osgEarth 2.1.1
Public Types | Public Member Functions | Private Attributes

TileService Class Reference

Inheritance diagram for TileService:
Collaboration diagram for TileService:

List of all members.

Public Types

typedef std::vector< TilePatternTilePatternList

Public Member Functions

 TileService ()
TilePatternListgetPatterns ()
const std::string & getName ()
void setName (const std::string &name)
const std::string & getTitle ()
void setTitle (const std::string &title)
const std::string & getAbstract ()
void setAbstract (const std::string &value)
const std::string & getVersion ()
void setVersion (const std::string &version)
const std::string & getAccessConstraints ()
void setAccessConstraints (const std::string &accessConstraints)
const osg::Vec2d & getDataMin ()
void setDataMin (const osg::Vec2d &min)
const osg::Vec2d & getDataMax ()
void setDataMax (const osg::Vec2d &max)
void getMatchingPatterns (const std::string &layers, const std::string &format, const std::string &styles, const std::string &srs, unsigned int imageWidth, unsigned int imageHeight, TilePatternList &out_patterns)
const osgEarth::ProfilecreateProfile (TilePatternList &patterns)

Private Attributes

std::string _name
std::string _title
std::string _abstract
std::string _version
std::string _accessConstraints
osg::Vec2d _dataMin
osg::Vec2d _dataMax
std::vector< TilePattern_patterns

Detailed Description

Definition at line 99 of file TileService.


Member Typedef Documentation

A list of TilePatterns

Definition at line 105 of file TileService.


Constructor & Destructor Documentation

TileService::TileService ( )

Definition at line 119 of file TileService.cpp.

                        :
_dataMin(-180, -90),
_dataMax(180, 90)
{
}

Member Function Documentation

const Profile * TileService::createProfile ( TilePatternList patterns)

Given a list of patterns with matching parameters, compute a Profile.

Definition at line 146 of file TileService.cpp.

{
    //Assume that all the values in the patterns are equal except for the bounding boxes
    const Profile* profile = NULL;

    if (patterns.size() > 0)
    {
      double maxWidth = -1;
      double maxHeight = -1;

      osg::Vec2d topLeftMin;
      osg::Vec2d topLeftMax;

      //Find the lowest resolution pattern.
      for (unsigned int i = 0; i < patterns.size(); ++i)
      {
          if (maxWidth < patterns[i].getTileWidth() &&
              maxHeight < patterns[i].getTileHeight())
          {
              maxWidth = patterns[i].getTileWidth();
              maxHeight = patterns[i].getTileHeight();

              topLeftMin = patterns[i].getTopLeftMin();
              topLeftMax = patterns[i].getTopLeftMax();
          }
      }

      double dataWidth = _dataMax.x() - _dataMin.x();
      double dataHeight = _dataMax.y() - _dataMin.y();

      double tileWidth = topLeftMax.x() - topLeftMin.x();
      double tileHeight = topLeftMax.y() - topLeftMin.y();

      unsigned int w = (unsigned int) ceil(dataWidth / tileWidth );
      unsigned int h = (unsigned int) ceil(dataHeight / tileHeight);

      double xmin = topLeftMin.x();
      double xmax = xmin + (double)w * tileWidth;
      double ymax = topLeftMax.y();
      double ymin = ymax - (double)h * tileHeight;
      
      profile = Profile::create( patterns[0].getSRS(), xmin, ymin, xmax, ymax, "", w, h);
    }

    return profile;
}
const std::string& TileService::getAbstract ( ) [inline]

Gets the abstract of this TileService

Definition at line 133 of file TileService.

{return _abstract;}
const std::string& TileService::getAccessConstraints ( ) [inline]

Gets the access constraints of this TileService

Definition at line 153 of file TileService.

const osg::Vec2d& TileService::getDataMax ( ) [inline]

Gets the upper right corner of the data bounding box.

Definition at line 173 of file TileService.

