@@ -461,29 +461,32 @@ public void TestSTShiftLongitude()
461
461
{
462
462
using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
463
463
{
464
- const string ewkt1 = "SRID=4326;POINT(-118.58 38.38 10)" ;
465
- const string ewkt2 = "SRID=4326;POINT(241.42 38.38 10)" ;
464
+ const string Ewkt1 = "SRID=4326;POINT(-118.58 38.38 10)" ;
465
+ const string Ewkt2 = "SRID=4326;POINT(241.42 38.38 10)" ;
466
466
db . TestGeometries
467
467
. Value ( g => g . Id , 1 )
468
- . Value ( p => p . Geometry , ( ) => GeometryInput . STGeomFromEWKT ( ewkt1 ) )
468
+ . Value ( p => p . Geometry , ( ) => GeometryInput . STGeomFromEWKT ( Ewkt1 ) )
469
469
. Insert ( ) ;
470
470
db . TestGeometries
471
471
. Value ( g => g . Id , 2 )
472
- . Value ( p => p . Geometry , ( ) => GeometryInput . STGeomFromEWKT ( ewkt2 ) )
472
+ . Value ( p => p . Geometry , ( ) => GeometryInput . STGeomFromEWKT ( Ewkt2 ) )
473
473
. Insert ( ) ;
474
474
475
475
var result1 = db . TestGeometries
476
476
. Where ( g => g . Id == 1 )
477
- . Select ( g => g . Geometry . STShiftLongitude ( ) . STAsEWKT ( ) )
478
- . Single ( ) ;
477
+ . Select ( g => g . Geometry . STShiftLongitude ( ) )
478
+ . Single ( ) as NTSGS . Point ;
479
479
480
480
var result2 = db . TestGeometries
481
481
. Where ( g => g . Id == 2 )
482
- . Select ( g => g . Geometry . STShiftLongitude ( ) . STAsEWKT ( ) )
483
- . Single ( ) ;
482
+ . Select ( g => g . Geometry . STShiftLongitude ( ) )
483
+ . Single ( ) as NTSGS . Point ;
484
484
485
- Assert . AreEqual ( "SRID=4326;POINT(241.42 38.38 10)" , result1 ) ;
486
- Assert . AreEqual ( "SRID=4326;POINT(-118.58 38.38 10)" , result2 ) ;
485
+ Assert . AreEqual ( 241.42 , result1 . X , 1.0E-2 ) ;
486
+ Assert . AreEqual ( 38.38 , result1 . Y , 1.0E-2 ) ;
487
+
488
+ Assert . AreEqual ( - 118.58 , result2 . X , 1.0E-2 ) ;
489
+ Assert . AreEqual ( 38.38 , result2 . Y , 1.0E-2 ) ;
487
490
}
488
491
}
489
492
@@ -649,17 +652,23 @@ public void TestSTSetEffectiveArea()
649
652
650
653
var result1 = db . TestGeometries
651
654
. Where ( g => g . Id == 1 )
652
- . Select ( g => g . Geometry . STSetEffectiveArea ( ) . STAsText ( ) )
653
- . Single ( ) ;
655
+ . Select ( g => g . Geometry . STSetEffectiveArea ( ) )
656
+ . Single ( ) as NTSGS . LineString ;
654
657
655
- Assert . AreEqual ( "LINESTRING M (5 2 3.40282e+038,3 8 29,6 20 1.5,7 25 49.5,10 10 3.40282e+038)" , result1 ) ;
658
+ Assert . AreEqual ( 3.40282e+038 , result1 . Coordinates [ 0 ] . M , 0.00001E38 ) ;
659
+ Assert . AreEqual ( 29 , result1 . Coordinates [ 1 ] . M , 1.0E-3 ) ;
660
+ Assert . AreEqual ( 1.5 , result1 . Coordinates [ 2 ] . M , 1.0E-3 ) ;
661
+ Assert . AreEqual ( 49.5 , result1 . Coordinates [ 3 ] . M , 1.0E-3 ) ;
662
+ Assert . AreEqual ( 3.40282e+038 , result1 . Coordinates [ 4 ] . M , 0.00001E38 ) ;
656
663
657
664
var result2 = db . TestGeometries
658
665
. Where ( g => g . Id == 1 )
659
- . Select ( g => g . Geometry . STSetEffectiveArea ( 30 ) . STAsText ( ) )
660
- . Single ( ) ;
666
+ . Select ( g => g . Geometry . STSetEffectiveArea ( 30 ) )
667
+ . Single ( ) as NTSGS . LineString ;
661
668
662
- Assert . AreEqual ( "LINESTRING M (5 2 3.40282e+038,7 25 49.5,10 10 3.40282e+038)" , result2 ) ;
669
+ Assert . AreEqual ( 3.40282e+038 , result2 . Coordinates [ 0 ] . M , 0.00001E38 ) ;
670
+ Assert . AreEqual ( 49.5 , result2 . Coordinates [ 1 ] . M , 1.0E-3 ) ;
671
+ Assert . AreEqual ( 3.40282e+038 , result2 . Coordinates [ 2 ] . M , 0.00001E38 ) ;
663
672
}
664
673
}
665
674
@@ -734,18 +743,32 @@ public void TestSTVoronoiLines()
734
743
{
735
744
using ( var db = new PostGisTestDataConnection ( TestDatabaseConnectionString ) )
736
745
{
737
- const string wkt = "MULTIPOINT (50 30, 60 30, 100 100,10 150, 110 120)" ;
746
+ const string Wkt = "MULTIPOINT (50 30, 60 30, 100 100,10 150, 110 120)" ;
738
747
db . TestGeometries
739
748
. Value ( g => g . Id , 1 )
740
- . Value ( p => p . Geometry , ( ) => GeometryInput . STGeometryFromText ( wkt ) )
749
+ . Value ( p => p . Geometry , ( ) => GeometryInput . STGeometryFromText ( Wkt ) )
741
750
. Insert ( ) ;
742
751
743
752
var result = db . TestGeometries
744
- . Where ( g => g . Id == 1 )
745
- . Select ( g => g . Geometry . STVoronoiLines ( 30.0 ) . STAsText ( ) )
746
- . Single ( ) ;
753
+ . Select ( g => g . Geometry . STVoronoiLines ( 30.0 ) )
754
+ . Single ( ) as NTSGS . MultiLineString ;
755
+
756
+ Assert . AreEqual ( 3 , result . Geometries . Length ) ;
757
+
758
+ Assert . AreEqual ( 135.555555555556 , result . Geometries [ 0 ] . Coordinates [ 0 ] . X , 1.0E-12 ) ;
759
+ Assert . AreEqual ( 270 , result . Geometries [ 0 ] . Coordinates [ 0 ] . Y , 1.0E-12 ) ;
760
+ Assert . AreEqual ( 36.8181818181818 , result . Geometries [ 0 ] . Coordinates [ 1 ] . X , 1.0E-12 ) ;
761
+ Assert . AreEqual ( 92.2727272727273 , result . Geometries [ 0 ] . Coordinates [ 1 ] . Y , 1.0E-12 ) ;
762
+
763
+ Assert . AreEqual ( 36.8181818181818 , result . Geometries [ 1 ] . Coordinates [ 0 ] . X , 1.0E-12 ) ;
764
+ Assert . AreEqual ( 92.2727272727273 , result . Geometries [ 1 ] . Coordinates [ 0 ] . Y , 1.0E-12 ) ;
765
+ Assert . AreEqual ( - 110 , result . Geometries [ 1 ] . Coordinates [ 1 ] . X , 1.0E-12 ) ;
766
+ Assert . AreEqual ( 43.3333333333333 , result . Geometries [ 1 ] . Coordinates [ 1 ] . Y , 1.0E-12 ) ;
747
767
748
- Assert . AreEqual ( "MULTILINESTRING((135.555555555556 270,36.8181818181818 92.2727272727273),(36.8181818181818 92.2727272727273,-110 43.3333333333333),(230 -45.7142857142858,36.8181818181818 92.2727272727273))" , result ) ;
768
+ Assert . AreEqual ( 230 , result . Geometries [ 2 ] . Coordinates [ 0 ] . X , 1.0E-12 ) ;
769
+ Assert . AreEqual ( - 45.7142857142858 , result . Geometries [ 2 ] . Coordinates [ 0 ] . Y , 1.0E-12 ) ;
770
+ Assert . AreEqual ( 36.8181818181818 , result . Geometries [ 2 ] . Coordinates [ 1 ] . X , 1.0E-12 ) ;
771
+ Assert . AreEqual ( 92.2727272727273 , result . Geometries [ 2 ] . Coordinates [ 1 ] . Y , 1.0E-12 ) ;
749
772
}
750
773
}
751
774
0 commit comments