Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_911 / extensions / extCAD / src / com / iver / cit / gvsig / gui / cad / tools / PolylineCADTool.java @ 11388

History | View | Annotate | Download (19.6 KB)

1 3765 caballero
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41 3782 caballero
package com.iver.cit.gvsig.gui.cad.tools;
42
43 3832 caballero
import java.awt.Graphics;
44
import java.awt.Graphics2D;
45 4313 fjp
import java.awt.event.InputEvent;
46 3832 caballero
import java.awt.geom.Point2D;
47
import java.util.ArrayList;
48
49 5747 fjp
import org.apache.log4j.Logger;
50
51 4584 caballero
import com.iver.andami.PluginServices;
52 3782 caballero
import com.iver.cit.gvsig.fmap.core.FGeometryCollection;
53
import com.iver.cit.gvsig.fmap.core.FShape;
54
import com.iver.cit.gvsig.fmap.core.GeneralPathX;
55
import com.iver.cit.gvsig.fmap.core.IGeometry;
56
import com.iver.cit.gvsig.fmap.core.ShapeFactory;
57 6714 caballero
import com.iver.cit.gvsig.fmap.core.v02.FConverter;
58 5747 fjp
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
59 3782 caballero
import com.iver.cit.gvsig.fmap.edition.UtilFunctions;
60
import com.iver.cit.gvsig.gui.cad.CADTool;
61 3832 caballero
import com.iver.cit.gvsig.gui.cad.DefaultCADTool;
62 5735 caballero
import com.iver.cit.gvsig.gui.cad.exception.CommandException;
63 3782 caballero
import com.iver.cit.gvsig.gui.cad.tools.smc.PolylineCADToolContext;
64
import com.iver.cit.gvsig.gui.cad.tools.smc.PolylineCADToolContext.PolylineCADToolState;
65
66
67
/**
68
 * DOCUMENT ME!
69
 *
70
 * @author Vicente Caballero Navarro
71
 */
72 3765 caballero
public class PolylineCADTool extends DefaultCADTool {
73 5747 fjp
        private static Logger logger = Logger.getLogger(PolylineCADTool.class.getName());
74 3765 caballero
    private PolylineCADToolContext _fsm;
75
    private Point2D firstPoint;
76
    private Point2D antPoint;
77
    private Point2D antantPoint;
78
    private Point2D antCenter;
79 3782 caballero
    private Point2D antInter;
80
    private ArrayList list = new ArrayList();
81 6161 caballero
        private boolean close=false;
82 3782 caballero
83
    /**
84 3765 caballero
     * Crea un nuevo PolylineCADTool.
85
     */
86
    public PolylineCADTool() {
87 3883 caballero
88 3765 caballero
    }
89
90
    /**
91
     * M?todo de incio, para poner el c?digo de todo lo que se requiera de una
92
     * carga previa a la utilizaci?n de la herramienta.
93
     */
94
    public void init() {
95 5170 caballero
        _fsm = new PolylineCADToolContext(this);
96 3765 caballero
    }
97 11144 caballero
    public IGeometry getGeometry() {
98
                IGeometry[] geoms = (IGeometry[]) list.toArray(new IGeometry[0]);
99
                FGeometryCollection fgc = new FGeometryCollection(geoms);
100
                // No queremos guardar FGeometryCollections:
101
                GeneralPathX gp = new GeneralPathX();
102
                gp.append(fgc.getPathIterator(null, FConverter.FLATNESS), true);
103
                IGeometry newGeom = ShapeFactory.createPolyline2D(gp);
104
                return newGeom;
105
        }
106 3883 caballero
    public void endGeometry() {
107 9443 caballero
             try {
108
                         if (getVLE().getVEA().getShapeType()==FShape.POLYGON && !close){
109
                                 closeGeometry();
110
                         }
111
                 } catch (DriverIOException e) {
112
                         e.printStackTrace();
113
                 }
114
            IGeometry[] geoms = (IGeometry[]) list.toArray(new IGeometry[0]);
115 3846 caballero
        FGeometryCollection fgc = new FGeometryCollection(geoms);
116 5880 fjp
117 9443 caballero
118 5880 fjp
        // No queremos guardar FGeometryCollections:
119
        GeneralPathX gp = new GeneralPathX();
120 7072 caballero
        gp.append(fgc.getPathIterator(null,FConverter.FLATNESS), true);
121 5880 fjp
        IGeometry newGeom = ShapeFactory.createPolyline2D(gp);
122 6034 fjp
//        if (gp.isClosed())
123
//        {
124
//                gp.ensureOrientation(false); // Poligono exterior.
125
//                // Voy a testear que se puede convertir a JTS:
126
//                IGeometry gAux = ShapeFactory.createPolygon2D(gp);
127
//                Geometry jtsG = gAux.toJTSGeometry();
128
//                logger.debug("A punto de escribir " + jtsG.toText());
129
//                try {
130
//                        int shapeType = getVLE().getVEA().getShapeType();
131
//                                if ((shapeType ==FShape.POLYGON) || (shapeType == FShape.MULTI)) {
132
//                                        newGeom = gAux;
133
//                                }
134
//                        } catch (DriverIOException e) {
135
//                                // TODO Auto-generated catch block
136
//                                e.printStackTrace();
137
//                                return;
138
//                        }
139
//
140
//        }
141
//
142 5880 fjp
        addGeometry(newGeom);
143 3782 caballero
        _fsm = new PolylineCADToolContext(this);
144 3883 caballero
        list.clear();
145 9443 caballero
        close=false;
146 3883 caballero
        antantPoint=antCenter=antInter=antPoint=firstPoint=null;
147 3765 caballero
    }
148 3883 caballero
    public void closeGeometry(){
149 6161 caballero
            close=true;
150 5170 caballero
        GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD,
151
                2);
152
        elShape.moveTo(antPoint.getX(), antPoint.getY());
153
        elShape.lineTo(firstPoint.getX(), firstPoint.getY());
154 3765 caballero
155 5170 caballero
        list.add(ShapeFactory.createPolyline2D(elShape));
156 5747 fjp
157 5945 caballero
158 5170 caballero
        // list.add(ShapeFactory.createPolyline2D(elShape));
159 5880 fjp
160 3883 caballero
    }
161 3765 caballero
    /* (non-Javadoc)
162 3782 caballero
     * @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, double, double)
163
     */
164 4313 fjp
    public void transition(double x, double y, InputEvent event) {
165 4324 caballero
        _fsm.addPoint(x, y, event);
166 3765 caballero
    }
167
168
    /* (non-Javadoc)
169 3782 caballero
     * @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, double)
170
     */
171 3832 caballero
    public void transition(double d) {
172 5735 caballero
        _fsm.addValue(d);
173 3782 caballero
    }
174 3765 caballero
175 3782 caballero
    /* (non-Javadoc)
176
     * @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, java.lang.String)
177
     */
178 5735 caballero
    public void transition(String s) throws CommandException {
179 5170 caballero
        if (!super.changeCommand(s)){
180
            _fsm.addOption(s);
181
        }
182 3782 caballero
    }
183
184 3765 caballero
    /**
185
     * Equivale al transition del prototipo pero sin pasarle como par?metro el
186
     * editableFeatureSource que ya estar? creado.
187
     *
188
     * @param sel Bitset con las geometr?as que est?n seleccionadas.
189
     * @param x par?metro x del punto que se pase en esta transici?n.
190
     * @param y par?metro y del punto que se pase en esta transici?n.
191
     */
