use of de.micromata.opengis.kml.v_2_2_0.Placemark in project ddf by codice.
the class KMLTransformerImplTest method testPerformDefaultTransformationMultiLineStringLocation.
@Test
public void testPerformDefaultTransformationMultiLineStringLocation() throws CatalogTransformerException {
MetacardImpl metacard = createMockMetacard();
metacard.setLocation(MULTILINESTRING_WKT);
Placemark placemark = kmlTransformer.performDefaultTransformation(metacard);
assertThat(placemark.getId(), is("Placemark-" + ID));
assertThat(placemark.getName(), is(TITLE));
assertThat(placemark.getTimePrimitive(), instanceOf(TimeSpan.class));
TimeSpan timeSpan = (TimeSpan) placemark.getTimePrimitive();
assertThat(timeSpan.getBegin(), is(dateFormat.format(metacard.getEffectiveDate())));
assertThat(placemark.getGeometry(), instanceOf(MultiGeometry.class));
MultiGeometry multiGeo = (MultiGeometry) placemark.getGeometry();
assertThat(multiGeo.getGeometry().size(), is(2));
assertThat(multiGeo.getGeometry().get(0), instanceOf(Point.class));
assertThat(multiGeo.getGeometry().get(1), instanceOf(MultiGeometry.class));
MultiGeometry multiLineString = (MultiGeometry) multiGeo.getGeometry().get(1);
assertThat(multiLineString.getGeometry().size(), is(2));
assertThat(multiLineString.getGeometry().get(0), instanceOf(LineString.class));
assertThat(multiLineString.getGeometry().get(1), instanceOf(LineString.class));
}
use of de.micromata.opengis.kml.v_2_2_0.Placemark in project ddf by codice.
the class KmlToJtsGeometryConverterTest method testConvertPointGeometry.
@Test
public void testConvertPointGeometry() {
InputStream stream = KmlToJtsGeometryConverterTest.class.getResourceAsStream("/kmlPoint.kml");
Kml kml = Kml.unmarshal(stream);
assertThat(kml, notNullValue());
Point kmlPoint = ((Point) ((Placemark) kml.getFeature()).getGeometry());
assertThat(kmlPoint, notNullValue());
org.locationtech.jts.geom.Geometry jtsGeometryPoint = KmlToJtsGeometryConverter.from(kmlPoint);
assertThat(jtsGeometryPoint, instanceOf(org.locationtech.jts.geom.Point.class));
assertSpecificGeometry(kmlPoint, jtsGeometryPoint);
}
use of de.micromata.opengis.kml.v_2_2_0.Placemark in project ddf by codice.
the class KmlToJtsGeometryConverterTest method testConvertPolygonGeometry.
@Test
public void testConvertPolygonGeometry() {
InputStream stream = KmlToJtsGeometryConverterTest.class.getResourceAsStream("/kmlPolygon.kml");
Kml kml = Kml.unmarshal(stream);
assertThat(kml, notNullValue());
Polygon kmlPolygon = ((Polygon) ((Placemark) kml.getFeature()).getGeometry());
assertThat(kmlPolygon, notNullValue());
org.locationtech.jts.geom.Geometry jtsGeometryPolygon = KmlToJtsGeometryConverter.from(kmlPolygon);
assertThat(jtsGeometryPolygon, instanceOf(org.locationtech.jts.geom.Polygon.class));
assertSpecificGeometry(kmlPolygon, jtsGeometryPolygon);
}
use of de.micromata.opengis.kml.v_2_2_0.Placemark in project ddf by codice.
the class KmlToJtsGeometryConverterTest method testConvertMultiGeometry.
@Test
public void testConvertMultiGeometry() {
InputStream stream = KmlToJtsGeometryConverterTest.class.getResourceAsStream("/kmlMultiGeometry.kml");
Kml kml = Kml.unmarshal(stream);
assertThat(kml, notNullValue());
MultiGeometry multiGeometry = ((MultiGeometry) ((Placemark) kml.getFeature()).getGeometry());
assertThat(multiGeometry, notNullValue());
org.locationtech.jts.geom.Geometry jtsGeometryCollectionGeometry = KmlToJtsGeometryConverter.from(multiGeometry);
assertThat(jtsGeometryCollectionGeometry, instanceOf(GeometryCollection.class));
assertSpecificGeometry(multiGeometry, jtsGeometryCollectionGeometry);
}
use of de.micromata.opengis.kml.v_2_2_0.Placemark in project ddf by codice.
the class KmlToJtsGeometryConverterTest method testConvertLinearRingGeometry.
@Test
public void testConvertLinearRingGeometry() {
InputStream stream = KmlToJtsGeometryConverterTest.class.getResourceAsStream("/kmlLinearRing.kml");
Kml kml = Kml.unmarshal(stream);
assertThat(kml, notNullValue());
LinearRing kmlLinearRing = ((LinearRing) ((Placemark) kml.getFeature()).getGeometry());
assertThat(kmlLinearRing, notNullValue());
org.locationtech.jts.geom.Geometry jtsGeometryLinearRing = KmlToJtsGeometryConverter.from(kmlLinearRing);
assertThat(jtsGeometryLinearRing, instanceOf(org.locationtech.jts.geom.LinearRing.class));
assertSpecificGeometry(kmlLinearRing, jtsGeometryLinearRing);
}
Aggregations