Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: terrain/Include/lSystem.h
- ===================================================================
- --- terrain/Include/lSystem.h (revision 91366)
- +++ terrain/Include/lSystem.h (working copy)
- @@ -74,6 +74,11 @@
- // Размер квадрата по уровню детализации
- virtual int GetLevelSize(int level);
- + // convert x,y in UTM coords(x-east, y-north), to lat,lon (in degrees, N+, E+)
- + virtual void toLatLon(double x, double y, double& lat, double& lon) const;
- + // convert lat,lon (degrees, N+, E+) to UTM coords
- + virtual void fromLatLon(double lat, double lon, double& x, double& y) const;
- +
- virtual lua_State* getTerrainCfg();
- protected:
- /*/
- Index: terrain/Source/lSystem.cpp
- ===================================================================
- --- terrain/Source/lSystem.cpp (revision 91366)
- +++ terrain/Source/lSystem.cpp (working copy)
- @@ -25,6 +25,7 @@
- #include "vfs_utils.h"
- #include "i18n.h"
- #include "Util/Strings.h"
- +#include "edTerrain/ITerrain.h"
- lSystem::lSystem()
- {
- @@ -576,6 +577,30 @@
- return levelsizes[level];
- }
- +// convert x,y in UTM coords, to lat,lon (in degrees, N+, E+)
- +void lSystem::toLatLon(double x, double y, double &lat, double &lon)
- +{
- +#ifndef USE_TERRAIN4
- + lTerraDispatch* pTerraDispatch = GetTerraDispatch();
- + if( pTerraDispatch)
- + pTerraDispatch->toLatLon(x, y, lat, lon);
- +#else
- + edterrain::ITerrain::GetDefaultTerrain()->toLatLon(x, y, lat, lon);
- +#endif
- +}
- +
- +// convert lat,lon (degrees, N+, E+) to UTM coords
- +void lSystem::fromLatLon(double lat, double lon, double &x, double &y)
- +{
- +#ifndef USE_TERRAIN4
- + lTerraDispatch* pTerraDispatch = GetTerraDispatch();
- + if( pTerraDispatch)
- + pTerraDispatch->fromLatLon(lat, lon, x, y);
- +#else
- + edterrain::ITerrain::GetDefaultTerrain()->fromLatLon(lat, lon, x, y);
- +#endif
- +}
- +
- lua_State* lSystem::getTerrainCfg()
- {
- #ifndef USE_TERRAIN4
- Index: worldgeneral/Include/wTerrain.h
- ===================================================================
- --- worldgeneral/Include/wTerrain.h (revision 91366)
- +++ worldgeneral/Include/wTerrain.h (working copy)
- @@ -115,6 +115,11 @@
- // Размер квадрата по уровню детализации
- virtual int GetLevelSize(int level) = 0;
- + // convert x,y in UTM coords(x-east, y-north), to lat,lon (in degrees, N+, E+)
- + virtual void toLatLon(double x, double y, double& lat, double& lon) const = 0;
- + // convert lat,lon (degrees, N+, E+) to UTM coords
- + virtual void fromLatLon(double lat, double lon, double& x, double& y) const = 0;
- +
- virtual lua_State* getTerrainCfg() = 0;
- };
- Index: worldgeneral/SConscript
- ===================================================================
- --- worldgeneral/SConscript (revision 91366)
- +++ worldgeneral/SConscript (working copy)
- @@ -24,7 +24,6 @@
- if env.has_key('TERRAIN4'):
- CPPDEFINES += ['USE_TERRAIN4',]
- - LIBS += ['edTerrain',]
- else:
- LIBS += ['edTerrain',]
- Index: worldgeneral/Source/MapCoords.cpp
- ===================================================================
- --- worldgeneral/Source/MapCoords.cpp (revision 91366)
- +++ worldgeneral/Source/MapCoords.cpp (working copy)
- @@ -18,6 +18,7 @@
- #include "MapCoords.h"
- #include "Common/Unicode.h"
- #include "lTerraDispatch.h"
- +#include "edTerrain/ITerrain.h"
- static ed::string degree_ = Common::uni2mbstr(0xB0);
- @@ -36,9 +37,13 @@
- double MapCoords::Longitude(double x, double z)
- {
- double lat=0, lon=0;
- +#ifndef USE_TERRAIN4
- lTerraDispatch* pTerraDispatch = GetTerraDispatch();
- if( pTerraDispatch)
- - pTerraDispatch->toLatLon(z,x, lat,lon);
- + pTerraDispatch->toLatLon(z, x, lat, lon);
- +#else
- + globalLand->toLatLon(z, x, lat, lon);
- +#endif
- return lon;
- // double lat, lon;
- @@ -50,9 +55,13 @@
- double MapCoords::Latitude(double x, double z)
- {
- double lat=0, lon=0;
- +#ifndef USE_TERRAIN4
- lTerraDispatch* pTerraDispatch = GetTerraDispatch();
- if( pTerraDispatch)
- - pTerraDispatch->toLatLon(z,x, lat,lon);
- + pTerraDispatch->toLatLon(z, x, lat, lon);
- +#else
- + globalLand->toLatLon(z, x, lat, lon);
- +#endif
- return lat;
- }
- @@ -59,9 +68,13 @@
- // широта и долгота в градусах, (x (meters) - to North, z (meters) - to East)
- void MapCoords::LatLon(double x, double z, double& lat, double& lon)
- {
- +#ifndef USE_TERRAIN4
- lTerraDispatch* pTerraDispatch = GetTerraDispatch();
- if( pTerraDispatch)
- pTerraDispatch->toLatLon(z, x, lat, lon);
- +#else
- + globalLand->toLatLon(z, x, lat, lon);
- +#endif
- }
- bool MapCoords::ConvertCoordToGradMinSec(double inCoordGrads, int *outCoordGrad, int *outCoordMin, int *outCoordSec)
- @@ -140,9 +153,13 @@
- void MapCoords::GetCoords(double inLatitudeGrad, double inLongitudeGrad, double &outX, double &outZ) // принимает градусы
- {
- +#ifndef USE_TERRAIN4
- lTerraDispatch* pTerraDispatch = GetTerraDispatch();
- if( pTerraDispatch)
- pTerraDispatch->fromLatLon(inLatitudeGrad, inLongitudeGrad, outZ, outX);
- +#else
- + globalLand->fromLatLon(inLatitudeGrad, inLongitudeGrad, outZ, outX);
- +#endif
- // code for measuring computational error
- /*
Advertisement
Add Comment
Please, Sign In to add comment