本文整理汇总了C++中QgsSymbolV2::clone方法的典型用法代码示例。如果您正苦于以下问题:C++ QgsSymbolV2::clone方法的具体用法?C++ QgsSymbolV2::clone怎么用?C++ QgsSymbolV2::clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QgsSymbolV2
的用法示例。
在下文中一共展示了QgsSymbolV2::clone方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dlg
void QgsGraduatedSymbolRendererV2Widget::changeSelectedSymbols()
{
QItemSelectionModel* m = viewGraduated->selectionModel();
QModelIndexList selectedIndexes = m->selectedRows( 1 );
if ( m && !selectedIndexes.isEmpty() )
{
QgsSymbolV2* newSymbol = mGraduatedSymbol->clone();
QgsSymbolV2SelectorDialog dlg( newSymbol, mStyle, mLayer, this );
dlg.setMapCanvas( mMapCanvas );
if ( !dlg.exec() )
{
delete newSymbol;
return;
}
Q_FOREACH ( const QModelIndex& idx, selectedIndexes )
{
if ( idx.isValid() )
{
int rangeIdx = idx.row();
QgsSymbolV2* newRangeSymbol = newSymbol->clone();
newRangeSymbol->setColor( mRenderer->ranges()[rangeIdx].symbol()->color() );
mRenderer->updateRangeSymbol( rangeIdx, newRangeSymbol );
}
}
}
示例2: dlg
void QgsRuleBasedRendererV2Widget::editRule( const QModelIndex& index )
{
if ( !index.isValid() )
return;
QgsRuleBasedRendererV2::Rule* rule = mModel->ruleForIndex( index );
if ( index.column() == 7 )
{
QgsSymbolV2 *legendSymbol = rule->legendSymbol();
if ( legendSymbol )
{
legendSymbol = legendSymbol->clone();
}
else
{
legendSymbol = QgsSymbolV2::defaultSymbol( queryGeometryType() );
}
QgsSymbolV2SelectorDialog dlg( legendSymbol, mStyle, mLayer, this );
QPushButton* deleteButton = new QPushButton( QApplication::style()->standardIcon( QStyle::SP_TrashIcon ), tr( "Delete" ) );
connect( deleteButton, SIGNAL( clicked() ), &dlg, SLOT( reject() ) );
connect( deleteButton, SIGNAL( clicked() ), this, SLOT( removeLegendSymbol() ) );
dlg.addDialogBoxButton( deleteButton, QDialogButtonBox::DestructiveRole );
if ( dlg.exec() == QDialog::Accepted )
{
if ( legendSymbol )
{
rule->setLegendSymbol( legendSymbol );
}
mModel->updateRule( index.parent(), index.row() );
}
else
{
delete legendSymbol;
}
return;
}
QgsRendererRulePropsDialog dlg( rule, mLayer, mStyle, this );
if ( dlg.exec() )
{
// model should know about the change and emit dataChanged signal for the view
mModel->updateRule( index.parent(), index.row() );
mModel->clearFeatureCounts();
}
}
示例3: dlg
void QgsCategorizedSymbolRendererV2Widget::changeSelectedSymbols()
{
QList<int> selectedCats = selectedCategories();
if ( selectedCats.size() > 0 )
{
QgsSymbolV2* newSymbol = mCategorizedSymbol->clone();
QgsSymbolV2SelectorDialog dlg( newSymbol, mStyle, mLayer, this );
if ( !dlg.exec() )
{
delete newSymbol;
return;
}
foreach ( const int idx, selectedCats )
{
QgsRendererCategoryV2 category = mRenderer->categories().value( idx );
QgsSymbolV2* newCatSymbol = newSymbol->clone();
newCatSymbol->setColor( mRenderer->categories()[idx].symbol()->color() );
mRenderer->updateCategorySymbol( idx, newCatSymbol );
}
示例4: dlg
void QgsCategorizedSymbolRendererV2Widget::changeSelectedSymbols()
{
QList<int> selectedCats = selectedCategories();
if ( !selectedCats.isEmpty() )
{
QgsSymbolV2* newSymbol = mCategorizedSymbol->clone();
QgsSymbolV2SelectorDialog dlg( newSymbol, mStyle, mLayer, this );
dlg.setMapCanvas( mMapCanvas );
if ( !dlg.exec() )
{
delete newSymbol;
return;
}
Q_FOREACH ( int idx, selectedCats )
{
QgsRendererCategoryV2 category = mRenderer->categories().value( idx );
QgsSymbolV2* newCatSymbol = newSymbol->clone();
newCatSymbol->setColor( mRenderer->categories()[idx].symbol()->color() );
mRenderer->updateCategorySymbol( idx, newCatSymbol );
}