GXEMAPTEMPLATE class

class geosoft.gxapi.GXEMAPTEMPLATE
             The EMAPTEMPLATE 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 EMAPTEMPLATE object, and use the Lock function to
lock the underlying template to prevent external changes. The returned
MAPTEMPLATE object may then be safely used to make changes to the template itself.

VIRTUAL EMAPTEMPLATE 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 EMAPTEMPLATE from that
map template. The GX can then call MakeCurrent and set the current EMAPTEMPLATE so
that code that follows sees this map template as the current MAPTEMPLATE.

Supported methods on Virtual EMAPTEMPLATEs are:

  geosoft.gxapi.GXEMAPTEMPLATE.current()
  geosoft.gxapi.GXEMAPTEMPLATE.current_no_activate()
  geosoft.gxapi.GXEMAPTEMPLATE.make_current()
  geosoft.gxapi.GXEMAPTEMPLATE.have_current()
  geosoft.gxapi.GXEMAPTEMPLATE.current_if_exists()

  geosoft.gxapi.GXEMAPTEMPLATE.lock()
  geosoft.gxapi.GXEMAPTEMPLATE.un_lock()

  geosoft.gxapi.GXEMAPTEMPLATE.get_name()

  geosoft.gxapi.GXEMAPTEMPLATE.loaded()
  geosoft.gxapi.GXEMAPTEMPLATE.load()
  geosoft.gxapi.GXEMAPTEMPLATE.load_no_activate()
  geosoft.gxapi.GXEMAPTEMPLATE.un_load_verify()
  geosoft.gxapi.GXEMAPTEMPLATE.un_load()

  geosoft.gxapi.GXEMAPTEMPLATE.create_virtual()
static create_virtual((str)arg1) → GXEMAPTEMPLATE:
Makes this EMAPTEMPLATE object the current active object to the user.
Parameters:arg1 (str) – Name of map to create a virtual EMAMTEMPLATE from
Returns:EMAPTEMPLATE Object
Return type:geosoft.gxapi.GXEMAPTEMPLATE

New in version 5.0.0.

static current() → GXEMAPTEMPLATE:
This method returns the Current Edited map template.
Returns:EMAPTEMPLATE Object
Return type:geosoft.gxapi.GXEMAPTEMPLATE

New in version 5.0.0.

static current_if_exists() → GXEMAPTEMPLATE:
This method returns the Current Edited map.
Returns:EMAPTEMPLATE 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:geosoft.gxapi.GXEMAPTEMPLATE

New in version 5.0.0.

static current_no_activate() → GXEMAPTEMPLATE:
This method returns the Current Edited map template.
Returns:EMAPTEMPLATE Object
Return type:geosoft.gxapi.GXEMAPTEMPLATE

New in version 9.0.0.

Note:

This function acts just like geosoft.gxapi.GXEMAPTEMPLATE.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() → bool:
Is drag-and-drop enabled for the map?
Returns:bool
Return type:bool

New in version 5.0.0.

get_box((str)arg1, (float_ref)arg2, (float_ref)arg3, (float_ref)arg4, (float_ref)arg5) → int:
Returns the coordinates of a user selected box.
Parameters:
Returns:

0 if point returned. 1 if user cancelled.

Return type:

int

New in version 5.0.0.

Note:

                                     The coordinates are returned in the current template units
(See GetUnits and SetUnits in MAPTEMPLATE)
get_display_area((float_ref)arg1, (float_ref)arg2, (float_ref)arg3, (float_ref)arg4) → None:
Get the area you are currently looking at.
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.0.0.

Note:

                                     The coordinates are based on the current template units
(See GetUnits and SetUnits in MAPTEMPLATE)
get_item_selection((str_ref)arg1) → bool:
Gets info about the current selected item
Parameters:arg1 (geosoft.gxapi.str_ref) – returned item name
Returns:bool Is item a view?
Return type:bool

New in version 5.0.0.

Note:

If nothing is selected the string will be empty and the function will return False;
get_line((str)arg1, (float_ref)arg2, (float_ref)arg3, (float_ref)arg4, (float_ref)arg5) → int:
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.0.

Note:

                                     The coordinates are returned in the current template units
(See GetUnits and SetUnits in MAPTEMPLATE)
static get_map_templates_lst((GXLST)arg1, (int)arg2) → int:
Load the file names of open maps into a LST.
Parameters:
Returns:

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

Return type:

int

New in version 5.0.0.

get_name((str_ref)arg1) → None:
Get the name of the map object of this EMAPTEMPLATE.
Parameters:arg1 (geosoft.gxapi.str_ref) – Name returned
Returns:Nothing
Return type:None

New in version 5.0.0.

get_point((str)arg1, (float_ref)arg2, (float_ref)arg3) → int:
Returns the coordinates of a user selected point.
Parameters:
Returns:

0 if point returned. 1 if user cancelled.

Return type:

int

New in version 5.0.0.

Note:

                                     The coordinates are returned in the current template units
(See GetUnits and SetUnits in MAPTEMPLATE)
get_rect((str)arg1, (float_ref)arg2, (float_ref)arg3, (float_ref)arg4, (float_ref)arg5) → int:
Returns the coordinates of a user selected box starting at a corner.
Parameters:
Returns:

0 if point returned. 1 if user cancelled.

Return type:

int

New in version 5.0.0.

Note:

                                     The coordinates are returned in the current template units
(See GetUnits and SetUnits in MAPTEMPLATE)
get_template_layout_props((bool_ref)arg1, (float_ref)arg2, (int_ref)arg3, (int_ref)arg4, (int_ref)arg5, (int_ref)arg6, (int_ref)arg7, (int_ref)arg8) → None:
Get the base layout view properties.
Parameters:
Returns:

Nothing

Return type:

None

New in version 5.0.0.

Note:

                                     This affects the display units and other related properties for the base
view of a map.
get_window_position((int_ref)arg1, (int_ref)arg2, (int_ref)arg3, (int_ref)arg4, (int_ref)arg5, (int_ref)arg6) → None:
Get the map window's position and dock state
Parameters:
Returns:

Nothing

Return type:

None

New in version 9.0.0.

get_window_state() → int:
Retrieve the current state of the map window
Returns:EMAPTEMPLATE_WINDOW_STATE constants
Return type:int

New in version 5.0.0.

static have_current() → int:
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.0.

static i_get_specified_map_name((str)arg1, (str)arg2, (str_ref)arg3) → int:
Find a loaded map that has a setting in its reg.
Parameters:
  • arg1 (str) – REG field name
  • arg2 (str) – REG field value to find
  • arg3 (geosoft.gxapi.str_ref) – buffer for map name
Returns:

0 - Ok 1 - No Map Found

Return type:

int

New in version 5.0.0.

is_locked() → bool:
Is this MapTemplate locked
Returns:bool
Return type:bool

New in version 5.0.0.

is_null() → bool

Check if the instance of geosoft.gxapi.GXEMAPTEMPLATE is null (undefined)

Returns:True if this is a null instance of geosoft.gxapi.GXEMAPTEMPLATE, False otherwise.
Return type:bool`
static load((str)arg1) → GXEMAPTEMPLATE:
Loads maps into the editor.
Parameters:arg1 (str) – list of maps (‘;’ or ‘|‘ delimited) to load.
Returns:EMAPTEMPLATE Object to edited map.
Return type:geosoft.gxapi.GXEMAPTEMPLATE

New in version 5.0.0.

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.
static load_no_activate((str)arg1) → GXEMAPTEMPLATE:
Loads documents into the workspace
Parameters:arg1 (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:geosoft.gxapi.GXEMAPTEMPLATE

New in version 5.0.0.

Note:

This function acts just like geosoft.gxapi.GXEMAPTEMPLATE.load() except that the document(s) is not activated (brought to foreground) and no
guarantee is given about which document is currently active.
static loaded((str)arg1) → int:
Returns 1 if a map is loaded .
Parameters:arg1 (str) – map name
Returns:1 if map is loaded, 0 otherwise.
Return type:int

New in version 5.0.0.

lock() → GXMAPTEMPLATE:
This method locks the Edited map.
Returns:MAPTEMPLATE Object to map associated with edited map.
Return type:geosoft.gxapi.GXMAPTEMPLATE

New in version 5.0.0.

make_current() → None:
Makes this EMAPTEMPLATE object the current active object to the user.
Returns:Nothing
Return type:None

New in version 5.0.0.

static null() → GXEMAPTEMPLATE

A null (undefined) instance of geosoft.gxapi.GXEMAPTEMPLATE

Returns:A null geosoft.gxapi.GXEMAPTEMPLATE
Return type:geosoft.gxapi.GXEMAPTEMPLATE
read_only() → bool:
Checks if a map is currently opened in a read-only mode.
Returns:bool
Return type:bool

New in version 5.0.0.

set_display_area((float)arg1, (float)arg2, (float)arg3, (float)arg4) → None:
Set the area you wish to see.
Parameters:
  • arg1 (float) – X Min
  • arg2 (float) – Y Min
  • arg3 (float) – X Max
  • arg4 (float) – Y Max
Returns:

Nothing

Return type:

None

New in version 5.0.0.

Note:

                                     The coordinates are based on the current template units
(See GetUnits and SetUnits in MAPTEMPLATE)
set_drag_drop_enabled((bool)arg1) → None:
Set whether drag-and-drop is enabled for the map.
Parameters:arg1 (bool) – Enables/disables drag-and-drop bool
Returns:Nothing
Return type:None

New in version 5.0.0.

set_item_selection((str)arg1) → None:
Sets the current selected item
Parameters:arg1 (str) – item name
Returns:Nothing
Return type:None

New in version 5.0.0.

Note:

An empty string will unselect everything.
set_template_layout_props((bool)arg1, (float)arg2, (int)arg3, (int)arg4, (int)arg5, (int)arg6, (int)arg7, (int)arg8) → None:
Set the base layout view properties.
Parameters:
  • arg1 (bool) – bool Snap to grid
  • arg2 (float) – Snapping distance (always in mm)
  • arg3 (int) – View Grid
  • arg4 (int) – View Rulers
  • arg5 (int) – LAYOUT_VIEW_UNITS constants View Units
  • arg6 (int) – Grid Red Component (0-255)
  • arg7 (int) – Grid Green Component (0-255)
  • arg8 (int) – Grid Blue Component (0-255)
Returns:

Nothing

Return type:

None

New in version 5.0.0.

Note:

                                     This affects the display units and other related properties for the base
view of a map.
set_window_position((int)arg1, (int)arg2, (int)arg3, (int)arg4, (int)arg5, (int)arg6) → None:
Get the map window's position and dock state
Parameters:
Returns:

Nothing

Return type:

None

New in version 9.0.0.

set_window_state((int)arg1) → None:
Changes the state of the map window
Parameters:arg1 (int) – EMAPTEMPLATE_WINDOW_STATE constants
Returns:Nothing
Return type:None

New in version 5.0.0.

track_point((int)arg1, (float_ref)arg2, (float_ref)arg3) → int:
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.0.

static un_load((str)arg1) → None:
Unloads a map template.
Parameters:arg1 (str) – Name of the map to unload
Returns:Nothing
Return type:None

New in version 5.0.0.

Note:

                                     If the map template is not loaded, nothing happens.
Same as geosoft.gxapi.GXEMAPTEMPLATE.un_load_verify() with FALSE to prompt save.
static un_load_all() → None:
Unloads all opened maps
Returns:Nothing
Return type:None

New in version 5.0.0.

static un_load_verify((str)arg1, (bool)arg2) → None:
Unloads an edited map, optional prompt to save.
Parameters:
  • arg1 (str) – Name of map to unload
  • arg2 (bool) – prompt bool
Returns:

Nothing

Return type:

None

New in version 5.0.0.

Note:

                                     If the map is not loaded, nothing happens.
If "FALSE", map is saved without a prompt.
un_lock() → None:
This method unlocks the Edited map.
Returns:Nothing
Return type:None

New in version 5.0.0.

EMAPTEMPLATE_PATH constants

Four forms
gxapi.EMAPTEMPLATE_PATH_FULL = 0
d:\directory\file.gdb
gxapi.EMAPTEMPLATE_PATH_DIR = 1
\directory\file.gdb
gxapi.EMAPTEMPLATE_PATH_NAME_EXT = 2
file.gdb
gxapi.EMAPTEMPLATE_PATH_NAME = 3
file

EMAPTEMPLATE_TRACK constants

Tracking Options
gxapi.EMAPTEMPLATE_TRACK_ERASE = 1
Erase Object after you return?
gxapi.EMAPTEMPLATE_TRACK_RMENU = 2
Allow use of right-menu
gxapi.EMAPTEMPLATE_TRACK_CYCLE = 4
If user holds down left-mouse, will return many times

EMAPTEMPLATE_WINDOW_POSITION constants

Window Positioning Options
gxapi.EMAPTEMPLATE_WINDOW_POSITION_DOCKED = 0
gxapi.EMAPTEMPLATE_WINDOW_POSITION_FLOATING = 1

EMAPTEMPLATE_WINDOW_STATE constants

Window State Options
gxapi.EMAPTEMPLATE_WINDOW_RESTORE = 0
gxapi.EMAPTEMPLATE_WINDOW_MINIMIZE = 1
gxapi.EMAPTEMPLATE_WINDOW_MAXIMIZE = 2