Re: [JPP-Devel] Hi all

2009-09-21 Thread Sunburned Surveyor
Thanks for the suggestion Benjamin.

On Fri, Sep 18, 2009 at 6:29 AM, Benjamin Gudehus
hasteb...@googlemail.com wrote:
 Hallo Nils!

 I had the very same problem with ColorThemingStyle.

 To solve it you need to change the following two things

  1. With lyrTest.addStyle(ctStyle) an _additional_ style is added. It's
 better to modify the already
     existing styles (OpenJUMP creates these automaticly during the creation
 of the layer). This
     is possible for instance for ColorThemingStyles using the method
 ColorThemingStyle.get().

  2. To map the attribute values to colors you need to define two maps. One
 containing the colours for
     the values and another one containing its labels. Use the methods
 ColorThemingStyle
     .setAttributeValueToBasicStyleMap(), resp.
 ColorThemingStyle.setAttributeValueToLabelMap().

 Here's my code (in Groovy):

 code
     def colorThemingStyle = ColorThemingStyle.get(layer)
     colorThemingStyle.setAttributeName(ATTRIBUTE_NAME)
     colorThemingStyle.setDefaultStyle(new BasicStyle(Color.gray))
     colorThemingStyle.setAttributeValueToBasicStyleMap([
     0: new BasicStyle(Color.green),
     1: new BasicStyle(Color.red),
     ] as HashMap)
     colorThemingStyle.setAttributeValueToLabelMap([
     0: Linked,
     1: Not linked,
     ] as HashMap)
     colorThemingStyle.setEnabled(true)
     layer.fireAppearanceChanged()
 /code

 Hope this solves your problem :)

 Greetings from Hannover,

 Benjamin Gudehus

 Hi all,
 I am using OJ as a platform for developing GIS-solutions in implementing
 OJ-Plugins.
 I am doing this for maybe one and a half year and first I would like to
 thank everybody who participates in developing OJ now and in the past!


 There is a lot of great work in the code and I've learned a lot out of
 it yet.
 Now my question:
 I want to change the style of some layers programmatically and my first
 approach is like this:
 CODE


 Layer lyrTest = context.getLayerManager().getLayer(test);
 lyrTest.getBasicStyle().setEnabled(false);
 HashMap attributeToStyleMap = new HashMap();
 attributeToStyleMap.put(18, new BasicStyle(Color.red));


 attributeToStyleMap.put(19, new BasicStyle(Color.blue));
 attributeToStyleMap.put(20, new BasicStyle(Color.cyan));
 ColorThemingStyle ctStyle = new
 ColorThemingStyle(BGVNR,attributeToStyleMap,new BasicStyle(Color.gray));


 ctStyle.setEnabled(true);
 lyrTest.addStyle(ctStyle);
 lyrTest.fireAppearanceChanged();
 /CODE
 This example works fine and the LayerViewPanel shows the changed styles.
 But the OJ-standard-menu Change styles isn't updated (the colour


 theming isn't enabled and the Fill- and Line-Checkboxes are still set).
 How can I do that???
 I would be happy if anybody could help me!
 Nils


 --
 Come build with us! The BlackBerryreg; Developer Conference in SF, CA
 is the only developer event you need to attend this year. Jumpstart your
 developing skills, take BlackBerry mobile applications to market and stay
 ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
 http://p.sf.net/sfu/devconf
 ___
 Jump-pilot-devel mailing list
 Jump-pilot-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel



--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


Re: [JPP-Devel] Hi all

2009-09-18 Thread Benjamin Gudehus
Hallo Nils!

I had the very same problem with ColorThemingStyle.

To solve it you need to change the following two things

 1. With lyrTest.addStyle(ctStyle) an _additional_ style is added. It's
better to modify the already
existing styles (OpenJUMP creates these automaticly during the creation
of the layer). This
is possible for instance for ColorThemingStyles using the method
ColorThemingStyle.get().

 2. To map the attribute values to colors you need to define two maps. One
