Options
All
• Public
• Public/Protected
• All

# Module ria/shape/ShapeFactory

The ShapeFactory allows you to create new shapes.

``````import {createArc, createPoint} from "@luciad/ria/shape/ShapeFactory.js";

const ref = getReference("EPSG:4326");
const myPoint = createPoint(ref, [52, 5]);

const myArc = createArc(ref, createPoint(ref, [52, 5]), 20000, 10000, 0, 90, 180);
``````

## Functions

### createArc

• (reference: CoordinateReference | null, center: Point, a: number, b: number, rotationAzimuth: number, startAzimuth: number, sweepAngle: number): Arc
• Creates a elliptical arc defined by a center point, semi-major axis, semi-minor axis, a start angle and a sweep angle.

see

Arc

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which the elliptical arc is defined.

• ##### center: Point

the center point.

• ##### a: number

the semi-major axis of the ellipse defining the arc, in meters.

• ##### b: number

the semi-minor axis of the ellipse defining the arc, in meters.

• ##### rotationAzimuth: number

the rotation azimuth of the ellipse defining the arc, in degrees, positive clockwise from 12 o'clock (north).

• ##### startAzimuth: number

the start azimuth, in degrees, positive clockwise from 12 o'clock (north).

• ##### sweepAngle: number

the angle over which the arc extends, in degrees, positive clockwise.

the arc

### createArcBand

• Creates a circular arc band defined by a center point, a minimum radius, a maximum radius, a start angle and a sweep angle.

see

ArcBand

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which the shape is defined.

• ##### center: Point

center the center point.

the minimum radius of the circle defining the arc band, in meters.

the maximum radius of the circle defining the arc band, in meters.

• ##### startAzimuth: number

the start azimuth, in degrees, positive clockwise from 12 o'clock (north).

• ##### sweepAngle: number

the angle over which the arc band extends, in degrees, positive clockwise.

the arc band

### createBounds

• Creates a Bounds with the specified coordinates.

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which the coordinates are defined

• ##### Optional coordinates: number[]

the coordinate of the bounds, expressed as an array. (e.g. "[x,width,y,height]" or "[x,width,y,height,z,depth]")

#### Returns Bounds

The bounds with the specified coordinates

### createCircleBy3Points

• Creates a circle defined by three points on its circumference

#### Parameters

• ##### reference: CoordinateReference

the reference in which the circle is defined

• ##### point1: Point

A point on the circumference

• ##### point2: Point

A point on the circumference

• ##### point3: Point

A point on the circumference

#### Returns CircleBy3Points

The new circle

### createCircleByCenterPoint

• Creates a circle defined by a center-point and radius.

#### Parameters

• ##### reference: CoordinateReference

the reference in which the circle is defined

• ##### center: Point

The center of the circle

The radius of the circle, in meters

#### Returns CircleByCenterPoint

The circle with the specified center and radius

### createCircularArcBy3Points

• Creates a circular arc defined by a start point, an end point and an intermediate point on the arc.

see

CircularArcBy3Points

#### Parameters

• ##### reference: CoordinateReference

the reference in which the circular arc is defined

• ##### startPoint: Point

The start point of the arc

• ##### intermediatePoint: Point

An intermediate point on the arc

• ##### endPoint: Point

The end point of the arc

#### Returns CircularArcBy3Points

The circular-arc-by-3-points with the specified 3 points

### createCircularArcByBulge

• Creates a circular arc defined by two points and bulge factor

see

CircularArcByBulge

#### Parameters

• ##### reference: CoordinateReference

the reference in which the circular arc is defined

• ##### startPoint: Point

the start point of the circular arc

• ##### endPoint: Point

the end point of the circular arc

• ##### bulge: number

the bulge of the arc (a value of 1 defines a half-circle, less makes the arc flatter)

#### Returns CircularArcByBulge

The circular-arc-by-bulge with the specified points and bulge

### createCircularArcByCenterPoint

• Creates a circular arc defined by a center point, radius, a start angle and a sweep angle.

see

CircularArcByCenterPoint

#### Parameters

• ##### reference: CoordinateReference

the reference in which the circular arc is defined

• ##### center: Point

the center point.

the radius of the circle defining the arc.

• ##### startAzimuth: number

