maptek.vulcan_gui.gfx module

This module provides an interface to the Vulcan GUI GFX functionality.

Functionality includes:
  • Window listing/setting

  • View control

  • View feature control

window_info()

Returns a dictionary with the list of open graphics windows, the current window, and a list of window definitions (may or may not be inactive).

Parameters:

None

Returns:

Returns a dict describing the windows and window definitions (See example).

Return type:

dict

Example

>>> window_info = vulcan_gui.gfx.window_info()
>>> print (window_info)
{'current': 'TEST.DG1(*)',
'window_definitions': [{'description': 'Default start up window',
                       'name': 'TEST.DG1'},
                      {'description': 'Fitted window for AA:*',
                       'name': 'PLOT_PREVIEW'},
                      {'description': 'Window used for setting the plot '
                                      'data.',
                       'name': 'DATA_VIEW_1'}],
'windows': [{'name': 'TEST.DG1(*)'}, {'name': 'Overview'}]}
load_window_from_definition(window_def) bool

Loads a window definition to the active window.

Parameters:

window_def (str) –

set_current_window(window) bool

Sets the current window.

Parameters:

window (str) –

zoom_to_selection(select) bool

Zooms to a selection interactively with the user. The selection is defined as a vulcan_gui.selection, then passed as an input, running it interactively.

Parameters:

select (selection const &) –

Example

>>> sel = vulcan_gui.selection('Select polygons to zoom to')
>>> sel.criteria = ['POLYGON']
>>> vulcan_gui.gfx.zoom_to_selection(sel)
True
zoom_to_object_list(objects)

Zooms to a list of objects from Vulcan.

Important

All objects must come from a previously run selection.

Parameters:

objects (list(obj)) – List of objects to fit the window to.

Example

>>> sel = vulcan_gui.selection('Pick data to fit to')
>>> fit_list = []
>>> for obj in sel:
>>>     if isinstance(obj, vulcan.polyline) and obj.closed:
>>>         fit_list.append(obj)
>>> if len(fit_list) > 0:
>>>     gfx.zoom_to_object_list(fit_list)
True
view_reset_and_fit_to_world(window='') bool

Resets to plan view and fits the window to the loaded data.

Parameters:

window (str, optional) – Window to perform the action in. will default to the current window.

view_reset(window='') bool

Resets to plan view.

Parameters:

window (str, optional) – Window to perform the action in. will default to the current window.

view_fit_to_world(window='') bool

Zooms to fit the loaded data on screen without rotation.

Parameters:

window (str, optional) – Window to perform the action in. will default to the current window.

view_rotate_relative(*args, **kwargs)

Rotates the view about the x/y/z axes from the current rotation.

Parameters:
  • rx (double) – Rotation angle of the view about the x-axis (degrees).

  • ry (double) – Rotation angle of the view about the y-axis (degrees).

  • rz (double) – Rotation angle of the view about the z-axis (degrees).

  • window (str, optional) – Window to perform the action in. will default to the current window.

view_pan(*args, **kwargs)

Pans/moves the view a number of pixels in the x/y direction.

Parameters:
  • dx (double) – Distance to pan in the x direction. -X moves the screen left, +X move the screen right.

  • dy (double) – Distance to pan in the y direction. -Y moves the screen down, +Y move the screen up.

  • window (str, optional) – Window to perform the action in. will default to the current window.

view_screen_dump(*args, **kwargs)

Performs a screen dump as seen in the Effects toolbar, capturing the on screen data and saving it to a png file.

Parameters:
  • filename (str) – The filename to save the screen dump to. Extension must be ‘.png’ If no filename is provided, it will automatically be named ‘dumpXXXX.png’

  • overwrite (bool, default = False) – Flag to overwrite a file if it already exists. See Raises for error cases.

Returns:

Returns the filename of the saved screen dump.

Return type:

str

Raises:
  • RuntimeError: – When an error occurs in the GUI. Generally file overwrite issues such as already exists, cannot remove, or when a filename is too long. The exception text will specify the failure mode.

  • Exception: – When Vulcan doesn’t communicate a specific error.

enum clip_mode(value)

Bases: IntEnum

Section clipping modes for section_settings.clip property.

Member Type:

int

Valid values are as follows:

BY_WIDTH = <clip_mode.BY_WIDTH: 0>
FORWARDS = <clip_mode.FORWARDS: 1>
BACKWARDS = <clip_mode.BACKWARDS: 2>
NO_CLIPPING = <clip_mode.NO_CLIPPING: 3>
enum intersection_draw(value)

Bases: IntEnum

Section intersection drawing modes for section_settings.draw property.

Member Type:

int

Valid values are as follows:

NONE = <intersection_draw.NONE: 0>
HIGHLIGHT = <intersection_draw.HIGHLIGHT: 1>
PATTERN = <intersection_draw.PATTERN: 2>
class section_settings

Bases: object

Settings for section display.

property front_width

The section thickness in ‘front’ of the section plane.

property back_width

The section thickness in ‘back’ of the section plane.

property step

The step distance between sections.

property clip

The clipping mode for the section (type = gfx.clip_mode). Raises ValueError if invalid value.

property reverse_view

Flag to reverse the viewing direction of the section.

property draw

Setting for the intersection draw mode (type = gfx.intersection_draw)

__init__(self) section_settings

Settings for section display.

section_by_strike_dip(*args, **kwargs)

Creates a section view about a center point and a strike and dip.

