Re: [Geotools-gt2-users] Programmatically retrieving a feature property name

2009-03-06 Thread Benoît Thiébault
Got it !
I will try to keep a low profile ;-)

But it's true I'm trying to understand all the tricks behind styling.  
It is really performance bottleneck.
Did you know that drawing a 1 pixel width Line String was much faster  
than a 2 pixel width Line String ?
In my particular case, refreshing the map pane took approximately 1.5s  
instead of 3.5s... (my map contains 180 000 colored Line Strings)

Le 6 mars 09 à 05:17, Michael Bedward a écrit :

 You better watch out Ben... soon all of the really tricky styling
 questions are going to be directed to you :-)

 Michael





--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


Re: [Geotools-gt2-users] Programmatically retrieving a feature property name

2009-03-05 Thread Justin Deoliveira
Hi Benoît,

Looking at the style builder classes, it does not seem to be possible, 
as it does not expose a method that creates a stroke from an Expression. 
  However you can get at the underlying style factory 
(getStyleFactory()), and should be able to manually build up the 
symbolizer, creating the stroke with a property expression. The downside 
being that it will take 3 or 4 lines of code to build up the symbolizer 
manually, instead of calling a single method on the builder.

-Justin

Benoît Thiébault wrote:
 Hi everyone,
 
 I am trying to build a style programmatically, and I would like the  
 color of my line symbolizer to be retrieved from a feature attribute,  
 like in the SLD sample below.
 Do you know how to do this ?
 
 UserStyle
   FeatureTypeStyle
Rule
   LineSymbolizer
   Stroke
   CssParameter name=\stroke\
   
 PropertyNamecolor/PropertyName
   /CssParameter
   CssParameter 
 name=\width\1.0/CssParameter
   /Stroke
   /LineSymbolizer
   /Rule
   /FeatureTypeStyle
 /UserStyle
 
 Here is my code so far:
 
 // Create the style
 Style style = null;
 
 // Create the style builder and the filter factory
 StyleBuilder sb = new StyleBuilder();
 
 // Creates the line symbolizer
 LineSymbolizer symbolizer = sb.createLineSymbolizer(Color.decode(???));
 
 // Creates a rule
 Rule rule = sb.createRule(symbolizer);
 
 // Creates a feature style
 FeatureTypeStyle fts = sb.createFeatureTypeStyle(typeName, rule);
 
 // Creates the style
 style = sb.createStyle();
 
 // Adds the feature style to the style
 style.addFeatureTypeStyle(fts);
 
 --
 Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
 -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
 -Strategies to boost innovation and cut costs with open source participation
 -Receive a $600 discount off the registration fee with the source code: SFAD
 http://p.sf.net/sfu/XcvMzF8H
 ___
 Geotools-gt2-users mailing list
 Geotools-gt2-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


Re: [Geotools-gt2-users] Programmatically retrieving a feature property name

2009-03-05 Thread Benoît Thiébault
Hi Justin,

In fact, I just found a way to do it :

// Temporary style
Style style = null;

// Style builder
StyleBuilder sb = new StyleBuilder();

// Line symbolizer stroke
Stroke stroke = sb.createStroke(sb.attributeExpression(color),  
sb.literalExpression(2.0));

// Line symbolizer
LineSymbolizer lineSymbolizer = sb.createLineSymbolizer(stroke);

// Creates the style
style = sb.createStyle(lineSymbolizer);

Le 5 mars 09 à 21:33, Justin Deoliveira a écrit :

 Hi Benoît,

 Looking at the style builder classes, it does not seem to be  
 possible, as it does not expose a method that creates a stroke from  
 an Expression.  However you can get at the underlying style factory  
 (getStyleFactory()), and should be able to manually build up the  
 symbolizer, creating the stroke with a property expression. The  
 downside being that it will take 3 or 4 lines of code to build up  
 the symbolizer manually, instead of calling a single method on the  
 builder.

 -Justin

 Benoît Thiébault wrote:
 Hi everyone,
 I am trying to build a style programmatically, and I would like  
 the  color of my line symbolizer to be retrieved from a feature  
 attribute,  like in the SLD sample below.
 Do you know how to do this ?
 UserStyle
  FeatureTypeStyle
   Rule
  LineSymbolizer
  Stroke
  CssParameter name=\stroke\
  
 PropertyNamecolor/PropertyName
  /CssParameter
  CssParameter 
 name=\width\1.0/CssParameter
  /Stroke
  /LineSymbolizer
  /Rule
  /FeatureTypeStyle
 /UserStyle
 Here is my code so far:
 // Create the style
 Style style = null;
 // Create the style builder and the filter factory
 StyleBuilder sb = new StyleBuilder();
 // Creates the line symbolizer
 LineSymbolizer symbolizer =  
 sb.createLineSymbolizer(Color.decode(???));
 // Creates a rule
 Rule rule = sb.createRule(symbolizer);
 // Creates a feature style
 FeatureTypeStyle fts = sb.createFeatureTypeStyle(typeName, rule);
 // Creates the style
 style = sb.createStyle();
 // Adds the feature style to the style
 style.addFeatureTypeStyle(fts);
 --
 Open Source Business Conference (OSBC), March 24-25, 2009, San  
 Francisco, CA
 -OSBC tackles the biggest issue in open source: Open Sourcing the  
 Enterprise
 -Strategies to boost innovation and cut costs with open source  
 participation
 -Receive a $600 discount off the registration fee with the source  
 code: SFAD
 http://p.sf.net/sfu/XcvMzF8H
 ___
 Geotools-gt2-users mailing list
 Geotools-gt2-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


 -- 
 Justin Deoliveira
 OpenGeo - http://opengeo.org
 Enterprise support for open source geospatial.


Benoît Thiébault

   Société Artenum
   24 rue Louis Blanc, 75010 Paris
   tel: +33 (0)1 46 94 67 54

   Artenum - Science  Groupware - http://www.artenum.com


--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


Re: [Geotools-gt2-users] Programmatically retrieving a feature property name

2009-03-05 Thread Justin Deoliveira
Aha, very nice, much better than my suggestion :).

-Justin

Benoît Thiébault wrote:
 Hi Justin,
 
 In fact, I just found a way to do it :
 
 // Temporary style
 Style style = null;
 
 // Style builder
 StyleBuilder sb = new StyleBuilder();
 
 // Line symbolizer stroke
 Stroke stroke = sb.createStroke(sb.attributeExpression(color), 
 sb.literalExpression(2.0));

 // Line symbolizer
 LineSymbolizer lineSymbolizer = sb.createLineSymbolizer(stroke);
 
 // Creates the style
 style = sb.createStyle(lineSymbolizer);
 
 Le 5 mars 09 à 21:33, Justin Deoliveira a écrit :
 
 Hi Benoît,

 Looking at the style builder classes, it does not seem to be possible, 
 as it does not expose a method that creates a stroke from an 
 Expression.  However you can get at the underlying style factory 
 (getStyleFactory()), and should be able to manually build up the 
 symbolizer, creating the stroke with a property expression. The 
 downside being that it will take 3 or 4 lines of code to build up the 
 symbolizer manually, instead of calling a single method on the builder.

 -Justin

 Benoît Thiébault wrote:
 Hi everyone,
 I am trying to build a style programmatically, and I would like the  
 color of my line symbolizer to be retrieved from a feature 
 attribute,  like in the SLD sample below.
 Do you know how to do this ?
 UserStyle
 FeatureTypeStyle
  Rule
 LineSymbolizer
 Stroke
 CssParameter name=\stroke\
 PropertyNamecolor/PropertyName
 /CssParameter
 CssParameter name=\width\1.0/CssParameter
 /Stroke
 /LineSymbolizer
 /Rule
 /FeatureTypeStyle
 /UserStyle
 Here is my code so far:
 // Create the style
 Style style = null;
 // Create the style builder and the filter factory
 StyleBuilder sb = new StyleBuilder();
 // Creates the line symbolizer
 LineSymbolizer symbolizer = sb.createLineSymbolizer(Color.decode(???));
 // Creates a rule
 Rule rule = sb.createRule(symbolizer);
 // Creates a feature style
 FeatureTypeStyle fts = sb.createFeatureTypeStyle(typeName, rule);
 // Creates the style
 style = sb.createStyle();
 // Adds the feature style to the style
 style.addFeatureTypeStyle(fts);
 --
  

 Open Source Business Conference (OSBC), March 24-25, 2009, San 
 Francisco, CA
 -OSBC tackles the biggest issue in open source: Open Sourcing the 
 Enterprise
 -Strategies to boost innovation and cut costs with open source 
 participation
 -Receive a $600 discount off the registration fee with the source 
 code: SFAD
 http://p.sf.net/sfu/XcvMzF8H
 ___
 Geotools-gt2-users mailing list
 Geotools-gt2-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


 -- 
 Justin Deoliveira
 OpenGeo - http://opengeo.org
 Enterprise support for open source geospatial.

 
 Benoît Thiébault
 
   Société Artenum
   24 rue Louis Blanc, 75010 Paris
   tel: +33 (0)1 46 94 67 54
 
   Artenum - Science  Groupware - http://www.artenum.com
 


-- 
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users


Re: [Geotools-gt2-users] Programmatically retrieving a feature property name

2009-03-05 Thread Michael Bedward
You better watch out Ben... soon all of the really tricky styling
questions are going to be directed to you :-)

Michael

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users