Beispiel #1
0
        public static void main(string[] args)
        {
            var seqFact = ExtendedCoordinateSequenceFactory.Instance();

            var array1 = new ExtendedCoordinate[] { new ExtendedCoordinate(0, 0, 0, 91),
                                                    new ExtendedCoordinate(10, 0, 0, 92), new ExtendedCoordinate(10, 10, 0, 93),
                                                    new ExtendedCoordinate(0, 10, 0, 94), new ExtendedCoordinate(0, 0, 0, 91) };
            var seq1 = seqFact.Create(array1);

            var seq2 = seqFact.Create(new ExtendedCoordinate[] { new ExtendedCoordinate(5, 5, 0, 91),
                                                                 new ExtendedCoordinate(15, 5, 0, 92), new ExtendedCoordinate(15, 15, 0, 93),
                                                                 new ExtendedCoordinate(5, 15, 0, 94), new ExtendedCoordinate(5, 5, 0, 91) });

            var fact = new GeometryFactory(ExtendedCoordinateSequenceFactory.Instance());

            IGeometry g1 = fact.CreatePolygon(fact.CreateLinearRing(seq1), null);
            IGeometry g2 = fact.CreatePolygon(fact.CreateLinearRing(seq2), null);

            Console.WriteLine("WKT for g1: " + g1);
            Console.WriteLine("Internal rep for g1: " + ((IPolygon)g1).ExteriorRing.CoordinateSequence);

            Console.WriteLine("WKT for g2: " + g2);
            Console.WriteLine("Internal rep for g2: " + ((IPolygon)g2).ExteriorRing.CoordinateSequence);

            var gInt = g1.Intersection(g2);

            Console.WriteLine("WKT for gInt: " + gInt);
            Console.WriteLine("Internal rep for gInt: " + ((IPolygon)gInt).ExteriorRing.CoordinateSequence);
        }
        public static void PrintSourceData(IList <Envelope> sourceEnvelopes)
        {
            Console.WriteLine("============ Source Data ============\n");
            Console.Write("GEOMETRYCOLLECTION(");
            bool first = true;

            foreach (var e in sourceEnvelopes)
            {
                IGeometry g = factory.CreatePolygon(factory.CreateLinearRing(new Coordinate[] {
                    new Coordinate(e.MinX, e.MinY), new Coordinate(e.MinX, e.MaxY),
                    new Coordinate(e.MaxX, e.MaxY), new Coordinate(e.MaxX, e.MinY),
                    new Coordinate(e.MinX, e.MinY)
                }), null);
                if (first)
                {
                    first = false;
                }
                else
                {
                    Console.Write(",");
                }
                Console.Write(g);
            }
            Console.WriteLine(")\n");
        }
        public IPolygon CreatePolygon(IList <Coordinate> shell, IList <Coordinate>[] holes = null)
        {
            ILinearRing[] geomHoles = new ILinearRing[holes == null ? 0 : holes.Length];

            for (int i = 0; i < geomHoles.Length; i++)
            {
                geomHoles[i] = _factory.CreateLinearRing(holes[i]);
            }

            return(_factory.CreatePolygon(_factory.CreateLinearRing(shell), geomHoles));
        }
        private void MergeInnerIntoOuterPolygon(ref List <Polygon> outerPolygons, ref List <Polygon> innerPolygons)
        {
            var newOuterPolygons = new List <Polygon>();

            foreach (var outerPolygon in outerPolygons)
            {
                var currentInnerPolygons = innerPolygons.Where(p => p.Within(outerPolygon)).ToArray();
                var holes = currentInnerPolygons.Select(p => _geometryFactory.CreateLinearRing(p.Coordinates)).ToArray();
                innerPolygons = innerPolygons.Except(currentInnerPolygons).ToList();
                newOuterPolygons.Add(_geometryFactory.CreatePolygon(_geometryFactory.CreateLinearRing(outerPolygon.Coordinates), holes));
            }
            outerPolygons = newOuterPolygons;
        }
Beispiel #5
0
 public void TestUnclosedLinearRing()
 {
     try
     {
         geometryFactory.CreateLinearRing(new Coordinate[] {
             new Coordinate(0, 0), new Coordinate(1, 0), new Coordinate(1, 1), new Coordinate(2, 1)
         });
         Assert.IsTrue(false);
     }
     catch (Exception e)
     {
         Assert.IsTrue(e is ArgumentException);
     }
 }
