Search in sources :

Example 6 with LatLonBox

use of org.geotoolkit.data.kml.model.LatLonBox in project geotoolkit by Geomatys.

the class GroundOverlayTest method groundOverlayReadTest.

@Test
public void groundOverlayReadTest() throws IOException, XMLStreamException, KmlException, URISyntaxException {
    final KmlReader reader = new KmlReader();
    reader.setInput(new File(pathToTestFile));
    final Kml kmlObjects = reader.read();
    reader.dispose();
    final Feature groundOverlay = kmlObjects.getAbstractFeature();
    assertEquals(KmlModelConstants.TYPE_GROUND_OVERLAY, groundOverlay.getType());
    assertEquals("GroundOverlay.kml", groundOverlay.getPropertyValue(KmlConstants.TAG_NAME));
    assertEquals("7fffffff", KmlUtilities.toKmlColor((Color) groundOverlay.getPropertyValue(KmlConstants.TAG_COLOR)));
    assertEquals(1, groundOverlay.getPropertyValue(KmlConstants.TAG_DRAW_ORDER));
    final Icon icon = (Icon) groundOverlay.getPropertyValue(KmlConstants.TAG_ICON);
    assertEquals("http://www.google.com/intl/en/images/logo.gif", icon.getHref());
    assertEquals(RefreshMode.ON_INTERVAL, icon.getRefreshMode());
    assertEquals(86400, icon.getRefreshInterval(), DELTA);
    assertEquals(0.75, icon.getViewBoundScale(), DELTA);
    final LatLonBox latLonBox = (LatLonBox) groundOverlay.getPropertyValue(KmlConstants.TAG_LAT_LON_BOX);
    assertEquals(37.83234, latLonBox.getNorth(), DELTA);
    assertEquals(37.832122, latLonBox.getSouth(), DELTA);
    assertEquals(-122.373033, latLonBox.getEast(), DELTA);
    assertEquals(-122.373724, latLonBox.getWest(), DELTA);
    assertEquals(45, latLonBox.getRotation(), DELTA);
}
Also used : Color(java.awt.Color) KmlReader(org.geotoolkit.data.kml.xml.KmlReader) LatLonBox(org.geotoolkit.data.kml.model.LatLonBox) Kml(org.geotoolkit.data.kml.model.Kml) Icon(org.geotoolkit.data.kml.model.Icon) File(java.io.File) Feature(org.opengis.feature.Feature) Test(org.junit.Test)

Aggregations

Icon (org.geotoolkit.data.kml.model.Icon)6 LatLonBox (org.geotoolkit.data.kml.model.LatLonBox)6 Color (java.awt.Color)5 Feature (org.opengis.feature.Feature)5 File (java.io.File)4 Kml (org.geotoolkit.data.kml.model.Kml)4 Test (org.junit.Test)4 Extensions (org.geotoolkit.data.kml.model.Extensions)2 Link (org.geotoolkit.data.kml.model.Link)2 RefreshMode (org.geotoolkit.data.kml.model.RefreshMode)2 KmlReader (org.geotoolkit.data.kml.xml.KmlReader)2 KmlWriter (org.geotoolkit.data.kml.xml.KmlWriter)2 OutputStream (java.io.OutputStream)1 URI (java.net.URI)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 Entry (java.util.Map.Entry)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 GridCoverage (org.apache.sis.coverage.grid.GridCoverage)1 GridCoverageResource (org.apache.sis.storage.GridCoverageResource)1