192 4365 caballero
    public void addPoint(double x, double y,InputEvent event) {
193 5170 caballero
        PolylineCADToolState actualState = (PolylineCADToolState) _fsm.getPreviousState();
194 3765 caballero
        String status = actualState.getName();
195 3782 caballero
196 5945 caballero
//        if (status.equals("Polyline.FirstPoint")) {
197
//            antPoint = new Point2D.Double(x, y);
198
//
199
//            if (firstPoint == null) {
200
//                firstPoint = (Point2D) antPoint.clone();
201
//            }
202
//        } else
203
        if (status.equals("Polyline.NextPointOrArcOrClose") || status.equals("Polyline.FirstPoint")) {
204 6071 caballero
205 5945 caballero
           if (firstPoint == null) {
206 6071 caballero
               firstPoint = new Point2D.Double(x, y);
207 5945 caballero
           }
208
                Point2D point = new Point2D.Double(x, y);
209 3782 caballero
210
            if (antPoint != null) {
211
                GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD,
212
                        2);
213
                elShape.moveTo(antPoint.getX(), antPoint.getY());
214
                elShape.lineTo(point.getX(), point.getY());
215 5170 caballero
                list.add(ShapeFactory.createPolyline2D(elShape));
216 3978 caballero
217 3782 caballero
            }
218 6071 caballero
            if (antPoint==null)
219
                    antPoint = (Point2D)firstPoint.clone();
220 3765 caballero
221 3782 caballero
            if (antPoint != null) {
222
                antantPoint = antPoint;
223
            }
224 3765 caballero
225 3782 caballero
            antPoint = point;
226 3978 caballero
        } else if (status.equals("Polyline.NextPointOrLineOrClose")) {
227 3782 caballero
            Point2D point = new Point2D.Double(x, y);
228
            Point2D lastp = antPoint; //(Point2D)points.get(i-1);
229 3765 caballero
230 3782 caballero
            if (antantPoint == null) {
231
                antantPoint = new Point2D.Double(lastp.getX() +
232
                        (point.getX() / 2), lastp.getY() + (point.getY() / 2));
233
            }
234 3765 caballero
235 3782 caballero
            if (((point.getY() == lastp.getY()) &&
236
                    (point.getX() < lastp.getX())) ||
237
                    ((point.getX() == lastp.getX()) &&
238
                    (point.getY() < lastp.getY()))) {
239
            } else {
240
                if (point.getX() == lastp.getX()) {
241
                    point = new Point2D.Double(point.getX() + 0.00000001,
242
                            point.getY());
243
                } else if (point.getY() == lastp.getY()) {
244
                    point = new Point2D.Double(point.getX(),
245
                            point.getY() + 0.00000001);
246
                }
247 3765 caballero
248 3782 caballero
                if (point.getX() == antantPoint.getX()) {
249
                    point = new Point2D.Double(point.getX() + 0.00000001,
250
                            point.getY());
251
                } else if (point.getY() == antantPoint.getY()) {
252
                    point = new Point2D.Double(point.getX(),
253
                            point.getY() + 0.00000001);
254
                }
255 3765 caballero
256 3782 caballero
                if (!(list.size() > 0) ||
257
                        (((IGeometry) list.get(list.size() - 1)).getGeometryType() == FShape.LINE)) {
258
                    Point2D[] ps1 = UtilFunctions.getPerpendicular(antantPoint,
259
                            lastp, lastp);
260
                    Point2D mediop = new Point2D.Double((point.getX() +
261
                            lastp.getX()) / 2, (point.getY() + lastp.getY()) / 2);
262
                    Point2D[] ps2 = UtilFunctions.getPerpendicular(lastp,
263
                            point, mediop);
264
                    Point2D interp = UtilFunctions.getIntersection(ps1[0],
265
                            ps1[1], ps2[0], ps2[1]);
266
                    antInter = interp;
267 3765 caballero
268 3782 caballero
                    double radio = interp.distance(lastp);
269 3765 caballero
270 3782 caballero
                    if (UtilFunctions.isLowAngle(antantPoint, lastp, interp,
271
                                point)) {
272
                        radio = -radio;
273
                    }
274 3765 caballero
275 3782 caballero
                    Point2D centerp = UtilFunctions.getPoint(interp, mediop,
276
                            radio);
277
                    antCenter = centerp;
278 3765 caballero
279 3782 caballero
                    IGeometry ig = ShapeFactory.createArc(lastp, centerp, point);
280 3765 caballero
281 3782 caballero
                    if (ig != null) {
282
                        list.add(ig);
283
                    }
284
                } else {
285
                    Point2D[] ps1 = UtilFunctions.getPerpendicular(lastp,
286
                            antInter, lastp);
287
                    double a1 = UtilFunctions.getAngle(ps1[0], ps1[1]);
288
                    double a2 = UtilFunctions.getAngle(ps1[1], ps1[0]);
289
                    double angle = UtilFunctions.getAngle(antCenter, lastp);
290
                    Point2D ini1 = null;
291
                    Point2D ini2 = null;
292 3765 caballero
293 3782 caballero
                    if (UtilFunctions.absoluteAngleDistance(angle, a1) > UtilFunctions.absoluteAngleDistance(
294
                                angle, a2)) {
295
                        ini1 = ps1[0];
296
                        ini2 = ps1[1];
297
                    } else {
298
                        ini1 = ps1[1];
299
                        ini2 = ps1[0];
300
                    }
301 3765 caballero
302 3782 caballero
                    Point2D unit = UtilFunctions.getUnitVector(ini1, ini2);
303
                    Point2D correct = new Point2D.Double(lastp.getX() +
304
                            unit.getX(), lastp.getY() + unit.getY());
305
                    Point2D[] ps = UtilFunctions.getPerpendicular(lastp,
306
                            correct, lastp);
307
                    Point2D mediop = new Point2D.Double((point.getX() +
308
                            lastp.getX()) / 2, (point.getY() + lastp.getY()) / 2);
309
                    Point2D[] ps2 = UtilFunctions.getPerpendicular(lastp,
310
                            point, mediop);
311
                    Point2D interp = UtilFunctions.getIntersection(ps[0],
312
                            ps[1], ps2[0], ps2[1]);
313
                    antInter = interp;
314 3765 caballero
315 3782 caballero
                    double radio = interp.distance(lastp);
316 3765 caballero
317 3782 caballero
                    if (UtilFunctions.isLowAngle(correct, lastp, interp, point)) {
318
                        radio = -radio;
319
                    }
320 3765 caballero
321 3782 caballero
                    Point2D centerp = UtilFunctions.getPoint(interp, mediop,
322
                            radio);
323
                    antCenter = centerp;
324
                    list.add(ShapeFactory.createArc(lastp, centerp, point));
325
                }
326 3765 caballero
327 3782 caballero
                antantPoint = antPoint;
328
                antPoint = point;
329
            }
330 3765 caballero
        }
