Search in sources :

Example 6 with MultiGeometry

use of de.micromata.opengis.kml.v_2_2_0.MultiGeometry in project ddf by codice.

the class TestKMLTransformerImpl method testPerformDefaultTransformationMultiLineStringLocation.

@Test
public void testPerformDefaultTransformationMultiLineStringLocation() throws CatalogTransformerException {
    MetacardImpl metacard = createMockMetacard();
    metacard.setLocation(MULTILINESTRING_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 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));
}
Also used : TimeSpan(de.micromata.opengis.kml.v_2_2_0.TimeSpan) Placemark(de.micromata.opengis.kml.v_2_2_0.Placemark) LineString(de.micromata.opengis.kml.v_2_2_0.LineString) MultiGeometry(de.micromata.opengis.kml.v_2_2_0.MultiGeometry) Point(de.micromata.opengis.kml.v_2_2_0.Point) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Test(org.junit.Test)

Aggregations

MetacardImpl (ddf.catalog.data.impl.MetacardImpl)6 MultiGeometry (de.micromata.opengis.kml.v_2_2_0.MultiGeometry)6 Placemark (de.micromata.opengis.kml.v_2_2_0.Placemark)6 Point (de.micromata.opengis.kml.v_2_2_0.Point)6 TimeSpan (de.micromata.opengis.kml.v_2_2_0.TimeSpan)6 Test (org.junit.Test)6 LineString (de.micromata.opengis.kml.v_2_2_0.LineString)3 Polygon (de.micromata.opengis.kml.v_2_2_0.Polygon)3