Revision 24263 branches/v2_0_0_prep/extensions/extCAD/src/com/iver/cit/gvsig/gui/cad/tools/MatrixCADTool.java
MatrixCADTool.java | ||
---|---|---|
49 | 49 |
import java.util.ArrayList; |
50 | 50 |
import java.util.Iterator; |
51 | 51 |
|
52 |
import org.gvsig.fmap.data.exceptions.DataException; |
|
52 | 53 |
import org.gvsig.fmap.data.exceptions.ReadException; |
54 |
import org.gvsig.fmap.data.feature.EditableFeature; |
|
53 | 55 |
import org.gvsig.fmap.data.feature.Feature; |
56 |
import org.gvsig.fmap.data.feature.FeatureSelection; |
|
54 | 57 |
import org.gvsig.fmap.data.feature.FeatureSet; |
55 | 58 |
import org.gvsig.fmap.data.feature.FeatureStore; |
56 | 59 |
import org.gvsig.fmap.geom.Geometry; |
... | ... | |
136 | 139 |
FeatureSet selection=null; |
137 | 140 |
try { |
138 | 141 |
selection = (FeatureSet)getVLE().getFeatureStore().getSelection(); |
142 |
|
|
143 |
if (selection.getSize() == 0 && !CADExtension.getCADTool().getClass().getName().equals("com.iver.cit.gvsig.gui.cad.tools.SelectionCADTool")) { |
|
144 |
CADExtension.setCADTool("_selection",false); |
|
145 |
((SelectionCADTool) CADExtension.getCADTool()).setNextTool( |
|
146 |
"_matrix"); |
|
147 |
}else { |
|
148 |
//init(); |
|
149 |
matrixPropeties(); |
|
150 |
} |
|
139 | 151 |
} catch (ReadException e) { |
140 | 152 |
// TODO Auto-generated catch block |
141 | 153 |
e.printStackTrace(); |
142 |
} |
|
143 |
if (selection.size() == 0 && !CADExtension.getCADTool().getClass().getName().equals("com.iver.cit.gvsig.gui.cad.tools.SelectionCADTool")) { |
|
144 |
CADExtension.setCADTool("_selection",false); |
|
145 |
((SelectionCADTool) CADExtension.getCADTool()).setNextTool( |
|
146 |
"_matrix"); |
|
147 |
}else { |
|
148 |
//init(); |
|
149 |
matrixPropeties(); |
|
150 |
} |
|
154 |
} catch (DataException e) { |
|
155 |
// TODO Auto-generated catch block |
|
156 |
e.printStackTrace(); |
|
157 |
} |
|
151 | 158 |
} |
152 | 159 |
private void matrixPropeties() { |
153 | 160 |
matrixProperty.setMatrixCADTool(this); |
... | ... | |
170 | 177 |
// TODO Auto-generated catch block |
171 | 178 |
e.printStackTrace(); |
172 | 179 |
} |
173 |
featureStore.getCommandsRecord().startComplex();
|
|
174 |
Iterator iterator=featureStore.getSelection().iterator();
|
|
180 |
featureStore.beginEditingGroup(getName());
|
|
181 |
Iterator iterator=((FeatureSelection)featureStore.getSelection()).iterator();
|
|
175 | 182 |
while (iterator.hasNext()) { |
176 | 183 |
Feature feature = (Feature) iterator.next(); |
177 |
Object[] attributes=new Object[feature.size()]; |
|
178 |
for (int j = 0; j < feature.size(); j++) { |
|
179 |
attributes[j]=feature.get(j); |
|
180 |
} |
|
181 |
// } |
|
182 |
// for (int i = 0; i < selectedRow.size(); i++) { |
|
183 |
// DefaultRowEdited row = (DefaultRowEdited) selectedRow |
|
184 |
// .get(i); |
|
185 |
// DefaultFeature fea = (DefaultFeature) row.getLinkedRow() |
|
186 |
// .cloneRow(); |
|
187 |
if (operations.isRectangular()) {//Si es rectangular la matriz |
|
184 |
// Object[] attributes=new Object[feature.size()]; |
|
185 |
// for (int j = 0; j < feature.size(); j++) { |
|
186 |
// attributes[j]=feature.get(j); |
|
187 |
// } |
|
188 |
if (operations.isRectangular()) {//Si es rectangular la matriz |
|
188 | 189 |
|
189 | 190 |
for (int columns = 0; columns < operations |
190 | 191 |
.getNumColumns(); columns++) { |
... | ... | |
221 | 222 |
Point2D p = h.getPoint(); |
222 | 223 |
h.set(p.getX() + (difX), p.getY() + (difY)); |
223 | 224 |
} |
225 |
EditableFeature eFeature=featureStore.createNewFeature(feature.getType(),feature); |
|
226 |
eFeature.setGeometry(name, value) |
|
224 | 227 |
selectedRowAux.add(addGeometry(geom, attributes)); |
225 | 228 |
} |
226 | 229 |
|
Also available in: Unified diff