containing the colours for
the values and another one containing its labels. Use the methods
ColorThemingStyle
.setAttributeValueToBasicStyleMap(), resp.
ColorThemingStyle.setAttributeValueToLabelMap().

Here's my code (in Groovy):

code
def colorThemingStyle = ColorThemingStyle.get(layer)
colorThemingStyle.setAttributeName(ATTRIBUTE_NAME)
colorThemingStyle.setDefaultStyle(new BasicStyle(Color.gray))
colorThemingStyle.setAttributeValueToBasicStyleMap([
0: new BasicStyle(Color.green),
1: new BasicStyle(Color.red),
] as HashMap)
colorThemingStyle.setAttributeValueToLabelMap([
0: Linked,
1: Not linked,
] as HashMap)
colorThemingStyle.setEnabled(true)
layer.fireAppearanceChanged()
/code

Hope this solves your problem :)

Greetings from Hannover,

Benjamin Gudehus

Hi all,
 I am using OJ as a platform for developing GIS-solutions in implementing
 OJ-Plugins.
 I am doing this for maybe one and a half year and first I would like to
 thank everybody who participates in developing OJ now and in the past!

 There is a lot of great work in the code and I've learned a lot out of
 it yet.
 Now my question:
 I want to change the style of some layers programmatically and my first
 approach is like this:
 CODE

 Layer lyrTest = context.getLayerManager().getLayer(test);
 lyrTest.getBasicStyle().setEnabled(false);
 HashMap attributeToStyleMap = new HashMap();
 attributeToStyleMap.put(18, new BasicStyle(Color.red));

 attributeToStyleMap.put(19, new BasicStyle(Color.blue));
 attributeToStyleMap.put(20, new BasicStyle(Color.cyan));
 ColorThemingStyle ctStyle = new
 ColorThemingStyle(BGVNR,attributeToStyleMap,new BasicStyle(Color.gray));

 ctStyle.setEnabled(true);
 lyrTest.addStyle(ctStyle);
 lyrTest.fireAppearanceChanged();
 /CODE
 This example works fine and the LayerViewPanel shows the changed styles.
 But the OJ-standard-menu Change styles isn't updated (the colour

 theming isn't enabled and the Fill- and Line-Checkboxes are still set).
 How can I do that???
 I would be happy if anybody could help me!
 Nils


--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel


[JPP-Devel] Hi all

2009-09-17 Thread Nils Kuhn
Hi all,
I am using OJ as a platform for developing GIS-solutions in implementing 
OJ-Plugins.
I am doing this for maybe one and a half year and first I would like to 
thank everybody who participates in developing OJ now and in the past! 
There is a lot of great work in the code and I've learned a lot out of 
it yet.
Now my question:
I want to change the style of some layers programmatically and my first 
approach is like this:
CODE
Layer lyrTest = context.getLayerManager().getLayer(test);
lyrTest.getBasicStyle().setEnabled(false);
HashMap attributeToStyleMap = new HashMap();
attributeToStyleMap.put(18, new BasicStyle(Color.red));
attributeToStyleMap.put(19, new BasicStyle(Color.blue));
attributeToStyleMap.put(20, new BasicStyle(Color.cyan));
ColorThemingStyle ctStyle = new 
ColorThemingStyle(BGVNR,attributeToStyleMap,new BasicStyle(Color.gray));
ctStyle.setEnabled(true);
lyrTest.addStyle(ctStyle);
lyrTest.fireAppearanceChanged();
/CODE
This example works fine and the LayerViewPanel shows the changed styles. 
But the OJ-standard-menu Change styles isn't updated (the colour 
theming isn't enabled and the Fill- and Line-Checkboxes are still set).
How can I do that???
I would be happy if anybody could help me!
Nils


--
Come build with us! The BlackBerryreg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9#45;12, 2009. Register now#33;
http://p.sf.net/sfu/devconf
___
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel