Revision 4365

View differences:

trunk/extensions/extCAD/sm/CircleCADTool.sm
30 30
			PointOrRadius {
31 31
				setQuestion("Insertar radio o segundo punto");
32 32
				setDescription(new String[]{"Cancelar"});
33
				addPoint( pointX,pointY);
33
				addPoint( pointX,pointY,event);
34 34
				}
35 35
	addOption( s:String)
36 36
		[s.equals("3p") || s.equals("3P")]
......
43 43
PointOrRadius{
44 44
	addPoint( pointX:double,pointY:double,event:InputEvent)
45 45
		CenterPointOr3p {
46
			addPoint( pointX,pointY);
46
			addPoint( pointX,pointY,event);
47 47
			end();
48 48
			}
49 49
	addValue( d:double)
......
57 57
		ThirdPoint {
58 58
			setQuestion("Insertar tercer punto");
59 59
			setDescription(new String[]{"Cancelar"});
60
			addPoint( pointX,pointY);
60
			addPoint( pointX,pointY,event);
61 61
			}
62 62
}
63 63
ThirdPoint{
64 64
	addPoint( pointX:double,pointY:double,event:InputEvent)
65 65
		CenterPointOr3p {
66
			addPoint( pointX,pointY);
66
			addPoint( pointX,pointY,event);
67 67
			end();
68 68
			}
69 69
}
......
73 73
		SecondPoint {
74 74
			setQuestion("Insertar segundo punto");
75 75
			setDescription(new String[]{"Cancelar"});
76
			addPoint( pointX,pointY);
76
			addPoint( pointX,pointY,event);
77 77
			}
78 78
}
79 79

  
trunk/extensions/extCAD/sm/EditVertexCADTool.sm
9 9
%class EditVertexCADTool
10 10
%package com.iver.cit.gvsig.gui.cad.tools.smc
11 11
%import com.iver.cit.gvsig.gui.cad.tools.EditVertexCADTool
12
%import java.awt.event.InputEvent
12 13

  
13 14
%map EditVertex
14 15
%%
......
26 27
		}
27 28

  
28 29
	{
30
		addPoint( pointX:double,pointY:double,event:InputEvent)
31
			SelectVertexOrDelete {
32
				setQuestion("Seleccionar a partir de un punto");
33
				setDescription(new String[]{"Siguiente","Anterior","Anyadir","Eliminar","Cancelar"});
34
				addPoint( pointX,pointY,event);
35
				}
29 36
		addOption(s:String)
30 37
			SelectVertexOrDelete {
31 38
				setQuestion("Siguiente vertice, aNyadir, Anterior o Eliminar");
......
33 40
				addOption(s);
34 41
				}
35 42
	}
36
	
37 43

  
44

  
38 45
Default
39 46
{
40 47
	addOption(s:String)
trunk/extensions/extCAD/sm/RectangleCADTool.sm
31 31
			SecondPointOrSquare {
32 32
				setQuestion("Insertar punto de esquina opuesta o Cuadrado[C]");
33 33
				setDescription(new String[]{"Cuadrado","Cancelar"});
34
				addPoint(pointX,pointY);
34
				addPoint( pointX,pointY,event);
35 35
				}
36 36

  
37 37
	}
38 38
SecondPointOrSquare{
39 39
	addPoint( pointX:double,pointY:double,event:InputEvent)
40 40
		FirstPoint {
41
			addPoint(pointX,pointY);
41
			addPoint(pointX,pointY,event);
42 42
			end();
43 43
			}
44 44
	addOption(s:String)
......
53 53
SecondPointSquare{
54 54
	addPoint( pointX:double,pointY:double,event:InputEvent)
55 55
		FirstPoint {
56
			addPoint(pointX,pointY);
56
			addPoint( pointX,pointY,event);
57 57
			end();
58 58
			}
59 59
}
trunk/extensions/extCAD/sm/ArcCADTool.sm
30 30
			SecondPoint {
31 31
				setQuestion("Insertar segundo punto");
32 32
				setDescription(new String[]{"Cancelar"});
33
				addPoint( pointX,pointY);
33
				addPoint( pointX,pointY,event);
34 34
				}
35 35

  
36 36
	}
......
39 39
		ThirdPoint {
40 40
			setQuestion("Insertar ultimo punto");
41 41
			setDescription(new String[]{"Cancelar"});
42
			addPoint( pointX,pointY);
42
			addPoint( pointX,pointY,event);
43 43
			}
44 44
}
45 45
ThirdPoint{
46 46
	addPoint( pointX:double,pointY:double,event:InputEvent)
47 47
		FirstPoint {
48
			addPoint(pointX,pointY);
48
			addPoint( pointX,pointY,event);
49 49
			end();
50 50
			}
51 51
}
trunk/extensions/extCAD/sm/SelectionCADTool.sm
33 33
			SecondPoint{
34 34
				setQuestion("Precise segundo punto del rect?ngulo de seleccion");
35 35
				setDescription(new String[]{"Cancelar"});
36
				addPoint(pointX,pointY);
36
				addPoint( pointX,pointY,event);
37 37
				}
38 38
		addPoint( pointX:double,pointY:double,event:InputEvent)
39 39
			[ctxt.getState().equals("Selection.FirstPoint")]
40 40
			FirstPoint {
41 41
				setQuestion("Precise punto");
42 42
				setDescription(new String[]{"Cancelar"});
43
				addPoint(pointX,pointY);
43
				addPoint( pointX,pointY,event);
44 44
				}
45 45
		addPoint( pointX:double,pointY:double,event:InputEvent)
46 46
			[ctxt.getState().equals("Selection.EndPoint")]
47 47
			EndPoint {
48 48
				setQuestion("Precise punto destino");
49 49
				setDescription(new String[]{"Cancelar"});
50
				addPoint(pointX,pointY);
50
				addPoint( pointX,pointY,event);
51 51
				}
52 52
}
53 53

  
......
56 56
			FirstPoint {
57 57
				setQuestion("Precise punto de estiramiento");
58 58
				setDescription(new String[]{"Cancelar"});
59
				addPoint(pointX,pointY);
59
				addPoint( pointX,pointY,event);
60 60
				end();
61 61
				}
62 62

  
......
67 67
			FirstPoint {
68 68
				setQuestion("Precise punto destino");
69 69
				setDescription(new String[]{"Cancelar"});
70
				addPoint(pointX,pointY);
70
				addPoint( pointX,pointY,event);
71 71
				end();
72 72
				refresh();
73 73
				}
trunk/extensions/extCAD/sm/LineCADTool.sm
31 31
			SecondPointOrAngle {
32 32
				setQuestion("Insertar segundo punto o angulo");
33 33
				setDescription(new String[]{"Cancelar"});
34
				addPoint( pointX,pointY);
34
				addPoint( pointX,pointY,event);
35 35
				}
36 36

  
37 37
	}
......
40 40
		SecondPointOrAngle {
41 41
			setQuestion("Insertar segundo punto o angulo");
42 42
			setDescription(new String[]{"Cancelar"});
43
			addPoint( pointX,pointY);
43
			addPoint( pointX,pointY,event);
44 44
			}
45 45
	addValue( d:double)
