Revision 21072
branches/v2_0_0_prep/libraries/libFMap/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/ArrowDecoratorStyle.java | ||
---|---|---|
45 | 45 |
import java.awt.geom.AffineTransform; |
46 | 46 |
|
47 | 47 |
import org.apache.batik.ext.awt.geom.PathLength; |
48 |
import org.gvsig.fmap.core.shapes.FPoint2D;
|
|
49 |
import org.gvsig.fmap.core.shapes.FShape;
|
|
48 |
import org.gvsig.fmap.geom.Geometry;
|
|
49 |
import org.gvsig.fmap.geom.primitive.Point2D;
|
|
50 | 50 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ArrowMarkerSymbol; |
51 | 51 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ILineSymbol; |
52 | 52 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IMarkerSymbol; |
... | ... | |
155 | 155 |
* @param affineTransform |
156 | 156 |
* @param shp |
157 | 157 |
*/ |
158 |
public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp) {
|
|
158 |
public void draw(Graphics2D g, AffineTransform affineTransform, Geometry geom) {
|
|
159 | 159 |
if (arrowMarkerCount <= 0) return; |
160 | 160 |
|
161 |
PathLength pl = new PathLength(shp);
|
|
161 |
PathLength pl = new PathLength(geom);
|
|
162 | 162 |
float size = (float) marker.getSize(); |
163 | 163 |
float myLineLength = pl.lengthOfPath()-size; // length without the first and last arrow |
164 | 164 |
float step = arrowMarkerCount>2 ? myLineLength/(arrowMarkerCount-1) : pl.lengthOfPath(); |
165 | 165 |
float rotation1; // rotation at the arrow's vertex |
166 | 166 |
float rotation2; // rotation at the arrow's back; |
167 | 167 |
|
168 |
FPoint2D startP;
|
|
168 |
Point2D startP; |
|
169 | 169 |
|
170 | 170 |
// the first arrow at the end of the line |
171 | 171 |
{ |
172 | 172 |
float theLength = pl.lengthOfPath(); |
173 | 173 |
|
174 | 174 |
if ((flipFirst || flipAll) && (flipFirst != flipAll)) { // logical XOR |
175 |
startP = new FPoint2D(pl.pointAtLength(theLength-size));
|
|
175 |
startP = new Point2D(pl.pointAtLength(theLength-size)); |
|
176 | 176 |
rotation1 = pl.angleAtLength(theLength-size); |
177 | 177 |
rotation2 = pl.angleAtLength(theLength); |
178 | 178 |
} else { |
179 |
startP = new FPoint2D(pl.pointAtLength(theLength));
|
|
179 |
startP = new Point2D(pl.pointAtLength(theLength)); |
|
180 | 180 |
rotation1 = pl.angleAtLength(theLength-size)+(float) Math.PI; |
181 | 181 |
rotation2 = pl.angleAtLength(theLength)+(float) Math.PI; |
182 | 182 |
|
... | ... | |
196 | 196 |
rotation2 = (float) pl.angleAtLength((float)(aLength+size)); |
197 | 197 |
|
198 | 198 |
if (flipAll) { |
199 |
startP = new FPoint2D(pl.pointAtLength(aLength));
|
|
199 |
startP = new Point2D(pl.pointAtLength(aLength)); |
|
200 | 200 |
|
201 | 201 |
} else { |
202 |
startP = new FPoint2D(pl.pointAtLength(aLength+size));
|
|
202 |
startP = new Point2D(pl.pointAtLength(aLength+size)); |
|
203 | 203 |
rotation1 += Math.PI; |
204 | 204 |
rotation2 += Math.PI; |
205 | 205 |
} |
... | ... | |
219 | 219 |
rotation1 = (float) pl.angleAtLength(aLength+1); |
220 | 220 |
rotation2 = (float) pl.angleAtLength((float)(aLength+size+1)); |
221 | 221 |
if (flipAll) { |
222 |
startP = new FPoint2D(pl.pointAtLength(aLength+1));
|
|
222 |
startP = new Point2D(pl.pointAtLength(aLength+1)); |
|
223 | 223 |
|
224 | 224 |
} else { |
225 |
startP = new FPoint2D(pl.pointAtLength(aLength+size+1));
|
|
225 |
startP = new Point2D(pl.pointAtLength(aLength+size+1)); |
|
226 | 226 |
rotation1 += Math.PI; |
227 | 227 |
rotation2 += Math.PI; |
228 | 228 |
} |
... | ... | |
241 | 241 |
rotation2 = (float) pl.angleAtLength(0); |
242 | 242 |
|
243 | 243 |
if (flipAll) { |
244 |
startP = new FPoint2D(pl.pointAtLength(0));
|
|
244 |
startP = new Point2D(pl.pointAtLength(0)); |
|
245 | 245 |
|
246 | 246 |
} else { |
247 |
startP = new FPoint2D(pl.pointAtLength(size));
|
|
247 |
startP = new Point2D(pl.pointAtLength(size)); |
|
248 | 248 |
rotation1 += Math.PI; |
249 | 249 |
rotation2 += Math.PI; |
250 | 250 |
} |
branches/v2_0_0_prep/libraries/libFMap/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/SimpleLineStyle.java | ||
---|---|---|
104 | 104 |
import java.awt.Rectangle; |
105 | 105 |
import java.awt.Stroke; |
106 | 106 |
|
107 |
import org.gvsig.fmap.core.shapes.FShape;
|
|
107 |
import org.gvsig.fmap.geom.Geometry;
|
|
108 | 108 |
import org.gvsig.fmap.mapcontext.ViewPort; |
109 | 109 |
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupport; |
110 | 110 |
import org.gvsig.fmap.mapcontext.rendering.symbols.CartographicSupportToolkit; |
... | ... | |
265 | 265 |
this.csOffset = offset * scale; |
266 | 266 |
} |
267 | 267 |
this.lineWidth = width; |
268 |
|
|
268 |
|
|
269 | 269 |
} |
270 | 270 |
|
271 | 271 |
public boolean isSuitableFor(ISymbol symbol) { |
... | ... | |
279 | 279 |
if (dashArray != null) { |
280 | 280 |
tempDashArray = new float[dashArray.length]; |
281 | 281 |
for (int i = 0; i < dashArray.length; i++) { |
282 |
tempDashArray[i] = dashArray[i];
|
|
282 |
tempDashArray[i] = dashArray[i]; |
|
283 | 283 |
} |
284 | 284 |
} else |
285 | 285 |
tempDashArray = null; |
286 | 286 |
|
287 |
|
|
287 |
|
|
288 | 288 |
dashPhase = dummy.getDashPhase(); |
289 | 289 |
endCap = dummy.getEndCap(); |
290 | 290 |
lineJoin = dummy.getLineJoin(); |
... | ... | |
330 | 330 |
this.referenceSystem = referenceSystem; |
331 | 331 |
} |
332 | 332 |
|
333 |
public double toCartographicSize(ViewPort viewPort, double dpi, FShape shp) {
|
|
333 |
public double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom) {
|
|
334 | 334 |
double oldWidth = getLineWidth(); |
335 |
setCartographicSize(getCartographicSize(viewPort, dpi, shp), shp);
|
|
335 |
setCartographicSize(getCartographicSize(viewPort, dpi, geom), geom);
|
|
336 | 336 |
return oldWidth; |
337 | 337 |
} |
338 | 338 |
|
339 |
public void setCartographicSize(double cartographicSize, FShape shp) {
|
|
339 |
public void setCartographicSize(double cartographicSize, Geometry geom) {
|
|
340 | 340 |
setLineWidth((float) cartographicSize); |
341 | 341 |
|
342 | 342 |
} |
343 | 343 |
|
344 |
public double getCartographicSize(ViewPort viewPort, double dpi, FShape shp) {
|
|
344 |
public double getCartographicSize(ViewPort viewPort, double dpi, Geometry geom) {
|
|
345 | 345 |
return CartographicSupportToolkit. |
346 | 346 |
getCartographicLength(this, |
347 | 347 |
getOffset(), |
branches/v2_0_0_prep/libraries/libFMap/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/IMask.java | ||
---|---|---|
45 | 45 |
import java.awt.Rectangle; |
46 | 46 |
import java.awt.Shape; |
47 | 47 |
|
48 |
import org.gvsig.fmap.core.shapes.FPolygon2D;
|
|
49 |
import org.gvsig.fmap.core.shapes.FShape;
|
|
50 |
import org.gvsig.fmap.core.shapes.GeneralPathX;
|
|
48 |
import org.gvsig.fmap.geom.Geometry;
|
|
49 |
import org.gvsig.fmap.geom.primitive.GeneralPathX;
|
|
50 |
import org.gvsig.fmap.geom.primitive.Surface2D;
|
|
51 | 51 |
import org.gvsig.fmap.mapcontext.rendering.symbols.IFillSymbol; |
52 | 52 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
53 | 53 |
|
... | ... | |
68 | 68 |
|
69 | 69 |
public void setFillSymbol(IFillSymbol fill); |
70 | 70 |
|
71 |
public FShape getHaloShape(Shape shp);
|
|
71 |
public Geometry getHaloShape(Shape shp);
|
|
72 | 72 |
|
73 | 73 |
/** |
74 | 74 |
* Class that implements the methods of the IMask interface showed above. |
... | ... | |
104 | 104 |
|
105 | 105 |
} |
106 | 106 |
|
107 |
public FShape getHaloShape(Shape shp) {
|
|
107 |
public Geometry getHaloShape(Shape shp) {
|
|
108 | 108 |
BasicStroke stroke = new BasicStroke((int) /*falta CartographicSupport*/getSize()); |
109 | 109 |
Shape myShp = stroke.createStrokedShape(shp); |
110 |
FShape haloShape = new FPolygon2D(new GeneralPathX(myShp.getBounds2D()));
|
|
110 |
Geometry haloShape = new Surface2D(new GeneralPathX(myShp.getBounds2D()));
|
|
111 | 111 |
|
112 | 112 |
return haloShape; |
113 | 113 |
} |
branches/v2_0_0_prep/libraries/libFMap/src/org/gvsig/fmap/mapcontext/rendering/symbols/styles/Line2DOffset.java | ||
---|---|---|
48 | 48 |
import java.util.Hashtable; |
49 | 49 |
|
50 | 50 |
import org.apache.log4j.Logger; |
51 |
import org.gvsig.fmap.core.shapes.GeneralPathX;
|
|
51 |
import org.gvsig.fmap.geom.primitive.GeneralPathX;
|
|
52 | 52 |
|
53 | 53 |
import com.vividsolutions.jts.geom.Coordinate; |
54 | 54 |
import com.vividsolutions.jts.geom.LineSegment; |
55 | 55 |
/** |
56 |
*
|
|
56 |
* |
|
57 | 57 |
* Line2DOffset.java |
58 | 58 |
* |
59 |
*
|
|
59 |
* |
|
60 | 60 |
* @author jaume dominguez faus - jaume.dominguez@iver.es Jan 3, 2008 |
61 | 61 |
* |
62 | 62 |
*/ |
... | ... | |
420 | 420 |
//* line1 (this): y - y0 = m*(x - x0) |
421 | 421 |
//* line2 (otherLine): y' - y'0 = m'*(x' - x'0) |
422 | 422 |
//*/ |
423 |
//if (otherLine.theta == this.theta)
|
|
423 |
//if (otherLine.theta == this.theta) |
|
424 | 424 |
//throw new ParallelLinesCannotBeResolvedException(this, otherLine); |
425 | 425 |
|
426 | 426 |
//if (Math.cos(theta) == 0) { |
Also available in: Unified diff