fmeobjects.FMEDonut

Inheritance diagram of fmeobjects.FMEDonut

FMEDonut.addInnerBoundaryCurve(innerBoundary)

If the inner boundary being added has a different dimension than the other boundaries, anything 2D will be forced to 3D.

FMEDonut.addInnerBoundarySimpleArea(...)

Adds a simple area as an inner boundary.

FMEDonut.boundingBox()

This method returns the bounding box of the geometry.

FMEDonut.boundingCube()

This method returns the bounding cube of the geometry.

FMEDonut.bounds()

Returns the bounds of the geometry.

FMEDonut.clearMeasures()

Remove all measures from the geometry.

FMEDonut.copyAttributesFromFeature(...)

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

FMEDonut.copyNameFromGeometry(sourceGeometry)

Copies the name of the 'sourceGeometry' onto this geometry.

FMEDonut.copyTraitsFromGeometry(...)

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

FMEDonut.copyTraitsToFeature(destFeature, ...)

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

FMEDonut.deleteName()

Deletes the geometry's name.

FMEDonut.force2D()

Reduces the geometry to 2D.

FMEDonut.force3D(newZ)

This sets the geometry's dimension to 3D.

FMEDonut.getArea()

Area calculation.

FMEDonut.getInnerBoundaryAsCurveAt(index)

Retrieves the inner boundary at 'index' as a FMECurve.

FMEDonut.getInnerBoundaryAsSimpleAreaAt(index)

Retrieves the inner boundary at 'index' as a FMESimpleArea.

FMEDonut.getMeasureNames()

Retrieve the names of the measures on this geometry.

FMEDonut.getName()

This routine retrieves the 'name' of this geometry as a str.

FMEDonut.getOuterBoundaryAsCurve()

Retrieves the outer boundary as a FMECurve.

FMEDonut.getOuterBoundaryAsSimpleArea()

Retrieves the outer boundary as a FMESimpleArea.

FMEDonut.getTrait(traitName)

Retrieves the geometry trait value of the specified trait name.

FMEDonut.getTraitNames()

Retrieve the names of the traits on this geometry.

FMEDonut.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.

FMEDonut.getTraitType(traitName)

Returns the type of given trait.

FMEDonut.hasMeasures()

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

FMEDonut.hasName()

Returns whether or not the geometry has a name.

FMEDonut.is3D()

Returns whether or not the geometry is 3D.

FMEDonut.isBoundaryLinear()

Returns True if the outer boundary (and inner boundaries in the case of FMEDonut) of this area contains FMELine only.

FMEDonut.isCollection()

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

FMEDonut.isConvex()

Determines if area is convex.

FMEDonut.isInPlane(tolerance, normalVector, ...)

Works similarly to isPlanar(), but checks planarity with respect to given normal or given plane (if plane equation D is specified - see below).

FMEDonut.isOriented(rightOrLeft)

This returns True if the geometry has the specified orientation.

FMEDonut.isPlanar(tolerance)

Returns True if this is planar within the given tolerance, and False otherwise.

FMEDonut.measureExists(measureName)

Returns True if the specified measure exists and False otherwise.

FMEDonut.numInnerBoundaries()

Returns the number of inner boundaries on this donut.

FMEDonut.offset(offsetPoint)

Offsets the area by the coords specified by 'offsetPoint'.

FMEDonut.orient(rightOrLeft)

This sets the geometry to the specified orientation.

FMEDonut.removeDuplicates(checkZ)

Removes any adjacent duplicate points.

FMEDonut.removeLastInnerBoundaryAsCurve()

Removes and returns the last inner boundary as a curve.

FMEDonut.removeLastInnerBoundaryAsSimpleArea()

Removes and returns the last inner boundary as a simple area.

FMEDonut.removeMeasure(measureName)

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

FMEDonut.removeTraits(regexp)

This method has 4 modes:

FMEDonut.renameMeasure(oldMeasureName, ...)

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

FMEDonut.reverse()

This reverses the order of the area's points.

FMEDonut.rotate2D(center, angle)

Rotate the area counterclockwise around the 'center' point by the specified 'angle' (in degrees).

FMEDonut.scale(xScale, yScale, zScale)

Scale the feature by the given amounts.

FMEDonut.setName(name)

Sets the geometry's name with a str.

FMEDonut.setOuterBoundaryCurve(outerBoundary)

If the curve is not closed, the closure will be assumed as a straight line from the start point to the end point.

FMEDonut.setOuterBoundarySimpleArea(...)

Sets the outer boundary of the donut.

FMEDonut.setTrait(traitName, traitValue)

Sets a geometry trait with the specified value.

FMEDonut.setTraitNullWithType(traitName, ...)

This method supplies a null trait value with a type to the geometry.

class FMEDonut

FME Donut Class

Create an instance of a Donut geometry object.

init(outerBoundary)

Creates a new Donut geometry object. The curve passed in is used to define the outer boundary of the donut.

