Revision 5878 trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/CircleCADTool.java
CircleCADTool.java | ||
---|---|---|
49 | 49 |
import com.iver.cit.gvsig.fmap.core.FShape; |
50 | 50 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
51 | 51 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
52 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
|
52 | 53 |
import com.iver.cit.gvsig.gui.cad.CADTool; |
53 | 54 |
import com.iver.cit.gvsig.gui.cad.DefaultCADTool; |
54 | 55 |
import com.iver.cit.gvsig.gui.cad.exception.CommandException; |
... | ... | |
120 | 121 |
if (status.equals("Circle.CenterPointOr3p")) { |
121 | 122 |
center = new Point2D.Double(x, y); |
122 | 123 |
} else if (status == "Circle.PointOrRadius") { |
123 |
addGeometry(ShapeFactory.createCircle(center, |
|
124 |
new Point2D.Double(x, y))); |
|
124 |
IGeometry geom=ShapeFactory.createCircle(center, |
|
125 |
new Point2D.Double(x, y)); |
|
126 |
// try { |
|
127 |
// if (getVLE().getVEA().getShapeType()==FShape.LINE) |
|
128 |
// geom.setGeometryType(FShape.LINE); |
|
129 |
// else |
|
130 |
// geom.setGeometryType(FShape.POLYGON); |
|
131 |
// } catch (DriverIOException e) { |
|
132 |
// e.printStackTrace(); |
|
133 |
// } |
|
134 |
addGeometry(geom); |
|
125 | 135 |
} else if (status == "Circle.FirstPoint") { |
126 | 136 |
firstPoint = new Point2D.Double(x, y); |
127 | 137 |
} else if (status == "Circle.SecondPoint") { |
128 | 138 |
secondPoint = new Point2D.Double(x, y); |
129 | 139 |
} else if (status == "Circle.ThirdPoint") { |
130 | 140 |
thirdPoint = new Point2D.Double(x, y); |
131 |
addGeometry(ShapeFactory.createCircle(firstPoint, secondPoint, |
|
132 |
thirdPoint)); |
|
141 |
IGeometry geom=ShapeFactory.createCircle(firstPoint, secondPoint, |
|
142 |
thirdPoint); |
|
143 |
// try { |
|
144 |
// if (getVLE().getVEA().getShapeType()==FShape.LINE) |
|
145 |
// geom.setGeometryType(FShape.LINE); |
|
146 |
// else |
|
147 |
// geom.setGeometryType(FShape.POLYGON); |
|
148 |
// } catch (DriverIOException e) { |
|
149 |
// e.printStackTrace(); |
|
150 |
// } |
|
151 |
addGeometry(geom); |
|
133 | 152 |
} |
134 | 153 |
} |
135 | 154 |
|
... | ... | |
156 | 175 |
|
157 | 176 |
if (status == "Circle.PointOrRadius") { |
158 | 177 |
Point2D currentPoint = new Point2D.Double(x, y); |
159 |
ShapeFactory.createCircle(center, currentPoint).draw((Graphics2D) g, |
|
160 |
getCadToolAdapter().getMapControl().getViewPort(), |
|
161 |
CADTool.drawingSymbol); |
|
178 |
IGeometry geom=ShapeFactory.createCircle(center, currentPoint); |
|
179 |
// try { |
|
180 |
// if (getVLE().getVEA().getShapeType()==FShape.LINE) |
|
181 |
// geom.setGeometryType(FShape.LINE); |
|
182 |
// else |
|
183 |
// geom.setGeometryType(FShape.POLYGON); |
|
184 |
// } catch (DriverIOException e) { |
|
185 |
// e.printStackTrace(); |
|
186 |
// } |
|
187 |
if (geom!=null) |
|
188 |
geom.drawInts((Graphics2D) g, |
|
189 |
getCadToolAdapter().getMapControl().getViewPort(), |
|
190 |
CADTool.drawingSymbol); |
|
162 | 191 |
} else if (status == "Circle.SecondPoint") { |
163 | 192 |
drawLine((Graphics2D) g, firstPoint, new Point2D.Double(x, y)); |
164 | 193 |
} else if (status == "Circle.ThirdPoint") { |
165 | 194 |
Point2D currentPoint = new Point2D.Double(x, y); |
166 | 195 |
IGeometry geom = ShapeFactory.createCircle(firstPoint, secondPoint, |
167 | 196 |
currentPoint); |
168 |
|
|
197 |
// try { |
|
198 |
// if (getVLE().getVEA().getShapeType()==FShape.LINE) |
|
199 |
// geom.setGeometryType(FShape.LINE); |
|
200 |
// else |
|
201 |
// geom.setGeometryType(FShape.POLYGON); |
|
202 |
// } catch (DriverIOException e) { |
|
203 |
// e.printStackTrace(); |
|
204 |
// } |
|
169 | 205 |
if (geom != null) { |
170 |
geom.draw((Graphics2D) g, |
|
206 |
geom.drawInts((Graphics2D) g,
|
|
171 | 207 |
getCadToolAdapter().getMapControl().getViewPort(), |
172 | 208 |
CADTool.drawingSymbol); |
173 | 209 |
} |
... | ... | |
199 | 235 |
String status = actualState.getName(); |
200 | 236 |
|
201 | 237 |
if (status == "Circle.PointOrRadius") { |
202 |
addGeometry(ShapeFactory.createCircle(center, d)); |
|
238 |
IGeometry geom=ShapeFactory.createCircle(center, d); |
|
239 |
// try { |
|
240 |
// if (getVLE().getVEA().getShapeType()==FShape.LINE) |
|
241 |
// geom.setGeometryType(FShape.LINE); |
|
242 |
// else |
|
243 |
// geom.setGeometryType(FShape.POLYGON); |
|
244 |
// } catch (DriverIOException e) { |
|
245 |
// e.printStackTrace(); |
|
246 |
// } |
|
247 |
addGeometry(geom); |
|
203 | 248 |
} |
204 | 249 |
} |
205 | 250 |
|
Also available in: Unified diff