Statistics
| Revision:

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

History | View | Annotate | Download (19.5 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 3832 caballero
import com.iver.cit.gvsig.gui.cad.DefaultCADTool;
61 5735 caballero
import com.iver.cit.gvsig.gui.cad.exception.CommandException;
62 3782 caballero
import com.iver.cit.gvsig.gui.cad.tools.smc.PolylineCADToolContext;
63
import com.iver.cit.gvsig.gui.cad.tools.smc.PolylineCADToolContext.PolylineCADToolState;
64
65
66
/**
67
 * DOCUMENT ME!
68
 *
69
 * @author Vicente Caballero Navarro
70
 */
71 3765 caballero
public class PolylineCADTool extends DefaultCADTool {
72 5747 fjp
        private static Logger logger = Logger.getLogger(PolylineCADTool.class.getName());
73 3765 caballero
    private PolylineCADToolContext _fsm;
74
    private Point2D firstPoint;
75
    private Point2D antPoint;
76
    private Point2D antantPoint;
77
    private Point2D antCenter;
78 3782 caballero
    private Point2D antInter;
79
    private ArrayList list = new ArrayList();
80 6161 caballero
        private boolean close=false;
81 3782 caballero
82
    /**
83 3765 caballero
     * Crea un nuevo PolylineCADTool.
84
     */
85
    public PolylineCADTool() {
86 3883 caballero
87 3765 caballero
    }
88
89
    /**
90
     * M?todo de incio, para poner el c?digo de todo lo que se requiera de una
91
     * carga previa a la utilizaci?n de la herramienta.
92
     */
93
    public void init() {
94 5170 caballero
        _fsm = new PolylineCADToolContext(this);
95 3765 caballero
    }
96 11144 caballero
    public IGeometry getGeometry() {
97
                IGeometry[] geoms = (IGeometry[]) list.toArray(new IGeometry[0]);
98
                FGeometryCollection fgc = new FGeometryCollection(geoms);
99
                // No queremos guardar FGeometryCollections:
100
                GeneralPathX gp = new GeneralPathX();
101
                gp.append(fgc.getPathIterator(null, FConverter.FLATNESS), true);
102
                IGeometry newGeom = ShapeFactory.createPolyline2D(gp);
103
                return newGeom;
104
        }
105 3883 caballero
    public void endGeometry() {
106 9443 caballero
             try {
107
                         if (getVLE().getVEA().getShapeType()==FShape.POLYGON && !close){
108
                                 closeGeometry();
109
                         }
110
                 } catch (DriverIOException e) {
111
                         e.printStackTrace();
112
                 }
113
            IGeometry[] geoms = (IGeometry[]) list.toArray(new IGeometry[0]);
114 3846 caballero
        FGeometryCollection fgc = new FGeometryCollection(geoms);
115 5880 fjp
116 9443 caballero
117 5880 fjp
        // No queremos guardar FGeometryCollections:
118
        GeneralPathX gp = new GeneralPathX();
119 7072 caballero
        gp.append(fgc.getPathIterator(null,FConverter.FLATNESS), true);
120 5880 fjp
        IGeometry newGeom = ShapeFactory.createPolyline2D(gp);
121 6034 fjp
//        if (gp.isClosed())
122
//        {
123
//                gp.ensureOrientation(false); // Poligono exterior.
124
//                // Voy a testear que se puede convertir a JTS:
125
//                IGeometry gAux = ShapeFactory.createPolygon2D(gp);
126
//                Geometry jtsG = gAux.toJTSGeometry();
127
//                logger.debug("A punto de escribir " + jtsG.toText());
128
//                try {
129
//                        int shapeType = getVLE().getVEA().getShapeType();
130
//                                if ((shapeType ==FShape.POLYGON) || (shapeType == FShape.MULTI)) {
131
//                                        newGeom = gAux;
132
//                                }
133
//                        } catch (DriverIOException e) {
134
//                                // TODO Auto-generated catch block
135
//                                e.printStackTrace();
136
//                                return;
137
//                        }
138
//
139
//        }
140
//
141 5880 fjp
        addGeometry(newGeom);
142 3782 caballero
        _fsm = new PolylineCADToolContext(this);
143 3883 caballero
        list.clear();
144 9443 caballero
        close=false;
145 3883 caballero
        antantPoint=antCenter=antInter=antPoint=firstPoint=null;
146 3765 caballero
    }
147 3883 caballero
    public void closeGeometry(){
148 6161 caballero
            close=true;
149 5170 caballero
        GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD,
150
                2);
151
        elShape.moveTo(antPoint.getX(), antPoint.getY());
152
        elShape.lineTo(firstPoint.getX(), firstPoint.getY());
153 3765 caballero
154 5170 caballero
        list.add(ShapeFactory.createPolyline2D(elShape));
155 5747 fjp
156 5945 caballero
157 5170 caballero
        // list.add(ShapeFactory.createPolyline2D(elShape));
158 5880 fjp
159 3883 caballero
    }
160 3765 caballero
    /* (non-Javadoc)
161 3782 caballero
     * @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, double, double)
162
     */
163 4313 fjp
    public void transition(double x, double y, InputEvent event) {
164 4324 caballero
        _fsm.addPoint(x, y, event);
165 3765 caballero
    }
166
167
    /* (non-Javadoc)
168 3782 caballero
     * @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, double)
169
     */
170 3832 caballero
    public void transition(double d) {
171 5735 caballero
        _fsm.addValue(d);
172 3782 caballero
    }
173 3765 caballero
174 3782 caballero
    /* (non-Javadoc)
175
     * @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, java.lang.String)
176
     */
177 5735 caballero
    public void transition(String s) throws CommandException {
178 5170 caballero
        if (!super.changeCommand(s)){
179
            _fsm.addOption(s);
180
        }
181 3782 caballero
    }
182
183 3765 caballero
    /**
184
     * Equivale al transition del prototipo pero sin pasarle como par?metro el
185
     * editableFeatureSource que ya estar? creado.
186
     *
187
     * @param sel Bitset con las geometr?as que est?n seleccionadas.
188
     * @param x par?metro x del punto que se pase en esta transici?n.
189
     * @param y par?metro y del punto que se pase en esta transici?n.
190
     */
191 4365 caballero
    public void addPoint(double x, double y,InputEvent event) {
192 5170 caballero
        PolylineCADToolState actualState = (PolylineCADToolState) _fsm.getPreviousState();
193 3765 caballero
        String status = actualState.getName();
194 3782 caballero
195 5945 caballero
//        if (status.equals("Polyline.FirstPoint")) {
196
//            antPoint = new Point2D.Double(x, y);
197
//
198
//            if (firstPoint == null) {
199
//                firstPoint = (Point2D) antPoint.clone();
200
//            }
201
//        } else
202
        if (status.equals("Polyline.NextPointOrArcOrClose") || status.equals("Polyline.FirstPoint")) {
203 6071 caballero
204 5945 caballero
           if (firstPoint == null) {
205 6071 caballero
               firstPoint = new Point2D.Double(x, y);
206 5945 caballero
           }
207
                Point2D point = new Point2D.Double(x, y);
208 3782 caballero
209
            if (antPoint != null) {
210
                GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD,
211
                        2);
212
                elShape.moveTo(antPoint.getX(), antPoint.getY());
213
                elShape.lineTo(point.getX(), point.getY());
214 5170 caballero
                list.add(ShapeFactory.createPolyline2D(elShape));
215 3978 caballero
216 3782 caballero
            }
217 6071 caballero
            if (antPoint==null)
218
                    antPoint = (Point2D)firstPoint.clone();
219 3765 caballero
220 3782 caballero
            if (antPoint != null) {
221
                antantPoint = antPoint;
222
            }
223 3765 caballero
224 3782 caballero
            antPoint = point;
225 3978 caballero
        } else if (status.equals("Polyline.NextPointOrLineOrClose")) {
226 3782 caballero
            Point2D point = new Point2D.Double(x, y);
227
            Point2D lastp = antPoint; //(Point2D)points.get(i-1);
228 3765 caballero
229 3782 caballero
            if (antantPoint == null) {
230
                antantPoint = new Point2D.Double(lastp.getX() +
231
                        (point.getX() / 2), lastp.getY() + (point.getY() / 2));
232
            }
233 3765 caballero
234 3782 caballero
            if (((point.getY() == lastp.getY()) &&
235
                    (point.getX() < lastp.getX())) ||
236
                    ((point.getX() == lastp.getX()) &&
237
                    (point.getY() < lastp.getY()))) {
238
            } else {
239
                if (point.getX() == lastp.getX()) {
240
                    point = new Point2D.Double(point.getX() + 0.00000001,
241
                            point.getY());
242
                } else if (point.getY() == lastp.getY()) {
243
                    point = new Point2D.Double(point.getX(),
244
                            point.getY() + 0.00000001);
245
                }
246 3765 caballero
247 3782 caballero
                if (point.getX() == antantPoint.getX()) {
248
                    point = new Point2D.Double(point.getX() + 0.00000001,
249
                            point.getY());
250
                } else if (point.getY() == antantPoint.getY()) {
251
                    point = new Point2D.Double(point.getX(),
252
                            point.getY() + 0.00000001);
253
                }
254 3765 caballero
255 3782 caballero
                if (!(list.size() > 0) ||
256
                        (((IGeometry) list.get(list.size() - 1)).getGeometryType() == FShape.LINE)) {
257
                    Point2D[] ps1 = UtilFunctions.getPerpendicular(antantPoint,
258
                            lastp, lastp);
259
                    Point2D mediop = new Point2D.Double((point.getX() +
260
                            lastp.getX()) / 2, (point.getY() + lastp.getY()) / 2);
261
                    Point2D[] ps2 = UtilFunctions.getPerpendicular(lastp,
262
                            point, mediop);
263
                    Point2D interp = UtilFunctions.getIntersection(ps1[0],
264
                            ps1[1], ps2[0], ps2[1]);
265
                    antInter = interp;
266 3765 caballero
267 3782 caballero
                    double radio = interp.distance(lastp);
268 3765 caballero
269 3782 caballero
                    if (UtilFunctions.isLowAngle(antantPoint, lastp, interp,
270
                                point)) {
271
                        radio = -radio;
272
                    }
273 3765 caballero
274 3782 caballero
                    Point2D centerp = UtilFunctions.getPoint(interp, mediop,
275
                            radio);
276
                    antCenter = centerp;
277 3765 caballero
278 3782 caballero
                    IGeometry ig = ShapeFactory.createArc(lastp, centerp, point);
279 3765 caballero
280 3782 caballero
                    if (ig != null) {
281
                        list.add(ig);
282
                    }
283
                } else {
284
                    Point2D[] ps1 = UtilFunctions.getPerpendicular(lastp,
285
                            antInter, lastp);
286
                    double a1 = UtilFunctions.getAngle(ps1[0], ps1[1]);
287
                    double a2 = UtilFunctions.getAngle(ps1[1], ps1[0]);
288
                    double angle = UtilFunctions.getAngle(antCenter, lastp);
289
                    Point2D ini1 = null;
290
                    Point2D ini2 = null;
291 3765 caballero
292 3782 caballero
                    if (UtilFunctions.absoluteAngleDistance(angle, a1) > UtilFunctions.absoluteAngleDistance(
293
                                angle, a2)) {
294
                        ini1 = ps1[0];
295
                        ini2 = ps1[1];
296
                    } else {
297
                        ini1 = ps1[1];
298
                        ini2 = ps1[0];
299
                    }
300 3765 caballero
301 3782 caballero
                    Point2D unit = UtilFunctions.getUnitVector(ini1, ini2);
302
                    Point2D correct = new Point2D.Double(lastp.getX() +
303
                            unit.getX(), lastp.getY() + unit.getY());
304
                    Point2D[] ps = UtilFunctions.getPerpendicular(lastp,
305
                            correct, lastp);
306
                    Point2D mediop = new Point2D.Double((point.getX() +
307
                            lastp.getX()) / 2, (point.getY() + lastp.getY()) / 2);
308
                    Point2D[] ps2 = UtilFunctions.getPerpendicular(lastp,
309
                            point, mediop);
310
                    Point2D interp = UtilFunctions.getIntersection(ps[0],
311
                            ps[1], ps2[0], ps2[1]);
312
                    antInter = interp;
313 3765 caballero
314 3782 caballero
                    double radio = interp.distance(lastp);
315 3765 caballero
316 3782 caballero
                    if (UtilFunctions.isLowAngle(correct, lastp, interp, point)) {
317
                        radio = -radio;
318
                    }
319 3765 caballero
320 3782 caballero
                    Point2D centerp = UtilFunctions.getPoint(interp, mediop,
321
                            radio);
322
                    antCenter = centerp;
323
                    list.add(ShapeFactory.createArc(lastp, centerp, point));
324
                }
325 3765 caballero
326 3782 caballero
                antantPoint = antPoint;
327
                antPoint = point;
328
            }
329 3765 caballero
        }
330
    }
331
332
    /**
333
     * M?todo para dibujar la lo necesario para el estado en el que nos
334
     * encontremos.
335
     *
336
     * @param g Graphics sobre el que dibujar.
337
     * @param selectedGeometries BitSet con las geometr?as seleccionadas.
338
     * @param x par?metro x del punto que se pase para dibujar.
339
     * @param y par?metro x del punto que se pase para dibujar.
340
     */
341 3832 caballero
    public void drawOperation(Graphics g, double x,
342 3765 caballero
        double y) {
343 3883 caballero
        PolylineCADToolState actualState = ((PolylineCADToolContext)_fsm).getState();
344 3765 caballero
        String status = actualState.getName();
345
346 5945 caballero
        if (status.equals("Polyline.NextPointOrArcOrClose") || status.equals("Polyline.FirstPoint")) {
347 3782 caballero
            for (int i = 0; i < list.size(); i++) {
348
                ((IGeometry) list.get(i)).cloneGeometry().draw((Graphics2D) g,
349
                    getCadToolAdapter().getMapControl().getViewPort(),
350 11427 caballero
                    DefaultCADTool.drawingSymbol);
351 3782 caballero
            }
352 5945 caballero
            if (antPoint!=null)
353
                    drawLine((Graphics2D) g, antPoint, new Point2D.Double(x, y));
354 3765 caballero
355 3978 caballero
        } else if ((status.equals("Polyline.NextPointOrLineOrClose"))) {
356 3782 caballero
            for (int i = 0; i < list.size(); i++) {
357
                ((IGeometry) list.get(i)).cloneGeometry().draw((Graphics2D) g,
358
                    getCadToolAdapter().getMapControl().getViewPort(),
359 11427 caballero
                    DefaultCADTool.drawingSymbol);
360 3782 caballero
            }
361 3765 caballero
362 3782 caballero
            Point2D point = new Point2D.Double(x, y);
363
            Point2D lastp = antPoint;
364 3765 caballero
365 3782 caballero
            if (!(list.size() > 0) ||
366
                    (((IGeometry) list.get(list.size() - 1)).getGeometryType() == FShape.LINE)) {
367
                if (antantPoint == null) {
368
                    drawArc(point, lastp,
369
                        new Point2D.Double(lastp.getX() + (point.getX() / 2),
370
                            lastp.getY() + (point.getY() / 2)), g);
371
                } else {
372
                    drawArc(point, lastp, antantPoint, g);
373
                }
374
            } else {
375
                if (antInter != null) {
376
                    Point2D[] ps1 = UtilFunctions.getPerpendicular(lastp,
377
                            antInter, lastp);
378
                    double a1 = UtilFunctions.getAngle(ps1[0], ps1[1]);
379
                    double a2 = UtilFunctions.getAngle(ps1[1], ps1[0]);
380
                    double angle = UtilFunctions.getAngle(antCenter, lastp);
381
                    Point2D ini1 = null;
382
                    Point2D ini2 = null;
383 3765 caballero
384 3782 caballero
                    if (UtilFunctions.absoluteAngleDistance(angle, a1) > UtilFunctions.absoluteAngleDistance(
385
                                angle, a2)) {
386
                        ini1 = ps1[0];
387
                        ini2 = ps1[1];
388
                    } else {
389
                        ini1 = ps1[1];
390
                        ini2 = ps1[0];
391
                    }
392 3765 caballero
393 3782 caballero
                    Point2D unit = UtilFunctions.getUnitVector(ini1, ini2);
394
                    Point2D correct = new Point2D.Double(lastp.getX() +
395
                            unit.getX(), lastp.getY() + unit.getY());
396
                    drawArc(point, lastp, correct, g);
397
                }
398
            }
399
        }
400 3765 caballero
    }
401 3782 caballero
402 3765 caballero
    /**
403 3782 caballero
     * Dibuja el arco sobre el graphics.
404
     *
405
     * @param point Puntero del rat?n.
406
     * @param lastp ?ltimo punto de la polilinea.
407
     * @param antp Punto antepenultimo.
408
     * @param g Graphics sobre el que se dibuja.
409
     */
410
    private void drawArc(Point2D point, Point2D lastp, Point2D antp, Graphics g) {
411
        if (((point.getY() == lastp.getY()) && (point.getX() < lastp.getX())) ||
412
                ((point.getX() == lastp.getX()) &&
413
                (point.getY() < lastp.getY()))) {
414
        } else {
415
            if (point.getX() == lastp.getX()) {
416
                point = new Point2D.Double(point.getX() + 0.00000001,
417
                        point.getY());
418
            } else if (point.getY() == lastp.getY()) {
419
                point = new Point2D.Double(point.getX(),
420
                        point.getY() + 0.00000001);
421
            }
422 3765 caballero
423 3782 caballero
            if (point.getX() == antp.getX()) {
424
                point = new Point2D.Double(point.getX() + 0.00000001,
425
                        point.getY());
426
            } else if (point.getY() == antp.getY()) {
427
                point = new Point2D.Double(point.getX(),
428
                        point.getY() + 0.00000001);
429
            }
430 3765 caballero
431 3782 caballero
            Point2D[] ps1 = UtilFunctions.getPerpendicular(lastp, antp, lastp);
432
            Point2D mediop = new Point2D.Double((point.getX() + lastp.getX()) / 2,
433
                    (point.getY() + lastp.getY()) / 2);
434
            Point2D[] ps2 = UtilFunctions.getPerpendicular(lastp, point, mediop);
435
            Point2D interp = UtilFunctions.getIntersection(ps1[0], ps1[1],
436
                    ps2[0], ps2[1]);
437 3765 caballero
438 3782 caballero
            double radio = interp.distance(lastp);
439 3765 caballero
440 3782 caballero
            if (UtilFunctions.isLowAngle(antp, lastp, interp, point)) {
441
                radio = -radio;
442
            }
443 3765 caballero
444 3782 caballero
            Point2D centerp = UtilFunctions.getPoint(interp, mediop, radio);
445 3765 caballero
446 3782 caballero
            drawLine((Graphics2D) g, lastp, point);
447 3765 caballero
448 3782 caballero
            IGeometry ig = ShapeFactory.createArc(lastp, centerp, point);
449 3765 caballero
450 3782 caballero
            if (ig != null) {
451
                ig.draw((Graphics2D) g,
452
                    getCadToolAdapter().getMapControl().getViewPort(),
453 11427 caballero
                    DefaultCADTool.modifySymbol);
454 3782 caballero
            }
455
        }
456 3765 caballero
    }
457
458
    /**
459
     * Add a diferent option.
460
     *
461 3782 caballero
     * @param sel DOCUMENT ME!
462 3765 caballero
     * @param s Diferent option.
463
     */
464 3832 caballero
    public void addOption(String s) {
465 5395 caballero
            /*       PolylineCADToolState actualState = (PolylineCADToolState) _fsm.getPreviousState();
466 3765 caballero
        String status = actualState.getName();
467 3782 caballero

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