mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-07 00:15:48 -04:00
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.
This commit is contained in:
parent
014409d025
commit
932e469e5f
@ -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,7 +129,7 @@ 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.
|
||||
@ -137,7 +137,7 @@ class QgsGlowEffect : QgsPaintEffect
|
||||
* @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,22 +199,21 @@ 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;
|
||||
|
||||
@ -223,7 +221,7 @@ class QgsVectorRandomColorRamp : QgsVectorColorRamp
|
||||
|
||||
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,21 +280,24 @@ 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;
|
||||
|
||||
@ -298,7 +305,7 @@ class QgsVectorColorBrewerColorRamp : QgsVectorColorRamp
|
||||
|
||||
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/;
|
||||
|
@ -183,8 +183,8 @@ class QgsGradientFillSymbolLayer : QgsFillSymbolLayer
|
||||
void setGradientColorType( GradientColorType gradientColorType );
|
||||
|
||||
/** Color ramp used for the gradient fill, only used if the gradient color type is set to ColorRamp*/
|
||||
QgsVectorColorRamp* colorRamp();
|
||||
void setColorRamp( QgsVectorColorRamp* ramp );
|
||||
QgsColorRamp* colorRamp();
|
||||
void setColorRamp( QgsColorRamp* ramp );
|
||||
|
||||
/** Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor*/
|
||||
QColor color2() const;
|
||||
@ -336,7 +336,7 @@ class QgsShapeburstFillSymbolLayer : QgsFillSymbolLayer
|
||||
void setDistanceMapUnitScale( const QgsMapUnitScale& scale );
|
||||
const QgsMapUnitScale& distanceMapUnitScale() const;
|
||||
|
||||
/** Sets the color mode to use for the shapeburst fill. Shapeburst can either be drawn using a QgsVectorColorRamp color ramp
|
||||
/** Sets the color mode to use for the shapeburst fill. Shapeburst can either be drawn using a QgsColorRamp color ramp
|
||||
* or by simply specificing a start and end color. setColorType is used to specify which mode to use for the fill.
|
||||
* @param colorType color type to use for shapeburst fill
|
||||
* @note added in 2.3
|
||||
@ -346,7 +346,7 @@ class QgsShapeburstFillSymbolLayer : QgsFillSymbolLayer
|
||||
* @see setColorRamp
|
||||
*/
|
||||
void setColorType( ShapeburstColorType colorType );
|
||||
/** Returns the color mode used for the shapeburst fill. Shapeburst can either be drawn using a QgsVectorColorRamp color ramp
|
||||
/** Returns the color mode used for the shapeburst fill. Shapeburst can either be drawn using a QgsColorRamp color ramp
|
||||
* or by simply specificing a start and end color.
|
||||
* @returns current color mode used for the shapeburst fill
|
||||
* @note added in 2.3
|
||||
@ -363,14 +363,14 @@ class QgsShapeburstFillSymbolLayer : QgsFillSymbolLayer
|
||||
* @see setColorType
|
||||
* @see colorRamp
|
||||
*/
|
||||
void setColorRamp( QgsVectorColorRamp* ramp );
|
||||
void setColorRamp( QgsColorRamp* ramp );
|
||||
/** Returns the color ramp used for the shapeburst fill. The color ramp is only used if the colorType is set to ShapeburstColorType::ColorRamp
|
||||
* @returns a QgsVectorColorRamp color ramp
|
||||
* @returns a QgsColorRamp color ramp
|
||||
* @note added in 2.3
|
||||
* @see setColorRamp
|
||||
* @see colorType
|
||||
*/
|
||||
QgsVectorColorRamp* colorRamp();
|
||||
QgsColorRamp* colorRamp();
|
||||
|
||||
/** Sets the color for the endpoint of the shapeburst fill. This color is only used if setColorType is set ShapeburstColorType::SimpleTwoColor.
|
||||
* @param color2 QColor to use for endpoint of gradient
|
||||
|
@ -209,7 +209,7 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
|
||||
int classes,
|
||||
Mode mode,
|
||||
QgsSymbol* symbol /Transfer/,
|
||||
QgsVectorColorRamp* ramp /Transfer/,
|
||||
QgsColorRamp* ramp /Transfer/,
|
||||
bool inverted = false,
|
||||
const QgsRendererRangeLabelFormat& legendFormat = QgsRendererRangeLabelFormat()
|
||||
);
|
||||
@ -251,12 +251,12 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
|
||||
* @see setSourceColorRamp()
|
||||
* @see sourceSymbol()
|
||||
*/
|
||||
QgsVectorColorRamp* sourceColorRamp();
|
||||
QgsColorRamp* sourceColorRamp();
|
||||
|
||||
/** Sets the source color ramp.
|
||||
* @param ramp color ramp. Ownership is transferred to the renderer
|
||||
*/
|
||||
void setSourceColorRamp( QgsVectorColorRamp* ramp /Transfer/ );
|
||||
void setSourceColorRamp( QgsColorRamp* ramp /Transfer/ );
|
||||
|
||||
//! @note added in 2.1
|
||||
bool invertedColorRamp();
|
||||
@ -267,7 +267,7 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
|
||||
* @param ramp color ramp. Ownership is transferred to the renderer
|
||||
* @param inverted set to true to invert ramp colors
|
||||
*/
|
||||
void updateColorRamp( QgsVectorColorRamp* ramp /Transfer/ = 0, bool inverted = false );
|
||||
void updateColorRamp( QgsColorRamp* ramp /Transfer/ = 0, bool inverted = false );
|
||||
|
||||
/** Update all the symbols but leave breaks and colors. This method also sets the source
|
||||
* symbol for the renderer.
|
||||
|
@ -33,12 +33,12 @@ class QgsHeatmapRenderer : QgsFeatureRenderer
|
||||
* @returns color ramp for heatmap
|
||||
* @see setColorRamp
|
||||
*/
|
||||
QgsVectorColorRamp* colorRamp() const;
|
||||
QgsColorRamp* colorRamp() const;
|
||||
/** Sets the color ramp to use for shading the heatmap.
|
||||
* @param ramp color ramp for heatmap. Ownership of ramp is transferred to the renderer.
|
||||
* @see colorRamp
|
||||
*/
|
||||
void setColorRamp( QgsVectorColorRamp* ramp /Transfer/ );
|
||||
void setColorRamp( QgsColorRamp* ramp /Transfer/ );
|
||||
|
||||
/** Returns whether the ramp is inverted
|
||||
* @returns true if color ramp is inverted
|
||||
|
@ -20,11 +20,11 @@ class QgsStyle : QObject
|
||||
/*!
|
||||
* \note Adding a color ramp with the name of existing one replaces it.
|
||||
* \param name is the name of the color ramp being added or updated
|
||||
* \param colorRamp is the Vector color ramp
|
||||
* \param colorRamp is the color ramp
|
||||
* \param update set to true when the style DB has to be updated, by default it is false
|
||||
* \return success status of the operation
|
||||
*/
|
||||
bool addColorRamp( const QString& name, QgsVectorColorRamp* colorRamp /Transfer/, bool update = false );
|
||||
bool addColorRamp( const QString& name, QgsColorRamp* colorRamp /Transfer/, bool update = false );
|
||||
|
||||
//! adds a new group and returns the group's id
|
||||
/*!
|
||||
@ -72,7 +72,7 @@ class QgsStyle : QObject
|
||||
void clear();
|
||||
|
||||
//! return a NEW copy of color ramp
|
||||
QgsVectorColorRamp* colorRamp( const QString& name ) /Factory/;
|
||||
QgsColorRamp* colorRamp( const QString& name ) /Factory/;
|
||||
|
||||
//! return count of color ramps
|
||||
int colorRampCount();
|
||||
@ -81,7 +81,7 @@ class QgsStyle : QObject
|
||||
QStringList colorRampNames();
|
||||
|
||||
//! return a const pointer to a symbol (doesn't create new instance)
|
||||
const QgsVectorColorRamp* colorRampRef( const QString& name ) const;
|
||||
const QgsColorRamp* colorRampRef( const QString& name ) const;
|
||||
|
||||
//! return the id in the style database for the given colorramp name
|
||||
//! returns 0 if not found
|
||||
@ -199,12 +199,12 @@ class QgsStyle : QObject
|
||||
//! add the colorramp to the DB
|
||||
/*!
|
||||
* \param name is the name of the colorramp as QString
|
||||
* \param ramp is the pointer to the new QgsVectorColorRamp being saved
|
||||
* \param ramp is the pointer to the new QgsColorRamp being saved
|
||||
* \param groupid is the id of the group to which the Color Ramp belongs. Pass 0 if it doesn't belong to any group or not known.
|
||||
* \param tags is a list of tags that are associated with the color ramp as a QStringList.
|
||||
* \return returns the success state of the save operation
|
||||
*/
|
||||
bool saveColorRamp( const QString& name, QgsVectorColorRamp* ramp, int groupid, const QStringList& tags );
|
||||
bool saveColorRamp( const QString& name, QgsColorRamp* ramp, int groupid, const QStringList& tags );
|
||||
|
||||
//! remove color ramp from style (and delete it)
|
||||
bool removeColorRamp( const QString& name );
|
||||
|
@ -95,13 +95,13 @@ class QgsSymbolLayerUtils
|
||||
*/
|
||||
static QIcon symbolLayerPreviewIcon( QgsSymbolLayer* layer, QgsUnitTypes::RenderUnit u, QSize size, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
static QIcon colorRampPreviewIcon( QgsVectorColorRamp* ramp, QSize size );
|
||||
static QIcon colorRampPreviewIcon( QgsColorRamp* ramp, QSize size );
|
||||
|
||||
static void drawStippledBackground( QPainter* painter, QRect rect );
|
||||
|
||||
//! @note customContext parameter added in 2.6
|
||||
static QPixmap symbolPreviewPixmap( QgsSymbol* symbol, QSize size, QgsRenderContext* customContext = 0 );
|
||||
static QPixmap colorRampPreviewPixmap( QgsVectorColorRamp* ramp, QSize size );
|
||||
static QPixmap colorRampPreviewPixmap( QgsColorRamp* ramp, QSize size );
|
||||
|
||||
/** Returns the maximum estimated bleed for the symbol */
|
||||
static double estimateMaxSymbolBleed( QgsSymbol* symbol );
|
||||
@ -241,8 +241,8 @@ class QgsSymbolLayerUtils
|
||||
|
||||
static void clearSymbolMap( QgsSymbolMap& symbols );
|
||||
|
||||
static QgsVectorColorRamp* loadColorRamp( QDomElement& element ) /Factory/;
|
||||
static QDomElement saveColorRamp( const QString& name, QgsVectorColorRamp* ramp, QDomDocument& doc );
|
||||
static QgsColorRamp* loadColorRamp( QDomElement& element ) /Factory/;
|
||||
static QDomElement saveColorRamp( const QString& name, QgsColorRamp* ramp, QDomDocument& doc );
|
||||
|
||||
/**
|
||||
* Returns a friendly display name for a color
|
||||
|
@ -17,18 +17,18 @@ class QgsGradientStopEditor : QWidget
|
||||
* @param parent parent widget
|
||||
* @param ramp optional initial gradient ramp
|
||||
*/
|
||||
QgsGradientStopEditor( QWidget* parent /TransferThis/ = nullptr, QgsVectorGradientColorRamp* ramp = nullptr );
|
||||
QgsGradientStopEditor( QWidget* parent /TransferThis/ = nullptr, QgsGradientColorRamp* ramp = nullptr );
|
||||
|
||||
/** Sets the current ramp shown in the editor.
|
||||
* @param ramp color ramp
|
||||
* @see gradientRamp()
|
||||
*/
|
||||
void setGradientRamp( const QgsVectorGradientColorRamp& ramp );
|
||||
void setGradientRamp( const QgsGradientColorRamp& ramp );
|
||||
|
||||
/** Returns the current ramp created by the editor.
|
||||
* @see setGradientRamp()
|
||||
*/
|
||||
QgsVectorGradientColorRamp gradientRamp() const;
|
||||
QgsGradientColorRamp gradientRamp() const;
|
||||
|
||||
/** Sets the currently selected stop.
|
||||
* @param index index of stop, where 0 corresponds to the first stop
|
||||
|
@ -75,7 +75,7 @@ class QgsCategorizedSymbolRendererWidget : QgsRendererWidget
|
||||
|
||||
void changeCategorySymbol();
|
||||
|
||||
QgsVectorColorRamp* getColorRamp();
|
||||
QgsColorRamp* getColorRamp();
|
||||
|
||||
QList<QgsSymbol*> selectedSymbols();
|
||||
QgsCategoryList selectedCategoryList();
|
||||
|
@ -12,10 +12,10 @@ class QgsColorRampComboBox : QComboBox
|
||||
void populate( QgsStyle* style );
|
||||
|
||||
//! add/select color ramp which was used previously by the renderer
|
||||
void setSourceColorRamp( QgsVectorColorRamp* sourceRamp );
|
||||
void setSourceColorRamp( QgsColorRamp* sourceRamp );
|
||||
|
||||
//! return new instance of the current color ramp or NULL if there is no active color ramp
|
||||
QgsVectorColorRamp* currentColorRamp();
|
||||
QgsColorRamp* currentColorRamp();
|
||||
|
||||
/** Returns true if the current selection in the combo box is the option for creating
|
||||
* a new color ramp
|
||||
|
@ -5,7 +5,7 @@ class QgsVectorColorBrewerColorRampDialog : QDialog
|
||||
%End
|
||||
|
||||
public:
|
||||
QgsVectorColorBrewerColorRampDialog( QgsVectorColorBrewerColorRamp* ramp, QWidget* parent /TransferThis/ = NULL );
|
||||
QgsVectorColorBrewerColorRampDialog( QgsColorBrewerColorRamp* ramp, QWidget* parent /TransferThis/ = NULL );
|
||||
|
||||
public slots:
|
||||
void setSchemeName();
|
||||
|
@ -5,7 +5,7 @@ class QgsVectorGradientColorRampDialog : QDialog
|
||||
%End
|
||||
|
||||
public:
|
||||
QgsVectorGradientColorRampDialog( QgsVectorGradientColorRamp* ramp, QWidget* parent /TransferThis/ = NULL );
|
||||
QgsVectorGradientColorRampDialog( QgsGradientColorRamp* ramp, QWidget* parent /TransferThis/ = NULL );
|
||||
|
||||
public slots:
|
||||
void setColor1( const QColor& color );
|
||||
|
@ -5,7 +5,7 @@ class QgsVectorRandomColorRampDialog : QDialog
|
||||
%End
|
||||
|
||||
public:
|
||||
QgsVectorRandomColorRampDialog( QgsVectorRandomColorRamp* ramp, QWidget* parent /TransferThis/ = NULL );
|
||||
QgsVectorRandomColorRampDialog( QgsLimitedRandomColorRamp* ramp, QWidget* parent /TransferThis/ = NULL );
|
||||
|
||||
public slots:
|
||||
void setCount( int val );
|
||||
|
@ -65,7 +65,7 @@
|
||||
#include <qwt_plot_curve.h>
|
||||
#include <qwt_symbol.h>
|
||||
#include <qwt_legend.h>
|
||||
#include "qgsvectorcolorramp.h" // for random colors
|
||||
#include "qgscolorramp.h" // for random colors
|
||||
|
||||
QgsIdentifyResultsWebView::QgsIdentifyResultsWebView( QWidget *parent ) : QgsWebView( parent )
|
||||
{
|
||||
@ -609,7 +609,7 @@ QgsIdentifyPlotCurve::QgsIdentifyPlotCurve( const QMap<QString, QString> &attrib
|
||||
|
||||
if ( color == QColor() )
|
||||
{
|
||||
color = QgsVectorRandomColorRamp::randomColors( 1 ).at( 0 );
|
||||
color = QgsLimitedRandomColorRamp::randomColors( 1 ).at( 0 );
|
||||
}
|
||||
#if defined(QWT_VERSION) && QWT_VERSION>=0x060000
|
||||
mPlotCurve->setSymbol( new QwtSymbol( QwtSymbol::Ellipse, QBrush( Qt::white ),
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "qgsstyle.h"
|
||||
#include "qgssymbol.h"
|
||||
#include "qgsstylemanagerdialog.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgssymbolselectordialog.h"
|
||||
#include "qgsrelationmanagerdialog.h"
|
||||
#include "qgsrelationmanager.h"
|
||||
@ -1713,7 +1713,7 @@ void QgsProjectProperties::populateStyles()
|
||||
for ( int i = 0; i < colorRamps.count(); ++i )
|
||||
{
|
||||
QString name = colorRamps[i];
|
||||
QgsVectorColorRamp* ramp = mStyle->colorRamp( name );
|
||||
QgsColorRamp* ramp = mStyle->colorRamp( name );
|
||||
QIcon icon = QgsSymbolLayerUtils::colorRampPreviewIcon( ramp, cboStyleColorRamp->iconSize() );
|
||||
cboStyleColorRamp->addItem( icon, name );
|
||||
delete ramp;
|
||||
|
@ -42,7 +42,6 @@ SET(QGIS_CORE_SRCS
|
||||
symbology-ng/qgssymbollayerutils.cpp
|
||||
symbology-ng/qgssymbologyconversion.cpp
|
||||
symbology-ng/qgssymbol.cpp
|
||||
symbology-ng/qgsvectorcolorramp.cpp
|
||||
symbology-ng/qgsvectorfieldsymbollayer.cpp
|
||||
|
||||
diagram/qgsdiagram.cpp
|
||||
@ -87,6 +86,7 @@ SET(QGIS_CORE_SRCS
|
||||
qgscacheindex.cpp
|
||||
qgscacheindexfeatureid.cpp
|
||||
qgsclipper.cpp
|
||||
qgscolorramp.cpp
|
||||
qgscolorscheme.cpp
|
||||
qgscolorschemeregistry.cpp
|
||||
qgsconditionalstyle.cpp
|
||||
@ -607,6 +607,7 @@ SET(QGIS_CORE_HDRS
|
||||
qgscacheindex.h
|
||||
qgscacheindexfeatureid.h
|
||||
qgsclipper.h
|
||||
qgscolorramp.h
|
||||
qgscolorscheme.h
|
||||
qgscolorschemeregistry.h
|
||||
qgsconnectionpool.h
|
||||
@ -818,7 +819,6 @@ SET(QGIS_CORE_HDRS
|
||||
symbology-ng/qgssymbollayerutils.h
|
||||
symbology-ng/qgssymbologyconversion.h
|
||||
symbology-ng/qgssymbol.h
|
||||
symbology-ng/qgsvectorcolorramp.h
|
||||
symbology-ng/qgsvectorfieldsymbollayer.h
|
||||
symbology-ng/qgsgeometrygeneratorsymbollayer.h
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "qgsgloweffect.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsimageoperation.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgsunittypes.h"
|
||||
|
||||
QgsGlowEffect::QgsGlowEffect()
|
||||
@ -65,7 +65,7 @@ void QgsGlowEffect::draw( QgsRenderContext &context )
|
||||
|
||||
QImage im = sourceAsImage( context )->copy();
|
||||
|
||||
QgsVectorColorRamp* ramp = nullptr;
|
||||
QgsColorRamp* ramp = nullptr;
|
||||
if ( mColorType == ColorRamp && mRamp )
|
||||
{
|
||||
ramp = mRamp;
|
||||
@ -75,7 +75,7 @@ void QgsGlowEffect::draw( QgsRenderContext &context )
|
||||
//create a temporary ramp
|
||||
QColor transparentColor = mColor;
|
||||
transparentColor.setAlpha( 0 );
|
||||
ramp = new QgsVectorGradientColorRamp( mColor, transparentColor );
|
||||
ramp = new QgsGradientColorRamp( mColor, transparentColor );
|
||||
}
|
||||
|
||||
QgsImageOperation::DistanceTransformProperties dtProps;
|
||||
@ -176,10 +176,10 @@ void QgsGlowEffect::readProperties( const QgsStringMap &props )
|
||||
|
||||
//attempt to create color ramp from props
|
||||
delete mRamp;
|
||||
mRamp = QgsVectorGradientColorRamp::create( props );
|
||||
mRamp = QgsGradientColorRamp::create( props );
|
||||
}
|
||||
|
||||
void QgsGlowEffect::setRamp( QgsVectorColorRamp *ramp )
|
||||
void QgsGlowEffect::setRamp( QgsColorRamp *ramp )
|
||||
{
|
||||
delete mRamp;
|
||||
mRamp = ramp;
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "qgssymbol.h"
|
||||
#include <QPainter>
|
||||
|
||||
class QgsVectorColorRamp;
|
||||
class QgsColorRamp;
|
||||
|
||||
/** \ingroup core
|
||||
* \class QgsGlowEffect
|
||||
@ -151,7 +151,7 @@ class CORE_EXPORT QgsGlowEffect : public QgsPaintEffect
|
||||
* @see ramp
|
||||
* @see setColorType
|
||||
*/
|
||||
void setRamp( QgsVectorColorRamp* ramp );
|
||||
void setRamp( QgsColorRamp* ramp );
|
||||
|
||||
/** 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.
|
||||
@ -159,7 +159,7 @@ class CORE_EXPORT QgsGlowEffect : public QgsPaintEffect
|
||||
* @see setRamp
|
||||
* @see colorType
|
||||
*/
|
||||
QgsVectorColorRamp* ramp() const { return mRamp; }
|
||||
QgsColorRamp* ramp() const { return mRamp; }
|
||||
|
||||
/** Sets the blend mode for the effect
|
||||
* @param mode blend mode used for drawing the effect on to a destination
|
||||
@ -175,7 +175,7 @@ class CORE_EXPORT QgsGlowEffect : public QgsPaintEffect
|
||||
*/
|
||||
QPainter::CompositionMode blendMode() const { return mBlendMode; }
|
||||
|
||||
/** 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
|
||||
@ -185,7 +185,7 @@ class CORE_EXPORT QgsGlowEffect : public QgsPaintEffect
|
||||
*/
|
||||
void setColorType( GlowColorType colorType ) { mColorType = 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
|
||||
@ -211,7 +211,7 @@ class CORE_EXPORT QgsGlowEffect : public QgsPaintEffect
|
||||
double mSpread;
|
||||
QgsUnitTypes::RenderUnit mSpreadUnit;
|
||||
QgsMapUnitScale mSpreadMapUnitScale;
|
||||
QgsVectorColorRamp* mRamp;
|
||||
QgsColorRamp* mRamp;
|
||||
int mBlurLevel;
|
||||
double mTransparency;
|
||||
QColor mColor;
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "qgsimageoperation.h"
|
||||
#include "qgis.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgslogger.h"
|
||||
#include <QtConcurrentMap>
|
||||
#include <QColor>
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <QColor>
|
||||
#include <QtCore/qmath.h>
|
||||
|
||||
class QgsVectorColorRamp;
|
||||
class QgsColorRamp;
|
||||
|
||||
/** \ingroup core
|
||||
* \class QgsImageOperation
|
||||
@ -126,7 +126,7 @@ class CORE_EXPORT 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,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsvectorcolorramp.cpp
|
||||
qgscolorramp.cpp
|
||||
---------------------
|
||||
begin : November 2009
|
||||
copyright : (C) 2009 by Martin Dobias
|
||||
@ -13,7 +13,7 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgscolorbrewerpalette.h"
|
||||
#include "qgscptcityarchive.h"
|
||||
|
||||
@ -42,7 +42,7 @@ static QColor _interpolate( const QColor& c1, const QColor& c2, const double val
|
||||
|
||||
//////////////
|
||||
|
||||
QgsVectorGradientColorRamp::QgsVectorGradientColorRamp( const QColor& color1, const QColor& color2,
|
||||
QgsGradientColorRamp::QgsGradientColorRamp( const QColor& color1, const QColor& color2,
|
||||
bool discrete, const QgsGradientStopsList& stops )
|
||||
: mColor1( color1 )
|
||||
, mColor2( color2 )
|
||||
@ -51,7 +51,7 @@ QgsVectorGradientColorRamp::QgsVectorGradientColorRamp( const QColor& color1, co
|
||||
{
|
||||
}
|
||||
|
||||
QgsVectorColorRamp* QgsVectorGradientColorRamp::create( const QgsStringMap& props )
|
||||
QgsColorRamp* QgsGradientColorRamp::create( const QgsStringMap& props )
|
||||
{
|
||||
// color1 and color2
|
||||
QColor color1 = DEFAULT_GRADIENT_COLOR1;
|
||||
@ -93,12 +93,12 @@ QgsVectorColorRamp* QgsVectorGradientColorRamp::create( const QgsStringMap& prop
|
||||
info[ it.key().mid( 5 )] = it.value();
|
||||
}
|
||||
|
||||
QgsVectorGradientColorRamp* r = new QgsVectorGradientColorRamp( color1, color2, discrete, stops );
|
||||
QgsGradientColorRamp* r = new QgsGradientColorRamp( color1, color2, discrete, stops );
|
||||
r->setInfo( info );
|
||||
return r;
|
||||
}
|
||||
|
||||
double QgsVectorGradientColorRamp::value( int index ) const
|
||||
double QgsGradientColorRamp::value( int index ) const
|
||||
{
|
||||
if ( index <= 0 )
|
||||
{
|
||||
@ -114,7 +114,7 @@ double QgsVectorGradientColorRamp::value( int index ) const
|
||||
}
|
||||
}
|
||||
|
||||
QColor QgsVectorGradientColorRamp::color( double value ) const
|
||||
QColor QgsGradientColorRamp::color( double value ) const
|
||||
{
|
||||
if ( qgsDoubleNear( value, 0.0 ) || value < 0.0 )
|
||||
{
|
||||
@ -160,15 +160,15 @@ QColor QgsVectorGradientColorRamp::color( double value ) const
|
||||
}
|
||||
}
|
||||
|
||||
QgsVectorGradientColorRamp* QgsVectorGradientColorRamp::clone() const
|
||||
QgsGradientColorRamp* QgsGradientColorRamp::clone() const
|
||||
{
|
||||
QgsVectorGradientColorRamp* r = new QgsVectorGradientColorRamp( mColor1, mColor2,
|
||||
QgsGradientColorRamp* r = new QgsGradientColorRamp( mColor1, mColor2,
|
||||
mDiscrete, mStops );
|
||||
r->setInfo( mInfo );
|
||||
return r;
|
||||
}
|
||||
|
||||
QgsStringMap QgsVectorGradientColorRamp::properties() const
|
||||
QgsStringMap QgsGradientColorRamp::properties() const
|
||||
{
|
||||
QgsStringMap map;
|
||||
map["color1"] = QgsSymbolLayerUtils::encodeColor( mColor1 );
|
||||
@ -193,7 +193,7 @@ QgsStringMap QgsVectorGradientColorRamp::properties() const
|
||||
|
||||
return map;
|
||||
}
|
||||
void QgsVectorGradientColorRamp::convertToDiscrete( bool discrete )
|
||||
void QgsGradientColorRamp::convertToDiscrete( bool discrete )
|
||||
{
|
||||
if ( discrete == mDiscrete )
|
||||
return;
|
||||
@ -240,7 +240,7 @@ bool stopLessThan( const QgsGradientStop &s1, const QgsGradientStop &s2 )
|
||||
return s1.offset < s2.offset;
|
||||
}
|
||||
|
||||
void QgsVectorGradientColorRamp::setStops( const QgsGradientStopsList &stops )
|
||||
void QgsGradientColorRamp::setStops( const QgsGradientStopsList &stops )
|
||||
{
|
||||
mStops = stops;
|
||||
|
||||
@ -248,7 +248,7 @@ void QgsVectorGradientColorRamp::setStops( const QgsGradientStopsList &stops )
|
||||
qSort( mStops.begin(), mStops.end(), stopLessThan );
|
||||
}
|
||||
|
||||
void QgsVectorGradientColorRamp::addStopsToGradient( QGradient* gradient, double alpha )
|
||||
void QgsGradientColorRamp::addStopsToGradient( QGradient* gradient, double alpha )
|
||||
{
|
||||
//copy color ramp stops to a QGradient
|
||||
QColor color1 = mColor1;
|
||||
@ -277,7 +277,7 @@ void QgsVectorGradientColorRamp::addStopsToGradient( QGradient* gradient, double
|
||||
//////////////
|
||||
|
||||
|
||||
QgsVectorRandomColorRamp::QgsVectorRandomColorRamp( int count, int hueMin, int hueMax,
|
||||
QgsLimitedRandomColorRamp::QgsLimitedRandomColorRamp( int count, int hueMin, int hueMax,
|
||||
int satMin, int satMax, int valMin, int valMax )
|
||||
: mCount( count )
|
||||
, mHueMin( hueMin ), mHueMax( hueMax )
|
||||
@ -287,7 +287,7 @@ QgsVectorRandomColorRamp::QgsVectorRandomColorRamp( int count, int hueMin, int h
|
||||
updateColors();
|
||||
}
|
||||
|
||||
QgsVectorColorRamp* QgsVectorRandomColorRamp::create( const QgsStringMap& props )
|
||||
QgsColorRamp* QgsLimitedRandomColorRamp::create( const QgsStringMap& props )
|
||||
{
|
||||
int count = DEFAULT_RANDOM_COUNT;
|
||||
int hueMin = DEFAULT_RANDOM_HUE_MIN, hueMax = DEFAULT_RANDOM_HUE_MAX;
|
||||
@ -302,16 +302,16 @@ QgsVectorColorRamp* QgsVectorRandomColorRamp::create( const QgsStringMap& props
|
||||
if ( props.contains( "valMin" ) ) valMin = props["valMin"].toInt();
|
||||
if ( props.contains( "valMax" ) ) valMax = props["valMax"].toInt();
|
||||
|
||||
return new QgsVectorRandomColorRamp( count, hueMin, hueMax, satMin, satMax, valMin, valMax );
|
||||
return new QgsLimitedRandomColorRamp( count, hueMin, hueMax, satMin, satMax, valMin, valMax );
|
||||
}
|
||||
|
||||
double QgsVectorRandomColorRamp::value( int index ) const
|
||||
double QgsLimitedRandomColorRamp::value( int index ) const
|
||||
{
|
||||
if ( mColors.size() < 1 ) return 0;
|
||||
return static_cast< double >( index ) / ( mColors.size() - 1 );
|
||||
}
|
||||
|
||||
QColor QgsVectorRandomColorRamp::color( double value ) const
|
||||
QColor QgsLimitedRandomColorRamp::color( double value ) const
|
||||
{
|
||||
int colorCnt = mColors.count();
|
||||
int colorIdx = static_cast< int >( value * ( colorCnt - 1 ) );
|
||||
@ -322,12 +322,12 @@ QColor QgsVectorRandomColorRamp::color( double value ) const
|
||||
return QColor();
|
||||
}
|
||||
|
||||
QgsVectorRandomColorRamp* QgsVectorRandomColorRamp::clone() const
|
||||
QgsLimitedRandomColorRamp* QgsLimitedRandomColorRamp::clone() const
|
||||
{
|
||||
return new QgsVectorRandomColorRamp( mCount, mHueMin, mHueMax, mSatMin, mSatMax, mValMin, mValMax );
|
||||
return new QgsLimitedRandomColorRamp( mCount, mHueMin, mHueMax, mSatMin, mSatMax, mValMin, mValMax );
|
||||
}
|
||||
|
||||
QgsStringMap QgsVectorRandomColorRamp::properties() const
|
||||
QgsStringMap QgsLimitedRandomColorRamp::properties() const
|
||||
{
|
||||
QgsStringMap map;
|
||||
map["count"] = QString::number( mCount );
|
||||
@ -340,7 +340,7 @@ QgsStringMap QgsVectorRandomColorRamp::properties() const
|
||||
return map;
|
||||
}
|
||||
|
||||
QList<QColor> QgsVectorRandomColorRamp::randomColors( int count,
|
||||
QList<QColor> QgsLimitedRandomColorRamp::randomColors( int count,
|
||||
int hueMax, int hueMin, int satMax, int satMin, int valMax, int valMin )
|
||||
{
|
||||
int h, s, v;
|
||||
@ -373,35 +373,35 @@ QList<QColor> QgsVectorRandomColorRamp::randomColors( int count,
|
||||
return colors;
|
||||
}
|
||||
|
||||
void QgsVectorRandomColorRamp::updateColors()
|
||||
void QgsLimitedRandomColorRamp::updateColors()
|
||||
{
|
||||
mColors = QgsVectorRandomColorRamp::randomColors( mCount, mHueMax, mHueMin, mSatMax, mSatMin, mValMax, mValMin );
|
||||
mColors = QgsLimitedRandomColorRamp::randomColors( mCount, mHueMax, mHueMin, mSatMax, mSatMin, mValMax, mValMin );
|
||||
}
|
||||
|
||||
/////////////
|
||||
|
||||
QgsRandomColors::QgsRandomColors()
|
||||
QgsRandomColorRamp::QgsRandomColorRamp()
|
||||
: mTotalColorCount( 0 )
|
||||
{
|
||||
}
|
||||
|
||||
QgsRandomColors::~QgsRandomColors()
|
||||
QgsRandomColorRamp::~QgsRandomColorRamp()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int QgsRandomColors::count() const
|
||||
int QgsRandomColorRamp::count() const
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
double QgsRandomColors::value( int index ) const
|
||||
double QgsRandomColorRamp::value( int index ) const
|
||||
{
|
||||
Q_UNUSED( index );
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
QColor QgsRandomColors::color( double value ) const
|
||||
QColor QgsRandomColorRamp::color( double value ) const
|
||||
{
|
||||
int minVal = 130;
|
||||
int maxVal = 255;
|
||||
@ -421,7 +421,7 @@ QColor QgsRandomColors::color( double value ) const
|
||||
return QColor::fromHsv( h, s, v );
|
||||
}
|
||||
|
||||
void QgsRandomColors::setTotalColorCount( const int colorCount )
|
||||
void QgsRandomColorRamp::setTotalColorCount( const int colorCount )
|
||||
{
|
||||
//calculate colors in advance, so that we can ensure they are more visually distinct than pure random colors
|
||||
mPrecalculatedColors.clear();
|
||||
@ -453,31 +453,31 @@ void QgsRandomColors::setTotalColorCount( const int colorCount )
|
||||
std::random_shuffle( mPrecalculatedColors.begin(), mPrecalculatedColors.end() );
|
||||
}
|
||||
|
||||
QString QgsRandomColors::type() const
|
||||
QString QgsRandomColorRamp::type() const
|
||||
{
|
||||
return "randomcolors";
|
||||
}
|
||||
|
||||
QgsRandomColors* QgsRandomColors::clone() const
|
||||
QgsRandomColorRamp* QgsRandomColorRamp::clone() const
|
||||
{
|
||||
return new QgsRandomColors();
|
||||
return new QgsRandomColorRamp();
|
||||
}
|
||||
|
||||
QgsStringMap QgsRandomColors::properties() const
|
||||
QgsStringMap QgsRandomColorRamp::properties() const
|
||||
{
|
||||
return QgsStringMap();
|
||||
}
|
||||
|
||||
////////////
|
||||
|
||||
QgsVectorColorBrewerColorRamp::QgsVectorColorBrewerColorRamp( const QString& schemeName, int colors )
|
||||
QgsColorBrewerColorRamp::QgsColorBrewerColorRamp( const QString& schemeName, int colors )
|
||||
: mSchemeName( schemeName )
|
||||
, mColors( colors )
|
||||
{
|
||||
loadPalette();
|
||||
}
|
||||
|
||||
QgsVectorColorRamp* QgsVectorColorBrewerColorRamp::create( const QgsStringMap& props )
|
||||
QgsColorRamp* QgsColorBrewerColorRamp::create( const QgsStringMap& props )
|
||||
{
|
||||
QString schemeName = DEFAULT_COLORBREWER_SCHEMENAME;
|
||||
int colors = DEFAULT_COLORBREWER_COLORS;
|
||||
@ -487,31 +487,31 @@ QgsVectorColorRamp* QgsVectorColorBrewerColorRamp::create( const QgsStringMap& p
|
||||
if ( props.contains( "colors" ) )
|
||||
colors = props["colors"].toInt();
|
||||
|
||||
return new QgsVectorColorBrewerColorRamp( schemeName, colors );
|
||||
return new QgsColorBrewerColorRamp( schemeName, colors );
|
||||
}
|
||||
|
||||
void QgsVectorColorBrewerColorRamp::loadPalette()
|
||||
void QgsColorBrewerColorRamp::loadPalette()
|
||||
{
|
||||
mPalette = QgsColorBrewerPalette::listSchemeColors( mSchemeName, mColors );
|
||||
}
|
||||
|
||||
QStringList QgsVectorColorBrewerColorRamp::listSchemeNames()
|
||||
QStringList QgsColorBrewerColorRamp::listSchemeNames()
|
||||
{
|
||||
return QgsColorBrewerPalette::listSchemes();
|
||||
}
|
||||
|
||||
QList<int> QgsVectorColorBrewerColorRamp::listSchemeVariants( const QString& schemeName )
|
||||
QList<int> QgsColorBrewerColorRamp::listSchemeVariants( const QString& schemeName )
|
||||
{
|
||||
return QgsColorBrewerPalette::listSchemeVariants( schemeName );
|
||||
}
|
||||
|
||||
double QgsVectorColorBrewerColorRamp::value( int index ) const
|
||||
double QgsColorBrewerColorRamp::value( int index ) const
|
||||
{
|
||||
if ( mPalette.size() < 1 ) return 0;
|
||||
return static_cast< double >( index ) / ( mPalette.size() - 1 );
|
||||
}
|
||||
|
||||
QColor QgsVectorColorBrewerColorRamp::color( double value ) const
|
||||
QColor QgsColorBrewerColorRamp::color( double value ) const
|
||||
{
|
||||
if ( mPalette.isEmpty() || value < 0 || value > 1 )
|
||||
return QColor();
|
||||
@ -522,12 +522,12 @@ QColor QgsVectorColorBrewerColorRamp::color( double value ) const
|
||||
return mPalette.at( paletteEntry );
|
||||
}
|
||||
|
||||
QgsVectorColorBrewerColorRamp* QgsVectorColorBrewerColorRamp::clone() const
|
||||
QgsColorBrewerColorRamp* QgsColorBrewerColorRamp::clone() const
|
||||
{
|
||||
return new QgsVectorColorBrewerColorRamp( mSchemeName, mColors );
|
||||
return new QgsColorBrewerColorRamp( mSchemeName, mColors );
|
||||
}
|
||||
|
||||
QgsStringMap QgsVectorColorBrewerColorRamp::properties() const
|
||||
QgsStringMap QgsColorBrewerColorRamp::properties() const
|
||||
{
|
||||
QgsStringMap map;
|
||||
map["schemeName"] = mSchemeName;
|
||||
@ -541,7 +541,7 @@ QgsStringMap QgsVectorColorBrewerColorRamp::properties() const
|
||||
|
||||
QgsCptCityColorRamp::QgsCptCityColorRamp( const QString& schemeName, const QString& variantName,
|
||||
bool doLoadFile )
|
||||
: QgsVectorGradientColorRamp()
|
||||
: QgsGradientColorRamp()
|
||||
, mSchemeName( schemeName ), mVariantName( variantName )
|
||||
, mVariantList( QStringList() ), mFileLoaded( false ), mMultiStops( false )
|
||||
{
|
||||
@ -553,7 +553,7 @@ QgsCptCityColorRamp::QgsCptCityColorRamp( const QString& schemeName, const QStri
|
||||
|
||||
QgsCptCityColorRamp::QgsCptCityColorRamp( const QString& schemeName, const QStringList& variantList,
|
||||
const QString& variantName, bool doLoadFile )
|
||||
: QgsVectorGradientColorRamp()
|
||||
: QgsGradientColorRamp()
|
||||
, mSchemeName( schemeName ), mVariantName( variantName )
|
||||
, mVariantList( variantList ), mFileLoaded( false ), mMultiStops( false )
|
||||
{
|
||||
@ -565,7 +565,7 @@ QgsCptCityColorRamp::QgsCptCityColorRamp( const QString& schemeName, const QStri
|
||||
loadFile();
|
||||
}
|
||||
|
||||
QgsVectorColorRamp* QgsCptCityColorRamp::create( const QgsStringMap& props )
|
||||
QgsColorRamp* QgsCptCityColorRamp::create( const QgsStringMap& props )
|
||||
{
|
||||
QString schemeName = DEFAULT_CPTCITY_SCHEMENAME;
|
||||
QString variantName = DEFAULT_CPTCITY_VARIANTNAME;
|
||||
@ -599,10 +599,10 @@ void QgsCptCityColorRamp::copy( const QgsCptCityColorRamp* other )
|
||||
mFileLoaded = other->mFileLoaded;
|
||||
}
|
||||
|
||||
QgsVectorGradientColorRamp* QgsCptCityColorRamp::cloneGradientRamp() const
|
||||
QgsGradientColorRamp* QgsCptCityColorRamp::cloneGradientRamp() const
|
||||
{
|
||||
QgsVectorGradientColorRamp* ramp =
|
||||
new QgsVectorGradientColorRamp( mColor1, mColor2, mDiscrete, mStops );
|
||||
QgsGradientColorRamp* ramp =
|
||||
new QgsGradientColorRamp( mColor1, mColor2, mDiscrete, mStops );
|
||||
// add author and copyright information
|
||||
// TODO also add COPYING.xml file/link?
|
||||
QgsStringMap info = copyingInfo();
|
@ -1,5 +1,5 @@
|
||||
/***************************************************************************
|
||||
qgsvectorcolorramp.h
|
||||
qgscolorramp.h
|
||||
---------------------
|
||||
begin : November 2009
|
||||
copyright : (C) 2009 by Martin Dobias
|
||||
@ -13,23 +13,22 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef QGSVECTORCOLORRAMPV2_H
|
||||
#define QGSVECTORCOLORRAMPV2_H
|
||||
#ifndef QGSCOLORRAMP_H
|
||||
#define QGSCOLORRAMP_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QGradient>
|
||||
#include "qgis.h"
|
||||
|
||||
/** \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 CORE_EXPORT QgsVectorColorRamp
|
||||
class CORE_EXPORT QgsColorRamp
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~QgsVectorColorRamp() {}
|
||||
virtual ~QgsColorRamp() {}
|
||||
|
||||
/** Returns number of defined colors, or -1 if undefined
|
||||
*/
|
||||
@ -51,7 +50,7 @@ class CORE_EXPORT QgsVectorColorRamp
|
||||
|
||||
/** Creates a clone of the color ramp.
|
||||
*/
|
||||
virtual QgsVectorColorRamp* clone() const = 0;
|
||||
virtual QgsColorRamp* clone() const = 0;
|
||||
|
||||
/** Returns a string map containing all the color ramp's properties.
|
||||
*/
|
||||
@ -60,19 +59,19 @@ class CORE_EXPORT 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 CORE_EXPORT QgsGradientStop
|
||||
{
|
||||
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 )
|
||||
: offset( o )
|
||||
, color( c )
|
||||
QgsGradientStop( double offset, const QColor& color )
|
||||
: offset( offset )
|
||||
, color( color )
|
||||
{ }
|
||||
|
||||
//! Relative positional offset, between 0 and 1
|
||||
@ -93,35 +92,34 @@ typedef QList<QgsGradientStop> QgsGradientStopsList;
|
||||
#define DEFAULT_GRADIENT_COLOR2 QColor(0,255,0)
|
||||
|
||||
/** \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 CORE_EXPORT QgsVectorGradientColorRamp : public QgsVectorColorRamp
|
||||
class CORE_EXPORT QgsGradientColorRamp : public QgsColorRamp
|
||||
{
|
||||
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 = DEFAULT_GRADIENT_COLOR2,
|
||||
bool discrete = false,
|
||||
const QgsGradientStopsList& stops = QgsGradientStopsList() );
|
||||
|
||||
//! Creates a new QgsVectorColorRamp from a map of properties
|
||||
static QgsVectorColorRamp* create( const QgsStringMap& properties = QgsStringMap() );
|
||||
//! Creates a new QgsColorRamp from a map of properties
|
||||
static QgsColorRamp* create( const QgsStringMap& properties = QgsStringMap() );
|
||||
|
||||
virtual int count() const override { return mStops.count() + 2; }
|
||||
virtual double value( int index ) const override;
|
||||
virtual QColor color( double value ) const override;
|
||||
virtual QString type() const override { return "gradient"; }
|
||||
virtual QgsVectorGradientColorRamp* clone() const override;
|
||||
virtual QgsGradientColorRamp* clone() const override;
|
||||
virtual QgsStringMap properties() const override;
|
||||
|
||||
/** Returns the gradient start color.
|
||||
@ -221,19 +219,18 @@ class CORE_EXPORT QgsVectorGradientColorRamp : public QgsVectorColorRamp
|
||||
#define DEFAULT_RANDOM_SAT_MAX 240
|
||||
|
||||
/** \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 CORE_EXPORT QgsVectorRandomColorRamp : public QgsVectorColorRamp
|
||||
class CORE_EXPORT QgsLimitedRandomColorRamp : public QgsColorRamp
|
||||
{
|
||||
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() );
|
||||
static QgsColorRamp* create( const QgsStringMap& properties = QgsStringMap() );
|
||||
|
||||
virtual double value( int index ) const override;
|
||||
|
||||
@ -241,7 +238,7 @@ class CORE_EXPORT QgsVectorRandomColorRamp : public QgsVectorColorRamp
|
||||
|
||||
virtual QString type() const override { return "random"; }
|
||||
|
||||
virtual QgsVectorRandomColorRamp* clone() const override;
|
||||
virtual QgsLimitedRandomColorRamp* clone() const override;
|
||||
|
||||
virtual QgsStringMap properties() const override;
|
||||
|
||||
@ -278,13 +275,13 @@ class CORE_EXPORT QgsVectorRandomColorRamp : public QgsVectorColorRamp
|
||||
};
|
||||
|
||||
/** \ingroup core
|
||||
* \class QgsRandomColors
|
||||
* \class QgsRandomColorRamp
|
||||
*/
|
||||
class CORE_EXPORT QgsRandomColors: public QgsVectorColorRamp
|
||||
class CORE_EXPORT QgsRandomColorRamp: public QgsColorRamp
|
||||
{
|
||||
public:
|
||||
QgsRandomColors();
|
||||
~QgsRandomColors();
|
||||
QgsRandomColorRamp();
|
||||
~QgsRandomColorRamp();
|
||||
|
||||
int count() const override;
|
||||
|
||||
@ -302,7 +299,7 @@ class CORE_EXPORT QgsRandomColors: public QgsVectorColorRamp
|
||||
|
||||
QString type() const override;
|
||||
|
||||
QgsRandomColors* clone() const override;
|
||||
QgsRandomColorRamp* clone() const override;
|
||||
|
||||
QgsStringMap properties() const override;
|
||||
|
||||
@ -318,15 +315,15 @@ class CORE_EXPORT QgsRandomColors: public QgsVectorColorRamp
|
||||
#define DEFAULT_COLORBREWER_COLORS 5
|
||||
|
||||
/** \ingroup core
|
||||
* \class QgsVectorColorBrewerColorRamp
|
||||
* \class QgsColorBrewerColorRamp
|
||||
*/
|
||||
class CORE_EXPORT QgsVectorColorBrewerColorRamp : public QgsVectorColorRamp
|
||||
class CORE_EXPORT QgsColorBrewerColorRamp : public QgsColorRamp
|
||||
{
|
||||
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() );
|
||||
static QgsColorRamp* create( const QgsStringMap& properties = QgsStringMap() );
|
||||
|
||||
virtual double value( int index ) const override;
|
||||
|
||||
@ -334,7 +331,7 @@ class CORE_EXPORT QgsVectorColorBrewerColorRamp : public QgsVectorColorRamp
|
||||
|
||||
virtual QString type() const override { return "colorbrewer"; }
|
||||
|
||||
virtual QgsVectorColorBrewerColorRamp* clone() const override;
|
||||
virtual QgsColorBrewerColorRamp* clone() const override;
|
||||
|
||||
virtual QgsStringMap properties() const override;
|
||||
|
||||
@ -364,7 +361,7 @@ class CORE_EXPORT QgsVectorColorBrewerColorRamp : public QgsVectorColorRamp
|
||||
/** \ingroup core
|
||||
* \class QgsCptCityColorRamp
|
||||
*/
|
||||
class CORE_EXPORT QgsCptCityColorRamp : public QgsVectorGradientColorRamp
|
||||
class CORE_EXPORT QgsCptCityColorRamp : public QgsGradientColorRamp
|
||||
{
|
||||
public:
|
||||
QgsCptCityColorRamp( const QString& schemeName = DEFAULT_CPTCITY_SCHEMENAME,
|
||||
@ -373,13 +370,13 @@ class CORE_EXPORT QgsCptCityColorRamp : public QgsVectorGradientColorRamp
|
||||
QgsCptCityColorRamp( const QString& schemeName, const QStringList& variantList,
|
||||
const QString& variantName = QString(), bool doLoadFile = true );
|
||||
|
||||
static QgsVectorColorRamp* create( const QgsStringMap& properties = QgsStringMap() );
|
||||
static QgsColorRamp* create( const QgsStringMap& properties = QgsStringMap() );
|
||||
|
||||
virtual QString type() const override { return "cpt-city"; }
|
||||
|
||||
virtual QgsCptCityColorRamp* clone() const override;
|
||||
void copy( const QgsCptCityColorRamp* other );
|
||||
QgsVectorGradientColorRamp* cloneGradientRamp() const;
|
||||
QgsGradientColorRamp* cloneGradientRamp() const;
|
||||
|
||||
virtual QgsStringMap properties() const override;
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "qgsogcutils.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgsstyle.h"
|
||||
#include "qgsexpressioncontext.h"
|
||||
#include "qgsproject.h"
|
||||
@ -2669,7 +2669,7 @@ static QVariant fncColorRgba( const QVariantList &values, const QgsExpressionCon
|
||||
QVariant fcnRampColor( const QVariantList &values, const QgsExpressionContext *, QgsExpression *parent )
|
||||
{
|
||||
QString rampName = getStringValue( values.at( 0 ), parent );
|
||||
const QgsVectorColorRamp *mRamp = QgsStyle::defaultStyle()->colorRampRef( rampName );
|
||||
const QgsColorRamp *mRamp = QgsStyle::defaultStyle()->colorRampRef( rampName );
|
||||
if ( ! mRamp )
|
||||
{
|
||||
parent->setEvalErrorString( QObject::tr( "\"%1\" is not a valid color ramp" ).arg( rampName ) );
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
#include "qgssymbol.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgspointdisplacementrenderer.h"
|
||||
#include "qgsinvertedpolygonrenderer.h"
|
||||
#include "qgspainteffect.h"
|
||||
@ -900,24 +900,24 @@ void QgsCategorizedSymbolRenderer::setSourceSymbol( QgsSymbol* sym )
|
||||
mSourceSymbol.reset( sym );
|
||||
}
|
||||
|
||||
QgsVectorColorRamp* QgsCategorizedSymbolRenderer::sourceColorRamp()
|
||||
QgsColorRamp* QgsCategorizedSymbolRenderer::sourceColorRamp()
|
||||
{
|
||||
return mSourceColorRamp.data();
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRenderer::setSourceColorRamp( QgsVectorColorRamp* ramp )
|
||||
void QgsCategorizedSymbolRenderer::setSourceColorRamp( QgsColorRamp* ramp )
|
||||
{
|
||||
mSourceColorRamp.reset( ramp );
|
||||
}
|
||||
|
||||
void QgsCategorizedSymbolRenderer::updateColorRamp( QgsVectorColorRamp* ramp, bool inverted )
|
||||
void QgsCategorizedSymbolRenderer::updateColorRamp( QgsColorRamp* ramp, bool inverted )
|
||||
{
|
||||
setSourceColorRamp( ramp );
|
||||
setInvertedColorRamp( inverted );
|
||||
double num = mCategories.count() - 1;
|
||||
double count = 0;
|
||||
|
||||
QgsRandomColors* randomRamp = dynamic_cast<QgsRandomColors*>( ramp );
|
||||
QgsRandomColorRamp* randomRamp = dynamic_cast<QgsRandomColorRamp*>( ramp );
|
||||
if ( randomRamp )
|
||||
{
|
||||
//ramp is a random colors ramp, so inform it of the total number of required colors
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include <QHash>
|
||||
#include <QScopedPointer>
|
||||
|
||||
class QgsVectorColorRamp;
|
||||
class QgsColorRamp;
|
||||
class QgsVectorLayer;
|
||||
|
||||
/** \ingroup core
|
||||
@ -182,14 +182,14 @@ class CORE_EXPORT QgsCategorizedSymbolRenderer : public 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 );
|
||||
void setSourceColorRamp( QgsColorRamp* ramp );
|
||||
|
||||
//! @note added in 2.1
|
||||
bool invertedColorRamp() { return mInvertedColorRamp; }
|
||||
@ -200,7 +200,7 @@ class CORE_EXPORT QgsCategorizedSymbolRenderer : public QgsFeatureRenderer
|
||||
* @param inverted set to true to invert ramp colors
|
||||
* @note added in 2.5
|
||||
*/
|
||||
void updateColorRamp( QgsVectorColorRamp* ramp, bool inverted = false );
|
||||
void updateColorRamp( QgsColorRamp* ramp, bool inverted = false );
|
||||
|
||||
Q_DECL_DEPRECATED void setRotationField( const QString& fieldOrExpression ) override;
|
||||
Q_DECL_DEPRECATED QString rotationField() const override;
|
||||
@ -238,7 +238,7 @@ class CORE_EXPORT QgsCategorizedSymbolRenderer : public QgsFeatureRenderer
|
||||
QString mAttrName;
|
||||
QgsCategoryList mCategories;
|
||||
QScopedPointer<QgsSymbol> mSourceSymbol;
|
||||
QScopedPointer<QgsVectorColorRamp> mSourceColorRamp;
|
||||
QScopedPointer<QgsColorRamp> mSourceColorRamp;
|
||||
bool mInvertedColorRamp;
|
||||
QScopedPointer<QgsExpression> mRotation;
|
||||
QScopedPointer<QgsExpression> mSizeScale;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#ifndef QGSCPTCITYARCHIVE_H
|
||||
#define QGSCPTCITYARCHIVE_H
|
||||
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QIcon>
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "qgsproject.h"
|
||||
#include "qgssvgcache.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgsunittypes.h"
|
||||
|
||||
#include <QPainter>
|
||||
@ -539,7 +539,7 @@ QgsSymbolLayer* QgsGradientFillSymbolLayer::create( const QgsStringMap& props )
|
||||
offset = QgsSymbolLayerUtils::decodePoint( props["offset"] );
|
||||
|
||||
//attempt to create color ramp from props
|
||||
QgsVectorColorRamp* gradientRamp = QgsVectorGradientColorRamp::create( props );
|
||||
QgsColorRamp* gradientRamp = QgsGradientColorRamp::create( props );
|
||||
|
||||
//create a new gradient fill layer with desired properties
|
||||
QgsGradientFillSymbolLayer* sl = new QgsGradientFillSymbolLayer( color, color2, colorType, type, coordinateMode, gradientSpread );
|
||||
@ -561,7 +561,7 @@ QgsSymbolLayer* QgsGradientFillSymbolLayer::create( const QgsStringMap& props )
|
||||
return sl;
|
||||
}
|
||||
|
||||
void QgsGradientFillSymbolLayer::setColorRamp( QgsVectorColorRamp* ramp )
|
||||
void QgsGradientFillSymbolLayer::setColorRamp( QgsColorRamp* ramp )
|
||||
{
|
||||
delete mGradientRamp;
|
||||
mGradientRamp = ramp;
|
||||
@ -765,7 +765,7 @@ QPointF QgsGradientFillSymbolLayer::rotateReferencePoint( QPointF refPoint, doub
|
||||
|
||||
void QgsGradientFillSymbolLayer::applyGradient( const QgsSymbolRenderContext &context, QBrush &brush,
|
||||
const QColor &color, const QColor &color2, GradientColorType gradientColorType,
|
||||
QgsVectorColorRamp *gradientRamp, GradientType gradientType,
|
||||
QgsColorRamp *gradientRamp, GradientType gradientType,
|
||||
GradientCoordinateMode coordinateMode, GradientSpread gradientSpread,
|
||||
QPointF referencePoint1, QPointF referencePoint2, const double angle )
|
||||
{
|
||||
@ -819,7 +819,7 @@ void QgsGradientFillSymbolLayer::applyGradient( const QgsSymbolRenderContext &co
|
||||
if ( gradientColorType == QgsGradientFillSymbolLayer::ColorRamp && gradientRamp && gradientRamp->type() == "gradient" )
|
||||
{
|
||||
//color ramp gradient
|
||||
QgsVectorGradientColorRamp* gradRamp = static_cast<QgsVectorGradientColorRamp*>( gradientRamp );
|
||||
QgsGradientColorRamp* gradRamp = static_cast<QgsGradientColorRamp*>( gradientRamp );
|
||||
gradRamp->addStopsToGradient( &gradient, context.alpha() );
|
||||
}
|
||||
else
|
||||
@ -1021,7 +1021,7 @@ QgsSymbolLayer* QgsShapeburstFillSymbolLayer::create( const QgsStringMap& props
|
||||
}
|
||||
|
||||
//attempt to create color ramp from props
|
||||
QgsVectorColorRamp* gradientRamp = QgsVectorGradientColorRamp::create( props );
|
||||
QgsColorRamp* gradientRamp = QgsGradientColorRamp::create( props );
|
||||
|
||||
//create a new shapeburst fill layer with desired properties
|
||||
QgsShapeburstFillSymbolLayer* sl = new QgsShapeburstFillSymbolLayer( color, color2, colorType, blurRadius, useWholeShape, maxDistance );
|
||||
@ -1061,7 +1061,7 @@ QString QgsShapeburstFillSymbolLayer::layerType() const
|
||||
return "ShapeburstFill";
|
||||
}
|
||||
|
||||
void QgsShapeburstFillSymbolLayer::setColorRamp( QgsVectorColorRamp* ramp )
|
||||
void QgsShapeburstFillSymbolLayer::setColorRamp( QgsColorRamp* ramp )
|
||||
{
|
||||
delete mGradientRamp;
|
||||
mGradientRamp = ramp;
|
||||
@ -1188,7 +1188,7 @@ void QgsShapeburstFillSymbolLayer::renderPolygon( const QPolygonF& points, QList
|
||||
//if we are using the two color mode, create a gradient ramp
|
||||
if ( mColorType == QgsShapeburstFillSymbolLayer::SimpleTwoColor )
|
||||
{
|
||||
mTwoColorGradientRamp = new QgsVectorGradientColorRamp( color1, color2 );
|
||||
mTwoColorGradientRamp = new QgsGradientColorRamp( color1, color2 );
|
||||
}
|
||||
|
||||
//no border for shapeburst fills
|
||||
@ -1406,7 +1406,7 @@ double * QgsShapeburstFillSymbolLayer::distanceTransform( QImage *im )
|
||||
return dtArray;
|
||||
}
|
||||
|
||||
void QgsShapeburstFillSymbolLayer::dtArrayToQImage( double * array, QImage *im, QgsVectorColorRamp* ramp, double layerAlpha, bool useWholeShape, int maxPixelDistance )
|
||||
void QgsShapeburstFillSymbolLayer::dtArrayToQImage( double * array, QImage *im, QgsColorRamp* ramp, double layerAlpha, bool useWholeShape, int maxPixelDistance )
|
||||
{
|
||||
int width = im->width();
|
||||
int height = im->height();
|
||||
|
@ -165,7 +165,7 @@ class CORE_EXPORT QgsSimpleFillSymbolLayer : public QgsFillSymbolLayer
|
||||
void applyDataDefinedSymbology( QgsSymbolRenderContext& context, QBrush& brush, QPen& pen, QPen& selPen );
|
||||
};
|
||||
|
||||
class QgsVectorColorRamp;
|
||||
class QgsColorRamp;
|
||||
|
||||
/** \ingroup core
|
||||
* \class QgsGradientFillSymbolLayer
|
||||
@ -239,8 +239,8 @@ class CORE_EXPORT QgsGradientFillSymbolLayer : public QgsFillSymbolLayer
|
||||
void setGradientColorType( GradientColorType gradientColorType ) { mGradientColorType = gradientColorType; }
|
||||
|
||||
/** Color ramp used for the gradient fill, only used if the gradient color type is set to ColorRamp*/
|
||||
QgsVectorColorRamp* colorRamp() { return mGradientRamp; }
|
||||
void setColorRamp( QgsVectorColorRamp* ramp );
|
||||
QgsColorRamp* colorRamp() { return mGradientRamp; }
|
||||
void setColorRamp( QgsColorRamp* ramp );
|
||||
|
||||
/** Color for endpoint of gradient, only used if the gradient color type is set to SimpleTwoColor*/
|
||||
QColor color2() const { return mColor2; }
|
||||
@ -293,7 +293,7 @@ class CORE_EXPORT QgsGradientFillSymbolLayer : public QgsFillSymbolLayer
|
||||
|
||||
GradientColorType mGradientColorType;
|
||||
QColor mColor2;
|
||||
QgsVectorColorRamp* mGradientRamp;
|
||||
QgsColorRamp* mGradientRamp;
|
||||
GradientType mGradientType;
|
||||
GradientCoordinateMode mCoordinateMode;
|
||||
GradientSpread mGradientSpread;
|
||||
@ -314,7 +314,7 @@ class CORE_EXPORT QgsGradientFillSymbolLayer : public QgsFillSymbolLayer
|
||||
|
||||
/** Applies the gradient to a brush*/
|
||||
void applyGradient( const QgsSymbolRenderContext& context, QBrush& brush, const QColor& color, const QColor& color2,
|
||||
GradientColorType gradientColorType, QgsVectorColorRamp *gradientRamp, GradientType gradientType,
|
||||
GradientColorType gradientColorType, QgsColorRamp *gradientRamp, GradientType gradientType,
|
||||
GradientCoordinateMode coordinateMode, GradientSpread gradientSpread,
|
||||
QPointF referencePoint1, QPointF referencePoint2, const double angle );
|
||||
|
||||
@ -425,7 +425,7 @@ class CORE_EXPORT QgsShapeburstFillSymbolLayer : public QgsFillSymbolLayer
|
||||
void setDistanceMapUnitScale( const QgsMapUnitScale& scale ) { mDistanceMapUnitScale = scale; }
|
||||
const QgsMapUnitScale& distanceMapUnitScale() const { return mDistanceMapUnitScale; }
|
||||
|
||||
/** Sets the color mode to use for the shapeburst fill. Shapeburst can either be drawn using a QgsVectorColorRamp color ramp
|
||||
/** Sets the color mode to use for the shapeburst fill. Shapeburst can either be drawn using a QgsColorRamp color ramp
|
||||
* or by simply specificing a start and end color. setColorType is used to specify which mode to use for the fill.
|
||||
* @param colorType color type to use for shapeburst fill
|
||||
* @note added in 2.3
|
||||
@ -435,7 +435,7 @@ class CORE_EXPORT QgsShapeburstFillSymbolLayer : public QgsFillSymbolLayer
|
||||
* @see setColorRamp
|
||||
*/
|
||||
void setColorType( ShapeburstColorType colorType ) { mColorType = colorType; }
|
||||
/** Returns the color mode used for the shapeburst fill. Shapeburst can either be drawn using a QgsVectorColorRamp color ramp
|
||||
/** Returns the color mode used for the shapeburst fill. Shapeburst can either be drawn using a QgsColorRamp color ramp
|
||||
* or by simply specificing a start and end color.
|
||||
* @returns current color mode used for the shapeburst fill
|
||||
* @note added in 2.3
|
||||
@ -452,14 +452,14 @@ class CORE_EXPORT QgsShapeburstFillSymbolLayer : public QgsFillSymbolLayer
|
||||
* @see setColorType
|
||||
* @see colorRamp
|
||||
*/
|
||||
void setColorRamp( QgsVectorColorRamp* ramp );
|
||||
void setColorRamp( QgsColorRamp* ramp );
|
||||
/** Returns the color ramp used for the shapeburst fill. The color ramp is only used if the colorType is set to ShapeburstColorType::ColorRamp
|
||||
* @returns a QgsVectorColorRamp color ramp
|
||||
* @returns a QgsColorRamp color ramp
|
||||
* @note added in 2.3
|
||||
* @see setColorRamp
|
||||
* @see colorType
|
||||
*/
|
||||
QgsVectorColorRamp* colorRamp() { return mGradientRamp; }
|
||||
QgsColorRamp* colorRamp() { return mGradientRamp; }
|
||||
|
||||
/** Sets the color for the endpoint of the shapeburst fill. This color is only used if setColorType is set ShapeburstColorType::SimpleTwoColor.
|
||||
* @param color2 QColor to use for endpoint of gradient
|
||||
@ -542,8 +542,8 @@ class CORE_EXPORT QgsShapeburstFillSymbolLayer : public QgsFillSymbolLayer
|
||||
|
||||
ShapeburstColorType mColorType;
|
||||
QColor mColor2;
|
||||
QgsVectorColorRamp* mGradientRamp;
|
||||
QgsVectorColorRamp* mTwoColorGradientRamp;
|
||||
QgsColorRamp* mGradientRamp;
|
||||
QgsColorRamp* mTwoColorGradientRamp;
|
||||
|
||||
bool mIgnoreRings;
|
||||
|
||||
@ -565,7 +565,7 @@ class CORE_EXPORT QgsShapeburstFillSymbolLayer : public QgsFillSymbolLayer
|
||||
double * distanceTransform( QImage * im );
|
||||
|
||||
/* fills a QImage with values from an array of doubles containing squared distance transform values */
|
||||
void dtArrayToQImage( double * array, QImage *im, QgsVectorColorRamp* ramp, double layerAlpha = 1, bool useWholeShape = true, int maxPixelDistance = 0 );
|
||||
void dtArrayToQImage( double * array, QImage *im, QgsColorRamp* ramp, double layerAlpha = 1, bool useWholeShape = true, int maxPixelDistance = 0 );
|
||||
};
|
||||
|
||||
/** \ingroup core
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "qgssymbol.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgspointdisplacementrenderer.h"
|
||||
#include "qgsinvertedpolygonrenderer.h"
|
||||
#include "qgspainteffect.h"
|
||||
@ -843,7 +843,7 @@ QgsGraduatedSymbolRenderer* QgsGraduatedSymbolRenderer::createRenderer(
|
||||
int classes,
|
||||
Mode mode,
|
||||
QgsSymbol* symbol,
|
||||
QgsVectorColorRamp* ramp,
|
||||
QgsColorRamp* ramp,
|
||||
bool inverted,
|
||||
const QgsRendererRangeLabelFormat& labelFormat
|
||||
)
|
||||
@ -1315,12 +1315,12 @@ void QgsGraduatedSymbolRenderer::setSourceSymbol( QgsSymbol* sym )
|
||||
mSourceSymbol.reset( sym );
|
||||
}
|
||||
|
||||
QgsVectorColorRamp* QgsGraduatedSymbolRenderer::sourceColorRamp()
|
||||
QgsColorRamp* QgsGraduatedSymbolRenderer::sourceColorRamp()
|
||||
{
|
||||
return mSourceColorRamp.data();
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRenderer::setSourceColorRamp( QgsVectorColorRamp* ramp )
|
||||
void QgsGraduatedSymbolRenderer::setSourceColorRamp( QgsColorRamp* ramp )
|
||||
{
|
||||
mSourceColorRamp.reset( ramp );
|
||||
}
|
||||
@ -1371,7 +1371,7 @@ void QgsGraduatedSymbolRenderer::setSymbolSizes( double minSize, double maxSize
|
||||
}
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRenderer::updateColorRamp( QgsVectorColorRamp *ramp, bool inverted )
|
||||
void QgsGraduatedSymbolRenderer::updateColorRamp( QgsColorRamp *ramp, bool inverted )
|
||||
{
|
||||
int i = 0;
|
||||
if ( ramp )
|
||||
|
@ -123,7 +123,7 @@ class CORE_EXPORT QgsRendererRangeLabelFormat
|
||||
};
|
||||
|
||||
class QgsVectorLayer;
|
||||
class QgsVectorColorRamp;
|
||||
class QgsColorRamp;
|
||||
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
/** \ingroup core
|
||||
@ -253,7 +253,7 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
int classes,
|
||||
Mode mode,
|
||||
QgsSymbol* symbol,
|
||||
QgsVectorColorRamp* ramp,
|
||||
QgsColorRamp* ramp,
|
||||
bool inverted = false,
|
||||
const QgsRendererRangeLabelFormat& legendFormat = QgsRendererRangeLabelFormat()
|
||||
);
|
||||
@ -295,12 +295,12 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
* @see setSourceColorRamp()
|
||||
* @see sourceSymbol()
|
||||
*/
|
||||
QgsVectorColorRamp* sourceColorRamp();
|
||||
QgsColorRamp* sourceColorRamp();
|
||||
|
||||
/** Sets the source color ramp.
|
||||
* @param ramp color ramp. Ownership is transferred to the renderer
|
||||
*/
|
||||
void setSourceColorRamp( QgsVectorColorRamp* ramp );
|
||||
void setSourceColorRamp( QgsColorRamp* ramp );
|
||||
|
||||
//! @note added in 2.1
|
||||
bool invertedColorRamp() { return mInvertedColorRamp; }
|
||||
@ -311,7 +311,7 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
* @param ramp color ramp. Ownership is transferred to the renderer
|
||||
* @param inverted set to true to invert ramp colors
|
||||
*/
|
||||
void updateColorRamp( QgsVectorColorRamp* ramp = nullptr, bool inverted = false );
|
||||
void updateColorRamp( QgsColorRamp* ramp = nullptr, bool inverted = false );
|
||||
|
||||
/** Update all the symbols but leave breaks and colors. This method also sets the source
|
||||
* symbol for the renderer.
|
||||
@ -380,7 +380,7 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
QgsRangeList mRanges;
|
||||
Mode mMode;
|
||||
QScopedPointer<QgsSymbol> mSourceSymbol;
|
||||
QScopedPointer<QgsVectorColorRamp> mSourceColorRamp;
|
||||
QScopedPointer<QgsColorRamp> mSourceColorRamp;
|
||||
bool mInvertedColorRamp;
|
||||
QgsRendererRangeLabelFormat mLabelFormat;
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgssymbollayer.h"
|
||||
#include "qgsogcutils.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgsrendercontext.h"
|
||||
#include "qgspainteffect.h"
|
||||
#include "qgspainteffectregistry.h"
|
||||
@ -45,7 +45,7 @@ QgsHeatmapRenderer::QgsHeatmapRenderer()
|
||||
, mRenderQuality( 3 )
|
||||
, mFeaturesRendered( 0 )
|
||||
{
|
||||
mGradientRamp = new QgsVectorGradientColorRamp( QColor( 255, 255, 255 ), QColor( 0, 0, 0 ) );
|
||||
mGradientRamp = new QgsGradientColorRamp( QColor( 255, 255, 255 ), QColor( 0, 0, 0 ) );
|
||||
|
||||
}
|
||||
|
||||
@ -413,7 +413,7 @@ QgsHeatmapRenderer* QgsHeatmapRenderer::convertFromRenderer( const QgsFeatureRen
|
||||
}
|
||||
}
|
||||
|
||||
void QgsHeatmapRenderer::setColorRamp( QgsVectorColorRamp *ramp )
|
||||
void QgsHeatmapRenderer::setColorRamp( QgsColorRamp *ramp )
|
||||
{
|
||||
delete mGradientRamp;
|
||||
mGradientRamp = ramp;
|
||||
|
@ -22,7 +22,7 @@
|
||||
#include "qgsgeometry.h"
|
||||
#include <QScopedPointer>
|
||||
|
||||
class QgsVectorColorRamp;
|
||||
class QgsColorRamp;
|
||||
|
||||
/** \ingroup core
|
||||
* \class QgsHeatmapRenderer
|
||||
@ -61,12 +61,12 @@ class CORE_EXPORT QgsHeatmapRenderer : public QgsFeatureRenderer
|
||||
* @returns color ramp for heatmap
|
||||
* @see setColorRamp
|
||||
*/
|
||||
QgsVectorColorRamp* colorRamp() const { return mGradientRamp; }
|
||||
QgsColorRamp* colorRamp() const { return mGradientRamp; }
|
||||
/** Sets the color ramp to use for shading the heatmap.
|
||||
* @param ramp color ramp for heatmap. Ownership of ramp is transferred to the renderer.
|
||||
* @see colorRamp
|
||||
*/
|
||||
void setColorRamp( QgsVectorColorRamp* ramp );
|
||||
void setColorRamp( QgsColorRamp* ramp );
|
||||
|
||||
/** Returns whether the ramp is inverted
|
||||
* @returns true if color ramp is inverted
|
||||
@ -185,7 +185,7 @@ class CORE_EXPORT QgsHeatmapRenderer : public QgsFeatureRenderer
|
||||
int mWeightAttrNum;
|
||||
QScopedPointer<QgsExpression> mWeightExpression;
|
||||
|
||||
QgsVectorColorRamp* mGradientRamp;
|
||||
QgsColorRamp* mGradientRamp;
|
||||
bool mInvertRamp;
|
||||
|
||||
double mExplicitMax;
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "qgsstyle.h"
|
||||
|
||||
#include "qgssymbol.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
|
||||
#include "qgssymbollayerregistry.h"
|
||||
|
||||
@ -183,7 +183,7 @@ QStringList QgsStyle::symbolNames()
|
||||
}
|
||||
|
||||
|
||||
bool QgsStyle::addColorRamp( const QString& name, QgsVectorColorRamp* colorRamp, bool update )
|
||||
bool QgsStyle::addColorRamp( const QString& name, QgsColorRamp* colorRamp, bool update )
|
||||
{
|
||||
if ( !colorRamp || name.isEmpty() )
|
||||
return false;
|
||||
@ -207,7 +207,7 @@ bool QgsStyle::addColorRamp( const QString& name, QgsVectorColorRamp* colorRamp,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QgsStyle::saveColorRamp( const QString& name, QgsVectorColorRamp* ramp, int groupid, const QStringList& tags )
|
||||
bool QgsStyle::saveColorRamp( const QString& name, QgsColorRamp* ramp, int groupid, const QStringList& tags )
|
||||
{
|
||||
// insert it into the database
|
||||
QDomDocument doc( "dummy" );
|
||||
@ -238,7 +238,7 @@ bool QgsStyle::saveColorRamp( const QString& name, QgsVectorColorRamp* ramp, int
|
||||
|
||||
bool QgsStyle::removeColorRamp( const QString& name )
|
||||
{
|
||||
QgsVectorColorRamp *ramp = mColorRamps.take( name );
|
||||
QgsColorRamp *ramp = mColorRamps.take( name );
|
||||
if ( !ramp )
|
||||
return false;
|
||||
|
||||
@ -254,13 +254,13 @@ bool QgsStyle::removeColorRamp( const QString& name )
|
||||
return true;
|
||||
}
|
||||
|
||||
QgsVectorColorRamp* QgsStyle::colorRamp( const QString& name )
|
||||
QgsColorRamp* QgsStyle::colorRamp( const QString& name )
|
||||
{
|
||||
const QgsVectorColorRamp *ramp = colorRampRef( name );
|
||||
const QgsColorRamp *ramp = colorRampRef( name );
|
||||
return ramp ? ramp->clone() : nullptr;
|
||||
}
|
||||
|
||||
const QgsVectorColorRamp* QgsStyle::colorRampRef( const QString& name ) const
|
||||
const QgsColorRamp* QgsStyle::colorRampRef( const QString& name ) const
|
||||
{
|
||||
return mColorRamps.value( name );
|
||||
}
|
||||
@ -343,7 +343,7 @@ bool QgsStyle::load( const QString& filename )
|
||||
continue;
|
||||
}
|
||||
QDomElement rampElement = doc.documentElement();
|
||||
QgsVectorColorRamp *ramp = QgsSymbolLayerUtils::loadColorRamp( rampElement );
|
||||
QgsColorRamp *ramp = QgsSymbolLayerUtils::loadColorRamp( rampElement );
|
||||
if ( ramp )
|
||||
mColorRamps.insert( ramp_name, ramp );
|
||||
}
|
||||
@ -374,7 +374,7 @@ bool QgsStyle::save( QString filename )
|
||||
QDomElement rampsElem = doc.createElement( "colorramps" );
|
||||
|
||||
// save color ramps
|
||||
for ( QMap<QString, QgsVectorColorRamp*>::iterator itr = mColorRamps.begin(); itr != mColorRamps.end(); ++itr )
|
||||
for ( QMap<QString, QgsColorRamp*>::iterator itr = mColorRamps.begin(); itr != mColorRamps.end(); ++itr )
|
||||
{
|
||||
QDomElement rampEl = QgsSymbolLayerUtils::saveColorRamp( itr.key(), itr.value(), doc );
|
||||
rampsElem.appendChild( rampEl );
|
||||
@ -440,7 +440,7 @@ bool QgsStyle::renameColorRamp( const QString& oldName, const QString& newName )
|
||||
return false;
|
||||
}
|
||||
|
||||
QgsVectorColorRamp *ramp = mColorRamps.take( oldName );
|
||||
QgsColorRamp *ramp = mColorRamps.take( oldName );
|
||||
if ( !ramp )
|
||||
return false;
|
||||
|
||||
@ -1377,7 +1377,7 @@ bool QgsStyle::exportXml( const QString& filename )
|
||||
QDomElement rampsElem = doc.createElement( "colorramps" );
|
||||
|
||||
// save color ramps
|
||||
for ( QMap<QString, QgsVectorColorRamp*>::const_iterator itr = mColorRamps.constBegin(); itr != mColorRamps.constEnd(); ++itr )
|
||||
for ( QMap<QString, QgsColorRamp*>::const_iterator itr = mColorRamps.constBegin(); itr != mColorRamps.constEnd(); ++itr )
|
||||
{
|
||||
QDomElement rampEl = QgsSymbolLayerUtils::saveColorRamp( itr.key(), itr.value(), doc );
|
||||
rampsElem.appendChild( rampEl );
|
||||
@ -1482,7 +1482,7 @@ bool QgsStyle::importXml( const QString& filename )
|
||||
{
|
||||
if ( e.tagName() == "colorramp" )
|
||||
{
|
||||
QgsVectorColorRamp* ramp = QgsSymbolLayerUtils::loadColorRamp( e );
|
||||
QgsColorRamp* ramp = QgsSymbolLayerUtils::loadColorRamp( e );
|
||||
if ( ramp )
|
||||
{
|
||||
addColorRamp( e.attribute( "name" ), ramp );
|
||||
|
@ -26,12 +26,12 @@
|
||||
|
||||
class QgsSymbol;
|
||||
class QgsSymbolLayer;
|
||||
class QgsVectorColorRamp;
|
||||
class QgsColorRamp;
|
||||
|
||||
class QDomDocument;
|
||||
class QDomElement;
|
||||
|
||||
typedef QMap<QString, QgsVectorColorRamp* > QgsVectorColorRampMap;
|
||||
typedef QMap<QString, QgsColorRamp* > QgsVectorColorRampMap;
|
||||
typedef QMap<int, QString> QgsSymbolGroupMap;
|
||||
|
||||
/** \ingroup core
|
||||
@ -90,7 +90,7 @@ class CORE_EXPORT QgsStyle : public QObject
|
||||
* \param update set to true when the style DB has to be updated, by default it is false
|
||||
* \return success status of the operation
|
||||
*/
|
||||
bool addColorRamp( const QString& name, QgsVectorColorRamp* colorRamp, bool update = false );
|
||||
bool addColorRamp( const QString& name, QgsColorRamp* colorRamp, bool update = false );
|
||||
|
||||
//! adds a new group and returns the group's id
|
||||
/*!
|
||||
@ -138,7 +138,7 @@ class CORE_EXPORT QgsStyle : public QObject
|
||||
void clear();
|
||||
|
||||
//! return a NEW copy of color ramp
|
||||
QgsVectorColorRamp* colorRamp( const QString& name );
|
||||
QgsColorRamp* colorRamp( const QString& name );
|
||||
|
||||
//! return count of color ramps
|
||||
int colorRampCount();
|
||||
@ -147,7 +147,7 @@ class CORE_EXPORT QgsStyle : public QObject
|
||||
QStringList colorRampNames();
|
||||
|
||||
//! return a const pointer to a symbol (doesn't create new instance)
|
||||
const QgsVectorColorRamp* colorRampRef( const QString& name ) const;
|
||||
const QgsColorRamp* colorRampRef( const QString& name ) const;
|
||||
|
||||
//! return the id in the style database for the given colorramp name
|
||||
//! returns 0 if not found
|
||||
@ -265,12 +265,12 @@ class CORE_EXPORT QgsStyle : public QObject
|
||||
//! add the colorramp to the DB
|
||||
/*!
|
||||
* \param name is the name of the colorramp as QString
|
||||
* \param ramp is the pointer to the new QgsVectorColorRamp being saved
|
||||
* \param ramp is the pointer to the new QgsColorRamp being saved
|
||||
* \param groupid is the id of the group to which the Color Ramp belongs. Pass 0 if it doesn't belong to any group or not known.
|
||||
* \param tags is a list of tags that are associated with the color ramp as a QStringList.
|
||||
* \return returns the success state of the save operation
|
||||
*/
|
||||
bool saveColorRamp( const QString& name, QgsVectorColorRamp* ramp, int groupid, const QStringList& tags );
|
||||
bool saveColorRamp( const QString& name, QgsColorRamp* ramp, int groupid, const QStringList& tags );
|
||||
|
||||
//! remove color ramp from style (and delete it)
|
||||
bool removeColorRamp( const QString& name );
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "qgssymbollayer.h"
|
||||
#include "qgssymbollayerregistry.h"
|
||||
#include "qgssymbol.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgsexpression.h"
|
||||
#include "qgspainteffect.h"
|
||||
#include "qgspainteffectregistry.h"
|
||||
@ -619,12 +619,12 @@ QIcon QgsSymbolLayerUtils::symbolLayerPreviewIcon( QgsSymbolLayer* layer, QgsUni
|
||||
return QIcon( pixmap );
|
||||
}
|
||||
|
||||
QIcon QgsSymbolLayerUtils::colorRampPreviewIcon( QgsVectorColorRamp* ramp, QSize size )
|
||||
QIcon QgsSymbolLayerUtils::colorRampPreviewIcon( QgsColorRamp* ramp, QSize size )
|
||||
{
|
||||
return QIcon( colorRampPreviewPixmap( ramp, size ) );
|
||||
}
|
||||
|
||||
QPixmap QgsSymbolLayerUtils::colorRampPreviewPixmap( QgsVectorColorRamp* ramp, QSize size )
|
||||
QPixmap QgsSymbolLayerUtils::colorRampPreviewPixmap( QgsColorRamp* ramp, QSize size )
|
||||
{
|
||||
QPixmap pixmap( size );
|
||||
pixmap.fill( Qt::transparent );
|
||||
@ -2665,7 +2665,7 @@ void QgsSymbolLayerUtils::clearSymbolMap( QgsSymbolMap& symbols )
|
||||
}
|
||||
|
||||
|
||||
QgsVectorColorRamp* QgsSymbolLayerUtils::loadColorRamp( QDomElement& element )
|
||||
QgsColorRamp* QgsSymbolLayerUtils::loadColorRamp( QDomElement& element )
|
||||
{
|
||||
QString rampType = element.attribute( "type" );
|
||||
|
||||
@ -2673,11 +2673,11 @@ QgsVectorColorRamp* QgsSymbolLayerUtils::loadColorRamp( QDomElement& element )
|
||||
QgsStringMap props = QgsSymbolLayerUtils::parseProperties( element );
|
||||
|
||||
if ( rampType == "gradient" )
|
||||
return QgsVectorGradientColorRamp::create( props );
|
||||
return QgsGradientColorRamp::create( props );
|
||||
else if ( rampType == "random" )
|
||||
return QgsVectorRandomColorRamp::create( props );
|
||||
return QgsLimitedRandomColorRamp::create( props );
|
||||
else if ( rampType == "colorbrewer" )
|
||||
return QgsVectorColorBrewerColorRamp::create( props );
|
||||
return QgsColorBrewerColorRamp::create( props );
|
||||
else if ( rampType == "cpt-city" )
|
||||
return QgsCptCityColorRamp::create( props );
|
||||
else
|
||||
@ -2688,7 +2688,7 @@ QgsVectorColorRamp* QgsSymbolLayerUtils::loadColorRamp( QDomElement& element )
|
||||
}
|
||||
|
||||
|
||||
QDomElement QgsSymbolLayerUtils::saveColorRamp( const QString& name, QgsVectorColorRamp* ramp, QDomDocument& doc )
|
||||
QDomElement QgsSymbolLayerUtils::saveColorRamp( const QString& name, QgsColorRamp* ramp, QDomDocument& doc )
|
||||
{
|
||||
QDomElement rampEl = doc.createElement( "colorramp" );
|
||||
rampEl.setAttribute( "type", ramp->type() );
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
class QgsExpression;
|
||||
class QgsSymbolLayer;
|
||||
class QgsVectorColorRamp;
|
||||
class QgsColorRamp;
|
||||
|
||||
typedef QMap<QString, QString> QgsStringMap;
|
||||
typedef QMap<QString, QgsSymbol* > QgsSymbolMap;
|
||||
@ -138,13 +138,13 @@ class CORE_EXPORT QgsSymbolLayerUtils
|
||||
*/
|
||||
static QIcon symbolLayerPreviewIcon( QgsSymbolLayer* layer, QgsUnitTypes::RenderUnit u, QSize size, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
static QIcon colorRampPreviewIcon( QgsVectorColorRamp* ramp, QSize size );
|
||||
static QIcon colorRampPreviewIcon( QgsColorRamp* ramp, QSize size );
|
||||
|
||||
static void drawStippledBackground( QPainter* painter, QRect rect );
|
||||
|
||||
//! @note customContext parameter added in 2.6
|
||||
static QPixmap symbolPreviewPixmap( QgsSymbol* symbol, QSize size, QgsRenderContext* customContext = nullptr );
|
||||
static QPixmap colorRampPreviewPixmap( QgsVectorColorRamp* ramp, QSize size );
|
||||
static QPixmap colorRampPreviewPixmap( QgsColorRamp* ramp, QSize size );
|
||||
|
||||
/** Returns the maximum estimated bleed for the symbol */
|
||||
static double estimateMaxSymbolBleed( QgsSymbol* symbol );
|
||||
@ -297,8 +297,8 @@ class CORE_EXPORT QgsSymbolLayerUtils
|
||||
|
||||
static void clearSymbolMap( QgsSymbolMap& symbols );
|
||||
|
||||
static QgsVectorColorRamp* loadColorRamp( QDomElement& element );
|
||||
static QDomElement saveColorRamp( const QString& name, QgsVectorColorRamp* ramp, QDomDocument& doc );
|
||||
static QgsColorRamp* loadColorRamp( QDomElement& element );
|
||||
static QDomElement saveColorRamp( const QString& name, QgsColorRamp* ramp, QDomDocument& doc );
|
||||
|
||||
/**
|
||||
* Returns a friendly display name for a color
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "qgstransformeffect.h"
|
||||
#include "qgscoloreffect.h"
|
||||
#include "qgsstyle.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
|
||||
//
|
||||
// draw source
|
||||
@ -594,7 +594,7 @@ void QgsGlowWidget::applyColorRamp()
|
||||
return;
|
||||
}
|
||||
|
||||
QgsVectorColorRamp* ramp = mRampComboBox->currentColorRamp();
|
||||
QgsColorRamp* ramp = mRampComboBox->currentColorRamp();
|
||||
if ( !ramp )
|
||||
return;
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#define FRAME_MARGIN 2
|
||||
#define CLICK_THRESHOLD ( MARKER_WIDTH / 2 + 3 )
|
||||
|
||||
QgsGradientStopEditor::QgsGradientStopEditor( QWidget *parent, QgsVectorGradientColorRamp *ramp )
|
||||
QgsGradientStopEditor::QgsGradientStopEditor( QWidget *parent, QgsGradientColorRamp *ramp )
|
||||
: QWidget( parent )
|
||||
, mSelectedStop( 0 )
|
||||
{
|
||||
@ -58,7 +58,7 @@ QgsGradientStopEditor::QgsGradientStopEditor( QWidget *parent, QgsVectorGradient
|
||||
setAcceptDrops( true );
|
||||
}
|
||||
|
||||
void QgsGradientStopEditor::setGradientRamp( const QgsVectorGradientColorRamp &ramp )
|
||||
void QgsGradientStopEditor::setGradientRamp( const QgsGradientColorRamp &ramp )
|
||||
{
|
||||
mGradient = ramp;
|
||||
mStops = mGradient.stops();
|
||||
|
@ -16,7 +16,7 @@
|
||||
#ifndef QGSGRADIENTSTOPEDITOR_H
|
||||
#define QGSGRADIENTSTOPEDITOR_H
|
||||
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
@ -37,18 +37,18 @@ class GUI_EXPORT QgsGradientStopEditor : public QWidget
|
||||
* @param parent parent widget
|
||||
* @param ramp optional initial gradient ramp
|
||||
*/
|
||||
QgsGradientStopEditor( QWidget* parent = nullptr, QgsVectorGradientColorRamp* ramp = nullptr );
|
||||
QgsGradientStopEditor( QWidget* parent = nullptr, QgsGradientColorRamp* ramp = nullptr );
|
||||
|
||||
/** Sets the current ramp shown in the editor.
|
||||
* @param ramp color ramp
|
||||
* @see gradientRamp()
|
||||
*/
|
||||
void setGradientRamp( const QgsVectorGradientColorRamp& ramp );
|
||||
void setGradientRamp( const QgsGradientColorRamp& ramp );
|
||||
|
||||
/** Returns the current ramp created by the editor.
|
||||
* @see setGradientRamp()
|
||||
*/
|
||||
QgsVectorGradientColorRamp gradientRamp() const { return mGradient; }
|
||||
QgsGradientColorRamp gradientRamp() const { return mGradient; }
|
||||
|
||||
/** Sets the currently selected stop.
|
||||
* @param index index of stop, where 0 corresponds to the first stop
|
||||
@ -160,7 +160,7 @@ class GUI_EXPORT QgsGradientStopEditor : public QWidget
|
||||
//! Returns the closest stop to a mouse x position, or -1 if no stops within tolerance
|
||||
int findClosestStop( int x, int threshold = -1 ) const;
|
||||
|
||||
QgsVectorGradientColorRamp mGradient;
|
||||
QgsGradientColorRamp mGradient;
|
||||
|
||||
//! We keep a separate, unordered copy of the gradient stops so that the selected stop is not changed.
|
||||
QgsGradientStopsList mStops;
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
// for color ramps - todo add rasterStyle and refactor raster vs. vector ramps
|
||||
#include "qgsstyle.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgscolordialog.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
@ -332,7 +332,7 @@ void QgsSingleBandPseudoColorRendererWidget::on_mClassifyButton_clicked()
|
||||
double min = lineEditValue( mMinLineEdit );
|
||||
double max = lineEditValue( mMaxLineEdit );
|
||||
|
||||
QScopedPointer< QgsVectorColorRamp > colorRamp( mColorRampComboBox->currentColorRamp() );
|
||||
QScopedPointer< QgsColorRamp > colorRamp( mColorRampComboBox->currentColorRamp() );
|
||||
|
||||
if ( mClassificationModeComboBox->itemData( mClassificationModeComboBox->currentIndex() ).toInt() == Continuous )
|
||||
{
|
||||
@ -345,7 +345,7 @@ void QgsSingleBandPseudoColorRendererWidget::on_mClassifyButton_clicked()
|
||||
double intervalDiff = max - min;
|
||||
|
||||
// remove last class when ColorRamp is gradient and discrete, as they are implemented with an extra stop
|
||||
QgsVectorGradientColorRamp* colorGradientRamp = dynamic_cast<QgsVectorGradientColorRamp*>( colorRamp.data() );
|
||||
QgsGradientColorRamp* colorGradientRamp = dynamic_cast<QgsGradientColorRamp*>( colorRamp.data() );
|
||||
if ( colorGradientRamp != NULL && colorGradientRamp->isDiscrete() )
|
||||
{
|
||||
numberOfEntries--;
|
||||
@ -515,7 +515,7 @@ void QgsSingleBandPseudoColorRendererWidget::on_mColorRampComboBox_currentIndexC
|
||||
QSettings settings;
|
||||
settings.setValue( "/Raster/defaultPalette", mColorRampComboBox->currentText() );
|
||||
|
||||
QgsVectorColorRamp* ramp = mColorRampComboBox->currentColorRamp();
|
||||
QgsColorRamp* ramp = mColorRampComboBox->currentColorRamp();
|
||||
if ( !ramp )
|
||||
return;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "qgssymbol.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgsstyle.h"
|
||||
#include "qgslogger.h"
|
||||
|
||||
@ -630,9 +630,9 @@ static void _createCategories( QgsCategoryList& cats, QList<QVariant>& values, Q
|
||||
}
|
||||
}
|
||||
|
||||
QgsVectorColorRamp* QgsCategorizedSymbolRendererWidget::getColorRamp()
|
||||
QgsColorRamp* QgsCategorizedSymbolRendererWidget::getColorRamp()
|
||||
{
|
||||
QgsVectorColorRamp* ramp = cboCategorizedColorRamp->currentColorRamp();
|
||||
QgsColorRamp* ramp = cboCategorizedColorRamp->currentColorRamp();
|
||||
if ( !ramp )
|
||||
{
|
||||
if ( cboCategorizedColorRamp->count() == 0 )
|
||||
@ -764,7 +764,7 @@ void QgsCategorizedSymbolRendererWidget::addCategories()
|
||||
r->setScaleMethod( mRenderer->scaleMethod() );
|
||||
r->setSizeScaleField( mRenderer->sizeScaleField() );
|
||||
r->setInvertedColorRamp( cbxInvertedColorRamp->isChecked() );
|
||||
QgsVectorColorRamp* ramp = getColorRamp();
|
||||
QgsColorRamp* ramp = getColorRamp();
|
||||
if ( ramp ) r->setSourceColorRamp( ramp->clone() );
|
||||
|
||||
if ( mModel )
|
||||
@ -785,7 +785,7 @@ void QgsCategorizedSymbolRendererWidget::applyColorRamp()
|
||||
else
|
||||
mButtonEditRamp->setEnabled( true );
|
||||
|
||||
QgsVectorColorRamp* ramp = getColorRamp();
|
||||
QgsColorRamp* ramp = getColorRamp();
|
||||
if ( ramp )
|
||||
{
|
||||
mRenderer->updateColorRamp( ramp, cbxInvertedColorRamp->isChecked() );
|
||||
|
@ -159,7 +159,7 @@ class GUI_EXPORT QgsCategorizedSymbolRendererWidget : public QgsRendererWidget,
|
||||
|
||||
void changeCategorySymbol();
|
||||
|
||||
QgsVectorColorRamp* getColorRamp();
|
||||
QgsColorRamp* getColorRamp();
|
||||
|
||||
QList<QgsSymbol*> selectedSymbols() override;
|
||||
QgsCategoryList selectedCategoryList();
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "qgscolorrampcombobox.h"
|
||||
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgsstyle.h"
|
||||
#include "qgsstylemanagerdialog.h"
|
||||
|
||||
@ -51,7 +51,7 @@ void QgsColorRampComboBox::populate( QgsStyle* style )
|
||||
QStringList rampNames = mStyle->colorRampNames();
|
||||
for ( QStringList::iterator it = rampNames.begin(); it != rampNames.end(); ++it )
|
||||
{
|
||||
QgsVectorColorRamp* ramp = style->colorRamp( *it );
|
||||
QgsColorRamp* ramp = style->colorRamp( *it );
|
||||
|
||||
if ( !mShowGradientOnly || ramp->type() == "gradient" )
|
||||
{
|
||||
@ -68,13 +68,13 @@ void QgsColorRampComboBox::populate( QgsStyle* style )
|
||||
connect( this, SIGNAL( activated( int ) ), SLOT( colorRampChanged( int ) ) );
|
||||
}
|
||||
|
||||
QgsVectorColorRamp* QgsColorRampComboBox::currentColorRamp()
|
||||
QgsColorRamp* QgsColorRampComboBox::currentColorRamp()
|
||||
{
|
||||
QString rampName = currentText();
|
||||
|
||||
if ( rampName == tr( "Random colors" ) )
|
||||
{
|
||||
return new QgsRandomColors();
|
||||
return new QgsRandomColorRamp();
|
||||
}
|
||||
else if ( rampName == "[source]" && mSourceColorRamp )
|
||||
return mSourceColorRamp->clone();
|
||||
@ -88,7 +88,7 @@ bool QgsColorRampComboBox::createNewColorRampSelected() const
|
||||
return index == count() - 1; //create new ramp is last item in combobox
|
||||
}
|
||||
|
||||
void QgsColorRampComboBox::setSourceColorRamp( QgsVectorColorRamp* sourceRamp )
|
||||
void QgsColorRampComboBox::setSourceColorRamp( QgsColorRamp* sourceRamp )
|
||||
{
|
||||
delete mSourceColorRamp;
|
||||
mSourceColorRamp = sourceRamp->clone();
|
||||
@ -120,7 +120,7 @@ void QgsColorRampComboBox::colorRampChanged( int index )
|
||||
return;
|
||||
|
||||
// put newly added ramp into the combo
|
||||
QgsVectorColorRamp* ramp = mStyle->colorRamp( rampName );
|
||||
QgsColorRamp* ramp = mStyle->colorRamp( rampName );
|
||||
QIcon icon = QgsSymbolLayerUtils::colorRampPreviewIcon( ramp, rampIconSize );
|
||||
|
||||
blockSignals( true ); // avoid calling this method again!
|
||||
@ -138,15 +138,15 @@ void QgsColorRampComboBox::colorRampChanged( int index )
|
||||
|
||||
void QgsColorRampComboBox::editSourceRamp()
|
||||
{
|
||||
QgsVectorColorRamp* currentRamp = currentColorRamp();
|
||||
QgsColorRamp* currentRamp = currentColorRamp();
|
||||
if ( !currentRamp )
|
||||
return;
|
||||
|
||||
QScopedPointer<QgsVectorColorRamp> newRamp( currentRamp->clone() );
|
||||
QScopedPointer<QgsColorRamp> newRamp( currentRamp->clone() );
|
||||
|
||||
if ( newRamp->type() == "gradient" )
|
||||
{
|
||||
QgsVectorGradientColorRamp* gradRamp = static_cast<QgsVectorGradientColorRamp*>( newRamp.data() );
|
||||
QgsGradientColorRamp* gradRamp = static_cast<QgsGradientColorRamp*>( newRamp.data() );
|
||||
QgsVectorGradientColorRampDialog dlg( gradRamp, this );
|
||||
if ( dlg.exec() && gradRamp )
|
||||
{
|
||||
@ -156,7 +156,7 @@ void QgsColorRampComboBox::editSourceRamp()
|
||||
}
|
||||
else if ( newRamp->type() == "random" )
|
||||
{
|
||||
QgsVectorRandomColorRamp* randRamp = static_cast<QgsVectorRandomColorRamp*>( newRamp.data() );
|
||||
QgsLimitedRandomColorRamp* randRamp = static_cast<QgsLimitedRandomColorRamp*>( newRamp.data() );
|
||||
QgsVectorRandomColorRampDialog dlg( randRamp, this );
|
||||
if ( dlg.exec() )
|
||||
{
|
||||
@ -166,7 +166,7 @@ void QgsColorRampComboBox::editSourceRamp()
|
||||
}
|
||||
else if ( newRamp->type() == "colorbrewer" )
|
||||
{
|
||||
QgsVectorColorBrewerColorRamp* brewerRamp = static_cast<QgsVectorColorBrewerColorRamp*>( newRamp.data() );
|
||||
QgsColorBrewerColorRamp* brewerRamp = static_cast<QgsColorBrewerColorRamp*>( newRamp.data() );
|
||||
QgsVectorColorBrewerColorRampDialog dlg( brewerRamp, this );
|
||||
if ( dlg.exec() )
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include <QComboBox>
|
||||
|
||||
class QgsStyle;
|
||||
class QgsVectorColorRamp;
|
||||
class QgsColorRamp;
|
||||
|
||||
/** \ingroup gui
|
||||
* \class QgsColorRampComboBox
|
||||
@ -35,10 +35,10 @@ class GUI_EXPORT QgsColorRampComboBox : public QComboBox
|
||||
void populate( QgsStyle* style );
|
||||
|
||||
//! add/select color ramp which was used previously by the renderer
|
||||
void setSourceColorRamp( QgsVectorColorRamp* sourceRamp );
|
||||
void setSourceColorRamp( QgsColorRamp* sourceRamp );
|
||||
|
||||
//! return new instance of the current color ramp or NULL if there is no active color ramp
|
||||
QgsVectorColorRamp* currentColorRamp();
|
||||
QgsColorRamp* currentColorRamp();
|
||||
|
||||
/** Returns true if the current selection in the combo box is the option for creating
|
||||
* a new color ramp
|
||||
@ -74,7 +74,7 @@ class GUI_EXPORT QgsColorRampComboBox : public QComboBox
|
||||
|
||||
protected:
|
||||
QgsStyle* mStyle;
|
||||
QgsVectorColorRamp* mSourceColorRamp; // owns the copy
|
||||
QgsColorRamp* mSourceColorRamp; // owns the copy
|
||||
|
||||
private:
|
||||
bool mShowGradientOnly;
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "qgscptcitycolorrampdialog.h"
|
||||
|
||||
#include "qgscptcityarchive.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsapplication.h"
|
||||
#include "qgsdialog.h"
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "qgssymbol.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgsstyle.h"
|
||||
|
||||
#include "qgsvectorlayer.h"
|
||||
@ -657,7 +657,7 @@ void QgsGraduatedSymbolRendererWidget::on_methodComboBox_currentIndexChanged( in
|
||||
if ( idx == 0 )
|
||||
{
|
||||
mRenderer->setGraduatedMethod( QgsGraduatedSymbolRenderer::GraduatedColor );
|
||||
QgsVectorColorRamp* ramp = cboGraduatedColorRamp->currentColorRamp();
|
||||
QgsColorRamp* ramp = cboGraduatedColorRamp->currentColorRamp();
|
||||
|
||||
if ( !ramp )
|
||||
{
|
||||
@ -742,7 +742,7 @@ void QgsGraduatedSymbolRendererWidget::classifyGraduated()
|
||||
|
||||
int nclasses = spinGraduatedClasses->value();
|
||||
|
||||
QSharedPointer<QgsVectorColorRamp> ramp( cboGraduatedColorRamp->currentColorRamp() );
|
||||
QSharedPointer<QgsColorRamp> ramp( cboGraduatedColorRamp->currentColorRamp() );
|
||||
if ( !ramp )
|
||||
{
|
||||
if ( cboGraduatedColorRamp->count() == 0 )
|
||||
@ -779,7 +779,7 @@ void QgsGraduatedSymbolRendererWidget::classifyGraduated()
|
||||
|
||||
if ( methodComboBox->currentIndex() == 0 )
|
||||
{
|
||||
QgsVectorColorRamp* ramp = cboGraduatedColorRamp->currentColorRamp();
|
||||
QgsColorRamp* ramp = cboGraduatedColorRamp->currentColorRamp();
|
||||
|
||||
if ( !ramp )
|
||||
{
|
||||
@ -811,7 +811,7 @@ void QgsGraduatedSymbolRendererWidget::classifyGraduated()
|
||||
|
||||
void QgsGraduatedSymbolRendererWidget::reapplyColorRamp()
|
||||
{
|
||||
QgsVectorColorRamp* ramp = cboGraduatedColorRamp->currentColorRamp();
|
||||
QgsColorRamp* ramp = cboGraduatedColorRamp->currentColorRamp();
|
||||
if ( !ramp )
|
||||
return;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "qgslogger.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgsstyle.h"
|
||||
#include "qgsproject.h"
|
||||
#include "qgsmapcanvas.h"
|
||||
@ -142,7 +142,7 @@ void QgsHeatmapRendererWidget::applyColorRamp()
|
||||
return;
|
||||
}
|
||||
|
||||
QgsVectorColorRamp* ramp = mRampComboBox->currentColorRamp();
|
||||
QgsColorRamp* ramp = mRampComboBox->currentColorRamp();
|
||||
if ( !ramp )
|
||||
return;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "qgsstyle.h"
|
||||
#include "qgssymbol.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsstylegroupselectiondialog.h"
|
||||
|
||||
@ -203,7 +203,7 @@ bool QgsStyleExportImportDialog::populateStyles( QgsStyle* style )
|
||||
for ( int i = 0; i < styleNames.count(); ++i )
|
||||
{
|
||||
name = styleNames[i];
|
||||
QgsVectorColorRamp* ramp = style->colorRamp( name );
|
||||
QgsColorRamp* ramp = style->colorRamp( name );
|
||||
|
||||
QStandardItem* item = new QStandardItem( name );
|
||||
QIcon icon = QgsSymbolLayerUtils::colorRampPreviewIcon( ramp, listItems->iconSize() );
|
||||
@ -218,7 +218,7 @@ void QgsStyleExportImportDialog::moveStyles( QModelIndexList* selection, QgsStyl
|
||||
{
|
||||
QString symbolName;
|
||||
QgsSymbol* symbol;
|
||||
QgsVectorColorRamp *ramp = nullptr;
|
||||
QgsColorRamp *ramp = nullptr;
|
||||
QModelIndex index;
|
||||
bool isSymbol = true;
|
||||
bool prompt = true;
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "qgsstyle.h"
|
||||
#include "qgssymbol.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
|
||||
#include "qgssymbolselectordialog.h"
|
||||
#include "qgsvectorgradientcolorrampdialog.h"
|
||||
@ -292,7 +292,7 @@ void QgsStyleManagerDialog::populateColorRamps( const QStringList& colorRamps, b
|
||||
for ( int i = 0; i < colorRamps.count(); ++i )
|
||||
{
|
||||
QString name = colorRamps[i];
|
||||
QgsVectorColorRamp* ramp = mStyle->colorRamp( name );
|
||||
QgsColorRamp* ramp = mStyle->colorRamp( name );
|
||||
|
||||
QStandardItem* item = new QStandardItem( name );
|
||||
QIcon icon = QgsSymbolLayerUtils::colorRampPreviewIcon( ramp, listItems->iconSize() );
|
||||
@ -454,10 +454,10 @@ QString QgsStyleManagerDialog::addColorRampStatic( QWidget* parent, QgsStyle* st
|
||||
|
||||
QString name = tr( "new ramp" );
|
||||
|
||||
QgsVectorColorRamp *ramp = nullptr;
|
||||
QgsColorRamp *ramp = nullptr;
|
||||
if ( rampType == tr( "Gradient" ) )
|
||||
{
|
||||
QgsVectorGradientColorRamp* gradRamp = new QgsVectorGradientColorRamp();
|
||||
QgsGradientColorRamp* gradRamp = new QgsGradientColorRamp();
|
||||
QgsVectorGradientColorRampDialog dlg( gradRamp, parent );
|
||||
if ( !dlg.exec() )
|
||||
{
|
||||
@ -469,7 +469,7 @@ QString QgsStyleManagerDialog::addColorRampStatic( QWidget* parent, QgsStyle* st
|
||||
}
|
||||
else if ( rampType == tr( "Random" ) )
|
||||
{
|
||||
QgsVectorRandomColorRamp* randRamp = new QgsVectorRandomColorRamp();
|
||||
QgsLimitedRandomColorRamp* randRamp = new QgsLimitedRandomColorRamp();
|
||||
QgsVectorRandomColorRampDialog dlg( randRamp, parent );
|
||||
if ( !dlg.exec() )
|
||||
{
|
||||
@ -481,7 +481,7 @@ QString QgsStyleManagerDialog::addColorRampStatic( QWidget* parent, QgsStyle* st
|
||||
}
|
||||
else if ( rampType == tr( "ColorBrewer" ) )
|
||||
{
|
||||
QgsVectorColorBrewerColorRamp* brewerRamp = new QgsVectorColorBrewerColorRamp();
|
||||
QgsColorBrewerColorRamp* brewerRamp = new QgsColorBrewerColorRamp();
|
||||
QgsVectorColorBrewerColorRampDialog dlg( brewerRamp, parent );
|
||||
if ( !dlg.exec() )
|
||||
{
|
||||
@ -633,11 +633,11 @@ bool QgsStyleManagerDialog::editColorRamp()
|
||||
if ( name.isEmpty() )
|
||||
return false;
|
||||
|
||||
QgsVectorColorRamp* ramp = mStyle->colorRamp( name );
|
||||
QgsColorRamp* ramp = mStyle->colorRamp( name );
|
||||
|
||||
if ( ramp->type() == "gradient" )
|
||||
{
|
||||
QgsVectorGradientColorRamp* gradRamp = static_cast<QgsVectorGradientColorRamp*>( ramp );
|
||||
QgsGradientColorRamp* gradRamp = static_cast<QgsGradientColorRamp*>( ramp );
|
||||
QgsVectorGradientColorRampDialog dlg( gradRamp, this );
|
||||
if ( !dlg.exec() )
|
||||
{
|
||||
@ -647,7 +647,7 @@ bool QgsStyleManagerDialog::editColorRamp()
|
||||
}
|
||||
else if ( ramp->type() == "random" )
|
||||
{
|
||||
QgsVectorRandomColorRamp* randRamp = static_cast<QgsVectorRandomColorRamp*>( ramp );
|
||||
QgsLimitedRandomColorRamp* randRamp = static_cast<QgsLimitedRandomColorRamp*>( ramp );
|
||||
QgsVectorRandomColorRampDialog dlg( randRamp, this );
|
||||
if ( !dlg.exec() )
|
||||
{
|
||||
@ -657,7 +657,7 @@ bool QgsStyleManagerDialog::editColorRamp()
|
||||
}
|
||||
else if ( ramp->type() == "colorbrewer" )
|
||||
{
|
||||
QgsVectorColorBrewerColorRamp* brewerRamp = static_cast<QgsVectorColorBrewerColorRamp*>( ramp );
|
||||
QgsColorBrewerColorRamp* brewerRamp = static_cast<QgsColorBrewerColorRamp*>( ramp );
|
||||
QgsVectorColorBrewerColorRampDialog dlg( brewerRamp, this );
|
||||
if ( !dlg.exec() )
|
||||
{
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "qgssymbolselectordialog.h"
|
||||
#include "qgssvgcache.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgsvectorgradientcolorrampdialog.h"
|
||||
#include "qgsdatadefined.h"
|
||||
#include "qgsstyle.h" //for symbol selector dialog
|
||||
@ -1233,7 +1233,7 @@ void QgsGradientFillSymbolLayerWidget::colorModeChanged()
|
||||
|
||||
void QgsGradientFillSymbolLayerWidget::applyColorRamp()
|
||||
{
|
||||
QgsVectorColorRamp* ramp = cboGradientColorRamp->currentColorRamp();
|
||||
QgsColorRamp* ramp = cboGradientColorRamp->currentColorRamp();
|
||||
if ( !ramp )
|
||||
return;
|
||||
|
||||
@ -1567,7 +1567,7 @@ void QgsShapeburstFillSymbolLayerWidget::on_mRadioUseWholeShape_toggled( bool va
|
||||
|
||||
void QgsShapeburstFillSymbolLayerWidget::applyColorRamp()
|
||||
{
|
||||
QgsVectorColorRamp* ramp = cboGradientColorRamp->currentColorRamp();
|
||||
QgsColorRamp* ramp = cboGradientColorRamp->currentColorRamp();
|
||||
if ( !ramp )
|
||||
return;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "qgsvectorcolorbrewercolorrampdialog.h"
|
||||
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include <QAbstractButton>
|
||||
|
||||
@ -31,7 +31,7 @@ static void updateColorButton( QAbstractButton* button, QColor color )
|
||||
/////////
|
||||
|
||||
|
||||
QgsVectorColorBrewerColorRampDialog::QgsVectorColorBrewerColorRampDialog( QgsVectorColorBrewerColorRamp* ramp, QWidget* parent )
|
||||
QgsVectorColorBrewerColorRampDialog::QgsVectorColorBrewerColorRampDialog( QgsColorBrewerColorRamp* ramp, QWidget* parent )
|
||||
: QDialog( parent )
|
||||
, mRamp( ramp )
|
||||
{
|
||||
@ -41,11 +41,11 @@ QgsVectorColorBrewerColorRampDialog::QgsVectorColorBrewerColorRampDialog( QgsVec
|
||||
QSize iconSize( 50, 16 );
|
||||
cboSchemeName->setIconSize( iconSize );
|
||||
|
||||
QStringList schemes = QgsVectorColorBrewerColorRamp::listSchemeNames();
|
||||
QStringList schemes = QgsColorBrewerColorRamp::listSchemeNames();
|
||||
Q_FOREACH ( const QString& schemeName, schemes )
|
||||
{
|
||||
// create a preview icon using five color variant
|
||||
QgsVectorColorBrewerColorRamp* r = new QgsVectorColorBrewerColorRamp( schemeName, 5 );
|
||||
QgsColorBrewerColorRamp* r = new QgsColorBrewerColorRamp( schemeName, 5 );
|
||||
QIcon icon = QgsSymbolLayerUtils::colorRampPreviewIcon( r, iconSize );
|
||||
delete r;
|
||||
cboSchemeName->addItem( icon, schemeName );
|
||||
@ -67,7 +67,7 @@ void QgsVectorColorBrewerColorRampDialog::populateVariants()
|
||||
|
||||
cboColors->clear();
|
||||
QString schemeName = cboSchemeName->currentText();
|
||||
QList<int> variants = QgsVectorColorBrewerColorRamp::listSchemeVariants( schemeName );
|
||||
QList<int> variants = QgsColorBrewerColorRamp::listSchemeVariants( schemeName );
|
||||
Q_FOREACH ( int variant, variants )
|
||||
{
|
||||
cboColors->addItem( QString::number( variant ) );
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "ui_qgsvectorcolorbrewercolorrampv2dialogbase.h"
|
||||
|
||||
class QgsVectorColorBrewerColorRamp;
|
||||
class QgsColorBrewerColorRamp;
|
||||
|
||||
/** \ingroup gui
|
||||
* \class QgsVectorColorBrewerColorRampDialog
|
||||
@ -30,7 +30,7 @@ class GUI_EXPORT QgsVectorColorBrewerColorRampDialog : public QDialog, private U
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QgsVectorColorBrewerColorRampDialog( QgsVectorColorBrewerColorRamp* ramp, QWidget* parent = nullptr );
|
||||
QgsVectorColorBrewerColorRampDialog( QgsColorBrewerColorRamp* ramp, QWidget* parent = nullptr );
|
||||
|
||||
public slots:
|
||||
void setSchemeName();
|
||||
@ -42,7 +42,7 @@ class GUI_EXPORT QgsVectorColorBrewerColorRampDialog : public QDialog, private U
|
||||
|
||||
void updatePreview();
|
||||
|
||||
QgsVectorColorBrewerColorRamp* mRamp;
|
||||
QgsColorBrewerColorRamp* mRamp;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
#include "qgsvectorgradientcolorrampdialog.h"
|
||||
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgsdialog.h"
|
||||
#include "qgscolordialog.h"
|
||||
#include "qgscptcityarchive.h"
|
||||
@ -40,7 +40,7 @@
|
||||
#include <qwt_symbol.h>
|
||||
#include <qwt_legend.h>
|
||||
|
||||
QgsVectorGradientColorRampDialog::QgsVectorGradientColorRampDialog( QgsVectorGradientColorRamp* ramp, QWidget* parent )
|
||||
QgsVectorGradientColorRampDialog::QgsVectorGradientColorRampDialog( QgsGradientColorRamp* ramp, QWidget* parent )
|
||||
: QDialog( parent )
|
||||
, mRamp( ramp )
|
||||
, mCurrentPlotColorComponent( -1 )
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "ui_qgsvectorgradientcolorrampv2dialogbase.h"
|
||||
|
||||
class QgsVectorGradientColorRamp;
|
||||
class QgsGradientColorRamp;
|
||||
class QwtPlot;
|
||||
class QwtPlotCurve;
|
||||
class QwtPlotMarker;
|
||||
@ -34,7 +34,7 @@ class GUI_EXPORT QgsVectorGradientColorRampDialog : public QDialog, private Ui::
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QgsVectorGradientColorRampDialog( QgsVectorGradientColorRamp* ramp, QWidget* parent = nullptr );
|
||||
QgsVectorGradientColorRampDialog( QgsGradientColorRamp* ramp, QWidget* parent = nullptr );
|
||||
~QgsVectorGradientColorRampDialog();
|
||||
|
||||
public slots:
|
||||
@ -46,7 +46,7 @@ class GUI_EXPORT QgsVectorGradientColorRampDialog : public QDialog, private Ui::
|
||||
void on_btnInformation_pressed();
|
||||
|
||||
protected:
|
||||
QgsVectorGradientColorRamp* mRamp;
|
||||
QgsGradientColorRamp* mRamp;
|
||||
|
||||
private slots:
|
||||
|
||||
|
@ -16,12 +16,12 @@
|
||||
#include "qgsvectorrandomcolorrampdialog.h"
|
||||
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
|
||||
#include <QColorDialog>
|
||||
|
||||
|
||||
QgsVectorRandomColorRampDialog::QgsVectorRandomColorRampDialog( QgsVectorRandomColorRamp* ramp, QWidget* parent )
|
||||
QgsVectorRandomColorRampDialog::QgsVectorRandomColorRampDialog( QgsLimitedRandomColorRamp* ramp, QWidget* parent )
|
||||
: QDialog( parent )
|
||||
, mRamp( ramp )
|
||||
{
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include "ui_qgsvectorrandomcolorrampv2dialogbase.h"
|
||||
|
||||
class QgsVectorRandomColorRamp;
|
||||
class QgsLimitedRandomColorRamp;
|
||||
|
||||
/** \ingroup gui
|
||||
* \class QgsVectorRandomColorRampDialog
|
||||
@ -30,7 +30,7 @@ class GUI_EXPORT QgsVectorRandomColorRampDialog : public QDialog, private Ui::Qg
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QgsVectorRandomColorRampDialog( QgsVectorRandomColorRamp* ramp, QWidget* parent = nullptr );
|
||||
QgsVectorRandomColorRampDialog( QgsLimitedRandomColorRamp* ramp, QWidget* parent = nullptr );
|
||||
|
||||
public slots:
|
||||
void setCount( int val );
|
||||
@ -45,7 +45,7 @@ class GUI_EXPORT QgsVectorRandomColorRampDialog : public QDialog, private Ui::Qg
|
||||
|
||||
void updatePreview();
|
||||
|
||||
QgsVectorRandomColorRamp* mRamp;
|
||||
QgsLimitedRandomColorRamp* mRamp;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include <qgssymbol.h>
|
||||
#include <qgssinglesymbolrenderer.h>
|
||||
#include <qgsfillsymbollayer.h>
|
||||
#include <qgsvectorcolorramp.h>
|
||||
#include <qgscolorramp.h>
|
||||
//qgis test includes
|
||||
#include "qgsrenderchecker.h"
|
||||
|
||||
@ -165,7 +165,7 @@ void TestQgsGradients::gradientSymbolColors()
|
||||
|
||||
void TestQgsGradients::gradientSymbolRamp()
|
||||
{
|
||||
QgsVectorGradientColorRamp* gradientRamp = new QgsVectorGradientColorRamp( QColor( Qt::red ), QColor( Qt::blue ) );
|
||||
QgsGradientColorRamp* gradientRamp = new QgsGradientColorRamp( QColor( Qt::red ), QColor( Qt::blue ) );
|
||||
QgsGradientStopsList stops;
|
||||
stops.append( QgsGradientStop( 0.5, QColor( Qt::white ) ) );
|
||||
gradientRamp->setStops( stops );
|
||||
|
@ -16,7 +16,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "qgsimageoperation.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include <QObject>
|
||||
#include <QtTest/QtTest>
|
||||
#include "qgsrenderchecker.h"
|
||||
@ -286,7 +286,7 @@ void TestQgsImageOperation::overlayColor()
|
||||
void TestQgsImageOperation::distanceTransformMaxDist()
|
||||
{
|
||||
QImage image( mTransparentSampleImage );
|
||||
QgsVectorGradientColorRamp ramp;
|
||||
QgsGradientColorRamp ramp;
|
||||
QgsImageOperation::DistanceTransformProperties props;
|
||||
props.useMaxDistance = true;
|
||||
props.ramp = &ramp;
|
||||
@ -301,7 +301,7 @@ void TestQgsImageOperation::distanceTransformMaxDist()
|
||||
void TestQgsImageOperation::distanceTransformSetSpread()
|
||||
{
|
||||
QImage image( mTransparentSampleImage );
|
||||
QgsVectorGradientColorRamp ramp;
|
||||
QgsGradientColorRamp ramp;
|
||||
QgsImageOperation::DistanceTransformProperties props;
|
||||
props.useMaxDistance = false;
|
||||
props.spread = 10;
|
||||
@ -317,7 +317,7 @@ void TestQgsImageOperation::distanceTransformSetSpread()
|
||||
void TestQgsImageOperation::distanceTransformInterior()
|
||||
{
|
||||
QImage image( mTransparentSampleImage );
|
||||
QgsVectorGradientColorRamp ramp;
|
||||
QgsGradientColorRamp ramp;
|
||||
QgsImageOperation::DistanceTransformProperties props;
|
||||
props.useMaxDistance = true;
|
||||
props.ramp = &ramp;
|
||||
@ -344,7 +344,7 @@ void TestQgsImageOperation::distanceTransformMisc()
|
||||
//zero spread
|
||||
QImage image2( mSampleImage );
|
||||
QgsImageOperation::DistanceTransformProperties props2;
|
||||
QgsVectorGradientColorRamp ramp;
|
||||
QgsGradientColorRamp ramp;
|
||||
props2.useMaxDistance = false;
|
||||
props2.spread = 0;
|
||||
props2.ramp = &ramp;
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "qgseffectstack.h"
|
||||
#include "qgsgloweffect.h"
|
||||
#include "qgspainteffectregistry.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgssymbollayerutils.h"
|
||||
#include "qgsmapsettings.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
@ -540,7 +540,7 @@ void TestQgsPaintEffect::glow()
|
||||
effect->setSpreadMapUnitScale( QgsMapUnitScale( 1.0, 2.0 ) );
|
||||
QCOMPARE( effect->spreadMapUnitScale().minScale, 1.0 );
|
||||
QCOMPARE( effect->spreadMapUnitScale().maxScale, 2.0 );
|
||||
effect->setRamp( new QgsVectorGradientColorRamp( QColor( 255, 0, 0 ), QColor( 0, 255, 0 ) ) );
|
||||
effect->setRamp( new QgsGradientColorRamp( QColor( 255, 0, 0 ), QColor( 0, 255, 0 ) ) );
|
||||
QCOMPARE( effect->ramp()->color( 0 ), QColor( 255, 0, 0 ) );
|
||||
QCOMPARE( effect->ramp()->color( 1.0 ), QColor( 0, 255, 0 ) );
|
||||
effect->setColorType( QgsGlowEffect::ColorRamp );
|
||||
|
@ -36,7 +36,7 @@
|
||||
#include <qgssinglebandgrayrenderer.h>
|
||||
#include <qgssinglebandpseudocolorrenderer.h>
|
||||
#include <qgsmultibandcolorrenderer.h>
|
||||
#include <qgsvectorcolorramp.h>
|
||||
#include <qgscolorramp.h>
|
||||
#include <qgscptcityarchive.h>
|
||||
#include "qgscolorrampshader.h"
|
||||
#include "qgsrasterdataprovider.h"
|
||||
@ -96,9 +96,9 @@ class TestQgsRasterLayer : public QObject
|
||||
bool render( const QString& theFileName, int mismatchCount = 0 );
|
||||
bool setQml( const QString& theType, QString& msg );
|
||||
void populateColorRampShader( QgsColorRampShader* colorRampShader,
|
||||
QgsVectorColorRamp* colorRamp,
|
||||
QgsColorRamp* colorRamp,
|
||||
int numberOfEntries );
|
||||
bool testColorRamp( const QString& name, QgsVectorColorRamp* colorRamp,
|
||||
bool testColorRamp( const QString& name, QgsColorRamp* colorRamp,
|
||||
QgsColorRampShader::ColorRamp_TYPE type, int numberOfEntries );
|
||||
QString mTestDataDir;
|
||||
QgsRasterLayer * mpRasterLayer;
|
||||
@ -250,7 +250,7 @@ void TestQgsRasterLayer::pseudoColor()
|
||||
}
|
||||
|
||||
void TestQgsRasterLayer::populateColorRampShader( QgsColorRampShader* colorRampShader,
|
||||
QgsVectorColorRamp* colorRamp,
|
||||
QgsColorRamp* colorRamp,
|
||||
int numberOfEntries )
|
||||
|
||||
{
|
||||
@ -294,7 +294,7 @@ void TestQgsRasterLayer::populateColorRampShader( QgsColorRampShader* colorRampS
|
||||
colorRampShader->setColorRampItemList( colorRampItems );
|
||||
}
|
||||
|
||||
bool TestQgsRasterLayer::testColorRamp( const QString& name, QgsVectorColorRamp* colorRamp,
|
||||
bool TestQgsRasterLayer::testColorRamp( const QString& name, QgsColorRamp* colorRamp,
|
||||
QgsColorRampShader::ColorRamp_TYPE type, int numberOfEntries )
|
||||
{
|
||||
QgsRasterShader* rasterShader = new QgsRasterShader();
|
||||
@ -313,7 +313,7 @@ bool TestQgsRasterLayer::testColorRamp( const QString& name, QgsVectorColorRamp*
|
||||
void TestQgsRasterLayer::colorRamp1()
|
||||
{
|
||||
// gradient ramp
|
||||
QgsVectorGradientColorRamp* colorRamp = new QgsVectorGradientColorRamp( QColor( Qt::red ), QColor( Qt::black ) );
|
||||
QgsGradientColorRamp* colorRamp = new QgsGradientColorRamp( QColor( Qt::red ), QColor( Qt::black ) );
|
||||
QgsGradientStopsList stops;
|
||||
stops.append( QgsGradientStop( 0.5, QColor( Qt::white ) ) );
|
||||
colorRamp->setStops( stops );
|
||||
@ -325,7 +325,7 @@ void TestQgsRasterLayer::colorRamp1()
|
||||
|
||||
void TestQgsRasterLayer::colorRamp2()
|
||||
{
|
||||
QgsVectorColorBrewerColorRamp ramp( "BrBG", 10 );
|
||||
QgsColorBrewerColorRamp ramp( "BrBG", 10 );
|
||||
// ColorBrewer ramp
|
||||
QVERIFY( testColorRamp( "raster_colorRamp2",
|
||||
&ramp,
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <qgsapplication.h>
|
||||
#include <qgssinglebandgrayrenderer.h>
|
||||
#include <qgssinglebandpseudocolorrenderer.h>
|
||||
#include <qgsvectorcolorramp.h>
|
||||
#include <qgscolorramp.h>
|
||||
#include <qgscptcityarchive.h>
|
||||
|
||||
//qgis unit test includes
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <qgssymbol.h>
|
||||
#include <qgssinglesymbolrenderer.h>
|
||||
#include <qgsfillsymbollayer.h>
|
||||
#include <qgsvectorcolorramp.h>
|
||||
#include <qgscolorramp.h>
|
||||
//qgis test includes
|
||||
#include "qgsmultirenderchecker.h"
|
||||
|
||||
@ -160,7 +160,7 @@ void TestQgsShapeburst::shapeburstSymbolRamp()
|
||||
{
|
||||
mReport += "<h2>Shapeburst symbol renderer ramp test</h2>\n";
|
||||
|
||||
QgsVectorGradientColorRamp* gradientRamp = new QgsVectorGradientColorRamp( QColor( Qt::yellow ), QColor( 255, 105, 180 ) );
|
||||
QgsGradientColorRamp* gradientRamp = new QgsGradientColorRamp( QColor( Qt::yellow ), QColor( 255, 105, 180 ) );
|
||||
QgsGradientStopsList stops;
|
||||
stops.append( QgsGradientStop( 0.5, QColor( 255, 255, 255, 0 ) ) );
|
||||
gradientRamp->setStops( stops );
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <qgsapplication.h>
|
||||
#include "qgsconfig.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgscptcityarchive.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsmaplayerregistry.h"
|
||||
@ -50,7 +50,7 @@ class TestStyle : public QObject
|
||||
QgsStyle *mStyle;
|
||||
QString mTestDataDir;
|
||||
|
||||
bool testValidColor( QgsVectorColorRamp *ramp, double value, const QColor& expected );
|
||||
bool testValidColor( QgsColorRamp *ramp, double value, const QColor& expected );
|
||||
bool imageCheck( QgsMapSettings &ms, const QString &testName );
|
||||
|
||||
private slots:
|
||||
@ -138,7 +138,7 @@ bool TestStyle::imageCheck( QgsMapSettings& ms, const QString& testName )
|
||||
return result;
|
||||
}
|
||||
|
||||
bool TestStyle::testValidColor( QgsVectorColorRamp *ramp, double value, const QColor& expected )
|
||||
bool TestStyle::testValidColor( QgsColorRamp *ramp, double value, const QColor& expected )
|
||||
{
|
||||
QColor result = ramp->color( value );
|
||||
//use int color components when testing (builds some fuzziness into test)
|
||||
@ -155,20 +155,20 @@ bool TestStyle::testValidColor( QgsVectorColorRamp *ramp, double value, const QC
|
||||
void TestStyle::testCreateColorRamps()
|
||||
{
|
||||
// gradient ramp
|
||||
QgsVectorGradientColorRamp* gradientRamp = new QgsVectorGradientColorRamp( QColor( Qt::red ), QColor( Qt::blue ) );
|
||||
QgsGradientColorRamp* gradientRamp = new QgsGradientColorRamp( QColor( Qt::red ), QColor( Qt::blue ) );
|
||||
QgsGradientStopsList stops;
|
||||
stops.append( QgsGradientStop( 0.5, QColor( Qt::white ) ) );
|
||||
gradientRamp->setStops( stops );
|
||||
QVERIFY( mStyle->addColorRamp( "test_gradient", gradientRamp, true ) );
|
||||
|
||||
// random ramp
|
||||
QgsVectorRandomColorRamp* randomRamp = new QgsVectorRandomColorRamp();
|
||||
QgsLimitedRandomColorRamp* randomRamp = new QgsLimitedRandomColorRamp();
|
||||
QVERIFY( mStyle->addColorRamp( "test_random", randomRamp, true ) );
|
||||
|
||||
// color brewer ramp
|
||||
QgsVectorColorBrewerColorRamp* cb1Ramp = new QgsVectorColorBrewerColorRamp();
|
||||
QgsColorBrewerColorRamp* cb1Ramp = new QgsColorBrewerColorRamp();
|
||||
QVERIFY( mStyle->addColorRamp( "test_cb1", cb1Ramp, true ) );
|
||||
QgsVectorColorBrewerColorRamp* cb2Ramp = new QgsVectorColorBrewerColorRamp( "RdYlGn", 6 );
|
||||
QgsColorBrewerColorRamp* cb2Ramp = new QgsColorBrewerColorRamp( "RdYlGn", 6 );
|
||||
QVERIFY( mStyle->addColorRamp( "test_cb2", cb2Ramp, true ) );
|
||||
|
||||
// discrete ramp with no variant
|
||||
@ -216,7 +216,7 @@ void TestStyle::testLoadColorRamps()
|
||||
{
|
||||
QgsDebugMsg( "colorRamp " + name );
|
||||
QVERIFY( colorRamps.contains( name ) );
|
||||
QgsVectorColorRamp* ramp = mStyle->colorRamp( name );
|
||||
QgsColorRamp* ramp = mStyle->colorRamp( name );
|
||||
QVERIFY( ramp != 0 );
|
||||
// test colors
|
||||
if ( colorTests.contains( name ) )
|
||||
@ -249,7 +249,7 @@ void TestStyle::testSaveLoad()
|
||||
{
|
||||
QgsDebugMsg( "colorRamp " + name );
|
||||
QVERIFY( colorRamps.contains( name ) );
|
||||
QgsVectorColorRamp* ramp = mStyle->colorRamp( name );
|
||||
QgsColorRamp* ramp = mStyle->colorRamp( name );
|
||||
QVERIFY( ramp != 0 );
|
||||
if ( ramp )
|
||||
delete ramp;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include <qgsapplication.h>
|
||||
#include "qgsconfig.h"
|
||||
#include "qgslogger.h"
|
||||
#include "qgsvectorcolorramp.h"
|
||||
#include "qgscolorramp.h"
|
||||
#include "qgscptcityarchive.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgsmaplayerregistry.h"
|
||||
|
@ -19,7 +19,7 @@ from qgis.core import (QgsGraduatedSymbolRenderer,
|
||||
QgsRendererRange,
|
||||
QgsRendererRangeLabelFormat,
|
||||
QgsMarkerSymbol,
|
||||
QgsVectorGradientColorRamp,
|
||||
QgsGradientColorRamp,
|
||||
QgsVectorLayer,
|
||||
QgsFeature,
|
||||
QgsGeometry,
|
||||
@ -67,7 +67,7 @@ def createMemoryLayer(values):
|
||||
|
||||
|
||||
def createColorRamp():
|
||||
return QgsVectorGradientColorRamp(
|
||||
return QgsGradientColorRamp(
|
||||
QColor(255, 0, 0),
|
||||
QColor(0, 0, 255)
|
||||
)
|
||||
|
@ -14,11 +14,11 @@ __revision__ = '$Format:%H$'
|
||||
|
||||
import qgis # NOQA
|
||||
|
||||
from qgis.core import (QgsVectorGradientColorRamp,
|
||||
from qgis.core import (QgsGradientColorRamp,
|
||||
QgsGradientStop,
|
||||
QgsVectorRandomColorRamp,
|
||||
QgsRandomColors,
|
||||
QgsVectorColorBrewerColorRamp)
|
||||
QgsLimitedRandomColorRamp,
|
||||
QgsRandomColorRamp,
|
||||
QgsColorBrewerColorRamp)
|
||||
from qgis.PyQt.QtGui import QColor, QGradient
|
||||
from qgis.testing import unittest
|
||||
|
||||
@ -35,7 +35,7 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
self.assertNotEqual(QgsGradientStop(0.1, QColor(180, 20, 30)), QgsGradientStop(0.1, QColor(180, 40, 30)))
|
||||
|
||||
# test gradient with only start/end color
|
||||
r = QgsVectorGradientColorRamp(QColor(200, 0, 0, 100), QColor(0, 200, 0, 200))
|
||||
r = QgsGradientColorRamp(QColor(200, 0, 0, 100), QColor(0, 200, 0, 200))
|
||||
self.assertEqual(r.type(), 'gradient')
|
||||
self.assertEqual(r.color1(), QColor(200, 0, 0, 100))
|
||||
self.assertEqual(r.color2(), QColor(0, 200, 0, 200))
|
||||
@ -49,8 +49,8 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
self.assertEqual(r.color(0.5), QColor(100, 100, 0, 150))
|
||||
|
||||
# test gradient with stops
|
||||
r = QgsVectorGradientColorRamp(QColor(200, 0, 0), QColor(0, 200, 0), False, [QgsGradientStop(0.1, QColor(180, 20, 40)),
|
||||
QgsGradientStop(0.9, QColor(40, 60, 100))])
|
||||
r = QgsGradientColorRamp(QColor(200, 0, 0), QColor(0, 200, 0), False, [QgsGradientStop(0.1, QColor(180, 20, 40)),
|
||||
QgsGradientStop(0.9, QColor(40, 60, 100))])
|
||||
self.assertEqual(r.color1(), QColor(200, 0, 0))
|
||||
self.assertEqual(r.color2(), QColor(0, 200, 0))
|
||||
self.assertEqual(r.isDiscrete(), False)
|
||||
@ -88,7 +88,7 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
|
||||
# test creating from properties
|
||||
props = r.properties()
|
||||
fromProps = QgsVectorGradientColorRamp.create(props)
|
||||
fromProps = QgsGradientColorRamp.create(props)
|
||||
self.assertEqual(fromProps.color1(), QColor(0, 0, 200))
|
||||
self.assertEqual(fromProps.color2(), QColor(0, 0, 100))
|
||||
s = fromProps.stops()
|
||||
@ -115,14 +115,14 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
|
||||
# test discrete ramps
|
||||
# first with no stops
|
||||
d = QgsVectorGradientColorRamp(QColor(200, 0, 0), QColor(0, 200, 0), True)
|
||||
d = QgsGradientColorRamp(QColor(200, 0, 0), QColor(0, 200, 0), True)
|
||||
self.assertEqual(d.isDiscrete(), True)
|
||||
self.assertEqual(d.color(0), QColor(200, 0, 0))
|
||||
self.assertEqual(d.color(0.5), QColor(200, 0, 0))
|
||||
self.assertEqual(d.color(1), QColor(0, 200, 0))
|
||||
# then with stops
|
||||
d = QgsVectorGradientColorRamp(QColor(200, 0, 0), QColor(0, 200, 0), True, [QgsGradientStop(0.1, QColor(180, 20, 40)),
|
||||
QgsGradientStop(0.9, QColor(40, 60, 100))])
|
||||
d = QgsGradientColorRamp(QColor(200, 0, 0), QColor(0, 200, 0), True, [QgsGradientStop(0.1, QColor(180, 20, 40)),
|
||||
QgsGradientStop(0.9, QColor(40, 60, 100))])
|
||||
self.assertEqual(d.isDiscrete(), True)
|
||||
self.assertEqual(d.color(0), QColor(200, 0, 0))
|
||||
self.assertEqual(d.color(0.05), QColor(200, 0, 0))
|
||||
@ -134,8 +134,8 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
|
||||
# to gradient
|
||||
g = QGradient()
|
||||
r = QgsVectorGradientColorRamp(QColor(200, 0, 0), QColor(0, 200, 0), False, [QgsGradientStop(0.1, QColor(180, 20, 40)),
|
||||
QgsGradientStop(0.9, QColor(40, 60, 100))])
|
||||
r = QgsGradientColorRamp(QColor(200, 0, 0), QColor(0, 200, 0), False, [QgsGradientStop(0.1, QColor(180, 20, 40)),
|
||||
QgsGradientStop(0.9, QColor(40, 60, 100))])
|
||||
r.addStopsToGradient(g, 0.5)
|
||||
self.assertEqual(len(g.stops()), 4)
|
||||
self.assertEqual(g.stops()[0], (0.0, QColor(200, 0, 0, 127)))
|
||||
@ -160,9 +160,9 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
self.assertEqual(s[3].offset, 0.8)
|
||||
self.assertEqual(s[3].color, QColor(50, 20, 10))
|
||||
|
||||
def testQgsVectorRandomColorRampV2(self):
|
||||
def testQgsLimitedRandomColorRampV2(self):
|
||||
# test random color ramp
|
||||
r = QgsVectorRandomColorRamp(5)
|
||||
r = QgsLimitedRandomColorRamp(5)
|
||||
self.assertEqual(r.type(), 'random')
|
||||
self.assertEqual(r.count(), 5)
|
||||
self.assertEqual(r.value(0), 0)
|
||||
@ -208,7 +208,7 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
|
||||
# test creating from properties
|
||||
props = r.properties()
|
||||
fromProps = QgsVectorRandomColorRamp.create(props)
|
||||
fromProps = QgsLimitedRandomColorRamp.create(props)
|
||||
self.assertEqual(fromProps.count(), 5)
|
||||
self.assertEqual(fromProps.hueMin(), 10)
|
||||
self.assertEqual(fromProps.hueMax(), 60)
|
||||
@ -240,9 +240,9 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
self.assertTrue(c.value() >= 150)
|
||||
self.assertTrue(c.value() <= 180)
|
||||
|
||||
def testQgsRandomColorsV2(self):
|
||||
def testQgsRandomColorRampV2(self):
|
||||
# test random colors
|
||||
r = QgsRandomColors()
|
||||
r = QgsRandomColorRamp()
|
||||
self.assertEqual(r.type(), 'randomcolors')
|
||||
self.assertEqual(r.count(), -1) # no color count
|
||||
self.assertEqual(r.value(0), 0) # all values should be 0
|
||||
@ -254,7 +254,7 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
self.assertTrue(c.isValid())
|
||||
|
||||
# test creating from properties
|
||||
# QgsRandomColors has no properties for now, but test to ensure no crash
|
||||
# QgsRandomColorRamp has no properties for now, but test to ensure no crash
|
||||
props = r.properties() # NOQA
|
||||
|
||||
# test cloning ramp
|
||||
@ -268,9 +268,9 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
c = r.color(j * 0.1)
|
||||
self.assertTrue(c.isValid())
|
||||
|
||||
def testQgsVectorColorBrewerColorRampV2(self):
|
||||
def testQgsColorBrewerColorRampV2(self):
|
||||
# test color brewer color ramps
|
||||
r = QgsVectorColorBrewerColorRamp('OrRd', 6)
|
||||
r = QgsColorBrewerColorRamp('OrRd', 6)
|
||||
self.assertEqual(r.type(), 'colorbrewer')
|
||||
self.assertEqual(r.schemeName(), 'OrRd')
|
||||
self.assertEqual(r.count(), 6)
|
||||
@ -291,13 +291,13 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
self.assertEqual(r.color(1.0), QColor(179, 0, 0))
|
||||
|
||||
# try using an invalid scheme name
|
||||
bad = QgsVectorColorBrewerColorRamp('badscheme', 6)
|
||||
bad = QgsColorBrewerColorRamp('badscheme', 6)
|
||||
self.assertFalse(bad.color(0).isValid())
|
||||
self.assertEqual(bad.value(1), 0)
|
||||
|
||||
# test creating from properties
|
||||
props = r.properties()
|
||||
fromProps = QgsVectorColorBrewerColorRamp.create(props)
|
||||
fromProps = QgsColorBrewerColorRamp.create(props)
|
||||
self.assertEqual(fromProps.type(), 'colorbrewer')
|
||||
self.assertEqual(fromProps.schemeName(), 'OrRd')
|
||||
self.assertEqual(fromProps.count(), 6)
|
||||
@ -340,10 +340,10 @@ class PyQgsVectorColorRamp(unittest.TestCase):
|
||||
self.assertEqual(r.color(1.0), QColor(222, 45, 38))
|
||||
|
||||
# test static members
|
||||
names = QgsVectorColorBrewerColorRamp.listSchemeNames()
|
||||
names = QgsColorBrewerColorRamp.listSchemeNames()
|
||||
self.assertTrue('Reds' in names and 'OrRd' in names)
|
||||
self.assertEqual(len(QgsVectorColorBrewerColorRamp.listSchemeVariants('bad scheme')), 0)
|
||||
variants = QgsVectorColorBrewerColorRamp.listSchemeVariants('Reds')
|
||||
self.assertEqual(len(QgsColorBrewerColorRamp.listSchemeVariants('bad scheme')), 0)
|
||||
variants = QgsColorBrewerColorRamp.listSchemeVariants('Reds')
|
||||
self.assertEqual(variants, [3, 4, 5, 6, 7, 8, 9])
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user