{return _dataMax;}
const osg::Vec2d& TileService::getDataMin ( ) [inline]

Gets the lower left corner of the data bounding box.

Definition at line 163 of file TileService.

{return _dataMin;}
void TileService::getMatchingPatterns ( const std::string &  layers,
const std::string &  format,
const std::string &  styles,
const std::string &  srs,
unsigned int  imageWidth,
unsigned int  imageHeight,
TilePatternList out_patterns 
)

Gets the TilePatterns from this TileService with the matching parameters.

Parameters:
layersThe WMS layers
formatThe WMS format
stylesThe WMS styles
srsThe spatial reference
imageWidthThe image width
imageHeightThe image height
patternsThe TilePatternList to populate with the matching TilePatterns.

Definition at line 125 of file TileService.cpp.

{
    out_patterns.clear();
    for (TilePatternList::iterator i = _patterns.begin(); i < _patterns.end(); ++i)
    {
        if (osgDB::equalCaseInsensitive(i->getLayers(), layers) &&
            osgDB::equalCaseInsensitive(i->getFormat(),format) &&
            osgDB::equalCaseInsensitive(i->getStyles(), styles) &&
            osgDB::equalCaseInsensitive(i->getSRS(), srs) &&
            (i->getImageWidth()  == (int)imageWidth) &&
            (i->getImageHeight() == (int)imageHeight))
        {
            out_patterns.push_back(*i);
        }
    }
}
const std::string& TileService::getName ( ) [inline]

Gets the name of this TileService

Definition at line 113 of file TileService.

{return _name;}
TilePatternList& TileService::getPatterns ( ) [inline]

Gets the TilePatterns defined in this TileService

Definition at line 108 of file TileService.

{return _patterns;}

Here is the caller graph for this function:

const std::string& TileService::getTitle ( ) [inline]

Gets the title of this TileService

Definition at line 123 of file TileService.

{return _title;}
const std::string& TileService::getVersion ( ) [inline]

Gets the version of this TileService

Definition at line 143 of file TileService.

{return _version;}
void TileService::setAbstract ( const std::string &  value) [inline]

Sets the abstract of this TileService

Definition at line 138 of file TileService.

{_abstract = value;}
void TileService::setAccessConstraints ( const std::string &  accessConstraints) [inline]

Sets the access constraints of this TileService

Definition at line 158 of file TileService.

{_accessConstraints = accessConstraints;}
void TileService::setDataMax ( const osg::Vec2d &  max) [inline]

Sets the upper right corner of the data bounding box.

Definition at line 178 of file TileService.

{_dataMax = max;}
void TileService::setDataMin ( const osg::Vec2d &  min) [inline]

Sets the lower left corner of the data bounding box

Definition at line 168 of file TileService.

{_dataMin = min;}
void TileService::setName ( const std::string &  name) [inline]

Sets the name of this TileService

Definition at line 118 of file TileService.

{_name = name;}
void TileService::setTitle ( const std::string &  title) [inline]

Sets the title of this TileService

Definition at line 128 of file TileService.

{_title = title;}
void TileService::setVersion ( const std::string &  version) [inline]

Sets the version of this TileService

Definition at line 148 of file TileService.

{_version = version;}

Member Data Documentation

std::string TileService::_abstract [private]

Definition at line 211 of file TileService.

std::string TileService::_accessConstraints [private]

Definition at line 213 of file TileService.

osg::Vec2d TileService::_dataMax [private]

Definition at line 216 of file TileService.

osg::Vec2d TileService::_dataMin [private]

Definition at line 215 of file TileService.

std::string TileService::_name [private]

Definition at line 209 of file TileService.

std::vector<TilePattern> TileService::_patterns [private]

Definition at line 218 of file TileService.

std::string TileService::_title [private]

Definition at line 210 of file TileService.

std::string TileService::_version [private]

Definition at line 212 of file TileService.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines