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

Class FMEGeometryTools


init()

Instance Methods [hide private]
 
__init__()
x.__init__(...) initializes x; see help(type(x)) for signature
a new object with type S, a subtype of T
__new__(T, S, ...)
FMECurve of a terminal type or None
appendCurve(destinationCurve, sourceCurve)
Appends the source curve to the destination curve.
None
applyTransformationToTextureCoordinates(surface, applyOnlyIfShearExists)
Apply the transformation matrix of the texture to the texture coordinates if exists and that it does not have any shear if applyOnlyIfShearExists is set to true.
None
calculateVertexNormals(repairOnlyMissing, repairType, geom)
This method returns None if vertex normals are repaired on the geometry or if there is nothing to repair.
FMEEllipse, or None
closeArcAsEllipse(arc)
This routine to see if the current arc is closed.
FMECurve of a terminal type or None
closeCurve(curve)
This checks to see if the current curve is closed.
FMECurve of a terminal type or None
closeCurve3D(curve, mode)
This function closes the curve in 3D if it is not already closed.
FMELine or None
convertToLine(curve)
Returns a line that is created from the given curve.
string
createXMLFromGeometry(geom)
This routine returns an XML definition according to the geometry passed in.
FMECurve of a terminal type or None
extendToCurve(destinationCurve, sourceCurve)
Extends the source curve to the destination curve.
FMECurve of a terminal type or None
extendToPoint(curve, point)
This method will extend the given curve to the given point.
FMEGeometry of a terminal type.
extractTextLocation(text)
This routine consumes the text passed in and returns the IFMEGeometry that was its location.
FMEGeometry of a terminal type.
force2D(geometry)
This routine forces the geometry to 2D.
int
getPartCount(geometry, recursive, splitDonuts, splitPaths)
Return the number of parts in the geometry.
FMEGeometry of a terminal type.
join(firstGeom, secondGeom, aggregatable)
This routine joins two geometries together.
FMEGeometry of a terminal type.
makeDonuts(multiArea)
This routine takes in a MultiArea, extracts simple areas from it, and creates donuts out of them.
FMEGeometry of a terminal type.
matrixTransform(geometry, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34)
This method performs a 3D matrix transformation on the geometry passed in.
FMEGeometry of a terminal type.
offset(geometry, point)
Offsets the geometry by the coords specified by point.
FMEArea of a terminal type.
refineArea(area, refineType)
See the documentation for refineGeometry().
FMEGeometry of a terminal type.
refineCurve(curve, refineType)
See the documentation for refineGeometry().
FMEGeometry of a terminal type.
refineGeometry(geometry, refineType)
This routine offers a number of options to refine geometries.
FMEGeometry of a terminal type.
rotate2D(geometry, center, angle)
The angle is CCW up from the horizontal and is measured in degrees.
FMEGeometry of a terminal type.
scale(geometry, xscale, yscale, zscale)
The zscale is ignored if geometry is 2D.
FMEArc
setArcPrimaryRadius(arc, primRadius)
The zscale is ignored if geometry is 2D.
FMEArc
setArcRotation(arc, rotation)
Set the rotation on an arc object.
FMEArc
setArcSecondaryRadius(arc, secRadius)
Sets the secondary radius of the arc.
FMEArc
setArcSweepAngle(arc, angle)
Sets the sweep angle of the arc.
list of FMESurfaces
splitDoubleSidedSurface(doubleSidedSurface)
Takes a double-sided surface and splits it up into two single-sided surfaces of the same type.
FMEGeometry of a terminal type.
triangulateToSurface(geometry)
This routine will return a FMEGeometry object with triangle faces.

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__

appendCurve(destinationCurve, sourceCurve)

 

Appends the source curve to the destination curve. This will not merge curves but simply append them into an IFMEPath if necessary. If the source curve is None, nothing will be done and the destination curve will be returned. If the destination curve is None, it will be set to the source curve. If the source and destination curves do not have touching end points, a line will be inserted to connect them.

Parameters:
  • destinationCurve (FMECurve or None) - The curve to append to the source curve to.
  • sourceCurve (FMECurve or None) - The curve to append to the destination curve.
Returns: FMECurve of a terminal type or None
The appended curve. Note: This method returns a terminal geometry type of the FMECurve; i.e. one of the leaf classes in the FMECurve inheritance graph. For example, a FMEPath is returned if the geometry truly is a path.

