|
osgEarth 2.1.1
|
Collaboration diagram for osgEarth::ImageLayerTileProcessor:Public Member Functions | |
| ImageLayerTileProcessor (const ImageLayerOptions &options=ImageLayerOptions()) | |
| void | init (const ImageLayerOptions &options, bool layerInTargetProfile) |
| void | process (osg::ref_ptr< osg::Image > &image) const |
Private Attributes | |
| ImageLayerOptions | _options |
| osg::Vec4f | _chromaKey |
| osg::ref_ptr< const osg::Image > | _noDataImage |
| bool | _layerInTargetProfile |
Internal utility class for post-processing image tiles that come from a TileSource
Definition at line 137 of file ImageLayer.
| ImageLayerTileProcessor::ImageLayerTileProcessor | ( | const ImageLayerOptions & | options = ImageLayerOptions() | ) |
Definition at line 151 of file ImageLayer.cpp.
{
init( options, false );
}
Here is the call graph for this function:| void ImageLayerTileProcessor::init | ( | const ImageLayerOptions & | options, |
| bool | layerInTargetProfile | ||
| ) |
Definition at line 157 of file ImageLayer.cpp.
{
_options = options;
_layerInTargetProfile = layerInTargetProfile;
if ( _layerInTargetProfile )
OE_DEBUG << LC << "Good, the layer and map have the same profile." << std::endl;
const osg::Vec4ub& ck= *_options.transparentColor();
_chromaKey.set( ck.r() / 255.0f, ck.g() / 255.0f, ck.b() / 255.0f, 1.0 );
if ( _options.noDataImageFilename().isSet() && !_options.noDataImageFilename()->empty() )
{
_noDataImage = URI(*_options.noDataImageFilename()).readImage();
if ( !_noDataImage.valid() )
{
OE_WARN << "Warning: Could not read nodata image from \"" << _options.noDataImageFilename().value() << "\"" << std::endl;
}
}
}
Here is the call graph for this function:
Here is the caller graph for this function:| void ImageLayerTileProcessor::process | ( | osg::ref_ptr< osg::Image > & | image | ) | const |
Definition at line 179 of file ImageLayer.cpp.
{
if ( !image.valid() )
return;
// Check to see if the image is the nodata image
if ( _noDataImage.valid() )
{
if (ImageUtils::areEquivalent(image.get(), _noDataImage.get()))
{
//OE_DEBUG << LC << "Found nodata" << std::endl;
image = 0L;
return;
}
}
// If this is a compressed image, uncompress it IF the image is not already in the
// target profile...becuase if it's not in the target profile, we will have to do
// some mosaicing...and we can't mosaic a compressed image.
if (!_layerInTargetProfile &&
ImageUtils::isCompressed(image.get()) &&
ImageUtils::canConvert(image.get(), GL_RGBA, GL_UNSIGNED_BYTE) )
{
image = ImageUtils::convertToRGBA8( image.get() );
}
// Apply a transparent color mask if one is specified
if ( _options.transparentColor().isSet() )
{
if ( !ImageUtils::hasAlphaChannel(image.get()) && ImageUtils::canConvert(image.get(), GL_RGBA, GL_UNSIGNED_BYTE) )
{
// if the image doesn't have an alpha channel, we must convert it to
// a format that does before continuing.
image = ImageUtils::convertToRGBA8( image.get() );
}
ImageUtils::PixelVisitor<ApplyChromaKey> applyChroma;
applyChroma._chromaKey = _chromaKey;
applyChroma.accept( image.get() );
}
// protected against multi threaded access. This is a requirement in sequential/preemptive mode,
// for example. This used to be in TextureCompositorTexArray::prepareImage.
// TODO: review whether this affects performance.
image->setDataVariance( osg::Object::DYNAMIC );
}
Here is the call graph for this function:osg::Vec4f osgEarth::ImageLayerTileProcessor::_chromaKey [private] |
Definition at line 148 of file ImageLayer.
bool osgEarth::ImageLayerTileProcessor::_layerInTargetProfile [private] |
Definition at line 150 of file ImageLayer.
osg::ref_ptr<const osg::Image> osgEarth::ImageLayerTileProcessor::_noDataImage [private] |
Definition at line 149 of file ImageLayer.
Definition at line 147 of file ImageLayer.
1.7.3