GXMAPTEMPLATE class¶
- class GXMAPTEMPLATE(handle=0)[source]¶
GXMAPTEMPLATE class.
A
GXMAPTEMPLATE
wraps and provides manipulation and usage for the XML content in map template files. See the annotated schema file maptemplate.xsd in the <GEOSOFT>maptemplate folder and the accompanying documentation in that folder for documentation on the file format.- commit()[source]¶
Commit any changes to the map template to disk
New in version 6.3.
License: Geosoft End-User License
- classmethod create(name, base, mode)[source]¶
Create a
GXMAPTEMPLATE
from an existing file.- Parameters:
name (str) – Map Template file name
base (str) – Map Template base template to create from
mode (int) – MAPTEMPLATE_OPEN constants
- Returns:
GXMAPTEMPLATE
Object- Return type:
New in version 6.3.
License: Geosoft Open License
Note: The base template name should be the file name part of a geosoft_maptemplate file in the <geosoft>maptemplate or <geosoftuser>maptemplate folders. A base file in the user folder will override any in the Geosoft install dir.
- create_map(map, group)[source]¶
Create a map from the map template
- Parameters:
map (str) – New map file name (if it exists it will be overwritten)
group (str) – Group name to use for settings
New in version 6.3.
License: Geosoft End-User License
- discard()[source]¶
Discard all changes made to the map template and reload from disk.
New in version 6.3.
License: Geosoft End-User License
- get_file_name(name)[source]¶
Get the file name of the map template.
- Parameters:
name (str_ref) – Returned map template file name
New in version 6.3.
License: Geosoft End-User License
- classmethod get_media_size(name, full_page_width, full_page_height, plot_width, plot_height)[source]¶
Get full width, full height, plot width and plot height in cm for a specific media or template name
- Parameters:
name (str) – Page size name
full_page_width (float_ref) – Full width of page in cm (
rDUMMY
if name not found)full_page_height (float_ref) – Full height of page in cm (
rDUMMY
if name not found)plot_width (float_ref) – Plot width of page in cm (
rDUMMY
if name not found)plot_height (float_ref) – Plot height of page in cm (
rDUMMY
if name not found)
New in version 2023.2.
License: Geosoft End-User License
Note: The user ‘media.csv’ file is searched first. If the name is not found then the ‘maptmpl.csv’ file is searched, and if a template name is matched the sizes of the associated media name are returned. If a template is specified, the orientation is taken into account for the media.
- get_tmp_copy(tmp)[source]¶
Get a temporary XML file for manipulation of the map template.
- Parameters:
tmp (str_ref) – Returned temporary map template file name
New in version 6.3.
License: Geosoft End-User License
Note: After manipulating contents the object may be updated by a call to the UpdateFromTmpCopy method.
- is_null()[source]¶
Check if this is a null (undefined) instance
- Returns:
True if this is a null (undefined) instance, False otherwise.
- Return type:
bool
- classmethod null()[source]¶
A null (undefined) instance of
GXMAPTEMPLATE
- Returns:
A null
GXMAPTEMPLATE
- Return type:
- refresh()[source]¶
Refresh the map template with any newly saved items
New in version 7.0.
License: Geosoft End-User License
- render_preview(hdc, left, bottom, right, top)[source]¶
Create a preview of the map template onto a Windows DC handle
- Parameters:
hdc (int) – DC Handle
left (int) – Left value of the render rect in Windows coordinates (bottom>top)
bottom (int) – Bottom value
right (int) – Right value
top (int) – Top value
New in version 6.3.
License: Geosoft End-User License
- render_preview_map_production(hdc, left, bottom, right, top)[source]¶
Render a preview for map sheet production purposes
- Parameters:
New in version 6.4.
License: Geosoft End-User License
Note: This method can also be used to get the data view pixel location by passing a null DC handle. This help to plot the view contents preview from another location.
- update_from_tmp_copy(tmp)[source]¶
Update the object contents from a temporary XML file that may have bee manipulated externally.
- Parameters:
tmp (str) – Temporary map template file name
New in version 6.3.
License: Geosoft End-User License
Note: This method will not modify the original contents of the file until a call to the the Commit method is made or the object is destroyed. A call to the Discard method will restore the contents to that of the original file. The temporary file is not deleted and should be to not leak file resources.
MAPTEMPLATE_OPEN constants¶
Open Modes