fmeobjects.FMELine
|
Appends 'line' to the end of the existing line. |
|
Appends 'point' to the end of the line. |
|
Appends 'points' to the end of the line. |
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 name 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 name. |
|
Reduces the geometry to 2D. |
|
|
This sets the geometry's dimension to 3D. |
Area calculation. |
|
Returns the curve as a line. |
|
|
Returns a copy of this curve as a line. |
Returns the end point of this curve. |
|
|
Returns the length of the curve. |
Retrieve the names of the measures on this geometry. |
|
|
Get the value of the default measure at the 'index'. |
|
Returns the value of the default measure, or the measure named by 'measureName'. |
This routine retrieves the 'name' of this geometry as a |
|
|
Gets the point at the specified 'index'. |
Gets the points of the line as a list of |
|
Returns the start point of this curve. |
|
|
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. |
Check if this geometry or any sub part of this geometry has measures. |
|
Returns whether or not the geometry has a name. |
|
|
Returns the index of the first coordinate defined within the tuple 'coord', or |
|
Insert 'point' at 'index'. |
Returns whether or not the geometry is 3D. |
|
|
Returns |
Check if the geometry is an aggregate or multi-part collection. |
|
Returns |
|
|
Returns |
Returns the number of points which are stored. |
|
|
Offsets the geometry by the coords specified by 'offsetPoint'. |
|
Removes any adjacent duplicate points. |
|
Remove the specified measure if it exists. |
|
Remove the point at 'index'. |
|
This method has 4 modes: |
|
Renames the measure specified by 'oldMeasureName' to the new name, specified by 'newMeasureName'. |
|
Resets the coordinates to an 'empty' state. |
This reverses the order of the curve's points. |
|
|
Rotate the curve counterclockwise around the 'center' point by the specified 'angle' (in degrees). |
|
Scale the feature by the given amounts. |
|
Changes the existing end point of this curve. |
|
Set the default measure to the given values. |
|
Set the default measure of the point at 'index' to the given 'measureValue'. |
|
Sets the geometry's name with a |
|
Sets 'point' at the specified index. |
|
Changes the existing start point of this curve. |
|
Sets a geometry trait with the specified value. |
|
This method supplies a null trait value with a type to the geometry. |
|
Take a description of start and end positions (either as a measured 2D/3D distance, percentage, or normalized distance from the beginning, or a vertex index), and chop off only the portion between these positions. |
|
Snip off the portion between two points. |
- class FMELine
FME Line Class
Create an instance of a Line geometry object.
init()
Default
FMELine
constructor.- Return type:
- Returns:
An instance of a Line Geometry object.
init(is3D)
Constructs a 3D line if ‘is3D’ is
True
, otherwise a 2D line is created.- Parameters:
is3D (bool) – The value to set the line’s dimension.
- Return type:
- Returns:
An instance of a Line Geometry object.
init(points)
Creates a line consisting of the list of points passed in.
- Parameters:
points (list[tuple[float]]) – The list of points to set to the line. The points are represented as (x, y) or (x, y, z) tuples
- Return type:
- Returns:
An instance of a Line Geometry object.
init(line)
Create a copy of the passed in Line geometry object.
- Parameters:
FMELine – The Line geometry object to create a copy of.
- Return type:
- Returns:
An instance of a Line Geometry object.
- __init__(*args, **kwargs)
- appendLine(line)
Appends ‘line’ to the end of the existing line. If the existing line has no coordinates, it will have its geometry dimension set based on the first append call made. This line’s points will be forced to have a consistent dimension. If a 2D line is appended to a 3D line, the 2D line will be changed to 3D with a Z value of 0.0. If a 3D line is appended to a 2D line, the 2D line will be changed to 3D with 0.0 for all Z values. The appended line will be forced to have consistent measures. Any unspecified measure values will be set to
None
.- Parameters:
line (FMELine) – The line to append.
- Return type:
None
- appendPoint(point)
Appends ‘point’ to the end of the line. Lines with no coordinates will have their dimension set based on the first append call made. The line’s points will be forced to have a consistent dimension. If a 2D point is appended to a 3D line, the point will be changed to 3D with a Z value of 0.0. If a 3D point is appended to a 2D line, the line will be changed to 3D with 0.0 for all Z values. The points will be forced to have consistent measures. Any unspecified measure values will be set to
None
. Nothing is appended ifNone
is passed in.- Parameters:
point (FMEPoint or tuple) – The point to append to the line.
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- appendPoints(points)
Appends ‘points’ to the end of the line. Lines with no coordinates will have their geometry dimension set based on the first append call made. If this method is called on a 3D line, a Z value of 0.0 will be used for each appended point. If this method is called on a 2D line, the line will be forced to 3D with a default Z value of 0.0. Because this method does not specify measure values, a value of
None
will be used for each point for any existing measures.- Parameters:
points (list[
FMEPoint
]) – The list of points to be added.- Return type:
None
- 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
- 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, 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
- deleteName()
Deletes the geometry’s name. If a name existed prior to this call then
True
is returned; otherwiseFalse
is returned.- Return type:
- Returns:
Returns a boolean indicating whether or not the name 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
- getAsLine()
Returns the curve as a line.
- getAsLineFixedArcSamples(numSamples)
Returns a copy of this curve as a line. All arcs are approximated with the number of points given by ‘numSamples’. If ‘numSamples’ is 0, the number points will first be determined by the value of
kFMEStrokeMaxDeviationValue
directive in mapping file, which denotes the maximum deviation of the arc from the line. In the absence of this directive or the value of this directive is smaller than or equal to 0, the number points will be determined by the arc’s sweep angle and the value of the mapping file directivekFMEDegreesPerEdge
, which defaults to 5.
- getEndPoint()
Returns the end point of this curve. An error is returned and
None
is returned if this curve has no point to return.- Return type:
FMEPoint or None
- Returns:
The end point of the curve, or
None
if there is no point to return.- Raises:
FMEException – An exception is raised if an error occurred.
- getLength(threeD)
Returns the length of the curve. If ‘threeD’ is
True
, this returns the 3D length of the curve, otherwise this returns the 2D length.
- 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.
- getMeasureValueAt(index, measureName)
Get the value of the default measure at the ‘index’. If ‘measureName’ is supplied, this method gets the value of the named measure at ‘index’. Returns an error if the measure doesn’t exist or ‘index’ is out of range.
- Parameters:
- Return type:
- Returns:
The value of the default measure at the given index, or the measure named by ‘measureName’ at the given index.
- Raises:
FMEException – An exception is raised if an error occurred.
- getMeasureValues(measureName)
Returns the value of the default measure, or the measure named by ‘measureName’.
- Parameters:
measureName (str) – (Optional) The name of the measure whose value is to be returned.
- Return type:
- Returns:
The values of the default measure, or the measures named by ‘measureName’.
- Raises:
FMEException – An exception is raised if an error occurred.
- getName()
This routine retrieves the ‘name’ of this geometry as a
str
. This will returnNone
if it did not have a name associated with it.- Return type:
str or None
- Returns:
The geometry’s name.
- getPointAt(index)
Gets the point at the specified ‘index’. An error is returned if the index is out of range.
- Parameters:
index (int) – The index which to retrieve the point from.
- Return type:
- Returns:
The point at the supplied index.
- Raises:
FMEException – An exception is raised if an error occurred.
- getPoints()
Gets the points of the line as a list of
FMEPoint
objects. An exception is raised if an error occurred getting a point from the line.- Return type:
- Returns:
A list of points contained within the line.
- Raises:
FMEException – An exception is raised if an error occurred.
- getStartPoint()
Returns the start point of this curve. An error is returned and
None
is returned if this curve has no point to return.- Return type:
FMEPoint or None
- Returns:
The start point of the curve, or
None
if there is no point to return.- Raises:
FMEException – An exception is raised if an error occurred.
- 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.
None
is 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
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
.
- 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
.
- hasMeasures()
Check if this geometry or any sub part of this geometry has measures.
- hasName()
Returns whether or not the geometry has a name.
- indexOfCoord(coord)
Returns the index of the first coordinate defined within the tuple ‘coord’, or
FME_NPOS32
if no such coordinate is found.- Parameters:
coord (tuple) – The z tuple containing coordinate whose index to search.
- Return type:
- Returns:
The index of the supplied coordinate, or
FME_NPOS32
if no such coordinate exists.
- insertPointAtIndex(point, index)
Insert ‘point’ at ‘index’. All points from that index on will be shifted to allow room for the new point. Any new measures added to the point will be set a default of
None
.- Parameters:
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- is3D()
Returns whether or not the geometry is 3D.
- Return type:
- 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
.
- isClosed(threeD)
Returns
True
if the start and end points have identical coordinate values. If ‘threeD’ isTrue
, the z coordinate of the start and end points will be compared. This does not take measures into consideration.
- isCollection()
Check 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.
- numPoints()
Returns the number of points which are stored.
- Return type:
- Returns:
The number of points which are stored in the line.
- offset(offsetPoint)
Offsets the geometry by the coords specified by ‘offsetPoint’.
- Parameters:
offsetPoint (FMEPoint) – The
FMEPoint
to offset the curve by.- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- removeDuplicates(checkZ)
Removes any adjacent duplicate points. If ‘checkZ’ is
True
, x, y, and z coordinates are checked, otherwise only x and y are.- Parameters:
checkZ (bool) – Whether to check the z coordinate.
- Return type:
None
- removeMeasure(measureName)
Remove the specified measure if it exists. If the measure name, is not provided remove the default measure, if there is one.
- Parameters:
measureName (str) – (Optional) The name of the measure to remove.
- Return type:
None
- removePointAt(index)
Remove the point at ‘index’. Null is returned if the index is out of range.
- 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’.
- reset(coords)
Resets the coordinates to an ‘empty’ state. It does not alter the geometry dimension, but it does remove all measures. If ‘coords’ is supplied, then this method sets the line’s coordinates to the values in the supplied ‘coords’ list.
None
zCoord values will result in a 2D line, otherwise a 3D line is created. This method removes all measures.
- reverse()
This reverses the order of the curve’s points.
- Return type:
None
- rotate2D(center, angle)
Rotate the curve counterclockwise around the ‘center’ point by the specified ‘angle’ (in degrees).
- Parameters:
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- scale(xScale, yScale, zScale)
Scale the feature by the given amounts.
- Parameters:
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- setEndPoint(point)
Changes the existing end point of this curve. If there are no points on the curve, this method does nothing.
- Parameters:
point (FMEPoint) – The point to set at the end of the curve.
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- setMeasure(measureValues, measureName)
Set the default measure to the given values. Create the measure if it doesn’t already exist. If ‘measureName’ is supplied, this method sets the given measure to ‘measureValues’, or creates the measure if it doesn’t already exist. The size of ‘measureValues’ must be exactly equal to the value returned by
numPoints()
.
- setMeasureAt(index, measureValue, measureName)
Set the default measure of the point at ‘index’ to the given ‘measureValue’. If ‘measureName’ is supplied, this method sets the given measure of the point at ‘index’ to ‘measureValue’. It will create the measure, if it doesn’t already exist, and set the measures to all points, other than the point at the given index, to
None
. An error will be returned if the index is out of range.- Parameters:
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- setName(name)
Sets the geometry’s name with a
str
. By supplying a blank name as input, this method will act asdeleteName()
.- Parameters:
name (str) – The geometry’s new name.
- Return type:
None
- setPointAt(index, point)
Sets ‘point’ at the specified index. The line’s points will be forced to have a consistent dimension. If any points are 3D, they all must be. A Z value of 0.0 is used when converting from a 2D point to a 3D point. The points will be forced to have consistent measures. Any unspecified measure values will be set to
None
. An error is returned if the index is out of range.- Parameters:
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- setStartPoint(point)
Changes the existing start point of this curve. If there are no points on the curve, this method does nothing.
- Parameters:
point (FMEPoint) – The point to set at the start of the curve.
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- 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
.
- snip(measureType, measure3D, startLocation, endLocation)
Take a description of start and end positions (either as a measured 2D/3D distance, percentage, or normalized distance from the beginning, or a vertex index), and chop off only the portion between these positions. If the start and end positions are the same, keep two same points.
- Parameters:
measureType (int) – The measure type to use. Must be on of:
SNIP_DISTANCE
,SNIP_PERCENTAGE
,SNIP_VERTEX
orSNIP_POINT
.measure3D (bool) – Whether to measure the 2D or 3D distance.
startLocation (float) – The start location.
endLocation (float) – The end location.
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.
- snipByPoints(startPoint, endPoint)
Snip off the portion between two points. If these points are not on this line, replaced with nearest points which are exactly on the line. If the start and end point are the same, keep two same points.
- Parameters:
- Return type:
None
- Raises:
FMEException – An exception is raised if an error occurred.