applyTransformationToTextureCoordinates(surface, applyOnlyIfShearExists)

 

Apply the transformation matrix of the texture to the texture coordinates if exists and that it does not have any shear if applyOnlyIfShearExists is set to true. Note: This method should only be called once for one surface, or else the transformation matrix is applied as many times as the method is called.

Parameters:
  • surface (FMESurface) - The surface to apply the transformation to.
  • applyOnlyIfShearExists (bool) - If true only applies the transformation when a shear exists.
Returns: None

calculateVertexNormals(repairOnlyMissing, repairType, geom)

 

This method returns None if vertex normals are repaired on the geometry or if there is nothing to repair. If an error occurs during the repair a FMEException is thrown. Currently, the only valid value for repairOnlyMissing is true, and the only valid value for repairType is BY_FACE.

Parameters:
  • repairOnlyMissing (bool) - Boolean indicating whether or not to repair only the missing vertex normals, currently, the only true is valid.
  • repairType (int) - Repair type, the only valid value is BY_FACE.
  • geom (FMEGeometry) - The geometry to calculate the vertex normals for.
Returns: None

closeArcAsEllipse(arc)

 

This routine to see if the current arc is closed. A closed arc is defined as one where the start and end points are equal. If None is passed in, nothing will be done. The returned geometry may or may not be the original object that was passed in. If a different object is returned, the original object will be destroyed.

Parameters:
  • arc (FMEArc) - The arc to close as an ellipse.
Returns: FMEEllipse, or None
The Arc closed as an ellipse or None

closeCurve(curve)

 

This checks to see if the current curve is closed. A closed curve is defined as one where the start and end points are equal. If necessary this method will add a straight segment from the end point to the start point to force the curve closed. If None is passed in, nothing will be done and None will be returned. The returned geometry may or may not be the original object that was passed in. If a different object is returned, the original object will be destroyed.

Parameters:
  • curve (FMECurve or None.) - The curve to close.
Returns: FMECurve of a terminal type or None
The closed curve. Note: This method returns a terminal geometry type of the FMECurve; i.e. one of the leaf classes in the FMECurve inheritance graph. For example, a FMEArc.
Raises:
  • FMEException - An exception is raised if an error occurred.

closeCurve3D(curve, mode)

 

This function closes the curve in 3D if it is not already closed. If the curve is not 3D, it forces the curve to be 3D with default z value of 0.0. A closed curve is defined as one where the start and end points are equal in all X, Y and Z coordinates. The returned geometry may or may not be the original object that was passed in. If None is passed in, nothing will be done and None will be rteurned. If a different object is returned, the original object will be destroyed. There are 3 modes that the function uses in deciding how to close the curve, namely FME_CLOSE_3D_EXTEND_MODE, FME_CLOSE_3D_AVERAGE_MODE and FME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE.

  • In FME_CLOSE_3D_AVERAGE_MODE, the curve is closed by modifying the current start and end points of the curve to be the average of the two points.
  • In FME_CLOSE_3D_EXTEND_MODE, this method will add a straight segment from the end point to the start point to force the curve closed.
  • In FME_CLOSE_3D_EXTEND_OR_AVERAGE_Z_MODE, the curve is closed using the AVERAGE mode if the start and end points only differ in Z. Otherwise, the EXTEND MODE is used.
Parameters:
  • curve (FMECurve) - The curve to close.
  • mode (int) - The FME_CloseCurve3DMode.
Returns: FMECurve of a terminal type or None
The closed curve. Note: This method returns a terminal geometry type of the FMECurve; i.e. one of the leaf classes in the FMECurve inheritance graph. For example, a FMEPath is returned if the geometry truly is a path.
Raises:
  • FMEException - An exception is raised if an error occurred.

convertToLine(curve)

 

Returns a line that is created from the given curve. If the curve is a FMELine, it will be returned. If it is a FMEArc, it will be stroked to a line. If the curve is a FMEPath, all segments will be returned as their line representations. If the given curve is None, nothing will be done. This throws an exception if there is an error.

Parameters:
  • curve (FMECurve or None.) - The curve to convert to a line.
Returns: FMELine or None
The line representing the curve.
Raises:
  • FMEException - An exception is raised if an error occurred.

createXMLFromGeometry(geom)

 

This routine returns an XML definition according to the geometry passed in.

Parameters:
  • geom (FMEGeometry.) - The geometry to create the XML definition from.
