root / branches / v2_0_0_prep / extensions / extEditing / src / org / gvsig / editing / layers / VectorialLayerEdited.java @ 30335
History | View | Annotate | Download (18 KB)
1 |
package org.gvsig.editing.layers; |
---|---|
2 |
|
3 |
import java.awt.Graphics2D; |
4 |
import java.awt.Image; |
5 |
import java.awt.geom.Point2D; |
6 |
import java.awt.image.BufferedImage; |
7 |
import java.util.ArrayList; |
8 |
import java.util.ConcurrentModificationException; |
9 |
import java.util.EmptyStackException; |
10 |
|
11 |
import org.gvsig.andami.PluginServices; |
12 |
import org.gvsig.andami.messages.NotificationManager; |
13 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
14 |
import org.gvsig.app.project.documents.view.gui.View; |
15 |
import org.gvsig.editing.CADExtension; |
16 |
import org.gvsig.editing.EditionChangeManager; |
17 |
import org.gvsig.editing.StartEditing; |
18 |
import org.gvsig.editing.ViewCommandStackExtension; |
19 |
import org.gvsig.editing.gui.cad.CADTool; |
20 |
import org.gvsig.editing.gui.cad.DefaultCADTool; |
21 |
import org.gvsig.editing.gui.cad.tools.SelectionCADTool; |
22 |
import org.gvsig.editing.gui.cad.tools.select.SelectRowPanel; |
23 |
import org.gvsig.fmap.dal.exception.DataException; |
24 |
import org.gvsig.fmap.dal.exception.ReadException; |
25 |
import org.gvsig.fmap.dal.feature.DisposableIterator; |
26 |
import org.gvsig.fmap.dal.feature.Feature; |
27 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
28 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
29 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
30 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
31 |
import org.gvsig.fmap.geom.GeometryLocator; |
32 |
import org.gvsig.fmap.geom.GeometryManager; |
33 |
import org.gvsig.fmap.geom.Geometry.SUBTYPES; |
34 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
35 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
36 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
37 |
import org.gvsig.fmap.geom.handler.Handler; |
38 |
import org.gvsig.fmap.geom.operation.Draw; |
39 |
import org.gvsig.fmap.geom.operation.DrawOperationContext; |
40 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
41 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
42 |
import org.gvsig.fmap.geom.primitive.Circle; |
43 |
import org.gvsig.fmap.geom.primitive.Envelope; |
44 |
import org.gvsig.fmap.geom.primitive.Point; |
45 |
import org.gvsig.fmap.mapcontext.ViewPort; |
46 |
import org.gvsig.fmap.mapcontext.layers.CancelationException; |
47 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
48 |
import org.gvsig.fmap.mapcontext.layers.LayerDrawEvent; |
49 |
import org.gvsig.fmap.mapcontext.layers.LayerDrawingListener; |
50 |
import org.gvsig.fmap.mapcontext.layers.LayerEvent; |
51 |
import org.gvsig.fmap.mapcontext.layers.vectorial.ContainsEnvelopeEvaluator; |
52 |
import org.gvsig.fmap.mapcontext.layers.vectorial.ContainsGeometryEvaluator; |
53 |
import org.gvsig.fmap.mapcontext.layers.vectorial.CrossEnvelopeEvaluator; |
54 |
import org.gvsig.fmap.mapcontext.layers.vectorial.CrossesGeometryEvaluator; |
55 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
56 |
import org.gvsig.fmap.mapcontext.layers.vectorial.IntersectsGeometryEvaluator; |
57 |
import org.gvsig.fmap.mapcontext.layers.vectorial.OutGeometryEvaluator; |
58 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
59 |
import org.gvsig.fmap.mapcontrol.MapControl; |
60 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
61 |
import org.gvsig.fmap.mapcontrol.MapControlManager; |
62 |
import org.gvsig.tools.evaluator.Evaluator; |
63 |
import org.gvsig.tools.observer.Observable; |
64 |
import org.gvsig.tools.observer.Observer; |
65 |
import org.slf4j.Logger; |
66 |
import org.slf4j.LoggerFactory; |
67 |
|
68 |
public class VectorialLayerEdited extends DefaultLayerEdited implements |
69 |
LayerDrawingListener, Observer {
|
70 |
private static final GeometryManager geomManager = GeometryLocator.getGeometryManager(); |
71 |
private static final Logger logger = LoggerFactory.getLogger(VectorialLayerEdited.class); |
72 |
private static final MapControlManager mapControlManager = MapControlLocator.getMapControlManager(); |
73 |
private ArrayList selectedHandler = new ArrayList(); |
74 |
private Point2D lastPoint; |
75 |
private Point2D firstPoint; |
76 |
private CADTool cadtool = null; |
77 |
|
78 |
private ILegend legend;
|
79 |
private Image imageSelection; |
80 |
private Image imageHandlers; |
81 |
private EditionChangeManager echm=null; |
82 |
private MapControl mapControl = null; |
83 |
|
84 |
public VectorialLayerEdited(FLayer lyr, MapControl mapControl) {
|
85 |
super(lyr);
|
86 |
this.mapControl = mapControl;
|
87 |
lyr.getMapContext().addLayerDrawingListener(this);
|
88 |
// Por defecto, siempre hacemos snapping sobre la capa en edici�n.
|
89 |
lyr.getMapContext().getLayersToSnap().add(lyr); |
90 |
((FLyrVect) lyr).getFeatureStore().addObserver(this);
|
91 |
} |
92 |
|
93 |
public ArrayList getSelectedHandler() { |
94 |
return selectedHandler;
|
95 |
} |
96 |
|
97 |
public void clearSelection() throws DataException { |
98 |
if (getFeatureStore() == null) { |
99 |
return;
|
100 |
} |
101 |
FeatureSelection selection = getFeatureStore().getFeatureSelection(); |
102 |
selectedHandler.clear(); |
103 |
selection.deselectAll(); |
104 |
} |
105 |
|
106 |
public void selectWithPoint(double x, double y, boolean multipleSelection) { |
107 |
try {
|
108 |
firstPoint = new Point2D.Double(x, y); |
109 |
FeatureStore featureStore = getFeatureStore(); |
110 |
// Se comprueba si se pincha en una gemometr�a
|
111 |
ViewPort vp = getLayer().getMapContext().getViewPort(); |
112 |
double tol = vp.toMapDistance(mapControlManager.getTolerance());
|
113 |
|
114 |
GeometryManager manager = GeometryLocator.getGeometryManager(); |
115 |
Point center = (org.gvsig.fmap.geom.primitive.Point)manager.create(TYPES.POINT, SUBTYPES.GEOM2D);
|
116 |
center.setX(x); |
117 |
center.setY(y); |
118 |
Circle circle = (Circle)geomManager.create(TYPES.CIRCLE, SUBTYPES.GEOM2D); |
119 |
circle.setPoints(center, tol); |
120 |
|
121 |
FeatureQuery fq = featureStore.createFeatureQuery(); |
122 |
fq.setAttributeNames(new String[]{featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName()}); |
123 |
Evaluator evaluator=new IntersectsGeometryEvaluator(circle, vp.getProjection(), featureStore.getDefaultFeatureType(), featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName());
|
124 |
fq.setFilter(evaluator); |
125 |
FeatureSet set = featureStore.getFeatureSet(fq); |
126 |
if (!multipleSelection && set.getSize()>1){ |
127 |
SelectRowPanel selectionPanel=new SelectRowPanel(set, this); |
128 |
PluginServices.getMDIManager().addCentredWindow(selectionPanel); |
129 |
} |
130 |
selectAndDrawGeometries(featureStore, set, vp, multipleSelection); |
131 |
} catch (ReadException e) {
|
132 |
NotificationManager.addError(e.getMessage(), e); |
133 |
} catch (GeometryOperationNotSupportedException e) {
|
134 |
NotificationManager.addError(e.getMessage(), e); |
135 |
} catch (GeometryOperationException e) {
|
136 |
NotificationManager.addError(e.getMessage(), e); |
137 |
} catch (DataException e) {
|
138 |
NotificationManager.addError(e.getMessage(), e); |
139 |
} catch (CreateGeometryException e) {
|
140 |
NotificationManager.addError(e.getMessage(), e); |
141 |
} |
142 |
} |
143 |
|
144 |
public void selectWithSecondPoint(double x, double y) { |
145 |
try {
|
146 |
FeatureStore featureStore = getFeatureStore(); |
147 |
lastPoint = new Point2D.Double(x, y); |
148 |
ViewPort vp = getLayer().getMapContext().getViewPort(); |
149 |
double x1;
|
150 |
double y1;
|
151 |
double w1;
|
152 |
double h1;
|
153 |
|
154 |
if (firstPoint.getX() < lastPoint.getX()) {
|
155 |
x1 = firstPoint.getX(); |
156 |
w1 = lastPoint.getX() - firstPoint.getX(); |
157 |
} else {
|
158 |
x1 = lastPoint.getX(); |
159 |
w1 = firstPoint.getX() - lastPoint.getX(); |
160 |
} |
161 |
|
162 |
if (firstPoint.getY() < lastPoint.getY()) {
|
163 |
y1 = firstPoint.getY(); |
164 |
h1 = lastPoint.getY() - firstPoint.getY(); |
165 |
} else {
|
166 |
y1 = lastPoint.getY(); |
167 |
h1 = firstPoint.getY() - lastPoint.getY(); |
168 |
} |
169 |
|
170 |
Envelope envelope = geomManager.createEnvelope(x1, y1, x1 + w1, y1 + h1, SUBTYPES.GEOM2D); |
171 |
|
172 |
FeatureQuery fq = featureStore.createFeatureQuery(); |
173 |
fq.setAttributeNames(new String[]{featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName()}); |
174 |
Evaluator evaluator=null;
|
175 |
if (firstPoint.getX() < lastPoint.getX()) {
|
176 |
evaluator=new ContainsEnvelopeEvaluator(envelope, vp.getProjection(), featureStore.getDefaultFeatureType(), featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName());
|
177 |
}else{
|
178 |
evaluator=new CrossEnvelopeEvaluator(envelope, vp.getProjection(), featureStore.getDefaultFeatureType(), featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName());
|
179 |
} |
180 |
fq.setFilter(evaluator); |
181 |
FeatureSet set = featureStore.getFeatureSet(fq); |
182 |
selectAndDrawGeometries(featureStore, set, vp, false);
|
183 |
} catch (ReadException e) {
|
184 |
NotificationManager.addError(e.getMessage(), e); |
185 |
} catch (GeometryOperationNotSupportedException e) {
|
186 |
NotificationManager.addError(e.getMessage(), e); |
187 |
} catch (GeometryOperationException e) {
|
188 |
NotificationManager.addError(e.getMessage(), e); |
189 |
} catch (DataException e) {
|
190 |
NotificationManager.addError(e.getMessage(), e); |
191 |
} catch (CreateEnvelopeException e) {
|
192 |
NotificationManager.addError(e.getMessage(), e); |
193 |
} |
194 |
} |
195 |
|
196 |
public void selectInsidePolygon(org.gvsig.fmap.geom.Geometry polygon) { |
197 |
try {
|
198 |
FeatureStore featureStore = getFeatureStore(); |
199 |
ViewPort vp = getLayer().getMapContext().getViewPort(); |
200 |
FeatureQuery fq = featureStore.createFeatureQuery(); |
201 |
fq.setAttributeNames(new String[]{featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName()}); |
202 |
Evaluator evaluator=new ContainsGeometryEvaluator(polygon, vp.getProjection(), featureStore.getDefaultFeatureType(), featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName());
|
203 |
fq.setFilter(evaluator); |
204 |
FeatureSet set = featureStore.getFeatureSet(fq); |
205 |
selectAndDrawGeometries(featureStore, set, vp, false);
|
206 |
} catch (ReadException e) {
|
207 |
NotificationManager.addError(e.getMessage(), e); |
208 |
} catch (DataException e) {
|
209 |
NotificationManager.addError(e.getMessage(), e); |
210 |
} catch (GeometryOperationNotSupportedException e) {
|
211 |
NotificationManager.addError(e.getMessage(), e); |
212 |
} catch (GeometryOperationException e) {
|
213 |
NotificationManager.addError(e.getMessage(), e); |
214 |
} |
215 |
} |
216 |
private void selectAndDrawGeometries(FeatureStore featureStore, FeatureSet set, ViewPort vp, boolean multipleSelection) throws DataException, GeometryOperationNotSupportedException, GeometryOperationException{ |
217 |
BufferedImage selectionImage = null; |
218 |
BufferedImage handlersImage = null; |
219 |
// if (!multipleSelection) {
|
220 |
// clearSelection();
|
221 |
// }
|
222 |
if (multipleSelection && getSelectionImage()!=null && getHandlersImage()!=null) { |
223 |
selectionImage=(BufferedImage)getSelectionImage();
|
224 |
handlersImage = (BufferedImage)getHandlersImage();
|
225 |
}else{
|
226 |
selectionImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
227 |
handlersImage = new BufferedImage(vp.getImageWidth(), vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB); |
228 |
} |
229 |
Graphics2D gs = selectionImage.createGraphics();
|
230 |
Graphics2D gh = handlersImage.createGraphics();
|
231 |
FeatureSelection featureSelection = null;
|
232 |
if (multipleSelection){
|
233 |
featureSelection=(FeatureSelection)featureStore.getSelection(); |
234 |
featureSelection.select(set); |
235 |
}else{
|
236 |
featureSelection=featureStore.createFeatureSelection(); |
237 |
featureSelection.select(set); |
238 |
featureStore.setSelection(featureSelection); |
239 |
} |
240 |
|
241 |
DisposableIterator iterator = null;
|
242 |
|
243 |
try {
|
244 |
iterator = set.iterator(); |
245 |
DrawOperationContext doc = new DrawOperationContext();
|
246 |
doc.setGraphics(gs); |
247 |
doc.setViewPort(vp); |
248 |
doc.setSymbol(mapControlManager.getSelectionSymbol()); |
249 |
while (iterator.hasNext()) {
|
250 |
Feature feature = (Feature) iterator.next(); |
251 |
org.gvsig.fmap.geom.Geometry geom = feature |
252 |
.getDefaultGeometry(); |
253 |
if (geom == null) { |
254 |
continue;
|
255 |
} |
256 |
geom.cloneGeometry().invokeOperation(Draw.CODE, doc); |
257 |
drawHandlers(geom.cloneGeometry(), gh, vp); |
258 |
} |
259 |
} finally {
|
260 |
if (iterator != null) { |
261 |
iterator.dispose(); |
262 |
} |
263 |
} |
264 |
|
265 |
set.dispose(); |
266 |
setSelectionImage(selectionImage); |
267 |
setHandlersImage(handlersImage); |
268 |
} |
269 |
public void selectCrossPolygon(org.gvsig.fmap.geom.Geometry polygon) { |
270 |
try {
|
271 |
FeatureStore featureStore = getFeatureStore(); |
272 |
ViewPort vp = getLayer().getMapContext().getViewPort(); |
273 |
FeatureQuery fq = featureStore.createFeatureQuery(); |
274 |
fq.setAttributeNames(new String[]{featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName()}); |
275 |
Evaluator evaluator=new CrossesGeometryEvaluator(polygon, vp.getProjection(), featureStore.getDefaultFeatureType(), featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName());
|
276 |
fq.setFilter(evaluator); |
277 |
FeatureSet set = featureStore.getFeatureSet(fq); |
278 |
selectAndDrawGeometries(featureStore,set,vp,false);
|
279 |
} catch (ReadException e) {
|
280 |
NotificationManager.addError(e.getMessage(), e); |
281 |
} catch (DataException e) {
|
282 |
NotificationManager.addError(e.getMessage(), e); |
283 |
} catch (GeometryOperationNotSupportedException e) {
|
284 |
NotificationManager.addError(e.getMessage(), e); |
285 |
} catch (GeometryOperationException e) {
|
286 |
NotificationManager.addError(e.getMessage(), e); |
287 |
} |
288 |
} |
289 |
|
290 |
public void selectOutPolygon(org.gvsig.fmap.geom.Geometry polygon) { |
291 |
try {
|
292 |
FeatureStore featureStore = getFeatureStore(); |
293 |
ViewPort vp = getLayer().getMapContext().getViewPort(); |
294 |
FeatureQuery fq = featureStore.createFeatureQuery(); |
295 |
fq.setAttributeNames(new String[]{featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName()}); |
296 |
Evaluator evaluator=new OutGeometryEvaluator(polygon, vp.getProjection(), featureStore.getDefaultFeatureType(), featureStore.getDefaultFeatureType().getDefaultGeometryAttributeName());
|
297 |
fq.setFilter(evaluator); |
298 |
FeatureSet set = featureStore.getFeatureSet(fq); |
299 |
selectAndDrawGeometries(featureStore, set, vp, false);
|
300 |
|
301 |
} catch (ReadException e) {
|
302 |
NotificationManager.addError(e.getMessage(), e); |
303 |
} catch (DataException e) {
|
304 |
NotificationManager.addError(e.getMessage(), e); |
305 |
} catch (GeometryOperationNotSupportedException e) {
|
306 |
NotificationManager.addError(e.getMessage(), e); |
307 |
} catch (GeometryOperationException e) {
|
308 |
NotificationManager.addError(e.getMessage(), e); |
309 |
} |
310 |
} |
311 |
|
312 |
public void selectAll() { |
313 |
try {
|
314 |
FeatureStore featureStore = getFeatureStore(); |
315 |
ViewPort vp = getLayer().getMapContext().getViewPort(); |
316 |
FeatureSet set = featureStore.getFeatureSet(); |
317 |
selectAndDrawGeometries(featureStore, set, vp, false);
|
318 |
} catch (ReadException e) {
|
319 |
NotificationManager.addError(e.getMessage(), e); |
320 |
} catch (DataException e) {
|
321 |
NotificationManager.addError(e.getMessage(), e); |
322 |
} catch (GeometryOperationNotSupportedException e) {
|
323 |
NotificationManager.addError(e.getMessage(), e); |
324 |
} catch (GeometryOperationException e) {
|
325 |
NotificationManager.addError(e.getMessage(), e); |
326 |
} |
327 |
} |
328 |
|
329 |
public void drawHandlers(org.gvsig.fmap.geom.Geometry geom, Graphics2D gs, |
330 |
ViewPort vp) { |
331 |
Handler[] handlers = geom |
332 |
.getHandlers(org.gvsig.fmap.geom.Geometry.SELECTHANDLER); |
333 |
mapControl.getMapControlDrawer().drawHandlers(handlers, vp.getAffineTransform(), |
334 |
mapControlManager.getHandlerSymbol()); |
335 |
} |
336 |
|
337 |
public Image getSelectionImage() { |
338 |
return imageSelection;
|
339 |
} |
340 |
|
341 |
public void setSelectionImage(Image image) { |
342 |
imageSelection = image; |
343 |
} |
344 |
|
345 |
public Image getHandlersImage() { |
346 |
return imageHandlers;
|
347 |
} |
348 |
|
349 |
public void setHandlersImage(Image image) { |
350 |
imageHandlers = image; |
351 |
} |
352 |
|
353 |
public void beforeLayerDraw(LayerDrawEvent e) throws CancelationException { |
354 |
FeatureStore featureStore = null;
|
355 |
try {
|
356 |
featureStore = getFeatureStore(); |
357 |
} catch (ReadException e2) {
|
358 |
e2.printStackTrace(); |
359 |
} |
360 |
if (featureStore.isEditing()) {
|
361 |
ViewPort vp = getLayer().getMapContext().getViewPort(); |
362 |
BufferedImage selectionImage = new BufferedImage( |
363 |
vp.getImageWidth(), vp.getImageHeight(), |
364 |
BufferedImage.TYPE_INT_ARGB);
|
365 |
BufferedImage handlersImage = new BufferedImage(vp.getImageWidth(), |
366 |
vp.getImageHeight(), BufferedImage.TYPE_INT_ARGB);
|
367 |
Graphics2D gs = selectionImage.createGraphics();
|
368 |
Graphics2D gh = handlersImage.createGraphics();
|
369 |
DisposableIterator iterator = null;
|
370 |
try {
|
371 |
iterator = featureStore.getFeatureSelection() |
372 |
.iterator(); |
373 |
try {
|
374 |
while (iterator.hasNext()) {
|
375 |
Feature feature = (Feature) iterator.next(); |
376 |
org.gvsig.fmap.geom.Geometry geom = feature |
377 |
.getDefaultGeometry(); |
378 |
|
379 |
DrawOperationContext doc = new DrawOperationContext();
|
380 |
doc.setGraphics(gs); |
381 |
doc.setViewPort(vp); |
382 |
doc.setSymbol(mapControlManager.getSelectionSymbol()); |
383 |
try {
|
384 |
geom.cloneGeometry() |
385 |
.invokeOperation(Draw.CODE, doc); |
386 |
} catch (GeometryOperationNotSupportedException e1) {
|
387 |
e1.printStackTrace(); |
388 |
} catch (GeometryOperationException e1) {
|
389 |
e1.printStackTrace(); |
390 |
} |
391 |
drawHandlers(geom.cloneGeometry(), gh, vp); |
392 |
} |
393 |
} catch (ConcurrentModificationException e1) { |
394 |
// throw new CancelationException(e1);
|
395 |
// A mitad de pintado se cambia la selecci�n y por tanto no
|
396 |
// se puede seguir recorriendo la anterior.
|
397 |
return;
|
398 |
} |
399 |
} catch (DataException e2) {
|
400 |
e2.printStackTrace(); |
401 |
} finally {
|
402 |
if (iterator != null) { |
403 |
iterator.dispose(); |
404 |
} |
405 |
} |
406 |
|
407 |
setSelectionImage(selectionImage); |
408 |
setHandlersImage(handlersImage); |
409 |
} |
410 |
} |
411 |
|
412 |
public void afterLayerDraw(LayerDrawEvent e) throws CancelationException { |
413 |
} |
414 |
|
415 |
public void beforeGraphicLayerDraw(LayerDrawEvent e) |
416 |
throws CancelationException {
|
417 |
} |
418 |
|
419 |
public void afterLayerGraphicDraw(LayerDrawEvent e) |
420 |
throws CancelationException {
|
421 |
} |
422 |
|
423 |
public void activationGained(LayerEvent e) { |
424 |
if (ViewCommandStackExtension.csd != null) { |
425 |
ViewCommandStackExtension.csd.setModel(((FLyrVect) getLayer()) |
426 |
.getFeatureStore()); |
427 |
|
428 |
} |
429 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
430 |
if (window instanceof View) { |
431 |
View view = (View) window; |
432 |
if (e.getSource().isEditing()) {
|
433 |
view.showConsole(); |
434 |
} |
435 |
} |
436 |
if (cadtool != null) { |
437 |
CADExtension.getCADToolAdapter().setCadTool(cadtool); |
438 |
PluginServices.getMainFrame().setSelectedTool(cadtool.toString()); |
439 |
StartEditing.startCommandsApplicable(null, (FLyrVect) getLayer());
|
440 |
CADExtension.initFocus(); |
441 |
} |
442 |
|
443 |
} |
444 |
|
445 |
public void activationLost(LayerEvent e) { |
446 |
try {
|
447 |
cadtool = CADExtension.getCADTool(); |
448 |
IWindow window = PluginServices.getMDIManager().getActiveWindow(); |
449 |
if (window instanceof View) { |
450 |
View view = (View) window; |
451 |
view.hideConsole(); |
452 |
} |
453 |
} catch (EmptyStackException e1) { |
454 |
cadtool = new SelectionCADTool();
|
455 |
cadtool.init(); |
456 |
} |
457 |
|
458 |
} |
459 |
|
460 |
public void setLegend(ILegend legend) { |
461 |
this.legend = legend;
|
462 |
} |
463 |
|
464 |
public ILegend getLegend() {
|
465 |
return legend;
|
466 |
} |
467 |
|
468 |
public FeatureStore getFeatureStore() throws ReadException { |
469 |
return ((FLyrVect) getLayer()).getFeatureStore();
|
470 |
} |
471 |
|
472 |
public void update(Observable observable, Object notification) { |
473 |
echm.update(observable, notification); |
474 |
} |
475 |
|
476 |
public EditionChangeManager getEditionChangeManager() {
|
477 |
return echm;
|
478 |
} |
479 |
|
480 |
public void setEditionChangeManager(EditionChangeManager echm) { |
481 |
this.echm = echm;
|
482 |
} |
483 |
} |