mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
add new functions to analysis library, also adds python bindings to analysis library
git-svn-id: http://svn.osgeo.org/qgis/trunk@11976 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
e4f8eddc43
commit
4a7839c313
@ -2,38 +2,45 @@ SUBDIRS(plugins)
|
||||
IF (WIN32)
|
||||
SET(BINDINGS_CORE_LIB ${CMAKE_CURRENT_BINARY_DIR}/core/core.pyd)
|
||||
SET(BINDINGS_GUI_LIB ${CMAKE_CURRENT_BINARY_DIR}/gui/gui.pyd)
|
||||
SET(BINDINGS_ANALYSIS_LIB ${CMAKE_CURRENT_BINARY_DIR}/analysis/analysis.pyd)
|
||||
IF (NOT MSVC)
|
||||
SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/libqgis_core.dll)
|
||||
SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/libqgis_gui.dll)
|
||||
SET(QGIS_ANALYSIS_LIB ${CMAKE_BINARY_DIR}/src/analysis/libqgis_analysis.dll)
|
||||
ELSE (NOT MSVC)
|
||||
SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/${CMAKE_CFG_INTDIR}/qgis_core.lib)
|
||||
SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/${CMAKE_CFG_INTDIR}/qgis_gui.lib)
|
||||
SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/${CMAKE_CFG_INTDIR}/qgis_core.lib)
|
||||
SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/${CMAKE_CFG_INTDIR}/qgis_gui.lib)
|
||||
SET(QGIS_ANALYSIS_LIB ${CMAKE_BINARY_DIR}/src/analysis/${CMAKE_CFG_INTDIR}/qgis_analysis.lib)
|
||||
ENDIF (NOT MSVC)
|
||||
ELSE (WIN32)
|
||||
SET(BINDINGS_CORE_LIB ${CMAKE_CURRENT_BINARY_DIR}/core/core.so)
|
||||
SET(BINDINGS_GUI_LIB ${CMAKE_CURRENT_BINARY_DIR}/gui/gui.so)
|
||||
SET(BINDINGS_CORE_LIB ${CMAKE_CURRENT_BINARY_DIR}/core/core.so)
|
||||
SET(BINDINGS_GUI_LIB ${CMAKE_CURRENT_BINARY_DIR}/gui/gui.so)
|
||||
SET(BINDINGS_ANALYSIS_LIB ${CMAKE_CURRENT_BINARY_DIR}/analysis/analysis.so)
|
||||
IF (APPLE)
|
||||
SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/libqgis_core.dylib)
|
||||
SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/libqgis_gui.dylib)
|
||||
SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/libqgis_core.dylib)
|
||||
SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/libqgis_gui.dylib)
|
||||
SET(QGIS_ANALYSIS_LIB ${CMAKE_BINARY_DIR}/src/analysis/libqgis_analysis.dylib)
|
||||
ELSE (APPLE)
|
||||
SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/libqgis_core.so)
|
||||
SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/libqgis_gui.so)
|
||||
SET(QGIS_CORE_LIB ${CMAKE_BINARY_DIR}/src/core/libqgis_core.so)
|
||||
SET(QGIS_GUI_LIB ${CMAKE_BINARY_DIR}/src/gui/libqgis_gui.so)
|
||||
SET(QGIS_ANALYSIS_LIB ${CMAKE_BINARY_DIR}/src/analysis/libqgis_analysis.so)
|
||||
ENDIF (APPLE)
|
||||
ENDIF (WIN32)
|
||||
|
||||
SET (BINDINGS_LIBS ${BINDINGS_CORE_LIB} ${BINDINGS_GUI_LIB})
|
||||
|
||||
SET (BINDINGS_CORE_MAKEFILE ${CMAKE_CURRENT_BINARY_DIR}/core/Makefile)
|
||||
SET (BINDINGS_GUI_MAKEFILE ${CMAKE_CURRENT_BINARY_DIR}/gui/Makefile)
|
||||
SET (BINDINGS_LIBS ${BINDINGS_CORE_LIB} ${BINDINGS_GUI_LIB} ${BINDINGS_ANALYSIS_LIB})
|
||||
SET (BINDINGS_CORE_MAKEFILE ${CMAKE_CURRENT_BINARY_DIR}/core/Makefile)
|
||||
SET (BINDINGS_GUI_MAKEFILE ${CMAKE_CURRENT_BINARY_DIR}/gui/Makefile)
|
||||
SET (BINDINGS_ANALYSIS_MAKEFILE ${CMAKE_CURRENT_BINARY_DIR}/analysis/Makefile)
|
||||
|
||||
# 'python' target will force to build bindings libs for core and gui
|
||||
ADD_CUSTOM_TARGET (python ALL DEPENDS ${BINDINGS_CORE_LIB} ${BINDINGS_GUI_LIB})
|
||||
ADD_CUSTOM_TARGET (python ALL DEPENDS ${BINDINGS_CORE_LIB} ${BINDINGS_GUI_LIB} ${BINDINGS_ANALYSIS_LIB})
|
||||
|
||||
# don't run python before the libs are built
|
||||
ADD_DEPENDENCIES (python qgis_core qgis_gui)
|
||||
ADD_DEPENDENCIES (python qgis_core qgis_gui qgis_analysis)
|
||||
|
||||
FILE(GLOB CORE_SIP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/core/*.sip")
|
||||
FILE(GLOB GUI_SIP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/gui/*.sip")
|
||||
FILE(GLOB CORE_SIP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/core/*.sip")
|
||||
FILE(GLOB GUI_SIP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/gui/*.sip")
|
||||
FILE(GLOB ANALYSIS_SIP_FILES "${CMAKE_CURRENT_SOURCE_DIR}/analysis/*.sip")
|
||||
|
||||
# Step 1: during configuration
|
||||
# create file configure.py from configure.py.in
|
||||
@ -50,12 +57,12 @@ ENDIF (MSVC)
|
||||
# run python configure.py
|
||||
# it will run SIP utility to generate sources and will prepare makefiles
|
||||
# should be run everytime core or gui library has been changed
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${BINDINGS_CORE_MAKEFILE} ${BINDINGS_GUI_MAKEFILE} PRE_BUILD
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${BINDINGS_CORE_MAKEFILE} ${BINDINGS_GUI_MAKEFILE} ${BINDINGS_ANALYSIS_MAKEFILE} PRE_BUILD
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
ARGS ${CMAKE_CURRENT_BINARY_DIR}/configure.py ${CMAKE_CFG_INTDIR} ${EXPORT}
|
||||
DEPENDS ${QGIS_CORE_LIB} ${QGIS_GUI_LIB}
|
||||
DEPENDS ${QGIS_CORE_LIB} ${QGIS_GUI_LIB} ${QGIS_ANALYSIS_LIB}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/configure.py
|
||||
${CORE_SIP_FILES} ${GUI_SIP_FILES})
|
||||
${CORE_SIP_FILES} ${GUI_SIP_FILES} ${ANALYSIS_SIP_FILES})
|
||||
|
||||
# Step 3: run make in core and gui subdirs
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${BINDINGS_CORE_LIB} PRE_LINK
|
||||
@ -66,6 +73,10 @@ ADD_CUSTOM_COMMAND(OUTPUT ${BINDINGS_GUI_LIB} PRE_LINK
|
||||
COMMAND ${SIP_MAKE_PROGRAM}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gui
|
||||
DEPENDS ${BINDINGS_GUI_MAKEFILE})
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${BINDINGS_ANALYSIS_LIB} PRE_LINK
|
||||
COMMAND ${SIP_MAKE_PROGRAM}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/analysis
|
||||
DEPENDS ${BINDINGS_ANALYSIS_MAKEFILE})
|
||||
|
||||
IF (BINDINGS_GLOBAL_INSTALL)
|
||||
|
||||
|
11
python/analysis/analysis.sip
Normal file
11
python/analysis/analysis.sip
Normal file
@ -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
|
||||
|
67
python/analysis/qgsgeometryanalyzer.sip
Normal file
67
python/analysis/qgsgeometryanalyzer.sip
Normal file
@ -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 );
|
||||
};
|
@ -38,6 +38,8 @@ if not os.path.isdir("./core"):
|
||||
os.mkdir("./core")
|
||||
if not os.path.isdir("./gui"):
|
||||
os.mkdir("./gui")
|
||||
if not os.path.isdir("./analysis"):
|
||||
os.mkdir("./analysis")
|
||||
|
||||
##########################################################################
|
||||
# SIP -> *.CPP + *.H
|
||||
@ -46,6 +48,7 @@ if not os.path.isdir("./gui"):
|
||||
# system.
|
||||
build_file_core = build_path + "/python/core/core.sbf"
|
||||
build_file_gui = build_path + "/python/gui/gui.sbf"
|
||||
build_file_analysis = build_path + "/python/analysis/analysis.sbf"
|
||||
|
||||
# Get the SIP configuration information.
|
||||
config = PyQt4.pyqtconfig.Configuration()
|
||||
@ -61,6 +64,7 @@ mod_dir = os.path.join(config.default_mod_dir, "qgis")
|
||||
# directory where sip files will be installed
|
||||
sip_dir_core = os.path.join(config.default_sip_dir, "qgis/core")
|
||||
sip_dir_gui = os.path.join(config.default_sip_dir, "qgis/gui")
|
||||
sip_dir_analysis = os.path.join(config.default_sip_dir, "qgis/analysis")
|
||||
|
||||
# Run SIP to generate the code.
|
||||
print "Parsing SIP files for 'core' library..."
|
||||
@ -73,6 +77,11 @@ cmd = " ".join([config.sip_bin, "-c", "gui", "-b", build_file_gui, "-I", python_
|
||||
print cmd
|
||||
os.system(cmd)
|
||||
|
||||
print "Parsing SIP files for 'analysis' library..."
|
||||
cmd = " ".join([config.sip_bin, "-c", "analysis", "-b", build_file_analysis, "-I", python_path, "-I", config.pyqt_sip_dir, qt_sip_flags, python_path + "/analysis/analysis.sip"])
|
||||
print cmd
|
||||
os.system(cmd)
|
||||
|
||||
|
||||
##########################################################################
|
||||
# MAKEFILES
|
||||
@ -83,12 +92,13 @@ print "Creating makefiles..."
|
||||
# its configuration module.
|
||||
installs = []
|
||||
|
||||
# directories relative to core (gui) directories
|
||||
# directories relative to core (gui, analysis) directories
|
||||
installs.append([[python_path + "__init__.py", python_path + "qgisconfig.py"], mod_dir])
|
||||
|
||||
|
||||
installs_core = copy.copy(installs)
|
||||
installs_gui = copy.copy(installs)
|
||||
installs_analysis = copy.copy(installs)
|
||||
|
||||
# install all sip files
|
||||
sips_core = glob.glob(python_path + "/core/*.sip")
|
||||
@ -98,6 +108,10 @@ for sip in sips_core:
|
||||
sips_gui = glob.glob(python_path + "/gui/*.sip")
|
||||
for sip in sips_gui:
|
||||
installs_gui.append([os.path.basename(sip), sip_dir_gui])
|
||||
|
||||
sips_analysis = glob.glob(python_path + "/analysis/*.sip")
|
||||
for sip in sips_analysis:
|
||||
installs_analysis.append([os.path.basename(sip), sip_dir_analysis])
|
||||
|
||||
|
||||
# Create the Makefile. The QtModuleMakefile class provided by the
|
||||
@ -120,9 +134,18 @@ makefile_gui = sipconfig.ModuleMakefile(
|
||||
install_dir=mod_dir,
|
||||
dir="gui",
|
||||
universal=osx_universal)
|
||||
|
||||
makefile_analysis = sipconfig.ModuleMakefile(
|
||||
configuration=config,
|
||||
qt=qt_libs,
|
||||
build_file=build_file_analysis,
|
||||
installs=installs_analysis,
|
||||
install_dir=mod_dir,
|
||||
dir="analysis",
|
||||
universal=osx_universal)
|
||||
|
||||
# common settings for both core and gui libs
|
||||
for mk in [ makefile_core, makefile_gui ]:
|
||||
# common settings for core, gui and analysis libs
|
||||
for mk in [ makefile_core, makefile_gui, makefile_analysis ]:
|
||||
mk.extra_lflags.extend( "@CMAKE_MODULE_LINKER_FLAGS@".strip(' ').split(' ') )
|
||||
mk.extra_libs = ["qgis_core"]
|
||||
mk.extra_lib_dirs = [build_path+"/src/core"+intdir]
|
||||
@ -145,9 +168,18 @@ makefile_gui.extra_include_dirs.append(build_path+"/src/ui")
|
||||
makefile_gui.extra_include_dirs.append(src_path+"/src/plugins") # because of qgisplugin.h TODO: sort out
|
||||
makefile_gui.extra_cxxflags.append("-DGUI_EXPORT="+export)
|
||||
|
||||
# more settings for analysis lib
|
||||
makefile_analysis.extra_libs.append("qgis_analysis")
|
||||
makefile_analysis.extra_lib_dirs.append(build_path+"/src/analysis/vector"+intdir)
|
||||
makefile_analysis.extra_include_dirs.append(src_path+"/src/analysis/vector")
|
||||
makefile_analysis.extra_include_dirs.append(build_path+"/src/analysis/vector")
|
||||
makefile_analysis.extra_include_dirs.append(src_path+"/src/plugins") # because of qgisplugin.h TODO: sort out
|
||||
makefile_analysis.extra_cxxflags.append("-DANALYSIS_EXPORT="+export)
|
||||
|
||||
# Generate the Makefile itself.
|
||||
makefile_core.generate()
|
||||
makefile_gui.generate()
|
||||
makefile_analysis.generate()
|
||||
|
||||
##########################################################################
|
||||
# QGIS CONFIG
|
||||
|
@ -34,6 +34,7 @@ class QgisModuleMakefile(pyqtconfig.QtModuleMakefile):
|
||||
# Make sure our C++ library is linked.
|
||||
self.extra_libs.append("qgis_core")
|
||||
self.extra_libs.append("qgis_gui")
|
||||
self.extra_libs.append("qgis_analysis")
|
||||
|
||||
# Let the super-class do what it needs to.
|
||||
pyqtconfig.QtModuleMakefile.finalise(self)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -38,72 +38,37 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Convert a vector layer from single part geometry
|
||||
* to multipart geometry for a given field
|
||||
*
|
||||
* */
|
||||
bool singlepartsToMultipart( QgsVectorLayer* layer,
|
||||
const QString& shapefileName,
|
||||
const QString& fileEncoding,
|
||||
const int fieldIndex );
|
||||
/**Simplify vector layer using (a modified) Douglas-Peucker algorithm
|
||||
and write it to a new shape file
|
||||
@param layer input vector layer
|
||||
@param shapefileName path to the output shp
|
||||
@param fileEncoding encoding of the output file
|
||||
@param tolerance (level of simplification)
|
||||
@param onlySelectedFeatures if true, only selected features are considered, else all the features
|
||||
@param p progress dialog (or 0 if no progress dialog is to be shown)
|
||||
@note: added in version 1.4*/
|
||||
bool simplify( QgsVectorLayer* layer, const QString& shapefileName, double tolerance, \
|
||||
bool onlySelectedFeatures = false, QProgressDialog* p = 0 );
|
||||
|
||||
/**
|
||||
* Convert multipart features to multiple singlepart features. Creates
|
||||
* simple polygons and lines.
|
||||
*/
|
||||
bool multipartToSingleparts( QgsVectorLayer* layer,
|
||||
const QString& shapefileName,
|
||||
const QString& fileEncoding );
|
||||
/**Calculate the true centroids, or 'center of mass' for a vector layer and
|
||||
write it to a new shape file
|
||||
@param layer input vector layer
|
||||
@param shapefileName path to the output shp
|
||||
@param fileEncoding encoding of the output file
|
||||
@param onlySelectedFeatures if true, only selected features are considered, else all the features
|
||||
@param p progress dialog (or 0 if no progress dialog is to be shown)
|
||||
@note: added in version 1.4*/
|
||||
bool centroids( QgsVectorLayer* layer, const QString& shapefileName, \
|
||||
bool onlySelectedFeatures = false, QProgressDialog* p = 0 );
|
||||
|
||||
/**
|
||||
* Extract nodes from line and polygon vector layers and output them as
|
||||
* points.
|
||||
* */
|
||||
bool extractNodes( QgsVectorLayer* layer,
|
||||
const QString& shapefileName,
|
||||
const QString& fileEncoding );
|
||||
|
||||
/**
|
||||
* Convert polygon features to line features. Multipart polygons are
|
||||
* converted to multiple singlepart lines.
|
||||
*/
|
||||
bool polygonsToLines( QgsVectorLayer* layer,
|
||||
const QString& shapefileName,
|
||||
const QString& fileEncoding );
|
||||
|
||||
/**
|
||||
* Add vector layer geometry info to point (XCOORD, YCOORD), line (LENGTH),
|
||||
* or polygon (AREA, PERIMETER) layer.
|
||||
*/
|
||||
bool exportGeometryInformation( QgsVectorLayer* layer,
|
||||
const QString& shapefileName,
|
||||
const QString& fileEncoding );
|
||||
|
||||
/**
|
||||
* Simplify (generalise) line or polygon vector layers using (a modified)
|
||||
* Douglas-Peucker algorithm.
|
||||
*/
|
||||
bool simplifyGeometry( QgsVectorLayer* layer,
|
||||
const QString shapefileName,
|
||||
const QString fileEncoding,
|
||||
const double tolerance );
|
||||
|
||||
/**
|
||||
* Calculate the true centroids, or 'center of mass' for each polygon in an
|
||||
* input polygon layer.
|
||||
*/
|
||||
bool polygonCentroids( QgsVectorLayer* layer,
|
||||
const QString& shapefileName,
|
||||
const QString& fileEncoding );
|
||||
|
||||
/**
|
||||
* Create a polygon based on the extents of all features (or all
|
||||
* selected features if applicable) and write it out to a shp.
|
||||
*/
|
||||
bool layerExtent( QgsVectorLayer* layer,
|
||||
const QString& shapefileName,
|
||||
const QString& fileEncoding );
|
||||
/**Create a polygon based on the extent of all (selected) features and write it to a new shape file
|
||||
@param layer input vector layer
|
||||
@param shapefileName path to the output shp
|
||||
@param fileEncoding encoding of the output file
|
||||
@param onlySelectedFeatures if true, only selected features are considered, else all the features
|
||||
@param p progress dialog (or 0 if no progress dialog is to be shown)
|
||||
@note: added in version 1.4*/
|
||||
bool extent( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, QProgressDialog* p = 0 );
|
||||
|
||||
/**Create buffers for a vector layer and write it to a new shape file
|
||||
@param layer input vector layer
|
||||
@ -118,19 +83,45 @@ class ANALYSIS_EXPORT QgsGeometryAnalyzer
|
||||
bool buffer( QgsVectorLayer* layer, const QString& shapefileName, double bufferDistance, \
|
||||
bool onlySelectedFeatures = false, bool dissolve = false, int bufferDistanceField = -1, QProgressDialog* p = 0 );
|
||||
|
||||
/**Create convex hull(s) of a vector layer and write it to a new shape file
|
||||
@param layer input vector layer
|
||||
@param shapefileName path to the output shp
|
||||
@param fileEncoding encoding of the output file
|
||||
@param onlySelectedFeatures if true, only selected features are considered, else all the features
|
||||
@param uniqueIdField index of the attribute field that contains the unique convex hull id (or -1 if
|
||||
all features have the same buffer distance)
|
||||
@param p progress dialog (or 0 if no progress dialog is to be shown)
|
||||
@note: added in version 1.4*/
|
||||
bool convexHull( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, \
|
||||
int uniqueIdField = -1, QProgressDialog* p = 0 );
|
||||
|
||||
/**Dissolve a vector layer and write it to a new shape file
|
||||
@param layer input vector layer
|
||||
@param shapefileName path to the output shp
|
||||
@param fileEncoding encoding of the output file
|
||||
@param onlySelectedFeatures if true, only selected features are considered, else all the features
|
||||
@param uniqueIdField index of the attribute field that contains the unique id to dissolve on (or -1 if
|
||||
all features should be dissolved together)
|
||||
@param p progress dialog (or 0 if no progress dialog is to be shown)
|
||||
@note: added in version 1.4*/
|
||||
bool dissolve( QgsVectorLayer* layer, const QString& shapefileName, bool onlySelectedFeatures = false, \
|
||||
int uniqueIdField = -1, QProgressDialog* p = 0 );
|
||||
|
||||
private:
|
||||
|
||||
QList<double> simpleMeasure( QgsGeometry* geometry );
|
||||
double perimeterMeasure( QgsGeometry* geometry, QgsDistanceArea& measure );
|
||||
QgsFieldMap checkGeometryFields( QgsVectorLayer* layer, int& index1, int& index2 );
|
||||
QgsGeometry* extractLines( QgsGeometry* geometry );
|
||||
QgsGeometry* extractAsSingle( QgsGeometry* geometry );
|
||||
QgsGeometry* extractAsMulti( QgsGeometry* geometry );
|
||||
QgsGeometry* convertGeometry( QgsGeometry* geometry );
|
||||
QList<QgsPoint> extractPoints( QgsGeometry* geometry );
|
||||
/**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 );
|
||||
|
||||
};
|
||||
#endif //QGSVECTORANALYZER
|
||||
|
Loading…
x
Reference in New Issue
Block a user