getViewCenter
getViewCenter() Function
• Introduced in version 1.5.4
Returns the center of the visible area of the map window, given in either map pixels or cell coordinates depending on the first parameter. The result is in a ";" delimited String as default or can be configured by setting the delimiter or using JSON.
Usage
<source lang="mtmacro" line> getViewCenter() getViewCenter(pixels) getViewCenter(pixels, delim) </syntaxhighlight>
Parameters
pixels
- if set to true (1) means the returned coordinates are measured in map pixels. If set to false (0) the returned coordinates are measured in map cells. Defaults totrue
.delim
- if set to "json" means the returned coordinates are defined in JSON style. Otherwise a String property list is returning usingdelim
as a delimiter. Defaults to;
.
Examples
Get the center of the view of the current client:
<source lang="mtmacro" line> [r: getViewCenter()] [r: getViewCenter(0)] [r: getViewCenter(1)] [r: getViewCenter(0, "json")] [r: getViewCenter(1, "json")] [r: getViewCenter(0, ",")] [r: getViewCenter(1, ";")] </syntaxhighlight>
Output: <source lang="mtmacro" line> centerX=646; centerY=319; centerX=14; centerY=7; centerX=646; centerY=319; {"centerX":14,"centerY":7} {"centerX":646,"centerY":319} centerX=14, centerY=7; centerX=646; centerY=319,
</syntaxhighlight>