use of de.micromata.opengis.kml.v_2_2_0.MultiGeometry in project ddf by codice.
the class TestKMLTransformerImpl method testPerformDefaultTransformationPolygonLocation.
@Test
public void testPerformDefaultTransformationPolygonLocation() throws CatalogTransformerException {
MetacardImpl metacard = createMockMetacard();
metacard.setLocation(POLYGON_WKT);
Placemark placemark = kmlTransformer.performDefaultTransformation(metacard, null);
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(Polygon.class));
}
use of de.micromata.opengis.kml.v_2_2_0.MultiGeometry in project ddf by codice.
the class TestKMLTransformerImpl method testPerformDefaultTransformationMultiPolygonLocation.
@Test
public void testPerformDefaultTransformationMultiPolygonLocation() throws CatalogTransformerException {
MetacardImpl metacard = createMockMetacard();
metacard.setLocation(MULTIPOLYGON_WKT);
Placemark placemark = kmlTransformer.performDefaultTransformation(metacard, null);
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 multiPolygon = (MultiGeometry) multiGeo.getGeometry().get(1);
assertThat(multiPolygon.getGeometry().size(), is(2));
assertThat(multiPolygon.getGeometry().get(0), instanceOf(Polygon.class));
assertThat(multiPolygon.getGeometry().get(1), instanceOf(Polygon.class));
}
use of de.micromata.opengis.kml.v_2_2_0.MultiGeometry in project ddf by codice.
the class TestKMLTransformerImpl method testPerformDefaultTransformationMultiPointLocation.
@Test
public void testPerformDefaultTransformationMultiPointLocation() throws CatalogTransformerException {
MetacardImpl metacard = createMockMetacard();
metacard.setLocation(MULTIPOINT_WKT);
Placemark placemark = kmlTransformer.performDefaultTransformation(metacard, null);
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 multiPoint = (MultiGeometry) multiGeo.getGeometry().get(1);
assertThat(multiPoint.getGeometry().size(), is(3));
assertThat(multiPoint.getGeometry().get(0), instanceOf(Point.class));
assertThat(multiPoint.getGeometry().get(1), instanceOf(Point.class));
assertThat(multiPoint.getGeometry().get(2), instanceOf(Point.class));
}
use of de.micromata.opengis.kml.v_2_2_0.MultiGeometry in project ddf by codice.
the class TestKMLTransformerImpl method testPerformDefaultTransformationLineStringLocation.
@Test
public void testPerformDefaultTransformationLineStringLocation() throws CatalogTransformerException {
MetacardImpl metacard = createMockMetacard();
metacard.setLocation(LINESTRING_WKT);
Placemark placemark = kmlTransformer.performDefaultTransformation(metacard, null);
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(LineString.class));
}
use of de.micromata.opengis.kml.v_2_2_0.MultiGeometry in project ddf by codice.
the class TestKMLTransformerImpl method testPerformDefaultTransformationGeometryCollectionLocation.
@Test
public void testPerformDefaultTransformationGeometryCollectionLocation() throws CatalogTransformerException {
MetacardImpl metacard = createMockMetacard();
metacard.setLocation(GEOMETRYCOLLECTION_WKT);
Placemark placemark = kmlTransformer.performDefaultTransformation(metacard, null);
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 multiGeo2 = (MultiGeometry) multiGeo.getGeometry().get(1);
assertThat(multiGeo2.getGeometry().size(), is(3));
assertThat(multiGeo2.getGeometry().get(0), instanceOf(Point.class));
assertThat(multiGeo2.getGeometry().get(1), instanceOf(LineString.class));
assertThat(multiGeo2.getGeometry().get(2), instanceOf(Polygon.class));
}
Aggregations