本文整理汇总了C++中qgsfeaturelist::iterator::attributeMap方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::attributeMap方法的具体用法?C++ iterator::attributeMap怎么用?C++ iterator::attributeMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgsfeaturelist::iterator
的用法示例。
在下文中一共展示了iterator::attributeMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: replaceWithCopyOf
void QgsClipboard::replaceWithCopyOf( const QgsFieldMap& fields, QgsFeatureList& features )
{
// Replace the QGis clipboard.
mFeatureClipboard = features;
QgsDebugMsg( "replaced QGis clipboard." );
// Replace the system clipboard.
QStringList textLines;
QStringList textFields;
// first do the field names
textFields += "wkt_geom";
for ( QgsFieldMap::const_iterator fit = fields.begin(); fit != fields.end(); ++fit )
{
textFields += fit->name();
}
textLines += textFields.join( "\t" );
textFields.clear();
// then the field contents
for ( QgsFeatureList::iterator it = features.begin(); it != features.end(); ++it )
{
QgsAttributeMap attributes = it->attributeMap();
// TODO: Set up Paste Transformations to specify the order in which fields are added.
if ( it->geometry() )
textFields += it->geometry()->exportToWkt();
else
{
QSettings settings;
textFields += settings.value( "qgis/nullValue", "NULL" ).toString();
}
// QgsDebugMsg("about to traverse fields.");
//
for ( QgsAttributeMap::iterator it2 = attributes.begin(); it2 != attributes.end(); ++it2 )
{
// QgsDebugMsg(QString("inspecting field '%1'.").arg(it2->toString()));
textFields += it2->toString();
}
textLines += textFields.join( "\t" );
textFields.clear();
}
QString textCopy = textLines.join( "\n" );
QClipboard *cb = QApplication::clipboard();
// Copy text into the clipboard
// With qgis running under Linux, but with a Windows based X
// server (Xwin32), ::Selection was necessary to get the data into
// the Windows clipboard (which seems contrary to the Qt
// docs). With a Linux X server, ::Clipboard was required.
// The simple solution was to put the text into both clipboards.
// The ::Selection setText() below one may need placing inside so
// #ifdef so that it doesn't get compiled under Windows.
cb->setText( textCopy, QClipboard::Selection );
cb->setText( textCopy, QClipboard::Clipboard );
QgsDebugMsg( QString( "replaced system clipboard with: %1." ).arg( textCopy ) );
}