Esempio n. 1
0
        public void TestSTIsPolygonCCW()
        {
            const string Wkt = "POLYGON((0 0 1,5 0 1,0 5 1,0 0 1),(1 1 1,1 3 1,3 1 1,1 1 1))";

            using (var db = new PostGisTestDataConnection(TestDatabaseConnectionString))
            {
                db.TestGeometries
                .Value(g => g.Id, 1)
                .Value(g => g.Geometry, () => GeometryInput.STGeomFromText(Wkt))
                .Insert();

                var result1 = db.TestGeometries
                              .Where(g => g.Id == 1)
                              .Select(g => g.Geometry.STIsPolygonCCW())
                              .Single();

                Assert.IsTrue(result1.HasValue);
                Assert.IsTrue(result1);

                var result2 = db.TestGeometries
                              .Where(g => g.Id == 1)
                              .Select(g => GeometryAccessors.STIsPolygonCCW(g.Geometry.STAsText()))
                              .Single();

                Assert.IsTrue(result2.HasValue);
                Assert.IsTrue(result2);

                Assert.IsNull(db.Select(() => GeometryAccessors.STIsPolygonCCW((NTSG)null)));
            }
        }