gov.nasa.worldwind.data.RasterServerConfiguration Maven / Gradle / Ivy
The newest version!
/*
* Copyright (C) 2015 United States Government as represented by the Administrator of the
* National Aeronautics and Space Administration.
* All Rights Reserved.
*/
package gov.nasa.worldwind.data;
import gov.nasa.worldwind.geom.Sector;
import gov.nasa.worldwind.util.*;
import gov.nasa.worldwind.util.xml.*;
import javax.xml.namespace.QName;
import javax.xml.stream.*;
import javax.xml.stream.events.XMLEvent;
import java.util.*;
/**
* Parses a raster server configuration document.
*
* @author tag
* @version $Id: RasterServerConfiguration.java 2813 2015-02-18 23:35:24Z tgaskins $
*/
public class RasterServerConfiguration extends AbstractXMLEventParser
{
protected static class Property extends AbstractXMLEventParser
{
public Property(String namespaceURI)
{
super(namespaceURI);
}
public String getName()
{
return (String) this.getField("name");
}
public String getValue()
{
return (String) this.getField("value");
}
}
protected static class RasterSector extends AbstractXMLEventParser
{
public RasterSector(String namespaceURI)
{
super(namespaceURI);
}
public Sector getSector()
{
AbstractXMLEventParser corner = (AbstractXMLEventParser) this.getField("SouthWest");
AbstractXMLEventParser latLon = (AbstractXMLEventParser) corner.getField("LatLon");
Double minLat = Double.valueOf((String) latLon.getField("latitude"));
Double minLon = Double.valueOf((String) latLon.getField("longitude"));
String units = (String) latLon.getField("units");
corner = (AbstractXMLEventParser) this.getField("NorthEast");
latLon = (AbstractXMLEventParser) corner.getField("LatLon");
Double maxLat = Double.valueOf((String) latLon.getField("latitude"));
Double maxLon = Double.valueOf((String) latLon.getField("longitude"));
if (units.equals("radians"))
return Sector.fromRadians(minLat, maxLat, minLon, maxLon);
else
return Sector.fromDegrees(minLat, maxLat, minLon, maxLon);
}
}
protected static class Corner extends AbstractXMLEventParser
{
public Corner(String namespaceURI)
{
super(namespaceURI);
}
}
public static class Source extends AbstractXMLEventParser
{
public Source(String namespaceURI)
{
super(namespaceURI);
}
public String getPath()
{
return (String) this.getField("path");
}
public String getType()
{
return (String) this.getField("type");
}
public Sector getSector()
{
return ((RasterSector) this.getField("Sector")).getSector();
}
}
protected static class Sources extends AbstractXMLEventParser
{
protected ArrayList
© 2015 - 2024 Weber Informatics LLC | Privacy Policy