Re: [JPP-Devel] New WMS Layer legend plugin on OpenJUMP

2015-06-05 Thread Giuseppe Aruta
I think also that  Kosmo request to WMS Styles and Legends starts probably
together with a  WMS layer request. Since I didn't want to modify any
original WMS OJ classes, OJ WMS legend plugin calls after a WMS is loaded.
Infact there is a small delay on OJ whenever a user ask for a legend,
comparing to the same process on Kosmo

2015-06-05 9:54 GMT+02:00 Giuseppe Aruta giuseppe.ar...@gmail.com:

 Hi Jukka,
 thanks for the quick answer.
 Regarding user/password of WMS, I can see that the code comes from
 SelectUrlWithAuthPanel.class but I don't see where these datas are stored
 on WMS classes ( or maybe not, they are only asked at the beginning of the
 WMS request process).


 This plugin is relatively simple. If you have time you can see the code on
 class org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.

 The core of legend request is Line 71, the String
 getLegendUrl(PlugInContext context, String names).
 The String is divided into 3 parts:
 a) PlugInContext refers to WMS layer where to extract the URL calling
 layer.getService().getServerUrl().
 b) while String names is the name of the WMS layer.
 c) the rest of the code calls GetLegendGraphic, Version, etc, including
 some graphical components for the legend.

 I don't have experience with WMS. I understood from your code (
 https://username:pas...@site.fi/cgi-bin/service1?) that that
 user/password should before the the server URL string (part a of String
 getLegendUrl) .
 If so, and if OJ memorize somewhere those datas, it should be easy to
 modify this String to get Legends from WMS withcredentials.
 Otherwhise I should build ad hoc another panel where users have to enter
 those info again.

 Regarding ChangeWMSStyleDialogPlugIn, I gave a look to it thinking to port
 to OpenJUMP.  While GetLegend is relatively easy as it is shown a new image
 on a separate panel, for the Style it should redraw the workbench. Which I
 still don't know how to do.

 I really appreciate any comment or help on the code from you.

 Best Regards

 Peppe


 2015-06-04 17:56 GMT+02:00 Rahkonen Jukka (MML) 
 jukka.rahko...@maanmittauslaitos.fi:

  Hi Peppe,



 Seems to work with Geoserver and it generates also a correct URL for
 Mapserver so it should work. However, there is some little issue with sites
 using basic authentication. I think that the plugin is sending the request
 without credentials or something like that. Note that the error log shows
 URL as

 URL: https://username:pas...@site.fi/cgi-bin/service1? and if I copy the
 whole URL into browser I get the legend graphics. However, OpenJUMP gets an
 http 401 “not authorized” response.





 javax.imageio.IIOException: Can't get input stream from URL!

  at javax.imageio.ImageIO.read(Unknown Source)

  at
 org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.getLegendPanel(WMSLegendPlugIn.java:150)

  at
 org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.execute(WMSLegendPlugIn.java:48)

  at
 com.vividsolutions.jump.workbench.plugin.AbstractPlugIn$1.actionPerformed(AbstractPlugIn.java:342)

  at
 javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

  at
 javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

  at
 javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

  at
 javax.swing.DefaultButtonModel.setPressed(Unknown Source)

  at
 javax.swing.AbstractButton.doClick(Unknown Source)

  at
 javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

  at
 javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)

  at
 java.awt.Component.processMouseEvent(Unknown Source)

  at
 javax.swing.JComponent.processMouseEvent(Unknown Source)

  at java.awt.Component.processEvent(Unknown
 Source)

  at java.awt.Container.processEvent(Unknown
 Source)

  at
 java.awt.Component.dispatchEventImpl(Unknown Source)

  at
 java.awt.Container.dispatchEventImpl(Unknown Source)

  at java.awt.Component.dispatchEvent(Unknown
 Source)

  at
 java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

  at
 java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

  at
 java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

  at
 java.awt.Container.dispatchEventImpl(Unknown Source)

  at java.awt.Window.dispatchEventImpl(Unknown
 Source)

  at java.awt.Component.dispatchEvent(Unknown
 Source)

   

Re: [JPP-Devel] Fwd: Fwd: NullPointerException Change Raster Image Properties

2015-06-05 Thread Uwe Dalluege
Hi Peppe,

thank you for your long explanation
of the problem.

Sorry, but I am not able to decide which solution is the best.
In the moment I do not use the RasterRaster Color Editor...
with my students.
This was only a test for me to decide, whether
I can use it for my lessons.
But it does not work correctly, you know.

Please ask the OJ community which solution is the best.

Have a nice weekend!

Uwe

