Skip to content
Permalink
Browse files

Rename color ramp classes to more sensible names

QgsVectorColorRamp -> QgsColorRamp
QgsVectorGradientColorRamp -> QgsGradientColorRamp
QgsRandomColors -> QgsRandomColorRamp
QgsRandomColorRamp -> QgsLimitedRandomColorRamp
QgsVectorColorBrewerColorRamp -> QgsColorBrewerColorRamp

These color ramps are used throughout all of QGIS (not
just in vector symbology) and the current names are
misleading.
  • Loading branch information
nyalldawson committed Aug 24, 2016
1 parent 014409d commit 932e469e5fee265ffe0e58c1f6dab9d94bc4d165
Showing with 428 additions and 421 deletions.
  1. +5 −5 doc/api_break.dox
  2. +1 −1 python/core/core.sip
  3. +4 −4 python/core/effects/qgsgloweffect.sip
  4. +1 −1 python/core/effects/qgsimageoperation.sip
  5. +54 −44 python/core/{symbology-ng/qgsvectorcolorramp.sip → qgscolorramp.sip}
  6. +3 −3 python/core/symbology-ng/qgscategorizedsymbolrenderer.sip
  7. +7 −7 python/core/symbology-ng/qgsfillsymbollayer.sip
  8. +4 −4 python/core/symbology-ng/qgsgraduatedsymbolrenderer.sip
  9. +2 −2 python/core/symbology-ng/qgsheatmaprenderer.sip
  10. +6 −6 python/core/symbology-ng/qgsstyle.sip
  11. +4 −4 python/core/symbology-ng/qgssymbollayerutils.sip
  12. +3 −3 python/gui/qgsgradientstopeditor.sip
  13. +1 −1 python/gui/symbology-ng/qgscategorizedsymbolrendererwidget.sip
  14. +2 −2 python/gui/symbology-ng/qgscolorrampcombobox.sip
  15. +1 −1 python/gui/symbology-ng/qgsvectorcolorbrewercolorrampdialog.sip
  16. +1 −1 python/gui/symbology-ng/qgsvectorgradientcolorrampdialog.sip
  17. +1 −1 python/gui/symbology-ng/qgsvectorrandomcolorrampdialog.sip
  18. +2 −2 src/app/qgsidentifyresultsdialog.cpp
  19. +2 −2 src/app/qgsprojectproperties.cpp
  20. +2 −2 src/core/CMakeLists.txt
  21. +5 −5 src/core/effects/qgsgloweffect.cpp
  22. +6 −6 src/core/effects/qgsgloweffect.h
  23. +1 −1 src/core/effects/qgsimageoperation.cpp
  24. +2 −2 src/core/effects/qgsimageoperation.h
  25. +51 −51 src/core/{symbology-ng/qgsvectorcolorramp.cpp → qgscolorramp.cpp}
  26. +39 −42 src/core/{symbology-ng/qgsvectorcolorramp.h → qgscolorramp.h}
  27. +2 −2 src/core/qgsexpression.cpp
  28. +5 −5 src/core/symbology-ng/qgscategorizedsymbolrenderer.cpp
  29. +5 −5 src/core/symbology-ng/qgscategorizedsymbolrenderer.h
  30. +1 −1 src/core/symbology-ng/qgscptcityarchive.h
  31. +9 −9 src/core/symbology-ng/qgsfillsymbollayer.cpp
  32. +13 −13 src/core/symbology-ng/qgsfillsymbollayer.h
  33. +5 −5 src/core/symbology-ng/qgsgraduatedsymbolrenderer.cpp
  34. +6 −6 src/core/symbology-ng/qgsgraduatedsymbolrenderer.h
  35. +3 −3 src/core/symbology-ng/qgsheatmaprenderer.cpp
  36. +4 −4 src/core/symbology-ng/qgsheatmaprenderer.h
  37. +12 −12 src/core/symbology-ng/qgsstyle.cpp
  38. +7 −7 src/core/symbology-ng/qgsstyle.h
  39. +8 −8 src/core/symbology-ng/qgssymbollayerutils.cpp
  40. +5 −5 src/core/symbology-ng/qgssymbollayerutils.h
  41. +2 −2 src/gui/effects/qgspainteffectwidget.cpp
  42. +2 −2 src/gui/qgsgradientstopeditor.cpp
  43. +5 −5 src/gui/qgsgradientstopeditor.h
  44. +4 −4 src/gui/raster/qgssinglebandpseudocolorrendererwidget.cpp
  45. +5 −5 src/gui/symbology-ng/qgscategorizedsymbolrendererwidget.cpp
  46. +1 −1 src/gui/symbology-ng/qgscategorizedsymbolrendererwidget.h
  47. +11 −11 src/gui/symbology-ng/qgscolorrampcombobox.cpp
  48. +4 −4 src/gui/symbology-ng/qgscolorrampcombobox.h
  49. +1 −1 src/gui/symbology-ng/qgscptcitycolorrampdialog.cpp
  50. +5 −5 src/gui/symbology-ng/qgsgraduatedsymbolrendererwidget.cpp
  51. +2 −2 src/gui/symbology-ng/qgsheatmaprendererwidget.cpp
  52. +3 −3 src/gui/symbology-ng/qgsstyleexportimportdialog.cpp
  53. +10 −10 src/gui/symbology-ng/qgsstylemanagerdialog.cpp
  54. +3 −3 src/gui/symbology-ng/qgssymbollayerwidget.cpp
  55. +5 −5 src/gui/symbology-ng/qgsvectorcolorbrewercolorrampdialog.cpp
  56. +3 −3 src/gui/symbology-ng/qgsvectorcolorbrewercolorrampdialog.h
  57. +2 −2 src/gui/symbology-ng/qgsvectorgradientcolorrampdialog.cpp
  58. +3 −3 src/gui/symbology-ng/qgsvectorgradientcolorrampdialog.h
  59. +2 −2 src/gui/symbology-ng/qgsvectorrandomcolorrampdialog.cpp
  60. +3 −3 src/gui/symbology-ng/qgsvectorrandomcolorrampdialog.h
  61. +2 −2 tests/src/core/testqgsgradients.cpp
  62. +5 −5 tests/src/core/testqgsimageoperation.cpp
  63. +2 −2 tests/src/core/testqgspainteffect.cpp
  64. +7 −7 tests/src/core/testqgsrasterlayer.cpp
  65. +1 −1 tests/src/core/testqgsrastersublayer.cpp
  66. +2 −2 tests/src/core/testqgsshapeburst.cpp
  67. +9 −9 tests/src/core/testqgsstyle.cpp
  68. +1 −1 tests/src/core/testqgssymbol.cpp
  69. +2 −2 tests/src/python/test_qgsgraduatedsymbolrenderer.py
  70. +26 −26 tests/src/python/test_qgsvectorcolorramp.py
