Esempio n. 1
0
        public void Parse_ParsesEmptyPoint()
        {
            string wkt = "point empty";

            Point parsed = WktReader.Parse <Point>(wkt);

            this.CompareCoordinate(Coordinate.Empty, parsed.Position);
        }
Esempio n. 2
0
        public void Parse_ParsesEmptyMultiPolygon()
        {
            string wkt = "multipolygon empty";

            MultiPolygon parsed = WktReader.Parse <MultiPolygon>(wkt);

            Assert.NotNull(parsed);
            Assert.Empty(parsed.Geometries);
        }
Esempio n. 3
0
        public void Parse_Parses3DMeasuredLineString()
        {
            string wkt = "linestring zm (-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5)";

            LineString parsed = WktReader.Parse <LineString>(wkt);

            Assert.NotNull(parsed);
            this.CompareCoordinates(_coordinatesXYZM, parsed.Coordinates);
        }
Esempio n. 4
0
        public void Parse_Parses2DLineString()
        {
            string wkt = "linestring (-10.1 15.5, 20.2 -25.5, 30.3 35.5)";

            LineString parsed = WktReader.Parse <LineString>(wkt);

            Assert.NotNull(parsed);
            this.CompareCoordinates(_coordinatesXY, parsed.Coordinates);
        }
Esempio n. 5
0
        public void Parse_ParsesEmptyLineString()
        {
            string wkt = "linestring empty";

            LineString parsed = WktReader.Parse <LineString>(wkt);

            Assert.NotNull(parsed);
            Assert.Empty(parsed.Coordinates);
        }
Esempio n. 6
0
        public void Parse_ParsesEmptyGeometryCollection()
        {
            string wkt = "geometrycollection empty";

            GeometryCollection <Geometry> parsed = WktReader.Parse <GeometryCollection <Geometry> >(wkt);

            Assert.NotNull(parsed);
            Assert.Empty(parsed.Geometries);
        }
Esempio n. 7
0
        public void Parse_Parses3DMeasuredPoint()
        {
            string wkt = "point zm (-10.1 15.5 100.5 1000.5)";

            Point parsed = WktReader.Parse <Point>(wkt);

            Assert.NotNull(parsed);
            this.CompareCoordinate(_coordinatesXYZM[0], parsed.Position);
        }
Esempio n. 8
0
        public void Parse_ParsesMultiPoint()
        {
            string wkt = "multipoint empty";

            MultiPoint parsed = (MultiPoint)WktReader.Parse(wkt);

            Assert.NotNull(parsed);
            Assert.Empty(parsed.Geometries);
        }
Esempio n. 9
0
        public void Parse_ParsesPolygon()
        {
            string wkt = "polygon empty";

            Polygon parsed = (Polygon)WktReader.Parse(wkt);

            Assert.NotNull(parsed);
            Assert.Empty(parsed.ExteriorRing);
        }
Esempio n. 10
0
        public void Parse_ParsesEmptyMultiLineString()
        {
            string wkt = "multilinestring empty";

            MultiLineString parsed = WktReader.Parse <MultiLineString>(wkt);

            Assert.NotNull(parsed);
            Assert.Empty(parsed.Geometries);
        }
Esempio n. 11
0
        public void ParsePolygon_Parses3DMeasuredPolygonOnlyExteriorRing()
        {
            string wkt = "polygon zm ((-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5))";

            Polygon parsed = WktReader.Parse <Polygon>(wkt);

            Assert.NotNull(parsed);
            this.CompareCoordinates(_coordinatesXYZM, parsed.ExteriorRing);
            Assert.Empty(parsed.InteriorRings);
        }
Esempio n. 12
0
        public void ParsePolygon_ParsesEmptyPolygon()
        {
            string wkt = "polygon empty";

            Polygon parsed = WktReader.Parse <Polygon>(wkt);

            Assert.NotNull(parsed);
            Assert.Empty(parsed.ExteriorRing);
            Assert.Empty(parsed.InteriorRings);
        }
Esempio n. 13
0
        public void Parse_Parses2DPoint()
        {
            string wkt = "point (-10.1 15.5)";

            Point parsed = WktReader.Parse <Point>(wkt);

            Assert.False(parsed.Is3D);
            Assert.False(parsed.IsMeasured);
            this.CompareCoordinate(_coordinatesXY[0], parsed.Position);
        }
Esempio n. 14
0
        public void Parse_Parses3DGeometryCollectionWithPoint()
        {
            string wkt = "geometrycollection z (point z (-10.1 15.5 100.5))";

            GeometryCollection <Geometry> parsed = WktReader.Parse <GeometryCollection <Geometry> >(wkt);

            Assert.NotNull(parsed);
            Assert.Equal(1, parsed.Geometries.Count);
            this.CompareCoordinate(_coordinatesXYZ[0], ((Point)parsed.Geometries[0]).Position);
        }
        public void IsInRing_ReturnsFalseIfPointIsOutsideRing()
        {
            string     wktRing = "linestring (0 0, 2 0, 1 1, 1 2, 0 0)";
            LineString ring    = WktReader.Parse <LineString>(wktRing);

            Coordinate         c      = new Coordinate(3, 0);
            Euclidean2DLocator target = new Euclidean2DLocator();

            Assert.False(target.IsInRing(c, ring.Coordinates));
        }
        public void IsInRing_ReturnsFalseIfPointIsInRingAndCYCoordinateIsSameAsVertexYCoordinate()
        {
            string     wktRing = "linestring (-1 -1, 1 -1, 1 0.5, 1 1, -1 1, -1 -1)";
            LineString ring    = WktReader.Parse <LineString>(wktRing);

            Coordinate         c      = new Coordinate(-2, 0.5);
            Euclidean2DLocator target = new Euclidean2DLocator();

            Assert.False(target.IsInRing(c, ring.Coordinates));
        }
        public void IsInRing_ReturnsTrueIfPointIsInSimpleRing()
        {
            string     wktRing = "linestring (-1 -1, 1 -1, 1 1, -1 1, -1 -1)";
            LineString ring    = WktReader.Parse <LineString>(wktRing);

            Coordinate         c      = new Coordinate(0.5, 0.5);
            Euclidean2DLocator target = new Euclidean2DLocator();

            Assert.True(target.IsInRing(c, ring.Coordinates));
        }
        public void IsInRing_ReturnsTrueIfPointIsInConcaveRing()
        {
            string     wktRing = "linestring (0 0, 2 0, 1 1, 1 2, 0 0)";
            LineString ring    = WktReader.Parse <LineString>(wktRing);

            Coordinate         c      = new Coordinate(1, 0.5);
            Euclidean2DLocator target = new Euclidean2DLocator();

            Assert.True(target.IsInRing(c, ring.Coordinates));
        }
Esempio n. 19
0
        public void Parse_Parses3DMeasuredGeometryCollectionWithPoint()
        {
            string wkt = "geometrycollection zm (point zm (-10.1 15.5 100.5 1000.5))";

            GeometryCollection <Geometry> parsed = WktReader.Parse <GeometryCollection <Geometry> >(wkt);

            Assert.NotNull(parsed);
            Assert.Single(parsed.Geometries);
            this.CompareCoordinate(_coordinatesXYZM[0], ((Point)parsed.Geometries[0]).Position);
        }
Esempio n. 20
0
        public void Parse_Parses3DMeasuredMultiPolygon()
        {
            string wkt = "multipolygon zm (((-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5)),((-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5)))";

            MultiPolygon parsed = WktReader.Parse <MultiPolygon>(wkt);

            Assert.NotNull(parsed);
            Assert.Equal(2, parsed.Geometries.Count);
            this.CompareCoordinates(_coordinatesXYZM, parsed.Geometries[0].ExteriorRing);
            this.CompareCoordinates(_coordinatesXYZM, parsed.Geometries[1].ExteriorRing);
        }
Esempio n. 21
0
        public void Parse_Parses3DMeasuredMultiLineString()
        {
            string wkt = "multilinestring zm ((-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5),(-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5))";

            MultiLineString parsed = WktReader.Parse <MultiLineString>(wkt);

            Assert.NotNull(parsed);
            Assert.Equal(2, parsed.Geometries.Count);
            this.CompareCoordinates(_coordinatesXYZM, parsed.Geometries[0].Coordinates);
            this.CompareCoordinates(_coordinatesXYZM, parsed.Geometries[1].Coordinates);
        }