Returns: string
The geometry definition.

extendToCurve(destinationCurve, sourceCurve)

 

Extends the source curve to the destination curve. If one curve is a line or a path with a line at its end, and the other curve is a line or a path with a line at its start, the matching lines will be merged, as long as both share the same geometry attributes. If the curves do not have touching end points, a line will be created to attach them. Appending an arc or appending to an arc will result in a path. If the source curve is None, nothing will be done adn None will be returned. If the destination curve is None, it will be set to the source curve.

Parameters:
  • destinationCurve (FMECurve or None) - The curve to extend with source curve.
  • sourceCurve (FMECurve or None) - The curve to extend the destination curve by.
Returns: FMECurve of a terminal type or None
The extended curve. Note: This method returns a terminal geometry type of the FMECurve; i.e. one of the leaf classes in the FMECurve inheritance graph. For example, a FMEPath is returned if the geometry truly is a path.
Raises:
  • FMEException - An exception is raised if an error occurred.

extendToPoint(curve, point)

 

This method will extend the given curve to the given point. This method will add a straight segment from the curve's end point to the new point. The returned geometry may or may not be the original object that was passed in. If a different object is returned, the original object will be destroyed. If the point is None, nothing will be done and None will be returned. If the curve is None, but the point is valid, a line will be returned that has one point.

Parameters:
  • curve (FMECurve or None) - The curve to extend with the point.
  • point (FMEPoint, or None) - The point to extend the curve by, or None.
Returns: FMECurve of a terminal type or None
The extended curve. Note: This method returns a terminal geometry type of the FMECurve; i.e. one of the leaf classes in the FMECurve inheritance graph. For example, a FMELine is returned if the geometry truly is a line.
Raises:
  • FMEException - An exception is raised if an error occurred.

extractTextLocation(text)

 

This routine consumes the text passed in and returns the IFMEGeometry that was its location.

Parameters:
  • text (FMEText) - The text whose location to extract.
Returns: FMEGeometry of a terminal type.
The geometry at the text's location. Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMELine is returned if the geometry truly is a line.
Raises:
  • FMEException - An exception is raised if an error occurred.

force2D(geometry)

 

This routine forces the geometry to 2D. If the geometry is surface or solid, it will become 2D polygons, or wire-frame if the surface is vertical.

Parameters:
Returns: FMEGeometry of a terminal type.
The geometry in 2D. Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMELine is returned if the geometry truly is a line.
Raises:
  • FMEException - An exception is raised if an error occurred.

getPartCount(geometry, recursive, splitDonuts, splitPaths)

 

Return the number of parts in the geometry. For multis and aggregates, this is the number of parts, and for paths, the number of segments; otherwise it is one. If recursive is true, then aggregates' parts will be counted recursively.

Parameters:
  • geometry (FMEGeometry) - aggregate or multis whose parts to count.
  • recursive (bool) - Boolean indicating whether or not to count recursively.
  • splitDonuts (bool) - Boolean indicating whether or not to split donuts.
  • splitPaths (bool) - Boolean indictaing whether or to split paths.
Returns: int
The number of parts in the geometry.

join(firstGeom, secondGeom, aggregatable)

 

This routine joins two geometries together. Options applying to joinning will affect the result. Both geometries will be taken ownership if the result is successful.aggregatable: If the joining of two geometries doesn't make any sense, put them into an aggregate. For example: one ellipse and one line

Parameters:
  • firstGeom (FMEGeometry) - The first geometry to join.
  • secondGeom (FMEGeometry) - The second geometry to join.
  • aggregatable (bool) - Boolean indictaing whether or not to combine the two geometries into an aggregate.
Returns: FMEGeometry of a terminal type.
The combined geometries. Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMELine is returned if the geometry truly is a line.
Raises:
  • FMEException - An exception is raised if an error occurred.

makeDonuts(multiArea)

 

This routine takes in a MultiArea, extracts simple areas from it, and creates donuts out of them. The resulting donuts and simple areas, if any, are returned. The returned MultiArea may contain a mixture of donuts and simple areas.

Parameters:
  • multiArea (FMEMultiArea) - The multi area to extract the donuts from.
Returns: FMEGeometry of a terminal type.
The donuts and simple areas extracted form the multi area. Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMESimpleArea is returned if the geometry truly is a simple area.
Raises:
  • FMEException - An exception is raised if an error occurred.

matrixTransform(geometry, m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34)

 

