GXEMAPTEMPLATE class

class GXEMAPTEMPLATE(handle=0)

GXEMAPTEMPLATE class.

The GXEMAPTEMPLATE class provides access to a map template as displayed within Oasis montaj, but does not change data within the template itself. It performs functions such as setting the currently displayed area, or drawing “tracking” lines or boxes on the template (which are not part of the template itself).

Note:

To obtain access to the map template itself, it is recommended practice to begin with an GXEMAPTEMPLATE object, and use the Lock function to lock the underlying template to prevent external changes. The returned GXMAPTEMPLATE object may then be safely used to make changes to the template itself.

VIRTUAL GXEMAPTEMPLATE SUPPORT

These methods are only available when running in an external application. They allow the GX to open a map template and then create a Virtual GXEMAPTEMPLATE from that map template. The GX can then call MakeCurrent and set the current GXEMAPTEMPLATE so that code that follows sees this map template as the current GXMAPTEMPLATE.

Supported methods on Virtual EMAPTEMPLATEs are:

classmethod create_virtual(name)

Makes this GXEMAPTEMPLATE object the current active object to the user.

Parameters:name (str) – Name of map to create a virtual EMAMTEMPLATE from
Returns:GXEMAPTEMPLATE Object
Return type:GXEMAPTEMPLATE

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod current()

This method returns the Current Edited map template.

Returns:GXEMAPTEMPLATE Object
Return type:GXEMAPTEMPLATE

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod current_if_exists()

This method returns the Current Edited map.

Returns:GXEMAPTEMPLATE Object to current edited map. If there is no current map, the user is not prompted for a map, and 0 is returned.
Return type:GXEMAPTEMPLATE

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod current_no_activate()

This method returns the Current Edited map template.

Returns:GXEMAPTEMPLATE Object
Return type:GXEMAPTEMPLATE

New in version 9.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: This function acts just like current except that the document is not activated (brought to foreground) and no guarantee is given about which document is currently active.

drag_drop_enabled()

Checks if drag-and-drop is enabled for the map

Return type:bool

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

get_box(state, min_x, min_y, max_x, max_y)

Returns the coordinates of a user selected box.

Parameters:
  • state (str) – user prompt string
  • min_x (float_ref) – X minimum in current view user units.
  • min_y (float_ref) – Y minimum in current view user units.
  • max_x (float_ref) – X maximum in current view user units.
  • max_y (float_ref) – Y maximum in current view user units.
Returns:

0 if point returned. 1 if user cancelled.

Return type:

int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The coordinates are returned in the current template units (See GetUnits and SetUnits in GXMAPTEMPLATE)

get_display_area(min_x, min_y, max_x, max_y)

Get the area you are currently looking at.

Parameters:

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The coordinates are based on the current template units (See GetUnits and SetUnits in GXMAPTEMPLATE)

get_item_selection(item)

Gets info about the current selected item

Parameters:item (str_ref) – returned item name
Returns:Returns True if the item is a view
Return type:bool

New in version 5.0.

License: Geosoft End-User License

Limitations: May not be available while executing a command line program.

Note: If nothing is selected the string will be empty and the function will return False

get_line(str_val, min_x, min_y, max_x, max_y)

Returns the end points of a line.

Parameters:
Returns:

0 if line returned. 1 if user cancelled.

Return type:

int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The coordinates are returned in the current template units (See GetUnits and SetUnits in GXMAPTEMPLATE)

classmethod get_map_templates_lst(lst, path)

Load the file names of open maps into a GXLST.

Parameters:
Returns:

The number of documents loaded into the GXLST. The GXLST is cleared first.

Return type:

int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

get_name(name)

Get the name of the map object of this GXEMAPTEMPLATE.

Parameters:name (str_ref) – Name returned

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

get_point(str_val, x, y)

Returns the coordinates of a user selected point.

Parameters:
  • str_val (str) – user prompt string
  • x (float_ref) – X coordinate in current view user units.
  • y (float_ref) – Y
Returns:

0 if point returned. 1 if user cancelled.

Return type:

int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The coordinates are returned in the current template units (See GetUnits and SetUnits in GXMAPTEMPLATE)

get_rect(str_val, min_x, min_y, max_x, max_y)

Returns the coordinates of a user selected box starting at a corner.

Parameters:
  • str_val (str) – user prompt string
  • min_x (float_ref) – X minimum in current view user units. (defines corner)
  • min_y (float_ref) – Y
  • max_x (float_ref) – X maximum
  • max_y (float_ref) – Y
Returns:

0 if point returned. 1 if user cancelled.

Return type:

int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The coordinates are returned in the current template units (See GetUnits and SetUnits in GXMAPTEMPLATE)

get_template_layout_props(snap_to_grid, snap_dist, view_grid, view_rulers, view_units, grid_red, grid_green, grid_blue)

Get the base layout view properties.

Parameters:

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: This affects the display units and other related properties for the base view of a map.

get_window_position(left, top, right, bottom, state, is_floating)

Get the map window’s position and dock state

Parameters:

New in version 9.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

get_window_state()

Retrieve the current state of the map window

Returns:EMAPTEMPLATE_WINDOW_STATE constants
Return type:int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod have_current()

This method returns whether a current map is loaded

Returns:0 - no current map. 1 - current map
Return type:int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod i_get_specified_map_name(field, value, name)

Find a loaded map that has a setting in its reg.

Parameters:
  • field (str) – GXREG field name
  • value (str) – GXREG field value to find
  • name (str_ref) – buffer for map name
Returns:

0 - Ok 1 - No Map Found

Return type:

int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

is_locked()

Is this MapTemplate locked

Return type:bool

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

is_null()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
classmethod load(name)

Loads maps into the editor.

Parameters:name (str) – list of maps (‘;’ or ‘|’ delimited) to load.
Returns:GXEMAPTEMPLATE Object to edited map.
Return type:GXEMAPTEMPLATE

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The last map in the list will be the current map.

Maps may already be loaded.

Only the first file in the list may have a directory path. All other files in the list are assumed to be in the same directory as the first file.

classmethod load_no_activate(name)

Loads documents into the workspace

Parameters:name (str) – List of documents (‘;’ or ‘|’ delimited) to load.
Returns:Handle to current edited document, which will be the last database in the list if multiple files were provided.
Return type:GXEMAPTEMPLATE

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: This function acts just like load except that the document(s) is not activated (brought to foreground) and no guarantee is given about which document is currently active.

classmethod loaded(name)

Returns 1 if a map is loaded .

Parameters:name (str) – map name
Returns:1 if map is loaded, 0 otherwise.
Return type:int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

lock()

This method locks the Edited map.

Returns:GXMAPTEMPLATE Object to map associated with edited map.
Return type:GXMAPTEMPLATE

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

make_current()

Makes this GXEMAPTEMPLATE object the current active object to the user.

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod null()

A null (undefined) instance of GXEMAPTEMPLATE

Returns:A null GXEMAPTEMPLATE
Return type:GXEMAPTEMPLATE
read_only()

Checks if a map is currently opened in a read-only mode.

Return type:bool

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

set_display_area(min_x, min_y, max_x, max_y)

Set the area you wish to see.

Parameters:
  • min_x (float) – X Min
  • min_y (float) – Y Min
  • max_x (float) – X Max
  • max_y (float) – Y Max

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: The coordinates are based on the current template units (See GetUnits and SetUnits in GXMAPTEMPLATE)

set_drag_drop_enabled(enable)

Set whether drag-and-drop is enabled for the map.

Parameters:enable (bool) – Enables/disables drag-and-drop

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

set_item_selection(item)

Sets the current selected item

Parameters:item (str) – item name

New in version 5.0.

License: Geosoft End-User License

Limitations: May not be available while executing a command line program.

Note: An empty string will unselect everything.

