LuciadCPillar 2023.1.02
|
Factory to create geometries defined within a coordinate reference. More...
#include <luciad/geometries/GeometryFactory.h>
Public Member Functions | |
GeometryFactory ()=delete | |
~GeometryFactory ()=delete | |
Static Public Member Functions | |
static std::shared_ptr< ArcBand > | createArcBand (std::shared_ptr< CoordinateReference > reference, Coordinate center, double minRadius, double maxRadius, Angle startAngle, Angle endAngle, Angle::Direction angleDirection=Angle::Direction::CounterClockwise) |
Factory method to create an arc band. More... | |
static std::shared_ptr< BezierCurve > | createBezierCurve (std::shared_ptr< luciad::CoordinateReference > reference, Coordinate startPoint, Coordinate controlPoint, Coordinate endPoint) |
Factory method to create a quadratic Bezier curve transitioning smoothly between startPoint and endPoint. More... | |
static std::shared_ptr< Bounds > | createBounds (std::shared_ptr< CoordinateReference > reference, Coordinate location, double width, double height, double depth) |
Factory method to create a bounding box geometry. More... | |
static std::shared_ptr< CircleBy3Points > | createCircleBy3Points (std::shared_ptr< CoordinateReference > reference, Coordinate startPoint, Coordinate firstIntermediatePoint, Coordinate secondIntermediatePoint) |
Factory method to create a circle, given three points. More... | |
static std::shared_ptr< CircleByCenterPoint > | createCircleByCenterPoint (std::shared_ptr< CoordinateReference > reference, Coordinate center, double radius) |
Factory method to create a circle. More... | |
static std::shared_ptr< CircularArcBy3Points > | createCircularArcBy3Points (std::shared_ptr< CoordinateReference > reference, Coordinate startPoint, Coordinate intermediatePoint, Coordinate endPoint) |
Factory method to create a circular arc, given three points. More... | |
static std::shared_ptr< CircularArcByBulge > | createCircularArcByBulge (std::shared_ptr< CoordinateReference > reference, Coordinate startPoint, Coordinate endPoint, double bulge) |
Factory method to create a circular arc, starting at the given start point and ending in the given end point. More... | |
static std::shared_ptr< CircularArcByCenterPoint > | createCircularArcByCenterPoint (std::shared_ptr< CoordinateReference > reference, Coordinate center, double radius, luciad::Angle startAngle, luciad::Angle endAngle, Angle::Direction angleDirection=Angle::Direction::CounterClockwise) |
Factory method to create a circular arc. More... | |
static std::shared_ptr< CompositeCurve > | createCompositeCurve (std::vector< std::shared_ptr< Curve > > curveList) |
Factory to create a composite curve. More... | |
static std::shared_ptr< CompositePatch > | createCompositePatch (std::shared_ptr< Patch > exteriorPatch, std::vector< std::shared_ptr< Patch > > interiorPatches) |
Factory to create a composite patch. More... | |
static std::shared_ptr< CompositeRing > | createCompositeRing (std::vector< std::shared_ptr< Curve > > curveList) |
Factory to create a composite ring. More... | |
static std::shared_ptr< Ellipse > | createEllipse (std::shared_ptr< CoordinateReference > reference, Coordinate center, double a, double b, luciad::Angle rotationAngle) |
Factory method to create an ellipse. More... | |
static std::shared_ptr< EllipticalArc > | createEllipticalArc (std::shared_ptr< CoordinateReference > reference, Coordinate center, double a, double b, luciad::Angle startAngle, luciad::Angle endAngle, luciad::Angle rotationAngle, Angle::Direction angleDirection=Angle::Direction::CounterClockwise) |
Factory method to create an elliptical arc. More... | |
static std::shared_ptr< ExtrudedGeometry > | createExtrudedGeometry (std::shared_ptr< CoordinateReference > reference, std::shared_ptr< Geometry > baseGeometry, double minHeight, double maxHeight) |
Factory method to create an extruded geometry, based on a base geometry, minimum height and maximum height. More... | |
static std::shared_ptr< Line > | createLine (std::shared_ptr< luciad::CoordinateReference > reference, Coordinate firstPoint, Coordinate secondPoint, LineInterpolationType curveInterpolationType) |
Factory method to create a line. More... | |
static std::shared_ptr< MultiGeometry > | createMultiGeometry (std::vector< std::shared_ptr< Geometry > > geometryList) |
Factory to create a multi-geometry. More... | |
static std::shared_ptr< Patch > | createPatch (std::shared_ptr< Ring > baseGeometry) |
Factory method to create a patch based on a Ring. More... | |
static std::shared_ptr< Point > | createPoint (std::shared_ptr< CoordinateReference > reference, Coordinate location) |
Factory method to create a point from a coordinate. More... | |
static std::shared_ptr< Point > | createPoint (std::shared_ptr< CoordinateReference > reference, double x, double y, double z) |
Factory method to create a point. More... | |
static std::shared_ptr< Polygon > | createPolygon (std::shared_ptr< PolylineRing > exteriorRing, std::vector< std::shared_ptr< PolylineRing > > interiorRings) |
Factory to create a polygon. More... | |
static std::shared_ptr< Polyline > | createPolyline (std::shared_ptr< luciad::CoordinateReference > reference, std::vector< Coordinate > points, LineInterpolationType curveInterpolationType) |
Factory to create a polyline. More... | |
static std::shared_ptr< PolylineRing > | createPolylineRing (std::shared_ptr< CoordinateReference > reference, std::vector< Coordinate > points, LineInterpolationType curveInterpolationType) |
Factory to create a polyline to be used as ring. More... | |
static std::shared_ptr< CompositeCurve > | createRoundedPolyline (std::shared_ptr< luciad::CoordinateReference > reference, const std::vector< Coordinate > &points, double cornerRoundness) |
Factory method to create a curve where pointy corners are replaced by Bezier Curves. More... | |
static std::shared_ptr< CompositeRing > | createRoundedPolylineRing (std::shared_ptr< luciad::CoordinateReference > reference, const std::vector< Coordinate > &points, double cornerRoundness) |
Factory method to create a ring where pointy corners are replaced by Bezier Curves. More... | |
Factory to create geometries defined within a coordinate reference.
You can read more about the available geometries here.
|
delete |
|
delete |
|
static |
Factory method to create an arc band.
The angles for the arc band are expressed in degrees counterclockwise from the direction at 3 o'clock). By default, the arc band goes from the start angle to the end angle in the positive direction (counterclockwise). This can changed using the optional angleDirection
parameter.
To create an arc band from 30° to 145° you can use the following code.
Creation of an arc band is very similar to a circular arc. See GeometryFactory::createCircularArcByCenterPoint.
When the passed coordinate reference is a geodetic reference the distance calculations to determine points on the arc band are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.
For other coordinate references the distance calculations are done using cartesian calculations.
reference | the coordinate reference in which the circular arc is defined. |
center | the center point of the arc band. |
minRadius | the minimal radius of the arc band. |
maxRadius | the maximal radius of the arc band. |
startAngle | the start angle of the arc band. (in degrees, counterclockwise from the direction at 3 o'clock). |
endAngle | the end angle of the arc band. (in degrees, counterclockwise from the direction at 3 o'clock). |
angleDirection | optional parameter defining the orientation of the arc, i.e. in which direction the arc extends from the start angle to the end angle. The default value is counterclockwise. |
luciad::InvalidArgumentException | if the arc band cannot be created. |
|
static |
Factory method to create a quadratic Bezier curve transitioning smoothly between startPoint and endPoint.
A quadratic Bezier curve is defined by this equation:
F(t) = startPoint*(1-t)^2 + 2(1-t)*t*controlPoint + endPoint*t^2
At t=0 (at start), F(t) evaluates to startPoint At t=1 (at end), F(t) evaluates to endPoint
For other values between 0 and 1, F(t) will evaluate to a quadratic curve tending to controlPoint.
reference | the coordinate reference in which the Bezier curve is defined. |
startPoint | first control point of quadratic Bezier curve, start of the curve. |
controlPoint | second control point of quadratic Bezier curve. |
endPoint | third control point of quadratic Bezier curve, end of the curve. |
|
static |
Factory method to create a bounding box geometry.
Example to create a bounds geometry:
reference | the coordinate reference in which the point is defined. |
location | the lower left location of the bounds. |
width | the width of the bounds (positive value). |
height | the height of the bounds (positive value). |
depth | the depth of the bounds (positive value). |
|
static |
Factory method to create a circle, given three points.
The points are allowed to have a Z-value, but all Z-values are required to be equal. If this requirement is not met, an exception is thrown.
Example usage:
A circle by-3-points where the three points coincide represents a circle with these points as its center and a radius of 0.
A circle by-3-points where 2 out of 3 points coincide represents a circle with its center located in the middle between the 2 coinciding points and the other point.
A circle by-3-points where the 3 points are co-linear results in luciad::InvalidArgumentException exceptions when curve methods are called in case the coordinate reference is Cartesian .
When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the circle are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.
For other coordinate references the distance calculations are done using cartesian calculations.
reference | the coordinate reference in which the circle is defined. |
startPoint | the start point of the circle. |
firstIntermediatePoint | the first intermediate point of the circle. |
secondIntermediatePoint | the second intermediate point of the circle. |
luciad::InvalidArgumentException | if the input points do not have equal Z-values. |
|
static |
Factory method to create a circle.
Example usage:
When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the circle are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.
reference | the coordinate reference in which the circle is defined. |
center | the center point of the circle. |
radius | the radius of the circle. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used. |
luciad::InvalidArgumentException | if the radius is smaller than 0. |
|
static |
Factory method to create a circular arc, given three points.
The circular arc will start at the given start point, pass through the given intermediate point and end in the given end point. The points are allowed to have a Z-value, but all Z-values are required to be equal. If this requirement is not met, an exception is thrown.
Example usage:
A circular arc-by-3-points where the start, end and intermediate point coincide represents an arc on a circle with these points as its center and a radius of 0.
A circular arc-by-3-points where 2 out of 3 points coincide represents an arc on a circle with its center located in the middle between the 2 coinciding points and the other point. If the start and end point coincide, a full circle is drawn, otherwise, the arc is interpreted as half a circle in counterclockwise direction from start to end point.
When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the circular arc are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.
For other coordinate references the distance calculations are done using cartesian calculations.
reference | the coordinate reference in which the circular arc is defined. |
startPoint | the start point of the circular arc. |
intermediatePoint | an intermediate point of the circular arc. |
endPoint | the end point of the circular arc. |
luciad::InvalidArgumentException | if the input points do not have equal Z-values. |
|
static |
Factory method to create a circular arc, starting at the given start point and ending in the given end point.
The points are allowed to have a Z-value, but both Z-values are required to be equal. If this requirement is not met, an exception is thrown.
Example usage:
The bulge factor is the ratio of (1) the distance between the arc midpoint and the center of the arc's chord, and (2) half the length of the arc's chord. The sign of the bulge indicates whether the midpoint is on the left side (positive) or right side (negative) of the vector from start to end point. So a bulge factor with an absolute value of 1 means a half-circle, smaller than 1 means a less bulging arc and larger than 1 means an arc that bulges out in the start and end point.
A circular arc-by-bulge where the start and end point coincide represents an arc on a circle with these points as its center and a radius of 0. The bulge factor is ignored in this case.
When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the circular arc are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.
For other coordinate references the distance calculations are done using cartesian calculations.
reference | the coordinate reference in which the circular arc is defined. |
startPoint | the start point of the circular arc. |
endPoint | the end point of the circular arc. |
bulge | the bulge factor of the circular arc. |
luciad::InvalidArgumentException | if the input points do not have equal Z-values. |
|
static |
Factory method to create a circular arc.
The angles for the circular arc are expressed in degrees counterclockwise from the direction at 3 o'clock. The arc segment goes from the start angle to the end angle in the positive direction (counterclockwise).
To create a circular arc with an extent from 45° to 300° you can use the following code.
To create a circular arc with an extent from 300° to 45° you can use the following code.
Creation of a circular arc with the start and the end angle having the same value results in full circle.
The default orientation for the circular arc is counterclockwise. The circular arc is a curve that is useful as a sub-curve building block for other geometries, e.g., an arc band. Therefore it also supports the specification of the orientation of the arc. When the orientation value is set to clock-wise the arc segment goes from the start angle to the end angle in counter clock wise direction (negative direction).
When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the circular arc are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.
For other coordinate references the distance calculations are done using cartesian calculations.
reference | the coordinate reference in which the circular arc is defined. |
center | the center point of the circular arc. |
radius | the radius of the circular arc. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used. |
startAngle | the start angle of the circular arc. (in degrees, counterclockwise from the direction at 3 o'clock). |
endAngle | the end angle of the circular arc. (in degrees, counterclockwise from the direction at 3 o'clock). |
angleDirection | optional parameter defining the orientation of the arc. The default value is counter clock-wise. |
|
static |
Factory to create a composite curve.
The following requirements must be met for the curves:
curveList | the curves of which to make a composite curve. |
luciad::InvalidArgumentException | if the requirements are not met. |
|
static |
Factory to create a composite patch.
The composite patch represents a surface whose boundary is defined by an exterior patch and optionally a number of interior patches which represents holes within the surface.
The following requirements must be met for the exterior patch and the interior patches:
Creation of composite patch with a hole:
exteriorPatch | the exterior patch of the composite patch surface. |
interiorPatches | the interior patches of the composite patch surface. This can be an empty list. |
luciad::InvalidArgumentException | if the requirements are not met. |
|
static |
Factory to create a composite ring.
The following requirements must be met for the curves:
curveList | the curves of which to make a composite ring. |
luciad::InvalidArgumentException | if the requirements are not met. |
|
static |
Factory method to create an ellipse.
Example usage:
When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the ellipse are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.
For other coordinate references the distance calculations are done using cartesian calculations.
reference | the coordinate reference in which the ellipse is defined. |
center | the center point of the ellipse. |
a | the length of the semi-major axis of the ellipse. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used. |
b | the length of the semi-minor axis of the ellipse. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used. |
rotationAngle | the rotation angle of the ellipse. |
luciad::InvalidArgumentException | if a or b is smaller than 0. |
|
static |
Factory method to create an elliptical arc.
Example usage:
Creation of an elliptical arc with the start and the end angle having the same value results in full ellipse.
When the passed coordinate reference is a geodetic reference, the distance calculations to determine points on the elliptical arc are done using geodesic calculations on the underlying ellipsoid of the coordinate reference.
For other coordinate references the distance calculations are done using cartesian calculations.
reference | the coordinate reference in which the elliptical arc is defined. |
center | the center point of the elliptical arc. |
a | the length of the semi-major axis of the elliptical arc. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used. |
b | the length of the semi-minor axis of the elliptical arc. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used. |
startAngle | the start angle of the elliptical arc. |
endAngle | the end angle of the elliptical arc. |
rotationAngle | the rotation of the ellipse on which the arc is defined |
angleDirection | optional parameter defining the orientation of the arc, i.e. in which direction the arc extends from the start angle to the end angle. The default value is counterclockwise. |
luciad::InvalidArgumentException | if a or b is smaller than 0. |
|
static |
Factory method to create an extruded geometry, based on a base geometry, minimum height and maximum height.
If the base geometry has Z-values of its own, they are ignored. The maximum height cannot be smaller than the minimum height.
If the given geometry is not a supported base for an extruded geometry, an exception is thrown. Use luciad::ExtrudedGeometry::isBaseGeometrySupported
to check whether a geometry is supported or not. Currently, all luciad::Curve
and luciad::Surface
geometries are supported, as well as luciad::MultiGeometry
instances that consist solely of such geometries.
Example Usage:
reference | the coordinate reference in which the extruded geometry is defined. The horizontal component of this reference must be the same as the horizontal component of the base geometry's coordinate reference. The vertical reference is used to interpret the min and max height values. |
baseGeometry | the geometry to use as a base for the extruded geometry. |
minHeight | the minimum height of the extruded geometry. If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used. |
maxHeight | the maximum height of the extruded geometry.If the coordinate reference is a geodetic reference, this is expressed in meters. Otherwise the unit of the reference is used. |
luciad::InvalidArgumentException | if the given geometry is not a supported base geometry for an extruded geometry, or if maxHeight < minHeight. |
|
static |
Factory method to create a line.
Line objects can be created with the interpolation types:
The interpolation types geodesic and rhumb are only allowed for geodetic coordinate references.
Creation of geodesic line:
Creation of rhumb line:
Creation of linear line in a cartesian coordinate reference:
firstPoint | first point of the line. |
secondPoint | second point of the line. |
reference | the coordinate reference in which the line is defined. |
curveInterpolationType | the type of interpolation between the points, i.e., linear, geodesic, or rhumb. |
luciad::InvalidArgumentException | if the line cannot be constructed. For example for an invalid combination of coordinate reference and interpolation type. |
|
static |
Factory to create a multi-geometry.
The following requirements must be met for the geometries:
To create a multi-geometry from a list of geometries you can use the following code.
geometryList | the geometries of which to make a multi-geometry; at least one geometry is required. |
luciad::InvalidArgumentException | if the requirements are not met. |
|
static |
Factory method to create a patch based on a Ring.
Example Usage:
baseGeometry | the base geometry (Ring) for the patch. |
luciad::InvalidArgumentException | if the base ring geometry is not supported. |
|
static |
Factory method to create a point from a coordinate.
Example to create a point geometry:
reference | the coordinate reference in which the point is defined. |
location | the location of the point |
|
static |
Factory method to create a point.
Example to create a point geometry:
reference | the coordinate reference in which the point is defined. |
x | the x-value of the point. |
y | the y-value of the point. |
z | the z-value of the point. |
|
static |
Factory to create a polygon.
The polygon represents a surface whose boundary is defined by an exterior (polyline) ring and optionally a number of interior (polyline) rings.
The following requirements must be met for the exterior ring and the interior rings:
Creation of polygon that only has an exterior ring:
Creation of polygon that has a single hole:
exteriorRing | the exterior ring of the polygon. |
interiorRings | the interior rings of the polygon. This can be an empty list. |
luciad::InvalidArgumentException | if the requirements are not met. |
|
static |
Factory to create a polyline.
Polyline objects can be created with the interpolation types:
The interpolation types geodesic and rhumb are only allowed for geodetic coordinate references.
Creation of geodesic polyline:
Creation of rhumb polyline:
Creation of linear polyline in a cartesian coordinate reference:
points | the points defining the polyline. |
reference | the coordinate reference in which the polyline is defined. |
curveInterpolationType | the type of interpolation between the points, i.e., linear, geodesic, or rhumb. |
luciad::InvalidArgumentException | if the polyline cannot be constructed. For example for an invalid combination of coordinate reference and interpolation type. |
|
static |
Factory to create a polyline to be used as ring.
The polyline represents a closed curve. The implementation does not require the list of points to be such that the first and the last point are the same. A line segment is automatically included between the last point and the first point.
Polyline objects can be created with the interpolation types:
The interpolation types geodesic and rhumb are only allowed for geodetic coordinate references.
Creation of a polyline as a ring:
points | the points defining the polyline. |
reference | the coordinate reference in which the polyline is defined. |
curveInterpolationType | the type of interpolation between the points, i.e., linear, geodesic, or rhumb. |
luciad::InvalidArgumentException | if the polyline ring cannot be constructed. For example for an invalid combination of coordinate reference and interpolation type. |
|
static |
Factory method to create a curve where pointy corners are replaced by Bezier Curves.
This method operates by assuming that the points originally define a Polyline. It retains the first and last point and replaces the geometry around vertex (corners) by a BezierCurve. The extent of BezierCurve depends on cornerRoundess. cornerRoundness decides the size of the Bezier Curve such that lower values will result in more pointy geometries.
This method requires at least 3 points to produce a rounded result. If only 2 points are provided, it will return a standard line. If less than 2 points are provided, this method will throw an Invalid Argument exception. If cornerRoundness is zero, a standard Polyline is created.
Corner roundness is expected to be between [0,1]
.
reference | The coordinate reference in which the curve is defined. |
points | Series of points defining the curve. At least 2 points are required to produce a result. |
cornerRoundness | The lower this value, the pointier the geometry will be. This value must be between [0, 1]. |
luciad::InvalidArgumentException | if the requirements are not met. |
|
static |
Factory method to create a ring where pointy corners are replaced by Bezier Curves.
This method operates by assuming that the points define a PolylineRing and then replace each corner of the ring by a BezierCurve. The extent of BezierCurve depends on cornerRoundess. CornerRoundness decides the size of the Bezier Curve such that lower values will result in more pointy geometries.
This method requires at least 3 points to produce a result. If less than 3 points are provided, it will throw an Invalid Argument exception. If cornerRoundness is zero, a standard PolylineRing is created.
Corner roundness is expected to be between [0,1]
.
reference | The coordinate reference in which the curve is defined. |
points | Series of points defining the curve. At least 3 points are required to produce a result. |
cornerRoundness | The lower this value, the pointier the geometry will be. This value must be between [0, 1]. |
luciad::InvalidArgumentException | if the requirements are not met. |