Search in sources :

Example 31 with InstanceCollection

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

the class MultiPolygonGeometryTest method testMultiPolygonGml2.

/**
 * Test multi polygon geometries read from a GML 2 file
 *
 * @throws Exception if an error occurs
 */
@Test
public void testMultiPolygonGml2() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml2.xsd").toURI(), getClass().getResource("/data/polygon/sample-multipolygon-gml2.xml").toURI());
    // one instance expected
    ResourceIterator<Instance> it = instances.iterator();
    try {
        // MultiPolygonProperty with LinearRings 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 32 with InstanceCollection

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

the class MultiSurfaceGeometryTest method testMultiSurfaceGml32_Grid.

/**
 * Test multi-surface geometries read from a GML 3.2 file. Geometry
 * coordinates will be moved to the universal grid
 *
 * @throws Exception if an error occurs
 */
@Test
public void testMultiSurfaceGml32_Grid() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/surface/sample-multisurface-gml32.xml").toURI(), gridConfig);
    // one instance expected
    ResourceIterator<Instance> it = instances.iterator();
    try {
        // SurfaceMember with LinearRings 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 33 with InstanceCollection

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

the class MultiSurfaceGeometryTest method testMultiSurfaceGml3_Grid.

/**
 * Test multi-surface geometries read from a GML 3 file. Geometry
 * coordinates will be moved to the universal grid
 *
 * @throws Exception if an error occurs
 */
@Test
public void testMultiSurfaceGml3_Grid() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml3.xsd").toURI(), getClass().getResource("/data/surface/sample-multisurface-gml3.xml").toURI(), gridConfig);
    // one instance expected
    ResourceIterator<Instance> it = instances.iterator();
    try {
        // SurfaceMember with LinearRings 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 34 with InstanceCollection

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

the class OrientableCurveGeometryTest method testorientableCurveGml32.

/**
 * Test orientable curve geometries read from a GML 3.2 file
 *
 * @throws Exception if an error occurs
 */
@Test
public void testorientableCurveGml32() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/curve/sample-orientablecurve-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, 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 35 with InstanceCollection

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

the class OrientableCurveGeometryTest method testorientableCurveGml32_Grid.

/**
 * Test orientable curve geometries read from a GML 3.2 file. Geometry
 * coordinates will be moved to the universal grid
 *
 * @throws Exception if an error occurs
 */
@Test
public void testorientableCurveGml32_Grid() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/curve/sample-orientablecurve-gml32.xml").toURI(), gridConfig);
    // 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, 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)

Aggregations

InstanceCollection (eu.esdihumboldt.hale.common.instance.model.InstanceCollection)151 Instance (eu.esdihumboldt.hale.common.instance.model.Instance)131 Test (org.junit.Test)116 AbstractHandlerTest (eu.esdihumboldt.hale.io.gml.geometry.handler.internal.AbstractHandlerTest)97 Schema (eu.esdihumboldt.hale.common.schema.model.Schema)17 TypeDefinition (eu.esdihumboldt.hale.common.schema.model.TypeDefinition)17 DefaultInstance (eu.esdihumboldt.hale.common.instance.model.impl.DefaultInstance)11 ArrayList (java.util.ArrayList)10 Geometry (com.vividsolutions.jts.geom.Geometry)9 MutableInstance (eu.esdihumboldt.hale.common.instance.model.MutableInstance)9 IOException (java.io.IOException)9 MultiPolygon (com.vividsolutions.jts.geom.MultiPolygon)8 Polygon (com.vividsolutions.jts.geom.Polygon)8 QName (javax.xml.namespace.QName)8 Coordinate (com.vividsolutions.jts.geom.Coordinate)7 IOReport (eu.esdihumboldt.hale.common.core.io.report.IOReport)7 DefaultInstanceCollection (eu.esdihumboldt.hale.common.instance.model.impl.DefaultInstanceCollection)7 IOProviderConfigurationException (eu.esdihumboldt.hale.common.core.io.IOProviderConfigurationException)6 IOMessageImpl (eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl)6 TypeFilter (eu.esdihumboldt.hale.common.instance.model.TypeFilter)6