@@ -72,7 +72,7 @@ This page tries to maintain a list with incompatible changes that happened in pr
<tr><td>QgsMultiLineStringV2<td>QgsMultiLineString
<tr><td>QgsMultiSurfaceV2<td>QgsMultiSurface
<tr><td>QgsPointSequenceV2<td>QgsPointSequence
<tr><td>QgsRandomColorsV2<td>QgsRandomColors
<tr><td>QgsRandomColorsV2<td>QgsRandomColorRamp
<tr><td>QgsRendererCategoryV2<td>QgsRendererCategory
<tr><td>QgsRendererRangeV2<td>QgsRendererRange
<tr><td>QgsRendererRangeV2LabelFomat<td>QgsRendererRangeLabelFomat
@@ -125,17 +125,17 @@ This page tries to maintain a list with incompatible changes that happened in pr
<tr><td>QgsSymbolV2SelectorDialog<td>QgsSymbolSelectorDialog
<tr><td>QgsSymbolV2SelectorWidget<td>QgsSymbolSelectorWidget
<tr><td>QgsSymbologyV2Conversion<td>QgsSymbologyConversion
<tr><td>QgsVectorColorBrewerColorRampV2<td>QgsVectorColorBrewerColorRamp
<tr><td>QgsVectorColorBrewerColorRampV2<td>QgsColorBrewerColorRamp
<tr><td>QgsVectorColorBrewerColorRampV2Dialog<td>QgsVectorColorBrewerColorRampDialog
<tr><td>QgsVectorColorBrewerColorRampV2DialogBase<td>QgsVectorColorBrewerColorRampDialogBase
<tr><td>QgsVectorColorRampV2<td>QgsVectorColorRamp
<tr><td>QgsVectorColorRampV2<td>QgsColorRamp
<tr><td>QgsVectorColorRampV2Map<td>QgsVectorColorRampMap
<tr><td>QgsVectorGradientColorRampV2<td>QgsVectorGradientColorRamp
<tr><td>QgsVectorGradientColorRampV2<td>QgsGradientColorRamp
<tr><td>QgsVectorGradientColorRampV2Dialog<td>QgsVectorGradientColorRampDialog
<tr><td>QgsVectorGradientColorRampV2DialogBase<td>QgsVectorGradientColorRampDialogBase
<tr><td>QgsVectorGradientRampV2<td>QgsVectorGradientRamp
<tr><td>QgsVectorLayersetRendererV2<td>QgsVectorLayersetRenderer
<tr><td>QgsVectorRandomColorRampV2<td>QgsVectorRandomColorRamp
<tr><td>QgsVectorRandomColorRampV2<td>QgsLimitedRandomColorRamp
<tr><td>QgsVectorRandomColorRampV2Dialog<td>QgsVectorRandomColorRampDialog
<tr><td>QgsVectorRandomColorRampV2DialogBase<td>QgsVectorRandomColorRampDialogBase
<tr><th>QgsSymbolV2<th>QgsSymbol
@@ -27,6 +27,7 @@
%Include qgsattributeeditorelement.sip
%Include qgsbrowsermodel.sip
%Include qgsclipper.sip
%Include qgscolorramp.sip
%Include qgscolorscheme.sip
%Include qgscolorschemeregistry.sip
%Include qgsconditionalstyle.sip
@@ -290,7 +291,6 @@
%Include symbology-ng/qgsstyle.sip
%Include symbology-ng/qgssvgcache.sip
%Include symbology-ng/qgssymbol.sip
%Include symbology-ng/qgsvectorcolorramp.sip

