|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectFeatureTypes
public class FeatureTypes
Utility methods for working against the FeatureType interface.
Many methods from DataUtilities should be refractored here.
Responsibilities:
modules/library/main (gt-main.jar)
Field Summary | |
---|---|
static SimpleFeatureType |
ABSTRACT_FEATURE_TYPE
abstract base type for all feature types |
static int |
ANY_LENGTH
represent an unbounded field length |
static URI |
DEFAULT_NAMESPACE
the default namespace for feature types |
static NameImpl |
DEFAULT_TYPENAME
default feature collection name |
static SimpleFeatureType |
EMPTY
An feature type with no attributes |
Constructor Summary | |
---|---|
FeatureTypes()
|
Method Summary | |
---|---|
static Set |
ancestors(SimpleFeatureType featureType)
|
static boolean |
equals(AttributeDescriptor[] attributesA,
AttributeDescriptor[] attributesB)
|
static boolean |
equals(AttributeDescriptor a,
AttributeDescriptor b)
|
static boolean |
equals(List attributesA,
List attributesB)
|
static boolean |
equals(SimpleFeatureType typeA,
SimpleFeatureType typeB)
Exact equality based on typeNames, namespace, attributes and ancestors |
static boolean |
equalsAncestors(SimpleFeatureType typeA,
SimpleFeatureType typeB)
This method depends on the correct implementation of FeatureType equals We may need to write an implementation that can detect cycles, |
static boolean |
equalsExact(AttributeDescriptor[] attributesA,
AttributeDescriptor[] attributesB)
|
static boolean |
equalsExact(AttributeDescriptor a,
AttributeDescriptor b)
|
static boolean |
equalsExact(List attributesA,
List attributesB)
|
static boolean |
equalsExact(SimpleFeatureType typeA,
SimpleFeatureType typeB)
Exact equality based on typeNames, namespace, attributes and ancestors, including the user maps contents |
static boolean |
equalsId(SimpleFeatureType typeA,
SimpleFeatureType typeB)
Quick check of namespace and typename |
static List<FeatureType> |
getAncestors(FeatureType featureType)
Walks up the type hierarchy of the feature returning all super types of the specified feature type. |
static int |
getFieldLength(PropertyDescriptor descriptor)
This is a 'suitable replacement for extracting the expected field length of an attribute absed on its "facets" (ie Filter describing type restrictions); This code is copied from the ShapefileDataStore where it was written (probably by dzwiers). |
static boolean |
isDecendedFrom(FeatureType featureType,
FeatureType isParentType)
|
static boolean |
isDecendedFrom(FeatureType featureType,
URI namespace,
String typeName)
A query of the the types ancestor information. |
static SimpleFeatureType |
newFeatureType(AttributeDescriptor[] types,
String name)
Create a new FeatureType with the given AttributeTypes. |
static SimpleFeatureType |
newFeatureType(AttributeDescriptor[] types,
String name,
URI ns)
Create a new FeatureType with the given AttributeTypes. |
static SimpleFeatureType |
newFeatureType(AttributeDescriptor[] types,
String name,
URI ns,
boolean isAbstract)
Create a new FeatureType with the given AttributeTypes. |
static SimpleFeatureType |
newFeatureType(AttributeDescriptor[] types,
String name,
URI ns,
boolean isAbstract,
SimpleFeatureType[] superTypes)
The most specific way to create a new FeatureType. |
static SimpleFeatureType |
newFeatureType(AttributeDescriptor[] types,
String name,
URI ns,
boolean isAbstract,
SimpleFeatureType[] superTypes,
AttributeDescriptor defaultGeometry)
The most specific way to create a new FeatureType. |
static SimpleFeatureType |
newFeatureType(AttributeDescriptor[] types,
String name,
URI ns,
boolean isAbstract,
SimpleFeatureType[] superTypes,
GeometryDescriptor defaultGeometry)
The most specific way to create a new FeatureType. |
static SimpleFeature |
transform(SimpleFeature feature,
SimpleFeatureType schema,
MathTransform transform)
Applies transform to all geometry attribute. |
static SimpleFeatureType |
transform(SimpleFeatureType schema,
CoordinateReferenceSystem crs)
Forces the specified CRS on all geometry attributes |
static SimpleFeatureType |
transform(SimpleFeatureType schema,
CoordinateReferenceSystem crs,
boolean forceOnlyMissing)
Forces the specified CRS on geometry attributes (all or some, depends on the parameters). |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final URI DEFAULT_NAMESPACE
public static final SimpleFeatureType ABSTRACT_FEATURE_TYPE
public static final NameImpl DEFAULT_TYPENAME
public static final int ANY_LENGTH
public static final SimpleFeatureType EMPTY
Constructor Detail |
---|
public FeatureTypes()
Method Detail |
---|
public static int getFieldLength(PropertyDescriptor descriptor)
This code is copied from the ShapefileDataStore where it was written (probably by dzwiers). Cholmes is providing documentation.
type
- the AttributeType
public static SimpleFeatureType transform(SimpleFeatureType schema, CoordinateReferenceSystem crs) throws SchemaException
schema
- the original schemacrs
- the forced crs
SchemaException
public static SimpleFeatureType transform(SimpleFeatureType schema, CoordinateReferenceSystem crs, boolean forceOnlyMissing) throws SchemaException
schema
- the original schemacrs
- the forced crsforceOnlyMissing
- if true, will force the specified crs only on the attributes that
do miss one
SchemaException
public static SimpleFeature transform(SimpleFeature feature, SimpleFeatureType schema, MathTransform transform) throws MismatchedDimensionException, TransformException, IllegalAttributeException
feature
- Feature to be transformedschema
- Schema for target transformation - transform( schema, crs )transform
- MathTransform used to transform coordinates - reproject( crs, crs )
TransformException
MismatchedDimensionException
IllegalAttributeException
public static SimpleFeatureType newFeatureType(AttributeDescriptor[] types, String name, URI ns, boolean isAbstract, SimpleFeatureType[] superTypes) throws FactoryRegistryException, SchemaException
types
- The AttributeTypes to create the FeatureType with.name
- The typeName of the FeatureType. Required, may not be null.ns
- The namespace of the FeatureType. Optional, may be null.isAbstract
- True if this created type should be abstract.superTypes
- A Collection of types the FeatureType will inherit from. Currently, all
types inherit from feature in the opengis namespace.
FactoryRegistryException
- If there are problems creating a factory.
SchemaException
- If the AttributeTypes provided are invalid in some way.public static SimpleFeatureType newFeatureType(AttributeDescriptor[] types, String name, URI ns, boolean isAbstract, SimpleFeatureType[] superTypes, AttributeDescriptor defaultGeometry) throws FactoryRegistryException, SchemaException
types
- The AttributeTypes to create the FeatureType with.name
- The typeName of the FeatureType. Required, may not be null.ns
- The namespace of the FeatureType. Optional, may be null.isAbstract
- True if this created type should be abstract.superTypes
- A Collection of types the FeatureType will inherit from. Currently, all
types inherit from feature in the opengis namespace.
FactoryRegistryException
- If there are problems creating a factory.
SchemaException
- If the AttributeTypes provided are invalid in some way.public static SimpleFeatureType newFeatureType(AttributeDescriptor[] types, String name, URI ns, boolean isAbstract, SimpleFeatureType[] superTypes, GeometryDescriptor defaultGeometry) throws FactoryRegistryException, SchemaException
types
- The AttributeTypes to create the FeatureType with.name
- The typeName of the FeatureType. Required, may not be null.ns
- The namespace of the FeatureType. Optional, may be null.isAbstract
- True if this created type should be abstract.superTypes
- A Collection of types the FeatureType will inherit from. Currently, all
types inherit from feature in the opengis namespace.
FactoryRegistryException
- If there are problems creating a factory.
SchemaException
- If the AttributeTypes provided are invalid in some way.public static SimpleFeatureType newFeatureType(AttributeDescriptor[] types, String name, URI ns, boolean isAbstract) throws FactoryRegistryException, SchemaException
newFeatureType(types,name,ns,isAbstract,null)
.
types
- The AttributeTypes to create the FeatureType with.name
- The typeName of the FeatureType. Required, may not be null.ns
- The namespace of the FeatureType. Optional, may be null.isAbstract
- True if this created type should be abstract.
FactoryRegistryException
- If there are problems creating a factory.
SchemaException
- If the AttributeTypes provided are invalid in some way.public static SimpleFeatureType newFeatureType(AttributeDescriptor[] types, String name, URI ns) throws FactoryRegistryException, SchemaException
newFeatureType(types,name,ns,false,null)
.
types
- The AttributeTypes to create the FeatureType with.name
- The typeName of the FeatureType. Required, may not be null.ns
- The namespace of the FeatureType. Optional, may be null.
FactoryRegistryException
- If there are problems creating a factory.
SchemaException
- If the AttributeTypes provided are invalid in some way.public static SimpleFeatureType newFeatureType(AttributeDescriptor[] types, String name) throws FactoryRegistryException, SchemaException
newFeatureType(types,name,null,false,null)
. Useful for test cases or
datasources which may not allow a namespace.
types
- The AttributeTypes to create the FeatureType with.name
- The typeName of the FeatureType. Required, may not be null.
FactoryRegistryException
- If there are problems creating a factory.
SchemaException
- If the AttributeTypes provided are invalid in some way.public static List<FeatureType> getAncestors(FeatureType featureType)
public static boolean isDecendedFrom(FeatureType featureType, URI namespace, String typeName)
This utility method may be used as common implementation for
FeatureType.isDecendedFrom( namespace, typeName )
, however for specific uses,
such as GML, an implementor may be able to provide a more efficient implemenation based on
prior knolwege.
This is a proper check, if the provided FeatureType matches the given namespace and typename it is not considered to be decended from itself.
featureType
- typeName with parentage in questionnamespace
- namespace to match against, or null for a "wildcard"typeName
- typename to match against, or null for a "wildcard"
public static boolean isDecendedFrom(FeatureType featureType, FeatureType isParentType)
public static boolean equals(SimpleFeatureType typeA, SimpleFeatureType typeB)
public static boolean equalsExact(SimpleFeatureType typeA, SimpleFeatureType typeB)
public static boolean equals(List attributesA, List attributesB)
public static boolean equalsExact(List attributesA, List attributesB)
public static boolean equals(AttributeDescriptor[] attributesA, AttributeDescriptor[] attributesB)
public static boolean equalsExact(AttributeDescriptor[] attributesA, AttributeDescriptor[] attributesB)
public static boolean equalsAncestors(SimpleFeatureType typeA, SimpleFeatureType typeB)
We may need to write an implementation that can detect cycles,
typeA
- typeB
- public static Set ancestors(SimpleFeatureType featureType)
public static boolean equals(AttributeDescriptor a, AttributeDescriptor b)
public static boolean equalsExact(AttributeDescriptor a, AttributeDescriptor b)
public static boolean equalsId(SimpleFeatureType typeA, SimpleFeatureType typeB)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |