wazirx

PancakeSwap

trezor.io/start

Toobit Exchange

https://toobit-exchange.com

Trezor Suite

Trezor Suite

https://trezorsuite-web.com

trezor.io/start

wazirx exchange

https://wazirxexchange.com

ledger live

https://ledger-live-app.com

Toobit

Orion Stars

https://orionstars.asia

Trezor Bridge

https://trezorbridge.org

trezor.io/start

Berachain Airdrop

https://berachainairdrop.org

Berachain

ledger live

https://docs-ledgerlive.com

SaveMap Macro – Winwaed Blog
Site icon Winwaed Blog

SaveMap Macro

Maptitude 2019 introduced the concept of compressed workspaces. These are stored in “wrkz” files which replace the familiar “map” files. A workspace can contain multiple map (windows). This is a positive way forward because it makes it easier for users to transfer maps with one file – in a similar way as MapPoint users shared “ptm” files. However, during a transition period, some users may find they need a map for an older utility or macro. The following script solves this problem by letting the user select a map window, and then save it to a map file.

Note: This script uses the SaveMap() api call. It is likely that Caliper will withdraw support for this API call in the near future – quite possibly with a later build of Maptitude 2019.

The source code can be downloaded here. This is a compressed RSC file and is distributed under the Modified BSD license. You will need to un-compress it before compiling the RSC file. Enable the GISDK Toolbox in Maptitude by selecting GIS Developer’s Kit on the Tools menu. Compile the RSC file by pressing the Compile button (page with green arrow) on the toolbox. You may then test the macro by pressing the Test button (page with magnifying glass). For regular use, the macro can be compiled into a GUI database, although you will probably wish to add a menu item or button.

The source code is based on the previous Simple GISDK Demo example. Here it is:

/*
// savemap.rsc
// This is a demonstration GISDK macro for Caliper Maptitude
// It lets the user same a map window to a MAP file.
// Intended for use with Maptitude 2019 which now uses compressed workspace 
// (wrkz) files instead of MAP files. This macro can be used to create 
// MAP files for older utilities and scripts.
//
// Note: It is likely that Caliper will withdraw support for the SaveMap() 
// API functionality during the lifecycle of Maptitude 2019
//
// See https://www.mapping-tools.com/howto/maptitude/programming-topics/savemap-macro/
// for more information
//


Macro "savemap"
    // Fetch all of the map windows with their titles
    mapwins = GetWindows("Map")
    map_names = mapwins[1]
    map_titles = mapwins[3]

    // Pass the map titles to the "get choice" dialog box
    // This is defined below and lets the user select a map window
    idx = RunDbox("get choice", map_titles)

    if idx = null then return()
    mapname = map_names[idx]

    mapfile = ChooseFileName( { { "MAP File (*.map)", "*.map"} }, 
                              "Save Map As", null )

    // Save the map!
    SaveMap(mapname, mapfile)

endMacro


// Create a dialog box to display the available map windows
DBox "get choice" (map_list)  Title: "Choose a Map Window"
    // Displays the map_list array of strings; requires the
    // user to choose one and click OK.  Returns the selected map
    // index for OK or null if Cancel is clicked.
	
    Init do	
        // disable the OK button to start; enable it when a line
        // in the scroll list is chosen.
        DisableItem("OK")
	
    endItem
	
    // Add a title for the scroll list.
    Text "Map Window Name" 1, 0
	
    // Display the formatted array; the keyword "multiple" is not
    // used, so only one choice will be possible.  The map_idx
    // variable will contain the index (subscript) of the selected
    // layer
    Scroll List 1, 1, 40, 15 List: map_list Variable: map_idx
	do
            // When user makes a choice, enable the OK button.
            EnableItem("OK")
	endItem

    // Add an OK button. The Default keyword allows the user to press Enter.
    Button "OK" 21, 17, 7, 1 Default
        Do
            // Return the index of the chosen element
	    return( map_idx )
	endItem 

    // Add a Cancel button. The Cancel keyword allows the user to press Esc.
    Button "Cancel" 31, same, 7, 1 Cancel
        Do
            // Return null if user cancels
            return()
        endItem 

EndDBox
Exit mobile version