Revision 30335 branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/ScaleCADTool.java
ScaleCADTool.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package org.gvsig.editing.gui.cad.tools; |
42 | 42 |
|
43 |
import java.awt.Graphics; |
|
44 |
import java.awt.Graphics2D; |
|
45 | 43 |
import java.awt.Image; |
46 | 44 |
import java.awt.event.InputEvent; |
47 | 45 |
import java.awt.geom.AffineTransform; |
... | ... | |
74 | 72 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
75 | 73 |
import org.gvsig.fmap.geom.util.UtilFunctions; |
76 | 74 |
import org.gvsig.fmap.mapcontext.ViewPort; |
75 |
import org.gvsig.fmap.mapcontrol.MapControlDrawer; |
|
77 | 76 |
|
78 | 77 |
|
79 | 78 |
/** |
... | ... | |
234 | 233 |
* @param y |
235 | 234 |
* par?metro x del punto que se pase para dibujar. |
236 | 235 |
*/ |
237 |
public void drawOperation(Graphics g, double x, double y) {
|
|
236 |
public void drawOperation(MapControlDrawer renderer, double x, double y) {
|
|
238 | 237 |
ScaleCADToolState actualState = _fsm.getState(); |
239 | 238 |
String status = actualState.getName(); |
240 | 239 |
FeatureSet selection = null; |
... | ... | |
254 | 253 |
.toMapDistance( |
255 | 254 |
getCadToolAdapter().getMapControl().getWidth()); |
256 | 255 |
double scale = firstPoint.distance(currentPoint) / (size / 40); |
257 |
drawLine((Graphics2D) g, firstPoint, currentPoint,
|
|
258 |
DefaultCADTool.axisReferencesSymbol);
|
|
259 |
|
|
256 |
renderer.drawLine(firstPoint, currentPoint,
|
|
257 |
mapControlManager.getAxisReferenceSymbol());
|
|
258 |
|
|
260 | 259 |
if (selectionCount < CADTool.TOPGEOMETRY) { |
261 | 260 |
iterator = selection.iterator(); |
262 | 261 |
while (iterator.hasNext()) { |
... | ... | |
273 | 272 |
UtilFunctions.scaleGeom(geometry, firstPoint, scale, |
274 | 273 |
scale); |
275 | 274 |
|
276 |
DrawOperationContext doc = new DrawOperationContext(); |
|
277 |
doc.setGraphics((Graphics2D) g); |
|
278 |
doc.setViewPort(getCadToolAdapter().getMapControl() |
|
279 |
.getViewPort()); |
|
280 |
doc.setSymbol(DefaultCADTool.axisReferencesSymbol); |
|
281 |
try { |
|
282 |
geometry.invokeOperation(Draw.CODE, doc); |
|
283 |
} catch (GeometryOperationNotSupportedException e) { |
|
284 |
e.printStackTrace(); |
|
285 |
} catch (GeometryOperationException e) { |
|
286 |
e.printStackTrace(); |
|
287 |
} |
|
288 |
|
|
289 |
// geometry.draw((Graphics2D) g, getCadToolAdapter() |
|
290 |
// .getMapControl().getViewPort(), |
|
291 |
// DefaultCADTool.axisReferencesSymbol); |
|
292 |
|
|
275 |
renderer.draw(geometry, mapControlManager.getAxisReferenceSymbol()); |
|
293 | 276 |
} |
294 | 277 |
|
295 | 278 |
} else { |
... | ... | |
298 | 281 |
at.scale(scale, scale); |
299 | 282 |
at.translate(-point.getX(), -point.getY()); |
300 | 283 |
Image imgSel = vle.getSelectionImage(); |
301 |
try { |
|
302 |
((Graphics2D) g).drawImage(imgSel, at, null); |
|
303 |
} catch (ImagingOpException e) { |
|
304 |
} |
|
284 |
renderer.drawImage(imgSel, at); |
|
305 | 285 |
} |
306 | 286 |
PluginServices.getMainFrame().getStatusBar().setMessage("5", |
307 | 287 |
"Factor = " + scale); |
... | ... | |
327 | 307 |
UtilFunctions.scaleGeom(geometry, scalePoint, escalado, |
328 | 308 |
escalado); |
329 | 309 |
|
330 |
DrawOperationContext doc = new DrawOperationContext(); |
|
331 |
doc.setGraphics((Graphics2D) g); |
|
332 |
doc.setViewPort(getCadToolAdapter().getMapControl() |
|
333 |
.getViewPort()); |
|
334 |
doc.setSymbol(DefaultCADTool.axisReferencesSymbol); |
|
335 |
try { |
|
336 |
geometry.invokeOperation(Draw.CODE, doc); |
|
337 |
} catch (GeometryOperationNotSupportedException e) { |
|
338 |
e.printStackTrace(); |
|
339 |
} catch (GeometryOperationException e) { |
|
340 |
e.printStackTrace(); |
|
341 |
} |
|
342 |
|
|
343 |
// geometry.draw((Graphics2D) g, getCadToolAdapter() |
|
344 |
// .getMapControl().getViewPort(), |
|
345 |
// DefaultCADTool.axisReferencesSymbol); |
|
346 |
|
|
310 |
renderer.draw(geometry, mapControlManager.getAxisReferenceSymbol()); |
|
347 | 311 |
} |
348 | 312 |
} else { |
349 | 313 |
AffineTransform at = new AffineTransform(); |
... | ... | |
351 | 315 |
at.scale(escalado, escalado); |
352 | 316 |
at.translate(-point.getX(), -point.getY()); |
353 | 317 |
Image imgSel = vle.getSelectionImage(); |
354 |
try { |
|
355 |
((Graphics2D) g).drawImage(imgSel, at, null); |
|
356 |
} catch (ImagingOpException e) { |
|
357 |
} |
|
318 |
renderer.drawImage(imgSel, at); |
|
358 | 319 |
} |
359 |
drawLine((Graphics2D) g, firstPoint, new Point2D.Double(x, y),
|
|
360 |
DefaultCADTool.axisReferencesSymbol);
|
|
320 |
renderer.drawLine(firstPoint, new Point2D.Double(x, y),
|
|
321 |
mapControlManager.getAxisReferenceSymbol());
|
|
361 | 322 |
} |
362 | 323 |
} catch (DataException e) { |
363 | 324 |
e.printStackTrace(); |
Also available in: Unified diff