From: <jde...@sv...> - 2007-12-30 06:47:35
|
Author: jdeolive Date: 2007-12-29 22:47:30 -0800 (Sat, 29 Dec 2007) New Revision: 28554 Modified: geotools/trunk/gt/modules/extension/xsd/gml3/src/main/java/org/geotools/gml3/bindings/GeometryPropertyTypeBinding.java Log: treating empty geometry as a referenced geometry Modified: geotools/trunk/gt/modules/extension/xsd/gml3/src/main/java/org/geotools/gml3/bindings/GeometryPropertyTypeBinding.java =================================================================== --- geotools/trunk/gt/modules/extension/xsd/gml3/src/main/java/org/geotools/gml3/bindings/GeometryPropertyTypeBinding.java 2007-12-30 06:45:35 UTC (rev 28553) +++ geotools/trunk/gt/modules/extension/xsd/gml3/src/main/java/org/geotools/gml3/bindings/GeometryPropertyTypeBinding.java 2007-12-30 06:47:30 UTC (rev 28554) @@ -15,6 +15,9 @@ */ package org.geotools.gml3.bindings; +import java.util.Collections; +import java.util.List; + import javax.xml.namespace.QName; import com.vividsolutions.jts.geom.Geometry; import org.geotools.gml3.GML; @@ -87,9 +90,26 @@ public Object getProperty(Object object, QName name) throws Exception { if (GML._Geometry.equals(name)) { + //if the geometry is null, return null + Geometry geometry = (Geometry) object; + if ( geometry.isEmpty() ) { + return null; + } return object; } return null; } + + public List getProperties(Object object) throws Exception { + Geometry geometry = (Geometry) object; + String id = GML3EncodingUtils.getID( geometry ); + if ( id != null ) { + //add a comment + // return a comment which is hte xlink href + return Collections.singletonList(new Object[] { Encoder.COMMENT, "#" +id }); + } + + return null; + } } |