Search in sources :

Example 21 with Instance

use of eu.esdihumboldt.hale.common.instance.model.Instance in project hale by halestudio.

the class CompositeCurveGeometryTest method testCompositeCurveGml32.

/**
 * Test composite curve geometries read from a GML 3.2 file
 *
 * @throws Exception if an error occurs
 */
@Test
public void testCompositeCurveGml32() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/curve/sample-compositecurve-gml32.xml").toURI());
    // one instances expected
    ResourceIterator<Instance> it = instances.iterator();
    try {
        // segments with LineStringSegment defined through coordinates
        assertTrue("First sample feature missing", it.hasNext());
        Instance instance = it.next();
        checkSingleGeometry(instance, checker);
    } finally {
        it.close();
    }
}
Also used : Instance(eu.esdihumboldt.hale.common.instance.model.Instance) InstanceCollection(eu.esdihumboldt.hale.common.instance.model.InstanceCollection) Test(org.junit.Test) AbstractHandlerTest(eu.esdihumboldt.hale.io.gml.geometry.handler.internal.AbstractHandlerTest)

Example 22 with Instance

use of eu.esdihumboldt.hale.common.instance.model.Instance in project hale by halestudio.

the class CompositeCurveGeometryTest method testCompositeCurveGml32_Grid.

/**
 * Test composite curve geometries read from a GML 3.2 file. Geometry
 * coordinates will be moved to universal grid
 *
 * @throws Exception if an error occurs
 */
@Test
public void testCompositeCurveGml32_Grid() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/curve/sample-compositecurve-gml32.xml").toURI(), gridConfig);
    // one instances expected
    ResourceIterator<Instance> it = instances.iterator();
    try {
        // segments with LineStringSegment defined through coordinates
        assertTrue("First sample feature missing", it.hasNext());
        Instance instance = it.next();
        checkSingleGeometry(instance, gridChecker);
    } finally {
        it.close();
    }
}
Also used : Instance(eu.esdihumboldt.hale.common.instance.model.Instance) InstanceCollection(eu.esdihumboldt.hale.common.instance.model.InstanceCollection) Test(org.junit.Test) AbstractHandlerTest(eu.esdihumboldt.hale.io.gml.geometry.handler.internal.AbstractHandlerTest)

Example 23 with Instance

use of eu.esdihumboldt.hale.common.instance.model.Instance in project hale by halestudio.

the class CompositeCurveGeometryTest method testCompositeCurveGml32_combined.

/**
 * Test composite curve geometries read from a GML 3.2 file
 *
 * @throws Exception if an error occurs
 */
@Test
public void testCompositeCurveGml32_combined() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/curve/sample-compositecurve-gml32_combined.xml").toURI());
    LineString combined = geomFactory.createLineString(new Coordinate[] { new Coordinate(0, 0), new Coordinate(1, 1), new Coordinate(2, 2), new Coordinate(3, 1), new Coordinate(4, 0), new Coordinate(5, -1), new Coordinate(6, 0), new Coordinate(7, 2), new Coordinate(8, 4) });
    // one instances expected
    ResourceIterator<Instance> it = instances.iterator();
    try {
        // segments with LineStringSegment defined through coordinates
        assertTrue("First sample feature missing", it.hasNext());
        Instance instance = it.next();
        checkSingleGeometry(instance, referenceChecker(combined));
    } finally {
        it.close();
    }
}
Also used : LineString(com.vividsolutions.jts.geom.LineString) MultiLineString(com.vividsolutions.jts.geom.MultiLineString) Coordinate(com.vividsolutions.jts.geom.Coordinate) Instance(eu.esdihumboldt.hale.common.instance.model.Instance) InstanceCollection(eu.esdihumboldt.hale.common.instance.model.InstanceCollection) Test(org.junit.Test) AbstractHandlerTest(eu.esdihumboldt.hale.io.gml.geometry.handler.internal.AbstractHandlerTest)

Example 24 with Instance

use of eu.esdihumboldt.hale.common.instance.model.Instance in project hale by halestudio.

the class CompositeSurfaceGeometryTest method testCompositeSurfaceGml31_Grid.

/**
 * Test composite surface geometries read from a GML 3.2 file Geometry
 * coordinates will be moved to universal grid
 *
 * @throws Exception if an error occurs
 */
@Test
@Ignore("Test case does not represent a valid composite surface")
public void testCompositeSurfaceGml31_Grid() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/surface/sample-compositesurface-gml32.xml").toURI(), gridConfig);
    // one instance expected
    ResourceIterator<Instance> it = instances.iterator();
    try {
        // CompositeCurveProperty with surfaceMembers defined through
        // PolygonPatch and Polygon
        assertTrue("First sample feature missing", it.hasNext());
        Instance instance = it.next();
        checkSingleGeometry(instance, gridChecker);
    } finally {
        it.close();
    }
}
Also used : Instance(eu.esdihumboldt.hale.common.instance.model.Instance) InstanceCollection(eu.esdihumboldt.hale.common.instance.model.InstanceCollection) Ignore(org.junit.Ignore) Test(org.junit.Test) AbstractHandlerTest(eu.esdihumboldt.hale.io.gml.geometry.handler.internal.AbstractHandlerTest)

Example 25 with Instance

use of eu.esdihumboldt.hale.common.instance.model.Instance in project hale by halestudio.

the class CurveGeometryTest method testCurveGml32.

