Revision: 4506 http://sourceforge.net/p/jump-pilot/code/4506 Author: bertazza Date: 2015-06-23 12:29:52 +0000 (Tue, 23 Jun 2015) Log Message: ----------- Improved legend handling of rasters (via RasterStyler): the legend is now integrated in the layer tree of the TOC.
Modified Paths: -------------- core/trunk/ChangeLog core/trunk/src/com/vividsolutions/jump/util/SimpleTreeModel.java core/trunk/src/com/vividsolutions/jump/workbench/model/LayerTreeModel.java core/trunk/src/com/vividsolutions/jump/workbench/ui/TreeLayerNamePanel.java core/trunk/src/org/openjump/core/rasterimage/AddRasterImageLayerWizard.java core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java core/trunk/src/org/openjump/core/rasterimage/RasterSymbology.java core/trunk/src/org/openjump/core/rasterimage/styler/RasterStylesExtension.java core/trunk/src/org/openjump/core/rasterimage/styler/RasterStylesPlugIn.java core/trunk/src/org/openjump/core/rasterimage/styler/resources/Bundle.properties core/trunk/src/org/openjump/core/rasterimage/styler/resources/Bundle_en.properties core/trunk/src/org/openjump/core/rasterimage/styler/ui/ColorsTablePanel.java core/trunk/src/org/openjump/core/rasterimage/styler/ui/CustomGradientColorsDialog.java core/trunk/src/org/openjump/core/rasterimage/styler/ui/GUIUtils.java core/trunk/src/org/openjump/core/rasterimage/styler/ui/GradientTablePanel.java core/trunk/src/org/openjump/core/rasterimage/styler/ui/IntervalPanel.java core/trunk/src/org/openjump/core/rasterimage/styler/ui/NoDataValueDialog.java core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterStylesDialog.form core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterStylesDialog.java core/trunk/src/org/openjump/core/rasterimage/styler/ui/SingleValuesPanel.java Added Paths: ----------- core/trunk/src/com/vividsolutions/jump/workbench/ui/RasterRampIcon.java Removed Paths: ------------- core/trunk/src/org/openjump/core/rasterimage/styler/RasterLegendPlugIn.java core/trunk/src/org/openjump/core/rasterimage/styler/RasterStyler.java core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterLegendDialog.java Modified: core/trunk/ChangeLog =================================================================== --- core/trunk/ChangeLog 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/ChangeLog 2015-06-23 12:29:52 UTC (rev 4506) @@ -1,5 +1,9 @@ # for display continuity sake please use 2 spaces instead of tabs +2015-06-23 bertazza + * improved legend handling for rasters (via RasterStyler): + * the legend is now integrated in the layer tree of the TOC + 2015-06-23 mmichaud <m.michael.mich...@orange.fr> * fix bug #406 wrong message "layers not saved" Modified: core/trunk/src/com/vividsolutions/jump/util/SimpleTreeModel.java =================================================================== --- core/trunk/src/com/vividsolutions/jump/util/SimpleTreeModel.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/com/vividsolutions/jump/util/SimpleTreeModel.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -98,6 +98,7 @@ public void valueForPathChanged(TreePath path, Object newValue) { } + @Override public int getIndexOfChild(Object parent, Object child) { for (int i = 0; i < getChildCount(parent); i++) { //Folders are value objects. [Jon Aquino] Modified: core/trunk/src/com/vividsolutions/jump/workbench/model/LayerTreeModel.java =================================================================== --- core/trunk/src/com/vividsolutions/jump/workbench/model/LayerTreeModel.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/com/vividsolutions/jump/workbench/model/LayerTreeModel.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -34,7 +34,6 @@ import java.awt.Color; import java.util.ArrayList; import java.util.Collections; -import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -44,9 +43,11 @@ import com.vividsolutions.jts.util.Assert; import com.vividsolutions.jump.util.LangUtil; import com.vividsolutions.jump.util.SimpleTreeModel; -import com.vividsolutions.jump.util.SimpleTreeModel.Folder; import com.vividsolutions.jump.workbench.ui.renderer.style.BasicStyle; import com.vividsolutions.jump.workbench.ui.renderer.style.ColorThemingStyle; +import org.openjump.core.rasterimage.RasterImageLayer; +import org.openjump.core.rasterimage.RasterSymbology; +import org.openjump.core.rasterimage.RasterSymbology.ColorMapType; /** * JTree model for displaying the Layers, WMSLayers, and other Layerables @@ -65,19 +66,23 @@ super(new Root()); this.layerManagerProxy = layerManagerProxy; } + public static class ColorThemingValue { private Object value; private BasicStyle style; private String label; + public ColorThemingValue(Object value, BasicStyle style, String label) { this.value = value; this.style = style; Assert.isTrue(label != null); this.label = label; } + @Override public String toString() { return label; } + @Override public boolean equals(Object other) { return other instanceof ColorThemingValue && LangUtil.bothNullOrEqual(value, @@ -87,7 +92,138 @@ public BasicStyle getStyle() { return style; } + } + + public static class RasterStyleValueIntv { + + private final ColorMapType colorMapType; + private final Color color; + private final Double nextValue; + private final Double value; + private final String label; + private int width; + private int height; + + public RasterStyleValueIntv( + ColorMapType colorMapType, + Color color, + Double value, + Double nextValue, + String label) { + this.colorMapType = colorMapType; + this.color = color; + this.nextValue = nextValue; + this.value = value; + this.label = label; + } + + public ColorMapType getColorMapType() { + return colorMapType; + } + + public Color getColor() { + return color; + } + + public Double getNextValue() { + return nextValue; + } + + public Double getValue() { + return value; + } + + public String getLabel() { + return label; + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + @Override + public String toString() { + return label; + } + + @Override + public boolean equals(Object other) { + return other instanceof RasterStyleValueIntv + && LangUtil.bothNullOrEqual(value, ((RasterStyleValueIntv) other).value) + && this.getValue() == ((RasterStyleValueIntv) other).getValue().doubleValue(); + } + + @Override + public int hashCode() { + int hash = 3; + hash = 89 * hash + (this.color != null ? this.color.hashCode() : 0); + hash = 89 * hash + (this.value != null ? this.value.hashCode() : 0); + return hash; + } + } + + public static class RasterStyleValueRamp { + + private final Double topValue; + private final Double bottomValue; + private final Color[] colors; + private int width; + private int height; + + public RasterStyleValueRamp(Double topValue, Double bottomValue, Color[] colors) { + this.topValue = topValue; + this.bottomValue = bottomValue; + this.colors = colors; + } + + public RasterStyleValueRamp(Double topValue, Double bottomValue, Color[] colors, int width, int height) { + this.topValue = topValue; + this.bottomValue = bottomValue; + this.colors = colors; + this.width = width; + this.height = height; + } + + public int getWidth() { + return width; + } + + public int getHeight() { + return height; + } + + @Override + public String toString() { + return String.valueOf(bottomValue) + "-" + String.valueOf(topValue); + } + + public Double getTopValue() { + return topValue; + } + + public Double getBottomValue() { + return bottomValue; + } + + public Color[] getColors() { + return colors; + } + + @Override + public boolean equals(Object other) { + return other instanceof RasterStyleValueRamp + && LangUtil.bothNullOrEqual(topValue, ((RasterStyleValueRamp) other).topValue) + && LangUtil.bothNullOrEqual(bottomValue, ((RasterStyleValueRamp) other).bottomValue); + } + + } + + @Override public int getIndexOfChild(Object parent, Object child) { for (int i = 0; i < getChildCount(parent); i++) { // ColorThemingValue are value objects. [Jon Aquino] @@ -96,9 +232,24 @@ && getChild(parent, i).equals(child)) { return i; } + + if (child instanceof RasterStyleValueIntv + && getChild(parent, i) instanceof RasterStyleValueIntv + && getChild(parent, i).equals(child)) { + return i; + } + + if (child instanceof RasterStyleValueRamp + && getChild(parent, i) instanceof RasterStyleValueRamp + && getChild(parent, i).equals(child)) { + return i; + } + } return super.getIndexOfChild(parent, child); } + + @Override public List getChildren(Object parent) { if (parent == getRoot()) { return layerManagerProxy.getLayerManager().getCategories(); @@ -125,13 +276,98 @@ if (parent instanceof ColorThemingValue) { return Collections.EMPTY_LIST; } - if (parent instanceof Layerable) { + + if(parent instanceof Layerable) { + if (parent instanceof RasterImageLayer) { + + RasterImageLayer rasterImageLayer = (RasterImageLayer)parent; + if(rasterImageLayer.getRasterSymbology() != null) { + + RasterSymbology rasterSymbology = rasterImageLayer.getRasterSymbology(); + + if(rasterImageLayer.getRasterSymbology().getColorMapType() != ColorMapType.RAMP) { + + List<RasterStyleValueIntv> styleValues_l = new ArrayList<RasterStyleValueIntv>(); + + Double[] keys = rasterSymbology.getColorMapEntries_tm() + .keySet().toArray(new Double[rasterSymbology.getColorMapEntries_tm().size()]); + + for(int i=0; i<keys.length; i++) { + + Double key = keys[i]; + if(!rasterImageLayer.isNoData(key)) { + + Double nextValue; + if(i == keys.length - 1) { + nextValue = rasterImageLayer.getMetadata().getStats().getMax(0); + } else { + nextValue = keys[i+1]; + } + + Color color = rasterSymbology.getColorMapEntries_tm().get(key); + + + styleValues_l.add(new RasterStyleValueIntv( + rasterSymbology.getColorMapType(), + color, + key, + nextValue, + key.toString())); + } + + } + + return styleValues_l; + + } else { + + List<RasterStyleValueRamp> styleValues_l = new ArrayList<RasterStyleValueRamp>(); + + double topValue = rasterImageLayer.getMetadata().getStats().getMax(0); + double bottomValue = rasterImageLayer.getMetadata().getStats().getMin(0); + + Double[] keys = rasterSymbology.getColorMapEntries_tm() + .keySet().toArray(new Double[rasterSymbology.getColorMapEntries_tm().size()]); + + List<Color> colors_l = new ArrayList<Color>(); + for(int i=keys.length-1; i>=0; i--) { + Double key = keys[i]; + if(!rasterImageLayer.isNoData(key)) { + Color color = rasterSymbology.getColorMapEntries_tm().get(key); + colors_l.add(color); + } + } + + Color[] colors = colors_l.toArray(new Color[colors_l.size()]); + + RasterStyleValueRamp ramp = new RasterStyleValueRamp( + topValue, + bottomValue, + colors); + + styleValues_l.add(ramp); + + return styleValues_l; + + } + } + } return new ArrayList(); } + if (parent instanceof RasterStyleValueIntv) { + return Collections.EMPTY_LIST; + } + + if (parent instanceof RasterStyleValueRamp) { + return Collections.EMPTY_LIST; + } + + Assert.shouldNeverReachHere(parent.getClass().getName()); return null; } + @Override public void valueForPathChanged(TreePath path, Object newValue) { if (path.getLastPathComponent() instanceof Layerable) { ((Layerable)path.getLastPathComponent()).setName((String)newValue); Added: core/trunk/src/com/vividsolutions/jump/workbench/ui/RasterRampIcon.java =================================================================== --- core/trunk/src/com/vividsolutions/jump/workbench/ui/RasterRampIcon.java (rev 0) +++ core/trunk/src/com/vividsolutions/jump/workbench/ui/RasterRampIcon.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -0,0 +1,59 @@ +package com.vividsolutions.jump.workbench.ui; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.LinearGradientPaint; +import java.awt.Paint; +import java.awt.geom.Point2D; +import javax.swing.Icon; + +/** + * + * @author AdL + */ +public class RasterRampIcon implements Icon { + + public RasterRampIcon(Color[] colors) { + this.colors = colors; + } + + @Override + public int getIconHeight() { + return 60; + } + + @Override + public int getIconWidth() { + return 15; + } + + @Override + public void paintIcon(Component c, Graphics g, int x, int y) + { +// // store the old color; I like to leave Graphics as I receive them +// Color old = g.getColor(); +// g.setColor(Color.BLUE); +// g.fillRect(x, y, getIconWidth(), getIconHeight()); +// g.setColor(old); + + float[] fractions = new float[colors.length]; + for(int f=0; f<fractions.length; f++) { + fractions[f] = f * (1f/(colors.length-1)); + } + + Paint gradient = new LinearGradientPaint( + new Point2D.Double(0, 0), + new Point2D.Double(0, getIconHeight() - 1), + fractions, + colors); + + ((Graphics2D)g).setPaint(gradient); + g.fillRect(x, y, getIconWidth(), getIconHeight()); + + } + + private Color[] colors; + +} Modified: core/trunk/src/com/vividsolutions/jump/workbench/ui/TreeLayerNamePanel.java =================================================================== --- core/trunk/src/com/vividsolutions/jump/workbench/ui/TreeLayerNamePanel.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/com/vividsolutions/jump/workbench/ui/TreeLayerNamePanel.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -79,10 +79,13 @@ import com.vividsolutions.jump.workbench.model.LayerManager; import com.vividsolutions.jump.workbench.model.LayerManagerProxy; import com.vividsolutions.jump.workbench.model.LayerTreeModel; +import com.vividsolutions.jump.workbench.model.LayerTreeModel.RasterStyleValueIntv; +import com.vividsolutions.jump.workbench.model.LayerTreeModel.RasterStyleValueRamp; import com.vividsolutions.jump.workbench.model.Layerable; import com.vividsolutions.jump.workbench.model.WMSLayer; import com.vividsolutions.jump.workbench.ui.renderer.RenderingManager; import com.vividsolutions.jump.workbench.ui.renderer.style.BasicStyle; +import org.openjump.core.rasterimage.RasterSymbology; public class TreeLayerNamePanel extends JPanel implements LayerListener, LayerNamePanel, LayerableNamePanel, LayerNamePanelProxy, PopupNodeProxy { @@ -91,6 +94,7 @@ BorderLayout borderLayout1 = new BorderLayout(); JTree tree = new JTree() { + @Override public boolean isPathEditable(TreePath path) { if (!isEditable()) { return false; @@ -103,6 +107,7 @@ // Workaround for Java Bug 4199956 "JTree shows container can be // expanded - even when empty", posted by bertrand.allo in the Java Bug // Database. [Jon Aquino] + @Override public boolean hasBeenExpanded(TreePath path) { return super.hasBeenExpanded(path) || !this.getModel().isLeaf(path.getLastPathComponent()); @@ -162,6 +167,10 @@ private int lastHoveringRow = -1; /** + * @param layerManagerProxy + * @param treeModel + * @param renderingManager + * @param additionalNodeClassToTreeCellRendererMap */ public TreeLayerNamePanel(LayerManagerProxy layerManagerProxy, TreeModel treeModel, RenderingManager renderingManager, @@ -389,6 +398,9 @@ if (path.peek() instanceof LayerTreeModel.ColorThemingValue) { return; } + if (path.peek() instanceof LayerTreeModel.RasterStyleValueIntv) { + return; + } tree.makeVisible(new TreePath(path.toArray())); } }); @@ -420,6 +432,7 @@ } }; + @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { @@ -437,16 +450,17 @@ map.put(WMSLayer.class, layerTreeCellRenderer); map.put(Category.class, layerTreeCellRenderer); map.put(RasterImageLayer.class, layerTreeCellRenderer); - map.put(LayerTreeModel.ColorThemingValue.class, - createColorThemingValueRenderer()); + map.put(LayerTreeModel.ColorThemingValue.class, createColorThemingValueRenderer()); + map.put(LayerTreeModel.RasterStyleValueIntv.class, createRasterStyleValueIntvRenderer()); + map.put(LayerTreeModel.RasterStyleValueRamp.class, createRasterStyleValueRampRenderer()); return map; } private TreeCellRenderer createColorThemingValueRenderer() { return new TreeCellRenderer() { - private JPanel panel = new JPanel(new GridBagLayout()); - private ColorPanel colorPanel = new ColorPanel(); - private JLabel label = new JLabel(); + private final JPanel panel = new JPanel(new GridBagLayout()); + private final ColorPanel colorPanel = new ColorPanel(); + private final JLabel label = new JLabel(); { panel.add(colorPanel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, @@ -456,6 +470,7 @@ 0, 0), 0, 0)); } + @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { @@ -473,6 +488,107 @@ }; } + private TreeCellRenderer createRasterStyleValueIntvRenderer() { + + return new TreeCellRenderer() { + private final JPanel panel = new JPanel(new GridBagLayout()); + private final ColorPanel colorPanel = new ColorPanel(); + private final JLabel label = new JLabel(); + { + panel.add(colorPanel, + new GridBagConstraints( + 0, 0, 1, 1, 0, 0, + GridBagConstraints.WEST, + GridBagConstraints.NONE, + new Insets(0,0,0,0), + 0, 0)); + panel.add(label, + new GridBagConstraints( + 1, 0, 1, 1, 0, 0, + GridBagConstraints.WEST, + GridBagConstraints.NONE, + new Insets(0,5,0,0), + 0, 0)); + } + + @Override + public Component getTreeCellRendererComponent(JTree tree, + Object value, boolean selected, boolean expanded, + boolean leaf, int row, boolean hasFocus) { + + RasterStyleValueIntv rasterStyleValue = (RasterStyleValueIntv) value; + + if(rasterStyleValue.getColorMapType() == RasterSymbology.ColorMapType.INTERVALS) { + label.setText( + String.valueOf(rasterStyleValue.getValue().floatValue() + "-" + + String.valueOf(rasterStyleValue.getNextValue().floatValue()))); + } else if(rasterStyleValue.getColorMapType() == RasterSymbology.ColorMapType.SINGLE) { + label.setText(String.valueOf(rasterStyleValue.getValue().intValue())); + } + colorPanel.setLineColor(Color.BLACK); + colorPanel.setFillColor(rasterStyleValue.getColor()); + + return panel; + } + }; + } + + private TreeCellRenderer createRasterStyleValueRampRenderer() { + + return new TreeCellRenderer() { + private final JPanel panel = new JPanel(new GridBagLayout()); + private final JLabel labelTop = new JLabel(); + private final JLabel labelMiddle = new JLabel(); + private final JLabel labelBottom = new JLabel(); + private final JLabel labelImg = new JLabel(); + { + + panel.add(labelImg, new GridBagConstraints(0, 0, 1, 3, 0, 1, + GridBagConstraints.WEST, + GridBagConstraints.NONE, + new Insets(0,0,0,0), + 0, 0)); + panel.add(labelTop, new GridBagConstraints(1, 0, 1, 1, 0, 1, + GridBagConstraints.WEST, + GridBagConstraints.VERTICAL, + new Insets(0,5,0,0), + 0, 0)); + panel.add(labelMiddle, new GridBagConstraints(1, 1, 1, 1, 0, 1, + GridBagConstraints.WEST, + GridBagConstraints.VERTICAL, + new Insets(0,5,0,0), + 0, 0)); + panel.add(labelBottom, new GridBagConstraints(1, 2, 1, 1, 0, 1, + GridBagConstraints.LAST_LINE_START, + GridBagConstraints.VERTICAL, + new Insets(0,5,0,0), + 0, 0)); + + labelTop.setVerticalAlignment(JLabel.TOP); + labelBottom.setVerticalAlignment(JLabel.BOTTOM); + + } + + @Override + public Component getTreeCellRendererComponent(JTree tree, + Object value, boolean selected, boolean expanded, + boolean leaf, int row, boolean hasFocus) { + + RasterStyleValueRamp rasterStyleValue = (RasterStyleValueRamp) value; + + labelTop.setText(String.valueOf(rasterStyleValue.getTopValue().floatValue())); + labelMiddle.setText(String.valueOf( + (rasterStyleValue.getTopValue().floatValue() - rasterStyleValue.getBottomValue().floatValue())/2)); + labelBottom.setText(String.valueOf(rasterStyleValue.getBottomValue().floatValue())); + + labelImg.setIcon(new RasterRampIcon(rasterStyleValue.getColors())); + + return panel; + } + }; + + } + void jbInit() throws Exception { this.setLayout(borderLayout1); tree.addMouseListener(new java.awt.event.MouseAdapter() { @@ -820,5 +936,5 @@ protected LayerTreeCellRenderer getLayerTreeCellRenderer() { return layerTreeCellRenderer; } - -} \ No newline at end of file + +} Modified: core/trunk/src/org/openjump/core/rasterimage/AddRasterImageLayerWizard.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/AddRasterImageLayerWizard.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/AddRasterImageLayerWizard.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -26,6 +26,7 @@ import com.vividsolutions.jump.task.TaskMonitor; import com.vividsolutions.jump.workbench.WorkbenchContext; import com.vividsolutions.jump.workbench.model.Category; +import com.vividsolutions.jump.workbench.model.LayerEventType; import com.vividsolutions.jump.workbench.model.Layerable; import com.vividsolutions.jump.workbench.model.StandardCategoryNames; import com.vividsolutions.jump.workbench.ui.GUIUtil; @@ -33,6 +34,7 @@ import com.vividsolutions.jump.workbench.ui.images.IconLoader; import com.vividsolutions.jump.workbench.ui.wizard.WizardDialog; import com.vividsolutions.jump.workbench.ui.wizard.WizardPanel; +import java.awt.Color; public class AddRasterImageLayerWizard extends AbstractWizardGroup { @@ -92,9 +94,11 @@ /** * Load the files selected in the wizard. * + * @param dialog * @param monitor * The task monitor. */ + @Override public void run(WizardDialog dialog, TaskMonitor monitor) { this.properties = new PropertiesHandler( AddRasterImageLayerWizard.propertiesFile); @@ -114,9 +118,6 @@ public void open(File file, TaskMonitor monitor) { try { - // workbenchContext.getWorkbench().getFrame().warnUser("would load: " - // + file.getName()); - try { this.properties.setProperty( LoadSextanteRasterImagePlugIn.KEY_PATH, file.getPath()); @@ -134,7 +135,7 @@ selectedFilename.lastIndexOf(File.separator) + 1, selectedFilename.lastIndexOf(".")); - boolean imageAdded = false; +// boolean imageAdded = false; Point imageDimensions = RasterImageIO .getImageDimensions(selectedFilename); @@ -143,7 +144,7 @@ this.workbenchContext); if (env != null) { - imageAdded = this.addImage(workbenchContext, env, + addImage(workbenchContext, env, imageDimensions); } @@ -157,8 +158,8 @@ } } - private boolean addImage(WorkbenchContext context, Envelope envelope, - Point imageDimensions) { + private void addImage(WorkbenchContext context, Envelope envelope, + Point imageDimensions) throws NoninvertibleTransformException { String newLayerName = context.getLayerManager().uniqueLayerName( cachedLayer); @@ -178,7 +179,6 @@ RasterImageLayer rLayer = new RasterImageLayer(newLayerName, context.getLayerManager(), imageFileName, null, envelope); - // ################################# MetaInformationHandler mih = new MetaInformationHandler(rLayer); @@ -190,15 +190,12 @@ // Double(envelope.getWidth())); // mih.addMetaInformation("real-world-height", new // Double(envelope.getHeight())); - mih.addMetaInformation("real-world-width", - new Double(envelope.getWidth())); - mih.addMetaInformation("real-world-height", - new Double(envelope.getHeight())); + mih.addMetaInformation("real-world-width", envelope.getWidth()); + mih.addMetaInformation("real-world-height", envelope.getHeight()); // ################################### - context.getLayerManager().addLayerable(catName, rLayer); - + if (zoomToInsertedImage || layersAsideImage == 0) { // logger.printDebug("zooming to image, layers: " + // layersAsideImage); @@ -208,8 +205,7 @@ // logger.printDebug(e.getMessage()); } } - - return true; + } /** Modified: core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/RasterImageLayer.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -32,6 +32,7 @@ import java.awt.image.renderable.ParameterBlock; import java.io.FileNotFoundException; import java.io.IOException; +import java.util.UUID; import java.util.logging.Level; import java.util.logging.Logger; @@ -128,6 +129,7 @@ private RasterSymbology symbology = null; private boolean symbologyChanged = false; + private final UUID uuid = java.util.UUID.randomUUID(); /** * for java2xml @@ -568,15 +570,21 @@ if(symbology == null) { if(stats.getBandCount() < 3) { - double value = actualRasterData.getSampleDouble(col, row, 0); - if(Double.isNaN(value) || Double.isInfinite(value) || value == noDataValue) { - newImage.setRGB(col, row, Color.TRANSLUCENT); - continue; - } - int rgbValue = (int) ((value - stats.getMin(0)) * 255./(stats.getMax(0) - stats.getMin(0))); - if(rgbValue > 255) rgbValue = 255; - if(rgbValue < 0) rgbValue = 0; - newImage.setRGB(col, row, new Color(rgbValue, rgbValue, rgbValue).getRGB()); +// double value = actualRasterData.getSampleDouble(col, row, 0); +// if(Double.isNaN(value) || Double.isInfinite(value) || value == noDataValue) { +// newImage.setRGB(col, row, Color.TRANSLUCENT); +// continue; +// } +// int rgbValue = (int) ((value - stats.getMin(0)) * 255./(stats.getMax(0) - stats.getMin(0))); +// if(rgbValue > 255) rgbValue = 255; +// if(rgbValue < 0) rgbValue = 0; +// newImage.setRGB(col, row, new Color(rgbValue, rgbValue, rgbValue).getRGB()); + + RasterSymbology rasterSymbology = new RasterSymbology(RasterSymbology.ColorMapType.RAMP); + rasterSymbology.addColorMapEntry(metadata.getStats().getMin(0), Color.WHITE); + rasterSymbology.addColorMapEntry(metadata.getStats().getMax(0), Color.BLACK); + setSymbology(rasterSymbology); + } else { double valueR = actualRasterData.getSampleDouble(col, row, 0); double valueG = actualRasterData.getSampleDouble(col, row, 1); @@ -1622,6 +1630,10 @@ } + public RasterSymbology getRasterSymbology() { + return symbology; + } + public void setSymbology(RasterSymbology symbology) throws NoninvertibleTransformException { this.symbology = symbology; symbologyChanged = true; @@ -1639,6 +1651,9 @@ return actualRasterData; } + public UUID getUUID() { + return uuid; + } } Modified: core/trunk/src/org/openjump/core/rasterimage/RasterSymbology.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/RasterSymbology.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/RasterSymbology.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -101,6 +101,15 @@ } return downColorMapEntry.getColor(); + } else if(colorMapType == ColorMapType.SINGLE) { + + ColorMapEntry downColorMapEntry = getColorMapEntry(value); + if(downColorMapEntry == null) { + return null; + } + return downColorMapEntry.getColor(); + + } else { return null; } @@ -116,7 +125,7 @@ } public enum ColorMapType { - RAMP, INTERVALS + RAMP, INTERVALS, SINGLE } } Deleted: core/trunk/src/org/openjump/core/rasterimage/styler/RasterLegendPlugIn.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/RasterLegendPlugIn.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/RasterLegendPlugIn.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -1,133 +0,0 @@ -package org.openjump.core.rasterimage.styler; - -import org.openjump.core.rasterimage.styler.ui.GUIUtils; -import org.openjump.core.rasterimage.styler.ui.RasterStylesDialog; -import org.openjump.core.rasterimage.styler.ui.RasterLegendDialog; -import com.vividsolutions.jump.task.TaskMonitor; -import com.vividsolutions.jump.workbench.WorkbenchContext; -import com.vividsolutions.jump.workbench.plugin.EnableCheck; -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.plugin.ThreadedPlugIn; -import com.vividsolutions.jump.workbench.ui.images.IconLoader; -import java.awt.Dimension; -import javax.swing.Icon; -import javax.swing.JComponent; -import javax.swing.JOptionPane; -import javax.swing.JPopupMenu; -import org.openjump.core.apitools.LayerTools; -import org.openjump.core.rasterimage.RasterImageLayer; -import org.openjump.core.rasterimage.RasterSymbology; -import org.openjump.core.ui.plugin.layer.pirolraster.RasterImageContextMenu; - -/** - * Plugin for displaying the raster (ASC, FLT formats) legend. - * The menu is actived only is a raster layer is selected. - * @author GeomaticaEAmbiente - */ -public class RasterLegendPlugIn implements ThreadedPlugIn { - - @Override - public void initialize(PlugInContext context) throws Exception { - - /* Add item to pop-up menu, only for rasters */ - JPopupMenu menu = RasterImageContextMenu.getInstance(context); - context.getFeatureInstaller().addPopupMenuPlugin( - menu, - this, - getName(), - false, - null, - createEnableCheck(context.getWorkbenchContext())); - - } - - @Override - public boolean execute(PlugInContext context) throws Exception { - - RasterImageLayer rasterImageLayer = (RasterImageLayer) LayerTools.getSelectedLayerable(context, RasterImageLayer.class); - String bboardKey = GUIUtils.getBBKey(rasterImageLayer.getImageFileName()); - RasterStylesDialog symbologyDialog; - RasterSymbology rasterStyler = null; - double noDataValue = 0d; - //Check if the RasterStyles of raster has been set. - if(context.getWorkbenchContext().getBlackboard().get(bboardKey)!= null){ - - symbologyDialog = (RasterStylesDialog) context.getWorkbenchContext().getBlackboard().get(bboardKey); - rasterStyler = symbologyDialog.getFinalRasterSymbolizer(); - noDataValue = symbologyDialog.getNoDataValue(); - } - - if(rasterStyler != null){ - - if(rasterStyler.getColorMapEntries_tm().size() > 40){ - JOptionPane.showMessageDialog(context.getWorkbenchFrame(), - bundle.getString("LegendDialog.More40Colors.message"), - RasterStylesExtension.extensionName, JOptionPane.INFORMATION_MESSAGE); - return false; - } - - RasterLegendDialog legendDialog = new RasterLegendDialog(context.getWorkbenchFrame(), - false, rasterStyler,noDataValue, rasterImageLayer.getName()); - - legendDialog.setLocationRelativeTo(context.getWorkbenchFrame()); - legendDialog.setMinimumSize(new Dimension(200, 300)); - legendDialog.setPreferredSize(new Dimension(200, 400)); - legendDialog.setAlwaysOnTop(true); - legendDialog.setVisible(true); - - - } - - return false; - - } - - @Override - public void run(TaskMonitor monitor, PlugInContext context) throws Exception { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } - - @Override - public String getName() { - return bundle.getString("LegendPlugIn.PlugInName.text"); - } - - public Icon getIcon() { - return IconLoader.icon("eye.png"); - } - - - public static MultiEnableCheck createEnableCheck( - final WorkbenchContext workbenchContext) { - - MultiEnableCheck multiEnableCheck = new MultiEnableCheck(); - EnableCheckFactory checkFactory = new EnableCheckFactory(workbenchContext); - multiEnableCheck.add(checkFactory.createWindowWithLayerNamePanelMustBeActiveCheck()); - multiEnableCheck.add(checkFactory.createExactlyNLayerablesMustBeSelectedCheck(1, RasterImageLayer.class) ); - multiEnableCheck.add(checkFactory.createRasterImageLayerExactlyNBandsMustExistCheck(1)); - - multiEnableCheck.add(new EnableCheck() { - - @Override - public String check(JComponent component) { - - RasterImageLayer ril = (RasterImageLayer) LayerTools.getSelectedLayerable(workbenchContext, RasterImageLayer.class); - String bboardKey = GUIUtils.getBBKey(ril.getImageFileName()); - return (workbenchContext.getBlackboard().get(bboardKey) != null) ? null : "Sign"; - } - }); -// - return multiEnableCheck; - } - -// private static String bboardKey; - private final java.util.ResourceBundle bundle = - java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle"); // NOI18N - - - - - -} Deleted: core/trunk/src/org/openjump/core/rasterimage/styler/RasterStyler.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/RasterStyler.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/RasterStyler.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -1,173 +0,0 @@ -package org.openjump.core.rasterimage.styler; - -import java.util.TreeMap; - -/** - * This class represents the style to be associated to a raster image. A style - * is given as series of value-colour pairs. The values refer to the raster cell - * values, and the colours to the colours that the cells will take. - * There are two types of symbolizers: RAMP, INTERVALS. For the RAMP - * symbolizer, the cell colours will be interpolated from the given value-colour - * pairs. For the INTERVALS symbolizer, all the cells with value equal or above - * the value contained in the value-colour pair will take the associated colour. - * To create a single values symbology, use the INTERVALS symbolizer, providing - * a value-colour pair for every raster value. - * @author AdL - */ -public class RasterStyler { - - /** - * Creates a new raster symbolizer of the given colour map type. - * @param colorMapType The colour map type to be used in this raster symbolizer. - * - */ - public RasterStyler(ColorMapType2 colorMapType) { - this.colorMapEntry_tm = new TreeMap<Double,ColorMapEntry>(); - this.colorMapType = colorMapType; - } - - /** - * Adds a new value-colour pair to the symbology. - * @param colorMapEntry The new value-colour pair - * @throws Exception - */ - public void addColorMapEntry(ColorMapEntry colorMapEntry) throws Exception { - - colorMapEntry_tm.put(colorMapEntry.getUpperValue(), colorMapEntry); - - } - - public void addColorMapEntries(ColorMapEntry[] colorMapEntries) throws Exception { - - for(ColorMapEntry colorMapEntry : colorMapEntries) { - colorMapEntry_tm.put(colorMapEntry.getUpperValue(), colorMapEntry); - } - - } - - /** - * Removes a value-colour pair from the symbology. - * @param cellValue The value to be removed. - */ - public void removeColorMapEntry(double cellValue) { - colorMapEntry_tm.remove(cellValue); - } - - /** - * Returns the colour map entry associated to a cell value. - * @param cellValue The cell value. - * @return - */ - public ColorMapEntry getColorMapEntry(double cellValue) { - - if(colorMapEntry_tm.floorEntry(cellValue) != null) { - return colorMapEntry_tm.floorEntry(cellValue).getValue(); - } - return null; - - } - - /** - * Returns the colour map entry just above to the given cell value. - * @param cellValue The given cell value. - * @return - */ - public ColorMapEntry getNextColorMapEntry(double cellValue) { - - if(colorMapEntry_tm.higherEntry(cellValue) != null) { - return colorMapEntry_tm.higherEntry(cellValue).getValue(); - } - return null; - - } - - /** - * Returns an array of all the colour map entries. - * @return The colour map entries of the symbolizer. - */ - public ColorMapEntry[] getColorMapEntries() { - - ColorMapEntry[] colorMapEntry = new ColorMapEntry[colorMapEntry_tm.size()]; - return colorMapEntry_tm.values().toArray(colorMapEntry); - - } - - /** - * Returns the colour map type. - * @return The colour map type. - */ - public ColorMapType2 getColorMapType() { - return colorMapType; - } - - /** - * Returns the level of transparency: 0 (no transparency) - 1 (transparent). - * @return The transparency (0-1). - */ - public double getTransparencyRatio() { - return transparencyRatio; - } - - /** - * Sets the overall transparency: 0 (no transparency) - 1 (transparent). - * @param transparencyRatio Transparency level (0-1); - */ - public void setTransparencyRatio(double transparencyRatio) { - this.transparencyRatio = transparencyRatio; - } - - @Override - public boolean equals(Object obj) { - - if(obj instanceof RasterStyler) { - - RasterStyler otherRasterSymbolizer = (RasterStyler) obj; - - // Compare color map type - if(this.getColorMapType() != otherRasterSymbolizer.getColorMapType()) { - return false; - } - - // Compare color map entries - ColorMapEntry[] thisColorMapEntries = this.getColorMapEntries(); - ColorMapEntry[] otherColorMapEntries = otherRasterSymbolizer.getColorMapEntries(); - - if(thisColorMapEntries.length != otherColorMapEntries.length) { - return false; - } - - for(int c=0; c<thisColorMapEntries.length; c++) { - if(thisColorMapEntries[c].getUpperValue() != otherColorMapEntries[c].getUpperValue()) { - return false; - } - if(!thisColorMapEntries[c].getColor().equals(otherColorMapEntries[c].getColor())) { - return false; - } - } - - return this.getTransparencyRatio() == otherRasterSymbolizer.getTransparencyRatio(); - - } else { - return super.equals(obj); - } - - } - - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.colorMapEntry_tm != null ? this.colorMapEntry_tm.hashCode() : 0); - hash = 79 * hash + (this.colorMapType != null ? this.colorMapType.hashCode() : 0); - hash = 79 * hash + (int) (Double.doubleToLongBits(this.transparencyRatio) ^ (Double.doubleToLongBits(this.transparencyRatio) >>> 32)); - return hash; - } - - private final TreeMap<Double,ColorMapEntry> colorMapEntry_tm; - private final ColorMapType2 colorMapType; - private double transparencyRatio = 0; - - public enum ColorMapType2 { - RAMP, INTERVALS; - } - -} Modified: core/trunk/src/org/openjump/core/rasterimage/styler/RasterStylesExtension.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/RasterStylesExtension.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/RasterStylesExtension.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -9,7 +9,6 @@ public void configure(PlugInContext pic) throws Exception { new RasterStylesPlugIn().initialize(pic); - new RasterLegendPlugIn().initialize(pic); } Modified: core/trunk/src/org/openjump/core/rasterimage/styler/RasterStylesPlugIn.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/RasterStylesPlugIn.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/RasterStylesPlugIn.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -4,10 +4,12 @@ import org.openjump.core.rasterimage.styler.ui.RasterStylesDialog; import com.vividsolutions.jump.task.TaskMonitor; import com.vividsolutions.jump.workbench.WorkbenchContext; +import com.vividsolutions.jump.workbench.model.Layerable; 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.plugin.ThreadedPlugIn; +import java.util.List; import javax.swing.JPopupMenu; import org.openjump.core.apitools.LayerTools; import org.openjump.core.rasterimage.RasterImageLayer; @@ -42,16 +44,15 @@ RasterImageLayer rasterImageLayer = (RasterImageLayer) LayerTools.getSelectedLayerable(context, RasterImageLayer.class); RasterStylesDialog symbologyDialog; - String bboardKey = GUIUtils.getBBKey(rasterImageLayer.getImageFileName()); + String bboardKey = GUIUtils.getBBKey(String.valueOf(rasterImageLayer.getUUID())); - if(context.getWorkbenchContext().getBlackboard().get(bboardKey)!= null){ + if(context.getWorkbenchContext().getBlackboard().get(bboardKey) != null){ symbologyDialog = (RasterStylesDialog) context.getWorkbenchContext().getBlackboard().get(bboardKey); symbologyDialog.setLocationRelativeTo(context.getWorkbenchFrame()); symbologyDialog.setVisible(true); } else { - Double noDataValue; //check if getNoDataValue() method in RasterImageLayer exist try{ Modified: core/trunk/src/org/openjump/core/rasterimage/styler/resources/Bundle.properties =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/resources/Bundle.properties 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/resources/Bundle.properties 2015-06-23 12:29:52 UTC (rev 4506) @@ -24,30 +24,20 @@ org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jLabel_Transp_100.t org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jLabel_Transparency.text=Transparency (%): org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jTextField_TranspValue.text=0 -CustomGradientColors.jButton_Cancel.text=Cancel -CustomGradientColors.jButton_AddRow.text=Add row -CustomGradientColors.jLabel_Min.text=Min -CustomGradientColors.jLabel_Max.text=Max -GradientTablePanel.FractionValues.message=The values must be in ascending order \n and must not be equal values. -GradientTablePanel.ColorsNumber.message=The colors must be at least two. -NoDataValueDialog.jButton_Memorize.text=Memorize -NoDataValueDialog.jButton_Cancel.text=Cancel -NoDataValueDialog.jTextField_NoDataValue.text=-9999.0 -NoDataValueDialog.jLabel_Message.text=Set noData raster value. -NoDataValueDialog.Values.message=The value entered is not valid. -LegendDialog.Title.text=Legend -LegendDialog.NoDataValue.text=NoData value -LegendPlugIn.PlugInName.text=Legend -ColorLabelLegendComponent.NoColor.ToolTipText=No color -ColorLabelLegendComponent.ColorR.ToolTipText=Color: R= -LegendDialog.More40Colors.message=The legend has more than 40 elements. It will not be displayed. -CustomGradientColorsDialog.jLabel_Min.text=Min -CustomGradientColorsDialog.jButton_RemoveRow.toolTipText= -CustomGradientColorsDialog.jButton_RemoveRow.text=Remove row -CustomGradientColorsDialog.jLabel_Max.text=Max -CustomGradientColorsDialog.jButton_AddRow.text=Add row -CustomGradientColorsDialog.jButton_Cancel.text=Cancel -CustomGradientColorsDialog.jButton_Ok.text=Ok +org.openjump.core.rasterimage.styler.ui.GradientTablePanel.FractionValues.message=The values must be in ascending order \n and must not be equal values. +org.openjump.core.rasterimage.styler.ui.GradientTablePanel.ColorsNumber.message=The colors must be at least two. +org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jButton_Memorize.text=Memorize +org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jButton_Cancel.text=Cancel +org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jTextField_NoDataValue.text=-9999.0 +org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jLabel_Message.text=Set noData raster value. +org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.Values.message=The value entered is not valid. +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jLabel_Min.text=Min +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_RemoveRow.toolTipText= +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_RemoveRow.text=Remove row +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jLabel_Max.text=Max +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_AddRow.text=Add row +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_Cancel.text=Cancel +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_Ok.text=Ok org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jButton_Restore.text=Restore org.openjump.core.rasterimage.styler.ui.SingleValuesPanel.jButton_Ramp=Ramp all org.openjump.core.rasterimage.styler.ui.SingleValuesPanel.jButton_Random=Random @@ -56,26 +46,27 @@ org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.tabStretched=Stretched org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.tabIntervals=Intervals org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.tabSingleValues=Single values -IntervalPanel.jLabel.method=Method: -IntervalPanel.jButton.RampAll=Ramp all -IntervalPanel.jLabel.Classes=Classes: -IntervalPanel.jButton.AddRow=Add row -IntervalPanel.jButton.RemoveRow=Remove row -IntervalPanel.jButton.Ramp=Ramp -IntervalPanel.classMethods.EqualInterval=Equal interval -IntervalPanel.classMethods.Jenks=Jenks -IntervalPanel.classMethods.MaxBreaks=Max breaks -IntervalPanel.classMethods.MeanStDev=Mean st. dev. -IntervalPanel.classMethods.Quantiles=Quantiles -IntervalPanel.message.ErrorWhileClassifying=Error while classifiyng data. -IntervalPanel.classMethods.EqualInterval.SelectTowRowsToRamp=You need to selected two rows to ramp the colours between them. -ColorsTablePanel.MinValue=Min. value -ColorsTablePanel.Color=Color -ColorsTablePanel.Value=Value -ColorsTablePanel.ErrorInTable=Error in table: +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jLabel.method=Method: +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.RampAll=Ramp all +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jLabel.Classes=Classes: +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.AddRow=Add row +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.RemoveRow=Remove row +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.Ramp=Ramp +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.EqualInterval=Equal interval +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.Jenks=Jenks +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.MaxBreaks=Max breaks +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.MeanStDev=Mean st. dev. +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.Quantiles=Quantiles +org.openjump.core.rasterimage.styler.ui.IntervalPanel.message.ErrorWhileClassifying=Error while classifiyng data. +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.EqualInterval.SelectTowRowsToRamp=You need to selected two rows to ramp the colours between them. +org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.MinValue=Min. value +org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.Color=Color +org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.Value=Value +org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.ErrorInTable=Error in table: org.openjump.core.rasterimage.styler.ui.ColorEditor.edit=edit org.openjump.core.rasterimage.styler.ui.ColorEditor.PickAColor=Pick a color org.openjump.core.rasterimage.styler.ui.ColorEditor.Transparent=Transparent org.openjump.core.rasterimage.styler.ui.ColorEditor.Cancel=Cancel org.openjump.core.rasterimage.styler.ui.ColorEditor.Ok=Ok org.openjump.core.rasterimage.styler.RasterStylesExtension.Name=Raster styles... +org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jButton_OK.text=OK Modified: core/trunk/src/org/openjump/core/rasterimage/styler/resources/Bundle_en.properties =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/resources/Bundle_en.properties 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/resources/Bundle_en.properties 2015-06-23 12:29:52 UTC (rev 4506) @@ -24,30 +24,20 @@ org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jLabel_Transp_100.t org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jLabel_Transparency.text=Transparency (%): org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jTextField_TranspValue.text=0 -CustomGradientColors.jButton_Cancel.text=Cancel -CustomGradientColors.jButton_AddRow.text=Add row -CustomGradientColors.jLabel_Min.text=Min -CustomGradientColors.jLabel_Max.text=Max -GradientTablePanel.FractionValues.message=The values must be in ascending order \n and must not be equal values. -GradientTablePanel.ColorsNumber.message=The colors must be at least two. -NoDataValueDialog.jButton_Memorize.text=Memorize -NoDataValueDialog.jButton_Cancel.text=Cancel -NoDataValueDialog.jTextField_NoDataValue.text=-9999.0 -NoDataValueDialog.jLabel_Message.text=Set noData raster value. -NoDataValueDialog.Values.message=The value entered is not valid. -LegendDialog.Title.text=Legend -LegendDialog.NoDataValue.text=NoData value -LegendPlugIn.PlugInName.text=Legend -ColorLabelLegendComponent.NoColor.ToolTipText=No color -ColorLabelLegendComponent.ColorR.ToolTipText=Color: R= -LegendDialog.More40Colors.message=The legend has more than 40 elements. It will not be displayed. -CustomGradientColorsDialog.jLabel_Min.text=Min -CustomGradientColorsDialog.jButton_RemoveRow.toolTipText= -CustomGradientColorsDialog.jButton_RemoveRow.text=Remove row -CustomGradientColorsDialog.jLabel_Max.text=Max -CustomGradientColorsDialog.jButton_AddRow.text=Add row -CustomGradientColorsDialog.jButton_Cancel.text=Cancel -CustomGradientColorsDialog.jButton_Ok.text=Ok +org.openjump.core.rasterimage.styler.ui.GradientTablePanel.FractionValues.message=The values must be in ascending order \n and must not be equal values. +org.openjump.core.rasterimage.styler.ui.GradientTablePanel.ColorsNumber.message=The colors must be at least two. +org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jButton_Memorize.text=Memorize +org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jButton_Cancel.text=Cancel +org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jTextField_NoDataValue.text=-9999.0 +org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jLabel_Message.text=Set noData raster value. +org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.Values.message=The value entered is not valid. +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jLabel_Min.text=Min +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_RemoveRow.toolTipText= +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_RemoveRow.text=Remove row +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jLabel_Max.text=Max +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_AddRow.text=Add row +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_Cancel.text=Cancel +org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_Ok.text=Ok org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jButton_Restore.text=Restore org.openjump.core.rasterimage.styler.ui.SingleValuesPanel.jButton_Ramp=Ramp all org.openjump.core.rasterimage.styler.ui.SingleValuesPanel.jButton_Random=Random @@ -56,25 +46,26 @@ org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.tabStretched=Stretched org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.tabIntervals=Intervals org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.tabSingleValues=Single values -IntervalPanel.jLabel.method=Method: -IntervalPanel.jButton.RampAll=Ramp all -IntervalPanel.jLabel.Classes=Classes: -IntervalPanel.jButton.AddRow=Add row -IntervalPanel.jButton.RemoveRow=Remove row -IntervalPanel.jButton.Ramp=Ramp -IntervalPanel.classMethods.EqualInterval=Equal interval -IntervalPanel.classMethods.Jenks=Jenks -IntervalPanel.classMethods.MaxBreaks=Max breaks -IntervalPanel.classMethods.MeanStDev=Mean st. dev. -IntervalPanel.classMethods.Quantiles=Quantiles -IntervalPanel.message.ErrorWhileClassifying=Error while classifiyng data. -IntervalPanel.classMethods.EqualInterval.SelectTowRowsToRamp=You need to selected two rows to ramp the colours between them. -ColorsTablePanel.MinValue=Min. value -ColorsTablePanel.Color=Color -ColorsTablePanel.Value=Value -ColorsTablePanel.ErrorInTable=Error in table: +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jLabel.method=Method: +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.RampAll=Ramp all +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jLabel.Classes=Classes: +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.AddRow=Add row +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.RemoveRow=Remove row +org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.Ramp=Ramp +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.EqualInterval=Equal interval +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.Jenks=Jenks +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.MaxBreaks=Max breaks +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.MeanStDev=Mean st. dev. +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.Quantiles=Quantiles +org.openjump.core.rasterimage.styler.ui.IntervalPanel.message.ErrorWhileClassifying=Error while classifiyng data. +org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.EqualInterval.SelectTowRowsToRamp=You need to selected two rows to ramp the colours between them. +org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.MinValue=Min. value +org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.Color=Color +org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.Value=Value +org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.ErrorInTable=Error in table: org.openjump.core.rasterimage.styler.ui.ColorEditor.edit=edit org.openjump.core.rasterimage.styler.ui.ColorEditor.PickAColor=Pick a color org.openjump.core.rasterimage.styler.ui.ColorEditor.Transparent=Transparent org.openjump.core.rasterimage.styler.ui.ColorEditor.Cancel=Cancel org.openjump.core.rasterimage.styler.ui.ColorEditor.Ok=Ok +org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jButton_OK.text=OK Modified: core/trunk/src/org/openjump/core/rasterimage/styler/ui/ColorsTablePanel.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/ui/ColorsTablePanel.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/ui/ColorsTablePanel.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -39,15 +39,15 @@ if(tableType == TableType.INTERVALS) { columnNames = new String[]{ java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle") - .getString("ColorsTablePanel.MinValue"), + .getString("org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.MinValue"), java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle") - .getString("ColorsTablePanel.Color")}; + .getString("org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.Color")}; } else if(tableType == TableType.VALUES) { columnNames = new String[]{ java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle") - .getString("ColorsTablePanel.Value"), + .getString("org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.Value"), java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle") - .getString("ColorsTablePanel.Color")}; + .getString("org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.Color")}; } this.noDataValue = noDataValue; this.integerValues = integerValues; @@ -146,7 +146,7 @@ } catch (Exception ex) { throw new Exception( java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle") - .getString("ColorsTablePanel.ErrorInTable") + ex); + .getString("org.openjump.core.rasterimage.styler.ui.ColorsTablePanel.ErrorInTable") + ex); } } Modified: core/trunk/src/org/openjump/core/rasterimage/styler/ui/CustomGradientColorsDialog.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/ui/CustomGradientColorsDialog.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/ui/CustomGradientColorsDialog.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -58,8 +58,8 @@ jPanel_ColorTable.setLayout(new java.awt.GridBagLayout()); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle"); // NOI18N - jButton_RemoveRow.setText(bundle.getString("CustomGradientColorsDialog.jButton_RemoveRow.text")); // NOI18N - jButton_RemoveRow.setToolTipText(bundle.getString("CustomGradientColorsDialog.jButton_RemoveRow.toolTipText")); // NOI18N + jButton_RemoveRow.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_RemoveRow.text")); // NOI18N + jButton_RemoveRow.setToolTipText(bundle.getString("org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_RemoveRow.toolTipText")); // NOI18N jButton_RemoveRow.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton_RemoveRowActionPerformed(evt); @@ -73,7 +73,7 @@ gridBagConstraints.insets = new java.awt.Insets(0, 0, 5, 2); jPanel_ColorTable.add(jButton_RemoveRow, gridBagConstraints); - jButton_AddRow.setText(bundle.getString("CustomGradientColorsDialog.jButton_AddRow.text")); // NOI18N + jButton_AddRow.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_AddRow.text")); // NOI18N jButton_AddRow.setMaximumSize(new java.awt.Dimension(93, 23)); jButton_AddRow.setMinimumSize(new java.awt.Dimension(93, 23)); jButton_AddRow.setPreferredSize(new java.awt.Dimension(93, 23)); @@ -110,14 +110,14 @@ gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10); jPanel_ColorTable.add(jPanel_Gradient, gridBagConstraints); - jLabel_Min.setText(bundle.getString("CustomGradientColorsDialog.jLabel_Min.text")); // NOI18N + jLabel_Min.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jLabel_Min.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 0; gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10); jPanel_ColorTable.add(jLabel_Min, gridBagConstraints); - jLabel_Max.setText(bundle.getString("CustomGradientColorsDialog.jLabel_Max.text")); // NOI18N + jLabel_Max.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jLabel_Max.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 3; gridBagConstraints.gridy = 2; @@ -130,7 +130,7 @@ gridBagConstraints.gridwidth = 2; getContentPane().add(jPanel_ColorTable, gridBagConstraints); - jButton_Cancel.setText(bundle.getString("CustomGradientColorsDialog.jButton_Cancel.text")); // NOI18N + jButton_Cancel.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_Cancel.text")); // NOI18N jButton_Cancel.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton_CancelActionPerformed(evt); @@ -144,7 +144,7 @@ gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10); getContentPane().add(jButton_Cancel, gridBagConstraints); - jButton_Ok.setText(bundle.getString("CustomGradientColorsDialog.jButton_Ok.text")); // NOI18N + jButton_Ok.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.jButton_Ok.text")); // NOI18N jButton_Ok.setMaximumSize(new java.awt.Dimension(65, 23)); jButton_Ok.setMinimumSize(new java.awt.Dimension(65, 23)); jButton_Ok.setPreferredSize(new java.awt.Dimension(65, 23)); @@ -187,7 +187,7 @@ try { okButton(); } catch (Exception ex) { - Logger.getLogger(CustomGradientColorsDialog.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(org.openjump.core.rasterimage.styler.ui.CustomGradientColorsDialog.class.getName()).log(Level.SEVERE, null, ex); } @@ -233,7 +233,7 @@ //Check if colors are more than 1 if(cme.length < 2){ JOptionPane.showMessageDialog(this, - bundle.getString("GradientTablePanel.ColorsNumber.message"), + bundle.getString("org.openjump.core.rasterimage.styler.ui.GradientTablePanel.ColorsNumber.message"), RasterStylesExtension.extensionName, JOptionPane.INFORMATION_MESSAGE); return; @@ -251,7 +251,7 @@ if(values[v] <= tempValue || values[v]>1){ JOptionPane.showMessageDialog(this, - bundle.getString("GradientTablePanel.FractionValues.message"), + bundle.getString("org.openjump.core.rasterimage.styler.ui.GradientTablePanel.FractionValues.message"), RasterStylesExtension.extensionName, JOptionPane.INFORMATION_MESSAGE); return; Modified: core/trunk/src/org/openjump/core/rasterimage/styler/ui/GUIUtils.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/ui/GUIUtils.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/ui/GUIUtils.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -161,7 +161,7 @@ Iterator iter = layers.iterator(); while (iter.hasNext()) { RasterImageLayer ril = (RasterImageLayer) iter.next(); - if (rasterStylerKey.equals(ril.getImageFileName() + RasterStylesExtension.suffixBlackBKey)) { + if (rasterStylerKey.equals(ril.getUUID() + RasterStylesExtension.suffixBlackBKey)) { end_hm.put(rasterStylerKey, start_hm.get(rasterStylerKey)); break; } Modified: core/trunk/src/org/openjump/core/rasterimage/styler/ui/GradientTablePanel.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/ui/GradientTablePanel.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/ui/GradientTablePanel.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -102,7 +102,7 @@ }catch(Exception ex){ updateGradient = true; - Logger.getLogger(GradientTablePanel.class.getName()).log(Level.SEVERE, null, ex); + Logger.getLogger(org.openjump.core.rasterimage.styler.ui.GradientTablePanel.class.getName()).log(Level.SEVERE, null, ex); } updateGradient = true; Modified: core/trunk/src/org/openjump/core/rasterimage/styler/ui/IntervalPanel.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/ui/IntervalPanel.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/ui/IntervalPanel.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -75,7 +75,7 @@ setLayout(layout); java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle"); // NOI18N - jLabel_Method.setText(bundle.getString("IntervalPanel.jLabel.method")); // NOI18N + jLabel_Method.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.jLabel.method")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; @@ -95,7 +95,7 @@ gridBagConstraints.ipadx = 3; add(jComboBox_Method, gridBagConstraints); - jButton_Values.setText(bundle.getString("IntervalPanel.jButton.RampAll")); // NOI18N + jButton_Values.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.RampAll")); // NOI18N jButton_Values.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton_ValuesActionPerformed(evt); @@ -107,7 +107,7 @@ gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; add(jButton_Values, gridBagConstraints); - jLabel_Classes.setText(bundle.getString("IntervalPanel.jLabel.Classes")); // NOI18N + jLabel_Classes.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.jLabel.Classes")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; @@ -134,7 +134,7 @@ gridBagConstraints.weighty = 0.5; add(jPanel_Table, gridBagConstraints); - jButton_AddRow.setText(bundle.getString("IntervalPanel.jButton.AddRow")); // NOI18N + jButton_AddRow.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.AddRow")); // NOI18N jButton_AddRow.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton_AddRowActionPerformed(evt); @@ -145,7 +145,7 @@ gridBagConstraints.gridy = 6; add(jButton_AddRow, gridBagConstraints); - jButton_RemoveRow.setText(bundle.getString("IntervalPanel.jButton.RemoveRow")); // NOI18N + jButton_RemoveRow.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.RemoveRow")); // NOI18N jButton_RemoveRow.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton_RemoveRowActionPerformed(evt); @@ -156,7 +156,7 @@ gridBagConstraints.gridy = 6; add(jButton_RemoveRow, gridBagConstraints); - jButton_Ramp.setText(bundle.getString("IntervalPanel.jButton.Ramp")); // NOI18N + jButton_Ramp.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.jButton.Ramp")); // NOI18N jButton_Ramp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton_RampActionPerformed(evt); @@ -225,11 +225,11 @@ private void fixComponents() throws Exception { - classMethods_m.put(ClassificationMethod.EQUAL_RANGE, java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("IntervalPanel.classMethods.EqualInterval")); - classMethods_m.put(ClassificationMethod.JENKS, java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("IntervalPanel.classMethods.Jenks")); - classMethods_m.put(ClassificationMethod.MAX_BREAKS, java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("IntervalPanel.classMethods.MaxBreaks")); - classMethods_m.put(ClassificationMethod.MEAN_STDEV, java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("IntervalPanel.classMethods.MeanStDev")); - classMethods_m.put(ClassificationMethod.QUANTILE, java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("IntervalPanel.classMethods.Quantiles")); + classMethods_m.put(ClassificationMethod.EQUAL_RANGE, java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.EqualInterval")); + classMethods_m.put(ClassificationMethod.JENKS, java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.Jenks")); + classMethods_m.put(ClassificationMethod.MAX_BREAKS, java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.MaxBreaks")); + classMethods_m.put(ClassificationMethod.MEAN_STDEV, java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.MeanStDev")); + classMethods_m.put(ClassificationMethod.QUANTILE, java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.Quantiles")); jComboBox_Method.removeAllItems(); jComboBox_Method.addItem(classMethods_m.get(ClassificationMethod.EQUAL_RANGE)); @@ -297,7 +297,7 @@ } if(breaks == null) { - throw new Exception(java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("IntervalPanel.message.ErrorWhileClassifying")); + throw new Exception(java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.message.ErrorWhileClassifying")); } ColorMapEntry[] paletteColorMapEntries = ((GradientCanvas) jComboBox_Gradient.getSelectedItem()).getColorMapEntries(); @@ -347,7 +347,7 @@ if(colorsTablePanel.getSelectedRowsCount() != 2) { JOptionPane.showMessageDialog( this, - java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("IntervalPanel.classMethods.EqualInterval.SelectTowRowsToRamp"), + java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle").getString("org.openjump.core.rasterimage.styler.ui.IntervalPanel.classMethods.EqualInterval.SelectTowRowsToRamp"), RasterStylesExtension.extensionName, JOptionPane.WARNING_MESSAGE); } Modified: core/trunk/src/org/openjump/core/rasterimage/styler/ui/NoDataValueDialog.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/ui/NoDataValueDialog.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/ui/NoDataValueDialog.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -43,8 +43,8 @@ setResizable(false); getContentPane().setLayout(new java.awt.GridBagLayout()); - java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("com/geomaticaeambiente/openjump/rasterstyles/resources/Bundle"); // NOI18N - jLabel_Message.setText(bundle.getString("NoDataValueDialog.jLabel_Message.text")); // NOI18N + java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle"); // NOI18N + jLabel_Message.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jLabel_Message.text")); // NOI18N gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; @@ -53,7 +53,7 @@ gridBagConstraints.insets = new java.awt.Insets(0, 5, 20, 0); getContentPane().add(jLabel_Message, gridBagConstraints); - jTextField_NoDataValue.setText(bundle.getString("NoDataValueDialog.jTextField_NoDataValue.text")); // NOI18N + jTextField_NoDataValue.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jTextField_NoDataValue.text")); // NOI18N jTextField_NoDataValue.setMinimumSize(new java.awt.Dimension(110, 20)); jTextField_NoDataValue.setPreferredSize(new java.awt.Dimension(110, 20)); gridBagConstraints = new java.awt.GridBagConstraints(); @@ -65,7 +65,7 @@ gridBagConstraints.insets = new java.awt.Insets(0, 5, 20, 0); getContentPane().add(jTextField_NoDataValue, gridBagConstraints); - jButton_Cancel.setText(bundle.getString("NoDataValueDialog.jButton_Cancel.text")); // NOI18N + jButton_Cancel.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jButton_Cancel.text")); // NOI18N jButton_Cancel.setMaximumSize(new java.awt.Dimension(77, 23)); jButton_Cancel.setMinimumSize(new java.awt.Dimension(77, 23)); jButton_Cancel.setPreferredSize(new java.awt.Dimension(77, 23)); @@ -82,7 +82,7 @@ gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 5); getContentPane().add(jButton_Cancel, gridBagConstraints); - jButton_Memorize.setText(bundle.getString("NoDataValueDialog.jButton_Memorize.text")); // NOI18N + jButton_Memorize.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.jButton_Memorize.text")); // NOI18N jButton_Memorize.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton_MemorizeActionPerformed(evt); @@ -105,7 +105,7 @@ double value = Double.parseDouble(jTextField_NoDataValue.getText()); } catch(NumberFormatException nfe){ - JOptionPane.showMessageDialog(this, bundle.getString("NoDataValueDialog.Values.message"), RasterStylesExtension.extensionName, WIDTH); + JOptionPane.showMessageDialog(this, bundle.getString("org.openjump.core.rasterimage.styler.ui.NoDataValueDialog.Values.message"), RasterStylesExtension.extensionName, WIDTH); } noDataValue = Double.parseDouble(jTextField_NoDataValue.getText()); Deleted: core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterLegendDialog.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterLegendDialog.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterLegendDialog.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -1,85 +0,0 @@ -package org.openjump.core.rasterimage.styler.ui; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.util.TreeMap; -import javax.swing.JDialog; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import org.openjump.core.rasterimage.RasterSymbology; - -/** - * - * @author GeomaticaEAmbiente - */ -public class RasterLegendDialog extends JDialog{ - - public RasterLegendDialog(java.awt.Frame parent, boolean modal, RasterSymbology rasterStyler, double noDataValue, String rasterName) throws Exception{ - super(parent, modal); - - this.rasterStyler = rasterStyler; - this.noDataValue = noDataValue; - this.rasterName = rasterName; - - fixComponents(); - } - - - private void fixComponents() throws Exception{ - - this.setTitle(bundle.getString("LegendDialog.Title.text")); - - TreeMap<Double,Color> colorMapEntries = rasterStyler.getColorMapEntries_tm(); - - RasterSymbology.ColorMapType type = rasterStyler.getColorMapType(); - - JScrollPane scrollPane = null; - - if(type.equals(RasterSymbology.ColorMapType.INTERVALS)){ - scrollPane = getInterval(colorMapEntries); - }else if (type.equals(RasterSymbology.ColorMapType.RAMP)){ - scrollPane = getGradient(colorMapEntries); - } - - - add(scrollPane); - - } - - private JScrollPane getInterval(TreeMap<Double,Color> colorMapEntry_tm) throws Exception{ - - ColorsLabelLegendComponent component = new ColorsLabelLegendComponent(colorMapEntry_tm, noDataValue, rasterName); - component.setPreferredSize(new Dimension(200, 400)); - JPanel panel = new JPanel(new BorderLayout()); - panel.add(component); - panel.setVisible(true); - - JScrollPane sc = new JScrollPane(panel); - return sc; - - } - - private JScrollPane getGradient(TreeMap<Double,Color> colorMapEntry) throws Exception{ - - GradientLabelLegendComponent component = new GradientLabelLegendComponent(colorMapEntry, noDataValue, rasterName); - JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); - panel.add(component); - panel.setVisible(true); - - JScrollPane sc = new JScrollPane(panel); - - return sc; - - } - - private final RasterSymbology rasterStyler; - private final double noDataValue; - private final String rasterName; - private final java.util.ResourceBundle bundle = - java.util.ResourceBundle.getBundle("org/openjump/core/rasterimage/styler/resources/Bundle"); // NOI18N - - - -} Modified: core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterStylesDialog.form =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterStylesDialog.form 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterStylesDialog.form 2015-06-23 12:29:52 UTC (rev 4506) @@ -263,7 +263,7 @@ </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="3" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="20" insetsBottom="5" insetsRight="0" anchor="21" weightX="0.0" weightY="0.0"/> + <GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="5" insetsRight="5" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> @@ -278,9 +278,24 @@ </Events> <Constraints> <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> - <GridBagConstraints gridX="3" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="0" insetsBottom="5" insetsRight="20" anchor="22" weightX="1.0" weightY="0.0"/> + <GridBagConstraints gridX="2" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="5" insetsRight="5" anchor="10" weightX="0.0" weightY="0.0"/> </Constraint> </Constraints> </Component> + <Component class="javax.swing.JButton" name="jButton_OK"> + <Properties> + <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> + <ResourceString bundle="com/geomaticaeambiente/openjump/rasterstyles/resources/Bundle.properties" key="RasterStylesDialog.jButton_OK.text" replaceFormat="java.util.ResourceBundle.getBundle("{bundleNameSlashes}").getString("{key}")"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_OKActionPerformed"/> + </Events> + <Constraints> + <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> + <GridBagConstraints gridX="3" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="5" insetsLeft="5" insetsBottom="5" insetsRight="5" anchor="10" weightX="0.0" weightY="0.0"/> + </Constraint> + </Constraints> + </Component> </SubComponents> </Form> Modified: core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterStylesDialog.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterStylesDialog.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/ui/RasterStylesDialog.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -2,6 +2,7 @@ import com.vividsolutions.jump.util.Range; import com.vividsolutions.jump.workbench.WorkbenchContext; +import com.vividsolutions.jump.workbench.model.LayerEventType; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -69,6 +70,7 @@ jButton_Cancel = new javax.swing.JButton(); jButton_Restore = new javax.swing.JButton(); jButton_Apply = new javax.swing.JButton(); + jButton_OK = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setMinimumSize(new java.awt.Dimension(420, 450)); @@ -220,10 +222,9 @@ } }); gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; + gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_START; - gridBagConstraints.insets = new java.awt.Insets(5, 20, 5, 0); + gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(jButton_Restore, gridBagConstraints); jButton_Apply.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jButton_Apply.text")); // NOI18N @@ -233,13 +234,23 @@ } }); gridBagConstraints = new java.awt.GridBagConstraints(); - gridBagConstraints.gridx = 3; + gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; - gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END; - gridBagConstraints.weightx = 1.0; - gridBagConstraints.insets = new java.awt.Insets(5, 0, 5, 20); + gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(jButton_Apply, gridBagConstraints); + jButton_OK.setText(bundle.getString("org.openjump.core.rasterimage.styler.ui.RasterStylesDialog.jButton_OK.text")); // NOI18N + jButton_OK.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton_OKActionPerformed(evt); + } + }); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 3; + gridBagConstraints.gridy = 2; + gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); + getContentPane().add(jButton_OK, gridBagConstraints); + pack(); }// </editor-fold>//GEN-END:initComponents @@ -262,9 +273,9 @@ }//GEN-LAST:event_jCheckBox_NoDataValueActionPerformed private void jButton_CancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_CancelActionPerformed - GUIUtils.clearRasterStylerFromBlackBoard(context); - setVisible(false); + closeDialog(); + }//GEN-LAST:event_jButton_CancelActionPerformed private void jButton_ApplyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_ApplyActionPerformed @@ -293,6 +304,18 @@ } }//GEN-LAST:event_jButton_RestoreActionPerformed + + private void jButton_OKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OKActionPerformed + + //Update raster image and close + try { + updateRasterImageLayer(); + closeDialog(); + } catch (Exception ex) { + Logger.getLogger(RasterStylesDialog.class.getName()).log(Level.SEVERE, null, ex); + } + + }//GEN-LAST:event_jButton_OKActionPerformed private void fixComponents() throws Exception{ @@ -349,13 +372,21 @@ } //add RasterSimbolizer Object in BlackBoard, the key is the name of raster plus suffixBBoardKey var. - String bboardKey = GUIUtils.getBBKey(rasterImageLayer.getImageFileName()); + String bboardKey = GUIUtils.getBBKey(String.valueOf(rasterImageLayer.getUUID())); context.getBlackboard().put(bboardKey, this); - rasterImageLayer.setSymbology(finalRasterSymbolizer); + context.getLayerManager().fireLayerChanged(rasterImageLayer, LayerEventType.APPEARANCE_CHANGED); + } + private void closeDialog() { + + GUIUtils.clearRasterStylerFromBlackBoard(context); + setVisible(false); + + } + private void restoreToOriginal() throws NoninvertibleTransformException { rasterImageLayer.setSymbology(null); @@ -371,6 +402,7 @@ private javax.swing.JButton jButton_Apply; private javax.swing.JButton jButton_Cancel; private javax.swing.JButton jButton_NoDataValueColor; + private javax.swing.JButton jButton_OK; private javax.swing.JButton jButton_Restore; private javax.swing.JCheckBox jCheckBox_NoDataValue; private javax.swing.JLabel jLabel_Transp_0; Modified: core/trunk/src/org/openjump/core/rasterimage/styler/ui/SingleValuesPanel.java =================================================================== --- core/trunk/src/org/openjump/core/rasterimage/styler/ui/SingleValuesPanel.java 2015-06-23 11:42:46 UTC (rev 4505) +++ core/trunk/src/org/openjump/core/rasterimage/styler/ui/SingleValuesPanel.java 2015-06-23 12:29:52 UTC (rev 4506) @@ -259,7 +259,7 @@ public RasterSymbology getRasterSymbolizer() throws Exception{ - RasterSymbology rasterSymbolizer = new RasterSymbology(RasterSymbology.ColorMapType.INTERVALS); + RasterSymbology rasterSymbolizer = new RasterSymbology(RasterSymbology.ColorMapType.SINGLE); for (ColorMapEntry colorMapEntry : colorsTablePanel.getColorMapEntries()) { rasterSymbolizer.addColorMapEntry(colorMapEntry.getUpperValue(), colorMapEntry.getColor()); } ------------------------------------------------------------------------------ Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical & virtual servers, alerts via email & sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel