Shape

Description

abstract class Tinman.Terrain.Shapes.Shape

Derived from

ShapeBase abstract

Extended by

ShapeGeometry abstract

Abstract base class for IShape implementations.

The following default method implementations provide standard functionality and may be overridden by subclasses in order to provide custom / optimized behaviour:

Public / Constructors

Arc​Inner


[Pure]
public static method ArcInner → (6)

center in : Vec2D

The center of the oval from which to create the arc.

in : Vec2D

Vector pointing from center in to start of arc.

in : Vec2D

Vector pointing from center in to end of arc.

in : int32

[>=1]
The number of segments between in and in.

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The shape.

Creates an arc shape that runs from in to in over the inner path (i.e. the shorter one).

Arc​Outer


[Pure]
public static method ArcOuter → (6)

center in : Vec2D

The center of the oval from which to create the arc.

in : Vec2D

Vector pointing from center in to start of arc.

in : Vec2D

Vector pointing from center in to end of arc.

in : int32

[>=1]
The number of segments between in and in.

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The shape.

Creates an arc shape that runs from in to in over the outer path (i.e. the longer one).

Arrow


[Pure]
public static method Arrow → (8)

from in : Vec2D

Base point of arrow.

to in : Vec2D

Tip point of arrow.

width opt : float64 = 0.7

Scale factor from length to width.

widthShaft opt : float64 = 0.25

Scale factor from width to widthShaft.

lengthShaft opt : float64 = 0.5

Scale factor length to lengthShaft.

lengthHead opt : float64 = 0.6

Scale factor length to lengthHead.

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The shape.

Creates an arrow shape.

The arrow shape vertices a are determined by the 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.

Box


[Pure]
public static method Box → (5)

bounds in : Box2D

The bounds of the box.

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

value opt : float64 = 0

The custom value to use for all box vertices.

type opt : ShapeValue = ShapeValue.None

The type of value opt.

returns → IShape

The shape.

Creates a new box shape.

Checker​Board


[Pure]
public static method CheckerBoard → (4)

size opt : float64 = 1

[>0]
Edge length of checkerboard tiles.

offset opt : Vec2D = default(Vec2D)

Tile corner offset.

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The shape.

Creates a new checkerboard shape.

Circle

2 overloads


[Pure]
public static method Circle1 → (5)

center in : Vec2D

The circle center.

radius in : float64

[>=0]
The circle radius.

in : int32

[>=1]
The number of segments per circle quadrant.

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

this

Creates a new circle shape by defining an approximating polygon.


[Pure]
public static method Circle2 → (4)

center in : Vec2D

Coordinates of center of circle.

radius opt : float64 = 0

[>=0]
Radius of circle. Set to 0 to create a point shape.

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The shape.

Creates a new circle shape by defining a signed distance field.

See also

ShapeType.Points

Curve


[Pure]
public static method Curve → (7)

curve in : ICurve

[not-null]
The curve to follow.

accuracy in : float64

[>=0]
The sub-division accuracy to achieve, given as the maximum allowed error in the shape coordinate system (treating control point position and tangent values as 2D vectors). Set to 0 to disable.

range in : RangeD

The control point index range of the shape. If RangeD.Inv, the curve range will be used (see ICurve.Range).

y1b opt : float64 = 0

Coefficient for Y-coordinate, in curve-space (see remarks).

y2b opt : float64 = 0

Coefficient for Y-coordinate, in curve-space (see remarks).

y1m opt : float64 = 0

Coefficient for Y-coordinate, in curve-space (see remarks).

y2m opt : float64 = 0

Coefficient for Y-coordinate, in curve-space (see remarks).

returns → IShape

The shape.

Creates a new shape that follows the given curve, using ShapeBuilder.Curve

This method is a helper that uses Geometry and calls ShapeBuilder.Build to build the shape, using an edge parity of 0 if any of the following holds true and -1 otherwise:

  • The given range in has zero length.

  • y1b opt is equal to y2b opt and both y1m opt and y2m opt are zero.

File

2 overloads


[Pure]
public static method File1 → (5)

file in : Path

[not-null]
The file path.

flags opt : ReadShapeFlags = ReadShapeFlags.Geo