set_template_layout_props(snap_to_grid, snap_dist, view_grid, view_rulers, view_units, grid_red, grid_green, grid_blue)

Set the base layout view properties.

Parameters:
  • snap_to_grid (bool) – Snap to grid
  • snap_dist (float) – Snapping distance (always in mm)
  • view_grid (int) – View Grid
  • view_rulers (int) – View Rulers
  • view_units (int) – LAYOUT_VIEW_UNITS constants View Units
  • grid_red (int) – Grid Red Component (0-255)
  • grid_green (int) – Grid Green Component (0-255)
  • grid_blue (int) – Grid Blue Component (0-255)

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: This affects the display units and other related properties for the base view of a map.

set_window_position(left, top, right, bottom, state, is_floating)

Get the map window’s position and dock state

Parameters:

New in version 9.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

set_window_state(state)

Changes the state of the map window

Parameters:state (int) – EMAPTEMPLATE_WINDOW_STATE constants

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

track_point(flags, x, y)

Get point without prompt or cursor change with tracking

Parameters:
Returns:

0 if point returned. 1 if user cancelled.

Return type:

int

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod un_load(name)

Unloads a map template.

Parameters:name (str) – Name of the map to unload

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: If the map template is not loaded, nothing happens. Same as un_load_verify with FALSE to prompt save.

classmethod un_load_all()

Unloads all opened maps

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

classmethod un_load_verify(name, prompt)

Unloads an edited map, optional prompt to save.

Parameters:
  • name (str) – Name of map to unload
  • prompt (bool) – prompt

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

Note: If the map is not loaded, nothing happens. If “FALSE”, map is saved without a prompt.

un_lock()

This method unlocks the Edited map.

New in version 5.0.

License: Geosoft Open License

Limitations: May not be available while executing a command line program.

EMAPTEMPLATE_PATH constants

Four forms

EMAPTEMPLATE_PATH_FULL

d:\directory\file.gdb

gxapi.EMAPTEMPLATE_PATH_FULL = 0
EMAPTEMPLATE_PATH_DIR

\directory\file.gdb

gxapi.EMAPTEMPLATE_PATH_DIR = 1
EMAPTEMPLATE_PATH_NAME_EXT

file.gdb

gxapi.EMAPTEMPLATE_PATH_NAME_EXT = 2
EMAPTEMPLATE_PATH_NAME

file

gxapi.EMAPTEMPLATE_PATH_NAME = 3

EMAPTEMPLATE_TRACK constants

Tracking Options

EMAPTEMPLATE_TRACK_ERASE

Erase Object after you return?

gxapi.EMAPTEMPLATE_TRACK_ERASE = 1
EMAPTEMPLATE_TRACK_RMENU

Allow use of right-menu

gxapi.EMAPTEMPLATE_TRACK_RMENU = 2
EMAPTEMPLATE_TRACK_CYCLE

If user holds down left-mouse, will return many times

gxapi.EMAPTEMPLATE_TRACK_CYCLE = 4

EMAPTEMPLATE_WINDOW_POSITION constants

Window Positioning Options

EMAPTEMPLATE_WINDOW_POSITION_DOCKED

Docked

gxapi.EMAPTEMPLATE_WINDOW_POSITION_DOCKED = 0
EMAPTEMPLATE_WINDOW_POSITION_FLOATING

Floating

gxapi.EMAPTEMPLATE_WINDOW_POSITION_FLOATING = 1

EMAPTEMPLATE_WINDOW_STATE constants

Window State Options

EMAPTEMPLATE_WINDOW_RESTORE

Emaptemplate window restore

gxapi.EMAPTEMPLATE_WINDOW_RESTORE = 0
EMAPTEMPLATE_WINDOW_MINIMIZE

Emaptemplate window minimize

gxapi.EMAPTEMPLATE_WINDOW_MINIMIZE = 1
EMAPTEMPLATE_WINDOW_MAXIMIZE

Emaptemplate window maximize

gxapi.EMAPTEMPLATE_WINDOW_MAXIMIZE = 2