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: TypeAlias

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.

PointLike

A value which can be converted to a single point.

alias of Union[float64), Sequence[float]]

PointArray: TypeAlias

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.

PointArrayLike

Represents a value which could be converted to an array of points.

alias of Union[float64), Sequence[Sequence[float]]]

Edge: TypeAlias

A single edge.

This indicates a numpy array of shape (2,) where the first item is the index of the start point of the edge and the second is the index of the end point of the loop.

EdgeLike

Indicates a value which can be converted into a single edge.

alias of Union[uint32), Sequence[int]]

EdgeArray: TypeAlias

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.

EdgeArrayLike

Represents a value which can be converted to an edge array.

alias of Union[uint32), Sequence[Sequence[int]]]

FacetArray: TypeAlias

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.

FacetArrayLike

Represents a value which can be converted to a facet array.

alias of Union[uint32), Sequence[Sequence[int]]]

CellArray: TypeAlias

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: TypeAlias

An array of indices into another array.

BlockSize: TypeAlias

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: TypeAlias

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: TypeAlias

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.

ColourLike

Values which can be converted to a colour.

alias of Union[uint8), Sequence[int]]

ColourArray: TypeAlias

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.

ColourArrayLike

Values which can be converted to a colour array.

alias of Union[uint8), Sequence[int], Sequence[Sequence[int]]]

BooleanArray: TypeAlias

An array of booleans.

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

BooleanArrayLike

A value which can be converted to a boolean array.

A single bool will be broadcast to fill the entire array with the same value.

alias of Union[bool, Sequence[bool], bool_)]

FloatArray: TypeAlias

An array of floats.

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

FloatArrayLike

Values which can be converted to a float array.

alias of Union[float64), Sequence[float]]

StringArray: TypeAlias

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.

StringArrayLike

A value which can be converted into a StringArray.

alias of Union[str_), Sequence[str]]

Vector3D: TypeAlias

A 3D vector.

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

Vector3DArray: TypeAlias

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.

MutableIndexSequence

A sequence of indices into an array.

This is similar to an IndexArray, except that it is mutable similar to a list. This allows for the index to be updated more easily.

alias of MutableSequence[int]