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 );
588 void removeExpressionField(
int index );
610 void updateExpressionField(
int index,
const QString& exp );
627 int selectedFeatureCount();
637 void select(
QgsRectangle & rect,
bool addToSelection );
653 void invertSelection();
717 bool labelsEnabled()
const;
723 bool diagramsEnabled()
const;
750 bool hasGeometryType()
const;
761 virtual bool readXml(
const QDomNode& layer_node )
override;
776 virtual void saveStyleToDatabase(
const QString& name,
const QString& description,
777 bool useAsDefault,
const QString& uiFileContent,
802 virtual QString loadNamedStyle(
const QString &theURI,
bool &theResultFlag,
bool loadFromLocalDb );
808 virtual QString loadNamedStyle(
const QString &theURI,
bool &theResultFlag )
override;
820 Q_DECL_DEPRECATED
virtual bool applyNamedStyle(
const QString& namedStyle,
QString &errorMsg );
833 bool readSymbology(
const QDomNode& node,
QString& errorMessage )
override;
864 void setDataSource(
const QString& dataSource,
const QString& baseName,
const QString& provider,
bool loadDefaultStyleFlag =
false );
871 bool countSymbolFeatures(
bool showProgress =
true );
880 virtual bool setSubsetString(
const QString& subset );
886 virtual QString subsetString();
898 bool addFeature(
QgsFeature& f,
bool alsoUpdateExtent =
true );
912 bool insertVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int beforeVertex );
918 bool moveVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int atVertex );
930 Q_DECL_DEPRECATED
bool deleteVertex(
QgsFeatureId atFeatureId,
int atVertex );
943 bool deleteSelectedFeatures(
int *deletedCount =
nullptr );
1011 int translateFeature(
QgsFeatureId featureId,
double dx,
double dy );
1021 int splitParts(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
1031 int splitFeatures(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
1048 int addTopologicalPoints(
const QgsGeometry* geom );
1057 int addTopologicalPoints(
const QgsPoint& p );
1069 Q_DECL_DEPRECATED
void enableLabels(
bool on );
1074 Q_DECL_DEPRECATED
bool hasLabelsEnabled()
const;
1089 virtual bool isEditable()
const override;
1092 virtual bool isReadOnly()
const;
1095 virtual bool isModified()
const;
1103 bool snapPoint(
QgsPoint& point,
double tolerance );
1112 int snapWithContext(
const QgsPoint& startPoint,
1113 double snappingTolerance,
1118 virtual void reload()
override;
1133 Q_DECL_DEPRECATED
void drawLabels(
QgsRenderContext& rendererContext )
override;
1186 long featureCount()
const;
1191 bool setReadOnly(
bool readonly =
true );
1202 Q_DECL_DEPRECATED
bool changeAttributeValue(
QgsFeatureId fid,
int field,
const QVariant& value,
bool emitSignal );
1219 bool addAttribute(
const QgsField &field );
1222 void addAttributeAlias(
int attIndex,
const QString& aliasString );
1225 void remAttributeAlias(
int attIndex );
1243 Q_DECL_DEPRECATED
const QString editorWidgetV2(
int fieldIdx )
const {
return mEditFormConfig->widgetType( fieldIdx ); }
1303 QString attributeAlias(
int attributeIndex )
const;
1306 QString attributeDisplayName(
int attributeIndex )
const;
1317 bool deleteAttribute(
int attr );
1329 bool addFeatures(
QgsFeatureList features,
bool makeSelected =
true );
1358 bool commitChanges();
1364 bool rollBack(
bool deleteBuffer =
true );
1371 Q_DECL_DEPRECATED
EditType editType(
int idx );
1378 Q_DECL_DEPRECATED
void setEditType(
int idx,
EditType edit );
1390 Q_DECL_DEPRECATED
void setEditorLayout(
EditorLayout editorLayout ) { mEditFormConfig->setLayout( static_cast< QgsEditFormConfig::EditorLayout >( editorLayout ) ); }
1422 Q_DECL_DEPRECATED
void setEditorWidgetV2(
int attrIdx,
const QString& widgetType ) { mEditFormConfig->setWidgetType( attrIdx, widgetType ); }
1448 Q_DECL_DEPRECATED
void setCheckedState(
int idx,
const QString& checked,
const QString& notChecked );
1479 void setAnnotationForm(
const QString& ui );
1506 Q_DECL_DEPRECATED
RangeData range(
int idx );
1524 Q_DECL_DEPRECATED
QString dateFormat(
int idx );
1531 Q_DECL_DEPRECATED
QSize widgetSize(
int idx );
1538 Q_DECL_DEPRECATED
bool fieldEditable(
int idx ) {
return !mEditFormConfig->readOnly( idx ); }
1544 Q_DECL_DEPRECATED
bool labelOnTop(
int idx ) {
return mEditFormConfig->labelOnTop( idx ); }
1550 Q_DECL_DEPRECATED
void setFieldEditable(
int idx,
bool editable ) { mEditFormConfig->setReadOnly( idx, !editable ); }
1556 Q_DECL_DEPRECATED
void setLabelOnTop(
int idx,
bool onTop ) { mEditFormConfig->setLabelOnTop( idx, onTop ); }
1565 void beginEditCommand(
const QString& text );
1568 void endEditCommand();
1571 void destroyEditCommand();
1574 int fieldNameIndex(
const QString& fieldName )
const;
1588 void updateFields();
1591 void createJoinCaches();
1644 QList< double > getDoubleValues(
const QString &fieldOrExpression,
bool &ok,
bool selectedOnly =
false,
int* nullCount =
nullptr );
1647 void setFeatureBlendMode( QPainter::CompositionMode blendMode );
1649 QPainter::CompositionMode featureBlendMode()
const;
1652 void setLayerTransparency(
int layerTransparency );
1654 int layerTransparency()
const;
1727 void removeSelection();
1732 virtual void updateExtents();
1735 void checkJoinLayerRemove(
const QString& theLayerId );
1743 bool startEditing();
1747 void invalidateSymbolCountedFlag();
1761 void selectionChanged();
1764 void layerModified();
1767 void beforeModifiedCheck()
const;
1770 void beforeEditingStarted();
1773 void editingStarted();
1776 void editingStopped();
1779 void beforeCommitChanges();
1782 void beforeRollBack();
1792 void attributeAdded(
int idx );
1800 void beforeAddingExpressionField(
const QString& fieldName );
1810 void attributeDeleted(
int idx );
1818 void beforeRemovingExpressionField(
int idx );
1852 void updatedFields();
1857 void layerDeleted();
1866 void committedFeaturesRemoved(
const QString& layerId,
const QgsFeatureIds& deletedFeatureIds );
1870 void saveLayerToProject();
1876 void featureBlendModeChanged( QPainter::CompositionMode blendMode );
1879 void layerTransparencyChanged(
int layerTransparency );
1886 void editCommandStarted(
const QString& text );
1893 void editCommandEnded();
1900 void editCommandDestroyed();
1927 void raiseError(
const QString& msg );
1930 void onJoinedFieldsChanged();
1950 bool setDataProvider(
QString const & provider );
1963 void snapToGeometry(
const QgsPoint& startPoint,
1966 double sqrSnappingTolerance,
1974 void readSldLabeling(
const QDomNode& node );
2038 bool mLabelFontNotFoundNotified;
2041 QPainter::CompositionMode mFeatureBlendMode;
2044 int mLayerTransparency;
2047 bool mVertexMarkerOnlyForSelection;
2077 bool mSymbolFeatureCounted;
2083 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.
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()