コード例 #1
0
ファイル: Polygon.cs プロジェクト: RobertCL/MissionPlanner
 /// <summary>
 /// Adds the specified <see cref="InnerBoundary"/> to this instance.
 /// </summary>
 /// <param name="boundary">
 /// The <c>InnerBoundary</c> to add to this instance.
 /// </param>
 /// <exception cref="System.ArgumentNullException">boundary is null.</exception>
 /// <exception cref="System.InvalidOperationException">
 /// boundary belongs to another <see cref="Element"/>.
 /// </exception>
 public void AddInnerBoundary(InnerBoundary boundary)
 {
     this.AddChild(boundary);
 }
コード例 #2
0
 /// <summary>
 /// Adds the specified <see cref="InnerBoundary"/> to this instance.
 /// </summary>
 /// <param name="boundary">
 /// The <c>InnerBoundary</c> to add to this instance.
 /// </param>
 /// <exception cref="System.ArgumentNullException">boundary is null.</exception>
 /// <exception cref="System.InvalidOperationException">
 /// boundary belongs to another <see cref="Element"/>.
 /// </exception>
 public void AddInnerBoundary(InnerBoundary boundary)
 {
     this.AddChild(boundary);
 }
コード例 #3
0
        private Polygon CreateKmlPolygon(IPolygon polygon)
        {
            var kmlPolygon = new Polygon();
            var ring = new LinearRing { Coordinates = new CoordinateCollection() };

            kmlPolygon.OuterBoundary = new OuterBoundary { LinearRing = ring };

            foreach (var coordinate in polygon.ExteriorRing.Coordinates)
            {
                ring.Coordinates.Add(new Vector(coordinate.Y, coordinate.X));
            }

            foreach (var interiorRing in polygon.InteriorRings)
            {
                var innerBoundary = new InnerBoundary();
                kmlPolygon.AddInnerBoundary(innerBoundary);

                ring = new LinearRing { Coordinates = new CoordinateCollection() };

                innerBoundary.LinearRing = ring;

                foreach (var coordinate in interiorRing.Coordinates)
                {
                    ring.Coordinates.Add(new Vector(coordinate.Y, coordinate.X));
                }
            }

            return kmlPolygon;
        }