the start azimuth (in degrees, clockwise from 12 o'clock (north)).

• ##### sweepAngle: number

the sweep angle (in degrees, clockwise from the start angle).

#### Returns CircularArcByCenterPoint

the circular-arc-by-center-point

### createComplexPolygon

• Creates a complex polygon with the specified polygons.

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which the ComplexPolygon is defined

• ##### Optional polygons: Polygon[]

an array of Polygon instances. The first polygon in this array is the outer ring. All other polygons in this array must be contained inside this first polygon.

#### Returns ComplexPolygon

The complex polygon with the specified polygons

### createEllipse

• Creates an Ellipse with the specified parameters

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which the circle is defined

• ##### center: Point

The center of the circle

• ##### a: number

The length of the semi-major axis, in meters

• ##### b: number

The length of the semi-minor axis, in meters

• ##### rotationAzimuth: number

The rotation azimuth of the semi-major axis, in degrees from 12 o'clock (north), positive clockwise

#### Returns Ellipse

The ellipse with the specified parameters

### createExtrudedShape

• Creates a extruded shape for a base shape.

Currently ExtrudedShape supports 2D lines and areas as base shape. See ExtrudedShape.isSupportedBaseShape to check if a base shape is supported.

``````require([
], function(ShapeFactory,
ReferenceProvider){

...

var ref = ReferenceProvider.getReference("EPSG:4326"),
var myExtrudedShape = createExtrudedShape(ref, polyline, 1200, 1500);
});``````
throws

ProgrammingError if the base shape is not supported (see ExtrudedShape.isSupportedBaseShape)

see

ExtrudedShape

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which both the extruded shape and base shape are defined. They must be the same.

• ##### baseShape: Shape

The base shape

• ##### minimumHeight: number

The lower/bottom boundary of the 3D volume

• ##### maximumHeight: number

The upper/top boundary of the 3D volume

#### Returns ExtrudedShape

The new extruded shape

### createGeoBuffer

• Creates a geo-buffer around a base shape.

Currently GeoBuffer supports Polyline, Polygon and ComplexPolygon as base shape. See GeoBuffer.isSupportedBaseShape to check if a base shape is supported.

throws

ProgrammingError if the base shape is not supported (see GeoBuffer.isSupportedBaseShape)

see

GeoBuffer

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which the geobuffer and base shape are defined

• ##### baseShape: Shape

The base shape

• ##### width: number

The width, in model reference distance units

#### Returns GeoBuffer

The new geo buffer

### createOrientedBox

• Creates an axis-aligned OrientedBox with given location and dimensions.

since

2021.1

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which the oriented box is defined. Due to the cartesian nature of this shape, it is not available for geodetic references

• ##### location: Vector3

the location of the corner of the box with minimal x, y and z values

• ##### dimensions: Vector3

the size of the oriented box

#### Returns OrientedBox

• Creates an OrientedBox resulting from a base box with given location and dimensions, transformed by the given transformation.

``````const center = createPoint(getReference("CRS:84"), [4, 51, 0]);
const width = 10;
const depth = 12;
const height = 15;
const transformation = createTransformationFromGeoLocation(center);

const centeredBox = createOrientedBox(transformation, {x: -width / 2, y: -depth / 2, z: -height / 2}, {x: width, y: depth, z: height});``````
since

2021.1

#### Parameters

• ##### transformation: Affine3DTransformation

the transformation applied to the base box to get the resulting box

• ##### location: Vector3

the location of the corner of the base box with minimal x, y and z values

• ##### dimensions: Vector3

the size of the base box

### createPoint

• Creates a point with the specified coordinates

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which the point is defined

• ##### coordinates: number[]

the coordinate of the point, expressed as an array. (e.g. "[52,5]")

the point

### createPolygon

• Creates a polygon with the specified points (Point).

#### Parameters

• ##### reference: CoordinateReference

the reference in which the polygon is defined

• ##### Optional points: Point[]

an array of Point instances

#### Returns Polygon

The polygon with the specified points

• Creates a polygon with the specified point coordinates. The x, y, z elements of point coordinates must be expressed in the given `reference`.

since

2021.0

#### Parameters

• ##### reference: CoordinateReference

the reference in which the polygon and point coordinates are defined

• ##### Optional pointCoordinates: PointCoordinates[]

an array of PointCoordinates

#### Returns Polygon

The polygon with the specified point coordinates

``````const reference = getReference("EPSG:4979");
const polygon = createPolygon(reference, [[1,1,0],[3,1,0],[3,1,1000],[1,1,1000]);``````

### createPolyline

• Creates a polyline with the specified points (Point).

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which the polyline is defined

• ##### Optional points: Point[]

an array of Point instances

#### Returns Polyline

The polyline with the specified points

• Creates a polyline with the specified point coordinates. The x, y, z elements of point coordinates must be expressed in the given `reference`.

since

2021.0

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which the polyline and point coordinates are defined

• ##### Optional pointCoordinates: PointCoordinates[]

an array of PointCoordinates

#### Returns Polyline

The polyline with the specified point coordinates

``````const reference = getReference("CRS:84");
const polyline = createPolyline(reference, [[0,1],[10,1],[5,5]);``````

### createSector

• Creates a circular sector defined by a center point, a radius, a start angle and a sweep angle.

see

Sector

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which the shape is defined.

• ##### center: Point

the center point.

the radius of the circle defining the sector, in meters.

• ##### startAzimuth: number

the start azimuth, in degrees, positive clockwise from 12 o'clock (north).

• ##### sweepAngle: number

the angle over which the sector extends, in degrees, positive clockwise.

the sector

### createShape

• Creates a shape of the given type and reference. The coordinate type of the returned shape will match that of the specified reference.

#### Parameters

• ##### shapeType: ShapeType

The shape type of the returned shape

• ##### reference: CoordinateReference

The reference of the returned shape

### createShapeList

• Creates a shape list containing the specified shapes

#### Parameters

• ##### reference: CoordinateReference | null

the reference in which all the shapes are defined

• ##### Optional shapes: Shape[]

Array of shapes. All shapes must have the same reference, which should be equal to the first parameter (`reference`)

#### Returns ShapeList

Shape list containing the specified shapes

## Legend

• Module
• Object literal
• Variable
• Function
• Function with type parameter
• Index signature
• Type alias
• Type alias with type parameter
• Enumeration
• Enumeration member
• Property
• Method
• Interface
• Interface with type parameter
• Constructor
• Property
• Method
• Index signature
• Class
• Class with type parameter
• Constructor
• Property
• Method
• Accessor
• Index signature
• Inherited constructor
• Inherited property
• Inherited method
• Inherited accessor
• Protected property
• Protected method
• Protected accessor
• Private property
• Private method
• Private accessor
• Static property
• Static method