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 );
604 QString expressionField(
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;
766 virtual bool readXml(
const QDomNode& layer_node )
override;
781 virtual void saveStyleToDatabase(
const QString& name,
const QString& description,
782 bool useAsDefault,
const QString& uiFileContent,
807 virtual QString loadNamedStyle(
const QString &theURI,
bool &theResultFlag,
bool loadFromLocalDb );
813 virtual QString loadNamedStyle(
const QString &theURI,
bool &theResultFlag )
override;
825 Q_DECL_DEPRECATED
virtual bool applyNamedStyle(
const QString& namedStyle,
QString &errorMsg );
838 bool readSymbology(
const QDomNode& node,
QString& errorMessage )
override;
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 );
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;
1120 virtual bool isEditable()
const override;
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;
1164 Q_DECL_DEPRECATED
void drawLabels(
QgsRenderContext& rendererContext )
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 );
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();
1635 void uniqueValues(
int index,
QList<QVariant> &uniqueValues,
int limit = -1 );
1644 QVariant minimumValue(
int index );
1653 QVariant maximumValue(
int index );
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;
const QSet< QString > & excludeAttributesWMS() const
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.
QgsAttributeAction * actions()
ValueRelationData(const QString &layer, const QString &key, const QString &value, bool allowNull, bool orderByValue, bool allowMulti=false, const QString &filterExpression=QString::null)
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.
Storage and management of actions associated with Qgis layer attributes.
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.
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()
Returns diagram settings for a 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.
const QMap< QString, QString > & attributeAliases() 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.
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.
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) ...
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.
long pendingFeatureCount() const
Returns feature count including changes which have not yet been committed Alias for featureCount()...
uuid generator - readonly and automatically intialized
Q_DECL_DEPRECATED QString editFormInit() const
Get python function for edit form initialization.
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...
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
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.
QgsEditFormConfig::TabData TabData
QList< QgsPointV2 > QgsPointSequenceV2
bool operator==(const QgsVectorJoinInfo &other) const
Q_DECL_DEPRECATED RangeData()