Draw outline of markers

Topics: Windows Forms
Aug 19, 2011 at 10:30 AM

Hi All,

Imagine the simplest scenario. There are 12 markers on the map in the positions of numbers on a clock, drawing a line between each marker i would end up with an outline of a clock. How would I get an outline of a shape if there are markers in the middle of the clock and i only want the outer markers? The zoomtomarker? command may be of help because that must know the outer markers to zoom in to.

Ideas anyone?

Thanks

Aug 19, 2011 at 10:41 AM

Suppose one way is a loop getting the left most, then the right most but that may take a while so if there is a quicker way than to literate through the markers?

Coordinator
Aug 19, 2011 at 11:19 AM

doubtly

Aug 25, 2011 at 3:00 PM
Edited Aug 25, 2011 at 3:04 PM

ok found something.

the "quickhull" algorithm

http://westhoffswelt.de/blog/0040_quickhull_introduction_and_php_implementation.html

 

Aug 29, 2011 at 1:05 PM

Hello tradford,

 

i use the Grahamalgorithmen for it. Works well up to thousand points and more.

 

The code-example you can find here:

http://www.activevb.de/tipps/vbnettipps/tipp0113.html

 

how to use with GMap:

 

        Dim Ret = GrahamScan.ConvexHull(m_Points)
        Dim polygonPoints As New List(Of PointLatLng)()

        For Each DrawingPoint In Ret
            TempPoint = Form_Main.MainMap.FromLocalToLatLng(DrawingPoint.X, DrawingPoint.Y)
            polygonPoints.Add(TempPoint)
        Next

 

Bye RobbeEDE

 

 

Aug 31, 2011 at 12:38 PM

Thanks a lot RobbeEDE will try!

Aug 31, 2011 at 1:45 PM

I tried the demo of the above and the convex hull still selects the very outside points which is what it's supposed to do but what i need is something that will trace the outside edge, so if the shape is a star it draws a star insted of a circle which the convex hull would do.

Aug 31, 2011 at 2:06 PM

I think the answer lies here but i never studied genometry in school :-

Taken from http://www.northeastraces.com/runningstatic/pcas/

Removing the overlaps

Many of these polygons overlap. This means a polygon has at least one vertex from a neighbouring polygon inside its area.
I call such a vertex an insider. If you like the polygon is taking a shortcut across the territory of its neighbour.
In some ways it would be better to alter the polygon so that the offending side of the polygon were bent to go round the insider.

The problem is widespread: the 120 polygons contain 1488 insiders.

Here is my improvement algorithm that alters each polygon so that it goes round the insiders:

   for each postcode area
      let "current polygon" be the polygon of this postcode area
      for each postcode area other than the current one
         for each vertex of the polygon of this postcode area
            if the vertex is inside the current polygon, 
            then add it to a set of "insiders"
      while the set is not empty
         choose the insider that causes fewer points to be insiders if
                  the chosen insider were added to the current polygon
         for each side of the current polygon
            determine the distance of this insider from the side
         let "grafting point" be the point at the start of the side that
             has the smallest distance
         add the point of this insider to the polygon after the grafting point
         remove this insider from the set of insiders
         remove any points that are no longer insiders from the set of insiders