331
    }
332
333
    /**
334
     * M?todo para dibujar la lo necesario para el estado en el que nos
335
     * encontremos.
336
     *
337
     * @param g Graphics sobre el que dibujar.
338
     * @param selectedGeometries BitSet con las geometr?as seleccionadas.
339
     * @param x par?metro x del punto que se pase para dibujar.
340
     * @param y par?metro x del punto que se pase para dibujar.
341
     */
342 3832 caballero
    public void drawOperation(Graphics g, double x,
343 3765 caballero
        double y) {
344 3883 caballero
        PolylineCADToolState actualState = ((PolylineCADToolContext)_fsm).getState();
345 3765 caballero
        String status = actualState.getName();
346
347 5945 caballero
        if (status.equals("Polyline.NextPointOrArcOrClose") || status.equals("Polyline.FirstPoint")) {
348 3782 caballero
            for (int i = 0; i < list.size(); i++) {
349
                ((IGeometry) list.get(i)).cloneGeometry().draw((Graphics2D) g,
350
                    getCadToolAdapter().getMapControl().getViewPort(),
351 3997 fjp
                    CADTool.drawingSymbol);
352 3782 caballero
            }
353 5945 caballero
            if (antPoint!=null)
354
                    drawLine((Graphics2D) g, antPoint, new Point2D.Double(x, y));
355 3765 caballero
356 3978 caballero
        } else if ((status.equals("Polyline.NextPointOrLineOrClose"))) {
357 3782 caballero
            for (int i = 0; i < list.size(); i++) {
358
                ((IGeometry) list.get(i)).cloneGeometry().draw((Graphics2D) g,
359
                    getCadToolAdapter().getMapControl().getViewPort(),
360 3997 fjp
                    CADTool.drawingSymbol);
361 3782 caballero
            }
362 3765 caballero
363 3782 caballero
            Point2D point = new Point2D.Double(x, y);
364
            Point2D lastp = antPoint;
365 3765 caballero
366 3782 caballero
            if (!(list.size() > 0) ||
367
                    (((IGeometry) list.get(list.size() - 1)).getGeometryType() == FShape.LINE)) {
368
                if (antantPoint == null) {
369
                    drawArc(point, lastp,
370
                        new Point2D.Double(lastp.getX() + (point.getX() / 2),
371
                            lastp.getY() + (point.getY() / 2)), g);
372
                } else {
373
                    drawArc(point, lastp, antantPoint, g);
374
                }
375
            } else {
376
                if (antInter != null) {
377
                    Point2D[] ps1 = UtilFunctions.getPerpendicular(lastp,
378
                            antInter, lastp);
379
                    double a1 = UtilFunctions.getAngle(ps1[0], ps1[1]);
380
                    double a2 = UtilFunctions.getAngle(ps1[1], ps1[0]);
381
                    double angle = UtilFunctions.getAngle(antCenter, lastp);
382
                    Point2D ini1 = null;
383
                    Point2D ini2 = null;
384 3765 caballero
385 3782 caballero
                    if (UtilFunctions.absoluteAngleDistance(angle, a1) > UtilFunctions.absoluteAngleDistance(
386
                                angle, a2)) {
387
                        ini1 = ps1[0];
388
                        ini2 = ps1[1];
389
                    } else {
390
                        ini1 = ps1[1];
391
                        ini2 = ps1[0];
392
                    }
393 3765 caballero
394 3782 caballero
                    Point2D unit = UtilFunctions.getUnitVector(ini1, ini2);
395
                    Point2D correct = new Point2D.Double(lastp.getX() +
396
                            unit.getX(), lastp.getY() + unit.getY());
397
                    drawArc(point, lastp, correct, g);
398
                }
399
            }
400
        }
401 3765 caballero
    }
