none
Create a "rounded corner rectangle" polyline/polygon RRS feed

  • Question

  • Hello guys,

    I'd like to create a polygon/polyline with a curve in it. Just like a rectangle with rounded corners, for example.

    This is of course basically a mathematical issue; but I don't know how to do that anyways. Perfect would be an algorithm with a "start point" and and "end point" and maybe even a target angle that defines the curve (Standard rectangle would be 90°, but it would be awesome to be also able to define a 70° angle etc...)

    Do you have any sources or ideas how to achieve this?

    Thanks and best regards,

    Adrian

    Monday, September 3, 2012 8:18 AM

Answers

  • Take a look at this article: http://www.codeproject.com/Articles/128705/WPF-rounded-corners-polygon

    What I would suggest doing is converting the coordinates of your polygon to pixel coordinates on the map using the tryLocationToPixel method this way you are working with basic 2D data. Then run the algorithm to calculate the rounded corners. Then convert the pixel coordinates back to spatial coordinates using tryPixelToLocation.


    http://rbrundritt.wordpress.com

    Monday, September 3, 2012 9:50 AM

All replies

  • Take a look at this article: http://www.codeproject.com/Articles/128705/WPF-rounded-corners-polygon

    What I would suggest doing is converting the coordinates of your polygon to pixel coordinates on the map using the tryLocationToPixel method this way you are working with basic 2D data. Then run the algorithm to calculate the rounded corners. Then convert the pixel coordinates back to spatial coordinates using tryPixelToLocation.


    http://rbrundritt.wordpress.com

    Monday, September 3, 2012 9:50 AM
  • a huge thanks for your quick reply, I will evaluate this soonish :)
    Thanks a lot and,

    best regards from Stuttgart!

    Adrian

    Monday, September 3, 2012 5:52 PM
  • I can't get this working. The solution you provided doesn't calculate new point-objects for the PointCollection/LocationCollection. Instead it just takes all the points and draws a rounded shape. The algorithm basically runs with Shapes, Segments and Paths but all the Point-Objects remain the same.

    Yet i haven't figured out how to use this algorithm to produce more Points for the PointCollection/LocationCollection.

    @Adrian: Have you already figured out how to make rounded MapPolygons? bzw. hast du schon rausgefunden, wie man mappolygone mit runden ecken hinkriegt?

    Best regards from Munich ;)

    Friday, November 9, 2012 3:42 PM