Quantum GIS API Documentation
1.7.4
|
00001 /*************************************************************************** 00002 qgsgeometryanalyzer.h - QGIS Tools for vector geometry analysis 00003 ------------------- 00004 begin : 19 March 2009 00005 copyright : (C) Carson Farmer 00006 email : carson.farmer@gmail.com 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 /* $Id: qgis.h 9774 2008-12-12 05:41:24Z timlinux $ */ 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