MapContentMilestone.getMilestonePosition

Syntax

getMilestonePosition(offset: PP.Point);

Parameters

offset. Offset by all axes relative to initial position of the milestone, shows as shares of it maximum possible offset.

Description

The getMilestonePosition method determines milestone position in coordinates of map topobase.

Comments

The method returns value of the PP.Point type.

Example

To execute the example the HTML page must contain the MapChart component named map (see Example of Creating the MapChart Component). Create a milestone that contains a text area an place it in the center of the RU-KYA map layer area:

// Create a text area
var textArea = new PP.Ui.TextArea({
    Width: 50,
    Height: 20,
    Content: "RU-KYA" // Text
})
// Create a milestone for the map layer area with the RU-KYA identifier
var milestone = new PP.MapContentMilestone({
    Chart: map,
    Content: textArea, // Milestones contents is a text area
    Shape: "{RU-KYA}"
});
with(milestone) {
    // Render milestone
    draw(map.getScale(), null, 0, 0);
    // Determine milestone placement taking in consideration shift to 50%
    var targetPoint = new PP.Point("0.5, 0.5");
    var topoPoint = getMilestonePosition(targetPoint);
    // Convert topobase coordinates into screen coordinates
    var screenPoint = getScreen2DCoord(topoPoint);
    // Place the milestone into the center of the map layer area with the RU-KYA identifier
    setLeft(screenPoint.x - textArea.getWidth() / 2);
    setTop(screenPoint.y);
};

After executing the example a milestone that contains a text area is shown in the center of the map layer area with the RY-KYA ID:

See also:

MapContentMilestone