本文整理汇总了C++中QgsStringMap类的典型用法代码示例。如果您正苦于以下问题:C++ QgsStringMap类的具体用法?C++ QgsStringMap怎么用?C++ QgsStringMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QgsStringMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fromProperties
QgsStringReplacement QgsStringReplacement::fromProperties( const QgsStringMap& properties )
{
return QgsStringReplacement( properties.value( QStringLiteral( "match" ) ),
properties.value( QStringLiteral( "replace" ) ),
properties.value( QStringLiteral( "caseSensitive" ), QStringLiteral( "0" ) ) == QLatin1String( "1" ),
properties.value( QStringLiteral( "wholeWord" ), QStringLiteral( "0" ) ) == QLatin1String( "1" ) );
}
示例2: horizontalViewScaleFactor
void QgsComposerNodesItem::drawNodes( QPainter *painter ) const
{
double rectSize = 3.0 / horizontalViewScaleFactor();
QgsStringMap properties;
properties.insert( QStringLiteral( "name" ), QStringLiteral( "cross" ) );
properties.insert( QStringLiteral( "color_border" ), QStringLiteral( "red" ) );
QScopedPointer<QgsMarkerSymbol> symbol;
symbol.reset( QgsMarkerSymbol::createSimple( properties ) );
symbol.data()->setSize( rectSize );
symbol.data()->setAngle( 45 );
QgsRenderContext context = QgsComposerUtils::createRenderContext( mComposition, painter );
context.setForceVectorOutput( true );
QgsExpressionContext expressionContext = createExpressionContext();
context.setExpressionContext( expressionContext );
symbol.data()->startRender( context );
Q_FOREACH ( QPointF pt, mPolygon )
symbol.data()->renderPoint( pt, nullptr, context );
symbol.data()->stopRender( context );
if ( mSelectedNode >= 0 && mSelectedNode < mPolygon.size() )
drawSelectedNode( painter );
}
示例3: QgsExpressionContextScope
QgsExpressionContextScope* QgsExpressionContextUtils::projectScope()
{
QgsProject* project = QgsProject::instance();
QgsExpressionContextScope* scope = new QgsExpressionContextScope( QObject::tr( "Project" ) );
const QgsStringMap vars = QgsProject::instance()->variables();
QgsStringMap::const_iterator it = vars.constBegin();
for ( ; it != vars.constEnd(); ++it )
{
scope->setVariable( it.key(), it.value() );
}
//add other known project variables
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "project_title" ), project->title(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "project_path" ), project->fileInfo().filePath(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "project_folder" ), project->fileInfo().dir().path(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "project_filename" ), project->fileInfo().fileName(), true ) );
QgsCoordinateReferenceSystem projectCrs = project->crs();
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "project_crs" ), projectCrs.authid(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "project_crs_definition" ), projectCrs.toProj4(), true ) );
scope->addFunction( QStringLiteral( "project_color" ), new GetNamedProjectColor() );
return scope;
}
示例4:
void QgsSimpleLineSymbolLayerV2::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
{
if ( mPenStyle == Qt::NoPen )
return;
QDomElement symbolizerElem = doc.createElement( "se:LineSymbolizer" );
if ( !props.value( "uom", "" ).isEmpty() )
symbolizerElem.setAttribute( "uom", props.value( "uom", "" ) );
element.appendChild( symbolizerElem );
// <Geometry>
QgsSymbolLayerV2Utils::createGeometryElement( doc, symbolizerElem, props.value( "geom", "" ) );
// <Stroke>
QDomElement strokeElem = doc.createElement( "se:Stroke" );
symbolizerElem.appendChild( strokeElem );
Qt::PenStyle penStyle = mUseCustomDashPattern ? Qt::CustomDashLine : mPenStyle;
QgsSymbolLayerV2Utils::lineToSld( doc, strokeElem, penStyle, mColor, mWidth,
&mPenJoinStyle, &mPenCapStyle, &mCustomDashVector );
// <se:PerpendicularOffset>
if ( mOffset != 0 )
{
QDomElement perpOffsetElem = doc.createElement( "se:PerpendicularOffset" );
perpOffsetElem.appendChild( doc.createTextNode( QString::number( mOffset ) ) );
symbolizerElem.appendChild( perpOffsetElem );
}
}
示例5: if
void QgsFontMarkerSymbolLayerV2::writeSldMarker( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
{
// <Graphic>
QDomElement graphicElem = doc.createElement( "se:Graphic" );
element.appendChild( graphicElem );
QString fontPath = QString( "ttf://%1" ).arg( mFontFamily );
int markIndex = mChr.unicode();
QgsSymbolLayerV2Utils::externalMarkerToSld( doc, graphicElem, fontPath, "ttf", &markIndex, mColor, mSize );
// <Rotation>
QString angleFunc;
bool ok;
double angle = props.value( "angle", "0" ).toDouble( &ok );
if ( !ok )
{
angleFunc = QString( "%1 + %2" ).arg( props.value( "angle", "0" ) ).arg( mAngle );
}
else if ( angle + mAngle != 0 )
{
angleFunc = QString::number( angle + mAngle );
}
QgsSymbolLayerV2Utils::createRotationElement( doc, graphicElem, angleFunc );
// <Displacement>
QgsSymbolLayerV2Utils::createDisplacementElement( doc, graphicElem, mOffset );
}
示例6: restoreDataDefinedProperties
void QgsSymbolLayer::restoreDataDefinedProperties( const QgsStringMap &stringMap )
{
QgsStringMap::const_iterator propIt = stringMap.constBegin();
for ( ; propIt != stringMap.constEnd(); ++propIt )
{
if ( propIt.key().endsWith( QLatin1String( "_dd_expression" ) ) )
{
//found a data defined property
//get data defined property name by stripping "_dd_expression" from property key
QString propertyName = propIt.key().left( propIt.key().length() - 14 );
QgsDataDefined* dd = QgsDataDefined::fromMap( stringMap, propertyName );
if ( dd )
setDataDefinedProperty( propertyName, dd );
}
else if ( propIt.key().endsWith( QLatin1String( "_expression" ) ) )
{
//old style data defined property, upgrade
//get data defined property name by stripping "_expression" from property key
QString propertyName = propIt.key().left( propIt.key().length() - 11 );
setDataDefinedProperty( propertyName, new QgsDataDefined( propIt.value() ) );
}
}
}
示例7: loadAvailableConfigs
void QgsAuthConfigSelect::populateConfigSelector()
{
loadAvailableConfigs();
validateConfig();
cmbConfigSelect->blockSignals( true );
cmbConfigSelect->clear();
cmbConfigSelect->addItem( tr( "No authentication" ), "0" );
QgsStringMap sortmap;
QgsAuthMethodConfigsMap::const_iterator cit = mConfigs.constBegin();
for ( cit = mConfigs.constBegin(); cit != mConfigs.constEnd(); ++cit )
{
QgsAuthMethodConfig config = cit.value();
sortmap.insert( QStringLiteral( "%1 (%2)" ).arg( config.name(), config.method() ), cit.key() );
}
QgsStringMap::const_iterator sm = sortmap.constBegin();
for ( sm = sortmap.constBegin(); sm != sortmap.constEnd(); ++sm )
{
cmbConfigSelect->addItem( sm.key(), sm.value() );
}
cmbConfigSelect->blockSignals( false );
int indx = 0;
if ( !mAuthCfg.isEmpty() )
{
indx = cmbConfigSelect->findData( mAuthCfg );
}
cmbConfigSelect->setCurrentIndex( indx > 0 ? indx : 0 );
}
示例8:
QgsStringMap QgsAuthPkcs12Edit::configMap() const
{
QgsStringMap config;
config.insert( "bundlepath", lePkcs12Bundle->text() );
config.insert( "bundlepass", lePkcs12KeyPass->text() );
return config;
}
示例9: properties
QgsStringMap QgsDrawSourceEffect::properties() const
{
QgsStringMap props;
props.insert( QStringLiteral( "enabled" ), mEnabled ? "1" : "0" );
props.insert( QStringLiteral( "draw_mode" ), QString::number( int( mDrawMode ) ) );
props.insert( QStringLiteral( "blend_mode" ), QString::number( int( mBlendMode ) ) );
props.insert( QStringLiteral( "transparency" ), QString::number( mTransparency ) );
return props;
}
示例10: createDefaultLineSymbol
void QgsComposerArrow::createDefaultLineSymbol()
{
delete mLineSymbol;
QgsStringMap properties;
properties.insert( "color", "0,0,0,255" );
properties.insert( "width", "1" );
properties.insert( "capstyle", "square" );
mLineSymbol = QgsLineSymbolV2::createSimple( properties );
}
示例11: properties
QgsStringMap QgsStringReplacement::properties() const
{
QgsStringMap map;
map.insert( QStringLiteral( "match" ), mMatch );
map.insert( QStringLiteral( "replace" ), mReplacement );
map.insert( QStringLiteral( "caseSensitive" ), mCaseSensitive ? "1" : "0" );
map.insert( QStringLiteral( "wholeWord" ), mWholeWordOnly ? "1" : "0" );
return map;
}
示例12: configMap
QgsStringMap QgsAuthPkiPathsEdit::configMap() const
{
QgsStringMap config;
config.insert( "certpath", lePkiPathsCert->text() );
config.insert( "keypath", lePkiPathsKey->text() );
config.insert( "keypass", lePkiPathsKeyPass->text() );
return config;
}
示例13: toSld
void QgsSVGFillSymbolLayer::toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const
{
QDomElement symbolizerElem = doc.createElement( "se:PolygonSymbolizer" );
if ( !props.value( "uom", "" ).isEmpty() )
symbolizerElem.setAttribute( "uom", props.value( "uom", "" ) );
element.appendChild( symbolizerElem );
QgsSymbolLayerV2Utils::createGeometryElement( doc, symbolizerElem, props.value( "geom", "" ) );
QDomElement fillElem = doc.createElement( "se:Fill" );
symbolizerElem.appendChild( fillElem );
QDomElement graphicFillElem = doc.createElement( "se:GraphicFill" );
fillElem.appendChild( graphicFillElem );
QDomElement graphicElem = doc.createElement( "se:Graphic" );
graphicFillElem.appendChild( graphicElem );
if ( !mSvgFilePath.isEmpty() )
{
QgsSymbolLayerV2Utils::externalGraphicToSld( doc, graphicElem, mSvgFilePath, "image/svg+xml", mSvgFillColor, mPatternWidth );
}
else
{
// TODO: create svg from data
// <se:InlineContent>
symbolizerElem.appendChild( doc.createComment( "SVG from data not implemented yet" ) );
}
if ( mSvgOutlineColor.isValid() || mSvgOutlineWidth >= 0 )
{
QgsSymbolLayerV2Utils::lineToSld( doc, graphicElem, Qt::SolidLine, mSvgOutlineColor, mSvgOutlineWidth );
}
// <Rotation>
QString angleFunc;
bool ok;
double angle = props.value( "angle", "0" ).toDouble( &ok );
if ( !ok )
{
angleFunc = QString( "%1 + %2" ).arg( props.value( "angle", "0" ) ).arg( mAngle );
}
else if ( angle + mAngle != 0 )
{
angleFunc = QString::number( angle + mAngle );
}
QgsSymbolLayerV2Utils::createRotationElement( doc, graphicElem, angleFunc );
if ( mOutline )
{
// the outline sub symbol should be stored within the Stroke element,
// but it will be stored in a separated LineSymbolizer because it could
// have more than one layer
mOutline->toSld( doc, element, props );
}
}
示例14: createDefaultPolylineStyleSymbol
void QgsLayoutItemPolyline::createDefaultPolylineStyleSymbol()
{
QgsStringMap properties;
properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
properties.insert( QStringLiteral( "width" ), QStringLiteral( "0.3" ) );
properties.insert( QStringLiteral( "capstyle" ), QStringLiteral( "square" ) );
mPolylineStyleSymbol.reset( QgsLineSymbol::createSimple( properties ) );
refreshSymbol();
}
示例15: setProjectVariable
void QgsExpressionContextUtils::setProjectVariable( const QString& name, const QVariant& value )
{
QgsProject* project = QgsProject::instance();
QgsStringMap vars = project->variables();
vars.insert( name, value.toString() );
project->setVariables( vars );
}