46 46
		LenghtOrPoint {
......
55 55
		SecondPointOrAngle {
56 56
			setQuestion("Insertar segundo punto o angulo");
57 57
			setDescription(new String[]{"Cancelar"});
58
			addPoint( pointX,pointY);
58
			addPoint( pointX,pointY,event);
59 59
			}
60 60
	addValue( d:double)
61 61
		SecondPointOrAngle {
trunk/extensions/extCAD/sm/PolygonCADTool.sm
36 36
			OptionOrRadiusOrPoint {
37 37
				setQuestion("Inscrito en el c?rculo[I] o Circunscrito[C]<C>");
38 38
				setDescription(new String[]{"Inscrito","Circunscrito","Cancelar"});
39
				addPoint(pointX,pointY);
39
				addPoint( pointX,pointY,event);
40 40
				}
41 41

  
42 42
	}
......
45 45
		OptionOrRadiusOrPoint {
46 46
			setQuestion("Inscrito en el c?rculo[I] o Circunscrito[C]<C>");
47 47
			setDescription(new String[]{"Inscrito","Circunscrito","Cancelar"});
48
			addPoint(pointX,pointY);
48
			addPoint( pointX,pointY,event);
49 49
			}
50 50
}
51 51
OptionOrRadiusOrPoint{
......
62 62
			}
63 63
	addPoint( pointX:double,pointY:double,event:InputEvent)
64 64
		NumberOrCenterPoint {
65
			addPoint(pointX,pointY);
65
			addPoint( pointX,pointY,event);
66 66
			end();
67 67
			}
68 68
}
69 69
RadiusOrPoint{
70 70
	addPoint( pointX:double,pointY:double,event:InputEvent)
71 71
		NumberOrCenterPoint {
72
			addPoint(pointX,pointY);
72
			addPoint( pointX,pointY,event);
73 73
			end();
74 74
			}
75 75
	addValue(d:double)
trunk/extensions/extCAD/sm/ScaleCADTool.sm
31 31
			ScaleFactorOrReference {
32 32
				setQuestion("Precise factor de escala<2> o Referencia[R]");
33 33
				setDescription(new String[]{"Referencia","Cancelar"});
34
				addPoint(pointX,pointY);
34
				addPoint( pointX,pointY,event);
35 35
				}
36 36
	}
37 37
ScaleFactorOrReference{
......
57 57
			}
58 58
	addPoint( pointX:double,pointY:double,event:InputEvent)
59 59
		PointMain {
60
			addPoint(pointX,pointY);
60
			addPoint( pointX,pointY,event);
61 61
			end();
62 62
			refresh();
63 63
			}
......
74 74
		EndPointReference {
75 75
			setQuestion("Precise punto final recta referencia");
76 76
			setDescription(new String[]{"Cancelar"});
77
			addPoint(pointX,pointY);
77
			addPoint( pointX,pointY,event);
78 78
			}
79 79
}
80 80
EndPointReference{
......
82 82
		OriginPointScale {
83 83
			setQuestion("Precise punto origen recta escala");
84 84
			setDescription(new String[]{"Cancelar"});
85
			addPoint(pointX,pointY);
85
			addPoint( pointX,pointY,event);
86 86
			}
87 87
}
88 88
OriginPointScale{
......
90 90
		EndPointScale {
91 91
			setQuestion("Precise punto final recta escala");
92 92
			setDescription(new String[]{"Cancelar"});
93
			addPoint(pointX,pointY);
93
			addPoint( pointX,pointY,event);
94 94
			}
95 95
}
96 96
EndPointScale{
97 97
	addPoint( pointX:double,pointY:double,event:InputEvent)
98 98
		PointMain {
99
			addPoint(pointX,pointY);
99
			addPoint( pointX,pointY,event);
100 100
			end();
101 101
			refresh();
102 102
			}
trunk/extensions/extCAD/sm/PointCADTool.sm
32 32
			FirstPoint {
33 33
				setQuestion("Insertar punto");
34 34
				setDescription(new String[]{"Cancelar"});
35
				addPoint( pointX,pointY);
35
				addPoint( pointX,pointY,event);
36 36
				}
37 37
	}
38 38

  
trunk/extensions/extCAD/sm/CopyCADTool.sm
31 31
			SecondPointToMove {
32 32
				setQuestion("Precisar segundo punto del desplazamiento");
33 33
				setDescription(new String[]{"Cancelar"});
34
				addPoint(pointX,pointY);
34
				addPoint( pointX,pointY,event);
35 35
				}
36 36
	}
37 37
SecondPointToMove{
38 38
	addPoint( pointX:double,pointY:double,event:InputEvent)
39 39
		FirstPointToMove {
40 40
			setDescription(new String[]{"Cancelar"});
41
			addPoint(pointX,pointY);
41
			addPoint( pointX,pointY,event);
42 42
			end();
43 43
			refresh();
44 44
			}
trunk/extensions/extCAD/sm/PolylineCADTool.sm
30 30
			NextPointOrArcOrClose{
31 31
				setQuestion("Insertar siguiente punto, Arco[A] o Cerrar[C]");
32 32
				setDescription(new String[]{"Arco","Cerrar","Cancelar"});
33
				addPoint(pointX,pointY);
33
				addPoint( pointX,pointY,event);
34 34
				}
35 35
	}
36 36
NextPointOrArcOrClose{
......
54 54
		NextPointOrArcOrClose {
55 55
			setQuestion("Insertar siguiente punto, Arco[A] o Cerrar[C]");
56 56
			setDescription(new String[]{"Arco","Cerrar","Cancelar"});
57
			addPoint(pointX,pointY);
57
			addPoint( pointX,pointY,event);
58 58
			}
59 59
}
60 60
NextPointOrLineOrClose{
......
62 62
		NextPointOrLineOrClose {
63 63
			setQuestion("Insertar punto siguiente, Linea[N] o Cerrar[C]");
64 64
			setDescription(new String[]{"Linea","Cerrar","Cancelar"});
65
			addPoint(pointX,pointY);
65
			addPoint( pointX,pointY,event);
66 66
			}
67 67
	addOption(s:String)
68 68
		[s.equals("N") ||  s.equals("n") || s.equals("Linea")]
trunk/extensions/extCAD/sm/EllipseCADTool.sm
30 30
			SecondPointAxis {
31 31
				setQuestion("Insertar punto final de eje de elipse");
32 32
				setDescription(new String[]{"Cancelar"});
33
				addPoint( pointX,pointY);
33
				addPoint( pointX,pointY,event);
34 34
				}
35 35

  
36 36
	}
......
39 39
		DistanceOtherAxis {
40 40
			setQuestion("Insertar distancia al otro eje");
41 41
			setDescription(new String[]{"Cancelar"});
42
			addPoint( pointX,pointY);
42
			addPoint( pointX,pointY,event);
43 43
			}
44 44

  
45 45
}
46 46
DistanceOtherAxis{
47 47
	addPoint( pointX:double,pointY:double,event:InputEvent)
48 48
		FirstPointAxis {
49
			addPoint( pointX,pointY);
49
			addPoint( pointX,pointY,event);
50 50
			end();
51 51
			}
52 52
	addValue( d:double)
trunk/extensions/extCAD/sm/RotateCADTool.sm
31 31
			AngleOrPoint {
32 32
				setQuestion("Precise angulo de rotacion");
33 33
				setDescription(new String[]{"Cancelar"});
34
				addPoint(pointX,pointY);
34
				addPoint( pointX,pointY,event);
35 35
				}
36 36
	}
37 37
AngleOrPoint{
......
45 45
	addPoint( pointX:double,pointY:double,event:InputEvent)
46 46
		PointMain {
47 47
			setDescription(new String[]{"Cancelar"});
48
			addPoint(pointX,pointY);
48
			addPoint( pointX,pointY,event);
49 49
			end();
50 50
			refresh();
51 51
			}
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/CircleCADTool.java
111 111
     * @param x par?metro x del punto que se pase en esta transici?n.
112 112
     * @param y par?metro y del punto que se pase en esta transici?n.
113 113
     */
114
    public void addPoint(double x, double y) {
114
    public void addPoint(double x, double y,InputEvent event) {
115 115
        CircleCADToolState actualState = (CircleCADToolState) _fsm.getPreviousState();
116 116
        String status = actualState.getName();
117 117

  
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/EditVertexCADTool.java
46 46
import java.awt.geom.AffineTransform;
47 47
import java.awt.geom.PathIterator;
48 48
import java.awt.geom.Point2D;
49
import java.awt.geom.Rectangle2D;
49 50
import java.io.IOException;
51
import java.util.ArrayList;
50 52

  
51 53
import com.iver.cit.gvsig.CADExtension;
54
import com.iver.cit.gvsig.fmap.DriverException;
52 55
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
56
import com.iver.cit.gvsig.fmap.core.FGeometry;
53 57
import com.iver.cit.gvsig.fmap.core.FGeometryCollection;
54 58
import com.iver.cit.gvsig.fmap.core.FPoint2D;
55 59
import com.iver.cit.gvsig.fmap.core.FPolygon2D;
......
70 74
import com.iver.cit.gvsig.gui.cad.DefaultCADTool;
71 75
import com.iver.cit.gvsig.gui.cad.tools.smc.EditVertexCADToolContext;
72 76
import com.iver.cit.gvsig.gui.cad.tools.smc.EditVertexCADToolContext.EditVertexCADToolState;
73
import com.vividsolutions.jts.geom.Geometry;
77
import com.iver.cit.gvsig.layers.VectorialLayerEdited;
74 78

  
75 79

  
76 80
/**
......
82 86
    private EditVertexCADToolContext _fsm;
83 87
    private int numSelect=0;
84 88
	private int numHandlers;
85

  
89
	private boolean addVertex=false;
86 90
    /**
87 91
     * Crea un nuevo PolylineCADTool.
88 92
     */
......
101 105
     * @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, double, double)
102 106
     */
103 107
    public void transition(double x, double y, InputEvent event) {
104
        addPoint(x, y);
108
        addPoint(x, y, event);
105 109
    }
106 110

  
107 111
    /* (non-Javadoc)
......
139 143
     * @param x par?metro x del punto que se pase en esta transici?n.
140 144
     * @param y par?metro y del punto que se pase en esta transici?n.
141 145
     */
142
    public void addPoint(double x, double y) {
143
    	IGeometry geom = getSelectedGeometry();
144
    	Geometry jtsGeom = geom.toJTSGeometry();
145
    	
146
		/* IRow newRow=new DefaultFeature(newGeometry,row.getAttributes());
147
		try {
148
			vea.modifyRow(selection.nextSetBit(0),newRow,getName());
149
		} catch (IOException e) {
150
			// TODO Auto-generated catch block
151
			e.printStackTrace();
152
		} catch (DriverIOException e) {
153
			// TODO Auto-generated catch block
154
			e.printStackTrace();
155
		} */
156
		getCadToolAdapter().getMapControl().drawMap(false);    	
157
    	
158
    	
146
    public void addPoint(double x, double y,InputEvent event) {
147
    	selectHandler(x,y);
148
    	addVertex=false;
159 149
    }
160 150

  
161 151
    private IGeometry getSelectedGeometry() {
......
164 154
        IRowEdited row=null;
165 155
        IGeometry ig=null;
166 156
        if (selection.cardinality()==1){
167

  
168 157
			try {
169 158
				row = getCadToolAdapter().getVectorialAdapter().getRow(selection.nextSetBit(0));
170 159
			} catch (DriverIOException e) {
171
				// TODO Auto-generated catch block
172 160
				e.printStackTrace();
173 161
			} catch (IOException e) {
174
				// TODO Auto-generated catch block
175 162
				e.printStackTrace();
176 163
			}
177 164
        	ig=((IFeature)row.getLinkedRow()).getGeometry().cloneGeometry();
......
200 187
                getCadToolAdapter().getMapControl().getViewPort()
201 188
                    .getAffineTransform());
202 189
        } catch (DriverIOException e) {
203
            // TODO Auto-generated catch block
204 190
            e.printStackTrace();
205 191
        }
192

  
206 193
    }
207 194

  
208 195
    /**
......
254 241
        		if (numSelect<0){
255 242
        			numSelect=numHandlers-1+(numSelect+1);
256 243
        		}
257
           }else if(s.equals("a") || s.equals("a") || s.equals("Anterior")){
244
           }else if(s.equals("a") || s.equals("A") || s.equals("Anterior")){
258 245
        	   	numSelect=numSelect+dif;
259 246
       			if (numSelect>(numHandlers-1)){
260 247
       				numSelect=numSelect-(numHandlers);
......
277 264
					}
278 265
					getCadToolAdapter().getMapControl().drawMap(false);
279 266
        		}
267
        	}else if(s.equals("i") || s.equals("I") || s.equals("Anyadir")){
268
        		addVertex=true;
280 269
        	}
281 270
        }
282 271
    }
......
289 278
				FGraphicUtilities.DrawVertex((Graphics2D)g,at,handlers[numSelect]);
290 279
		}
291 280
	}
281

  
292 282
    /* (non-Javadoc)
293 283
     * @see com.iver.cit.gvsig.gui.cad.CADTool#addvalue(double)
294 284
     */
295 285
    public void addValue(double d) {
296 286
    }
297
    public IGeometry removeVertex(IGeometry gp,Handler handler) {
287
    private IGeometry removeVertex(IGeometry gp,Handler handler) {
298 288
        GeneralPathX newGp = new GeneralPathX();
299 289
        double[] theData = new double[6];
300 290

  
......
379 369
        }
380 370
        return ShapeFactory.createGeometry(shp);
381 371
    }
372
    private IGeometry addVertex(IGeometry geome,Point2D p,Rectangle2D rect) {
373
    	IGeometry geometryCloned=geome.cloneGeometry();
374
    	FGeometry geom1=null;
375
    	FGeometry geom2=null;
376
    	if (geometryCloned instanceof FGeometryCollection){
377
    		IGeometry[] geometries=((FGeometryCollection)geometryCloned).getGeometries();
378
    		boolean isSelected=false;
379
    		for (int i=0;i<geometries.length;i++){
380
    			if (geometries[i].intersects(rect) && !isSelected){
381
    				isSelected=true;
382
    				Handler[] handlers=geometries[i].getHandlers(IGeometry.SELECTHANDLER);
382 383

  
384
    				GeneralPathX gp1=new GeneralPathX();
385
    				Point2D pinit1=(Point2D)handlers[0].getPoint().clone();
386
    				gp1.moveTo(pinit1.getX(),pinit1.getY());
387
    				System.out.println("Handler inicial = "+pinit1);
388
    				gp1.lineTo(p.getX(),p.getY());
389
    				System.out.println("Handler medio = "+p);
390
    				FPolyline2D poly1=new FPolyline2D(gp1);
391
    				geom1=ShapeFactory.createGeometry(poly1);
392

  
393
    				GeneralPathX gp2=new GeneralPathX();
394
    				gp2.moveTo(p.getX(),p.getY());
395
    				System.out.println("Handler medio = "+p);
396
    				Point2D pEnd=(Point2D)handlers[1].getPoint().clone();
397
    				gp2.lineTo(pEnd.getX(),pEnd.getY());
398
    				System.out.println("Handler final = "+pEnd);
399
    				FPolyline2D poly2=new FPolyline2D(gp2);
400
    				geom2=ShapeFactory.createGeometry(poly2);
401

  
402
    				ArrayList geomsAux=new ArrayList();
403
    				geometries[i]=geom1;
404
    				for (int j=i;j<geometries.length;j++){
405
    					geomsAux.add(geometries[j]);
406
    				}
407

  
408
    				if (i<geometries.length-1){
409
    					geometries[i+1]=geom2;
410
    					Handler[] hands=((IGeometry)geom1).getHandlers(IGeometry.SELECTHANDLER);
411
    					for (int h=0;h<hands.length;h++)
412
    					System.out.println("Handlers New Geometry = "+hands[h].getPoint());
413
    					Handler[] hands2=((IGeometry)geom2).getHandlers(IGeometry.SELECTHANDLER);
414
    					for (int h=0;h<hands2.length;h++)
415
    					System.out.println("Handlers New Geometry = "+hands2[h].getPoint());
416
    				}else{
417
    					geometryCloned=new FGeometryCollection(geometries);
418
    					((FGeometryCollection)geometryCloned).addGeometry(geom2);
419
    				}
420
    				for (int j=i+1;j<geometries.length;j++){
421
    					if ((j-i)<geomsAux.size()-1){
422
        					geometries[j+1]=(IGeometry)geomsAux.get(j-i);
423
        				}else{
424
        					geometryCloned=new FGeometryCollection(geometries);
425
        					((FGeometryCollection)geometryCloned).addGeometry((IGeometry)geomsAux.get(j-i));
426

  
427
        				}
428
    				}
429
    			}
430

  
431
    		}
432
    	}
433
    	return geometryCloned;
434

  
435

  
436

  
437
    	/*Geometry jtsGeom = geometry.toJTSGeometry();
438
    	Coordinate[] coords=jtsGeom.getCoordinates();
439
    	Coordinate[] newcoordinates=new Coordinate[coords.length+1];
440
    	int i;
441
    	for (i=0;i<coords.length;i++){
442
    		newcoordinates[i]=coords[i];
443
    	}
444
    	newcoordinates[i+1]=new Coordinate(p.getX(), p.getY());
445
    	//Geometry jtsGeomNew = new GeometryFactory().createPoint(new Coordinate(p.getX(), p.getY()));
446
    	//Geometry jtsGeomNew = new GeometryFactory().createPoint(new Coordinate(p.getX(), p.getY()));
447
    	//GeometryCollection res=new GeometryCollection(new Geometry[]{jtsGeom,jtsGeomNew},null);//jtsGeom.union(jtsGeomNew);
448
    	return FConverter.jts_to_igeometry(res);
449
    	*/
450
    }
383 451
	public String getName() {
384 452
		return "EDITAR VERTICE";
385 453
	}
454
	private void selectHandler(double x, double y) {
455
		Point2D firstPoint = new Point2D.Double(x, y);
456
		FBitSet selection = getCadToolAdapter().getVectorialAdapter()
457
				.getSelection();
458
		double tam = getCadToolAdapter().getMapControl().getViewPort()
459
				.toMapDistance(SelectionCADTool.tolerance);
460
		 Rectangle2D rect = new Rectangle2D.Double(firstPoint.getX() - tam,
461
					firstPoint.getY() - tam, tam * 2, tam * 2);
462
		if (selection.cardinality()>0){
463
			boolean isSelectedHandler=false;
464
			 IGeometry geometry=getSelectedGeometry();
465
				 Handler[] handlers=geometry.getHandlers(IGeometry.SELECTHANDLER);
466
				 for (int h=0;h<handlers.length;h++){
467
					 if (handlers[h].getPoint().distance(firstPoint)<tam){
468
						 numSelect=h;
469
						 isSelectedHandler=true;
470
					 }
471
				 }
472

  
473
				 if (!isSelectedHandler){
474
					 boolean isSelectedGeometry=false;
475
					 try {
476

  
477
							VectorialEditableAdapter vea = getCadToolAdapter()
478
									.getVectorialAdapter();
479
							String strEPSG = getCadToolAdapter().getMapControl().getViewPort()
480
									.getProjection().getAbrev().substring(5);
481
							IRowEdited[] feats = vea.getFeatures(rect, strEPSG);
482

  
483
							for (int i = 0; i < feats.length; i++) {
484
								if (geometry.intersects(rect)) { // , 0.1)){
485
									isSelectedGeometry=true;
486
								}
487
							}
488
							if (isSelectedGeometry && addVertex){
489
								selection = getCadToolAdapter().getVectorialAdapter()
490
								.getSelection();
491
						    	DefaultFeature fea=null;
492
								try {
493
									fea = (DefaultFeature) getCadToolAdapter()
494
									.getVectorialAdapter().getRow(selection.nextSetBit(0)).getLinkedRow();
495
								} catch (DriverIOException e) {
496
									e.printStackTrace();
497
								} catch (IOException e) {
498
									e.printStackTrace();
499
								}
500
								Point2D posVertex=new Point2D.Double(x,y);
501
						    	IGeometry geom=addVertex(fea.getGeometry(),posVertex,rect);
502

  
503
						    	getCadToolAdapter()
504
								.getVectorialAdapter().modifyRow(selection.nextSetBit(0),new DefaultFeature(geom,fea.getAttributes()),"Add vertice");
505

  
506
						    	Handler[] newHandlers=geom.getHandlers(IGeometry.SELECTHANDLER);
507
								 for (int h=0;h<newHandlers.length;h++){
508
									 if (newHandlers[h].getPoint().distance(posVertex)<tam){
509
										 numSelect=h;
510
										 isSelectedHandler=true;
511
									 }
512
								 }
513
								VectorialLayerEdited vle=(VectorialLayerEdited)CADExtension.getEditionManager().getActiveLayerEdited();
514
				    			vle.refreshSelectionCache(firstPoint,getCadToolAdapter());
515
								//getCadToolAdapter().getMapControl().drawMap(false);
516
							}
517
						} catch (DriverException e1) {
518
							e1.printStackTrace();
519
						} catch (IOException e) {
520
							// TODO Auto-generated catch block
521
							e.printStackTrace();
522
						} catch (DriverIOException e) {
523
							// TODO Auto-generated catch block
524
							e.printStackTrace();
525
						}
526

  
527
				 }
528
		}
529

  
530
	}
531

  
532

  
386 533
}
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/RectangleCADTool.java
107 107
     * @param x par?metro x del punto que se pase en esta transici?n.
108 108
     * @param y par?metro y del punto que se pase en esta transici?n.
109 109
     */
110
    public void addPoint(double x, double y) {
110
    public void addPoint(double x, double y,InputEvent event) {
111 111
        RectangleCADToolState actualState = (RectangleCADToolState) _fsm.getPreviousState();
112 112

  
113 113
        String status = actualState.getName();
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/ArcCADTool.java
107 107
     * @param x par?metro x del punto que se pase en esta transici?n.
108 108
     * @param y par?metro y del punto que se pase en esta transici?n.
109 109
     */
110
    public void addPoint(double x, double y) {
110
    public void addPoint(double x, double y,InputEvent event) {
111 111
        ArcCADToolState actualState = (ArcCADToolState) _fsm.getPreviousState();
112 112
        String status = actualState.getName();
113 113

  
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/SelectionCADTool.java
40 40
 */
41 41
package com.iver.cit.gvsig.gui.cad.tools;
42 42

  
43
import java.awt.Color;
44
import java.awt.Graphics;
45
import java.awt.Graphics2D;
46
import java.awt.event.InputEvent;
47
import java.awt.geom.Point2D;
48
import java.awt.geom.Rectangle2D;
49
import java.io.IOException;
50
import java.util.ArrayList;
51

  
52 43
import com.iver.andami.PluginServices;
44

  
53 45
import com.iver.cit.gvsig.CADExtension;
54 46
import com.iver.cit.gvsig.fmap.DriverException;
55 47
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
......
58 50
import com.iver.cit.gvsig.fmap.core.IFeature;
59 51
import com.iver.cit.gvsig.fmap.core.IGeometry;
60 52
import com.iver.cit.gvsig.fmap.core.ShapeFactory;
61
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
62 53
import com.iver.cit.gvsig.fmap.edition.IRowEdited;
63 54
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter;
64 55
import com.iver.cit.gvsig.fmap.layers.FBitSet;
......
66 57
import com.iver.cit.gvsig.gui.cad.DefaultCADTool;
67 58
import com.iver.cit.gvsig.gui.cad.tools.smc.SelectionCADToolContext;
68 59
import com.iver.cit.gvsig.gui.cad.tools.smc.SelectionCADToolContext.SelectionCADToolState;
60
import com.iver.cit.gvsig.layers.VectorialLayerEdited;
69 61

  
62
import java.awt.Color;
63
import java.awt.Graphics;
64
import java.awt.Graphics2D;
65
import java.awt.event.InputEvent;
66
import java.awt.geom.Point2D;
67
import java.awt.geom.Rectangle2D;
68

  
69
import java.util.ArrayList;
70

  
70 71
/**
71 72
 * DOCUMENT ME!
72 73
 *
......
81 82

  
82 83
	private Point2D lastPoint;
83 84

  
84
	private ArrayList selectedHandler = new ArrayList();
85

  
86
	private ArrayList selectedRow = new ArrayList();
87

  
88
	private ArrayList selectedRowIndex = new ArrayList();
89

  
90 85
	private String tool = "selection";
91 86

  
92
	//private IGeometry clonedGeometry = null;
93

  
94 87
	private String state;
95 88

  
96
	// double
97
	// FLATNESS=getCadToolAdapter().getMapControl().getViewPort().toMapDistance(2);
98

  
99 89
	/**
100 90
	 * Crea un nuevo LineCADTool.
101 91
	 */
102 92
	public SelectionCADTool() {
103

  
104 93
	}
105 94

  
106 95
	/**
......
150 139

  
151 140
	public boolean select(double x, double y) {
152 141
		firstPoint = new Point2D.Double(x, y);
142

  
153 143
		FBitSet selection = getCadToolAdapter().getVectorialAdapter()
154 144
				.getSelection();
155
		// if ((selectedRow.size() == 0) ||
156
		// (selection.cardinality() == 0)) {
145
		VectorialLayerEdited vle = (VectorialLayerEdited) CADExtension
146
				.getEditionManager().getActiveLayerEdited();
147
		ArrayList selectedHandler = vle.getSelectedHandler();
148
		ArrayList selectedRow = vle.getSelectedRow();
149
		ArrayList selectedRowIndex = vle.getSelectedRowIndex();
150

  
157 151
		// Se comprueba si se pincha en una gemometr?a
158 152
		PluginServices.getMDIManager().setWaitCursor();
159 153

  
......
161 155
				.toMapDistance(tolerance);
162 156
		Rectangle2D rect = new Rectangle2D.Double(firstPoint.getX() - tam,
163 157
				firstPoint.getY() - tam, tam * 2, tam * 2);
164
		// int[] indexes = getCadToolAdapter().getVectorialAdapter()
165
		// 		.getRowsIndexes_OLD(rect);
166 158
		VectorialEditableAdapter vea = getCadToolAdapter()
167 159
				.getVectorialAdapter();
168 160
		String strEPSG = getCadToolAdapter().getMapControl().getViewPort()
......
175 167
			selection.clear();
176 168

  
177 169
			for (int i = 0; i < feats.length; i++) {
178
			// for (int i = 0; i < indexes.length; i++) {
179

  
180
				IFeature feat = (IFeature)feats[i].getLinkedRow();
170
				IFeature feat = (IFeature) feats[i].getLinkedRow();
181 171
				IGeometry geom = feat.getGeometry();
182
				/* IGeometry geom = null;
183
				try {
184
					geom = vea.getShape(indexes[i]);
185
				} catch (DriverIOException e) {
186
					// TODO Auto-generated catch block
187
					e.printStackTrace();
188
				} */
172

  
189 173
				if (geom.intersects(rect)) { // , 0.1)){
190 174
					selection.set(feats[i].getIndex(), true);
191
					// selection.set(indexes[i], true);
192 175
				}
193 176
			}
194 177
		} catch (DriverException e1) {
195
			// TODO Auto-generated catch block
196 178
			e1.printStackTrace();
197 179
		}
198 180

  
199
		/*
200
		 * for (int i = 0; i < indexes.length; i++) { try { if
201
		 * (getCadToolAdapter().getVectorialAdapter().getShape(
202
		 * indexes[i]).intersects(rect)) { // .intersects(rect,FLATNESS)) {
203
		 * selection.set(indexes[i], true); } } catch (DriverIOException e) { //
204
		 * TODO Auto-generated catch block e.printStackTrace(); } }
205
		 */
206 181
		boolean isTheSame = false;
207
		if (prevSelection.cardinality() != 0
182

  
183
		if ((prevSelection.cardinality() != 0)
208 184
				&& selection.intersects(prevSelection)
209 185
				&& !selection.equals(prevSelection)) {
210 186
			selection = prevSelection;
211 187
			getCadToolAdapter().getVectorialAdapter().setSelection(selection);
212 188
			isTheSame = true;
213 189
		}
190

  
214 191
		if (selection.cardinality() > 0) {
215 192
			// Se comprueba si se pincha un handler. El m?s cercano (o los m?s
216 193
			// cercanos si hay empate)
217 194
			selectedRow.clear();
218 195
			selectedRowIndex.clear();
219 196
			selectedHandler.clear();
220

  
221
			double min = Double.MAX_VALUE;
222

  
223
			// Cogemos las entidades seleccionadas
224
			for (int i = selection.nextSetBit(0); i >= 0; i = selection
225
					.nextSetBit(i + 1)) {
226
				Handler[] handlers = null;
227

  
228
				DefaultFeature fea = null;
229
				try {
230
					fea = (DefaultFeature) getCadToolAdapter()
231
							.getVectorialAdapter().getRow(i).getLinkedRow();
232
					/* clonedGeometry = fea.getGeometry().cloneGeometry();
233
					handlers = clonedGeometry
234
							.getHandlers(IGeometry.SELECTHANDLER);
235
					selectedRow.add(new DefaultFeature(clonedGeometry, fea
236
							.getAttributes())); */
237
					handlers = fea.getGeometry().getHandlers(IGeometry.SELECTHANDLER);
238
					selectedRow.add(fea);
239
					selectedRowIndex.add(new Integer(i));
240
					// y miramos los handlers de cada entidad seleccionada
241
					min = getCadToolAdapter().getMapControl().getViewPort()
242
							.toMapDistance(tolerance);
243
					// int hSel = -1;
244
					for (int j = 0; j < handlers.length; j++) {
245
						Point2D handlerPoint = handlers[j].getPoint();
246
						double distance = firstPoint.distance(handlerPoint);
247
						if (distance <= min) {
248
							min = distance;
249
							//hSel = j;
250
							selectedHandler.add(handlers[j]);
251
						}
252
					}
253
					// Se a?ade un solo handler por
254
					// cada geometr?a seleccionada
255
					// if (hSel != -1) {
256
					// 	selectedHandler.add(handlers[hSel]);
257
					// 	System.out.println("Handler seleccionado: " + hSel);
258
					// }
259

  
260
				} catch (DriverIOException e) {
261
					// TODO Auto-generated catch block
262
					e.printStackTrace();
263
				} catch (IOException e) {
264
					// TODO Auto-generated catch block
265
					e.printStackTrace();
266
				}
267
			}
268

  
197
			vle.refreshSelectionCache(firstPoint, getCadToolAdapter());
269 198
		}
199

  
270 200
		PluginServices.getMDIManager().restoreCursor();
271
		if ((selection.cardinality() > 0 && selectedHandler.size() > 0)
201

  
202
		if (((selection.cardinality() > 0) && (selectedHandler.size() > 0))
272 203
				|| isTheSame) {
273 204
			state = "Selection.EndPoint";
274 205
		} else if (selection.cardinality() > 0) {
......
276 207
		} else {
277 208
			state = "Selection.SecondPoint";
278 209
		}
210

  
279 211
		return true;
280 212
	}
281 213

  
......
290 222
	 * @param y
291 223
	 *            par?metro y del punto que se pase en esta transici?n.
292 224
	 */
293
	public void addPoint(double x, double y) {
225
	public void addPoint(double x, double y, InputEvent event) {
294 226
		SelectionCADToolState actualState = (SelectionCADToolState) _fsm
295 227
				.getPreviousState();
296 228
		String status = actualState.getName();
297 229
		FBitSet selection = getCadToolAdapter().getVectorialAdapter()
298 230
				.getSelection();
231
		VectorialLayerEdited vle = (VectorialLayerEdited) CADExtension
232
				.getEditionManager().getActiveLayerEdited();
233
		ArrayList selectedHandler = vle.getSelectedHandler();
234
		ArrayList selectedRow = vle.getSelectedRow();
235
		ArrayList selectedRowIndex = vle.getSelectedRowIndex();
236

  
299 237
		try {
300 238
			if (status.equals("Selection.FirstPoint")) {
301
				// firstPoint = new Point2D.Double(x, y);
302 239
			} else if (status.equals("Selection.SecondPoint")) {
303
				// PluginServices.getMDIManager().setWaitCursor();
304 240
				lastPoint = new Point2D.Double(x, y);
305 241
				selection.clear();
306 242

  
......
327 263

  
328 264
				Rectangle2D rect = new Rectangle2D.Double(x1, y1, w1, h1);
329 265

  
330
				// int[] indexes = getCadToolAdapter().getVectorialAdapter()
331
				// 		.getRowsIndexes_OLD(
332
				// 				new Rectangle2D.Double(x1, y1, w1, h1));
333 266
				VectorialEditableAdapter vea = getCadToolAdapter()
334 267
						.getVectorialAdapter();
335 268
				String strEPSG = getCadToolAdapter().getMapControl()
......
337 270
				IRowEdited[] feats = vea.getFeatures(rect, strEPSG);
338 271

  
339 272
				for (int i = 0; i < feats.length; i++) {
340
				// for (int i = 0; i < indexes.length; i++) {
341
					IGeometry geom =
342
					((IFeature)feats[i].getLinkedRow()).getGeometry();
343
					/* IGeometry geom = null;
344
					try {
345
						geom = vea.getShape(indexes[i]);
346
					} catch (DriverIOException e) {
347
						// TODO Auto-generated catch block
348
						e.printStackTrace();
349
					} */
273
					IGeometry geom = ((IFeature) feats[i].getLinkedRow())
274
							.getGeometry();
275

  
350 276
					if (firstPoint.getX() < lastPoint.getX()) {
351 277
						if (rect.contains(geom.getBounds2D())) {
352 278
							selection.set(feats[i].getIndex(), true);
353
							// selection.set(indexes[i], true);
354 279
						}
355 280
					} else {
356 281
						if (geom.intersects(rect)) { // , 0.1)){
357 282
							selection.set(feats[i].getIndex(), true);
358
							// selection.set(indexes[i], true);
359 283
						}
360 284
					}
361 285
				}
362 286

  
363 287
				PluginServices.getMDIManager().restoreCursor();
364
				// cardinality = selection.cardinality();
365 288
			} else if (status.equals("Selection.EndPoint")) {
366

  
367
				/*
368
				 * for (int k = 0; k < selectedHandler.size(); k++) { Handler h =
369
				 * (Handler) selectedHandler.get(k); h.set(x, y); }
370
				 */
371

  
372 289
				for (int i = 0; i < selectedRow.size(); i++) {
373

  
374
					// System.out.println(h.getPoint());
375 290
					DefaultFeature row = (DefaultFeature) selectedRow.get(i);
376 291
					int index = ((Integer) selectedRowIndex.get(i)).intValue();
377
					// System.out.println(row.getGeometry().getBounds2D());
292

  
378 293
					// Movemos los handlers que hemos seleccionado
379 294
					// previamente dentro del m?todo select()
380 295
					for (int k = 0; k < selectedHandler.size(); k++) {
381 296
						Handler h = (Handler) selectedHandler.get(k);
382 297
						h.set(x, y);
383
						// System.out.println(h.getPoint());
384 298
					}
385 299

  
386
					// h.set(x, y);
387
					// getVectorialAdapter().modifyRow(index, row);
388

  
389 300
					modifyFeature(index, row);
390 301
				}
391

  
392 302
			}
393
			// } catch (IOException e) {
394
			// TODO Auto-generated catch block
395
			// e.printStackTrace();
396 303
		} catch (DriverException e) {
397
			// TODO Auto-generated catch block
398 304
			e.printStackTrace();
399 305
		}
400 306
	}
......
417 323
		String status = actualState.getName();
418 324
		FBitSet selection = getCadToolAdapter().getVectorialAdapter()
419 325
				.getSelection();
420
		if (selection.cardinality() == 0)
421
		{
326
		VectorialLayerEdited vle = (VectorialLayerEdited) CADExtension
327
				.getEditionManager().getActiveLayerEdited();
328
		ArrayList selectedHandler = vle.getSelectedHandler();
329
		ArrayList selectedRow = vle.getSelectedRow();
330
		ArrayList selectedRowIndex = vle.getSelectedRowIndex();
331

  
332
		if (selection.cardinality() == 0) {
422 333
			selectedRow.clear();
423 334
			selectedRowIndex.clear();
424 335
			selectedHandler.clear();
425 336
		}
426
		// try {
427
			// drawHandlers(g, selection, getCadToolAdapter().getMapControl()
428
			// 		.getViewPort().getAffineTransform());
429
			drawHandlers(g, selectedRow, getCadToolAdapter().getMapControl()
430
					.getViewPort().getAffineTransform());
431
		/* } catch (DriverIOException e) {
432
			e.printStackTrace();
433
		} */
434 337

  
338
		drawHandlers(g, selectedRow, getCadToolAdapter().getMapControl()
339
				.getViewPort().getAffineTransform());
340

  
435 341
		if (status.equals("Selection.SecondPoint")) {
436 342
			// Dibuja el rect?ngulo de selecci?n
437

  
438 343
			GeneralPathX elShape = new GeneralPathX(GeneralPathX.WIND_EVEN_ODD,
439 344
					4);
440 345
			elShape.moveTo(firstPoint.getX(), firstPoint.getY());
......
445 350
			ShapeFactory.createPolyline2D(elShape).draw((Graphics2D) g,
446 351
					getCadToolAdapter().getMapControl().getViewPort(),
447 352
					CADTool.selectSymbol);
448

  
449 353
		} else if (status.equals("Selection.EndPoint")) {
450 354
			// Movemos los handlers que hemos seleccionado
451 355
			// previamente dentro del m?todo select()
452 356
			for (int k = 0; k < selectedHandler.size(); k++) {
453 357
				Handler h = (Handler) selectedHandler.get(k);
454 358
				h.set(x, y);
455
				// System.out.println(h.getPoint());
456 359
			}
457 360

  
458 361
			// Y una vez movidos los v?rtices (handles)
459 362
			// redibujamos la nueva geometr?a.
460 363
			for (int i = 0; i < selectedRow.size(); i++) {
461

  
462 364
				IGeometry geom = ((IFeature) selectedRow.get(i)).getGeometry()
463 365
						.cloneGeometry();
464
				// System.out.println(geom.getBounds2D());
465
				// int index = ((Integer) selectedRowIndex.get(i)).intValue();
466 366
				g.setColor(Color.gray);
467

  
468 367
				geom.draw((Graphics2D) g, getCadToolAdapter().getMapControl()
469 368
						.getViewPort(), CADTool.modifySymbol);
470 369
			}
471 370
		}
472

  
473 371
	}
474 372

  
475

  
476 373
	/**
477 374
	 * Add a diferent option.
478 375
	 *
......
493 390
	public void addValue(double d) {
494 391
	}
495 392

  
496
	/**
497
	 * DOCUMENT ME!
498
	 *
499
	 * @return DOCUMENT ME!
500
	 */
501
	public int getSelectedRowSize() {
502
		return this.selectedRow.size();
503
	}
504

  
505 393
	public String getStatus() {
506 394
		try {
507 395
			SelectionCADToolState actualState = (SelectionCADToolState) _fsm
508 396
					.getPreviousState();
509 397
			String status = actualState.getName();
398

  
510 399
			return status;
511 400
		} catch (NullPointerException e) {
512 401
			return "ExecuteMap.Initial";
......
528 417
	public String getName() {
529 418
		return "SELECCION";
530 419
	}
531

  
532
	public void clearSelection() {
533
		// Limpiamos la selecci?n cacheada
534
		selectedHandler.clear();
535
		selectedRow.clear();
536
		selectedRowIndex.clear();
537
	}
538

  
539
	/**
540
	 * @return Returns the selectedRow.
541
	 */
542
	public IFeature[] getSelectedRowsCache() {
543
		return (IFeature[]) selectedRow.toArray(new IFeature[0]);
544
	}
545

  
546

  
547 420
}
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/LineCADTool.java
108 108
     * @param x par?metro x del punto que se pase en esta transici?n.
109 109
     * @param y par?metro y del punto que se pase en esta transici?n.
110 110
     */
111
    public void addPoint(double x, double y) {
111
    public void addPoint(double x, double y,InputEvent event) {
112 112
        LineCADToolState actualState = (LineCADToolState) _fsm.getPreviousState();
113 113
        String status = actualState.getName();
114 114

  
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/PolygonCADTool.java
111 111
     * @param x par?metro x del punto que se pase en esta transici?n.
112 112
     * @param y par?metro y del punto que se pase en esta transici?n.
113 113
     */
114
    public void addPoint(double x, double y) {
114
    public void addPoint(double x, double y,InputEvent event) {
115 115
        PolygonCADToolState actualState = (PolygonCADToolState) _fsm.getPreviousState();
116 116
        String status = actualState.getName();
117 117

  
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/ScaleCADTool.java
132 132
     * @param x par?metro x del punto que se pase en esta transici?n.
133 133
     * @param y par?metro y del punto que se pase en esta transici?n.
134 134
     */
135
    public void addPoint(double x, double y) {
135
    public void addPoint(double x, double y,InputEvent event) {
136 136
        ScaleCADToolState actualState = (ScaleCADToolState) _fsm.getPreviousState();
137 137
        String status = actualState.getName();
138 138
        VectorialEditableAdapter vea = getCadToolAdapter().getVectorialAdapter();
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/PointCADTool.java
104 104
     * @param x par?metro x del punto que se pase en esta transici?n.
105 105
     * @param y par?metro y del punto que se pase en esta transici?n.
106 106
     */
107
    public void addPoint(double x, double y) {
107
    public void addPoint(double x, double y,InputEvent event) {
108 108
        PointCADToolState actualState = (PointCADToolState) _fsm.getPreviousState();
109 109
        String status = actualState.getName();
110 110

  
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/CopyCADTool.java
126 126
     * @param x par?metro x del punto que se pase en esta transici?n.
127 127
     * @param y par?metro y del punto que se pase en esta transici?n.
128 128
     */
129
    public void addPoint(double x, double y) {
129
    public void addPoint(double x, double y,InputEvent event) {
130 130
        CopyCADToolState actualState = (CopyCADToolState) _fsm.getPreviousState();
131 131
        String status = actualState.getName();
132 132
        VectorialEditableAdapter vea = getCadToolAdapter().getVectorialAdapter();
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/PolylineCADTool.java
134 134
     * @param x par?metro x del punto que se pase en esta transici?n.
135 135
     * @param y par?metro y del punto que se pase en esta transici?n.
136 136
     */
137
    public void addPoint(double x, double y) {
137
    public void addPoint(double x, double y,InputEvent event) {
138 138
    	PolylineCADToolState actualState = (PolylineCADToolState) _fsm.getPreviousState();
139 139
        String status = actualState.getName();
140 140

  
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/smc/RectangleCADToolContext.java
224 224
                {
225 225
                    ctxt.setQuestion("Insertar punto de esquina opuesta o Cuadrado[C]");
226 226
                    ctxt.setDescription(new String[]{"Cuadrado", "Cancelar"});
227
                    ctxt.addPoint(pointX, pointY);
227
                    ctxt.addPoint(pointX, pointY, event);
228 228
                }
229 229
                finally
230 230
                {
......
289 289
                context.clearState();
290 290
                try
291 291
                {
292
                    ctxt.addPoint(pointX, pointY);
292
                    ctxt.addPoint(pointX, pointY, event);
293 293
                    ctxt.end();
294 294
                }
295 295
                finally
......
326 326
                context.clearState();
327 327
                try
328 328
                {
329
                    ctxt.addPoint(pointX, pointY);
329
                    ctxt.addPoint(pointX, pointY, event);
330 330
                    ctxt.end();
331 331
                }
332 332
                finally
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/smc/ArcCADToolContext.java
224 224
                {
225 225
                    ctxt.setQuestion("Insertar segundo punto");
226 226
                    ctxt.setDescription(new String[]{"Cancelar"});
227
                    ctxt.addPoint(pointX, pointY);
227
                    ctxt.addPoint(pointX, pointY, event);
228 228
                }
229 229
                finally
230 230
                {
......
262 262
                {
263 263
                    ctxt.setQuestion("Insertar ultimo punto");
264 264
                    ctxt.setDescription(new String[]{"Cancelar"});
265
                    ctxt.addPoint(pointX, pointY);
265
                    ctxt.addPoint(pointX, pointY, event);
266 266
                }
267 267
                finally
268 268
                {
......
298 298
                context.clearState();
299 299
                try
300 300
                {
301
                    ctxt.addPoint(pointX, pointY);
301
                    ctxt.addPoint(pointX, pointY, event);
302 302
                    ctxt.end();
303 303
                }
304 304
                finally
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/smc/SelectionCADToolContext.java
227 227
                    {
228 228
                        ctxt.setQuestion("Precise segundo punto del rect?ngulo de seleccion");
229 229
                        ctxt.setDescription(new String[]{"Cancelar"});
230
                        ctxt.addPoint(pointX, pointY);
230
                        ctxt.addPoint(pointX, pointY, event);
231 231
                    }
232 232
                    finally
233 233
                    {
......
244 244
                    {
245 245
                        ctxt.setQuestion("Precise punto");
246 246
                        ctxt.setDescription(new String[]{"Cancelar"});
247
                        ctxt.addPoint(pointX, pointY);
247
                        ctxt.addPoint(pointX, pointY, event);
248 248
                    }
249 249
                    finally
250 250
                    {
......
260 260
                    {
261 261
                        ctxt.setQuestion("Precise punto destino");
262 262
                        ctxt.setDescription(new String[]{"Cancelar"});
263
                        ctxt.addPoint(pointX, pointY);
263
                        ctxt.addPoint(pointX, pointY, event);
264 264
                    }
265 265
                    finally
266 266
                    {
......
303 303
                {
304 304
                    ctxt.setQuestion("Precise punto de estiramiento");
305 305
                    ctxt.setDescription(new String[]{"Cancelar"});
306
                    ctxt.addPoint(pointX, pointY);
306
                    ctxt.addPoint(pointX, pointY, event);
307 307
                    ctxt.end();
308 308
                }
309 309
                finally
......
342 342
                {
343 343
                    ctxt.setQuestion("Precise punto destino");
344 344
                    ctxt.setDescription(new String[]{"Cancelar"});
345
                    ctxt.addPoint(pointX, pointY);
345
                    ctxt.addPoint(pointX, pointY, event);
346 346
                    ctxt.end();
347 347
                    ctxt.refresh();
348 348
                }
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/smc/LineCADToolContext.java
237 237
                {
238 238
                    ctxt.setQuestion("Insertar segundo punto o angulo");
239 239
                    ctxt.setDescription(new String[]{"Cancelar"});
240
                    ctxt.addPoint(pointX, pointY);
240
                    ctxt.addPoint(pointX, pointY, event);
241 241
                }
242 242
                finally
243 243
                {
......
275 275
                {
276 276
                    ctxt.setQuestion("Insertar segundo punto o angulo");
277 277
                    ctxt.setDescription(new String[]{"Cancelar"});
278
                    ctxt.addPoint(pointX, pointY);
278
                    ctxt.addPoint(pointX, pointY, event);
279 279
                }
280 280
                finally
281 281
                {
......
333 333
                {
334 334
                    ctxt.setQuestion("Insertar segundo punto o angulo");
335 335
                    ctxt.setDescription(new String[]{"Cancelar"});
336
                    ctxt.addPoint(pointX, pointY);
336
                    ctxt.addPoint(pointX, pointY, event);
337 337
                }
338 338
                finally
339 339
                {
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/smc/PolygonCADToolContext.java
239 239
                {
240 240
                    ctxt.setQuestion("Inscrito en el c?rculo[I] o Circunscrito[C]<C>");
241 241
                    ctxt.setDescription(new String[]{"Inscrito", "Circunscrito", "Cancelar"});
242
                    ctxt.addPoint(pointX, pointY);
242
                    ctxt.addPoint(pointX, pointY, event);
243 243
                }
244 244
                finally
245 245
                {
......
298 298
                {
299 299
                    ctxt.setQuestion("Inscrito en el c?rculo[I] o Circunscrito[C]<C>");
300 300
                    ctxt.setDescription(new String[]{"Inscrito", "Circunscrito", "Cancelar"});
301
                    ctxt.addPoint(pointX, pointY);
301
                    ctxt.addPoint(pointX, pointY, event);
302 302
                }
303 303
                finally
304 304
                {
......
355 355
                context.clearState();
356 356
                try
357 357
                {
358
                    ctxt.addPoint(pointX, pointY);
358
                    ctxt.addPoint(pointX, pointY, event);
359 359
                    ctxt.end();
360 360
                }
361 361
                finally
......
412 412
                context.clearState();
413 413
                try
414 414
                {
415
                    ctxt.addPoint(pointX, pointY);
415
                    ctxt.addPoint(pointX, pointY, event);
416 416
                    ctxt.end();
417 417
                }
418 418
                finally
trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/smc/ScaleCADToolContext.java
244 244
                {
245 245
                    ctxt.setQuestion("Precise factor de escala<2> o Referencia[R]");
246 246
                    ctxt.setDescription(new String[]{"Referencia", "Cancelar"});
247
                    ctxt.addPoint(pointX, pointY);
247
                    ctxt.addPoint(pointX, pointY, event);
248 248
                }
249 249
                finally
250 250
                {
......
325 325
                context.clearState();
326 326
                try
327 327
                {
328
                    ctxt.addPoint(pointX, pointY);
328
                    ctxt.addPoint(pointX, pointY, event);
329 329
                    ctxt.end();
330 330
                    ctxt.refresh();
331 331
                }
......
415 415
                {
416 416
                    ctxt.setQuestion("Precise punto final recta referencia");
417 417
                    ctxt.setDescription(new String[]{"Cancelar"});
418
                    ctxt.addPoint(pointX, pointY);
418
                    ctxt.addPoint(pointX, pointY, event);
419 419
                }
420 420
                finally
421 421
                {
......
453 453
                {
454 454
                    ctxt.setQuestion("Precise punto origen recta escala");
455 455
                    ctxt.setDescription(new String[]{"Cancelar"});
456
                    ctxt.addPoint(pointX, pointY);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff