Skip to content

Commit

Permalink
Issue Framstag#1045 - Update projection
Browse files Browse the repository at this point in the history
- MOve TileProjection and MercatorProjection to their own headers
- Move Projections to projection package/directory
- Adapt includes
- Fixed builds
  • Loading branch information
Framstag authored and DerKleinePunk committed Jul 16, 2023
1 parent a7538fd commit 38b2f4c
Show file tree
Hide file tree
Showing 38 changed files with 746 additions and 568 deletions.
16 changes: 8 additions & 8 deletions Android/OsmScoutLib/jni/src/jniMercatorProjection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <string.h>
#include <android/log.h>

#include <osmscout/util/Projection.h>
#include <osmscout/projection/Projection.h>

#include <jniObjectArray.h>

Expand Down Expand Up @@ -109,15 +109,15 @@ jobject Java_osm_scout_MercatorProjection_jniPixelToGeo(JNIEnv *env,
}

double lon, lat;

if (!nativeProjection->PixelToGeo(x, y, lon, lat))
return NULL;

jclass javaClass = env->FindClass("osm/scout/GeoPos");
jmethodID methodId = env->GetMethodID(javaClass,"<init>","(DD)V");
jobject geoPos=env->NewObject(javaClass, methodId, lon, lat);
return geoPos;

return geoPos;
}

jobject Java_osm_scout_MercatorProjection_jniGeoToPixel(JNIEnv *env,
Expand All @@ -133,15 +133,15 @@ jobject Java_osm_scout_MercatorProjection_jniGeoToPixel(JNIEnv *env,
}

double x, y;

if (!nativeProjection->GeoToPixel(lon, lat, x, y))
return NULL;

jclass javaClass = env->FindClass("android/graphics/PointF");
jmethodID methodId = env->GetMethodID(javaClass,"<init>","(FF)V");
jobject point=env->NewObject(javaClass, methodId, (float)x, (float)y);
return point;

return point;
}

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions Android/OsmScoutLib/jni/src/jniOnLoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <android/log.h>

#include <osmscout/Database.h>
#include <osmscout/util/Projection.h>
#include <osmscout/projection/Projection.h>
#include <osmscout/StyleConfig.h>

#include <jniMapPainterCanvas.h>
Expand Down Expand Up @@ -51,7 +51,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved)
gObjectTypeSetsArray=new JniObjectArray<ObjectTypeSets>();
gStyleConfigArray=new JniObjectArray<StyleConfig>();
gTypeConfigArray=new JniObjectArray<TypeConfig>();

return JNI_VERSION_1_6;
}

2 changes: 2 additions & 0 deletions BasemapImport/src/BasemapImport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <vector>
#include <algorithm>

#include <osmscout/projection/MercatorProjection.h>

#include <osmscout/util/CmdLineParsing.h>
#include <osmscout/util/File.h>

Expand Down
7 changes: 5 additions & 2 deletions Demos/include/DrawMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#include <osmscout/Database.h>
#include <osmscout/BasemapDatabase.h>

#include <osmscout/projection/MercatorProjection.h>

#include <osmscout/util/CmdLineParsing.h>

#include <osmscout/Database.h>
#include <osmscoutmap/MapService.h>
#include <osmscout/BasemapDatabase.h>

#include <iostream>

Expand Down
7 changes: 4 additions & 3 deletions Demos/src/ResourceConsumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@


#include <osmscout/Database.h>
#include <osmscoutmap/MapService.h>

#include <osmscoutmap/MapPainter.h>
#include <osmscout/projection/MercatorProjection.h>

#include <osmscout/util/Projection.h>
#include <osmscout/util/StopClock.h>

#include <osmscoutmap/MapService.h>
#include <osmscoutmap/MapPainter.h>

/*
Example for the germany.osm, show germany overview, then zooms into Bonn city
and then zoom into Dortmund city and then zomm into München overview.
Expand Down
6 changes: 5 additions & 1 deletion Demos/src/ResourceConsumptionQt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@
#include <QApplication>

#include <osmscout/Database.h>

#include <osmscout/projection/MercatorProjection.h>

#include <osmscout/util/StopClock.h>

#include <osmscoutmap/MapService.h>

#include <osmscoutmapqt/MapPainterQt.h>

#include <osmscout/util/StopClock.h>

/*
Example for the germany.osm, show germany overview, then zooms into Bonn city
Expand Down
13 changes: 7 additions & 6 deletions Demos/src/RoutingAnimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@
#include <list>

#include <osmscout/Database.h>
#include <osmscoutmap/MapService.h>

#include <osmscout/util/Projection.h>
#include <osmscout/util/Geometry.h>
#include <osmscout/util/CmdLineParsing.h>

#include <osmscoutmapqt/MapPainterQt.h>
#include <osmscout/projection/MercatorProjection.h>

#include <osmscout/routing/SimpleRoutingService.h>
#include <osmscout/routing/RoutePostprocessor.h>
#include <osmscout/routing/RoutingService.h>

#include <osmscout/util/Geometry.h>
#include <osmscout/util/CmdLineParsing.h>

#include <osmscoutmap/MapService.h>

#include <osmscoutmapqt/MapPainterQt.h>

//#define ROUTE_DEBUG
//#define NODE_DEBUG
Expand Down
2 changes: 2 additions & 0 deletions Demos/src/Tiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@

#include <osmscout/Database.h>

#include <osmscout/projection/TileProjection.h>

#include <osmscout/util/StopClock.h>
#include <osmscout/util/Tiling.h>
#include <osmscout/util/CmdLineParsing.h>
Expand Down
2 changes: 2 additions & 0 deletions Tests/src/MapRotate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include <iostream>

#include <osmscout/projection/MercatorProjection.h>

#include <osmscoutmap/MapPainterNoOp.h>

#include <TestMain.h>
Expand Down
2 changes: 1 addition & 1 deletion Tests/src/MercatorProjection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#include <osmscout/util/Projection.h>
#include "osmscout/projection/MercatorProjection.h"

#include <TestMain.h>

Expand Down
3 changes: 3 additions & 0 deletions Tests/src/PerformanceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
#include "config.h"

#include <osmscout/Database.h>

#include <osmscout/projection/TileProjection.h>

#include <osmscoutmap/MapService.h>

#if defined(HAVE_LIB_OSMSCOUTMAPCAIRO)
Expand Down
2 changes: 2 additions & 0 deletions Tests/src/TransPolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include <TestWay.h>

#include <osmscout/projection/MercatorProjection.h>

#include <osmscout/util/Geometry.h>
#include <osmscout/util/Transformation.h>

Expand Down
5 changes: 4 additions & 1 deletion libosmscout-client-qt/include/osmscoutclientqt/DBJob.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@
#include <QReadWriteLock>

#include <osmscout/BasemapDatabase.h>
#include <osmscoutclientqt/DBInstance.h>

#include <osmscout/projection/MercatorProjection.h>

#include <osmscoutmap/DataTileCache.h>

#include <osmscoutclientqt/DBInstance.h>
#include <osmscoutclientqt/ClientQtImportExport.h>

namespace osmscout {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@

#include <osmscoutclientqt/ClientQtImportExport.h>

#include <osmscout/util/Projection.h>
#include <osmscout/projection/Projection.h>

#include <osmscoutclientqt/IconLookup.h>

#include <QObject>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <osmscoutclientqt/InputHandler.h>
#include <osmscoutclientqt/OSMTile.h>

#include <osmscout/util/Projection.h>
#include <osmscout/projection/MercatorProjection.h>

#include <osmscout/system/Math.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@

#include <osmscout/GroundTile.h>

#include <osmscout/projection/Projection.h>

#include <osmscout/util/FileWriter.h>
#include <osmscout/util/Geometry.h>
#include <osmscout/util/Progress.h>
#include <osmscout/util/Projection.h>
#include <osmscout/util/Transformation.h>

#include <osmscout/system/Compiler.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
#include <osmscout/system/Assert.h>
#include <osmscout/system/Math.h>

#include <osmscout/projection/MercatorProjection.h>

#include <osmscout/util/File.h>
#include <osmscout/util/GeoBox.h>
#include <osmscout/util/Geometry.h>
#include <osmscout/util/Number.h>
#include <osmscout/util/Projection.h>
#include <osmscout/util/TileId.h>
#include <osmscout/util/Transformation.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@
#include <osmscout/system/Assert.h>
#include <osmscout/system/Math.h>

#include <osmscout/projection/MercatorProjection.h>

#include <osmscout/util/File.h>
#include <osmscout/util/Geometry.h>
#include <osmscout/util/GeoBox.h>
#include <osmscout/util/Number.h>
#include <osmscout/util/Projection.h>
#include <osmscout/util/TileId.h>
#include <osmscout/util/Transformation.h>

Expand Down
2 changes: 1 addition & 1 deletion libosmscout-import/src/osmscoutimport/GenWaterIndex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <osmscout/WaterIndex.h>
#include <osmscout/WayDataFile.h>

#include <osmscout/system/Math.h>
#include <osmscout/projection/MercatorProjection.h>

#include <osmscout/util/File.h>
#include <osmscout/util/FileScanner.h>
Expand Down
3 changes: 1 addition & 2 deletions libosmscout-map-gdi/src/osmscoutmapgdi/MapPainterGDI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ namespace osmscout {

result.emplace_back();
result.back().glyph.character = WStringToUTF8String(buffer.data());
result.back().position.SetX(horizontalOffset);
result.back().position.SetY(0);
result.back().position=Vertex2D(horizontalOffset,0);

Gdiplus::RectF bb;

Expand Down
6 changes: 3 additions & 3 deletions libosmscout-map-iosx/src/osmscout/MapPainterIOS.mm
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ static void DrawPattern (void * info,CGContextRef cg){
glyph.glyph.line = label.line[i];
glyph.glyph.run = run;
glyph.glyph.index = index;
glyph.position.Set(glyphPositions[index].x, glyphPositions[index].y);
glyph.position=Vertex2D(glyphPositions[index].x, glyphPositions[index].y);
result.push_back(std::move(glyph));
}
i++;
Expand Down Expand Up @@ -586,7 +586,7 @@ static void DrawPattern (void * info,CGContextRef cg){
hnd.transEnd = transStart;
}
hnd.direction = (hnd.transStart < hnd.transEnd) ? 1 : -1;
origin.Set(coordBuffer.buffer[hnd.transStart].GetX(), coordBuffer.buffer[hnd.transStart].GetY());
origin=Vertex2D(coordBuffer.buffer[hnd.transStart].GetX(), coordBuffer.buffer[hnd.transStart].GetY());
}

bool MapPainterIOS::followPath(FollowPathHandle &hnd, double l, Vertex2D &origin) {
Expand All @@ -609,7 +609,7 @@ static void DrawPattern (void * info,CGContextRef cg){

fracToGo = l/len;
if(fracToGo <= 1.0) {
origin.Set(x + deltaX*fracToGo,y + deltaY*fracToGo);
origin=Vertex2D(x + deltaX*fracToGo,y + deltaY*fracToGo);
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include <osmscoutmapopengl/MapOpenGLImportExport.h>

#include <osmscout/util/Projection.h>
#include <osmscout/projection/MercatorProjection.h>

#include <cassert>

Expand Down
2 changes: 1 addition & 1 deletion libosmscout-map/include/osmscoutmap/BatchMapPainter.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <osmscoutmap/MapImportExport.h>

#include <osmscout/util/Projection.h>
#include <osmscout/projection/Projection.h>

#include <osmscoutmap/MapData.h>
#include <osmscoutmap/MapPainter.h>
Expand Down
3 changes: 2 additions & 1 deletion libosmscout-map/include/osmscoutmap/MapPainter.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@

#include <osmscoutmap/MapData.h>

#include <osmscout/projection/Projection.h>

#include <osmscout/util/Breaker.h>
#include <osmscout/util/Geometry.h>
#include <osmscout/util/Projection.h>
#include <osmscout/util/Transformation.h>

#include <osmscout/system/Compiler.h>
Expand Down
3 changes: 2 additions & 1 deletion libosmscout-map/include/osmscoutmap/MapPainterStatistics.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
#include <osmscoutmap/MapImportExport.h>

#include <osmscout/TypeConfig.h>
#include <osmscout/util/Projection.h>

#include <osmscout/projection/Projection.h>

#include <osmscoutmap/MapParameter.h>
#include <osmscoutmap/MapData.h>
Expand Down
4 changes: 3 additions & 1 deletion libosmscout-map/include/osmscoutmap/Styles.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@
#include <osmscoutmap/MapImportExport.h>

#include <osmscout/Pixel.h>

#include <osmscout/projection/Projection.h>

#include <osmscout/util/Color.h>
#include <osmscout/util/LaneTurn.h>
#include <osmscout/util/Projection.h>
#include <osmscout/util/ScreenBox.h>

#include <osmscoutmap/StyleDescription.h>
Expand Down
Loading

0 comments on commit 38b2f4c

Please sign in to comment.