Exemplo n.º 1
0
 /// <summary>
 /// ersetzt die Polyline in <see cref="DetailMap.Poly"/> durch den Pfad vom Clipping (in MapUnits)
 /// </summary>
 /// <param name="path"></param>
 /// <param name="area"></param>
 static void SetClipperPath2Area(ClipperPath path, DetailMap.Poly area)
 {
     area.Clear();
     foreach (var item in path)
     {
         area.AddPoint(new MapUnitPoint(item.X, item.Y), false);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// "sichere" Flächen erzeugen (ev. aufteilen)
        /// </summary>
        /// <param name="area"></param>
        /// <param name="maxsize">max. "quadratisches" Umgrenzung in MapUnits</param>
        /// <returns></returns>
        static List <DetailMap.Poly> MakeSafeAreas(DetailMap.Poly area, int maxsize)
        {
            List <DetailMap.Poly> lst = new List <DetailMap.Poly>();

            ClipperPath p = MapUnitPointList2ClipperPath(area.GetMapUnitPoints());
            bool        counterclockwise = Clipper.Orientation(p);

            ClipperPaths newpolys = SplitClipperPath(MapUnitPointList2ClipperPath(area.GetMapUnitPoints()), maxsize);

            for (int i = 0; i < newpolys.Count; i++)
            {
                if (Clipper.Orientation(newpolys[i]) != counterclockwise)
                {
                    newpolys[i].Reverse();
                }
            }

            if (newpolys.Count > 1) // es ist eine Teilung erfolgt
            {
                foreach (var newpoly in newpolys)
                {
                    DetailMap.Poly newarea = new DetailMap.Poly(area);
                    newarea.Clear();
                    foreach (var pt in newpoly)
                    {
                        newarea.AddPoint(new MapUnitPoint((int)pt.X, (int)pt.Y), false);
                    }
                    lst.Add(newarea);
                }
            }
            else
            {
                lst.Add(area);
            }

            return(lst);
        }