Am 05.06.2015 um 10:22 schrieb Giuseppe Aruta:
 Hi everybody,
 this is a dialog between Uwe about the possibility to deactivate a
 plugin (RasterColor Editor) as it was substituded by the new Raster
 Image tree menuRaster Layer PropertiesRaster Color Editor Panel*.
 *
 My mistake thatthis dialog remained between Uwe and I*.
 *
 I would like the opinion of the other developers
 thanks
 Peppe




 -- Forwarded message --
 From: *Giuseppe Aruta* giuseppe.ar...@gmail.com
 mailto:giuseppe.ar...@gmail.com
 Date: 2015-06-04 17:53 GMT+02:00
 Subject: Re: [JPP-Devel] Fwd: NullPointerException Change Raster Image
 Properties
 To: uwe.dallu...@hcu-hamburg.de mailto:uwe.dallu...@hcu-hamburg.de


 Hi Uwe,
 I checked the code of **RasterRaster Color Editor* *(original
 plugin)*. *It seems that the new raster improvements broke its
 capability to restore original color scheme. And I don't want to make
 any change as those improvements have been applied to other
 classes/plugins, which have no described bugs.
 There are some solutions, I will describe them after a brief description
 of how and when to apply those plugins (sorry for the boringness and
 redundancy)

 *Actual situation:*
 _Single Band Raster_. to apply color schemas on these files, an user
 should use Raster Image tree menuRaster Layer PropertiesRaster Color
 Editor Panel* *(derived plugin)).  It is possible to restore the
 Default Colors of a DEM (since these files have no default color
 schema, OJ adopted a standard  B/Grays/W ramp). This derived plugin has
 also more options and color schemas that the original one.

 _Raster with multiple bands_. the original plugin affects (and affected)
 only the Band num. 0, which is usually the red channel on image files.
 The other channels (blue and green) are hidden. This behaviour has a few
 application, I feel, on raster analysis.
 On the other hand the option to restore default color doesn't work,
 because of the raster framework improvements. Alberto, if he reads these
 notes, can probably explain better than I do.
 The derived plugin is not activated if a multi-band raster is selected.

 *Possible solutions*:
 If you need to use the original plugin. Or  you need to use false color
 schemas on multi-band rasters, there are a couple of option that we can
 discuss about:

 a)  I can add modify the code in order that, when user choose Default
 color, the raster layer is reloaded with its original color schemas
 (RGB). In this case the original plugin is saved.

 b) I can add a plugin that divide RGB channels of an Image into separate
 single band rasters, than user can apply color schemas using the derived
 plugin. In this case I would deactivate the original plugin.

 I am waiting for your opinion about. Your experience with the students
 is important. In my opinion I woulddeactivate the original plugin in
 order not to confuse users.

 Best regards

 Peppe


 2015-06-01 14:24 GMT+02:00 Uwe Dalluege uwe.dallu...@hcu-hamburg.de
 mailto:uwe.dallu...@hcu-hamburg.de:

 ... I hope you will have nice free days!

 uwe

 Am 01.06.2015 tel:01.06.2015 um 13:51 schrieb Giuseppe Aruta:

 Hi Uwe,
 Thanks for hte test.I was aware of that bug. It was corrected on
 Raster
 Layer PropertiesRaster Color Editor layer menu but not on the
 RasterRaster Color Editor one.
 I am out for a couples of days. I will give a look when I will
 be back home
 Best regards
 Peppe

 2015-06-01 11:16 GMT+02:00 Uwe Dalluege
 uwe.dallu...@hcu-hamburg.de mailto:uwe.dallu...@hcu-hamburg.de
 mailto:uwe.dallu...@hcu-hamburg.de
 mailto:uwe.dallu...@hcu-hamburg.de:


  Hi Peppe,

  sorry for answering so late but I was on holiday :-)

  I have some problems with RasterRaster Color Editor...
  in OJ r.4471.

  1. Open with Sextante Raster Image my orthoGC.tif
  2. Select the RasterLayer and then RasterRaster Color
 Editor...
  3. The Raster Color Editor Panel appears.
  4. Click to the Ok button and the image disappears!
  5. Zooming in or out and the image appears.
  6. Now choosing another color combination, maybe Black-White.
  7. The Black-White image appears immediately.
  8. Choosing Default colors the image disappears!
  9. Zooming in or out and the image appears with Black-White
  but not with the Default colors.

  Kind regards

 

Re: [JPP-Devel] New WMS Layer legend plugin on OpenJUMP

2015-06-05 Thread Giuseppe Aruta
Hi Jukka,
can you send me a WMS url with relative User/Password? I want to check a
possibility to set them on asking GetLegendGraphic URL
Peppe

