18 #ifndef QGSVECTORLAYER_H
19 #define QGSVECTORLAYER_H
24 #include <QStringList>
41 class QgsGeometryVertexIndex;
74 : QObject( parent ), mType( type ), mName( name ) {}
78 QString
name()
const {
return mName; }
81 virtual QDomElement toDomElement( QDomDocument& doc )
const = 0;
97 virtual QDomElement
toDomElement( QDomDocument& doc )
const;
99 QList<QgsAttributeEditorElement*>
children()
const {
return mChildren; }
114 virtual QDomElement
toDomElement( QDomDocument& doc )
const;
115 int idx()
const {
return mIdx; }
452 RangeData( QVariant theMin, QVariant theMax, QVariant theStep )
453 : mMin( theMin ), mMax( theMax ), mStep( theStep ) {}
463 ValueRelationData( QString layer, QString key, QString value,
bool allowNull,
bool orderByValue,
464 bool allowMulti =
false,
465 QString filterExpression = QString::null )
469 , mFilterExpression( filterExpression )
470 , mAllowNull( allowNull )
471 , mOrderByValue( orderByValue )
472 , mAllowMulti( allowMulti )
488 : mName( name ), mFields( fields ) {}
496 TabData( QString name , QList<QString> fields , QList<GroupData> groups )
497 : mName( name ), mFields( fields ), mGroups( groups ) {}
516 QgsVectorLayer( QString path = QString::null, QString baseName = QString::null,
517 QString providerLib = QString::null,
bool loadDefaultStyleFlag =
true );
523 QString storageType()
const;
526 QString capabilitiesString()
const;
529 QString dataComment()
const;
532 void setDisplayField( QString fldName =
"" );
535 const QString displayField()
const;
544 void setDisplayExpression(
const QString displayExpression );
554 const QString displayExpression();
565 void setProviderEncoding(
const QString& encoding );
568 void setCoordinateSystem();
577 void removeJoin(
const QString& joinLayerId );
580 const QList< QgsVectorJoinInfo >& vectorJoins()
const;
594 int selectedFeatureCount();
604 void select(
QgsRectangle & rect,
bool addToSelection );
620 void invertSelection();
694 bool hasGeometryType()
const;
700 QString providerType()
const;
705 virtual bool readXml(
const QDomNode& layer_node );
710 virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc );
720 virtual void saveStyleToDatabase( QString name, QString description,
721 bool useAsDefault, QString uiFileContent,
732 virtual int listStylesInDatabase( QStringList &ids, QStringList &names,
733 QStringList &descriptions, QString &msgError );
738 virtual QString getStyleFromDatabase( QString styleId, QString &msgError );
746 virtual QString
loadNamedStyle(
const QString theURI,
bool &theResultFlag,
bool loadFromLocalDb );
752 virtual QString
loadNamedStyle(
const QString theURI,
bool &theResultFlag );
754 virtual bool applyNamedStyle( QString namedStyle , QString errorMsg );
767 bool readSymbology(
const QDomNode& node, QString& errorMessage );
775 bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage )
const;
777 bool writeSld( QDomNode& node, QDomDocument& doc, QString& errorMessage )
const;
778 bool readSld(
const QDomNode& node, QString& errorMessage );
787 virtual long featureCount()
const;
802 bool countSymbolFeatures(
bool showProgress =
true );
811 virtual bool setSubsetString( QString subset );
817 virtual QString subsetString();
829 bool addFeature(
QgsFeature& f,
bool alsoUpdateExtent =
true );
842 bool insertVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int beforeVertex );
848 bool moveVertex(
double x,
double y,
QgsFeatureId atFeatureId,
int atVertex );
852 bool deleteVertex(
QgsFeatureId atFeatureId,
int atVertex );
857 bool deleteSelectedFeatures();
868 int addRing(
const QList<QgsPoint>& ring );
880 int addPart(
const QList<QgsPoint>& ring );
887 int translateFeature(
QgsFeatureId featureId,
double dx,
double dy );
896 int splitFeatures(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
920 int addTopologicalPoints(
const QgsPoint& p );
927 int insertSegmentVerticesForSnap(
const QList<QgsSnappingResult>& snapResults );
930 void enableLabels(
bool on );
933 bool hasLabelsEnabled()
const;
941 virtual bool isReadOnly()
const;
944 virtual bool isModified()
const;
952 bool snapPoint(
QgsPoint& point,
double tolerance );
961 int snapWithContext(
const QgsPoint& startPoint,
962 double snappingTolerance,
963 QMultiMap < double, QgsSnappingResult > &snappingResults,
993 int pendingFeatureCount();
999 bool setReadOnly(
bool readonly =
true );
1002 bool startEditing();
1009 bool changeAttributeValue(
QgsFeatureId fid,
int field, QVariant value,
bool emitSignal =
true );
1014 bool addAttribute(
const QgsField &field );
1018 void addAttributeAlias(
int attIndex, QString aliasString );
1026 QList< QgsAttributeEditorElement* > &attributeEditorElements();
1029 void clearAttributeEditorWidgets();
1033 QString attributeAlias(
int attributeIndex )
const;
1037 QString attributeDisplayName(
int attributeIndex )
const;
1048 bool deleteAttribute(
int attr );
1057 bool deleteAttributes( QList<int> attrs );
1060 bool addFeatures(
QgsFeatureList features,
bool makeSelected =
true );
1080 bool commitChanges();
1081 const QStringList &commitErrors();
1086 bool rollBack(
bool deleteBuffer =
true );
1089 EditType editType(
int idx );
1092 void setEditType(
int idx, EditType edit );
1095 EditorLayout editorLayout();
1098 void setEditorLayout( EditorLayout editorLayout );
1101 void setCheckedState(
int idx, QString checked, QString notChecked );
1107 QPair<QString, QString> checkedState(
int idx );
1113 void setEditForm( QString ui );
1119 void setAnnotationForm(
const QString& ui );
1122 QString editFormInit();
1125 void setEditFormInit( QString
function );
1128 QMap<QString, QVariant> &valueMap(
int idx );
1131 RangeData &range(
int idx );
1136 ValueRelationData &valueRelation(
int idx );
1141 QString &dateFormat(
int idx );
1146 QSize &widgetSize(
int idx );
1151 bool fieldEditable(
int idx );
1156 bool labelOnTop(
int idx );
1161 void setFieldEditable(
int idx,
bool editable );
1166 void setLabelOnTop(
int idx,
bool onTop );
1175 void beginEditCommand( QString text );
1178 void endEditCommand();
1181 void destroyEditCommand();
1186 int fieldNameIndex(
const QString& fieldName )
const;
1203 void updateFields();
1207 void createJoinCaches();
1214 void uniqueValues(
int index, QList<QVariant> &uniqueValues,
int limit = -1 );
1218 QVariant minimumValue(
int index );
1222 QVariant maximumValue(
int index );
1227 void setFeatureBlendMode(
const QPainter::CompositionMode blendMode );
1231 QPainter::CompositionMode featureBlendMode()
const;
1236 void setLayerTransparency(
int layerTransparency );
1240 int layerTransparency()
const;
1284 void removeSelection();
1286 void triggerRepaint();
1291 virtual void updateExtents();
1295 void checkJoinLayerRemove( QString theLayerId );
1309 void invalidateSymbolCountedFlag();
1323 void selectionChanged();
1326 void layerModified();
1329 void editingStarted();
1332 void editingStopped();
1335 void beforeCommitChanges();
1338 void beforeRollBack();
1348 void attributeAdded(
int idx );
1357 void attributeDeleted(
int idx );
1366 void updatedFields();
1367 void layerDeleted();
1369 void attributeValueChanged(
QgsFeatureId fid,
int idx,
const QVariant & );
1374 void committedAttributesDeleted(
const QString& layerId,
const QgsAttributeList& deletedAttributes );
1375 void committedAttributesAdded(
const QString& layerId,
const QList<QgsField>& addedAttributes );
1376 void committedFeaturesAdded(
const QString& layerId,
const QgsFeatureList& addedFeatures );
1377 void committedFeaturesRemoved(
const QString& layerId,
const QgsFeatureIds& deletedFeatureIds );
1378 void committedAttributeValuesChanges(
const QString& layerId,
const QgsChangedAttributesMap& changedAttributesValues );
1379 void committedGeometriesChanges(
const QString& layerId,
const QgsGeometryMap& changedGeometries );
1384 void labelingFontNotFound(
QgsVectorLayer* layer,
const QString& fontfamily );
1402 bool setDataProvider( QString
const & provider );
1415 void snapToGeometry(
const QgsPoint& startPoint,
1418 double sqrSnappingTolerance,
1419 QMultiMap<double, QgsSnappingResult>& snappingResults,
1426 static int currentVertexMarkerSize();