Parameters:

outerBoundary (FMECurve) – The outer boundary as a curve.

Return type:

FMEDonut

Returns:

An instance of a donut geometry object.

init(outerBoundary)

Creates a new Donut geometry object. The simple area passed in is used to define the outer boundary of the donut.

Parameters:

outerBoundary (FMESimpleArea) – The outer boundary as a simple area.

Return type:

FMEDonut

Returns:

An instance of a donut geometry object.

init(donut)

Create a copy of the passed in Donut geometry object.

Parameters:

donut (FMEDonut) – The Donut geometry object to create a copy of.

Return type:

FMEDonut

Returns:

An instance of a Donut Geometry object.

__init__(*args, **kwargs)
addInnerBoundaryCurve(innerBoundary)

If the inner boundary being added has a different dimension than the other boundaries, anything 2D will be forced to 3D. Note that the default Z value is 0.0 when forcing 2D geometry to 3D. If the curve is not closed, the closure will be assumed as a straight line from the start point to the end point. If the ‘innerBoundary’ being added is None, nothing will be done.

Parameters:

innerBoundary (FMECurve or None) – The curve to add to the inner boundary.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

addInnerBoundarySimpleArea(innerBoundary)

Adds a simple area as an inner boundary. If the inner boundary being added has a different dimension than the other boundaries, anything 2D will be forced to 3D. Note that the default Z value is 0.0 when forcing 2D geometry to 3D. If the ‘innerBoundary’ being added is None, nothing will be done.

Parameters:

innerBoundary (FMESimpleArea or None) – The simple area to add to the inner boundary.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

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.

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 become None.

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; otherwise False is returned.

Return type:

bool

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

getArea()

Area calculation.

Return type:

float

Returns:

The calculated area.

getInnerBoundaryAsCurveAt(index)

Retrieves the inner boundary at ‘index’ as a FMECurve.

Parameters:

index (int) – The index from which to retrieve the inner boundary as a curve from.

Return type:

FMEPath, FMEArc, FMELine or None

Returns:

The inner boundary as a FMECurve, or None if the specified index is greater than the number of inner boundaries. Returns the terminal geometry of the FMECurve, either a FMEPath, FMEArc or FMELine.

Raises:

FMEException – An exception is raised if an error occurred.

getInnerBoundaryAsSimpleAreaAt(index)

Retrieves the inner boundary at ‘index’ as a FMESimpleArea.

Parameters:

index (int) – The index from which to retrieve the inner boundary as a simple area from.

Return type:

FMEPolygon, FMEEllipse or None

Returns:

The inner boundary as a FMESimpleArea, or None if the specified index is greater than the number of inner boundaries. Returns the terminal geometry of the FMESimpleArea, either a FMEPolygon or a FMEEllipse.

Raises:

FMEException – An exception is raised if an error occurred.

getMeasureNames()

Retrieve the names of the measures on this geometry.

Return type:

tuple[str]

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, and FMECompositeSurface, 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 str. This will return None if it did not have a name associated with it.

Return type:

str or None

Returns:

The geometry’s name.

getOuterBoundaryAsCurve()

Retrieves the outer boundary as a FMECurve.

Return type:

FMEPath, FMEArc or FMELine

Returns:

The inner boundary as a FMECurve. Returns the terminal geometry of the FMECurve, either a FMEPath, FMEArc or FMELine.

Raises:

FMEException – An exception is raised if an error occurred.

getOuterBoundaryAsSimpleArea()

Retrieves the outer boundary as a FMESimpleArea.

Return type:

FMEPolygon or FMEEllipse

Returns:

The outer boundary as a FMESimpleArea. Returns the terminal geometry of the FMESimpleArea, either a FMEPolygon or a FMEEllipse.

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.

Parameters:

traitName (str) – The name of the geometry trait.

Return type:

bool, int, float, str, 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 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 (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 and False otherwise.

is3D()

Returns whether or not the geometry is 3D.

Return type:

bool

Returns:

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.

isBoundaryLinear()

Returns True if the outer boundary (and inner boundaries in the case of FMEDonut) of this area contains FMELine only.

Return type:

bool

Returns:

Whether the area’s boundaries contain only lines.

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.

isConvex()

Determines if area is convex. The polygon making up the area is convex if all internal angles are less than 180 degrees and it’s not self-intersecting. Imperfectly planar 3D polygons are tolerated.

Return type:

bool

Returns:

Whether the area is convex.

isInPlane(tolerance, normalVector, valD, recalculateD)

Works similarly to isPlanar(), but checks planarity with respect to given normal or given plane (if plane equation D is specified - see below). If given normal is the zero vector, the normal used to check the planarity is computed using Newell’s method as in isPlanar(). valD is a reference to a value of D in the plane equation AX + BY + CZ = D. It can be used to make sure that multiple pieces lie in the same plane. If ‘recalculateD’ is set to False, the passed in value of D will be used in the calculation. If ‘recalcualteD’ is set to True, the passed in value is ignored and is instead automatically calculated (and returned in the second position of the returned tuple). A useful calling pattern for ensuring co-planarity is to get valD computed on the first call to the function setting recalculateD to True, and then use this value for future calls with recalculateD to False.

Parameters:
  • tolerance (float) – The tolerance to check against.

  • normalVector (tuple of 3 float) – The normal used to check the planarity.

  • valD (float) – The value D from ‘AX + BY + CZ = D’.

  • recalculateD (bool) – Whether to recalculate ‘D’ or not.

Return type:

tuple[bool, tuple, float]

Returns:

A tuple containing a boolean, tuple, and float representing: 1) Whether or not the area is in plane; 2) The normal vector returned; and 3) The value ‘D’. Note: If recalculateD is False, the tuple returned will only contain the boolean and vector tuple (i.e. ‘valD’ is not returned).

