Module fmeobjects :: Class FMEGeometry
[hide private]
[frames] | no frames]

Class FMEGeometry

object --+
         |
        FMEGeometry
Known Subclasses:

init()

FMEGeometry is an abstract class. It cannot be created directly.

Instance Methods [hide private]
 
__getObject__(args)
 
__init__()
x.__init__(...) initializes x; see help(type(x)) for signature
a new object with type S, a subtype of T
__new__(T, S, ...)
((float, float), (float, float))
boundingBox()
This method returns the bounding box of the geometry
((float, float, float), (float, float, float))
boundingCube()
This method returns the bounding cube of the geometry
tuple of FMEPoints
bounds()
Returns the bounds of the geometry.
None
clearMeasures()
Remove all measures from the geometry.
None
copyAttributesFromFeature(sourceFeature, overwriteExisting, regexp, prefix)
Copies all the attributes from the given feature to traits on this geometry, if they match the (optional) regular expression.
None
copyNameFromGeometry(sourceGeometry)
Copies the name of the sourceGeometry onto this geometry.
None
copyTraitsFromGeometry(sourceGeometry, overwriteExisting, regexp, prefix)
Copies all the traits from the given geometry that match the (optional) regular expression.
None
copyTraitsToFeature(destFeature, overwriteExisting, regexp, prefix)
Copies all the traits from this geometry to attributes on the given feature, if they match the (optional) regular expression.
bool
deleteName()
Deletes the geometry's name.
None
force2D()
Reduces the geometry to 2D.
None
force3D(newZ)
This sets the geometry's dimension to 3D.
float
getArea()
Area calculation.
tuple of strings
getMeasureNames()
Retrieve the names of the measures on this geometry.
unicode or None
getName()
This routine retrieves the 'name' of this geometry as a unicode string.
bool, int, long, float, string, unicode, bytearray, or None
getTrait(traitName)
Retrieves the geometry trait value of the specified trait name.
tuple of strings
getTraitNames()
Retrieve the names of the traits on this geometry.
tuple of bool bool and int
getTraitNullMissingAndType(traitName)
This method returns a tuple of a boolean, indicating if the trait is null, a boolean, indicating if the trait is missing, and an integer representing the type of the trait.
int
getTraitType(traitName)
Returns the type of given trait.
bool
hasMeasures()
Check if this geometry or any sub part of this geometry has measures.
bool
hasName()
Returns whether or not the geometry has a name.
bool
is3D()
Returns whether or not the geometry is 3D.
bool
isCollection()
Check if the geometry is an aggregate or multi-part collection.
bool
measureExists(measureName)
Returns True if the specified measure exists and False otherwise.
None
removeMeasure(measureName)
Removes the measure with name 'measureName' if supplied, or the default measure, if there is one.
None
removeTraits(regexp)
This method has 4 modes:
None
renameMeasure(oldMeasureName, newMeasureName)
Renames the measure specified by oldMeasureName to the new name, specified by newMeasureName.
None
setName(name)
Sets the geometry's name with a unicode string.
None
setTrait(traitName, traitValue)
Sets a geometry trait with the specified value.
None
setTraitNullWithType(traitName, traitType)
This method supplies a null trait value with a type to the geometry.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__()
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

boundingBox()

 

This method returns the bounding box of the geometry

Returns: ((float, float), (float, float))
The bounding box of the Geometry, in the form ((minx, miny), (maxx, maxy)).

boundingCube()

 

This method returns the bounding cube of the geometry

Returns: ((float, float, float), (float, float, float))
The bounding box of the Geometry, in the form ((minx, miny, minz), (maxx, maxy, maxz)).

bounds()

 

Returns the bounds of the geometry.

Returns: tuple of FMEPoints
The min point and max point of the bounds. None is returned if the geometry contains no points.

copyAttributesFromFeature(sourceFeature, overwriteExisting, regexp, prefix)

 

Copies all the attributes from the given feature to traits on this geometry, if they match the (optional) regular expression.

Parameters:
  • sourceFeature (FMEFeature) - The feature to copy attributes from.
  • overwriteExisting (bool) - Existing traits will be overwritten only if overwriteExisting is True.
  • regexp (string) - If regexp is an empty string then all traits will be copied.
  • prefix (string) - (Optional) The prefix is put on all the trait names as they are copied, if it is not an empty string.
Returns: None

