The JSON-serializable polygon type.
Inheritance: JsonGeometry, IJsonGeometry
Exemplo n.º 1
0
        private static IPolygon ToEsriPolygon(this JsonPolygon shape)
        {
            var polygon = (IGeometryCollection) new Polygon();

            foreach (var ring in shape.rings)
            {
                polygon.AddGeometry(new Ring().Load(ring));
            }

            return((IPolygon)polygon);
        }
Exemplo n.º 2
0
        private static XElement ToKmlPolygon(this JsonPolygon shape, double z, params XElement[] extraElements)
        {
            var polygons = new List <XElement>();

            foreach (var ring in shape.rings)
            {
                var isInnerRing = IsInnerRing(ring);

                if (shape.rings.Length == 1 || !isInnerRing)
                {
                    polygons.Add(new XElement(kml + "Polygon", extraElements));
                }

                polygons.Last().Add(new XElement(kml + (isInnerRing ? "innerBoundaryIs" : "outerBoundaryIs"),
                                                 new XElement(kml + "LinearRing",
                                                              new XElement(kml + "coordinates", ring.ToCoordinates(z)))));
            }

            return(new XElement(kml + "MultiGeometry", polygons));
        }