00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef QGSGEOMETRYANALYZERH
00020 #define QGSGEOMETRYANALYZERH
00021
00022 #include "qgsvectorlayer.h"
00023 #include "qgsfield.h"
00024 #include "qgsfeature.h"
00025 #include "qgsgeometry.h"
00026 #include "qgsfield.h"
00027 #include "qgsdistancearea.h"
00028
00029 class QgsVectorFileWriter;
00030 class QProgressDialog;
00031
00032
00037 class ANALYSIS_EXPORT QgsGeometryAnalyzer
00038 {
00039 public:
00040
00049 bool simplify( QgsVectorLayer* layer, const QString& shapefileName, double tolerance,
00050 bool onlySelectedFeatures = false, QProgressDialog* p = 0 );
00051
00059 bool centroids( QgsVectorLayer* layer, const QString& shapefileName,
00060 bool onlySelectedFeatures = false, QProgressDialog* p = 0 );
00061
00068 bool extent( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, QProgressDialog* p = 0 );
00069
00079 bool buffer( QgsVectorLayer* layer, const QString& shapefileName, double bufferDistance,
00080 bool onlySelectedFeatures = false, bool dissolve = false, int bufferDistanceField = -1, QProgressDialog* p = 0 );
00081
00090 bool convexHull( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false,
00091 int uniqueIdField = -1, QProgressDialog* p = 0 );
00092
00101 bool dissolve( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false,
00102 int uniqueIdField = -1, QProgressDialog* p = 0 );
00103
00104 private:
00105
00106 QList<double> simpleMeasure( QgsGeometry* geometry );
00107 double perimeterMeasure( QgsGeometry* geometry, QgsDistanceArea& measure );
00109 void simplifyFeature( QgsFeature& f, QgsVectorFileWriter* vfw, double tolerance );
00111 void centroidFeature( QgsFeature& f, QgsVectorFileWriter* vfw );
00113 void bufferFeature( QgsFeature& f, int nProcessedFeatures, QgsVectorFileWriter* vfw, bool dissolve, QgsGeometry** dissolveGeometry,
00114 double bufferDistance, int bufferDistanceField );
00116 void convexFeature( QgsFeature& f, int nProcessedFeatures, QgsGeometry** dissolveGeometry );
00118 void dissolveFeature( QgsFeature& f, int nProcessedFeatures, QgsGeometry** dissolveGeometry );
00119
00120 };
00121 #endif //QGSVECTORANALYZER