Author: aaime Date: 2012-06-16 09:45:48 -0700 (Sat, 16 Jun 2012) New Revision: 38810 Modified: branches/2.7.x/modules/extension/wms/src/main/java/org/geotools/data/wms/xml/WMSComplexTypes.java branches/2.7.x/modules/extension/wms/src/test/java/org/geotools/data/wms/xml/test/WMSSchemaTest.java branches/2.7.x/modules/extension/wms/src/test/resources/org/geotools/data/wms/xml/test/test-data/1.3.0Capabilities.xml Log: [GEOT-4149] Legendurls from wms getcapabilities, patch by Meine Toonen Modified: branches/2.7.x/modules/extension/wms/src/main/java/org/geotools/data/wms/xml/WMSComplexTypes.java =================================================================== --- branches/2.7.x/modules/extension/wms/src/main/java/org/geotools/data/wms/xml/WMSComplexTypes.java 2012-06-16 16:44:11 UTC (rev 38809) +++ branches/2.7.x/modules/extension/wms/src/main/java/org/geotools/data/wms/xml/WMSComplexTypes.java 2012-06-16 16:45:48 UTC (rev 38810) @@ -4143,6 +4143,7 @@ Attributes attrs, Map hints) throws SAXException, OperationNotSupportedException { StyleImpl style = new StyleImpl(); + List legendURLS = new ArrayList(); for (int i = 0; i < value.length; i++) { @@ -4162,7 +4163,7 @@ } if (sameName(elems[3], value[i])) { - //TODO Implement LegendURL + legendURLS.add((String)value[2].getValue()); } if (sameName(elems[4], value[i])) { @@ -4173,7 +4174,7 @@ //TODO implement StyleURL } } - + style.setLegendURLs(legendURLS); return style; } @@ -4274,7 +4275,9 @@ public Object getValue(Element element, ElementValue[] value, Attributes attrs, Map hints) throws SAXException, OperationNotSupportedException { - return null; + + String legendURL = value[1].getValue().toString(); + return legendURL; // throw new OperationNotSupportedException(); } Modified: branches/2.7.x/modules/extension/wms/src/test/java/org/geotools/data/wms/xml/test/WMSSchemaTest.java =================================================================== --- branches/2.7.x/modules/extension/wms/src/test/java/org/geotools/data/wms/xml/test/WMSSchemaTest.java 2012-06-16 16:44:11 UTC (rev 38809) +++ branches/2.7.x/modules/extension/wms/src/test/java/org/geotools/data/wms/xml/test/WMSSchemaTest.java 2012-06-16 16:45:48 UTC (rev 38810) @@ -116,6 +116,7 @@ assertTrue(layer.isQueryable()); assertEquals(layer.getName(), "Bathymetry"); assertEquals(layer.getTitle(), "Bathymetry"); + assertEquals(layer.getStyles().get(0).getLegendURLs().get(0), "http://www.osgeo.org/sites/all/themes/osgeo/logo.png"); // Added test to verify inheritance, should be same as previous llbbox llbbox = layer.getLatLonBoundingBox(); Modified: branches/2.7.x/modules/extension/wms/src/test/resources/org/geotools/data/wms/xml/test/test-data/1.3.0Capabilities.xml =================================================================== --- branches/2.7.x/modules/extension/wms/src/test/resources/org/geotools/data/wms/xml/test/test-data/1.3.0Capabilities.xml 2012-06-16 16:44:11 UTC (rev 38809) +++ branches/2.7.x/modules/extension/wms/src/test/resources/org/geotools/data/wms/xml/test/test-data/1.3.0Capabilities.xml 2012-06-16 16:45:48 UTC (rev 38810) @@ -100,7 +100,15 @@ <Layer queryable="1" opaque="1"> <Name>Bathymetry</Name> <Title>Bathymetry</Title> - <BoundingBox CRS="CRS:84" minx="-180" miny="-90" maxx="180" maxy="90"/> + <BoundingBox CRS="CRS:84" minx="-180" miny="-90" maxx="180" maxy="90"/> + <Style> + <Name>default</Name> + <Title>default</Title> + <LegendURL width="99" height="25"> + <Format>image/png</Format> + <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://www.osgeo.org/sites/all/themes/osgeo/logo.png"/> + </LegendURL> + </Style> </Layer> <Layer queryable="1" opaque="0"> <Name>Countries</Name> |