-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Applied patch #2634 from Luiz Motta which provide a new c++…
… plugin for carrying out spatial selections git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13356 c8812cc2-4d05-0410-92ff-de0c093fc19c
- Loading branch information
timlinux
committed
Apr 23, 2010
1 parent
ddaf58e
commit 1b6409c
Showing
22 changed files
with
2,887 additions
and
0 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,62 @@ | ||
######################################################## | ||
# Files | ||
|
||
SET (SPATIALQUERY_SRCS | ||
qgsspatialqueryplugin.cpp | ||
qgsspatialquerydialog.cpp | ||
qgsspatialquery.cpp | ||
qgsreaderfeatures.cpp | ||
qgsrubberselectid.cpp | ||
qgsgeometrycoordinatetransform.cpp | ||
qgsmngprogressbar.cpp | ||
) | ||
|
||
SET (SPATIALQUERY_MOC_HDRS | ||
qgsspatialqueryplugin.h | ||
qgsspatialquerydialog.h | ||
qgsspatialquery.h | ||
qgsreaderfeatures.h | ||
qgsrubberselectid.h | ||
qgsgeometrycoordinatetransform.h | ||
qgsmngprogressbar.h | ||
) | ||
|
||
SET( SPATIALQUERY_UIS qgsspatialquerydialogbase.ui) | ||
|
||
SET (SPATIALQUERY_RCCS qgsspatialquerydialogbase.qrc) | ||
|
||
######################################################## | ||
# Build | ||
|
||
QT4_WRAP_UI (SPATIALQUERY_UIS_H ${SPATIALQUERY_UIS}) | ||
|
||
QT4_WRAP_CPP (SPATIALQUERY_MOC_SRCS ${SPATIALQUERY_MOC_HDRS}) | ||
|
||
QT4_ADD_RESOURCES (SPATIALQUERY_RCC_SRCS ${SPATIALQUERY_RCCS}) | ||
|
||
ADD_LIBRARY (spatialqueryplugin MODULE ${SPATIALQUERY_SRCS} ${SPATIALQUERY_MOC_SRCS} ${SPATIALQUERY_RCC_SRCS} ${SPATIALQUERY_UIS_H}) | ||
|
||
INCLUDE_DIRECTORIES( | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
${CMAKE_CURRENT_BINARY_DIR}/../../ui/ | ||
../../core | ||
../../core/spatialindex | ||
../../core/raster | ||
../../core/renderer | ||
../../core/symbology | ||
../../gui | ||
.. | ||
) | ||
|
||
TARGET_LINK_LIBRARIES(spatialqueryplugin | ||
qgis_core | ||
qgis_gui | ||
) | ||
|
||
|
||
######################################################## | ||
# Install | ||
|
||
INSTALL(TARGETS spatialqueryplugin | ||
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR} | ||
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}) |
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,7 @@ | ||
Spatial Query Plugin for Quantum GIS | ||
|
||
Luiz Motta and Diego Moreira 2009 | ||
|
||
Plugin for make spatial query with two layers | ||
where features of target layer are selected by topological operations | ||
with reference layer |
55 changes: 55 additions & 0 deletions
55
src/plugins/spatialquery/qgsgeometrycoordinatetransform.cpp
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,55 @@ | ||
/*************************************************************************** | ||
qgsgeometrycoordinatetransform.cpp | ||
------------------- | ||
begin : Dec 29, 2009 | ||
copyright : (C) 2009 by Diego Moreira And Luiz Motta | ||
email : moreira.geo at gmail.com And motta.luiz at gmail.com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
/* $Id: $ */ | ||
|
||
#include "qgsgeometrycoordinatetransform.h" | ||
|
||
#include "qgscoordinatereferencesystem.h" | ||
|
||
QgsGeometryCoordinateTransform::~QgsGeometryCoordinateTransform() | ||
{ | ||
delete mCoordTransform; | ||
|
||
} // QgsGeometryCoordinateTransform::~QgsGeometryCoordinateTransform() | ||
|
||
void QgsGeometryCoordinateTransform::setCoordinateTransform(QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference) | ||
{ | ||
// Transform Forward: Target to Reference | ||
// * Use srs() to use old versions QGis - will be deprecited in 2.0 (after use crs()) | ||
QgsCoordinateReferenceSystem srsTarget = lyrTarget->srs(); | ||
QgsCoordinateReferenceSystem srsReference = lyrReference->srs(); | ||
|
||
mCoordTransform = new QgsCoordinateTransform(srsTarget, srsReference); | ||
|
||
mFuncTransform = ( srsTarget != srsReference) | ||
? &QgsGeometryCoordinateTransform::setGeomTransform | ||
: &QgsGeometryCoordinateTransform::setNoneGeomTransform; | ||
|
||
} // void QgsGeometryCoordinateTransform::setCoordinateTransform(QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference) | ||
|
||
void QgsGeometryCoordinateTransform::transform(QgsGeometry *geom) | ||
{ | ||
(this->*mFuncTransform)(geom); | ||
|
||
} // void QgsGeometryCoordinateTransform::transformCoordenate() | ||
|
||
void QgsGeometryCoordinateTransform::setGeomTransform(QgsGeometry *geom) | ||
{ | ||
geom->transform(*mCoordTransform); | ||
|
||
} // void QgsGeometryCoordinateTransform::setGeomTransform(QgsGeometry *geom) |
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,72 @@ | ||
/*************************************************************************** | ||
qgsgeometrycoordinatetransform.h | ||
------------------- | ||
begin : Dec 29, 2009 | ||
copyright : (C) 2009 by Diego Moreira And Luiz Motta | ||
email : moreira.geo at gmail.com And motta.luiz at gmail.com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
/* $Id: $ */ | ||
#ifndef GEOMETRYCOORDINATETRANSFORM_H | ||
#define GEOMETRYCOORDINATETRANSFORM_H | ||
|
||
#include "qgsgeometry.h" | ||
#include "qgsvectorlayer.h" | ||
#include "qgscoordinatetransform.h" | ||
|
||
/** | ||
* \class QgsGeometryCoordinateTransform | ||
* \brief Transform the coordinate reference system of the geometry | ||
*/ | ||
class QgsGeometryCoordinateTransform | ||
{ | ||
public: | ||
/** | ||
* \brief Constructor for a Geometry Coordinate Transform. | ||
* | ||
*/ | ||
QgsGeometryCoordinateTransform () {}; | ||
|
||
/** | ||
* \brief Destructor | ||
*/ | ||
~QgsGeometryCoordinateTransform (); | ||
|
||
/** | ||
* \brief Sets the coordinate reference system the target and reference layer | ||
* \param lyrTarget target layer. | ||
* \param lyrReference reference layer. | ||
*/ | ||
void setCoordinateTransform(QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference); | ||
|
||
/** | ||
* \brief Transform the coordinates reference system of the geometry, if target have the different system of reference | ||
* \param geom Geometry | ||
*/ | ||
void transform(QgsGeometry *geom); | ||
private: | ||
/** | ||
* \brief Transform the coordinates reference system of the geometry (use by transform) | ||
* \param geom Geometry | ||
*/ | ||
void setGeomTransform(QgsGeometry *geom); | ||
/** | ||
* \brief None transform the coordinates reference system of the geometry (use by transform) | ||
* \param geom Geometry | ||
*/ | ||
void setNoneGeomTransform(QgsGeometry *geom) {}; | ||
|
||
QgsCoordinateTransform * mCoordTransform; | ||
void (QgsGeometryCoordinateTransform::* mFuncTransform)(QgsGeometry *); | ||
}; | ||
|
||
#endif // GEOMETRYCOORDINATETRANSFORM_H |
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,50 @@ | ||
/*************************************************************************** | ||
qgsmngprogressbar.cpp | ||
------------------- | ||
begin : Dec 29, 2009 | ||
copyright : (C) 2009 by Diego Moreira And Luiz Motta | ||
email : moreira.geo at gmail.com And motta.luiz at gmail.com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
/* $Id: $ */ | ||
|
||
#include "qgsmngprogressbar.h" | ||
|
||
MngProgressBar::MngProgressBar(QProgressBar *pb) | ||
{ | ||
mPb = pb; | ||
mPb->reset(); | ||
} // MngProgressBar::MngProgressBar(QProgressBar *pb) | ||
|
||
void MngProgressBar::init(int minimum, int maximum) | ||
{ | ||
mPb->reset(); | ||
mPb->setRange(minimum, maximum); | ||
|
||
} // void MngProgressBar::init(int minimum, int maximum) | ||
|
||
void MngProgressBar::setFormat(QString format) | ||
{ | ||
// special caracters: | ||
// %p - is replaced by the percentage completed. | ||
// %v - is replaced by the current value. | ||
// %m - is replaced by the total number of steps. | ||
mPb->setFormat(format); | ||
|
||
} // void MngProgressBar::setFormat(QString format) | ||
|
||
void MngProgressBar::step(int step) | ||
{ | ||
mPb->setValue(step); | ||
mPb->repaint(); | ||
|
||
} // void MngProgressBar::step() |
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,65 @@ | ||
/*************************************************************************** | ||
qgsmngprogressbar.h | ||
------------------- | ||
begin : Dec 29, 2009 | ||
copyright : (C) 2009 by Diego Moreira And Luiz Motta | ||
email : moreira.geo at gmail.com And motta.luiz at gmail.com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
/* $Id: $ */ | ||
#ifndef QGSMNGPROGRESSBAR_H | ||
#define QGSMNGPROGRESSBAR_H | ||
|
||
#include "qprogressbar.h" | ||
|
||
/** | ||
* \class MngProgressBar | ||
* \brief This Class manager the progress bar | ||
*/ | ||
class MngProgressBar | ||
{ | ||
public: | ||
/** | ||
* \brief Constructor for a MngProgressBar. | ||
* \param pb Pointer to the MngProgressBar object. | ||
*/ | ||
MngProgressBar(QProgressBar *pb); | ||
/** | ||
* \brief Destructor | ||
*/ | ||
~MngProgressBar() { mPb->reset(); }; | ||
|
||
/** | ||
* \brief Sets the progress bar's minimum and maximum values to minimum and maximum respectively | ||
* \param minimum minimun value. | ||
* \param maximum maximum value. | ||
*/ | ||
void init(int minimum, int maximum); | ||
|
||
/** | ||
* \brief Sets the format the current text. | ||
* \param format This property holds the string used to generate the current text. | ||
*/ | ||
void setFormat(QString format); | ||
|
||
/** | ||
* \brief Sets current value progress bar's | ||
* \param step current value | ||
*/ | ||
void step(int step ); | ||
|
||
private: | ||
QProgressBar * mPb; | ||
|
||
}; | ||
|
||
#endif // QGSMNGPROGRESSBAR_H |
Oops, something went wrong.