Revision 40389 branches/v2_0_0_prep/libraries/libFMap_controls/src/org/gvsig/fmap/mapcontrol/impl/MapControlDrawer2D.java
MapControlDrawer2D.java | ||
---|---|---|
37 | 37 |
import org.gvsig.fmap.geom.GeometryLocator; |
38 | 38 |
import org.gvsig.fmap.geom.GeometryManager; |
39 | 39 |
import org.gvsig.fmap.geom.handler.Handler; |
40 |
|
|
40 | 41 |
import org.gvsig.fmap.geom.operation.Draw; |
41 | 42 |
import org.gvsig.fmap.geom.operation.DrawOperationContext; |
42 | 43 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
43 | 44 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
44 | 45 |
import org.gvsig.fmap.geom.primitive.Curve; |
45 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
|
46 | 46 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
47 | 47 |
import org.gvsig.fmap.mapcontext.ViewPort; |
48 | 48 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
... | ... | |
99 | 99 |
* @see org.gvsig.fmap.mapcontrol.tools.renderer.Renderer#drawLine(java.awt.geom.Point2D, java.awt.geom.Point2D, org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol) |
100 | 100 |
*/ |
101 | 101 |
public void drawLine(Point2D firstPoint, Point2D endPoint, ISymbol symbol) { |
102 |
GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD, 2); |
|
103 |
elShape.moveTo(firstPoint.getX(), firstPoint.getY()); |
|
104 |
elShape.lineTo(endPoint.getX(), endPoint.getY()); |
|
105 | 102 |
DrawOperationContext doc = new DrawOperationContext(); |
106 | 103 |
doc.setGraphics(graphics); |
107 | 104 |
doc.setViewPort(viewPort); |
108 | 105 |
doc.setSymbol(symbol); |
109 | 106 |
try { |
110 | 107 |
Curve curve = (Curve)geomManager.create(Geometry.TYPES.CURVE, Geometry.SUBTYPES.GEOM2D); |
111 |
curve.setGeneralPath(elShape); |
|
108 |
curve.addVertex(geomManager.createPoint(firstPoint.getX(), firstPoint.getY(), Geometry.SUBTYPES.GEOM2D) ); |
|
109 |
curve.addVertex(geomManager.createPoint(endPoint.getX(), endPoint.getY(), Geometry.SUBTYPES.GEOM2D) ); |
|
112 | 110 |
curve.invokeOperation(Draw.CODE, doc); |
113 | 111 |
} catch (GeometryOperationNotSupportedException e) { |
114 | 112 |
e.printStackTrace(); |
Also available in: Unified diff