I have a Canvas, and its NW and SE corners' Lat-Lon (basically a LocationRect). Is there a way to fix this Canvas to the appropriate locations on the map?
The Canvas will be automatically resized and shifted for any zoom and pan movements on the map control.
1 Answer, 1 is accepted
0
Martin Ivanov
Telerik team
answered on 04 Aug 2015, 12:07 PM
Hello Eric,
You can draw the Canvas based on given NW and SE coordinates using the following approach:
Convert the Locations to Point objects which represents the Locations' positions on the screen relative to the map. You can do that using the Location's GetPoint) method.
Location nw = new Location(0, 0);
Point topLeft = nw.GetPoint(this.RadMap3);
Calculate the size of the canvas based on Points' X and Y and set it to the Canvas Element.
Here is an example for this approach:
private void SetCanvasSize()
{
var nw = new Location(0, 0);
var se = new Location(-50, 100);
var topLeft = nw.GetPoint(this.RadMap3);
var bottomRight = se.GetPoint(this.RadMap3);
canvas.Width = bottomRight.X - topLeft.X;
canvas.Height = bottomRight.Y - topLeft.Y;
MapLayer.SetLocation(this.canvas, nw);
}
Please give it a try and let me know if it works for you.
Regards,
Martin
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items