Revision 37328 branches/v2_0_0_prep/extensions/extEditing/src/org/gvsig/editing/gui/cad/tools/LineCADTool.java

View differences:

LineCADTool.java
25 25
import java.awt.geom.Point2D;
26 26

  
27 27
import org.gvsig.andami.PluginServices;
28
import org.gvsig.editing.gui.cad.DefaultCADTool;
29 28
import org.gvsig.editing.gui.cad.exception.CommandException;
30 29
import org.gvsig.editing.gui.cad.tools.smc.LineCADToolContext;
31 30
import org.gvsig.editing.gui.cad.tools.smc.LineCADToolContext.LineCADToolState;
32
import org.gvsig.fmap.geom.Geometry;
33 31
import org.gvsig.fmap.geom.primitive.GeneralPathX;
34 32
import org.gvsig.fmap.mapcontrol.MapControlDrawer;
35 33

  
......
38 36
 * 
39 37
 * @author Vicente Caballero Navarro
40 38
 */
41
public class LineCADTool extends DefaultCADTool {
39
public class LineCADTool extends AbstractCurveCADTool {
42 40

  
43 41
    protected LineCADToolContext _fsm;
44 42
    protected Point2D firstPoint;
......
47 45
    protected double length;
48 46

  
49 47
    /**
50
     * Crea un nuevo LineCADTool.
51
     */
52
    public LineCADTool() {
53

  
54
    }
55

  
56
    /**
57 48
     * M?todo de incio, para poner el c?digo de todo lo que se requiera de una
58 49
     * carga previa a la utilizaci?n de la herramienta.
59 50
     */
......
61 52
        _fsm = new LineCADToolContext(this);
62 53
    }
63 54

  
64
    /*
65
     * (non-Javadoc)
66
     * 
67
     * @see
68
     * com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap
69
     * .layers.FBitSet, double, double)
70
     */
71 55
    public void transition(double x, double y, InputEvent event) {
72 56
        _fsm.addPoint(x, y, event);
73 57
    }
74 58

  
75
    /*
76
     * (non-Javadoc)
77
     * 
78
     * @see
79
     * com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap
80
     * .layers.FBitSet, double)
81
     */
82 59
    public void transition(double d) {
83 60
        _fsm.addValue(d);
84 61
    }
85 62

  
86
    /*
87
     * (non-Javadoc)
88
     * 
89
     * @see
90
     * com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap
91
     * .layers.FBitSet, java.lang.String)
92
     */
93 63
    public void transition(String s) throws CommandException {
94 64
        if (!super.changeCommand(s)) {
95 65
            _fsm.addOption(s);
......
179 149
     *            Diferent option.
180 150
     */
181 151
    public void addOption(String s) {
182
        // TODO Auto-generated method stub
152
        // Nothing to do
183 153
    }
184 154

  
185
    /*
186
     * (non-Javadoc)
187
     * 
188
     * @see com.iver.cit.gvsig.gui.cad.CADTool#addvalue(double)
189
     */
190 155
    public void addValue(double d) {
191 156
        LineCADToolState actualState =
192 157
            (LineCADToolState) _fsm.getPreviousState();
......
221 186
        return "_line";
222 187
    }
223 188

  
224
    public boolean isApplicable(int shapeType) {
225
        switch (shapeType) {
226
        case Geometry.TYPES.POINT:
227
        case Geometry.TYPES.MULTIPOINT:
228
        case Geometry.TYPES.SURFACE:
229
        case Geometry.TYPES.MULTISURFACE:
230

  
231
            return false;
232
        }
233
        return true;
189
    @Override
190
    protected int getSupportedPrimitiveGeometryType() {
191
        return CURVE;
234 192
    }
235 193
}

Also available in: Unified diff