Beispiel #6
0
        public void TestWritePolygon()
        {
            Coordinate[] coordinates =
            {
                new CoordinateZ(10, 10, 0),
                new CoordinateZ(10, 20, 0),
                new CoordinateZ(20, 20, 0),
                new CoordinateZ(20, 15, 0),
                new CoordinateZ(10, 10, 0)
            };
            var linearRing = _factory.CreateLinearRing(coordinates);
            var polygon    = _factory.CreatePolygon(linearRing, new LinearRing[] { });

            Assert.AreEqual("POLYGON ((10 10, 10 20, 20 20, 20 15, 10 10))", _writer.Write(polygon));
        }
Beispiel #7
0
        static IPolygon ParseFlatbufPolygon(uint[] ends, double[] coords, byte dimensions)
        {
            if (ends == null)
            {
                return(ParseFlatbufPolygonSingleRing(coords, dimensions));
            }
            var  sequenceFactory = new PackedCoordinateSequenceFactory();
            var  factory         = new GeometryFactory(sequenceFactory);
            var  arraySegment    = new ArraySegment <double>(coords);
            var  linearRings     = new List <ILinearRing>();
            uint offset          = 0;

            for (var i = 0; i < ends.Length; i++)
            {
                var end        = ends[i] << 1;
                var ringCoords = coords.Skip((int)offset).Take((int)end).ToArray();
                var linearRing = factory.CreateLinearRing(sequenceFactory.Create(ringCoords, dimensions));
                linearRings.Add(linearRing);
                offset = end;
            }
            var shell = linearRings.First();
            var holes = linearRings.Skip(1).ToArray();

            return(factory.CreatePolygon(shell, holes));
        }
