Sunburned Surveyor wrote:
> [1] Is there a utility class that allows me to pass an AttributeType
> or PropertyType object and an Object reflecting an Attribute value to
> determine if the Attribute value passes all of the filters?
>
> I can code this on my own, but I thought I would ask if there was a
> standard way to do this first.
>
Code example is here:
> for (PropertyDescriptor property : feature.getType().getAttributes() )) {
> Object value = feature.getAttribute( property.getName() );
>
> Types.validate( property, value );
> }
See this page for both the above example, and an example of checking by
hand.
-
http://docs.codehaus.org/display/GEOTDOC/Feature+Model+Guide#FeatureModelGuide-ValidatingaFeature
> [2] I noticed that both the org.opengis.simple.SimpleFeature class and
> the org.opengis.simple.SimpleFeatureType classes define a
> getAttributeCount method. It seems that this method really belongs to
> the SimpleFeatureType class. Should it be removed or deprecated from
> the SimpleFeature class? (I'll forward this to the GeoAPI mailing
> list, but I thought I would ask here first before I embarass myself on
> the other mailing list.) :]
>
You are correct; it is straight up duplication. Once again to minimize
key strokes; and to preserve backwards compatibility with the earlier
GeoTools Feature interface).
> [3] I'm trying to implement the SimpleFeature.getAttribute(Name
> argName) method. I would like to know if I should be using the
> Name.getLocalPart method for this purpose. For example: I've got a
> SimpleFeature implementation with an attribute that is identified with
> the name "comment". If I constructed a Name object using the fully
> qualified name "org.geotools.gpx2.names.comment" would the
> getLocalPart method be expected to return "comment". I know this will
> depend on my implementation of the Name interface, but I'm just trying
> to figure out the expected behavior at this point. In the meantime, I
> will leave my SimpleFeature.getAttribute(Name argName) method
> unimplemented.
>
You got it right. But once again you only have to get all formal if
there is a point to the exercise; until then new NameImpl( null, "cmt")
will work fine.
If you want to go the extra mile; perhaps "comment" is formally defined
by by the TopGraphix format? For example it looks like some of the GPS
units limit the field to 30 characters? Oh wait here is the schema:
http://www.topografix.com/GPX/1/1/gpx.xsd and the "cmt" field does not
seem to be defined as anything other than an xs:string.
Given that this is an element name it looks like new NameImpl( null,
"cmt" ) is still a good bet.
Cheers,
Jody
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel