Skip to content

Commit 3d2b177

Browse files
author
jef
committedApr 24, 2010
spatial query plugin: fix warnings, reindent, include in debian package
git-svn-id: http://svn.osgeo.org/qgis/trunk@13360 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent e0ec67b commit 3d2b177

18 files changed

+1042
-1040
lines changed
 

‎debian/changelog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ qgis (1.5.0) UNRELEASED; urgency=low
55
* require CMake >2.6 and Qt 4.4 for sid
66
* remove circular dependencies
77
* integrate new GRASS raster provider
8+
* add spatialquery plugin
89

9-
-- Jürgen E. Fischer <jef@norbit.de> Thu, 04 Feb 2010 23:20:29 +0100
10+
-- Jürgen E. Fischer <jef@norbit.de> Sat, 24 Apr 2010 10:57:21 +0200
1011

1112
qgis (1.4.0) UNRELEASED; urgency=low
1213

‎debian/qgis.install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ usr/lib/qgis/libevis.so
2626
usr/lib/qgis/libosmprovider.so
2727
usr/lib/qgis/librasterterrainplugin.so
2828
usr/lib/qgis/liblabelingplugin.so
29+
usr/lib/qgis/libspatialqueryplugin.so
2930
usr/share/pixmaps/qgis-icon.xpm
3031
usr/share/pixmaps/qgis-mime-icon.png
3132
usr/share/pixmaps/qgis-mime-icon.png usr/share/icons/crystalsvg/128x128/mimetypes

‎debian/rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
1010
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
1111

1212
DISTRIBUTION := $(shell dpkg-parsechangelog --format rfc822 | sed -ne "s/^Distribution: //p")
13-
ifneq ($(DISTRIBUTION),$(findstring $(DISTRIBUTION),"lenny hardy intrepid jaunty karmic"))
13+
ifneq ($(DISTRIBUTION),$(findstring $(DISTRIBUTION),"lenny hardy intrepid jaunty karmic lucid"))
1414
DISTRIBUTION := sid
1515
endif
1616

‎src/plugins/spatialquery/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ SET (SPATIALQUERY_SRCS
1414
SET (SPATIALQUERY_MOC_HDRS
1515
qgsspatialqueryplugin.h
1616
qgsspatialquerydialog.h
17-
qgsspatialquery.h
18-
qgsreaderfeatures.h
19-
qgsrubberselectid.h
20-
qgsgeometrycoordinatetransform.h
21-
qgsmngprogressbar.h
2217
)
2318

2419
SET( SPATIALQUERY_UIS qgsspatialquerydialogbase.ui)

‎src/plugins/spatialquery/qgsgeometrycoordinatetransform.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,33 @@
2323

2424
QgsGeometryCoordinateTransform::~QgsGeometryCoordinateTransform()
2525
{
26-
delete mCoordTransform;
26+
delete mCoordTransform;
2727

2828
} // QgsGeometryCoordinateTransform::~QgsGeometryCoordinateTransform()
2929

30-
void QgsGeometryCoordinateTransform::setCoordinateTransform(QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference)
30+
void QgsGeometryCoordinateTransform::setCoordinateTransform( QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference )
3131
{
32-
// Transform Forward: Target to Reference
33-
// * Use srs() to use old versions QGis - will be deprecited in 2.0 (after use crs())
34-
QgsCoordinateReferenceSystem srsTarget = lyrTarget->srs();
35-
QgsCoordinateReferenceSystem srsReference = lyrReference->srs();
32+
// Transform Forward: Target to Reference
33+
// * Use srs() to use old versions QGis - will be deprecited in 2.0 (after use crs())
34+
QgsCoordinateReferenceSystem srsTarget = lyrTarget->srs();
35+
QgsCoordinateReferenceSystem srsReference = lyrReference->srs();
3636

37-
mCoordTransform = new QgsCoordinateTransform(srsTarget, srsReference);
37+
mCoordTransform = new QgsCoordinateTransform( srsTarget, srsReference );
3838

39-
mFuncTransform = ( srsTarget != srsReference)
39+
mFuncTransform = ( srsTarget != srsReference )
4040
? &QgsGeometryCoordinateTransform::setGeomTransform
4141
: &QgsGeometryCoordinateTransform::setNoneGeomTransform;
4242

4343
} // void QgsGeometryCoordinateTransform::setCoordinateTransform(QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference)
4444

45-
void QgsGeometryCoordinateTransform::transform(QgsGeometry *geom)
45+
void QgsGeometryCoordinateTransform::transform( QgsGeometry *geom )
4646
{
47-
(this->*mFuncTransform)(geom);
47+
( this->*mFuncTransform )( geom );
4848

4949
} // void QgsGeometryCoordinateTransform::transformCoordenate()
5050

51-
void QgsGeometryCoordinateTransform::setGeomTransform(QgsGeometry *geom)
51+
void QgsGeometryCoordinateTransform::setGeomTransform( QgsGeometry *geom )
5252
{
53-
geom->transform(*mCoordTransform);
53+
geom->transform( *mCoordTransform );
5454

5555
} // void QgsGeometryCoordinateTransform::setGeomTransform(QgsGeometry *geom)

‎src/plugins/spatialquery/qgsgeometrycoordinatetransform.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,44 +29,44 @@
2929
*/
3030
class QgsGeometryCoordinateTransform
3131
{
32-
public:
32+
public:
3333
/**
3434
* \brief Constructor for a Geometry Coordinate Transform.
3535
*
3636
*/
37-
QgsGeometryCoordinateTransform () {};
37+
QgsGeometryCoordinateTransform() {};
3838

3939
/**
4040
* \brief Destructor
4141
*/
42-
~QgsGeometryCoordinateTransform ();
42+
~QgsGeometryCoordinateTransform();
4343

4444
/**
4545
* \brief Sets the coordinate reference system the target and reference layer
4646
* \param lyrTarget target layer.
4747
* \param lyrReference reference layer.
4848
*/
49-
void setCoordinateTransform(QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference);
49+
void setCoordinateTransform( QgsVectorLayer* lyrTarget, QgsVectorLayer* lyrReference );
5050

5151
/**
5252
* \brief Transform the coordinates reference system of the geometry, if target have the different system of reference
5353
* \param geom Geometry
5454
*/
55-
void transform(QgsGeometry *geom);
56-
private:
55+
void transform( QgsGeometry *geom );
56+
private:
5757
/**
5858
* \brief Transform the coordinates reference system of the geometry (use by transform)
5959
* \param geom Geometry
6060
*/
61-
void setGeomTransform(QgsGeometry *geom);
61+
void setGeomTransform( QgsGeometry *geom );
6262
/**
6363
* \brief None transform the coordinates reference system of the geometry (use by transform)
6464
* \param geom Geometry
6565
*/
66-
void setNoneGeomTransform(QgsGeometry *geom) {};
66+
void setNoneGeomTransform( QgsGeometry *geom ) {};
6767

6868
QgsCoordinateTransform * mCoordTransform;
69-
void (QgsGeometryCoordinateTransform::* mFuncTransform)(QgsGeometry *);
69+
void ( QgsGeometryCoordinateTransform::* mFuncTransform )( QgsGeometry * );
7070
};
7171

7272
#endif // GEOMETRYCOORDINATETRANSFORM_H

‎src/plugins/spatialquery/qgsmngprogressbar.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,32 @@
1919

2020
#include "qgsmngprogressbar.h"
2121

22-
MngProgressBar::MngProgressBar(QProgressBar *pb)
22+
MngProgressBar::MngProgressBar( QProgressBar *pb )
2323
{
24-
mPb = pb;
25-
mPb->reset();
24+
mPb = pb;
25+
mPb->reset();
2626
} // MngProgressBar::MngProgressBar(QProgressBar *pb)
2727

28-
void MngProgressBar::init(int minimum, int maximum)
28+
void MngProgressBar::init( int minimum, int maximum )
2929
{
30-
mPb->reset();
31-
mPb->setRange(minimum, maximum);
30+
mPb->reset();
31+
mPb->setRange( minimum, maximum );
3232

3333
} // void MngProgressBar::init(int minimum, int maximum)
3434

35-
void MngProgressBar::setFormat(QString format)
35+
void MngProgressBar::setFormat( QString format )
3636
{
3737
// special caracters:
3838
// %p - is replaced by the percentage completed.
3939
// %v - is replaced by the current value.
4040
// %m - is replaced by the total number of steps.
41-
mPb->setFormat(format);
41+
mPb->setFormat( format );
4242

4343
} // void MngProgressBar::setFormat(QString format)
4444

45-
void MngProgressBar::step(int step)
45+
void MngProgressBar::step( int step )
4646
{
47-
mPb->setValue(step);
48-
mPb->repaint();
47+
mPb->setValue( step );
48+
mPb->repaint();
4949

5050
} // void MngProgressBar::step()

‎src/plugins/spatialquery/qgsmngprogressbar.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,39 +27,39 @@
2727
*/
2828
class MngProgressBar
2929
{
30-
public:
30+
public:
3131
/**
3232
* \brief Constructor for a MngProgressBar.
3333
* \param pb Pointer to the MngProgressBar object.
3434
*/
35-
MngProgressBar(QProgressBar *pb);
35+
MngProgressBar( QProgressBar *pb );
3636
/**
3737
* \brief Destructor
3838
*/
3939
~MngProgressBar() { mPb->reset(); };
40-
40+
4141
/**
4242
* \brief Sets the progress bar's minimum and maximum values to minimum and maximum respectively
4343
* \param minimum minimun value.
4444
* \param maximum maximum value.
4545
*/
46-
void init(int minimum, int maximum);
46+
void init( int minimum, int maximum );
4747

4848
/**
4949
* \brief Sets the format the current text.
5050
* \param format This property holds the string used to generate the current text.
5151
*/
52-
void setFormat(QString format);
52+
void setFormat( QString format );
5353

5454
/**
5555
* \brief Sets current value progress bar's
5656
* \param step current value
5757
*/
58-
void step(int step );
58+
void step( int step );
5959

60-
private:
60+
private:
6161
QProgressBar * mPb;
62-
62+
6363
};
6464

6565
#endif // QGSMNGPROGRESSBAR_H
Lines changed: 88 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,88 @@
1-
/***************************************************************************
2-
qgsreaderfeatures.cpp
3-
-------------------
4-
begin : Dec 29, 2009
5-
copyright : (C) 2009 by Diego Moreira And Luiz Motta
6-
email : moreira.geo at gmail.com And motta.luiz at gmail.com
7-
8-
***************************************************************************/
9-
10-
/***************************************************************************
11-
* *
12-
* This program is free software; you can redistribute it and/or modify *
13-
* it under the terms of the GNU General Public License as published by *
14-
* the Free Software Foundation; either version 2 of the License, or *
15-
* (at your option) any later version. *
16-
* *
17-
***************************************************************************/
18-
/* $Id: $ */
19-
20-
#include <qgsvectordataprovider.h>
21-
22-
#include "qgsreaderfeatures.h"
23-
24-
QgsReaderFeatures::QgsReaderFeatures(QgsVectorLayer *layer, bool useSelection)
25-
{
26-
mLayer = layer;
27-
28-
initReader(useSelection);
29-
30-
} // QgsReaderFeatures::QgsReaderFeatures(QgsVectorLayer *layer, bool useSelection)
31-
32-
QgsReaderFeatures::~QgsReaderFeatures()
33-
{
34-
if ( mListSelectedFeature.count() > 0 )
35-
{
36-
mListSelectedFeature.clear();
37-
}
38-
39-
} // QgsReaderFeatures::~QgsReaderFeatures()
40-
41-
bool QgsReaderFeatures::nextFeature(QgsFeature & feature)
42-
{
43-
return (this->*mFuncNextFeature)(feature);
44-
45-
} // bool QgsReaderFeatures::nextFeature(QgsFeature & feature)
46-
47-
void QgsReaderFeatures::initReader(bool useSelection)
48-
{
49-
if ( useSelection )
50-
{
51-
mListSelectedFeature = mLayer->selectedFeatures();
52-
mIterSelectedFeature = mListSelectedFeature.begin();
53-
mFuncNextFeature = &QgsReaderFeatures::nextFeatureSelected;
54-
}
55-
else
56-
{
57-
QgsAttributeList attListGeom;
58-
int idGeom = 0;
59-
attListGeom.append(idGeom);
60-
mLayer->select(attListGeom, mLayer->extent(), true, false);
61-
mFuncNextFeature = &QgsReaderFeatures::nextFeatureTotal;
62-
}
63-
64-
} // void QgsReaderFeatures::initReader()
65-
66-
bool QgsReaderFeatures::nextFeatureTotal ( QgsFeature & feature )
67-
{
68-
return mLayer->dataProvider()->nextFeature(feature);
69-
70-
} // bool QgsReaderFeatures::nextFeatureTotal ( QgsFeature & feature )
71-
72-
bool QgsReaderFeatures::nextFeatureSelected ( QgsFeature & feature )
73-
{
74-
bool bReturn = true;
75-
if ( mIterSelectedFeature == mListSelectedFeature.end() )
76-
{
77-
bReturn = false;
78-
}
79-
else
80-
{
81-
feature = *mIterSelectedFeature;
82-
mIterSelectedFeature++;
83-
}
84-
return bReturn;
85-
86-
} // bool QgsReaderFeatures::nextFeatureSelected( QgsFeature &feature )
87-
88-
1+
/***************************************************************************
2+
qgsreaderfeatures.cpp
3+
-------------------
4+
begin : Dec 29, 2009
5+
copyright : (C) 2009 by Diego Moreira And Luiz Motta
6+
email : moreira.geo at gmail.com And motta.luiz at gmail.com
7+
8+
***************************************************************************/
9+
10+
/***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************/
18+
/* $Id: $ */
19+
20+
#include <qgsvectordataprovider.h>
21+
22+
#include "qgsreaderfeatures.h"
23+
24+
QgsReaderFeatures::QgsReaderFeatures( QgsVectorLayer *layer, bool useSelection )
25+
{
26+
mLayer = layer;
27+
28+
initReader( useSelection );
29+
30+
} // QgsReaderFeatures::QgsReaderFeatures(QgsVectorLayer *layer, bool useSelection)
31+
32+
QgsReaderFeatures::~QgsReaderFeatures()
33+
{
34+
if ( mListSelectedFeature.count() > 0 )
35+
{
36+
mListSelectedFeature.clear();
37+
}
38+
39+
} // QgsReaderFeatures::~QgsReaderFeatures()
40+
41+
bool QgsReaderFeatures::nextFeature( QgsFeature & feature )
42+
{
43+
return ( this->*mFuncNextFeature )( feature );
44+
45+
} // bool QgsReaderFeatures::nextFeature(QgsFeature & feature)
46+
47+
void QgsReaderFeatures::initReader( bool useSelection )
48+
{
49+
if ( useSelection )
50+
{
51+
mListSelectedFeature = mLayer->selectedFeatures();
52+
mIterSelectedFeature = mListSelectedFeature.begin();
53+
mFuncNextFeature = &QgsReaderFeatures::nextFeatureSelected;
54+
}
55+
else
56+
{
57+
QgsAttributeList attListGeom;
58+
int idGeom = 0;
59+
attListGeom.append( idGeom );
60+
mLayer->select( attListGeom, mLayer->extent(), true, false );
61+
mFuncNextFeature = &QgsReaderFeatures::nextFeatureTotal;
62+
}
63+
64+
} // void QgsReaderFeatures::initReader()
65+
66+
bool QgsReaderFeatures::nextFeatureTotal( QgsFeature & feature )
67+
{
68+
return mLayer->dataProvider()->nextFeature( feature );
69+
70+
} // bool QgsReaderFeatures::nextFeatureTotal ( QgsFeature & feature )
71+
72+
bool QgsReaderFeatures::nextFeatureSelected( QgsFeature & feature )
73+
{
74+
bool bReturn = true;
75+
if ( mIterSelectedFeature == mListSelectedFeature.end() )
76+
{
77+
bReturn = false;
78+
}
79+
else
80+
{
81+
feature = *mIterSelectedFeature;
82+
mIterSelectedFeature++;
83+
}
84+
return bReturn;
85+
86+
} // bool QgsReaderFeatures::nextFeatureSelected( QgsFeature &feature )
87+
88+
Lines changed: 78 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,78 @@
1-
/***************************************************************************
2-
qgsreaderfeatures.h
3-
-------------------
4-
begin : Dec 29, 2009
5-
copyright : (C) 2009 by Diego Moreira And Luiz Motta
6-
email : moreira.geo at gmail.com And motta.luiz at gmail.com
7-
8-
***************************************************************************/
9-
10-
/***************************************************************************
11-
* *
12-
* This program is free software; you can redistribute it and/or modify *
13-
* it under the terms of the GNU General Public License as published by *
14-
* the Free Software Foundation; either version 2 of the License, or *
15-
* (at your option) any later version. *
16-
* *
17-
***************************************************************************/
18-
/* $Id: $ */
19-
#ifndef READERFEATURES_H
20-
#define READERFEATURES_H
21-
22-
#include <qgsvectorlayer.h>
23-
#include <qgsfeature.h>
24-
25-
/**
26-
* \class QgsReaderFeatures
27-
* \brief Reader Features
28-
*/
29-
class QgsReaderFeatures
30-
{
31-
public:
32-
/**
33-
* \brief Constructor for a Reader Features.
34-
* \param layer Pointer to the layer.
35-
* \param useSelection Use or not use the features selected
36-
*/
37-
QgsReaderFeatures(QgsVectorLayer *layer, bool useSelection);
38-
39-
/**
40-
* \brief Destructor
41-
*/
42-
~QgsReaderFeatures();
43-
44-
/**
45-
* \brief Next feature
46-
* \param feature reference to next Feature.
47-
* \returns True if has next feature.
48-
*/
49-
bool nextFeature(QgsFeature & feature);
50-
51-
private:
52-
/**
53-
* \brief init Reader
54-
* \param useSelection Use or not use the features selected
55-
*/
56-
void initReader(bool useSelection);
57-
58-
/**
59-
* \brief Next feature, not using the features selected
60-
* \param feature reference to next Feature.
61-
* \returns True if has next feature.
62-
*/
63-
bool nextFeatureTotal(QgsFeature & feature);
64-
65-
/**
66-
* \brief Next feature, using the features selected
67-
* \param feature reference to next Feature.
68-
* \returns True if has next feature.
69-
*/
70-
bool nextFeatureSelected(QgsFeature & feature);
71-
72-
QgsVectorLayer * mLayer;
73-
QgsFeatureList mListSelectedFeature;
74-
QList<QgsFeature>::iterator mIterSelectedFeature;
75-
bool (QgsReaderFeatures::* mFuncNextFeature) ( QgsFeature &);
76-
};
77-
78-
#endif // READERFEATURES_H
1+
/***************************************************************************
2+
qgsreaderfeatures.h
3+
-------------------
4+
begin : Dec 29, 2009
5+
copyright : (C) 2009 by Diego Moreira And Luiz Motta
6+
email : moreira.geo at gmail.com And motta.luiz at gmail.com
7+
8+
***************************************************************************/
9+
10+
/***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************/
18+
/* $Id: $ */
19+
#ifndef READERFEATURES_H
20+
#define READERFEATURES_H
21+
22+
#include <qgsvectorlayer.h>
23+
#include <qgsfeature.h>
24+
25+
/**
26+
* \class QgsReaderFeatures
27+
* \brief Reader Features
28+
*/
29+
class QgsReaderFeatures
30+
{
31+
public:
32+
/**
33+
* \brief Constructor for a Reader Features.
34+
* \param layer Pointer to the layer.
35+
* \param useSelection Use or not use the features selected
36+
*/
37+
QgsReaderFeatures( QgsVectorLayer *layer, bool useSelection );
38+
39+
/**
40+
* \brief Destructor
41+
*/
42+
~QgsReaderFeatures();
43+
44+
/**
45+
* \brief Next feature
46+
* \param feature reference to next Feature.
47+
* \returns True if has next feature.
48+
*/
49+
bool nextFeature( QgsFeature & feature );
50+
51+
private:
52+
/**
53+
* \brief init Reader
54+
* \param useSelection Use or not use the features selected
55+
*/
56+
void initReader( bool useSelection );
57+
58+
/**
59+
* \brief Next feature, not using the features selected
60+
* \param feature reference to next Feature.
61+
* \returns True if has next feature.
62+
*/
63+
bool nextFeatureTotal( QgsFeature & feature );
64+
65+
/**
66+
* \brief Next feature, using the features selected
67+
* \param feature reference to next Feature.
68+
* \returns True if has next feature.
69+
*/
70+
bool nextFeatureSelected( QgsFeature & feature );
71+
72+
QgsVectorLayer * mLayer;
73+
QgsFeatureList mListSelectedFeature;
74+
QList<QgsFeature>::iterator mIterSelectedFeature;
75+
bool ( QgsReaderFeatures::* mFuncNextFeature )( QgsFeature & );
76+
};
77+
78+
#endif // READERFEATURES_H

‎src/plugins/spatialquery/qgsrubberselectid.cpp

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,62 +22,62 @@
2222

2323
#include "qgsfeature.h"
2424

25-
QgsRubberSelectId::QgsRubberSelectId( QgsMapCanvas* mapCanvas)
25+
QgsRubberSelectId::QgsRubberSelectId( QgsMapCanvas* mapCanvas )
2626
{
27-
mIsPolygon = true;
28-
mMapCanvas = mapCanvas;
29-
mRubberBand = new QgsRubberBand( mMapCanvas, mIsPolygon );
27+
mIsPolygon = true;
28+
mMapCanvas = mapCanvas;
29+
mRubberBand = new QgsRubberBand( mMapCanvas, mIsPolygon );
3030

3131
} // QgsRubberSelectId::QgsRubberSelectId( QgsMapCanvas* mapCanvas, bool isPolygon = true )
3232

3333
QgsRubberSelectId::~QgsRubberSelectId()
3434
{
35-
reset();
36-
delete mRubberBand;
35+
reset();
36+
delete mRubberBand;
3737

3838
} // QgsRubberSelectId::~QgsRubberSelectId()
3939

40-
void QgsRubberSelectId::isGeometryNotPolygon(bool isPolygon = false)
40+
void QgsRubberSelectId::isGeometryNotPolygon( bool isPolygon = false )
4141
{
42-
reset();
43-
delete mRubberBand;
44-
mIsPolygon = isPolygon;
45-
mRubberBand = new QgsRubberBand( mMapCanvas, mIsPolygon );
42+
reset();
43+
delete mRubberBand;
44+
mIsPolygon = isPolygon;
45+
mRubberBand = new QgsRubberBand( mMapCanvas, mIsPolygon );
4646

4747
} // void QgsRubberSelectId::isGeometryNotPolygon(bool isPolygon)
4848

4949
void QgsRubberSelectId::reset()
5050
{
51-
mRubberBand->reset( mIsPolygon );
51+
mRubberBand->reset( mIsPolygon );
5252

5353
} // void QgsRubberSelectId::reset()
5454

55-
void QgsRubberSelectId::setColor(int colorRed, int colorGreen, int colorBlue, int width, float alfa = 0)
55+
void QgsRubberSelectId::setColor( int colorRed, int colorGreen, int colorBlue, int width, float alfa = 0 )
5656
{
57-
QColor color = QColor( colorRed, colorGreen, colorBlue );
58-
color.setAlpha( alfa );
59-
mRubberBand->setColor( color );
60-
mRubberBand->setWidth( width );
57+
QColor color = QColor( colorRed, colorGreen, colorBlue );
58+
color.setAlpha( alfa );
59+
mRubberBand->setColor( color );
60+
mRubberBand->setWidth( width );
6161

6262
} // void QgsRubberSelectId::setColor(int colorRed, int colorGreen, int colorBlue, float alfa, width)
6363

6464
void QgsRubberSelectId::addFeature( QgsVectorLayer* mLayer, int fid )
6565
{
66-
QgsFeature feat;
67-
if ( !mLayer->featureAtId( fid, feat, true, false ) )
68-
{
69-
return;
70-
}
71-
if ( !feat.geometry() )
72-
{
73-
return;
74-
}
75-
76-
mRubberBand->setToGeometry( feat.geometry(), mLayer );
66+
QgsFeature feat;
67+
if ( !mLayer->featureAtId( fid, feat, true, false ) )
68+
{
69+
return;
70+
}
71+
if ( !feat.geometry() )
72+
{
73+
return;
74+
}
75+
76+
mRubberBand->setToGeometry( feat.geometry(), mLayer );
7777

7878
} // void QgsRubberSelectId::addFeature( QgsVectorLayer* mLayer, int Id )
7979

8080
void QgsRubberSelectId::show()
8181
{
82-
mRubberBand->show();
82+
mRubberBand->show();
8383
} // QgsRubberSelectId::show()

‎src/plugins/spatialquery/qgsrubberselectid.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
*/
3131
class QgsRubberSelectId
3232
{
33-
public:
33+
public:
3434
/**
3535
* Constructor for a class RubberSelectedId.
3636
* @param mapCanvas Pointer to the iface.mapCanvas().
3737
*/
38-
QgsRubberSelectId( QgsMapCanvas* mapCanvas);
38+
QgsRubberSelectId( QgsMapCanvas* mapCanvas );
3939
/**
4040
* \brief Destructor
4141
*/
@@ -45,7 +45,7 @@ class QgsRubberSelectId
4545
* \brief Set if is geometry polygon for rubber band
4646
* \param isPolygon boolean for type geometry is polygon
4747
*/
48-
void isGeometryNotPolygon(bool isPolygon);
48+
void isGeometryNotPolygon( bool isPolygon );
4949

5050
/**
5151
* \brief Reset rubber band
@@ -72,7 +72,7 @@ class QgsRubberSelectId
7272
* \brief Show rubber band
7373
*/
7474
void show();
75-
private:
75+
private:
7676
//! RubberBand
7777
QgsRubberBand* mRubberBand;
7878
bool mIsPolygon;

‎src/plugins/spatialquery/qgsspatialquery.cpp

Lines changed: 218 additions & 215 deletions
Large diffs are not rendered by default.

‎src/plugins/spatialquery/qgsspatialquery.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
*/
3636
enum Topologic_Relation
3737
{
38-
Intersects,
39-
Disjoint,
40-
Touches,
41-
Crosses,
42-
Within,
43-
Equals,
44-
Overlaps,
45-
Contains
38+
Intersects,
39+
Disjoint,
40+
Touches,
41+
Crosses,
42+
Within,
43+
Equals,
44+
Overlaps,
45+
Contains
4646
};
4747

4848

@@ -53,12 +53,12 @@ enum Topologic_Relation
5353
*/
5454
class QgsSpatialQuery
5555
{
56-
public:
56+
public:
5757
/**
5858
* \brief Constructor for a Spatial query.
5959
* \param pb Pointer to the MngProgressBar object.
6060
*/
61-
QgsSpatialQuery(MngProgressBar *pb);
61+
QgsSpatialQuery( MngProgressBar *pb );
6262

6363
/**
6464
* \brief Destructor
@@ -69,13 +69,13 @@ class QgsSpatialQuery
6969
* \brief Sets if using selected features in Target layer
7070
* \param useSelected TRUE if use selected.
7171
*/
72-
void setSelectedFeaturesTarget(bool useSelected);
72+
void setSelectedFeaturesTarget( bool useSelected );
7373

7474
/**
7575
* \brief Sets if using selected features in Reference layer
7676
* \param useSelected TRUE if use selected.
7777
*/
78-
void setSelectedFeaturesReference(bool useSelected);
78+
void setSelectedFeaturesReference( bool useSelected );
7979

8080
/**
8181
* \brief Execute the query
@@ -99,9 +99,9 @@ class QgsSpatialQuery
9999
* \param geomType Geometry Type
100100
* \returns short int Topologic Dimension
101101
*/
102-
static short int dimensionGeometry(QGis::GeometryType geomType);
102+
static short int dimensionGeometry( QGis::GeometryType geomType );
103103

104-
private:
104+
private:
105105

106106
/**
107107
* \brief Sets the target layer and reference layer
@@ -114,7 +114,7 @@ class QgsSpatialQuery
114114
* \brief Verify has valid Geometry in feature
115115
* \param QgsFeature Feature
116116
*/
117-
bool hasValidGeometry(QgsFeature &feature);
117+
bool hasValidGeometry( QgsFeature &feature );
118118

119119
/**
120120
* \brief Build the Spatial Index
@@ -126,7 +126,7 @@ class QgsSpatialQuery
126126
* \param qsetIndexResult Reference to QSet contains the result query
127127
* \param relation Enum Topologic Relation
128128
*/
129-
void execQuery(QSet<int> & qsetIndexResult, int relation);
129+
void execQuery( QSet<int> & qsetIndexResult, int relation );
130130

131131
/**
132132
* \brief Populate index Result
@@ -136,8 +136,8 @@ class QgsSpatialQuery
136136
* \param operation Pointer to function of GEOS operation
137137
*/
138138
void populateIndexResult(
139-
QSet<int> & qsetIndexResult, int idTarget, QgsGeometry * geomTarget,
140-
char(*operation)(const GEOSGeometry *, const GEOSGeometry *) );
139+
QSet<int> & qsetIndexResult, int idTarget, QgsGeometry * geomTarget,
140+
char( *operation )( const GEOSGeometry *, const GEOSGeometry * ) );
141141
/**
142142
* \brief Populate index Result Disjoint
143143
* \param qsetIndexResult Reference to QSet contains the result query
@@ -146,8 +146,8 @@ class QgsSpatialQuery
146146
* \param operation Pointer to function of GEOS operation
147147
*/
148148
void populateIndexResultDisjoint(
149-
QSet<int> & qsetIndexResult, int idTarget, QgsGeometry * geomTarget,
150-
char(*operation)(const GEOSGeometry *, const GEOSGeometry *) );
149+
QSet<int> & qsetIndexResult, int idTarget, QgsGeometry * geomTarget,
150+
char( *operation )( const GEOSGeometry *, const GEOSGeometry * ) );
151151

152152
MngProgressBar *mPb;
153153
bool mUseReferenceSelection;

‎src/plugins/spatialquery/qgsspatialquerydialog.cpp

Lines changed: 490 additions & 489 deletions
Large diffs are not rendered by default.

‎src/plugins/spatialquery/qgsspatialquerydialog.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@
3434
class QgsSpatialQueryDialog : public QDialog, private Ui::QgsSpatialQueryDialogBase
3535
{
3636
Q_OBJECT
37-
public:
37+
public:
3838
/**
3939
* Constructor for a dialog. The QgisInterface pointer is passed by
4040
* QGIS when it attempts to instantiate the plugin.
4141
* @param iface Pointer to the QgisInterface object.
4242
*/
43-
QgsSpatialQueryDialog(QWidget *parent = 0, QgisInterface* iface = 0);
43+
QgsSpatialQueryDialog( QWidget *parent = 0, QgisInterface* iface = 0 );
4444
//! Destructor
4545
~QgsSpatialQueryDialog();
4646

@@ -50,24 +50,24 @@ class QgsSpatialQueryDialog : public QDialog, private Ui::QgsSpatialQueryDialogB
5050
//! Unload plugins by QGIS - Disconnect signal from QGIS
5151
void disconnectQGis();
5252

53-
private slots:
53+
private slots:
5454
//! Slots for signs of Dialog
5555
void on_buttonBox_accepted();
5656
void on_buttonBox_rejected();
5757
void on_targetLayerComboBox_currentIndexChanged( int index );
5858
void on_referenceLayerComboBox_currentIndexChanged( int index );
59-
void on_selectedFeatureListWidget_currentTextChanged ( const QString& currentText );
60-
void on_showLogProcessingCheckBox_clicked(bool checked);
59+
void on_selectedFeatureListWidget_currentTextChanged( const QString& currentText );
60+
void on_showLogProcessingCheckBox_clicked( bool checked );
6161

6262
//! Slots for signs of QGIS
63-
void signal_qgis_layerWasAdded ( QgsMapLayer* mapLayer );
64-
void signal_qgis_layerWillBeRemoved ( QString idLayer );
63+
void signal_qgis_layerWasAdded( QgsMapLayer* mapLayer );
64+
void signal_qgis_layerWillBeRemoved( QString idLayer );
6565

6666
//! Slots for signs of Layers (Target or Reference)
6767
void signal_layerTarget_selectionFeaturesChanged();
6868
void signal_layerReference_selectionFeaturesChanged();
6969

70-
private:
70+
private:
7171
//! Initialize the Gui
7272
void initGui();
7373
//! Set Color mRubberSelectId
@@ -79,27 +79,27 @@ private slots:
7979
//! Run Query
8080
void runQuery();
8181
//! Show Log Processing
82-
void showLogProcessing(bool hasShow);
82+
void showLogProcessing( bool hasShow );
8383
//! Show result of query
84-
void showResultQuery(QDateTime *datetimeStart, QDateTime *datetimeEnd);
84+
void showResultQuery( QDateTime *datetimeStart, QDateTime *datetimeEnd );
8585
//! Get Description Layer to show result
86-
QString getDescriptionLayerShow(bool isTarget);
86+
QString getDescriptionLayerShow( bool isTarget );
8787
//! Connect all slots
8888
void connectAll();
8989
//! Disconnect all slots
9090
void disconnectAll();
9191
//! reject - override
9292
void reject();
9393
//! Get Vector layer from combobox
94-
QgsVectorLayer * getLayerFromCombobox(bool isTarget, int index);
94+
QgsVectorLayer * getLayerFromCombobox( bool isTarget, int index );
9595
//! Get Icon for vector layer
96-
QIcon getIconTypeGeometry(QGis::GeometryType geomType);
96+
QIcon getIconTypeGeometry( QGis::GeometryType geomType );
9797
//! Add layer in combobox (text, data and tooltips)
98-
void addLayerCombobox(bool isTarget, QgsVectorLayer* vectorLayer);
98+
void addLayerCombobox( bool isTarget, QgsVectorLayer* vectorLayer );
9999
//! Find Layer in combobox
100-
int getIndexLayerCombobox(bool isTarget, QgsVectorLayer* vectorLayer);
100+
int getIndexLayerCombobox( bool isTarget, QgsVectorLayer* vectorLayer );
101101
//! Remove layer in combobox and setting GUI
102-
void removeLayer(bool isTarget, QgsVectorLayer* lyrRemove);
102+
void removeLayer( bool isTarget, QgsVectorLayer* lyrRemove );
103103
//! Populates targetLayerComboBox with all layers
104104
void populateTargetLayerComboBox();
105105
//! Populates referenceLayerComboBox with all layers except the current target layer
@@ -125,7 +125,7 @@ private slots:
125125
// Menssage
126126
QString mMsgLayersLessTwo;
127127

128-
void MsgDEBUG(QString sMSg);
128+
void MsgDEBUG( QString sMSg );
129129
};
130130

131131
#endif // SPATIALQUERYDIALOG_H

‎src/plugins/spatialquery/qgsspatialqueryplugin.cpp

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -57,83 +57,84 @@ static const QgisPlugin::PLUGINTYPE type_ = QgisPlugin::UI;
5757
* @param qgis Pointer to the QGIS main window
5858
* @parma mIface Pointer to the QGIS interface object
5959
*/
60-
QgsSpatialQueryPlugin::QgsSpatialQueryPlugin(QgisInterface* iface)
61-
:QgisPlugin( name_, description_, version_, type_ ),
62-
mIface(iface)
60+
QgsSpatialQueryPlugin::QgsSpatialQueryPlugin( QgisInterface* iface )
61+
: QgisPlugin( name_, description_, version_, type_ ),
62+
mIface( iface )
6363
{
64-
mDialog = NULL;
64+
mDialog = NULL;
6565
}
6666

6767
QgsSpatialQueryPlugin::~QgsSpatialQueryPlugin()
6868
{
69-
mIface = NULL;
70-
delete mSpatialQueryAction;
71-
delete mDialog;
69+
mIface = NULL;
70+
delete mSpatialQueryAction;
71+
delete mDialog;
7272
}
7373
/*
7474
* Initialize the GUI interface for the plugin
7575
*/
7676
void QgsSpatialQueryPlugin::initGui()
7777
{
78-
// Create the action for tool
79-
mSpatialQueryAction = new QAction( QIcon(), tr("&Spatial Query"), this);
78+
// Create the action for tool
79+
mSpatialQueryAction = new QAction( QIcon(), tr( "&Spatial Query" ), this );
8080

81-
// Connect the action to the spatialQuery slot
82-
connect(mSpatialQueryAction, SIGNAL(activated()), this, SLOT(run()));
81+
// Connect the action to the spatialQuery slot
82+
connect( mSpatialQueryAction, SIGNAL( activated() ), this, SLOT( run() ) );
8383

84-
setCurrentTheme( "" );
85-
// this is called when the icon theme is changed
86-
connect( mIface, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
84+
setCurrentTheme( "" );
85+
// this is called when the icon theme is changed
86+
connect( mIface, SIGNAL( currentThemeChanged( QString ) ), this, SLOT( setCurrentTheme( QString ) ) );
8787

88-
// Add the icon to the toolbar and to the plugin menu
89-
mIface->addToolBarIcon(mSpatialQueryAction);
90-
mIface->addPluginToMenu(tr("&Spatial Query"), mSpatialQueryAction);
88+
// Add the icon to the toolbar and to the plugin menu
89+
mIface->addToolBarIcon( mSpatialQueryAction );
90+
mIface->addPluginToMenu( tr( "&Spatial Query" ), mSpatialQueryAction );
9191

9292
}
9393

9494
//Unload the plugin by cleaning up the GUI
9595
void QgsSpatialQueryPlugin::unload()
9696
{
97-
// remove the GUI
98-
mIface->removeToolBarIcon(mSpatialQueryAction);
99-
mIface->removePluginMenu(tr("&Spatial Query"), mSpatialQueryAction);
97+
// remove the GUI
98+
mIface->removeToolBarIcon( mSpatialQueryAction );
99+
mIface->removePluginMenu( tr( "&Spatial Query" ), mSpatialQueryAction );
100100

101-
delete mSpatialQueryAction;
101+
delete mSpatialQueryAction;
102102

103103
}
104104

105105
void QgsSpatialQueryPlugin::run()
106106
{
107-
if (!mDialog){
108-
if(QgsMapLayerRegistry::instance()->mapLayers().size() < 2)
109-
{
110-
QgsSpatialQueryDialog::messageLayersLessTwo();
111-
return;
112-
}
113-
mDialog = new QgsSpatialQueryDialog(mIface->mainWindow(), mIface);
114-
mDialog->setModal(false);
115-
mDialog->show();
107+
if ( !mDialog )
108+
{
109+
if ( QgsMapLayerRegistry::instance()->mapLayers().size() < 2 )
110+
{
111+
QgsSpatialQueryDialog::messageLayersLessTwo();
112+
return;
113+
}
114+
mDialog = new QgsSpatialQueryDialog( mIface->mainWindow(), mIface );
115+
mDialog->setModal( false );
116+
mDialog->show();
117+
}
118+
else
119+
{
120+
if ( !mDialog->isVisible() )
121+
{
122+
delete mDialog;
123+
mDialog = NULL;
124+
run();
116125
}
117126
else
118127
{
119-
if ( !mDialog->isVisible() )
120-
{
121-
delete mDialog;
122-
mDialog = NULL;
123-
run();
124-
}
125-
else
126-
{
127-
mDialog->activateWindow();
128-
}
128+
mDialog->activateWindow();
129129
}
130+
}
130131

131132
}
132133

133134
//! Set icons to the current theme
134135
void QgsSpatialQueryPlugin::setCurrentTheme( QString )
135136
{
136-
mSpatialQueryAction->setIcon(getThemeIcon("/spatialquery.png"));
137+
mSpatialQueryAction->setIcon( getThemeIcon( "/spatialquery.png" ) );
137138
}
138139

139140
QIcon QgsSpatialQueryPlugin::getThemeIcon( const QString &theName )
@@ -142,19 +143,19 @@ QIcon QgsSpatialQueryPlugin::getThemeIcon( const QString &theName )
142143
{
143144
return QIcon( QgsApplication::activeThemePath() + "/plugins" + theName );
144145
}
145-
else if (QFile::exists(QgsApplication::defaultThemePath() + "/plugins" + theName ))
146+
else if ( QFile::exists( QgsApplication::defaultThemePath() + "/plugins" + theName ) )
146147
{
147148
return QIcon( QgsApplication::defaultThemePath() + "/plugins" + theName );
148149
}
149150
else
150151
{
151-
return QIcon(":/icons" + theName);
152+
return QIcon( ":/icons" + theName );
152153
}
153154
}
154155

155-
void QgsSpatialQueryPlugin::MsgDEBUG(QString sMSg)
156+
void QgsSpatialQueryPlugin::MsgDEBUG( QString sMSg )
156157
{
157-
QMessageBox::warning(0, tr("DEBUG"), sMSg, QMessageBox::Ok);
158+
QMessageBox::warning( 0, tr( "DEBUG" ), sMSg, QMessageBox::Ok );
158159
}
159160

160161

@@ -164,9 +165,9 @@ void QgsSpatialQueryPlugin::MsgDEBUG(QString sMSg)
164165
* of the plugin class
165166
*/
166167
// Class factory to return a new instance of the plugin class
167-
QGISEXTERN QgisPlugin* classFactory(QgisInterface* iface)
168+
QGISEXTERN QgisPlugin* classFactory( QgisInterface* iface )
168169
{
169-
return new QgsSpatialQueryPlugin(iface);
170+
return new QgsSpatialQueryPlugin( iface );
170171
}
171172
// Return the name of the plugin
172173

@@ -194,7 +195,7 @@ QGISEXTERN QString version()
194195
}
195196

196197
// Delete ourself
197-
QGISEXTERN void unload(QgisPlugin* theSpatialQueryPluginPointer)
198+
QGISEXTERN void unload( QgisPlugin* theSpatialQueryPluginPointer )
198199
{
199200
delete theSpatialQueryPluginPointer;
200201
}

‎src/plugins/spatialquery/qgsspatialqueryplugin.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ class QAction;
4545
class QgsSpatialQueryPlugin: public QObject, public QgisPlugin
4646
{
4747
Q_OBJECT
48-
public:
48+
public:
4949
/**
5050
* \brief Constructor for a plugin. The QgisInterface pointer is passed by
5151
* QGIS when it attempts to instantiate the plugin.
5252
* \param iface Pointer to the QgisInterface object.
5353
*/
54-
QgsSpatialQueryPlugin(QgisInterface* iface);
54+
QgsSpatialQueryPlugin( QgisInterface* iface );
5555
//! Destructor
5656
~QgsSpatialQueryPlugin();
5757

58-
public slots:
58+
public slots:
5959
//! init the gui
6060
void initGui();
6161
//! unload the plugin
@@ -66,7 +66,7 @@ class QgsSpatialQueryPlugin: public QObject, public QgisPlugin
6666
void setCurrentTheme( QString theThemeName );
6767
QIcon getThemeIcon( const QString &theThemeName );
6868

69-
private:
69+
private:
7070

7171
QgsSpatialQueryDialog *mDialog;
7272
//! Pointer to the QgisInterface object
@@ -75,7 +75,7 @@ class QgsSpatialQueryPlugin: public QObject, public QgisPlugin
7575
QAction* mSpatialQueryAction;
7676

7777

78-
void MsgDEBUG(QString sMSg);
78+
void MsgDEBUG( QString sMSg );
7979

8080
};
8181
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.