Revision 44601
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/toc/gui/FPopupMenu.java | ||
---|---|---|
124 | 124 |
this.extensionPoint = |
125 | 125 |
ToolsLocator.getExtensionPointManager().get("View_TocActions"); |
126 | 126 |
this.selecteds = this.mapContext.getLayers().getActives(); |
127 |
|
|
127 |
|
|
128 | 128 |
List<IContextMenuAction> actions = this.getActionList(); |
129 | 129 |
if (actions == null) { |
130 | 130 |
return; |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ViewInvertSelection.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.messages.NotificationManager; |
27 | 28 |
import org.gvsig.andami.plugins.Extension; |
... | ... | |
33 | 34 |
import org.gvsig.fmap.dal.DataStore; |
34 | 35 |
import org.gvsig.fmap.dal.exception.DataException; |
35 | 36 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
36 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
37 | 37 |
import org.gvsig.fmap.mapcontext.MapContext; |
38 | 38 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
39 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
39 | 40 |
import org.gvsig.fmap.mapcontext.layers.operations.SingleLayer; |
40 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
41 | 41 |
import org.slf4j.Logger; |
42 | 42 |
import org.slf4j.LoggerFactory; |
43 | 43 |
|
... | ... | |
48 | 48 |
*/ |
49 | 49 |
public class ViewInvertSelection extends Extension { |
50 | 50 |
|
51 |
private static final Logger logger = LoggerFactory
|
|
51 |
private static final Logger LOGGER = LoggerFactory
|
|
52 | 52 |
.getLogger(ViewInvertSelection.class); |
53 | 53 |
private DefaultViewPanel vista; |
54 | 54 |
|
55 |
@Override |
|
55 | 56 |
public void initialize() { |
56 | 57 |
IconThemeHelper.registerIcon("action", "selection-reverse", this); |
57 | 58 |
} |
58 | 59 |
|
60 |
@Override |
|
59 | 61 |
public void postInitialize() { |
60 | 62 |
} |
61 | 63 |
|
64 |
@Override |
|
62 | 65 |
public void execute(String actionCommand) { |
63 | 66 |
ApplicationManager application = ApplicationLocator.getManager(); |
64 | 67 |
|
... | ... | |
101 | 104 |
if( document == null ) { |
102 | 105 |
return false; |
103 | 106 |
} |
104 |
boolean hasActiveVectorLayers = false; |
|
105 |
for (FLayer layer : document.getMapContext().getLayers()) { |
|
106 |
if( layer.isActive() && layer.isAvailable() && layer instanceof FLyrVect ) { |
|
107 |
try { |
|
108 |
hasActiveVectorLayers = true; |
|
109 |
FeatureStore store = ((FLyrVect)layer).getFeatureStore(); |
|
110 |
if( !store.getFeatureSelection().isAvailable() ) { |
|
111 |
return false; |
|
112 |
} |
|
113 |
} catch (Exception ex) { |
|
114 |
} |
|
115 |
} |
|
107 |
List<FLayer> layers = document.getMapContext().getLayers().getLayers( |
|
108 |
FLayers.LAYER_ACTIVE |
|
109 |
.and(FLayers.LAYER_AVALAIBLE) |
|
110 |
.and(FLayers.LAYER_SELECTION_AVAILABLE) |
|
111 |
); |
|
112 |
if (layers.size()>=1) { |
|
113 |
return true; |
|
116 | 114 |
} |
117 |
return hasActiveVectorLayers;
|
|
115 |
return false;
|
|
118 | 116 |
} |
119 | 117 |
|
118 |
@Override |
|
120 | 119 |
public boolean isVisible() { |
121 | 120 |
ApplicationManager application = ApplicationLocator.getManager(); |
122 | 121 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/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 |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/SelectByAttributesExtension.java | ||
---|---|---|
23 | 23 |
package org.gvsig.app.extension; |
24 | 24 |
|
25 | 25 |
import java.util.Iterator; |
26 |
import java.util.List; |
|
26 | 27 |
|
27 | 28 |
import javax.swing.JOptionPane; |
28 | 29 |
|
... | ... | |
44 | 45 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
45 | 46 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
46 | 47 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
47 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
48 | 48 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
49 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
49 | 50 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
50 | 51 |
import org.gvsig.i18n.Messages; |
51 | 52 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
... | ... | |
78 | 79 |
if ("selection-by-attributes-layer".equals(actionCommand)) { |
79 | 80 |
ViewDocument document = view.getViewDocument(); |
80 | 81 |
|
81 |
FLayer layer = document.getMapContext().getLayers().getActives()[0];
|
|
82 |
FLayer layer = document.getMapContext().getLayers().getFirstActiveVectorLayer();
|
|
82 | 83 |
filterTitle = layer.getName(); |
83 | 84 |
featureStore = ((FLyrVect) layer).getFeatureStore(); |
84 | 85 |
document.setModified(true); |
... | ... | |
124 | 125 |
return false; |
125 | 126 |
} |
126 | 127 |
ViewDocument document = view.getViewDocument(); |
127 |
if( document == null ) {
|
|
128 |
if (document == null) {
|
|
128 | 129 |
return false; |
129 | 130 |
} |
130 |
boolean hasActiveVectorLayers = false; |
|
131 |
for (FLayer layer : document.getMapContext().getLayers()) { |
|
132 |
if( layer.isActive() && layer.isAvailable() && layer instanceof FLyrVect ) { |
|
133 |
try { |
|
134 |
hasActiveVectorLayers = true; |
|
135 |
FeatureStore store = ((FLyrVect)layer).getFeatureStore(); |
|
136 |
if( !store.getFeatureSelection().isAvailable() ) { |
|
137 |
return false; |
|
138 |
} |
|
139 |
} catch (Exception ex) { |
|
140 |
} |
|
141 |
} |
|
131 |
|
|
132 |
FLayers layers = document.getMapContext().getLayers(); |
|
133 |
List<FLayer> activeLayers = layers.getLayers( |
|
134 |
FLayers.LAYER_ACTIVE |
|
135 |
.and(FLayers.LAYER_AVALAIBLE) |
|
136 |
.and(FLayers.LAYER_FLYRVECT) |
|
137 |
); |
|
138 |
if (activeLayers.size() != 1) { |
|
139 |
return false; |
|
142 | 140 |
} |
143 |
return hasActiveVectorLayers; |
|
141 |
List<FLayer> selectivedLayers = document.getMapContext().getLayers().getLayers( |
|
142 |
FLayers.LAYER_ACTIVE |
|
143 |
.and(FLayers.LAYER_AVALAIBLE) |
|
144 |
.and(FLayers.LAYER_SELECTION_AVAILABLE) |
|
145 |
); |
|
146 |
if (selectivedLayers.size()==1) { |
|
147 |
return true; |
|
148 |
} |
|
149 |
|
|
150 |
return false; |
|
144 | 151 |
} |
145 | 152 |
|
146 | 153 |
@Override |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ViewSelectionByTheme.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; |
... | ... | |
34 | 35 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
35 | 36 |
import org.gvsig.fmap.dal.feature.FeatureType; |
36 | 37 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
38 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
37 | 39 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
38 | 40 |
import org.gvsig.tools.ToolsLocator; |
39 | 41 |
import org.gvsig.tools.i18n.I18nManager; |
... | ... | |
96 | 98 |
if( document == null ) { |
97 | 99 |
return false; |
98 | 100 |
} |
99 |
boolean hasActiveVectorLayers = false; |
|
100 |
for (FLayer layer : document.getMapContext().getLayers()) { |
|
101 |
if( layer.isActive() && layer.isAvailable() && layer instanceof FLyrVect ) { |
|
102 |
try { |
|
103 |
hasActiveVectorLayers = true; |
|
104 |
FeatureStore store = ((FLyrVect)layer).getFeatureStore(); |
|
105 |
if( !store.getFeatureSelection().isAvailable() ) { |
|
106 |
return false; |
|
107 |
} |
|
108 |
} catch (Exception ex) { |
|
109 |
} |
|
110 |
} |
|
101 |
List<FLayer> layers = document.getMapContext().getLayers().getLayers( |
|
102 |
FLayers.LAYER_ACTIVE |
|
103 |
.and(FLayers.LAYER_AVALAIBLE) |
|
104 |
.and(FLayers.LAYER_SELECTION_AVAILABLE) |
|
105 |
); |
|
106 |
if (layers.size()>=1) { |
|
107 |
return true; |
|
111 | 108 |
} |
112 |
return hasActiveVectorLayers;
|
|
109 |
return false;
|
|
113 | 110 |
} |
114 | 111 |
|
115 | 112 |
public boolean isVisible() { |
Also available in: Unified diff