summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-09-03 15:19:27 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-09-03 15:19:27 (GMT)
commita4135f7eb85d125ec4197a91ad7885b7c34c0898 (patch)
tree3d9015d25abf06e509e89dd9f043966a78cd74ca
parent55b28190ab538697d4a977bd1ff2a11e213b9aac (diff)
More whitespace fixes
-rw-r--r--tools/osm-simplify/NodeReducer.cpp235
-rw-r--r--tools/osm-simplify/WayConcatenator.cpp4
-rw-r--r--tools/osm-simplify/main.cpp4
3 files changed, 122 insertions, 121 deletions
diff --git a/tools/osm-simplify/NodeReducer.cpp b/tools/osm-simplify/NodeReducer.cpp
index 5fc08cc..54909d2 100644
--- a/tools/osm-simplify/NodeReducer.cpp
+++ b/tools/osm-simplify/NodeReducer.cpp
@@ -29,137 +29,138 @@ NodeReducer::NodeReducer(GeoDataDocument* document, int zoomLevel) :
void NodeReducer::process()
{
- foreach (GeoDataPlacemark* placemark, placemarks()) {
+ foreach (GeoDataPlacemark* placemark, placemarks()) {
- if(placemark->geometry()->nodeType() == GeoDataTypes::GeoDataLineStringType){
- GeoDataLineString* prevLine = static_cast<GeoDataLineString*>(placemark->geometry());
- GeoDataLineString* reducedLine = reduce(prevLine);
- placemark->setGeometry(reducedLine);
- }
+ if(placemark->geometry()->nodeType() == GeoDataTypes::GeoDataLineStringType) {
+ GeoDataLineString* prevLine = static_cast<GeoDataLineString*>(placemark->geometry());
+ GeoDataLineString* reducedLine = reduce(prevLine);
+ placemark->setGeometry(reducedLine);
+ }
- else if(placemark->geometry()->nodeType() == GeoDataTypes::GeoDataLinearRingType){
- GeoDataLinearRing* prevRing = static_cast<GeoDataLinearRing*>(placemark->geometry());
- GeoDataLinearRing* reducedRing = static_cast<GeoDataLinearRing*>(reduce(prevRing));
- placemark->setGeometry(reducedRing);
- }
+ else if(placemark->geometry()->nodeType() == GeoDataTypes::GeoDataLinearRingType) {
+ GeoDataLinearRing* prevRing = static_cast<GeoDataLinearRing*>(placemark->geometry());
+ GeoDataLinearRing* reducedRing = static_cast<GeoDataLinearRing*>(reduce(prevRing));
+ placemark->setGeometry(reducedRing);
+ }
- else if(placemark->geometry()->nodeType() == GeoDataTypes::GeoDataPolygonType){
- GeoDataPolygon* reducedPolygon = new GeoDataPolygon;
- GeoDataPolygon* prevPolygon = static_cast<GeoDataPolygon*>(placemark->geometry());
- GeoDataLinearRing* prevRing = &(prevPolygon->outerBoundary());
- GeoDataLinearRing* reducedRing = static_cast<GeoDataLinearRing*>(reduce(prevRing));
- reducedPolygon->setOuterBoundary(*reducedRing);
- QVector<GeoDataLinearRing>& innerBoundaries = prevPolygon->innerBoundaries();
- for(int i = 0; i < innerBoundaries.size(); i++){
- prevRing = &innerBoundaries[i];
- reducedRing = static_cast<GeoDataLinearRing*>(reduce(prevRing));
- reducedPolygon->appendInnerBoundary(*reducedRing);
+ else if(placemark->geometry()->nodeType() == GeoDataTypes::GeoDataPolygonType) {
+ GeoDataPolygon* reducedPolygon = new GeoDataPolygon;
+ GeoDataPolygon* prevPolygon = static_cast<GeoDataPolygon*>(placemark->geometry());
+ GeoDataLinearRing* prevRing = &(prevPolygon->outerBoundary());
+ GeoDataLinearRing* reducedRing = static_cast<GeoDataLinearRing*>(reduce(prevRing));
+ reducedPolygon->setOuterBoundary(*reducedRing);
+ QVector<GeoDataLinearRing>& innerBoundaries = prevPolygon->innerBoundaries();
+ for(int i = 0; i < innerBoundaries.size(); i++) {
+ prevRing = &innerBoundaries[i];
+ reducedRing = static_cast<GeoDataLinearRing*>(reduce(prevRing));
+ reducedPolygon->appendInnerBoundary(*reducedRing);
+ }
+ placemark->setGeometry(reducedPolygon);
}
- placemark->setGeometry(reducedPolygon);
- }
- }
- qDebug()<<"Total nodes reduced: "<<m_count<<endl;
+ }
+ qDebug()<<"Total nodes reduced: "<<m_count<<endl;
}
-GeoDataLineString* NodeReducer::reduce(GeoDataLineString* lineString){
- qint64 prevSize = lineString->size();
+GeoDataLineString* NodeReducer::reduce(GeoDataLineString* lineString)
+{
+ qint64 prevSize = lineString->size();
- GeoDataLineString* reducedLine;
- if(lineString->nodeType() == GeoDataTypes::GeoDataLineStringType){
- if(prevSize < 2){
- reducedLine = new GeoDataLineString(*lineString);
- return reducedLine;
- }
- else{
- reducedLine = new GeoDataLineString;
+ GeoDataLineString* reducedLine;
+ if(lineString->nodeType() == GeoDataTypes::GeoDataLineStringType) {
+ if(prevSize < 2) {
+ reducedLine = new GeoDataLineString(*lineString);
+ return reducedLine;
+ }
+ else{
+ reducedLine = new GeoDataLineString;
+ }
+ }
+ else if(lineString->nodeType() == GeoDataTypes::GeoDataLinearRingType) {
+ if(prevSize < 2) {
+ reducedLine = new GeoDataLinearRing(*lineString);
+ return reducedLine;
+ }
+ reducedLine = new GeoDataLinearRing;
+ } else {
+ Q_ASSERT(false && "Unexpected GeoDataLineString subtype");
+ return nullptr;
}
- }
- else if(lineString->nodeType() == GeoDataTypes::GeoDataLinearRingType){
- if(prevSize < 2){
- reducedLine = new GeoDataLinearRing(*lineString);
- return reducedLine;
- }
- reducedLine = new GeoDataLinearRing;
- } else {
- Q_ASSERT(false && "Unexpected GeoDataLineString subtype");
- return nullptr;
- }
- QVector<GeoDataCoordinates>::iterator itCoords = lineString->begin();
- GeoDataCoordinates currentCoords = *itCoords;
- reducedLine->append(*itCoords);
- ++itCoords;
- for(; itCoords != (lineString->end() - 1); ++itCoords){
- if(distanceSphere( currentCoords, *itCoords ) >= m_resolution){
- currentCoords = *itCoords;
- reducedLine->append(*itCoords);
+ QVector<GeoDataCoordinates>::iterator itCoords = lineString->begin();
+ GeoDataCoordinates currentCoords = *itCoords;
+ reducedLine->append(*itCoords);
+ ++itCoords;
+ for(; itCoords != (lineString->end() - 1); ++itCoords) {
+ if(distanceSphere( currentCoords, *itCoords ) >= m_resolution) {
+ currentCoords = *itCoords;
+ reducedLine->append(*itCoords);
+ }
}
- }
- reducedLine->append(*itCoords);
+ reducedLine->append(*itCoords);
- qint64 reducedSize = reducedLine->size();
- m_count += (prevSize - reducedSize);
- return reducedLine;
- //qDebug()<<"Nodes reduced "<<(prevSize - reducedSize)<<endl;
+ qint64 reducedSize = reducedLine->size();
+ m_count += (prevSize - reducedSize);
+ return reducedLine;
+ //qDebug()<<"Nodes reduced "<<(prevSize - reducedSize)<<endl;
}
-qreal NodeReducer::resolutionForLevel(int level) {
+qreal NodeReducer::resolutionForLevel(int level) {
switch (level) {
- case 0:
- return 0.0655360;
- break;
- case 1:
- return 0.0327680;
- break;
- case 2:
- return 0.0163840;
- break;
- case 3:
- return 0.0081920;
- break;
- case 4:
- return 0.0040960;
- break;
- case 5:
- return 0.0020480;
- break;
- case 6:
- return 0.0010240;
- break;
- case 7:
- return 0.0005120;
- break;
- case 8:
- return 0.0002560;
- break;
- case 9:
- return 0.0001280;
- break;
- case 10:
- return 0.0000640;
- break;
- case 11:
- return 0.0000320;
- break;
- case 12:
- return 0.0000160;
- break;
- case 13:
- return 0.0000080;
- break;
- case 14:
- return 0.0000040;
- break;
- case 15:
- return 0.0000020;
- break;
- case 16:
- return 0.0000010;
- break;
- default:
- case 17:
- return 0.0000005;
- break;
+ case 0:
+ return 0.0655360;
+ break;
+ case 1:
+ return 0.0327680;
+ break;
+ case 2:
+ return 0.0163840;
+ break;
+ case 3:
+ return 0.0081920;
+ break;
+ case 4:
+ return 0.0040960;
+ break;
+ case 5:
+ return 0.0020480;
+ break;
+ case 6:
+ return 0.0010240;
+ break;
+ case 7:
+ return 0.0005120;
+ break;
+ case 8:
+ return 0.0002560;
+ break;
+ case 9:
+ return 0.0001280;
+ break;
+ case 10:
+ return 0.0000640;
+ break;
+ case 11:
+ return 0.0000320;
+ break;
+ case 12:
+ return 0.0000160;
+ break;
+ case 13:
+ return 0.0000080;
+ break;
+ case 14:
+ return 0.0000040;
+ break;
+ case 15:
+ return 0.0000020;
+ break;
+ case 16:
+ return 0.0000010;
+ break;
+ default:
+ case 17:
+ return 0.0000005;
+ break;
}
}
diff --git a/tools/osm-simplify/WayConcatenator.cpp b/tools/osm-simplify/WayConcatenator.cpp
index e266689..93c31c4 100644
--- a/tools/osm-simplify/WayConcatenator.cpp
+++ b/tools/osm-simplify/WayConcatenator.cpp
@@ -104,7 +104,7 @@ void WayConcatenator::process()
if (chunk != nullptr && otherChunk != nullptr) {
// qDebug()<< "Both* Both chunks found, concatenating to it";
- if(chunk == otherChunk){
+ if(chunk == otherChunk) {
qDebug()<<"#### Both the chunks are same, directly adding to the list of placemarks";
m_wayPlacemarks.append(*placemark);
} else {
@@ -133,7 +133,7 @@ void WayConcatenator::process()
}
- // if(flag){
+ // if(flag) {
// qDebug()<<" Concat not possible";
// m_wayPlacemarks.append(*placemark);
// }
diff --git a/tools/osm-simplify/main.cpp b/tools/osm-simplify/main.cpp
index 06942e9..781e8eb 100644
--- a/tools/osm-simplify/main.cpp
+++ b/tools/osm-simplify/main.cpp
@@ -236,7 +236,7 @@ int main(int argc, char *argv[])
} else if(parser.isSet("node-reduce")) {
qDebug()<<"Entered Node reduce"<<endl;
qDebug()<<"Finished Processing"<<endl;
- if(!parser.isSet("zoom-level")){
+ if(!parser.isSet("zoom-level")) {
qDebug()<<" Zoom level not set"<<endl;
}
else{
@@ -248,7 +248,7 @@ int main(int argc, char *argv[])
}
}
- } else if(parser.isSet("tags-filter") && parser.isSet("concat-ways")){
+ } else if(parser.isSet("tags-filter") && parser.isSet("concat-ways")) {
//Parses the tags given at command line and makes a Hash of key-value pairs