Parameters:
  • view_center (point) – Point that the section view will be centered around.

  • strike (double) – Section plane strike angle (degrees).

  • dip (double) – Section plane dip angle (degrees).

  • settings (section_settings) – Settings for the section display and width parameters.

  • window (str, optional) – Window to create section view in. Default is the current window.

section_by_plane_equation(*args, **kwargs)

Creates a section view about a center point and a plane equation defined as ax + by + cz = d where the a, b, c factors are the unit vector normal for the plane.

Parameters:
  • view_center (point) – Point that the section view will be centered around.

  • a (double) – Plane equation ‘a’ component.

  • b (double) – Plane equation ‘b’ component.

  • c (double) – Plane equation ‘c’ component.

  • d (double) – Plane equation ‘d’ component.

  • settings (section_settings) – Settings for the section display and width parameters.

  • window (str, optional) – Window to create section view in. Default is the current window.

section_by_three_points(*args, **kwargs)

Creates a section view from a plane defined by three points.

Parameters:
  • a (point) –

  • b (point) –

  • c (point) –

  • settings (section_settings) – Settings for the section display and width parameters.

  • window (str, optional) – Window to create section view in. Default is the current window.

step_section_plane(steps) bool

Moves the current section plane by a number of steps (+=forward, -=backwards).

Parameters:

steps (int) –

move_section_plane(distance) bool

Moves the current section plane by a distance (+=forward, -=backwards).

Parameters:

distance (double) –

enum cursor_snap_mode(value)

Bases: IntEnum

Options for the cursor snap modes.

Member Type:

int

Valid values are as follows:

INDICATE = <cursor_snap_mode.INDICATE: 0>
OBJECT = <cursor_snap_mode.OBJECT: 1>
POINT = <cursor_snap_mode.POINT: 2>
SMART = <cursor_snap_mode.SMART: 3>
GRID = <cursor_snap_mode.GRID: 4>
ELEVATION = <cursor_snap_mode.ELEVATION: 5>
DRAW = <cursor_snap_mode.DRAW: 6>
set_cursor_snap_mode(mode, window='') bool

Sets the cursor snap mode for a window (=current).

Parameters:
class grid_effects

Bases: object

Struct for the state of grid effects for a window.

__init__(self) grid_effects

Struct for the state of grid effects for a window.

property visible

Grid visibility in the GUI (on/off)

Type:

bool

property show

Grid visibility state for X/Y/Z axes

Type:

list[3] (int)

property origin

The grid origin coordinate Z/Y/Z

Type:

list[3] (double)

property step

The grid step distance in Z/Y/Z axes

Type:

list[3] (double)

property annotate

Grid annotation state for X/Y/Z axes

Type:

list[3] (int)

property brightness

The grid brightness display as a fraction (0-1).

Type:

double

property colour

The grid colour in an R/G/B array.

Type:

list[3] (int)

property snap_mode

Set the snap mode for the grid. Allows snapping to visble grid lines or to actual grid intervals. Invalid values will raise a ValueError exception.

Options:
  • ‘visible’

  • ‘actual’

Type:

str

property type

The type of grid plane.

Options:
  • ‘XY Plane’

  • ‘XZ Plane’

  • ‘YZ Plane’

  • ‘Screen Plane’

  • ‘Pimary Plane’

  • ‘3D’

  • ‘Undefined’ (Not set)

Type:

str

property label_frequency

Set the label frequency on the grid. Option ‘all’ will label every line, or ‘major’ will label only major grid intervals. Invalid values will raise a ValueError exception.

Options:
  • ‘all’

  • ‘major’

Type:

str

property label_plane

Set the label drawing plane for the grid. Option ‘grid’ will align labels with the grid plane, and ‘screen’ will align the labels with the screen plane or viewport. Invalid values will raise a ValueError exception.

Options:
  • ‘screen’

  • ‘grid’

Type:

str

property font_size

The font size of the grid labels, provided as an integer from 0-4.

Options:
  • 0 - Small

  • 1 - Medium

  • 2 - Large

  • 3 - Extra Large

Type:

int

get_grid_effects(window='') grid_effects

Gets the grid effect states for the specified window or the current window (if window==””)

Parameters:

window (str) –

set_grid_effects(effects, window='') bool

Sets the grid effect states for the specified window or the current window (if window==””)

Note

Use get_grid_effects, then alter the effects as desired.

Parameters:
  • effects (grid_effects const &) –

  • window (str) –

class viewport_effects

Bases: object

Struct for the state of viewport effects for a window.

property show_annotations

Enables annotations for the viewport.

Type:

bool

property refresh_timer

Enables the on screen refresh timer. (FPS, etc)

Type:

bool

property direction_dials

Enables the on screen direction dials (Bearing/dip).

Type:

bool

property draw_object_extents

Enables drawing the extents boxes for objects.

Type:

bool

property anti_alias

Enables anti-aliasing for the viewport.

Type:

bool

property mark_end_on_lines

Enables drawing marks on the ends of lines.

Type:

bool

property daylight_enable

Enables the daylight simulation for the viewport.

Type:

bool

__init__(self) viewport_effects

Struct for the state of viewport effects for a window.

get_viewport_effects(window='') viewport_effects

Gets the viewport effect states for the specified window or the current window (if window==””)

Parameters:

window (str) –

set_viewport_effects(effects, window='') bool

Sets the viewport effect states for the specified window or the current window (if window==””) Use get_viewport_effects and alter the desired effects.

Parameters:
  • effects (viewport_effects const &) –

  • window (str) –