Search in sources :

Example 56 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType in project geotoolkit by Geomatys.

the class GeometrytoJTSTest method gmlPointToJTSTest3D.

@Test
public void gmlPointToJTSTest3D() throws Exception {
    Point expected = GF.createPoint(new Coordinate(0, 1, 1));
    expected.setSRID(2154);
    PointType gml = new PointType(new DirectPositionType(0.0, 1.0, 1.0));
    final Geometry result = GeometrytoJTS.toJTS(gml);
    Assert.assertEquals(expected, result);
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) DirectPositionType(org.geotoolkit.gml.xml.v321.DirectPositionType) Coordinate(org.locationtech.jts.geom.Coordinate) PointType(org.geotoolkit.gml.xml.v321.PointType) ArcByCenterPointType(org.geotoolkit.gml.xml.v321.ArcByCenterPointType) Point(org.locationtech.jts.geom.Point) Test(org.junit.Test)

Example 57 with DirectPositionType

use of org.geotoolkit.gml.xml.v311.DirectPositionType in project geotoolkit by Geomatys.

the class GeometrytoJTSTest method gmlEnvelopeToJTSTest2D.

@Test
public void gmlEnvelopeToJTSTest2D() throws Exception {
    final EnvelopeType env = new EnvelopeType(new DirectPositionType(2.0, 2.0), new DirectPositionType(4.0, 4.0), "EPSG:4326");
    final Geometry geom = GeometrytoJTS.toJTS(env);
    Coordinate[] expectedPoints = { new Coordinate(2.0, 2.0), new Coordinate(2.0, 4.0), new Coordinate(4.0, 4.0), new Coordinate(4.0, 2.0), new Coordinate(2.0, 2.0) };
    Assert.assertTrue(GF.createPolygon(expectedPoints).equalsTopo(geom));
}
Also used : Geometry(org.locationtech.jts.geom.Geometry) EnvelopeType(org.geotoolkit.gml.xml.v321.EnvelopeType) DirectPositionType(org.geotoolkit.gml.xml.v321.DirectPositionType) Coordinate(org.locationtech.jts.geom.Coordinate) Test(org.junit.Test)

Aggregations

DirectPositionType (org.geotoolkit.gml.xml.v311.DirectPositionType)24 ArrayList (java.util.ArrayList)14 PointType (org.geotoolkit.gml.xml.v311.PointType)14 Test (org.junit.Test)11 StringWriter (java.io.StringWriter)10 DirectPositionType (net.opengis.gml.v_3_1_1.DirectPositionType)10 DirectPositionType (org.geotoolkit.gml.xml.v321.DirectPositionType)10 EnvelopeType (org.geotoolkit.gml.xml.v311.EnvelopeType)9 StringReader (java.io.StringReader)8 JAXBElement (javax.xml.bind.JAXBElement)8 EnvelopeType (net.opengis.gml.v_3_1_1.EnvelopeType)7 Geometry (org.locationtech.jts.geom.Geometry)7 Coordinate (org.locationtech.jts.geom.Coordinate)6 BBOXType (net.opengis.filter.v_1_1_0.BBOXType)5 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)5 DirectPositionType (net.opengis.gml.x32.DirectPositionType)4 FeaturePropertyType (org.geotoolkit.gml.xml.v311.FeaturePropertyType)4 SamplingPointType (org.geotoolkit.sampling.xml.v100.SamplingPointType)4 FilterType (net.opengis.filter.v_1_1_0.FilterType)3 DirectPositionType (net.opengis.gml.v_3_2_1.DirectPositionType)3