Skip to content
Permalink
Browse files
Remove "first rule" and "use symbol levels" options
  • Loading branch information
wonder-sk committed Nov 26, 2011
1 parent 1e7a554 commit 81ec790e1ff89ba77e46363df7f0981968c3da61
@@ -354,7 +354,6 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::load( QDomElement& element )
if ( r )
{
r->setUsingSymbolLevels( element.attribute( "symbollevels", "0" ).toInt() );
r->setUsingFirstRule( element.attribute( "firstrule", "0" ).toInt() );
}
return r;
}
@@ -84,10 +84,6 @@ class CORE_EXPORT QgsFeatureRendererV2
bool usingSymbolLevels() const { return mUsingSymbolLevels; }
void setUsingSymbolLevels( bool usingSymbolLevels ) { mUsingSymbolLevels = usingSymbolLevels; }

bool usingFirstRule() const { return mUsingFirstRule; }
void setUsingFirstRule( bool usingFirstRule ) { mUsingFirstRule = usingFirstRule; }


//! create a renderer from XML element
static QgsFeatureRendererV2* load( QDomElement& symbologyElem );

@@ -128,7 +124,6 @@ class CORE_EXPORT QgsFeatureRendererV2
QString mType;

bool mUsingSymbolLevels;
bool mUsingFirstRule;

/** The current type of editing marker */
int mCurrentVertexMarkerType;
@@ -309,8 +309,6 @@ QgsFeatureRendererV2* QgsRuleBasedRendererV2::clone()
QgsRuleBasedRendererV2* r = new QgsRuleBasedRendererV2( s );
r->mRules = mRules;
r->setUsingSymbolLevels( usingSymbolLevels() );
r->setUsingFirstRule( usingFirstRule() );
setUsingFirstRule( usingFirstRule() );
setUsingSymbolLevels( usingSymbolLevels() );
return r;
}
@@ -332,7 +330,6 @@ 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" );

@@ -203,29 +203,11 @@ void QgsRendererV2PropertiesDialog::showSymbolLevels()
QgsSymbolV2List symbols = r->symbols();

QgsSymbolLevelsV2Dialog dlg( symbols, r->usingSymbolLevels(), this );
connect( this, SIGNAL( forceChkUsingFirstRule() ), mActiveWidget, SLOT( forceUsingFirstRule() ) );
connect( this, SIGNAL( forceUncheckSymbolLevels() ), mActiveWidget, SLOT( forceNoSymbolLevels() ) );

if ( dlg.exec() )
{
r->setUsingSymbolLevels( dlg.usingLevels() );

if ( r->type() == "RuleRenderer" )
{
if ( dlg.usingLevels() )
{
r->setUsingFirstRule( true );
emit forceChkUsingFirstRule();
}
else
{
emit forceUncheckSymbolLevels();
}
}
}

disconnect( this, SIGNAL( forceChkUsingFirstRule() ), mActiveWidget, SLOT( forceUsingFirstRule() ) );
disconnect( this, SIGNAL( forceUncheckSymbolLevels() ), mActiveWidget, SLOT( forceNoSymbolLevels() ) );
}


@@ -34,8 +34,6 @@ class GUI_EXPORT QgsRendererV2PropertiesDialog : public QDialog, private Ui::Qgs

signals:
void useNewSymbology( bool );
void forceChkUsingFirstRule();
void forceUncheckSymbolLevels();

protected:

@@ -84,15 +84,6 @@ QgsRuleBasedRendererV2Widget::QgsRuleBasedRendererV2Widget( QgsVectorLayer* laye
connect( radGroupFilter, SIGNAL( clicked() ), this, SLOT( setGrouping() ) );
connect( radGroupScale, SIGNAL( clicked() ), this, SLOT( setGrouping() ) );

// Make sure buttons are always in the correct state
chkUsingFirstRule->setChecked( mRenderer->usingFirstRule() );
chkEnableSymbolLevels->setChecked( mRenderer->usingSymbolLevels() );
// If symbol levels are used, forcefully check and gray-out the chkUsingFirstRule checkbox
if ( mRenderer->usingSymbolLevels() ) { forceUsingFirstRule(); }
connect( chkUsingFirstRule, SIGNAL( clicked() ), this, SLOT( usingFirstRuleChanged() ) );
connect( chkEnableSymbolLevels, SIGNAL( clicked() ), this, SLOT( symbolLevelsEnabledChanged() ) );
connect( this, SIGNAL( forceChkUsingFirstRule() ), this, SLOT( forceUsingFirstRule() ) );

treeRules->populateRules();
}

@@ -234,52 +225,6 @@ void QgsRuleBasedRendererV2Widget::decreasePriority()
}


void QgsRuleBasedRendererV2Widget::usingFirstRuleChanged()
{
if ( chkUsingFirstRule->checkState() == Qt::Checked )
{
mRenderer->setUsingFirstRule( true );
}
else
{
mRenderer->setUsingFirstRule( false );
}

}


void QgsRuleBasedRendererV2Widget::forceUsingFirstRule()
{
chkEnableSymbolLevels->setChecked( true );
chkUsingFirstRule->setChecked( true );
chkUsingFirstRule->setEnabled( false );
mRenderer->setUsingFirstRule( true );
}


void QgsRuleBasedRendererV2Widget::forceNoSymbolLevels()
{
chkEnableSymbolLevels->setChecked( false );
chkUsingFirstRule->setEnabled( true );
mRenderer->setUsingSymbolLevels( false );
}


void QgsRuleBasedRendererV2Widget::symbolLevelsEnabledChanged()
{
if ( chkEnableSymbolLevels->checkState() == Qt::Checked )
{
mRenderer->setUsingSymbolLevels( true );
emit forceChkUsingFirstRule();
}
else
{
mRenderer->setUsingSymbolLevels( false );
chkUsingFirstRule->setEnabled( true );
}
}




#include "qgscategorizedsymbolrendererv2.h"
@@ -87,15 +87,6 @@ class GUI_EXPORT QgsRuleBasedRendererV2Widget : public QgsRendererV2Widget, priv
void refineRuleCategories();
void refineRuleRanges();

void usingFirstRuleChanged( );
void symbolLevelsEnabledChanged();
void forceNoSymbolLevels();
void forceUsingFirstRule();

signals:

void forceChkUsingFirstRule();

protected:

void refineRule( int type );
@@ -119,64 +119,6 @@
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>35</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string/>
</property>
<widget class="QCheckBox" name="chkEnableSymbolLevels">
<property name="geometry">
<rect>
<x>113</x>
<y>10</y>
<width>231</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>Enable symbol levels</string>
</property>
</widget>
<widget class="QCheckBox" name="chkUsingFirstRule">
<property name="geometry">
<rect>
<x>360</x>
<y>10</y>
<width>271</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>Use only first matched rule</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>84</width>
<height>24</height>
</rect>
</property>
<property name="text">
<string>Behavior</string>
</property>
</widget>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">

0 comments on commit 81ec790

Please sign in to comment.