19 #ifndef QGSVECTORLAYER_H
20 #define QGSVECTORLAYER_H
25 #include <QStringList>
51 class QgsGeometryVertexIndex;
97 :
QObject( parent ), mType( type ), mName( name ) {}
145 , mIsGroupBox( true )
241 int idx()
const {
return mIdx; }
264 , mRelationId( relationId ) {}
275 , mRelationId( relation.id() )
276 , mRelation( relation ) {}
674 : mMin( theMin ), mMax( theMax ), mStep( theStep ) {}
685 bool allowMulti =
false,
686 QString filterExpression = QString::null )
690 , mFilterExpression( filterExpression )
691 , mAllowNull( allowNull )
692 , mOrderByValue( orderByValue )
693 , mAllowMulti( allowMulti )
709 : mName( name ), mFields( fields ) {}
718 : mName( name ), mFields( fields ), mGroups( groups ) {}
738 QString providerLib = QString::null,
bool loadDefaultStyleFlag =
true );
747 QString capabilitiesString()
const;
753 void setDisplayField(
QString fldName =
"" );
756 const QString displayField()
const;
764 void setDisplayExpression(
const QString &displayExpression );
772 const QString displayExpression();
783 void setProviderEncoding(
const QString& encoding );
786 void setCoordinateSystem();
794 void removeJoin(
const QString& joinLayerId );
817 void removeExpressionField(
int index );
839 void updateExpressionField(
int index,
const QString& exp );
853 int selectedFeatureCount();
863 void select(
QgsRectangle & rect,
bool addToSelection );
879 void invertSelection();
943 bool labelsEnabled()
const;
949 bool diagramsEnabled()
const;
967 bool hasGeometryType()
const;
993 virtual void saveStyleToDatabase(
QString name,
QString description,
994 bool useAsDefault,
QString uiFileContent,
1037 virtual bool applyNamedStyle(
QString namedStyle,
QString &errorMsg );
1070 virtual long featureCount()
const;
1090 void setDataSource(
QString dataSource,
QString baseName,
QString provider,
bool loadDefaultStyleFlag =
false );
1097 bool countSymbolFeatures(
bool showProgress =
true );
1106 virtual bool setSubsetString(
QString subset );
1112 virtual QString subsetString();
1124 bool addFeature(
QgsFeature& f,
bool alsoUpdateExtent =
true );
1138 bool insertVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int beforeVertex );
1144 bool moveVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int atVertex );
1148 bool deleteVertex(
QgsFeatureId atFeatureId,
int atVertex );
1153 bool deleteSelectedFeatures(
int *deletedCount = 0 );
1183 int translateFeature(
QgsFeatureId featureId,
double dx,
double dy );
1192 int splitParts(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
1201 int splitFeatures(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
1218 int addTopologicalPoints(
const QgsGeometry* geom );
1227 int addTopologicalPoints(
const QgsPoint& p );
1239 Q_DECL_DEPRECATED
void enableLabels(
bool on );
1244 Q_DECL_DEPRECATED
bool hasLabelsEnabled()
const;
1250 virtual bool isReadOnly()
const;
1253 virtual bool isModified()
const;
1261 bool snapPoint(
QgsPoint& point,
double tolerance );
1270 int snapWithContext(
const QgsPoint& startPoint,
1271 double snappingTolerance,
1276 virtual void reload()
override;
1306 int pendingFeatureCount();
1311 bool setReadOnly(
bool readonly =
true );
1314 bool startEditing();
1325 Q_DECL_DEPRECATED
bool changeAttributeValue(
QgsFeatureId fid,
int field,
QVariant value,
bool emitSignal );
1341 bool addAttribute(
const QgsField &field );
1344 void addAttributeAlias(
int attIndex,
QString aliasString );
1347 void remAttributeAlias(
int attIndex );
1361 const QString editorWidgetV2(
int fieldIdx )
const;
1401 void clearAttributeEditorWidgets();
1404 QString attributeAlias(
int attributeIndex )
const;
1407 QString attributeDisplayName(
int attributeIndex )
const;
1418 bool deleteAttribute(
int attr );
1430 bool addFeatures(
QgsFeatureList features,
bool makeSelected =
true );
1450 bool commitChanges();
1456 bool rollBack(
bool deleteBuffer =
true );
1463 Q_DECL_DEPRECATED EditType editType(
int idx );
1470 Q_DECL_DEPRECATED
void setEditType(
int idx, EditType edit );
1473 EditorLayout editorLayout();
1476 void setEditorLayout( EditorLayout editorLayout );
1506 void setEditorWidgetV2(
int attrIdx,
const QString& widgetType );
1530 Q_DECL_DEPRECATED
void setCheckedState(
int idx,
QString checked,
QString notChecked );
1536 void setEditForm(
QString ui );
1550 void setAnnotationForm(
const QString& ui );
1556 void setEditFormInit(
QString function );
1569 Q_DECL_DEPRECATED RangeData range(
int idx );
1572 ValueRelationData valueRelation(
int idx );
1587 Q_DECL_DEPRECATED
QString dateFormat(
int idx );
1594 Q_DECL_DEPRECATED
QSize widgetSize(
int idx );
1597 bool fieldEditable(
int idx );
1600 bool labelOnTop(
int idx );
1603 void setFieldEditable(
int idx,
bool editable );
1606 void setLabelOnTop(
int idx,
bool onTop );
1615 void beginEditCommand(
QString text );
1618 void endEditCommand();
1621 void destroyEditCommand();
1624 int fieldNameIndex(
const QString& fieldName )
const;
1638 void updateFields();
1641 void createJoinCaches();
1675 QList< double > getDoubleValues(
const QString &fieldOrExpression,
bool &ok,
bool selectedOnly =
false,
int* nullCount = 0 );
1678 void setFeatureBlendMode(
const QPainter::CompositionMode &blendMode );
1680 QPainter::CompositionMode featureBlendMode()
const;
1683 void setLayerTransparency(
int layerTransparency );
1685 int layerTransparency()
const;
1749 void removeSelection();
1754 virtual void updateExtents();
1757 void checkJoinLayerRemove(
QString theLayerId );
1760 void invalidateSymbolCountedFlag();
1774 void selectionChanged();
1777 void layerModified();
1780 void beforeModifiedCheck()
const;
1783 void editingStarted();
1786 void editingStopped();
1789 void beforeCommitChanges();
1792 void beforeRollBack();
1802 void attributeAdded(
int idx );
1811 void attributeDeleted(
int idx );
1841 void updatedFields();
1842 void layerDeleted();
1851 void committedFeaturesRemoved(
const QString& layerId,
const QgsFeatureIds& deletedFeatureIds );
1855 void saveLayerToProject();
1861 void featureBlendModeChanged(
const QPainter::CompositionMode &blendMode );
1864 void layerTransparencyChanged(
int layerTransparency );
1871 void editCommandStarted(
const QString& text );
1878 void editCommandEnded();
1885 void editCommandDestroyed();
1910 void onRelationsLoaded();
1911 void onJoinedFieldsChanged();
1931 bool setDataProvider(
QString const & provider );
1944 void snapToGeometry(
const QgsPoint& startPoint,
1947 double sqrSnappingTolerance,
1955 void readSldLabeling(
const QDomNode& node );
2016 bool mLabelFontNotFoundNotified;
2019 QPainter::CompositionMode mFeatureBlendMode;
2022 int mLayerTransparency;
2025 bool mVertexMarkerOnlyForSelection;
2036 EditorLayout mEditorLayout;
2038 QString mEditForm, mEditFormInit;
2070 bool mSymbolFeatureCounted;
2076 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.
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.
virtual bool isGroupBox() const
Returns if this ccontainer is going to be rendered as a group box.
RangeData(QVariant theMin, QVariant theMax, QVariant theStep)
QgsAttributeAction * actions()
EditorLayout
The different types to layout the attribute editor.
The attribute value should not be changed in the attribute form.
QSet< QgsFeatureId > QgsFeatureIds
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.
virtual void reload()
Synchronises with changes in the datasource.
VertexMarkerType
Editing vertex markers.
QgsVectorLayer::FeatureFormSuppress featureFormSuppress() const
Type of feature form pop-up suppression after feature creation (overrides app setting) ...
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.
WkbType
Used for symbology operations.
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...
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
QgsAttributeEditorField(QString name, int idx, QObject *parent)
Creates a new attribute editor element which represents a field.
int idx() const
Return the index of the field.
TabData(QString name, QList< QString > fields, QList< GroupData > groups)
virtual bool writeSymbology(QDomNode &node, QDomDocument &doc, QString &errorMessage) const =0
Write the symbology for the layer into the docment provided.
QgsGeometryCache * cache()
QgsAttributeEditorRelation(QString name, const QString &relationId, QObject *parent)
Creates a new element which embeds a relation.
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.
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...
The attribute value should not be shown in the attribute form.
const QSet< QString > & excludeAttributesWFS() const
virtual void setExtent(const QgsRectangle &rect)
Set the extent.
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.
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 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.
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.
uuid generator - readonly and automatically intialized
This class contains information how to simplify geometries fetched from a vector layer.
Contains information about the context of a rendering operation.
ValueRelationData(QString layer, QString key, QString value, bool allowNull, bool orderByValue, bool allowMulti=false, QString filterExpression=QString::null)
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) ...
GroupData(QString name, QList< QString > fields)
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.
virtual bool readXml(const QDomNode &layer_node)
called by readLayerXML(), used by children to read state specific to them from project files...
QString mFilterExpression
QgsAttributeEditorRelation(QString name, const QgsRelation &relation, QObject *parent)
Creates a new element which embeds a relation.
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 ...
QgsAttributeEditorElement(AttributeEditorType type, QString name, QObject *parent=NULL)
Constructor.
QSet< int > QgsAttributeIds
QgsAttributeEditorContainer(QString name, QObject *parent)
Creates a new attribute editor container.
FeatureFormSuppress
Types of feature form suppression after feature creation.
This is the base class for vector data providers.
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.
QList< GroupData > mGroups