mapteksdk.common.typing module

Classes used for type hints.

The classes defined in this module are only intended to be used for type checking. Imports from this module should always be inside a type checking block:

>>> import typing
>>> if typing.TYPE_CHECKING:
...     from mapteksdk.data.type_checking import Point

This prevents this module from being imported at runtime, which can cause the script to crash if the installed numpy does not support typing.

Warning

Importing this module requires numpy 1.21.0 or newer.

Point

A single point.

This type hint indicates a numpy array of shape (3,) of 64 bit floats representing a point in the form [X, Y, Z].

Notes

X corresponds to East, Y corresponds to North and Z corresponds to up.

PointArray

An array of points.

This type hint indicates a numpy array of shape (N, 3) (where N is the point count) of 64 bit floats.

  • The 0th column contains the X coordinates of each point.

  • The 1st column contains the Y coordinates of each point.

  • The 2nd column contains the Z coordinates of each point.

Notes

X corresponds to East, Y corresponds to North and Z corresponds to up.

EdgeArray

An array of edges.

This type hint indicates a numpy array of shape (N, 2) (where N is the edge count) of 32 bit integers. Each row is of the form [start, end], representing the edge between the point with an index of start and the point with an index of end.

FacetArray

An array of facets.

This type hint indicates a numpy array of shape (N, 3) (where N is the facet count) of 32 bit integers. Each row is of the form [A, B, C], representing the triangle between the point with an index of A, the point with an index of B and the point with an index of C.

CellArray

An array of cells.

This type hint indicates a numpy array of shape (N, 4) (where N is the cell count) of 32 bit integers. Each row is of the form [A, B, C, D], representing the quadrilateral between the point with an index of A, the point with an index of B, the point with an index of C and the point with an index of D.

IndexArray

An array of indices into another array.

BlockSize

The size of a single block.

This type hint indicates a numpy array of shape (3,) of 64 bit floats. This is of the form [column_size, row_size, slice_size] where column_size is the size of the block in the column direction, row_size is the size of the block in the row direction and slice_size is the size of the block in the slice direction.

BlockSizeArray

An array of block sizes.

This type hint indicates a numpy array of shape (N, 3) (where N is the block count) of 64 bit floats. Each row is of the form [column_size, row_size, slice_size] where column_size is the size of the block in the column direction, row_size is the size of the block in the row direction and slice_size is the size of the block in the slice direction.

Colour

A single colour.

This is an array of shape (4,) of unsigned 8 bit integers. This is of the form [red, green, blue, alpha].

  • red = 0 indicates no red, red = 255 indicates maximum red.

  • green = 0 indicates no green, green = 255 indicates maximum green.

  • blue = 0 indicates no blue, blue = 255 indicates maximum blue.

  • alpha = 0 indicates fully transparent, alpha = 255 indicates fully opaque.

ColourArray

An array of colours.

This indicates an array of shape (N, 4) where N is the colour count. Each row is of the form [red, green, blue, alpha] as described in colour above.

BooleanArray

An array of booleans.

This indicates an array of booleans shape (N,) where N is the count.

FloatArray

An array of floats.

This indicates an array of floats of shape (N,) where N is the count.

StringArray

An array of UTF-32 strings of fixed length.

This indicates an array of shape (N,) where N is the number of strings. The maximum string length which can be stored in such an array is:

>>> string_array: StringArray
>>> max_string_length = string_array.dtype.itemsize // 4

Attempting to store a longer string inside such an array will result in the string being truncated to the max string length.

Vector3D

A 3D vector.

This is a numpy array of shape (3,) of the form [X, Y, Z].

Vector3DArray

An array of 3D vectors.

This is a numpy array of shape (N, 3) where each row is a Vector3D. N is the count of the vectors in the array.