Revision 12297
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/PolygonCADTool.java | ||
---|---|---|
46 | 46 |
import java.awt.geom.Point2D; |
47 | 47 |
|
48 | 48 |
import com.iver.andami.PluginServices; |
49 |
import com.iver.cit.gvsig.fmap.core.FPolygon2D; |
|
49 | 50 |
import com.iver.cit.gvsig.fmap.core.FPolyline2D; |
50 | 51 |
import com.iver.cit.gvsig.fmap.core.FShape; |
51 | 52 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
... | ... | |
260 | 261 |
} |
261 | 262 |
//elShape.lineTo(firstPoint.getX(),firstPoint.getY()); |
262 | 263 |
elShape.closePath(); |
263 |
return ShapeFactory.createGeometry(new FPolyline2D(elShape)); |
|
264 |
int type=getCadToolAdapter().getActiveLayerType(); |
|
265 |
FShape shape=null; |
|
266 |
if (type==FShape.POLYGON){ |
|
267 |
shape=new FPolygon2D(elShape); |
|
268 |
}else{ |
|
269 |
shape=new FPolyline2D(elShape); |
|
270 |
} |
|
271 |
return ShapeFactory.createGeometry(shape); |
|
264 | 272 |
} |
265 | 273 |
|
266 | 274 |
/** |
... | ... | |
298 | 306 |
} |
299 | 307 |
//elShape.lineTo(firstPoint.getX(),firstPoint.getY()); |
300 | 308 |
elShape.closePath(); |
301 |
return ShapeFactory.createGeometry(new FPolyline2D(elShape)); |
|
309 |
int type=getCadToolAdapter().getActiveLayerType(); |
|
310 |
FShape shape=null; |
|
311 |
if (type==FShape.POLYGON){ |
|
312 |
shape=new FPolygon2D(elShape); |
|
313 |
}else{ |
|
314 |
shape=new FPolyline2D(elShape); |
|
315 |
} |
|
316 |
return ShapeFactory.createGeometry(shape); |
|
302 | 317 |
} |
303 | 318 |
/** |
304 | 319 |
* Devuelve la geometr?a con el poligono regular circunscrito a la |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/PolylineCADTool.java | ||
---|---|---|
117 | 117 |
e.printStackTrace(); |
118 | 118 |
} |
119 | 119 |
|
120 |
IGeometry newGeom = ShapeFactory.createPolyline2D(gpx); |
|
120 |
IGeometry newGeom = null; |
|
121 |
int type=getCadToolAdapter().getActiveLayerType(); |
|
122 |
if (type==FShape.POLYGON){ |
|
123 |
newGeom = ShapeFactory.createPolygon2D(gpx); |
|
124 |
}else{ |
|
125 |
newGeom = ShapeFactory.createPolyline2D(gpx); |
|
126 |
} |
|
121 | 127 |
addGeometry(newGeom); |
122 | 128 |
_fsm = new PolylineCADToolContext(this); |
123 | 129 |
list.clear(); |
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/RectangleCADTool.java | ||
---|---|---|
128 | 128 |
elShape.lineTo(firstPoint.getX(), lastPoint.getY()); |
129 | 129 |
//elShape.lineTo(firstPoint.getX(), firstPoint.getY()); |
130 | 130 |
elShape.closePath(); |
131 |
addGeometry(ShapeFactory.createPolyline2D(elShape)); |
|
131 |
int type=getCadToolAdapter().getActiveLayerType(); |
|
132 |
if (type==FShape.POLYGON){ |
|
133 |
addGeometry(ShapeFactory.createPolygon2D(elShape)); |
|
134 |
}else{ |
|
135 |
addGeometry(ShapeFactory.createPolyline2D(elShape)); |
|
136 |
} |
|
132 | 137 |
firstPoint = (Point2D) lastPoint.clone(); |
133 | 138 |
} else if (status == "Rectangle.SecondPointSquare") { |
134 | 139 |
lastPoint = new Point2D.Double(x, y); |
... | ... | |
154 | 159 |
|
155 | 160 |
//elShape.lineTo(firstPoint.getX(), firstPoint.getY()); |
156 | 161 |
elShape.closePath(); |
157 |
addGeometry(ShapeFactory.createPolyline2D(elShape)); |
|
162 |
int type=getCadToolAdapter().getActiveLayerType(); |
|
163 |
if (type==FShape.POLYGON){ |
|
164 |
addGeometry(ShapeFactory.createPolygon2D(elShape)); |
|
165 |
}else{ |
|
166 |
addGeometry(ShapeFactory.createPolyline2D(elShape)); |
|
167 |
} |
|
158 | 168 |
firstPoint = (Point2D) lastPoint.clone(); |
159 | 169 |
} |
160 | 170 |
} |
Also available in: Unified diff