LuciadCPillar 2023.1.02
luciad::GeometryFactory Class Referencefinal

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< ArcBandcreateArcBand (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< BezierCurvecreateBezierCurve (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< BoundscreateBounds (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< CircleBy3PointscreateCircleBy3Points (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< CircleByCenterPointcreateCircleByCenterPoint (std::shared_ptr< CoordinateReference > reference, Coordinate center, double radius)
 Factory method to create a circle. More...
 
static std::shared_ptr< CircularArcBy3PointscreateCircularArcBy3Points (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< CircularArcByBulgecreateCircularArcByBulge (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< CircularArcByCenterPointcreateCircularArcByCenterPoint (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< CompositeCurvecreateCompositeCurve (std::vector< std::shared_ptr< Curve > > curveList)
 Factory to create a composite curve. More...
 
static std::shared_ptr< CompositePatchcreateCompositePatch (std::shared_ptr< Patch > exteriorPatch, std::vector< std::shared_ptr< Patch > > interiorPatches)
 Factory to create a composite patch. More...
 
static std::shared_ptr< CompositeRingcreateCompositeRing (std::vector< std::shared_ptr< Curve > > curveList)
 Factory to create a composite ring. More...
 
static std::shared_ptr< EllipsecreateEllipse (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< EllipticalArccreateEllipticalArc (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< ExtrudedGeometrycreateExtrudedGeometry (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< LinecreateLine (std::shared_ptr< luciad::CoordinateReference > reference, Coordinate firstPoint, Coordinate secondPoint, LineInterpolationType curveInterpolationType)
 Factory method to create a line. More...
 
static std::shared_ptr< MultiGeometrycreateMultiGeometry (std::vector< std::shared_ptr< Geometry > > geometryList)
 Factory to create a multi-geometry. More...
 
static std::shared_ptr< PatchcreatePatch (std::shared_ptr< Ring > baseGeometry)
 Factory method to create a patch based on a Ring. More...
 
static std::shared_ptr< PointcreatePoint (std::shared_ptr< CoordinateReference > reference, Coordinate location)
 Factory method to create a point from a coordinate. More...
 
static std::shared_ptr< PointcreatePoint (std::shared_ptr< CoordinateReference > reference, double x, double y, double z)
 Factory method to create a point. More...
 
static std::shared_ptr< PolygoncreatePolygon (std::shared_ptr< PolylineRing > exteriorRing, std::vector< std::shared_ptr< PolylineRing > > interiorRings)
 Factory to create a polygon. More...
 
static std::shared_ptr< PolylinecreatePolyline (std::shared_ptr< luciad::CoordinateReference > reference, std::vector< Coordinate > points, LineInterpolationType curveInterpolationType)
 Factory to create a polyline. More...
 
static std::shared_ptr< PolylineRingcreatePolylineRing (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< CompositeCurvecreateRoundedPolyline (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< CompositeRingcreateRoundedPolylineRing (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...
 

Detailed Description

Factory to create geometries defined within a coordinate reference.

You can read more about the available geometries here.

Constructor & Destructor Documentation

◆ GeometryFactory()

luciad::GeometryFactory::GeometryFactory ( )
delete

◆ ~GeometryFactory()

luciad::GeometryFactory::~GeometryFactory ( )
delete

Member Function Documentation

◆ createArcBand()

static std::shared_ptr< ArcBand > luciad::GeometryFactory::createArcBand ( std::shared_ptr< CoordinateReference reference,
Coordinate  center,
double  minRadius,
double  maxRadius,
Angle  startAngle,
Angle  endAngle,
Angle::Direction  angleDirection = Angle::Direction::CounterClockwise 
)
static

Factory method to create an arc band.

Create the arc band you need

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.

std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
Coordinate center{3.5, 51.4, 123.0};
double minRadius = 12000.0;
double maxRadius = 15000.0;
Angle startAngle = 30.0;
Angle endAngle = 145.0;
auto arcBand = GeometryFactory::createArcBand(crs.value(), center, minRadius, maxRadius, startAngle, endAngle);
static luciad::expected< std::shared_ptr< CoordinateReference >, ErrorInfo > create(const std::string &identifier)
Creates the coordinate reference from a given EPSG, WKT (version 1) or OGC identifier.
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.
An angle on a mathematical circle: degrees, counter-clockwise from right/X-axis.
Definition: Angle.h:14
A "POD" for a 3D coordinate.
Definition: Coordinate.h:14

Creation of an arc band is very similar to a circular arc. See GeometryFactory::createCircularArcByCenterPoint.

Interpretation based on the coordinate reference

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.

Parameters
referencethe coordinate reference in which the circular arc is defined.
centerthe center point of the arc band.
minRadiusthe minimal radius of the arc band.
maxRadiusthe maximal radius of the arc band.
startAnglethe start angle of the arc band. (in degrees, counterclockwise from the direction at 3 o'clock).
endAnglethe end angle of the arc band. (in degrees, counterclockwise from the direction at 3 o'clock).
angleDirectionoptional 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.
Returns
the arc band.
Exceptions
luciad::InvalidArgumentExceptionif the arc band cannot be created.

◆ createBezierCurve()

static std::shared_ptr< BezierCurve > luciad::GeometryFactory::createBezierCurve ( std::shared_ptr< luciad::CoordinateReference reference,
Coordinate  startPoint,
Coordinate  controlPoint,
Coordinate  endPoint 
)
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
Quadratic Bezier Curves

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.

Parameters
referencethe coordinate reference in which the Bezier curve is defined.
startPointfirst control point of quadratic Bezier curve, start of the curve.
controlPointsecond control point of quadratic Bezier curve.
endPointthird control point of quadratic Bezier curve, end of the curve.
Returns
the line geometry.
Since
2020.1

◆ createBounds()

static std::shared_ptr< Bounds > luciad::GeometryFactory::createBounds ( std::shared_ptr< CoordinateReference reference,
Coordinate  location,
double  width,
double  height,
double  depth 
)
static

Factory method to create a bounding box geometry.

Example to create a bounds geometry:

std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
Coordinate location = {3.5, 51.4, 123.0};
double width = 5.5;
double height = 6.6;
double depth = 123.0;
auto bounds = GeometryFactory::createBounds(crs.value(), location, width, height, depth);
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.
Parameters
referencethe coordinate reference in which the point is defined.
locationthe lower left location of the bounds.
widththe width of the bounds (positive value).
heightthe height of the bounds (positive value).
depththe depth of the bounds (positive value).
Returns
the point.

◆ createCircleBy3Points()

static std::shared_ptr< CircleBy3Points > luciad::GeometryFactory::createCircleBy3Points ( std::shared_ptr< CoordinateReference reference,
Coordinate  startPoint,
Coordinate  firstIntermediatePoint,
Coordinate  secondIntermediatePoint 
)
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:

std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
Coordinate startPoint = {3.5, 51.4, 123.0};
Coordinate firstIntermediatePoint = {10, 50, 123.0};
Coordinate secondIntermediatePoint = {8, 54, 123.0};
auto circleBy3Points = GeometryFactory::createCircleBy3Points(crs.value(), startPoint, firstIntermediatePoint, secondIntermediatePoint);
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.

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.

Parameters
referencethe coordinate reference in which the circle is defined.
startPointthe start point of the circle.
firstIntermediatePointthe first intermediate point of the circle.
secondIntermediatePointthe second intermediate point of the circle.
Returns
the circle.
Exceptions
luciad::InvalidArgumentExceptionif the input points do not have equal Z-values.

◆ createCircleByCenterPoint()

static std::shared_ptr< CircleByCenterPoint > luciad::GeometryFactory::createCircleByCenterPoint ( std::shared_ptr< CoordinateReference reference,
Coordinate  center,
double  radius 
)
static

Factory method to create a circle.

Example usage:

std::string identifier = "EPSG:3857";
auto crs = CoordinateReferenceProvider::create(identifier);
Coordinate center = Coordinate(3.5, 51.4, 123.0);
double radius = 12000.0;
auto circle = GeometryFactory::createCircleByCenterPoint(crs.value(), center, radius);
static std::shared_ptr< CircleByCenterPoint > createCircleByCenterPoint(std::shared_ptr< CoordinateReference > reference, Coordinate center, double radius)
Factory method to create a circle.

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.

Parameters
referencethe coordinate reference in which the circle is defined.
centerthe center point of the circle.
radiusthe 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.
Returns
the circle.
Exceptions
luciad::InvalidArgumentExceptionif the radius is smaller than 0.

◆ createCircularArcBy3Points()

static std::shared_ptr< CircularArcBy3Points > luciad::GeometryFactory::createCircularArcBy3Points ( std::shared_ptr< CoordinateReference reference,
Coordinate  startPoint,
Coordinate  intermediatePoint,
Coordinate  endPoint 
)
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:

std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
Coordinate startPoint = {3.5, 51.4, 123.0};
Coordinate intermediatePoint = {10, 50, 123.0};
Coordinate endPoint = {8, 54, 123.0};
auto arc = GeometryFactory::createCircularArcBy3Points(crs.value(), startPoint, intermediatePoint, endPoint);
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.

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.

Parameters
referencethe coordinate reference in which the circular arc is defined.
startPointthe start point of the circular arc.
intermediatePointan intermediate point of the circular arc.
endPointthe end point of the circular arc.
Returns
the circular arc.
Exceptions
luciad::InvalidArgumentExceptionif the input points do not have equal Z-values.

◆ createCircularArcByBulge()

static std::shared_ptr< CircularArcByBulge > luciad::GeometryFactory::createCircularArcByBulge ( std::shared_ptr< CoordinateReference reference,
Coordinate  startPoint,
Coordinate  endPoint,
double  bulge 
)
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:

std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
Coordinate startPoint = {3.5, 51.4, 123.0};
Coordinate endPoint = {8, 54, 123.0};
double bulge = -0.7;
auto arc = GeometryFactory::createCircularArcByBulge(crs.value(), startPoint, endPoint, bulge);
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 en...

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.

Parameters
referencethe coordinate reference in which the circular arc is defined.
startPointthe start point of the circular arc.
endPointthe end point of the circular arc.
bulgethe bulge factor of the circular arc.
Returns
the circular arc.
Exceptions
luciad::InvalidArgumentExceptionif the input points do not have equal Z-values.

◆ createCircularArcByCenterPoint()

static std::shared_ptr< CircularArcByCenterPoint > luciad::GeometryFactory::createCircularArcByCenterPoint ( std::shared_ptr< CoordinateReference reference,
Coordinate  center,
double  radius,
luciad::Angle  startAngle,
luciad::Angle  endAngle,
Angle::Direction  angleDirection = Angle::Direction::CounterClockwise 
)
static

Factory method to create a circular arc.

Create the circular arc you need

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.

std::string identifier = "EPSG:4326";
auto expectedCRS = CoordinateReferenceProvider::create(identifier);
auto crs = expectedCRS.value();
Coordinate center = {3.5, 51.4, 123.0};
double radius = 12000.0;
Angle startAngle = 45.0;
Angle endAngle = 300.0;
auto arc = GeometryFactory::createCircularArcByCenterPoint(crs, center, radius, startAngle, endAngle);
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.
Arc from 45° to 300°

To create a circular arc with an extent from 300° to 45° you can use the following code.

std::string identifier = "EPSG:4326";
auto expectedCRS = CoordinateReferenceProvider::create(identifier);
auto crs = expectedCRS.value();
Coordinate center = {3.5, 51.4, 123.0};
double radius = 12000.0;
Angle startAngle = 300.0;
Angle endAngle = 45.0;
auto arc = GeometryFactory::createCircularArcByCenterPoint(crs, center, radius, startAngle, endAngle);
Arc from 300° to 45°

Creation of a circular arc with the start and the end angle having the same value results in full circle.

Optional orientation of the arc

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

Interpretation based on the coordinate reference

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.

Parameters
referencethe coordinate reference in which the circular arc is defined.
centerthe center point of the circular arc.
radiusthe 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.
startAnglethe start angle of the circular arc. (in degrees, counterclockwise from the direction at 3 o'clock).
endAnglethe end angle of the circular arc. (in degrees, counterclockwise from the direction at 3 o'clock).
angleDirectionoptional parameter defining the orientation of the arc. The default value is counter clock-wise.
Returns
the circular arc.

◆ createCompositeCurve()

static std::shared_ptr< CompositeCurve > luciad::GeometryFactory::createCompositeCurve ( std::vector< std::shared_ptr< Curve > >  curveList)
static

Factory to create a composite curve.

The following requirements must be met for the curves:

  1. the coordinate references must be the same
  2. the end point of a curve must be same as the start point of the next curve
Parameters
curveListthe curves of which to make a composite curve.
Returns
the composite curve.
Exceptions
luciad::InvalidArgumentExceptionif the requirements are not met.

◆ createCompositePatch()

static std::shared_ptr< CompositePatch > luciad::GeometryFactory::createCompositePatch ( std::shared_ptr< Patch exteriorPatch,
std::vector< std::shared_ptr< Patch > >  interiorPatches 
)
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:

  1. the coordinate references must be the same

Creation of composite patch with a hole:

std::shared_ptr<Patch> exteriorPatch = GeometryFactory::createPatch(circleBy3Points);
std::shared_ptr<Patch> interiorPatch = GeometryFactory::createPatch(ellipse);
std::vector<std::shared_ptr<Patch>> interiorPatches;
interiorPatches.emplace_back(std::move(interiorPatch));
std::shared_ptr<CompositePatch> compositePatch = GeometryFactory::createCompositePatch(exteriorPatch, interiorPatches);
static std::shared_ptr< Patch > createPatch(std::shared_ptr< Ring > baseGeometry)
Factory method to create a patch based on a Ring.
static std::shared_ptr< CompositePatch > createCompositePatch(std::shared_ptr< Patch > exteriorPatch, std::vector< std::shared_ptr< Patch > > interiorPatches)
Factory to create a composite patch.
Parameters
exteriorPatchthe exterior patch of the composite patch surface.
interiorPatchesthe interior patches of the composite patch surface. This can be an empty list.
Returns
the composite patch.
Exceptions
luciad::InvalidArgumentExceptionif the requirements are not met.

◆ createCompositeRing()

static std::shared_ptr< CompositeRing > luciad::GeometryFactory::createCompositeRing ( std::vector< std::shared_ptr< Curve > >  curveList)
static

Factory to create a composite ring.

The following requirements must be met for the curves:

  1. the coordinate references must be the same
  2. the end point of a curve must be same as the start point of the next curve
  3. the end point of the last curve must be the same as the start point of the first curve
Parameters
curveListthe curves of which to make a composite ring.
Returns
the composite ring.
Exceptions
luciad::InvalidArgumentExceptionif the requirements are not met.

◆ createEllipse()

static std::shared_ptr< Ellipse > luciad::GeometryFactory::createEllipse ( std::shared_ptr< CoordinateReference reference,
Coordinate  center,
double  a,
double  b,
luciad::Angle  rotationAngle 
)
static

Factory method to create an ellipse.

Example usage:

std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
Coordinate centerPoint = {3.5, 51.4, 123.0};
double a = 12000;
double b = 6000;
Angle rotAngle = 45;
auto ellipse = GeometryFactory::createEllipse(crs.value(), centerPoint, a, b, rotAngle);
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.

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.

Parameters
referencethe coordinate reference in which the ellipse is defined.
centerthe center point of the ellipse.
athe 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.
bthe 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.
rotationAnglethe rotation angle of the ellipse.
Returns
the ellipse.
Exceptions
luciad::InvalidArgumentExceptionif a or b is smaller than 0.

◆ createEllipticalArc()

static std::shared_ptr< EllipticalArc > luciad::GeometryFactory::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 
)
static

Factory method to create an elliptical arc.

Example usage:

std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
Coordinate centerPoint = {3.5, 51.4, 123.0};
double a = 12000;
double b = 6000;
Angle startAngle = 30;
Angle endAngle = 125;
Angle rotAngle = 45;
auto arc = GeometryFactory::createEllipticalArc(crs.value(), centerPoint, a, b, startAngle, endAngle, rotAngle);
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.

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.

Parameters
referencethe coordinate reference in which the elliptical arc is defined.
centerthe center point of the elliptical arc.
athe 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.
bthe 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.
startAnglethe start angle of the elliptical arc.
endAnglethe end angle of the elliptical arc.
rotationAnglethe rotation of the ellipse on which the arc is defined
angleDirectionoptional 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.
Returns
the elliptical arc.
Exceptions
luciad::InvalidArgumentExceptionif a or b is smaller than 0.

◆ createExtrudedGeometry()

static std::shared_ptr< ExtrudedGeometry > luciad::GeometryFactory::createExtrudedGeometry ( std::shared_ptr< CoordinateReference reference,
std::shared_ptr< Geometry baseGeometry,
double  minHeight,
double  maxHeight 
)
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:

auto crs = CoordinateReferenceProvider::create("EPSG:4326");
Coordinate centerPoint = {51, 4, 0};
double radius = 5000;
auto circle = GeometryFactory::createCircleByCenterPoint(crs.value(), centerPoint, radius);
double minHeight = 500;
double maxHeight = 2000;
auto extrudedGeometry = GeometryFactory::createExtrudedGeometry(*crs, circle, minHeight, maxHeight);
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 h...
Parameters
referencethe 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.
baseGeometrythe geometry to use as a base for the extruded geometry.
minHeightthe 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.
maxHeightthe 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.
Returns
the extruded geometry.
Exceptions
luciad::InvalidArgumentExceptionif the given geometry is not a supported base geometry for an extruded geometry, or if maxHeight < minHeight.

◆ createLine()

static std::shared_ptr< Line > luciad::GeometryFactory::createLine ( std::shared_ptr< luciad::CoordinateReference reference,
Coordinate  firstPoint,
Coordinate  secondPoint,
LineInterpolationType  curveInterpolationType 
)
static

Factory method to create a line.

Line objects can be created with the interpolation types:

  • linear
  • geodesic
  • rhumb

The interpolation types geodesic and rhumb are only allowed for geodetic coordinate references.

Creation of geodesic line:

Coordinate startPoint = {-10.0, 50.0, 123.0};
Coordinate endPoint = {15.0, 50.0, 256.0};
std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
auto line = GeometryFactory::createLine(crs.value(), startPoint, endPoint, LineInterpolationType::Geodesic);
static std::shared_ptr< Line > createLine(std::shared_ptr< luciad::CoordinateReference > reference, Coordinate firstPoint, Coordinate secondPoint, LineInterpolationType curveInterpolationType)
Factory method to create a line.
@ Geodesic
Geodesic interpolation between points.

Creation of rhumb line:

Coordinate startPoint = {-10.0, 50.0, 123.0};
Coordinate endPoint = {15.0, 50.0, 256.0};
std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
auto line = GeometryFactory::createLine(crs.value(), startPoint, endPoint, LineInterpolationType::Rhumb);
@ Rhumb
Rhumbline interpolation between points.

Creation of linear line in a cartesian coordinate reference:

Coordinate startPoint = {-10.0, 50.0, 123.0};
Coordinate endPoint = {15.0, 50.0, 256.0};
std::string identifier = "EPSG:3857";
auto crs = CoordinateReferenceProvider::create(identifier);
auto line = GeometryFactory::createLine(crs.value(), startPoint, endPoint, LineInterpolationType::Linear);
@ Linear
Linear interpolation between points.
Parameters
firstPointfirst point of the line.
secondPointsecond point of the line.
referencethe coordinate reference in which the line is defined.
curveInterpolationTypethe type of interpolation between the points, i.e., linear, geodesic, or rhumb.
Returns
the line geometry.
Exceptions
luciad::InvalidArgumentExceptionif the line cannot be constructed. For example for an invalid combination of coordinate reference and interpolation type.

◆ createMultiGeometry()

static std::shared_ptr< MultiGeometry > luciad::GeometryFactory::createMultiGeometry ( std::vector< std::shared_ptr< Geometry > >  geometryList)
static

Factory to create a multi-geometry.

The following requirements must be met for the geometries:

  1. the coordinate references must be the same

To create a multi-geometry from a list of geometries you can use the following code.

std::vector<std::shared_ptr<Geometry>> geometryList;
geometryList.emplace_back(point);
geometryList.emplace_back(polyline);
geometryList.emplace_back(polygon);
geometryList.emplace_back(circularArcByCenterPoint);
geometryList.emplace_back(arcBand);
auto multiGeometry = GeometryFactory::createMultiGeometry(geometryList);
static std::shared_ptr< MultiGeometry > createMultiGeometry(std::vector< std::shared_ptr< Geometry > > geometryList)
Factory to create a multi-geometry.
Parameters
geometryListthe geometries of which to make a multi-geometry; at least one geometry is required.
Returns
the multi-geometry.
Exceptions
luciad::InvalidArgumentExceptionif the requirements are not met.

◆ createPatch()

static std::shared_ptr< Patch > luciad::GeometryFactory::createPatch ( std::shared_ptr< Ring baseGeometry)
static

Factory method to create a patch based on a Ring.

Example Usage:

std::shared_ptr<CircleByCenterPoint> circleByCenterPoint = GeometryFactory::createCircleByCenterPoint(crs, centerPoint, radius);
std::shared_ptr<Patch> circleByCenterPointPatch = GeometryFactory::createPatch(circleByCenterPoint);
std::shared_ptr<CircleBy3Points> circleBy3Points = GeometryFactory::createCircleBy3Points(crs, startPoint, firstIntermediatePoint, secondIntermediatePoint);
std::shared_ptr<Patch> circleBy3PointsPatch = GeometryFactory::createPatch(circleBy3Points);
std::shared_ptr<ArcBand> arcBand = GeometryFactory::createArcBand(crs, center, minRadius, maxRadius, startAngle, endAngle);
std::shared_ptr<Patch> arcBandPatch = GeometryFactory::createPatch(arcBand);
std::shared_ptr<Ellipse> ellipse = GeometryFactory::createEllipse(crs, centerPoint, a, b, rotAngle);
std::shared_ptr<Patch> ellipsePatch = GeometryFactory::createPatch(ellipse);
std::shared_ptr<PolylineRing> polylineRing = GeometryFactory::createPolylineRing(crs, points, LineInterpolationType::Geodesic);
std::shared_ptr<Patch> polylineRingPatch = GeometryFactory::createPatch(polylineRing);
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.
Parameters
baseGeometrythe base geometry (Ring) for the patch.
Returns
the patch geometry.
Exceptions
luciad::InvalidArgumentExceptionif the base ring geometry is not supported.

◆ createPoint() [1/2]

static std::shared_ptr< Point > luciad::GeometryFactory::createPoint ( std::shared_ptr< CoordinateReference reference,
Coordinate  location 
)
static

Factory method to create a point from a coordinate.

Example to create a point geometry:

std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
Coordinate location{3.5, 51.4, 123.0};
auto point = GeometryFactory::createPoint(crs.value(), location);
static std::shared_ptr< Point > createPoint(std::shared_ptr< CoordinateReference > reference, double x, double y, double z)
Factory method to create a point.
Parameters
referencethe coordinate reference in which the point is defined.
locationthe location of the point
Returns
the point.
Since
2022.1

◆ createPoint() [2/2]

static std::shared_ptr< Point > luciad::GeometryFactory::createPoint ( std::shared_ptr< CoordinateReference reference,
double  x,
double  y,
double  z 
)
static

Factory method to create a point.

Example to create a point geometry:

std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
auto point = GeometryFactory::createPoint(crs.value(), 3.5, 51.4, 123.0);
Parameters
referencethe coordinate reference in which the point is defined.
xthe x-value of the point.
ythe y-value of the point.
zthe z-value of the point.
Returns
the point.

◆ createPolygon()

static std::shared_ptr< Polygon > luciad::GeometryFactory::createPolygon ( std::shared_ptr< PolylineRing exteriorRing,
std::vector< std::shared_ptr< PolylineRing > >  interiorRings 
)
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:

  1. the coordinate references must be the same
  2. the interpolation type must be the same

Creation of polygon that only has an exterior ring:

std::vector<Coordinate> points = {
{-10.0, 50.0, 123.0},
{15.0, 50.0, 256.0},
{15.0, 40.0, 321.0},
};
std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
auto exteriorRing = GeometryFactory::createPolylineRing(crs.value(), points, LineInterpolationType::Geodesic);
std::vector<std::shared_ptr<PolylineRing>> interiorRings = {};
auto polygon = GeometryFactory::createPolygon(std::move(exteriorRing), interiorRings);
static std::shared_ptr< Polygon > createPolygon(std::shared_ptr< PolylineRing > exteriorRing, std::vector< std::shared_ptr< PolylineRing > > interiorRings)
Factory to create a polygon.

Creation of polygon that has a single hole:

std::vector<Coordinate> pointsExterior = {
{-10.0, 50.0, 123.0},
{15.0, 50.0, 123.0},
{15.0, 40.0, 123.0},
};
std::vector<Coordinate> pointsInterior = {
{-0.0, 49.0, 123.0},
{10.0, 49.0, 123.0},
{10.0, 44.0, 123.0},
};
std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
auto exteriorRing = GeometryFactory::createPolylineRing(crs.value(), pointsExterior, LineInterpolationType::Geodesic);
auto interiorRing = GeometryFactory::createPolylineRing(crs.value(), pointsInterior, LineInterpolationType::Geodesic);
std::vector<std::shared_ptr<PolylineRing>> interiorRings;
interiorRings.emplace_back(std::move(interiorRing));
auto polygon = GeometryFactory::createPolygon(std::move(exteriorRing), interiorRings);
Parameters
exteriorRingthe exterior ring of the polygon.
interiorRingsthe interior rings of the polygon. This can be an empty list.
Returns
the polygon.
Exceptions
luciad::InvalidArgumentExceptionif the requirements are not met.

◆ createPolyline()

static std::shared_ptr< Polyline > luciad::GeometryFactory::createPolyline ( std::shared_ptr< luciad::CoordinateReference reference,
std::vector< Coordinate points,
LineInterpolationType  curveInterpolationType 
)
static

Factory to create a polyline.

Polyline objects can be created with the interpolation types:

  • linear
  • geodesic
  • rhumb

The interpolation types geodesic and rhumb are only allowed for geodetic coordinate references.

Creation of geodesic polyline:

std::vector<Coordinate> points = {
{-10.0, 50.0, 123.0},
{15.0, 50.0, 256.0},
{15.0, 40.0, 321.0},
{-10.0, 50.0, 123.0},
};
std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
static std::shared_ptr< Polyline > createPolyline(std::shared_ptr< luciad::CoordinateReference > reference, std::vector< Coordinate > points, LineInterpolationType curveInterpolationType)
Factory to create a polyline.

Creation of rhumb polyline:

std::vector<Coordinate> points = {
{-10.0, 50.0, 123.0},
{15.0, 50.0, 256.0},
{15.0, 40.0, 321.0},
{-10.0, 50.0, 123.0},
};
std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
auto polyline = GeometryFactory::createPolyline(crs.value(), points, LineInterpolationType::Rhumb);

Creation of linear polyline in a cartesian coordinate reference:

std::vector<Coordinate> points = {
{-10.0, 50.0, 123.0},
{15.0, 50.0, 256.0},
{15.0, 40.0, 321.0},
{-10.0, 50.0, 123.0},
};
std::string identifier = "EPSG:3857";
auto crs = CoordinateReferenceProvider::create(identifier);
auto polyline = GeometryFactory::createPolyline(crs.value(), points, LineInterpolationType::Linear);
Parameters
pointsthe points defining the polyline.
referencethe coordinate reference in which the polyline is defined.
curveInterpolationTypethe type of interpolation between the points, i.e., linear, geodesic, or rhumb.
Returns
the polyline
Exceptions
luciad::InvalidArgumentExceptionif the polyline cannot be constructed. For example for an invalid combination of coordinate reference and interpolation type.

◆ createPolylineRing()

static std::shared_ptr< PolylineRing > luciad::GeometryFactory::createPolylineRing ( std::shared_ptr< CoordinateReference reference,
std::vector< Coordinate points,
LineInterpolationType  curveInterpolationType 
)
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:

  • linear
  • geodesic
  • rhumb

The interpolation types geodesic and rhumb are only allowed for geodetic coordinate references.

Creation of a polyline as a ring:

std::vector<Coordinate> points = {
{-10.0, 50.0, 123.0},
{15.0, 50.0, 256.0},
{15.0, 40.0, 321.0},
};
std::string identifier = "EPSG:4326";
auto crs = CoordinateReferenceProvider::create(identifier);
auto polylineRing = GeometryFactory::createPolylineRing(crs.value(), points, LineInterpolationType::Geodesic);
Parameters
pointsthe points defining the polyline.
referencethe coordinate reference in which the polyline is defined.
curveInterpolationTypethe type of interpolation between the points, i.e., linear, geodesic, or rhumb.
Returns
the polyline, as a ring.
Exceptions
luciad::InvalidArgumentExceptionif the polyline ring cannot be constructed. For example for an invalid combination of coordinate reference and interpolation type.

◆ createRoundedPolyline()

static std::shared_ptr< CompositeCurve > luciad::GeometryFactory::createRoundedPolyline ( std::shared_ptr< luciad::CoordinateReference reference,
const std::vector< Coordinate > &  points,
double  cornerRoundness 
)
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].

Rounded Line
Parameters
referenceThe coordinate reference in which the curve is defined.
pointsSeries of points defining the curve. At least 2 points are required to produce a result.
cornerRoundnessThe lower this value, the pointier the geometry will be. This value must be between [0, 1].
Returns
the rounded curve geometry.
Exceptions
luciad::InvalidArgumentExceptionif the requirements are not met.
Since
2020.1

◆ createRoundedPolylineRing()

static std::shared_ptr< CompositeRing > luciad::GeometryFactory::createRoundedPolylineRing ( std::shared_ptr< luciad::CoordinateReference reference,
const std::vector< Coordinate > &  points,
double  cornerRoundness 
)
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].

Roundness Factor
Parameters
referenceThe coordinate reference in which the curve is defined.
pointsSeries of points defining the curve. At least 3 points are required to produce a result.
cornerRoundnessThe lower this value, the pointier the geometry will be. This value must be between [0, 1].
Returns
the rounded ring geometry.
Exceptions
luciad::InvalidArgumentExceptionif the requirements are not met.
Since
2020.1