Commit 32c48f39 authored by Dennis Nienhüser's avatar Dennis Nienhüser
Browse files

Don't use protected member variables.

parent 8b0a09cb
......@@ -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;
}
......@@ -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;
};
......
......@@ -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();
}
......@@ -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());
......
......@@ -15,6 +15,6 @@
PlacemarkFilter::PlacemarkFilter(GeoDataDocument *document) :
BaseFilter(document)
{
qDebug() << "Placemark count:" << m_placemarks.size();
qDebug() << "Placemark count:" << placemarks().size();
}
......@@ -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());
......
......@@ -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);
......
......@@ -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())) {
......
......@@ -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);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment