summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Nienhüser <nienhueser@kde.org>2016-09-11 05:51:01 (GMT)
committerDennis Nienhüser <nienhueser@kde.org>2016-09-11 05:53:40 (GMT)
commit0df741d697c7d68d10a3c693ad5f2ea804a86385 (patch)
treee59552edb0687fdaf64942799f500d8dd6bb3377
parent939554605ddb02436a1941dff54954dd249452bc (diff)
ShpCoastlineProcessor is superseded by TinyPlanetProcessor
-rw-r--r--tools/vectorosm-tilecreator/CMakeLists.txt1
-rw-r--r--tools/vectorosm-tilecreator/ShpCoastlineProcessor.cpp106
-rw-r--r--tools/vectorosm-tilecreator/ShpCoastlineProcessor.h30
-rw-r--r--tools/vectorosm-tilecreator/main.cpp35
4 files changed, 0 insertions, 172 deletions
diff --git a/tools/vectorosm-tilecreator/CMakeLists.txt b/tools/vectorosm-tilecreator/CMakeLists.txt
index 8763b90..dda6576 100644
--- a/tools/vectorosm-tilecreator/CMakeLists.txt
+++ b/tools/vectorosm-tilecreator/CMakeLists.txt
@@ -27,7 +27,6 @@ main.cpp
BaseClipper.cpp
BaseFilter.cpp
PlacemarkFilter.cpp
-ShpCoastlineProcessor.cpp
TinyPlanetProcessor.cpp
NodeReducer.cpp
TagsFilter.cpp
diff --git a/tools/vectorosm-tilecreator/ShpCoastlineProcessor.cpp b/tools/vectorosm-tilecreator/ShpCoastlineProcessor.cpp
deleted file mode 100644
index 8781264..0000000
--- a/tools/vectorosm-tilecreator/ShpCoastlineProcessor.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-//
-// This file is part of the Marble Virtual Globe.
-//
-// This program is free software licensed under the GNU LGPL. You can
-// find a copy of this license in LICENSE.txt in the top directory of
-// the source code.
-//
-// Copyright 2016 David Kolozsvari <freedawson@gmail.com>
-//
-
-#include "ShpCoastlineProcessor.h"
-
-#include "BaseClipper.h"
-#include "TileId.h"
-
-#include "GeoDataPlacemark.h"
-#include "OsmPlacemarkData.h"
-
-#include <QPolygonF>
-#include <QDebug>
-
-namespace Marble {
-
-ShpCoastlineProcessor::ShpCoastlineProcessor(GeoDataDocument* document) :
- PlacemarkFilter(document)
-{
-
-}
-
-void ShpCoastlineProcessor::process()
-{
- OsmPlacemarkData marbleLand;
- marbleLand.addTag("marble_land","landmass");
-
- foreach (GeoDataPlacemark* placemark, placemarks()) {
- if(placemark->geometry()->nodeType() == GeoDataTypes::GeoDataPolygonType) {
- placemark->setOsmData(marbleLand);
- }
- }
-}
-
-GeoDataDocument *ShpCoastlineProcessor::cutToTiles(unsigned int zoomLevel, unsigned int tileX, unsigned int tileY)
-{
- unsigned int N = pow(2, zoomLevel);
-
- GeoDataDocument* tile = new GeoDataDocument();
- QString tileName = QString("%1/%2/%3").arg(zoomLevel).arg(tileX).arg(tileY);
- tile->setName(tileName);
-
- GeoDataLatLonBox tileBoundary;
- qreal north = TileId::tileY2lat(tileY, N);
- qreal south = TileId::tileY2lat(tileY+1, N);
- qreal west = TileId::tileX2lon(tileX, N);
- qreal east = TileId::tileX2lon(tileX+1, N);
-
- // qDebug() << tileName;
- // qDebug() << "west: " << west*RAD2DEG << "\t east: " << east*RAD2DEG;
- // qDebug() << "north: " << north*RAD2DEG << "\t south: " << south*RAD2DEG;
- // qDebug() << "\n";
-
- tileBoundary.setBoundaries(north, south, east, west);
-
- foreach (GeoDataPlacemark* placemark, placemarks()) {
-
- if(placemark->geometry()->nodeType() == GeoDataTypes::GeoDataPolygonType) {
- GeoDataPolygon* marblePolygon = static_cast<GeoDataPolygon*>(placemark->geometry());
-
- if(tileBoundary.intersects(marblePolygon->latLonAltBox())) {
- BaseClipper clipper;
- clipper.initClipRect(tileBoundary, 20);
-
- QVector<QPolygonF> clippedPolygons;
-
- QPolygonF outerBoundary = BaseClipper::toQPolygon(marblePolygon->outerBoundary());
- qDebug() << "Size before:" << outerBoundary.size();
-
- qDebug() << "Clipping...";
- clipper.clipPolyObject(outerBoundary, clippedPolygons, true);
- qDebug() << "done.";
-
- qDebug() << "Number of polygons after clipping: " << clippedPolygons.size();
- qDebug() << "Size(s) after:";
- foreach(const QPolygonF& polygon, clippedPolygons) {
- qDebug() << polygon.size();
-
- GeoDataLinearRing outerBoundary = BaseClipper::toLineString<GeoDataLinearRing>(polygon);
- GeoDataPolygon* newMarblePolygon = new GeoDataPolygon();
- newMarblePolygon->setOuterBoundary(outerBoundary);
-
- GeoDataPlacemark* newPlacemark = new GeoDataPlacemark();
- newPlacemark->setGeometry(newMarblePolygon);
- newPlacemark->setVisualCategory(GeoDataFeature::Landmass);
- newPlacemark->setOsmData(placemark->osmData());
-
- tile->append(newPlacemark);
- }
- qDebug() << "";
- }
- }
- }
-
-
- return tile;
-}
-
-}
diff --git a/tools/vectorosm-tilecreator/ShpCoastlineProcessor.h b/tools/vectorosm-tilecreator/ShpCoastlineProcessor.h
deleted file mode 100644
index 8090479..0000000
--- a/tools/vectorosm-tilecreator/ShpCoastlineProcessor.h
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// This file is part of the Marble Virtual Globe.
-//
-// This program is free software licensed under the GNU LGPL. You can
-// find a copy of this license in LICENSE.txt in the top directory of
-// the source code.
-//
-// Copyright 2016 David Kolozsvari <freedawson@gmail.com>
-//
-
-#ifndef COASTLINEFILTER_H
-#define COASTLINEFILTER_H
-
-#include "PlacemarkFilter.h"
-
-namespace Marble {
-
-class ShpCoastlineProcessor : public PlacemarkFilter
-{
-public:
- explicit ShpCoastlineProcessor(GeoDataDocument* document);
-
- void process() override;
-
- GeoDataDocument* cutToTiles(unsigned int zoomLevel, unsigned int tileX, unsigned int tileY);
-};
-
-}
-
-#endif // COASTLINEFILTER_H
diff --git a/tools/vectorosm-tilecreator/main.cpp b/tools/vectorosm-tilecreator/main.cpp
index b3e85e9..2d9990a 100644
--- a/tools/vectorosm-tilecreator/main.cpp
+++ b/tools/vectorosm-tilecreator/main.cpp
@@ -23,7 +23,6 @@
#include <QMessageLogContext>
-#include "ShpCoastlineProcessor.h"
#include "TinyPlanetProcessor.h"
#include "NodeReducer.h"
#include "WayConcatenator.h"
@@ -265,40 +264,6 @@ int main(int argc, char *argv[])
delete tile1;
delete tile2;
}
- } else if(file.suffix() == QLatin1String("shp") && parser.isSet("cut-to-tiles")) {
- ShpCoastlineProcessor processor(map);
- processor.process();
- GeoDataLatLonBox world(85.0, -85.0, 180.0, -180.0, GeoDataCoordinates::Degree);
- //TileIterator iter(map->latLonAltBox(), zoomLevel);
- TileIterator iter(world, zoomLevel);
- foreach(auto const &tileId, iter) {
- GeoDataDocument* tile = processor.cutToTiles(zoomLevel, tileId.x(), tileId.y());
- if (!writeTile(parser, outputName, tile, tileId.x(), tileId.y(), zoomLevel)) {
- return 4;
- }
- qInfo() << tile->name() << " done";
- delete tile;
- }
- } else if (file.suffix() == QLatin1String("osm") && parser.isSet("cut-to-tiles") && parser.isSet("merge")) {
- TinyPlanetProcessor processor(map);
- processor.process();
- ShpCoastlineProcessor shpProcessor(mergeMap);
- shpProcessor.process();
- GeoDataLatLonBox world(85.0, -85.0, 180.0, -180.0, GeoDataCoordinates::Degree);
- //TileIterator iter(map->latLonAltBox(), zoomLevel);
- TileIterator iter(world, zoomLevel);
- foreach(auto const &tileId, iter) {
- GeoDataDocument* tile1 = processor.cutToTiles(zoomLevel, tileId.x(), tileId.y());
- GeoDataDocument* tile2 = shpProcessor.cutToTiles(zoomLevel, tileId.x(), tileId.y());
- GeoDataDocument* tile = mergeDocuments(tile1, tile2);
- if (!writeTile(parser, outputName, tile, tileId.x(), tileId.y(), zoomLevel)) {
- return 4;
- }
- qInfo() << tile->name() << " done";
- delete tile1;
- delete tile2;
- delete tile;
- }
} else if (file.suffix() == QLatin1String("osm") && parser.isSet("cut-to-tiles")) {
TinyPlanetProcessor processor(map);