The reader flags to use.

format opt : ShapeFormat = null

The file format or null if not known.

modifier opt : IShapeReaderModifier = null

The shape data modifier to use.

filter opt : IShapeReaderFilter = null

The shape data filter to use.

returns → IShape

The shape.

Reads the given shape file.


[Pure]
public static method File2 → (5)

file in : IFileData

[not-null]
The file data.

flags opt : ReadShapeFlags = ReadShapeFlags.Geo

The reader flags to use.

format opt : ShapeFormat = null

The file format or null if not known.

modifier opt : IShapeReaderModifier = null

The shape data modifier to use.

filter opt : IShapeReaderFilter = null

The shape data filter to use.

returns → IShape

The shape.

Reads the given shape file.

Geographic​Polygon

2 overloads


[Pure]
public static method GeographicPolygon1 → (3)

vertices in : LatLon [ ]

[not-null]
The polygon vertices, given as a non-closed polyline that represents a weakly simple polygon.

datum opt : GeodeticDatum = null

The geographic datum. If null, GeodeticDatum.WGS84 will be used.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The resulting shape.

Creates a polygon shape in a geographic coordinate system.

The winding the shape vertices is not relevant.


[Pure]
public static method GeographicPolygon2 → (3)

vertices in : IVectorConst<LatLon>

[not-null]
The polygon vertices, given as a non-closed polyline that represents a weakly simple polygon.

datum opt : GeodeticDatum = null

The geographic datum. If null, GeodeticDatum.WGS84 will be used.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The resulting shape.

Creates a polygon shape in a geographic coordinate system.

The winding the shape vertices is not relevant.

Geometry


public static method Geometry → (3)

vertices opt : int32 = 0

[>=0]
Initial vertex capacity.

edges opt : int32 = 0

[>=0]
Initial edge capacity.

triangles opt : int32 = 0

[>=0]
Initial triangle capacity.

returns → ShapeBuilder

The shape builder object.

Returns a ShapeBuilder object for creating geometry based shapes (i.e. vertices, edges and/or triangles).

Grid


[Pure]
public static method Grid → (8)

in : Vec2D

First grid corner point.

in : Vec2D

Second grid corner point.

in : Vec2D

Third grid corner point.

in : Vec2D

Fourth grid corner point.

in : int32

[>=1]
Number of segment lines between in and in (inclusive).

in : int32

[>=1]
Number of segment lines between in and in (inclusive).

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The shape.

Creates a grid shape.

The grid is specified by the four given control points:

(a)----- + ----- + ----- + -----(b)
 |       |       |       |       |
 + ----- + ----- + ----- + ----- +
 |       |       |       |       |
 + ----- + ----- + ----- + ----- +
 |       |       |       |       |
(d)----- + ----- + ----- + -----(c)
See also

ShapeType.Graph

Group


public static method Group → (3)

georef opt : CoordinateSystem = null

The geo-reference of the shape group or null for CoordinateSystem.Local.

metadata opt : IJsonValue = null

The metadata of the shape group or null for JsonValue.Null.

accuracy opt : float64 = 0

[>=0]
Optional accuracy to use for subdivision of edges. Given as a maximum error in the target coordinate system (see georef opt). Set to 0 to disable edge subdivision.

returns → IShape

The shape group.

Creates an empty shape group (see ShapeType.Group).

Oval


[Pure]
public static method Oval → (6)

center in : Vec2D

The center of the oval.

in : Vec2D

First vector pointing from center in to oval edge.

in : Vec2D

Second vector pointing from center in to oval edge.

in : int32

[>=1]
The number of segments between in and in.

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The shape.

Creates an oval shape.

Polygon

2 overloads


[Pure]
public static method Polygon1 → (3)

vertices in : Vec2D [ ]

[not-null]
The polygon vertices, given as a non-closed polyline that represents a weakly simple polygon.

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The shape.

Creates a polygon shape.

The winding the shape vertices is not relevant.


[Pure]
public static method Polygon2 → (3)

vertices in : IVectorConst<Vec2D>

[not-null]
The polygon vertices, given as a non-closed polyline that represents a weakly simple polygon.

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The shape.

Creates a polygon shape.