copyNameFromGeometry(sourceGeometry)

 

Copies the name of the sourceGeometry onto this geometry. If sourceGeometry's name is blank or None, this geometry's name will become None.

Parameters:
  • sourceGeometry (FMEGeometry) - The geometry to copy the name from.
Returns: None

copyTraitsFromGeometry(sourceGeometry, overwriteExisting, regexp, prefix)

 

Copies all the traits from the given geometry that match the (optional) regular expression.

Parameters:
  • sourceGeometry (FMEGeometry) - The geometry to copy traits from.
  • overwriteExisting (bool) - Existing traits will be overwritten only if overwriteExisting is True.
  • regexp (string) - If regexp is an empty string then all traits will be copied.
  • prefix (string) - (Optional) The prefix is put on all the trait names as they are copied, if it is not an empty string.
Returns: None

copyTraitsToFeature(destFeature, overwriteExisting, regexp, prefix)

 

Copies all the traits from this geometry to attributes on the given feature, if they match the (optional) regular expression.

Parameters:
  • destFeature (FMEFeature) - The feature to copy traits to.
  • overwriteExisting (bool) - Existing attributes will be overwritten only if overwriteExisting is True.
  • regexp (string) - If regexp is an empty string then all traits will be copied.
  • prefix (string) - (Optional) The prefix is put on all the attribute names as they are copied, if it is not NULL.
Returns: None

deleteName()

 

Deletes the geometry's name. If a name existed prior to this call then True is returned; otherwise False is returned.

Returns: bool
Returns a boolean indicating whether or not the name existed before deletion.

force3D(newZ)

 

This sets the geometry's dimension to 3D. All Z values are set to the value passed in, even if the geometry is already 3D.

Parameters:
  • newZ (float) - The new Z value.
Returns: None

getArea()

 

Area calculation.

Returns: float
The calculated area.

getMeasureNames()

 

Retrieve the names of the measures on this geometry.

Returns: tuple of strings
Return a tuple storing the names of the measures on this geometry. This will return an empty tuple if there are no measures. For FMEAggregates, FMEMultiSurfaces, and FMECompositeSurfaces, this will return the union of all measure names of all of its parts.

getName()

 

This routine retrieves the 'name' of this geometry as a unicode string. This will return None if it did not have a name associated with it.

Returns: unicode or None
The geometry's name.

getTrait(traitName)

 

Retrieves the geometry trait value of the specified trait name. Strings are returned as one of two possible types - system encoded strings or unicode strings, if the source trait was encoded. Null trait values will be returned as an empty string. Binary blob traits are returned as a bytearray.

None is returned when the trait is not found on the geometry.

Parameters:
  • traitName (string) - The name of the geometry trait.
Returns: bool, int, long, float, string, unicode, bytearray, or None
The trait value.
Raises:
  • FMEException - An exception is raised if there was a problem in retrieving the trait value.

getTraitNames()

 

Retrieve the names of the traits on this geometry.

Returns: tuple of strings
Return a tuple storing the names of the traits on this geometry. This will return an empty tuple if there are no traits. For all collections and containers, this will only return the names of traits on the outermost object only.

getTraitNullMissingAndType(traitName)

 

This method returns a tuple of a boolean, indicating if the trait is null, a boolean, indicating if the trait is missing, and an integer representing the type of the trait. The first boolean is True if traitName maps to a null trait value on the geometry. Otherwise it is False. The second boolean is True if traitName maps to a no value on the geometry. Otherwise it is False. If the trait is absent, FME_ATTR_UNDEFINED is returned for the type.

The possible trait types are FME_ATTR_UNDEFINED, FME_ATTR_BOOLEAN, FME_ATTR_INT8, FME_ATTR_UINT8, FME_ATTR_INT16, FME_ATTR_UINT16, FME_ATTR_INT32, FME_ATTR_UINT32, FME_ATTR_REAL32, FME_ATTR_REAL64, FME_ATTR_REAL80, FME_ATTR_STRING, FME_ATTR_ENCODED_STRING, FME_ATTR_INT64, FME_ATTR_UINT64.

Parameters:
  • traitName (string) - The trait's name.
Returns: tuple of bool bool and int
A tuple of 2 boolean values the first indicating whether or not the value of the trait is null, the second indicating whether or not the trait is missing, and an integer representing the trait type.

getTraitType(traitName)

 

