本文整理汇总了C++中qgsfeaturemap::iterator::value方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::value方法的具体用法?C++ iterator::value怎么用?C++ iterator::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgsfeaturemap::iterator
的用法示例。
在下文中一共展示了iterator::value方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addAttributes
bool QgsMemoryProvider::addAttributes( const QList<QgsField> &attributes )
{
for ( QList<QgsField>::const_iterator it = attributes.begin(); it != attributes.end(); ++it )
{
// Why are attributes restricted to int,double and string only?
switch ( it->type() )
{
case QVariant::Int:
case QVariant::Double:
case QVariant::String:
case QVariant::Date:
case QVariant::LongLong:
break;
default:
QgsDebugMsg( "Field type not supported: " + it->typeName() );
continue;
}
// add new field as a last one
mFields.append( *it );
for ( QgsFeatureMap::iterator fit = mFeatures.begin(); fit != mFeatures.end(); ++fit )
{
QgsFeature& f = fit.value();
f.attributes().append( QVariant() );
}
}
return true;
}
示例2: undo
void QgsVectorLayerUndoCommandChangeGeometry::undo()
{
if ( FID_IS_NEW( mFid ) )
{
// modify added features
QgsFeatureMap::iterator it = mBuffer->mAddedFeatures.find( mFid );
Q_ASSERT( it != mBuffer->mAddedFeatures.end() );
it.value().setGeometry( mOldGeom );
emit mBuffer->geometryChanged( mFid, mOldGeom );
}
else
{
// existing feature
if ( mOldGeom.isNull() )
{
mBuffer->mChangedGeometries.remove( mFid );
QgsFeature f;
if ( layer()->getFeatures( QgsFeatureRequest().setFilterFid( mFid ).setNoAttributes() ).nextFeature( f ) && f.hasGeometry() )
{
emit mBuffer->geometryChanged( mFid, f.geometry() );
}
}
else
{
mBuffer->mChangedGeometries[mFid] = mOldGeom;
emit mBuffer->geometryChanged( mFid, mOldGeom );
}
}
}
示例3: updateExtent
void QgsMemoryProvider::updateExtent()
{
if ( mFeatures.count() == 0 )
{
mExtent = QgsRectangle();
}
else
{
mExtent = mFeatures.begin().value().geometry()->boundingBox();
for ( QgsFeatureMap::iterator it = mFeatures.begin(); it != mFeatures.end(); ++it )
mExtent.unionRect( it.value().geometry()->boundingBox() );
}
}
示例4: redo
void QgsVectorLayerUndoCommandChangeGeometry::redo()
{
if ( FID_IS_NEW( mFid ) )
{
// modify added features
QgsFeatureMap::iterator it = mBuffer->mAddedFeatures.find( mFid );
Q_ASSERT( it != mBuffer->mAddedFeatures.end() );
it.value().setGeometry( mNewGeom );
}
else
{
mBuffer->mChangedGeometries[ mFid ] = mNewGeom;
}
emit mBuffer->geometryChanged( mFid, mNewGeom );
}
示例5: undo
void QgsVectorLayerUndoCommandDeleteAttribute::undo()
{
if ( mProviderField )
{
mBuffer->mDeletedAttributeIds.removeOne( mOriginIndex );
}
else
{
// newly added attribute
mBuffer->mAddedAttributes.insert( mOriginIndex, mOldField );
}
mBuffer->updateLayerFields();
mBuffer->handleAttributeAdded( mFieldIndex ); // update changed attributes + new features
if ( !mOldName.isEmpty() )
{
mBuffer->mRenamedAttributes[ mFieldIndex ] = mOldName;
mBuffer->updateLayerFields();
}
// set previously used attributes of new features
for ( QgsFeatureMap::iterator it = mBuffer->mAddedFeatures.begin(); it != mBuffer->mAddedFeatures.end(); ++it )
{
QgsFeature& f = it.value();
f.setAttribute( mFieldIndex, mDeletedValues.value( f.id() ) );
}
// set previously used changed attributes
for ( QMap<QgsFeatureId, QVariant>::const_iterator it = mDeletedValues.constBegin(); it != mDeletedValues.constEnd(); ++it )
{
if ( !FID_IS_NEW( it.key() ) )
{
QgsAttributeMap& attrs = mBuffer->mChangedAttributeValues[it.key()]; // also adds record if nonexistant
attrs.insert( mFieldIndex, it.value() );
}
}
QgsEditFormConfig formConfig = mBuffer->L->editFormConfig();
formConfig.setWidgetConfig( mFieldName, mOldEditorWidgetConfig );
mBuffer->L->setEditFormConfig( formConfig );
emit mBuffer->attributeAdded( mFieldIndex );
}
示例6: deleteAttributes
bool QgsMemoryProvider::deleteAttributes( const QgsAttributeIds& attributes )
{
QList<int> attrIdx = attributes.toList();
qSort( attrIdx.begin(), attrIdx.end(), qGreater<int>() );
// delete attributes one-by-one with decreasing index
for ( QList<int>::const_iterator it = attrIdx.constBegin(); it != attrIdx.constEnd(); ++it )
{
int idx = *it;
mFields.remove( idx );
for ( QgsFeatureMap::iterator fit = mFeatures.begin(); fit != mFeatures.end(); ++fit )
{
QgsFeature& f = fit.value();
f.attributes().remove( idx );
}
}
return true;
}