Revision: 5169
http://sourceforge.net/p/jump-pilot/code/5169
Author: michaudm
Date: 2016-11-06 17:26:22 +0000 (Sun, 06 Nov 2016)
Log Message:
-----------
Add a selection mode to select features with a Multi-Geometry type
Update of selection tools (generics...)
Modified Paths:
--------------
core/trunk/ChangeLog
core/trunk/scripts/default-plugins.xml
core/trunk/src/language/jump.properties
core/trunk/src/language/jump_cz.properties
core/trunk/src/language/jump_de.properties
core/trunk/src/language/jump_es.properties
core/trunk/src/language/jump_fi.properties
core/trunk/src/language/jump_fr.properties
core/trunk/src/language/jump_hu.properties
core/trunk/src/language/jump_it.properties
core/trunk/src/language/jump_ja_JP.properties
core/trunk/src/language/jump_ml.properties
core/trunk/src/language/jump_pt.properties
core/trunk/src/language/jump_pt_BR.properties
core/trunk/src/language/jump_ta_IN.properties
core/trunk/src/language/jump_te.properties
core/trunk/src/language/jump_zh_CN.properties
core/trunk/src/language/jump_zh_HK.properties
core/trunk/src/org/openjump/core/ui/plugin/edit/ClipToFencePlugIn.java
core/trunk/src/org/openjump/core/ui/plugin/edit/CopyBBoxPlugin.java
core/trunk/src/org/openjump/core/ui/plugin/edit/InvertSelectionPlugIn.java
core/trunk/src/org/openjump/core/ui/plugin/edit/ReplicateSelectedItemsPlugIn.java
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectAllLayerItemsPlugIn.java
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectAllModifiedFeaturesPlugIn.java
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectByTypePlugIn.java
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectItemsByCircleFromSelectedLayersPlugIn.java
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectItemsByFenceFromSelectedLayersPlugIn.java
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectLayersWithSelectedItemsPlugIn.java
Added Paths:
-----------
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectGeometryCollectionsPlugIn.java
Modified: core/trunk/ChangeLog
===================================================================
--- core/trunk/ChangeLog 2016-11-06 17:18:05 UTC (rev 5168)
+++ core/trunk/ChangeLog 2016-11-06 17:26:22 UTC (rev 5169)
@@ -6,6 +6,7 @@
2016-11-06 mmichaud <[email protected]>
* Fix bug #439 MakeValid now uses SymDifference instead of difference to
repair overlapping holes (which corresponds what is displayed on screen)
+ * Add a selection mode to select features with a Multi-Geometry type
2016-11-05 mmichaud <[email protected]>
* Writable PostGIS driver apply a ST_Multi transformation to geometries
Modified: core/trunk/scripts/default-plugins.xml
===================================================================
--- core/trunk/scripts/default-plugins.xml 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/scripts/default-plugins.xml 2016-11-06 17:26:22 UTC (rev
5169)
@@ -257,6 +257,9 @@
org.openjump.core.ui.plugin.edit.SelectByTypePlugIn
</plug-in>
<plug-in>
+ org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn
+ </plug-in>
+ <plug-in>
org.openjump.core.ui.plugin.edit.SelectLayersWithSelectedItemsPlugIn
</plug-in>
<plug-in>
Modified: core/trunk/src/language/jump.properties
===================================================================
--- core/trunk/src/language/jump.properties 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/src/language/jump.properties 2016-11-06 17:26:22 UTC (rev
5169)
@@ -637,6 +637,7 @@
org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.Select-by-Geometry-Type =
Select by Geometry Type
org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.Select-only-these-types =
Select only these types\:
org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.Exclude-empty-geometries =
Exclude empty geometries
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn = Select
Features with a Multiple-Geometry Type
org.openjump.core.ui.plugin.edit.SelectItemsByCirlceFromSelectedLayersPlugIn.cirlce-diameter
= circle diameter
org.openjump.core.ui.plugin.edit.SelectItemsByCirlceFromSelectedLayersPlugIn.select-features-by-cirlce-from-selected-layers
= Select Features by Circle from Selected Layers
org.openjump.core.ui.plugin.edit.SelectItemsByCirlceFromSelectedLayersPlugIn.select-features-within-a-circle-from-currently-selected-layers
= Select features within a circle from currently selected layers.
Modified: core/trunk/src/language/jump_cz.properties
===================================================================
--- core/trunk/src/language/jump_cz.properties 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/src/language/jump_cz.properties 2016-11-06 17:26:22 UTC (rev
5169)
@@ -2743,4 +2743,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_de.properties
===================================================================
--- core/trunk/src/language/jump_de.properties 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/src/language/jump_de.properties 2016-11-06 17:26:22 UTC (rev
5169)
@@ -2739,4 +2739,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_es.properties
===================================================================
--- core/trunk/src/language/jump_es.properties 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/src/language/jump_es.properties 2016-11-06 17:26:22 UTC (rev
5169)
@@ -2722,4 +2722,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_fi.properties
===================================================================
--- core/trunk/src/language/jump_fi.properties 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/src/language/jump_fi.properties 2016-11-06 17:26:22 UTC (rev
5169)
@@ -2716,4 +2716,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_fr.properties
===================================================================
--- core/trunk/src/language/jump_fr.properties 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/src/language/jump_fr.properties 2016-11-06 17:26:22 UTC (rev
5169)
@@ -2746,4 +2746,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=Voulez-vous
remplacer les valeurs existantes ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=Bas\xE9
sur des mots
ui.plugin.analysis.GeometryFunction.UnwrapSingle=Utiliser un type
g\xE9om\xE9trique simple si possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=Toujours utiliser une
multi-g\xE9om\xE9trie
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=Toujours utiliser une
multi-g\xE9om\xE9trie
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=S\xE9lectionner
les objets ayant un type multi-g\xE9om\xE9trie
\ No newline at end of file
Modified: core/trunk/src/language/jump_hu.properties
===================================================================
--- core/trunk/src/language/jump_hu.properties 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/src/language/jump_hu.properties 2016-11-06 17:26:22 UTC (rev
5169)
@@ -2739,4 +2739,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_it.properties
===================================================================
--- core/trunk/src/language/jump_it.properties 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/src/language/jump_it.properties 2016-11-06 17:26:22 UTC (rev
5169)
@@ -2723,3 +2723,4 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
Modified: core/trunk/src/language/jump_ja_JP.properties
===================================================================
--- core/trunk/src/language/jump_ja_JP.properties 2016-11-06 17:18:05 UTC
(rev 5168)
+++ core/trunk/src/language/jump_ja_JP.properties 2016-11-06 17:26:22 UTC
(rev 5169)
@@ -2741,4 +2741,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_ml.properties
===================================================================
--- core/trunk/src/language/jump_ml.properties 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/src/language/jump_ml.properties 2016-11-06 17:26:22 UTC (rev
5169)
@@ -4012,4 +4012,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_pt.properties
===================================================================
--- core/trunk/src/language/jump_pt.properties 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/src/language/jump_pt.properties 2016-11-06 17:26:22 UTC (rev
5169)
@@ -2737,4 +2737,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_pt_BR.properties
===================================================================
--- core/trunk/src/language/jump_pt_BR.properties 2016-11-06 17:18:05 UTC
(rev 5168)
+++ core/trunk/src/language/jump_pt_BR.properties 2016-11-06 17:26:22 UTC
(rev 5169)
@@ -2738,4 +2738,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_ta_IN.properties
===================================================================
--- core/trunk/src/language/jump_ta_IN.properties 2016-11-06 17:18:05 UTC
(rev 5168)
+++ core/trunk/src/language/jump_ta_IN.properties 2016-11-06 17:26:22 UTC
(rev 5169)
@@ -2740,4 +2740,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_te.properties
===================================================================
--- core/trunk/src/language/jump_te.properties 2016-11-06 17:18:05 UTC (rev
5168)
+++ core/trunk/src/language/jump_te.properties 2016-11-06 17:26:22 UTC (rev
5169)
@@ -3246,4 +3246,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_zh_CN.properties
===================================================================
--- core/trunk/src/language/jump_zh_CN.properties 2016-11-06 17:18:05 UTC
(rev 5168)
+++ core/trunk/src/language/jump_zh_CN.properties 2016-11-06 17:26:22 UTC
(rev 5169)
@@ -2901,4 +2901,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=#T:Word
based
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/language/jump_zh_HK.properties
===================================================================
--- core/trunk/src/language/jump_zh_HK.properties 2016-11-06 17:18:05 UTC
(rev 5168)
+++ core/trunk/src/language/jump_zh_HK.properties 2016-11-06 17:26:22 UTC
(rev 5169)
@@ -2902,4 +2902,5 @@
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.overwrite-prompt=#T:Do
you want to overwrite existing values ?
org.openjump.core.ui.plugin.tools.GenerateRandomStringPlugIn.word-based=
ui.plugin.analysis.GeometryFunction.UnwrapSingle=#T:Use simple geometry type
when possible
-ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
\ No newline at end of file
+ui.plugin.analysis.GeometryFunction.WrapIntoMulti=#T:Wrap Into MultiGeometry
+org.openjump.core.ui.plugin.edit.SelectGeometryCollectionsPlugIn=#T:Select
Features with a Multiple-Geometry Type
\ No newline at end of file
Modified: core/trunk/src/org/openjump/core/ui/plugin/edit/ClipToFencePlugIn.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/edit/ClipToFencePlugIn.java
2016-11-06 17:18:05 UTC (rev 5168)
+++ core/trunk/src/org/openjump/core/ui/plugin/edit/ClipToFencePlugIn.java
2016-11-06 17:26:22 UTC (rev 5169)
@@ -2,19 +2,14 @@
import java.util.ArrayList;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.swing.JComponent;
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jump.I18N;
-import com.vividsolutions.jump.feature.Feature;
import com.vividsolutions.jump.feature.FeatureCollection;
import com.vividsolutions.jump.feature.FeatureSchema;
-import com.vividsolutions.jump.feature.IndexedFeatureCollection;
import com.vividsolutions.jump.task.TaskMonitor;
import com.vividsolutions.jump.tools.AttributeMapping;
import com.vividsolutions.jump.tools.OverlayEngine;
@@ -36,7 +31,6 @@
public class ClipToFencePlugIn extends AbstractPlugIn implements
ThreadedPlugIn {
private static String FENCELAYERMUSTBEPRESENT = "Fence layer must be
present";
- //private static String CLIPMAPTOFENCE = "Clip Map to Fence";
private static String DIALOGMSG = "All vector layers will be clipped to
the Fence."+
" Warning: if your task loaded with layers not visible,
they have not be loaded" +
" and therefore will not be clipped.";
@@ -54,13 +48,12 @@
public void initialize( PlugInContext context ) throws Exception
{
workbenchContext = context.getWorkbenchContext();
- context.getFeatureInstaller().addMainMenuItem(this,
- new String[] {MenuNames.EDIT}, getName()+ "...",
- false, null,
- new MultiEnableCheck()
- .add(new
EnableCheckFactory(context.getWorkbenchContext())
- .createTaskWindowMustBeActiveCheck())
- .add(fenceLayerMustBePresent()));
+ context.getFeatureInstaller().addMainMenuPlugin(this,
+ new String[] {MenuNames.EDIT}, getName()+ "...",
+ false, null,
+ new MultiEnableCheck()
+ .add(new
EnableCheckFactory(context.getWorkbenchContext()).createTaskWindowMustBeActiveCheck())
+
.add(fenceLayerMustBePresent()));
DIALOGWARNING=I18N.get("org.openjump.core.ui.plugin.edit.ClipToFencePlugIn.This-operation-is-not-undoable");
VISIBLEONLY =
I18N.get("org.openjump.core.ui.plugin.edit.ClipToFencePlugIn.Visible-Only-(-see-Warning-)");
@@ -68,10 +61,9 @@
FENCELAYERMUSTBEPRESENT =
I18N.get("org.openjump.core.ui.plugin.edit.ClipToFencePlugIn.Fence-layer-must-be-present");
}
- public boolean execute(PlugInContext context) throws Exception {
+ public boolean execute(PlugInContext context) throws Exception {
MultiInputDialog dialog = new
MultiInputDialog(context.getWorkbenchFrame(),
getName(), true);
- //dialog.setInset(0);
dialog.setSideBarDescription(DIALOGMSG);
dialog.addLabel(DIALOGWARNING);
dialog.addCheckBox(VISIBLEONLY, visibleOnly);
@@ -88,21 +80,18 @@
LayerManager layerManager = context.getLayerManager();
Layer fence =
layerManager.getLayer(FenceLayerFinder.LAYER_NAME);
- ArrayList layerList;
+ ArrayList<Layer> layerList;
if (visibleOnly) {
- layerList = new
ArrayList(layerManager.getVisibleLayers(false));
+ layerList = new
ArrayList<>(layerManager.getVisibleLayers(false));
} else {
- layerList = new ArrayList(layerManager.getLayers());
+ layerList = new ArrayList<>(layerManager.getLayers());
}
OverlayEngine overlayEngine = new OverlayEngine();
overlayEngine.setAllowingPolygonsOnly(POLYGON_OUTPUT);
overlayEngine.setSplittingGeometryCollections(POLYGON_OUTPUT);
FeatureCollection a = fence.getFeatureCollectionWrapper();
- //boolean firingEvents = layerManager.isFiringEvents();
- //layerManager.setFiringEvents(false);
- List<Layer> unprocessedLayers = new ArrayList<Layer>();
- for (Iterator j = layerList.iterator(); j.hasNext();) {
- Layer layer = (Layer) j.next();
+ List<Layer> unprocessedLayers = new ArrayList<>();
+ for (Layer layer : layerList) {
if (layer == fence) continue;
FeatureCollection b = layer.getFeatureCollectionWrapper();
if (hasDuplicateAttributeNames(b.getFeatureSchema())) {
@@ -124,44 +113,21 @@
outputFrame.append(layer.getName());
}
}
- //layerManager.setFiringEvents(firingEvents);
- }
-
-// public void run(TaskMonitor monitor, PlugInContext context) throws
Exception {
-//
-// LayerManager layerManager = context.getLayerManager();
-// Layer fence =
layerManager.getLayer(FenceLayerFinder.LAYER_NAME);
-// ArrayList layerList;
-// if (visibleOnly) {
-// layerList = new
ArrayList(layerManager.getVisibleLayers(false));
-// } else {
-// layerList = new
ArrayList(layerManager.getLayers());
-// }
-// Polygon a = (Polygon) ((Feature)
fence.getFeatureCollectionWrapper()
-// .iterator().next()).getGeometry();
-// for (Iterator j = layerList.iterator(); j.hasNext();) {
-// Layer layer = (Layer) j.next();
-// if (layer == fence) continue;
-// FeatureCollection b =
layer.getFeatureCollectionWrapper();
-// IndexedFeatureCollection ifc = new
IndexedFeatureCollection(b);
-// FeatureCollection overlay = GeoUtils.clipToPolygon(a,
ifc, true);
-// layer.setFeatureCollection(overlay);
-// }
-// }
-//
+ }
+
private AttributeMapping mapping(FeatureCollection a, FeatureCollection b)
{
return new AttributeMapping( new FeatureSchema(),
b.getFeatureSchema());
}
private boolean hasDuplicateAttributeNames(FeatureSchema schema) {
- Set set = new HashSet();
+ Set<String> set = new HashSet<>();
for (int i = 0; i < schema.getAttributeCount(); i++) {
if (!set.add(schema.getAttributeName(i))) return true ;
}
return false;
}
- public EnableCheck fenceLayerMustBePresent() {
+ private EnableCheck fenceLayerMustBePresent() {
return new EnableCheck() {
public String check(JComponent component) {
return (workbenchContext.getLayerViewPanel().getFence() ==
null)
Modified: core/trunk/src/org/openjump/core/ui/plugin/edit/CopyBBoxPlugin.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/edit/CopyBBoxPlugin.java
2016-11-06 17:18:05 UTC (rev 5168)
+++ core/trunk/src/org/openjump/core/ui/plugin/edit/CopyBBoxPlugin.java
2016-11-06 17:26:22 UTC (rev 5169)
@@ -43,19 +43,13 @@
import com.vividsolutions.jts.geom.Envelope;
import com.vividsolutions.jump.I18N;
-import com.vividsolutions.jump.workbench.WorkbenchContext;
import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
import com.vividsolutions.jump.workbench.plugin.PlugInContext;
-import com.vividsolutions.jump.workbench.ui.MenuNames;
-import com.vividsolutions.jump.workbench.ui.plugin.FeatureInstaller;
/**
* <code>CopyBBoxPlugin</code>
*
* @author <a href="mailto:[email protected]">Andreas Schmitz</a>
- * @author last edited by: $Author:$
- *
- * @version $Revision:$, $Date:$
*/
public class CopyBBoxPlugin extends AbstractPlugIn {
@@ -66,41 +60,35 @@
@Override
public void initialize( PlugInContext context ) {
-// WorkbenchContext wbcontext = context.getWorkbenchContext();
-// FeatureInstaller installer = new FeatureInstaller( wbcontext );
-//
-// installer.addMainMenuItem( this, new String[] { MenuNames.VIEW },
-// I18N.get(
"org.openjump.core.ui.plugin.edit.CopyBBoxPlugin.name" )+"{pos:2}",
-// false, null, null );
}
@Override
public boolean execute( PlugInContext context ) {
Envelope env =
context.getWorkbenchContext().getLayerViewPanel().getViewport().getEnvelopeInModelCoordinates();
- StringBuffer sb = new StringBuffer( 512 );
- sb.append( "POLYGON((" );
- sb.append( env.getMinX() ).append( " " ).append( env.getMinY() );
- sb.append( "," );
- sb.append( env.getMinX() ).append( " " ).append( env.getMaxY() );
- sb.append( "," );
- sb.append( env.getMaxX() ).append( " " ).append( env.getMaxY() );
- sb.append( "," );
- sb.append( env.getMaxX() ).append( " " ).append( env.getMinY() );
- sb.append( "," );
- sb.append( env.getMinX() ).append( " " ).append( env.getMinY() );
- sb.append( "))" );
+ //StringBuilder sb = new StringBuilder( 512 );
+ //sb.append( "POLYGON((" );
+ //sb.append( env.getMinX() ).append( " " ).append( env.getMinY() );
+ //sb.append( "," );
+ //sb.append( env.getMinX() ).append( " " ).append( env.getMaxY() );
+ //sb.append( "," );
+ //sb.append( env.getMaxX() ).append( " " ).append( env.getMaxY() );
+ //sb.append( "," );
+ //sb.append( env.getMaxX() ).append( " " ).append( env.getMinY() );
+ //sb.append( "," );
+ //sb.append( env.getMinX() ).append( " " ).append( env.getMinY() );
+ //sb.append( "))" );
- StringBuffer sbcleartext = new StringBuffer( 512 );
- sbcleartext.append( "bbox(" );
- sbcleartext.append( env.getMinX() );
- sbcleartext.append( "," );
- sbcleartext.append( env.getMinY() );
- sbcleartext.append( "," );
- sbcleartext.append( env.getMaxX() );
- sbcleartext.append( "," );
- sbcleartext.append( env.getMaxY() );
- sbcleartext.append( ")" );
+ StringBuilder sbcleartext = new StringBuilder( 128 )
+ .append( "bbox(" )
+ .append( env.getMinX() )
+ .append( "," )
+ .append( env.getMinY() )
+ .append( "," )
+ .append( env.getMaxX() )
+ .append( "," )
+ .append( env.getMaxY() )
+ .append( ")" );
Toolkit.getDefaultToolkit().getSystemClipboard().setContents( new
StringSelection( sbcleartext.toString() ), null );
Modified:
core/trunk/src/org/openjump/core/ui/plugin/edit/InvertSelectionPlugIn.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/edit/InvertSelectionPlugIn.java
2016-11-06 17:18:05 UTC (rev 5168)
+++ core/trunk/src/org/openjump/core/ui/plugin/edit/InvertSelectionPlugIn.java
2016-11-06 17:26:22 UTC (rev 5169)
@@ -36,12 +36,10 @@
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import java.util.SortedSet;
import java.util.TreeSet;
import com.vividsolutions.jump.I18N;
-import com.vividsolutions.jump.feature.BasicFeature;
import com.vividsolutions.jump.feature.Feature;
import com.vividsolutions.jump.feature.FeatureCollection;
import com.vividsolutions.jump.workbench.WorkbenchContext;
@@ -51,7 +49,6 @@
import com.vividsolutions.jump.workbench.plugin.MultiEnableCheck;
import com.vividsolutions.jump.workbench.plugin.PlugInContext;
import com.vividsolutions.jump.workbench.ui.LayerViewPanel;
-import com.vividsolutions.jump.workbench.ui.MenuNames;
import com.vividsolutions.jump.workbench.ui.SelectionManager;
/**
@@ -61,51 +58,43 @@
* @author beckerl
*/
public class InvertSelectionPlugIn extends AbstractPlugIn {
- private String name = I18N
-
.get("org.openjump.core.ui.plugin.edit.InvertSelectionPlugIn.invert-selection");
+ private String name = I18N
+
.get("org.openjump.core.ui.plugin.edit.InvertSelectionPlugIn.invert-selection");
+
public InvertSelectionPlugIn() {
- super();
- this.setShortcutKeys(KeyEvent.VK_I);
- this.setShortcutModifiers(KeyEvent.CTRL_MASK);
+ super();
+ this.setShortcutKeys(KeyEvent.VK_I);
+ this.setShortcutModifiers(KeyEvent.CTRL_MASK);
}
public void initialize(PlugInContext context) throws Exception {
-// context.getFeatureInstaller().addMainMenuItem(this,
-// new String[]
-// {MenuNames.EDIT},
-// name+"{pos:6}",
-// false,
-// null,
-// createEnableCheck(context.getWorkbenchContext())); //enable
check
}
public boolean execute(final PlugInContext context) throws Exception {
reportNothingToUndoYet(context);
- Collection oldSelectedFeatures = new ArrayList();
- Collection newSelectedFeatures = new ArrayList();
+ Collection<Feature> oldSelectedFeatures;
+ Collection<Feature> newSelectedFeatures = new ArrayList<>();
LayerViewPanel layerViewPanel =
context.getWorkbenchContext().getLayerViewPanel();
SelectionManager selectionManager =
layerViewPanel.getSelectionManager();
// Layers process
- Collection layers = selectionManager.getLayersWithSelectedItems();
- for (Iterator layersIterator = layers.iterator() ;
layersIterator.hasNext() ;) {
+ Collection<Layer> layers =
selectionManager.getLayersWithSelectedItems();
+ for (Layer layer : layers) {
// Invisible layers are just cleared
- Layer layer = (Layer)layersIterator.next();
newSelectedFeatures.clear();
oldSelectedFeatures =
selectionManager.getFeaturesWithSelectedItems(layer);
selectionManager.getFeatureSelection().unselectItems(layer);
if (layer.isVisible()) {
// Get an ordered set of old selected identifiers
- SortedSet ids = new TreeSet();
- for (Iterator it = oldSelectedFeatures.iterator() ;
it.hasNext() ; ) {
- ids.add(new Integer(((Feature)it.next()).getID()));
+ SortedSet<Integer> ids = new TreeSet<>();
+ for (Feature oldF : oldSelectedFeatures) {
+ ids.add(oldF.getID());
}
FeatureCollection featureCollection =
layer.getFeatureCollectionWrapper();
- for (Iterator i = featureCollection.iterator(); i.hasNext();) {
- Feature feature = (Feature) i.next();
- if (!ids.contains(new Integer(feature.getID()))) {
+ for (Feature feature : featureCollection.getFeatures()) {
+ if (!ids.contains(feature.getID())) {
newSelectedFeatures.add(feature);
}
}
Modified:
core/trunk/src/org/openjump/core/ui/plugin/edit/ReplicateSelectedItemsPlugIn.java
===================================================================
---
core/trunk/src/org/openjump/core/ui/plugin/edit/ReplicateSelectedItemsPlugIn.java
2016-11-06 17:18:05 UTC (rev 5168)
+++
core/trunk/src/org/openjump/core/ui/plugin/edit/ReplicateSelectedItemsPlugIn.java
2016-11-06 17:26:22 UTC (rev 5169)
@@ -44,7 +44,6 @@
import java.util.Iterator;
import javax.swing.ImageIcon;
-import javax.swing.JComboBox;
import org.openjump.core.ui.images.IconLoader;
@@ -80,7 +79,7 @@
public static ImageIcon ICON = IconLoader.icon("shape_replicate.png");
private String T1 = "Replicate to new layer?";
private String CLAYER = "otherwise select layer";
- boolean newLayer = true;
+ private boolean newLayer = true;
private Layer itemlayer = null;
private boolean copyAsGeometry = false;
@@ -142,7 +141,7 @@
dialog.setSideBarDescription(sidebarString);
// "Replicates selected items if all have same feature schema"
dialog.addCheckBox(T1, true);
- JComboBox addLayerComboBoxBuild = dialog.addLayerComboBox(this.CLAYER,
+ dialog.addLayerComboBox(this.CLAYER,
context.getCandidateLayer(0), null, context.getLayerManager());
}
@@ -165,28 +164,25 @@
.get("org.openjump.core.ui.plugin.edit.ReplicateSelectedItemsPlugIn.no-replication-because-different-attribute-schema");
boolean hasBeenCalled = false;
- System.gc(); // flush garbage collector
// --------------------------
// -- get selected items
final Collection features = context.getLayerViewPanel()
.getSelectionManager().getFeaturesWithSelectedItems();
- if (newLayer == false) {
+ if (!newLayer) {
EditTransaction transaction = new EditTransaction(new ArrayList(),
this.getName(), this.itemlayer,
this.isRollingBackInvalidEdits(context), true,
context.getWorkbenchFrame());
- FeatureCollection actualLayerFeatures = this.itemlayer
- .getFeatureCollectionWrapper().getWrappee();
FeatureSchema fschema = this.itemlayer
.getFeatureCollectionWrapper().getFeatureSchema();
// -- check if schema is the same if yes add the feature (or change
// Schema)
Iterator iter = features.iterator();
int i = 0;
- Feature fi = null;
+ Feature fi;
while (iter.hasNext()) {
i++;
fi = (Feature) iter.next();
@@ -196,11 +192,11 @@
} else {
context.getWorkbenchFrame().setStatusMessage(
statusMessage1 + ": " + i + " " + statusMessage2);
- if (hasBeenCalled == false) {
+ if (!hasBeenCalled) {
this.askWhatToDo(context);
hasBeenCalled = true;
}
- if (this.copyAsGeometry == true) {
+ if (this.copyAsGeometry) {
Geometry geom = (Geometry) fi.getGeometry().clone();
Feature newFeature = FeatureUtil.toFeature(geom,
fschema);
@@ -213,23 +209,23 @@
Iterator iter = features.iterator();
Feature f = (Feature) iter.next();
FeatureCollection myCollA = new FeatureDataset(f.getSchema());
- myCollA.add((Feature) f.clone()); // copy first Item
- Feature fi = null;
+ myCollA.add(f.clone()); // copy first Item
+ Feature fi;
int i = 1;
while (iter.hasNext()) {
i++;
fi = (Feature) iter.next();
if (f.getSchema().equals(fi.getSchema())) {
- Feature feature = (Feature) fi.clone();
+ Feature feature = fi.clone();
myCollA.add(feature);
} else {
context.getWorkbenchFrame().setStatusMessage(
statusMessage1 + ": " + i + statusMessage2);
- if (hasBeenCalled == false) {
+ if (!hasBeenCalled) {
this.askWhatToDo(context);
hasBeenCalled = true;
}
- if (this.copyAsGeometry == true) {
+ if (this.copyAsGeometry) {
Geometry geom = (Geometry) fi.getGeometry().clone();
Feature newFeature = FeatureUtil.toFeature(geom,
f.getSchema());
Modified:
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectAllLayerItemsPlugIn.java
===================================================================
---
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectAllLayerItemsPlugIn.java
2016-11-06 17:18:05 UTC (rev 5168)
+++
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectAllLayerItemsPlugIn.java
2016-11-06 17:26:22 UTC (rev 5169)
@@ -61,6 +61,7 @@
*
*/
public class SelectAllLayerItemsPlugIn extends AbstractPlugIn {
+
private String name = I18N
.get("org.openjump.core.ui.plugin.edit.SelectAllLayerItemsPlugIn.select-all-items-of-selected-layers");
@@ -74,7 +75,7 @@
context
.getFeatureInstaller()
- .addPopupMenuItem(
+ .addPopupMenuPlugin(
context.getWorkbenchContext().getWorkbench().getFrame()
.getLayerNamePopupMenu(),
this,
@@ -83,7 +84,7 @@
context
.getFeatureInstaller()
- .addMainMenuItem(
+ .addMainMenuPlugin(
this,
new String[] { MenuNames.EDIT, MenuNames.SELECTION },
name,
@@ -101,13 +102,13 @@
public boolean execute(PlugInContext context) throws Exception {
int count = 0;
- Layer[] selectedLayers = context.getLayerNamePanel().getSelectedLayers();
+ Layer[] selectedLayers = context.getSelectedLayers();
for (int i = 0; i < selectedLayers.length; i++) {
Layer actualLayer = selectedLayers[i];
if (actualLayer.isVisible()) {
FeatureCollection fc = context.getSelectedLayer(i)
.getFeatureCollectionWrapper().getWrappee();
- Collection features = new ArrayList();
+ Collection<Feature> features = new ArrayList<>();
for (Iterator iter = fc.iterator(); iter.hasNext();) {
Feature element = (Feature) iter.next();
Modified:
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectAllModifiedFeaturesPlugIn.java
===================================================================
---
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectAllModifiedFeaturesPlugIn.java
2016-11-06 17:18:05 UTC (rev 5168)
+++
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectAllModifiedFeaturesPlugIn.java
2016-11-06 17:26:22 UTC (rev 5169)
@@ -36,7 +36,7 @@
import java.awt.event.KeyEvent;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
+import java.util.List;
import com.vividsolutions.jump.I18N;
import com.vividsolutions.jump.feature.BasicFeature;
@@ -77,21 +77,18 @@
public boolean execute(final PlugInContext context) throws Exception {
reportNothingToUndoYet(context);
- ArrayList selectedFeatures = new ArrayList();
+ List<Feature> selectedFeatures = new ArrayList<>();
LayerViewPanel layerViewPanel = context.getWorkbenchContext()
.getLayerViewPanel();
layerViewPanel.getSelectionManager().clear();
- Collection layers = (Collection) context.getWorkbenchContext()
- .getLayerNamePanel().getLayerManager().getLayers();
- for (Iterator j = layers.iterator(); j.hasNext();) {
- Layer layer = (Layer) j.next();
+ Collection<Layer> layers = context.getLayerManager().getLayers();
+ for (Layer layer : layers) {
selectedFeatures.clear();
if (layer.isVisible()) {
FeatureCollection featureCollection = layer
.getFeatureCollectionWrapper();
- for (Iterator i = featureCollection.iterator(); i.hasNext();) {
- Feature feature = (Feature) i.next();
+ for (Feature feature : featureCollection.getFeatures()) {
if (feature instanceof BasicFeature
&& ((BasicFeature) feature).isModified()) {
selectedFeatures.add(feature);
Modified:
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectByTypePlugIn.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/edit/SelectByTypePlugIn.java
2016-11-06 17:18:05 UTC (rev 5168)
+++ core/trunk/src/org/openjump/core/ui/plugin/edit/SelectByTypePlugIn.java
2016-11-06 17:26:22 UTC (rev 5169)
@@ -36,6 +36,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryCollection;
@@ -77,21 +78,19 @@
private boolean excludeEmptyGeometries = false;
protected AbstractSelection selection;
- final static String sSelectByGeometryType =
I18N.get("org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.Select-by-Geometry-Type");
- final static String sSelectOnlyTheseTypes =
I18N.get("org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.Select-only-these-types");
- final static String sEmptyGeometries =
I18N.get("org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.Empty-Geometries");
- final static String sOnSelectedLayersOnly =
I18N.get("org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.On-selected-layers-only");
- final static String sExcludeEmptyGeometries =
I18N.get("org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.Exclude-empty-geometries");
+ private final static String sSelectByGeometryType =
I18N.get("org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.Select-by-Geometry-Type");
+ private final static String sSelectOnlyTheseTypes =
I18N.get("org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.Select-only-these-types");
+ private final static String sEmptyGeometries =
I18N.get("org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.Empty-Geometries");
+ private final static String sOnSelectedLayersOnly =
I18N.get("org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.On-selected-layers-only");
+ private final static String sExcludeEmptyGeometries =
I18N.get("org.openjump.core.ui.plugin.edit.SelectByTypePlugIn.Exclude-empty-geometries");
public void initialize(PlugInContext context) throws Exception
{
workbenchContext = context.getWorkbenchContext();
- context.getFeatureInstaller().addMainMenuItem(this,
+ context.getFeatureInstaller().addMainMenuPlugin(this,
new String[] { MenuNames.EDIT, MenuNames.SELECTION },
sSelectByGeometryType + "...",
- false,
- null,
- this.createEnableCheck(workbenchContext));
+ false, null, getEnableCheck());
}
public String getName(){
@@ -103,7 +102,7 @@
reportNothingToUndoYet(context);
MultiInputDialog dialog = new MultiInputDialog(
context.getWorkbenchFrame(), getName(), true);
- setDialogValues(dialog, context);
+ setDialogValues(dialog);
GUIUtil.centreOnWindow(dialog);
dialog.setVisible(true);
@@ -111,19 +110,18 @@
getDialogValues(dialog);
LayerViewPanel layerViewPanel =
context.getWorkbenchContext().getLayerViewPanel();
- ArrayList selectedFeatures = new ArrayList();
+ List<Feature> selectedFeatures = new ArrayList<>();
layerViewPanel.getSelectionManager().clear();
- Collection layers;
+ Collection<Layer> layers;
if (selectedLayersOnly)
- layers = (Collection)
context.getWorkbenchContext().getLayerNamePanel().selectedNodes(Layer.class);
+ layers =
context.getWorkbenchContext().getLayerableNamePanel().selectedNodes(Layer.class);
else
- layers = (Collection)
context.getWorkbenchContext().getLayerNamePanel().getLayerManager().getLayers();
+ layers = context.getLayerManager().getLayers();
- for (Iterator j = layers.iterator(); j.hasNext();)
+ for (Layer layer : layers)
{
- Layer layer = (Layer) j.next();
selectedFeatures.clear();
if (layer.isVisible())
@@ -161,7 +159,7 @@
return false;
}
- private void setDialogValues(MultiInputDialog dialog, PlugInContext
context)
+ private void setDialogValues(MultiInputDialog dialog)
{
dialog.addLabel(sSelectOnlyTheseTypes);
dialog.addCheckBox(sEmptyGeometries, selectEmpty);
@@ -191,11 +189,13 @@
excludeEmptyGeometries =
dialog.getCheckBox(sExcludeEmptyGeometries).isSelected();
selectedLayersOnly =
dialog.getCheckBox(sOnSelectedLayersOnly).isSelected();
}
-
- public MultiEnableCheck createEnableCheck(final WorkbenchContext
workbenchContext)
+
+ @Override
+ public MultiEnableCheck getEnableCheck()
{
EnableCheckFactory checkFactory = new
EnableCheckFactory(workbenchContext);
- return new
MultiEnableCheck().add(checkFactory.createWindowWithLayerViewPanelMustBeActiveCheck())
+ return new MultiEnableCheck()
+
.add(checkFactory.createWindowWithLayerViewPanelMustBeActiveCheck())
.add(checkFactory.createAtLeastNLayersMustExistCheck(1));
}
}
Added:
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectGeometryCollectionsPlugIn.java
===================================================================
---
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectGeometryCollectionsPlugIn.java
(rev 0)
+++
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectGeometryCollectionsPlugIn.java
2016-11-06 17:26:22 UTC (rev 5169)
@@ -0,0 +1,61 @@
+package org.openjump.core.ui.plugin.edit;
+
+import com.vividsolutions.jts.geom.GeometryCollection;
+import com.vividsolutions.jump.feature.Feature;
+import com.vividsolutions.jump.feature.FeatureCollection;
+import com.vividsolutions.jump.workbench.WorkbenchContext;
+import com.vividsolutions.jump.workbench.model.Layer;
+import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
+import com.vividsolutions.jump.workbench.plugin.EnableCheckFactory;
+import com.vividsolutions.jump.workbench.plugin.MultiEnableCheck;
+import com.vividsolutions.jump.workbench.plugin.PlugInContext;
+import com.vividsolutions.jump.workbench.ui.LayerViewPanel;
+import com.vividsolutions.jump.workbench.ui.MenuNames;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A plugin to select features with complex geometries (MultiPoint,
MultiLineString,
+ * MultiPolygon or GeometryCollection).
+ * Useful to decompose these geometries.
+ */
+public class SelectGeometryCollectionsPlugIn extends AbstractPlugIn {
+
+ public void initialize(PlugInContext context) throws Exception {
+
+ context.getFeatureInstaller().addMainMenuPlugin(this,
+ new String[] {MenuNames.EDIT, MenuNames.SELECTION},
+ getName(), false, null,
+ createEnableCheck(context.getWorkbenchContext()));
+ }
+
+ public MultiEnableCheck createEnableCheck(WorkbenchContext
workbenchContext) {
+ EnableCheckFactory checkFactory = new
EnableCheckFactory(workbenchContext);
+ return new MultiEnableCheck()
+ .add(checkFactory.createAtLeastNLayersMustExistCheck(1));
+ }
+
+ public boolean execute(PlugInContext context) throws Exception{
+ reportNothingToUndoYet(context);
+ List<Feature> selectedFeatures = new ArrayList<>();
+ LayerViewPanel layerViewPanel =
context.getWorkbenchContext().getLayerViewPanel();
+ layerViewPanel.getSelectionManager().clear();
+ for (Layer layer : context.getSelectedLayers()) {
+ selectedFeatures.clear();
+ if (layer.isVisible()) {
+ FeatureCollection featureCollection =
layer.getFeatureCollectionWrapper();
+ for (Feature feature : featureCollection.getFeatures()) {
+ if (feature.getGeometry() instanceof GeometryCollection) {
+ selectedFeatures.add(feature);
+ }
+ }
+ if (selectedFeatures.size() > 0) {
+
context.getWorkbenchContext().getLayerViewPanel().getSelectionManager().getFeatureSelection()
+ .selectItems(layer, selectedFeatures);
+ }
+ }
+ }
+ return true;
+ }
+}
Modified:
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectItemsByCircleFromSelectedLayersPlugIn.java
===================================================================
---
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectItemsByCircleFromSelectedLayersPlugIn.java
2016-11-06 17:18:05 UTC (rev 5168)
+++
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectItemsByCircleFromSelectedLayersPlugIn.java
2016-11-06 17:26:22 UTC (rev 5169)
@@ -25,18 +25,6 @@
* Stefan Steiniger
* [email protected]
*/
-/*****************************************************
- * created: 20.05.2005
- * last modified: 22.05.2005
- *
- * description:
- * selects items within a cirlce of the actual selected layers
- * and informs about the number of selected items<p>
- * uses selectItemsByCircle class for user interaction and
- * determination of selection
- *
- *****************************************************/
-
package org.openjump.core.ui.plugin.edit;
import
org.openjump.core.ui.plugin.edit.helpclassesselection.SelectItemsByCircleTool;
@@ -55,11 +43,12 @@
/**
- * Selects items of the actual layer
+ * Selects items within a cirlce of the actual selected layers
* and informs about the number of selected items
*
* @author sstein
*
+ * created: 20.05.2005
*/
public class SelectItemsByCircleFromSelectedLayersPlugIn extends
AbstractPlugIn{
@@ -72,14 +61,10 @@
this.T1 =
I18N.get("org.openjump.core.ui.plugin.edit.SelectItemsByCirlceFromSelectedLayersPlugIn.cirlce-diameter")
+ ":";
this.sidebarstring =
I18N.get("org.openjump.core.ui.plugin.edit.SelectItemsByCirlceFromSelectedLayersPlugIn.select-features-within-a-circle-from-currently-selected-layers");
- context.getFeatureInstaller().addMainMenuItem(this,
- new String[]
- {MenuNames.EDIT, MenuNames.SELECTION},
- getName(),
-
//I18N.get("org.openjump.core.ui.plugin.edit.SelectItemsByCirlceFromSelectedLayersPlugIn.select-items-by-cirlce-from-selected-layers"),
- false, //icon
- null, //icon
- createEnableCheck(context.getWorkbenchContext())); //enable check
+ context.getFeatureInstaller().addMainMenuPlugin(this,
+ new String[] {MenuNames.EDIT, MenuNames.SELECTION},
+ getName(), false, null,
+ createEnableCheck(context.getWorkbenchContext()));
}
public String getName() {
@@ -92,11 +77,11 @@
.add(checkFactory.createAtLeastNLayersMustExistCheck(1));
}
- public boolean makeDialogThings(PlugInContext context) throws Exception{
+ private boolean makeDialogThings(PlugInContext context) throws
Exception{
this.reportNothingToUndoYet(context);
MultiInputDialog dialog = new MultiInputDialog(
context.getWorkbenchFrame(), getName(), true);
- setDialogValues(dialog, context);
+ setDialogValues(dialog);
GUIUtil.centreOnWindow(dialog);
dialog.setVisible(true);
if (! dialog.wasOKPressed()) { return false; }
@@ -104,17 +89,14 @@
return true;
}
- private void setDialogValues(MultiInputDialog dialog, PlugInContext
context)
- {
+ private void setDialogValues(MultiInputDialog dialog) {
dialog.setSideBarDescription(this.sidebarstring);
dialog.addDoubleField(T1,this.diameter,7,T1);
- }
+ }
private void getDialogValues(MultiInputDialog dialog) {
this.diameter = dialog.getDouble(T1);
-
- }
-
+ }
public boolean execute(PlugInContext context) throws Exception{
try {
@@ -125,24 +107,13 @@
Coordinate initCoords = new Coordinate(x,y);
SelectItemsByCircleTool sit = new
SelectItemsByCircleTool(context, this.diameter, initCoords);
context.getLayerViewPanel().setCurrentCursorTool(sit);
-
- //-- if an toolbar item should be added use the following?
- /**
- QuasimodeTool tool = new QuasimodeTool(sit).add(
- new QuasimodeTool.ModifierKeySpec(true, false, false),
null);
- WorkbenchContext wbcontext = context.getWorkbenchContext();
-
wbcontext.getWorkbench().getFrame().getToolBar().addCursorTool(tool).getQuasimodeTool();
- **/
}
}
catch (Exception e) {
context.getWorkbenchFrame().warnUser("SelecItemsByCircleTool
Exception:" + e.toString());
return false;
}
-
- System.gc();
return true;
}
-
}
Modified:
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectItemsByFenceFromSelectedLayersPlugIn.java
===================================================================
---
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectItemsByFenceFromSelectedLayersPlugIn.java
2016-11-06 17:18:05 UTC (rev 5168)
+++
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectItemsByFenceFromSelectedLayersPlugIn.java
2016-11-06 17:26:22 UTC (rev 5169)
@@ -25,19 +25,9 @@
* Stefan Steiniger
* [email protected]
*/
-/*****************************************************
- * created: 16.05.2005
- * last modified: 18.05.2005
- *
- * description:
- * selects items within a fence of the actual selected layers
- * and informs about the number of selected items<p>
- * uses DrawFenceTool class for user interaction and
- * determination of selection
- *
- *****************************************************/
package org.openjump.core.ui.plugin.edit;
+
import org.openjump.core.ui.plugin.edit.helpclassesselection.DrawFenceTool;
import com.vividsolutions.jump.I18N;
@@ -52,21 +42,21 @@
/**
- * Selects items within a fence of the actual layer
- * and informs about the number of selected items
+ * Selects items within a fence of the actual selected layers
+ * and informs about the number of selected items.
*
* @author sstein
*
+ * created: 16.05.2005
+ *
*/
public class SelectItemsByFenceFromSelectedLayersPlugIn extends
AbstractPlugIn{
public void initialize(PlugInContext context) throws Exception {
- context.getFeatureInstaller().addMainMenuItem(this,
- new String[]
- {MenuNames.EDIT, MenuNames.SELECTION},
+ context.getFeatureInstaller().addMainMenuPlugin(this,
+ new String[] {MenuNames.EDIT, MenuNames.SELECTION},
I18N.get("org.openjump.core.ui.plugin.edit.SelectItemsByFenceFromSelectedLayersPlugIn.select-features-by-polygon-from-selected-layers"),
- false,
- null,
+ false, null,
createEnableCheck(context.getWorkbenchContext()));
}
Modified:
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectLayersWithSelectedItemsPlugIn.java
===================================================================
---
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectLayersWithSelectedItemsPlugIn.java
2016-11-06 17:18:05 UTC (rev 5168)
+++
core/trunk/src/org/openjump/core/ui/plugin/edit/SelectLayersWithSelectedItemsPlugIn.java
2016-11-06 17:26:22 UTC (rev 5169)
@@ -48,33 +48,26 @@
public class SelectLayersWithSelectedItemsPlugIn extends AbstractPlugIn {
- private static final String sSelectLayersWithSelectedItems =
I18N.get("org.openjump.core.ui.plugin.mousemenu.SelectLayersWithSelectedItemsPlugIn.SelectLayersWithSelectedItems");
- public void initialize(PlugInContext context) throws Exception
+ private static final String sSelectLayersWithSelectedItems =
+
I18N.get("org.openjump.core.ui.plugin.mousemenu.SelectLayersWithSelectedItemsPlugIn.SelectLayersWithSelectedItems");
+
+ public void initialize(PlugInContext context) throws Exception
{
WorkbenchContext workbenchContext = context.getWorkbenchContext();
- context.getFeatureInstaller().addMainMenuItem(this,
+ context.getFeatureInstaller().addMainMenuPlugin(this,
new String[] { MenuNames.EDIT, MenuNames.SELECTION },
sSelectLayersWithSelectedItems,
- false,
- null,
+ false, null,
this.createEnableCheck(workbenchContext));
- /*//[sstein] 23.Mar.2009 disabled - now in >edit>selection menu
- FeatureInstaller featureInstaller = new
FeatureInstaller(workbenchContext);
- JPopupMenu popupMenu = LayerViewPanel.popupMenu();
- featureInstaller.addPopupMenuItem(popupMenu,
- this, sSelectLayersWithSelectedItems,
- false, null,
- this.createEnableCheck(workbenchContext));
- */
}
public boolean execute(final PlugInContext context) throws Exception
{
reportNothingToUndoYet(context);
LayerViewPanel layerViewPanel =
context.getWorkbenchContext().getLayerViewPanel();
- Collection layerCollection =
layerViewPanel.getSelectionManager().getLayersWithSelectedItems();
- TreeLayerNamePanel lnp =
(TreeLayerNamePanel)context.getWorkbenchContext().getLayerNamePanel();
- Layer[] layersToSelect = (Layer[]) layerCollection.toArray(new
Layer[]{});
+ Collection<Layer> layerCollection =
layerViewPanel.getSelectionManager().getLayersWithSelectedItems();
+ TreeLayerNamePanel lnp =
(TreeLayerNamePanel)context.getWorkbenchContext().getLayerableNamePanel();
+ Layer[] layersToSelect = layerCollection.toArray(new Layer[]{});
lnp.setSelectedLayers(layersToSelect);
return true;
}
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel