本文整理汇总了C++中qgsfieldmap::const_iterator类的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator类的具体用法?C++ const_iterator怎么用?C++ const_iterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了const_iterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadRows
void QgsVectorLayerProperties::loadRows()
{
const QgsFieldMap &fields = layer->pendingFields();
tblAttributes->clear();
tblAttributes->setColumnCount( 8 );
tblAttributes->setRowCount( fields.size() );
tblAttributes->setHorizontalHeaderItem( 0, new QTableWidgetItem( tr( "id" ) ) );
tblAttributes->setHorizontalHeaderItem( 1, new QTableWidgetItem( tr( "name" ) ) );
tblAttributes->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "type" ) ) );
tblAttributes->setHorizontalHeaderItem( 3, new QTableWidgetItem( tr( "length" ) ) );
tblAttributes->setHorizontalHeaderItem( 4, new QTableWidgetItem( tr( "precision" ) ) );
tblAttributes->setHorizontalHeaderItem( 5, new QTableWidgetItem( tr( "comment" ) ) );
tblAttributes->setHorizontalHeaderItem( 6, new QTableWidgetItem( tr( "edit widget" ) ) );
tblAttributes->setHorizontalHeaderItem( 7, new QTableWidgetItem( tr( "values" ) ) );
tblAttributes->setSelectionBehavior( QAbstractItemView::SelectRows );
tblAttributes->setSelectionMode( QAbstractItemView::MultiSelection );
int row = 0;
for ( QgsFieldMap::const_iterator it = fields.begin(); it != fields.end(); it++, row++ )
setRow( row, it.key(), it.value() );
tblAttributes->resizeColumnsToContents();
}
示例2: prefixIsValid
bool QgsZonalStatisticsDialog::prefixIsValid( const QString& prefix ) const
{
QgsVectorLayer* vl = polygonLayer();
if ( !vl )
{
return false;
}
QgsVectorDataProvider* dp = vl->dataProvider();
if ( !dp )
{
return false;
}
QgsFieldMap providerFieldMap = dp->fields();
QgsFieldMap::const_iterator it = providerFieldMap.constBegin();
QString currentFieldName;
for ( ; it != providerFieldMap.constEnd(); ++it )
{
currentFieldName = it.value().name();
if ( currentFieldName == ( prefix + "mean" ) || currentFieldName == ( prefix + "sum" ) || currentFieldName == ( prefix + "count" ) )
{
return false;
}
}
return true;
}
示例3: on_mcbLayers_selectItem
void RgLineVectorLayerSettingsWidget::on_mcbLayers_selectItem()
{
mcbDirection->clear();
mcbSpeed->clear();
mcbDirection->insertItem( 0, tr( "Always use default" ) );
mcbSpeed->insertItem( 0, tr( "Always use default" ) );
QgsVectorLayer* vl = selectedLayer();
if ( !vl )
return;
QgsVectorDataProvider* provider = vl->dataProvider();
if ( !provider )
return;
const QgsFieldMap& fields = provider->fields();
QgsFieldMap::const_iterator it;
for ( it = fields.constBegin(); it != fields.constEnd(); ++it )
{
QgsField currentField = it.value();
QVariant currentType = currentField.type();
if ( currentType == QVariant::Int || currentType == QVariant::String )
{
mcbDirection->insertItem( 1, currentField.name() );
}
if ( currentType == QVariant::Int || currentType == QVariant::Double )
{
mcbSpeed->insertItem( 1, currentField.name() );
}
}
} // RgDSettingsDlg::on_mcbLayers_selectItem()
示例4: populateFieldNames
void QgsLabelingGui::populateFieldNames()
{
const QgsFieldMap& fields = mLayer->pendingFields();
QgsFieldMap::const_iterator it = fields.constBegin();
for ( ; it != fields.constEnd(); it++ )
{
cboFieldName->addItem( it->name() );
}
}
示例5: fieldIndexFromName
int QgsLabelDialog::fieldIndexFromName( QString name )
{
const QgsFieldMap& fields = mLabel->fields();
for ( QgsFieldMap::const_iterator it = fields.begin(); it != fields.end(); ++it )
{
if ( it->name() == name )
return it.key();
}
return -1;
}
示例6: populateDataDefinedCombos
void QgsLabelingGui::populateDataDefinedCombos( QgsPalLayerSettings& s )
{
QList<QComboBox*> comboList;
comboList << mSizeAttributeComboBox;
comboList << mColorAttributeComboBox;
comboList << mBoldAttributeComboBox;
comboList << mItalicAttributeComboBox;
comboList << mUnderlineAttributeComboBox;
comboList << mStrikeoutAttributeComboBox;
comboList << mFontFamilyAttributeComboBox;
comboList << mBufferSizeAttributeComboBox;
comboList << mBufferColorAttributeComboBox;
comboList << mXCoordinateComboBox;
comboList << mYCoordinateComboBox;
comboList << mHorizontalAlignmentComboBox;
comboList << mVerticalAlignmentComboBox;
comboList << mLabelDistanceComboBox;
comboList << mRotationComboBox;
QList<QComboBox*>::iterator comboIt = comboList.begin();
for ( ; comboIt != comboList.end(); ++comboIt )
{
( *comboIt )->addItem( "", QVariant() );
}
const QgsFieldMap& fields = mLayer->dataProvider()->fields();
for ( QgsFieldMap::const_iterator it = fields.constBegin(); it != fields.constEnd(); it++ )
{
for ( comboIt = comboList.begin(); comboIt != comboList.end(); ++comboIt )
{
( *comboIt )->addItem( it.value().name(), it.key() );
}
}
//set current combo boxes to already existing indices
setCurrentComboValue( mSizeAttributeComboBox, s, QgsPalLayerSettings::Size );
setCurrentComboValue( mColorAttributeComboBox, s, QgsPalLayerSettings::Color );
setCurrentComboValue( mBoldAttributeComboBox, s, QgsPalLayerSettings::Bold );
setCurrentComboValue( mItalicAttributeComboBox, s, QgsPalLayerSettings::Italic );
setCurrentComboValue( mUnderlineAttributeComboBox, s, QgsPalLayerSettings::Underline );
setCurrentComboValue( mStrikeoutAttributeComboBox, s, QgsPalLayerSettings::Strikeout );
setCurrentComboValue( mFontFamilyAttributeComboBox, s, QgsPalLayerSettings::Family );
setCurrentComboValue( mBufferSizeAttributeComboBox, s , QgsPalLayerSettings::BufferSize );
setCurrentComboValue( mBufferColorAttributeComboBox, s, QgsPalLayerSettings::BufferColor );
setCurrentComboValue( mXCoordinateComboBox, s, QgsPalLayerSettings::PositionX );
setCurrentComboValue( mYCoordinateComboBox, s, QgsPalLayerSettings::PositionY );
setCurrentComboValue( mHorizontalAlignmentComboBox, s, QgsPalLayerSettings::Hali );
setCurrentComboValue( mVerticalAlignmentComboBox, s, QgsPalLayerSettings::Vali );
setCurrentComboValue( mLabelDistanceComboBox, s, QgsPalLayerSettings::LabelDistance );
setCurrentComboValue( mRotationComboBox, s, QgsPalLayerSettings::Rotation );
}
示例7: loadAttributes
void QgsAttributeTableModel::loadAttributes()
{
if ( !mLayer )
{
return;
}
bool ins = false, rm = false;
QgsAttributeList attributes;
for ( QgsFieldMap::const_iterator it = mLayer->pendingFields().constBegin(); it != mLayer->pendingFields().end(); it++ )
{
switch ( mLayer->editType( it.key() ) )
{
case QgsVectorLayer::Hidden:
continue;
case QgsVectorLayer::ValueMap:
mValueMaps.insert( it.key(), &mLayer->valueMap( it.key() ) );
break;
default:
break;
}
attributes << it.key();
}
if ( mFieldCount < attributes.size() )
{
ins = true;
beginInsertColumns( QModelIndex(), mFieldCount, attributes.size() - 1 );
}
else if ( attributes.size() < mFieldCount )
{
rm = true;
beginRemoveColumns( QModelIndex(), attributes.size(), mFieldCount - 1 );
}
mFieldCount = attributes.size();
mAttributes = attributes;
mValueMaps.clear();
if ( ins )
{
endInsertColumns();
}
else if ( rm )
{
endRemoveColumns();
}
}
示例8: populateFields
void SaQueryBuilder::populateFields()
{
for ( QgsFieldMap::const_iterator it = mLayer->pendingFields().begin(); it != mLayer->pendingFields().end(); it++ )
{
QStandardItem *myItem = new QStandardItem( it->name() );
myItem->setData( it.key() );
myItem->setEditable( false );
mModelFields->insertRow( mModelFields->rowCount(), myItem );
}
// All fields get ... setup
setupLstFieldsModel();
}
示例9: fieldNameIndex
int QgsVectorDataProvider::fieldNameIndex( const QString& fieldName ) const
{
const QgsFieldMap &theFields = fields();
for ( QgsFieldMap::const_iterator it = theFields.constBegin(); it != theFields.constEnd(); ++it )
{
if ( QString::compare( it->name(), fieldName, Qt::CaseInsensitive ) == 0 )
{
return it.key();
}
}
return -1;
}
示例10: addFeatureWithDefaultValue
int OptVectorLayer::addFeatureWithDefaultValue( OptFeature& f )
{
//{zhangliye2715:api}
if ( !isEditable() )
{
startEditing();
}
// add the fields to the QgsFeature
QgsVectorDataProvider* provider = dataProvider();
const QgsFieldMap fields = provider->fields();
for ( QgsFieldMap::const_iterator it = fields.begin(); it != fields.end(); ++it )
{
f.addAttribute( it.key(), provider->defaultValue( it.key() ) );
}
int id = -1;
id = OptVectorLayer::addFeature( f );
if ( id != -1 )
{
//add points to other features to keep topology up-to-date
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
if( topologicalEditing )
{
addTopologicalPoints( f.geometry() );
}
}
else
{
return -1;
}
//vlayer->setModified(true);
//commit or rollBack the change
if ( isModified() )
{
commitChanges();
}
else
{
rollBack();
return -1;
}
//make the layer still editable for the next adding operation
startEditing();
return id;
}
示例11: expandAction
QString QgsAttributeAction::expandAction( QString action, const QgsAttributeMap &attributes,
uint clickedOnValue )
{
// This function currently replaces all %% characters in the action
// with the value from values[clickedOnValue].second, and then
// searches for all strings that go %attribite_name, where
// attribute_name is found in values[x].first, and replaces any that
// it finds by values[s].second.
// Additional substitutions could include symbols for $CWD, $HOME,
// etc (and their OSX and Windows equivalents)
// This function will potentially fall apart if any of the
// substitutions produce text that could match another
// substitution. May be better to adopt a two pass approach - identify
// all matches and their substitutions and then do a second pass
// for the actual substitutions.
QString expanded_action;
if ( clickedOnValue >= 0 && attributes.contains( clickedOnValue ) )
expanded_action = action.replace( "%%", attributes[clickedOnValue].toString() );
else
expanded_action = action;
const QgsFieldMap &fields = mLayer->pendingFields();
for ( int i = 0; i < 4; i++ )
{
for ( QgsAttributeMap::const_iterator it = attributes.begin(); it != attributes.end(); it++ )
{
QgsFieldMap::const_iterator fit = fields.find( it.key() );
if ( fit == fields.constEnd() )
continue;
QString to_replace;
switch ( i )
{
case 0: to_replace = "[%" + fit->name() + "]"; break;
case 1: to_replace = "[%" + mLayer->attributeDisplayName( it.key() ) + "]"; break;
case 2: to_replace = "%" + fit->name(); break;
case 3: to_replace = "%" + mLayer->attributeDisplayName( it.key() ); break;
}
expanded_action = expanded_action.replace( to_replace, it.value().toString() );
}
}
return expanded_action;
}
示例12: QDialog
QgsDelAttrDialog::QgsDelAttrDialog( const QgsVectorLayer* vl ): QDialog()
{
setupUi( this );
if ( vl )
{
listBox2->clear();
const QgsFieldMap layerAttributes = vl->pendingFields();
QgsFieldMap::const_iterator attIt = layerAttributes.constBegin();
for ( ; attIt != layerAttributes.constEnd(); ++attIt )
{
QListWidgetItem* item = new QListWidgetItem( attIt.value().name(), listBox2 );
item->setData( Qt::UserRole, attIt.key() );
}
}
}
示例13: mLayer
QgsVectorFieldSymbolLayerWidget::QgsVectorFieldSymbolLayerWidget( const QgsVectorLayer* vl, QWidget* parent ): QgsSymbolLayerV2Widget( parent, vl ), mLayer( 0 )
{
setupUi( this );
if ( mVectorLayer )
{
const QgsFieldMap& fm = mVectorLayer->pendingFields();
QgsFieldMap::const_iterator fieldIt = fm.constBegin();
mXAttributeComboBox->addItem( "" );
mYAttributeComboBox->addItem( "" );
for ( ; fieldIt != fm.constEnd(); ++fieldIt )
{
QString fieldName = fieldIt.value().name();
mXAttributeComboBox->addItem( fieldName );
mYAttributeComboBox->addItem( fieldName );
}
}
}
示例14: initializeAliasMap
void QgsComposerAttributeTable::initializeAliasMap()
{
mFieldAliasMap.clear();
if ( mVectorLayer )
{
QgsFieldMap fieldMap = mVectorLayer->pendingFields();
QgsFieldMap::const_iterator it = fieldMap.constBegin();
for ( ; it != fieldMap.constEnd(); ++it )
{
QString currentAlias = mVectorLayer->attributeAlias( it.key() );
if ( !currentAlias.isEmpty() )
{
mFieldAliasMap.insert( it.key(), currentAlias );
}
}
}
}
示例15: populateFields
void QgsFieldCalculator::populateFields()
{
if ( !mVectorLayer )
return;
const QgsFieldMap fieldMap = mVectorLayer->pendingFields();
QgsFieldMap::const_iterator fieldIt = fieldMap.constBegin();
for ( ; fieldIt != fieldMap.constEnd(); ++fieldIt )
{
QString fieldName = fieldIt.value().name();
//insert into field list and field combo box
mFieldMap.insert( fieldName, fieldIt.key() );
mExistingFieldComboBox->addItem( fieldName );
}
}