mirror of
https://github.com/qgis/QGIS.git
synced 2025-06-19 00:02:48 -04:00
improved problem (b)
removed the .sip corrected (f) removed direct comparison of doubles to try to pass the tests one step back to know if it cause the check failure the step forward, improved, should pass the test comments of m-kuhn taken into account The last 7 commits to rebase easily on master
This commit is contained in:
parent
fe049d372c
commit
0053630f8e
@ -1,535 +0,0 @@
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/symbology/qgsgraduatedsymbolrenderer.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsRendererRange
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsgraduatedsymbolrenderer.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsRendererRange();
|
||||
%Docstring
|
||||
Constructor for QgsRendererRange.
|
||||
%End
|
||||
QgsRendererRange( double lowerValue, double upperValue, QgsSymbol *symbol /Transfer/, const QString &label, bool render = true );
|
||||
QgsRendererRange( const QgsRendererRange &range );
|
||||
|
||||
|
||||
bool operator<( const QgsRendererRange &other ) const;
|
||||
|
||||
double lowerValue() const;
|
||||
double upperValue() const;
|
||||
|
||||
QgsSymbol *symbol() const;
|
||||
QString label() const;
|
||||
|
||||
void setSymbol( QgsSymbol *s /Transfer/ );
|
||||
void setLabel( const QString &label );
|
||||
void setLowerValue( double lowerValue );
|
||||
void setUpperValue( double upperValue );
|
||||
|
||||
bool renderState() const;
|
||||
void setRenderState( bool render );
|
||||
|
||||
QString dump() const;
|
||||
|
||||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props, bool firstRange = false ) const;
|
||||
%Docstring
|
||||
Creates a DOM element representing the range in SLD format.
|
||||
|
||||
:param doc: DOM document
|
||||
:param element: destination DOM element
|
||||
:param props: graduated renderer properties
|
||||
:param firstRange: set to true if the range is the first range, where the lower value uses a <= test
|
||||
rather than a < test.
|
||||
%End
|
||||
|
||||
protected:
|
||||
|
||||
void swap( QgsRendererRange &other );
|
||||
};
|
||||
|
||||
typedef QList<QgsRendererRange> QgsRangeList;
|
||||
|
||||
|
||||
class QgsRendererRangeLabelFormat
|
||||
{
|
||||
%Docstring
|
||||
|
||||
.. versionadded:: 2.6
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsgraduatedsymbolrenderer.h"
|
||||
%End
|
||||
public:
|
||||
QgsRendererRangeLabelFormat();
|
||||
QgsRendererRangeLabelFormat( const QString &format, int precision = 4, bool trimTrailingZeroes = false );
|
||||
|
||||
bool operator==( const QgsRendererRangeLabelFormat &other ) const;
|
||||
bool operator!=( const QgsRendererRangeLabelFormat &other ) const;
|
||||
|
||||
QString format() const;
|
||||
void setFormat( const QString &format );
|
||||
|
||||
int precision() const;
|
||||
void setPrecision( int precision );
|
||||
|
||||
bool trimTrailingZeroes() const;
|
||||
void setTrimTrailingZeroes( bool trimTrailingZeroes );
|
||||
|
||||
QString labelForRange( double lower, double upper ) const /PyName=labelForLowerUpper/;
|
||||
%Docstring
|
||||
|
||||
.. note::
|
||||
|
||||
labelForLowerUpper in Python bindings
|
||||
%End
|
||||
QString labelForRange( const QgsRendererRange &range ) const;
|
||||
QString formatNumber( double value ) const;
|
||||
|
||||
void setFromDomElement( QDomElement &element );
|
||||
void saveToDomElement( QDomElement &element );
|
||||
|
||||
static const int MAX_PRECISION;
|
||||
static const int MIN_PRECISION;
|
||||
|
||||
protected:
|
||||
};
|
||||
|
||||
|
||||
class QgsGraduatedSymbolRenderer : QgsFeatureRenderer
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsgraduatedsymbolrenderer.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsGraduatedSymbolRenderer( const QString &attrName = QString(), const QgsRangeList &ranges = QgsRangeList() );
|
||||
|
||||
~QgsGraduatedSymbolRenderer();
|
||||
|
||||
virtual QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context );
|
||||
|
||||
virtual QgsSymbol *originalSymbolForFeature( QgsFeature &feature, QgsRenderContext &context );
|
||||
|
||||
virtual void startRender( QgsRenderContext &context, const QgsFields &fields );
|
||||
|
||||
virtual void stopRender( QgsRenderContext &context );
|
||||
|
||||
virtual QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
|
||||
|
||||
virtual QString dump() const;
|
||||
|
||||
virtual QgsGraduatedSymbolRenderer *clone() const /Factory/;
|
||||
|
||||
virtual void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props = QgsStringMap() ) const;
|
||||
|
||||
virtual QgsFeatureRenderer::Capabilities capabilities();
|
||||
virtual QgsSymbolList symbols( QgsRenderContext &context );
|
||||
|
||||
|
||||
QString classAttribute() const;
|
||||
void setClassAttribute( const QString &attr );
|
||||
|
||||
const QgsRangeList &ranges() const;
|
||||
|
||||
bool updateRangeSymbol( int rangeIndex, QgsSymbol *symbol /Transfer/ );
|
||||
bool updateRangeLabel( int rangeIndex, const QString &label );
|
||||
bool updateRangeUpperValue( int rangeIndex, double value );
|
||||
bool updateRangeLowerValue( int rangeIndex, double value );
|
||||
bool updateRangeRenderState( int rangeIndex, bool render );
|
||||
%Docstring
|
||||
|
||||
.. versionadded:: 2.5
|
||||
%End
|
||||
|
||||
void addClass( QgsSymbol *symbol );
|
||||
void addClass( const QgsRendererRange &range ) /PyName=addClassRange/;
|
||||
%Docstring
|
||||
|
||||
.. note::
|
||||
|
||||
available in Python bindings as addClassRange
|
||||
%End
|
||||
void addClass( double lower, double upper ) /PyName=addClassLowerUpper/;
|
||||
%Docstring
|
||||
|
||||
.. note::
|
||||
|
||||
available in Python bindings as addClassLowerUpper
|
||||
%End
|
||||
|
||||
void addBreak( double breakValue, bool updateSymbols = true );
|
||||
%Docstring
|
||||
Add a breakpoint by splitting existing classes so that the specified
|
||||
value becomes a break between two classes.
|
||||
|
||||
:param breakValue: position to insert break
|
||||
:param updateSymbols: set to true to reapply ramp colors to the new
|
||||
symbol ranges
|
||||
|
||||
.. versionadded:: 2.9
|
||||
%End
|
||||
|
||||
void deleteClass( int idx );
|
||||
void deleteAllClasses();
|
||||
|
||||
void moveClass( int from, int to );
|
||||
%Docstring
|
||||
Moves the category at index position from to index position to.
|
||||
%End
|
||||
|
||||
bool rangesOverlap() const;
|
||||
%Docstring
|
||||
Tests whether classes assigned to the renderer have ranges which overlap.
|
||||
|
||||
:return: true if ranges overlap
|
||||
|
||||
.. versionadded:: 2.10
|
||||
%End
|
||||
|
||||
bool rangesHaveGaps() const;
|
||||
%Docstring
|
||||
Tests whether classes assigned to the renderer have gaps between the ranges.
|
||||
|
||||
:return: true if ranges have gaps
|
||||
|
||||
.. versionadded:: 2.10
|
||||
%End
|
||||
|
||||
void sortByValue( Qt::SortOrder order = Qt::AscendingOrder );
|
||||
void sortByLabel( Qt::SortOrder order = Qt::AscendingOrder );
|
||||
|
||||
enum Mode
|
||||
{
|
||||
EqualInterval,
|
||||
Quantile,
|
||||
Jenks,
|
||||
StdDev,
|
||||
Pretty,
|
||||
Custom
|
||||
};
|
||||
|
||||
Mode mode() const;
|
||||
void setMode( Mode mode );
|
||||
|
||||
bool useSymmetricMode();
|
||||
%Docstring
|
||||
get mUseSymmetricMode, which says if we want to classify symmetric around a given value
|
||||
|
||||
.. versionadded:: 3.2
|
||||
%End
|
||||
|
||||
void setUseSymmetricMode( bool useSymmetricMode );
|
||||
%Docstring
|
||||
set mUseSymmetricMode, which says if we want to classify symmetric around a given value
|
||||
|
||||
.. versionadded:: 3.2
|
||||
%End
|
||||
|
||||
double symmetryPoint();
|
||||
%Docstring
|
||||
get mSymmetryPoint, the pivot value for symmetric classification
|
||||
|
||||
.. versionadded:: 3.2
|
||||
%End
|
||||
|
||||
void setSymmetryPoint( double symmetryPoint );
|
||||
%Docstring
|
||||
set the pivot point
|
||||
|
||||
.. versionadded:: 3.2
|
||||
%End
|
||||
|
||||
QStringList listForCboPrettyBreaks();
|
||||
%Docstring
|
||||
get mListForCboPrettyBreaks, which is need to recover this list in saved configuration, or when property window in closed and reopened
|
||||
|
||||
.. versionadded:: 3.2
|
||||
%End
|
||||
|
||||
void setListForCboPrettyBreaks( QStringList listForCboPrettyBreaks );
|
||||
%Docstring
|
||||
set mListForCboPrettyBreaks, which is need to recover this list in saved configuration, or when property window in closed and reopened
|
||||
|
||||
.. versionadded:: 3.2
|
||||
%End
|
||||
|
||||
bool astride();
|
||||
%Docstring
|
||||
get mAstride, a bool saying if we want to have a central class astride the pivot value
|
||||
|
||||
.. versionadded:: 3.2
|
||||
%End
|
||||
|
||||
void setAstride( bool astride );
|
||||
%Docstring
|
||||
set mAstride, a bool saying if we want to have a central class astride the pivot value
|
||||
|
||||
.. versionadded:: 3.2
|
||||
%End
|
||||
|
||||
void updateClasses( QgsVectorLayer *vlayer, Mode mode, int nclasses, bool useSymmetricMode = false, double symmetryPoint = 0.0, bool astride = false );
|
||||
%Docstring
|
||||
Recalculate classes for a layer
|
||||
|
||||
:param vlayer: The layer being rendered (from which data values are calculated)
|
||||
:param mode: The calculation mode
|
||||
:param nclasses: The number of classes to calculate (approximate for some modes)
|
||||
|
||||
.. versionadded:: 2.6
|
||||
:param useSymmetricMode: A bool indicating if we want to have classes and hence colors ramp symmetric around a value
|
||||
:param symmetryPoint: The value around which the classes will be symmetric if useSymmetricMode is checked
|
||||
:param astride: A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
|
||||
|
||||
.. versionadded:: 3.2
|
||||
%End
|
||||
|
||||
const QgsRendererRangeLabelFormat &labelFormat() const;
|
||||
%Docstring
|
||||
Return the label format used to generate default classification labels
|
||||
|
||||
.. versionadded:: 2.6
|
||||
%End
|
||||
|
||||
void setLabelFormat( const QgsRendererRangeLabelFormat &labelFormat, bool updateRanges = false );
|
||||
%Docstring
|
||||
Set the label format used to generate default classification labels
|
||||
|
||||
:param labelFormat: The string appended to classification labels
|
||||
:param updateRanges: If true then ranges ending with the old unit string are updated to the new.
|
||||
|
||||
.. versionadded:: 2.6
|
||||
%End
|
||||
|
||||
void calculateLabelPrecision( bool updateRanges = true );
|
||||
%Docstring
|
||||
Reset the label decimal places to a numberbased on the minimum class interval
|
||||
|
||||
:param updateRanges: if true then ranges currently using the default label will be updated
|
||||
|
||||
.. versionadded:: 2.6
|
||||
%End
|
||||
|
||||
static QgsGraduatedSymbolRenderer *createRenderer( QgsVectorLayer *vlayer,
|
||||
const QString &attrName,
|
||||
int classes,
|
||||
Mode mode,
|
||||
bool useSymmetricMode,
|
||||
double symmetryPoint,
|
||||
QStringList listForCboPrettyBreaks,
|
||||
bool astride,
|
||||
QgsSymbol *symbol /Transfer/,
|
||||
QgsColorRamp *ramp /Transfer/,
|
||||
const QgsRendererRangeLabelFormat &legendFormat = QgsRendererRangeLabelFormat() );
|
||||
%Docstring
|
||||
Creates a new graduated renderer.
|
||||
|
||||
:param vlayer: vector layer
|
||||
:param attrName: attribute to classify
|
||||
:param classes: number of classes
|
||||
:param mode: classification mode
|
||||
:param useSymmetricMode: A bool indicating if we want to have classes and hence colors ramp symmetric around a value
|
||||
:param symmetryPoint: The value around which the classes will be symmetric if useSymmetricMode is checked
|
||||
:param listForCboPrettyBreaks: The list of potential pivot values for symmetric mode with prettybreaks mode
|
||||
:param astride: A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
|
||||
:param symbol: base symbol
|
||||
:param ramp: color ramp for classes
|
||||
:param legendFormat:
|
||||
|
||||
:return: new QgsGraduatedSymbolRenderer object
|
||||
%End
|
||||
|
||||
static QgsFeatureRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) /Factory/;
|
||||
%Docstring
|
||||
create renderer from XML element
|
||||
%End
|
||||
|
||||
virtual QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context );
|
||||
|
||||
virtual QgsLegendSymbolList legendSymbolItems() const;
|
||||
|
||||
virtual QSet< QString > legendKeysForFeature( QgsFeature &feature, QgsRenderContext &context );
|
||||
|
||||
|
||||
QgsSymbol *sourceSymbol();
|
||||
%Docstring
|
||||
Returns the renderer's source symbol, which is the base symbol used for the each classes' symbol before applying
|
||||
the classes' color.
|
||||
|
||||
.. seealso:: :py:func:`setSourceSymbol`
|
||||
|
||||
.. seealso:: :py:func:`sourceColorRamp`
|
||||
%End
|
||||
|
||||
void setSourceSymbol( QgsSymbol *sym /Transfer/ );
|
||||
%Docstring
|
||||
Sets the source symbol for the renderer, which is the base symbol used for the each classes' symbol before applying
|
||||
the classes' color.
|
||||
|
||||
:param sym: source symbol, ownership is transferred to the renderer
|
||||
|
||||
.. seealso:: :py:func:`sourceSymbol`
|
||||
|
||||
.. seealso:: :py:func:`setSourceColorRamp`
|
||||
%End
|
||||
|
||||
QgsColorRamp *sourceColorRamp();
|
||||
%Docstring
|
||||
Returns the source color ramp, from which each classes' color is derived.
|
||||
|
||||
.. seealso:: :py:func:`setSourceColorRamp`
|
||||
|
||||
.. seealso:: :py:func:`sourceSymbol`
|
||||
%End
|
||||
|
||||
void setSourceColorRamp( QgsColorRamp *ramp /Transfer/ );
|
||||
%Docstring
|
||||
Sets the source color ramp.
|
||||
|
||||
:param ramp: color ramp. Ownership is transferred to the renderer
|
||||
%End
|
||||
|
||||
void updateColorRamp( QgsColorRamp *ramp /Transfer/ = 0 );
|
||||
%Docstring
|
||||
Update the color ramp used. Also updates all symbols colors.
|
||||
Doesn't alter current breaks.
|
||||
|
||||
:param ramp: color ramp. Ownership is transferred to the renderer
|
||||
%End
|
||||
|
||||
void updateSymbols( QgsSymbol *sym );
|
||||
%Docstring
|
||||
Update all the symbols but leave breaks and colors. This method also sets the source
|
||||
symbol for the renderer.
|
||||
|
||||
:param sym: source symbol to use for classes. Ownership is not transferred.
|
||||
|
||||
.. seealso:: :py:func:`setSourceSymbol`
|
||||
%End
|
||||
|
||||
void setSymbolSizes( double minSize, double maxSize );
|
||||
%Docstring
|
||||
set varying symbol size for classes
|
||||
|
||||
.. note::
|
||||
|
||||
the classes must already be set so that symbols exist
|
||||
|
||||
.. versionadded:: 2.10
|
||||
%End
|
||||
|
||||
double minSymbolSize() const;
|
||||
%Docstring
|
||||
return the min symbol size when graduated by size
|
||||
|
||||
.. versionadded:: 2.10
|
||||
%End
|
||||
|
||||
double maxSymbolSize() const;
|
||||
%Docstring
|
||||
return the max symbol size when graduated by size
|
||||
|
||||
.. versionadded:: 2.10
|
||||
%End
|
||||
|
||||
enum GraduatedMethod
|
||||
{
|
||||
GraduatedColor,
|
||||
GraduatedSize
|
||||
};
|
||||
|
||||
GraduatedMethod graduatedMethod() const;
|
||||
%Docstring
|
||||
return the method used for graduation (either size or color)
|
||||
|
||||
.. versionadded:: 2.10
|
||||
%End
|
||||
|
||||
void setGraduatedMethod( GraduatedMethod method );
|
||||
%Docstring
|
||||
set the method used for graduation (either size or color)
|
||||
|
||||
.. versionadded:: 2.10
|
||||
%End
|
||||
|
||||
virtual bool legendSymbolItemsCheckable() const;
|
||||
|
||||
virtual bool legendSymbolItemChecked( const QString &key );
|
||||
|
||||
virtual void checkLegendSymbolItem( const QString &key, bool state = true );
|
||||
|
||||
virtual void setLegendSymbolItem( const QString &key, QgsSymbol *symbol /Transfer/ );
|
||||
|
||||
virtual QString legendClassificationAttribute() const;
|
||||
|
||||
static QgsGraduatedSymbolRenderer *convertFromRenderer( const QgsFeatureRenderer *renderer ) /Factory/;
|
||||
%Docstring
|
||||
creates a QgsGraduatedSymbolRenderer from an existing renderer.
|
||||
|
||||
:return: a new renderer if the conversion was possible, otherwise 0.
|
||||
|
||||
.. versionadded:: 2.6
|
||||
%End
|
||||
|
||||
void setDataDefinedSizeLegend( QgsDataDefinedSizeLegend *settings /Transfer/ );
|
||||
%Docstring
|
||||
Configures appearance of legend when renderer is configured to use data-defined size for marker symbols.
|
||||
This allows configuring for which values (symbol sizes) should be shown in the legend, whether to display
|
||||
different symbol sizes collapsed in one legend node or separated across multiple legend nodes etc.
|
||||
|
||||
When renderer does not use data-defined size or does not use marker symbols, these settings will be ignored.
|
||||
Takes ownership of the passed settings objects. Null pointer is a valid input that disables data-defined
|
||||
size legend.
|
||||
|
||||
.. versionadded:: 3.0
|
||||
%End
|
||||
|
||||
QgsDataDefinedSizeLegend *dataDefinedSizeLegend() const;
|
||||
%Docstring
|
||||
Returns configuration of appearance of legend when using data-defined size for marker symbols.
|
||||
Will return null if the functionality is disabled.
|
||||
|
||||
.. versionadded:: 3.0
|
||||
%End
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
QgsSymbol *symbolForValue( double value );
|
||||
%Docstring
|
||||
attribute index (derived from attribute name in startRender)
|
||||
%End
|
||||
|
||||
QString legendKeyForValue( double value ) const;
|
||||
%Docstring
|
||||
Returns the matching legend key for a value.
|
||||
%End
|
||||
|
||||
|
||||
private:
|
||||
QgsGraduatedSymbolRenderer( const QgsGraduatedSymbolRenderer & );
|
||||
QgsGraduatedSymbolRenderer &operator=( const QgsGraduatedSymbolRenderer & );
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/symbology/qgsgraduatedsymbolrenderer.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
@ -1,100 +0,0 @@
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/gui/symbology/qgsgraduatedsymbolrendererwidget.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsGraduatedSymbolRendererWidget : QgsRendererWidget
|
||||
{
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsgraduatedsymbolrendererwidget.h"
|
||||
%End
|
||||
public:
|
||||
static QgsRendererWidget *create( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer ) /Factory/;
|
||||
|
||||
QgsGraduatedSymbolRendererWidget( QgsVectorLayer *layer, QgsStyle *style, QgsFeatureRenderer *renderer );
|
||||
~QgsGraduatedSymbolRendererWidget();
|
||||
|
||||
virtual QgsFeatureRenderer *renderer();
|
||||
|
||||
|
||||
public slots:
|
||||
void changeGraduatedSymbol();
|
||||
void graduatedColumnChanged( const QString &field );
|
||||
void classifyGraduated();
|
||||
void reapplyColorRamp();
|
||||
void reapplySizes();
|
||||
void rangesDoubleClicked( const QModelIndex &idx );
|
||||
void rangesClicked( const QModelIndex &idx );
|
||||
void changeCurrentValue( QStandardItem *item );
|
||||
|
||||
void addClass();
|
||||
%Docstring
|
||||
Adds a class manually to the classification
|
||||
%End
|
||||
void deleteClasses();
|
||||
%Docstring
|
||||
Removes currently selected classes
|
||||
%End
|
||||
void deleteAllClasses();
|
||||
%Docstring
|
||||
Removes all classes from the classification
|
||||
%End
|
||||
void toggleBoundariesLink( bool linked );
|
||||
%Docstring
|
||||
Toggle the link between classes boundaries
|
||||
%End
|
||||
|
||||
void labelFormatChanged();
|
||||
|
||||
void showSymbolLevels();
|
||||
|
||||
void rowsMoved();
|
||||
void modelDataChanged();
|
||||
void refreshRanges( bool reset = false );
|
||||
|
||||
protected:
|
||||
void updateUiFromRenderer( bool updateCount = true );
|
||||
void connectUpdateHandlers();
|
||||
void disconnectUpdateHandlers();
|
||||
bool rowsOrdered();
|
||||
|
||||
void updateGraduatedSymbolIcon();
|
||||
|
||||
QList<int> selectedClasses();
|
||||
%Docstring
|
||||
return a list of indexes for the classes under selection
|
||||
%End
|
||||
QgsRangeList selectedRanges();
|
||||
|
||||
void changeRangeSymbol( int rangeIdx );
|
||||
void changeRange( int rangeIdx );
|
||||
|
||||
void changeSelectedSymbols();
|
||||
|
||||
virtual QList<QgsSymbol *> selectedSymbols();
|
||||
|
||||
QgsSymbol *findSymbolForRange( double lowerBound, double upperBound, const QgsRangeList &ranges ) const;
|
||||
virtual void refreshSymbolView();
|
||||
|
||||
|
||||
virtual void keyPressEvent( QKeyEvent *event );
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/gui/symbology/qgsgraduatedsymbolrendererwidget.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
@ -1217,7 +1217,8 @@ QDomElement QgsGraduatedSymbolRenderer::save( QDomDocument &doc, const QgsReadWr
|
||||
breaks.append( mListForCboPrettyBreaks.at( i ) );
|
||||
breaks.append( QStringLiteral( "/" ) );
|
||||
}
|
||||
breaks.append( mListForCboPrettyBreaks.at( mListForCboPrettyBreaks.size() - 1 ) );
|
||||
if ( mListForCboPrettyBreaks.size() > 0 ) //make sure we can go at size-1
|
||||
breaks.append( mListForCboPrettyBreaks.at( mListForCboPrettyBreaks.size() - 1 ) ); //add the last break
|
||||
symmetricModeElem.setAttribute( QStringLiteral( "valueForCboPrettyBreaks" ), breaks );
|
||||
}
|
||||
|
||||
|
@ -223,50 +223,50 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
void setMode( Mode mode ) { mMode = mode; }
|
||||
|
||||
/**
|
||||
* get mUseSymmetricMode, which says if we want to classify symmetric around a given value
|
||||
* \since QGIS 3.2
|
||||
* Get if we want to classify symmetric around a given value
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
bool useSymmetricMode() { return mUseSymmetricMode; }
|
||||
bool useSymmetricMode() const { return mUseSymmetricMode; }
|
||||
|
||||
/**
|
||||
* set mUseSymmetricMode, which says if we want to classify symmetric around a given value
|
||||
* \since QGIS 3.2
|
||||
* Set if we want to classify symmetric around a given value
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
void setUseSymmetricMode( bool useSymmetricMode ) { mUseSymmetricMode = useSymmetricMode; }
|
||||
|
||||
/**
|
||||
* get mSymmetryPoint, the pivot value for symmetric classification
|
||||
* \since QGIS 3.2
|
||||
* Get the pivot value for symmetric classification
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
double symmetryPoint() { return mSymmetryPoint; }
|
||||
double symmetryPoint() const { return mSymmetryPoint; }
|
||||
|
||||
/**
|
||||
* set the pivot point
|
||||
* \since QGIS 3.2
|
||||
* Set the pivot point
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
void setSymmetryPoint( double symmetryPoint ) { mSymmetryPoint = symmetryPoint; }
|
||||
|
||||
/**
|
||||
* get mListForCboPrettyBreaks, which is need to recover this list in saved configuration, or when property window in closed and reopened
|
||||
* \since QGIS 3.2
|
||||
* Get mListForCboPrettyBreaks, which is needed to recover this list in saved configuration, or when property window in closed and reopened
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
QStringList listForCboPrettyBreaks() { return mListForCboPrettyBreaks; }
|
||||
QStringList listForCboPrettyBreaks() const { return mListForCboPrettyBreaks; }
|
||||
|
||||
/**
|
||||
* set mListForCboPrettyBreaks, which is need to recover this list in saved configuration, or when property window in closed and reopened
|
||||
* \since QGIS 3.2
|
||||
* Set the list of breaks used in the prettybreaks mode, which is needed to recover this list in saved configuration, or when property window is closed and reopened
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
void setListForCboPrettyBreaks( QStringList listForCboPrettyBreaks ) { mListForCboPrettyBreaks = listForCboPrettyBreaks; }
|
||||
|
||||
/**
|
||||
* get mAstride, a bool saying if we want to have a central class astride the pivot value
|
||||
* \since QGIS 3.2
|
||||
* Get if we want to have a central class astride the pivot value
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
bool astride() { return mAstride; }
|
||||
bool astride() const { return mAstride; }
|
||||
|
||||
/**
|
||||
* set mAstride, a bool saying if we want to have a central class astride the pivot value
|
||||
* \since QGIS 3.2
|
||||
* Set if we want a central class astride the pivot value
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
void setAstride( bool astride ) { mAstride = astride; }
|
||||
|
||||
@ -279,7 +279,7 @@ class CORE_EXPORT QgsGraduatedSymbolRenderer : public QgsFeatureRenderer
|
||||
* \param useSymmetricMode A bool indicating if we want to have classes and hence colors ramp symmetric around a value
|
||||
* \param symmetryPoint The value around which the classes will be symmetric if useSymmetricMode is checked
|
||||
* \param astride A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
|
||||
* \since QGIS 3.2
|
||||
* \since QGIS 3.4
|
||||
*/
|
||||
void updateClasses( QgsVectorLayer *vlayer, Mode mode, int nclasses, bool useSymmetricMode = false, double symmetryPoint = 0.0, bool astride = false );
|
||||
|
||||
|
@ -576,7 +576,7 @@ void QgsGraduatedSymbolRendererWidget::connectUpdateHandlers()
|
||||
connect( cbxClassifySymmetric, &QAbstractButton::toggled, this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
|
||||
connect( cbxAstride, &QAbstractButton::toggled, this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
|
||||
connect( cboSymmetryPointForPretty, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
|
||||
connect( spinSymmetryPointForOtherMethods, static_cast < void ( QgsDoubleSpinBox::* )( double ) > ( &QgsDoubleSpinBox::valueChanged ), this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
|
||||
connect( spinSymmetryPointForOtherMethods, static_cast<void( QgsDoubleSpinBox::* )()>( &QgsDoubleSpinBox::editingFinished ), this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
|
||||
}
|
||||
|
||||
// Connect/disconnect event handlers which trigger updating renderer
|
||||
@ -597,7 +597,7 @@ void QgsGraduatedSymbolRendererWidget::disconnectUpdateHandlers()
|
||||
disconnect( cbxClassifySymmetric, &QAbstractButton::toggled, this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
|
||||
disconnect( cbxAstride, &QAbstractButton::toggled, this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
|
||||
disconnect( cboSymmetryPointForPretty, static_cast<void ( QComboBox::* )( int )>( &QComboBox::activated ), this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
|
||||
disconnect( spinSymmetryPointForOtherMethods, static_cast < void ( QgsDoubleSpinBox::* )( double ) > ( &QgsDoubleSpinBox::valueChanged ), this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
|
||||
disconnect( spinSymmetryPointForOtherMethods, static_cast<void( QgsDoubleSpinBox::* )()>( &QgsDoubleSpinBox::editingFinished ), this, &QgsGraduatedSymbolRendererWidget::classifyGraduated );
|
||||
}
|
||||
|
||||
void QgsGraduatedSymbolRendererWidget::updateUiFromRenderer( bool updateCount )
|
||||
@ -864,16 +864,22 @@ void QgsGraduatedSymbolRendererWidget::classifyGraduated()
|
||||
QgsGraduatedSymbolRenderer::Mode mode;
|
||||
bool useSymmetricMode = false;
|
||||
bool astride = false;
|
||||
double symmetryPoint = 0.0;
|
||||
|
||||
int attrNum = mLayer->fields().lookupField( attrName );
|
||||
double minimum = mLayer->minimumValue( attrNum ).toDouble();
|
||||
double maximum = mLayer->maximumValue( attrNum ).toDouble();
|
||||
spinSymmetryPointForOtherMethods->setMinimum( minimum );
|
||||
spinSymmetryPointForOtherMethods->setMaximum( maximum );
|
||||
spinSymmetryPointForOtherMethods->setDecimals( spinPrecision->value() );
|
||||
double symmetryPoint = spinSymmetryPointForOtherMethods->value();
|
||||
|
||||
if ( cboGraduatedMode->currentIndex() == 0 ) // EqualInterval
|
||||
{
|
||||
mode = QgsGraduatedSymbolRenderer::EqualInterval;
|
||||
// because spinSymmetryPointForOtherMethods->value() is put at minimum when out of min-max
|
||||
if ( spinSymmetryPointForOtherMethods->value() <= minimum + ( maximum - minimum ) / 100. ) // to avoid direct comparison of doubles
|
||||
symmetryPoint = minimum + ( maximum - minimum ) / 2;
|
||||
|
||||
if ( cbxClassifySymmetric->isChecked() )
|
||||
{
|
||||
useSymmetricMode = true;
|
||||
@ -888,6 +894,9 @@ void QgsGraduatedSymbolRendererWidget::classifyGraduated()
|
||||
else if ( cboGraduatedMode->currentIndex() == 3 ) // StdDev
|
||||
{
|
||||
mode = QgsGraduatedSymbolRenderer::StdDev;
|
||||
if ( spinSymmetryPointForOtherMethods->value() <= minimum + ( maximum - minimum ) / 100. ) // to avoid direct comparison of doubles
|
||||
symmetryPoint = minimum + ( maximum - minimum ) / 2;
|
||||
|
||||
if ( cbxClassifySymmetric->isChecked() )
|
||||
{
|
||||
useSymmetricMode = true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user