Revision: 4456
          http://sourceforge.net/p/jump-pilot/code/4456
Author:   ma15569
Date:     2015-05-20 17:44:56 +0000 (Wed, 20 May 2015)
Log Message:
-----------
Correct bug described by Uwe (Apply or Ok on Change Image Properties and the 
image disappears). Now the plugin has two behaviors:
a) if selected raster is a Single band raster, it opens three panels 
(transparency, Scale and Ratser Color Editor)
b) if the selected raster is not a single band raster, it opens only two panels 
(transparency and Scale)
Possible other LUTs to multiple bands raster can be applied by RAster>Raster 
color editor

Modified Paths:
--------------
    
core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/ChangeRasterImagePropertiesPlugIn.java
    
core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/panel/RasterColorEditorPanel.java

Modified: 
core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/ChangeRasterImagePropertiesPlugIn.java
===================================================================
--- 
core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/ChangeRasterImagePropertiesPlugIn.java
 2015-05-19 19:04:01 UTC (rev 4455)
+++ 
core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/ChangeRasterImagePropertiesPlugIn.java
 2015-05-20 17:44:56 UTC (rev 4456)
@@ -73,9 +73,15 @@
         final RasterColorEditorPanel rascolorpanel = new 
RasterColorEditorPanel(
                 context, rLayer);
 
-        stylePanels.add(rasstyle);
-        stylePanels.add(rasterScalepanel);
-        stylePanels.add(rascolorpanel);
+        if (rLayer.getNumBands() == 1) {
+            stylePanels.add(rasstyle);
+            stylePanels.add(rasterScalepanel);
+            stylePanels.add(rascolorpanel);
+        } else {
+            stylePanels.add(rasstyle);
+            stylePanels.add(rasterScalepanel);
+            // stylePanels.add(rascolorpanel);
+        }
 
         JTabbedPane tabbedPane = new JTabbedPane();
 
@@ -111,9 +117,15 @@
         dialog.addOKCancelApplyPanelActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent e) {
                 if (dialog.wasApplyPressed()) {
-                    rasterScalepanel.updateStyles();
-                    rasstyle.updateStyles();
-                    rascolorpanel.updateStyles();
+                    if (rLayer.getNumBands() == 1) {
+                        rasterScalepanel.updateStyles();
+                        rasstyle.updateStyles();
+                        rascolorpanel.updateStyles();
+                    } else {
+                        rasterScalepanel.updateStyles();
+                        rasstyle.updateStyles();
+                        // rascolorpanel.updateStyles();
+                    }
                 }
             }
         });
@@ -123,9 +135,15 @@
         dialog.setVisible(true);
 
         if (dialog.wasOKPressed()) {
-            rasterScalepanel.updateStyles();
-            rasstyle.updateStyles();
-            rascolorpanel.updateStyles();
+            if (rLayer.getNumBands() == 1) {
+                rasterScalepanel.updateStyles();
+                rasstyle.updateStyles();
+                rascolorpanel.updateStyles();
+            } else {
+                rasterScalepanel.updateStyles();
+                rasstyle.updateStyles();
+                // rascolorpanel.updateStyles();
+            }
             return true;
         }
         return false;

Modified: 
core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/panel/RasterColorEditorPanel.java
===================================================================
--- 
core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/panel/RasterColorEditorPanel.java
      2015-05-19 19:04:01 UTC (rev 4455)
+++ 
core/trunk/src/org/openjump/core/ui/plugin/layer/pirolraster/panel/RasterColorEditorPanel.java
      2015-05-20 17:44:56 UTC (rev 4456)
@@ -153,76 +153,70 @@
 
         setLayout(layout);
 
-         
-            // Giuseppe Aruta - 2015_4_21
-            // First panel: show statistics of cells of the layer
-            // Deactivate for now
-            statisticPanel.setBorder(BorderFactory
-                    .createTitledBorder(STATISTICS));
-            nodataField = new 
JTextField(String.valueOf(layer.getNoDataValue()));
-            nodataField.setEditable(false);
-            maxdataField = new JTextField(String.valueOf(layer.getMetadata()
-                    .getStats().getMax(0)));
-            maxdataField.setEditable(false);
-            mindataField = new JTextField(String.valueOf(layer.getMetadata()
-                    .getStats().getMin(0)));
-            mindataField.setEditable(false);
-            JLabel nd_label = new JLabel(NODATA);
-            JLabel min_label = new JLabel(MIN);
-            JLabel max_label = new JLabel(MAX);
-            FormUtils.addRowInGBL(statisticPanel, 1, 0, nd_label, nodataField);
-            FormUtils
-                    .addRowInGBL(statisticPanel, 1, 2, min_label, 
mindataField);
-            FormUtils
-                    .addRowInGBL(statisticPanel, 1, 4, max_label, 
maxdataField);
-            // add(statisticPanel, BorderLayout.PAGE_START);
+        // Giuseppe Aruta - 2015_4_21
+        // First panel: show statistics of cells of the layer
+        // Deactivate for now
+        statisticPanel.setBorder(BorderFactory.createTitledBorder(STATISTICS));
+        nodataField = new JTextField(String.valueOf(layer.getNoDataValue()));
+        nodataField.setEditable(false);
+        maxdataField = new JTextField(String.valueOf(layer.getMetadata()
+                .getStats().getMax(0)));
+        maxdataField.setEditable(false);
+        mindataField = new JTextField(String.valueOf(layer.getMetadata()
+                .getStats().getMin(0)));
+        mindataField.setEditable(false);
+        JLabel nd_label = new JLabel(NODATA);
+        JLabel min_label = new JLabel(MIN);
+        JLabel max_label = new JLabel(MAX);
+        FormUtils.addRowInGBL(statisticPanel, 1, 0, nd_label, nodataField);
+        FormUtils.addRowInGBL(statisticPanel, 1, 2, min_label, mindataField);
+        FormUtils.addRowInGBL(statisticPanel, 1, 4, max_label, maxdataField);
+        // add(statisticPanel, BorderLayout.PAGE_START);
 
-            // Giuseppe Aruta - 2015_4_21
-            // Second panel: Change color model
-            strechedPanel.setBorder(border);
-            strechedPanel.setLayout(gridBagLayout);
-            colorScaleChooser = new JComboBox(colorTableList);
-            final String selectedIndex = (String) colorScaleChooser
-                    .getSelectedItem();
-            colorScaleChooser.setSelectedItem(selectedIndex);
-            colorScaleChooser.setToolTipText(sToolTip); //$NON-NLS-1$
-            colorScaleChooser.setBorder(borderRaised);
-            FormUtils.addRowInGBL(strechedPanel, 2, 0, colorScaleChooser);
+        // Giuseppe Aruta - 2015_4_21
+        // Second panel: Change color model
+        strechedPanel.setBorder(border);
+        strechedPanel.setLayout(gridBagLayout);
+        colorScaleChooser = new JComboBox(colorTableList);
+        final String selectedIndex = (String) colorScaleChooser
+                .getSelectedItem();
+        colorScaleChooser.setSelectedItem(selectedIndex);
+        colorScaleChooser.setToolTipText(sToolTip); //$NON-NLS-1$
+        colorScaleChooser.setBorder(borderRaised);
+        FormUtils.addRowInGBL(strechedPanel, 2, 0, colorScaleChooser);
 
-            fromValueLabel = new JLabel(sFromValue);
-            toValueLabel = new JLabel(sToValue); //$NON-NLS-1$
-            fromValue = new JTextField(Double.toString(layer.getMetadata()
-                    .getStats().getMin(0)), 15);
-            fromValue.setCaretPosition(0);
-            fromValue.selectAll();
-            toValue = new JTextField(Double.toString(layer.getMetadata()
-                    .getStats().getMax(0)), 15);
-            toValue.setCaretPosition(0);
-            toValue.selectAll();
-            FormUtils.addRowInGBL(strechedPanel, 3, 0, fromValueLabel,
-                    toValueLabel);
-            FormUtils.addRowInGBL(strechedPanel, 4, 0, fromValue, toValue);
+        fromValueLabel = new JLabel(sFromValue);
+        toValueLabel = new JLabel(sToValue); //$NON-NLS-1$
+        fromValue = new JTextField(Double.toString(layer.getMetadata()
+                .getStats().getMin(0)), 15);
+        fromValue.setCaretPosition(0);
+        fromValue.selectAll();
+        toValue = new JTextField(Double.toString(layer.getMetadata().getStats()
+                .getMax(0)), 15);
+        toValue.setCaretPosition(0);
+        toValue.selectAll();
+        FormUtils
+                .addRowInGBL(strechedPanel, 3, 0, fromValueLabel, 
toValueLabel);
+        FormUtils.addRowInGBL(strechedPanel, 4, 0, fromValue, toValue);
 
-            invertBox = new JCheckBox(INVERT);
-            invertBox.setSelected(false);
-            FormUtils.addRowInGBL(strechedPanel, 5, 0, invertBox);
+        invertBox = new JCheckBox(INVERT);
+        invertBox.setSelected(false);
+        FormUtils.addRowInGBL(strechedPanel, 5, 0, invertBox);
 
-            new JLabel(NUMBER);
+        new JLabel(NUMBER);
 
-            /*
-             * Text field to choose number of intervals. Deactivated. Chooser =
-             * new JTextField("11", 15); Chooser.setColumns(4);
-             * Chooser.setSize(4, 4); // Chooser.setCaretPosition(0);
-             * FormUtils.addRowInGBL(strechedPanel, 6, 0, classes, Chooser);
-             */
+        /*
+         * Text field to choose number of intervals. Deactivated. Chooser = new
+         * JTextField("11", 15); Chooser.setColumns(4); Chooser.setSize(4, 4);
+         * // Chooser.setCaretPosition(0); FormUtils.addRowInGBL(strechedPanel,
+         * 6, 0, classes, Chooser);
+         */
 
-            transparentBox = new JCheckBox(TRANSPARENT);
-            transparentBox.setSelected(false);
-            FormUtils.addRowInGBL(strechedPanel, 7, 0, transparentBox);
-            add(strechedPanel, BorderLayout.NORTH);
+        transparentBox = new JCheckBox(TRANSPARENT);
+        transparentBox.setSelected(false);
+        FormUtils.addRowInGBL(strechedPanel, 7, 0, transparentBox);
+        add(strechedPanel, BorderLayout.NORTH);
 
-        
-
     }
 
     public String getTitle() {
@@ -285,7 +279,7 @@
         switch (colorScaleChooser.getSelectedIndex()) {
 
         case 0: {
-            valuesColors = null;
+            valuesColors = new Color[] { Color.BLACK, Color.WHITE };
             break;
         }
         case 1: {


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel

Reply via email to