|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.feature.FeatureTypes
public class FeatureTypes
Utility methods for working against the FeatureType interface.
Many methods from DataUtilities should be refractored here.
Responsibilities:
Field Summary | |
---|---|
static org.opengis.feature.simple.SimpleFeatureType |
ABSTRACT_FEATURE_TYPE
abstract base type for all feature types |
static int |
ANY_LENGTH
represent an unbounded field length |
static java.net.URI |
DEFAULT_NAMESPACE
the default namespace for feature types |
static NameImpl |
DEFAULT_TYPENAME
default feature collection name |
static org.opengis.feature.simple.SimpleFeatureType |
EMPTY
An feature type with no attributes |
Constructor Summary | |
---|---|
FeatureTypes()
|
Method Summary | |
---|---|
static java.util.Set |
ancestors(org.opengis.feature.simple.SimpleFeatureType featureType)
|
static boolean |
equals(org.opengis.feature.type.AttributeDescriptor[] attributesA,
org.opengis.feature.type.AttributeDescriptor[] attributesB)
|
static boolean |
equals(org.opengis.feature.type.AttributeDescriptor a,
org.opengis.feature.type.AttributeDescriptor b)
|
static boolean |
equals(java.util.List attributesA,
java.util.List attributesB)
|
static boolean |
equals(org.opengis.feature.simple.SimpleFeatureType typeA,
org.opengis.feature.simple.SimpleFeatureType typeB)
Exact equality based on typeNames, namespace, attributes and ancestors |
static boolean |
equalsAncestors(org.opengis.feature.simple.SimpleFeatureType typeA,
org.opengis.feature.simple.SimpleFeatureType typeB)
This method depends on the correct implementation of FeatureType equals |
static boolean |
equalsExact(org.opengis.feature.type.AttributeDescriptor[] attributesA,
org.opengis.feature.type.AttributeDescriptor[] attributesB)
|
static boolean |
equalsExact(org.opengis.feature.type.AttributeDescriptor a,
org.opengis.feature.type.AttributeDescriptor b)
|
static boolean |
equalsExact(java.util.List attributesA,
java.util.List attributesB)
|
static boolean |
equalsExact(org.opengis.feature.simple.SimpleFeatureType typeA,
org.opengis.feature.simple.SimpleFeatureType typeB)
Exact equality based on typeNames, namespace, attributes and ancestors, including the user maps contents |
static boolean |
equalsId(org.opengis.feature.simple.SimpleFeatureType typeA,
org.opengis.feature.simple.SimpleFeatureType typeB)
Quick check of namespace and typename |
static java.util.List<org.opengis.feature.type.FeatureType> |
getAncestors(org.opengis.feature.type.FeatureType featureType)
Walks up the type hierarchy of the feature returning all super types of the specified feature type. |
static int |
getFieldLength(org.opengis.feature.type.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); |
static boolean |
isDecendedFrom(org.opengis.feature.type.FeatureType featureType,
org.opengis.feature.type.FeatureType isParentType)
|
static boolean |
isDecendedFrom(org.opengis.feature.type.FeatureType featureType,
java.net.URI namespace,
java.lang.String typeName)
A query of the the types ancestor information. |
static org.opengis.feature.simple.SimpleFeatureType |
newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types,
java.lang.String name)
Create a new FeatureType with the given AttributeTypes. |
static org.opengis.feature.simple.SimpleFeatureType |
newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types,
java.lang.String name,
java.net.URI ns)
Create a new FeatureType with the given AttributeTypes. |
static org.opengis.feature.simple.SimpleFeatureType |
newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types,
java.lang.String name,
java.net.URI ns,
boolean isAbstract)
Create a new FeatureType with the given AttributeTypes. |
static org.opengis.feature.simple.SimpleFeatureType |
newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types,
java.lang.String name,
java.net.URI ns,
boolean isAbstract,
org.opengis.feature.simple.SimpleFeatureType[] superTypes)
The most specific way to create a new FeatureType. |
static org.opengis.feature.simple.SimpleFeatureType |
newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types,
java.lang.String name,
java.net.URI ns,
boolean isAbstract,
org.opengis.feature.simple.SimpleFeatureType[] superTypes,
org.opengis.feature.type.AttributeDescriptor defaultGeometry)
The most specific way to create a new FeatureType. |
static org.opengis.feature.simple.SimpleFeatureType |
newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types,
java.lang.String name,
java.net.URI ns,
boolean isAbstract,
org.opengis.feature.simple.SimpleFeatureType[] superTypes,
org.opengis.feature.type.GeometryDescriptor defaultGeometry)
The most specific way to create a new FeatureType. |
static org.opengis.feature.simple.SimpleFeature |
transform(org.opengis.feature.simple.SimpleFeature feature,
org.opengis.feature.simple.SimpleFeatureType schema,
org.opengis.referencing.operation.MathTransform transform)
Applies transform to all geometry attribute. |
static org.opengis.feature.simple.SimpleFeatureType |
transform(org.opengis.feature.simple.SimpleFeatureType schema,
org.opengis.referencing.crs.CoordinateReferenceSystem crs)
Forces the specified CRS on all geometry attributes |
static org.opengis.feature.simple.SimpleFeatureType |
transform(org.opengis.feature.simple.SimpleFeatureType schema,
org.opengis.referencing.crs.CoordinateReferenceSystem crs,
boolean forceOnlyMissing)
Forces the specified CRS on geometry attributes (all or some, depends on the parameters). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.net.URI DEFAULT_NAMESPACE
public static final org.opengis.feature.simple.SimpleFeatureType ABSTRACT_FEATURE_TYPE
public static final NameImpl DEFAULT_TYPENAME
public static final int ANY_LENGTH
public static final org.opengis.feature.simple.SimpleFeatureType EMPTY
Constructor Detail |
---|
public FeatureTypes()
Method Detail |
---|
public static int getFieldLength(org.opengis.feature.type.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 org.opengis.feature.simple.SimpleFeatureType transform(org.opengis.feature.simple.SimpleFeatureType schema, org.opengis.referencing.crs.CoordinateReferenceSystem crs) throws SchemaException
schema
- the original schemacrs
- the forced crs
SchemaException
public static org.opengis.feature.simple.SimpleFeatureType transform(org.opengis.feature.simple.SimpleFeatureType schema, org.opengis.referencing.crs.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 org.opengis.feature.simple.SimpleFeature transform(org.opengis.feature.simple.SimpleFeature feature, org.opengis.feature.simple.SimpleFeatureType schema, org.opengis.referencing.operation.MathTransform transform) throws org.opengis.geometry.MismatchedDimensionException, org.opengis.referencing.operation.TransformException, IllegalAttributeException
feature
- Feature to be transformedschema
- Schema for target transformation - transform( schema, crs )transform
- MathTransform used to transform coordinates - reproject( crs, crs )
org.opengis.referencing.operation.TransformException
org.opengis.geometry.MismatchedDimensionException
IllegalAttributeException
public static org.opengis.feature.simple.SimpleFeatureType newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types, java.lang.String name, java.net.URI ns, boolean isAbstract, org.opengis.feature.simple.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 org.opengis.feature.simple.SimpleFeatureType newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types, java.lang.String name, java.net.URI ns, boolean isAbstract, org.opengis.feature.simple.SimpleFeatureType[] superTypes, org.opengis.feature.type.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 org.opengis.feature.simple.SimpleFeatureType newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types, java.lang.String name, java.net.URI ns, boolean isAbstract, org.opengis.feature.simple.SimpleFeatureType[] superTypes, org.opengis.feature.type.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 org.opengis.feature.simple.SimpleFeatureType newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types, java.lang.String name, java.net.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 org.opengis.feature.simple.SimpleFeatureType newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types, java.lang.String name, java.net.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 org.opengis.feature.simple.SimpleFeatureType newFeatureType(org.opengis.feature.type.AttributeDescriptor[] types, java.lang.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 java.util.List<org.opengis.feature.type.FeatureType> getAncestors(org.opengis.feature.type.FeatureType featureType)
public static boolean isDecendedFrom(org.opengis.feature.type.FeatureType featureType, java.net.URI namespace, java.lang.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(org.opengis.feature.type.FeatureType featureType, org.opengis.feature.type.FeatureType isParentType)
public static boolean equals(org.opengis.feature.simple.SimpleFeatureType typeA, org.opengis.feature.simple.SimpleFeatureType typeB)
public static boolean equalsExact(org.opengis.feature.simple.SimpleFeatureType typeA, org.opengis.feature.simple.SimpleFeatureType typeB)
public static boolean equals(java.util.List attributesA, java.util.List attributesB)
public static boolean equalsExact(java.util.List attributesA, java.util.List attributesB)
public static boolean equals(org.opengis.feature.type.AttributeDescriptor[] attributesA, org.opengis.feature.type.AttributeDescriptor[] attributesB)
public static boolean equalsExact(org.opengis.feature.type.AttributeDescriptor[] attributesA, org.opengis.feature.type.AttributeDescriptor[] attributesB)
public static boolean equalsAncestors(org.opengis.feature.simple.SimpleFeatureType typeA, org.opengis.feature.simple.SimpleFeatureType typeB)
We may need to write an implementation that can detect cycles,
typeA
- typeB
- public static java.util.Set ancestors(org.opengis.feature.simple.SimpleFeatureType featureType)
public static boolean equals(org.opengis.feature.type.AttributeDescriptor a, org.opengis.feature.type.AttributeDescriptor b)
public static boolean equalsExact(org.opengis.feature.type.AttributeDescriptor a, org.opengis.feature.type.AttributeDescriptor b)
public static boolean equalsId(org.opengis.feature.simple.SimpleFeatureType typeA, org.opengis.feature.simple.SimpleFeatureType typeB)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |