Statistics
| Revision:

root / trunk / extensions / extCAD / src / com / iver / cit / gvsig / gui / cad / CADToolAdapter.java @ 3883

History | View | Annotate | Download (17 KB)

1
package com.iver.cit.gvsig.gui.cad;
2

    
3
import java.awt.Color;
4
import java.awt.Cursor;
5
import java.awt.Graphics;
6
import java.awt.Image;
7
import java.awt.Point;
8
import java.awt.Toolkit;
9
import java.awt.event.MouseEvent;
10
import java.awt.event.MouseWheelEvent;
11
import java.awt.geom.Point2D;
12
import java.awt.geom.Rectangle2D;
13
import java.awt.image.MemoryImageSource;
14
import java.io.IOException;
15
import java.util.Stack;
16

    
17
import com.iver.andami.PluginServices;
18
import com.iver.cit.gvsig.CADExtension;
19
import com.iver.cit.gvsig.fmap.DriverException;
20
import com.iver.cit.gvsig.fmap.ViewPort;
21
import com.iver.cit.gvsig.fmap.core.Handler;
22
import com.iver.cit.gvsig.fmap.core.IFeature;
23
import com.iver.cit.gvsig.fmap.core.IGeometry;
24
import com.iver.cit.gvsig.fmap.core.v02.FConstant;
25
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
26
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
27
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter;
28
import com.iver.cit.gvsig.fmap.layers.FBitSet;
29
import com.iver.cit.gvsig.fmap.tools.BehaviorException;
30
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior;
31
import com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener;
32
import com.iver.cit.gvsig.gui.View;
33
import com.iver.cit.gvsig.gui.cad.tools.SelectionCADTool;
34

    
35
public class CADToolAdapter extends Behavior {
36
        private Stack cadToolStack = new Stack();
37

    
38
        //Para pasarle las coordenadas cuando se produce un evento textEntered
39
        private int lastX;
40
        private int lastY;
41
        private FSymbol symbol = new FSymbol(FConstant.SYMBOL_TYPE_POINT, Color.RED);
42
        private Point2D mapAdjustedPoint;
43
        private boolean questionAsked = false;
44
        private Point2D adjustedPoint;
45
        private boolean snapping = false;
46
        private boolean adjustSnapping = false;
47
        private VectorialEditableAdapter vea;
48
        private CADGrid cadgrid=new CADGrid();
49

    
50
        /**
51
         * Pinta de alguna manera especial las geometrias seleccionadas para la
52
         * edici?n. En caso de que el snapping est? activado, pintar? el efecto
53
         * del mismo.
54
         *
55
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#paintComponent(java.awt.Graphics)
56
         */
57
        public void paintComponent(Graphics g) {
58
                super.paintComponent(g);
59
                drawCursor(g);
60
                getGrid().drawGrid(g);
61
                if (adjustedPoint != null) {
62
                        Point2D p=null;
63
                        if (mapAdjustedPoint != null) {
64
                                p = mapAdjustedPoint;
65
                        } else {
66
                                p = getMapControl().getViewPort().toMapPoint(adjustedPoint);
67
                        }
68
                        ((CADTool) cadToolStack.peek()).drawOperation(g,
69
                                p.getX(), p.getY());
70
                }
71
        }
72

    
73
        /**
74
         * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
75
         */
76
        public void mouseClicked(MouseEvent e) throws BehaviorException {
77
                if (e.getButton()==MouseEvent.BUTTON3){
78
                        CADExtension.showPopup(e);
79
                }
80
        }
81

    
82
        /**
83
         * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
84
         */
85
        public void mouseEntered(MouseEvent e) throws BehaviorException {
86
        }
87

    
88
        /**
89
         * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
90
         */
91
        public void mouseExited(MouseEvent e) throws BehaviorException {
92
        }
93

    
94
        /**
95
         * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
96
         */
97
        public void mousePressed(MouseEvent e) throws BehaviorException {
98
                if (e.getButton() == MouseEvent.BUTTON1) {
99
                        ViewPort vp = getMapControl().getMapContext().getViewPort();
100
                        Point2D p;
101

    
102
                                if (mapAdjustedPoint != null) {
103
                                p = mapAdjustedPoint;
104
                        } else {
105
                                p = vp.toMapPoint(adjustedPoint);
106
                        }
107
                        transition(vea,
108
                                new double[] { p.getX(), p.getY() });
109
                }
110
        }
111

    
112
        /**
113
         * Ajusta un punto de la imagen que se pasa como  par?metro al grid si ?ste
114
         * est? activo y devuelve la distancia de un punto al punto ajustado
115
         *
116
         * @param point
117
         * @param mapHandlerAdjustedPoint DOCUMENT ME!
118
         *
119
         * @return Distancia del punto que se pasa como par?metro al punto ajustado
120
         */
121
        private double adjustToHandler(Point2D point,
122
                Point2D mapHandlerAdjustedPoint) {
123
                //if (selection.cardinality() > 0) {
124
                double rw=getMapControl().getViewPort().toMapDistance(5);
125
                try {
126
                        Point2D mapPoint = point;
127
                        Rectangle2D r = new Rectangle2D.Double(mapPoint.getX() - rw/2,
128
                                        mapPoint.getY() - rw/2, rw, rw);
129

    
130
                        int[] indexes = vea.getRowsIndexes(r);
131

    
132
                        double min = Double.MAX_VALUE;
133
                        Point2D argmin = null;
134
                        Point2D mapArgmin = null;
135

    
136
                        for (int i = 0; i < indexes.length; i++) {
137
                                IFeature fea=null;
138
                                        fea = vea.getFeature(indexes[i]);
139
                                Handler[] handlers = fea.getGeometry().getHandlers(IGeometry.SELECTHANDLER);
140

    
141
                                for (int j = 0; j < handlers.length; j++) {
142
                                        Point2D handlerPoint = handlers[j].getPoint();
143
                                        //System.err.println("handlerPoint= "+ handlerPoint);
144
                                        Point2D handlerImagePoint = handlerPoint;
145
                                        double dist = handlerImagePoint.distance(point);
146
                                        if ((dist < getMapControl().getViewPort().toMapDistance(SelectionCADTool.tolerance)) &&
147
                                                        (dist < min)) {
148
                                                min = dist;
149
                                                argmin = handlerImagePoint;
150
                                                mapArgmin = handlerPoint;
151
                                        }
152
                                }
153
                        }
154

    
155
                        if (argmin != null) {
156
                                point.setLocation(argmin);
157

    
158
                                //Se hace el casting porque no se quiere redondeo
159
                                point.setLocation(argmin.getX(), argmin.getY());
160

    
161
                                mapHandlerAdjustedPoint.setLocation(mapArgmin);
162

    
163
                                return min;
164
                        }
165
                } catch (DriverException e) {
166
                        e.printStackTrace();
167
                }
168

    
169
                return Double.MAX_VALUE;
170

    
171
        }
172

    
173
        /**
174
         * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
175
         */
176
        public void mouseReleased(MouseEvent e) throws BehaviorException {
177
                getMapControl().repaint();
178
        }
179

    
180
        /**
181
         * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
182
         */
183
        public void mouseDragged(MouseEvent e) throws BehaviorException {
184
                lastX = e.getX();
185
                lastY = e.getY();
186

    
187
                calculateSnapPoint(e.getPoint());
188
        }
189

    
190
        /**
191
         * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
192
         */
193
        public void mouseMoved(MouseEvent e) throws BehaviorException {
194

    
195
                lastX = e.getX();
196
                lastY = e.getY();
197

    
198
                calculateSnapPoint(e.getPoint());
199

    
200
                getMapControl().repaint();
201
        }
202
        private void clearMouseImage(){
203
                int[] pixels = new int[16 * 16];
204
                Image image = Toolkit.getDefaultToolkit().createImage(
205
                        new MemoryImageSource(16, 16, pixels, 0, 16));
206
                Cursor transparentCursor =
207
                        Toolkit.getDefaultToolkit().createCustomCursor
208
                            (image, new Point(0,0), "invisiblecursor");
209
                View view=CADExtension.getView();
210
                view.setCursor(transparentCursor);
211
        }
212
        /**
213
         * DOCUMENT ME!
214
         *
215
         * @param g DOCUMENT ME!
216
         */
217
        private void drawCursor(Graphics g) {
218
                clearMouseImage();
219
                Point2D p = adjustedPoint;
220

    
221
                if (p == null) {
222
                        getGrid().setViewPort(getMapControl().getViewPort());
223

    
224
                        return;
225
                }
226

    
227
                int size1 = 15;
228
                int size2 = 3;
229
                g.drawLine((int) (p.getX() - size1), (int) (p.getY()),
230
                        (int) (p.getX() + size1), (int) (p.getY()));
231
                g.drawLine((int) (p.getX()), (int) (p.getY() - size1),
232
                        (int) (p.getX()), (int) (p.getY() + size1));
233

    
234
                if (adjustedPoint != null) {
235
                        if (adjustSnapping) {
236
                                g.setColor(Color.ORANGE);
237
                                g.drawRect((int) (adjustedPoint.getX() - 6),
238
                                        (int) (adjustedPoint.getY() - 6), 12, 12);
239
                                g.drawRect((int) (adjustedPoint.getX() - 3),
240
                                        (int) (adjustedPoint.getY() - 3), 6, 6);
241
                                g.setColor(Color.MAGENTA);
242
                                g.drawRect((int) (adjustedPoint.getX() - 4),
243
                                        (int) (adjustedPoint.getY() - 4), 8, 8);
244

    
245
                                adjustSnapping = false;
246
                        } else {
247
                                g.drawRect((int) (p.getX() - size2), (int) (p.getY() - size2),
248
                                        (int) (size2 * 2), (int) (size2 * 2));
249
                        }
250
                }
251
        }
252

    
253
        /**
254
         * DOCUMENT ME!
255
         *
256
         * @param point
257
         */
258
        private void calculateSnapPoint(Point point) {
259
                //Se comprueba el ajuste a rejilla
260

    
261
                Point2D gridAdjustedPoint = getMapControl().getViewPort().toMapPoint(point);
262
                double minDistance = Double.MAX_VALUE;
263
                CADTool ct=(CADTool)cadToolStack.peek();
264
                if (ct instanceof SelectionCADTool && ((SelectionCADTool)ct).getStatus().equals("ExecuteMap.Initial")){
265
                        mapAdjustedPoint=gridAdjustedPoint;
266
                        adjustedPoint=(Point2D)point.clone();
267
                }else{
268

    
269
                        minDistance= getGrid().adjustToGrid(gridAdjustedPoint);
270
                        if (minDistance < Double.MAX_VALUE) {
271
                                adjustedPoint = getMapControl().getViewPort().fromMapPoint(gridAdjustedPoint);
272
                                mapAdjustedPoint = gridAdjustedPoint;
273
                        } else {
274
                                mapAdjustedPoint = null;
275
                        }
276
                }
277
                Point2D handlerAdjustedPoint = null;
278

    
279
                //Se comprueba el ajuste a los handlers
280
                if (mapAdjustedPoint != null) {
281
                        handlerAdjustedPoint = (Point2D) mapAdjustedPoint.clone(); //getMapControl().getViewPort().toMapPoint(point);
282
                } else {
283
                        handlerAdjustedPoint = getMapControl().getViewPort().toMapPoint(point);
284
                }
285

    
286
                Point2D mapPoint = new Point2D.Double();
287
                double distance = adjustToHandler(handlerAdjustedPoint, mapPoint);
288

    
289
                if (distance < minDistance) {
290
                        adjustSnapping = true;
291
                        adjustedPoint = getMapControl().getViewPort().fromMapPoint(handlerAdjustedPoint);
292
                        mapAdjustedPoint = mapPoint;
293
                        minDistance = distance;
294
                }
295

    
296
                //Si no hay ajuste
297
                if (minDistance == Double.MAX_VALUE) {
298
                        adjustedPoint = point;
299
                        mapAdjustedPoint = null;
300
                }
301

    
302
        }
303

    
304
        /**
305
         * @see java.awt.event.MouseWheelListener#mouseWheelMoved(java.awt.event.MouseWheelEvent)
306
         */
307
        public void mouseWheelMoved(MouseWheelEvent e) throws BehaviorException {
308
        }
309

    
310
        /**
311
         * M?todo que realiza las transiciones en las herramientas en funci?n de un
312
         * texto introducido en la consola
313
         *
314
         * @param text DOCUMENT ME!
315
         */
316
        public void textEntered(String text) {
317
                if (text == null) {
318
                        transition("cancel");
319
                } else {
320
                /*        if ("".equals(text)) {
321
                                transition("aceptar");
322
                        } else {*/
323
                                text = text.trim();
324

    
325
                                String[] numbers = text.split(",");
326
                                double[] values = null;
327

    
328
                                try {
329
                                        if (numbers.length == 2) {
330
                                                //punto
331
                                                values = new double[] {
332
                                                                Double.parseDouble(numbers[0]),
333
                                                                Double.parseDouble(numbers[1])
334
                                                        };
335
                                                transition( vea,
336
                                                        values);
337
                                        } else if (numbers.length == 1) {
338
                                                //valor
339
                                                values = new double[] { Double.parseDouble(numbers[0]) };
340
                                                transition( vea,
341
                                                        values[0]);
342
                                        }
343
                                } catch (NumberFormatException e) {
344
                                        transition( vea,
345
                                                text);
346
                                }
347
                        //}
348
                }
349

    
350
        }
351

    
352
        /**
353
         * DOCUMENT ME!
354
         *
355
         * @param text DOCUMENT ME!
356
         */
357
        public void transition(String text) {
358
                transition( vea, text);
359

    
360
        }
361

    
362
        /**
363
         * DOCUMENT ME!
364
         */
365
        public void configureMenu() {
366
                String[] desc = ((CADTool) cadToolStack.peek()).getDescriptions();
367
                //String[] labels = ((CADTool) cadToolStack.peek()).getCurrentTransitions();
368
                CADExtension.clearMenu();
369

    
370
                for (int i = 0; i < desc.length; i++) {
371
                        if (desc[i] != null) {
372
                                CADExtension.addMenuEntry(desc[i]);//, labels[i]);
373
                        }
374
                }
375

    
376
        }
377

    
378
        /**
379
         * DOCUMENT ME!
380
         *
381
         * @param text DOCUMENT ME!
382
         * @param source DOCUMENT ME!
383
         * @param sel DOCUMENT ME!
384
         * @param values DOCUMENT ME!
385
         */
386
        private void transition( VectorialEditableAdapter source,
387
                double[] values) {
388
                questionAsked = true;
389
                if (!cadToolStack.isEmpty()){
390
                    CADTool ct = (CADTool) cadToolStack.peek();
391
                    ///String[] trs = ct.getAutomaton().getCurrentTransitions();
392
                    boolean esta = true;
393
                  /*  for (int i = 0; i < trs.length; i++) {
394
                if (trs[i].toUpperCase().equals(text.toUpperCase()))
395
                    esta = true;
396
            }
397
                    */
398
                    if (!esta){
399
                        askQuestion();
400
                    }else{
401
                                ct.transition(values[0],values[1]);
402
                                //Si es la transici?n que finaliza una geometria hay que redibujar la vista.
403

    
404
                                askQuestion();
405
                        /*        if ((ret & Automaton.AUTOMATON_FINISHED) == Automaton.AUTOMATON_FINISHED) {
406
                                        popCadTool();
407

408
                                        if (cadToolStack.isEmpty()) {
409
                                                pushCadTool(new com.iver.cit.gvsig.gui.cad.smc.gen.CADTool());//new SelectionCadTool());
410
                                                PluginServices.getMainFrame().setSelectedTool("selection");
411
                                        }
412

413
                                        askQuestion();
414

415
                                        getMapControl().drawMap(false);
416
                                } else {
417
                                        if (((CadTool) cadToolStack.peek()).getAutomaton().checkState('c')) {
418
                                                getMapControl().drawMap(false);
419
                                        }
420

421
                                        if (!questionAsked) {
422
                                                askQuestion();
423
                                        }
424
                                }
425

426
                                configureMenu();*/
427
                    }
428
                }
429
                configureMenu();
430
                //PluginServices.getMainFrame().enableControls();
431
        }
432
        /**
433
         * DOCUMENT ME!
434
         *
435
         * @param text DOCUMENT ME!
436
         * @param source DOCUMENT ME!
437
         * @param sel DOCUMENT ME!
438
         * @param values DOCUMENT ME!
439
         */
440
        private void transition( VectorialEditableAdapter source,
441
                double value) {
442
                questionAsked = true;
443
                if (!cadToolStack.isEmpty()){
444
                    CADTool ct = (CADTool) cadToolStack.peek();
445
                    ct.transition(value);
446
                        askQuestion();
447
                    }
448
                configureMenu();
449
                PluginServices.getMainFrame().enableControls();
450
        }
451
        private void transition(VectorialEditableAdapter source,
452
                        String option) {
453
                        questionAsked = true;
454
                        if (!cadToolStack.isEmpty()){
455
                            CADTool ct = (CADTool) cadToolStack.peek();
456
                            ct.transition(option);
457
                                askQuestion();
458
                            }
459
                        configureMenu();
460
                        //PluginServices.getMainFrame().enableControls();
461
        }
462
        /**
463
         * DOCUMENT ME!
464
         *
465
         * @param value DOCUMENT ME!
466
         */
467
        public void setGrid(boolean value) {
468
                getGrid().setUseGrid(value);
469
                getGrid().setViewPort(getMapControl().getViewPort());
470
                getMapControl().drawMap(false);
471
        }
472

    
473
        /**
474
         * DOCUMENT ME!
475
         *
476
         * @param activated DOCUMENT ME!
477
         */
478
        public void setSnapping(boolean activated) {
479
                snapping = activated;
480
        }
481

    
482
        /**
483
         * DOCUMENT ME!
484
         *
485
         * @param x DOCUMENT ME!
486
         * @param y DOCUMENT ME!
487
         * @param dist DOCUMENT ME!
488
         */
489
        public void getSnapPoint(double x, double y, double dist) {
490
        }
491

    
492
        /**
493
         * @see com.iver.cit.gvsig.fmap.tools.Behavior.Behavior#getListener()
494
         */
495
        public ToolListener getListener() {
496
                return new ToolListener() {
497
                                /**
498
                                 * @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor()
499
                                 */
500
                                public Cursor getCursor() {
501
                                        return null;
502
                                }
503

    
504
                                /**
505
                                 * @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing()
506
                                 */
507
                                public boolean cancelDrawing() {
508
                                        return false;
509
                                }
510
                        };
511
        }
512

    
513
        /**
514
         * DOCUMENT ME!
515
         *
516
         * @return DOCUMENT ME!
517
         */
518
        public CADTool getCadTool() {
519
                return (CADTool) cadToolStack.peek();
520
        }
521

    
522
        /**
523
         * DOCUMENT ME!
524
         *
525
         * @param cadTool DOCUMENT ME!
526
         */
527
        public void pushCadTool(CADTool cadTool) {
528
                cadToolStack.push(cadTool);
529
                cadTool.setCadToolAdapter(this);
530
                //cadTool.initializeStatus();
531
                //cadTool.setVectorialAdapter(vea);
532
                /*int ret = cadTool.transition(null, editableFeatureSource, selection,
533
                                new double[0]);
534

535
                if ((ret & Automaton.AUTOMATON_FINISHED) == Automaton.AUTOMATON_FINISHED) {
536
                        popCadTool();
537

538
                        if (cadToolStack.isEmpty()) {
539
                                pushCadTool(new com.iver.cit.gvsig.gui.cad.smc.gen.CADTool());//new SelectionCadTool());
540
                                PluginServices.getMainFrame().setSelectedTool("selection");
541
                        }
542

543
                        askQuestion();
544

545
                        getMapControl().drawMap(false);
546
                }
547
                */
548
        }
549

    
550
        /**
551
         * DOCUMENT ME!
552
         */
553
        public void popCadTool() {
554
                cadToolStack.pop();
555
        }
556

    
557
        /**
558
         * DOCUMENT ME!
559
         */
560
        public void askQuestion() {
561
                CADTool cadtool=(CADTool) cadToolStack.peek();
562
                /*if (cadtool..getStatus()==0){
563
                        PluginServices.getMainFrame().addTextToConsole("\n" +cadtool.getName());
564
                }
565
*/
566
                View vista = (View) PluginServices.getMDIManager().getActiveView();
567
                vista.getConsolePanel().addText("\n" + cadtool.getQuestion()+">");
568
                //***PluginServices.getMainFrame().addTextToConsole("\n" + cadtool.getQuestion());
569
                questionAsked = true;
570

    
571
        }
572

    
573
        /**
574
         * DOCUMENT ME!
575
         *
576
         * @param cadTool DOCUMENT ME!
577
         */
578
        public void setCadTool(CADTool cadTool) {
579
                cadToolStack.clear();
580
                pushCadTool(cadTool);
581
                askQuestion();
582
        }
583

    
584
        /**
585
         * DOCUMENT ME!
586
         *
587
         * @return DOCUMENT ME!
588
         */
589
        public VectorialEditableAdapter getVectorialAdapter() {
590
                return vea;
591
        }
592

    
593
        /**
594
         * DOCUMENT ME!
595
         *
596
         * @param editableFeatureSource DOCUMENT ME!
597
         * @param selection DOCUMENT ME!
598
         */
599
        public void setVectorialAdapter(
600
                VectorialEditableAdapter vea) {
601
                this.vea = vea;
602
        }
603

    
604
        /**
605
         * DOCUMENT ME!
606
         *
607
         * @return DOCUMENT ME!
608
         */
609
        /*public CadMapControl getCadMapControl() {
610
                return cadMapControl;
611
        }
612
*/
613
        /**
614
         * DOCUMENT ME!
615
         *
616
         * @param cadMapControl DOCUMENT ME!
617
         */
618
        /*public void setCadMapControl(CadMapControl cadMapControl) {
619
                this.cadMapControl = cadMapControl;
620
        }
621
*/
622

    
623
        /**
624
         * Elimina las geometr?as seleccionadas actualmente
625
         */
626
        private void delete() {
627
                vea.startComplexRow();
628
                FBitSet selection=getVectorialAdapter().getSelection();
629
                try {
630
                        for (int i = selection.nextSetBit(0); i >= 0;
631
                                        i = selection.nextSetBit(i + 1)) {
632
                                vea.removeRow(i);
633
                        }
634
                } catch (DriverIOException e) {
635
                        e.printStackTrace();
636
                } catch (IOException e) {
637
                        e.printStackTrace();
638
                } finally {
639
                        try {
640
                                vea.endComplexRow();
641
                        } catch (IOException e1) {
642
                                e1.printStackTrace();
643
                        } catch (DriverIOException e1) {
644
                                e1.printStackTrace();
645
                        }
646
                }
647

    
648
                selection.clear();
649
                getMapControl().drawMap(false);
650
        }
651

    
652
        /**
653
         * DOCUMENT ME!
654
         *
655
         * @param b
656
         */
657
        public void setAdjustGrid(boolean b) {
658
                getGrid().setAdjustGrid(b);
659
        }
660

    
661
        /**
662
         * DOCUMENT ME!
663
         *
664
         * @param actionCommand
665
         */
666
        public void keyPressed(String actionCommand) {
667
                if (actionCommand.equals("eliminar")) {
668
                        delete();
669
                } else if (actionCommand.equals("escape")) {
670
                        if (getMapControl().getTool().equals("cadtooladapter")){
671
                                CADTool ct = (CADTool) cadToolStack.peek();
672
                                ct.end();
673
                                cadToolStack.clear();
674
                                pushCadTool(new SelectionCADTool());
675
                                getVectorialAdapter().getSelection().clear();
676
                                getMapControl().drawMap(false);
677
                                PluginServices.getMainFrame().setSelectedTool("SELCAD");
678
                                askQuestion();
679
                        }
680
                }
681

    
682
                PluginServices.getMainFrame().enableControls();
683

    
684
        }
685
        public CADGrid getGrid(){
686
                return cadgrid;
687
        }
688
}