|
osgEarth 2.1.1
|
#include <osgEarthUtil/WMS>#include <osgEarth/XmlUtils>#include <osgEarth/HTTPClient>#include <osgDB/FileNameUtils>#include <osgDB/FileUtils>
Include dependency graph for WMS.cpp:Go to the source code of this file.
Defines | |
| #define | ATTR_VERSION "version" |
| #define | ELEM_CAPABILITY "capability" |
| #define | ELEM_REQUEST "request" |
| #define | ELEM_ABSTRACT "abstract" |
| #define | ELEM_GETMAP "getmap" |
| #define | ELEM_FORMAT "format" |
| #define | ELEM_LAYER "layer" |
| #define | ELEM_NAME "name" |
| #define | ELEM_TITLE "title" |
| #define | ELEM_STYLE "style" |
| #define | ELEM_SRS "srs" |
| #define | ELEM_CRS "crs" |
| #define | ELEM_LATLONBOUNDINGBOX "latlonboundingbox" |
| #define | ELEM_BOUNDINGBOX "boundingbox" |
| #define | ATTR_MINX "minx" |
| #define | ATTR_MINY "miny" |
| #define | ATTR_MAXX "maxx" |
| #define | ATTR_MAXY "maxy" |
Functions | |
| static WMSLayer * | getLayerByName (const string &name, WMSLayer::LayerList &layers) |
| static void | readLayers (XmlElement *e, WMSLayer *parentLayer, WMSLayer::LayerList &layers) |
| static WMSLayer* getLayerByName | ( | const string & | name, |
| WMSLayer::LayerList & | layers | ||
| ) | [static] |
Definition at line 32 of file WMS.cpp.
{
for (WMSLayer::LayerList::iterator i = layers.begin(); i != layers.end(); ++i)
{
if (osgDB::equalCaseInsensitive(i->get()->getName(),name)) return i->get();
WMSLayer *l = getLayerByName(name, i->get()->getLayers());
if (l) return l;
}
return 0;
}
| static void readLayers | ( | XmlElement * | e, |
| WMSLayer * | parentLayer, | ||
| WMSLayer::LayerList & | layers | ||
| ) | [static] |
Definition at line 180 of file WMS.cpp.
{
XmlNodeList layerNodes = e->getSubElements( ELEM_LAYER );
for( XmlNodeList::const_iterator i = layerNodes.begin(); i != layerNodes.end(); i++ )
{
XmlElement* e_layer = static_cast<XmlElement*>( i->get() );
WMSLayer *layer = new WMSLayer;
layer->setName( e_layer->getSubElementText( ELEM_NAME ) );
layer->setTitle( e_layer->getSubElementText( ELEM_TITLE ) );
layer->setAbstract( e_layer->getSubElementText( ELEM_ABSTRACT ) );
//Read all the supported styles
XmlNodeList styles = e_layer->getSubElements( ELEM_STYLE );
for( XmlNodeList::const_iterator styleitr = styles.begin(); styleitr != styles.end(); styleitr++ )
{
XmlElement* e_style = static_cast<XmlElement*>( styleitr->get() );
string name = e_style->getSubElementText( ELEM_NAME );
string title = e_style->getSubElementText( ELEM_TITLE );
layer->getStyles().push_back(WMSStyle(name,title));
}
//Read all the supported SRS's
XmlNodeList spatialReferences = e_layer->getSubElements( ELEM_SRS );
for (XmlNodeList::const_iterator srsitr = spatialReferences.begin(); srsitr != spatialReferences.end(); ++srsitr)
{
string srs = static_cast<XmlElement*>( srsitr->get() )->getText();
layer->getSpatialReferences().push_back(srs);
}
//Read all the supported CRS's
spatialReferences = e_layer->getSubElements( ELEM_CRS );
for (XmlNodeList::const_iterator srsitr = spatialReferences.begin(); srsitr != spatialReferences.end(); ++srsitr)
{
string crs = static_cast<XmlElement*>( srsitr->get() )->getText();
layer->getSpatialReferences().push_back(crs);
}
osg::ref_ptr<XmlElement> e_bb = e_layer->getSubElement( ELEM_LATLONBOUNDINGBOX );
if (e_bb.valid())
{
double minX, minY, maxX, maxY;
minX = as<double>(e_bb->getAttr( ATTR_MINX ), 0);
minY = as<double>(e_bb->getAttr( ATTR_MINY ), 0);
maxX = as<double>(e_bb->getAttr( ATTR_MAXX ), 0);
maxY = as<double>(e_bb->getAttr( ATTR_MAXY ), 0);
layer->setLatLonExtents(minX, minY, maxX, maxY);
}
e_bb = e_layer->getSubElement( ELEM_BOUNDINGBOX );
if (e_bb.valid())
{
double minX, minY, maxX, maxY;
minX = as<double>(e_bb->getAttr( ATTR_MINX ), 0);
minY = as<double>(e_bb->getAttr( ATTR_MINY ), 0);
maxX = as<double>(e_bb->getAttr( ATTR_MAXX ), 0);
maxY = as<double>(e_bb->getAttr( ATTR_MAXY ), 0);
layer->setExtents(minX, minY, maxX, maxY);
}
//Add the layer to the list and set its parent layer
layers.push_back(layer);
layer->setParentLayer( parentLayer );
//Read any other layers that are in the layer node
readLayers( e_layer, layer, layer->getLayers());
}
}
Here is the call graph for this function:
1.7.3