Revision 30335 branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/BreakCADTool.java
BreakCADTool.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.PathIterator; |
... | ... | |
72 | 70 |
import org.gvsig.fmap.geom.util.Converter; |
73 | 71 |
import org.gvsig.fmap.mapcontext.ViewPort; |
74 | 72 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
73 |
import org.gvsig.fmap.mapcontrol.MapControlDrawer; |
|
75 | 74 |
|
76 | 75 |
|
77 | 76 |
/** |
... | ... | |
315 | 314 |
GeneralPathX newGp2 = new GeneralPathX(); |
316 | 315 |
Geometry geomAux = (Geometry) rowEdited.getDefaultGeometry(); |
317 | 316 |
PathIterator theIterator = geomAux.getPathIterator(null, |
318 |
Converter.FLATNESS);
|
|
317 |
geomManager.getFlatness());
|
|
319 | 318 |
Point2D[] pointsOrdered = getOrderPoints(geomAux); |
320 | 319 |
double[] theData = new double[6]; |
321 | 320 |
boolean isFirstPart = true; |
... | ... | |
452 | 451 |
// vea.startComplexRow(); |
453 | 452 |
if (gpx.isClosed()) { |
454 | 453 |
|
455 |
newGp2.append(newGp1.getPathIterator(null, Converter.FLATNESS),
|
|
454 |
newGp2.append(newGp1.getPathIterator(null, geomManager.getFlatness()),
|
|
456 | 455 |
true); |
457 | 456 |
Geometry geom1 = createCurve(newGp2); |
458 | 457 |
|
... | ... | |
502 | 501 |
|
503 | 502 |
private Point2D[] getOrderPoints(Geometry geomAux) { |
504 | 503 |
PathIterator theIterator = geomAux.getPathIterator(null, |
505 |
Converter.FLATNESS);
|
|
504 |
geomManager.getFlatness());
|
|
506 | 505 |
double[] theData = new double[6]; |
507 | 506 |
Point2D previous = null; |
508 | 507 |
ArrayList points = new ArrayList(); |
... | ... | |
634 | 633 |
* @param y |
635 | 634 |
* par?metro x del punto que se pase para dibujar. |
636 | 635 |
*/ |
637 |
public void drawOperation(Graphics g, double x, double y) {
|
|
636 |
public void drawOperation(MapControlDrawer renderer, double x, double y) {
|
|
638 | 637 |
VectorialLayerEdited vle = getVLE(); |
639 | 638 |
FeatureSet selection = null; |
640 | 639 |
try { |
... | ... | |
649 | 648 |
Geometry g2 = createCircle(createPoint(firstPoint), vp |
650 | 649 |
.toMapDistance(5)); |
651 | 650 |
|
652 |
DrawOperationContext doc = new DrawOperationContext(); |
|
653 |
doc.setGraphics((Graphics2D) g); |
|
654 |
doc.setViewPort(vp); |
|
655 |
doc.setSymbol(DefaultCADTool.axisReferencesSymbol); |
|
656 |
try { |
|
657 |
g1.invokeOperation(Draw.CODE, doc); |
|
658 |
g2.invokeOperation(Draw.CODE, doc); |
|
659 |
} catch (GeometryOperationNotSupportedException e) { |
|
660 |
e.printStackTrace(); |
|
661 |
} catch (GeometryOperationException e) { |
|
662 |
e.printStackTrace(); |
|
663 |
} |
|
664 |
|
|
665 |
// g1.draw((Graphics2D)g,vp,DefaultCADTool.axisReferencesSymbol); |
|
666 |
// g2.draw((Graphics2D)g,vp,DefaultCADTool.axisReferencesSymbol); |
|
651 |
renderer.draw(g1, mapControlManager.getAxisReferenceSymbol()); |
|
652 |
renderer.draw(g2, mapControlManager.getAxisReferenceSymbol()); |
|
667 | 653 |
} |
668 | 654 |
rowEdited = (Feature) selection.iterator().next(); |
669 |
// .getLinkedRow() |
|
670 |
// .cloneRow(); |
|
671 | 655 |
Geometry geom = ((Geometry) rowEdited.getDefaultGeometry()) |
672 | 656 |
.cloneGeometry(); |
673 |
if (intersects(geom, new Point2D.Double(x, y))) { |
|
674 |
DrawOperationContext doc = new DrawOperationContext(); |
|
675 |
doc.setGraphics((Graphics2D) g); |
|
676 |
doc.setViewPort(vp); |
|
677 |
doc.setSymbol(DefaultCADTool.geometrySelectSymbol); |
|
678 |
try { |
|
679 |
geom.invokeOperation(Draw.CODE, doc); |
|
680 |
} catch (GeometryOperationNotSupportedException e) { |
|
681 |
e.printStackTrace(); |
|
682 |
} catch (GeometryOperationException e) { |
|
683 |
e.printStackTrace(); |
|
684 |
} |
|
685 |
|
|
686 |
// geom.draw((Graphics2D)g,vp,DefaultCADTool.geometrySelectSymbol); |
|
657 |
if (intersects(geom, new Point2D.Double(x, y))) { |
|
658 |
renderer.draw(geom, mapControlManager.getGeometrySelectionSymbol()); |
|
687 | 659 |
} |
688 | 660 |
}else{ |
689 | 661 |
if (!vle.getLayer().isVisible()) |
690 | 662 |
return; |
691 | 663 |
try{ |
692 | 664 |
Image imgSel = vle.getSelectionImage(); |
693 |
if (imgSel!=null)
|
|
694 |
g.drawImage(imgSel, 0, 0, null); |
|
665 |
renderer.drawImage(imgSel, 0, 0);
|
|
666 |
|
|
695 | 667 |
Image imgHand = vle.getHandlersImage(); |
696 |
if (imgHand!=null) |
|
697 |
g.drawImage(imgHand, 0, 0, null); |
|
668 |
renderer.drawImage(imgHand, 0, 0); |
|
698 | 669 |
}catch (Exception e) { |
699 | 670 |
} |
700 | 671 |
} |
Also available in: Unified diff