本文整理汇总了C++中QgsSymbolV2Map::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ QgsSymbolV2Map::insert方法的具体用法?C++ QgsSymbolV2Map::insert怎么用?C++ QgsSymbolV2Map::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QgsSymbolV2Map
的用法示例。
在下文中一共展示了QgsSymbolV2Map::insert方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
QDomElement QgsCategorizedSymbolRendererV2::save( QDomDocument& doc )
{
QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
rendererElem.setAttribute( "type", "categorizedSymbol" );
rendererElem.setAttribute( "symbollevels", ( mUsingSymbolLevels ? "1" : "0" ) );
rendererElem.setAttribute( "attr", mAttrName );
// categories
int i = 0;
QgsSymbolV2Map symbols;
QDomElement catsElem = doc.createElement( "categories" );
QgsCategoryList::const_iterator it = mCategories.constBegin();
for ( ; it != mCategories.end(); it++ )
{
const QgsRendererCategoryV2& cat = *it;
QString symbolName = QString::number( i );
symbols.insert( symbolName, cat.symbol() );
QDomElement catElem = doc.createElement( "category" );
catElem.setAttribute( "value", cat.value().toString() );
catElem.setAttribute( "symbol", symbolName );
catElem.setAttribute( "label", cat.label() );
catsElem.appendChild( catElem );
i++;
}
rendererElem.appendChild( catsElem );
// save symbols
QDomElement symbolsElem = QgsSymbolLayerV2Utils::saveSymbols( symbols, "symbols", doc );
rendererElem.appendChild( symbolsElem );
// save source symbol
if ( mSourceSymbol )
{
QgsSymbolV2Map sourceSymbols;
sourceSymbols.insert( "0", mSourceSymbol );
QDomElement sourceSymbolElem = QgsSymbolLayerV2Utils::saveSymbols( sourceSymbols, "source-symbol", doc );
rendererElem.appendChild( sourceSymbolElem );
}
// save source color ramp
if ( mSourceColorRamp )
{
QDomElement colorRampElem = QgsSymbolLayerV2Utils::saveColorRamp( "[source]", mSourceColorRamp, doc );
rendererElem.appendChild( colorRampElem );
}
QDomElement rotationElem = doc.createElement( "rotation" );
rotationElem.setAttribute( "field", mRotationField );
rendererElem.appendChild( rotationElem );
QDomElement sizeScaleElem = doc.createElement( "sizescale" );
sizeScaleElem.setAttribute( "field", mSizeScaleField );
sizeScaleElem.setAttribute( "scalemethod", QgsSymbolLayerV2Utils::encodeScaleMethod( mScaleMethod ) );
rendererElem.appendChild( sizeScaleElem );
return rendererElem;
}
示例2: text
void QgsComposerSymbolV2Item::writeXML( QDomElement& elem, QDomDocument& doc ) const
{
QDomElement vectorClassElem = doc.createElement( "VectorClassificationItemNg" );
if ( mSymbolV2 )
{
QgsSymbolV2Map saveSymbolMap;
saveSymbolMap.insert( "classificationSymbol", mSymbolV2 );
QDomElement symbolsElem = QgsSymbolLayerV2Utils::saveSymbols( saveSymbolMap, "symbols", doc );
vectorClassElem.appendChild( symbolsElem );
}
vectorClassElem.setAttribute( "text", text() );
elem.appendChild( vectorClassElem );
}
示例3: if
QDomElement QgsGraduatedSymbolRendererV2::save( QDomDocument& doc )
{
QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
rendererElem.setAttribute( "type", "graduatedSymbol" );
rendererElem.setAttribute( "symbollevels", ( mUsingSymbolLevels ? "1" : "0" ) );
rendererElem.setAttribute( "attr", mAttrName );
// ranges
int i = 0;
QgsSymbolV2Map symbols;
QDomElement rangesElem = doc.createElement( "ranges" );
QgsRangeList::const_iterator it = mRanges.constBegin();
for ( ; it != mRanges.constEnd(); ++it )
{
const QgsRendererRangeV2& range = *it;
QString symbolName = QString::number( i );
symbols.insert( symbolName, range.symbol() );
QDomElement rangeElem = doc.createElement( "range" );
rangeElem.setAttribute( "lower", QString::number( range.lowerValue(), 'f' ) );
rangeElem.setAttribute( "upper", QString::number( range.upperValue(), 'f' ) );
rangeElem.setAttribute( "symbol", symbolName );
rangeElem.setAttribute( "label", range.label() );
rangesElem.appendChild( rangeElem );
i++;
}
rendererElem.appendChild( rangesElem );
// save symbols
QDomElement symbolsElem = QgsSymbolLayerV2Utils::saveSymbols( symbols, "symbols", doc );
rendererElem.appendChild( symbolsElem );
// save source symbol
if ( mSourceSymbol.data() )
{
QgsSymbolV2Map sourceSymbols;
sourceSymbols.insert( "0", mSourceSymbol.data() );
QDomElement sourceSymbolElem = QgsSymbolLayerV2Utils::saveSymbols( sourceSymbols, "source-symbol", doc );
rendererElem.appendChild( sourceSymbolElem );
}
// save source color ramp
if ( mSourceColorRamp.data() )
{
QDomElement colorRampElem = QgsSymbolLayerV2Utils::saveColorRamp( "[source]", mSourceColorRamp.data(), doc );
rendererElem.appendChild( colorRampElem );
QDomElement invertedElem = doc.createElement( "invertedcolorramp" );
invertedElem.setAttribute( "value", mInvertedColorRamp );
rendererElem.appendChild( invertedElem );
}
// save mode
QString modeString;
if ( mMode == EqualInterval )
modeString = "equal";
else if ( mMode == Quantile )
modeString = "quantile";
else if ( mMode == Jenks )
modeString = "jenks";
else if ( mMode == StdDev )
modeString = "stddev";
else if ( mMode == Pretty )
modeString = "pretty";
if ( !modeString.isEmpty() )
{
QDomElement modeElem = doc.createElement( "mode" );
modeElem.setAttribute( "name", modeString );
rendererElem.appendChild( modeElem );
}
QDomElement rotationElem = doc.createElement( "rotation" );
if ( mRotation.data() )
rotationElem.setAttribute( "field", QgsSymbolLayerV2Utils::fieldOrExpressionFromExpression( mRotation.data() ) );
rendererElem.appendChild( rotationElem );
QDomElement sizeScaleElem = doc.createElement( "sizescale" );
if ( mSizeScale.data() )
sizeScaleElem.setAttribute( "field", QgsSymbolLayerV2Utils::fieldOrExpressionFromExpression( mSizeScale.data() ) );
sizeScaleElem.setAttribute( "scalemethod", QgsSymbolLayerV2Utils::encodeScaleMethod( mScaleMethod ) );
rendererElem.appendChild( sizeScaleElem );
return rendererElem;
}
示例4:
QDomElement QgsCategorizedSymbolRendererV2::save( QDomDocument& doc )
{
QDomElement rendererElem = doc.createElement( RENDERER_TAG_NAME );
rendererElem.setAttribute( "type", "categorizedSymbol" );
rendererElem.setAttribute( "symbollevels", ( mUsingSymbolLevels ? "1" : "0" ) );
rendererElem.setAttribute( "attr", mAttrName );
// categories
int i = 0;
QgsSymbolV2Map symbols;
QDomElement catsElem = doc.createElement( "categories" );
QgsCategoryList::const_iterator it = mCategories.constBegin();
for ( ; it != mCategories.end(); ++it )
{
const QgsRendererCategoryV2& cat = *it;
QString symbolName = QString::number( i );
symbols.insert( symbolName, cat.symbol() );
QDomElement catElem = doc.createElement( "category" );
catElem.setAttribute( "value", cat.value().toString() );
catElem.setAttribute( "symbol", symbolName );
catElem.setAttribute( "label", cat.label() );
catElem.setAttribute( "render", cat.renderState() ? "true" : "false" );
catsElem.appendChild( catElem );
i++;
}
rendererElem.appendChild( catsElem );
// save symbols
QDomElement symbolsElem = QgsSymbolLayerV2Utils::saveSymbols( symbols, "symbols", doc );
rendererElem.appendChild( symbolsElem );
// save source symbol
if ( mSourceSymbol.data() )
{
QgsSymbolV2Map sourceSymbols;
sourceSymbols.insert( "0", mSourceSymbol.data() );
QDomElement sourceSymbolElem = QgsSymbolLayerV2Utils::saveSymbols( sourceSymbols, "source-symbol", doc );
rendererElem.appendChild( sourceSymbolElem );
}
// save source color ramp
if ( mSourceColorRamp.data() )
{
QDomElement colorRampElem = QgsSymbolLayerV2Utils::saveColorRamp( "[source]", mSourceColorRamp.data(), doc );
rendererElem.appendChild( colorRampElem );
QDomElement invertedElem = doc.createElement( "invertedcolorramp" );
invertedElem.setAttribute( "value", mInvertedColorRamp );
rendererElem.appendChild( invertedElem );
}
QDomElement rotationElem = doc.createElement( "rotation" );
if ( mRotation.data() )
rotationElem.setAttribute( "field", QgsSymbolLayerV2Utils::fieldOrExpressionFromExpression( mRotation.data() ) );
rendererElem.appendChild( rotationElem );
QDomElement sizeScaleElem = doc.createElement( "sizescale" );
if ( mSizeScale.data() )
sizeScaleElem.setAttribute( "field", QgsSymbolLayerV2Utils::fieldOrExpressionFromExpression( mSizeScale.data() ) );
sizeScaleElem.setAttribute( "scalemethod", QgsSymbolLayerV2Utils::encodeScaleMethod( mScaleMethod ) );
rendererElem.appendChild( sizeScaleElem );
if ( mPaintEffect )
mPaintEffect->saveProperties( doc, rendererElem );
return rendererElem;
}