%Include symbology-ng/qgs25drenderer.sip
%Include symbology-ng/qgscategorizedsymbolrenderer.sip
@@ -129,15 +129,15 @@ class QgsGlowEffect : QgsPaintEffect
* @see ramp
* @see setColorType
*/
void setRamp( QgsVectorColorRamp* ramp /Transfer/ );
void setRamp( QgsColorRamp* ramp /Transfer/ );

/** Returns the color ramp used for the glow. This only applies if the @link colorType @endlink
* is set to ColorRamp. The glow will utilise colors from the ramp.
* @returns color ramp for glow
* @see setRamp
* @see colorType
*/
QgsVectorColorRamp* ramp() const;
QgsColorRamp* ramp() const;

/** Sets the blend mode for the effect
* @param mode blend mode used for drawing the effect on to a destination
@@ -153,7 +153,7 @@ class QgsGlowEffect : QgsPaintEffect
*/
QPainter::CompositionMode blendMode() const;

/** Sets the color mode to use for the glow. The glow can either be drawn using a QgsVectorColorRamp
/** Sets the color mode to use for the glow. The glow can either be drawn using a QgsColorRamp
* color ramp or by simply specificing a single color. setColorType is used to specify which mode to use
* for the glow.
* @param colorType color type to use for glow
@@ -163,7 +163,7 @@ class QgsGlowEffect : QgsPaintEffect
*/
void setColorType( GlowColorType colorType );

/** Returns the color mode used for the glow. The glow can either be drawn using a QgsVectorColorRamp
/** Returns the color mode used for the glow. The glow can either be drawn using a QgsColorRamp
* color ramp or by specificing a single color.
* @returns current color mode used for the glow
* @see setColorType
@@ -96,7 +96,7 @@ class QgsImageOperation
double spread;
/** Color ramp to use for shading the distance transform
*/
QgsVectorColorRamp* ramp;
QgsColorRamp* ramp;
};

/** Performs a distance transform on the source image and shades the result
@@ -1,23 +1,23 @@

/** \ingroup core
* \class QgsVectorColorRamp
* \class QgsColorRamp
* \brief Abstract base class for color ramps
*/
//TODO QGIS 3.0 - rename to QgsColorRamp, since this is used by much more than just vectors
class QgsVectorColorRamp
class QgsColorRamp
{
%TypeHeaderCode
#include <qgsvectorcolorramp.h>
#include <qgscolorramp.h>
%End

%ConvertToSubClassCode
if (sipCpp->type() == "gradient")
sipType = sipType_QgsVectorGradientColorRamp;
sipType = sipType_QgsGradientColorRamp;
else if (sipCpp->type() == "random")
sipType = sipType_QgsVectorRandomColorRamp;
sipType = sipType_QgsLimitedRandomColorRamp;
else if (sipCpp->type() == "randomcolors")
sipType = sipType_QgsRandomColors;
sipType = sipType_QgsRandomColorRamp;
else if (sipCpp->type() == "colorbrewer")
sipType = sipType_QgsVectorColorBrewerColorRamp;
sipType = sipType_QgsColorBrewerColorRamp;
else if (sipCpp->type() == "cpt-city")
sipType = sipType_QgsCptCityColorRamp;
else
@@ -26,7 +26,7 @@ class QgsVectorColorRamp

public:

virtual ~QgsVectorColorRamp();
virtual ~QgsColorRamp();

/** Returns number of defined colors, or -1 if undefined
*/
@@ -48,7 +48,7 @@ class QgsVectorColorRamp

/** Creates a clone of the color ramp.
*/
virtual QgsVectorColorRamp* clone() const = 0 /Factory/;
virtual QgsColorRamp* clone() const = 0 /Factory/;

/** Returns a string map containing all the color ramp's properties.
*/
@@ -58,20 +58,20 @@ class QgsVectorColorRamp

/** \ingroup core
* \class QgsGradientStop
* \brief Represents a color stop within a gradient color ramp.
* \brief Represents a color stop within a QgsGradientColorRamp color ramp.
*/
class QgsGradientStop
{
%TypeHeaderCode
#include <qgsvectorcolorramp.h>
#include <qgscolorramp.h>
%End
public:

/** Constructor for QgsGradientStop
* @param o positional offset for stop, between 0 and 1.0
* @param c color for stop
* @param offset positional offset for stop, between 0 and 1.0
* @param color color for stop
*/
QgsGradientStop( double o, const QColor& c );
QgsGradientStop( double offset, const QColor& color );

//! Relative positional offset, between 0 and 1
double offset;
@@ -86,38 +86,37 @@ class QgsGradientStop
typedef QList<QgsGradientStop> QgsGradientStopsList;

/** \ingroup core
* \class QgsVectorGradientColorRamp
* \class QgsGradientColorRamp
* \brief Gradient color ramp, which smoothly interpolates between two colors and also
* supports optional extra color stops.
*/
//TODO QGIS 3.0 - rename to QgsGradientColorRamp, since this is used by much more than just vectors
class QgsVectorGradientColorRamp : QgsVectorColorRamp
class QgsGradientColorRamp : QgsColorRamp
{
%TypeHeaderCode
#include <qgsvectorcolorramp.h>
#include <qgscolorramp.h>
%End
public:

/** Constructor for QgsVectorGradientColorRamp
/** Constructor for QgsGradientColorRamp
* @param color1 start color, corresponding to a position of 0.0
* @param color2 end color, corresponding to a position of 1.0
* @param discrete set to true for discrete interpolation instead of smoothly
* interpolating between colors
* @param stops optional list of additional color stops
*/
QgsVectorGradientColorRamp( const QColor& color1 = DEFAULT_GRADIENT_COLOR1,
QgsGradientColorRamp( const QColor& color1 = DEFAULT_GRADIENT_COLOR1,
const QColor& color2 = QColor(0,255,0),
bool discrete = false,
const QgsGradientStopsList& stops = QgsGradientStopsList() );

//! Creates a new QgsVectorColorRamp from a map of properties
static QgsVectorColorRamp* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
static QgsColorRamp* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;

virtual int count() const;
virtual double value( int index ) const;
virtual QColor color( double value ) const;
virtual QString type() const;
virtual QgsVectorGradientColorRamp* clone() const /Factory/;
virtual QgsGradientColorRamp* clone() const /Factory/;
virtual QgsStringMap properties() const;

/** Returns the gradient start color.
@@ -200,30 +199,29 @@ class QgsVectorGradientColorRamp : QgsVectorColorRamp
};

/** \ingroup core
* \class QgsVectorRandomColorRamp
* \brief Random color ramp, which returns random colors based on preset parameters.
* \class QgsLimitedRandomColorRamp
* \brief Constrained random color ramp, which returns random colors based on preset parameters.
*/
//TODO QGIS 3.0 - rename to QgsRandomColorRamp, since this is used by much more than just vectors
class QgsVectorRandomColorRamp : QgsVectorColorRamp
class QgsLimitedRandomColorRamp : QgsColorRamp
{
%TypeHeaderCode
#include <qgsvectorcolorramp.h>
#include <qgscolorramp.h>
%End
public:
QgsVectorRandomColorRamp( int count = DEFAULT_RANDOM_COUNT,
QgsLimitedRandomColorRamp( int count = DEFAULT_RANDOM_COUNT,
int hueMin = DEFAULT_RANDOM_HUE_MIN, int hueMax = DEFAULT_RANDOM_HUE_MAX,
int satMin = DEFAULT_RANDOM_SAT_MIN, int satMax = DEFAULT_RANDOM_SAT_MAX,
int valMin = DEFAULT_RANDOM_VAL_MIN, int valMax = DEFAULT_RANDOM_VAL_MAX );

static QgsVectorColorRamp* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
static QgsColorRamp* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;

virtual double value( int index ) const;

virtual QColor color( double value ) const;

virtual QString type() const;

virtual QgsVectorRandomColorRamp* clone() const /Factory/;
virtual QgsLimitedRandomColorRamp* clone() const /Factory/;

virtual QgsStringMap properties() const;

@@ -254,11 +252,17 @@ class QgsVectorRandomColorRamp : QgsVectorColorRamp
void setValMax( int val );
};

class QgsRandomColors : QgsVectorColorRamp
/** \ingroup core
* \class QgsRandomColorRamp
*/
class QgsRandomColorRamp : QgsColorRamp
{
%TypeHeaderCode
#include <qgscolorramp.h>
%End
public:
QgsRandomColors();
~QgsRandomColors();
QgsRandomColorRamp();
~QgsRandomColorRamp();

int count() const;

@@ -276,29 +280,32 @@ class QgsRandomColors : QgsVectorColorRamp

QString type() const;

virtual QgsRandomColors* clone() const /Factory/;
virtual QgsRandomColorRamp* clone() const /Factory/;

QgsStringMap properties() const;
};

class QgsVectorColorBrewerColorRamp : QgsVectorColorRamp
/** \ingroup core
* \class QgsColorBrewerColorRamp
*/
class QgsColorBrewerColorRamp : QgsColorRamp
{
%TypeHeaderCode
#include <qgsvectorcolorramp.h>
#include <qgscolorramp.h>
%End
public:
QgsVectorColorBrewerColorRamp( const QString& schemeName = DEFAULT_COLORBREWER_SCHEMENAME,
QgsColorBrewerColorRamp( const QString& schemeName = DEFAULT_COLORBREWER_SCHEMENAME,
int colors = DEFAULT_COLORBREWER_COLORS );

static QgsVectorColorRamp* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
static QgsColorRamp* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;

virtual double value( int index ) const;

virtual QColor color( double value ) const;

virtual QString type() const;

virtual QgsVectorColorBrewerColorRamp* clone() const /Factory/;
virtual QgsColorBrewerColorRamp* clone() const /Factory/;

virtual QgsStringMap properties() const;

@@ -318,10 +325,13 @@ class QgsVectorColorBrewerColorRamp : QgsVectorColorRamp
};


class QgsCptCityColorRamp : QgsVectorGradientColorRamp
/** \ingroup core
* \class QgsCptCityColorRamp
*/
class QgsCptCityColorRamp : QgsGradientColorRamp
{
%TypeHeaderCode
#include <qgsvectorcolorramp.h>
#include <qgscolorramp.h>
%End
public:
QgsCptCityColorRamp( const QString& schemeName = DEFAULT_CPTCITY_SCHEMENAME,
@@ -330,13 +340,13 @@ class QgsCptCityColorRamp : QgsVectorGradientColorRamp
QgsCptCityColorRamp( const QString& schemeName, const QStringList& variantList,
const QString& variantName = QString(), bool doLoadFile = true );

static QgsVectorColorRamp* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;
static QgsColorRamp* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;

virtual QString type() const;

virtual QgsCptCityColorRamp* clone() const /Factory/;
void copy( const QgsCptCityColorRamp* other );
QgsVectorGradientColorRamp* cloneGradientRamp() const /Factory/;
QgsGradientColorRamp* cloneGradientRamp() const /Factory/;

virtual QgsStringMap properties() const;

@@ -148,14 +148,14 @@ class QgsCategorizedSymbolRenderer : QgsFeatureRenderer
* @see setSourceColorRamp()
* @see sourceSymbol()
*/
QgsVectorColorRamp* sourceColorRamp();
QgsColorRamp* sourceColorRamp();

/** Sets the source color ramp.
* @param ramp color ramp. Ownership is transferred to the renderer
* @see sourceColorRamp()
* @see setSourceSymbol()
*/
void setSourceColorRamp( QgsVectorColorRamp* ramp /Transfer/ );
void setSourceColorRamp( QgsColorRamp* ramp /Transfer/ );

//! @note added in 2.1
bool invertedColorRamp();
@@ -166,7 +166,7 @@ class QgsCategorizedSymbolRenderer : QgsFeatureRenderer
* @param inverted set to true to invert ramp colors
* @note added in 2.5
*/
void updateColorRamp( QgsVectorColorRamp* ramp /Transfer/, bool inverted = false );
void updateColorRamp( QgsColorRamp* ramp /Transfer/, bool inverted = false );

void setRotationField( const QString& fieldOrExpression ) /Deprecated/;
QString rotationField() const /Deprecated/;

0 comments on commit 932e469

Please sign in to comment.
You can’t perform that action at this time.