Revision 3883 trunk/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/DefaultCADTool.java
DefaultCADTool.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.gui.cad; |
42 | 42 |
|
43 |
import java.awt.Graphics; |
|
44 |
import java.awt.Graphics2D; |
|
45 |
import java.awt.geom.AffineTransform; |
|
46 |
import java.awt.geom.Point2D; |
|
47 |
import java.awt.image.BufferedImage; |
|
48 |
import java.io.IOException; |
|
49 |
|
|
43 | 50 |
import com.hardcode.gdbms.engine.values.Value; |
44 |
|
|
51 |
import com.iver.andami.PluginServices; |
|
52 |
import com.iver.cit.gvsig.CADExtension; |
|
45 | 53 |
import com.iver.cit.gvsig.fmap.ViewPort; |
46 | 54 |
import com.iver.cit.gvsig.fmap.core.DefaultFeature; |
47 | 55 |
import com.iver.cit.gvsig.fmap.core.GeneralPathX; |
48 | 56 |
import com.iver.cit.gvsig.fmap.core.Handler; |
49 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
|
50 | 57 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
51 | 58 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
52 | 59 |
import com.iver.cit.gvsig.fmap.core.v02.FGraphicUtilities; |
53 | 60 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
54 |
import com.iver.cit.gvsig.fmap.edition.IRowEdited; |
|
55 | 61 |
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter; |
56 | 62 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
57 | 63 |
|
58 |
import java.awt.Graphics; |
|
59 |
import java.awt.Graphics2D; |
|
60 |
import java.awt.geom.AffineTransform; |
|
61 |
import java.awt.geom.Point2D; |
|
62 |
import java.awt.image.BufferedImage; |
|
63 | 64 |
|
64 |
import java.io.IOException; |
|
65 |
|
|
66 |
|
|
67 | 65 |
/** |
68 | 66 |
* DOCUMENT ME! |
69 | 67 |
* |
... | ... | |
71 | 69 |
*/ |
72 | 70 |
public abstract class DefaultCADTool implements CADTool { |
73 | 71 |
private CADToolAdapter cadToolAdapter; |
74 |
private VectorialEditableAdapter vea; |
|
75 | 72 |
private String question; |
73 |
private String[] currentdescriptions; |
|
76 | 74 |
|
77 | 75 |
/** |
78 | 76 |
* DOCUMENT ME! |
... | ... | |
130 | 128 |
DefaultFeature df = new DefaultFeature(geometry, null); |
131 | 129 |
|
132 | 130 |
try { |
133 |
vea.addRow(df);
|
|
131 |
getCadToolAdapter().getVectorialAdapter().addRow(df);
|
|
134 | 132 |
} catch (DriverIOException e) { |
135 | 133 |
// TODO Auto-generated catch block |
136 | 134 |
e.printStackTrace(); |
... | ... | |
148 | 146 |
*/ |
149 | 147 |
public void modifyFeature(int index,DefaultFeature row) { |
150 | 148 |
try { |
151 |
vea.modifyRow(index, row);
|
|
149 |
getCadToolAdapter().getVectorialAdapter().modifyRow(index, row);
|
|
152 | 150 |
} catch (IOException e1) { |
153 | 151 |
// TODO Auto-generated catch block |
154 | 152 |
e1.printStackTrace(); |
... | ... | |
168 | 166 |
} |
169 | 167 |
|
170 | 168 |
/** |
171 |
* DOCUMENT ME! |
|
172 |
* |
|
173 |
* @param vea DOCUMENT ME! |
|
174 |
*/ |
|
175 |
public void setVectorialAdapter(VectorialEditableAdapter vea) { |
|
176 |
this.vea = vea; |
|
177 |
} |
|
178 |
|
|
179 |
|
|
180 |
/** |
|
181 | 169 |
* Devuelve la cadena que corresponde al estado en el que nos encontramos. |
182 | 170 |
* |
183 | 171 |
* @return Cadena para mostrar por consola. |
... | ... | |
202 | 190 |
getCadToolAdapter().getMapControl().drawMap(false); |
203 | 191 |
} |
204 | 192 |
|
205 |
public VectorialEditableAdapter getVectorialAdapter() { |
|
206 |
return vea; |
|
207 |
} |
|
208 | 193 |
public void drawHandlers(Graphics g,FBitSet sel,AffineTransform at) throws DriverIOException{ |
209 | 194 |
for (int i = sel.nextSetBit(0); i >= 0; |
210 | 195 |
i = sel.nextSetBit(i + 1)) { |
211 |
IGeometry ig = getVectorialAdapter().getShape(i).cloneGeometry(); |
|
196 |
IGeometry ig = getCadToolAdapter().getVectorialAdapter().getShape(i).cloneGeometry();
|
|
212 | 197 |
if (ig == null) continue; |
213 | 198 |
Handler[] handlers=ig.getHandlers(IGeometry.SELECTHANDLER); |
214 | 199 |
FGraphicUtilities.DrawHandlers((Graphics2D)g,at,handlers); |
215 | 200 |
} |
216 | 201 |
} |
202 |
|
|
203 |
public void setDescription(String[] currentdescriptions) { |
|
204 |
this.currentdescriptions = currentdescriptions; |
|
205 |
} |
|
206 |
public String[] getDescriptions(){ |
|
207 |
return currentdescriptions; |
|
208 |
} |
|
209 |
/* (non-Javadoc) |
|
210 |
* @see com.iver.cit.gvsig.gui.cad.CADTool#end() |
|
211 |
*/ |
|
212 |
public void end() { |
|
213 |
CADExtension.setCADTool("selection"); |
|
214 |
PluginServices.getMainFrame().setSelectedTool("SELCAD"); |
|
215 |
} |
|
216 |
|
|
217 | 217 |
} |
Also available in: Unified diff