2015-06-05 9:59 GMT+02:00 Giuseppe Aruta giuseppe.ar...@gmail.com:

 I think also that  Kosmo request to WMS Styles and Legends starts probably
 together with a  WMS layer request. Since I didn't want to modify any
 original WMS OJ classes, OJ WMS legend plugin calls after a WMS is loaded.
 Infact there is a small delay on OJ whenever a user ask for a legend,
 comparing to the same process on Kosmo

 2015-06-05 9:54 GMT+02:00 Giuseppe Aruta giuseppe.ar...@gmail.com:

 Hi Jukka,
 thanks for the quick answer.
 Regarding user/password of WMS, I can see that the code comes from
 SelectUrlWithAuthPanel.class but I don't see where these datas are stored
 on WMS classes ( or maybe not, they are only asked at the beginning of the
 WMS request process).


 This plugin is relatively simple. If you have time you can see the code
 on class org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.

 The core of legend request is Line 71, the String
 getLegendUrl(PlugInContext context, String names).
 The String is divided into 3 parts:
 a) PlugInContext refers to WMS layer where to extract the URL calling
 layer.getService().getServerUrl().
 b) while String names is the name of the WMS layer.
 c) the rest of the code calls GetLegendGraphic, Version, etc, including
 some graphical components for the legend.

 I don't have experience with WMS. I understood from your code (
 https://username:pas...@site.fi/cgi-bin/service1?) that that
 user/password should before the the server URL string (part a of String
 getLegendUrl) .
 If so, and if OJ memorize somewhere those datas, it should be easy to
 modify this String to get Legends from WMS withcredentials.
 Otherwhise I should build ad hoc another panel where users have to
 enter those info again.

 Regarding ChangeWMSStyleDialogPlugIn, I gave a look to it thinking to
 port to OpenJUMP.  While GetLegend is relatively easy as it is shown a new
 image on a separate panel, for the Style it should redraw the workbench.
 Which I still don't know how to do.

 I really appreciate any comment or help on the code from you.

 Best Regards

 Peppe


 2015-06-04 17:56 GMT+02:00 Rahkonen Jukka (MML) 
 jukka.rahko...@maanmittauslaitos.fi:

  Hi Peppe,



 Seems to work with Geoserver and it generates also a correct URL for
 Mapserver so it should work. However, there is some little issue with sites
 using basic authentication. I think that the plugin is sending the request
 without credentials or something like that. Note that the error log shows
 URL as

 URL: https://username:pas...@site.fi/cgi-bin/service1? and if I copy
 the whole URL into browser I get the legend graphics. However, OpenJUMP
 gets an http 401 “not authorized” response.





 javax.imageio.IIOException: Can't get input stream from URL!

  at javax.imageio.ImageIO.read(Unknown
 Source)

  at
 org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.getLegendPanel(WMSLegendPlugIn.java:150)

  at
 org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.execute(WMSLegendPlugIn.java:48)

  at
 com.vividsolutions.jump.workbench.plugin.AbstractPlugIn$1.actionPerformed(AbstractPlugIn.java:342)

  at
 javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

  at
 javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

  at
 javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

  at
 javax.swing.DefaultButtonModel.setPressed(Unknown Source)

  at
 javax.swing.AbstractButton.doClick(Unknown Source)

  at
 javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

  at
 javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)

  at
 java.awt.Component.processMouseEvent(Unknown Source)

  at
 javax.swing.JComponent.processMouseEvent(Unknown Source)

  at java.awt.Component.processEvent(Unknown
 Source)

  at java.awt.Container.processEvent(Unknown
 Source)

  at
 java.awt.Component.dispatchEventImpl(Unknown Source)

  at
 java.awt.Container.dispatchEventImpl(Unknown Source)

  at java.awt.Component.dispatchEvent(Unknown
 Source)

  at
 java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

  at
 java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

  at
 java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

  at
 

Re: [JPP-Devel] New WMS Layer legend plugin on OpenJUMP

2015-06-05 Thread Giuseppe Aruta
Hi Jukka,
thanks for the quick answer.
Regarding user/password of WMS, I can see that the code comes from
SelectUrlWithAuthPanel.class but I don't see where these datas are stored
on WMS classes ( or maybe not, they are only asked at the beginning of the
WMS request process).


This plugin is relatively simple. If you have time you can see the code on
class org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.

The core of legend request is Line 71, the String
getLegendUrl(PlugInContext context, String names).
The String is divided into 3 parts:
a) PlugInContext refers to WMS layer where to extract the URL calling
layer.getService().getServerUrl().
b) while String names is the name of the WMS layer.
c) the rest of the code calls GetLegendGraphic, Version, etc, including
some graphical components for the legend.

I don't have experience with WMS. I understood from your code (
https://username:pas...@site.fi/cgi-bin/service1?) that that user/password
should before the the server URL string (part a of String getLegendUrl) .
If so, and if OJ memorize somewhere those datas, it should be easy to
modify this String to get Legends from WMS withcredentials.
Otherwhise I should build ad hoc another panel where users have to enter
those info again.

Regarding ChangeWMSStyleDialogPlugIn, I gave a look to it thinking to port
to OpenJUMP.  While GetLegend is relatively easy as it is shown a new image
on a separate panel, for the Style it should redraw the workbench. Which I
still don't know how to do.

I really appreciate any comment or help on the code from you.

Best Regards

Peppe


