29 return QStringLiteral(
"rgb" );
34 std::unique_ptr< QgsPointCloudRgbRenderer > res = std::make_unique< QgsPointCloudRgbRenderer >();
35 res->mRedAttribute = mRedAttribute;
36 res->mGreenAttribute = mGreenAttribute;
37 res->mBlueAttribute = mBlueAttribute;
39 if ( mRedContrastEnhancement )
43 if ( mGreenContrastEnhancement )
47 if ( mBlueContrastEnhancement )
61 const char *ptr = block->
data();
73 attribute = request.
find( mGreenAttribute, greenOffset );
79 attribute = request.
find( mBlueAttribute, blueOffset );
96 const bool reproject = ct.
isValid();
97 for (
int i = 0; i < count; ++i )
107 z =
pointZ( context, ptr, i );
112 pointXY( context, ptr, i, x, y );
113 if ( visibleExtent.
contains( x, y ) )
128 context.
getAttribute( ptr, i * recordSize + redOffset, redType, red );
130 context.
getAttribute( ptr, i * recordSize + greenOffset, greenType, green );
132 context.
getAttribute( ptr, i * recordSize + blueOffset, blueType, blue );
135 if ( ( useRedContrastEnhancement && !mRedContrastEnhancement->isValueInDisplayableRange( red ) )
136 || ( useGreenContrastEnhancement && !mGreenContrastEnhancement->isValueInDisplayableRange( green ) )
137 || ( useBlueContrastEnhancement && !mBlueContrastEnhancement->isValueInDisplayableRange( blue ) ) )
143 if ( useRedContrastEnhancement )
145 red = mRedContrastEnhancement->enhanceContrast( red );
147 if ( useGreenContrastEnhancement )
149 green = mGreenContrastEnhancement->enhanceContrast( green );
151 if ( useBlueContrastEnhancement )
153 blue = mBlueContrastEnhancement->enhanceContrast( blue );
156 red = std::max( 0, std::min( 255, red ) );
157 green = std::max( 0, std::min( 255, green ) );
158 blue = std::max( 0, std::min( 255, blue ) );
160 drawPoint( x, y, QColor( red, green, blue ), context );
170 std::unique_ptr< QgsPointCloudRgbRenderer > r = std::make_unique< QgsPointCloudRgbRenderer >();
172 r->setRedAttribute( element.attribute( QStringLiteral(
"red" ), QStringLiteral(
"Red" ) ) );
173 r->setGreenAttribute( element.attribute( QStringLiteral(
"green" ), QStringLiteral(
"Green" ) ) );
174 r->setBlueAttribute( element.attribute( QStringLiteral(
"blue" ), QStringLiteral(
"Blue" ) ) );
176 r->restoreCommonProperties( element, context );
180 const QDomElement redContrastElem = element.firstChildElement( QStringLiteral(
"redContrastEnhancement" ) );
181 if ( !redContrastElem.isNull() )
189 const QDomElement greenContrastElem = element.firstChildElement( QStringLiteral(
"greenContrastEnhancement" ) );
190 if ( !greenContrastElem.isNull() )
198 const QDomElement blueContrastElem = element.firstChildElement( QStringLiteral(
"blueContrastEnhancement" ) );
199 if ( !blueContrastElem.isNull() )
211 QDomElement rendererElem = doc.createElement( QStringLiteral(
"renderer" ) );
213 rendererElem.setAttribute( QStringLiteral(
"type" ), QStringLiteral(
"rgb" ) );
215 rendererElem.setAttribute( QStringLiteral(
"red" ), mRedAttribute );
216 rendererElem.setAttribute( QStringLiteral(
"green" ), mGreenAttribute );
217 rendererElem.setAttribute( QStringLiteral(
"blue" ), mBlueAttribute );
222 if ( mRedContrastEnhancement )
224 QDomElement redContrastElem = doc.createElement( QStringLiteral(
"redContrastEnhancement" ) );
225 mRedContrastEnhancement->writeXml( doc, redContrastElem );
226 rendererElem.appendChild( redContrastElem );
228 if ( mGreenContrastEnhancement )
230 QDomElement greenContrastElem = doc.createElement( QStringLiteral(
"greenContrastEnhancement" ) );
231 mGreenContrastEnhancement->writeXml( doc, greenContrastElem );
232 rendererElem.appendChild( greenContrastElem );
234 if ( mBlueContrastEnhancement )
236 QDomElement blueContrastElem = doc.createElement( QStringLiteral(
"blueContrastEnhancement" ) );
237 mBlueContrastEnhancement->writeXml( doc, blueContrastElem );
238 rendererElem.appendChild( blueContrastElem );
247 res << mRedAttribute << mGreenAttribute << mBlueAttribute;
253 std::unique_ptr< QgsPointCloudRgbRendererPreparedData > data = std::make_unique< QgsPointCloudRgbRendererPreparedData >();
254 data->redAttribute = mRedAttribute;
255 if ( mRedContrastEnhancement )
257 data->greenAttribute = mGreenAttribute;
258 if ( mGreenContrastEnhancement )
260 data->blueAttribute = mBlueAttribute;
261 if ( mBlueContrastEnhancement )
301 const char *ptr = block->
data();
333 red = std::max( 0, std::min( 255, red ) );
334 green = std::max( 0, std::min( 255, green ) );
335 blue = std::max( 0, std::min( 255, blue ) );
337 return QColor( red, green, blue );
342 return mRedAttribute;
352 return mGreenAttribute;
362 return mBlueAttribute;
372 return mRedContrastEnhancement.get();
377 mRedContrastEnhancement.reset( enhancement );
382 return mGreenContrastEnhancement.get();
387 mGreenContrastEnhancement.reset( enhancement );
392 return mBlueContrastEnhancement.get();
397 mBlueContrastEnhancement.reset( enhancement );