/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// #ifndef _ODGENERALMAPS_INCLUDED_ #define _ODGENERALMAPS_INCLUDED_ #include "OdaCommon.h" // EPSG:3857 WGS 84 / Web Mercator, Pseudo-Mercator -- Spherical Mercator, Google Maps, OpenStreetMap, Bing, ArcGIS, ESRI. Unit: meter // EPSG:4326 WGS 84 -- WGS84 - World Geodetic System 1984, used in GPS. Unit: degree namespace OdGeneralMaps { const double EarthRadius = 6378137.; const double MinLatitude = -85.05112878; const double MaxLatitude = 85.05112878; const double MinLongitude = -180.; const double MaxLongitude = 180.; void convertSphericalMercatorToWGS84(double dX, double dY, double& dLat, double& dLon); void convertWGS84ToSphericalMercator(double dLat, double dLon, double& dX, double& dY); double clip(double dValue, double dMinValue, double dMaxValue); OdUInt32 mapSize(OdUInt8 uLOD, OdUInt32 uTileSize); double groundResolution(double dLatitude, OdUInt8 uLOD, OdUInt32 uTileSize); double mapScale(double dLatitude, OdUInt8 uLOD, int nScreenDpi, OdUInt32 uTileSize); void convertLatLongToPixelXY(double dLatitude, double dLongitude, OdUInt8 uLOD, OdUInt32 uTileSize, OdUInt32& uPixelX, OdUInt32& uPixelY); void convertPixelXYToLatLong(OdUInt32 uPixelX, OdUInt32 uPixelY, OdUInt8 uLOD, OdUInt32 uTileSize, double& dLatitude, double& dLongitude); void convertTileXYToPixelXY(OdUInt32 uTileX, OdUInt32 uTileY, OdUInt32 uTileSize, OdUInt32& uPixelX, OdUInt32& uPixelY); void convertPixelXYToTileXY(OdUInt32 uPixelX, OdUInt32 uPixelY, OdUInt32 uTileSize, OdUInt32& uTileX, OdUInt32& uTileY); void convertTileXYToLatLong(OdUInt32 uTileX, OdUInt32 uTileY, OdUInt8 uLOD, OdUInt32 uTileSize, double& dLatitude, double& dLongitude); void convertLatLongToTileXY(double dLatitude, double dLongitude, OdUInt8 uLOD, OdUInt32 uTileSize, OdUInt32& uTileX, OdUInt32& uTileY); bool isTileValid(OdUInt8 uLOD, OdUInt32 uTileX, OdUInt32 uTileY); }; #endif // _ODGENERALMAPS_INCLUDED_