2015-06-04 17:56 GMT+02:00 Rahkonen Jukka (MML) 
jukka.rahko...@maanmittauslaitos.fi:

  Hi Peppe,



 Seems to work with Geoserver and it generates also a correct URL for
 Mapserver so it should work. However, there is some little issue with sites
 using basic authentication. I think that the plugin is sending the request
 without credentials or something like that. Note that the error log shows
 URL as

 URL: https://username:pas...@site.fi/cgi-bin/service1? and if I copy the
 whole URL into browser I get the legend graphics. However, OpenJUMP gets an
 http 401 “not authorized” response.





 javax.imageio.IIOException: Can't get input stream from URL!

  at javax.imageio.ImageIO.read(Unknown Source)

  at
 org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.getLegendPanel(WMSLegendPlugIn.java:150)

  at
 org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.execute(WMSLegendPlugIn.java:48)

  at
 com.vividsolutions.jump.workbench.plugin.AbstractPlugIn$1.actionPerformed(AbstractPlugIn.java:342)

  at
 javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

  at
 javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)

  at
 javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

  at
 javax.swing.DefaultButtonModel.setPressed(Unknown Source)

  at javax.swing.AbstractButton.doClick(Unknown
 Source)

  at
 javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

  at
 javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)

  at
 java.awt.Component.processMouseEvent(Unknown Source)

  at
 javax.swing.JComponent.processMouseEvent(Unknown Source)

  at java.awt.Component.processEvent(Unknown
 Source)

  at java.awt.Container.processEvent(Unknown
 Source)

  at
 java.awt.Component.dispatchEventImpl(Unknown Source)

  at
 java.awt.Container.dispatchEventImpl(Unknown Source)

  at java.awt.Component.dispatchEvent(Unknown
 Source)

  at
 java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

  at
 java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

  at
 java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

  at
 java.awt.Container.dispatchEventImpl(Unknown Source)

  at java.awt.Window.dispatchEventImpl(Unknown
 Source)

  at java.awt.Component.dispatchEvent(Unknown
 Source)

  at
 java.awt.EventQueue.dispatchEventImpl(Unknown Source)

  at java.awt.EventQueue.access$200(Unknown
 Source)

  at java.awt.EventQueue$3.run(Unknown Source)

  at java.awt.EventQueue$3.run(Unknown Source)

  at
 java.security.AccessController.doPrivileged(Native Method)

 

[JPP-Devel] SVN: [4475] core/trunk/src/com/vividsolutions/jump/workbench/ui/ TreeLayerNamePanel.java

2015-06-05 Thread jump-pilot-svn
Revision: 4475
  http://sourceforge.net/p/jump-pilot/code/4475
Author:   edso
Date: 2015-06-05 08:28:53 + (Fri, 05 Jun 2015)
Log Message:
---
remove spurious import

Modified Paths:
--
core/trunk/src/com/vividsolutions/jump/workbench/ui/TreeLayerNamePanel.java

Modified: 
core/trunk/src/com/vividsolutions/jump/workbench/ui/TreeLayerNamePanel.java
===
--- core/trunk/src/com/vividsolutions/jump/workbench/ui/TreeLayerNamePanel.java 
2015-06-04 13:16:46 UTC (rev 4474)
+++ core/trunk/src/com/vividsolutions/jump/workbench/ui/TreeLayerNamePanel.java 
2015-06-05 08:28:53 UTC (rev 4475)
@@ -83,7 +83,6 @@
 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.stringtree.util.tree.Tree;
 
 public class TreeLayerNamePanel extends JPanel implements LayerListener,
 LayerNamePanel, LayerableNamePanel, LayerNamePanelProxy, PopupNodeProxy {


--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] Fwd: Fwd: NullPointerException Change Raster Image Properties

2015-06-05 Thread Giuseppe Aruta
Hi everybody,
this is a dialog between Uwe about the possibility to deactivate a plugin
(RasterColor Editor) as it was substituded by the new Raster Image tree
menuRaster Layer PropertiesRaster Color Editor Panel
*.*
My mistake that this dialog remained between Uwe and I
*.*
I would like the opinion of the other developers
thanks
Peppe




-- Forwarded message --
From: Giuseppe Aruta giuseppe.ar...@gmail.com
Date: 2015-06-04 17:53 GMT+02:00
Subject: Re: [JPP-Devel] Fwd: NullPointerException Change Raster Image
Properties
To: uwe.dallu...@hcu-hamburg.de


Hi Uwe,
I checked the code of  RasterRaster Color Editor* *(original plugin)*. *It
seems that the new raster improvements broke its capability to restore
original color scheme. And I don't want to make any change as those
improvements have been applied to other classes/plugins, which have no
described bugs.
There are some solutions, I will describe them after a brief description of
how and when to apply those plugins (sorry for the boringness and
redundancy)

*Actual situation:*
*Single Band Raster*. to apply color schemas on these files, an user should
use Raster Image tree menuRaster Layer PropertiesRaster Color Editor
Panel* *(derived plugin)).  It is possible to restore the Default Colors
of a DEM (since these files have no default color schema, OJ adopted a
standard  B/Grays/W ramp). This derived plugin has also more options and
color schemas that the original one.

