本文整理汇总了C++中QgsVectorDataProvider::maximumValue方法的典型用法代码示例。如果您正苦于以下问题:C++ QgsVectorDataProvider::maximumValue方法的具体用法?C++ QgsVectorDataProvider::maximumValue怎么用?C++ QgsVectorDataProvider::maximumValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QgsVectorDataProvider
的用法示例。
在下文中一共展示了QgsVectorDataProvider::maximumValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
void qgis_dev_layerPropDialog::apply()
{
QSettings().setValue( "/Windows/VectorLayerProperties/diagram/tab",
mDiagramPropertiesTabWidget->currentIndex() );
if ( !mDisplayDiagramsGroupBox->isChecked() ) {m_layer->setDiagramRenderer( 0 ); return;}
QgsDiagram* diagram = 0;
int index = diagramType_comboBox->currentIndex();
QString diagramType = diagramType_comboBox->itemData( index ).toString();
if ( 0 == mDiagramAttributesTreeWidget->topLevelItemCount() )
{
qgis_dev::instance()->messageBar()->pushMessage(
tr( "Diagrams: No attributes added." ),
tr( "You did not add any attributes to this diagram layer. Please specify the attributes to visualize on the diagrams or disable diagrams." ),
QgsMessageBar::WARNING );
}
bool scaleAttributeValueOk = false;
// Check if a (usable) scale attribute value is inserted
mValueLineEdit->text().toDouble( &scaleAttributeValueOk );
if ( !mFixedSizeCheckBox->isChecked() && !scaleAttributeValueOk )
{
double maxVal = DBL_MIN;
QgsVectorDataProvider* provider = m_layer->dataProvider();
if ( provider )
{
if ( diagramType == DIAGRAM_NAME_HISTOGRAM )
{
// Find maximum value
for ( int i = 0; i < mDiagramAttributesTreeWidget->topLevelItemCount(); ++i )
{
QString fldName = mDiagramAttributesTreeWidget->topLevelItem( i )->data( 0, Qt::UserRole ).toString();
if ( fldName.count() >= 2 && fldName.at( 0 ) == '"' && fldName.at( fldName.count() - 1 ) == '"' )
{
fldName = fldName.mid( 1, fldName.count() - 2 ); // remove enclosing double quotes
}
int fld = provider->fieldNameIndex( fldName );
if ( fld != -1 )
{
bool ok = false;
double val = provider->maximumValue( fld ).toDouble( &ok );
if ( ok )
{
maxVal = qMax( maxVal, val );
}
}
}
}
else
{
maxVal = provider->maximumValue( mSizeAttributeComboBox->itemData( mSizeAttributeComboBox->currentIndex() ).toInt() ).toDouble();
}
}
if ( maxVal != DBL_MIN )
{
qgis_dev::instance()->messageBar()->pushMessage(
tr( "Interpolation value" ),
tr( "You did not specify an interpolation value. A default value of %1 has been set." ).arg( QString::number( maxVal ) ),
QgsMessageBar::INFO,
5 );
mValueLineEdit->setText( QString::number( maxVal ) );
}
}
if ( diagramType == DIAGRAM_NAME_TEXT )
{
diagram = new QgsTextDiagram();
}
else if ( diagramType == DIAGRAM_NAME_PIE )
{
diagram = new QgsPieDiagram();
}
else // if ( diagramType == DIAGRAM_NAME_HISTOGRAM )
{
diagram = new QgsHistogramDiagram();
}
QgsDiagramSettings ds;
ds.font = font_comboBox->currentFont(); // 字体
ds.transparency = mTransparencySlider->value(); // 透明度
QList<QColor> categoryColors;
QList<QString> categoryAttributes;
for ( int i = 0; i < mDiagramAttributesTreeWidget->topLevelItemCount(); ++i )
{
QColor color = mDiagramAttributesTreeWidget->topLevelItem( i )->background( 1 ).color();
color.setAlpha( 255 - ds.transparency );
categoryColors.append( color );
categoryAttributes.append( mDiagramAttributesTreeWidget->topLevelItem( i )->data( 0, Qt::UserRole ).toString() );
}
ds.categoryColors = categoryColors;
ds.categoryAttributes = categoryAttributes;
//ds.size = QSizeF( mDiagramSizeSpinBox->value(), mDiagramSizeSpinBox->value() );
ds.size = QSizeF( 50, 50 );
//ds.sizeType = static_cast<QgsDiagramSettings::SizeType>( mDiagramUnitComboBox->itemData( mDiagramUnitComboBox->currentIndex() ).toInt() );
//.........这里部分代码省略.........