Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgsgeometryanalyzer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgeometryanalyzer.h - QGIS Tools for vector geometry analysis
3  -------------------
4  begin : 19 March 2009
5  copyright : (C) Carson Farmer
6  email : carson.farmer@gmail.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 /* $Id: qgis.h 9774 2008-12-12 05:41:24Z timlinux $ */
18 
19 #ifndef QGSGEOMETRYANALYZERH
20 #define QGSGEOMETRYANALYZERH
21 
22 #include "qgsvectorlayer.h"
23 #include "qgsfield.h"
24 #include "qgsfeature.h"
25 #include "qgsgeometry.h"
26 #include "qgsfield.h"
27 #include "qgsdistancearea.h"
28 
30 class QProgressDialog;
31 
32 
37 class ANALYSIS_EXPORT QgsGeometryAnalyzer
38 {
39  public:
40 
49  bool simplify( QgsVectorLayer* layer, const QString& shapefileName, double tolerance,
50  bool onlySelectedFeatures = false, QProgressDialog* p = 0 );
51 
59  bool centroids( QgsVectorLayer* layer, const QString& shapefileName,
60  bool onlySelectedFeatures = false, QProgressDialog* p = 0 );
61 
68  bool extent( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, QProgressDialog* p = 0 );
69 
79  bool buffer( QgsVectorLayer* layer, const QString& shapefileName, double bufferDistance,
80  bool onlySelectedFeatures = false, bool dissolve = false, int bufferDistanceField = -1, QProgressDialog* p = 0 );
81 
90  bool convexHull( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false,
91  int uniqueIdField = -1, QProgressDialog* p = 0 );
92 
101  bool dissolve( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false,
102  int uniqueIdField = -1, QProgressDialog* p = 0 );
103 
104  private:
105 
106  QList<double> simpleMeasure( QgsGeometry* geometry );
107  double perimeterMeasure( QgsGeometry* geometry, QgsDistanceArea& measure );
109  void simplifyFeature( QgsFeature& f, QgsVectorFileWriter* vfw, double tolerance );
111  void centroidFeature( QgsFeature& f, QgsVectorFileWriter* vfw );
113  void bufferFeature( QgsFeature& f, int nProcessedFeatures, QgsVectorFileWriter* vfw, bool dissolve, QgsGeometry** dissolveGeometry,
114  double bufferDistance, int bufferDistanceField );
116  void convexFeature( QgsFeature& f, int nProcessedFeatures, QgsGeometry** dissolveGeometry );
118  void dissolveFeature( QgsFeature& f, int nProcessedFeatures, QgsGeometry** dissolveGeometry );
119 
120 };
121 #endif //QGSVECTORANALYZER