TileMap* TileMap::create(const TileSource* tileSource, const Profile* profile) { TileMap* tileMap = new TileMap(); tileMap->setTitle( tileSource->getName() ); tileMap->setProfileType( profile->getProfileType() ); const GeoExtent& ex = profile->getExtent(); tileMap->_srs = getHorizSRSString(profile->getSRS()); //srs(); tileMap->_vsrs = profile->getSRS()->getVertInitString(); //profile->getVerticalSRS() ? profile->getVerticalSRS()->getInitString() : 0L; tileMap->_originX = ex.xMin(); tileMap->_originY = ex.yMin(); tileMap->_minX = ex.xMin(); tileMap->_minY = ex.yMin(); tileMap->_maxX = ex.xMax(); tileMap->_maxY = ex.yMax(); profile->getNumTiles( 0, tileMap->_numTilesWide, tileMap->_numTilesHigh ); tileMap->_format.setWidth( tileSource->getPixelsPerTile() ); tileMap->_format.setHeight( tileSource->getPixelsPerTile() ); tileMap->_format.setExtension( tileSource->getExtension() ); tileMap->generateTileSets(); return tileMap; }
TileMap* TileMap::create(const std::string& url, const Profile* profile, const std::string& format, int tile_width, int tile_height) { //Profile profile(type); const GeoExtent& ex = profile->getExtent(); TileMap* tileMap = new TileMap(); tileMap->setProfileType(profile->getProfileType()); //type); tileMap->setExtents(ex.xMin(), ex.yMin(), ex.xMax(), ex.yMax()); tileMap->setOrigin(ex.xMin(), ex.yMin()); tileMap->_filename = url; tileMap->_srs = getHorizSRSString(profile->getSRS()); tileMap->_vsrs = profile->getSRS()->getVertInitString(); //tileMap->_vsrs = profile->getVerticalSRS() ? profile->getVerticalSRS()->getInitString() : ""; tileMap->_format.setWidth( tile_width ); tileMap->_format.setHeight( tile_height ); tileMap->_format.setExtension( format ); profile->getNumTiles( 0, tileMap->_numTilesWide, tileMap->_numTilesHigh ); tileMap->generateTileSets(); tileMap->computeMinMaxLevel(); return tileMap; }
TileMap* TileMap::create(const std::string& url, const Profile* profile, const DataExtentList& dataExtents, const std::string& format, int tile_width, int tile_height) { const GeoExtent& ex = profile->getExtent(); TileMap* tileMap = new TileMap(); tileMap->setProfileType(profile->getProfileType()); tileMap->setExtents(ex.xMin(), ex.yMin(), ex.xMax(), ex.yMax()); tileMap->setOrigin(ex.xMin(), ex.yMin()); tileMap->_filename = url; tileMap->_srs = getHorizSRSString(profile->getSRS()); tileMap->_vsrs = profile->getSRS()->getVertInitString(); tileMap->_format.setWidth( tile_width ); tileMap->_format.setHeight( tile_height ); profile->getNumTiles( 0, tileMap->_numTilesWide, tileMap->_numTilesHigh ); // format can be a mime-type or an extension: std::string::size_type p = format.find('/'); if ( p == std::string::npos ) { tileMap->_format.setExtension(format); tileMap->_format.setMimeType( Registry::instance()->getMimeTypeForExtension(format) ); } else { tileMap->_format.setMimeType(format); tileMap->_format.setExtension( Registry::instance()->getExtensionForMimeType(format) ); } //Add the data extents tileMap->getDataExtents().insert(tileMap->getDataExtents().end(), dataExtents.begin(), dataExtents.end()); // If we have some data extents specified then make a nicer bounds than the if (!tileMap->getDataExtents().empty()) { // Get the union of all the extents GeoExtent e(tileMap->getDataExtents()[0]); for (unsigned int i = 1; i < tileMap->getDataExtents().size(); i++) { e.expandToInclude(tileMap->getDataExtents()[i]); } // Convert the bounds to the output profile GeoExtent bounds = e.transform(profile->getSRS()); tileMap->setExtents(bounds.xMin(), bounds.yMin(), bounds.xMax(), bounds.yMax()); } tileMap->generateTileSets(); tileMap->computeMinMaxLevel(); return tileMap; }
TileMap* TileMap::create(const std::string& url, const Profile* profile, const std::string& format, int tile_width, int tile_height) { const GeoExtent& ex = profile->getExtent(); TileMap* tileMap = new TileMap(); tileMap->setProfileType(profile->getProfileType()); tileMap->setExtents(ex.xMin(), ex.yMin(), ex.xMax(), ex.yMax()); tileMap->setOrigin(ex.xMin(), ex.yMin()); tileMap->_filename = url; tileMap->_srs = getHorizSRSString(profile->getSRS()); tileMap->_vsrs = profile->getSRS()->getVertInitString(); tileMap->_format.setWidth( tile_width ); tileMap->_format.setHeight( tile_height ); profile->getNumTiles( 0, tileMap->_numTilesWide, tileMap->_numTilesHigh ); // format can be a mime-type or an extension: std::string::size_type p = format.find('/'); if ( p == std::string::npos ) { tileMap->_format.setExtension(format); tileMap->_format.setMimeType( Registry::instance()->getMimeTypeForExtension(format) ); } else { tileMap->_format.setMimeType(format); tileMap->_format.setExtension( Registry::instance()->getExtensionForMimeType(format) ); } tileMap->generateTileSets(); tileMap->computeMinMaxLevel(); return tileMap; }