Search in sources :

Example 31 with Instance

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

the class MultiPointGeometryTest method testMultiPointGml32_Grid.

/**
 * Test multi point geometries read from a GML 32 file. Geometry coordinates
 * will be moved to the universal grid
 *
 * @throws Exception if an error occurs
 */
@Test
public void testMultiPointGml32_Grid() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml32.xsd").toURI(), getClass().getResource("/data/point/sample-multipoint-gml32.xml").toURI(), gridConfig);
    // three instances expected
    ResourceIterator<Instance> it = instances.iterator();
    try {
        // 1. MultiPointProperty with MultiPoint defined through pointMember
        // - coordinates
        assertTrue("First sample feature missing", it.hasNext());
        Instance instance = it.next();
        checkSingleGeometry(instance, gridChecker);
        // 2. MultiPointProperty with MultiPoint defined through pointMember
        // - coordinates
        assertTrue("Second sample feature missing", it.hasNext());
        instance = it.next();
        checkSingleGeometry(instance, gridChecker);
        // 3. MultiPointProperty with MultiPoint defined through
        // pointMembers - pos
        assertTrue("Third sample feature missing", it.hasNext());
        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 32 with Instance

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

the class MultiPointGeometryTest method testMultiPointGml31_Grid.

/**
 * Test multi point geometries read from a GML 31 file. Geometry coordinates
 * will be moved to the universal grid
 *
 * @throws Exception if an error occurs
 */
@Test
public void testMultiPointGml31_Grid() throws Exception {
    InstanceCollection instances = AbstractHandlerTest.loadXMLInstances(getClass().getResource("/data/gml/geom-gml31.xsd").toURI(), getClass().getResource("/data/point/sample-multipoint-gml31.xml").toURI(), gridConfig);
    // four instances expected
    ResourceIterator<Instance> it = instances.iterator();
    try {
        // 1. MultiPointProperty with MultiPoint defined through pointMember
        // - coordinates
        assertTrue("First sample feature missing", it.hasNext());
        Instance instance = it.next();
        checkSingleGeometry(instance, gridChecker);
        // 2. MultiPointProperty with MultiPoint defined through pointMember
        // - coordinates
        assertTrue("Second sample feature missing", it.hasNext());
        instance = it.next();
        checkSingleGeometry(instance, gridChecker);
        // 3. MultiPointProperty with MultiPoint defined through
        // pointMembers - coord
        assertTrue("Third sample feature missing", it.hasNext());
        instance = it.next();
        checkSingleGeometry(instance, gridChecker);
        // 4. MultiPointProperty with MultiPoint defined through
        // pointMembers - pos
        assertTrue("Fourth sample feature missing", it.hasNext());
        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 Instance

use of eu.esdihumboldt.hale.common.instance.model.Instance 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 34 with Instance

use of eu.esdihumboldt.hale.common.instance.model.Instance 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 35 with Instance

use of eu.esdihumboldt.hale.common.instance.model.Instance 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)

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