Search in sources :

Example 6 with TimeSpan

use of de.micromata.opengis.kml.v_2_2_0.TimeSpan 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));
}
Also used : TimeSpan(de.micromata.opengis.kml.v_2_2_0.TimeSpan) Placemark(de.micromata.opengis.kml.v_2_2_0.Placemark) 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)

Example 7 with TimeSpan

use of de.micromata.opengis.kml.v_2_2_0.TimeSpan 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));
}
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)

Example 8 with TimeSpan

use of de.micromata.opengis.kml.v_2_2_0.TimeSpan 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));
}
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) Polygon(de.micromata.opengis.kml.v_2_2_0.Polygon) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Test(org.junit.Test)

Example 9 with TimeSpan

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

the class TestKMLTransformerImpl method testPerformDefaultTransformationPointLocation.

@Test
public void testPerformDefaultTransformationPointLocation() throws CatalogTransformerException {
    MetacardImpl metacard = createMockMetacard();
    metacard.setLocation(POINT_WKT);
    Placemark placemark = kmlTransformer.performDefaultTransformation(metacard, null);
    assertThat(placemark.getId(), is("Placemark-" + ID));
    assertThat(placemark.getName(), is(TITLE));
    assertThat(placemark.getStyleSelector().isEmpty(), is(true));
    assertThat(placemark.getStyleUrl(), nullValue());
    assertThat(placemark.getTimePrimitive(), instanceOf(TimeSpan.class));
    TimeSpan timeSpan = (TimeSpan) placemark.getTimePrimitive();
    assertThat(timeSpan.getBegin(), is(dateFormat.format(metacard.getEffectiveDate())));
    assertThat(placemark.getGeometry(), instanceOf(Point.class));
}
Also used : TimeSpan(de.micromata.opengis.kml.v_2_2_0.TimeSpan) Placemark(de.micromata.opengis.kml.v_2_2_0.Placemark) Point(de.micromata.opengis.kml.v_2_2_0.Point) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Test(org.junit.Test)

Example 10 with TimeSpan

use of de.micromata.opengis.kml.v_2_2_0.TimeSpan 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)16 Placemark (de.micromata.opengis.kml.v_2_2_0.Placemark)16 TimeSpan (de.micromata.opengis.kml.v_2_2_0.TimeSpan)16 Point (de.micromata.opengis.kml.v_2_2_0.Point)14 Test (org.junit.Test)14 MultiGeometry (de.micromata.opengis.kml.v_2_2_0.MultiGeometry)12 LineString (de.micromata.opengis.kml.v_2_2_0.LineString)6 Polygon (de.micromata.opengis.kml.v_2_2_0.Polygon)6 Handlebars (com.github.jknack.handlebars.Handlebars)2 Template (com.github.jknack.handlebars.Template)2 IOException (java.io.IOException)2 DateFormat (java.text.DateFormat)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 LineString (com.vividsolutions.jts.geom.LineString)1