This method performs a 3D matrix transformation on the geometry passed in. The order in which parameters are passed in is important and it should be row wise e.g. for a matrix the order of the parameters should be m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34.

  • | m11 m12 m13 m14|
  • | m21 m22 m23 m24|
  • | m31 m32 m33 m34|

    After doing the transformation, geometry is replaced with the transformed geometry if the method is successful. Otherwise, the matrix transform has failed and a FMEException is thrown.

Parameters:
  • geometry (FMEGeometry) - The geometry to apply the transformation Matrix to.
  • m31 (float)
  • m33 (float)
  • m34 (float)
  • m32 (float)
  • m21 (float)
  • m22 (float)
  • m23 (float)
  • m11 (float)
  • m24 (float)
  • m13 (float)
  • m12 (float)
  • m14 (float)
Returns: FMEGeometry of a terminal type.
The transformed geometry. Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMEAggregate is returned if the geometry truly is a aggregate.
Raises:
  • FMEException - An exception is raised if an error occurred.

offset(geometry, point)

 

Offsets the geometry by the coords specified by point. The returned geometry may or may not be the original object that was passed in. If a different object is returned, the original object will be destroyed.

Parameters:
  • geometry (FMEGeometry) - The geometry to offset by point.
  • point (FMEPoint) - The point to offset the geometry by.
Returns: FMEGeometry of a terminal type.
The geometry offset by point. Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMEPolygon is returned if the geometry truly is a polygon.
Raises:
  • FMEException - An exception is raised if an error occurred.

refineArea(area, refineType)

 

See the documentation for refineGeometry(). Bitmask elements are defined in FME_RefineAreaType.

Parameters:
Returns: FMEArea of a terminal type.
The refined area. Note: This method returns a terminal geometry type of the FMEArea; i.e. one of the leaf classes in the FMEArea inheritance graph. For example, a FMEPolygon is returned if the geometry truly is a polygon.
Raises:
  • FMEException - An exception is raised if an error occurred.

refineCurve(curve, refineType)

 

See the documentation for refineGeometry(). Bitmask elements are defined in FME_RefineAreaType.

Parameters:
Returns: FMEGeometry of a terminal type.
The refined curve. Note: This method returns a terminal geometry type of the FMECurve; i.e. one of the leaf classes in the FMECurve inheritance graph. For example, a FMELine is returned if the geometry truly is a line.
Raises:
  • FMEException - An exception is raised if an error occurred.

refineGeometry(geometry, refineType)

 

This routine offers a number of options to refine geometries. The options are defined as a bitmask whose components are defined in FME_RefineGeometryType. Options applying to curves will affect area boundaries.

Parameters:
  • geometry (FMEGeometry) - The geometry to refine.
  • refineType (int) - FME_RefineAreaType.
Returns: FMEGeometry of a terminal type.
The geometry to refine. Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMEPolygon is returned if the geometry truly is a polygon.
Raises:
  • FMEException - An exception is raised if an error occurred.

rotate2D(geometry, center, angle)

 

The angle is CCW up from the horizontal and is measured in degrees. The returned geometry may or may not be the original object that was passed in. If a different object is returned, the original object will be destroyed. If an error occurs an exception is thrown.

Parameters:
  • geometry (FMEGeometry) - The geometry to rotate.
  • center (FMEPoint) - The point to rotate the geometry around.
  • angle (float) - The angle to rotate the geometry by.
Returns: FMEGeometry of a terminal type.
The rotated geometry. Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMESimpleArea is returned if the geometry truly is a simple area.
Raises:
  • FMEException - An exception is raised if an error occurred.

scale(geometry, xscale, yscale, zscale)

 

The zscale is ignored if geometry is 2D. The returned geometry may or may not be the original object that was passed in. If a different object is returned, the original object will be destroyed. If an error occurs an exception is thrown.

Parameters:
  • geometry (FMEGeometry) - The geometry to scale.
  • xscale (float) - The x scale factor.
  • yscale (float) - The y scale factor.
  • zscale (float) - The z scale factor.
Returns: FMEGeometry of a terminal type.
The scaled geometry. Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMESimpleArea is returned if the geometry truly is a simple area.
Raises:
  • FMEException - An exception is raised if an error occurred.

setArcPrimaryRadius(arc, primRadius)

 

The zscale is ignored if geometry is 2D. The returned geometry may or may not be the original object that was passed in. If a different object is returned, the original object will be destroyed. If an error occurs an exception is thrown.

