dmitrysenkovich

Untitled

Aug 20th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.11 KB | None | 0 0
  1. Index: terrain/Include/lSystem.h
  2. ===================================================================
  3. --- terrain/Include/lSystem.h   (revision 91366)
  4. +++ terrain/Include/lSystem.h   (working copy)
  5. @@ -74,6 +74,11 @@
  6.     // Размер квадрата по уровню детализации
  7.     virtual int GetLevelSize(int level);
  8.  
  9. +   // convert x,y in UTM coords(x-east, y-north), to lat,lon (in degrees, N+, E+)
  10. +   virtual void toLatLon(double x, double y, double& lat, double& lon) const;
  11. +   // convert lat,lon (degrees, N+, E+) to UTM coords
  12. +   virtual void fromLatLon(double lat, double lon, double& x, double& y) const;
  13. +
  14.     virtual lua_State*  getTerrainCfg();
  15.  protected:
  16.     /*/
  17. Index: terrain/Source/lSystem.cpp
  18. ===================================================================
  19. --- terrain/Source/lSystem.cpp  (revision 91366)
  20. +++ terrain/Source/lSystem.cpp  (working copy)
  21. @@ -25,6 +25,7 @@
  22.  #include "vfs_utils.h"
  23.  #include "i18n.h"
  24.  #include "Util/Strings.h"
  25. +#include "edTerrain/ITerrain.h"
  26.  
  27.  lSystem::lSystem()
  28.  {    
  29. @@ -576,6 +577,30 @@
  30.     return levelsizes[level];
  31.  }
  32.  
  33. +// convert x,y in UTM coords, to lat,lon (in degrees, N+, E+)
  34. +void lSystem::toLatLon(double x, double y, double &lat, double &lon)
  35. +{
  36. +#ifndef USE_TERRAIN4
  37. +   lTerraDispatch* pTerraDispatch = GetTerraDispatch();
  38. +   if( pTerraDispatch)
  39. +       pTerraDispatch->toLatLon(x, y, lat, lon);
  40. +#else
  41. +   edterrain::ITerrain::GetDefaultTerrain()->toLatLon(x, y, lat, lon);
  42. +#endif
  43. +}
  44. +
  45. +// convert lat,lon (degrees, N+, E+) to UTM coords
  46. +void lSystem::fromLatLon(double lat, double lon, double &x, double &y)
  47. +{
  48. +#ifndef USE_TERRAIN4
  49. +   lTerraDispatch* pTerraDispatch = GetTerraDispatch();
  50. +   if( pTerraDispatch)
  51. +       pTerraDispatch->fromLatLon(lat, lon, x, y);
  52. +#else
  53. +   edterrain::ITerrain::GetDefaultTerrain()->fromLatLon(lat, lon, x, y);
  54. +#endif
  55. +}
  56. +
  57.  lua_State* lSystem::getTerrainCfg()
  58.  {
  59.  #ifndef USE_TERRAIN4
  60. Index: worldgeneral/Include/wTerrain.h
  61. ===================================================================
  62. --- worldgeneral/Include/wTerrain.h (revision 91366)
  63. +++ worldgeneral/Include/wTerrain.h (working copy)
  64. @@ -115,6 +115,11 @@
  65.     // Размер квадрата по уровню детализации
  66.     virtual int GetLevelSize(int level) = 0;
  67.  
  68. +   // convert x,y in UTM coords(x-east, y-north), to lat,lon (in degrees, N+, E+)
  69. +   virtual void toLatLon(double x, double y, double& lat, double& lon) const = 0;
  70. +   // convert lat,lon (degrees, N+, E+) to UTM coords
  71. +   virtual void fromLatLon(double lat, double lon, double& x, double& y) const = 0;
  72. +
  73.     virtual lua_State*  getTerrainCfg() = 0;
  74.  };
  75.  
  76. Index: worldgeneral/SConscript
  77. ===================================================================
  78. --- worldgeneral/SConscript (revision 91366)
  79. +++ worldgeneral/SConscript (working copy)
  80. @@ -24,7 +24,6 @@
  81.  
  82.  if env.has_key('TERRAIN4'):
  83.      CPPDEFINES += ['USE_TERRAIN4',]
  84. -    LIBS += ['edTerrain',]
  85.  else:
  86.      LIBS += ['edTerrain',]
  87.  
  88. Index: worldgeneral/Source/MapCoords.cpp
  89. ===================================================================
  90. --- worldgeneral/Source/MapCoords.cpp   (revision 91366)
  91. +++ worldgeneral/Source/MapCoords.cpp   (working copy)
  92. @@ -18,6 +18,7 @@
  93.  #include "MapCoords.h"
  94.  #include "Common/Unicode.h"
  95.  #include "lTerraDispatch.h"
  96. +#include "edTerrain/ITerrain.h"
  97.  
  98.  static ed::string degree_ = Common::uni2mbstr(0xB0);
  99.  
  100. @@ -36,9 +37,13 @@
  101.  double MapCoords::Longitude(double x, double z)
  102.  {
  103.      double lat=0, lon=0;
  104. +#ifndef USE_TERRAIN4
  105.     lTerraDispatch* pTerraDispatch = GetTerraDispatch();
  106.     if( pTerraDispatch)
  107. -       pTerraDispatch->toLatLon(z,x, lat,lon);
  108. +       pTerraDispatch->toLatLon(z, x, lat, lon);
  109. +#else
  110. +   globalLand->toLatLon(z, x, lat, lon);
  111. +#endif
  112.      return lon;
  113.  
  114.  //    double lat, lon;
  115. @@ -50,9 +55,13 @@
  116.  double MapCoords::Latitude(double x, double z)
  117.  {
  118.      double lat=0, lon=0;
  119. +#ifndef USE_TERRAIN4
  120.     lTerraDispatch* pTerraDispatch = GetTerraDispatch();
  121.     if( pTerraDispatch)
  122. -       pTerraDispatch->toLatLon(z,x, lat,lon);
  123. +       pTerraDispatch->toLatLon(z, x, lat, lon);
  124. +#else
  125. +   globalLand->toLatLon(z, x, lat, lon);
  126. +#endif
  127.      return lat;
  128.  }
  129.  
  130. @@ -59,9 +68,13 @@
  131.  // широта и долгота в градусах, (x (meters) - to North, z (meters) - to East)
  132.  void MapCoords::LatLon(double x, double z, double& lat, double& lon)
  133.  {
  134. +#ifndef USE_TERRAIN4
  135.     lTerraDispatch* pTerraDispatch = GetTerraDispatch();
  136.     if( pTerraDispatch)
  137.         pTerraDispatch->toLatLon(z, x, lat, lon);
  138. +#else
  139. +   globalLand->toLatLon(z, x, lat, lon);
  140. +#endif
  141.  }
  142.  
  143.  bool MapCoords::ConvertCoordToGradMinSec(double inCoordGrads, int *outCoordGrad, int *outCoordMin, int *outCoordSec)
  144. @@ -140,9 +153,13 @@
  145.  
  146.  void MapCoords::GetCoords(double inLatitudeGrad, double inLongitudeGrad, double &outX, double &outZ) // принимает градусы
  147.  {
  148. +#ifndef USE_TERRAIN4
  149.     lTerraDispatch* pTerraDispatch = GetTerraDispatch();
  150.     if( pTerraDispatch)
  151.         pTerraDispatch->fromLatLon(inLatitudeGrad, inLongitudeGrad, outZ, outX);
  152. +#else
  153. +   globalLand->fromLatLon(inLatitudeGrad, inLongitudeGrad, outZ, outX);
  154. +#endif
  155.  
  156.      // code for measuring computational error
  157.      /*
Advertisement
Add Comment
Please, Sign In to add comment