osgEarth 2.1.1
|
Public Types | |
typedef std::vector< TileImage > | TileImageList |
Public Member Functions | |
ImageMosaic () | |
osg::Image * | createImage () |
TileImageList & | getImages () |
void | getExtents (double &minX, double &minY, double &maxX, double &maxY) |
Protected Member Functions | |
~ImageMosaic () | |
Protected Attributes | |
TileImageList | _images |
Utility class for extracting a single image from a collection of image tiles
Definition at line 58 of file ImageMosaic.
typedef std::vector<TileImage> osgEarth::ImageMosaic::TileImageList |
A list of GeoImages
Definition at line 66 of file ImageMosaic.
ImageMosaic::ImageMosaic | ( | ) |
Definition at line 42 of file ImageMosaic.cpp.
{ }
ImageMosaic::~ImageMosaic | ( | ) | [protected] |
Definition at line 46 of file ImageMosaic.cpp.
{ }
osg::Image * ImageMosaic::createImage | ( | ) |
Definition at line 67 of file ImageMosaic.cpp.
{ if (_images.size() == 0) { OE_NOTICE << "ImageMosaic has no images..." << std::endl; return 0; } unsigned int tileWidth = _images[0]._image->s(); unsigned int tileHeight = _images[0]._image->t(); //OE_NOTICE << "TileDim " << tileWidth << ", " << tileHeight << std::endl; unsigned int minTileX = _images[0]._tileX; unsigned int minTileY = _images[0]._tileY; unsigned int maxTileX = _images[0]._tileX; unsigned int maxTileY = _images[0]._tileY; //Compute the tile size. for (TileImageList::iterator i = _images.begin(); i != _images.end(); ++i) { if (i->_tileX < minTileX) minTileX = i->_tileX; if (i->_tileY < minTileY) minTileY = i->_tileY; if (i->_tileX > maxTileX) maxTileX = i->_tileX; if (i->_tileY > maxTileY) maxTileY = i->_tileY; } unsigned int tilesWide = maxTileX - minTileX + 1; unsigned int tilesHigh = maxTileY - minTileY + 1; unsigned int pixelsWide = tilesWide * tileWidth; unsigned int pixelsHigh = tilesHigh * tileHeight; osg::ref_ptr<osg::Image> image = new osg::Image; image->allocateImage(pixelsWide, pixelsHigh, 1, _images[0]._image->getPixelFormat(), _images[0]._image->getDataType()); image->setInternalTextureFormat(_images[0]._image->getInternalTextureFormat()); //Composite the incoming images into the master image for (TileImageList::iterator i = _images.begin(); i != _images.end(); ++i) { //Determine the indices in the master image for this image int dstX = (i->_tileX - minTileX) * tileWidth; int dstY = (maxTileY - i->_tileY) * tileHeight; ImageUtils::copyAsSubImage(i->getImage(), image.get(), dstX, dstY); } return image.release(); }
void ImageMosaic::getExtents | ( | double & | minX, |
double & | minY, | ||
double & | maxX, | ||
double & | maxY | ||
) |
Definition at line 50 of file ImageMosaic.cpp.
TileImageList& osgEarth::ImageMosaic::getImages | ( | ) | [inline] |
TileImageList osgEarth::ImageMosaic::_images [protected] |
Definition at line 76 of file ImageMosaic.