Parameters:
  • arc (FMEArc) - The arc to set the primary radius for.
  • primRadius (float) - The primary radius.
Returns: FMEArc
The arc after the primary radius is set.
Raises:
  • FMEException - An exception is raised if an error occurred.

setArcRotation(arc, rotation)

 

Set the rotation on an arc object. All angles are CCW up from the horizontal and are measured in degrees. If the underlying arc is stored by bulge or by 3 points, it will become an arc by center point.

Parameters:
  • arc (FMEArc) - The arc to set the rotation for.
  • rotation (float) - The rotation factor.
Returns: FMEArc
The arc after setting the rotation.
Raises:
  • FMEException - An exception is raised if an error occurred.

setArcSecondaryRadius(arc, secRadius)

 

Sets the secondary radius of the arc. If the underlying arc is stored by bulge or by 3 points, it will become an arc by center point.

Parameters:
  • arc (FMEArc) - The arc to set the secondary radius for.
  • secRadius (float) - The secondary radius.
Returns: FMEArc
The arc after the secondary radius is set.
Raises:
  • FMEException - An exception is raised if an error occurred.

setArcSweepAngle(arc, angle)

 

Sets the sweep angle of the arc. If the angle is a bulge arc, it is turned as an arc by center point to support sweep angle of 360.

Parameters:
  • arc (FMEArc) - The arc to set the sweep angle for.
  • angle (float) - The arc's sweep angle.
Returns: FMEArc
The arc after setting the sweep angle.
Raises:
  • FMEException - An exception is raised if an error occurred.

splitDoubleSidedSurface(doubleSidedSurface)

 

Takes a double-sided surface and splits it up into two single-sided surfaces of the same type. If the passed in geometry is actually single-sided, then None is returned for the side that doesn't exist. An error is returned when the function encounters a problem trying to split up the surface.

Parameters:
  • doubleSidedSurface (FMESurface) - The surface to split up.
Returns: list of FMESurfaces
A List of the front and back side of doubleSidedSurface, in the form [frontSideSurface, backSideSurface].
Raises:
  • FMEException - An exception is raised if an error occurred.

triangulateToSurface(geometry)

 

This routine will return a FMEGeometry object with triangle faces. This feature can support all geometries except for FMEAggregate, FMECSGSolid, FMECompositeSolid and FMEMultiSolid. The output FMEGeometry is never None. The resulting FMEGeometry is not guaranteed to contain only triangles, so it is the user's responsiblity to check this. The geometry type of the returned FMEGeometry object depends on the type of input geometry:

  • If the input is a FMETriangleStrip, FMETriangleFan, or FMEFace that is already triangular, the resulting FMEGeometry is a copy of the input geometry and hence has the same geometry type as the input.
  • If the input is a sliver face, the resulting FMEGeometry is a copy of the original geometry.
  • If the input is a non-triangular and non-sliver Face, non-triangular Area, or RectangleFace, the resulting FMEGeometry is a FMECompositeSurface, whose components are triangular Faces. Otherwise the component is a FMECompositeSurface consisting of triangular Faces.
  • If the input is a CompositeSurface, the resulting FMEGeometry is a FMECompositeSurface. The type of each component in the resulting FMECompositeSurface is determined as described above.
  • If the input is a MultiSurface, the resulting FMEGeometry is a FMEMultiSurface. The type of each component in the resulting FMEMultiSurface is determined as described above.
  • If the input is a Box, Extrusion, or BRepSolid, the resulting FMEGeometry is a FMEBRepSolid.
  • If the input is a MultiArea, the resulting IFMEGeometry is a FMEMultiSurface. The type of each component in the resulting FMEMultiSurface is determined as described above.
  • If the input is a Mesh, the resulting FMEGeometry is a FMEMultiSurface.

    For the case of FMEArea, the triangulation will occur with respect to the x- and y-coordinates - the z values are ignored, yet they will be retained in the output. If there are any errors an exception will be thrown.

Parameters:
  • geometry (FMEGeometry) - The geometry to triangulate to the surface.
Returns: FMEGeometry of a terminal type.
Note: This method returns a terminal geometry type of the FMEGeometry; i.e. one of the leaf classes in the FMEGeometry inheritance graph. For example, a FMETriangleStrip is returned if the geometry truly is a triangle strip.
Raises:
  • FMEException - An exception is raised if an error occurred.