Revision 44601 trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ViewSelectionControls.java
ViewSelectionControls.java | ||
---|---|---|
22 | 22 |
*/ |
23 | 23 |
package org.gvsig.app.extension; |
24 | 24 |
|
25 |
import java.util.List; |
|
25 | 26 |
import org.gvsig.andami.IconThemeHelper; |
26 | 27 |
import org.gvsig.andami.plugins.Extension; |
27 | 28 |
import org.gvsig.app.ApplicationLocator; |
28 | 29 |
import org.gvsig.app.ApplicationManager; |
29 | 30 |
import org.gvsig.app.project.documents.view.ViewDocument; |
30 | 31 |
import org.gvsig.app.project.documents.view.gui.IView; |
31 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
32 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
33 | 32 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
34 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
|
|
33 |
import org.gvsig.fmap.mapcontext.layers.FLayers;
|
|
35 | 34 |
import org.gvsig.fmap.mapcontrol.MapControl; |
36 | 35 |
import org.slf4j.Logger; |
37 | 36 |
import org.slf4j.LoggerFactory; |
... | ... | |
46 | 45 |
private static final Logger logger = LoggerFactory |
47 | 46 |
.getLogger(ViewSelectionControls.class); |
48 | 47 |
|
48 |
@Override |
|
49 | 49 |
public void initialize() { |
50 | 50 |
registerIcons(); |
51 | 51 |
} |
... | ... | |
90 | 90 |
if( document == null ) { |
91 | 91 |
return false; |
92 | 92 |
} |
93 |
boolean hasActiveVectorLayers = false; |
|
94 |
for (FLayer layer : document.getMapContext().getLayers()) { |
|
95 |
if( layer.isActive() && layer.isAvailable() && layer instanceof FLyrVect ) { |
|
96 |
try { |
|
97 |
hasActiveVectorLayers = true; |
|
98 |
FeatureStore store = ((FLyrVect)layer).getFeatureStore(); |
|
99 |
if( !store.getFeatureSelection().isAvailable() ) { |
|
100 |
return false; |
|
101 |
} |
|
102 |
} catch (Exception ex) { |
|
103 |
} |
|
104 |
} |
|
93 |
List<FLayer> layers = document.getMapContext().getLayers().getLayers( |
|
94 |
FLayers.LAYER_ACTIVE |
|
95 |
.and(FLayers.LAYER_AVALAIBLE) |
|
96 |
.and(FLayers.LAYER_SELECTION_AVAILABLE) |
|
97 |
); |
|
98 |
if (layers.size()>=1) { |
|
99 |
return true; |
|
105 | 100 |
} |
106 |
return hasActiveVectorLayers ;
|
|
101 |
return false;
|
|
107 | 102 |
} |
108 | 103 |
|
109 | 104 |
@Override |
Also available in: Unified diff