本文整理汇总了C++中QgsSymbolV2::appendSymbolLayer方法的典型用法代码示例。如果您正苦于以下问题:C++ QgsSymbolV2::appendSymbolLayer方法的具体用法?C++ QgsSymbolV2::appendSymbolLayer怎么用?C++ QgsSymbolV2::appendSymbolLayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QgsSymbolV2
的用法示例。
在下文中一共展示了QgsSymbolV2::appendSymbolLayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mLineRenderer
QgsGrassEditRenderer::QgsGrassEditRenderer()
: QgsFeatureRendererV2( "grassEdit" )
, mLineRenderer( 0 )
, mMarkerRenderer( 0 )
{
QHash<int, QColor> colors;
//colors.insert( QgsGrassVectorMap::TopoUndefined, QColor( 125, 125, 125 ) );
colors.insert( QgsGrassVectorMap::TopoLine, QColor( Qt::black ) );
colors.insert( QgsGrassVectorMap::TopoBoundaryError, QColor( Qt::red ) );
colors.insert( QgsGrassVectorMap::TopoBoundaryErrorLeft, QColor( 255, 125, 0 ) );
colors.insert( QgsGrassVectorMap::TopoBoundaryErrorRight, QColor( 255, 125, 0 ) );
colors.insert( QgsGrassVectorMap::TopoBoundaryOk, QColor( Qt::green ) );
QHash<int, QString> labels;
//labels.insert( QgsGrassVectorMap::TopoUndefined, "Unknown type" );
labels.insert( QgsGrassVectorMap::TopoLine, "Line" );
labels.insert( QgsGrassVectorMap::TopoBoundaryError, "Boundary (topological error on both sides)" );
labels.insert( QgsGrassVectorMap::TopoBoundaryErrorLeft, "Boundary (topological error on the left side)" );
labels.insert( QgsGrassVectorMap::TopoBoundaryErrorRight, "Boundary (topological error on the right side)" );
labels.insert( QgsGrassVectorMap::TopoBoundaryOk, "Boundary (correct)" );
QgsCategoryList categoryList;
// first/last vertex marker to distinguish vertices from nodes
QgsMarkerLineSymbolLayerV2 * firstVertexMarkerLine = new QgsMarkerLineSymbolLayerV2( false );
QgsSimpleMarkerSymbolLayerV2 *markerSymbolLayer = new QgsSimpleMarkerSymbolLayerV2( QgsSimpleMarkerSymbolLayerBase::Cross2, 2 );
markerSymbolLayer->setColor( QColor( 255, 0, 0 ) );
markerSymbolLayer->setBorderColor( QColor( 255, 0, 0 ) );
markerSymbolLayer->setOutlineWidth( 0.5 );
QgsSymbolLayerV2List markerLayers;
markerLayers << markerSymbolLayer;
QgsMarkerSymbolV2 * markerSymbol = new QgsMarkerSymbolV2( markerLayers );
firstVertexMarkerLine->setSubSymbol( markerSymbol );
firstVertexMarkerLine->setPlacement( QgsMarkerLineSymbolLayerV2::FirstVertex );
QgsMarkerLineSymbolLayerV2 * lastVertexMarkerLine = static_cast<QgsMarkerLineSymbolLayerV2 *>( firstVertexMarkerLine->clone() );
lastVertexMarkerLine->setPlacement( QgsMarkerLineSymbolLayerV2::LastVertex );
Q_FOREACH ( int value, colors.keys() )
{
QgsSymbolV2 * symbol = QgsSymbolV2::defaultSymbol( QGis::Line );
symbol->setColor( colors.value( value ) );
symbol->appendSymbolLayer( firstVertexMarkerLine->clone() );
symbol->appendSymbolLayer( lastVertexMarkerLine->clone() );
categoryList << QgsRendererCategoryV2( QVariant( value ), symbol, labels.value( value ) );
}
delete firstVertexMarkerLine;
delete lastVertexMarkerLine;
mLineRenderer = new QgsCategorizedSymbolRendererV2( "topo_symbol", categoryList );
colors.clear();
labels.clear();
colors.insert( QgsGrassVectorMap::TopoPoint, QColor( 0, 255, 255 ) );
colors.insert( QgsGrassVectorMap::TopoCentroidIn, QColor( 0, 255, 0 ) );
colors.insert( QgsGrassVectorMap::TopoCentroidOut, QColor( 255, 0, 0 ) );
colors.insert( QgsGrassVectorMap::TopoCentroidDupl, QColor( 255, 0, 255 ) );
labels.insert( QgsGrassVectorMap::TopoPoint, "Point" );
labels.insert( QgsGrassVectorMap::TopoCentroidIn, "Centroid in area" );
labels.insert( QgsGrassVectorMap::TopoCentroidOut, "Centroid outside area" );
labels.insert( QgsGrassVectorMap::TopoCentroidDupl, "Duplicate centroid" );
categoryList.clear();
Q_FOREACH ( int value, colors.keys() )
{
QgsSymbolV2 * symbol = QgsSymbolV2::defaultSymbol( QGis::Point );
symbol->setColor( colors.value( value ) );
categoryList << QgsRendererCategoryV2( QVariant( value ), symbol, labels.value( value ) );
}
mMarkerRenderer = new QgsCategorizedSymbolRendererV2( "topo_symbol", categoryList );
}