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
Symbol levels in Rule-Based renderer #3
Closed
mayeulk
wants to merge
1
commit into
qgis:release-1_7_0
from
mayeulk:release-1_7_0_levels_rbb_1strule
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,7 +128,18 @@ QgsRuleBasedRendererV2::QgsRuleBasedRendererV2( QgsSymbolV2* defaultSymbol ) | |
|
||
QgsSymbolV2* QgsRuleBasedRendererV2::symbolForFeature( QgsFeature& feature ) | ||
{ | ||
return mCurrentSymbol; | ||
|
||
if( !( usingFirstRule() ) ) return mCurrentSymbol; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove one level of parens and add a newline. |
||
|
||
for ( QList<Rule*>::iterator it = mCurrentRules.begin(); it != mCurrentRules.end(); ++it ) | ||
{ | ||
Rule* rule = *it; | ||
|
||
if ( rule->isFilterOK( mCurrentFields, feature ) ) | ||
{ | ||
return rule->symbol(); //works with levels but takes only first rule | ||
} | ||
} | ||
} | ||
|
||
void QgsRuleBasedRendererV2::renderFeature( QgsFeature& feature, | ||
|
@@ -200,6 +211,10 @@ QgsFeatureRendererV2* QgsRuleBasedRendererV2::clone() | |
QgsSymbolV2* s = mDefaultSymbol->clone(); | ||
QgsRuleBasedRendererV2* r = new QgsRuleBasedRendererV2( s ); | ||
r->mRules = mRules; | ||
r->setUsingSymbolLevels( usingSymbolLevels() ); | ||
r->setUsingFirstRule( usingFirstRule() ); | ||
setUsingFirstRule( usingFirstRule() ); | ||
setUsingSymbolLevels( usingSymbolLevels() ); | ||
return r; | ||
} | ||
|
||
|
@@ -219,6 +234,8 @@ QDomElement QgsRuleBasedRendererV2::save( QDomDocument& doc ) | |
{ | ||
QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME ); | ||
rendererElem.setAttribute( "type", "RuleRenderer" ); | ||
rendererElem.setAttribute( "symbollevels", ( mUsingSymbolLevels ? "1" : "0" ) ); | ||
rendererElem.setAttribute( "firstrule", ( mUsingFirstRule ? "1" : "0" ) ); | ||
|
||
QDomElement rulesElem = doc.createElement( "rules" ); | ||
|
||
|
@@ -346,6 +363,12 @@ void QgsRuleBasedRendererV2::removeRuleAt( int index ) | |
mRules.removeAt( index ); | ||
} | ||
|
||
void QgsRuleBasedRendererV2::swapRules( int index1, int index2 ) | ||
{ | ||
mRules.swap( index1, index2 ); | ||
} | ||
|
||
|
||
#include "qgscategorizedsymbolrendererv2.h" | ||
#include "qgsgraduatedsymbolrendererv2.h" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use scripts/prepare-commit.sh please and add braces here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Jef,
Following your comments on indentation in my patch, I tried to use
prepare-commit.sh for more than one hour in vain. When applied after git
commit it says nothing has changed (in effect, after commit, my working
copy is ahead). So I created a new branch locally to restart from
scratch, reapplied my patch, tried the script, in vain again. The best I
get is:
"Unable to determine upstream SVN information from working tree history"
The only help I could find is a few lines on the following page:
http://www.qgis.org/wiki/Developers_Manual#Coding_Style
"There is a scripts/prepare-commit.sh that looks up the changed files
and reindents them using astyle. This should be run before committing.
As newer versions of astyle indent differently than the version used to
do a complete reindentation of the source, the script uses an old astyle
version, that we include in our repository."
I had to guess by reading the source code of the script that I needed to
install flip (and astyle?), and pass the path to the project as first
parameter, but I could not find any documentation on this. Should the
script be run form the root folder? Should I install astyle or not? (the
comment above on the astyle versions puzzles me).
Finally the following command took 10 minutes:
cd /hometb/mk/sig/dev/release-1_7_0-4May/Quantum-GIS
./scrips/prepare-commit.sh .
before telling me:
"Unable to determine upstream SVN information from working tree history"
I tried from several places with relative or absolute path, in vain.
So I tried to follow this advice on the same wiki:
"There is a .indent.pro file in the QGIS src directory that contains the
switches to be used when indenting code using the GNU indent program. If
you don't use GNU indent, you should emulate these settings."
So I installed GNU indent... but could not find the .indent.pro file in
the QGIS src directory. What indent options should I use?
If I cannot make scrips/prepare-commit.sh work, I do not mind formatting
my code manually, but which guidelines? The manual only says "Tab
spacing should be set to 2 spaces" and "Braces should start on the line
following the expression", which I tried to follow.
I do not mind to try and "emulate these settings", if I know where to
look for.
Still, thank you jef for you comments on coding style and other hints.
Could you please give me some hints on how to solve the above
indentation problem?
Thanks a lot in advance!
Mayeul
jef-n wrote at https://github.com/qgis/Quantum-GIS/pull/3/files#r26150 :
See also:
http://osgeo-org.1803224.n2.nabble.com/indentation-scripts-td3194208.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.