summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-07-24 16:54:31 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-07-24 16:55:02 (GMT)
commit32c48f393b2ccd412295b612dc7b02966ebe3635 (patch)
tree9259a2aeac234be374abb0f77e56f00eb7fcde5b
parent8b0a09cb1bc0391949db8e740775a7c254878f3b (diff)
Don't use protected member variables.
-rw-r--r--tools/osm-simplify/BaseFilter.cpp22
-rw-r--r--tools/osm-simplify/BaseFilter.h8
-rw-r--r--tools/osm-simplify/LineStringProcessor.cpp12
-rw-r--r--tools/osm-simplify/NodeReducer.cpp2
-rw-r--r--tools/osm-simplify/PlacemarkFilter.cpp2
-rw-r--r--tools/osm-simplify/ShpCoastlineProcessor.cpp4
-rw-r--r--tools/osm-simplify/TagsFilter.cpp6
-rw-r--r--tools/osm-simplify/TinyPlanetProcessor.cpp2
-rw-r--r--tools/osm-simplify/WayConcatenator.cpp6
9 files changed, 45 insertions, 19 deletions
diff --git a/tools/osm-simplify/BaseFilter.cpp b/tools/osm-simplify/BaseFilter.cpp
index 3b04d20..b08d70c 100644
--- a/tools/osm-simplify/BaseFilter.cpp
+++ b/tools/osm-simplify/BaseFilter.cpp
@@ -34,5 +34,25 @@ QVector<GeoDataPlacemark*>::const_iterator BaseFilter::objectsBegin() const
QVector<GeoDataPlacemark*>::const_iterator BaseFilter::objectsEnd() const
{
- return m_placemarks.end();
+ return m_placemarks.end();
+}
+
+const QVector<GeoDataPlacemark *> &BaseFilter::placemarks() const
+{
+ return m_placemarks;
+}
+
+QVector<GeoDataPlacemark *> &BaseFilter::placemarks()
+{
+ return m_placemarks;
+}
+
+const GeoDataDocument *BaseFilter::document() const
+{
+ return m_document;
+}
+
+GeoDataDocument *BaseFilter::document()
+{
+ return m_document;
}
diff --git a/tools/osm-simplify/BaseFilter.h b/tools/osm-simplify/BaseFilter.h
index 1c77c8b..7e92ae3 100644
--- a/tools/osm-simplify/BaseFilter.h
+++ b/tools/osm-simplify/BaseFilter.h
@@ -31,7 +31,13 @@ public:
QVector<GeoDataPlacemark*>::const_iterator objectsBegin() const;
QVector<GeoDataPlacemark*>::const_iterator objectsEnd() const;
-protected:
+ const QVector<GeoDataPlacemark*> & placemarks() const;
+ QVector<GeoDataPlacemark*> & placemarks();
+
+ const GeoDataDocument* document() const;
+ GeoDataDocument* document();
+
+private:
GeoDataDocument* m_document;
QVector<GeoDataPlacemark*> m_placemarks;
};
diff --git a/tools/osm-simplify/LineStringProcessor.cpp b/tools/osm-simplify/LineStringProcessor.cpp
index d578794..d56a817 100644
--- a/tools/osm-simplify/LineStringProcessor.cpp
+++ b/tools/osm-simplify/LineStringProcessor.cpp
@@ -19,25 +19,25 @@ LineStringProcessor::LineStringProcessor(GeoDataDocument* document) :
PlacemarkFilter(document)
{
QList<GeoDataPlacemark*> toRemove;
- foreach (GeoDataPlacemark* placemark, m_placemarks) {
+ foreach (GeoDataPlacemark* placemark, placemarks()) {
if(placemark->geometry()->nodeType() != GeoDataTypes::GeoDataLineStringType) {
toRemove.append(placemark);
}
}
foreach (GeoDataPlacemark* placemark, toRemove) {
- m_placemarks.removeOne(placemark);
+ placemarks().removeOne(placemark);
}
}
void LineStringProcessor::process()
{
- qDebug() << "Polylines to process: " << m_placemarks.size();
+ qDebug() << "Polylines to process: " << placemarks().size();
QList<GeoDataObject*> polylinesToDrop;
- foreach (GeoDataPlacemark* polyline, m_placemarks) {
+ foreach (GeoDataPlacemark* polyline, placemarks()) {
switch(polyline->visualCategory())
{
case GeoDataFeature::HighwayCycleway :
@@ -60,13 +60,13 @@ void LineStringProcessor::process()
int removed = 0;
foreach (GeoDataObject* polyline, polylinesToDrop) {
- if(m_document->removeOne(static_cast<GeoDataFeature*>(polyline))) {
+ if(document()->removeOne(static_cast<GeoDataFeature*>(polyline))) {
++removed;
}
}
qDebug() << "Polylines dropped: " << removed;
- qDebug() << m_document->name();
+ qDebug() << document()->name();
}
diff --git a/tools/osm-simplify/NodeReducer.cpp b/tools/osm-simplify/NodeReducer.cpp
index 1947a6b..09c070c 100644
--- a/tools/osm-simplify/NodeReducer.cpp
+++ b/tools/osm-simplify/NodeReducer.cpp
@@ -28,7 +28,7 @@ NodeReducer::NodeReducer(GeoDataDocument* document, int zoomLevel) :
void NodeReducer::process()
{
- foreach (GeoDataPlacemark* placemark, m_placemarks) {
+ foreach (GeoDataPlacemark* placemark, placemarks()) {
if(placemark->geometry()->nodeType() == GeoDataTypes::GeoDataLineStringType){
GeoDataLineString* prevLine = static_cast<GeoDataLineString*>(placemark->geometry());
diff --git a/tools/osm-simplify/PlacemarkFilter.cpp b/tools/osm-simplify/PlacemarkFilter.cpp
index 41b74f4..8b8ade4 100644
--- a/tools/osm-simplify/PlacemarkFilter.cpp
+++ b/tools/osm-simplify/PlacemarkFilter.cpp
@@ -15,6 +15,6 @@
PlacemarkFilter::PlacemarkFilter(GeoDataDocument *document) :
BaseFilter(document)
{
- qDebug() << "Placemark count:" << m_placemarks.size();
+ qDebug() << "Placemark count:" << placemarks().size();
}
diff --git a/tools/osm-simplify/ShpCoastlineProcessor.cpp b/tools/osm-simplify/ShpCoastlineProcessor.cpp
index a745d6a..d7b25b8 100644
--- a/tools/osm-simplify/ShpCoastlineProcessor.cpp
+++ b/tools/osm-simplify/ShpCoastlineProcessor.cpp
@@ -29,7 +29,7 @@ void ShpCoastlineProcessor::process()
OsmPlacemarkData marbleLand;
marbleLand.addTag("marble_land","landmass");
- foreach (GeoDataPlacemark* placemark, m_placemarks) {
+ foreach (GeoDataPlacemark* placemark, placemarks()) {
if(placemark->geometry()->nodeType() == GeoDataTypes::GeoDataPolygonType) {
placemark->setOsmData(marbleLand);
}
@@ -57,7 +57,7 @@ GeoDataDocument *ShpCoastlineProcessor::cutToTiles(unsigned int zoomLevel, unsig
tileBoundary.setBoundaries(north, south, east, west);
- foreach (GeoDataPlacemark* placemark, m_placemarks) {
+ foreach (GeoDataPlacemark* placemark, placemarks()) {
if(placemark->geometry()->nodeType() == GeoDataTypes::GeoDataPolygonType) {
GeoDataPolygon* marblePolygon = static_cast<GeoDataPolygon*>(placemark->geometry());
diff --git a/tools/osm-simplify/TagsFilter.cpp b/tools/osm-simplify/TagsFilter.cpp
index 7860831..85737fd 100644
--- a/tools/osm-simplify/TagsFilter.cpp
+++ b/tools/osm-simplify/TagsFilter.cpp
@@ -24,8 +24,8 @@ TagsFilter::TagsFilter(GeoDataDocument *document, const QStringList &tagsList, b
{
int total=0, tagCount=0;
// qDebug()<<"Entered tagFilter";
- QVector<GeoDataPlacemark*> previousObjects(m_placemarks);
- m_placemarks.clear();
+ QVector<GeoDataPlacemark*> previousObjects(placemarks());
+ placemarks().clear();
foreach (GeoDataPlacemark *placemark, previousObjects) {
++total;
bool flag = andFlag;
@@ -62,7 +62,7 @@ TagsFilter::TagsFilter(GeoDataDocument *document, const QStringList &tagsList, b
if (flag) {
++tagCount;
// qDebug()<<"Contained tag";
- m_placemarks.append(placemark);
+ placemarks().append(placemark);
// qDebug()<<"ID "<<placemark->osmData().id();
} else {
m_rejectedObjects.append(placemark);
diff --git a/tools/osm-simplify/TinyPlanetProcessor.cpp b/tools/osm-simplify/TinyPlanetProcessor.cpp
index 5dee6f3..cb980b8 100644
--- a/tools/osm-simplify/TinyPlanetProcessor.cpp
+++ b/tools/osm-simplify/TinyPlanetProcessor.cpp
@@ -48,7 +48,7 @@ GeoDataDocument *TinyPlanetProcessor::cutToTiles(unsigned int zoomLevel, unsigne
BaseClipper clipper;
clipper.initClipRect(tileBoundary);
- foreach (GeoDataPlacemark* placemark, m_placemarks) {
+ foreach (GeoDataPlacemark* placemark, placemarks()) {
if(tileBoundary.intersects(placemark->geometry()->latLonAltBox())) {
diff --git a/tools/osm-simplify/WayConcatenator.cpp b/tools/osm-simplify/WayConcatenator.cpp
index 642d2db..e266689 100644
--- a/tools/osm-simplify/WayConcatenator.cpp
+++ b/tools/osm-simplify/WayConcatenator.cpp
@@ -45,7 +45,7 @@ void WayConcatenator::process()
qint64 placemarkCount = 0;
// qDebug()<<"** Number of TagFiletered placemarks "<< m_objects.size();
- foreach (GeoDataPlacemark* placemark, m_placemarks) {
+ foreach (GeoDataPlacemark* placemark, placemarks()) {
qDebug()<<" ";
++placemarkCount;
// qDebug()<<"No."<<plcCount;
@@ -195,12 +195,12 @@ void WayConcatenator::addWayChunks()
void WayConcatenator::modifyDocument()
{
- m_document->clear();
+ document()->clear();
QVector<GeoDataPlacemark>::iterator itr;
itr = m_wayPlacemarks.begin();
for (; itr != m_wayPlacemarks.end(); ++itr) {
GeoDataPlacemark *placemark = new GeoDataPlacemark(*itr);
- m_document->append(placemark);
+ document()->append(placemark);
}
}