root / branches / v2_0_0_prep / extensions / extEditing / src / org / gvsig / editing / gui / cad / DefaultCADTool.java @ 37138
History | View | Annotate | Download (38.1 KB)
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department
|
4 |
* of the Valencian Government (CIT)
|
5 |
*
|
6 |
* This program is free software; you can redistribute it and/or
|
7 |
* modify it under the terms of the GNU General Public License
|
8 |
* as published by the Free Software Foundation; either version 2
|
9 |
* of the License, or (at your option) any later version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful,
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
* GNU General Public License for more details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License
|
17 |
* along with this program; if not, write to the Free Software
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
19 |
* MA 02110-1301, USA.
|
20 |
*
|
21 |
*/
|
22 |
package org.gvsig.editing.gui.cad; |
23 |
|
24 |
import java.awt.event.MouseEvent; |
25 |
import java.awt.geom.AffineTransform; |
26 |
import java.awt.geom.Point2D; |
27 |
import java.util.ArrayList; |
28 |
|
29 |
import org.cresques.cts.ICoordTrans; |
30 |
import org.slf4j.Logger; |
31 |
import org.slf4j.LoggerFactory; |
32 |
|
33 |
import org.gvsig.andami.PluginServices; |
34 |
import org.gvsig.andami.messages.NotificationManager; |
35 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
36 |
import org.gvsig.app.project.documents.view.gui.DefaultViewPanel; |
37 |
import org.gvsig.editing.CADExtension; |
38 |
import org.gvsig.editing.gui.cad.exception.CommandException; |
39 |
import org.gvsig.editing.layers.VectorialLayerEdited; |
40 |
import org.gvsig.fmap.dal.exception.DataException; |
41 |
import org.gvsig.fmap.dal.exception.ReadException; |
42 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
43 |
import org.gvsig.fmap.dal.feature.Feature; |
44 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
45 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
46 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
47 |
import org.gvsig.fmap.dal.feature.exception.CreateGeometryException; |
48 |
import org.gvsig.fmap.geom.Geometry; |
49 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
50 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
51 |
import org.gvsig.fmap.geom.GeometryLocator; |
52 |
import org.gvsig.fmap.geom.GeometryManager; |
53 |
import org.gvsig.fmap.geom.aggregate.MultiPrimitive; |
54 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
55 |
import org.gvsig.fmap.geom.handler.Handler; |
56 |
import org.gvsig.fmap.geom.primitive.Arc; |
57 |
import org.gvsig.fmap.geom.primitive.Circle; |
58 |
import org.gvsig.fmap.geom.primitive.Curve; |
59 |
import org.gvsig.fmap.geom.primitive.Ellipse; |
60 |
import org.gvsig.fmap.geom.primitive.Envelope; |
61 |
import org.gvsig.fmap.geom.primitive.GeneralPathX; |
62 |
import org.gvsig.fmap.geom.primitive.OrientablePrimitive; |
63 |
import org.gvsig.fmap.geom.primitive.Point; |
64 |
import org.gvsig.fmap.geom.primitive.Primitive; |
65 |
import org.gvsig.fmap.geom.primitive.Spline; |
66 |
import org.gvsig.fmap.geom.primitive.Surface; |
67 |
import org.gvsig.fmap.geom.util.UtilFunctions; |
68 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
69 |
import org.gvsig.fmap.mapcontext.MapContextManager; |
70 |
import org.gvsig.fmap.mapcontext.layers.SpatialCache; |
71 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
72 |
import org.gvsig.fmap.mapcontrol.MapControlDrawer; |
73 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
74 |
import org.gvsig.fmap.mapcontrol.MapControlManager; |
75 |
import org.gvsig.tools.dispose.DisposableIterator; |
76 |
import org.gvsig.utils.console.JConsole; |
77 |
|
78 |
/**
|
79 |
* DOCUMENT ME!
|
80 |
*
|
81 |
* @author Vicente Caballero Navarro
|
82 |
*/
|
83 |
public abstract class DefaultCADTool implements CADTool { |
84 |
|
85 |
private static final Logger LOG = LoggerFactory |
86 |
.getLogger(DefaultCADTool.class); |
87 |
|
88 |
/**
|
89 |
* Reference to the MapContext library manager, used to create symbols
|
90 |
* and legends.
|
91 |
*/
|
92 |
private static MapContextManager mapContextManager = MapContextLocator |
93 |
.getMapContextManager(); |
94 |
|
95 |
/**
|
96 |
* Reference to the MapControl library manager, used to manage
|
97 |
* tools.
|
98 |
*/
|
99 |
protected static MapControlManager mapControlManager = MapControlLocator |
100 |
.getMapControlManager(); |
101 |
|
102 |
private CADToolAdapter cadToolAdapter;
|
103 |
|
104 |
private String question; |
105 |
|
106 |
private String[] currentdescriptions; |
107 |
|
108 |
private String tool = "selection"; |
109 |
|
110 |
private DefaultCADTool previousTool;
|
111 |
|
112 |
private ArrayList temporalCache = new ArrayList(); |
113 |
protected GeometryManager geomManager = GeometryLocator
|
114 |
.getGeometryManager(); |
115 |
|
116 |
public void addTemporalCache(Geometry geom) { |
117 |
temporalCache.add(geom); |
118 |
try {
|
119 |
insertSpatialCache(geom); |
120 |
} catch (CreateEnvelopeException e) {
|
121 |
LOG.error("Error adding the spatial cache", e);
|
122 |
} |
123 |
} |
124 |
|
125 |
public void clearTemporalCache() { |
126 |
Geometry[] geoms = (Geometry[]) temporalCache.toArray(new Geometry[0]); |
127 |
for (int i = 0; i < geoms.length; i++) { |
128 |
try {
|
129 |
removeSpatialCache(geoms[i]); |
130 |
} catch (CreateEnvelopeException e) {
|
131 |
LOG.error("Error removing the temporal cache", e);
|
132 |
} |
133 |
} |
134 |
temporalCache.clear(); |
135 |
} |
136 |
|
137 |
private void insertSpatialCache(Geometry geom) |
138 |
throws CreateEnvelopeException {
|
139 |
VectorialLayerEdited vle = getVLE(); |
140 |
SpatialCache spatialCache = |
141 |
((FLyrVect) vle.getLayer()).getSpatialCache(); |
142 |
Envelope r = geom.getEnvelope(); |
143 |
if (geom.getType() == Geometry.TYPES.POINT) {
|
144 |
r = |
145 |
geomManager.createEnvelope(r.getMinimum(0), r.getMinimum(1), |
146 |
r.getMinimum(0) + 1, r.getMinimum(1) + 1, SUBTYPES.GEOM2D);// Rectangle2D.Double(r.getX(),r.getY(),1,1); |
147 |
} |
148 |
spatialCache.insert(r, geom); |
149 |
|
150 |
} |
151 |
|
152 |
private void removeSpatialCache(Geometry geom) |
153 |
throws CreateEnvelopeException {
|
154 |
VectorialLayerEdited vle = getVLE(); |
155 |
SpatialCache spatialCache = |
156 |
((FLyrVect) vle.getLayer()).getSpatialCache(); |
157 |
Envelope r = geom.getEnvelope(); |
158 |
if (geom.getType() == Geometry.TYPES.POINT) {
|
159 |
r = |
160 |
geomManager.createEnvelope(r.getMinimum(0), r.getMinimum(1), |
161 |
r.getMinimum(0) + 1, r.getMinimum(1) + 1, SUBTYPES.GEOM2D);// Rectangle2D.Double(r.getX(),r.getY(),1,1); |
162 |
} |
163 |
spatialCache.remove(r, geom); |
164 |
|
165 |
} |
166 |
|
167 |
/**
|
168 |
* DOCUMENT ME!
|
169 |
*
|
170 |
* @param feature
|
171 |
*/
|
172 |
public void draw(Geometry geometry, Feature feature) { |
173 |
if (geometry != null) { |
174 |
getCadToolAdapter().getMapControl().getMapControlDrawer() |
175 |
.draw(geometry, mapControlManager.getGeometrySelectionSymbol()); |
176 |
} |
177 |
} |
178 |
|
179 |
/**
|
180 |
* It draw the selected geometries from the initial point until a new
|
181 |
* point.
|
182 |
*
|
183 |
* @param mapControlDrawer
|
184 |
* The drawer.
|
185 |
* @param firstPoint
|
186 |
* The initial point.
|
187 |
* @param x
|
188 |
* The X coordinate of the mouse.
|
189 |
* @param y
|
190 |
* The Y coordinate of the mouse.
|
191 |
*/
|
192 |
protected void drawSelectedGeometries(MapControlDrawer mapControlDrawer, |
193 |
Point2D firstPoint, double x, double y) { |
194 |
FeatureStore featureStore = null;
|
195 |
DisposableIterator iterator = null;
|
196 |
ICoordTrans ct = getVLE().getLayer().getCoordTrans(); |
197 |
|
198 |
try {
|
199 |
featureStore = getVLE().getFeatureStore(); |
200 |
FeatureSet selection = (FeatureSet) featureStore.getSelection(); |
201 |
|
202 |
iterator = selection.iterator(); |
203 |
while (iterator.hasNext()) {
|
204 |
Feature feature = (Feature) iterator.next(); |
205 |
Geometry geometry = |
206 |
(feature.getDefaultGeometry()).cloneGeometry(); |
207 |
|
208 |
if (geometry == null) { |
209 |
continue;
|
210 |
} |
211 |
|
212 |
Point2D currentPoint = new Point2D.Double(x, y); |
213 |
if (ct != null) { |
214 |
currentPoint = ct.getInverted().convert(currentPoint, null);
|
215 |
} |
216 |
|
217 |
UtilFunctions.moveGeom(geometry, currentPoint.getX() |
218 |
- firstPoint.getX(), |
219 |
currentPoint.getY() - firstPoint.getY()); |
220 |
|
221 |
mapControlDrawer.draw(geometry, |
222 |
mapControlManager.getGeometrySelectionSymbol()); |
223 |
} |
224 |
} catch (Exception e) { |
225 |
LOG.error("Retrieving the selection", e);
|
226 |
} finally {
|
227 |
if (iterator != null) { |
228 |
iterator.dispose(); |
229 |
} |
230 |
} |
231 |
} |
232 |
|
233 |
/**
|
234 |
* It draw the selected geometries from the initial point until a new
|
235 |
* point.
|
236 |
*
|
237 |
* @param mapControlDrawer
|
238 |
* The drawer.
|
239 |
* @param firstPoint
|
240 |
* The initial point.
|
241 |
* @param x
|
242 |
* The X coordinate of the mouse.
|
243 |
* @param y
|
244 |
* The Y coordinate of the mouse.
|
245 |
* @param affineTransform
|
246 |
* The transformation to apply
|
247 |
*/
|
248 |
protected void drawAndRotateSelectedGeometries( |
249 |
MapControlDrawer mapControlDrawer, Point2D firstPoint, double x, |
250 |
double y) {
|
251 |
FeatureStore featureStore = null;
|
252 |
DisposableIterator iterator = null;
|
253 |
ICoordTrans ct = getVLE().getLayer().getCoordTrans(); |
254 |
|
255 |
try {
|
256 |
Point2D lastPoint = new Point2D.Double(x, y); |
257 |
|
258 |
double w = lastPoint.getX() - firstPoint.getX();
|
259 |
double h = lastPoint.getY() - firstPoint.getY();
|
260 |
|
261 |
featureStore = getVLE().getFeatureStore(); |
262 |
FeatureSet selection = (FeatureSet) featureStore.getSelection(); |
263 |
|
264 |
iterator = selection.iterator(); |
265 |
while (iterator.hasNext()) {
|
266 |
Feature feature = (Feature) iterator.next(); |
267 |
Geometry geometry = |
268 |
(feature.getDefaultGeometry()).cloneGeometry(); |
269 |
|
270 |
if (geometry == null) { |
271 |
continue;
|
272 |
} |
273 |
|
274 |
UtilFunctions.rotateGeom(geometry, -Math.atan2(w, h)
|
275 |
+ (Math.PI / 2), firstPoint.getX(), firstPoint.getY()); |
276 |
|
277 |
mapControlDrawer.draw(geometry, |
278 |
mapControlManager.getGeometrySelectionSymbol()); |
279 |
} |
280 |
} catch (Exception e) { |
281 |
LOG.error("Retrieving the selection", e);
|
282 |
} finally {
|
283 |
if (iterator != null) { |
284 |
iterator.dispose(); |
285 |
} |
286 |
} |
287 |
} |
288 |
|
289 |
/**
|
290 |
*
|
291 |
* @param cta
|
292 |
* DOCUMENT ME!
|
293 |
*/
|
294 |
public void setCadToolAdapter(CADToolAdapter cta) { |
295 |
cadToolAdapter = cta; |
296 |
} |
297 |
|
298 |
/**
|
299 |
* DOCUMENT ME!
|
300 |
*
|
301 |
* @return DOCUMENT ME!
|
302 |
*/
|
303 |
public CADToolAdapter getCadToolAdapter() {
|
304 |
return cadToolAdapter;
|
305 |
} |
306 |
|
307 |
public VectorialLayerEdited getVLE() {
|
308 |
return (VectorialLayerEdited) CADExtension.getEditionManager()
|
309 |
.getActiveLayerEdited(); |
310 |
} |
311 |
|
312 |
/**
|
313 |
* DOCUMENT ME!
|
314 |
*
|
315 |
* @param geometry
|
316 |
* DOCUMENT ME!
|
317 |
*/
|
318 |
public Feature insertGeometry(Geometry geometry, Feature feature) {
|
319 |
VectorialLayerEdited vle = getVLE(); |
320 |
|
321 |
try {
|
322 |
FeatureStore featureStore = |
323 |
((FLyrVect) vle.getLayer()).getFeatureStore(); |
324 |
EditableFeature eFeature = |
325 |
featureStore.createNewFeature( |
326 |
featureStore.getDefaultFeatureType(), feature); |
327 |
eFeature.setGeometry(featureStore.getDefaultFeatureType() |
328 |
.getDefaultGeometryAttributeName(), geometry); |
329 |
featureStore.insert(eFeature); |
330 |
// drawToImage(featureStore, vle, eFeature);
|
331 |
insertSpatialCache(geometry); |
332 |
|
333 |
getCadToolAdapter().getMapControl().getMapControlDrawer() |
334 |
.draw(geometry, mapControlManager.getGeometrySelectionSymbol()); |
335 |
|
336 |
return eFeature;
|
337 |
} catch (ReadException e) {
|
338 |
NotificationManager.addError(e.getMessage(), e); |
339 |
return null; |
340 |
} catch (DataException e) {
|
341 |
NotificationManager.addError(e.getMessage(), e); |
342 |
return null; |
343 |
} catch (CreateEnvelopeException e) {
|
344 |
NotificationManager.addError(e.getMessage(), e); |
345 |
return null; |
346 |
} |
347 |
} |
348 |
|
349 |
public Feature insertAndSelectGeometry(Geometry geometry) {
|
350 |
Feature feature = null;
|
351 |
try {
|
352 |
FeatureStore featureStore = getVLE().getFeatureStore(); |
353 |
featureStore.beginComplexNotification(); |
354 |
featureStore.beginEditingGroup(getName()); |
355 |
FeatureSelection newSelection = |
356 |
featureStore.createFeatureSelection(); |
357 |
feature = insertGeometry(geometry); |
358 |
newSelection.select(feature); |
359 |
// clearSelection();
|
360 |
featureStore.setSelection(newSelection); |
361 |
featureStore.endEditingGroup(); |
362 |
featureStore.endComplexNotification(); |
363 |
} catch (DataException e) {
|
364 |
NotificationManager.showMessageError("insertAndSelectGeoemtry", e);
|
365 |
} |
366 |
return feature;
|
367 |
} |
368 |
|
369 |
public Feature insertGeometry(Geometry geometry) {
|
370 |
VectorialLayerEdited vle = getVLE(); |
371 |
|
372 |
try {
|
373 |
FeatureStore featureStore = |
374 |
((FLyrVect) vle.getLayer()).getFeatureStore(); |
375 |
EditableFeature eFeature = featureStore.createNewFeature(true);
|
376 |
eFeature.setGeometry(featureStore.getDefaultFeatureType() |
377 |
.getDefaultGeometryAttributeName(), geometry); |
378 |
featureStore.insert(eFeature); |
379 |
|
380 |
// drawToImage(featureStore, vle, eFeature);
|
381 |
insertSpatialCache(geometry); |
382 |
|
383 |
getCadToolAdapter().getMapControl().getMapControlDrawer() |
384 |
.draw(geometry, mapControlManager.getGeometrySelectionSymbol()); |
385 |
|
386 |
draw(geometry.cloneGeometry(), eFeature); |
387 |
return eFeature;
|
388 |
} catch (ReadException e) {
|
389 |
NotificationManager.addError(e.getMessage(), e); |
390 |
return null; |
391 |
} catch (DataException e) {
|
392 |
NotificationManager.addError(e.getMessage(), e); |
393 |
return null; |
394 |
} catch (CreateEnvelopeException e) {
|
395 |
NotificationManager.addError(e.getMessage(), e); |
396 |
return null; |
397 |
} |
398 |
|
399 |
} |
400 |
|
401 |
// private void drawToImage(FeatureStore featureStore,VectorialLayerEdited
|
402 |
// vle, Feature feature) throws DataException,
|
403 |
// GeometryOperationNotSupportedException, GeometryOperationException {
|
404 |
// // clearSelection();
|
405 |
// // ViewPort vp = vle.getLayer().getMapContext().getViewPort();
|
406 |
// // BufferedImage selectionImage = new BufferedImage(
|
407 |
// // vp.getImageWidth(), vp.getImageHeight(),
|
408 |
// // BufferedImage.TYPE_INT_ARGB);
|
409 |
// // Graphics2D gs = selectionImage.createGraphics();
|
410 |
// // BufferedImage handlersImage = new BufferedImage(
|
411 |
// // vp.getImageWidth(), vp.getImageHeight(),
|
412 |
// // BufferedImage.TYPE_INT_ARGB);
|
413 |
// // Graphics2D gh = handlersImage.createGraphics();
|
414 |
//
|
415 |
// // int inversedIndex=vea.getInversedIndex(index);
|
416 |
// // FeatureSelection selection = (FeatureSelection)
|
417 |
// // featureStore.getSelection();
|
418 |
// // selection.select(feature);
|
419 |
// // vle.addSelectionCache(new DefaultRowEdited(df,
|
420 |
// // IRowEdited.STATUS_ADDED, inversedIndex ));
|
421 |
// // vea.getSelection().set(inversedIndex);
|
422 |
// // Geometry geom = (Geometry)feature.getDefaultGeometry();
|
423 |
// // DrawOperationContext doc = new DrawOperationContext();
|
424 |
// // doc.setGraphics(gs);
|
425 |
// // doc.setViewPort(vp);
|
426 |
// // doc.setSymbol(DefaultCADTool.selectionSymbol);
|
427 |
// Geometry geometry=feature.getDefaultGeometry();
|
428 |
// // geometry.cloneGeometry().invokeOperation(Draw.CODE, doc);
|
429 |
// // // draw(gs, vp, DefaultCADTool.selectionSymbol);
|
430 |
// // vle.drawHandlers(geometry.cloneGeometry(), gh, vp);
|
431 |
// // vle.setHandlersImage(handlersImage);
|
432 |
// // vle.setSelectionImage(selectionImage);
|
433 |
// try {
|
434 |
// insertSpatialCache(geometry);
|
435 |
// } catch (CreateEnvelopeException e) {
|
436 |
// LOG.error("Error creating the envelope", e);
|
437 |
// }
|
438 |
//
|
439 |
// }
|
440 |
|
441 |
/**
|
442 |
* DOCUMENT ME!
|
443 |
*
|
444 |
* @param geometry
|
445 |
* DOCUMENT ME!
|
446 |
*/
|
447 |
// public void modifyFeature(Feature feature, Feature oldFeature) {
|
448 |
// try {
|
449 |
// CommandsRecord
|
450 |
// cr=((FLyrVect)getVLE().getLayer()).getFeatureStore().getCommandsRecord();
|
451 |
// cr.update(feature, oldFeature);
|
452 |
// } catch (ReadException e) {
|
453 |
// NotificationManager.addError(e.getMessage(),e);
|
454 |
// }
|
455 |
// draw(((Geometry)feature.getDefaultGeometry()).cloneGeometry());
|
456 |
// }
|
457 |
/**
|
458 |
* DOCUMENT ME!
|
459 |
*
|
460 |
* @param geometry
|
461 |
* DOCUMENT ME!
|
462 |
* @param values
|
463 |
* DOCUMENT ME!
|
464 |
*/
|
465 |
// public Feature addGeometry(Geometry geometry, Object[] values) {
|
466 |
// // int index = 0;
|
467 |
// try {
|
468 |
// FeatureStore featureStore = ((FLyrVect) getVLE().getLayer())
|
469 |
// .getFeatureStore();
|
470 |
// EditableFeature eFeature = featureStore.createNewFeature(true);
|
471 |
// eFeature.setGeometry(featureStore.getDefaultFeatureType()
|
472 |
// .getDefaultGeometryAttributeName(), geometry);
|
473 |
// for (int i = 0; i < values.length; i++) {
|
474 |
// eFeature.set(i, values[i]);
|
475 |
// }
|
476 |
// featureStore.insert(eFeature);
|
477 |
// return eFeature;
|
478 |
// } catch (DataException e) {
|
479 |
// // TODO Auto-generated catch block
|
480 |
// e.printStackTrace();
|
481 |
// }
|
482 |
// // try {
|
483 |
// // String newFID = vea.getNewFID();
|
484 |
// // DefaultFeature df = new DefaultFeature(geometry, values, newFID);
|
485 |
// // index = vea.addRow(df, getName(), EditionEvent.GRAPHIC);
|
486 |
// // insertSpatialCache(geometry);
|
487 |
// // } catch (ValidateRowException e) {
|
488 |
// // NotificationManager.addError(e);
|
489 |
// // } catch (ReadException e) {
|
490 |
// // NotificationManager.addError(e);
|
491 |
// // }
|
492 |
// // return vea.getInversedIndex(index);
|
493 |
// return null;
|
494 |
// }
|
495 |
|
496 |
/**
|
497 |
* Devuelve la cadena que corresponde al estado en el que nos encontramos.
|
498 |
*
|
499 |
* @return Cadena para mostrar por consola.
|
500 |
*/
|
501 |
public String getQuestion() { |
502 |
return question;
|
503 |
} |
504 |
|
505 |
/**
|
506 |
* Actualiza la cadena que corresponde al estado actual.
|
507 |
*
|
508 |
* @param s
|
509 |
* Cadena que aparecer� en consola.
|
510 |
*/
|
511 |
public void setQuestion(String s) { |
512 |
question = s; |
513 |
// ConsoleToken.addQuestion(s);
|
514 |
} |
515 |
|
516 |
/**
|
517 |
* Provoca un repintado "soft" de la capa activa en edici�n. Las capas por
|
518 |
* debajo de ella no se dibujan de verdad, solo se dibuja la que est� en
|
519 |
* edici�n y las que est�n por encima de ella en el TOC.
|
520 |
*/
|
521 |
public void refresh() { |
522 |
// getCadToolAdapter().getMapControl().drawMap(false);
|
523 |
|
524 |
getCadToolAdapter().getMapControl().rePaintDirtyLayers(); |
525 |
} |
526 |
|
527 |
/*
|
528 |
* public void drawHandlers(Graphics g, FBitSet sel, AffineTransform at)
|
529 |
* throws DriverIOException { for (int i = sel.nextSetBit(0); i >= 0; i =
|
530 |
* sel.nextSetBit(i + 1)) { IGeometry ig =
|
531 |
* getCadToolAdapter().getVectorialAdapter() .getShape(i).cloneGeometry();
|
532 |
* if (ig == null) continue; Handler[] handlers =
|
533 |
* ig.getHandlers(IGeometry.SELECTHANDLER);
|
534 |
* FGraphicUtilities.DrawHandlers((Graphics2D) g, at, handlers); } }
|
535 |
*/
|
536 |
public void drawHandlers(MapControlDrawer renderer, ArrayList selectedRows, |
537 |
AffineTransform at) {
|
538 |
FeatureSet selection = null;
|
539 |
DisposableIterator iterator = null;
|
540 |
try {
|
541 |
selection = |
542 |
(FeatureSet) ((FLyrVect) getVLE().getLayer()).getFeatureStore() |
543 |
.getSelection(); |
544 |
|
545 |
iterator = selection.iterator(); |
546 |
while (iterator.hasNext()) {
|
547 |
Feature feature = (Feature) iterator.next(); |
548 |
|
549 |
// }
|
550 |
// for (int i = 0; i < selectedRows.size(); i++) {
|
551 |
// IRowEdited edRow = (IRowEdited) selectedRows.get(i);
|
552 |
// IFeature feat = (IFeature) edRow.getLinkedRow();
|
553 |
// IFeature feat = (IFeature) selectedRows.get(i);
|
554 |
Geometry ig = (feature.getDefaultGeometry()).cloneGeometry(); |
555 |
if (ig == null) { |
556 |
continue;
|
557 |
} |
558 |
Handler[] handlers = ig.getHandlers(Geometry.SELECTHANDLER); |
559 |
renderer.drawHandlers(handlers, at, |
560 |
mapControlManager.getGeometrySelectionSymbol()); |
561 |
} |
562 |
|
563 |
} catch (ReadException e) {
|
564 |
// TODO Auto-generated catch block
|
565 |
e.printStackTrace(); |
566 |
} catch (DataException e) {
|
567 |
// TODO Auto-generated catch block
|
568 |
e.printStackTrace(); |
569 |
} finally {
|
570 |
if (iterator != null) { |
571 |
iterator.dispose(); |
572 |
} |
573 |
} |
574 |
|
575 |
} |
576 |
|
577 |
public void setDescription(String[] currentdescriptions) { |
578 |
this.currentdescriptions = currentdescriptions;
|
579 |
} |
580 |
|
581 |
public String[] getDescriptions() { |
582 |
return currentdescriptions;
|
583 |
} |
584 |
|
585 |
/*
|
586 |
* (non-Javadoc)
|
587 |
*
|
588 |
* @see com.iver.cit.gvsig.gui.cad.CADTool#end()
|
589 |
*/
|
590 |
public void end() { |
591 |
CADExtension.setCADTool("_selection", true); |
592 |
PluginServices.getMainFrame().setSelectedTool("_selection");
|
593 |
CADTool cadtool = CADExtension.getCADTool(); |
594 |
cadtool.setPreviosTool(this);
|
595 |
} |
596 |
|
597 |
public void init() { |
598 |
// jaume, should not be necessary
|
599 |
// CADTool.drawingSymbol.setOutlined(true);
|
600 |
// CADTool.drawingSymbol.setOutlineColor(Color.GREEN);
|
601 |
|
602 |
} |
603 |
|
604 |
// protected ArrayList getSelectedRows() {
|
605 |
// VectorialLayerEdited vle = getVLE();
|
606 |
// ArrayList selectedRow = vle.getSelectedRow();
|
607 |
// return selectedRow;
|
608 |
// }
|
609 |
|
610 |
protected ArrayList getSelectedHandlers() { |
611 |
VectorialLayerEdited vle = getVLE(); |
612 |
ArrayList selectedHandlers = vle.getSelectedHandler();
|
613 |
return selectedHandlers;
|
614 |
} |
615 |
|
616 |
public void clearSelection() throws DataException { |
617 |
VectorialLayerEdited vle = getVLE(); |
618 |
FeatureSelection selection = null;
|
619 |
selection = |
620 |
(FeatureSelection) ((FLyrVect) vle.getLayer()).getFeatureStore() |
621 |
.getSelection(); |
622 |
// ArrayList selectedRow = vle.getSelectedRow();
|
623 |
ArrayList selectedHandlers = vle.getSelectedHandler();
|
624 |
selection.deselectAll(); |
625 |
selectedHandlers.clear(); |
626 |
// VectorialEditableAdapter vea = vle.getVEA();
|
627 |
// FBitSet selection = vea.getSelection();
|
628 |
// selection.clear();
|
629 |
vle.setSelectionImage(null);
|
630 |
vle.setHandlersImage(null);
|
631 |
|
632 |
} |
633 |
|
634 |
public String getNextTool() { |
635 |
return tool;
|
636 |
} |
637 |
|
638 |
public void setNextTool(String tool) { |
639 |
this.tool = tool;
|
640 |
} |
641 |
|
642 |
public boolean changeCommand(String name) throws CommandException { |
643 |
CADTool[] cadtools = CADExtension.getCADTools();
|
644 |
for (int i = 0; i < cadtools.length; i++) { |
645 |
CADTool ct = cadtools[i]; |
646 |
if (name.equalsIgnoreCase(ct.getName())
|
647 |
|| name.equalsIgnoreCase(ct.toString())) { |
648 |
int type = Geometry.TYPES.POINT;
|
649 |
try {
|
650 |
type = ((FLyrVect) getVLE().getLayer()).getShapeType(); |
651 |
} catch (ReadException e) {
|
652 |
throw new CommandException(e); |
653 |
} |
654 |
if (ct.isApplicable(type)) {
|
655 |
getCadToolAdapter().setCadTool(ct); |
656 |
ct.init(); |
657 |
DefaultViewPanel vista = |
658 |
(DefaultViewPanel) PluginServices.getMDIManager() |
659 |
.getActiveWindow(); |
660 |
vista.getConsolePanel().addText("\n" + ct.getName(),
|
661 |
JConsole.COMMAND); |
662 |
String question = ct.getQuestion();
|
663 |
vista.getConsolePanel().addText( |
664 |
"\n" + "#" + question + " > ", JConsole.MESSAGE); |
665 |
return true; |
666 |
} |
667 |
throw new CommandException(name); |
668 |
} |
669 |
} |
670 |
return false; |
671 |
} |
672 |
|
673 |
public boolean isApplicable(int shapeType) { |
674 |
return true; |
675 |
} |
676 |
|
677 |
public abstract String toString(); |
678 |
|
679 |
public void throwValueException(String s, double d) { |
680 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
681 |
if (window instanceof DefaultViewPanel) { |
682 |
((DefaultViewPanel) window).getConsolePanel().addText( |
683 |
s + " : " + d, JConsole.ERROR);
|
684 |
} |
685 |
} |
686 |
|
687 |
public void throwOptionException(String s, String o) { |
688 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
689 |
if (window instanceof DefaultViewPanel) { |
690 |
((DefaultViewPanel) window).getConsolePanel().addText( |
691 |
s + " : " + o, JConsole.ERROR);
|
692 |
} |
693 |
} |
694 |
|
695 |
public void throwPointException(String s, double x, double y) { |
696 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
697 |
if (window instanceof DefaultViewPanel) { |
698 |
((DefaultViewPanel) window).getConsolePanel().addText( |
699 |
s + " : " + " X = " + x + ", Y = " + y, JConsole.ERROR); |
700 |
} |
701 |
} |
702 |
|
703 |
public void setPreviosTool(DefaultCADTool tool) { |
704 |
previousTool = tool; |
705 |
} |
706 |
|
707 |
public void restorePreviousTool() { |
708 |
CADExtension.setCADTool(previousTool.toString(), true);
|
709 |
PluginServices.getMainFrame().setSelectedTool(previousTool.toString()); |
710 |
} |
711 |
|
712 |
public void endTransition(double x, double y, MouseEvent e) { |
713 |
// TODO Auto-generated method stub
|
714 |
|
715 |
} |
716 |
|
717 |
/**
|
718 |
* Create a curve. If there is an
|
719 |
* error return <code>null</code> and add the error
|
720 |
* to the log
|
721 |
*
|
722 |
* @return
|
723 |
* The Curve
|
724 |
*/
|
725 |
protected Curve createCurve() {
|
726 |
try {
|
727 |
return (Curve) geomManager.create(TYPES.CURVE, getSubType());
|
728 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
729 |
LOG.error("Error creating curve", new CreateGeometryException( |
730 |
TYPES.CURVE, getSubType(), e)); |
731 |
} |
732 |
return null; |
733 |
} |
734 |
|
735 |
/**
|
736 |
* Create an {@link OrientablePrimitive}. If there is an
|
737 |
* error return <code>null</code> and add the error
|
738 |
* to the log
|
739 |
*
|
740 |
* @param geometryType
|
741 |
* a type of a OrientablePrimitive.
|
742 |
* @return
|
743 |
* The {@link OrientablePrimitive}
|
744 |
*/
|
745 |
protected OrientablePrimitive createOrientablePrimitive(int geometryType) { |
746 |
try {
|
747 |
return (OrientablePrimitive) geomManager.create(geometryType,
|
748 |
getSubType()); |
749 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
750 |
LOG.error("Error creating curve", new CreateGeometryException( |
751 |
TYPES.CURVE, getSubType(), e)); |
752 |
} |
753 |
return null; |
754 |
} |
755 |
|
756 |
/**
|
757 |
* Create an envelope like a curve from two points.
|
758 |
* If there is an error return <code>null</code> and add the error to the
|
759 |
* log.
|
760 |
*
|
761 |
* @param firstPoint
|
762 |
* first point
|
763 |
* @param secondPoint
|
764 |
* second point
|
765 |
* @return
|
766 |
* the curve
|
767 |
*/
|
768 |
protected Curve createEnvelopeLikeCurve(Point2D firstPoint, |
769 |
Point2D secondPoint) {
|
770 |
try {
|
771 |
Curve curve = (Curve) geomManager.create(TYPES.CURVE, getSubType()); |
772 |
curve.addMoveToVertex(createPoint(firstPoint.getX(), |
773 |
firstPoint.getY())); |
774 |
curve.addVertex(createPoint(secondPoint.getX(), firstPoint.getY())); |
775 |
curve |
776 |
.addVertex(createPoint(secondPoint.getX(), secondPoint.getY())); |
777 |
curve.addVertex(createPoint(firstPoint.getX(), secondPoint.getY())); |
778 |
curve.addVertex(createPoint(firstPoint.getX(), firstPoint.getY())); |
779 |
return curve;
|
780 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
781 |
LOG.error("Error creating curve", new CreateGeometryException( |
782 |
TYPES.CURVE, getSubType(), e)); |
783 |
} |
784 |
return null; |
785 |
} |
786 |
|
787 |
/**
|
788 |
* Create a curve from a GeneralPath. If there is an
|
789 |
* error return <code>null</code> and add the error
|
790 |
* to the log
|
791 |
*
|
792 |
* @param gpx
|
793 |
* The GeneralPath
|
794 |
* @return
|
795 |
* The Curve
|
796 |
*/
|
797 |
protected Curve createCurve(GeneralPathX gpx) {
|
798 |
Curve curve = null;
|
799 |
try {
|
800 |
curve = (Curve) geomManager.create(TYPES.CURVE, getSubType()); |
801 |
curve.setGeneralPath(gpx); |
802 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
803 |
LOG.error("Error creating curve", new CreateGeometryException( |
804 |
TYPES.CURVE, getSubType(), e)); |
805 |
} |
806 |
return curve;
|
807 |
} |
808 |
|
809 |
/**
|
810 |
* Create a surface. If there is an
|
811 |
* error return <code>null</code> and add the error
|
812 |
* to the log
|
813 |
*
|
814 |
* @return
|
815 |
* The Surface
|
816 |
*/
|
817 |
protected Surface createSurface() {
|
818 |
try {
|
819 |
return (Surface) geomManager.create(TYPES.SURFACE, getSubType());
|
820 |
|
821 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
822 |
LOG.error("Error creating surface", new CreateGeometryException( |
823 |
TYPES.SURFACE, getSubType(), e)); |
824 |
} |
825 |
return null; |
826 |
} |
827 |
|
828 |
/**
|
829 |
* Create a surface from a GeneralPath. If there is an
|
830 |
* error return <code>null</code> and add the error
|
831 |
* to the log
|
832 |
*
|
833 |
* @param gpx
|
834 |
* The general path
|
835 |
* @return
|
836 |
* The Surface
|
837 |
*/
|
838 |
protected Surface createSurface(GeneralPathX gpx) {
|
839 |
Surface surface = null;
|
840 |
try {
|
841 |
surface = (Surface) geomManager.create(TYPES.SURFACE, getSubType()); |
842 |
surface.setGeneralPath(gpx); |
843 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
844 |
LOG.error("Error creating surface", new CreateGeometryException( |
845 |
TYPES.SURFACE, getSubType(), e)); |
846 |
} |
847 |
return surface;
|
848 |
} |
849 |
|
850 |
/**
|
851 |
* Create a curve point. If there is an
|
852 |
* error return <code>null</code> and add the error
|
853 |
* to the log
|
854 |
*
|
855 |
* @param p1
|
856 |
* The AWT point
|
857 |
* @return
|
858 |
* The gvSIG point
|
859 |
*/
|
860 |
protected Point createPoint(Point2D p1) { |
861 |
return createPoint(p1.getX(), p1.getY());
|
862 |
} |
863 |
|
864 |
/**
|
865 |
* Create point. If there is an
|
866 |
* error return <code>null</code> and add the error
|
867 |
* to the log
|
868 |
*
|
869 |
* @param x
|
870 |
* The X coordinate
|
871 |
* @param y
|
872 |
* The y coordinate
|
873 |
* @return
|
874 |
* The Point
|
875 |
*/
|
876 |
protected Point createPoint(double x, double y) { |
877 |
Point point = null; |
878 |
try {
|
879 |
point = (Point) geomManager.create(TYPES.POINT, getSubType());
|
880 |
point.setX(x); |
881 |
point.setY(y); |
882 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
883 |
LOG.error("Error creating point with x=" + x + ", y=" + y, |
884 |
new CreateGeometryException(TYPES.POINT, getSubType(), e));
|
885 |
} |
886 |
return point;
|
887 |
} |
888 |
|
889 |
/**
|
890 |
* Create an Arc. If there is an
|
891 |
* error return <code>null</code> and add the error
|
892 |
* to the log
|
893 |
*
|
894 |
* @param p1
|
895 |
* @param p2
|
896 |
* @param p3
|
897 |
* @return
|
898 |
* The arc
|
899 |
*/
|
900 |
protected Arc createArc(Point2D p1, Point2D p2, Point2D p3) { |
901 |
return createArc(createPoint(p1), createPoint(p2), createPoint(p3));
|
902 |
} |
903 |
|
904 |
/**
|
905 |
* Create an arc. If there is an
|
906 |
* error return <code>null</code> and add the error
|
907 |
* to the log
|
908 |
*
|
909 |
* @param p1
|
910 |
* @param p2
|
911 |
* @param p3
|
912 |
* @return
|
913 |
* The arc
|
914 |
*/
|
915 |
protected Arc createArc(Point p1, Point p2, Point p3) { |
916 |
Arc arc = null;
|
917 |
if (p1.equals(p2) || p2.equals(p3) || p1.equals(p3)) {
|
918 |
return null; |
919 |
} |
920 |
try {
|
921 |
arc = (Arc) geomManager.create(TYPES.ARC, getSubType()); |
922 |
arc.setPoints(p1, p2, p3); |
923 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
924 |
LOG.error("Error creating arc with p1=" + p1, ", p2=" + p2 |
925 |
+ ", p3=" + p3, new CreateGeometryException(TYPES.ARC, |
926 |
getSubType(), e)); |
927 |
} |
928 |
return arc;
|
929 |
} |
930 |
|
931 |
/**
|
932 |
* Create a circle. If there is an
|
933 |
* error return <code>null</code> and add the error
|
934 |
* to the log
|
935 |
*
|
936 |
* @param p1
|
937 |
* @param p2
|
938 |
* @param p3
|
939 |
* @return
|
940 |
* The Circle
|
941 |
*/
|
942 |
protected Circle createCircle(Point p1, Point p2, Point p3) { |
943 |
Circle circle = null;
|
944 |
try {
|
945 |
circle = (Circle) geomManager.create(TYPES.CIRCLE, getSubType()); |
946 |
circle.setPoints(p1, p2, p3); |
947 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
948 |
LOG.error("Error creating circle with p1=" + p1 + " p2=" + p2 |
949 |
+ ", p3=" + p3, new CreateGeometryException(TYPES.CIRCLE, |
950 |
getSubType(), e)); |
951 |
} |
952 |
return circle;
|
953 |
} |
954 |
|
955 |
/**
|
956 |
* Create a circle from a GeneralPath. If there is an
|
957 |
* error return <code>null</code> and add the error
|
958 |
* to the log
|
959 |
*
|
960 |
* @param p1
|
961 |
* @param p2
|
962 |
* @return
|
963 |
* The circle
|
964 |
*/
|
965 |
protected Circle createCircle(Point2D p1, Point2D p2) { |
966 |
return createCircle(createPoint(p1), createPoint(p2));
|
967 |
} |
968 |
|
969 |
/**
|
970 |
* Create a circle. If there is an
|
971 |
* error return <code>null</code> and add the error
|
972 |
* to the log
|
973 |
*
|
974 |
* @param p1
|
975 |
* @param p2
|
976 |
* @return
|
977 |
* The circle
|
978 |
*/
|
979 |
protected Circle createCircle(Point p1, Point p2) { |
980 |
Circle circle = null;
|
981 |
try {
|
982 |
circle = (Circle) geomManager.create(TYPES.CIRCLE, getSubType()); |
983 |
circle.setPoints(p1, p2); |
984 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
985 |
LOG.error("Error creating circle with p1=" + p1 + " p2=" + p2, |
986 |
new CreateGeometryException(TYPES.CIRCLE, getSubType(), e));
|
987 |
} |
988 |
return circle;
|
989 |
} |
990 |
|
991 |
/**
|
992 |
* Create a circle. If there is an
|
993 |
* error return <code>null</code> and add the error
|
994 |
* to the log
|
995 |
*
|
996 |
* @param p1
|
997 |
* @param radious
|
998 |
* @return
|
999 |
* The Circle
|
1000 |
*/
|
1001 |
protected Circle createCircle(Point2D p1, double radious) { |
1002 |
return createCircle(createPoint(p1), radious);
|
1003 |
} |
1004 |
|
1005 |
/**
|
1006 |
* Create a circle. If there is an
|
1007 |
* error return <code>null</code> and add the error
|
1008 |
* to the log
|
1009 |
*
|
1010 |
* @param p1
|
1011 |
* @param radious
|
1012 |
* @return
|
1013 |
* The Circle
|
1014 |
*/
|
1015 |
protected Circle createCircle(Point p1, double radious) { |
1016 |
Circle circle = null;
|
1017 |
try {
|
1018 |
circle = (Circle) geomManager.create(TYPES.CIRCLE, getSubType()); |
1019 |
circle.setPoints(p1, radious); |
1020 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
1021 |
LOG.error("Error creating circle with p1=" + p1 + " radious=" |
1022 |
+ radious, new CreateGeometryException(TYPES.CIRCLE,
|
1023 |
getSubType(), e)); |
1024 |
} |
1025 |
return circle;
|
1026 |
} |
1027 |
|
1028 |
/**
|
1029 |
* Create an Ellipse. If there is an
|
1030 |
* error return <code>null</code> and add the error
|
1031 |
* to the log
|
1032 |
*
|
1033 |
* @param p1
|
1034 |
* @param p2
|
1035 |
* @param d
|
1036 |
* @return
|
1037 |
* The Ellipse
|
1038 |
*/
|
1039 |
protected Ellipse createEllipse(Point2D p1, Point2D p2, double d) { |
1040 |
return createEllipse(createPoint(p1), createPoint(p2), d);
|
1041 |
} |
1042 |
|
1043 |
/**
|
1044 |
* Create an Ellipse. If there is an
|
1045 |
* error return <code>null</code> and add the error
|
1046 |
* to the log
|
1047 |
*
|
1048 |
* @param p1
|
1049 |
* @param p2
|
1050 |
* @param d
|
1051 |
* @return
|
1052 |
* The Ellipse
|
1053 |
*/
|
1054 |
protected Ellipse createEllipse(Point p1, Point p2, double d) { |
1055 |
Ellipse ellipse = null;
|
1056 |
try {
|
1057 |
ellipse = (Ellipse) geomManager.create(TYPES.ELLIPSE, getSubType()); |
1058 |
ellipse.setPoints(p1, p2, d); |
1059 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
1060 |
LOG.error("Error creating ellipse with p1=" + p1 + " p2=" + p2 |
1061 |
+ ", d=" + d, new CreateGeometryException(TYPES.ELLIPSE, |
1062 |
getSubType(), e)); |
1063 |
} |
1064 |
return ellipse;
|
1065 |
} |
1066 |
|
1067 |
/**
|
1068 |
* Create a Spline from a GeneralPath. If there is an
|
1069 |
* error return <code>null</code> and add the error
|
1070 |
* to the log
|
1071 |
*
|
1072 |
* @param points
|
1073 |
* @return
|
1074 |
* The Spline
|
1075 |
*/
|
1076 |
protected Spline createSpline(Point2D[] points) { |
1077 |
Spline spline = null;
|
1078 |
try {
|
1079 |
spline = (Spline) geomManager.create(TYPES.SPLINE, getSubType()); |
1080 |
for (int i = 0; i < points.length; i++) { |
1081 |
spline.addVertex(createPoint(points[i])); |
1082 |
} |
1083 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
1084 |
LOG.error("Error creating spline", new CreateGeometryException( |
1085 |
TYPES.SPLINE, getSubType(), e)); |
1086 |
} |
1087 |
return spline;
|
1088 |
} |
1089 |
|
1090 |
/**
|
1091 |
* Create a MultiPrimitive. If there is an
|
1092 |
* error return <code>null</code> and add the error
|
1093 |
* to the log
|
1094 |
*
|
1095 |
* @return
|
1096 |
*/
|
1097 |
protected MultiPrimitive createMultiPrimitive() {
|
1098 |
try {
|
1099 |
return (MultiPrimitive) geomManager.create(TYPES.AGGREGATE,
|
1100 |
getSubType()); |
1101 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
1102 |
LOG.error("Error creating MultiPrimitive",
|
1103 |
new CreateGeometryException(TYPES.SPLINE, getSubType(), e));
|
1104 |
} |
1105 |
return null; |
1106 |
} |
1107 |
|
1108 |
/**
|
1109 |
* Create a MultiPrimitive. If there is an
|
1110 |
* error return <code>null</code> and add the error
|
1111 |
* to the log
|
1112 |
*
|
1113 |
* @param geometries
|
1114 |
* @return
|
1115 |
*/
|
1116 |
protected MultiPrimitive createMultiPrimitive(Geometry[] geometries) { |
1117 |
MultiPrimitive multiPrimitive = null;
|
1118 |
try {
|
1119 |
multiPrimitive = |
1120 |
(MultiPrimitive) geomManager.create(TYPES.AGGREGATE, |
1121 |
getSubType()); |
1122 |
for (int i = 0; i < geometries.length; i++) { |
1123 |
multiPrimitive.addPrimitive((Primitive) geometries[i]); |
1124 |
} |
1125 |
} catch (org.gvsig.fmap.geom.exception.CreateGeometryException e) {
|
1126 |
LOG.error("Error creating MultiPrimitive",
|
1127 |
new CreateGeometryException(TYPES.SPLINE, getSubType(), e));
|
1128 |
} |
1129 |
return multiPrimitive;
|
1130 |
} |
1131 |
|
1132 |
/**
|
1133 |
* @return the subtype of the default geometry.
|
1134 |
*/
|
1135 |
protected int getSubType() { |
1136 |
FeatureStore featureStore = |
1137 |
((FLyrVect) getVLE().getLayer()).getFeatureStore(); |
1138 |
try {
|
1139 |
return featureStore.getDefaultFeatureType()
|
1140 |
.getDefaultGeometryAttribute().getGeometrySubType(); |
1141 |
} catch (DataException e) {
|
1142 |
LOG.error( |
1143 |
"Error getting subtype of the default feature type of the store: "
|
1144 |
+ featureStore, e); |
1145 |
return SUBTYPES.GEOM3D;
|
1146 |
} |
1147 |
} |
1148 |
} |