From 52ab14cb64147d7a030bd41fa03ca28aabc4c019 Mon Sep 17 00:00:00 2001 From: manuelaromero-guadaltel Date: Mon, 8 May 2023 10:15:25 +0200 Subject: [PATCH] Added validateLeftHandRightHandClockwiseOrientation() test Signed-off-by: manuelaromero-guadaltel --- .../validation/GmlGeometryValidatorTest.java | 45 +++++++++++++++++++ ...r_anticlockwise_interior_anticlockwise.gml | 13 ++++++ ...erior_anticlockwise_interior_clockwise.gml | 13 ++++++ ...erior_clockwise_interior_anticlockwise.gml | 13 ++++++ ..._exterior_clockwise_interior_clockwise.gml | 13 ++++++ ...r_anticlockwise_interior_anticlockwise.gml | 13 ++++++ ...erior_anticlockwise_interior_clockwise.gml | 13 ++++++ ...erior_clockwise_interior_anticlockwise.gml | 13 ++++++ ..._exterior_clockwise_interior_clockwise.gml | 13 ++++++ 9 files changed, 149 insertions(+) create mode 100644 deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_anticlockwise_interior_anticlockwise.gml create mode 100644 deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_anticlockwise_interior_clockwise.gml create mode 100644 deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_clockwise_interior_anticlockwise.gml create mode 100644 deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_clockwise_interior_clockwise.gml create mode 100644 deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_anticlockwise_interior_anticlockwise.gml create mode 100644 deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_anticlockwise_interior_clockwise.gml create mode 100644 deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_clockwise_interior_anticlockwise.gml create mode 100644 deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_clockwise_interior_clockwise.gml diff --git a/deegree-core/deegree-core-base/src/test/java/org/deegree/geometry/gml/validation/GmlGeometryValidatorTest.java b/deegree-core/deegree-core-base/src/test/java/org/deegree/geometry/gml/validation/GmlGeometryValidatorTest.java index 9917c74e91..0f40871824 100644 --- a/deegree-core/deegree-core-base/src/test/java/org/deegree/geometry/gml/validation/GmlGeometryValidatorTest.java +++ b/deegree-core/deegree-core-base/src/test/java/org/deegree/geometry/gml/validation/GmlGeometryValidatorTest.java @@ -110,6 +110,51 @@ public void validatePolygonExteriorClockwise() Assert.assertTrue( ( (InteriorRingOrientation) ( eventHandler.getEvents().get( 1 ).getEvent() ) ).isClockwise() ); Assert.assertTrue( ( (InteriorRingOrientation) ( eventHandler.getEvents().get( 2 ).getEvent() ) ).isClockwise() ); } + + @Test + public void validateLeftHandRightHandClockwiseOrientation() + throws XMLStreamException, UnknownCRSException, FactoryConfigurationError, IOException { + TestEventHandler eventHandler = validate( "invalid/LeftHanded_exterior_clockwise_interior_clockwise.gml" ); + assertEquals( 2, eventHandler.getEvents().size() ); + Assert.assertTrue( ( (ExteriorRingOrientation) ( eventHandler.getEvents().get( 0 ).getEvent() ) ).isExterior() ); + Assert.assertFalse( ( (InteriorRingOrientation) ( eventHandler.getEvents().get( 1 ).getEvent() ) ).isInterior() ); + + TestEventHandler eventHandler2 = validate( "invalid/LeftHanded_exterior_clockwise_interior_anticlockwise.gml" ); + assertEquals( 2, eventHandler2.getEvents().size() ); + Assert.assertTrue( ( (ExteriorRingOrientation) ( eventHandler2.getEvents().get( 0 ).getEvent() ) ).isExterior() ); + Assert.assertTrue( ( (InteriorRingOrientation) ( eventHandler2.getEvents().get( 1 ).getEvent() ) ).isInterior() ); + + TestEventHandler eventHandler3 = validate( "invalid/LeftHanded_exterior_anticlockwise_interior_clockwise.gml" ); + assertEquals( 2, eventHandler3.getEvents().size() ); + Assert.assertFalse( ( (ExteriorRingOrientation) ( eventHandler3.getEvents().get( 0 ).getEvent() ) ).isExterior() ); + Assert.assertFalse( ( (InteriorRingOrientation) ( eventHandler3.getEvents().get( 1 ).getEvent() ) ).isInterior() ); + + TestEventHandler eventHandler4 = validate( "invalid/LeftHanded_exterior_anticlockwise_interior_anticlockwise.gml" ); + assertEquals( 2, eventHandler4.getEvents().size() ); + Assert.assertFalse( ( (ExteriorRingOrientation) ( eventHandler4.getEvents().get( 0 ).getEvent() ) ).isExterior() ); + Assert.assertTrue( ( (InteriorRingOrientation) ( eventHandler4.getEvents().get( 1 ).getEvent() ) ).isInterior() ); + + TestEventHandler eventHandler5 = validate( "invalid/RightHanded_exterior_clockwise_interior_clockwise.gml" ); + assertEquals( 2, eventHandler5.getEvents().size() ); + Assert.assertFalse( ( (ExteriorRingOrientation) ( eventHandler5.getEvents().get( 0 ).getEvent() ) ).isExterior() ); + Assert.assertTrue( ( (InteriorRingOrientation) ( eventHandler5.getEvents().get( 1 ).getEvent() ) ).isInterior() ); + + TestEventHandler eventHandler6 = validate( "invalid/RightHanded_exterior_clockwise_interior_anticlockwise.gml" ); + assertEquals( 2, eventHandler6.getEvents().size() ); + Assert.assertFalse( ( (ExteriorRingOrientation) ( eventHandler6.getEvents().get( 0 ).getEvent() ) ).isExterior() ); + Assert.assertFalse( ( (InteriorRingOrientation) ( eventHandler6.getEvents().get( 1 ).getEvent() ) ).isInterior() ); + + TestEventHandler eventHandler7 = validate( "invalid/RightHanded_exterior_anticlockwise_interior_clockwise.gml" ); + assertEquals( 2, eventHandler7.getEvents().size() ); + Assert.assertTrue( ( (ExteriorRingOrientation) ( eventHandler7.getEvents().get( 0 ).getEvent() ) ).isExterior() ); + Assert.assertTrue( ( (InteriorRingOrientation) ( eventHandler7.getEvents().get( 1 ).getEvent() ) ).isInterior() ); + + TestEventHandler eventHandler8 = validate( "invalid/RightHanded_exterior_anticlockwise_interior_anticlockwise.gml" ); + assertEquals( 2, eventHandler8.getEvents().size() ); + Assert.assertTrue( ( (ExteriorRingOrientation) ( eventHandler8.getEvents().get( 0 ).getEvent() ) ).isExterior() ); + Assert.assertFalse( ( (InteriorRingOrientation) ( eventHandler8.getEvents().get( 1 ).getEvent() ) ).isInterior() ); + + } private TestEventHandler validate( String resourceName ) throws XMLStreamException, UnknownCRSException, FactoryConfigurationError, IOException { diff --git a/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_anticlockwise_interior_anticlockwise.gml b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_anticlockwise_interior_anticlockwise.gml new file mode 100644 index 0000000000..5107880a7c --- /dev/null +++ b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_anticlockwise_interior_anticlockwise.gml @@ -0,0 +1,13 @@ + + + + + 4570100 2886900 4570111 2886900 4570122 2886900 4570122 2886911 4570122 2886922 4570111 2886922 4570100 2886922 4570100 2886911 4570100 2886900 + + + + + 4570110 2886910 4570111 2886910 4570112 2886910 4570112 2886911 4570112 2886912 4570111 2886912 4570110 2886912 4570110 2886911 4570110 2886910 + + + diff --git a/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_anticlockwise_interior_clockwise.gml b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_anticlockwise_interior_clockwise.gml new file mode 100644 index 0000000000..ac3bf23760 --- /dev/null +++ b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_anticlockwise_interior_clockwise.gml @@ -0,0 +1,13 @@ + + + + + 4570100 2886900 4570111 2886900 4570122 2886900 4570122 2886911 4570122 2886922 4570111 2886922 4570100 2886922 4570100 2886911 4570100 2886900 + + + + + 4570110 2886910 4570110 2886911 4570110 2886912 4570111 2886912 4570112 2886912 4570112 2886911 4570112 2886910 4570111 2886910 4570110 2886910 + + + diff --git a/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_clockwise_interior_anticlockwise.gml b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_clockwise_interior_anticlockwise.gml new file mode 100644 index 0000000000..f274751123 --- /dev/null +++ b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_clockwise_interior_anticlockwise.gml @@ -0,0 +1,13 @@ + + + + + 4570100 2886900 4570100 2886911 4570100 2886922 4570111 2886922 4570122 2886922 4570122 2886911 4570122 2886900 4570111 2886900 4570100 2886900 + + + + + 4570110 2886910 4570111 2886910 4570112 2886910 4570112 2886911 4570112 2886912 4570111 2886912 4570110 2886912 4570110 2886911 4570110 2886910 + + + diff --git a/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_clockwise_interior_clockwise.gml b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_clockwise_interior_clockwise.gml new file mode 100644 index 0000000000..328e2070a1 --- /dev/null +++ b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/LeftHanded_exterior_clockwise_interior_clockwise.gml @@ -0,0 +1,13 @@ + + + + + 4570100 2886900 4570100 2886911 4570100 2886922 4570111 2886922 4570122 2886922 4570122 2886911 4570122 2886900 4570111 2886900 4570100 2886900 + + + + + 4570110 2886910 4570110 2886911 4570110 2886912 4570111 2886912 4570112 2886912 4570112 2886911 4570112 2886910 4570111 2886910 4570110 2886910 + + + diff --git a/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_anticlockwise_interior_anticlockwise.gml b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_anticlockwise_interior_anticlockwise.gml new file mode 100644 index 0000000000..e2298ed983 --- /dev/null +++ b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_anticlockwise_interior_anticlockwise.gml @@ -0,0 +1,13 @@ + + + + + 4570100 2886900 4570111 2886900 4570122 2886900 4570122 2886911 4570122 2886922 4570111 2886922 4570100 2886922 4570100 2886911 4570100 2886900 + + + + + 4570110 2886910 4570111 2886910 4570112 2886910 4570112 2886911 4570112 2886912 4570111 2886912 4570110 2886912 4570110 2886911 4570110 2886910 + + + diff --git a/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_anticlockwise_interior_clockwise.gml b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_anticlockwise_interior_clockwise.gml new file mode 100644 index 0000000000..76bfe07563 --- /dev/null +++ b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_anticlockwise_interior_clockwise.gml @@ -0,0 +1,13 @@ + + + + + 4570100 2886900 4570111 2886900 4570122 2886900 4570122 2886911 4570122 2886922 4570111 2886922 4570100 2886922 4570100 2886911 4570100 2886900 + + + + + 4570110 2886910 4570110 2886911 4570110 2886912 4570111 2886912 4570112 2886912 4570112 2886911 4570112 2886910 4570111 2886910 4570110 2886910 + + + diff --git a/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_clockwise_interior_anticlockwise.gml b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_clockwise_interior_anticlockwise.gml new file mode 100644 index 0000000000..31faacb126 --- /dev/null +++ b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_clockwise_interior_anticlockwise.gml @@ -0,0 +1,13 @@ + + + + + 4570100 2886900 4570100 2886911 4570100 2886922 4570111 2886922 4570122 2886922 4570122 2886911 4570122 2886900 4570111 2886900 4570100 2886900 + + + + + 4570110 2886910 4570111 2886910 4570112 2886910 4570112 2886911 4570112 2886912 4570111 2886912 4570110 2886912 4570110 2886911 4570110 2886910 + + + diff --git a/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_clockwise_interior_clockwise.gml b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_clockwise_interior_clockwise.gml new file mode 100644 index 0000000000..f54529fd09 --- /dev/null +++ b/deegree-core/deegree-core-base/src/test/resources/org/deegree/gml/misc/geometry/invalid/RightHanded_exterior_clockwise_interior_clockwise.gml @@ -0,0 +1,13 @@ + + + + + 4570100 2886900 4570100 2886911 4570100 2886922 4570111 2886922 4570122 2886922 4570122 2886911 4570122 2886900 4570111 2886900 4570100 2886900 + + + + + 4570110 2886910 4570110 2886911 4570110 2886912 4570111 2886912 4570112 2886912 4570112 2886911 4570112 2886910 4570111 2886910 4570110 2886910 + + +