mapteksdk.data.primitives.edge_properties module

Module containing the EdgeProperties Mixin class which provides support for Edge primitives.

class mapteksdk.data.primitives.edge_properties.EdgeProperties

Bases: object

A mixin class used to provide support for Edge Primitives. An edge is a line between two points.

The edge [i, j] indicates the line is between points Object.points[i] and Object.points[j].

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.

save()

Saves the edge primitives within inheriting object. This should be called during save() of the inheriting object. This should never be called directly.

Returns

True if successful.

Return type

bool

Raises

Exception – If in read-only mode.

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

PrimitiveAttributes

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.