fmeobjects.FMEText¶

FMEText.boundingBox () |
This method returns the bounding box of the geometry. |
FMEText.boundingCube () |
This method returns the bounding cube of the geometry. |
FMEText.bounds () |
Returns the bounds of the geometry. |
FMEText.clearMeasures () |
Remove all measures from the geometry. |
FMEText.copyAttributesFromFeature (…) |
Copies all the attributes from the given feature to traits on this geometry, if they match the (optional) regular expression. |
FMEText.copyNameFromGeometry (sourceGeometry) |
Copies the name of the ‘sourceGeometry’ onto this geometry. |
FMEText.copyTraitsFromGeometry (…) |
Copies all the traits from the given geometry that match the (optional) regular expression. |
FMEText.copyTraitsToFeature (destFeature, …) |
Copies all the traits from this geometry to attributes on the given feature, if they match the (optional) regular expression. |
FMEText.deleteName () |
Deletes the geometry’s name. |
FMEText.force2D () |
Reduces the geometry to 2D. |
FMEText.force3D (newZ) |
This sets the geometry’s dimension to 3D. |
FMEText.getArea () |
Area calculation. |
FMEText.getLocation (asPoint) |
Returns the location of the text. |
FMEText.getMeasureNames () |
Retrieve the names of the measures on this geometry. |
FMEText.getName () |
This routine retrieves the ‘name’ of this geometry as a six.text_type . |
FMEText.getTextRotation () |
Returns the rotation of the text object. |
FMEText.getTextSize () |
Returns the text size of the text object. |
FMEText.getTextString () |
Returns the text string of this text. |
FMEText.getTrait (traitName) |
Retrieves the geometry trait value of the specified trait name. |
FMEText.getTraitNames () |
Retrieve the names of the traits on this geometry. |
FMEText.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. |
FMEText.getTraitType (traitName) |
Returns the type of given trait. |
FMEText.hasMeasures () |
Check if this geometry or any sub part of this geometry has measures. |
FMEText.hasName () |
Returns whether or not the geometry has a name. |
FMEText.is3D () |
Returns whether or not the geometry is 3D. |
FMEText.isCollection () |
Check if the geometry is an aggregate or multi-part collection. |
FMEText.measureExists (measureName) |
Returns True if the specified measure exists and False otherwise. |
FMEText.offset (offsetPoint) |
Offsets the geometry by the coordinate values specified by ‘offsetPoint’. |
FMEText.removeMeasure (measureName) |
Removes the measure with name ‘measureName’ if supplied, or the default measure, if there is one. |
FMEText.removeTraits (regexp) |
This method has 4 modes: |
FMEText.renameMeasure (oldMeasureName, …) |
Renames the measure specified by ‘oldMeasureName’ to the new name, specified by ‘newMeasureName’. |
FMEText.reset (text) |
Resets the existing text object, and sets its values to the data stored in ‘text’. |
FMEText.rotate2D (center, angle) |
Rotates the text counterclockwise around the ‘center’ point by the specified ‘angle’ (in degrees). |
FMEText.scale (xScale, yScale, zScale, scaleText) |
Scale the feature by the given amounts. |
FMEText.setLocation (location) |
Sets the existing text object’s location to the value in ‘location’. |
FMEText.setName (name) |
Sets the geometry’s name with a six.text_type . |
FMEText.setTextRotation (textRotation) |
Sets the rotation of the existing text object to ‘textRotation’. |
FMEText.setTextSize (textSize) |
Sets the existing text object’s size to the value in ‘textSize’. |
FMEText.setTextString (textString) |
Sets the existing text object’s text string to ‘textString’. |
FMEText.setTrait (traitName, traitValue) |
Sets a geometry trait with the specified value. |
FMEText.setTraitNullWithType (traitName, …) |
This method supplies a null trait value with a type to the geometry. |
-
class
FMEText
¶ Bases:
fmeobjects.FMEGeometry
FME Text Class
Create an instance of a Text geometry object.
init(location, textString, textSize, textRotation)
Creates a new Text geometry object. ‘textRotation’ is CCW up from the horizontal and is measured in degrees. ‘textSize’ is the height of the text’s box before rotation. It includes all lines and interline spacing for multi-line text. The ‘textString’ is specified as a
six.text_type
, which is set as an encoded text string on the text object.Parameters: - location (FMEGeometry) – The location of the text.
- textString (six.text_type) – The string to set.
- textSize (float) – The size of the string to set.
- textRotation (float) – The rotation value to set.
Return type: Returns: An instance of a text geometry object.
init(text)
Create a copy of the passed in Text geometry object.
Parameters: text (FMEText) – The Text geometry object to create a copy of. Return type: FMEText Returns: An instance of a Text Geometry object. -
__init__
¶ Initialize self. See help(type(self)) for accurate signature.
-
boundingBox
()¶ This method returns the bounding box of the geometry.
Return type: tuple[tuple[float]] Returns: The bounding box of the Geometry, in the form ((minx, miny), (maxx, maxy)).
-
boundingCube
()¶ This method returns the bounding cube of the geometry.
Return type: tuple[tuple[float]] Returns: The bounding box of the Geometry, in the form ((minx, miny, minz), (maxx, maxy, maxz)).
-
bounds
()¶ Returns the bounds of the geometry.
Return type: tuple[FMEPoint] Returns: 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 (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:
-
copyNameFromGeometry
(sourceGeometry)¶ Copies the name of the ‘sourceGeometry’ onto this geometry. If ‘sourceGeometry’s name is blank or
None
, this geometry’s name will becomeNone
.Parameters: sourceGeometry (FMEGeometry) – The geometry to copy the name 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, 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:
-
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, 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:
-
deleteName
()¶ Deletes the geometry’s name. If a name existed prior to this call then
True
is returned; otherwiseFalse
is returned.Return type: bool Returns: 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. Return type: None
-
getLocation
(asPoint)¶ Returns the location of the text. If ‘asPoint’ is
True
, the location will be returned as aFMEPoint
.Parameters: asPoint (bool) – Whether to return the location as a FMEPoint
Return type: FMEGeometry or FMEPoint Returns: The location of the text.
-
getMeasureNames
()¶ Retrieve the names of the measures on this geometry.
Return type: tuple[string] 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.
-
getName
()¶ This routine retrieves the ‘name’ of this geometry as a
six.text_type
. This will returnNone
if it did not have a name associated with it.Return type: six.text_type or None Returns: The geometry’s name.
-
getTextRotation
()¶ Returns the rotation of the text object. The returned rotation is counter-clockwise up from the horizontal and is measured in degrees.
Return type: float Returns: The rotation of the text object.
-
getTextSize
()¶ Returns the text size of the text object. Text size is actually the height of hte text’s box before rotation. It includes all lines and interline spacing for multiline text.
Return type: float Returns: The text size of the text object.
-
getTextString
()¶ Returns the text string of this text. It includes all lines and interline spacing for multi-line text.
Return type: six.text_type Returns: The text string of the text object. Raises: FMEException – An exception is raised if an error occurred.
-
getTrait
(traitName)¶ Retrieves the geometry trait value of the specified trait name. For Python 2.7, 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 (str) – The name of the geometry trait. Return type: bool, int, long, float, six.string_types, bytearray, bytes or None Returns: 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.
Return type: tuple[str] Returns: 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 isFalse
. The second boolean isTrue
if ‘traitName’ maps to a no value on the geometry. Otherwise it isFalse
. 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 (str) – The trait’s name. Return type: tuple[bool, bool, int] Returns: 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 (str) – The trait’s name. Return type: int Returns: The trait type.
-
hasMeasures
()¶ Check if this geometry or any sub part of this geometry has measures.
Return type: bool Returns: 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.
Return type: bool Returns: Returns True
if the geometry has a name andFalse
otherwise.
-
is3D
()¶ Returns whether or not the geometry is 3D.
Return type: bool Returns: Returns True
if the geometry is 3D andFalse
otherwise. ForFMENull
, this method will always returnTrue
. ForFMEAggregate
,FMEMultiPoint
,FMEMultiArea
,FMEMultiText
andFMEMultiCurve
, this method will returnTrue
if 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.
Return type: bool Returns: True
if the geometry is an aggregate or multi-part collection.
-
measureExists
(measureName)¶ Returns
True
if the specified measure exists andFalse
otherwise. If the ‘measureName’ parameter is not specified then the default measure is checked.Parameters: measureName (str) – (Optional) The measure’s name. Return type: bool Returns: Boolean indicating whether or not the measure exists.
-
offset
(offsetPoint)¶ Offsets the geometry by the coordinate values specified by ‘offsetPoint’. An error is returned if the operation is unsuccessful.
Parameters: offsetPoint (FMEPoint) – The point whose coordinate values will be used to offset the text object. Return type: None Raises: FMEException – An exception is raised if an error occurred.
-
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_RecurseAll
- 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.Return type: None
-
renameMeasure
(oldMeasureName, newMeasureName)¶ Renames the measure specified by ‘oldMeasureName’ to the new name, specified by ‘newMeasureName’.
Parameters: Return type:
-
reset
(text)¶ Resets the existing text object, and sets its values to the data stored in ‘text’.
Parameters: text (FMEText) – The FMEText
object whose data will be set to the existing text object.Return type: None
-
rotate2D
(center, angle)¶ Rotates the text counterclockwise around the ‘center’ point by the specified ‘angle’ (in degrees). An error is returned if the operation is unsucessful.
Parameters: Return type: Raises: FMEException – An exception is raised if an error occurred.
-
scale
(xScale, yScale, zScale, scaleText)¶ Scale the feature by the given amounts. ‘zScale’ is ignored if the text object is 2D. An error is returned if the operation is unsucessful.
Parameters: Return type: Raises: FMEException – An exception is raised if an error occurred.
-
setLocation
(location)¶ Sets the existing text object’s location to the value in ‘location’. An error is returned if the new location is invalid or NULL.
Parameters: location (FMEGeometry) – The new location to set the existing text object to. Return type: None Raises: FMEException – An exception is raised if an error occurred.
-
setName
(name)¶ Sets the geometry’s name with a
six.text_type
. By supplying a blank name as input, this method will act asdeleteName()
.Parameters: name (six.text_type) – The geometry’s new name. Return type: None
-
setTextRotation
(textRotation)¶ Sets the rotation of the existing text object to ‘textRotation’. ‘textRotation’ is counter-clockwise up from the horizontal and measured in degrees.
Parameters: textRotation (float) – The new text rotation. Return type: None
-
setTextSize
(textSize)¶ Sets the existing text object’s size to the value in ‘textSize’. An error is returned if the new size is invalid or NULL.
Parameters: textSize (float) – The new size to set the existing text object to. Return type: None Raises: FMEException – An exception is raised if an error occurred.
-
setTextString
(textString)¶ Sets the existing text object’s text string to ‘textString’. The ‘textString’ is specified as a
six.text_type
, which is set as an encoded text string on the text object.Parameters: textString (six.text_type) – The new text string to set on the text object. Return type: 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
For Python 2.7, strings can be input as one of two possible types: system encoded strings or unicode strings. Binary values are to be specified as bytearray values or bytes values for Python 3 and as bytearray values for Python 2.7.
Parameters: Return type:
-
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: Return type: