mapteksdk.data.primitives.facet_properties module

Module containing the FacetProperties Mixin class which provides support for Facet primitives.

class mapteksdk.data.primitives.facet_properties.FacetProperties

Bases: object

A mixin class used by spatial objects to provide support for Facet Primitives.

A facet is a triangle drawn between three points. For example, the facet [i, j, k] is the triangle drawn between object.points[i], object.points[j] and object.points[k].

property facets

A 2D numpy array of facets in the object. This is of the form: [[i0, j0, k0], [i1, j1, k1], …, [iN, jN, kN]] where N is the number of facets. Each i, j and k value is the index of the point in Objects.points for the point used to define the facet.

property facet_colours

A 2D numpy array containing the colours of the facets. When setting the colour you may use a list of RGB or greyscale colours.

When facet colours are set, if there are more colours than facets then the excess colours are silently ignored. If there are fewer colours than facets the uncoloured facets are coloured green. If only a single colour is specified, instead of padding with green all of the facets are coloured with that colour. ie: object.facet_colours = [[Red, Green, Blue]] will set all facets to be the colour [Red, Green, Blue].

property facet_selection

A 1D numpy array representing which facets are selected.

If object.facet_selection[i] = True then the ith facet is selected.

property facet_count

The number of facets in the object.

remove_facets(facet_indices, update_immediately=True)

Remove one or more facets. This is done directly in the project and thus changes made by this function will be saved even if save() is not called.

Parameters
  • facet_indices (array or int) – 1D array of uint32 indices of edges to remove or a single uint32 of index of facet to remove.

  • update_immediately (bool) – Applies changes to project and re-loads numpy arrays and properties immediately. May be disabled for large datasets.

Returns

True if successful.

Return type

bool

Notes

Immediately reconciling changes on arrays is recommended.

save()

Saves facet primitives within inheriting object. This should be called during the save of an inheriting object. This function should not be called directly.

Returns

True if successful.

Return type

bool

Raises

Exception – If in read-only mode.

property facet_attributes

Access the custom facet attributes. These are arrays of values of the same type with one value for each facet.

Use Object.facet_attributes[attribute_name] to access a facet attribute called attribute_name. See PrimitiveAttributes for valid operations on facet attributes.

Returns

Access to the facet attributes.

Return type

PrimitiveAttributes

Raises

ValueError – If the type of the attribute is not supported.

save_facet_attribute(attribute_name, data)

Create new and/or edit the values of the facet attribute attribute_name.

This is equivalent to Object.facet_attributes[attribute_name] = data.

Parameters
  • attribute_name (str) – The name of attribute.

  • data (array) – A numpy array of a base type data to store for the attribute per-primitive.

delete_facet_attribute(attribute_name)

Delete a facet attribute by name.

This is equivalent to: facet_attributes.delete_attribute(attribute_name)

Parameters

attribute_name (str) – The name of attribute.

Raises

Exception – If the object is opened in read-only mode.