mapteksdk.view module¶
Module for interacting with a view in an applicable Maptek application.
The first step is opening a new view which returns a view controller for the new view. From there you can control the view by adding/removing objects, hiding/showing objects and querying what objects are in the view.
>>> from mapteksdk.project import Project
>>> import mapteksdk.pointstudio.operations as studio_operations
>>> project = Project()
>>> view = studio_operations.open_new_view()
>>> view.add_objects([project.find_object('/cad')])
- exception mapteksdk.view.ViewNoLongerExists¶
Bases:
RuntimeError
Exception for when a view is expected but it no longer exists.
The most common occurency for this exception is when the view has been closed.
- class mapteksdk.view.ObjectFilter¶
Bases:
object
Describes different ways to filter what objects are returned by a ViewController.
- DEFAULT = 0¶
Default - return all object except transient and background objects but ignoring visibility, and selection
Transient objects are objects that are in the view for previewing an operation or providing additional clarity while a tool in the application is running.
- VISIBLE_ONLY = 1¶
Only return objects that are visible in the view.
- HIDDEN_ONLY = 2¶
Only return objects that are hidden in the view.
- SELECTED_ONLY = 4¶
Only return objects that are selected and are in the view.
- class mapteksdk.view.ViewController(view_id: mapteksdk.data.objectid.ObjectID)¶
Bases:
object
Provides access onto a specified view.
This allows for objects to be added/removed/shown and hidden.
- property window_title¶
Return the window title (the name of the view) as seen in the application.
- objects_in_view(object_filter=0)¶
Return a list of objects that are in the the view.
- Parameters
object_filter (ObjectFilter) – A filter that limits what objects are returned.
- Returns
A list of object IDs of objects that are in the view that meet the filter criteria.
- Return type
list
- add_objects(objects)¶
Adds the provided objects to the view.
- Parameters
objects (list) – A list of IDs of objects to add to the view.
- remove_objects(objects)¶
Removes the provided objects from the view if present.
Removing objects not in the view will do nothing.
- Parameters
objects (list) – A list of IDs of objects to remove from the view.
- hide_objects(objects)¶
Hide the provided objects in the view.
Hiding objects not in the view will do nothing.
- Parameters
objects (list) – A list of IDs of objects to hide.
- show_objects(objects)¶
Show the provided objects in the view (if hidden).
If the objects are not in the view then they won’t be shown.
- Parameters
objects (list) – A list of IDs of objects to hide.
- property background_colour¶
The background colour of the view window as a tuple containing red, green, blue, alpha values of the colour. Each value is an integer in the range [0, 255].
When changing the background colour, the alpha is optional and the colour may be given as either a tuple, list or ndarray.
- Type
tuple