SimpleFeatureImpl inconsistency between getProperty and
getDefaultGeometryProperty
----------------------------------------------------------------------------------
Key: GEOT-2403
URL: http://jira.codehaus.org/browse/GEOT-2403
Project: GeoTools
Issue Type: Bug
Components: core feature
Affects Versions: 2.6-M1, 2.5.4
Reporter: Gabriel Roldán
Assignee: Andrea Aime
Fix For: 2.5.5, 2.6-M2
{{SimpleFeatureImpl}} presents the following inconsistencies:
- getProperty for the geometry attribute returns an {{Attribute}} instance, not
a {{GeometryAttribute}} instance, whilst {{getDefaultGeometryProperty()}} does.
- {{getProperty("the_geom")}} when the geometry value is null returns properly
an Attribute instance with a null value, whilst
{{getDefaultGeometryProperty()}} returns a null Attribute instance. It should
return a {{GeometryAttribute}} instance with null value.
Test cases attached:
{code}
Index: src/test/java/org/geotools/feature/simple/SimpleFeatureImplTest.java
===================================================================
--- src/test/java/org/geotools/feature/simple/SimpleFeatureImplTest.java
(revision 32665)
+++ src/test/java/org/geotools/feature/simple/SimpleFeatureImplTest.java
(working copy)
@@ -19,6 +19,7 @@
import junit.framework.TestCase;
import org.geotools.data.DataUtilities;
+import org.opengis.feature.GeometryAttribute;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
@@ -30,7 +31,7 @@
@Override
protected void setUp() throws Exception {
super.setUp();
- schema = DataUtilities.createType("buildings",
"_=the_geom:MultiPolygon,name:String,ADDRESS:String");
+ schema = DataUtilities.createType("buildings",
"the_geom:MultiPolygon,name:String,ADDRESS:String");
feature = SimpleFeatureBuilder.build(schema, new Object[] {null,
"ABC", "Random Road, 12"}, "building.1");
}
@@ -40,4 +41,22 @@
assertNull(feature.getProperty("NOWHERE"));
assertEquals(0, feature.getProperties("NOWHERE").size());
}
+
+
+ public void testGetPropertyNullValue(){
+ assertNotNull(feature.getProperty("the_geom"));
+ assertNull(feature.getProperty("the_geom").getValue());
+ }
+
+ public void testGeometryPropertyType(){
+ assertTrue("expected GeometryAttribute, got " +
feature.getProperty("the_geom").getClass().getName(),
+ feature.getProperty("the_geom") instanceof GeometryAttribute);
+ }
+
+ public void testDefaultGeometryProperty(){
+ assertTrue("expected GeometryAttribute, got " +
feature.getProperty("the_geom").getClass().getName(),
+ feature.getProperty("the_geom") instanceof GeometryAttribute);
+ assertNotNull(feature.getDefaultGeometryProperty());
+ assertNull(feature.getDefaultGeometryProperty().getValue());
+ }
}
{code}
Andrea I'm assigning to you as I think it has to do with your performance
improvements to SimpleFeatureImpl. Feel free to reasign to me if you want.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel