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

Even more whitespace fixes

parent a4135f7e
......@@ -435,11 +435,11 @@ void BaseClipper::clipPolyObject ( const QPolygonF & polygon,
if(!intersections.isEmpty()) {
// qDebug() << "intersections count:" << intersections.size();
// qDebug() << "intersectionsTop count:" << intersectionsTop.size();
// qDebug() << "intersectionsRight count:" << intersectionsRight.size();
// qDebug() << "intersectionsBottom count:" << intersectionsBottom.size();
// qDebug() << "intersectionsLeft count:" << intersectionsLeft.size();
// qDebug() << "intersections count:" << intersections.size();
// qDebug() << "intersectionsTop count:" << intersectionsTop.size();
// qDebug() << "intersectionsRight count:" << intersectionsRight.size();
// qDebug() << "intersectionsBottom count:" << intersectionsBottom.size();
// qDebug() << "intersectionsLeft count:" << intersectionsLeft.size();
clippedPolyObjects.clear();
clippedPolyObject = QPolygonF();
......@@ -512,12 +512,12 @@ void BaseClipper::clipPolyObject ( const QPolygonF & polygon,
}
clippedPolyObject << it->point();
// // To avoid crashes because of infinite loop.
// // Needs to be investigated
// if(clippedPolyObject.size() > basePolygon.size()) {
// qDebug() << "Something went wrong, exiting current clipping loop...";
// break;
// }
// // To avoid crashes because of infinite loop.
// // Needs to be investigated
// if(clippedPolyObject.size() > basePolygon.size()) {
// qDebug() << "Something went wrong, exiting current clipping loop...";
// break;
// }
} while(clippedPolyObject.first() != clippedPolyObject.last());
......
......@@ -91,20 +91,20 @@ private:
void clipMultiple( QPolygonF & clippedPolyObject,
QVector<QPolygonF> & clippedPolyObjects,
bool isClosed );
QVector<QPolygonF> & clippedPolyObjects,
bool isClosed );
void clipOnce( QPolygonF & clippedPolyObject,
QVector<QPolygonF> & clippedPolyObjects,
bool isClosed );
QVector<QPolygonF> & clippedPolyObjects,
bool isClosed );
void clipOnceCorner( QPolygonF & clippedPolyObject,
QVector<QPolygonF> & clippedPolyObjects,
const QPointF& corner,
const QPointF& point,
bool isClosed );
QVector<QPolygonF> & clippedPolyObjects,
const QPointF& corner,
const QPointF& point,
bool isClosed );
void clipOnceEdge( QPolygonF & clippedPolyObject,
QVector<QPolygonF> & clippedPolyObjects,
const QPointF& point,
bool isClosed );
QVector<QPolygonF> & clippedPolyObjects,
const QPointF& point,
bool isClosed );
static inline qreal _m( const QPointF & start, const QPointF & end );
......
......@@ -23,7 +23,7 @@ namespace Marble{
TagsFilter::TagsFilter(GeoDataDocument *document, const QStringList &tagsList, bool andFlag ) : PlacemarkFilter(document)
{
int total=0, tagCount=0;
// qDebug()<<"Entered tagFilter";
// qDebug()<<"Entered tagFilter";
QVector<GeoDataPlacemark*> previousObjects(placemarks());
placemarks().clear();
foreach (GeoDataPlacemark *placemark, previousObjects) {
......@@ -46,38 +46,38 @@ TagsFilter::TagsFilter(GeoDataDocument *document, const QStringList &tagsList, b
contains = placemark->osmData().containsTagKey(currentKey);
} else {
contains = placemark->osmData().containsTag(currentKey, currentValue);
}
}
if (!contains) {
if (andFlag) {
flag = false;
break;
}
flag = false;
break;
}
} else {
if (!andFlag) {
flag = true;
break;
}
}
}
flag = true;
break;
}
}
}
if (flag) {
++tagCount;
// qDebug()<<"Contained tag";
// qDebug()<<"Contained tag";
placemarks().append(placemark);
// qDebug()<<"ID "<<placemark->osmData().id();
// qDebug()<<"ID "<<placemark->osmData().id();
} else {
m_rejectedObjects.append(placemark);
}
}
}
// qDebug()<<"Done TagFiltering";
// qDebug()<<"Total"<<total;
// qDebug()<<"TagCount"<<tagcon;
// qDebug()<<"Is and : "<<andFlag;
}
// qDebug()<<"Done TagFiltering";
// qDebug()<<"Total"<<total;
// qDebug()<<"TagCount"<<tagcon;
// qDebug()<<"Is and : "<<andFlag;
}
void TagsFilter::process()
{
//does nothing
//does nothing
}
}
......
......@@ -24,9 +24,9 @@ class GeoDataDocument;
class TagsFilter : public PlacemarkFilter
{
public:
//Filters placemarks which have tags in the hash
TagsFilter(GeoDataDocument* document, const QStringList& tagsList, bool andFlag = false);
virtual void process();
//Filters placemarks which have tags in the hash
TagsFilter(GeoDataDocument* document, const QStringList& tagsList, bool andFlag = false);
virtual void process();
QVector<GeoDataPlacemark*>::const_iterator rejectedObjectsBegin() const;
QVector<GeoDataPlacemark*>::const_iterator rejectedObjectsEnd() const;
private:
......
......@@ -67,10 +67,10 @@ GeoDataDocument *TinyPlanetProcessor::cutToTiles(unsigned int zoomLevel, unsigne
QVector<QPolygonF> outerBoundaries;
clipper.clipPolyObject(outerBoundaryPolygon, outerBoundaries, true);
// qDebug() << "Size(s) after:";
// qDebug() << "Size(s) after:";
foreach(const QPolygonF& polygon, outerBoundaries) {
// qDebug() << polygon.size();
// qDebug() << polygon.size();
PolygonPair newMarblePolygon = qMakePair(new GeoDataPlacemark(), polygon);
GeoDataPolygon* geometry = new GeoDataPolygon();
......@@ -133,11 +133,11 @@ GeoDataDocument *TinyPlanetProcessor::cutToTiles(unsigned int zoomLevel, unsigne
clipper.clipPolyObject(way, clippedPolygons, false);
// qDebug() << "Size before:" << way.size();
// qDebug() << "Size(s) after:";
// qDebug() << "Size before:" << way.size();
// qDebug() << "Size(s) after:";
foreach(const QPolygonF& polygon, clippedPolygons) {
// qDebug() << polygon.size();
// qDebug() << polygon.size();
GeoDataLineString* newMarbleWay = new GeoDataLineString(BaseClipper::toLineString<GeoDataLineString>(polygon));
......@@ -149,27 +149,27 @@ GeoDataDocument *TinyPlanetProcessor::cutToTiles(unsigned int zoomLevel, unsigne
}
} else if (placemark->geometry()->nodeType() == GeoDataTypes::GeoDataLinearRingType) {
GeoDataLinearRing* marbleClosedWay = static_cast<GeoDataLinearRing*>(placemark->geometry());
GeoDataLinearRing* marbleClosedWay = static_cast<GeoDataLinearRing*>(placemark->geometry());
QVector<QPolygonF> clippedPolygons;
QVector<QPolygonF> clippedPolygons;
QPolygonF closedWay = BaseClipper::toQPolygon(*marbleClosedWay);
QPolygonF closedWay = BaseClipper::toQPolygon(*marbleClosedWay);
clipper.clipPolyObject(closedWay, clippedPolygons, true);
clipper.clipPolyObject(closedWay, clippedPolygons, true);
// qDebug() << "Size(s) after:";
foreach(const QPolygonF& polygon, clippedPolygons) {
// qDebug() << "Size(s) after:";
foreach(const QPolygonF& polygon, clippedPolygons) {
// qDebug() << polygon.size();
// qDebug() << polygon.size();
GeoDataLinearRing* newMarbleWay = new GeoDataLinearRing(BaseClipper::toLineString<GeoDataLinearRing>(polygon));
GeoDataLinearRing* newMarbleWay = new GeoDataLinearRing(BaseClipper::toLineString<GeoDataLinearRing>(polygon));
GeoDataPlacemark* newPlacemark = new GeoDataPlacemark();
newPlacemark->setGeometry(newMarbleWay);
copyTags(*placemark, *newPlacemark);
GeoDataPlacemark* newPlacemark = new GeoDataPlacemark();
newPlacemark->setGeometry(newMarbleWay);
copyTags(*placemark, *newPlacemark);
tile->append(newPlacemark);
}
tile->append(newPlacemark);
}
} else {
tile->append(placemark);
......
......@@ -24,38 +24,38 @@ namespace Marble
WayChunk::WayChunk(GeoDataPlacemark *placemark, qint64 first, qint64 last)
{
m_wayList.append(placemark);
m_first = first;
m_last = last;
m_visualCategory = placemark->visualCategory();
m_wayList.append(placemark);
m_first = first;
m_last = last;
m_visualCategory = placemark->visualCategory();
}
WayChunk::~WayChunk()
{
}
qint64 WayChunk::first() const
{
return m_first;
return m_first;
}
qint64 WayChunk::last() const
{
return m_last;
return m_last;
}
void WayChunk::append(GeoDataPlacemark *placemark, qint64 last)
{
m_wayList.append(placemark);
m_last = last;
m_wayList.append(placemark);
m_last = last;
}
void WayChunk::prepend(GeoDataPlacemark *placemark, qint64 first)
{
m_wayList.prepend(placemark);
m_first = first;
m_wayList.prepend(placemark);
m_first = first;
}
......@@ -78,51 +78,51 @@ GeoDataPlacemark* WayChunk::merge()
GeoDataLineString *currentLine = static_cast<GeoDataLineString*>( (*itr)->geometry() );
currentLine->remove(0);
(*line) << *currentLine;
}
//qDebug()<<"Merging placemark";
}
//qDebug()<<"Merging placemark";
return placemark;
}
void WayChunk::reverse()
{
std::reverse(m_wayList.begin(), m_wayList.end());
QList<GeoDataPlacemark*>::iterator itr = m_wayList.begin();
std::reverse(m_wayList.begin(), m_wayList.end());
QList<GeoDataPlacemark*>::iterator itr = m_wayList.begin();
for (; itr != m_wayList.end(); ++itr) {
GeoDataPlacemark *placemark = *itr;
GeoDataLineString *line = static_cast<GeoDataLineString*>(placemark->geometry());
line->reverse();
}
line->reverse();
}
qSwap(m_first, m_last);
}
qint64 WayChunk::id() const
{
return m_wayList.first()->osmData().id();
return m_wayList.first()->osmData().id();
}
void WayChunk::printIds() const
{
QList<GeoDataPlacemark*>::const_iterator itr = m_wayList.begin();
qDebug()<<"IDs of placemarks in chunk";
QList<GeoDataPlacemark*>::const_iterator itr = m_wayList.begin();
qDebug()<<"IDs of placemarks in chunk";
for (; itr != m_wayList.end(); ++itr) {
qDebug()<<"Id :- "<<(*itr)->osmData().id();
}
qDebug()<<"Id :- "<<(*itr)->osmData().id();
}
}
int WayChunk::size() const
{
return m_wayList.size();
return m_wayList.size();
}
bool WayChunk::concatPossible(GeoDataPlacemark *placemark) const
{
GeoDataFeature::GeoDataVisualCategory category = placemark->visualCategory();
return (category == m_visualCategory);
GeoDataFeature::GeoDataVisualCategory category = placemark->visualCategory();
return (category == m_visualCategory);
}
GeoDataFeature::GeoDataVisualCategory WayChunk::visualCategory() const
{
return m_visualCategory;
return m_visualCategory;
}
......
......@@ -26,7 +26,7 @@ class WayChunk
{
public:
WayChunk(GeoDataPlacemark *placemark, qint64 first, qint64 last );
~WayChunk();
~WayChunk();
void append(GeoDataPlacemark *placemark, qint64 last);
void append(WayChunk *chunk);
void prepend(GeoDataPlacemark *placemark, qint64 first);
......@@ -37,20 +37,20 @@ public:
*/
GeoDataPlacemark* merge();
qint64 first() const;
qint64 last() const;
void reverse();
qint64 first() const;
qint64 last() const;
void reverse();
qint64 id() const;
void printIds() const;
void printIds() const;
int size() const;
bool concatPossible(GeoDataPlacemark *placemark) const;
GeoDataFeature::GeoDataVisualCategory visualCategory() const;
private:
QList<GeoDataPlacemark*> m_wayList;
qint64 m_first;
qint64 m_last;
GeoDataFeature::GeoDataVisualCategory m_visualCategory;
qint64 m_first;
qint64 m_last;
GeoDataFeature::GeoDataVisualCategory m_visualCategory;
};
......
......@@ -22,20 +22,20 @@ class WayConcatenator : public TagsFilter
{
public:
WayConcatenator(GeoDataDocument *document, const QStringList &tagsList, bool andFlag = false);
virtual void process();
~WayConcatenator();
virtual void process();
~WayConcatenator();
private:
QMultiHash<qint64, WayChunk*> m_hash;
QVector<WayChunk*> m_chunks;
QMultiHash<qint64, WayChunk*> m_hash;
QVector<WayChunk*> m_chunks;
QVector<GeoDataPlacemark> m_wayPlacemarks;
void createWayChunk(GeoDataPlacemark *placemark, qint64 firstId, qint64 lastId);
WayChunk* getWayChunk(GeoDataPlacemark *placemark, qint64 matchId);
void concatFirst(GeoDataPlacemark *placemark, WayChunk *chunk);
void concatLast(GeoDataPlacemark *placemark, WayChunk *chunk);
void concatBoth(GeoDataPlacemark *placemark, WayChunk *chunk, WayChunk *otherChunk);
void addRejectedPlacemarks();
void addWayChunks();
void modifyDocument();
void addRejectedPlacemarks();
void addWayChunks();
void modifyDocument();
};
}
......
......@@ -109,18 +109,18 @@ int main(int argc, char *argv[])
parser.addPositionalArgument("input", "The input .osm or .shp file.");
parser.addOptions({
{{"d","debug"}, "Debug output in the terminal."},
{{"s","silent"}, "Don't output to terminal."},
{{"m","merge"}, "Merge the main document with the file <file_to_merge_with>. This works together with the -c flag.", "file_to_merge_with"},
{{"c", "cut-to-tiles"}, "Cuts into tiles based on the zoom level passed using -z."},
{{"n", "node-reduce"}, "Reduces the number of nodes for a given way based on zoom level"},
{{"z", "zoom-level"}, "Zoom level according to which OSM information has to be processed.", "number"},
{{"t", "tags-filter"}, "Tag key-value pairs which are to be be considered", "k1=v1,k2=v2..."},
{{"and", "tags-and"}, "For a feature to be considered for processing it must contain all the specified using tags-filter"},
{{"w", "concat-ways"}, "Concatenates the ways which are specified using tags-filter"},
{{"o", "output"}, "Generates an output .osmfile based on other flags. If the cut-to-tiles flag is set, then this needs to be a directory.", "output_file.osm"},
{{"e", "extension"}, "Output file type: osm (default), o5m or kml", "file extension", "osm"}
});
{{"d","debug"}, "Debug output in the terminal."},
{{"s","silent"}, "Don't output to terminal."},
{{"m","merge"}, "Merge the main document with the file <file_to_merge_with>. This works together with the -c flag.", "file_to_merge_with"},
{{"c", "cut-to-tiles"}, "Cuts into tiles based on the zoom level passed using -z."},
{{"n", "node-reduce"}, "Reduces the number of nodes for a given way based on zoom level"},
{{"z", "zoom-level"}, "Zoom level according to which OSM information has to be processed.", "number"},
{{"t", "tags-filter"}, "Tag key-value pairs which are to be be considered", "k1=v1,k2=v2..."},
{{"and", "tags-and"}, "For a feature to be considered for processing it must contain all the specified using tags-filter"},
{{"w", "concat-ways"}, "Concatenates the ways which are specified using tags-filter"},
{{"o", "output"}, "Generates an output .osmfile based on other flags. If the cut-to-tiles flag is set, then this needs to be a directory.", "output_file.osm"},
{{"e", "extension"}, "Output file type: osm (default), o5m or kml", "file extension", "osm"}
});
// Process the actual command line arguments given by the user
parser.process(app);
......@@ -254,7 +254,7 @@ int main(int argc, char *argv[])
//Parses the tags given at command line and makes a Hash of key-value pairs
qDebug()<<" Parsed tf value: "<<parser.value("tags-filter")<<endl;
QStringList tagsList = parser.value("tags-filter").split(QLatin1Char(','));
//Filters and considers only those placemarks which have all the key-value pairs given at command line
//Filters and considers only those placemarks which have all the key-value pairs given at command line
WayConcatenator concatenator(map, tagsList, parser.isSet("tags-and"));
concatenator.process();
......
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