isOriented(rightOrLeft)

This returns True if the geometry has the specified orientation.

Parameters:

rightOrLeft (int) – The orientation to check the FMEArea for.

Return type:

bool

Returns:

Whether the area has the specified orientation.

isPlanar(tolerance)

Returns True if this is planar within the given tolerance, and False otherwise.

The planarity condition is computed by the following algorithm. The normal vector <A, B, C> is determined by the vertices of this area using Newell’s method. For the first point (x’, y’, z’) of this area, we compute D’ = Ax’ + By’ + Cz’. Then, this area is planar if and only if every subsequent point (x, y, z) of this area gives a D = Ax + By + Cz, that is within the tolerance amount of D’. That is, | D - D’ | <= tolerance.

If the specified tolerance is negative, then this method always returns True.

Parameters:

tolerance (float) – The tolerance to check against.

Return type:

bool

Returns:

Whether the area is planar within the tolerance supplied.

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 (str) – (Optional) The measure’s name.

Return type:

bool

Returns:

Boolean indicating whether or not the measure exists.

numInnerBoundaries()

Returns the number of inner boundaries on this donut.

Return type:

int

Returns:

The number of inner boundaries on this donut.

offset(offsetPoint)

Offsets the area by the coords specified by ‘offsetPoint’.

Parameters:

offsetPoint (FMEPoint) – The FMEPoint to offset the area by.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

orient(rightOrLeft)

This sets the geometry to the specified orientation.

Parameters:

rightOrLeft (int) – The orientation to set on the FMEArea.

Return type:

None

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

removeLastInnerBoundaryAsCurve()

Removes and returns the last inner boundary as a curve.

Return type:

FMEPath, FMEArc or FMELine

Returns:

The last inner boundary as a FMECurve. Returns the terminal geometry of the FMECurve, either a FMEPath, FMEArc or FMELine.

Raises:

FMEException – An exception is raised if an error occurred.

removeLastInnerBoundaryAsSimpleArea()

Removes and returns the last inner boundary as a simple area.

Return type:

FMEEllipse or FMEPolygon

Returns:

The last inner boundary as a FMESimpleArea. Returns the terminal geometry of the FMESimpleArea, either a FMEEllipse, or FMEPolygon.

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:

  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.

Return type:

None

renameMeasure(oldMeasureName, newMeasureName)

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

Parameters:
  • oldMeasureName (str) – The original name of the measure.

  • newMeasureName (str) – The new name of the measure.

Return type:

None

reverse()

This reverses the order of the area’s points.

Return type:

None

rotate2D(center, angle)

Rotate the area counterclockwise around the ‘center’ point by the specified ‘angle’ (in degrees).

Parameters:
  • center (FMEPoint) – The center point of the area.

  • angle (float) – The angle by which the area is rotated.

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:
  • xScale (float) – The value to scale x by.

  • yScale (float) – The value to scale y by.

  • zScale (float) – The value to scale z by.

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 as deleteName().

Parameters:

name (str) – The geometry’s new name.

Return type:

None

setOuterBoundaryCurve(outerBoundary)

If the curve is not closed, the closure will be assumed as a straight line from the start point to the end point. If the new outer boundary has a different dimension than the inner boundaries, everything will be forced to 3D. Note that the default Z value is 0.0 when forcing 2D geometry to 3D. This will return an error if the outerBoundary passed in is invalid or None.

Parameters:

outerBoundary (FMECurve) – The curve to set as the outer boundary.

Return type:

None

Raises:

FMEException – An exception is raised if an error occurred.

setOuterBoundarySimpleArea(outerBoundary)

Sets the outer boundary of the donut. If the new outer boundary has a different dimension than the inner boundaries, everything will be forced to 3D. Note that the default Z value is 0.0 when forcing 2D geometry to 3D.

Parameters:

outerBoundary (FMESimpleArea) – The simple area to set as the outer boundary.

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.

Parameters:
Return type:

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 (str) – The trait’s name.

  • traitType (int) – An integer representing the trait type.

Return type:

None