Beispiel #8
0
        private static IPolygon SqlGeometryToGeometryPolygon(SqlGeometry geometry, GeometryFactory factory)
        {
            ILinearRing exterior = factory.CreateLinearRing(GetPoints(geometry.STExteriorRing()));

            ILinearRing[] interior = null;
            if (geometry.STNumInteriorRing() > 0)
            {
                interior = new ILinearRing[geometry.STNumInteriorRing().Value];
                for (int i = 1; i <= interior.Length; i++)
                {
                    interior[i - 1] = factory.CreateLinearRing(GetPoints(geometry.STInteriorRingN(i)));
                }
            }

            return(factory.CreatePolygon(exterior, interior));
        }
        public override Polygon CreateGeometry(
            IType type,
            object?coordinates,
            int?crs)
        {
            if (type is null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            if (coordinates is List <Coordinate> list)
            {
                coordinates = list.Count == 0
                    ? Array.Empty <Coordinate>()
                    : list.ToArray();
            }

            if (coordinates is not Coordinate[] coords)
            {
                throw Serializer_Parse_CoordinatesIsInvalid(type);
            }

            if (crs is not null)
            {
                GeometryFactory factory =
                    NtsGeometryServices.Instance.CreateGeometryFactory(crs.Value);

                LinearRing ringSrid = factory.CreateLinearRing(coords);
                return(factory.CreatePolygon(ringSrid));
            }

            var ring = new LinearRing(coords);

            return(new Polygon(ring));
        }
Beispiel #10
0
        private IPolygon CreateSelectionPolygon(ICoordinate worldPosition)
        {
            if (MultiSelectionMode == MultiSelectionMode.Rectangle)
            {
                if (0 == Math.Abs(mouseDownLocation.X - worldPosition.X))
                {
                    return(null);
                }
                if (0 == Math.Abs(mouseDownLocation.Y - worldPosition.Y))
                {
                    return(null);
                }
                return(CreatePolygon(Math.Min(mouseDownLocation.X, worldPosition.X),
                                     Math.Max(mouseDownLocation.Y, worldPosition.Y),
                                     Math.Max(mouseDownLocation.X, worldPosition.X),
                                     Math.Min(mouseDownLocation.Y, worldPosition.Y)));
            }
            var vertices = new List <ICoordinate>();

            foreach (var point in selectPoints)
            {
                vertices.Add(Map.ImageToWorld(point));
            }
            if (vertices.Count == 1)
            {
                // too few points to create a polygon
                return(null);
            }
            vertices.Add((ICoordinate)worldPosition.Clone());
            vertices.Add((ICoordinate)vertices[0].Clone());
            ILinearRing newLinearRing = GeometryFactory.CreateLinearRing(vertices.ToArray());

            return(GeometryFactory.CreatePolygon(newLinearRing, null));
        }
Beispiel #11
0
        public Geometry GetGeometry(GeometryFactory fact)
        {
            var ring = fact.CreateLinearRing(GetCoordinates());
            var tri  = fact.CreatePolygon(ring);

            return(tri);
        }
        /// <summary>
        /// Gets the Voronoi cell around a site specified
        /// by the origin of a QuadEdge.
        /// </summary>
        /// <remarks>
        /// The userData of the polygon is set to be the <see cref="Coordinate" />
        /// of the site.  This allows attaching external
        /// data associated with the site to this cell polygon.
        /// </remarks>
        /// <param name="qe">a quadedge originating at the cell site</param>
        /// <param name="geomFact">a factory for building the polygon</param>
        /// <returns>a polygon indicating the cell extent</returns>
        public Polygon GetVoronoiCellPolygon(QuadEdge qe, GeometryFactory geomFact)
        {
            var cellPts = new List <Coordinate>();
            var startQE = qe;

            do
            {
                // Coordinate cc = circumcentre(qe);
                // use previously computed circumcentre
                var cc = qe.Rot.Orig.Coordinate;
                cellPts.Add(cc);

                // move to next triangle CW around vertex
                qe = qe.OPrev;
            } while (qe != startQE);

            var coordList = new CoordinateList();

            coordList.AddAll(cellPts, false);
            coordList.CloseRing();

            if (coordList.Count < 4)
            {
                Debug.WriteLine(coordList);
                coordList.Add(coordList[coordList.Count - 1], true);
            }

            var pts      = coordList.ToCoordinateArray();
            var cellPoly = geomFact.CreatePolygon(geomFact.CreateLinearRing(pts));

            var v = startQE.Orig;

            cellPoly.UserData = v.Coordinate;
            return(cellPoly);
        }
        /// <summary>
        /// Creates a linar ring from WKB.
        /// </summary>
        /// <returns></returns>
        private LinearRing CreateWKBLinearRing()
        {
            Coordinates coords = ReadCoordinates();

            //Create and return the linearring.
            return(_geometryFactory.CreateLinearRing(coords));
        }
Beispiel #14
0
        protected override void OnMouseDoubleClick(MouseEventArgs e)
        {
            if (map == null)
            {
                return;
            }

            foreach (var tool in tools.Where(tool => tool.IsActive))
            {
                tool.OnMouseDoubleClick(this, e);
            }
            // todo (TOOLS-1151) move implemention in mapView_MouseDoubleClick to SelectTool::OnMouseDoubleClick?
            if (SelectTool.IsActive)
            {
                base.OnMouseDoubleClick(e);
            }

            //NS, 2013-12-02, generate polygon coordinate
            if (drawPolygonTool.IsActive)
            {
                if (GeometryDefined != null)
                {
                    var cl = new GisSharpBlog.NetTopologySuite.Geometries.CoordinateList(drawPolygonTool.pointArray, false);
                    cl.CloseRing();
                    GeometryDefined(GeometryFactory.CreatePolygon(GeometryFactory.CreateLinearRing(GisSharpBlog.NetTopologySuite.Geometries.CoordinateArrays.AtLeastNCoordinatesOrNothing(4, cl.ToCoordinateArray())), null));
                    drawPolygonTool.pointArray = null;
                }
                ActivateTool(panZoomTool);
            }
        }
Beispiel #15
0
        /// <summary>
        /// Converts this referenced location to a geometry.
        /// </summary>
        /// <returns></returns>
        public FeatureCollection ToFeatures()
        {
            // create the geometry factory.
            var geometryFactory = new GeometryFactory();

            // create the feature collection.
            var featureCollection = new FeatureCollection();

            //// create a point feature at each point in the grid.
            //double lonDiff = (this.LowerLeftLongitude - this.UpperRightLongitude) / this.Columns;
            //double latDiff = (this.UpperRightLatitude - this.LowerLeftLatitude) / this.Rows;
            //for (int column = 0; column < this.Columns; column++)
            //{
            //    double longitude = this.LowerLeftLongitude - (column * lonDiff);
            //    for (int row = 0; row < this.Rows; row++)
            //    {
            //        double latitude = this.UpperRightLatitude - (row * latDiff);
            //        var point = geometryFactory.CreatePoint(new Coordinate(longitude, latitude));
            //        var pointAttributes = new AttributesTable();
            //        featureCollection.Add(new Feature(point, pointAttributes));
            //    }
            //}

            // create a lineair ring.
            var lineairRingAttributes = new AttributesTable();

            featureCollection.Add(new Feature(geometryFactory.CreateLinearRing(new Coordinate[] {
                new Coordinate(this.LowerLeftLongitude, this.LowerLeftLatitude),
                new Coordinate(this.LowerLeftLongitude, this.UpperRightLatitude),
                new Coordinate(this.UpperRightLongitude, this.UpperRightLatitude),
                new Coordinate(this.UpperRightLongitude, this.LowerLeftLatitude),
                new Coordinate(this.LowerLeftLongitude, this.LowerLeftLatitude)
            }), lineairRingAttributes));
            return(featureCollection);
        }
Beispiel #16
0
        private Polygon Poly1()
        {
            _coords1 = new Coordinates();
            Coordinate coord = new Coordinate(5, 1);

            _coords1.Add(coord);
            coord = new Coordinate(6, 2);
            _coords1.Add(coord);
            coord = new Coordinate(7, 3);
            _coords1.Add(coord);
            coord = new Coordinate(6, 4);
            _coords1.Add(coord);
            coord = new Coordinate(5, 5);
            _coords1.Add(coord);
            coord = new Coordinate(4, 4);
            _coords1.Add(coord);
            coord = new Coordinate(3, 3);
            _coords1.Add(coord);
            coord = new Coordinate(4, 2);
            _coords1.Add(coord);
            coord = new Coordinate(5, 1);
            _coords1.Add(coord);

            _gf        = new GeometryFactory(_precMod, _sRID);
            _exterior1 = _gf.CreateLinearRing(_coords1);
            Polygon polygon = _gf.CreatePolygon(_exterior1);

            return(polygon);
        }
Beispiel #17
0
        public IGeometry GetGeometry(GeometryFactory fact)
        {
            ILinearRing ring = fact.CreateLinearRing(GetCoordinates());
            IPolygon    tri  = fact.CreatePolygon(ring, null);

            return(tri);
        }
Beispiel #18
0
        private Geometry GetGeometryFromNodes(Node[] nodes)
        {
            var coordinates = nodes.Select(ConvertNode).ToArray();

            return(nodes.First().Id == nodes.Last().Id&& nodes.Length >= 4
                        ? _geometryFactory.CreatePolygon(_geometryFactory.CreateLinearRing(coordinates)) as Geometry
                        : _geometryFactory.CreateLineString(coordinates) as Geometry);
        }
        /// <summary>
        /// Function to read a either a <see cref="Polygon"/> or an <see cref="MultiPolygon"/> from a ShapeFile stream using the specified <paramref name="reader"/>.
        /// </summary>
        /// <param name="reader">The reader to use</param>
        /// <param name="ordinates">The ordinates to read</param>
        /// <returns>The read polygonal geometry</returns>
        protected Geometry ReadPolygon(BinaryReader reader, Ordinates ordinates)
        {
            /*var bbox = */ ReadBoundingBox(reader); // jump boundingbox

            int numParts  = ReadNumParts(reader);
            int numPoints = ReadNumPoints(reader);

            int[] indexParts = ReadIndexParts(reader, numParts, numPoints);

            var buffer = new CoordinateBuffer(numPoints, ShapeFileConstants.NoDataBorder, true);

            ReadCoordinates(reader, numPoints, indexParts, ordinates, buffer);

            return(numParts == 1
                ? _factory.CreatePolygon(_factory.CreateLinearRing(buffer.ToSequence()), null)
                : CreateSingleOrMultiPolygon(buffer));
        }
Beispiel #20
0
        static IPolygon ParseFlatbufPolygonSingleRing(double[] coords, byte dimensions)
        {
            var sequenceFactory = new PackedCoordinateSequenceFactory();
            var factory         = new GeometryFactory(sequenceFactory);
            var shell           = factory.CreateLinearRing(sequenceFactory.Create(coords, dimensions));

            return(factory.CreatePolygon(shell));
        }
        /// <summary>
        /// Transforms a <see cref="LinearRing"/>.
        /// <para/>
        /// The transformation of a <c>LinearRing</c> may result in a coordinate sequence
        /// which does not form a structurally valid ring (i.e. a degenerate ring of 3 or fewer points).
        /// In this case a <c>LineString</c> is returned.
        /// Subclasses may wish to override this method and check for this situation
        /// (e.g.a subclass may choose to eliminate degenerate linear rings)
        /// </summary>
        /// <param name="geom">The <c>LinearRing</c> to transform</param>
        /// <param name="parent">The parent geometry</param>
        /// <returns>
        /// A <c>LinearRing</c> if the transformation resulted in a structurally valid ring, otherwise,
        /// if the transformation caused the LinearRing to collapse to 3 or fewer points, a <c>LineString</c>
        /// </returns>
        protected virtual Geometry TransformLinearRing(LinearRing geom, Geometry parent)
        {
            var seq = TransformCoordinates(geom.CoordinateSequence, geom);

            if (seq == null)
            {
                return(Factory.CreateLinearRing((CoordinateSequence)null));
            }

            int seqSize = seq.Count;

            // ensure a valid LinearRing
            if (seqSize > 0 && seqSize < 4 && !_preserveType)
            {
                return(Factory.CreateLineString(seq));
            }
            return(Factory.CreateLinearRing(seq));
        }
        private Polygon CreatePolygon(JsonReader reader, List <object> list)
        {
            var shell = _factory.CreateLinearRing(CreateCoordinateArray(reader, (List <object>)list[0]));

            if (list.Count == 1)
            {
                return(_factory.CreatePolygon(shell));
            }

            var holes = new LinearRing[list.Count - 1];

            for (int i = 0; i < holes.Length; i++)
            {
                holes[i] = _factory.CreateLinearRing(CreateCoordinateArray(reader, (List <object>)list[i + 1]));
            }

            return(_factory.CreatePolygon(shell, holes));
        }
Beispiel #23
0
 /// <summary>
 /// Compute a LinearRing from the point list previously collected.
 /// Test if the ring is a hole (i.e. if it is CCW) and set the hole flag
 /// accordingly.
 /// </summary>
 public void ComputeRing()
 {
     if (m_objRing != null)
     {
         return;                 // don't compute more than once
     }
     m_objRing = geometryFactory.CreateLinearRing(pts);
     m_bIsHole = CGAlgorithms.IsCCW(m_objRing.Coordinates);
 }
Beispiel #24
0
 /// <summary>
 /// Transforms a <see cref="LinearRing"/>.
 /// </summary>
 /// <param name="r">LinearRing to transform</param>
 /// <param name="transform">MathTransform</param>
 /// <returns>Transformed LinearRing</returns>
 public static ILinearRing TransformLinearRing(ILinearRing r, IMathTransform transform)
 {
     try
     {
         List <ICoordinate> coords = ExtractCoordinates(r, transform);
         return(GeometryFactory.CreateLinearRing(coords.ToArray()));
     }
     catch { return(null); }
 }
Beispiel #25
0
 /// <summary>
 /// Compute a LinearRing from the point list previously collected.
 /// Test if the ring is a hole (i.e. if it is CCW) and set the hole flag
 /// accordingly.
 /// </summary>
 public void ComputeRing()
 {
     if (_ring != null)
     {
         return;                                // don't compute more than once
     }
     // create ring using geometry factory.
     _ring   = _geometryFactory.CreateLinearRing(_pts);
     _isHole = _cga.IsCCW(_ring.GetCoordinates());
 }         // public void ComputeRing()
        // Use ring to restore M values on geoms
        private ICollection <NetTopologySuite.Geometries.Geometry> restoreDim4(ICollection <NetTopologySuite.Geometries.Geometry> geoms, Dictionary <Coordinate, Double> map)
        {
            GeometryFactory factory = new GeometryFactory(
                new PackedCoordinateSequenceFactory(PackedCoordinateSequenceFactory.PackedType.Double));
            List <NetTopologySuite.Geometries.Geometry> result = new List <NetTopologySuite.Geometries.Geometry>();

            foreach (NetTopologySuite.Geometries.Geometry geom in geoms)
            {
                if (geom is Point)
                {
                    result.Add(factory.CreatePoint(restoreDim4(
                                                       ((Point)geom).CoordinateSequence, map)));
                }
                else if (geom is LineString)
                {
                    result.Add(factory.CreateLineString(restoreDim4(
                                                            ((LineString)geom).CoordinateSequence, map)));
                }
                else if (geom is Polygon)
                {
                    LinearRing outer = factory.CreateLinearRing(restoreDim4(
                                                                    ((Polygon)geom).ExteriorRing.CoordinateSequence, map));
                    LinearRing[] inner = new LinearRing[((Polygon)geom).NumInteriorRings];
                    for (int i = 0; i < ((Polygon)geom).NumInteriorRings; i++)
                    {
                        inner[i] = factory.CreateLinearRing(restoreDim4(
                                                                ((Polygon)geom).GetInteriorRingN(i).CoordinateSequence, map));
                    }
                    result.Add(factory.CreatePolygon(outer, inner));
                }
                else
                {
                    for (int i = 0; i < geom.NumGeometries; i++)
                    {
                        result.AddRange(restoreDim4(new List <NetTopologySuite.Geometries.Geometry>()
                        {
                            geom.GetGeometryN(i)
                        }, map));
                    }
                }
            }
            return(result);
        }
Beispiel #27
0
        /// <summary>
        /// Reads a polygon, returning a NTS polygon.
        /// </summary>
        protected virtual IPolygon Polygon(WktShapeParser.State state)
        {
            GeometryFactory geometryFactory = m_ctx.GeometryFactory;

            IList <Coordinate[]> coordinateSequenceList = CoordinateSequenceList(state);

            ILinearRing shell = geometryFactory.CreateLinearRing(coordinateSequenceList[0]);

            ILinearRing[] holes = null;
            if (coordinateSequenceList.Count > 1)
            {
                holes = new ILinearRing[coordinateSequenceList.Count - 1];
                for (int i = 1; i < coordinateSequenceList.Count; i++)
                {
                    holes[i - 1] = geometryFactory.CreateLinearRing(coordinateSequenceList[i]);
                }
            }
            return(geometryFactory.CreatePolygon(shell, holes));
        }
        private static LinearRing CreateWKBLinearRing(BinaryReader reader, WkbByteOrder byteOrder, GeometryFactory factory)
        {
            var points = new List <Coordinate>(ReadCoordinates(reader, byteOrder));

            if (!points[0].Equals2D(points[points.Count - 1]))
            {
                points.Add(new Coordinate(points[0]));
            }
            return(factory.CreateLinearRing(points.ToArray()));
        }
        private Geometry CreatePolygonal(CoordinateSequence[] sequences)
        {
            var polygons = new List <Polygon>();

            LinearRing shell = null;
            var        holes = new List <LinearRing>();

            for (int i = 0; i < sequences.Length; i++)
            {
                var ring = _factory.CreateLinearRing(sequences[i]);

                // Shell rings should be CW (https://docs.mapbox.com/vector-tiles/specification/#winding-order)
                if (!ring.IsCCW)
                {
                    if (shell != null)
                    {
                        polygons.Add(_factory.CreatePolygon(shell, holes.ToArray()));
                        holes.Clear();
                    }
                    shell = ring;
                }
                // Hole rings should be CCW https://docs.mapbox.com/vector-tiles/specification/#winding-order
                else
                {
                    if (shell == null)
                    {
                        if (sequences.Length == 1)
                        {
                            // WARNING: this is not according to the spec but tiles exists like this in the wild
                            // that are rendered just fine by other tools, we can ignore them if we want to but
                            // should not throw an exception. The solution preferred here is to just read them
                            // but reverse them so the user gets what they expect according to the spec.
                            shell = ring.Reverse() as LinearRing;
                        }
                        else
                        {
                            throw new InvalidOperationException("No shell defined.");
                        }
                    }
                    else
                    {
                        holes.Add(ring);
                    }
                }
            }

            polygons.Add(_factory.CreatePolygon(shell, holes.ToArray()));

            if (polygons.Count == 1)
            {
                return(polygons[0]);
            }

            return(_factory.CreateMultiPolygon(polygons.ToArray()));
        }
Beispiel #30
0
 /// <summary>
 /// Transforms a <see cref="NetTopologySuite.Geometries.LinearRing"/>.
 /// </summary>
 /// <param name="r">LinearRing to transform</param>
 /// <param name="transform">MathTransform</param>
 /// <param name="targetFactory">The factory to create the target geometry</param>
 /// <returns>Transformed LinearRing</returns>
 public static LinearRing TransformLinearRing(LinearRing r, MathTransform transform, GeometryFactory targetFactory)
 {
     try
     {
         return(targetFactory.CreateLinearRing(TransformCoordinates(r.Coordinates, transform)));
     }
     catch
     {
         return(null);
     }
 }