Can't find MapEllipse, MapRectangle

1 Answer 62 Views
Map
Scott E
Top achievements
Rank 1
Scott E asked on 28 Sep 2021, 04:22 PM

Hello,

I've started using the Telerik UI WinForms Map control, and have seen some samples using MapRectangle.

However, I can't find this class anywhere in the Telerik namespaces. All I can find is MapPolyline and MapPolygon.

My referenced assemblies are:

Telerik.WinControls.dll

Telerik.WinControls.RadMap.dll

Telerik.WinControls.UI.dll

Am I missing an assembly reference?

I appreciate any guidance you can provide.

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 01 Oct 2021, 09:39 AM

Hello Scott,

Straight to your question. Telerik UI for WinForms suite does not provide RadMap MapRectangle and MapEllipse shapes out of the box. Those shapes are provided by Telerik UI for WPF suite if you want to use them out of the box.

However, you can create your own MapRectangle and MapEllipse classes that inherit MapPoint and add your custom logic. Then you can use them as follows: 

int rectangleWidth = 200;
int rectangleHeight = 100;

MapRectangle rectangle = new MapRectangle(location) { WidthInKm = rectangleWidth, HeightInKm = rectangleHeight }; rectangle.BackColor = Color.FromArgb(125, Color.LightGreen); this.radMap1.MapElement.Layers["CustomShapes"].Add(rectangle); MapEllipse ellipse = new MapEllipse(location) { Fx = rectangleWidth / 2, Fy = rectangleHeight / 2 }; ellipse.BackColor = Color.FromArgb(125, Color.LightCoral); this.radMap1.MapElement.Layers["CustomShapes"].Add(ellipse); this.radMap1.Zoom(5);

 

You can see the MapRectangle and MapEllipse logic inside the attached project - "MapShapesSample.zip". Note that when you create your custom shapes you will have to pass them location, which corresponds to the top left point for the MapRectangle or the center for MapEllipse, width and height values (in kilometers).

The end result will look like this:

I have attached a sample project to fully demonstrate the approach. I hope you find this information useful.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Map
Asked by
Scott E
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or