-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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] Add the expression for the diagram attributes - #8682 #1039
Conversation
Given that we are now in 2.x releases we need to maintain a stable API if we can. To do this I think you need to add a overloaded method in C++ which one taking QgsAttributes and the other taking QgsFeature. In sip you will just have to have methods with different names but both pointing to the same C++ method. There should be some places we already do this. |
OK, but If I do this I will probably duplicate the code and it the expressions are use I should return an error. |
@Matthias-Kuhn Your probably right, I will work on that :-) |
No you don't have to duplicate it. You just create a feature and set it's attributes in the
All the work still gets done in the |
Deprecation for SIP: |
Deprecation for SIP: |
Thanks for all your responses I will work on them :-) |
Hello, I just add the required changes, and do a rebase, ready for a second review :-) |
Hi Stéphane, It looks good and works fine in some quick tests. Minor issues I noticed:
|
Effectively, I will fix it :-)
Yey it's working, I will do a second checkout to be sure that all is ok ! |
Hello @Matthias-Kuhn, I just add the missing quote, but for the test my second build succeed, but on the same host based on Ubuntu 13.10, can you have some additional information to fix it ? Thanks :-) |
It seems that it's a one-pixel-problem...
|
Nice :-) Can you send me (at [email protected]) your generated files:
To get exactly what's wrong... |
I just fixed my email address :-) |
I just sent them to you. I think I heard there is a tolerance parameter, if it's just a change in the anti-aliasing alogorithm or similar. Anyway I was wondering if an image in this resolution is required for such a test. Seems to be a bit of an overkill (That was my first test I wrote and I was really new to QGIS development when I did that...) |
Effectively there is just one pixel who has the code #8f0f0f in place of #8e0e0e ... I put a smaller image and I hope that's will be ok ... |
Perfect, works here. Would it be easy for you to make the diagramtest image smaller too? |
OK, I will do it tomorrow :-) |
@Matthias-Kuhn Just done :-) |
thank you very much. passes the tests here now. do you have an idea why the diagramtest takes is about 7 times slower than the diagramexpression test? |
Hi Stéphane, I don't recall the comment I wrote on your first code draft literally, but I think it was concerning the prepared execution of expressions. And two minor things: In the sip file, the deprecated methods are marked as pure virtual ( =0 ) while in the header it is just virtual. Not sure if it makes any difference, but would be nice to have the same there. Can you run |
No but with the new version it's much faster :-)
Thanks with your suggest the tests run much faster :-)
Your right I remove them :-)
Thanks for the tip, I correct the related issue :-) Finally should I stash my commits in one or to commits ? CU and thanks for your reactivity and your good review :-) |
Very nice, thank you for the fast changes :-) If you could squash them all into one single commit it would be great. If you feel like optimizing more, you can change the lookup of the expressions into something based on IDs (QVector<QgsExpression*> instead of QMap<QString,QgsExpression*>). I'll have a look at it again when it is squashed. |
Why not but we should use a special index for the size and I think that's clearer with a QMap ... Otherwise I stacked the commits :-) |
I was thinking in terms of memory footprint (The QMap saves a copy of the cleartext expression once more, or does it make use of implicit sharing?) and lookup times (every time you use an expression, text comparisons have to take place) But honestly, I don't know if there is a difference and how much it actually is. I will try to get time for the review this afternoon. |
Good stuff, Stéph, I think it is ready to merge. Just give me a short feedback concerning the .gitignore before and I will merge. And a final question, |
The expression builder don't allow to validate an invalid expression, then the possible issue I see is when we edit the project file ..., and in this case we don't have any user message, the value is just considered to be 0 ! |
The expression could be parsed at least in the config dialog and somewhere shown an appropriate message if this fails. When evaluating the expression, it could be written to the message log, so the user gets a hint that something went wrong. Anyway: Merged in a0911d6 / 1d3dd1b |
Many thanks @Matthias-Kuhn :-) |
It would be very nice if you could write a short summary and make a screenshot for the changelog: Best to send it directly to Tim by email |
Thanks, done :-) |
I don't see the commit a0911d6 in the master branch any more what's going on ? |
It's still there. In fact github just link to it for you. |
Thanks @NathanW2 for your quick response, I just mixup my Git remote, sorry... |
I break the python API should be notified somewhere ?
I change the diagram verifications image, I think that the previous one is wrong, she indicate that some plane hasn't any Pilot ...
All comments are welcome :-)