Returns the type of given trait. If the trait cannot be found, FME_ATTR_UNDEFINED will be returned.

Returns one of FME_ATTR_UNDEFINED, FME_ATTR_BOOLEAN, FME_ATTR_INT8, FME_ATTR_UINT8, FME_ATTR_INT16, FME_ATTR_UINT16, FME_ATTR_INT32, FME_ATTR_UINT32, FME_ATTR_REAL32, FME_ATTR_REAL64, FME_ATTR_REAL80, FME_ATTR_STRING, FME_ATTR_ENCODED_STRING, FME_ATTR_INT64, FME_ATTR_UINT64.

Parameters:
  • traitName (string) - The trait's name.
Returns: int
The trait type.

hasMeasures()

 

Check if this geometry or any sub part of this geometry has measures.

Returns: bool
True if this geometry or any sub part of this geometry has measures, False otherwise.

hasName()

 

Returns whether or not the geometry has a name.

Returns: bool
Returns True if the geometry has a name and False otherwise.

is3D()

 

Returns whether or not the geometry is 3D.

Returns: bool
Returns True if the geometry is 3D and False otherwise. For FMENull, this method will always return True. For FMEAggregate, FMEMultiPoint, FMEMultiArea, FMEMultiText and FMEMultiCurve, this method will return True if any one of the sub-parts is 3D. If the collection is empty or all of its members are 2D, this method will return False.

isCollection()

 

Check if the geometry is an aggregate or multi-part collection.

Returns: bool
True if the geometry is an aggregate or multi-part collection.

measureExists(measureName)

 

Returns True if the specified measure exists and False otherwise. If the measureName parameter is not specified then the default measure is checked.

Parameters:
  • measureName (string) - (Optional) The measure's name.
Returns: bool
Boolean indicating whether or not the measure exists.

removeMeasure(measureName)

 

Removes the measure with name 'measureName' if supplied, or the default measure, if there is one.

Parameters:
  • measureName (string) - (Optional) The name of the measure to remove.
Returns: None

removeTraits(regexp)

 

This method has 4 modes:

 1) Remove all traits at the top level: regex == NULL
 2) Remove some traits at the top level: regex == <string>
 3) Remove all traits at all levels: regex == kFME_RecurseAll
 4) Remove some traits at all levels: regex == kFME_RecurseSome<string>

For example, specifying regex == NULL for a multi-surface will remove all traits at the root level of the multi-surface, whereas specifying regex == kFME_RecurseSome<string> will remove all traits from all levels of the multi surface that match <string>. If <string> is an illegal regular expression, no traits will be removed.

Returns: None

renameMeasure(oldMeasureName, newMeasureName)

 

Renames the measure specified by oldMeasureName to the new name, specified by newMeasureName.

Parameters:
  • oldMeasureName (string) - The original name of the measure.
  • newMeasureName (string) - The new name of the measure.
Returns: None

setName(name)

 

Sets the geometry's name with a unicode string. By supplying a blank name as input, this method will act as deleteName().

Parameters:
  • name (unicode) - The geometry's new name.
Returns: None

setTrait(traitName, traitValue)

 

Sets a geometry trait with the specified value. If the geometry trait already exists, its value and type will be changed. The following type numeric mappings are used:

PyInt ==> FME_Int32

PyFloat ==> FME_Real64

PyLong ==> FME_Int64

Encoded values are to be specified as unicode strings. Binary values are to be specified as bytearray values.

Parameters:
  • traitName (string) - The name of the geometry trait.
  • traitValue (bool, int, long, float, string, unicode, or bytearray) - The value of the geometry trait.
Returns: None

setTraitNullWithType(traitName, traitType)

 

This method supplies a null trait value with a type to the geometry. If a trait with the same name already exists, it is overwritten.

Trait type must be one of FME_ATTR_UNDEFINED, FME_ATTR_BOOLEAN, FME_ATTR_INT8, FME_ATTR_UINT8, FME_ATTR_INT16, FME_ATTR_UINT16, FME_ATTR_INT32, FME_ATTR_UINT32, FME_ATTR_REAL32, FME_ATTR_REAL64, FME_ATTR_REAL80, FME_ATTR_STRING, FME_ATTR_ENCODED_STRING, FME_ATTR_INT64, FME_ATTR_UINT64.

Parameters:
  • traitName (string) - The trait's name.
  • traitType (int) - An integer representing the trait type.
Returns: None