19 #ifndef QGSVECTORLAYER_H
20 #define QGSVECTORLAYER_H
25 #include <QStringList>
54 class QgsGeometryVertexIndex;
103 :
QObject( parent ), mType( type ), mName( name ) {}
151 , mIsGroupBox( true )
247 int idx()
const {
return mIdx; }
270 , mRelationId( relationId ) {}
281 , mRelationId( relation.id() )
282 , mRelation( relation ) {}
682 : mMin( theMin ), mMax( theMax ), mStep( theStep ) {}
693 bool allowMulti =
false,
694 const QString& filterExpression = QString::null )
698 , mFilterExpression( filterExpression )
699 , mAllowNull( allowNull )
700 , mOrderByValue( orderByValue )
701 , mAllowMulti( allowMulti )
717 : mName( name ), mFields( fields ) {}
726 : mName( name ), mFields( fields ), mGroups( groups ) {}
746 const QString& providerLib = QString::null,
bool loadDefaultStyleFlag =
true );
755 QString capabilitiesString()
const;
761 void setDisplayField(
const QString& fldName =
"" );
764 const QString displayField()
const;
772 void setDisplayExpression(
const QString &displayExpression );
780 const QString displayExpression();
791 void setProviderEncoding(
const QString& encoding );
794 void setCoordinateSystem();
802 void removeJoin(
const QString& joinLayerId );
825 void removeExpressionField(
int index );
847 void updateExpressionField(
int index,
const QString& exp );
861 int selectedFeatureCount();
871 void select(
QgsRectangle & rect,
bool addToSelection );
887 void invertSelection();
951 bool labelsEnabled()
const;
957 bool diagramsEnabled()
const;
979 bool hasGeometryType()
const;
1005 virtual void saveStyleToDatabase(
const QString& name,
const QString& description,
1006 bool useAsDefault,
const QString& uiFileContent,
1049 virtual bool applyNamedStyle(
const QString& namedStyle,
QString &errorMsg );
1093 void setDataSource(
const QString& dataSource,
const QString& baseName,
const QString& provider,
bool loadDefaultStyleFlag =
false );
1100 bool countSymbolFeatures(
bool showProgress =
true );
1109 virtual bool setSubsetString(
const QString& subset );
1115 virtual QString subsetString();
1127 bool addFeature(
QgsFeature& f,
bool alsoUpdateExtent =
true );
1141 bool insertVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int beforeVertex );
1147 bool moveVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int atVertex );
1157 bool deleteVertex(
QgsFeatureId atFeatureId,
int atVertex );
1162 bool deleteSelectedFeatures(
int *deletedCount = 0 );
1206 int translateFeature(
QgsFeatureId featureId,
double dx,
double dy );
1215 int splitParts(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
1224 int splitFeatures(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
1241 int addTopologicalPoints(
const QgsGeometry* geom );
1250 int addTopologicalPoints(
const QgsPoint& p );
1262 Q_DECL_DEPRECATED
void enableLabels(
bool on );
1267 Q_DECL_DEPRECATED
bool hasLabelsEnabled()
const;
1283 virtual bool isReadOnly()
const;
1286 virtual bool isModified()
const;
1294 bool snapPoint(
QgsPoint& point,
double tolerance );
1303 int snapWithContext(
const QgsPoint& startPoint,
1304 double snappingTolerance,
1309 virtual void reload()
override;
1377 long featureCount()
const;
1382 bool setReadOnly(
bool readonly =
true );
1390 bool startEditing();
1401 Q_DECL_DEPRECATED
bool changeAttributeValue(
QgsFeatureId fid,
int field,
const QVariant& value,
bool emitSignal );
1417 bool addAttribute(
const QgsField &field );
1420 void addAttributeAlias(
int attIndex,
const QString& aliasString );
1423 void remAttributeAlias(
int attIndex );
1437 const QString editorWidgetV2(
int fieldIdx )
const;
1477 void clearAttributeEditorWidgets();
1480 QString attributeAlias(
int attributeIndex )
const;
1483 QString attributeDisplayName(
int attributeIndex )
const;
1494 bool deleteAttribute(
int attr );
1506 bool addFeatures(
QgsFeatureList features,
bool makeSelected =
true );
1526 bool commitChanges();
1532 bool rollBack(
bool deleteBuffer =
true );
1539 Q_DECL_DEPRECATED EditType editType(
int idx );
1546 Q_DECL_DEPRECATED
void setEditType(
int idx, EditType edit );
1549 EditorLayout editorLayout();
1552 void setEditorLayout( EditorLayout editorLayout );
1582 void setEditorWidgetV2(
int attrIdx,
const QString& widgetType );
1606 Q_DECL_DEPRECATED
void setCheckedState(
int idx,
const QString& checked,
const QString& notChecked );
1612 void setEditForm(
const QString& ui );
1626 void setAnnotationForm(
const QString& ui );
1632 void setEditFormInit(
const QString&
function );
1645 Q_DECL_DEPRECATED RangeData range(
int idx );
1648 ValueRelationData valueRelation(
int idx );
1663 Q_DECL_DEPRECATED
QString dateFormat(
int idx );
1670 Q_DECL_DEPRECATED
QSize widgetSize(
int idx );
1673 bool fieldEditable(
int idx );
1676 bool labelOnTop(
int idx );
1679 void setFieldEditable(
int idx,
bool editable );
1682 void setLabelOnTop(
int idx,
bool onTop );
1691 void beginEditCommand(
const QString& text );
1694 void endEditCommand();
1697 void destroyEditCommand();
1700 int fieldNameIndex(
const QString& fieldName )
const;
1714 void updateFields();
1717 void createJoinCaches();
1751 QList< double > getDoubleValues(
const QString &fieldOrExpression,
bool &ok,
bool selectedOnly =
false,
int* nullCount = 0 );
1754 void setFeatureBlendMode(
const QPainter::CompositionMode &blendMode );
1756 QPainter::CompositionMode featureBlendMode()
const;
1759 void setLayerTransparency(
int layerTransparency );
1761 int layerTransparency()
const;
1834 void removeSelection();
1839 virtual void updateExtents();
1842 void checkJoinLayerRemove(
const QString& theLayerId );
1845 void invalidateSymbolCountedFlag();
1859 void selectionChanged();
1862 void layerModified();
1865 void beforeModifiedCheck()
const;
1868 void editingStarted();
1871 void editingStopped();
1874 void beforeCommitChanges();
1877 void beforeRollBack();
1887 void attributeAdded(
int idx );
1894 void beforeAddingExpressionField(
QString fieldName );
1903 void attributeDeleted(
int idx );
1910 void beforeRemovingExpressionField(
int idx );
1941 void updatedFields();
1942 void layerDeleted();
1951 void committedFeaturesRemoved(
const QString& layerId,
const QgsFeatureIds& deletedFeatureIds );
1955 void saveLayerToProject();
1961 void featureBlendModeChanged(
const QPainter::CompositionMode &blendMode );
1964 void layerTransparencyChanged(
int layerTransparency );
1971 void editCommandStarted(
const QString& text );
1978 void editCommandEnded();
1985 void editCommandDestroyed();
2011 void onRelationsLoaded();
2012 void onJoinedFieldsChanged();
2032 bool setDataProvider(
QString const & provider );
2045 void snapToGeometry(
const QgsPoint& startPoint,
2048 double sqrSnappingTolerance,
2056 void readSldLabeling(
const QDomNode& node );
2122 bool mLabelFontNotFoundNotified;
2125 QPainter::CompositionMode mFeatureBlendMode;
2128 int mLayerTransparency;
2131 bool mVertexMarkerOnlyForSelection;
2142 EditorLayout mEditorLayout;
2144 QString mEditForm, mEditFormInit;
2176 bool mSymbolFeatureCounted;
2182 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.
QgsAttributeEditorRelation(const QString &name, const QString &relationId, QObject *parent)
Creates a new element which embeds a relation.
QgsAttributeList attributeList() const
Returns list of attribute indexes.
virtual ~QgsAttributeEditorContainer()
Destructor.
QString joinFieldName
Join field in the source layer.
const QSet< QString > & excludeAttributesWMS() const
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.
QgsAttributeEditorRelation(const QString &name, const QgsRelation &relation, QObject *parent)
Creates a new element which embeds a relation.
virtual bool isGroupBox() const
Returns if this ccontainer is going to be rendered as a group box.
QgsAttributeAction * actions()
ValueRelationData(const QString &layer, const QString &key, const QString &value, bool allowNull, bool orderByValue, bool allowMulti=false, const QString &filterExpression=QString::null)
GroupData(const QString &name, const QList< QString > &fields)
QSet< QgsFeatureId > QgsFeatureIds
QgsFields fields() const
Returns the list of fields of this layer.
EditorLayout
The different types to layout the attribute editor.
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.
QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const
Type of feature form pop-up suppression after feature creation (overrides app setting) ...
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.
This element will load a field's widget onto the form.
virtual ~QgsAttributeEditorElement()
Destructor.
This element will load a relation editor onto the 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.
const QgsRelation & relation() const
Get the id of the relation which shall be embedded.
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...
const QgsDiagramLayerSettings * diagramLayerSettings() const
RangeData(const QVariant &theMin, const QVariant &theMax, const QVariant &theStep)
int idx() const
Return the index of the field.
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.
QString name() const
Return the name of this element.
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.
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
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
VertexMarkerType
Editing vertex markers.
virtual void setExtent(const QgsRectangle &rect)
Set the extent.
The attribute value should not be changed in the attribute form.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
AttributeEditorType type() const
The type of this element.
QgsAttributeEditorField(const QString &name, int idx, QObject *parent)
Creates a new attribute editor element which represents a field.
QSharedPointer< QStringList > joinFieldsSubset
Subset of fields to use from joined layer.
virtual ~QgsAttributeEditorField()
Destructor.
Encapsulate a field in an attribute table or data source.
const QgsFeatureRendererV2 * rendererV2() const
Return const renderer V2.
QgsAttributeEditorContainer(const QString &name, QObject *parent)
Creates a new attribute editor container.
const QMap< QString, QString > & attributeAliases() const
const QgsDiagramRendererV2 * diagramRenderer() const
A class to represent a point.
virtual bool readSld(const QDomNode &node, QString &errorMessage)
void setName(const char *name)
virtual ~QgsAttributeEditorRelation()
Destructor.
QgsAttributeList pendingAllAttributesList() const
Returns list of attribute indexes.
QList< QgsAttributeEditorElement * > children() const
Get a list of the children elements of this container.
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.
virtual QDomElement toDomElement(QDomDocument &doc) const =0
Is reimplemented in classes inheriting from this to serialize it.
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.
virtual void setIsGroupBox(bool isGroupBox)
Determines if this container is rendered as collapsible group box or tab in a tabwidget.
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...
Abstract base class - its implementations define different approaches to the labeling of a vector lay...
QString mFilterExpression
uuid generator - readonly and automatically intialized
This is a container for attribute editors, used to group them visually in the attribute form if it is...
void setSimplifyMethod(const QgsVectorSimplifyMethod &simplifyMethod)
Set the simplification settings for fast rendering of features.
Base class for utility classes that encapsulate information necessary for rendering of map layers...
void setFeatureFormSuppress(QgsVectorLayer::FeatureFormSuppress s)
Set type of feature form pop-up suppression after feature creation (overrides app setting) ...
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
QgsAttributeEditorElement(AttributeEditorType type, const QString &name, QObject *parent=NULL)
Constructor.
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.
AttributeEditorType mType
Abstract base class for simplify geometries using a specific algorithm.
TabData(const QString &name, const QList< QString > &fields, const QList< GroupData > &groups)
QList< GroupData > mGroups