mapteksdk.data.primitives.edge_properties module
Support for edge primitives.
An edge is a line between two points. In Python, an edge is represented as a numpy array containing two integers representing the indices of the points the edge connects. For example, the edge [0, 1] indicates the line between the 0th and 1st point. Because edges are defined based on points, all objects which inherit from EdgeProperties must also inherit from PointProperties.
- class EdgeProperties
Bases:
object
Mixin class which provides spatial objects support for edge primitives.
The edge [i, j] indicates the line is between the points Object.points[i] and Object.points[j].
Functions and properties defined on this class are available on all classes which support edges.
Notes
Currently all objects which inherit from EdgeProperties also inherit from PointProperties to allow using the points from point properties to define the edges.
- property edges
A 2D Numpy array of edges of the form: [[i0, j0], [i1, j1], …, [iN, jN]] where N is the number of edges and all iK and jK are valid indices in Object.points.
Warning
For Surfaces the edges are derived from the points and facets. If any changes are made to the points or facets, the corresponding changes to the edges will not be made until save() has been called.
Notes
Invalid edges are removed during save().
- property edge_colours
The colours of the edges, represented as a numpy array of RGBA colours, with one colour for each edge. When setting the colour you may use RGB or greyscale colours instead.
If there are more edge colours than edges, the excess colours are silently ignored. If there are fewer colours than edges, the uncoloured edges are coloured green. If only a single colour is passed, instead of padding with green all of the edges are coloured with that colour. ie: object.edge_colours = [[Red, Green, Blue]] will set all edge colours to be the colour [Red, Green, Blue].
- property edge_selection
A 1D ndarray representing which edges are selected.
edge_selection[i] = True indicates edge i is selected.
- property edge_count
The count of edges in the object.
- property edge_attributes
Access to custom edge attributes. These are arrays of values of the same type with one value for each edge.
Use Object.edge_attributes[attribute_name] to access the edge attribute called attribute_name. See PrimitiveAttributes for valid operations on edge attributes.
- Returns
Access to the edge attributes.
- Return type
- Raises
ValueError – If the type of the attribute is not supported.
Warning
For Surfaces if you have changed the points or facets in the object, you must call save() before accessing the edge attributes.
- save_edge_attribute(attribute_name, data)
Create and/or edit the values of the edge attribute attribute_name.
This is equivalent to Object.edge_attributes[attribute_name] = data
- Parameters
attribute_name (str) – The name of attribute.
data (array_like) – An array_like of a base type data to store for the attribute per-primitive.
- Raises
Exception – If the object is opened in read-only mode.
ValueError – If the type of the attribute is not supported.
- delete_edge_attribute(attribute_name)
Delete a edge attribute by name.
- Parameters
attribute_name (str) – The name of attribute
- Raises
Exception – If the object is opened in read-only mode.