Revision 30335 branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/CircleCADTool.java
CircleCADTool.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package org.gvsig.editing.gui.cad.tools; |
42 | 42 |
|
43 |
import java.awt.Graphics; |
|
44 | 43 |
import java.awt.Graphics2D; |
45 | 44 |
import java.awt.Image; |
46 | 45 |
import java.awt.event.InputEvent; |
... | ... | |
57 | 56 |
import org.gvsig.fmap.geom.operation.DrawOperationContext; |
58 | 57 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
59 | 58 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
59 |
import org.gvsig.fmap.geom.primitive.Circle; |
|
60 |
import org.gvsig.fmap.mapcontrol.MapControlDrawer; |
|
60 | 61 |
|
61 | 62 |
|
62 | 63 |
|
... | ... | |
147 | 148 |
* @param x par?metro x del punto que se pase para dibujar. |
148 | 149 |
* @param y par?metro x del punto que se pase para dibujar. |
149 | 150 |
*/ |
150 |
public void drawOperation(Graphics g,double x,
|
|
151 |
public void drawOperation(MapControlDrawer renderer,double x,
|
|
151 | 152 |
double y) { |
152 | 153 |
CircleCADToolState actualState = _fsm.getState(); |
153 | 154 |
String status = actualState.getName(); |
... | ... | |
155 | 156 |
if ((status == "Circle.CenterPointOr3p")) { // || (status == "5")) { |
156 | 157 |
|
157 | 158 |
if (firstPoint != null) { |
158 |
drawLine((Graphics2D) g, firstPoint, new Point2D.Double(x, y),DefaultCADTool.geometrySelectSymbol);
|
|
159 |
renderer.drawLine(firstPoint, new Point2D.Double(x, y), mapControlManager.getGeometrySelectionSymbol());
|
|
159 | 160 |
} |
160 | 161 |
} |
161 | 162 |
|
162 | 163 |
if (status == "Circle.PointOrRadius") { |
163 | 164 |
Point2D currentPoint = new Point2D.Double(x, y); |
164 | 165 |
DrawOperationContext doc=new DrawOperationContext(); |
165 |
doc.setGraphics((Graphics2D)g); |
|
166 |
doc.setViewPort(getCadToolAdapter().getMapControl().getViewPort()); |
|
167 |
doc.setSymbol(DefaultCADTool.axisReferencesSymbol); |
|
168 |
try { |
|
169 |
createCircle(createPoint(center), createPoint(currentPoint)).invokeOperation(Draw.CODE,doc); |
|
170 |
} catch (GeometryOperationNotSupportedException e) { |
|
171 |
e.printStackTrace(); |
|
172 |
} catch (GeometryOperationException e) { |
|
173 |
e.printStackTrace(); |
|
174 |
} |
|
166 |
Circle circle = createCircle(createPoint(center), createPoint(currentPoint)); |
|
167 |
renderer.draw(circle, mapControlManager.getAxisReferenceSymbol()); |
|
175 | 168 |
} else if (status == "Circle.SecondPoint") { |
176 |
drawLine((Graphics2D) g, firstPoint, new Point2D.Double(x, y),DefaultCADTool.geometrySelectSymbol);
|
|
169 |
renderer.drawLine(firstPoint, new Point2D.Double(x, y), mapControlManager.getGeometrySelectionSymbol());
|
|
177 | 170 |
} else if (status == "Circle.ThirdPoint") { |
178 | 171 |
Point2D currentPoint = new Point2D.Double(x, y); |
179 | 172 |
Geometry geom = createCircle(createPoint(firstPoint), |
... | ... | |
181 | 174 |
createPoint(currentPoint)); |
182 | 175 |
|
183 | 176 |
if (geom != null) { |
184 |
DrawOperationContext doc=new DrawOperationContext(); |
|
185 |
doc.setGraphics((Graphics2D)g); |
|
186 |
doc.setViewPort(getCadToolAdapter().getMapControl().getViewPort()); |
|
187 |
doc.setSymbol(DefaultCADTool.axisReferencesSymbol); |
|
188 |
try { |
|
189 |
geom.invokeOperation(Draw.CODE,doc); |
|
190 |
} catch (GeometryOperationNotSupportedException e) { |
|
191 |
e.printStackTrace(); |
|
192 |
} catch (GeometryOperationException e) { |
|
193 |
e.printStackTrace(); |
|
194 |
} |
|
177 |
renderer.draw(geom, mapControlManager.getAxisReferenceSymbol()); |
|
195 | 178 |
} |
196 | 179 |
}else{ |
197 | 180 |
VectorialLayerEdited vle=getVLE(); |
... | ... | |
199 | 182 |
return; |
200 | 183 |
try{ |
201 | 184 |
Image imgSel = vle.getSelectionImage(); |
202 |
if (imgSel!=null)
|
|
203 |
g.drawImage(imgSel, 0, 0, null); |
|
185 |
renderer.drawImage(imgSel, 0, 0);
|
|
186 |
|
|
204 | 187 |
Image imgHand = vle.getHandlersImage(); |
205 |
if (imgHand!=null) |
|
206 |
g.drawImage(imgHand, 0, 0, null); |
|
188 |
renderer.drawImage(imgHand, 0, 0); |
|
207 | 189 |
}catch (Exception e) { |
208 | 190 |
} |
209 | 191 |
} |
Also available in: Unified diff