Need to be able to detect Annotation Feature in FeatureType Inheritance

Description

Root problem:
Need to be able to detect an "Annotation" Feature.

Solution to Root problem:
Create a FeatureType (AnnotationFeatureType) that can be used as an
ancestor feature type to the Annotation features. The
AnnotationFeatureType defines an attribute (annotation_attribute_name)
that contains the name of the attribute to use to get the text that
should be displayed for the feature.

Problem with above Solution:
I can't set the attribute defined in the AnnotationFeatureType through
either the feature type create( Object[] ) method or the setAttribute
methods on the feature.

Vaguely thought out solution to above:
Have the DefaultFeature do some kind of searching up through the
ancestor types of the feature type.

And vague problems with the vague solution:
For the get/setAttribute methods that take an xPath argument this is
easy, if it's not found locally just start searching through the
ancestors. For the indexed versions it's trickier. For it to <b>really</b>
work right the FeatureType's getAttributeType methods should somehow
include the ancestor types.

Attached is the feature type definition I'm using right now. Below
are some code snippets that show how I'm making use of it.

// To build the feature type:
Vector superTypes = new Vector();
// if it's a text geometry feature type add annotation as a super type
if (textTypeFeature)
{
superTypes.add( AnnotationFeatureType.ANNOTATION );
}

featureType = new DefaultFeatureType(cName, "VPF", columns,
superTypes, gat);

// To build the feature:
boolean textPrimitive = pathName.endsWith(TEXT_PRIMITIVE);
int size = columns.size();
if (textPrimitive) size++;
Object[] values = new Object;
try {
for (int inx = 0; inx &lt; columns.size(); inx++)
{
...
}
if (textPrimitive)
values = "nam";
result = featureType.create(values);
}
// Of course this fails with a schema exception
// It should instead probably create the feature then
// manually add the extra attribute...

// Detecting and using the annotation:
if ( feature.getFeatureType().isDescendedFrom(
org.geotools.data.vpf.AnnotationFeatureType.ANNOTATION ) )
{
String attrName = (String)feature.getAttribute(
org.geotools.data.vpf.AnnotationFeatureType.ANNOTATION_ATTRIBUTE_NAME );
String annotationText = (String)feature.getAttribute( attrName );
...
}

Environment

None

Activity

Show:
codehaus
April 10, 2015, 3:09 PM

CodeHaus Comment From: aaime - Time: Sun, 28 Nov 2010 02:57:12 -0600
---------------------
Mass closing all issues that have been in &quot;resolved&quot; state for 2 months or more without any feedback or update

Assignee

Unassigned

Reporter

codehaus

Triage

None

Components

Priority

High
Configure