MapChart.topobaseToScreen

Syntax

topobaseToScreen(rect: PP.Rect);

Parameters

rect. Rectangular area of map topobase.

Description

The topobaseToScreen method converts coordinates of a specified topobase area to screen coordinates.

Comments

The method returns a value with PP.Rect type.

Example

To execute the example the HTML page must contain the MapChart component named map (see Example of Creating the MapChart Component). Get coordinates of map topobase center and corresponding screen coordinates:

// Get coordinates of topobase center
var centerX = map.getTopobaseLeft() + map.getTopobaseSize().width / 2;
var centerY = map.getTopobaseTop() + map.getTopobaseSize().height / 2;
console.log("Coordinates of topobase center: (" + centerX + ", " + centerY + ")");
var topoRect = new PP.Rect({
    Left: centerX,
    Top: centerY,
    Width: 0,
    Height: 0
});
// Get screen coordinates of topobase center
var screenRect = map.topobaseToScreen(topoRect);
console.log("Screen coordinates of topobase center: (" + screenRect.getLeft() + ", " + screenRect.getTop() + ")");

After executing the example the browser console displays coordinates of map topobase center and corresponding screen coordinates:

Coordinates of topobase center: (714.5198412698412, 252)

Screen coordinates of topobase center: (880.8645518392541, 207.5)

See also:

MapChart