19 #ifndef QGSVECTORLAYER_H
20 #define QGSVECTORLAYER_H
25 #include <QStringList>
39 class QgsGeometryVertexIndex;
114 RangeData( QVariant theMin, QVariant theMax, QVariant theStep )
115 : mMin( theMin ), mMax( theMax ), mStep( theStep ) {}
123 QgsVectorLayer( QString path = QString::null, QString baseName = QString::null,
124 QString providerLib = QString::null,
bool loadDefaultStyleFlag =
true );
130 QString storageType()
const;
133 QString capabilitiesString()
const;
136 QString dataComment()
const;
139 void setDisplayField( QString fldName =
"" );
142 const QString displayField()
const;
151 void setProviderEncoding(
const QString& encoding );
154 void setCoordinateSystem();
163 void removeJoin(
const QString& joinLayerId );
166 const QList< QgsVectorJoinInfo >& vectorJoins()
const;
176 int selectedFeatureCount();
182 void invertSelection();
228 bool isUsingRendererV2();
232 void setUsingRendererV2(
bool usingRendererV2 );
242 void drawRendererV2Levels(
QgsRenderContext& rendererContext,
bool labeling );
249 bool hasGeometryType()
const;
255 QString providerType()
const;
260 virtual bool readXml( QDomNode & layer_node );
265 virtual bool writeXml( QDomNode & layer_node, QDomDocument & doc );
272 bool readSymbology(
const QDomNode& node, QString& errorMessage );
280 bool writeSymbology( QDomNode& node, QDomDocument& doc, QString& errorMessage )
const;
290 virtual long featureCount()
const;
295 virtual long updateFeatureCount()
const;
304 virtual bool setSubsetString( QString subset );
310 virtual QString subsetString();
321 bool fetchGeometry =
true,
322 bool useIntersect =
false );
333 bool featureAtId(
int featureId,
QgsFeature &f,
bool fetchGeometries =
true,
bool fetchAttributes =
true );
340 bool addFeature(
QgsFeature& f,
bool alsoUpdateExtent =
true );
347 bool insertVertex(
double x,
double y,
int atFeatureId,
int beforeVertex );
353 bool moveVertex(
double x,
double y,
int atFeatureId,
int atVertex );
357 bool deleteVertex(
int atFeatureId,
int atVertex );
362 bool deleteSelectedFeatures();
372 int addRing(
const QList<QgsPoint>& ring );
383 int addIsland(
const QList<QgsPoint>& ring );
390 int translateFeature(
int featureId,
double dx,
double dy );
396 int splitFeatures(
const QList<QgsPoint>& splitLine,
bool topologicalEditing =
false );
402 int removePolygonIntersections(
QgsGeometry* geom );
418 int addTopologicalPoints(
const QgsPoint& p );
424 int insertSegmentVerticesForSnap(
const QList<QgsSnappingResult>& snapResults );
427 void enableLabels(
bool on );
430 bool hasLabelsEnabled(
void )
const;
437 virtual bool isReadOnly()
const;
440 virtual bool isModified()
const;
447 bool snapPoint(
QgsPoint& point,
double tolerance );
456 int snapWithContext(
const QgsPoint& startPoint,
457 double snappingTolerance,
481 int pendingFeatureCount();
487 bool setReadOnly(
bool readonly =
true );
490 void setModified(
bool modified =
true,
bool onlyGeometryWasModified =
false );
500 bool changeAttributeValue(
int fid,
int field, QVariant value,
bool emitSignal =
true );
505 bool addAttribute(
const QgsField &field );
510 Q_DECL_DEPRECATED
bool addAttribute( QString name, QString type );
514 void addAttributeAlias(
int attIndex, QString aliasString );
518 QString attributeAlias(
int attributeIndex )
const;
522 QString attributeDisplayName(
int attributeIndex )
const;
525 bool deleteAttribute(
int attr );
528 bool addFeatures(
QgsFeatureList features,
bool makeSelected =
true );
531 bool deleteFeature(
int fid );
548 bool commitChanges();
549 const QStringList &commitErrors();
555 EditType editType(
int idx );
558 void setEditType(
int idx, EditType edit );
561 void setCheckedState(
int idx, QString checked, QString notChecked );
564 QPair<QString, QString> checkedState(
int idx );
570 void setEditForm( QString ui );
576 void setAnnotationForm(
const QString& ui );
579 QString editFormInit();
582 void setEditFormInit( QString
function );
585 QMap<QString, QVariant> &valueMap(
int idx );
588 RangeData &range(
int idx );
598 void removeOverlay(
const QString& typeName );
603 void vectorOverlays( QList<QgsVectorOverlay*>& overlayList );
615 void beginEditCommand( QString text );
618 void endEditCommand();
621 void destroyEditCommand();
632 int fieldNameIndex(
const QString& fieldName )
const;
649 void updateFieldMap();
653 void createJoinCaches();
660 void uniqueValues(
int index, QList<QVariant> &uniqueValues,
int limit = -1 );
664 QVariant minimumValue(
int index );
668 QVariant maximumValue(
int index );
672 void select(
int featureId,
bool emitSignal =
true );
675 void deselect(
int featureId,
bool emitSignal =
true );
678 void removeSelection(
bool emitSignal =
true );
680 void triggerRepaint();
685 virtual void updateExtents();
689 void checkJoinLayerRemove( QString theLayerId );
694 void selectionChanged();
697 void layerModified(
bool onlyGeometry );
699 void editingStarted();
700 void editingStopped();
701 void attributeAdded(
int idx );
702 void attributeDeleted(
int idx );
703 void featureAdded(
int fid );
704 void featureDeleted(
int fid );
707 void attributeValueChanged(
int fid,
int idx,
const QVariant & );
711 void committedAttributesDeleted(
const QString& layerId,
const QgsAttributeIds& deletedAttributeIds );
712 void committedAttributesAdded(
const QString& layerId,
const QList<QgsField>& addedAttributes );
713 void committedFeaturesAdded(
const QString& layerId,
const QgsFeatureList& addedFeatures );
714 void committedFeaturesRemoved(
const QString& layerId,
const QgsFeatureIds& deletedFeatureIds );
715 void committedAttributeValuesChanges(
const QString& layerId,
const QgsChangedAttributesMap& changedAttributesValues );
716 void committedGeometriesChanges(
const QString& layerId,
const QgsGeometryMap& changedGeometries );
730 bool setDataProvider( QString
const & provider );
739 void transformPoint(
double& x,
double& y,
742 void transformPoints( std::vector<double>& x, std::vector<double>& y, std::vector<double>& z,
QgsRenderContext &renderContext );
747 unsigned char *drawLineString(
unsigned char *WKBlinestring,
QgsRenderContext &renderContext );
752 unsigned char *drawPolygon(
unsigned char *WKBpolygon,
QgsRenderContext &renderContext );
758 void deleteCachedGeometries();
768 void snapToGeometry(
const QgsPoint& startPoint,
int featureId,
QgsGeometry* geom,
double sqrSnappingTolerance,
773 int boundingBoxFromPointList(
const QList<QgsPoint>& list,
double& xmin,
double& ymin,
double& xmax,
double& ymax )
const;
779 static int currentVertexMarkerSize();
782 void updateFeatureAttributes(
QgsFeature &f,
bool all =
false );
791 void addJoinedFeatureAttributes(
QgsFeature& f,
const QgsVectorJoinInfo& joinInfo,
const QString& joinFieldName,
const QVariant& joinValue,
798 void editGeometryChange(
int featureId,
QgsGeometry& geometry );
804 void editFeatureDelete(
int featureId );
807 void editAttributeChange(
int featureId,
int field, QVariant value );
813 void updateAttributeMapIndex(
QgsAttributeMap& map,
int oldIndex,
int newIndex )
const;