Revision: 5863
http://sourceforge.net/p/jump-pilot/code/5863
Author: ma15569
Date: 2018-06-08 09:13:29 +0000 (Fri, 08 Jun 2018)
Log Message:
-----------
make RasterImageLayer final
Modified Paths:
--------------
core/trunk/src/org/openjump/core/ui/plugin/raster/HistogramPlugIn.java
Modified: core/trunk/src/org/openjump/core/ui/plugin/raster/HistogramPlugIn.java
===================================================================
--- core/trunk/src/org/openjump/core/ui/plugin/raster/HistogramPlugIn.java
2018-06-08 08:09:47 UTC (rev 5862)
+++ core/trunk/src/org/openjump/core/ui/plugin/raster/HistogramPlugIn.java
2018-06-08 09:13:29 UTC (rev 5863)
@@ -58,6 +58,7 @@
import com.vividsolutions.jump.task.TaskMonitor;
import com.vividsolutions.jump.util.StatisticIndices;
import com.vividsolutions.jump.workbench.JUMPWorkbench;
+import com.vividsolutions.jump.workbench.WorkbenchContext;
import com.vividsolutions.jump.workbench.plugin.AbstractPlugIn;
import com.vividsolutions.jump.workbench.plugin.EnableCheckFactory;
import com.vividsolutions.jump.workbench.plugin.MultiEnableCheck;
@@ -155,7 +156,8 @@
10);
private final Font big_font = new Font("BitStream Vera Sans", Font.PLAIN,
14);
- private RasterImageLayer selLayer = null;
+ // private RasterImageLayer selLayer = null;
+ private String layerName;
private int ranges = 100;
private final Icon ICON = IconLoader.icon("histogramme.png");
@@ -207,10 +209,25 @@
@Override
public void run(TaskMonitor monitor, PlugInContext context)
throws Exception {
- createHistogram(context, selLayer);
+ final RasterImageLayer layer = getRasterImageLayer(layerName);
+ createHistogram(context, layer);
}
+ public RasterImageLayer getRasterImageLayer(String name) {
+ final WorkbenchContext context = JUMPWorkbench.getInstance()
+ .getContext();
+ for (final Object element : context.getLayerManager()
+ .getRasterImageLayers()) {
+ final RasterImageLayer layer = (RasterImageLayer) element;
+ if (layer.getName().equals(name)) {
+ return layer;
+ }
+ }
+
+ return null;
+ }
+
private void setDialogValues(final MultiInputDialog dialog,
PlugInContext context) {
@@ -241,7 +258,9 @@
private void getDialogValues(MultiInputDialog dialog) {
ranges = dialog.getInteger(T2);
- selLayer = (RasterImageLayer) dialog.getLayerable(CLAYER);
+ final RasterImageLayer layer = (RasterImageLayer) dialog
+ .getLayerable(CLAYER);
+ layerName = layer.getName();
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jump-pilot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel