Revision 4313 trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/EditVertexCADTool.java

View differences:

EditVertexCADTool.java
42 42

  
43 43
import java.awt.Graphics;
44 44
import java.awt.Graphics2D;
45
import java.awt.event.InputEvent;
45 46
import java.awt.geom.AffineTransform;
46 47
import java.awt.geom.PathIterator;
47 48
import java.awt.geom.Point2D;
......
69 70
import com.iver.cit.gvsig.gui.cad.DefaultCADTool;
70 71
import com.iver.cit.gvsig.gui.cad.tools.smc.EditVertexCADToolContext;
71 72
import com.iver.cit.gvsig.gui.cad.tools.smc.EditVertexCADToolContext.EditVertexCADToolState;
73
import com.vividsolutions.jts.geom.Geometry;
72 74

  
73 75

  
74 76
/**
......
98 100
    /* (non-Javadoc)
99 101
     * @see com.iver.cit.gvsig.gui.cad.CADTool#transition(com.iver.cit.gvsig.fmap.layers.FBitSet, double, double)
100 102
     */
101
    public void transition(double x, double y) {
102
        //_fsm.addPoint(x, y);
103
    public void transition(double x, double y, InputEvent event) {
104
        addPoint(x, y);
103 105
    }
104 106

  
105 107
    /* (non-Javadoc)
......
138 140
     * @param y par?metro y del punto que se pase en esta transici?n.
139 141
     */
140 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
    	
141 159
    }
142 160

  
143
    /**
161
    private IGeometry getSelectedGeometry() {
162
        VectorialEditableAdapter vea = getCadToolAdapter().getVectorialAdapter();
163
        FBitSet selection = vea.getSelection();
164
        IRowEdited row=null;
165
        IGeometry ig=null;
166
        if (selection.cardinality()==1){
167

  
168
			try {
169
				row = getCadToolAdapter().getVectorialAdapter().getRow(selection.nextSetBit(0));
170
			} catch (DriverIOException e) {
171
				// TODO Auto-generated catch block
172
				e.printStackTrace();
173
			} catch (IOException e) {
174
				// TODO Auto-generated catch block
175
				e.printStackTrace();
176
			}
177
        	ig=((IFeature)row.getLinkedRow()).getGeometry().cloneGeometry();
178
        	return ig;
179
        }
180

  
181
		return null;
182
	}
183

  
184
	/**
144 185
     * M?todo para dibujar la lo necesario para el estado en el que nos
145 186
     * encontremos.
146 187
     *
......
239 280
        	}
240 281
        }
241 282
    }
242
    public void drawVertex(Graphics g,FBitSet sel,AffineTransform at) throws DriverIOException{
283
    private void drawVertex(Graphics g,FBitSet sel,AffineTransform at) throws DriverIOException{
243 284
		 for (int i = sel.nextSetBit(0); i >= 0;
244 285
		 		i = sel.nextSetBit(i + 1)) {
245 286
			IGeometry ig = getCadToolAdapter().getVectorialAdapter().getShape(i).cloneGeometry();

Also available in: Unified diff