This is a migrated thread and some comments may be shown as answers.

Detect Line crossing

2 Answers 64 Views
Map
This is a migrated thread and some comments may be shown as answers.
Roman Kurdadze
Top achievements
Rank 1
Roman Kurdadze asked on 06 Mar 2020, 02:19 PM
I have implemented a code which draws certain lines (MapPolyline) on a RadMap element. How to determine if drawn polygon (MapPolygon) crosses the line? 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 09 Mar 2020, 11:45 AM

 

Hello, Roman,

Determining whether a line crosses a polyline sounds more like a mathematical question than to a RadMap related one. 

I have researched in general programming forums like StackOverflow and have found the following thread which may be suitable for your scenario: https://stackoverflow.com/questions/5514366/how-to-know-if-a-line-intersects-a-rectangle 

It shows a sample formula which allows you to detect whether a line, defined by two points, intersects a rectangle. Please give it a try with your coordinates and see whether it would fit your requirement.

Note that MapTileSystemHelper offers the LatLongToPixelXY method which allows you to convert any PointG to PointL which represents a point in Cartesian coordinates represented with Int64 values. Thus, you can use the formula from the above referred StackOverflow thread.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Roman Kurdadze
Top achievements
Rank 1
answered on 09 Mar 2020, 02:14 PM
That is exactly what i did and it worked! Thanks for help!
Tags
Map
Asked by
Roman Kurdadze
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Roman Kurdadze
Top achievements
Rank 1
Share this question
or