/**
 * Test curve geometries read from a GML 3.2 file
 *
 * @throws Exception if an error occurs
 */
@Test
public void testCurveGml32() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/curve/sample-curve-gml32.xml").toURI());
    // twelve instances expected
    ResourceIterator<Instance> it = instances.iterator();
    try {
        // 1. segments with LineStringSegment defined through coordinates
        assertTrue("First sample feature missing", it.hasNext());
        Instance instance = it.next();
        checkSingleGeometry(instance, lineStringChecker);
        // 2. segments with LineStringSegment defined through posList
        assertTrue("Second sample feature missing", it.hasNext());
        instance = it.next();
        checkSingleGeometry(instance, lineStringChecker);
        // 3. segments with Arc defined through coordinates
        assertTrue("Third sample feature missing", it.hasNext());
        instance = it.next();
        // Arc handler added
        checkSingleGeometry(instance, arcChecker(arcByPoints, maxPositionalError));
        // 4. segments with ArcByBulge defined through coordinates
        assertTrue("Fourth sample feature missing", it.hasNext());
        instance = it.next();
        // FIXME this is not an accurate representation
        checkSingleGeometry(instance, lineStringChecker);
        // 5. segments with ArcByCenterPoint defined through coordinates
        assertTrue("Fifth sample feature missing", it.hasNext());
        instance = it.next();
        checkSingleGeometry(instance, arcChecker(arcByCenter, maxPositionalError));
        // 6. segments with ArcString defined through coordinates
        assertTrue("Sixth sample feature missing", it.hasNext());
        instance = it.next();
        // TODO more extensive check?
        checkSingleGeometry(instance, noCoordinatePairs());
        // 7. segments with ArcStringByBulge defined through coordinates
        assertTrue("Seventh sample feature missing", it.hasNext());
        instance = it.next();
        // FIXME this is not an accurate representation
        checkSingleGeometry(instance, lineStringChecker);
        // 8. segments with Bezier defined through coordinates
        assertTrue("Eigth sample feature missing", it.hasNext());
        instance = it.next();
        // FIXME this is not an accurate representation
        checkSingleGeometry(instance, lineStringChecker);
        // 9. segments with BSpline defined through coordinates
        assertTrue("Nineth sample feature missing", it.hasNext());
        instance = it.next();
        // FIXME this is not an accurate representation
        checkSingleGeometry(instance, lineStringChecker);
        // 10. segments with Circle defined through coordinates
        assertTrue("Tenth sample feature missing", it.hasNext());
        instance = it.next();
        checkSingleGeometry(instance, arcChecker(circleByPoints, maxPositionalError));
        // 11. segments with CircleByCenterPoint defined through coordinates
        assertTrue("Eleventh sample feature missing", it.hasNext());
        instance = it.next();
        checkSingleGeometry(instance, arcChecker(circleByCenter, maxPositionalError));
        // 12. segments with CubicSpline defined through coordinates
        assertTrue("Twelveth sample feature missing", it.hasNext());
        instance = it.next();
        // FIXME this is not an accurate representation
        checkSingleGeometry(instance, lineStringChecker);
        // 13. segments with Geodesic defined through posList
        assertTrue("Thirteenth sample feature missing", it.hasNext());
        instance = it.next();
        // FIXME this is not an accurate representation
        checkSingleGeometry(instance, lineStringChecker);
        // 14. segments with GeodesicString defined through posList
        assertTrue("Fourteenth sample feature missing", it.hasNext());
        instance = it.next();
        // FIXME this is not an accurate representation
        checkSingleGeometry(instance, lineStringChecker);
    } finally {
        it.close();
    }
}
Also used : Instance(eu.esdihumboldt.hale.common.instance.model.Instance) InstanceCollection(eu.esdihumboldt.hale.common.instance.model.InstanceCollection) Test(org.junit.Test) AbstractHandlerTest(eu.esdihumboldt.hale.io.gml.geometry.handler.internal.AbstractHandlerTest)

Aggregations

Instance (eu.esdihumboldt.hale.common.instance.model.Instance)203 InstanceCollection (eu.esdihumboldt.hale.common.instance.model.InstanceCollection)131 Test (org.junit.Test)122 AbstractHandlerTest (eu.esdihumboldt.hale.io.gml.geometry.handler.internal.AbstractHandlerTest)97 QName (javax.xml.namespace.QName)29 ArrayList (java.util.ArrayList)26 MutableInstance (eu.esdihumboldt.hale.common.instance.model.MutableInstance)25 DefaultInstance (eu.esdihumboldt.hale.common.instance.model.impl.DefaultInstance)23 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)22 Group (eu.esdihumboldt.hale.common.instance.model.Group)15 Schema (eu.esdihumboldt.hale.common.schema.model.Schema)13 Coordinate (com.vividsolutions.jts.geom.Coordinate)12 Geometry (com.vividsolutions.jts.geom.Geometry)12 FamilyInstance (eu.esdihumboldt.hale.common.instance.model.FamilyInstance)10 Polygon (com.vividsolutions.jts.geom.Polygon)9 MultiPolygon (com.vividsolutions.jts.geom.MultiPolygon)8 TransformationException (eu.esdihumboldt.hale.common.align.transformation.function.TransformationException)8 GeometryProperty (eu.esdihumboldt.hale.common.schema.geometry.GeometryProperty)8 HashSet (java.util.HashSet)8 Point (com.vividsolutions.jts.geom.Point)7