Revision 55 org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.swing/org.gvsig.vectorediting.swing.impl/src/main/java/org/gvsig/vectorediting/swing/impl/DefaultEditingBehavior.java
DefaultEditingBehavior.java | ||
---|---|---|
48 | 48 |
import org.gvsig.utils.console.JDockPanel; |
49 | 49 |
import org.gvsig.utils.console.ResponseListener; |
50 | 50 |
import org.gvsig.utils.console.jedit.JEditTextArea; |
51 |
import org.gvsig.vectorediting.lib.api.DrawingStatus; |
|
51 | 52 |
import org.gvsig.vectorediting.lib.api.EditingLocator; |
52 | 53 |
import org.gvsig.vectorediting.lib.api.EditingManager; |
53 | 54 |
import org.gvsig.vectorediting.lib.api.EditingService; |
54 | 55 |
import org.gvsig.vectorediting.lib.api.EditingServiceParameter; |
55 | 56 |
import org.gvsig.vectorediting.lib.api.EditingServiceParameter.TYPE; |
57 |
import org.gvsig.vectorediting.lib.spi.DefaultDrawingStatus; |
|
56 | 58 |
import org.gvsig.vectorediting.swing.api.EditingBehavior; |
57 | 59 |
import org.slf4j.Logger; |
58 | 60 |
import org.slf4j.LoggerFactory; |
... | ... | |
176 | 178 |
|
177 | 179 |
public void activateTool(String name) { |
178 | 180 |
|
179 |
EditingManager manager = EditingLocator.getManager();
|
|
181 |
EditingManager manager = EditingLocator.getManager();
|
|
180 | 182 |
|
181 |
if (currentLayer != null) {
|
|
182 |
EditingService service = serviceRegistration.get(currentLayer);
|
|
183 |
if (currentLayer != null) {
|
|
184 |
EditingService service = serviceRegistration.get(currentLayer);
|
|
183 | 185 |
if(service == null || !service.getName().equals(name)){ |
184 |
service = (EditingService) manager.getEditingService(name,
|
|
185 |
currentLayer.getFeatureStore());
|
|
186 |
serviceRegistration.put(currentLayer, service);
|
|
187 |
}
|
|
188 |
if (service != null) {
|
|
189 |
this.activeService = service;
|
|
190 |
service.start();
|
|
191 |
getNextParameter();
|
|
192 |
}
|
|
193 |
}
|
|
194 |
}
|
|
186 |
service = (EditingService) manager.getEditingService(name,
|
|
187 |
currentLayer.getFeatureStore());
|
|
188 |
serviceRegistration.put(currentLayer, service);
|
|
189 |
}
|
|
190 |
if (service != null) {
|
|
191 |
this.activeService = service;
|
|
192 |
service.start();
|
|
193 |
getNextParameter();
|
|
194 |
}
|
|
195 |
}
|
|
196 |
}
|
|
195 | 197 |
|
196 | 198 |
private void askQuestion(EditingServiceParameter param) { |
197 | 199 |
if (getConsolePanel() != null) { |
... | ... | |
224 | 226 |
private void getNextParameter() { |
225 | 227 |
currentParam = activeService.next(); |
226 | 228 |
if (currentParam == null) { |
227 |
activeService.finish(); |
|
229 |
try { |
|
230 |
activeService.finish(); |
|
231 |
} catch (BaseException e) { |
|
232 |
// TODO Auto-generated catch block |
|
233 |
e.printStackTrace(); |
|
234 |
} |
|
228 | 235 |
mapControl.rePaintDirtyLayers(); |
229 | 236 |
activeService.start(); |
230 | 237 |
getNextParameter(); |
... | ... | |
331 | 338 |
return; |
332 | 339 |
} |
333 | 340 |
|
334 |
Geometry helperGeo = activeService.draw(adjustedPoint); |
|
341 |
DrawingStatus helperGeo = null; |
|
342 |
try { |
|
343 |
helperGeo = activeService.draw(adjustedPoint); |
|
344 |
} catch (BaseException e) { |
|
345 |
// TODO Auto-generated catch block |
|
346 |
e.printStackTrace(); |
|
347 |
} |
|
335 | 348 |
if (helperGeo != null) { |
336 |
mapControl.getMapControlDrawer().draw( |
|
337 |
helperGeo, |
|
338 |
MapControlLocator.getMapControlManager() |
|
339 |
.getAxisReferenceSymbol()); |
|
349 |
for (Iterator iterator = helperGeo.getGeometries().iterator(); iterator.hasNext();) { |
|
350 |
Geometry geometry = (Geometry) iterator.next(); |
|
351 |
mapControl.getMapControlDrawer().draw( |
|
352 |
geometry, |
|
353 |
MapControlLocator.getMapControlManager() |
|
354 |
.getAxisReferenceSymbol()); |
|
355 |
} |
|
340 | 356 |
} |
341 | 357 |
} |
342 | 358 |
|
Also available in: Unified diff