402 3782 caballero
403 3765 caballero
    /**
404 3782 caballero
     * Dibuja el arco sobre el graphics.
405
     *
406
     * @param point Puntero del rat?n.
407
     * @param lastp ?ltimo punto de la polilinea.
408
     * @param antp Punto antepenultimo.
409
     * @param g Graphics sobre el que se dibuja.
410
     */
411
    private void drawArc(Point2D point, Point2D lastp, Point2D antp, Graphics g) {
412
        if (((point.getY() == lastp.getY()) && (point.getX() < lastp.getX())) ||
413
                ((point.getX() == lastp.getX()) &&
414
                (point.getY() < lastp.getY()))) {
415
        } else {
416
            if (point.getX() == lastp.getX()) {
417
                point = new Point2D.Double(point.getX() + 0.00000001,
418
                        point.getY());
419
            } else if (point.getY() == lastp.getY()) {
420
                point = new Point2D.Double(point.getX(),
421
                        point.getY() + 0.00000001);
422
            }
423 3765 caballero
424 3782 caballero
            if (point.getX() == antp.getX()) {
425
                point = new Point2D.Double(point.getX() + 0.00000001,
426
                        point.getY());
427
            } else if (point.getY() == antp.getY()) {
428
                point = new Point2D.Double(point.getX(),
429
                        point.getY() + 0.00000001);
430
            }
431 3765 caballero
432 3782 caballero
            Point2D[] ps1 = UtilFunctions.getPerpendicular(lastp, antp, lastp);
433
            Point2D mediop = new Point2D.Double((point.getX() + lastp.getX()) / 2,
434
                    (point.getY() + lastp.getY()) / 2);
435
            Point2D[] ps2 = UtilFunctions.getPerpendicular(lastp, point, mediop);
436
            Point2D interp = UtilFunctions.getIntersection(ps1[0], ps1[1],
437
                    ps2[0], ps2[1]);
438 3765 caballero
439 3782 caballero
            double radio = interp.distance(lastp);
440 3765 caballero
441 3782 caballero
            if (UtilFunctions.isLowAngle(antp, lastp, interp, point)) {
442
                radio = -radio;
443
            }
444 3765 caballero
445 3782 caballero
            Point2D centerp = UtilFunctions.getPoint(interp, mediop, radio);
446 3765 caballero
447 3782 caballero
            drawLine((Graphics2D) g, lastp, point);
448 3765 caballero
449 3782 caballero
            IGeometry ig = ShapeFactory.createArc(lastp, centerp, point);
450 3765 caballero
451 3782 caballero
            if (ig != null) {
452
                ig.draw((Graphics2D) g,
453
                    getCadToolAdapter().getMapControl().getViewPort(),
454
                    CADTool.modifySymbol);
455
            }
456
        }
457 3765 caballero
    }
