49 : QAbstractTableModel( parent )
50 , mLayerCache( layerCache )
59 mFeat.
setId( std::numeric_limits<int>::min() );
61 if ( !
layer()->isSpatial() )
81 bool QgsAttributeTableModel::loadFeatureAtId(
QgsFeatureId fid )
const 85 if ( fid == std::numeric_limits<int>::min() )
104 void QgsAttributeTableModel::featuresDeleted(
const QgsFeatureIds &fids )
108 const auto constFids = fids;
111 QgsDebugMsgLevel( QStringLiteral(
"(%2) fid: %1, size: %3" ).arg( fid ).arg( mFeatureRequest.
filterType() ).arg( mIdRowMap.size() ), 4 );
118 std::sort( rows.begin(), rows.end() );
122 int currentRowCount = 0;
126 const auto constRows = rows;
127 for (
int row : constRows )
130 qDebug() <<
"Row: " << row <<
", begin " << beginRow <<
", last " << lastRow <<
", current " << currentRowCount <<
", removed " << removedRows;
137 if ( row != lastRow + 1 && lastRow != -1 )
139 if ( rows.count() > 100 && currentRowCount < 10 )
144 removeRows( beginRow - removedRows, currentRowCount );
147 removedRows += currentRowCount;
157 removeRows( beginRow - removedRows, currentRowCount );
165 if ( row < 0 || count < 1 )
168 beginRemoveRows( parent, row, row + count - 1 );
172 QgsDebugMsgLevel( QStringLiteral(
"remove %2 rows at %1 (rows %3, ids %4)" ).arg( row ).arg( count ).arg( mRowIdMap.size() ).arg( mIdRowMap.size() ), 3 );
176 for (
int i = row; i < row + count; i++ )
178 for ( SortCache &cache : mSortCaches )
179 cache.sortCache.remove( mRowIdMap[i] );
180 mIdRowMap.remove( mRowIdMap[i] );
181 mRowIdMap.remove( i );
185 int n = mRowIdMap.size() + count;
186 for (
int i = row + count; i < n; i++ )
189 mIdRowMap[id] -= count;
190 mRowIdMap[i - count] = id;
191 mRowIdMap.remove( i );
197 QgsDebugMsgLevel( QStringLiteral(
"after removal rows %1, ids %2" ).arg( mRowIdMap.size() ).arg( mIdRowMap.size() ), 4 );
199 for ( QHash<QgsFeatureId, int>::const_iterator it = mIdRowMap.constBegin(); it != mIdRowMap.constEnd(); ++it )
203 for ( QHash<int, QgsFeatureId>::const_iterator it = mRowIdMap.constBegin(); it != mRowIdMap.constEnd(); ++it )
208 Q_ASSERT( mRowIdMap.size() == mIdRowMap.size() );
215 void QgsAttributeTableModel::featureAdded(
QgsFeatureId fid,
bool resettingModel )
220 if ( mFeat.
id() != fid )
221 featOk = loadFeatureAtId( fid );
225 for ( SortCache &cache : mSortCaches )
227 if ( cache.sortFieldIndex >= 0 )
230 const QVariant &widgetCache = mAttributeWidgetCaches.at( cache.sortFieldIndex );
231 const QVariantMap &widgetConfig = mWidgetConfigs.at( cache.sortFieldIndex );
232 QVariant sortValue = fieldFormatter->
representValue(
layer(), cache.sortFieldIndex, widgetConfig, widgetCache, mFeat.
attribute( cache.sortFieldIndex ) );
233 cache.sortCache.insert( mFeat.
id(), sortValue );
235 else if ( cache.sortCacheExpression.isValid() )
238 cache.sortCache[mFeat.
id()] = cache.sortCacheExpression.evaluate( &mExpressionContext );
243 if ( ! mIdRowMap.contains( fid ) )
245 int n = mRowIdMap.size();
246 if ( !resettingModel )
247 beginInsertRows( QModelIndex(), n, n );
248 mIdRowMap.insert( fid, n );
249 mRowIdMap.insert( n, fid );
250 if ( !resettingModel )
257 void QgsAttributeTableModel::updatedFields()
263 void QgsAttributeTableModel::editCommandEnded()
267 bulkEditCommandEnded( );
270 void QgsAttributeTableModel::attributeDeleted(
int idx )
273 for (
const SortCache &cache : mSortCaches )
275 if ( cache.sortCacheAttributes.contains( idx ) )
283 void QgsAttributeTableModel::layerDeleted()
285 mLayerCache =
nullptr;
288 mAttributeWidgetCaches.clear();
290 mWidgetFactories.clear();
291 mWidgetConfigs.clear();
292 mFieldFormatters.clear();
295 void QgsAttributeTableModel::fieldFormatterRemoved(
QgsFieldFormatter *fieldFormatter )
297 for (
int i = 0; i < mFieldFormatters.size(); ++i )
299 if ( mFieldFormatters.at( i ) == fieldFormatter )
304 void QgsAttributeTableModel::attributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant &value )
307 if ( mBulkEditCommandRunning )
309 mAttributeValueChanges.insert( QPair<QgsFeatureId, int>( fid, idx ), value );
312 QgsDebugMsgLevel( QStringLiteral(
"(%4) fid: %1, idx: %2, value: %3" ).arg( fid ).arg( idx ).arg( value.toString() ).arg( mFeatureRequest.
filterType() ), 2 );
314 for ( SortCache &cache : mSortCaches )
316 if ( cache.sortCacheAttributes.contains( idx ) )
318 if ( cache.sortFieldIndex == -1 )
320 if ( loadFeatureAtId( fid ) )
323 cache.sortCache[fid] = cache.sortCacheExpression.evaluate( &mExpressionContext );
329 const QVariant &widgetCache = mAttributeWidgetCaches.at( cache.sortFieldIndex );
330 const QVariantMap &widgetConfig = mWidgetConfigs.at( cache.sortFieldIndex );
331 QVariant sortValue = fieldFormatter->
representValue(
layer(), cache.sortFieldIndex, widgetConfig, widgetCache, value );
332 cache.sortCache.insert( fid, sortValue );
339 if ( loadFeatureAtId( fid ) )
344 if ( loadFeatureAtId( fid ) )
348 if ( !mIdRowMap.contains( fid ) )
361 if ( mIdRowMap.contains( fid ) )
372 void QgsAttributeTableModel::loadAttributes()
379 bool ins =
false, rm =
false;
384 mWidgetFactories.clear();
385 mAttributeWidgetCaches.clear();
386 mWidgetConfigs.clear();
388 for (
int idx = 0; idx < fields.
count(); ++idx )
394 mWidgetFactories.append( widgetFactory );
395 mWidgetConfigs.append( setup.
config() );
397 mFieldFormatters.append( fieldFormatter );
402 if ( mFieldCount + mExtraColumns < attributes.size() + mExtraColumns )
405 beginInsertColumns( QModelIndex(), mFieldCount + mExtraColumns, attributes.size() - 1 );
407 else if ( attributes.size() + mExtraColumns < mFieldCount + mExtraColumns )
410 beginRemoveColumns( QModelIndex(), attributes.size(), mFieldCount + mExtraColumns - 1 );
413 mFieldCount = attributes.size();
414 mAttributes = attributes;
416 for ( SortCache &cache : mSortCaches )
418 if ( cache.sortFieldIndex >= mAttributes.count() )
419 cache.sortFieldIndex = -1;
461 if ( t.elapsed() > 1000 )
470 featureAdded( mFeat.
id(), true );
483 if ( fieldName.isNull() )
485 mRowStylesMap.clear();
491 if ( fieldIndex == -1 )
496 emit dataChanged( index( 0, col ), index(
rowCount() - 1, col ) );
509 mRowIdMap.remove( rowA );
510 mRowIdMap.remove( rowB );
511 mRowIdMap.insert( rowA, b );
512 mRowIdMap.insert( rowB, a );
514 mIdRowMap.remove( a );
515 mIdRowMap.remove( b );
516 mIdRowMap.insert( a, rowB );
517 mIdRowMap.insert( b, rowA );
518 Q_ASSERT( mRowIdMap.size() == mIdRowMap.size() );
526 if ( !mIdRowMap.contains(
id ) )
528 QgsDebugMsg( QStringLiteral(
"idToRow: id %1 not in the map" ).arg(
id ) );
532 return mIdRowMap[id];
537 return index(
idToRow(
id ), 0 );
542 QModelIndexList indexes;
546 indexes.reserve( columns );
547 for (
int column = 0; column < columns; ++column )
549 indexes.append( index( row, column ) );
557 if ( !mRowIdMap.contains( row ) )
559 QgsDebugMsg( QStringLiteral(
"rowToId: row %1 not in the map" ).arg( row ) );
561 return std::numeric_limits<int>::min();
564 return mRowIdMap[row];
569 return mAttributes[col];
574 return mAttributes.indexOf( idx );
580 return mRowIdMap.size();
586 return std::max( 1, mFieldCount + mExtraColumns );
594 if ( role == Qt::DisplayRole )
596 if ( orientation == Qt::Vertical )
598 return QVariant( section );
600 else if ( section >= 0 && section < mFieldCount )
602 QString attributeName =
layer()->
fields().
at( mAttributes.at( section ) ).displayName();
603 return QVariant( attributeName );
607 return tr(
"extra column" );
610 else if ( role == Qt::ToolTipRole )
612 if ( orientation == Qt::Vertical )
615 return tr(
"Feature ID: %1" ).arg(
rowToId( section ) );
631 if ( !index.isValid() || !
layer() ||
632 ( role != Qt::TextAlignmentRole
633 && role != Qt::DisplayRole
634 && role != Qt::ToolTipRole
635 && role != Qt::EditRole
638 && role != Qt::BackgroundColorRole
639 && role != Qt::TextColorRole
640 && role != Qt::DecorationRole
641 && role != Qt::FontRole
652 if ( index.column() >= mFieldCount )
655 int fieldId = mAttributes.at( index.column() );
662 unsigned long cacheIndex = role -
SortRole;
663 if ( cacheIndex < mSortCaches.size() )
664 return mSortCaches.at( cacheIndex ).sortCache.value( rowId );
671 if ( role == Qt::TextAlignmentRole )
673 return QVariant( mFieldFormatters.at( index.column() )->alignmentFlag(
layer(), fieldId, mWidgetConfigs.at( index.column() ) ) | Qt::AlignVCenter );
676 if ( mFeat.
id() != rowId || !mFeat.
isValid() )
678 if ( !loadFeatureAtId( rowId ) )
679 return QVariant(
"ERROR" );
681 if ( mFeat.
id() != rowId )
682 return QVariant(
"ERROR" );
685 QVariant val = mFeat.
attribute( fieldId );
689 case Qt::DisplayRole:
690 case Qt::ToolTipRole:
691 return mFieldFormatters.at( index.column() )->representValue(
layer(), fieldId, mWidgetConfigs.at( index.column() ),
692 mAttributeWidgetCaches.at( index.column() ), val );
697 case Qt::BackgroundRole:
698 case Qt::TextColorRole:
699 case Qt::DecorationRole:
703 QList<QgsConditionalStyle> styles;
704 if ( mRowStylesMap.contains( index.row() ) )
706 styles = mRowStylesMap[index.row()];
711 mRowStylesMap.insert( index.row(), styles );
717 styles.insert( 0, rowstyle );
726 if ( role == Qt::DecorationRole )
728 if ( role == Qt::FontRole )
743 if ( !index.isValid() || index.column() >= mFieldCount || role != Qt::EditRole || !
layer()->
isEditable() )
749 mRowStylesMap.remove( index.row() );
756 if ( !index.isValid() )
757 return Qt::ItemIsEnabled;
759 if ( index.column() >= mFieldCount || !
layer() )
760 return Qt::NoItemFlags;
762 Qt::ItemFlags
flags = QAbstractTableModel::flags( index );
764 bool editable =
false;
765 const int fieldIndex = mAttributes[index.column()];
773 editable = fieldIsEditable( *info->
joinLayer(), srcFieldIndex, fid );
776 editable = fieldIsEditable( *
layer(), fieldIndex, fid );
779 flags |= Qt::ItemIsEditable;
791 void QgsAttributeTableModel::bulkEditCommandStarted()
793 mBulkEditCommandRunning =
true;
794 mAttributeValueChanges.clear();
797 void QgsAttributeTableModel::bulkEditCommandEnded()
799 mBulkEditCommandRunning =
false;
802 int changeCount( mAttributeValueChanges.count() );
803 bool fullModelUpdate = changeCount > mLayerCache->
cacheSize() ||
806 QgsDebugMsgLevel( QStringLiteral(
"Bulk edit command ended with %1 modified rows over (%4), cache size is %2, starting %3 update." )
809 .arg( fullModelUpdate ? QStringLiteral(
"full" ) : QStringLiteral(
"incremental" ) )
813 if ( fullModelUpdate )
825 const auto keys = mAttributeValueChanges.keys();
826 for (
const auto &key : keys )
828 attributeValueChanged( key.first, key.second, mAttributeValueChanges.value( key ) );
829 int row(
idToRow( key.first ) );
831 minRow = std::min<int>( row, minRow );
832 minCol = std::min<int>( col, minCol );
833 maxRow = std::max<int>( row, maxRow );
834 maxCol = std::max<int>( col, maxCol );
836 emit dataChanged( createIndex( minRow, minCol ), createIndex( maxRow, maxCol ) );
838 mAttributeValueChanges.clear();
843 mFeat.
setId( std::numeric_limits<int>::min() );
844 emit dataChanged( index1, index2 );
865 for (
int i = 0; i < mAttributes.size(); i++ )
867 f.
setAttribute( mAttributes[i],
data( index( idx.row(), i ), Qt::EditRole ) );
875 if ( column == -1 || column >= mAttributes.count() )
887 if ( cacheIndex >= mSortCaches.size() )
889 mSortCaches.resize( cacheIndex + 1 );
891 SortCache &cache = mSortCaches[cacheIndex];
892 cache.sortCache.clear();
893 cache.sortCacheAttributes.clear();
894 cache.sortFieldIndex = -1;
895 if ( !expressionString.isEmpty() )
896 cache.sortCacheExpression =
QgsExpression( expressionString );
905 QVariant widgetCache;
906 QVariantMap widgetConfig;
908 if ( cache.sortCacheExpression.isField() )
914 if ( cache.sortFieldIndex == -1 )
916 cache.sortCacheExpression.prepare( &mExpressionContext );
918 const QSet<QString> &referencedColumns = cache.sortCacheExpression.referencedColumns();
920 for (
const QString &col : referencedColumns )
927 cache.sortCacheAttributes.append( cache.sortFieldIndex );
929 widgetCache = mAttributeWidgetCaches.at( cache.sortFieldIndex );
930 widgetConfig = mWidgetConfigs.at( cache.sortFieldIndex );
931 fieldFormatter = mFieldFormatters.at( cache.sortFieldIndex );
942 if ( cache.sortFieldIndex == -1 )
945 const QVariant cacheValue = cache.sortCacheExpression.evaluate( &mExpressionContext );
946 cache.sortCache.insert( f.
id(), cacheValue );
950 QVariant sortValue = fieldFormatter->
sortValue(
layer(), cache.sortFieldIndex, widgetConfig, widgetCache, f.
attribute( cache.sortFieldIndex ) );
951 cache.sortCache.insert( f.
id(), sortValue );
958 QString expressionString;
960 if ( cacheIndex >= mSortCaches.size() )
961 return expressionString;
963 const QgsExpression &expression = mSortCaches[cacheIndex].sortCacheExpression;
968 expressionString = QString();
970 return expressionString;
982 return mFeatureRequest;
int lookupField(const QString &fieldName) const
Looks up field's index from the field name.
bool isValid() const
Returns the validity of this feature.
void setRequest(const QgsFeatureRequest &request)
Set a request that will be used to fill this attribute table model.
Class for parsing and evaluation of expressions (formerly called "search strings").
QgsActionManager * actions()
Returns all layer actions defined on this layer.
Wrapper for iterator of features from vector data provider or vector layer.
void featuresDeleted(const QgsFeatureIds &fids)
Emitted when features have been deleted.
QgsVectorLayer * layer() const
Returns the layer this model uses as backend.
int extraColumns() const
Empty extra columns to announce from this model.
bool acceptFeature(const QgsFeature &feature)
Check if a feature is accepted by this requests filter.
void doAction(QUuid actionId, const QgsFeature &feature, int defaultValueIndex=0, const QgsExpressionContextScope &scope=QgsExpressionContextScope())
Does the given action.
virtual void loadLayer()
Loads the layer into the model Preferably to be called, before using this model as source for any oth...
Field comes from a joined layer (originIndex / 1000 = index of the join, originIndex % 1000 = index w...
QSet< QgsFeatureId > QgsFeatureIds
static QgsFieldFormatterRegistry * fieldFormatterRegistry()
Gets the registry of available field formatters.
FieldOrigin fieldOrigin(int fieldIdx) const
Gets field's origin (value from an enumeration)
virtual QgsVectorDataProvider::Capabilities capabilities() const
Returns flags containing the supported capabilities.
static QString quotedColumnRef(QString name)
Returns a quoted column reference (in double quotes)
const Flags & flags() const
Get the field index of this column.
void beforeRollBack()
Emitted before changes are rolled back.
void invalidated()
The cache has been invalidated and cleared.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
QString sortCacheExpression(unsigned long cacheIndex=0) const
The expression which was used to fill the sorting cache at index cacheIndex.
QList< QgsConditionalStyle > fieldStyles(const QString &fieldName)
Returns the conditional styles set for the field UI properties.
void prefetchSortData(const QString &expression, unsigned long cacheIndex=0)
Prefetches the entire data for an expression.
static QString fieldToolTip(const QgsField &field)
Returns a HTML formatted tooltip string for a field, containing details like the field name...
void reload(const QModelIndex &index1, const QModelIndex &index2)
Reloads the model data between indices.
QgsFeatureRequest & setSubsetOfAttributes(const QgsAttributeList &attrs)
Set a subset of attributes that will be fetched.
FilterType filterType() const
Returns the filter type which is currently set on this request.
QgsWkbTypes::GeometryType geometryType() const
Returns point, line or polygon.
Container of fields for a vector layer.
bool setAttribute(int field, const QVariant &attr)
Set an attribute's value by field index.
bool validBackgroundColor() const
Check if the background color is valid for render.
QPixmap icon() const
The icon set for style generated from the set symbol.
void fieldConditionalStyleChanged(const QString &fieldName)
Handles updating the model when the conditional style for a field changes.
QgsVectorLayer * layer()
Returns the layer to which this cache belongs.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
void attributeValueChanged(QgsFeatureId fid, int field, const QVariant &value)
Emitted when an attribute is changed.
int count() const
Returns number of items.
void editCommandEnded()
Signal emitted, when an edit command successfully ended.
void resetModel()
Resets the model.
QModelIndex idToIndex(QgsFeatureId id) const
QgsConditionalLayerStyles * conditionalStyles() const
Returns the conditional styles that are set for this layer.
QgsField at(int i) const
Gets field at particular index (must be in range 0..N-1)
QVariant data(const QModelIndex &index, int role) const override
Returns data on the given index.
Get the feature id of the feature in this row.
QgsFeature feature(const QModelIndex &idx) const
Returns the feature attributes at given model index.
void featureAdded(QgsFeatureId fid)
Emitted when a new feature has been added to the layer and this cache.
bool isEditable() const FINAL
Returns true if the provider is in editing mode.
Roles used for sorting start here.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns header data.
QgsFields fields() const FINAL
Returns the list of fields of this layer.
Conditional styling for a rule.
QgsVectorLayer * joinLayer() const
Returns joined layer (may be nullptr if the reference was set by layer ID and not resolved yet) ...
#define QgsDebugMsgLevel(str, level)
void setExtraColumns(int extraColumns)
Empty extra columns to announce from this model.
bool isValid() const
Checks if this expression is valid.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns.
static QgsEditorWidgetRegistry * editorWidgetRegistry()
Returns the global editor widget registry, used for managing all known edit widget factories...
void initAttributes(int fieldCount)
Initialize this feature with the given number of fields.
void afterRollBack()
Emitted after changes are rolled back.
bool isValid() const
isValid Check if this rule is valid.
static QList< QgsConditionalStyle > matchingConditionalStyles(const QList< QgsConditionalStyle > &styles, const QVariant &value, QgsExpressionContext &context)
Find and return the matching styles for the value and feature.
Defines left outer join from our vector layer to some other vector layer.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
An expression node which takes it value from a feature's field.
QColor backgroundColor() const
The background color for style.
bool removeRows(int row, int count, const QModelIndex &parent=QModelIndex()) override
Remove rows.
static QgsConditionalStyle compressStyles(const QList< QgsConditionalStyle > &styles)
Compress a list of styles into a single style.
const QgsFeatureRequest & request() const
Gets the the feature request.
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
Encapsulate a field in an attribute table or data source.
void setId(QgsFeatureId id)
Sets the feature ID for this feature.
void cachedLayerDeleted()
Is emitted when the cached layer is deleted.
QgsEditFormConfig editFormConfig
QgsVectorLayerJoinBuffer * joinBuffer()
Returns the join buffer object.
QModelIndexList idToIndexList(QgsFeatureId id) const
QString expression() const
Returns the original, unmodified expression string.
This class caches features of a given QgsVectorLayer.
static int debugLevel()
Reads the environment variable QGIS_DEBUG and converts it to int.
void progress(int i, bool &cancel)
void modelChanged()
Model has been changed.
QColor textColor() const
The text color set for style.
QgsAttributeTableModel(QgsVectorLayerCache *layerCache, QObject *parent=nullptr)
Constructor.
int fieldCol(int idx) const
Gets column from field index.
void editCommandStarted(const QString &text)
Signal emitted when a new edit command has been started.
int fieldIdx(int col) const
Gets field index from column.
#define FID_TO_STRING(fid)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows.
bool featureAtId(QgsFeatureId featureId, QgsFeature &feature, bool skipCache=false)
Gets the feature at the given feature id.
bool validTextColor() const
Check if the text color is valid for render.
virtual bool isModified() const
Returns true if the provider has been modified since the last commit.
void executeMapLayerAction(QgsMapLayerAction *action, const QModelIndex &idx) const
Execute a QgsMapLayerAction.
const QgsVectorLayerJoinInfo * joinForFieldIndex(int index, const QgsFields &fields, int &sourceFieldIndex) const
Finds the vector join for a layer field index.
QgsFeatureId rowToId(int row) const
Maps row to feature id.
void dataChanged()
Data of layer changed.
int cacheSize()
Returns the maximum number of features this cache will hold.
void appendScopes(const QList< QgsExpressionContextScope *> &scopes)
Appends a list of scopes to the end of the context.
QgsVectorDataProvider * dataProvider() FINAL
Returns the layer's data provider, it may be nullptr.
QList< int > QgsAttributeList
bool isEditable() const
Returns whether joined fields may be edited through the form of the target layer. ...
QFont font() const
The font for the style.
void swapRows(QgsFeatureId a, QgsFeatureId b)
Swaps two rows.
bool nextFeature(QgsFeature &f)
void attributeDeleted(int idx)
Will be emitted, when an attribute has been deleted from this vector layer.
Geometry is not required. It may still be returned if e.g. required for a filter condition.
Represents a vector layer which manages a vector based data sets.
QVariant attribute(const QString &name) const
Lookup attribute value from attribute name.
QgsFeatureIterator getFeatures(const QgsFeatureRequest &featureRequest=QgsFeatureRequest())
Query this VectorLayerCache for features.
void updatedFields()
Emitted whenever the fields available from this layer have been changed.
int idToRow(QgsFeatureId id) const
Maps feature id to table row.
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
Updates data on given index.
void triggerForFeature(QgsMapLayer *layer, const QgsFeature *feature)
Triggers the action with the specified layer and feature.
void executeAction(QUuid action, const QModelIndex &idx) const
Execute an action.
Allows modification of attribute values.
An action which can run on map layers.
void prefetchColumnData(int column)
Caches the entire data for one column.
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns item flags for the index.
QgsFeatureRequest & setFlags(QgsFeatureRequest::Flags flags)
Sets flags that affect how features will be fetched.