fmeobjects.FMEGeometryInstance

This method returns the bounding box of the geometry. |
|
This method returns the bounding cube of the geometry. |
|
Returns the bounds of the geometry. |
|
Remove all measures from the geometry. |
|
Copies all the attributes from the given feature to traits on this geometry, if they match the (optional) regular expression. |
|
Copies the label of the 'sourceGeometry' onto this geometry. |
|
Copies all the traits from the given geometry that match the (optional) regular expression. |
|
Copies all the traits from this geometry to attributes on the given feature, if they match the (optional) regular expression. |
|
Deletes the geometry's label. |
|
Reduces the geometry to 2D. |
|
This sets the geometry's dimension to 3D. |
|
getAppearanceReference(front), |
|
Area calculation. |
|
This method will get the geometry definition reference associated with this geometry instance. |
|
This routine retrieves the 'label' of this geometry as a |
|
This method retrieves the local origin associated with the geometry instance. |
|
Retrieve the names of the measures on this geometry. |
|
|
Retrieves the geometry trait value of the specified trait name. |
Retrieve the names of the traits on this geometry. |
|
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. |
|
|
Returns the type of given trait. |
Gets this geometry instance's transformation matrix. |
|
Returns whether or not the geometry has a label. |
|
Check if this geometry or any sub part of this geometry has measures. |
|
Returns whether or not the geometry is 3D. |
|
Check if the geometry is an aggregate or multi-part collection. |
|
|
Returns |
offset(point), |
|
|
Removes the measure with name 'measureName' if supplied, or the default measure, if there is one. |
|
This method has 4 modes: |
Removes this geometry instance's transformation matrix. |
|
Renames the measure specified by 'oldMeasureName' to the new name, specified by 'newMeasureName'. |
|
|
The angle is CCW up from the horizontal and is measured in degrees. |
|
Applies a scale factor to the geometry instance. |
This method associates an appearance within the Library with this geometry instance. |
|
setGeometryDefinitionReference(gdReference), |
|
Sets the geometry's label with a |
|
|
This method sets the local origin of this geometry instance. |
|
Sets a geometry trait with the specified value. |
This method supplies a null trait value with a type to the geometry. |
|
setTransformationMatrix(matrix), |
- class FMEGeometryInstance
FME GeometryInstance Class
Create an instance of an GeometryInstance geometry object.
init()
Default FMEGeometryInstance constructor.
- Return type:
- Returns:
An instance of an GeometryInstance geometry object.
init(geometry instance)
Create a copy of the passed in GeometryInstance geometry object.
- Parameters:
instance (geometry) – The GeometryInstance geometry object to create a copy of.
- Return type:
- Returns:
An instance of an GeometryInstance Geometry object.
- __init__(*args, **kwargs)
- boundingBox()
This method returns the bounding box of the geometry.
- boundingCube()
This method returns the bounding cube of the geometry.
- bounds()
Returns the bounds of the geometry.
- clearMeasures()
Remove all measures from the geometry.
- Return type:
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.
- Parameters:
sourceFeature (FMEFeature) – The feature to copy attributes from.
overwriteExisting (bool) – Existing traits will be overwritten only if overwriteExisting is
True.regexp (str) – (Optional) The regular expression to match the attributes against. If regexp is not specified, then all attributes will be copied.
prefix (str) – (Optional) The prefix is put on all the trait names as they are copied. If it is not specified, a prefix will not be added to the trait names.
- Return type:
None
- copyLabelFromGeometry(sourceGeometry)
Copies the label of the ‘sourceGeometry’ onto this geometry. If ‘sourceGeometry’s label is blank or
None, this geometry’s label will becomeNone. This method replaces the deprecated copyNameFromGeometry() method.- Parameters:
sourceGeometry (FMEGeometry) – The geometry to copy the label from.
- Return type:
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 (str) – (Optional) The regular expression to match the traits against. If regexp is not specified, or is an empty string, then all traits will be copied.
prefix (str) – (Optional) The prefix is put on all the trait names as they are copied. If it is not specified, a prefix will not be added to the trait names.
- Return type:
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 (str) – (Optional) The regular expression to match the traits against. If regexp is not specified, or is an empty string, then all traits will be copied.
prefix (str) – (Optional) The prefix is put on all the attribute names as they are copied. If it is not specified, a prefix will not be added to the attribute names.
- Return type:
None
- deleteLabel()
Deletes the geometry’s label. If a label existed prior to this call then
Trueis returned; otherwiseFalseis returned. This method replaces the deprecated deleteName() method.- Return type:
- Returns:
Returns a boolean indicating whether or not the label existed before deletion.
- force2D()
Reduces the geometry to 2D.
- Return type:
None
- 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.
- Return type:
None
- getAppearanceReference()
getAppearanceReference(front),
This method returns the appearance reference within the Library associated with this geometry instance. The ‘front’ parameter controls whether this query should return the front or the back appearance reference. Both can be fetched independently.
- getGeometryDefinitionReference()
This method will get the geometry definition reference associated with this geometry instance.
- Return type:
- Returns:
The geometry definition reference.
- getLabel()
This routine retrieves the ‘label’ of this geometry as a
str. This will returnNoneif it did not have a label associated with it. This method replaces the deprecated getName() method.- Return type:
str or None
- Returns:
The geometry’s label.
- getLocalOrigin()
This method retrieves the local origin associated with the geometry instance. :rtype: tuple[float] :return: The local origin, formatted (ddd).
- getMeasureNames()
Retrieve the names of the measures on this geometry.
- Return type:
- Returns:
Return a tuple storing the names of the measures on this geometry. This will return an empty tuple if there are no measures. For
FMEAggregate,FMEMultiSurface, andFMECompositeSurface, this will return the union of all measure names of all of its parts.
- getTrait(traitName)
Retrieves the geometry trait value of the specified trait name. Null trait values will be returned as an empty string. Binary blob traits are returned as a bytearray.
Noneis returned when the trait is not found on the geometry.
- getTraitNames()
Retrieve the names of the traits on this geometry.
- 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
Trueif ‘traitName’ maps to a null trait value on the geometry. Otherwise it isFalse. The second boolean isTrueif ‘traitName’ maps to a no value on the geometry. Otherwise it isFalse. If the trait is absent,FME_ATTR_UNDEFINEDis 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.
- getTraitType(traitName)
Returns the type of given trait. If the trait cannot be found,
FME_ATTR_UNDEFINEDwill 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.
- getTransformationMatrix()
Gets this geometry instance’s transformation matrix. If the geometry instance does not have such a matrix, an identity matrix is returned. Only the top three rows of the matrix will be returned, as the bottom row is always [ 0 0 0 1 ].
- hasLabel()
Returns whether or not the geometry has a label. This method replaces the deprecated hasName() method.
- hasMeasures()
Check if this geometry or any sub part of this geometry has measures.
- is3D()
Returns whether or not the geometry is 3D.
- Return type:
- Returns:
Returns
Trueif the geometry is 3D andFalseotherwise. ForFMENull, this method will always returnTrue. ForFMEAggregate,FMEMultiPoint,FMEMultiArea,FMEMultiTextandFMEMultiCurve, this method will returnTrueif any one of the sub-parts is 3D. If the collection is empty or all of its members are 2D, this method will returnFalse.
- isCollection()
Check if the geometry is an aggregate or multi-part collection.
- measureExists(measureName)
Returns
Trueif the specified measure exists andFalseotherwise. If the ‘measureName’ parameter is not specified then the default measure is checked.
- offset()
offset(point),
Offsets the geometry by the coords specified by ‘point’. The offset will be applied to the transformation matrix associated with this geometry instance. If the geometry instance has no matrix, a new matrix will be created.
- Parameters:
point (FMEPoint) – The point to offset the coordinates of the geometry by.
- Return type:
None.
- removeMeasure(measureName)
Removes the measure with name ‘measureName’ if supplied, or the default measure, if there is one.
- Parameters:
measureName (str) – (Optional) The name of the measure to remove.
- Return type:
None
- removeTraits(regexp)
This method has 4 modes:
Remove all traits at the top level: regex == NULL
Remove some traits at the top level: regex == <string>
Remove all traits at all levels: regex ==
kFME_RecurseAllRemove 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.- Return type:
None
- removeTransformationMatrix()
Removes this geometry instance’s transformation matrix.
- Return type:
None
- renameMeasure(oldMeasureName, newMeasureName)
Renames the measure specified by ‘oldMeasureName’ to the new name, specified by ‘newMeasureName’.
- rotate2D(center, angle)
The angle is CCW up from the horizontal and is measured in degrees. The rotation will be applied to the transformation matrix associated with this geometry instance. If the geometry instance has no matrix, a new matrix will be created.
- scale(xscale, yscale, zscale)
Applies a scale factor to the geometry instance. The scale factor will be applied to the transformation matrix associated with this geometry instance. The ‘zscale’ is ignored if geometry is 2D. If the geometry instance has no matrix, a new matrix will be created.
- Parameters:
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- setAppearanceReference(appearanceRef, front)
This method associates an appearance within the Library with this geometry instance. This is done by passing in the unique appearance reference for this appearance. Subsequent calls to this method on the same side, will override the previous appearance used with the new appearance passed in.
An appearance reference of ‘0’ represents the default appearance. Interpretation of the default appearance is left to the consumer of this geometry. When set at this
FMEGeometryInstancelevel, the appearance represents the default appearance to apply when the contained surfaces use the default appearance instead of a specific appearance. The second parameter controls whether this action should take place on the front of the contained surfaces or the back. Both can be set independently. The ‘appearanceRef’ should be a valid reference to a definition stored in theFMELibrary. If the reference was not found in the library, it will still attach the reference to the instance, but will throw aFMEException. This is an unhealthy situation as it represents a ‘dangling reference’.- Parameters:
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred or the reference was not found in the library and a dangling reference was attached.
- setGeometryDefinitionReference()
setGeometryDefinitionReference(gdReference),
This method sets the geometry definition reference of this geometry instance.
If ‘gdReference’ reference was not found in the library, it will still attach the reference to the instance, but this is an unhealthy situation as it represents a ‘dangling reference’ and the user should remedy this by either adding a Geometry Definition with that exact reference to the library, or else remove the reference from this geometry instance.
- Parameters:
gdReference (int) – A valid geometry definition reference to a geometry definition stored in the
FMELibrary.- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred or the reference was not found in the library and a dangling reference was attached.
- setLabel(name)
Sets the geometry’s label with a
str. By supplying a blank label as input, this method will act asdeleteLabel(). This method replaces the deprecated setName() method.- Parameters:
name (str) – The geometry’s new label.
- Return type:
None
- setLocalOrigin(x, y, z)
This method sets the local origin of this geometry instance. The local origin is the origin from which the geometry instance transformation matrix is applied. The default local origin is (0,0,0).
- 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
Binary values are to be specified as bytearray values or bytes values.
- 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.
- setTransformationMatrix()
setTransformationMatrix(matrix),
Sets this geometry instance’s transformation matrix, replacing the existing matrix if it exists. Only three rows are expected in the input array, as a bottom row of [ 0 0 0 1 ] is assumed.