Esempio n. 22
0
        public void Parse_Parses3DMeasuredMultiPoint()
        {
            string wkt = "multipoint zm ((-10.1 15.5 100.5 1000.5),(20.2 -25.5 200.5 2000.5))";

            MultiPoint parsed = WktReader.Parse <MultiPoint>(wkt);

            Assert.NotNull(parsed);
            Assert.Equal(2, parsed.Geometries.Count);
            this.CompareCoordinate(_coordinatesXYZM[0], parsed.Geometries[0].Position);
            this.CompareCoordinate(_coordinatesXYZM[1], parsed.Geometries[1].Position);
        }
Esempio n. 23
0
        public void Parse_ParsesNestedCollections()
        {
            string wkt = "geometrycollection (geometrycollection (point (-10.1 15.5)))";

            GeometryCollection <Geometry> parsed = WktReader.Parse <GeometryCollection <Geometry> >(wkt);

            Assert.NotNull(parsed);
            Assert.Single(parsed.Geometries);
            GeometryCollection <Geometry> nested = (GeometryCollection <Geometry>)parsed.Geometries[0];

            this.CompareCoordinate(_coordinatesXY[0], ((Point)nested.Geometries[0]).Position);
        }
Esempio n. 24
0
        public void Parse_ParsesCollectionWithPointLineStringAndPolygon()
        {
            string wkt = "geometrycollection (point (-10.1 15.5),linestring (-10.1 15.5, 20.2 -25.5, 30.3 35.5),polygon ((-10.1 15.5, 20.2 -25.5, 30.3 35.5)))";

            GeometryCollection <Geometry> parsed = WktReader.Parse <GeometryCollection <Geometry> >(wkt);

            Assert.NotNull(parsed);
            Assert.Equal(3, parsed.Geometries.Count);
            this.CompareCoordinate(_coordinatesXY[0], ((Point)parsed.Geometries[0]).Position);
            this.CompareCoordinates(_coordinatesXY, ((LineString)parsed.Geometries[1]).Coordinates);
            this.CompareCoordinates(_coordinatesXY, ((Polygon)parsed.Geometries[2]).ExteriorRing);
        }
Esempio n. 25
0
        public void ParsePolygon_Parses3DMeasuredPolygonWithInteriorRings()
        {
            string wkt = "polygon zm ((-10.1 15.5 100.5 1000.5, 20.2 -25.5 200.5 2000.5, 30.3 35.5 -300.5 -3000.5),(-1.1 1.5 10.5 100.5, 2.2 -2.5 20.5 200.5, 3.3 3.5 -30.5 -300.5),(-1.1 1.5 10.5 100.5, 2.2 -2.5 20.5 200.5, 3.3 3.5 -30.5 -300.5))";

            Polygon parsed = WktReader.Parse <Polygon>(wkt);

            Assert.NotNull(parsed);
            this.CompareCoordinates(_coordinatesXYZM, parsed.ExteriorRing);
            Assert.Equal(2, parsed.InteriorRings.Count);
            this.CompareCoordinates(_coordinates2XYZM, parsed.InteriorRings[0]);
            this.CompareCoordinates(_coordinates2XYZM, parsed.InteriorRings[1]);
        }
Esempio n. 26
0
 private Geometry ParseWKT(string wkt)
 {
     return(WktReader.Parse(wkt));
 }
Esempio n. 27
0
        public void Parse_ThrowsExceptionIfWktDoNotRepresentGeometryCollection()
        {
            string wkt = "point empty";

            Assert.Throws <WktParseException>(() => WktReader.Parse <GeometryCollection <Geometry> >(wkt));
        }
Esempio n. 28
0
        public void Parse_ThrowsExceptionIfWktDoNotRepresentPoint()
        {
            string wkt = "linestring empty";

            Assert.Throws <WktParseException>(() => WktReader.Parse <Point>(wkt));
        }
Esempio n. 29
0
        public void Parse_ThrowsExceptionIfWktDoNotRepresentMultiPolygon()
        {
            string wkt = "point empty";

            Assert.Throws <WktParseException>(() => WktReader.Parse <MultiPolygon>(wkt));
        }
Esempio n. 30
0
        public void Parse_ThrowsExceptionIfWktDoNotRepresentLineString()
        {
            string wkt = "point empty";

            Assert.Throws <WktParseException>(() => WktReader.Parse <LineString>(wkt));
        }