*Raster with multiple bands*. the original plugin affects (and affected)
only the Band num. 0, which is usually the red channel on image files. The
other channels (blue and green) are hidden. This behaviour has a few
application, I feel, on raster analysis.
On the other hand the option to restore default color doesn't work,
because of the raster framework improvements. Alberto, if he reads these
notes, can probably explain better than I do.
The derived plugin is not activated if a multi-band raster is selected.

*Possible solutions*:
If you need to use the original plugin. Or  you need to use false color
schemas on multi-band rasters, there are a couple of option that we can
discuss about:

a)  I can add modify the code in order that, when user choose Default
color, the raster layer is reloaded with its original color schemas (RGB).
In this case the original plugin is saved.

b) I can add a plugin that divide RGB channels of an Image into separate
single band rasters, than user can apply color schemas using the derived
plugin. In this case I would deactivate the original plugin.

I am waiting for your opinion about. Your experience with the students is
important. In my opinion I would deactivate the original plugin in order
not to confuse users.

Best regards

Peppe


2015-06-01 14:24 GMT+02:00 Uwe Dalluege uwe.dallu...@hcu-hamburg.de:

 ... I hope you will have nice free days!

 uwe

 Am 01.06.2015 um 13:51 schrieb Giuseppe Aruta:

 Hi Uwe,
 Thanks for hte test.I was aware of that bug. It was corrected on Raster
 Layer PropertiesRaster Color Editor layer menu but not on the
 RasterRaster Color Editor one.
 I am out for a couples of days. I will give a look when I will be back
 home
 Best regards
 Peppe

 2015-06-01 11:16 GMT+02:00 Uwe Dalluege uwe.dallu...@hcu-hamburg.de
 mailto:uwe.dallu...@hcu-hamburg.de:


 Hi Peppe,

 sorry for answering so late but I was on holiday :-)

 I have some problems with RasterRaster Color Editor...
 in OJ r.4471.

 1. Open with Sextante Raster Image my orthoGC.tif
 2. Select the RasterLayer and then RasterRaster Color Editor...
 3. The Raster Color Editor Panel appears.
 4. Click to the Ok button and the image disappears!
 5. Zooming in or out and the image appears.
 6. Now choosing another color combination, maybe Black-White.
 7. The Black-White image appears immediately.
 8. Choosing Default colors the image disappears!
 9. Zooming in or out and the image appears with Black-White
 but not with the Default colors.

 Kind regards

 Uwe


 Am 23.05.2015 um 21:41 schrieb Giuseppe Aruta:

 Hi Uwe,
 I just gave a look on the code again to correct an annoying bug on
 Raster Color Editor: the elements of this panel were randomly
 appearing
 on  Raster transparency panel when a Single band raster was
 selected.
 Now the Dialog (only for Single band raster) is smaller as there
 is no
 need of the Select Color transparency for those files (it was
 not
 working anyhow).
 Nothing is changed if an image is selected.
 I also added a new option on Raster Color Editor panel to switch
 between
 ramp and interval color model, something embryonic, thanks to
 the new
 raster framework/classes that Alberto (one member of this list)
 added to
 OpenJUMP. I hope one day he can give a look and make something
 more
 professional than my work.
  

[JPP-Devel] SVN: [4477] core/trunk/src/org/openjump/core/ui/plugin/wms/WMSLegendPlugIn. java

2015-06-05 Thread jump-pilot-svn
Revision: 4477
  http://sourceforge.net/p/jump-pilot/code/4477
Author:   edso
Date: 2015-06-05 10:44:40 + (Fri, 05 Jun 2015)
Log Message:
---
enable WMSLegendPlugin for _one_ selected WMSLayer only

Modified Paths:
--
core/trunk/src/org/openjump/core/ui/plugin/wms/WMSLegendPlugIn.java

Modified: core/trunk/src/org/openjump/core/ui/plugin/wms/WMSLegendPlugIn.java
===
--- core/trunk/src/org/openjump/core/ui/plugin/wms/WMSLegendPlugIn.java 
2015-06-05 10:25:46 UTC (rev 4476)
+++ core/trunk/src/org/openjump/core/ui/plugin/wms/WMSLegendPlugIn.java 
2015-06-05 10:44:40 UTC (rev 4477)
@@ -172,7 +172,7 @@
 
 return new MultiEnableCheck().add(
 checkFactory.createWindowWithLayerNamePanelMustBeActiveCheck())
-.add(checkFactory.createAtLeastNLayerablesMustBeSelectedCheck(
+.add(checkFactory.createExactlyNLayerablesMustBeSelectedCheck(
 1, WMSLayer.class));
 }
 


--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] New WMS Layer legend plugin on OpenJUMP

2015-06-05 Thread edgar . soldin
hey Peppe,

while playing around with the plugin i stumbled over two issues

1. the plugin was enabled even if multiple wms layers were selected. this is 
fixed now in trunk.
2. the dialogs accumulate. every time a new one gets created. you should 
update/reuse existing legends per layer.

additionally i suggest you implement the dialogs as detachable internal frames. 
this way they will be listed in the 'Windows' main menu and the user can decide 
where to place them.

nice addition ..ede

On 04.06.2015 15:24, Giuseppe Aruta wrote:
 Dear Jumpers,
 I added on OpenJUMP a new plugin that displays WMS layer(s) legend (if 
 available) on a Dialog.
 This plugin is located on WMS Layer tree context menu, as Show WMS Layer 
 Legend.
 The code originally came from Kosmo SAIG and it was completely rewritten in 
 order to adapt WMS GetLegendGraphic and GetStyle operators without modifing 
 OJ WMS classes.
 
 Best Regards
 
 Peppe
 
 
 
 --
 
 
 
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel
 

--
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] SVN: [4476] core/trunk/src

2015-06-05 Thread jump-pilot-svn
Revision: 4476
  http://sourceforge.net/p/jump-pilot/code/4476
Author:   edso
Date: 2015-06-05 10:25:46 + (Fri, 05 Jun 2015)
Log Message:
---
make WMSLegendPlugIn reuse the existing WMSRequest classes to support basic 
auth out of the box

Modified Paths:
--
core/trunk/src/com/vividsolutions/wms/MapRequest.java
core/trunk/src/org/openjump/core/ui/plugin/wms/WMSLegendPlugIn.java

Added Paths:
---
core/trunk/src/com/vividsolutions/wms/AbstractBasicRequest.java

Added: core/trunk/src/com/vividsolutions/wms/AbstractBasicRequest.java
===
--- core/trunk/src/com/vividsolutions/wms/AbstractBasicRequest.java 
(rev 0)
+++ core/trunk/src/com/vividsolutions/wms/AbstractBasicRequest.java 
2015-06-05 10:25:46 UTC (rev 4476)
@@ -0,0 +1,92 @@
+package com.vividsolutions.wms;
+
+import java.awt.Image;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.List;
+import java.util.Map.Entry;
+
+import javax.imageio.ImageIO;
+
+import net.iharder.Base64;
+
+import org.openjump.util.UriUtil;
+
+abstract public class AbstractBasicRequest {
+
+  protected WMService service;
+  protected String version = WMService.WMS_1_1_1;
+  
+  protected AbstractBasicRequest(WMService service) {
+this.service = service;
+  }
+
+  /**
+   * Gets the WMService that this object will make requests from.
+   * @return the WMService that this object will make requests from
+   */
+  public WMService getService() {
+  return service;
+  }
+  
+  /**
+   * must be implemented according to the specific needs
+   * @return URL
+   * @throws MalformedURLException
+   */
+  abstract public URL getURL() throws MalformedURLException;
+  
+  /**
+   * Connect to the service and get an Image of the map.
+   * @return the retrieved map Image
+   */
+   public Image getImage() throws IOException {
+   URL requestUrl = getURL();
+   URLConnection con = requestUrl.openConnection();
+   if(requestUrl.getUserInfo() != null)
+   con.setRequestProperty(Authorization, Basic  +
+   
Base64.encodeBytes(UriUtil.urlDecode(requestUrl.getUserInfo()).getBytes()));
+
+   boolean isImage = false;
+   //System.out.println(requestUrl);
+   for (EntryString, ListString entry : 
con.getHeaderFields().entrySet()) {
+   
+ String key = entry.getKey() != null ? entry.getKey() : ;
+ String value = null;
+ try {
+   value = entry.getValue().get(0).toString();
+ } catch (Exception e) {
+ }
+   
+// System.out.println(key + / + value);
+   
+ if (key.matches(^(?i)Content-Type$)  
value.matches(^(?i)image/.*))
+   isImage = true;
+   }
+   
+   if (isImage)
+ return ImageIO.read(con.getInputStream());
+   
+   readConnection(con);
+   return null;
+   }
+   
+   private void readConnection(URLConnection con) throws IOException {
+ BufferedReader reader = new BufferedReader(new 
InputStreamReader(con.getInputStream()));
+ StringBuilder result = new StringBuilder();
+ String line;
+ while((line = reader.readLine()) != null) {
+ result.append(line);
+ }
+ System.out.println(result.toString());
+   }
+   
+   //UT
+   public void setVersion( String ver ){
+   this.version = ver;
+   }
+}


Property changes on: 
core/trunk/src/com/vividsolutions/wms/AbstractBasicRequest.java
___
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: core/trunk/src/com/vividsolutions/wms/MapRequest.java
===
--- core/trunk/src/com/vividsolutions/wms/MapRequest.java   2015-06-05 
08:28:53 UTC (rev 4475)
+++ core/trunk/src/com/vividsolutions/wms/MapRequest.java   2015-06-05 
10:25:46 UTC (rev 4476)
@@ -59,25 +59,23 @@
  * Represents all of the parameters of a getMap request from a WMS server.
  * @author Chris Hodgson chodg...@refractions.net
  */
-public class MapRequest {
+public class MapRequest extends AbstractBasicRequest{
 
 private static Logger LOG = Logger.getLogger(MapRequest.class);
   
-private WMService service;
 private int imgWidth;
 private int imgHeight;
 private ListString layerNames;
 private BoundingBox bbox;
 private boolean transparent;
 private String format;
-private String version = WMService.WMS_1_1_1;
 
 /**
  * Creates a new MapRequest.
  * @param service the WMService which this MapRequest will use
  */
 public MapRequest(WMService service) {
-this.service = service;
+super(service);
 imgWidth = 100;
 imgHeight = 100;
 

Re: [JPP-Devel] New WMS Layer legend plugin on OpenJUMP

2015-06-05 Thread edgar . soldin
hey Peppe,

check r4476. i made it reuse the existing WMSRequest classes to avoid 
implementing additional http auth code.

..ede

On 05.06.2015 11:01, Giuseppe Aruta wrote:
 Hi Jukka,
 can you send me a WMS url with relative User/Password? I want to check a 
 possibility to set them on asking GetLegendGraphic URL
 Peppe
 
 2015-06-05 9:59 GMT+02:00 Giuseppe Aruta giuseppe.ar...@gmail.com 
 mailto:giuseppe.ar...@gmail.com:
 
 I think also that  Kosmo request to WMS Styles and Legends starts 
 probably together with a  WMS layer request. Since I didn't want to modify 
 any original WMS OJ classes, OJ WMS legend plugin calls after a WMS is loaded.
 Infact there is a small delay on OJ whenever a user ask for a legend, 
 comparing to the same process on Kosmo
 
 2015-06-05 9:54 GMT+02:00 Giuseppe Aruta giuseppe.ar...@gmail.com 
 mailto:giuseppe.ar...@gmail.com:
 
 Hi Jukka,
 thanks for the quick answer.
 Regarding user/password of WMS, I can see that the code comes from 
 SelectUrlWithAuthPanel.class but I don't see where these datas are stored on 
 WMS classes ( or maybe not, they are only asked at the beginning of the WMS 
 request process).
 
 
 This plugin is relatively simple. If you have time you can see the 
 code on class org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.
 
 The core of legend request is Line 71, the String   
 getLegendUrl(PlugInContext context, String names).
 The String is divided into 3 parts:
 a) PlugInContext refers to WMS layer where to extract the URL calling 
  layer.getService().getServerUrl().
 b) while String names is the name of the WMS layer.
 c) the rest of the code calls GetLegendGraphic, Version, etc, 
 including some graphical components for the legend.
 
 I don't have experience with WMS. I understood from your code 
 (https://username:pas...@site.fi/cgi-bin/service1?) that that user/password 
 should before the the server URL string (part a of String getLegendUrl) .
 If so, and if OJ memorize somewhere those datas, it should be easy to 
 modify this String to get Legends from WMS withcredentials.
 Otherwhise I should build ad hoc another panel where users have to 
 enter those info again.
 
 Regarding ChangeWMSStyleDialogPlugIn, I gave a look to it thinking to 
 port to OpenJUMP.  While GetLegend is relatively easy as it is shown a new 
 image on a separate panel, for the Style it should redraw the workbench. 
 Which I still don't know how to do.
 
 I really appreciate any comment or help on the code from you.
 
 Best Regards
 
 Peppe
 
 
 2015-06-04 17:56 GMT+02:00 Rahkonen Jukka (MML) 
 jukka.rahko...@maanmittauslaitos.fi 
 mailto:jukka.rahko...@maanmittauslaitos.fi:
 
 Hi Peppe,
 
 __ __
 
 Seems to work with Geoserver and it generates also a correct URL 
 for Mapserver so it should work. However, there is some little issue with 
 sites using basic authentication. I think that the plugin is sending the 
 request without credentials or something like that. Note that the error log 
 shows URL as
 
 URL: https://username:pas...@site.fi/cgi-bin/service1? and if I 
 copy the whole URL into browser I get the legend graphics. However, OpenJUMP 
 gets an http 401 “not authorized” response.
 
 __ __
 
 __ __
 
 javax.imageio.IIOException: Can't get input stream from URL!
 
  at 
 javax.imageio.ImageIO.read(Unknown Source)
 
  at 
 org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.getLegendPanel(WMSLegendPlugIn.java:150)
 
  at 
 org.openjump.core.ui.plugin.wms.WMSLegendPlugIn.execute(WMSLegendPlugIn.java:48)
 
  at 
 com.vividsolutions.jump.workbench.plugin.AbstractPlugIn$1.actionPerformed(AbstractPlugIn.java:342)
 
  at 
 javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
 
  at 
 javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
 
  at 
 javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
 
  at 
 javax.swing.DefaultButtonModel.setPressed(Unknown Source)
 
  at 
 javax.swing.AbstractButton.doClick(Unknown Source)
 
  at 
 javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
 
  at 
 javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown 
 Source)
 
  at 
 java.awt.Component.processMouseEvent(Unknown Source)
 
 

Re: [JPP-Devel] Fwd: Fwd: NullPointerException Change Raster Image Properties

2015-06-05 Thread Alberto De Luca - GeA

Hi everyone,

as you might know, I've been working (lately not much, to be honest) on 
a new raster styler. If you reckon it could be useful, I would be 
pleased to share it with you. I was hoping to improving it a bit more, 
but I see that I keep procrastinating...


The styler is an independent plugin (that I could easily incorporate 
into the core OJ if you want), you can find jar and source code here 
https://www.dropbox.com/sh/8ldfw5ue8v74awz/AAAiW0dJy3sznv4Crwm6geGZa?dl=0. 
I don't know if it can address all the needs of the OJ users, for 
example it's limited to 1-band rasters (1 bands rasters are handled as 
if they had only one band). In addition, it needs some testing.


Let me know!
Alberto



On 05/06/2015 10:31 AM, Uwe Dalluege wrote:

Hi Peppe,

thank you for your long explanation
of the problem.

Sorry, but I am not able to decide which solution is the best.
In the moment I do not use the RasterRaster Color Editor...
with my students.
This was only a test for me to decide, whether
I can use it for my lessons.
But it does not work correctly, you know.

Please ask the OJ community which solution is the best.

Have a nice weekend!

Uwe

Am 05.06.2015 um 10:22 schrieb Giuseppe Aruta:

Hi everybody,
this is a dialog between Uwe about the possibility to deactivate a
plugin (RasterColor Editor) as it was substituded by the new Raster
Image tree menuRaster Layer PropertiesRaster Color Editor Panel*.
*
My mistake thatthis dialog remained between Uwe and I*.
*
I would like the opinion of the other developers
thanks
Peppe




-- Forwarded message --
From: *Giuseppe Aruta* giuseppe.ar...@gmail.com
mailto:giuseppe.ar...@gmail.com
Date: 2015-06-04 17:53 GMT+02:00
Subject: Re: [JPP-Devel] Fwd: NullPointerException Change Raster Image
Properties
To: uwe.dallu...@hcu-hamburg.de mailto:uwe.dallu...@hcu-hamburg.de


Hi Uwe,
I checked the code of **RasterRaster Color Editor* *(original
plugin)*. *It seems that the new raster improvements broke its
capability to restore original color scheme. And I don't want to make
any change as those improvements have been applied to other
classes/plugins, which have no described bugs.
There are some solutions, I will describe them after a brief description
of how and when to apply those plugins (sorry for the boringness and
redundancy)

*Actual situation:*
_Single Band Raster_. to apply color schemas on these files, an user
should use Raster Image tree menuRaster Layer PropertiesRaster Color
Editor Panel* *(derived plugin)).  It is possible to restore the
Default Colors of a DEM (since these files have no default color
schema, OJ adopted a standard  B/Grays/W ramp). This derived plugin has
also more options and color schemas that the original one.

_Raster with multiple bands_. the original plugin affects (and affected)
only the Band num. 0, which is usually the red channel on image files.
The other channels (blue and green) are hidden. This behaviour has a few
application, I feel, on raster analysis.
On the other hand the option to restore default color doesn't work,
because of the raster framework improvements. Alberto, if he reads these
notes, can probably explain better than I do.
The derived plugin is not activated if a multi-band raster is selected.

*Possible solutions*:
If you need to use the original plugin. Or  you need to use false color
schemas on multi-band rasters, there are a couple of option that we can
discuss about:

a)  I can add modify the code in order that, when user choose Default
color, the raster layer is reloaded with its original color schemas
(RGB). In this case the original plugin is saved.

b) I can add a plugin that divide RGB channels of an Image into separate
single band rasters, than user can apply color schemas using the derived
plugin. In this case I would deactivate the original plugin.

I am waiting for your opinion about. Your experience with the students
is important. In my opinion I woulddeactivate the original plugin in
order not to confuse users.

Best regards

Peppe


2015-06-01 14:24 GMT+02:00 Uwe Dalluege uwe.dallu...@hcu-hamburg.de
mailto:uwe.dallu...@hcu-hamburg.de:

 ... I hope you will have nice free days!

 uwe

 Am 01.06.2015 tel:01.06.2015 um 13:51 schrieb Giuseppe Aruta:

 Hi Uwe,
 Thanks for hte test.I was aware of that bug. It was corrected on
 Raster
 Layer PropertiesRaster Color Editor layer menu but not on the
 RasterRaster Color Editor one.
 I am out for a couples of days. I will give a look when I will
 be back home
 Best regards
 Peppe

 2015-06-01 11:16 GMT+02:00 Uwe Dalluege
 uwe.dallu...@hcu-hamburg.de mailto:uwe.dallu...@hcu-hamburg.de
 mailto:uwe.dallu...@hcu-hamburg.de
 mailto:uwe.dallu...@hcu-hamburg.de:


  Hi Peppe,

  sorry for answering so late but I was on holiday :-)

  I have some problems with RasterRaster Color Editor...