Re: [Geotools-gt2-users] question from off list

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

jody.garnett
Dragging this back to the list; there is way too much content here for a private discussion.

The way you did it was fine (it was one of the two options I listed); we should however save those out as new classes (as the start of being able to parse an SE document). What I was talking about with bindings relates to this way of parsing:
- http://docs.codehaus.org/display/GEOTDOC/SLD+XML+Support

Instructions on how to make bindings are here (http://docs.codehaus.org/display/GEOTDOC/XML+Developers+Guide).

A question for you - on 2.6 we started supporting the SE data structure; with that in mind do we not already have UOM already (it should be represented as a Unit)? Yep here it is (http://geoapi.sourceforge.net/snapshot/javadoc/org/opengis/style/Symbolizer.html?is-external=true). Not this is using the JSR-275 units library so you can actually do some conversions....

Jody


On Sat, Feb 14, 2009 at 5:24 AM, Milton Jonathan <[hidden email]> wrote:
Hello Jody

Thanks for the tips and info!

On the bad side: I'm not sure what you meant with "SLD bindings" (and thus, how an SE bindings should look like). Sorry, no SLD-expert here.

On the good side: in the meantime, my colleague here has made a working preliminary support for UOM. I'm sending the modifications for you to take a look at. We basically did the following:
- Added getUOM and setUOM methods to the Symbolizer classes
- Changed the SLDParser and SLDTransformer classes to read and write the UOM parameter (I guess you would prefer some other way, please tell me how)
- Added a "UOMTypes" class with definitions such as UOMTypes.PIXEL, UOMTypes.FOOT, etc. These are basically things such as http://www.opengeospatial.org/se/units/pixel, etc.
- Updated the DuplicatingStyleVisitor to include the UOM parameter

I'm sending to you a diff file (related to tag 2.5.3), and a zip with the modified files as well. Please tell me what you think.

We also implemented a dummy rescaling method to test it just for PointSymbolizers, and it worked fine (yeah, point symbols grow and shrink when we zoom!). So we'll have something like a "UOMRescaleStyleVisitor", which receives a meter-to-pixel scaling value in its constructor, and applies that to rescale any symbolizer that happens to have UOM defined and different from pixel.

If you want, I can send you that code as well.

Thanks for all
Milton


Jody Garnett wrote:
The approach you document (transforming the SLD) is a sensible one. You can accomplish a similar thing with the Style objects directly - using a StyleVisitor class. There are two examples; one of which is used to "resize" a Style to account for changes in resolution when printing from uDig.

There are some notes in the wiki; and the classes serve as a good example.
- http://docs.codehaus.org/display/GEOTDOC/08+StyleVisitor+use+with+DuplicatingStyleVisitor+and+RescaleStyleVisitor

Have a look at the SLD binding; and see if we can make a new configuration that supports UOM.  Rather than modifying SLDParser directly we have two options:
- use the SLD bindings as a starting point and make our own SE bindings
- or copy the SLDParser and make an SEParser

In both these cases we could start with the UOM tag first

Cheers,
Jody


On Sat, Feb 7, 2009 at 4:50 AM, Milton Jonathan <[hidden email] <mailto:[hidden email]>> wrote:

   Hello Jody

   Hmm.. so, there are already some advances in 2.6? I should check that
   out then. Have you already included the UOM parameters in the
   SymbolizerImpl's, and added support for it in the SLDParser and
   SLDTransformer?

   Thing is, we were basing ourselves here on version 2.5.x, since we need
   a stable version for our products to be released this semester. In this
   respect, I imagine there are quite a few things to change in the code
   that uses GeoTools if we are to move to 2.6, right?

   So, do you think it makes sense for us to add right away this basic
   support for UOM in 2.5.x, and later migrate that to 2.6?

   I ask this because our first idea here, to get to see things working,
   was to do the following:
   - add this basic support, so that we can read and write .sld files with
   the UOM property set
   - before even looking at the style rendering code, we wanted to change
   our method that calls the GeoTools renderer, so that it would:
    . check for symbolizers with UOM parameters
    . change those Symbolizer sizes accordingly
    . call the GeoTools renderer with modified Styles that have the
   appropriate size (in pixels)

   What do you think?

   Cheers
   Milton

   Jody Garnett wrote:

       greeetings


       On Fri, Feb 6, 2009 at 12:12 AM, Milton Jonathan
       <[hidden email] <mailto:[hidden email]>
       <mailto:[hidden email]
       <mailto:[hidden email]>>> wrote:

          Hello Jody

          Down here we've also been playing with some ideas a little
       related to
          that topic.

          In the style arena, people here frequently want to display
       something
          like a 10km-wide circle (or star, or whatever) for their points -
          actually, they generally just want their symbols to scale
       accordingly
          when you zoom in and out.


       Right
                  In my view, this would correspond to a point symbolizer whose
       size is
          measured in km, instead of pixels. Happily, the SLD/SE
       specification
          does include this feature, called the UOM (Unit of Measure,
       not the
          lightsaber sound). The UOM can be defined as "pixel"
       (default), "meter",
          "foot", etc. It applies to any Symbolizer, and in theory it
       should be
          used not only to control its size as displayed on the map,
       but also its
          stroke width, font size, etc (see
          http://www.opengeospatial.org/standards/symbol, v.1.1.0, page
       14).

          Sadly, as far as I know GeoTools does not implement this part
       of the
          specification. Is that correct?


       We have an implementaiton of SLD 1.0; we are starting to
       assemble the 1.1.0 data structure on trunk and you are welcome
       to help out. There is strong support for UOM converstions so you
       will not be stuck  when you go to that part.


          If that is the case, I think we may be willing to spend some
       time to add
          this capability, at least for PointSymbolizers. What do you
       think?


       Sounds good; you will need to go through the usual geotools
       process - there are a couple maintainers for the renderer module
       so you should be able to get a review in short order.

       Cheers,
       Jody


   --
   Milton Jonathan
   Grupo GIS e Meio Ambiente
   Tecgraf/PUC-Rio
   Tel: +55-21-3527-2502



--

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3527-2502

Index: main/src/main/java/org/geotools/styling/LineSymbolizerImpl.java
===================================================================
--- main/src/main/java/org/geotools/styling/LineSymbolizerImpl.java     (revision 32424)
+++ main/src/main/java/org/geotools/styling/LineSymbolizerImpl.java     (working copy)
@@ -1,9 +1,9 @@
 /*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
- *
+ *
 *    (C) 2002-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
@@ -33,6 +33,7 @@
 public class LineSymbolizerImpl implements LineSymbolizer, Cloneable {
    private Stroke stroke = null;
    private String geometryName = null;
+    private String uom = null;

    /**
     * Creates a new instance of DefaultLineSymbolizer
@@ -96,6 +97,14 @@
        this.stroke = stroke;
    }

+    public String getUOM() {
+               return uom;
+       }
+
+       public void setUOM(String uom) {
+               this.uom = uom;
+       }
+
    /**
     * Accepts a StyleVisitor to perform some operation on this LineSymbolizer.
     *
@@ -141,6 +150,10 @@
            result = (PRIME * result) + stroke.hashCode();
        }

+        if (uom != null) {
+            result = (PRIME * result) + uom.hashCode();
+        }
+
        if (geometryName != null) {
            result = (PRIME * result) + geometryName.hashCode();
        }
@@ -150,7 +163,7 @@

    /**
     * Compares this LineSymbolizerImpl with another for  equality.
-     *
+     *
     * <p>
     * Two LineSymbolizerImpls are equal if they have the same
     * geometryPropertyName and the same stroke.
@@ -185,11 +198,8 @@
            }
        }

-        if(!Utilities.equals( getStroke(), other.getStroke())){
-            return false;
-        }
-
-        return true;
+        return Utilities.equals( getStroke(), other.getStroke())
+                       && Utilities.equals(uom, other.uom);
    }
    public String toString() {
        StringBuffer buf = new StringBuffer();
Index: main/src/main/java/org/geotools/styling/PointSymbolizerImpl.java
===================================================================
--- main/src/main/java/org/geotools/styling/PointSymbolizerImpl.java    (revision 32424)
+++ main/src/main/java/org/geotools/styling/PointSymbolizerImpl.java    (working copy)
@@ -1,9 +1,9 @@
 /*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
- *
+ *
 *    (C) 2002-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
@@ -33,6 +33,7 @@
 public class PointSymbolizerImpl implements PointSymbolizer, Cloneable {
    private String geometryPropertyName = null;
    private Graphic graphic = new GraphicImpl();
+    private String uom = null;

    /**
     * Creates a new instance of DefaultPointSymbolizer
@@ -84,6 +85,14 @@
        visitor.visit(this);
    }

+    public String getUOM() {
+               return uom;
+       }
+
+       public void setUOM(String uom) {
+               this.uom = uom;
+       }
+
    /**
     * Creates a deep copy clone.
     *
@@ -117,6 +126,10 @@
            result = (PRIME * result) + geometryPropertyName.hashCode();
        }

+        if (uom != null) {
+            result = (PRIME * result) + uom.hashCode();
+        }
+
        if (graphic != null) {
            result = (PRIME * result) + graphic.hashCode();
        }
@@ -126,12 +139,12 @@

    /**
     * Checks this PointSymbolizerImpl with another for equality.
-     *
+     *
     * <p>
     * Two PointSymbolizers are equal if the have the same geometry property
     * name and their graphic object is equal.
     * </p>
-     *
+     *
     * <p>
     * Note: this method only works for other instances of PointSymbolizerImpl,
     * not other implementors of PointSymbolizer
@@ -152,7 +165,8 @@

            return Utilities.equals(geometryPropertyName,
                other.geometryPropertyName)
-            && Utilities.equals(graphic, other.graphic);
+            && Utilities.equals(graphic, other.graphic)
+            && Utilities.equals(uom, other.uom);
        }

        return false;
Index: main/src/main/java/org/geotools/styling/PolygonSymbolizerImpl.java
===================================================================
--- main/src/main/java/org/geotools/styling/PolygonSymbolizerImpl.java  (revision 32424)
+++ main/src/main/java/org/geotools/styling/PolygonSymbolizerImpl.java  (working copy)
@@ -1,9 +1,9 @@
 /*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
- *
+ *
 *    (C) 2002-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
@@ -34,6 +34,7 @@
    private Fill fill = new FillImpl();
    private Stroke stroke = new StrokeImpl();
    private String geometryPropertyName = null;
+    private String uom = null;

    /**
     * Creates a new instance of DefaultPolygonStyler
@@ -118,6 +119,16 @@
        this.stroke = stroke;
    }

+    public String getUOM() {
+
+               return uom;
+       }
+
+       public void setUOM(String uom) {
+               this.uom = uom;
+
+       }
+
    /**
     * Accepts a StyleVisitor to perform some operation on this LineSymbolizer.
     *
@@ -148,6 +159,10 @@
            if (stroke != null) {
                clone.stroke = (Stroke) ((Cloneable) stroke).clone();
            }
+
+            if (uom != null) {
+                clone.uom = (String) uom.substring(0);
+            }
        } catch (CloneNotSupportedException e) {
            throw new RuntimeException(e); // this should never happen.
        }
@@ -172,6 +187,10 @@
            result = (PRIME * result) + getStroke().hashCode();
        }

+        if (getUOM() != null) {
+            result = (PRIME * result) + getUOM().hashCode();
+        }
+
        if (geometryPropertyName != null) {
            result = (PRIME * result) + geometryPropertyName.hashCode();
        }
@@ -181,7 +200,7 @@

    /**
     * Compares this PolygonSymbolizerImpl with another.
-     *
+     *
     * <p>
     * Two PolygonSymbolizerImpls are equal if they have the same
     * geometryProperty, fill and stroke.
@@ -202,7 +221,8 @@
            return Utilities.equals(this.geometryPropertyName,
                other.geometryPropertyName)
            && Utilities.equals(fill, other.fill)
-            && Utilities.equals(stroke, other.stroke);
+            && Utilities.equals(stroke, other.stroke)
+            && Utilities.equals(uom, other.uom);
        }

        return false;
Index: main/src/main/java/org/geotools/styling/RasterSymbolizerImpl.java
===================================================================
--- main/src/main/java/org/geotools/styling/RasterSymbolizerImpl.java   (revision 32424)
+++ main/src/main/java/org/geotools/styling/RasterSymbolizerImpl.java   (working copy)
@@ -1,9 +1,9 @@
 /*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
- *
+ *
 *    (C) 2002-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
@@ -40,6 +40,7 @@
    private Symbolizer symbolizer;
    private Expression opacity;
    private Expression overlap;
+    private String uom = null;

    public RasterSymbolizerImpl(){
        this( CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints()));
@@ -60,6 +61,8 @@
        key = (key * 13) + opacity.hashCode();
        key = (key * 13) + overlap.hashCode();
        key = (key * 13) + geometryName.hashCode();
+        if(uom != null)
+               key = (key * 13) + uom.hashCode();

        return key;
    }
@@ -393,6 +396,14 @@
        this.shadedRelief = shadedRelief;
    }

+    public String getUOM() {
+               return uom;
+       }
+
+       public void setUOM(String uom) {
+               this.uom = uom;
+       }
+
    public void accept(StyleVisitor visitor) {
        visitor.visit(this);
    }
Index: main/src/main/java/org/geotools/styling/SLDParser.java
===================================================================
--- main/src/main/java/org/geotools/styling/SLDParser.java      (revision 32424)
+++ main/src/main/java/org/geotools/styling/SLDParser.java      (working copy)
@@ -1,9 +1,9 @@
 /*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
- *
+ *
 *    (C) 2005-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
@@ -45,9 +45,9 @@

 /**
 * TODO: This really needs to be container ready
- *
+ *
 * @author jgarnett
- *
+ *
 * @source $URL:
 *         http://svn.geotools.org/geotools/trunk/gt/modules/library/main/src/main/java/org/geotools/styling/SLDParser.java $
 */
@@ -57,21 +57,23 @@
            .getLogger("org.geotools.styling");

    private static final String channelSelectionString = "ChannelSelection";
-
+
    private static final String graphicSt = "Graphic"; // to make pmd to shut up

    private static final String geomString = "Geometry"; // to make pmd to shut up

    private static final String fillSt = "Fill";
-
+
+    private static final String uomString = "uom";
+
    private static final String opacityString="Opacity";

    private static final String overlapBehaviorString = "OverlapBehavior";

    private static final String colorMapString = "ColorMap";
-
+
    private static final String colorMapOpacityString="opacity";
-
+
    private static final String colorMapColorString = "color";

    private static final String contrastEnhancementString = "ContrastEnhancement";
@@ -98,7 +100,7 @@

    /**
     * Create a Stylereader - use if you already have a dom to parse.
-     *
+     *
     * @param factory
     *                The StyleFactory to use to build the style
     */
@@ -114,12 +116,12 @@

    /**
     * Creates a new instance of SLDStyler
-     *
+     *
     * @param factory
     *                The StyleFactory to use to read the file
     * @param filename
     *                The file to be read.
-     *
+     *
     * @throws java.io.FileNotFoundException -
     *                 if the file is missing
     */
@@ -133,12 +135,12 @@

    /**
     * Creates a new SLDStyle object.
-     *
+     *
     * @param factory
     *                The StyleFactory to use to read the file
     * @param f
     *                the File to be read
-     *
+     *
     * @throws java.io.FileNotFoundException -
     *                 if the file is missing
     */
@@ -150,12 +152,12 @@

    /**
     * Creates a new SLDStyle object.
-     *
+     *
     * @param factory
     *                The StyleFactory to use to read the file
     * @param url
     *                the URL to be read.
-     *
+     *
     * @throws java.io.IOException -
     *                 if something goes wrong reading the file
     */
@@ -167,7 +169,7 @@

    /**
     * Creates a new SLDStyle object.
-     *
+     *
     * @param factory
     *                The StyleFactory to use to read the file
     * @param s
@@ -180,7 +182,7 @@

    /**
     * Creates a new SLDStyle object.
-     *
+     *
     * @param factory
     *                The StyleFactory to use to read the file
     * @param r
@@ -193,10 +195,10 @@

    /**
     * set the file to read the SLD from
-     *
+     *
     * @param filename
     *                the file to read the SLD from
-     *
+     *
     * @throws java.io.FileNotFoundException
     *                 if the file is missing
     */
@@ -212,10 +214,10 @@

    /**
     * Sets the file to use to read the SLD from
-     *
+     *
     * @param f
     *                the file to use
-     *
+     *
     * @throws java.io.FileNotFoundException
     *                 if the file is missing
     */
@@ -230,10 +232,10 @@

    /**
     * sets an URL to read the SLD from
-     *
+     *
     * @param url
     *                the url to read the SLD from
-     *
+     *
     * @throws java.io.IOException
     *                 If anything goes wrong opening the url
     */
@@ -244,7 +246,7 @@

    /**
     * Sets the input stream to read the SLD from
-     *
+     *
     * @param in
     *                the inputstream used to read the SLD from
     */
@@ -254,7 +256,7 @@

    /**
     * Sets the input stream to read the SLD from
-     *
+     *
     * @param in
     *                the inputstream used to read the SLD from
     */
@@ -265,9 +267,9 @@
    /**
     * Read the xml inputsource provided and create a Style object for each user
     * style found
-     *
+     *
     * @return Style[] the styles constructed.
-     *
+     *
     * @throws RuntimeException
     *                 if a parsing error occurs
     */
@@ -291,10 +293,10 @@

    /**
     * Read the DOM provided and create a Style object for each user style found
-     *
+     *
     * @param document
     *                a dom containing the SLD
-     *
+     *
     * @return Style[] the styles constructed.
     */
    public Style[] readDOM(org.w3c.dom.Document document) {
@@ -374,7 +376,7 @@

        NodeList children = root.getChildNodes();
        final int length = children.getLength();
-
+
        for (int i = 0; i < length; i++) {
            Node child = children.item(i);
            if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) {
@@ -384,7 +386,7 @@
            if (childName == null) {
                childName = child.getNodeName();
            }
-
+
            if (childName.equalsIgnoreCase("Name")) {
                sld.setName(child.getFirstChild().getNodeValue());
            }
@@ -426,7 +428,7 @@
            if (childName == null) {
                childName = child.getNodeName();
            }
-
+
            if (childName.equalsIgnoreCase("InlineFeature")) {
                parseInlineFeature(child, layer);
            }
@@ -526,7 +528,7 @@
    }

    /**
-     *
+     *
     * @param child
     * @param layer
     */
@@ -546,7 +548,7 @@
     * Parses a NamedLayer.
     * <p>
     * The NamedLayer schema is:
-     *
+     *
     * <pre><code>
     * &lt;xsd:element name=&quot;NamedLayer&quot;&gt;
     *  &lt;xsd:annotation&gt;
@@ -564,9 +566,9 @@
     *  &lt;/xsd:complexType&gt;
     * &lt;/xsd:element&gt;
     * </code></pre>
-     *
+     *
     * </p>
-     *
+     *
     * @param root
     */
    private NamedLayer parseNamedLayer(Node root) {
@@ -612,7 +614,7 @@
     * <p>
     * A NamedStyle is used to refer to a style that has a name in a WMS, and is
     * defined as:
-     *
+     *
     * <pre><code>
     * &lt;xsd:element name=&quot;NamedStyle&quot;&gt;
     *  &lt;xsd:annotation&gt;
@@ -625,9 +627,9 @@
     *  &lt;/xsd:complexType&gt;
     * &lt;/xsd:element&gt;
     * </code></pre>
-     *
+     *
     * </p>
-     *
+     *
     * @param n
     */
    public NamedStyle parseNamedStyle(Node n) {
@@ -671,16 +673,16 @@
        return style;
    }

-

+
    /**
     * build a style for the Node provided
-     *
+     *
     * @param n
     *                the node which contains the style to be parsed.
-     *
+     *
     * @return the Style constructed.
-     *
+     *
     * @throws RuntimeException
     *                 if an error occurs setting up the parser
     */
@@ -769,8 +771,8 @@
            if (childName == null) {
                childName = child.getNodeName();
            }
-
-
+
+
            if (childName.equalsIgnoreCase("Name")) {
                ft.setName(child.getFirstChild().getNodeValue());
            }
@@ -830,11 +832,11 @@
                // the DOM parser wasnt properly set to handle namespaces...
                childName = childName.substring(childName.indexOf(':') + 1);
            }
-
+
            if (LOGGER.isLoggable(Level.FINEST)) {
                LOGGER.finest("processing " + child.getLocalName());
            }
-
+
            if (childName.equalsIgnoreCase("Name")) {
                rule.setName(child.getFirstChild().getNodeValue());
            }
@@ -925,14 +927,20 @@

    /**
     * parses the SLD for a linesymbolizer
-     *
+     *
     * @param root
     *                a w2c Dom Node
-     *
+     *
     * @return the linesymbolizer
     */
    private LineSymbolizer parseLineSymbolizer(Node root) {
        LineSymbolizer symbol = factory.createLineSymbolizer();
+
+        NamedNodeMap namedNodeMap = root.getAttributes();
+        Node uomNode = namedNodeMap.getNamedItem(uomString);
+        if(uomNode != null)
+               symbol.setUOM(uomNode.getNodeValue());
+
        NodeList children = root.getChildNodes();
        final int length = children.getLength();
        for (int i = 0; i < length; i++) {
@@ -959,10 +967,10 @@

    /**
     * parses the SLD for a polygonsymbolizer
-     *
+     *
     * @param root
     *                w3c dom node
-     *
+     *
     * @return the polygon symbolizer
     */
    private PolygonSymbolizer parsePolygonSymbolizer(Node root) {
@@ -970,6 +978,11 @@
        symbol.setFill((Fill) null);
        symbol.setStroke((Stroke) null);

+        NamedNodeMap namedNodeMap = root.getAttributes();
+        Node uomNode = namedNodeMap.getNamedItem(uomString);
+        if(uomNode != null)
+               symbol.setUOM(uomNode.getNodeValue());
+
        NodeList children = root.getChildNodes();
        final int length = children.getLength();
        for (int i = 0; i < length; i++) {
@@ -1000,16 +1013,21 @@

    /**
     * parses the SLD for a text symbolizer
-     *
+     *
     * @param root
     *                w3c dom node
-     *
+     *
     * @return the TextSymbolizer
     */
    private TextSymbolizer parseTextSymbolizer(Node root) {
        TextSymbolizer symbol = factory.createTextSymbolizer();
        symbol.setFill(null);

+        NamedNodeMap namedNodeMap = root.getAttributes();
+        Node uomNode = namedNodeMap.getNamedItem(uomString);
+        if(uomNode != null)
+               symbol.setUOM(uomNode.getNodeValue());
+
        List<Font> fonts = new ArrayList<Font>();
        NodeList children = root.getChildNodes();
        final int length = children.getLength();
@@ -1126,7 +1144,7 @@
    /**
     * adds the key/value pair from the node ("<VendorOption name="...">...</VendorOption>").
     * This can be generalized for other symbolizers in the future
-     *
+     *
     * @param symbol
     * @param child
     */
@@ -1140,14 +1158,20 @@

    /**
     * parses the SLD for a text symbolizer
-     *
+     *
     * @param root
     *                w3c dom node
-     *
+     *
     * @return the TextSymbolizer
     */
    private RasterSymbolizer parseRasterSymbolizer(Node root) {
        final RasterSymbolizer symbol = factory.getDefaultRasterSymbolizer();
+
+        NamedNodeMap namedNodeMap = root.getAttributes();
+        Node uomNode = namedNodeMap.getNamedItem(uomString);
+        if(uomNode != null)
+               symbol.setUOM(uomNode.getNodeValue());
+
        NodeList children = root.getChildNodes();
        final int length = children.getLength();
        for (int i = 0; i < length; i++) {
@@ -1223,9 +1247,9 @@
        * graphic parameters. A "mixed" element-content model is used with textual
        * substitution for values.
        */
-    Expression parseParameterValueExpression( Node root, boolean mixedText ){
+    Expression parseParameterValueExpression( Node root, boolean mixedText ){
       ExpressionDOMParser parser = new ExpressionDOMParser( (FilterFactory2) ff );
-       Expression expr = parser.expression( root ); // try the provided node first
+       Expression expr = parser.expression( root ); // try the provided node first
       if( expr != null ) return expr;
       NodeList children = root.getChildNodes();
       // if there is only one CharacterData node - we can make a literal out of it
@@ -1234,12 +1258,12 @@
               String text = textNode.getNodeValue();
               return ff.literal( text.trim() );
       }
-       List<Expression> expressionList = new ArrayList<Expression>();
+       List<Expression> expressionList = new ArrayList<Expression>();
       for( int index=0; index<children.getLength(); index++){
               Node child = children.item(index);
               if( child instanceof CharacterData ) {
                       if( mixedText ){
-                               String text = child.getNodeValue();
+                               String text = child.getNodeValue();
                               Expression childExpr = ff.literal( text );
                               expressionList.add( childExpr );
                       }
@@ -1260,13 +1284,13 @@
       else if( expressionList.size() == 2){
               Expression[] expressionArray = expressionList.toArray( new Expression[0]);
               return ff.function("strConcat", expressionArray );
-       }
+       }
       else {
               Expression[] expressionArray = expressionList.toArray( new Expression[0]);
               return ff.function("Concatenate", expressionArray );
       }
    }
-
+
    private ColorMapEntry parseColorMapEntry(Node root) {
        ColorMapEntry symbol = factory.createColorMapEntry();
        NamedNodeMap atts = root.getAttributes();
@@ -1309,17 +1333,6 @@
                            "ColorMapType", type));

            }
-
-            final Node extended = atts.getNamedItem("extended");
-            if (extended != null) {
-                final String type = extended.getNodeValue();
-
-                if ("true".equalsIgnoreCase(type)) {
-                    symbol.setExtendedColors(true);
-                } else if ("intervals".equalsIgnoreCase(type)) {
-                       symbol.setExtendedColors(false);
-                }
-            }
        }

        NodeList children = root.getChildNodes();
@@ -1355,7 +1368,7 @@
                continue;
            }
            String childName = child.getLocalName();
-
+
            if (childName == null) {
                childName = child.getNodeName();
            }
@@ -1437,7 +1450,7 @@
            if (childName == null) {
                childName = child.getNodeName();
            }
-
+
            if (childName.equalsIgnoreCase("Normalize")) {
                symbol.setNormalize();
            }
@@ -1492,7 +1505,7 @@
                try {
                    final String reliefString=child.getFirstChild().getNodeValue();
                    Expression relief = ExpressionDOMParser.parseExpression( child );
-                    symbol.setReliefFactor( relief );
+                    symbol.setReliefFactor( relief );
                } catch (Exception e) {
                    if(LOGGER.isLoggable(Level.WARNING))
                        LOGGER.log(Level.WARNING,e.getLocalizedMessage(),e);
@@ -1505,16 +1518,21 @@

    /**
     * parses the SLD for a point symbolizer
-     *
+     *
     * @param root
     *                a w3c dom node
-     *
+     *
     * @return the pointsymbolizer
     */
    private PointSymbolizer parsePointSymbolizer(Node root) {
        PointSymbolizer symbol = factory.getDefaultPointSymbolizer();
        // symbol.setGraphic(null);

+        NamedNodeMap namedNodeMap = root.getAttributes();
+        Node uomNode = namedNodeMap.getNamedItem(uomString);
+        if(uomNode != null)
+               symbol.setUOM(uomNode.getNodeValue());
+
        NodeList children = root.getChildNodes();
        final int length = children.getLength();
        for (int i = 0; i < length; i++) {
@@ -1527,8 +1545,8 @@
            if (childName == null) {
                childName = child.getNodeName();
            }
-
-
+
+
            if (childName.equalsIgnoreCase(geomString)) {
                symbol.setGeometryPropertyName(parseGeometryName(child));
            }
@@ -1560,7 +1578,7 @@
            if (childName == null) {
                childName = child.getNodeName();
            }
-
+
            if (childName.equalsIgnoreCase(geomString)) {
                graphic.setGeometryPropertyName(parseGeometryName(child));
            }
@@ -1637,8 +1655,8 @@
            if (childName == null) {
                childName = child.getNodeName();
            }
-
-
+
+
            if (childName.equalsIgnoreCase("Stroke")) {
                mark.setStroke(parseStroke(child));
            }
@@ -1973,7 +1991,7 @@
    /**
     * Concatenates the given expressions (through the strConcat FunctionFilter
     * expression)
-     *
+     *
     * @param left
     * @param right
     * @return
@@ -1991,7 +2009,7 @@
    /**
     * Parses a css parameter. Default implementation trims whitespaces from
     * text nodes.
-     *
+     *
     * @param root
     *                node to parse
     * @return
@@ -2003,7 +2021,7 @@
    /**
     * Parses a css parameter. You can choose if the parser must trim whitespace
     * from text nodes or not.
-     *
+     *
     * @param root
     *                node to parse
     * @param trimWhiteSpace
@@ -2279,9 +2297,9 @@

    /**
     * DOCUMENT ME!
-     *
+     *
     * @param root
-     *
+     *
     */
    private Halo parseHalo(Node root) {
        if (LOGGER.isLoggable(Level.FINEST)) {
Index: main/src/main/java/org/geotools/styling/SLDTransformer.java
===================================================================
--- main/src/main/java/org/geotools/styling/SLDTransformer.java (revision 32424)
+++ main/src/main/java/org/geotools/styling/SLDTransformer.java (working copy)
@@ -1,9 +1,9 @@
 /*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
- *
+ *
 *    (C) 2003-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
@@ -43,6 +43,7 @@
 import org.opengis.filter.expression.Literal;
 import org.opengis.filter.expression.PropertyName;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
+import org.xml.sax.Attributes;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
@@ -66,7 +67,7 @@
     * value.
     */
    final private Map uri2prefix;
-
+
    /**
     * Construct a new instance of <code>SLDTransformer</code> with the
     * default namespace mappings usually found in a simple Styled Layer
@@ -127,10 +128,10 @@

    /**
     * Currently does nothing.
-     *
+     *
     * @param args
     *            DOCUMENT ME!
-     *
+     *
     * @throws Exception
     *             DOCUMENT ME!
     */
@@ -155,24 +156,24 @@

        void element(String element, Expression e) {
            if( e == null || e == Expression.NIL ) return;
-
+
            start(element);
            filterTranslator.encode(e);
            end(element);
        }
-
+
        /**
-         * To be used when the expression is a single literal whose
+         * To be used when the expression is a single literal whose
         * value must be written out as element.
         * <p>
         * For Example OverlapBehaviour is represented as an expression but v 1.0.0
         * specifications do not define it as an expression.  (&ltAVERAGE/&gt)
         * </p>
-         *
+         *
         */
        void elementLiteral(String element, Expression e){
               if (e == null || e == Expression.NIL) return;
-
+
               final String value = e.evaluate(null, String.class);
               start(element);
               start(value);
@@ -253,8 +254,13 @@
                return;
            }

-            start("TextSymbolizer");
+            AttributesImpl atts = new AttributesImpl();
+               String uom = text.getUOM();
+                       if(uom != null)
+                               atts.addAttribute("", "uom", "uom", "", text.getUOM());

+            start("TextSymbolizer", atts);
+
            if (text.getGeometryPropertyName() != null) {
                encodeGeometryProperty(text.getGeometryPropertyName());
            }
@@ -293,13 +299,13 @@
            if (text.getOptions() != null) {
                encodeVendorOptions(text.getOptions());
            }
-
+
            if (text.getPriority() != null) {
                start("Priority");
                element("PropertyName", text.getPriority());
                end("Priority");
            }
-
+
            end("TextSymbolizer");
        }

@@ -308,8 +314,13 @@
                               return;
                       }

-                       start("RasterSymbolizer");
+                       AttributesImpl atts = new AttributesImpl();
+                       String uom = raster.getUOM();
+                       if(uom != null)
+                               atts.addAttribute("", "uom", "uom", "", uom);

+                       start("RasterSymbolizer", atts);
+
                       if (raster.getGeometryPropertyName() != null) {
                               encodeGeometryProperty(raster.getGeometryPropertyName());
                       }
@@ -319,20 +330,20 @@
                       }

                       if (raster.getChannelSelection() != null) {
-                               final ChannelSelection cs = raster.getChannelSelection();
+                               final ChannelSelection cs = raster.getChannelSelection();
                               if (cs.getGrayChannel() != null) {
                                   start("ChannelSelection");
                                   SelectedChannelType gray = cs.getGrayChannel();
-
+
                                   start("GrayChannel");
                                   gray.accept(this);
                                       end("GrayChannel");
-
-                                       end("ChannelSelection");
-                               } else if( cs.getRGBChannels() != null && cs.getRGBChannels().length ==3 && cs.getRGBChannels()[0] != null && cs.getRGBChannels()[1] != null && cs.getRGBChannels()[2] != null){
+
+                                       end("ChannelSelection");
+                               } else if( cs.getRGBChannels() != null && cs.getRGBChannels().length ==3 && cs.getRGBChannels()[0] != null && cs.getRGBChannels()[1] != null && cs.getRGBChannels()[2] != null){
                                   start("ChannelSelection");
                       SelectedChannelType[] rgb = cs.getRGBChannels();
-
+
                                   start("RedChannel");
                       rgb[0].accept(this);
                                       end("RedChannel");
@@ -345,22 +356,22 @@
                                       rgb[2].accept(this);
                                       end("BlueChannel");

-                                       end("ChannelSelection");
+                                       end("ChannelSelection");
                               }
                               else {
                                   // we have an invalid ChannelSelection ?
                               }
                       }
-
+
                       if (raster.getOverlap() != null) {
                               Expression overlaps = raster.getOverlap();
                               if( overlaps instanceof PropertyName){
                                   final String pn = ((PropertyName)overlaps).getPropertyName();
-
-                       start("OverlapBehavior");
+
+                       start("OverlapBehavior");
                       start(pn);
                       end(pn);
-                       end("OverlapBehavior");
+                       end("OverlapBehavior");
                               }
                               else {
                                       //this expression needs to be converted to a single string and then written
@@ -372,15 +383,15 @@
                       if (raster.getColorMap() != null) {
                               raster.getColorMap().accept(this);
                       }
-
+
                       if (raster.getContrastEnhancement() != null){
                               raster.getContrastEnhancement().accept(this);
                       }
-
+
                       if (raster.getShadedRelief() != null) {
                               raster.getShadedRelief().accept(this);
                       }
-
+
                       if (raster.getImageOutline() != null) {
                               start("ImageOutline");
                               raster.getImageOutline().accept(this);
@@ -398,7 +409,7 @@
               }
               end("ColorMap");
        }
-
+
        public void visit(ColorMapEntry colorEntry) {
               if (colorEntry != null) {
                AttributesImpl atts = new AttributesImpl();
@@ -415,7 +426,7 @@
                element("ColorMapEntry", null, atts);
               }
        }
-
+
        public void visit(Symbolizer sym) {
            try {
                contentHandler.startElement("", "!--", "!--", NULL_ATTS);
@@ -427,7 +438,12 @@
        }

        public void visit(PolygonSymbolizer poly) {
-            start("PolygonSymbolizer");
+               AttributesImpl atts = new AttributesImpl();
+               String uom = poly.getUOM();
+               if(uom != null)
+                       atts.addAttribute("", "uom", "uom", "", uom);
+
+            start("PolygonSymbolizer", atts);
            encodeGeometryProperty(poly.getGeometryPropertyName());

            if (poly.getFill() != null) {
@@ -460,8 +476,12 @@
        }

        public void visit(LineSymbolizer line) {
-            start("LineSymbolizer");
+               AttributesImpl atts = new AttributesImpl();
+               String uom = line.getUOM();
+                       if(uom != null)
+                               atts.addAttribute("", "uom", "uom", "", line.getUOM());

+               start("LineSymbolizer", atts);
            encodeGeometryProperty(line.getGeometryPropertyName());

            if( line.getStroke() != null ){
@@ -496,7 +516,7 @@
               gr[i].accept(this);
                end("LegendGraphic");
            }
-
+
            if (rule.getFilter() != null) {
                filterTranslator.encode(rule.getFilter());
            }
@@ -542,8 +562,13 @@
        }

        public void visit(PointSymbolizer ps) {
-            start("PointSymbolizer");
+               AttributesImpl atts = new AttributesImpl();
+               String uom = ps.getUOM();
+                       if(uom != null)
+                               atts.addAttribute("", "uom", "uom", "", ps.getUOM());

+            start("PointSymbolizer", atts);
+
            encodeGeometryProperty(ps.getGeometryPropertyName());

            ps.getGraphic().accept(this);
@@ -597,7 +622,7 @@
               }

               StyledLayer[] layers = sld.getStyledLayers();
-
+
            for (int i = 0; i < layers.length; i++) {
                if (layers[i] instanceof NamedLayer) {
                    visit((NamedLayer) layers[i]);
@@ -624,7 +649,7 @@
                   }
                       end("LayerFeatureConstraints");
            }
-
+
            Style[] styles = layer.getStyles();

            for (int i = 0; i < styles.length; i++) {
@@ -746,7 +771,7 @@
            }
            end("InlineFeature");
        }
-
+
        public void visit(RemoteOWS remoteOWS) {
            start("RemoteOWS");
            element("Service", remoteOWS.getService());
@@ -797,7 +822,7 @@
                    visit(fts[i]);
                }
                end("UserStyle");
-            }
+            }
        }

        public void visit(FeatureTypeStyle fts) {
@@ -849,11 +874,11 @@
            //create a property name out the name and encode it
            FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
            Expression expression = ff.property(name);
-
+
            start("Geometry");
            filterTranslator.encode(expression);
            end("Geometry");
-
+
        }

        void encodeCssParam(String name, Expression expression) {
@@ -890,7 +915,7 @@
                }
            }
        }
-
+
        void encodeVendorOption(String key, String value) {
            AttributesImpl atts = new AttributesImpl();
            atts.addAttribute("", "name", "name", "", key);
@@ -898,14 +923,14 @@
            chars(value);
            end("VendorOption");
        }
-
+
        public void encode(Style[] styles) {
            try {
                contentHandler.startDocument();

                start("StyledLayerDescriptor", NULL_ATTS);
                start("NamedLayer", NULL_ATTS); //this is correct?
-
+
                for (int i = 0, ii = styles.length; i < ii; i++) {
                    styles[i].accept(this);
                }
@@ -961,7 +986,7 @@
                               start(val);
                               end(val);
                       }
-
+
                       //gamma
                       exp=(Literal)ce.getGammaValue();
                       if (exp != null) {
@@ -1016,7 +1041,7 @@
                               element("BrightnessOnly", "true");
                       else
                               element("BrightnessOnly", "false");
-
+
                       //relief factor
                       if(sr.getReliefFactor()!=null)
                       {
Index: main/src/main/java/org/geotools/styling/TextSymbolizerImpl.java
===================================================================
--- main/src/main/java/org/geotools/styling/TextSymbolizerImpl.java     (revision 32424)
+++ main/src/main/java/org/geotools/styling/TextSymbolizerImpl.java     (working copy)
@@ -1,9 +1,9 @@
 /*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
- *
+ *
 *    (C) 2002-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
@@ -52,6 +52,7 @@
    private Expression abxtract = null;
    private Expression description = null;
    private OtherText otherText = null;
+    private String uom = null;

    protected TextSymbolizerImpl() {
        this( CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints()) );
@@ -251,6 +252,14 @@
        this.geometryPropertyName = geometryPropertyName;
    }

+    public String getUOM() {
+               return uom;
+       }
+
+       public void setUOM(String uom) {
+               this.uom = uom;
+       }
+
    /**
     * Accept a StyleVisitor to perform an operation on this symbolizer.
     *
@@ -304,6 +313,10 @@
            result = (PRIME * result) + label.hashCode();
        }

+        if (uom != null) {
+            result = (PRIME * result) + uom.hashCode();
+        }
+
        return result;
    }

@@ -325,7 +338,8 @@
            && Utilities.equals(this.halo, other.halo)
            && Utilities.equals(this.fonts, other.fonts)
            && Utilities.equals(this.placement, other.placement)
-            && Utilities.equals(this.fill, other.fill);
+            && Utilities.equals(this.fill, other.fill)
+            && Utilities.equals(this.uom, other.uom);
        }

        return false;
@@ -416,5 +430,5 @@
    public void setOtherText(OtherText otherText) {
        this.otherText = otherText;
    }
-
+
 }
Index: main/src/main/java/org/geotools/styling/UOMTypes.java
===================================================================
--- main/src/main/java/org/geotools/styling/UOMTypes.java       (revision 0)
+++ main/src/main/java/org/geotools/styling/UOMTypes.java       (revision 0)
@@ -0,0 +1,16 @@
+package org.geotools.styling;
+
+/**
+ * Provides some static UOM types that the symbolizers can use.
+ *
+ * @author emarx
+ */
+public final class UOMTypes {
+
+       public final static String URL_OGC = "http://www.opengeospatial.org/se/units/";
+
+       public final static String PIXEL = URL_OGC + "pixel";
+       public final static String METRE = URL_OGC + "metre";
+       public final static String FOOT = URL_OGC + "foot";
+
+}
Index: main/src/main/java/org/geotools/styling/visitor/DuplicatingStyleVisitor.java
===================================================================
--- main/src/main/java/org/geotools/styling/visitor/DuplicatingStyleVisitor.java        (revision 32424)
+++ main/src/main/java/org/geotools/styling/visitor/DuplicatingStyleVisitor.java        (working copy)
@@ -1,9 +1,9 @@
 /*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
- *
+ *
 *    (C) 2006-2008, Open Source Geospatial Foundation (OSGeo)
- *
+ *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
@@ -84,7 +84,7 @@
 * @author Jesse Eichar
 */
 public class DuplicatingStyleVisitor implements StyleVisitor {
-
+
       protected final StyleFactory sf;
    protected final FilterFactory2 ff;
    protected boolean STRICT;
@@ -93,15 +93,15 @@
     * We are using aggregation here to contain our DuplicatingFilterVisitor.
     */
    protected final DuplicatingFilterVisitor copyFilter;
-
+
    /**
     * This is our internal stack; used to maintain state as we copy sub elements.
     */
-    protected Stack<Object> pages=new Stack<Object>();
-
+    protected Stack<Object> pages=new Stack<Object>();
+
    public DuplicatingStyleVisitor() {
               this( CommonFactoryFinder.getStyleFactory( null ) );
-       }
+       }
       public DuplicatingStyleVisitor(StyleFactory styleFactory) {
           this( styleFactory, CommonFactoryFinder.getFilterFactory2( null ));
       }
@@ -118,11 +118,11 @@
       public void setStrict(boolean strict) {
        STRICT = strict;
    }
-
+
       public Object getCopy() {
               return pages.peek();
       }
-
+
    public void visit(StyledLayerDescriptor sld) {
        StyledLayerDescriptor copy = null;

@@ -189,7 +189,7 @@
    public void visit(UserLayer layer) {
        UserLayer copy = null;

-
+
        Style[] style = layer.getUserStyles();
         int length=style.length;
        Style[] styleCopy = new Style[length];
@@ -270,21 +270,21 @@

        Symbolizer[] symbolizer = rule.getSymbolizers();
        ArrayList<Symbolizer> symbolizerList = new ArrayList<Symbolizer>();
-

+
        length=symbolizer.length;
        for (int i = 0; i < length; i++) {
            if (symbolizer[i] == null) continue;
-
+
            symbolizer[i].accept(this);
            Symbolizer symbolizerCopy = (Symbolizer) pages.pop();
-
+
            if( symbolizerCopy == null ) continue;
-
+
            symbolizerList.add( symbolizerCopy );
        }
        Symbolizer[] symbolizerCopy = symbolizerList.toArray( new Symbolizer[0] );
-
+
        copy = sf.createRule();
        copy.setAbstract(rule.getAbstract());
        copy.setFilter(filterCopy);
@@ -322,7 +322,7 @@
        copy.setFeatureTypeName(fts.getFeatureTypeName());
        copy.setRules(rulesCopy);
        copy.setSemanticTypeIdentifiers((String[]) fts.getSemanticTypeIdentifiers().clone());
-
+
        if( STRICT && !copy.equals( fts )){
            throw new IllegalStateException("Was unable to duplicate provided FeatureTypeStyle:"+fts );
        }
@@ -336,7 +336,7 @@
     * </code></pre>
     * @param sion
     * @return copy of expression or null if expression was null
-     */
+     */
    protected Expression copy( Expression expression ){
        if( expression == null  ) return null;
        return (Expression) expression.accept( copyFilter, ff );
@@ -346,9 +346,9 @@
     */
    protected Filter copy( Filter filter ){
        if( filter == null ) return null;
-        return (Filter) filter.accept( copyFilter, ff );
+        return (Filter) filter.accept( copyFilter, ff );
    }
-
+
    /**
     * Null safe graphic copy
     * @param graphic
@@ -356,7 +356,7 @@
     */
    protected Graphic copy( Graphic graphic ){
        if( graphic == null ) return null;
-
+
        graphic.accept(this);
        return (Graphic) pages.pop();
    }
@@ -367,7 +367,7 @@
     */
    protected Fill copy( Fill fill ){
        if( fill == null ) return null;
-
+
        fill.accept(this);
        return (Fill) pages.pop();
    }
@@ -378,7 +378,7 @@
     */
    protected float[] copy(float[] array) {
        if( array == null ) return null;
-
+
        float copy[] = new float[ array.length];
        System.arraycopy( array, 0, copy, 0, array.length );
        return copy;
@@ -393,7 +393,7 @@
        if( customProperties == null ) return null;
        return new HashMap<K,V>( customProperties );
    }
-
+
    /**
     * Null safe copy of stroke.
     * @param stroke
@@ -414,7 +414,7 @@
        Expression reliefFactor = copy( shaded.getReliefFactor() );
        ShadedRelief copy = sf.createShadedRelief( reliefFactor );
        copy.setBrightnessOnly( shaded.isBrightnessOnly() );
-
+
        return copy;
    }
    protected ExternalGraphic copy( ExternalGraphic externalGraphic){
@@ -429,69 +429,69 @@
    }
    protected ColorMapEntry copy(ColorMapEntry entry) {
        if( entry == null ) return null;
-
+
        entry.accept( this );
        return (ColorMapEntry) pages.pop();
    }
-
+
    protected Symbolizer copy(Symbolizer symbolizer) {
        if( symbolizer == null ) return null;
-
+
        symbolizer.accept(this);
        return (Symbolizer) pages.pop();
    }
-
+
    protected OverlapBehavior copy(OverlapBehavior ob) {
        if( ob == null ) return null;
-
+
        ob.accept(this);
        return (OverlapBehavior) pages.pop();
    }
-
+
    protected ContrastEnhancement copy(ContrastEnhancement contrast) {
        if( contrast == null ) return null;
-
+
        ContrastEnhancement copy = sf.createContrastEnhancement();
        copy.setGammaValue( copy( contrast.getGammaValue()));
        return copy;
    }
    protected ColorMap copy(ColorMap colorMap) {
        if( colorMap == null ) return null;
-
+
        colorMap.accept(this);
        return (ColorMap) getCopy();
    }
-
+
    protected SelectedChannelType[] copy( SelectedChannelType[] channels){
        if( channels == null ) return null;
-
+
        SelectedChannelType[] copy = new SelectedChannelType[ channels.length ];
        for( int i=0; i< channels.length ; i++){
            copy[i] = copy( channels[i] );
        }
        return copy;
    }
-
+
    protected SelectedChannelType copy(SelectedChannelType selectedChannelType) {
        if( selectedChannelType == null ) return null;
-
+
        ContrastEnhancement enhancement = copy( selectedChannelType.getContrastEnhancement() );
        String name = selectedChannelType.getChannelName();
        SelectedChannelType copy = sf.createSelectedChannelType( name, enhancement);
-
+
        return copy;
    }
-
+
    protected ChannelSelection copy(ChannelSelection channelSelection) {
        if( channelSelection == null ) return null;
-
+
        SelectedChannelType[] channels = copy( channelSelection.getSelectedChannels() );
        ChannelSelection copy = sf.createChannelSelection( channels);
        copy.setGrayChannel( copy( channelSelection.getGrayChannel() ));
        copy.setRGBChannels( copy( channelSelection.getRGBChannels() ));
        return copy;
    }
-
+
    /**
     * Null safe copy of font array.
     * <p>
@@ -510,7 +510,7 @@
    /** Null safe copy of a single font */
    protected Font copy(Font font) {
        if( font == null) return font;
-
+
        Expression fontFamily = copy( font.getFontFamily() );
        Expression fontStyle = copy( font.getFontStyle() );
        Expression fontWeight = copy( font.getFontWeight() );
@@ -520,7 +520,7 @@
    }
    /**
     * Null safe copy of halo.
-     * @param halo
+     * @param halo
     * @return copy of halo if provided
     */
    protected Halo copy( Halo halo){
@@ -566,7 +566,7 @@
        copy.setColor(copy( fill.getColor()));
        copy.setGraphicFill( copy(fill.getGraphicFill()));
        copy.setOpacity( copy(fill.getOpacity()));
-
+
        if( STRICT && !copy.equals( fill )){
            throw new IllegalStateException("Was unable to duplicate provided Fill:"+fill );
        }
@@ -593,19 +593,19 @@

    public void visit(Symbolizer sym) {
        if( sym instanceof RasterSymbolizer){
-            visit( (RasterSymbolizer) sym );
+            visit( (RasterSymbolizer) sym );
        }
        else if( sym instanceof LineSymbolizer){
-            visit( (LineSymbolizer) sym );
+            visit( (LineSymbolizer) sym );
        }
        else if( sym instanceof PolygonSymbolizer){
-            visit( (PolygonSymbolizer) sym );
+            visit( (PolygonSymbolizer) sym );
        }
        else if( sym instanceof PointSymbolizer){
-            visit( (PointSymbolizer) sym );
+            visit( (PointSymbolizer) sym );
        }
        else if( sym instanceof TextSymbolizer){
-            visit( (TextSymbolizer) sym );
+            visit( (TextSymbolizer) sym );
        }
        else {
            throw new RuntimeException("visit(Symbolizer) unsupported");
@@ -616,6 +616,8 @@
        PointSymbolizer copy = sf.getDefaultPointSymbolizer();
        copy.setGeometryPropertyName( ps.getGeometryPropertyName());
        copy.setGraphic( copy( ps.getGraphic() ));
+        if(ps.getUOM() != null)
+               copy.setUOM(ps.getUOM().substring(0));
        if( STRICT ){
            if( !copy.equals( ps )){
                throw new IllegalStateException("Was unable to duplicate provided Graphic:"+ps );
@@ -628,7 +630,9 @@
        LineSymbolizer copy = sf.getDefaultLineSymbolizer();
        copy.setGeometryPropertyName( line.getGeometryPropertyName());
        copy.setStroke( copy( line.getStroke()));
-
+        if(line.getUOM() != null)
+               copy.setUOM(line.getUOM().substring(0));
+
        if( STRICT && !copy.equals( line )){
            throw new IllegalStateException("Was unable to duplicate provided LineSymbolizer:"+line );
        }
@@ -640,7 +644,9 @@
        copy.setFill( copy( poly.getFill()));
        copy.setGeometryPropertyName( poly.getGeometryPropertyName());
        copy.setStroke(copy(poly.getStroke()));
-
+        if(poly.getUOM() != null)
+               copy.setUOM(poly.getUOM().substring(0));
+
        if( STRICT && !copy.equals( poly )){
            throw new IllegalStateException("Was unable to duplicate provided PolygonSymbolizer:"+poly );
        }
@@ -656,13 +662,15 @@
        copy.setLabel( copy( text.getLabel()));
        copy.setPlacement( copy( text.getPlacement()));
        copy.setPriority( copy( text.getPriority()));
-
+        if(text.getUOM() != null)
+               copy.setUOM(text.getUOM().substring(0));
+
        if( STRICT && !copy.equals( text )){
            throw new IllegalStateException("Was unable to duplicate provided TextSymbolizer:"+text );
        }
        pages.push(copy);
    }
-
+
    public void visit(RasterSymbolizer raster) {
        RasterSymbolizer copy = sf.createRasterSymbolizer();
        copy.setChannelSelection( copy( raster.getChannelSelection() ));
@@ -673,7 +681,9 @@
        copy.setOpacity( copy( raster.getOpacity() ));
        copy.setOverlap( copy( raster.getOverlap()));
        copy.setShadedRelief( copy( raster.getShadedRelief()));
-
+        if(raster.getUOM() != null)
+               copy.setUOM(raster.getUOM().substring(0));
+
        if( STRICT && !copy.equals( raster )){
            throw new IllegalStateException("Was unable to duplicate provided raster:"+raster );
        }
@@ -688,8 +698,8 @@
        Mark[] marksCopy = copy( gr.getMarks() );
        Expression opacityCopy = copy( gr.getOpacity() );
        Expression rotationCopy = copy( gr.getRotation() );
-        Expression sizeCopy = copy( gr.getSize() );
-
+        Expression sizeCopy = copy( gr.getSize() );
+
        // Looks like Symbols are a "view" of marks and external graphics?
        // Symbol[] symbolCopys = copy( gr.getSymbols() );

@@ -702,7 +712,7 @@
        copy.setRotation((Expression) rotationCopy);
        copy.setSize((Expression) sizeCopy);
        // copy.setSymbols(symbolCopys);
-
+
        if( STRICT ){
            if( !copy.equals( gr )){
                throw new IllegalStateException("Was unable to duplicate provided Graphic:"+gr );
@@ -710,7 +720,7 @@
        }
        pages.push(copy);
    }
-
+
    private Mark[] copy(Mark[] marks) {
        if( marks == null) return null;
        Mark[] copy = new Mark[marks.length];
@@ -719,7 +729,7 @@
        }
        return copy;
    }
-
+
    private Symbol[] copy(Symbol[] symbols) {
        if( symbols == null) return null;
        Symbol[] copy = new Symbol[symbols.length];
@@ -728,7 +738,7 @@
        }
        return copy;
    }
-
+
    private ExternalGraphic[] copy(ExternalGraphic[] externalGraphics) {
        if( externalGraphics == null) return null;
        ExternalGraphic[] copy = new ExternalGraphic[externalGraphics.length];
@@ -737,7 +747,7 @@
        }
        return copy;
    }
-
+
    public void visit(Mark mark) {
        Mark copy = null;

@@ -747,7 +757,7 @@
        copy.setSize(copy( mark.getSize() ));
        copy.setStroke(copy( mark.getStroke() ));
        copy.setWellKnownName(copy( mark.getWellKnownName() ));
-
+
        if( STRICT && !copy.equals( mark )){
            throw new IllegalStateException("Was unable to duplicate provided Mark:"+mark );
        }
@@ -760,16 +770,16 @@
            uri = exgr.getLocation();
        }
        catch (MalformedURLException huh ){
-
+
        }
        String format = exgr.getFormat();
        ExternalGraphic copy = sf.createExternalGraphic(uri, format);
        copy.setCustomProperties( copy(exgr.getCustomProperties()));
-
+
        if( STRICT && !copy.equals( exgr )){
            throw new IllegalStateException("Was unable to duplicate provided ExternalGraphic:"+exgr );
        }
-        pages.push(copy);
+        pages.push(copy);
    }

    public void visit(PointPlacement pp) {
@@ -784,14 +794,14 @@
        pages.push(copy);
    }

-    public void visit(AnchorPoint ap) {
+    public void visit(AnchorPoint ap) {
        Expression x = copy( ap.getAnchorPointX() );
        Expression y = copy( ap.getAnchorPointY() );
        AnchorPoint copy = sf.createAnchorPoint(x, y);
-
+
        if( STRICT && !copy.equals( ap)){
            throw new IllegalStateException("Was unable to duplicate provided AnchorPoint:"+ap);
-        }
+        }
        pages.push(copy);
    }

@@ -799,7 +809,7 @@
        Expression x = copy( dis.getDisplacementX() );
        Expression y = copy( dis.getDisplacementY() );
        Displacement copy = sf.createDisplacement(x, y);
-
+
        if( STRICT && !copy.equals( dis )){
            throw new IllegalStateException("Was unable to duplicate provided Displacement:"+dis );
        }
@@ -820,7 +830,7 @@
        Fill fill = copy( halo.getFill());
        Expression radius = copy( halo.getRadius() );
        Halo copy = sf.createHalo(fill, radius);
-
+
        if( STRICT && !copy.equals( halo )){
            throw new IllegalStateException("Was unable to duplicate provided raster:"+halo );
        }
@@ -832,7 +842,7 @@
        Filter filter = copy( ftc.getFilter() );
        Extent[] extents = copy( ftc.getExtents() );
        FeatureTypeConstraint copy = sf.createFeatureTypeConstraint( typeName, filter, extents);
-
+
        if( STRICT && !copy.equals( ftc )){
            throw new IllegalStateException("Was unable to duplicate provided FeatureTypeConstraint:"+ftc );
        }
@@ -841,24 +851,24 @@

    protected Extent[] copy(Extent[] extents) {
           if( extents == null ) return null;
-
+
           Extent[] copy = new Extent[ extents.length ];
           for( int i=0; i<extents.length; i++){
               copy[i] = copy( extents[i] );
           }
           return copy;
       }
-
+
    protected Extent copy(Extent extent) {
        String name = extent.getName();
        String value = extent.getValue();
        Extent copy = sf.createExtent(name, value);
        return copy;
    }
-
-    public void visit(ColorMap colorMap) {
+
+    public void visit(ColorMap colorMap) {
           ColorMap copy = sf.createColorMap();
-           copy.setType( colorMap.getType() );
+           copy.setType( colorMap.getType() );
           ColorMapEntry[] entries = colorMap.getColorMapEntries();
           if( entries != null ){
               for( int i=0; i<entries.length;i++){
@@ -871,7 +881,7 @@
        }
               pages.push(copy);
       }
-
+
    public void visit(ColorMapEntry colorMapEntry) {
           ColorMapEntry copy = sf.createColorMapEntry();
           copy.setColor( copy( colorMapEntry.getColor() ));
@@ -884,7 +894,7 @@
        }
           pages.push(copy);
    }
-
+
       public void visit(ContrastEnhancement contrastEnhancement) {
               final ContrastEnhancement copy=sf.createContrastEnhancement();
               copy.setType(contrastEnhancement.getType());
@@ -893,21 +903,21 @@
                     throw new IllegalStateException("Was unable to duplicate provided contrastEnhancement:"+contrastEnhancement );
               }
               pages.push(copy);
-
+
       }
-
+
       public void visit(ImageOutline outline) {
           //copy the symbolizer
           final Symbolizer symb=outline.getSymbolizer();
           final Symbolizer copySymb=copy(symb);
-
+
            final ImageOutline copy=sf.createImageOutline(copySymb);
            copy.setSymbolizer(copySymb);
            if( STRICT && !copy.equals( outline )){
                  throw new IllegalStateException("Was unable to duplicate provided ImageOutline:"+outline );
            }
            pages.push(copy);
-
+
       }
       public void visit(ChannelSelection cs) {
           //get the channels
@@ -917,7 +927,7 @@
                  throw new IllegalStateException("Was unable to duplicate provided ChannelSelection:"+cs );
            }
            pages.push(copy);
-
+
       }
       public void visit(OverlapBehavior ob) {
               final String behavior= (String) ob.getValue();
@@ -934,8 +944,8 @@
                                       pages.push(OverlapBehavior.RANDOM_RESCTRICTION);
                                   else
                                       throw new IllegalStateException("Was unable to duplicate provided OverlapBehavior:"+ob );
-
-
+
+
       }
       public void visit(SelectedChannelType sct) {
               final SelectedChannelType copy= sf.createSelectedChannelType(sct.getChannelName(), copy(sct.getContrastEnhancement()));
@@ -951,6 +961,6 @@
                throw new IllegalStateException("Was unable to duplicate provided ShadedRelief:"+sr );
                }
            pages.push(copy);
-
+
       }
 }
Index: main/src/test/java/org/geotools/styling/SLDTransformerTest.java
===================================================================
--- main/src/test/java/org/geotools/styling/SLDTransformerTest.java     (revision 32424)
+++ main/src/test/java/org/geotools/styling/SLDTransformerTest.java     (working copy)
@@ -1,7 +1,7 @@
 /*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
- *
+ *
 *    (C) 2002-2008, Open Source Geospatial Foundation (OSGeo)
 *
 *    This library is free software; you can redistribute it and/or
@@ -18,12 +18,18 @@

 import java.io.StringReader;

+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
 import junit.framework.TestCase;

+import org.geotools.PrivateAccessor;
 import org.geotools.factory.CommonFactoryFinder;
 import org.geotools.factory.GeoTools;
 import org.opengis.filter.FilterFactory2;
 import org.opengis.filter.expression.Expression;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;

 /**
 * This test case captures specific problems encountered with the SLDTransformer
@@ -32,7 +38,7 @@
 * Please note that SLDTransformer is specifically targeted at SLD 1.0; for new
 * code you should be using the SLD 1.0 (or SE 1.1) xml-xsd bindings.
 * </p>
- *
+ *
 * @author Jody
 */
 public class SLDTransformerTest extends TestCase {
@@ -73,51 +79,50 @@
        * more exciting - a complete style object.
        */
       public void testEncodingStyle() throws Exception {
-
-               //simple default raster symbolizer
+
+               // simple default raster symbolizer
               RasterSymbolizer defaultRasterSymbolizer = sf.createRasterSymbolizer();
               String xmlFragment = transformer.transform(defaultRasterSymbolizer);
               assertNotNull(xmlFragment);

-               //more complex raster symbolizer
+               // more complex raster symbolizer
               StyleFactory styleFactory = CommonFactoryFinder
                               .getStyleFactory(GeoTools.getDefaultHints());
               StyleBuilder styleBuilder = new StyleBuilder(styleFactory);

               RasterSymbolizer rasterSymbolizer = styleFactory
                               .createRasterSymbolizer();
-
-               //set opacity
+
+               // set opacity
               rasterSymbolizer.setOpacity((Expression) CommonFactoryFinder
                               .getFilterFactory(GeoTools.getDefaultHints()).literal(0.25));

-               //set channel selection
+               // set channel selection
               ChannelSelectionImpl csi = new ChannelSelectionImpl();
-               //red
+               // red
               SelectedChannelTypeImpl redChannel = new SelectedChannelTypeImpl();
               redChannel.setChannelName("1");
               ContrastEnhancementImpl rcei = new ContrastEnhancementImpl();
               rcei.setHistogram();
               redChannel.setContrastEnhancement(rcei);
-
-               //green
+
+               // green
               SelectedChannelTypeImpl greenChannel = new SelectedChannelTypeImpl();
               greenChannel.setChannelName("4");
               ContrastEnhancementImpl gcei = new ContrastEnhancementImpl();
               gcei.setGammaValue(ff.literal(2.5));
               greenChannel.setContrastEnhancement(gcei);
-
-               //blue
+
+               // blue
               SelectedChannelTypeImpl blueChannel = new SelectedChannelTypeImpl();
               blueChannel.setChannelName("2");
               ContrastEnhancementImpl bcei = new ContrastEnhancementImpl();
               bcei.setNormalize();
               blueChannel.setContrastEnhancement(bcei);
-
+
               csi.setRGBChannels(redChannel, greenChannel, blueChannel);
               rasterSymbolizer.setChannelSelection(csi);
-
-
+
               Style style = styleBuilder.createStyle(rasterSymbolizer);
               style.setName("simpleStyle");
               // style.setAbstract("Hello World");
@@ -136,7 +141,272 @@
               parser.setInput(new StringReader(xmlFragment));
               Style[] stuff = parser.readXML();
               Style out = stuff[0];
+
               assertNotNull(out);
               assertEquals(0.25, SLD.rasterOpacity(out));
       }
+
+       public void testUOMEncodingPointSymbolizer() throws Exception {
+
+               // simple default line symbolizer
+               PointSymbolizer pointSymbolizer = sf.createPointSymbolizer();
+               pointSymbolizer.setUOM(UOMTypes.FOOT);
+               String xmlFragment = transformer.transform(pointSymbolizer);
+               assertNotNull(xmlFragment);
+
+               SLDParser parser = new SLDParser(sf);
+
+               try {
+                       DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+                       Document dom = null;
+                       DocumentBuilder db = null;
+
+                       db = dbf.newDocumentBuilder();
+                       dom = db.parse(new InputSource(new StringReader(xmlFragment)));
+
+                       PointSymbolizer pointSymbolizer2 = (PointSymbolizer) PrivateAccessor
+                                       .callPrivateMethod(parser, "parsePointSymbolizer", dom
+                                                       .getFirstChild());
+
+                       assertTrue(pointSymbolizer.getUOM().equals(
+                                       pointSymbolizer2.getUOM()));
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+
+       }
+
+       public void testUOMEncodingPolygonSymbolizer() throws Exception {
+
+               // simple default line symbolizer
+               PolygonSymbolizer polygonSymbolizer = sf.createPolygonSymbolizer();
+               polygonSymbolizer.setUOM(UOMTypes.METRE);
+               String xmlFragment = transformer.transform(polygonSymbolizer);
+               assertNotNull(xmlFragment);
+
+               SLDParser parser = new SLDParser(sf);
+
+               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+               Document dom = null;
+               DocumentBuilder db = null;
+
+               db = dbf.newDocumentBuilder();
+               dom = db.parse(new InputSource(new StringReader(xmlFragment)));
+
+               PolygonSymbolizer polygonSymbolizer2 = (PolygonSymbolizer) PrivateAccessor
+                               .callPrivateMethod(parser, "parsePolygonSymbolizer", dom
+                                               .getFirstChild());
+
+               assertTrue(polygonSymbolizer.getUOM().equals(
+                               polygonSymbolizer2.getUOM()));
+       }
+
+       public void testUOMEncodingRasterSymbolizer2() throws Exception {
+
+               // simple default line symbolizer
+               RasterSymbolizer rasterSymbolizer = sf.createRasterSymbolizer();
+               rasterSymbolizer.setUOM(UOMTypes.PIXEL);
+               String xmlFragment = transformer.transform(rasterSymbolizer);
+               assertNotNull(xmlFragment);
+
+               SLDParser parser = new SLDParser(sf);
+
+               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+               Document dom = null;
+               DocumentBuilder db = null;
+
+               db = dbf.newDocumentBuilder();
+               dom = db.parse(new InputSource(new StringReader(xmlFragment)));
+
+               RasterSymbolizer rasterSymbolizer2 = (RasterSymbolizer) PrivateAccessor
+                               .callPrivateMethod(parser, "parseRasterSymbolizer", dom
+                                               .getFirstChild());
+
+               assertTrue(rasterSymbolizer.getUOM().equals(rasterSymbolizer2.getUOM()));
+       }
+
+       public void testUOMEncodingLineSymbolizer() throws Exception {
+
+               // simple default line symbolizer
+               LineSymbolizer lineSymbolizer = sf.createLineSymbolizer();
+               lineSymbolizer.setUOM(UOMTypes.METRE);
+               String xmlFragment = transformer.transform(lineSymbolizer);
+               assertNotNull(xmlFragment);
+
+               SLDParser parser = new SLDParser(sf);
+
+               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+               Document dom = null;
+               DocumentBuilder db = null;
+
+               db = dbf.newDocumentBuilder();
+               dom = db.parse(new InputSource(new StringReader(xmlFragment)));
+
+               LineSymbolizer lineSymbolizer2 = (LineSymbolizer) PrivateAccessor
+                               .callPrivateMethod(parser, "parseLineSymbolizer", dom
+                                               .getFirstChild());
+
+               assertTrue(lineSymbolizer.getUOM().equals(lineSymbolizer2.getUOM()));
+
+       }
+
+       public void testUOMEncodingTextSymbolizer() throws Exception {
+
+               // simple default text symbolizer
+               TextSymbolizer textSymbolizer = sf.createTextSymbolizer();
+               textSymbolizer.setUOM(UOMTypes.FOOT);
+               String xmlFragment = transformer.transform(textSymbolizer);
+
+               assertNotNull(xmlFragment);
+
+               xmlFragment = transformer.transform(textSymbolizer);
+               System.out.println(xmlFragment);
+
+               assertNotNull(xmlFragment);
+               SLDParser parser = new SLDParser(sf);
+
+               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+               Document dom = null;
+               DocumentBuilder db = null;
+
+               db = dbf.newDocumentBuilder();
+               dom = db.parse(new InputSource(new StringReader(xmlFragment)));
+
+               TextSymbolizer textSymbolizer2 = (TextSymbolizer) PrivateAccessor
+                               .callPrivateMethod(parser, "parseTextSymbolizer", dom
+                                               .getFirstChild());
+
+               assertTrue(textSymbolizer.getUOM().equals(textSymbolizer2.getUOM()));
+       }
+
+       public void testNullEncodingPointSymbolizer() throws Exception {
+
+               // simple default line symbolizer
+               PointSymbolizer pointSymbolizer = sf.createPointSymbolizer();
+               String xmlFragment = transformer.transform(pointSymbolizer);
+               assertNotNull(xmlFragment);
+
+               SLDParser parser = new SLDParser(sf);
+
+               try {
+                       DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+                       Document dom = null;
+                       DocumentBuilder db = null;
+
+                       db = dbf.newDocumentBuilder();
+                       dom = db.parse(new InputSource(new StringReader(xmlFragment)));
+
+                       PointSymbolizer pointSymbolizer2 = (PointSymbolizer) PrivateAccessor
+                                       .callPrivateMethod(parser, "parsePointSymbolizer", dom
+                                                       .getFirstChild());
+
+                       assertTrue(pointSymbolizer2.getUOM() == null);
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+
+       }
+
+       public void testNullUOMEncodingPolygonSymbolizer() throws Exception {
+
+               // simple default line symbolizer
+               PolygonSymbolizer polygonSymbolizer = sf.createPolygonSymbolizer();
+               String xmlFragment = transformer.transform(polygonSymbolizer);
+               assertNotNull(xmlFragment);
+
+               SLDParser parser = new SLDParser(sf);
+
+               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+               Document dom = null;
+               DocumentBuilder db = null;
+
+               db = dbf.newDocumentBuilder();
+               dom = db.parse(new InputSource(new StringReader(xmlFragment)));
+
+               PolygonSymbolizer polygonSymbolizer2 = (PolygonSymbolizer) PrivateAccessor
+                               .callPrivateMethod(parser, "parsePolygonSymbolizer", dom
+                                               .getFirstChild());
+
+               assertTrue(polygonSymbolizer2.getUOM() == null);
+       }
+
+       public void testNullUOMEncodingRasterSymbolizer2() throws Exception {
+
+               // simple default line symbolizer
+               RasterSymbolizer rasterSymbolizer = sf.createRasterSymbolizer();
+               String xmlFragment = transformer.transform(rasterSymbolizer);
+               assertNotNull(xmlFragment);
+
+               SLDParser parser = new SLDParser(sf);
+
+               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+               Document dom = null;
+               DocumentBuilder db = null;
+
+               db = dbf.newDocumentBuilder();
+               dom = db.parse(new InputSource(new StringReader(xmlFragment)));
+
+               RasterSymbolizer rasterSymbolizer2 = (RasterSymbolizer) PrivateAccessor
+                               .callPrivateMethod(parser, "parseRasterSymbolizer", dom
+                                               .getFirstChild());
+
+               assertTrue(rasterSymbolizer2.getUOM() == null);
+       }
+
+       public void testNullUOMEncodingLineSymbolizer() throws Exception {
+
+               // simple default line symbolizer
+               LineSymbolizer lineSymbolizer = sf.createLineSymbolizer();
+               String xmlFragment = transformer.transform(lineSymbolizer);
+               assertNotNull(xmlFragment);
+
+               SLDParser parser = new SLDParser(sf);
+
+               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+               Document dom = null;
+               DocumentBuilder db = null;
+
+               db = dbf.newDocumentBuilder();
+               dom = db.parse(new InputSource(new StringReader(xmlFragment)));
+
+               LineSymbolizer lineSymbolizer2 = (LineSymbolizer) PrivateAccessor
+                               .callPrivateMethod(parser, "parseLineSymbolizer", dom
+                                               .getFirstChild());
+
+               assertTrue(lineSymbolizer2.getUOM() == null);
+
+       }
+
+       public void testNullUOMEncodingTextSymbolizer() throws Exception {
+
+               // simple default text symbolizer
+               TextSymbolizer textSymbolizer = sf.createTextSymbolizer();
+               String xmlFragment = transformer.transform(textSymbolizer);
+               assertNotNull(xmlFragment);
+
+               SLDParser parser = new SLDParser(sf);
+
+               DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+               Document dom = null;
+               DocumentBuilder db = null;
+
+               db = dbf.newDocumentBuilder();
+               dom = db.parse(new InputSource(new StringReader(xmlFragment)));
+
+               TextSymbolizer textSymbolizer2 = (TextSymbolizer) PrivateAccessor
+                               .callPrivateMethod(parser, "parseTextSymbolizer", dom
+                                               .getFirstChild());
+
+               assertTrue(textSymbolizer2.getUOM() == null);
+       }
 }
Index: main/src/test/java/org/geotools/styling/visitor/DuplicatorStyleVisitorTest.java
===================================================================
--- main/src/test/java/org/geotools/styling/visitor/DuplicatorStyleVisitorTest.java     (revision 32424)
+++ main/src/test/java/org/geotools/styling/visitor/DuplicatorStyleVisitorTest.java     (working copy)
@@ -1,7 +1,7 @@
 /*
 *    GeoTools - The Open Source Java GIS Toolkit
 *    http://geotools.org
- *
+ *
 *    (C) 2005-2008, Open Source Geospatial Foundation (OSGeo)
 *
 *    This library is free software; you can redistribute it and/or
@@ -18,16 +18,14 @@

 import java.util.Collections;

-import javax.xml.transform.TransformerException;
-
 import junit.framework.TestCase;

 import org.geotools.factory.CommonFactoryFinder;
 import org.geotools.filter.IllegalFilterException;
+import org.geotools.resources.Utilities;
 import org.geotools.styling.AnchorPoint;
 import org.geotools.styling.Displacement;
 import org.geotools.styling.ExternalGraphic;
-import org.geotools.styling.FeatureTypeConstraint;
 import org.geotools.styling.FeatureTypeStyle;
 import org.geotools.styling.Fill;
 import org.geotools.styling.Font;
@@ -40,16 +38,15 @@
 import org.geotools.styling.PointPlacement;
 import org.geotools.styling.PointSymbolizer;
 import org.geotools.styling.PolygonSymbolizer;
+import org.geotools.styling.RasterSymbolizer;
 import org.geotools.styling.Rule;
-import org.geotools.styling.SLDTransformer;
 import org.geotools.styling.Stroke;
 import org.geotools.styling.Style;
 import org.geotools.styling.StyleBuilder;
 import org.geotools.styling.StyleFactory;
-import org.geotools.styling.StyledLayerDescriptor;
 import org.geotools.styling.Symbolizer;
 import org.geotools.styling.TextSymbolizer;
-import org.geotools.styling.UserLayer;
+import org.geotools.styling.UOMTypes;
 import org.opengis.filter.FilterFactory2;
 import org.opengis.filter.expression.Expression;
 import org.opengis.util.Cloneable;
@@ -66,7 +63,7 @@
    StyleFactory sf;
    FilterFactory2 ff;
    DuplicatingStyleVisitor visitor;
-
+
    public DuplicatorStyleVisitorTest(String testName) {
        super(testName);
    }
@@ -77,7 +74,7 @@
        sb = new StyleBuilder(sf, ff);
        visitor = new DuplicatingStyleVisitor( sf, ff );
    }
-
+
    public void testStyleDuplication() throws IllegalFilterException {
       //create a style
       Style oldStyle = sb.createStyle("FTSName", sf.createPolygonSymbolizer());
@@ -85,57 +82,14 @@
       //duplicate it
       oldStyle.accept(visitor);
       Style newStyle = (Style) visitor.getCopy();
-
+
       //compare it
       assertNotNull(newStyle);
       assertEquals(2, newStyle.getFeatureTypeStyles()[0].getSemanticTypeIdentifiers().length);
-
       //TODO: actually compare it
-       assertTrue(areStylesEqualByXml(oldStyle, newStyle));
    }
-
-    /**
-     * Produces an XML representation of a Style.
-     * @param style
-     * @return
-     * @throws TransformerException
-     */
-    private String styleToXML(final Style style) throws TransformerException
-    {
-        StyledLayerDescriptor sld = sf.createStyledLayerDescriptor();
-        UserLayer layer = sf.createUserLayer();
-        layer.setLayerFeatureConstraints(new FeatureTypeConstraint[]{null});
-        sld.addStyledLayer(layer);
-        layer.addUserStyle(style);

-        SLDTransformer styleTransform = new SLDTransformer();
-        String xml = styleTransform.transform(sld);

-        return xml;
-    }
-
-    /**
-     * Returns whether two Styles have equal XML representations.
-     * @param s1
-     * @param s2
-     * @return
-     */
-    private boolean areStylesEqualByXml(final Style s1, final Style s2)
-    {
-        try
-        {
-            String xmlS1 = styleToXML(s1);
-            String xmlS2 = styleToXML(s2);
-
-            return xmlS1.equals(xmlS2);
-        }
-        catch (TransformerException te)
-        {
-            return false;
-        }
-    }
-
-
    public void testStyle() throws Exception {
        FeatureTypeStyle fts = sf.createFeatureTypeStyle();
        fts.setFeatureTypeName("feature-type-1");
@@ -146,17 +100,17 @@
        style.addFeatureTypeStyle(fts);
        style.addFeatureTypeStyle(fts2);

-        style.accept( visitor );
+        style.accept( visitor );
        Style copy = (Style) visitor.getCopy();
-
+
        //assertClone(style, clone);
        assertEqualsContract( style, copy );
-
+
        Style notEq = sf.getDefaultStyle();

        fts2 = fts2();
        notEq.addFeatureTypeStyle(fts2);
-
+
        assertEqualsContract(copy, notEq, style);
    }

@@ -189,7 +143,7 @@
        FeatureTypeStyle clone = (FeatureTypeStyle) visitor.getCopy();
        //assertClone(fts, clone);
        assertEqualsContract( fts, clone );
-
+
        rule1 = sf.createRule();
        rule1.setName("rule1");
        rule1.setFilter(ff.id(Collections.singleton(ff.featureId("FID"))));
@@ -214,7 +168,7 @@
        Rule clone = (Rule) visitor.getCopy();
        assertCopy(rule, clone);
        assertEqualsContract(rule, clone);
-
+
        symb2 = sf.createPolygonSymbolizer(sf
                .getDefaultStroke(), sf.getDefaultFill(), "shape");

@@ -235,12 +189,38 @@

        assertCopy(pointSymb, clone);
        assertEqualsContract(pointSymb, clone);
-
+
        PointSymbolizer notEq = sf.getDefaultPointSymbolizer();
        notEq.setGeometryPropertyName("something_else");
        assertEqualsContract(clone, notEq, pointSymb);
    }

+    public void testRasterSymbolizerWithUOM() throws Exception {
+        RasterSymbolizer rasterSymb = sf.createRasterSymbolizer();
+        rasterSymb.setUOM(UOMTypes.FOOT);
+        rasterSymb.accept(visitor);
+        RasterSymbolizer clone = (RasterSymbolizer) visitor.getCopy();
+
+        assertEquals(clone.getUOM(), rasterSymb.getUOM());
+
+        RasterSymbolizer notEq = sf.createRasterSymbolizer();
+
+        assertFalse(Utilities.equals(notEq.getUOM(), rasterSymb.getUOM()));
+    }
+
+    public void testPointSymbolizerWithUOM() throws Exception {
+        PointSymbolizer pointSymb = sf.createPointSymbolizer();
+        pointSymb.setUOM(UOMTypes.FOOT);
+        pointSymb.accept(visitor);
+        PointSymbolizer clone = (PointSymbolizer) visitor.getCopy();
+
+        assertCopy(pointSymb, clone);
+        assertEqualsContract(pointSymb, clone);
+
+        PointSymbolizer notEq = sf.getDefaultPointSymbolizer();
+        assertEqualsContract(clone, notEq, pointSymb);
+    }
+
    public void testTextSymbolizer() {
        TextSymbolizer textSymb = sf.createTextSymbolizer();
        Expression offset = ff.literal(10);
@@ -250,7 +230,7 @@
        TextSymbolizer clone = (TextSymbolizer) visitor.getCopy();
        assertCopy(textSymb, clone);
        assertEqualsContract(textSymb, clone);
-
+
        TextSymbolizer notEq = sf.getDefaultTextSymbolizer();
        Expression ancX = ff.literal(10);
        Expression ancY = ff.literal(10);
@@ -261,6 +241,27 @@
        assertEqualsContract(clone, notEq, textSymb);
    }

+    public void testTextSymbolizerWithUOM() {
+        TextSymbolizer textSymb = sf.createTextSymbolizer();
+        textSymb.setUOM(UOMTypes.METRE);
+        Expression offset = ff.literal(10);
+        textSymb.setLabelPlacement(sf.createLinePlacement(offset));
+
+        textSymb.accept(visitor);
+        TextSymbolizer clone = (TextSymbolizer) visitor.getCopy();
+        assertCopy(textSymb, clone);
+        assertEqualsContract(textSymb, clone);
+
+        TextSymbolizer notEq = sf.getDefaultTextSymbolizer();
+        Expression ancX = ff.literal(10);
+        Expression ancY = ff.literal(10);
+        AnchorPoint ancPoint = sf.createAnchorPoint(ancX, ancY);
+        LabelPlacement placement = sf.createPointPlacement(ancPoint,
+                null, null);
+        notEq.setLabelPlacement(placement);
+        assertEqualsContract(clone, notEq, textSymb);
+    }
+
    public void testFont() {
        Font font = sf.getDefaultFont();
        Font clone = visitor.copy(font);
@@ -278,10 +279,10 @@
    public void testHalo() {
        Halo halo = sf.createHalo(sf.getDefaultFill(),
                ff.literal(10));
-
+
        halo.accept(visitor);
        Halo clone = (Halo) visitor.getCopy();
-
+
        assertCopy(halo, clone);

        Halo other = sf.createHalo(sf.getDefaultFill(),
@@ -291,10 +292,10 @@

    public void testLinePlacement() throws Exception {
        LinePlacement linePlacement = sf.createLinePlacement(ff.literal(12));
-
+
        linePlacement.accept(visitor);
        LinePlacement clone = (LinePlacement) visitor.getCopy();;
-
+
        assertCopy(linePlacement, clone);

        LinePlacement other = sf.createLinePlacement(ff.property("NAME"));
@@ -305,7 +306,7 @@
        AnchorPoint anchorPoint = sf.createAnchorPoint(ff.literal(1),
                ff.literal(2));
        anchorPoint.accept(visitor);
-
+
        AnchorPoint clone = (AnchorPoint) visitor.getCopy();
        assertCopy(anchorPoint, clone);

@@ -317,7 +318,7 @@
    public void testDisplacement() {
        Displacement displacement = sf.createDisplacement(ff.literal(1),
                ff.literal(2));
-
+
        displacement.accept(visitor);
        Displacement clone = (Displacement) visitor.getCopy();
        assertCopy(displacement, clone);
@@ -329,8 +330,8 @@

    public void testPointPlacement() {
        PointPlacement pointPl = sf.getDefaultPointPlacement();
-
-        PointPlacement clone = (PointPlacement) visitor.copy( pointPl );
+
+        PointPlacement clone = (PointPlacement) visitor.copy( pointPl );
        assertCopy(pointPl, clone);

        PointPlacement other = (PointPlacement) ((Cloneable) pointPl).clone();
@@ -354,7 +355,25 @@
            visitor.setStrict(false);
        }
    }
-
+
+    public void testPolygonSymbolizerWithUOM() {
+        try {
+            //visitor.setStrict(true);
+            PolygonSymbolizer polygonSymb = sf.createPolygonSymbolizer();
+            polygonSymb.setUOM(UOMTypes.FOOT);
+            PolygonSymbolizer clone = (PolygonSymbolizer) visitor
+                    .copy(polygonSymb);
+            assertCopy(polygonSymb, clone);
+
+            PolygonSymbolizer notEq = sf.getDefaultPolygonSymbolizer();
+            notEq.setUOM(UOMTypes.PIXEL);
+
+            assertEqualsContract(clone, notEq, polygonSymb);
+        } finally {
+            visitor.setStrict(false);
+        }
+    }
+
    public void testLineSymbolizer() {
        LineSymbolizer lineSymb = sf.createLineSymbolizer();
        LineSymbolizer clone = (LineSymbolizer) visitor.copy( lineSymb);
@@ -365,6 +384,16 @@
        assertEqualsContract(clone, notEq, lineSymb);
    }

+    public void testLineSymbolizerWithUOM() {
+        LineSymbolizer lineSymb = sf.createLineSymbolizer();
+        LineSymbolizer clone = (LineSymbolizer) visitor.copy( lineSymb);
+        assertCopy(lineSymb, clone);
+
+        LineSymbolizer notEq = sf.getDefaultLineSymbolizer();
+        notEq.setUOM(UOMTypes.METRE);
+        assertEqualsContract(clone, notEq, lineSymb);
+    }
+
    public void testGraphic() {
        Graphic graphic = sf.getDefaultGraphic();
        graphic.addMark(sf.getDefaultMark());
@@ -465,7 +494,7 @@
        // assertHashcode equality
        int controlEqHash = controlEqual.hashCode();
        int testHash = test.hashCode();
-        if( controlEqHash == testHash ){
+        if( controlEqHash != testHash ){
            System.out.println( "Warning  - Equal objects should return equal hashcodes");
        }
    }
@@ -490,5 +519,5 @@
        assertTrue("Equal objects should return equal hashcodes",
            controlEqHash == testHash);
    }
-
+
 }



------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

aaime
Jody Garnett ha scritto:
> Dragging this back to the list; there is way too much content here for a
> private discussion.

Indeed, especially since it left out all the people involved in
the rendering module (basically me and Jesse, nobody else committed
anything to that module in ages).

The thread is way too long now for me to chime in, especially since
quite some coding already went in.

The UOM functionality is interesting, thought the changes implemented
are specific for 2.5.x, the situation on trunk is different, the unit
of measure is already available at the symbolizer level, thought
nothing in the rendering chain actually uses it (the people that
worked on SE 1.1 started their own renderer, which they said is
going to be open source but so far haven't actually seen the sources
of it).

The GeoApi Symbolizer interface has this:

Unit<Length> getUnitOfMeasure();

that influences the interpretation of all the measures.

As for parsing, hacking on the current parser is definitely easier,
thought it's not going to address a SE document parsing, but the parsing
of an augmented SLD 1.0 one (augmented in the meaning of having more
attributes around).

If you look in modules\extension\xsd\xsd-sld you'll find an already
available set of bindings for SLD 1.0 using the new parser architecture.
As far as I know the module was made by Justin as a proof of concept,
but was never actually used in practice, so I don't know how much
of a SLD document it can parse. For sure it does not deal with the
TextSymbolizer extensions (Priority, VendorParameter) that we added
with time in the sax based parser.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

jody.garnett
I agree Andrea; they started coding very quickly :-) Is there any chance you guys can use geotools 2.6? I would much rather see you work on respecting the UOM entry that is already there; and copy the SLDParser so we can modify and read that value in correctly.

I like to work on things we can keep :-) Rather then seeing you work on a fork of geotools that will not last beyond your project.

Jody

On Sun, Feb 15, 2009 at 8:49 PM, Andrea Aime <[hidden email]> wrote:
Jody Garnett ha scritto:

Dragging this back to the list; there is way too much content here for a private discussion.

Indeed, especially since it left out all the people involved in
the rendering module (basically me and Jesse, nobody else committed
anything to that module in ages).

The thread is way too long now for me to chime in, especially since
quite some coding already went in.

The UOM functionality is interesting, thought the changes implemented
are specific for 2.5.x, the situation on trunk is different, the unit
of measure is already available at the symbolizer level, thought
nothing in the rendering chain actually uses it (the people that
worked on SE 1.1 started their own renderer, which they said is
going to be open source but so far haven't actually seen the sources
of it).

The GeoApi Symbolizer interface has this:

Unit<Length> getUnitOfMeasure();

that influences the interpretation of all the measures.

As for parsing, hacking on the current parser is definitely easier,
thought it's not going to address a SE document parsing, but the parsing
of an augmented SLD 1.0 one (augmented in the meaning of having more
attributes around).

If you look in modules\extension\xsd\xsd-sld you'll find an already
available set of bindings for SLD 1.0 using the new parser architecture.
As far as I know the module was made by Justin as a proof of concept,
but was never actually used in practice, so I don't know how much
of a SLD document it can parse. For sure it does not deal with the
TextSymbolizer extensions (Priority, VendorParameter) that we added
with time in the sax based parser.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.


------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

Milton Jonathan
Hello people

Sorry for the fast coding! We just wanted to see something working to
give us a better idea. But it's definitely not meant to be kept as it
is, just to start the process for us (especially since we are no
SLD-experts).

OK, so let's see if I gather everything here:
- Ideally, we should move to 2.6 soon. I have two questions about that:
is it as stable as 2.5.x right now? And is there much to change to make
the move? I ask this because we want to make a first release of our
projects using GeoTools in about two months time, so.. Either we do it
now, or later on, around May-June. And a side-effect question is: does
anyone want support for this in 2.5.x?

- Nice thing about the XML bindings! We were actually looking for that,
and quite puzzled with the whole SLDParser and SLDTransformer thing (why
reading and writing was done by separate classes, why it didn't use the
xsd definitions, etc, etc). But I understand it's not in use right now,
and there is a lot missing, right? Or is that just for 2.5.x? Are things
more developped in 2.6?

- I really like the idea of working with actual Units. Sorry I didn't
notice that before: it is certainly the right way to do it, be it 2.5.x
or 2.6, SLDParser or SLD bindings.

So, from my point of view, our next moves back here should be:
1. Determine if we can move right away to 2.6. If you have any hints on
how tough that could be (and how we could make it easier), please tell
me. Truth is, we sticked to 2.5.x since the beginning since it was
labelled as the "stable release".

2. Determine if we can move to the XML bindings framework. That depends
on how much work we need to do to start to get things going. I guess it
also depends on the state of the bindings for Filter.

In any case, when we decide which way to go, we will reimplement things
using the GeoAPI interface. What do you guys think?

Milton


Jody Garnett wrote:

> I agree Andrea; they started coding very quickly :-) Is there any chance
> you guys can use geotools 2.6? I would much rather see you work on
> respecting the UOM entry that is already there; and copy the SLDParser
> so we can modify and read that value in correctly.
>
> I like to work on things we can keep :-) Rather then seeing you work on
> a fork of geotools that will not last beyond your project.
>
> Jody
>
> On Sun, Feb 15, 2009 at 8:49 PM, Andrea Aime <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     Jody Garnett ha scritto:
>
>         Dragging this back to the list; there is way too much content
>         here for a private discussion.
>
>
>     Indeed, especially since it left out all the people involved in
>     the rendering module (basically me and Jesse, nobody else committed
>     anything to that module in ages).
>
>     The thread is way too long now for me to chime in, especially since
>     quite some coding already went in.
>
>     The UOM functionality is interesting, thought the changes implemented
>     are specific for 2.5.x, the situation on trunk is different, the unit
>     of measure is already available at the symbolizer level, thought
>     nothing in the rendering chain actually uses it (the people that
>     worked on SE 1.1 started their own renderer, which they said is
>     going to be open source but so far haven't actually seen the sources
>     of it).
>
>     The GeoApi Symbolizer interface has this:
>
>     Unit<Length> getUnitOfMeasure();
>
>     that influences the interpretation of all the measures.
>
>     As for parsing, hacking on the current parser is definitely easier,
>     thought it's not going to address a SE document parsing, but the parsing
>     of an augmented SLD 1.0 one (augmented in the meaning of having more
>     attributes around).
>
>     If you look in modules\extension\xsd\xsd-sld you'll find an already
>     available set of bindings for SLD 1.0 using the new parser architecture.
>     As far as I know the module was made by Justin as a proof of concept,
>     but was never actually used in practice, so I don't know how much
>     of a SLD document it can parse. For sure it does not deal with the
>     TextSymbolizer extensions (Priority, VendorParameter) that we added
>     with time in the sax based parser.
>
>     Cheers
>     Andrea
>
>     --
>     Andrea Aime
>     OpenGeo - http://opengeo.org
>     Expert service straight from the developers.
>
>

--

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3527-2502

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

aaime
Milton Jonathan ha scritto:

> Hello people
>
> Sorry for the fast coding! We just wanted to see something working to
> give us a better idea. But it's definitely not meant to be kept as it
> is, just to start the process for us (especially since we are no
> SLD-experts).
>
> OK, so let's see if I gather everything here:
> - Ideally, we should move to 2.6 soon. I have two questions about that:
> is it as stable as 2.5.x right now?

Hard to say, GeoServer is not using that in anger at the moment, but
uDig is. I don't think major changes are going to plop into trunk
at the moment, but I may be mistaken.
The unit tests are about the same thought, so it should not be
much worse for sure.

> And is there much to change to make
> the move? I ask this because we want to make a first release of our
> projects using GeoTools in about two months time, so.. Either we do it
> now, or later on, around May-June. And a side-effect question is: does
> anyone want support for this in 2.5.x?

Well, it would be a nice addition for GeoServer for sure, however I
guess it would be better to have the code use the future proof api
that we have in 2.6.x instead.
I guess as an alternative it would also be possible to make changes
in 2.5.x so that they are future compatible with the signatures
available in 2.6.x

> - Nice thing about the XML bindings! We were actually looking for that,
> and quite puzzled with the whole SLDParser and SLDTransformer thing (why
> reading and writing was done by separate classes, why it didn't use the
> xsd definitions, etc, etc). But I understand it's not in use right now,
> and there is a lot missing, right? Or is that just for 2.5.x? Are things
> more developped in 2.6?

Nope, the parser/encoder framework is so far used only by GeoServer,
and only for GML/Filter/WFS. The SLD was developed as a proof of
concept but afaik there are no short term plans to bring it up to speed.
Your interest in it (and eventual help) might change that thought.
However, I guess in case we start working on that, it might make
sense to work against SLD 1.1 and SE 1.1. Some more investigation
on our part is needed, in order to decide whether we have any resource
to devote the effort.

  > 2. Determine if we can move to the XML bindings framework. That depends
> on how much work we need to do to start to get things going. I guess it
> also depends on the state of the bindings for Filter.

Bindings for Filter 1.1 are there and working, GeoServer uses them
for WFS 1.1.
I'll let Justin chime in, he's the resident xml expert (and maintainer
of the gt-xsd modules).

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

Milton Jonathan
Hello again, people

> 1. Determine if we can move right away to 2.6. If you have any hints

OK, I did a quick switch to GeoTools 2.6, and it didn't seem too much of
an issue to change (all the deprecated methods are still there.. for now
at least ;) ).

By the way, I should say that for some reason at least files
gt-imageio-ext-gdal-2.6-M1.jar and gt-oracle-spatial-2.6-M1.jar are
missing from the OSGEO repository (although they're included in the
binaries at http://docs.codehaus.org/display/GEOTOOLS/2.6-M1).


>  > 2. Determine if we can move to the XML bindings framework. That
>
> Bindings for Filter 1.1 are there and working, GeoServer uses them
> for WFS 1.1.
> I'll let Justin chime in, he's the resident xml expert (and maintainer
> of the gt-xsd modules).

Well, from what Jody said previously, I thought I should be dealing with
org.geotools.xml.Parser and org.geotools.xml.Configuration (and
specifically with org.geotools.xml.SLDConfiguration). Is that correct?
However, I tried hard but couldn't find the right maven dependency for
those classes. It seems to be in org.geotools.xsd.gt-sld, but I couldn't
get it neither for 2.5-SNAPSHOT nor for 2.6-SNAPSHOT. Also, there is no
mention to the jar in the javadocs (as there usually is). So.. where am
I wrong?

Thanks,
Milton

PS: just to let you know, I'll be away (and probably not checking much
e-mail) until next Thursday.


Andrea Aime wrote:

> Milton Jonathan ha scritto:
>> Hello people
>>
>> Sorry for the fast coding! We just wanted to see something working to
>> give us a better idea. But it's definitely not meant to be kept as it
>> is, just to start the process for us (especially since we are no
>> SLD-experts).
>>
>> OK, so let's see if I gather everything here:
>> - Ideally, we should move to 2.6 soon. I have two questions about
>> that: is it as stable as 2.5.x right now?
>
> Hard to say, GeoServer is not using that in anger at the moment, but
> uDig is. I don't think major changes are going to plop into trunk
> at the moment, but I may be mistaken.
> The unit tests are about the same thought, so it should not be
> much worse for sure.
>
>> And is there much to change to make the move? I ask this because we
>> want to make a first release of our projects using GeoTools in about
>> two months time, so.. Either we do it now, or later on, around
>> May-June. And a side-effect question is: does anyone want support for
>> this in 2.5.x?
>
> Well, it would be a nice addition for GeoServer for sure, however I
> guess it would be better to have the code use the future proof api
> that we have in 2.6.x instead.
> I guess as an alternative it would also be possible to make changes
> in 2.5.x so that they are future compatible with the signatures
> available in 2.6.x
>
>> - Nice thing about the XML bindings! We were actually looking for
>> that, and quite puzzled with the whole SLDParser and SLDTransformer
>> thing (why reading and writing was done by separate classes, why it
>> didn't use the xsd definitions, etc, etc). But I understand it's not
>> in use right now, and there is a lot missing, right? Or is that just
>> for 2.5.x? Are things more developped in 2.6?
>
> Nope, the parser/encoder framework is so far used only by GeoServer,
> and only for GML/Filter/WFS. The SLD was developed as a proof of
> concept but afaik there are no short term plans to bring it up to speed.
> Your interest in it (and eventual help) might change that thought.
> However, I guess in case we start working on that, it might make
> sense to work against SLD 1.1 and SE 1.1. Some more investigation
> on our part is needed, in order to decide whether we have any resource
> to devote the effort.
>
>  > 2. Determine if we can move to the XML bindings framework. That depends
>> on how much work we need to do to start to get things going. I guess
>> it also depends on the state of the bindings for Filter.
>
> Bindings for Filter 1.1 are there and working, GeoServer uses them
> for WFS 1.1.
> I'll let Justin chime in, he's the resident xml expert (and maintainer
> of the gt-xsd modules).
>
> Cheers
> Andrea
>

--

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3527-2502



------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

jody.garnett
In reply to this post by Milton Jonathan
I am jumping back into the discussion (sorry I have been off sick for a bit). Andrea has already furnished you with a reply which I have not read yet; so please view two replies as the start of an interesting discussion - we are after all interested in working with you.


On Tue, Feb 17, 2009 at 12:42 AM, Milton Jonathan <[hidden email]> wrote:
Hello people

Sorry for the fast coding! We just wanted to see something working to give us a better idea. But it's definitely not meant to be kept as it is, just to start the process for us (especially since we are no SLD-experts).

OK, so let's see if I gather everything here:
- Ideally, we should move to 2.6 soon. I have two questions about that: is it as stable as 2.5.x right now?

You would be the main reason for the instability :-) Working on the style interfaces is the only technical direction for the 2.6.x branch. You will find a lot of fixes have been done to the SLDParser addressing many problems around the handling of Expressions for example.
 
And is there much to change to make the move?

The use of geoapi interfaces for style are the only changes; and the geoapi interfaces were started by copying the geotools ones and removing the set methods so it should not be too bad. I still want to see a real user (ie you) try out the geoapi StyleFactory before we decide it is great. You can see why I am enthusiastic - much of what is needed here is feedback from a real team.

 
I ask this because we want to make a first release of our projects using GeoTools in about two months time, so.. Either we do it now, or later on, around May-June. And a side-effect question is: does anyone want support for this in 2.5.x?

2.5.x is closed for new development (people are working on additional formats and stuff but the API is fixed). So in a word - no.
Given a couple days warning I am willing to release a 2.6.x milestone release for you guys; as you approach your deadline and have something you are happy with.



- Nice thing about the XML bindings! We were actually looking for that, and quite puzzled with the whole SLDParser and SLDTransformer thing (why reading and writing was done by separate classes, why it didn't use the xsd definitions, etc, etc). But I understand it's not in use right now, and there is a lot missing, right? Or is that just for 2.5.x? Are things more developped in 2.6?

The SLDParser / SLDTransformer has been fixed up for 2.6.x (when we started using functions for line width or color definitions we ran into trouble and had to supply bug fixes). These are used by uDig 1.2 right now. The XML binding stuff is cool; but have not had a chance to work with it much yet - it is far more capable (and can handle literals expressed in GML3 for example).


- I really like the idea of working with actual Units. Sorry I didn't notice that before: it is certainly the right way to do it, be it 2.5.x or 2.6, SLDParser or SLD bindings.

Yeah the JSR-275 Units stuff is great; I am happy working with either the a copy of the SLDParser (copy it and call it SEParser) or constructing SE bindings. If we construct SE bindings we may want to warn Justin and ask him for a couple hours help getting started on the right foot (and be sure to go through the tutorials in that document 1st).
 


So, from my point of view, our next moves back here should be:
1. Determine if we can move right away to 2.6. If you have any hints on how tough that could be (and how we could make it easier), please tell me. Truth is, we sticked to 2.5.x since the beginning since it was labelled as the "stable release".

Yep; I really should label the reason the 2.6 release is unstable - it would of helped you with your planning. I will update the home page now to indicate that 2.6 is unstable because we are working on the style interfaces.


2. Determine if we can move to the XML bindings framework. That depends on how much work we need to do to start to get things going. I guess it also depends on the state of the bindings for Filter.

All of that is fine; and the test cases pass; the bindings for Filter and SLD work (the question is how much work will it be to make bindings for SE).

In any case, when we decide which way to go, we will reimplement things using the GeoAPI interface. What do you guys think?

It will be a pleasure to work with you on this.
Jody


------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

Milton Jonathan
Hey Jody

 > You would be the main reason for the instability :-) Working on the
 > style interfaces is the only technical direction for the 2.6.x branch.

Great! I mean, the part that the style interfaces are the only thing
changing, not that I will be the reason for any instability..


 > the set methods so it should not be too bad. I still want to see a
 > real user (ie you) try out the geoapi StyleFactory before we decide it
 > is great. You can see why I am enthusiastic - much of what is needed
 > here is feedback from a real team.

Great too. I've seen that the deprecated methods are also still around,
so moving towards it should be smooth enough.


 > 2.5.x is closed for new development (people are working on additional
 > formats and stuff but the API is fixed). So in a word - no.

OK


 > Yeah the JSR-275 Units stuff is great; I am happy working with either
 > the a copy of the SLDParser (copy it and call it SEParser) or

Ahm, sorry about the ignorance, but why do you guys want to copy the
current SLDParser instead of modifying it directly? I guess there is
something here I haven't grasped: do you want to split the current
parser and put all the symbolizer-specific methods (such as
parseXXXSymbolizer/Mark/Stroke/etc) in a separate SEParser?


Well, aside from that, as I said in a previous e-mail, I am still a
little confused about how to use the bindings framework. From what you
said previously, I thought I should be dealing with
org.geotools.xml.Parser and org.geotools.xml.Configuration (and
specifically with org.geotools.xml.SLDConfiguration). Is that correct?
However, I tried hard but couldn't find the right maven dependency for
those classes. It seems to be in org.geotools.xsd.gt-sld, but I couldn't
get it neither for 2.5-SNAPSHOT nor for 2.6-SNAPSHOT. Also, there is no
mention to the jar in the javadocs (as there usually is). So.. where am
I wrong?


So: I guess for now I will be moving to 2.6, and making things work with
SLDParser.


 > It will be a pleasure to work with you on this.

For us too, thanks for the support!

Cheers
Milton


Jody Garnett wrote:
> I am jumping back into the discussion (sorry I have been off sick for a
> bit). Andrea has already furnished you with a reply which I have not
> read yet; so please view two replies as the start of an interesting
> discussion - we are after all interested in working with you.

--

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3527-2502

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

jody.garnett

> Yeah the JSR-275 Units stuff is great; I am happy working with either
> the a copy of the SLDParser (copy it and call it SEParser) or

Ahm, sorry about the ignorance, but why do you guys want to copy the current SLDParser instead of modifying it directly? I guess there is something here I haven't grasped: do you want to split the current parser and put all the symbolizer-specific methods (such as parseXXXSymbolizer/Mark/Stroke/etc) in a separate SEParser?

Oh the reason is simple - the SLDParser has a job to do - namely parsing SLD files.
If we are starting to work with UOM information we are looking at parsing SE files.

Well, aside from that, as I said in a previous e-mail, I am still a little confused about how to use the bindings framework. From what you said previously, I thought I should be dealing with org.geotools.xml.Parser and org.geotools.xml.Configuration (and specifically with org.geotools.xml.SLDConfiguration). Is that correct? However, I tried hard but couldn't find the right maven dependency for those classes. It seems to be in org.geotools.xsd.gt-sld, but I couldn't get it neither for 2.5-SNAPSHOT nor for 2.6-SNAPSHOT. Also, there is no mention to the jar in the javadocs (as there usually is). So.. where am I wrong?

Here is the information from the pom.xml 
<groupId>org.geotools.xsd</groupId>
<artifactId>gt-xsd-sld</artifactId>

Does that give you the information you need?

Cheers,
Jody

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

Milton Jonathan
Hello again!

Jody Garnett wrote:
> Oh the reason is simple - the SLDParser has a job to do - namely parsing
> SLD files.
> If we are starting to work with UOM information we are looking at
> parsing SE files.

Ahm, sorry, ignorant here again: isn't the SLDParser already doing lots
of SE-specific stuff such as parsing symbolizers, marks, fills,
strokes..? Why not UOM as well? I guess if we are to have a real
SEParser, then we would have to move there all those SE-specific methods
from the current SLDParser, and leave only the main methods such as
"parseSLD". But that really doesn't look like a priority in my view: I
guess it would be more interesting to invest in the bindings framework.

>
> Here is the information from the pom.xml
> <groupId>org.geotools.xsd</groupId>
> <artifactId>gt-xsd-sld</artifactId>
>
> Does that give you the information you need?

YEP! Thanks a lot! Don't know why I couldn't find that one, maybe I
misspelled the groupId when I tried that artifact.. Anyway, it would be
nice to have that pointer in the javadoc (as in
http://javadoc.geotools.fr/2.6/org/geotools/styling/FeatureTypeStyle.html)

So, I gave it a try with a sample SLD file here and was able to see a
number of issues, such as problems with TextSymbolizer, fills, and others.

I guess we will stick to the SLDParser for now, which we are more
familiar with. I guess we just need to clarify the "copy and rename to
SEParser" issue :) and then we can start..

Hmm, final note - the SLDParser module is still using all those
deprecated setXXX methods. I guess we wouldn't want to create a new
deprecated setUnitOfMeasure method in all symbolizers right..? (we did
that in our preliminary working UOM sketch). My first guess would be to
add StyleFactory.createXXXSymbolizer methods that also receive an UOM
argument. What do you suggest?

Thanks
Milton


--

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3527-2502

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

jody.garnett
Jody Garnett wrote:
Oh the reason is simple - the SLDParser has a job to do - namely parsing SLD files.
If we are starting to work with UOM information we are looking at parsing SE files.

Ahm, sorry, ignorant here again: isn't the SLDParser already doing lots of SE-specific stuff such as parsing symbolizers, marks, fills, strokes..?

Okay let me help ... about SLDParser:
- Style Layer Descriptor 1.0 defines FeatureTypeStyle, symbolizer, marks, fills and strokes (and StyleLayerDescriptor, and NamedLayer, etc...)
- it uses Filter 1.0 for expressions
- it uses GML 2.x for geometry
- this is what SLDParser handles
- this is what there is an xml binding for as well

About the proposed SEParser or SE bindings:
- StyleLayerDescriptor was split into two: Style Layer Descriptor 1.1 (handling StyleLayerDescriptor and NamedLayer) and Symbology Encoding 1.1 (handling symbolier, makrs, fills and strokes ... and adding concepts such as UOM)
- it uses Filter 1.1 for expressions
- it uses GML 3.x for geometry

That is what I am focused on making some new code for handling UOM; we are parsing a new document.

Now the good news; we can start this work by copying what we have; and we can focus on just adding UOM support since that is what you care about. At the end of the day when 2.6 is released we can have the whole thing ready; but we can add functionality as needed for your project.

The other good thing is that by focusing on new code you do not have to worry about breaking code that others are already using; it allows you to be a bit more relaxed and take your time.
 
Why not UOM as well? I guess if we are to have a real SEParser, then we would have to move there all those SE-specific methods from the current SLDParser, and leave only the main methods such as "parseSLD". But that really doesn't look like a priority in my view: I guess it would be more interesting to invest in the bindings framework.

Agreed. 



Here is the information from the pom.xml <groupId>org.geotools.xsd</groupId>
<artifactId>gt-xsd-sld</artifactId>

Does that give you the information you need?

YEP! Thanks a lot! Don't know why I couldn't find that one, maybe I misspelled the groupId when I tried that artifact.. Anyway, it would be nice to have that pointer in the javadoc (as in http://javadoc.geotools.fr/2.6/org/geotools/styling/FeatureTypeStyle.html)

So, I gave it a try with a sample SLD file here and was able to see a number of issues, such as problems with TextSymbolizer, fills, and others.

Can you be more specific? if the binding framework is not working I would like to know - as far as I know it is handling its test cases in a reasonable fashion? 


I guess we will stick to the SLDParser for now, which we are more familiar with. I guess we just need to clarify the "copy and rename to SEParser" issue :) and then we can start..

Hmm, final note - the SLDParser module is still using all those deprecated setXXX methods. I guess we wouldn't want to create a new deprecated setUnitOfMeasure method in all symbolizers right..? (we did that in our preliminary working UOM sketch). My first guess would be to add StyleFactory.createXXXSymbolizer methods that also receive an UOM argument. What do you suggest?  

I have a new StyleFactoryInterface defined in geoapi; I think it already has the UOM parameter. I am still torn on the use of setXXX methods; I understand why it is done (so we can renderer faster); but I am considering a hybrid approach where you can call set methods until a method "freeze" is called at which point the set methods would call an illegalstate exception.

Jody

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

Milton Jonathan
Hello again

Ok, NOW I really understand what you're talking about! Fine then, I'll
copy SLDParser for v1.0 and call it SEParser for now (which in fact will
become a SLD+SEParser for v1.1). Later on, if we want, we can extract a
real SLDParser v1.1 from that code.


> I have a new StyleFactoryInterface defined in geoapi; I think it
> already has the UOM parameter.

Wow, that makes things even easier. I almost feel like I won't be doing
much in the end.. :) Hmm, but it took me a little time to find it: it's
in geoapi 2.2, not 2.3 right?
http://geoapi.sourceforge.net/snapshot/javadoc/org/opengis/style/StyleFactory.html?is-external=true
(I guess 2.3 was split, I don't know if there are javadocs around for
the rest of it)


> I am still torn on the use of setXXX
> methods; I understand why it is done (so we can renderer faster); but
> I am considering a hybrid approach where you can call set methods ]
> until a method "freeze" is called at which point the set methods would
> call an illegalstate exception.

Don't know, for me that does look a lot like a builder, where you call a
lot of setXXX and then get the thing ready by calling build(). I guess I
would prefer that than having exceptions thrown now and then.


> Can you be more specific? if the binding framework is not working I
> would like to know - as far as I know it is handling its test cases in
> a reasonable fashion?

Well, I ran only a simple test to see how a .sld file I have here for a
countries polygon shapefile would render.
Results were:
- It read basic stroke and fill settings OK
- It had problems with relative URL paths (don't know if it really
should only read absolute paths, but right now things like
<OnlineResource xlink:type="simple" xlink:href="../svg/myimage.svg"/> work)
- That svg resource was used for a GraphicFill, but even after fixing
the URL, the resulting fill was a plain grey one, ignoring the
GraphicFill altogether
- There were problems with labeling. I have a rule like this:
   <Rule> <Title>Other</Title>
      <TextSymbolizer>
         <Label>
            <ogc:PropertyName>NAME</ogc:PropertyName>
         </Label>
         <Font>
            <CssParameter name="font-style">normal</CssParameter>
         </Font>
      </TextSymbolizer>
   </Rule>

   . So, first, this didn't work because the binding for CssParameter
expects all font parameters (family, style, weight, size) to be present
- if anything is missing, it throws a NullPointerException at
SLDFontBinding.parse
   . Second, even after filling in all parameters no labels are
displayed (the same happens if I eliminate <Font> altogether)

OK, so that's it. If you want, I can open up a JIRA issue with the
shapefile and the .sld.

Thanks
Milton

--

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3527-2502


------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

Martin Desruisseaux
Hello Jonathan

Milton Jonathan a écrit :

> Hmm, but it took me a little time to find it: it's
> in geoapi 2.2, not 2.3 right?
> http://geoapi.sourceforge.net/snapshot/javadoc/org/opengis/style/StyleFactory.html?is-external=true
> (I guess 2.3 was split, I don't know if there are javadocs around for
> the rest of it)

There is a javadoc for both "geoapi" and "geoapi-pending". You can look at this
page:

     http://geoapi.sourceforge.net/

and scroll down to the "Links" section.

        Martin


------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

aaime
In reply to this post by Milton Jonathan
Milton Jonathan wrote:
> <OnlineResource xlink:type="simple" xlink:href="../svg/myimage.svg"/> work)
> - That svg resource was used for a GraphicFill, but even after fixing
> the URL, the resulting fill was a plain grey one, ignoring the
> GraphicFill altogether

That because you did not set the content type of the image, so the
code cannot find a handler to load it. use "image/svg+xml" and it'll
be loaded properly

Cheers
Andrea

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Geotools-gt2-users] question from off list

Milton Jonathan
Andrea Aime wrote:
 > Milton Jonathan wrote:
 >> <OnlineResource xlink:type="simple" xlink:href="../svg/myimage.svg"/>
 >> work)
 >> - That svg resource was used for a GraphicFill, but even after fixing
 >> the URL, the resulting fill was a plain grey one, ignoring the
 >> GraphicFill altogether
 >
 > That because you did not set the content type of the image, so the
 > code cannot find a handler to load it. use "image/svg+xml" and it'll
 > be loaded properly

Sorry, I didn't include the entire ExternalGraphics tag: I think this
information is in the <Format> tag:

<ExternalGraphic>
   <OnlineResource xlink:type="simple" xlink:href="../svg/myimage.svg"/>
   <Format>image/svg+xml</Format>
</ExternalGraphic>

Anyway, I should stress that everything is working fine using SLDParser.
This is just what didn't work when I switched to the bindings framework.

Cheers
Milton

--

Milton Jonathan
Grupo GIS e Meio Ambiente
Tecgraf/PUC-Rio
Tel: +55-21-3527-2502

------------------------------------------------------------------------------
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-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geotools-devel