-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add new functions to analysis library, also adds python bindings to a…
…nalysis library git-svn-id: http://svn.osgeo.org/qgis/trunk@11976 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
cfarmer
committed
Nov 7, 2009
1 parent
e4f8edd
commit 4a7839c
Showing
7 changed files
with
673 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
%Module qgis.analysis 0 | ||
|
||
%Import QtCore/QtCoremod.sip | ||
%Import QtGui/QtGuimod.sip | ||
%Import QtXml/QtXmlmod.sip | ||
|
||
%Import core/core.sip | ||
|
||
%Include qgsgeometryanalyzer.sip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/** \ingroup analysis | ||
* The QGis class provides vector geometry analysis functions | ||
*/ | ||
|
||
class QgsGeometryAnalyzer | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsgeometryanalyzer.h> | ||
%End | ||
|
||
public: | ||
|
||
/** | ||
* Simplify vector layer using (a modified) Douglas-Peucker algorithm | ||
* and write it to a new shape file | ||
*/ | ||
bool simplify( QgsVectorLayer* layer, const QString& shapefileName, double tolerance, | ||
bool onlySelectedFeatures = false ); | ||
|
||
/**Calculate the true centroids, or 'center of mass' for a vector layer and | ||
write it to a new shape file | ||
*/ | ||
bool centroids( QgsVectorLayer* layer, const QString& shapefileName, | ||
bool onlySelectedFeatures = false ); | ||
|
||
/**Create a polygon based on the extent of all (selected) features and write it to a new shape file | ||
*/ | ||
bool extent( QgsVectorLayer* layer, const QString& shapefileName, | ||
bool onlySelectedFeatures = false ); | ||
|
||
/**Create buffers for a vector layer and write it to a new shape file | ||
*/ | ||
bool buffer( QgsVectorLayer* layer, const QString& shapefileName, double bufferDistance, | ||
bool onlySelectedFeatures = false, bool dissolve = false, | ||
int bufferDistanceField = -1 ); | ||
|
||
/**Create convex hull(s) of a vector layer and write it to a new shape file | ||
*/ | ||
bool convexHull( QgsVectorLayer* layer, const QString& shapefileName, | ||
bool onlySelectedFeatures = false, | ||
int uniqueIdField = -1 ); | ||
|
||
/**Dissolve a vector layer and write it to a new shape file | ||
*/ | ||
bool dissolve( QgsVectorLayer* layer, const QString& shapefileName, | ||
bool onlySelectedFeatures = false, | ||
int uniqueIdField = -1 ); | ||
|
||
private: | ||
|
||
QList<double> simpleMeasure( QgsGeometry* geometry ); | ||
double perimeterMeasure( QgsGeometry* geometry, QgsDistanceArea& measure ); | ||
/**Helper function to simplify an individual feature*/ | ||
void simplifyFeature( QgsFeature& f, QgsVectorFileWriter* vfw, double tolerance ); | ||
/**Helper function to get the cetroid of an individual feature*/ | ||
void centroidFeature( QgsFeature& f, QgsVectorFileWriter* vfw ); | ||
/**Helper function to buffer an individual feature*/ | ||
void bufferFeature( QgsFeature& f, int nProcessedFeatures, QgsVectorFileWriter* vfw, | ||
bool dissolve, QgsGeometry** dissolveGeometry, | ||
double bufferDistance, int bufferDistanceField ); | ||
/**Helper function to get the convex hull of feature(s)*/ | ||
void convexFeature( QgsFeature& f, int nProcessedFeatures, | ||
QgsGeometry** dissolveGeometry ); | ||
/**Helper function to dissolve feature(s)*/ | ||
void dissolveFeature( QgsFeature& f, int nProcessedFeatures, | ||
QgsGeometry** dissolveGeometry ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.