Revision 3883 trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/PolylineCADTool.java
PolylineCADTool.java | ||
---|---|---|
75 | 75 |
* Crea un nuevo PolylineCADTool. |
76 | 76 |
*/ |
77 | 77 |
public PolylineCADTool() { |
78 |
_fsm = new PolylineCADToolContext(this); |
|
78 |
|
|
79 | 79 |
} |
80 | 80 |
|
81 | 81 |
/** |
... | ... | |
83 | 83 |
* carga previa a la utilizaci?n de la herramienta. |
84 | 84 |
*/ |
85 | 85 |
public void init() { |
86 |
_fsm = new PolylineCADToolContext(this); |
|
86 | 87 |
} |
87 | 88 |
|
88 |
/* (non-Javadoc) |
|
89 |
* @see com.iver.cit.gvsig.gui.cad.CADTool#end() |
|
90 |
*/ |
|
91 |
public void end() { |
|
89 |
public void endGeometry() { |
|
92 | 90 |
IGeometry[] geoms = (IGeometry[]) list.toArray(new IGeometry[0]); |
93 | 91 |
FGeometryCollection fgc = new FGeometryCollection(geoms); |
94 | 92 |
addGeometry(fgc); |
95 | 93 |
_fsm = new PolylineCADToolContext(this); |
96 |
firstPoint = null; |
|
94 |
list.clear(); |
|
95 |
antantPoint=antCenter=antInter=antPoint=firstPoint=null; |
|
97 | 96 |
} |
97 |
public void closeGeometry(){ |
|
98 |
GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD, |
|
99 |
2); |
|
100 |
elShape.moveTo(antPoint.getX(), antPoint.getY()); |
|
101 |
elShape.lineTo(firstPoint.getX(), firstPoint.getY()); |
|
98 | 102 |
|
103 |
list.add(ShapeFactory.createPolyline2D(elShape)); |
|
104 |
list.add(ShapeFactory.createPolyline2D(elShape)); |
|
105 |
|
|
106 |
} |
|
99 | 107 |
/* (non-Javadoc) |
100 | 108 |
* @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, double, double) |
101 | 109 |
*/ |
102 | 110 |
public void transition(double x, double y) { |
103 |
_fsm.addPoint(x, y);
|
|
111 |
((PolylineCADToolContext)_fsm).addPoint(x, y);
|
|
104 | 112 |
} |
105 | 113 |
|
106 | 114 |
/* (non-Javadoc) |
... | ... | |
114 | 122 |
* @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, java.lang.String) |
115 | 123 |
*/ |
116 | 124 |
public void transition(String s) { |
117 |
_fsm.addOption(s);
|
|
125 |
((PolylineCADToolContext)_fsm).addOption(s);
|
|
118 | 126 |
} |
119 | 127 |
|
120 | 128 |
/** |
... | ... | |
126 | 134 |
* @param y par?metro y del punto que se pase en esta transici?n. |
127 | 135 |
*/ |
128 | 136 |
public void addPoint(double x, double y) { |
129 |
PolylineCADToolState actualState = (PolylineCADToolState) _fsm.getPreviousState();
|
|
137 |
PolylineCADToolState actualState = (PolylineCADToolState) _fsm.getPreviousState();
|
|
130 | 138 |
String status = actualState.getName(); |
131 | 139 |
|
132 | 140 |
if (status.equals("ExecuteMap.Initial")) { |
... | ... | |
269 | 277 |
*/ |
270 | 278 |
public void drawOperation(Graphics g, double x, |
271 | 279 |
double y) { |
272 |
PolylineCADToolState actualState = _fsm.getState();
|
|
280 |
PolylineCADToolState actualState = ((PolylineCADToolContext)_fsm).getState();
|
|
273 | 281 |
String status = actualState.getName(); |
274 | 282 |
|
275 | 283 |
if (status.equals("ExecuteMap.First")) { |
... | ... | |
421 | 429 |
*/ |
422 | 430 |
public void addValue(double d) { |
423 | 431 |
} |
432 |
|
|
433 |
public void cancel(){ |
|
434 |
list.clear(); |
|
435 |
antantPoint=antCenter=antInter=antPoint=firstPoint=null; |
|
436 |
} |
|
424 | 437 |
} |
Also available in: Unified diff