Пример #1
0
        private void ProcessLinearRingGeometry(LinearRing f)
        {
            var ring = _geometryFactory.CreateLinearRing(
                f.Coordinates.Select(crd => new Coordinate(crd.Longitude, crd.Latitude)).ToArray());

            var geom = RingsArePolygons ? (IGeometry)_geometryFactory.CreatePolygon(ring) : ring;

            AddGeometryToCollection(f.GetParent <Placemark>(), geom);
        }
Пример #2
0
        private void ProcessLinearRingGeometry(LinearRing f)
        {
            var ring = _geometryFactory.CreateLinearRing(
                    f.Coordinates.Select(crd => new Coordinate(crd.Longitude, crd.Latitude)).ToArray());

            var geom = RingsArePolygons ? (IGeometry)_geometryFactory.CreatePolygon(ring) : ring;
            AddGeometryToCollection(f.GetParent<Placemark>(), geom);
        }
Пример #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;
        }