ShapeBuilder
Description
Helper class for building geometric shapes.
To build a geometric shape, perform the following steps:
-
Create a shape builder via Shape.Geometry or call Clear on an existing builder for starting from scratch.
-
Configure the shape builder flags via Flags.
-
Configure the geo-reference via Georef.
-
Configure shape metadata via Metadata.
-
Configure a coordinate system transformation via Transform.
-
Configure a vertex transformation via Matrix.
-
Add geometric primitives:
-
Vertices (see
Vertex*methods) -
Edges (see
Edge*methods) -
Triangles (see
Triangle*methods) -
Values (see
Value*methods)
-
-
Add pre-defined geometric shapes:
-
Finish shape building by calling one of the following methods:
- See also
Public / Constructors
Build
Creates a new instance of IShape from the specified vertices (see Vertex1), edges (see Edge2) and/or triangles (see Triangle2).
This method only delegates to other methods, in the following order:
Public / Methods
Add
2 overloads
Adds all vertices, edges and triangles of the given shape.
When flip opt is true, edges (A,B) resp. triangles (A,B,C) are added as (B,A) resp. (C,B,A).
- See also
Adds all vertices, edges and triangles of the given shape.
This method delegates to Add1, computing the flip parameter as follows:
-
If parity in or IShapeInfo.EdgeParity of shape in is
0,flipisfalse. -
If the sign of parity in is equal to the edge parity of shape in,
flipisfalse. -
Otherwise,
flipistrue.
- See also
ArcInner
Creates a vertex contour that runs from a in to b in over the inner path (i.e. the shorter one).
The edge parity of the contour is the sign of IVec2Ops.Cross2 for a in and b in.
ArcOuter
Creates a vertex contour that runs from a in to b in over the outer path (i.e. the longer one).
The edge parity of the contour is the sign of IVec2Ops.Cross2 for b in and a in.
Area
2 overloads
Computes the signed area of the simple polygon defined by the sequence of vertices that have been added to this builder.
- See also
Computes the signed area of the simple polygon defined by the given sequence of vertices.
- See also
Arrow
Creates a vertex contour for an arrow shape (negative edge parity).
The arrow shape vertices a are determined by these dimensions:
/ /\ \
| / \ |
| / \ |
| / \ | lengthHead
| / \ |
length | / _ _ \ |
| /.-´ | | `-.\ \ /
| | | |
| | | | lengthShaft
\ `--´ /
\__/
widthShaft
\____________/
width
The length is the distance between from in and to in. The other dimensions are defined by the ratios given as parameters.
Circle
Creates a vertex contour for a circle shape by defining an approximating polygon (negative edge parity).
Clear
Clears all geometry data in the shape builder.
After calling this method, the following lists will be empty:
ClearEdges
Clears geometry data in the shape builder.
After calling this method, the following lists will be empty:
ClearTriangles
Clears geometry data in the shape builder.
After calling this method, the following lists will be empty:
ClearValues
Clears geometry data in the shape builder.
After calling this method, the following lists will be empty:
-
Values, for the given values opt
ClearVertices
Clears geometry data in the shape builder.
After calling this method, the following lists will be empty:
Curve
Builds geometry follows the given curve and adds it to this shape builder.
Curve-space is defined as follows:
-
The coordinate origin coincides with the result of ICurve.Compute2D for the control point index zero.
-
The X-axis represents the control point indices in the range [0..N], where N is ICurve.Count minus one.
-
The Y-axis is perpendicular to the curve, where the Y-coordinate zero always lies on the curve. The sign of the Y-axis is chosen so that the points A, B and C form a triangle, according to IShape.TriangleAt:
A = (X,0) B = (X + epsilon,0) C = (X, epsilon)
where
Xis an X-coordinate value andepsilonis some sufficiently small value. The orientation of the Y-axis depends on the X-coordinate.
The geometry extend along the X-axis is defined with range in. The extend along the Y-axis is computed from the Vec4D.Z values, which are obtained from ICurve.Compute3D:
y1 = y1m * Z + y1b y2 = y2m * Z + y2b
Depending on the parameter values, the following geometry is generated:
-
If range in has non-zero length and, y1b in != y2b in or y1m opt != y2m opt:
A polygon contour with negative parity (y1b in < y2b in) or positive parity ( y1b in > y2b in), see ShapeType.Polygon -
Otherwise, if range in has zero length and y1b in = y2b in and y1m opt = y2m opt:
A point, see ShapeType.Points. -
Otherwise:
A polyline which is either perpendicular to the curve or parallel to it, see ShapeType.Graph
- See also
Edge
3 overloads
Specifies an edge when building a graph shape (see Graph).
This method uses the two most recently specified vertices (N-2, N-1), where N is the value of Index when this method is called.
EdgeList
6 overloads
Specifies a sequence of connected edges (polyline) when building a graph shape (see Graph) or polygon shape (see Polygon).
An edge is generated for each pair of recently added vertices, i.e. the vertices in the range from Last (inclusive) to Index (exclusive).
Specifies a sequence of connected edges (polyline) when building a graph shape (see Graph) or polygon shape (see Polygon).
The vertex sequence can be reversed by swapping a in and b in.
Specifies a sequence of connected edges (polyline) when building a graph shape (see Graph) or polygon shape (see Polygon).
Specifies a series of edges.
Specifies a series of edges.
Specifies a series of edges.
Grid
Creates a grid shape.
The grid is specified by the four given control points:
(a)----- + ----- + ----- + -----(b) | | | | | + ----- + ----- + ----- + ----- + | | | | | + ----- + ----- + ----- + ----- + | | | | | (d)----- + ----- + ----- + -----(c)
MatrixPop
Removes the current transformation from the stack, which restores the transformation that has been in place before the most recent call to MatrixPush.
- See also
MatrixPush
Appends the given transformation matrix to the current one, until MatrixPop is called.
- See also
Oval
Creates a vertex contour for an oval shape defining an approximating polygon.
The edge parity of the contour is the sign of IVec2Ops.Cross2 for a in and b in.
Rectangle
3 overloads
Specifies a rectangle.
This method delegates to Rectangle2,
- See also
Specifies a rectangle.
This method delegates to Rectangle3,
- See also
Specifies a rectangle.
This method calls Vertex1 in this order:
-
(x0 in, y0 in)
-
(x1 in, y0 in)
-
(x1 in, y1 in)
-
(x0 in, y1 in)
or if flip opt is true:
-
(x0 in, y0 in)
-
(x0 in, y1 in)
-
(x1 in, y1 in)
-
(x1 in, y0 in)
Then, the EdgeList1 method is called.
- See also
Transform
Applies the given coordinate transform while building shapes.
When a coordinate transform is given, the specified vertices are expected to be in the source coordinate system (see CoordinateSystemTransform.Source). The built shapes will have the target coordinate system as geo-reference (see IShapeInfo.Georef). So it is not necessary to call Georef when using a transform.
All existing geometry is cleared by this method.
- See also
Triangle
3 overloads
Specifies a triangle when building a mesh shape (see Mesh).
This method uses the three most recently specified vertices (N-3, N-2, N-1), where N is the value of Index when this method is called.
If necessary, the given triangle vertices will be adjusted to meet the requirements of IShape.TriangleAt.
Specifies a triangle when building a mesh shape (see Mesh).
If necessary, the given triangle vertices will be adjusted to meet the requirements of IShape.TriangleAt.
Specifies a triangle when building a mesh shape (see Mesh).
If necessary, the given triangle vertices will be adjusted to meet the requirements of IShape.TriangleAt.
TriangleList
3 overloads
Specifies a series of triangles.
Specifies a series of triangles.
Specifies a series of triangles.
Value
2 overloads
Specifies the custom value for the vertex that will be added next (see Index).
Custom values may be specified for vertices that have not yet been added to the shape builder and will be dropped silently if no vertex is specified for them.
- See also
Specifies the custom value for the given vertex.
Custom values may be specified for vertices that have not yet been added to the shape builder and will be dropped silently if no vertex is specified for them.
- See also
VertexGeographic2D
Specifies a new vertex.
If a coordinate system has been specified, the given vertex in coordinates will be transformed with ICoordinateTransform.GeographicToMap of CoordinateSystem.CreateCoordinateTransform. Otherwise, the result of LatLon.ToDegrees will be used. The resulting coordinates are then passed to Vertex2.
VertexGeographic3D
Specifies a new vertex.
This method delegates to VertexGeographic2D passing LatLonHeight.Coords and then to Value2 passing LatLonHeight.Vertical as ShapeValue.Vertical.
VertexList
3 overloads
Specifies a series of vertices.
- See also
Specifies a series of vertices.
- See also
Specifies a series of vertices.
- See also
VertexListGeographic2D
3 overloads
Specifies a series of vertices.
- See also
Specifies a series of vertices.
- See also
Specifies a series of vertices.
- See also
Public / Attributes
Geocentric
In geocentric mode (see Transform), returns the helper object that is used for geocentric computations.
IndicesOriginal
Mapping from vertex indices of the built shape to the original input vertex indices that have been specified while building.
For a given shape vertex A (see IShape.VertexAt), the corresponding builder vertex B (see Index) can be retrieved this way:
B = IndicesOriginal[A]
Last
Returns the index of the last vertex.
Each time an edge or a triangle is added, the last vertex is set to Index.
Matrix
The current vertex transformation matrix.
The homogeneous 2D transformation matrix is applied to the input vertex coordinates (see IMat3Ops.MulW11) that are provided when new vertices are added to the shape builder. The transformation may flip handedness (i.e. IMatOps.Determinant is negative), which is taken into account by Add1 and Rectangle1. Otherwise, the shape builder is agnostic to flipped handedness.
Settings the transformation matrix resets the transformation stack, making it contain only the given value.
The defaults value is Mat3D.Identity.