public double AngleInDegrees(Vector3 a) { return(GeoUtils.ToDegrees(this.Angle(a))); }
public void Load(IList <MapPoint> points, int firstPointIndex, int segmentLength, PolygonClosingPole closingPole) { MapPoint mapPoint = points[firstPointIndex]; MapPoint mapPoint2 = points[firstPointIndex + segmentLength - 1]; this.m_polygonIsClosed = mapPoint.Equals(mapPoint2); this.m_polygonIsCut = false; this.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 GeoUtils.DensifyLine(mapPoint3, mapPoint4, GeoUtils.DEFAULT_DENSIFICATION_ANGLE)) { if (Math.Abs(item.X - mapPoint5.X) <= 180.0) { polygonPart.Points.Add(item); mapPoint5 = item; } else if (Math.Abs(item.X) == 180.0) { MapPoint mapPoint6 = new MapPoint(0.0 - item.X, item.Y); polygonPart.Points.Add(mapPoint6); mapPoint5 = mapPoint6; } else 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; } else { MapPoint mapPoint7 = default(MapPoint); MapPoint mapPoint8 = default(MapPoint); this.FindIntersectionPoints(mapPoint5, item, out mapPoint7, out mapPoint8); if (!mapPoint5.Equals(mapPoint7)) { polygonPart.Points.Add(mapPoint7); } this.m_polygonPartsList.Add(polygonPart); polygonPart = new PolygonPart(closingPole); if (!item.Equals(mapPoint8)) { polygonPart.Points.Add(mapPoint8); } polygonPart.Points.Add(item); this.m_polygonIsCut = true; mapPoint5 = item; } } mapPoint4 = mapPoint5; } mapPoint3 = mapPoint4; } if (this.m_polygonIsCut && this.m_polygonIsClosed && polygonPart.LastPoint.Equals(this.m_polygonPartsList[0].FirstPoint)) { polygonPart.Points.RemoveAt(polygonPart.Points.Count - 1); this.m_polygonPartsList[0].Points.InsertRange(0, polygonPart.Points); } else { this.m_polygonPartsList.Add(polygonPart); } if (!this.m_polygonIsCut && this.m_polygonIsClosed && Math.Abs(polygonPart.FirstPoint.X) == 180.0 && polygonPart.FirstPoint.X == 0.0 - polygonPart.LastPoint.X) { this.m_polygonIsCut = true; } }