Skip to content
Permalink
Browse files

Improve docs for QgsLegendSymbolItemV2

  • Loading branch information
wonder-sk committed Sep 1, 2014
1 parent 872fe7a commit 514c49d176d2ddee6f1e196a75aa91bacb9213d7
Showing with 14 additions and 20 deletions.
  1. +0 −16 src/core/composer/qgscomposerlegenditem.cpp
  2. +14 −4 src/core/symbology-ng/qgslegendsymbolitemv2.h
@@ -171,24 +171,8 @@ void QgsComposerSymbolV2Item::readXML( const QDomElement& itemElem, bool xServer
return;
}

mItem.setLabel( itemElem.attribute( "text", "" ) );
setUserText( itemElem.attribute( "userText", "" ) );
QDomElement symbolsElem = itemElem.firstChildElement( "symbols" );
if ( !symbolsElem.isNull() )
{
QgsSymbolV2Map loadSymbolMap = QgsSymbolLayerV2Utils::loadSymbols( symbolsElem );
//we assume there is only one symbol in the map...
QgsSymbolV2Map::iterator mapIt = loadSymbolMap.begin();
if ( mapIt != loadSymbolMap.end() )
{
QgsSymbolV2* symbolNg = mapIt.value();
if ( symbolNg )
{
mItem.setSymbol( symbolNg );
}
}
qDeleteAll( loadSymbolMap );
}
}

void QgsComposerSymbolV2Item::setSymbolV2( QgsSymbolV2* s )
@@ -9,33 +9,43 @@ class QgsSymbolV2;
* The class stores information about one class/rule of a vector layer renderer in a unified way
* that can be used by legend model for rendering of legend.
*
* @see QgsSymbolV2LegendNode
* @note added in 2.6
*/
class CORE_EXPORT QgsLegendSymbolItemV2
{
public:
QgsLegendSymbolItemV2();
//! construct item, does not take ownership of symbol (makes internal clone)
//! Construct item. Does not take ownership of symbol (makes internal clone)
QgsLegendSymbolItemV2( QgsSymbolV2* symbol, const QString& label, const QString& ruleKey, bool checkable = false, int scaleMinDenom = -1, int scaleMaxDenom = -1 );
~QgsLegendSymbolItemV2();
QgsLegendSymbolItemV2( const QgsLegendSymbolItemV2& other );
QgsLegendSymbolItemV2& operator=( const QgsLegendSymbolItemV2& other );

//! Return associated symbol. May be null.
QgsSymbolV2* symbol() const { return mSymbol; }
//! Return text label
QString label() const { return mLabel; }
//! Return unique identifier of the rule for identification of the item within renderer
QString ruleKey() const { return mKey; }
//! Return whether the item is user-checkable - whether renderer supports enabling/disabling it
bool isCheckable() const { return mCheckable; }

//! used for older code that identifies legend entries from symbol pointer within renderer
//! Used for older code that identifies legend entries from symbol pointer within renderer
QgsSymbolV2* legacyRuleKey() const { return mOriginalSymbolPointer; }

//! Determine whether given scale is within the scale range. Returns true if scale or scale range is invalid (value <= 0)
bool isScaleOK( double scale ) const;
//! Min scale denominator of the scale range. For range 1:1000 to 1:2000 this will return 1000.
//! Value <= 0 means the range is unbounded on this side
int scaleMinDenom() const { return mScaleMinDenom; }
//! Max scale denominator of the scale range. For range 1:1000 to 1:2000 this will return 2000.
//! Value <= 0 means the range is unbounded on this side
int scaleMaxDenom() const { return mScaleMaxDenom; }

//! takes ownership of symbol
protected:
//! Set symbol of the item. Takes ownership of symbol.
void setSymbol( QgsSymbolV2* s );
void setLabel( const QString& label ) { mLabel = label; }

private:
//! symbol. owned by the struct. can be null.

0 comments on commit 514c49d

Please sign in to comment.
You can’t perform that action at this time.