19 #ifndef QGSVECTORLAYER_H
20 #define QGSVECTORLAYER_H
25 #include <QStringList>
54 class QgsGeometryVertexIndex;
408 : mMin( theMin ), mMax( theMax ), mStep( theStep ) {}
419 bool allowMulti =
false,
420 const QString& filterExpression = QString::null )
424 , mFilterExpression( filterExpression )
425 , mAllowNull( allowNull )
426 , mOrderByValue( orderByValue )
427 , mAllowMulti( allowMulti )
485 FetchFeatureFailed = 3,
503 const QString& providerLib = QString::null,
bool loadDefaultStyleFlag =
true );
512 QString capabilitiesString()
const;
518 void setDisplayField(
const QString& fldName =
"" );
521 const QString displayField()
const;
529 void setDisplayExpression(
const QString &displayExpression );
537 const QString displayExpression();
548 void setProviderEncoding(
const QString& encoding );
551 void setCoordinateSystem();
560 bool removeJoin(
const QString& joinLayerId );
593 void removeExpressionField(
int index );
615 void updateExpressionField(
int index,
const QString& exp );
632 int selectedFeatureCount();
642 void select(
QgsRectangle & rect,
bool addToSelection );
658 void invertSelection();
722 bool labelsEnabled()
const;
728 bool diagramsEnabled()
const;
755 bool hasGeometryType()
const;
781 virtual void saveStyleToDatabase(
const QString& name,
const QString& description,
782 bool useAsDefault,
const QString& uiFileContent,
825 Q_DECL_DEPRECATED
virtual bool applyNamedStyle(
const QString& namedStyle,
QString &errorMsg );
895 void setDataSource(
const QString& dataSource,
const QString& baseName,
const QString& provider,
bool loadDefaultStyleFlag =
false );
902 bool countSymbolFeatures(
bool showProgress =
true );
911 virtual bool setSubsetString(
const QString& subset );
917 virtual QString subsetString();
929 bool addFeature(
QgsFeature& f,
bool alsoUpdateExtent =
true );
943 bool insertVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int beforeVertex );
949 bool moveVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int atVertex );
961 Q_DECL_DEPRECATED
bool deleteVertex(
QgsFeatureId atFeatureId,
int atVertex );
969 EditResult deleteVertexV2(
QgsFeatureId featureId,
int vertex );
974 bool deleteSelectedFeatures(
int *deletedCount =
nullptr );
1042 int translateFeature(
QgsFeatureId featureId,
double dx,
double dy );
1052 int splitParts(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
1062 int splitFeatures(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
1079 int addTopologicalPoints(
const QgsGeometry* geom );
1088 int addTopologicalPoints(
const QgsPoint& p );
1100 Q_DECL_DEPRECATED
void enableLabels(
bool on );
1105 Q_DECL_DEPRECATED
bool hasLabelsEnabled()
const;
1123 virtual bool isReadOnly()
const;
1126 virtual bool isModified()
const;
1134 bool snapPoint(
QgsPoint& point,
double tolerance );
1143 int snapWithContext(
const QgsPoint& startPoint,
1144 double snappingTolerance,
1149 virtual void reload()
override;
1217 long featureCount()
const;
1222 bool setReadOnly(
bool readonly =
true );
1233 Q_DECL_DEPRECATED
bool changeAttributeValue(
QgsFeatureId fid,
int field,
const QVariant& value,
bool emitSignal );
1250 bool addAttribute(
const QgsField &field );
1253 void addAttributeAlias(
int attIndex,
const QString& aliasString );
1256 void remAttributeAlias(
int attIndex );
1274 Q_DECL_DEPRECATED
const QString editorWidgetV2(
int fieldIdx )
const {
return mEditFormConfig->widgetType( fieldIdx ); }
1334 QString attributeAlias(
int attributeIndex )
const;
1337 QString attributeDisplayName(
int attributeIndex )
const;
1348 bool deleteAttribute(
int attr );
1360 bool addFeatures(
QgsFeatureList features,
bool makeSelected =
true );
1389 bool commitChanges();
1395 bool rollBack(
bool deleteBuffer =
true );
1402 Q_DECL_DEPRECATED EditType editType(
int idx );
1409 Q_DECL_DEPRECATED
void setEditType(
int idx, EditType edit );
1421 Q_DECL_DEPRECATED
void setEditorLayout(
EditorLayout editorLayout ) { mEditFormConfig->setLayout( static_cast< QgsEditFormConfig::EditorLayout >( editorLayout ) ); }
1453 Q_DECL_DEPRECATED
void setEditorWidgetV2(
int attrIdx,
const QString& widgetType ) { mEditFormConfig->setWidgetType( attrIdx, widgetType ); }
1479 Q_DECL_DEPRECATED
void setCheckedState(
int idx,
const QString& checked,
const QString& notChecked );
1510 void setAnnotationForm(
const QString& ui );
1537 Q_DECL_DEPRECATED RangeData range(
int idx );
1540 ValueRelationData valueRelation(
int idx );
1555 Q_DECL_DEPRECATED
QString dateFormat(
int idx );
1562 Q_DECL_DEPRECATED
QSize widgetSize(
int idx );
1569 Q_DECL_DEPRECATED
bool fieldEditable(
int idx ) {
return !mEditFormConfig->readOnly( idx ); }
1575 Q_DECL_DEPRECATED
bool labelOnTop(
int idx ) {
return mEditFormConfig->labelOnTop( idx ); }
1581 Q_DECL_DEPRECATED
void setFieldEditable(
int idx,
bool editable ) { mEditFormConfig->setReadOnly( idx, !editable ); }
1587 Q_DECL_DEPRECATED
void setLabelOnTop(
int idx,
bool onTop ) { mEditFormConfig->setLabelOnTop( idx, onTop ); }
1596 void beginEditCommand(
const QString& text );
1599 void endEditCommand();
1602 void destroyEditCommand();
1605 int fieldNameIndex(
const QString& fieldName )
const;
1619 void updateFields();
1622 void createJoinCaches();
1675 QList< double > getDoubleValues(
const QString &fieldOrExpression,
bool &ok,
bool selectedOnly =
false,
int* nullCount =
nullptr );
1678 void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1680 QPainter::CompositionMode featureBlendMode()
const;
1683 void setLayerTransparency(
int layerTransparency );
1685 int layerTransparency()
const;
1758 void removeSelection();
1763 virtual void updateExtents();
1766 void checkJoinLayerRemove(
const QString& theLayerId );
1774 bool startEditing();
1778 void invalidateSymbolCountedFlag();
1792 void selectionChanged();
1795 void layerModified();
1798 void beforeModifiedCheck()
const;
1801 void beforeEditingStarted();
1804 void editingStarted();
1807 void editingStopped();
1810 void beforeCommitChanges();
1813 void beforeRollBack();
1823 void attributeAdded(
int idx );
1831 void beforeAddingExpressionField(
const QString& fieldName );
1841 void attributeDeleted(
int idx );
1849 void beforeRemovingExpressionField(
int idx );
1883 void updatedFields();
1888 void layerDeleted();
1897 void committedFeaturesRemoved(
const QString& layerId,
const QgsFeatureIds& deletedFeatureIds );
1901 void saveLayerToProject();
1907 void featureBlendModeChanged( QPainter::CompositionMode blendMode );
1910 void layerTransparencyChanged(
int layerTransparency );
1917 void editCommandStarted(
const QString& text );
1924 void editCommandEnded();
1931 void editCommandDestroyed();
1958 void raiseError(
const QString& msg );
1961 void onJoinedFieldsChanged();
1981 bool setDataProvider(
QString const & provider );
1994 void snapToGeometry(
const QgsPoint& startPoint,
1997 double sqrSnappingTolerance,
2005 void readSldLabeling(
const QDomNode& node );
2069 bool mLabelFontNotFoundNotified;
2072 QPainter::CompositionMode mFeatureBlendMode;
2075 int mLayerTransparency;
2078 bool mVertexMarkerOnlyForSelection;
2108 bool mSymbolFeatureCounted;
2114 bool mEditCommandActive;
virtual bool isEditable() const
True if the layer can be edited.
Wrapper for iterator of features from vector data provider or vector layer.
QString annotationForm() const
Get annotation form.
A rectangle specified with double values.
Base class for all map layer types.
QgsAttributeList attributeList() const
Returns list of attribute indexes.
QString joinFieldName
Join field in the source layer.
const QSet< QString > & excludeAttributesWMS() const
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.
virtual QString metadata()
Obtain Metadata for this layer.
QString targetFieldName
Join field in the target layer.
virtual void drawLabels(QgsRenderContext &rendererContext)
Draw labels.
QgsAttributeAction * actions()
ValueRelationData(const QString &layer, const QString &key, const QString &value, bool allowNull, bool orderByValue, bool allowMulti=false, const QString &filterExpression=QString::null)
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.
QgsEditFormConfig::GroupData GroupData
QSet< QgsFeatureId > QgsFeatureIds
QgsFields fields() const
Returns the list of fields of this layer.
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.
virtual bool readSymbology(const QDomNode &node, QString &errorMessage)=0
Read the symbology for the current layer from the Dom node supplied.
Storage and management of actions associated with Qgis layer attributes.
const QgsVectorSimplifyMethod & simplifyMethod() const
Returns the simplification settings for fast rendering of features.
QgsAttributeList pendingPkAttributesList() const
Returns list of attributes making up the primary key Alias for pkAttributeList(). ...
virtual void reload()
Synchronises with changes in the datasource.
FeatureFormSuppress
Types of feature form suppression after feature creation.
SimplifyHint
Simplification flags for fast rendering of features.
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
Q_DECL_DEPRECATED void setEditForm(const QString &ui)
Set edit form.
virtual QgsMapLayerRenderer * createMapRenderer(QgsRenderContext &rendererContext)
Return new instance of QgsMapLayerRenderer that will be used for rendering of given context...
WkbType
Used for symbology operations.
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...
QgsEditFormConfig * editFormConfig() const
Get the configuration of the form used to represent this vector layer.
const QgsDiagramLayerSettings * diagramLayerSettings() const
Q_DECL_DEPRECATED void setFieldEditable(int idx, bool editable)
Set edit widget editable.
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage) const =0
Write the symbology for the layer into the docment provided.
QgsGeometryCache * cache()
Returns diagram settings for a feature.
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...
Manages joined fields for a vector layer.
virtual bool draw(QgsRenderContext &rendererContext)
This is the method that does the actual work of drawing the layer onto a paint device.
Q_DECL_DEPRECATED void setEditorWidgetV2(int attrIdx, const QString &widgetType)
Set the editor widget type for a field.
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.
Perform transforms between map coordinates and device coordinates.
SnappingType
Snap to vertex, to segment or both.
QString prefix
An optional prefix.
QgsFields pendingFields() const
Returns the list of fields of this layer.
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.
bool operator==(const QgsVectorJoinInfo &other) const
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.
virtual bool writeXml(QDomNode &layer_node, QDomDocument &document)
Called by writeLayerXML(), used by children to write state specific to them to project files...
const QgsAbstractVectorLayerLabeling * labeling() const
Access to labeling configuration.
const QSet< QString > & excludeAttributesWFS() const
Q_DECL_DEPRECATED RangeData(const QVariant &theMin, const QVariant &theMax, const QVariant &theStep)
VertexMarkerType
Editing vertex markers.
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.
virtual void setExtent(const QgsRectangle &rect)
Set the extent.
The attribute value should not be changed in the attribute form.
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.
QSharedPointer< QStringList > joinFieldsSubset
Subset of fields to use from joined layer.
Encapsulate a field in an attribute table or data source.
Q_DECL_DEPRECATED bool labelOnTop(int idx)
Label widget on top.
const QgsFeatureRendererV2 * rendererV2() const
Return const renderer V2.
const QMap< QString, QString > & attributeAliases() const
const QgsDiagramRendererV2 * diagramRenderer() const
A class to represent a point.
virtual bool readSld(const QDomNode &node, QString &errorMessage)
Q_DECL_DEPRECATED void setEditorWidgetV2Config(int attrIdx, const QgsEditorWidgetConfig &config)
Set the editor widget config for a field.
QgsAttributeList pendingAllAttributesList() const
Returns list of attribute indexes.
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.
long pendingFeatureCount() const
Returns feature count including changes which have not yet been committed Alias for featureCount()...
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) ...
The attribute value should not be shown in the attribute form.
Q_DECL_DEPRECATED QString editFormInit() const
Get python function for edit form initialization.
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...
EditResult
Result of an edit operation.
This class manages a set of relations between layers.
The QgsConditionalLayerStyles class holds conditional style information for a layer.
virtual bool readXml(const QDomNode &layer_node)
Called by readLayerXML(), used by children to read state specific to them from project files...
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
uuid generator - readonly and automatically intialized
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
Q_DECL_DEPRECATED QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const
Type of feature form pop-up suppression after feature creation (overrides app setting) ...
Base class for utility classes that encapsulate information necessary for rendering of map layers...
QStringList * joinFieldNamesSubset() const
Get subset of fields to be used from joined layer.
virtual QString loadNamedStyle(const QString &theURI, bool &theResultFlag)
Retrieve a named style for this layer if one exists (either as a .qml file on disk or as a record in ...
QSet< int > QgsAttributeIds
Q_DECL_DEPRECATED QString editForm() const
Get edit form.
This is the base class for vector data providers.
Abstract base class for curved geometry type.
QList< int > QgsAttributeList
virtual QgsRectangle extent()
Return the extent of the layer.
Represents a vector layer which manages a vector based data sets.
QString joinLayerId
Source 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.
QgsEditFormConfig::TabData TabData
QList< QgsPointV2 > QgsPointSequenceV2
Q_DECL_DEPRECATED RangeData()