Esempio n. 1
0
            public List <PolygonPart> GetShapes()
            {
                if (!m_polygonIsCut)
                {
                    return(m_polygonPartsList);
                }
                List <PolygonPart> list = new List <PolygonPart>();

                if (!m_polygonIsClosed)
                {
                    foreach (PolygonPart polygonParts in m_polygonPartsList)
                    {
                        list.Add(polygonParts);
                    }
                    return(list);
                }
                if (m_polygonPartsList.Count > 1)
                {
                    m_polygonPartsList.Sort(new PolygonPart.Comparer());
                    int num;
                    for (num = 0; num < m_polygonPartsList.Count; num++)
                    {
                        PolygonPart polygonPart = m_polygonPartsList[num];
                        polygonPart.CollectKids(m_polygonPartsList);
                        num = m_polygonPartsList.IndexOf(polygonPart);
                    }
                }
                foreach (PolygonPart polygonParts2 in m_polygonPartsList)
                {
                    polygonParts2.SaveToResultsWithChildren(list);
                }
                return(list);
            }
Esempio n. 2
0
 public bool IsOnTheSameSide(PolygonPart other)
 {
     if (!InWest || !other.InWest)
     {
         if (InEast)
         {
             return(other.InEast);
         }
         return(false);
     }
     return(true);
 }
Esempio n. 3
0
 public bool IsOnTheSameSide(PolygonPart other)
 {
     if (this.InWest && other.InWest)
     {
         return(true);
     }
     if (this.InEast)
     {
         return(other.InEast);
     }
     return(false);
 }
Esempio n. 4
0
 public void CollectKids(List <PolygonPart> list)
 {
     if (!this.IsComplete())
     {
         int num = 0;
         while (num < list.Count)
         {
             PolygonPart polygonPart = list[num];
             if (this != polygonPart && this.IsOnTheSameSide(polygonPart) && polygonPart.TopPointY < this.TopPointY && polygonPart.BottomPointY > this.BottomPointY)
             {
                 this.Kids.Add(polygonPart);
                 polygonPart.CollectKids(list);
                 list.Remove(polygonPart);
             }
             else
             {
                 num++;
             }
         }
     }
 }
Esempio n. 5
0
            public void Load(IList <MapPoint> points, int firstPointIndex, int segmentLength, PolygonClosingPole closingPole)
            {
                MapPoint mapPoint  = points[firstPointIndex];
                MapPoint mapPoint2 = points[firstPointIndex + segmentLength - 1];

                m_polygonIsClosed  = mapPoint.Equals(mapPoint2);
                m_polygonIsCut     = false;
                m_polygonPartsList = new List <PolygonPart>();
                PolygonPart polygonPart = new PolygonPart(closingPole);
                MapPoint    mapPoint3   = default(MapPoint);

                for (int i = 0; i < segmentLength; i++)
                {
                    MapPoint mapPoint4 = points[firstPointIndex + i];
                    if (i == 0)
                    {
                        polygonPart.Points.Add(mapPoint4);
                    }
                    else
                    {
                        MapPoint mapPoint5 = mapPoint3;
                        foreach (MapPoint item in DensifyLine(mapPoint3, mapPoint4, DEFAULT_DENSIFICATION_ANGLE))
                        {
                            if (Math.Abs(item.X - mapPoint5.X) <= 180.0)
                            {
                                polygonPart.Points.Add(item);
                                mapPoint5 = item;
                                continue;
                            }
                            if (Math.Abs(item.X) == 180.0)
                            {
                                MapPoint mapPoint6 = new MapPoint(0.0 - item.X, item.Y);
                                polygonPart.Points.Add(mapPoint6);
                                mapPoint5 = mapPoint6;
                                continue;
                            }
                            if (Math.Abs(mapPoint5.X) == 180.0 && polygonPart.Points.Count == 1)
                            {
                                mapPoint5.X = 0.0 - mapPoint5.X;
                                polygonPart.Points[polygonPart.Points.Count - 1] = mapPoint5;
                                polygonPart.Points.Add(item);
                                mapPoint5 = item;
                                continue;
                            }
                            FindIntersectionPoints(mapPoint5, item, out MapPoint intersectionPoint, out MapPoint intersectionPoint2);
                            if (!mapPoint5.Equals(intersectionPoint))
                            {
                                polygonPart.Points.Add(intersectionPoint);
                            }
                            m_polygonPartsList.Add(polygonPart);
                            polygonPart = new PolygonPart(closingPole);
                            if (!item.Equals(intersectionPoint2))
                            {
                                polygonPart.Points.Add(intersectionPoint2);
                            }
                            polygonPart.Points.Add(item);
                            m_polygonIsCut = true;
                            mapPoint5      = item;
                        }
                        mapPoint4 = mapPoint5;
                    }
                    mapPoint3 = mapPoint4;
                }
                if (m_polygonIsCut && m_polygonIsClosed && polygonPart.LastPoint.Equals(m_polygonPartsList[0].FirstPoint))
                {
                    polygonPart.Points.RemoveAt(polygonPart.Points.Count - 1);
                    m_polygonPartsList[0].Points.InsertRange(0, polygonPart.Points);
                }
                else
                {
                    m_polygonPartsList.Add(polygonPart);
                }
                if (!m_polygonIsCut && m_polygonIsClosed && Math.Abs(polygonPart.FirstPoint.X) == 180.0 && polygonPart.FirstPoint.X == 0.0 - polygonPart.LastPoint.X)
                {
                    m_polygonIsCut = true;
                }
            }