19 #ifndef QGSVECTORLAYER_H 20 #define QGSVECTORLAYER_H 25 #include <QStringList> 56 class QgsGeometryVertexIndex;
79 : memoryCache( false )
81 , targetFieldIndex( -1 )
82 , joinFieldIndex( -1 )
443 : mAllowNull( false )
444 , mOrderByValue( false )
445 , mAllowMulti( false )
448 bool allowMulti =
false,
449 const QString& filterExpression = QString::null )
453 , mFilterExpression( filterExpression )
454 , mAllowNull( allowNull )
455 , mOrderByValue( orderByValue )
456 , mAllowMulti( allowMulti )
514 FetchFeatureFailed = 3,
541 const QString& providerLib = QString::null,
bool loadDefaultStyleFlag =
true );
550 QString capabilitiesString()
const;
556 void setDisplayField(
const QString& fldName =
"" );
567 void setDisplayExpression(
const QString &displayExpression );
575 QString displayExpression()
const;
586 void setProviderEncoding(
const QString& encoding );
589 void setCoordinateSystem();
598 bool removeJoin(
const QString& joinLayerId );
631 void removeExpressionField(
int index );
642 QString expressionField(
int index );
653 void updateExpressionField(
int index,
const QString& exp );
676 int selectedFeatureCount();
688 Q_DECL_DEPRECATED
void select(
QgsRectangle & rect,
bool addToSelection );
737 void invertSelection();
793 Q_DECL_DEPRECATED
void setSelectedFeatures(
const QgsFeatureIds &ids );
802 bool labelsEnabled()
const;
808 bool diagramsEnabled()
const;
835 bool hasGeometryType()
const;
846 virtual bool readXml(
const QDomNode& layer_node )
override;
861 virtual void saveStyleToDatabase(
const QString& name,
const QString& description,
862 bool useAsDefault,
const QString& uiFileContent,
887 virtual QString loadNamedStyle(
const QString &theURI,
bool &theResultFlag,
bool loadFromLocalDb );
893 virtual QString loadNamedStyle(
const QString &theURI,
bool &theResultFlag )
override;
905 Q_DECL_DEPRECATED
virtual bool applyNamedStyle(
const QString& namedStyle,
QString &errorMsg );
918 bool readSymbology(
const QDomNode& node,
QString& errorMessage )
override;
925 bool readStyle(
const QDomNode& node,
QString& errorMessage )
override;
990 void setDataSource(
const QString& dataSource,
const QString& baseName,
const QString& provider,
bool loadDefaultStyleFlag =
false );
997 bool countSymbolFeatures(
bool showProgress =
true );
1006 virtual bool setSubsetString(
const QString& subset );
1012 virtual QString subsetString();
1024 bool addFeature(
QgsFeature& feature,
bool alsoUpdateExtent =
true );
1038 bool insertVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int beforeVertex );
1044 bool moveVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int atVertex );
1056 Q_DECL_DEPRECATED
bool deleteVertex(
QgsFeatureId atFeatureId,
int atVertex );
1069 bool deleteSelectedFeatures(
int *deletedCount =
nullptr );
1137 int translateFeature(
QgsFeatureId featureId,
double dx,
double dy );
1147 int splitParts(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
1157 int splitFeatures(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
1174 int addTopologicalPoints(
const QgsGeometry* geom );
1183 int addTopologicalPoints(
const QgsPoint& p );
1195 Q_DECL_DEPRECATED
void enableLabels(
bool on );
1200 Q_DECL_DEPRECATED
bool hasLabelsEnabled()
const;
1215 virtual bool isEditable()
const override;
1217 virtual bool isSpatial()
const override;
1226 Q_DECL_DEPRECATED
virtual bool isReadOnly()
const override;
1229 virtual bool isModified()
const;
1237 bool snapPoint(
QgsPoint& point,
double tolerance );
1246 int snapWithContext(
const QgsPoint& startPoint,
1247 double snappingTolerance,
1252 virtual void reload()
override;
1267 Q_DECL_DEPRECATED
void drawLabels(
QgsRenderContext& rendererContext )
override;
1320 long featureCount()
const;
1325 bool setReadOnly(
bool readonly =
true );
1336 Q_DECL_DEPRECATED
bool changeAttributeValue(
QgsFeatureId fid,
int field,
const QVariant& value,
bool emitSignal );
1386 bool addAttribute(
const QgsField &field );
1389 void addAttributeAlias(
int attIndex,
const QString& aliasString );
1392 void remAttributeAlias(
int attIndex );
1399 bool renameAttribute(
int attIndex,
const QString& newName );
1417 Q_DECL_DEPRECATED
const QString editorWidgetV2(
int fieldIdx )
const {
return mEditFormConfig->widgetType( fieldIdx ); }
1484 QString attributeAlias(
int attributeIndex )
const;
1487 QString attributeDisplayName(
int attributeIndex )
const;
1499 bool deleteAttribute(
int attr );
1511 bool addFeatures(
QgsFeatureList features,
bool makeSelected =
true );
1540 bool commitChanges();
1546 bool rollBack(
bool deleteBuffer =
true );
1553 Q_DECL_DEPRECATED
EditType editType(
int idx );
1560 Q_DECL_DEPRECATED
void setEditType(
int idx,
EditType edit );
1572 Q_DECL_DEPRECATED
void setEditorLayout(
EditorLayout editorLayout ) { mEditFormConfig->setLayout( static_cast< QgsEditFormConfig::EditorLayout >( editorLayout ) ); }
1604 Q_DECL_DEPRECATED
void setEditorWidgetV2(
int attrIdx,
const QString& widgetType ) { mEditFormConfig->setWidgetType( attrIdx, widgetType ); }
1630 Q_DECL_DEPRECATED
void setCheckedState(
int idx,
const QString& checked,
const QString& notChecked );
1661 void setAnnotationForm(
const QString& ui );
1688 Q_DECL_DEPRECATED
RangeData range(
int idx );
1706 Q_DECL_DEPRECATED
QString dateFormat(
int idx );
1713 Q_DECL_DEPRECATED
QSize widgetSize(
int idx );
1720 Q_DECL_DEPRECATED
bool fieldEditable(
int idx ) {
return !mEditFormConfig->readOnly( idx ); }
1726 Q_DECL_DEPRECATED
bool labelOnTop(
int idx ) {
return mEditFormConfig->labelOnTop( idx ); }
1732 Q_DECL_DEPRECATED
void setFieldEditable(
int idx,
bool editable ) { mEditFormConfig->setReadOnly( idx, !editable ); }
1738 Q_DECL_DEPRECATED
void setLabelOnTop(
int idx,
bool onTop ) { mEditFormConfig->setLabelOnTop( idx, onTop ); }
1747 void beginEditCommand(
const QString& text );
1750 void endEditCommand();
1753 void destroyEditCommand();
1756 int fieldNameIndex(
const QString& fieldName )
const;
1770 void updateFields();
1773 void createJoinCaches();
1799 void setDefaultValueExpression(
int index,
const QString& expression );
1809 QString defaultValueExpression(
int index )
const;
1822 void uniqueValues(
int index,
QList<QVariant> &uniqueValues,
int limit = -1 );
1831 QVariant minimumValue(
int index );
1840 QVariant maximumValue(
int index );
1852 const QString& fieldOrExpression,
1855 bool* ok =
nullptr );
1877 QList< double > getDoubleValues(
const QString &fieldOrExpression,
bool &ok,
bool selectedOnly =
false,
int* nullCount =
nullptr );
1880 void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1882 QPainter::CompositionMode featureBlendMode()
const;
1885 void setLayerTransparency(
int layerTransparency );
1887 int layerTransparency()
const;
1972 void removeSelection();
1977 virtual void updateExtents();
1980 void checkJoinLayerRemove(
const QString& theLayerId );
1988 bool startEditing();
1992 void invalidateSymbolCountedFlag();
2006 void selectionChanged();
2009 void layerModified();
2012 void beforeModifiedCheck()
const;
2015 void beforeEditingStarted();
2018 void editingStarted();
2021 void editingStopped();
2024 void beforeCommitChanges();
2027 void beforeRollBack();
2037 void attributeAdded(
int idx );
2045 void beforeAddingExpressionField(
const QString& fieldName );
2055 void attributeDeleted(
int idx );
2063 void beforeRemovingExpressionField(
int idx );
2097 void updatedFields();
2102 void layerDeleted();
2130 void committedFeaturesRemoved(
const QString& layerId,
const QgsFeatureIds& deletedFeatureIds );
2137 Q_DECL_DEPRECATED
void saveLayerToProject();
2143 void featureBlendModeChanged( QPainter::CompositionMode blendMode );
2146 void layerTransparencyChanged(
int layerTransparency );
2153 void editCommandStarted(
const QString& text );
2160 void editCommandEnded();
2167 void editCommandDestroyed();
2194 void raiseError(
const QString& msg );
2197 void onJoinedFieldsChanged();
2217 bool setDataProvider(
QString const & provider );
2230 void snapToGeometry(
const QgsPoint& startPoint,
2233 double sqrSnappingTolerance,
2241 void readSldLabeling(
const QDomNode& node );
2308 bool mLabelFontNotFoundNotified;
2311 QPainter::CompositionMode mFeatureBlendMode;
2314 int mLayerTransparency;
2317 bool mVertexMarkerOnlyForSelection;
2347 bool mSymbolFeatureCounted;
2353 bool mEditCommandActive;
2359 QMutex mFeatureSourceConstructorMutex;
const QSet< QString > & excludeAttributesWMS() const
QgsActionManager * actions()
Get all layer actions defined on this layer.
bool cacheDirty
True if the cached join attributes need to be updated.
Wrapper for iterator of features from vector data provider or vector layer.
A rectangle specified with double values.
Base class for all map layer types.
QString joinFieldName
Join field in the source layer.
void clearAttributeEditorWidgets()
Clears all the tabs for the attribute editor form.
void setExcludeAttributesWFS(const QSet< QString > &att)
This is an abstract base class for any elements of a drag and drop form.
QString targetFieldName
Join field in the target layer.
ValueRelationData(const QString &layer, const QString &key, const QString &value, bool allowNull, bool orderByValue, bool allowMulti=false, const QString &filterExpression=QString::null)
Modify current selection to include only select features which match.
QgsEditFormConfig::GroupData GroupData
The attribute value should not be changed in the attribute form.
QSet< QgsFeatureId > QgsFeatureIds
const QgsFeatureRendererV2 * rendererV2() const
Return const renderer V2.
Q_DECL_DEPRECATED void addAttributeEditorWidget(QgsAttributeEditorElement *data)
Adds a tab (for the attribute editor form) holding groups and fields.
void setExcludeAttributesWMS(const QSet< QString > &att)
int joinFieldIndex
Join field index in the source layer.
VertexMarkerType
Editing vertex markers.
SimplifyHint
Simplification flags for fast rendering of features.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
const QSet< QString > & excludeAttributesWFS() const
Q_DECL_DEPRECATED void setEditForm(const QString &ui)
Set edit form.
WkbType
Used for symbology operations.
Set selection, removing any existing selection.
bool memoryCache
True if the join is cached in virtual memory.
int targetFieldIndex
Join field index in the target layer.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Q_DECL_DEPRECATED void setFieldEditable(int idx, bool editable)
Set edit widget editable.
Q_DECL_DEPRECATED const QString editorWidgetV2(const QString &fieldName) const
Get the id for the editor widget used to represent the field at the given index.
QgsAttributeList pendingPkAttributesList() const
Returns list of attributes making up the primary key Alias for pkAttributeList(). ...
Q_DECL_DEPRECATED const QgsEditorWidgetConfig editorWidgetV2Config(int fieldIdx) const
Get the configuration for the editor widget used to represent the field at the given index...
QgsGeometryCache * cache()
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
QgsEditFormConfig * editFormConfig() const
Get the configuration of the form used to represent this vector layer.
Manages joined fields for a vector layer.
QgsFields fields() const
Returns the list of fields of this layer.
Q_DECL_DEPRECATED void setEditorWidgetV2(int attrIdx, const QString &widgetType)
Set the editor widget type for a field.
Perform transforms between map coordinates and device coordinates.
SnappingType
Snap to vertex, to segment or both.
QString prefix
An optional prefix.
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
void setJoinFieldNamesSubset(QStringList *fieldNamesSubset)
Set subset of fields to be used from joined layer.
QVariantMap QgsEditorWidgetConfig
Holds a set of configuration parameters for a editor widget wrapper.
Q_DECL_DEPRECATED void setLabelOnTop(int idx, bool onTop)
Label widget on top.
Q_DECL_DEPRECATED QList< QgsAttributeEditorElement *> attributeEditorElements()
Returns a list of tabs holding groups and fields.
The attribute value should not be shown in the attribute form.
Q_DECL_DEPRECATED RangeData(const QVariant &theMin, const QVariant &theMax, const QVariant &theStep)
Q_DECL_DEPRECATED void setFeatureFormSuppress(QgsVectorLayer::FeatureFormSuppress s)
Set type of feature form pop-up suppression after feature creation (overrides app setting) ...
Point geometry type, with support for z-dimension and m-values.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Q_DECL_DEPRECATED const QgsEditorWidgetConfig editorWidgetV2Config(const QString &fieldName) const
Get the configuration for the editor widget used to represent the field with the given name...
const QgsDiagramRendererV2 * diagramRenderer() const
Q_DECL_DEPRECATED void setEditFormInit(const QString &function)
Set python function for edit form initialization.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsAttributeEditorElement * attributeEditorElementFromDomElement(QDomElement &elem, QObject *parent)
Convert a saved attribute editor element into a AttributeEditor structure as it's used internally...
Q_DECL_DEPRECATED bool fieldEditable(int idx)
Is edit widget editable.
Q_DECL_DEPRECATED QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const
Type of feature form pop-up suppression after feature creation (overrides app setting) ...
Storage and management of actions associated with a layer.
QSharedPointer< QStringList > joinFieldsSubset
Subset of fields to use from joined layer.
QgsAttributeList attributeList() const
Returns list of attribute indexes.
QgsAttributeList pendingAllAttributesList() const
Returns list of attribute indexes.
Encapsulate a field in an attribute table or data source.
Q_DECL_DEPRECATED bool labelOnTop(int idx)
Label widget on top.
const QgsAbstractVectorLayerLabeling * labeling() const
Access to labeling configuration.
Q_DECL_DEPRECATED QString editForm() const
Get edit form.
QString annotationForm() const
Get annotation form.
A class to represent a point.
Q_DECL_DEPRECATED void setEditorWidgetV2Config(int attrIdx, const QgsEditorWidgetConfig &config)
Set the editor widget config for a field.
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
QgsVectorLayerJoinBuffer * joinBuffer()
Acccessor to the join buffer object.
Partial snapshot of vector layer's state (only the members necessary for access to features) ...
A class to render labels.
Stores the settings for rendering of all diagrams for a layer.
long pendingFeatureCount() const
Returns feature count including changes which have not yet been committed Alias for featureCount()...
uuid generator - readonly and automatically intialized
SelectBehaviour
Selection behaviour.
Q_DECL_DEPRECATED QString editFormInit() const
Get python function for edit form initialization.
Add selection to current selection.
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
Buffers information about expression fields for a vector layer.
QHash< QString, QgsAttributes > cachedAttributes
Cache for joined attributes to provide fast lookup (size is 0 if no memory caching) ...
const QgsDiagramLayerSettings * diagramLayerSettings() const
This class manages a set of relations between layers.
The QgsConditionalLayerStyles class holds conditional style information for a layer.
Q_DECL_DEPRECATED EditorLayout editorLayout()
Get the active layout for the attribute editor for this layer.
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
QString mFilterExpression
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
QgsFields pendingFields() const
Returns the list of fields of this layer.
Base class for utility classes that encapsulate information necessary for rendering of map layers...
Remove from current selection.
Q_DECL_DEPRECATED const QString editorWidgetV2(int fieldIdx) const
Get the id for the editor widget used to represent the field at the given index.
QSet< int > QgsAttributeIds
This is a container for configuration of the attribute table.
FeatureFormSuppress
Types of feature form suppression after feature creation.
This is the base class for vector data providers.
Abstract base class for curved geometry type.
QList< int > QgsAttributeList
Represents a vector layer which manages a vector based data sets.
EditResult
Result of an edit operation.
QString joinLayerId
Source layer.
QStringList * joinFieldNamesSubset() const
Get subset of fields to be used from joined layer.
Q_DECL_DEPRECATED void setEditorLayout(EditorLayout editorLayout)
Set the active layout for the attribute editor for this layer.
Abstract base class for simplify geometries using a specific algorithm.
Aggregate
Available aggregates to calculate.
QgsEditFormConfig::TabData TabData
QList< QgsPointV2 > QgsPointSequenceV2
bool operator==(const QgsVectorJoinInfo &other) const
A bundle of parameters controlling aggregate calculation.
Q_DECL_DEPRECATED RangeData()