Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] [needs-docs] Classify symmetric #6120

Merged
merged 14 commits into from
Sep 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,84 @@ Tests whether classes assigned to the renderer have gaps between the ranges.
Mode mode() const;
void setMode( Mode mode );

void updateClasses( QgsVectorLayer *vlayer, Mode mode, int nclasses );
bool useSymmetricMode() const;
%Docstring
Returns if we want to classify symmetric around a given value

.. versionadded:: 3.4
%End

void setUseSymmetricMode( bool useSymmetricMode );
%Docstring
Set if we want to classify symmetric around a given value

.. versionadded:: 3.4
%End

double symmetryPoint() const;
%Docstring
Returns the pivot value for symmetric classification

.. versionadded:: 3.4
%End

void setSymmetryPoint( double symmetryPoint );
%Docstring
Set the pivot point

.. versionadded:: 3.4
%End



bool astride() const;
%Docstring
Returns if we want to have a central class astride the pivot value

.. versionadded:: 3.4
%End

void setAstride( bool astride );
%Docstring
Set if we want a central class astride the pivot value

.. versionadded:: 3.4
%End

static void makeBreaksSymmetric( QList<double> &breaks, double symmetryPoint, bool astride );
%Docstring
Remove the breaks that are above the existing opposite sign classes to keep colors symmetrically balanced around symmetryPoint
Does not put a break on the symmetryPoint. This is done before.

:param breaks: The breaks of an already-done classification
:param symmetryPoint: The point around which we want a symmetry
:param astride: A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )

.. versionadded:: 3.4
%End

static QList<double> calcEqualIntervalBreaks( double minimum, double maximum, int classes, bool useSymmetricMode, double symmetryPoint, bool astride );
%Docstring
Compute the equal interval classification

:param minimum: The minimum value of the distribution
:param maximum: The maximum value of the distribution
:param classes: The number of classes desired
:param useSymmetricMode: A bool indicating if we want to have classes and hence colors ramp symmetric around a value
:param symmetryPoint: The point around which we want a symmetry
:param astride: A bool indicating if the symmetry is made astride the symmetryPoint or not ( [-1,1] vs. [-1,0][0,1] )
%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)
: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:: 2.6
%End
Expand Down Expand Up @@ -268,7 +339,11 @@ Reset the label decimal places to a numberbased on the minimum class interval
Mode mode,
QgsSymbol *symbol /Transfer/,
QgsColorRamp *ramp /Transfer/,
const QgsRendererRangeLabelFormat &legendFormat = QgsRendererRangeLabelFormat() );
const QgsRendererRangeLabelFormat &legendFormat = QgsRendererRangeLabelFormat(),
bool useSymmetricMode = false,
double symmetryPoint = 0.0,
QStringList listForCboPrettyBreaks = QStringList(),
bool astride = false );
%Docstring
Creates a new graduated renderer.

Expand All @@ -279,6 +354,10 @@ Creates a new graduated renderer.
:param symbol: base symbol
:param ramp: color ramp for classes
:param legendFormat:
: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] )

:return: new QgsGraduatedSymbolRenderer object
%End
Expand Down Expand Up @@ -440,6 +519,7 @@ Will return null if the functionality is disabled.




QgsSymbol *symbolForValue( double value ) const;
%Docstring
Gets the symbol which is used to represent ``value``.
Expand All @@ -451,6 +531,7 @@ Returns the matching legend key for a value.
%End



private:
QgsGraduatedSymbolRenderer( const QgsGraduatedSymbolRenderer & );
QgsGraduatedSymbolRenderer &operator=( const QgsGraduatedSymbolRenderer & );
Expand Down
Loading