458
459
    /**
460
     * Add a diferent option.
461
     *
462 3782 caballero
     * @param sel DOCUMENT ME!
463 3765 caballero
     * @param s Diferent option.
464
     */
465 3832 caballero
    public void addOption(String s) {
466 5395 caballero
            /*       PolylineCADToolState actualState = (PolylineCADToolState) _fsm.getPreviousState();
467 3765 caballero
        String status = actualState.getName();
468 3782 caballero

469 3978 caballero
        if (status.equals("Polyline.NextPointOrArcOrClose")) {
470 5170 caballero
            if (s.equals("A") || s.equals("a") || s.equals(PluginServices.getText(this,"inter_arc"))) {
471 3782 caballero
                //Arco
472
            } else if (s.equals("C") || s.equals("c")) {
473 5170 caballero
                GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD, 2);
474 3846 caballero
                elShape.moveTo(antPoint.getX(), antPoint.getY());
475
                elShape.lineTo(firstPoint.getX(), firstPoint.getY());
476
                list.add(ShapeFactory.createPolyline2D(elShape));
477 5170 caballero
                //closeGeometry();
478 3765 caballero
            }
479 3978 caballero
        } else if (status.equals("Polyline.NextPointOrLineOrClose")) {
480 5170 caballero
            if (s.equals("N") || s.equals("n") || s.equals(PluginServices.getText(this,"inter_line"))) {
481 3782 caballero
                //L?nea
482
            } else if (s.equals("C") || s.equals("c")) {
483 5170 caballero
                GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD, 2);
484 3846 caballero
                elShape.moveTo(antPoint.getX(), antPoint.getY());
485
                elShape.lineTo(firstPoint.getX(), firstPoint.getY());
486
                list.add(ShapeFactory.createPolyline2D(elShape));
487
                //closeGeometry();
488 3782 caballero
            }
489 3765 caballero
        }
490 5395 caballero
  */
491 3765 caballero
    }
492
493
    /* (non-Javadoc)
494
     * @see com.iver.cit.gvsig.gui.cad.CADTool#addvalue(double)
495
     */
496 3832 caballero
    public void addValue(double d) {
497 3765 caballero
    }
498 3883 caballero
499
    public void cancel(){
500 5395 caballero
        //endGeometry();
501 5170 caballero
        list.clear();
502
        antantPoint=antCenter=antInter=antPoint=firstPoint=null;
503 3883 caballero
    }
504 4002 fjp
505 5170 caballero
    public void end() {
506
        /* CADExtension.setCADTool("polyline");
507
        PluginServices.getMainFrame().setSelectedTool("POLYLINE"); */
508
    }
509 4118 caballero
510 5170 caballero
    public String getName() {
511
        return PluginServices.getText(this,"polyline_");
512
    }
513 4892 caballero
514 5170 caballero
    public String toString() {
515
        return "_polyline";
516
    }
517
    public boolean isApplicable(int shapeType) {
518
        switch (shapeType) {
519
        case FShape.POINT:
520 6024 caballero
        case FShape.MULTIPOINT:
521 5170 caballero
            return false;
522
        }
523
        return true;
524
    }
525 3765 caballero
}