use of de.micromata.opengis.kml.v_2_2_0.Placemark in project ddf by codice.
the class KmlMarshallerTest method unmarshall.
@Test
public void unmarshall() {
final InputStream resourceAsStream = this.getClass().getResourceAsStream("/kmlPoint.kml");
final Kml kml = kmlMarshaller.unmarshal(resourceAsStream).get();
final Feature feature = kml.getFeature();
assertThat(feature.getName(), is("Simple placemark"));
}
use of de.micromata.opengis.kml.v_2_2_0.Placemark in project ddf by codice.
the class KmlMarshallerTest method marshall.
@Test
public void marshall() throws SAXException, IOException, XpathException {
Placemark placemark = new Placemark();
placemark.setName("a");
Kml kml = new Kml();
kml.setFeature(placemark);
final String kmlString = kmlMarshaller.marshal(kml);
assertXpathExists("/m:kml", kmlString);
assertXpathEvaluatesTo("a", "//m:Placemark/m:name", kmlString);
}
use of de.micromata.opengis.kml.v_2_2_0.Placemark in project ddf by codice.
the class KmlMarshallerTest method unmarshallEmptyStream.
@Test(expected = NoSuchElementException.class)
public void unmarshallEmptyStream() {
final ByteArrayInputStream inputStream = new ByteArrayInputStream("".getBytes(UTF_8));
final Kml kml = kmlMarshaller.unmarshal(inputStream).get();
final Feature feature = kml.getFeature();
assertThat(feature.getName(), is("Simple placemark"));
}
use of de.micromata.opengis.kml.v_2_2_0.Placemark in project ddf by codice.
the class KmlTransformations method encloseDoc.
/**
* Encapsulate the kml content (placemarks, etc.) with a style in a KML Document element. If
* either content or style are not null, they will be in the resulting Document
*
* @param kml
* @param style
* @param documentId which should be the metacard id
* @return KML DocumentType element with style and content
*/
public static Document encloseDoc(Placemark placemark, Style style, String documentId, String docName) {
Document document = KmlFactory.createDocument();
document.setId(documentId);
document.setOpen(true);
document.setName(docName);
if (style != null) {
document.getStyleSelector().add(style);
}
if (placemark != null) {
document.getFeature().add(placemark);
}
return document;
}
Aggregations