17#include "moc_qgsterraintextureimage_p.cpp"
19#include <Qt3DRender/QTextureImageDataGenerator>
25class TerrainTextureImageDataGenerator :
public Qt3DRender::QTextureImageDataGenerator
29 static QImage placeholderImage()
32 QImage i( 2, 2, QImage::Format_RGB32 );
33 i.setPixelColor( 0, 0, Qt::darkGray );
34 i.setPixelColor( 1, 0, Qt::lightGray );
35 i.setPixelColor( 0, 1, Qt::lightGray );
36 i.setPixelColor( 1, 1, Qt::darkGray );
40 TerrainTextureImageDataGenerator(
const QgsRectangle &extent,
const QString &debugText,
const QImage &img,
int version )
41 : mExtent( extent ), mDebugText( debugText ), mImage( img ), mVersion( version ) {}
43 Qt3DRender::QTextureImageDataPtr operator()()
override
45 Qt3DRender::QTextureImageDataPtr dataPtr = Qt3DRender::QTextureImageDataPtr::create();
46 dataPtr->setImage( mImage.isNull() ? placeholderImage() : mImage );
50 bool operator ==(
const QTextureImageDataGenerator &other )
const override
52 const TerrainTextureImageDataGenerator *otherFunctor = functor_cast<TerrainTextureImageDataGenerator>( &other );
53 return otherFunctor && otherFunctor->mVersion == mVersion &&
54 mExtent == otherFunctor->mExtent;
59 QT3D_FUNCTOR( TerrainTextureImageDataGenerator )
74QgsTerrainTextureImage::QgsTerrainTextureImage(
const QImage &image,
const QgsRectangle &extent,
const QString &debugText, Qt3DCore::QNode *parent )
77 , mDebugText( debugText )
82Qt3DRender::QTextureImageDataGeneratorPtr QgsTerrainTextureImage::dataGenerator()
const
84 return Qt3DRender::QTextureImageDataGeneratorPtr(
new TerrainTextureImageDataGenerator( mExtent, mDebugText, mImage, mVersion ) );
87void QgsTerrainTextureImage::invalidate()
91 notifyDataGeneratorChanged();
94void QgsTerrainTextureImage::setImage(
const QImage &img )
98 notifyDataGeneratorChanged();
A rectangle specified with double values.
#define Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_PUSH
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)