Author: aaime Date: 2012-06-16 03:34:20 -0700 (Sat, 16 Jun 2012) New Revision: 38808 Added: trunk/modules/extension/xsd/xsd-sld/src/test/resources/org/geotools/sld/gcontours.sld Modified: trunk/modules/extension/xsd/xsd-sld/src/main/resources/org/geotools/sld/bindings/StyledLayerDescriptor.xsd trunk/modules/extension/xsd/xsd-sld/src/test/java/org/geotools/sld/SLDTest.java Log: [GEOT-4178] Don't break schema validation on the Transformation vendor element Modified: trunk/modules/extension/xsd/xsd-sld/src/main/resources/org/geotools/sld/bindings/StyledLayerDescriptor.xsd =================================================================== --- trunk/modules/extension/xsd/xsd-sld/src/main/resources/org/geotools/sld/bindings/StyledLayerDescriptor.xsd 2012-06-15 12:43:19 UTC (rev 38807) +++ trunk/modules/extension/xsd/xsd-sld/src/main/resources/org/geotools/sld/bindings/StyledLayerDescriptor.xsd 2012-06-16 10:34:20 UTC (rev 38808) @@ -238,12 +238,27 @@ <xsd:element ref="sld:FeatureTypeName" minOccurs="0"/> <xsd:element ref="sld:SemanticTypeIdentifier" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element ref="sld:Transformation" minOccurs="0"/> <xsd:element ref="sld:Rule" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="SemanticTypeIdentifier" type="xsd:string"/> + <xsd:element name="Transformation"> + <xsd:annotation> + <xsd:documentation> + A Transformation specifies a Rendering Transformation + to be applied to the input data before styling. + </xsd:documentation> + </xsd:annotation> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="ogc:Function"/> + </xsd:sequence> + </xsd:complexType> + </xsd:element> + <xsd:element name="Rule"> <xsd:annotation> <xsd:documentation> Modified: trunk/modules/extension/xsd/xsd-sld/src/test/java/org/geotools/sld/SLDTest.java =================================================================== --- trunk/modules/extension/xsd/xsd-sld/src/test/java/org/geotools/sld/SLDTest.java 2012-06-15 12:43:19 UTC (rev 38807) +++ trunk/modules/extension/xsd/xsd-sld/src/test/java/org/geotools/sld/SLDTest.java 2012-06-16 10:34:20 UTC (rev 38808) @@ -34,6 +34,7 @@ * @source $URL$ */ public class SLDTest extends TestCase { + public void test() throws Exception { Parser parser = new Parser(new SLDConfiguration()); @@ -66,4 +67,11 @@ assertEquals(Integer.parseInt("C3", 16), color.getGreen()); assertEquals(Integer.parseInt("F5", 16), color.getBlue()); } + + public void testValidateTransformation() throws Exception { + Parser parser = new Parser(new SLDConfiguration()); + + // if a validato error occurs it will blow up with an exception + parser.validate(getClass().getResourceAsStream("gcontours.sld")); + } } Added: trunk/modules/extension/xsd/xsd-sld/src/test/resources/org/geotools/sld/gcontours.sld =================================================================== --- trunk/modules/extension/xsd/xsd-sld/src/test/resources/org/geotools/sld/gcontours.sld (rev 0) +++ trunk/modules/extension/xsd/xsd-sld/src/test/resources/org/geotools/sld/gcontours.sld 2012-06-16 10:34:20 UTC (rev 38808) @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<StyledLayerDescriptor version="1.0.0" + xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" + xmlns="http://www.opengis.net/sld" + xmlns:ogc="http://www.opengis.net/ogc" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <!-- a Named Layer is the basic building block of an SLD document --> + <NamedLayer> + <Name>default_line</Name> + <UserStyle> + <!-- Styles can have names, titles and abstracts --> + <Title>Default Line</Title> + <Abstract>A sample style that draws a line</Abstract> + <!-- FeatureTypeStyles describe how to render different features --> + <!-- A FeatureTypeStyle for rendering lines --> + <FeatureTypeStyle> + <Transformation> + <ogc:Function name="gs:Contour"> + <ogc:Function name="parameter"> + <ogc:Literal>data</ogc:Literal> + </ogc:Function> + <ogc:Function name="parameter"> + <ogc:Literal>levels</ogc:Literal> + <ogc:Literal>1100</ogc:Literal> + <ogc:Literal>1200</ogc:Literal> + <ogc:Literal>1300</ogc:Literal> + <ogc:Literal>1400</ogc:Literal> + <ogc:Literal>1500</ogc:Literal> + <ogc:Literal>1600</ogc:Literal> + <ogc:Literal>1700</ogc:Literal> + <ogc:Literal>1800</ogc:Literal> + </ogc:Function> + </ogc:Function> + </Transformation> + + <Rule> + <Name>rule1</Name> + <Title>Blue Line</Title> + <Abstract>A solid blue line with a 1 pixel width</Abstract> + <LineSymbolizer> + <Stroke> + <CssParameter name="stroke">#0000FF</CssParameter> + </Stroke> + </LineSymbolizer> + <TextSymbolizer> + <Label> + <ogc:PropertyName>value</ogc:PropertyName> + </Label> + + <Font> + <CssParameter name="font-family">Arial</CssParameter> + <CssParameter name="font-style">Normal</CssParameter> + <CssParameter name="font-size">10</CssParameter> + </Font> + + <LabelPlacement> + <LinePlacement> + </LinePlacement> + </LabelPlacement> + <Halo> + <Radius> + <ogc:Literal>2</ogc:Literal> + </Radius> + <Fill> + <CssParameter name="fill">#FFFFFF</CssParameter> + <CssParameter name="fill-opacity">0.85</CssParameter> + </Fill> + </Halo> + + <Fill> + <CssParameter name="fill">#000000</CssParameter> + </Fill> + + <VendorOption name="followLine">true</VendorOption> + <VendorOption name="repeat">200</VendorOption> + <VendorOption name="maxDisplacement">50</VendorOption> + <VendorOption name="maxAngleDelta">30</VendorOption> + </TextSymbolizer> + </Rule> + </FeatureTypeStyle> + </UserStyle> + </NamedLayer> +</StyledLayerDescriptor> \ No newline at end of file |