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

Refactor graduated symbol renderer #31500

Merged
merged 24 commits into from
Sep 2, 2019
Merged

Conversation

3nids
Copy link
Member

@3nids 3nids commented Aug 29, 2019

This is the implementation of qgis/QGIS-Enhancement-Proposals#147

Some work remains to be done in the widget and reading/writing to XML.

@3nids
Copy link
Member Author

3nids commented Aug 30, 2019

Missing bits were completed and this is now tested.

The only changes for the user:

  • an editable combobox with values from the ranges for the symmetry point (instead of spinbox)
  • ranges values can now be edited and legend will be correctly recalculated (for Std Dev for instance)

@3nids 3nids force-pushed the refactor_classification branch 4 times, most recently from 7b3b2c9 to b66b839 Compare August 30, 2019 12:33
@3nids
Copy link
Member Author

3nids commented Aug 31, 2019

The PR is ready for review.

Last missing thing to get green light from Travis is a warning when building the API docs probably due to use of Q_DECL_DEPRECATED on an enum. See warning on the build log or:
image
Will try with a newer Doxygen thanks to using Bionic on Travis (instead of Xenial), if not I will just drop the deprecation.

Regarding the review, I have mainly one point I'd like opinions. It's in the graduated symbol renderer which keeps a pointer to the method. A new method can be set using a setter.
I have used a sharer pointer for the method. See here.
image
Is this a wise choice (or a dummy one)?

@3nids 3nids closed this Aug 31, 2019
@3nids 3nids reopened this Aug 31, 2019
python/CMakeLists.txt Outdated Show resolved Hide resolved
src/core/CMakeLists.txt Outdated Show resolved Hide resolved
breaks << value;
}
breaks[nclasses - 1] = maximum;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For review purposes -- was any of the actual logic changed in these?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no.
The only thing I find weird is that breaks always include maximum but not minimum values. I kept this behavior.

// Jenks Optimal (Natural Breaks) algorithm
// Based on the Jenks algorithm from the 'classInt' package available for
// the R statistical prgramming language, and from Python code from here:
// http://danieljlewis.org/2010/06/07/jenks-natural-breaks-algorithm-in-python/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to self - we should resync this with classInt and double check we aren't missing any upstream fixes...

// if we have lots of values, we need to take a random sample
if ( values.size() > mMaximumSize )
{
// for now, sample at least maximumSize values or a 10% sample, whichever
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it worth moving the support for max sample sizes outside of this, so that the feature request used to fetch the values has a setLimit on it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense but a beyond the scope of this PR. I believe this can be easily added later on, even in classification base class.

src/core/symbology/qgsgraduatedsymbolrenderer.cpp Outdated Show resolved Hide resolved
src/core/symbology/qgsgraduatedsymbolrenderer.h Outdated Show resolved Hide resolved
@3nids 3nids force-pushed the refactor_classification branch 2 times, most recently from fd6a734 to 5b9fc1f Compare September 2, 2019 08:09
@3nids 3nids force-pushed the refactor_classification branch 5 times, most recently from fe2a454 to 2fae425 Compare September 2, 2019 10:56
@3nids 3nids merged commit b3d52df into qgis:master Sep 2, 2019
@3nids 3nids deleted the refactor_classification branch September 2, 2019 12:57
@nyalldawson
Copy link
Collaborator

@3nids a minor regression here:

image

(duplicate "std dev" text)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants