本文整理汇总了C++中QgsSymbolV2List::at方法的典型用法代码示例。如果您正苦于以下问题:C++ QgsSymbolV2List::at方法的具体用法?C++ QgsSymbolV2List::at怎么用?C++ QgsSymbolV2List::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QgsSymbolV2List
的用法示例。
在下文中一共展示了QgsSymbolV2List::at方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertFromRenderer
QgsSingleSymbolRendererV2* QgsSingleSymbolRendererV2::convertFromRenderer( const QgsFeatureRendererV2 *renderer )
{
if ( renderer->type() == "singleSymbol" )
{
return dynamic_cast<QgsSingleSymbolRendererV2*>( renderer->clone() );
}
if ( renderer->type() == "pointDisplacement" )
{
const QgsPointDisplacementRenderer* pointDisplacementRenderer = dynamic_cast<const QgsPointDisplacementRenderer*>( renderer );
if ( pointDisplacementRenderer )
return convertFromRenderer( pointDisplacementRenderer->embeddedRenderer() );
}
if ( renderer->type() == "invertedPolygonRenderer" )
{
const QgsInvertedPolygonRenderer* invertedPolygonRenderer = dynamic_cast<const QgsInvertedPolygonRenderer*>( renderer );
if ( invertedPolygonRenderer )
return convertFromRenderer( invertedPolygonRenderer->embeddedRenderer() );
}
QgsSymbolV2List symbols = const_cast<QgsFeatureRendererV2 *>( renderer )->symbols();
if ( symbols.size() > 0 )
{
return new QgsSingleSymbolRendererV2( symbols.at( 0 )->clone() );
}
return 0;
}
示例2: firstSymbolForFeature
QgsSymbolV2* QgsPointDisplacementRenderer::firstSymbolForFeature( QgsFeatureRendererV2* r, QgsFeature& f )
{
if ( !r )
{
return 0;
}
QgsSymbolV2List symbolList = r->symbolsForFeature( f );
if ( symbolList.size() < 1 )
{
return 0;
}
return symbolList.at( 0 );
}
示例3: item
void QgsVectorLayerRenderer::drawRendererV2Levels( QgsFeatureIterator& fit )
{
QHash< QgsSymbolV2*, QList<QgsFeature> > features; // key = symbol, value = array of features
QgsSingleSymbolRendererV2* selRenderer = nullptr;
if ( !mSelectedFeatureIds.isEmpty() )
{
selRenderer = new QgsSingleSymbolRendererV2( QgsSymbolV2::defaultSymbol( mGeometryType ) );
selRenderer->symbol()->setColor( mContext.selectionColor() );
selRenderer->setVertexMarkerAppearance( mVertexMarkerStyle, mVertexMarkerSize );
selRenderer->startRender( mContext, mFields );
}
QgsExpressionContextScope* symbolScope = QgsExpressionContextUtils::updateSymbolScope( nullptr );
mContext.expressionContext().appendScope( symbolScope );
// 1. fetch features
QgsFeature fet;
while ( fit.nextFeature( fet ) )
{
if ( !fet.constGeometry() )
continue; // skip features without geometry
if ( mContext.renderingStopped() )
{
qDebug( "rendering stop!" );
stopRendererV2( selRenderer );
mContext.expressionContext().popScope();
return;
}
mContext.expressionContext().setFeature( fet );
QgsSymbolV2* sym = mRendererV2->symbolForFeature( fet, mContext );
if ( !sym )
{
continue;
}
if ( !features.contains( sym ) )
{
features.insert( sym, QList<QgsFeature>() );
}
features[sym].append( fet );
if ( mCache )
{
// Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
mCache->cacheGeometry( fet.id(), *fet.constGeometry() );
}
if ( mContext.labelingEngine() )
{
mContext.expressionContext().setFeature( fet );
if ( mLabeling )
{
mContext.labelingEngine()->registerFeature( mLayerID, fet, mContext );
}
if ( mDiagrams )
{
mContext.labelingEngine()->registerDiagramFeature( mLayerID, fet, mContext );
}
}
// new labeling engine
if ( mContext.labelingEngineV2() )
{
QScopedPointer<QgsGeometry> obstacleGeometry;
QgsSymbolV2List symbols = mRendererV2->originalSymbolsForFeature( fet, mContext );
if ( !symbols.isEmpty() && fet.constGeometry()->type() == QGis::Point )
{
obstacleGeometry.reset( QgsVectorLayerLabelProvider::getPointObstacleGeometry( fet, mContext, symbols ) );
}
if ( !symbols.isEmpty() )
{
QgsExpressionContextUtils::updateSymbolScope( symbols.at( 0 ), symbolScope );
}
if ( mLabelProvider )
{
mLabelProvider->registerFeature( fet, mContext, obstacleGeometry.data() );
}
if ( mDiagramProvider )
{
mDiagramProvider->registerFeature( fet, mContext, obstacleGeometry.data() );
}
}
}
mContext.expressionContext().popScope();
// find out the order
QgsSymbolV2LevelOrder levels;
QgsSymbolV2List symbols = mRendererV2->symbols( mContext );
for ( int i = 0; i < symbols.count(); i++ )
{
QgsSymbolV2* sym = symbols[i];
for ( int j = 0; j < sym->symbolLayerCount(); j++ )
{
int level = sym->symbolLayer( j )->renderingPass();
//.........这里部分代码省略.........
示例4: while
void QgsVectorLayerRenderer::drawRendererV2( QgsFeatureIterator& fit )
{
QgsExpressionContextScope* symbolScope = QgsExpressionContextUtils::updateSymbolScope( nullptr );
mContext.expressionContext().appendScope( symbolScope );
QgsFeature fet;
while ( fit.nextFeature( fet ) )
{
try
{
if ( !fet.constGeometry() )
continue; // skip features without geometry
if ( mContext.renderingStopped() )
{
QgsDebugMsg( QString( "Drawing of vector layer %1 cancelled." ).arg( layerID() ) );
break;
}
mContext.expressionContext().setFeature( fet );
bool sel = mContext.showSelection() && mSelectedFeatureIds.contains( fet.id() );
bool drawMarker = ( mDrawVertexMarkers && mContext.drawEditingInformation() && ( !mVertexMarkerOnlyForSelection || sel ) );
if ( mCache )
{
// Cache this for the use of (e.g.) modifying the feature's uncommitted geometry.
mCache->cacheGeometry( fet.id(), *fet.constGeometry() );
}
// render feature
bool rendered = mRendererV2->renderFeature( fet, mContext, -1, sel, drawMarker );
// labeling - register feature
if ( rendered )
{
if ( mContext.labelingEngine() )
{
if ( mLabeling )
{
mContext.labelingEngine()->registerFeature( mLayerID, fet, mContext );
}
if ( mDiagrams )
{
mContext.labelingEngine()->registerDiagramFeature( mLayerID, fet, mContext );
}
}
// new labeling engine
if ( mContext.labelingEngineV2() )
{
QScopedPointer<QgsGeometry> obstacleGeometry;
QgsSymbolV2List symbols = mRendererV2->originalSymbolsForFeature( fet, mContext );
if ( !symbols.isEmpty() && fet.constGeometry()->type() == QGis::Point )
{
obstacleGeometry.reset( QgsVectorLayerLabelProvider::getPointObstacleGeometry( fet, mContext, symbols ) );
}
if ( !symbols.isEmpty() )
{
QgsExpressionContextUtils::updateSymbolScope( symbols.at( 0 ), symbolScope );
}
if ( mLabelProvider )
{
mLabelProvider->registerFeature( fet, mContext, obstacleGeometry.data() );
}
if ( mDiagramProvider )
{
mDiagramProvider->registerFeature( fet, mContext, obstacleGeometry.data() );
}
}
}
}
catch ( const QgsCsException &cse )
{
Q_UNUSED( cse );
QgsDebugMsg( QString( "Failed to transform a point while drawing a feature with ID '%1'. Ignoring this feature. %2" )
.arg( fet.id() ).arg( cse.what() ) );
}
}
mContext.expressionContext().popScope();
stopRendererV2( nullptr );
}