The winding the shape vertices is not relevant.

Polyline

2 overloads


[Pure]
public static method Polyline1 → (4)

vertices in : Vec2D [ ]

[not-null]
The polyline vertices.

closed in : bool

Attach last vertex to first one?

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The shape.

Creates a polyline shape.

See also

ShapeType.Graph


[Pure]
public static method Polyline2 → (4)

vertices in : IVectorConst<Vec2D>

[not-null]
The polyline vertices.

closed in : bool

Attach last vertex to first one?

georef opt : CoordinateSystem = null

The geo-reference or null.

metadata opt : IJsonValue = null

The metadata or null.

returns → IShape

The shape.

Creates a polyline shape.

See also

ShapeType.Graph

Read​CSH

2 overloads


public static method ReadCSH1 → (1)

path in : Path

[not-null]
The file path.

returns → IShape

The resulting shape.

Reads a shape from a CSH file.

IOException

If an I/O error has occurred.


public static method ReadCSH2 → (1)

stream in : IDataStream own

[not-null]
The input data stream.

returns → IShape

The resulting shape.

Reads a shape from a CSH file.

IOException

If an I/O error has occurred.

Public / Methods

Rasterizer​Factory

5 overloads


public static method RasterizerFactory1 → (2)

sample in : HeightmapSample

The uniform heightmap sample data to use.

falloff in : float64

[>=0]
Distance falloff value (see remarks).

returns → IShapeRasterizerFactory<HeightmapRegion>

The shape rasterizer.

Returns a IShapeRasterizerFactory object that rasterizes distance values into the given sample buffer.

Distance values are converted into heightmap samples by computing weighted vertex sums. Distance values of zero or less will produce heightmap samples that have full coverage; values greater than or equal to falloff in will produce void heightmap samples (i.e. zero coverage). Values in-between create have a smooth transition.


public static method RasterizerFactory2 → (2)

samples in : HeightmapSamples

[not-null]
Heightmap sample data for each vertex of the input shape (see IShape.VertexAt).

falloff in : float64

[>=0]
Distance falloff value (see remarks).

returns → IShapeRasterizerFactory<HeightmapRegion>

The shape rasterizer.

Returns a IShapeRasterizerFactory object that rasterizes distance values into the given sample buffer.

Distance values are converted into heightmap samples by computing weighted vertex sums. Distance values of zero or less will produce heightmap samples that have full coverage; values greater than or equal to falloff in will produce void heightmap samples (i.e. zero coverage). Values in-between create have a smooth transition.

Per-vertex heightmap sample values can only be used for explicit shapes that have an edge parity of zero. See IShape for details.


public static method RasterizerFactory3 → ()

returns → IShapeRasterizerFactory<DistanceBuffer>

The shape rasterizer.

Returns a IShapeRasterizerFactory object that rasterizes distance values into a sample buffer.

The distance value range (see ISampleBuffer.ScanlineRange) of the target sample buffer is used to optimize the rasterization process.

See also

DistanceBuffer


public static method RasterizerFactory4 → (1)

colorRamp in : IColorRamp

[not-null]
The color ramp to use.

returns → IShapeRasterizerFactory<ColorBuffer>

The shape rasterizer.

Returns a IShapeRasterizerFactory object that rasterizes distance values into the given sample buffer.

Distance values are converted into color values by performing a color ramp lookup.


public static method RasterizerFactory5 → (2)

colorRamp in : IColorRamp

[not-null]
The color ramp to use.

lineStipple in : LineStipple

The line stipple pattern to use.

returns → IShapeRasterizerFactory<ColorBuffer>

The shape rasterizer.

Returns a IShapeRasterizerFactory object that rasterizes distance values into the given sample buffer.

Distance values are converted into color values by performing a color ramp lookup.

Protected / Constructors

Shape


protected constructor Shape → (3)

serialId in : ISerialTypeInfo

[not-null]
The serial type ID.

georef opt : CoordinateSystem = null

Geo-reference object or null.

metadata opt : IJsonValue = null

Metadata object or null.

Creates a new instance of Shape.

Configuration

Config


public static attribute Config → (get)

value : IConfigurator<IShape>

[not-null]
The configurator object.

The configurator object for this type.