org.openjump.core.apitools
Class FeatureSchemaTools

java.lang.Object
  extended by org.openjump.core.apitools.ToolToMakeYourLifeEasier
      extended by org.openjump.core.apitools.FeatureSchemaTools

public class FeatureSchemaTools
extends ToolToMakeYourLifeEasier

Class for easier handling of featureSchema objects.

Version:
$Rev: 2260 $
Author:
Ole Rahn

FH Osnabrück - University of Applied Sciences Osnabrück,
Project: PIROL (2005),
Subproject: Daten- und Wissensmanagement

Constructor Summary
FeatureSchemaTools()
           
 
Method Summary
static Feature copyFeature(Feature feature, FeatureSchema newSchema)
          copy the input feature to a new Schema whereby the new Feature Schema must be an extended or shortened one
static FeatureSchema copyFeatureSchema(FeatureSchema oldSchema)
          Deprecated.  
static AttributeInfo getAttributesInfoFor(FeatureSchema fs, int attrIndex)
          Extracts information on the attribute at the given index from the feature schema.
static AttributeInfo getAttributesInfoFor(FeatureSchema fs, java.lang.String attrName)
          Extracts information on the attribute with the given name from the feature schema.
static AttributeInfo[] getAttributesWithTypes(FeatureSchema fs, AttributeType[] allowedTypes)
          Extracts information of all attributes with one of the given types from the given FeatureSchema
static java.util.List getFieldsFromLayerWithoutGeometry(Layer lyr)
           
static java.util.List getFieldsFromLayerWithoutGeometryAndString(Layer lyr)
           
static boolean isAttributeTypeAllowed(AttributeType at, AttributeType[] allowedTypes)
          Checks if the given attribute type is contained in the given array of allowed attribute types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureSchemaTools

public FeatureSchemaTools()
Method Detail

getAttributesWithTypes

public static AttributeInfo[] getAttributesWithTypes(FeatureSchema fs,
                                                     AttributeType[] allowedTypes)
Extracts information of all attributes with one of the given types from the given FeatureSchema

Parameters:
fs - FeatureSchema to get information from
allowedTypes - array with AttributeTypes, that specify which attribute to get information about
Returns:
array with information on matching attributes

getAttributesInfoFor

public static AttributeInfo getAttributesInfoFor(FeatureSchema fs,
                                                 int attrIndex)
Extracts information on the attribute at the given index from the feature schema.

Parameters:
fs - FeatureSchema to get information from
attrIndex - index of the attribute in the given featureSchema to get information about
Returns:
information about the attribute

getAttributesInfoFor

public static AttributeInfo getAttributesInfoFor(FeatureSchema fs,
                                                 java.lang.String attrName)
Extracts information on the attribute with the given name from the feature schema.

Parameters:
fs - FeatureSchema to get information from
attrName - name of the attribute in the given featureSchema to get information about
Returns:
information about the attribute

isAttributeTypeAllowed

public static boolean isAttributeTypeAllowed(AttributeType at,
                                             AttributeType[] allowedTypes)
Checks if the given attribute type is contained in the given array of allowed attribute types.

Parameters:
at - attribute type to be checked
allowedTypes - array of allowed attribute types
Returns:
true if at is contained in allowedTypes, else false

copyFeatureSchema

public static FeatureSchema copyFeatureSchema(FeatureSchema oldSchema)
Deprecated. 

copy/clone the input featureSchema since it is not proper implemented in Jump Note : FeatureSchema has now a proper deep clone implementation

Parameters:
oldSchema -
Returns:
a new FeatureSchema cloned from oldSchema

copyFeature

public static Feature copyFeature(Feature feature,
                                  FeatureSchema newSchema)
copy the input feature to a new Schema whereby the new Feature Schema must be an extended or shortened one

Parameters:
feature - the feature to copy from
newSchema - the schema to copy to
Returns:
a new feature which is a copy of feature in the new Schema

getFieldsFromLayerWithoutGeometryAndString

public static java.util.List getFieldsFromLayerWithoutGeometryAndString(Layer lyr)

getFieldsFromLayerWithoutGeometry

public static java.util.List getFieldsFromLayerWithoutGeometry(Layer lyr)