Revision 80 org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.lib/org.gvsig.vectorediting.lib.prov/org.gvsig.vectorediting.lib.prov.polyline/src/main/java/org/gvsig/vectorediting/lib/prov/polyline/PolylineEditingProvider.java
PolylineEditingProvider.java | ||
---|---|---|
283 | 283 |
} |
284 | 284 |
} |
285 | 285 |
|
286 |
public void finish() throws FinishServiceException { |
|
286 |
public void finishAndStore() throws FinishServiceException {
|
|
287 | 287 |
try { |
288 | 288 |
GeometryType storeGeomType = editingProviderServices |
289 | 289 |
.getGeomType(featureStore); |
290 |
DrawingStatus finalGeometries = calculatePolyline(null); |
|
290 |
|
|
291 |
Geometry geometry = finish(); |
|
292 |
if (geometry == null) { |
|
293 |
if (storeGeomType.isTypeOf(CURVE)) { |
|
294 |
DrawingStatus finalGeometries = calculatePolyline(null); |
|
295 |
for (Geometry geom : finalGeometries.getGeometries()) { |
|
296 |
editingProviderServices.insertGeometryIntoFeatureStore(geom, |
|
297 |
featureStore); |
|
298 |
} |
|
299 |
} |
|
300 |
else if (storeGeomType.isTypeOf(MULTICURVE)) { |
|
301 |
DrawingStatus finalGeometries = calculatePolyline(null); |
|
302 |
MultiCurve multiCurve; |
|
303 |
multiCurve = geomManager.createMultiCurve(storeGeomType.getSubType()); |
|
304 |
for (Geometry geom : finalGeometries.getGeometries()) { |
|
305 |
multiCurve.addCurve((Curve) geom); |
|
306 |
} |
|
307 |
editingProviderServices.insertGeometryIntoFeatureStore(multiCurve, |
|
308 |
featureStore); |
|
309 |
} |
|
310 |
} |
|
311 |
else { |
|
312 |
editingProviderServices.insertGeometryIntoFeatureStore(geometry, |
|
313 |
featureStore); |
|
314 |
} |
|
315 |
} |
|
316 |
catch (Exception e) { |
|
317 |
throw new FinishServiceException(e); |
|
318 |
} |
|
319 |
} |
|
320 |
|
|
321 |
public Geometry finish() throws FinishServiceException { |
|
322 |
try { |
|
323 |
GeometryType storeGeomType = editingProviderServices |
|
324 |
.getGeomType(featureStore); |
|
291 | 325 |
if (storeGeomType.isTypeOf(SURFACE)) { |
326 |
DrawingStatus finalGeometries = calculatePolyline(null); |
|
292 | 327 |
Surface surface = geomManager.createPolygon(storeGeomType.getSubType()); |
293 | 328 |
for (Geometry geometry : finalGeometries.getGeometries()) { |
294 | 329 |
surface.addVertex((Point) geometry); |
295 | 330 |
} |
296 | 331 |
surface = closeSurfaceIfNecessary(surface); |
297 |
editingProviderServices.insertGeometryIntoFeatureStore(surface, |
|
298 |
featureStore); |
|
332 |
return (Geometry) surface; |
|
299 | 333 |
} |
300 |
else if (storeGeomType.isTypeOf(CURVE)) { |
|
301 |
for (Geometry geometry : finalGeometries.getGeometries()) { |
|
302 |
editingProviderServices.insertGeometryIntoFeatureStore(geometry, |
|
303 |
featureStore); |
|
304 |
} |
|
305 |
} |
|
306 | 334 |
else if (storeGeomType.isTypeOf(MULTISURFACE)) { |
335 |
DrawingStatus finalGeometries = calculatePolyline(null); |
|
307 | 336 |
MultiSurface multiSurface; |
308 | 337 |
multiSurface = geomManager.createMultiSurface(storeGeomType |
309 | 338 |
.getSubType()); |
... | ... | |
318 | 347 |
} |
319 | 348 |
surface = closeSurfaceIfNecessary(surface); |
320 | 349 |
multiSurface.addSurface(surface); |
321 |
editingProviderServices.insertGeometryIntoFeatureStore(multiSurface, |
|
322 |
featureStore); |
|
350 |
return (Geometry) multiSurface; |
|
323 | 351 |
} |
324 |
else if (storeGeomType.isTypeOf(MULTICURVE)) { |
|
325 |
MultiCurve multiCurve; |
|
326 |
multiCurve = geomManager.createMultiCurve(storeGeomType.getSubType()); |
|
327 |
for (Geometry geometry : finalGeometries.getGeometries()) { |
|
328 |
multiCurve.addCurve((Curve) geometry); |
|
329 |
} |
|
330 |
editingProviderServices.insertGeometryIntoFeatureStore(multiCurve, |
|
331 |
featureStore); |
|
332 |
} |
|
352 |
return null; |
|
333 | 353 |
} |
334 | 354 |
catch (Exception e) { |
335 | 355 |
throw new FinishServiceException(e); |
... | ... | |
581 | 601 |
} |
582 | 602 |
|
583 | 603 |
public void stop() { |
584 |
if(values != null){
|
|
604 |
if (values != null) {
|
|
585 | 605 |
values.clear(); |
586 | 606 |
} |
587 | 607 |
points.setDescription(i18nManager.getTranslation("indicates_new_point")); |
Also available in: Unified diff