Skip to content

Commit 9cf9881

Browse files
timlinuxalexbruy
authored andcommitted
[BACKPORT] Formatting changes only for raster color ramp shader class
1 parent c065736 commit 9cf9881

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

src/core/raster/qgscolorrampshader.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ bool QgsColorRampShader::discreteColor( double theValue, int* theReturnRedValue,
6565
myColorRampItem = mColorRampItemList.value( mCurrentColorRampItemIndex );
6666
myTinyDiff = qAbs( theValue - myColorRampItem.value );
6767
//If the previous entry is less, then search closer to the top of the list (assumes mColorRampItemList is sorted)
68-
if ( mCurrentColorRampItemIndex != 0 && theValue <= mColorRampItemList.at( mCurrentColorRampItemIndex - 1 ).value )
68+
if ( mCurrentColorRampItemIndex != 0 &&
69+
theValue <= mColorRampItemList.at( mCurrentColorRampItemIndex - 1 ).value )
6970
{
7071
mCurrentColorRampItemIndex--;
7172
}
@@ -119,7 +120,9 @@ bool QgsColorRampShader::exactColor( double theValue, int* theReturnRedValue, in
119120
return true;
120121
}
121122
//pixel value sits between ramp entries so bail
122-
else if ( mCurrentColorRampItemIndex != myColorRampItemCount - 1 && theValue > myColorRampItem.value && theValue < mColorRampItemList.at( mCurrentColorRampItemIndex + 1 ).value )
123+
else if ( mCurrentColorRampItemIndex != myColorRampItemCount - 1 &&
124+
theValue > myColorRampItem.value && theValue < mColorRampItemList.at(
125+
mCurrentColorRampItemIndex + 1 ).value )
123126
{
124127
return false;
125128
}
@@ -138,7 +141,8 @@ bool QgsColorRampShader::exactColor( double theValue, int* theReturnRedValue, in
138141
return false; // value not found
139142
}
140143

141-
bool QgsColorRampShader::interpolatedColor( double theValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue )
144+
bool QgsColorRampShader::interpolatedColor( double theValue, int*
145+
theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue )
142146
{
143147
int myColorRampItemCount = mColorRampItemList.count();
144148
if ( myColorRampItemCount <= 0 )
@@ -275,7 +279,9 @@ bool QgsColorRampShader::shade( double theValue, int* theReturnRedValue, int* th
275279
return discreteColor( theValue, theReturnRedValue, theReturnGreenValue, theReturnBlueValue );
276280
}
277281

278-
bool QgsColorRampShader::shade( double theRedValue, double theGreenValue, double theBlueValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue )
282+
bool QgsColorRampShader::shade( double theRedValue, double theGreenValue,
283+
double theBlueValue, int* theReturnRedValue, int* theReturnGreenValue, int*
284+
theReturnBlueValue )
279285
{
280286
*theReturnRedValue = 0;
281287
*theReturnGreenValue = 0;

src/core/raster/qgscolorrampshader.h

+16-7
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction
9696
int mCurrentColorRampItemIndex;
9797

9898
//TODO: Consider pulling this out as a separate class and internally storing as a QMap rather than a QList
99-
/** This vector holds the information for classification based on values. Each item holds a value, a label and a color. The member mDiscreteClassification holds if one color is applied for all values between two class breaks (true) or if the item values are (linearly) interpolated for values between the item values (false)*/
99+
/** This vector holds the information for classification based on values.
100+
* Each item holds a value, a label and a color. The member
101+
* mDiscreteClassification holds if one color is applied for all values
102+
* between two class breaks (true) or if the item values are (linearly)
103+
* interpolated for values between the item values (false)*/
100104
QList<QgsColorRampShader::ColorRampItem> mColorRampItemList;
101105

102106
/** \brief The color ramp type */
@@ -105,18 +109,23 @@ class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction
105109
/** \brief Cache of values that have already been looked up */
106110
QMap<double, QColor> mColorCache;
107111

108-
/** Maximum size of the color cache. The color cache could eat a ton of memory if you have 32-bit data */
112+
/** Maximum size of the color cache. The color cache could eat a ton of
113+
* memory if you have 32-bit data */
109114
int mMaximumColorCacheSize;
110115

111-
112-
113-
/** Gets the color for a pixel value from the classification vector mValueClassification. Assigns the color of the lower class for every pixel between two class breaks.*/
116+
/** Gets the color for a pixel value from the classification vector
117+
* mValueClassification. Assigns the color of the lower class for every
118+
* pixel between two class breaks.*/
114119
bool discreteColor( double, int*, int*, int* );
115120

116-
/** Gets the color for a pixel value from the classification vector mValueClassification. Assigns the color of the exact matching value in the color ramp item list */
121+
/** Gets the color for a pixel value from the classification vector
122+
* mValueClassification. Assigns the color of the exact matching value in
123+
* the color ramp item list */
117124
bool exactColor( double, int*, int*, int* );
118125

119-
/** Gets the color for a pixel value from the classification vector mValueClassification. Interpolates the color between two class breaks linearly.*/
126+
/** Gets the color for a pixel value from the classification vector
127+
* mValueClassification. Interpolates the color between two class breaks
128+
* linearly.*/
120129
bool interpolatedColor( double, int*, int*, int* );
121130
};
122131

0 commit comments

Comments
 (0)