Ejemplo n.º 1
0
void RasterTerrain::OpenTerrain(void)
{
  TCHAR  szFile[MAX_PATH] = TEXT("\0");

  GetRegistryString(szRegistryTerrainFile, szFile, MAX_PATH);

  char zfilename[MAX_PATH];

  ExpandLocalPath(szFile);

  unicode2ascii(szFile, zfilename, MAX_PATH);

  if (strlen(zfilename)==0) {
    static TCHAR  szMapFile[MAX_PATH] = TEXT("\0");
    GetRegistryString(szRegistryMapFile, szMapFile, MAX_PATH);
    ExpandLocalPath(szMapFile);
    _tcscpy(szFile,szMapFile);
    _tcscat(szFile,TEXT("/terrain.jp2"));
    unicode2ascii(szFile, zfilename, MAX_PATH);
  }

  // TODO code: Check locking, especially when reloading a file.
  // TODO bug: Fix cache method

  CreateTerrainMap(zfilename);
}
Ejemplo n.º 2
0
void RasterTerrain::OpenTerrain(void)
{
  #if TESTBENCH
  StartupStore(TEXT(". Loading Terrain... %s"),NEWLINE);
  #endif
  CreateProgressDialog(MsgToken(900)); // Loading Terrain File...

  TCHAR szFile[MAX_PATH] = _T("\0");
  _tcscpy(szFile,szTerrainFile);
  ExpandLocalPath(szFile);

  if ( (_tcslen(szFile)>0) && ( _tcsstr(szFile, _T(".DEM")) || _tcsstr(szFile, _T(".dem")) ) ) {
	if (!CreateTerrainMap(szFile)) {
      // If no terrain will be found, the registry will be invalid on next run
      _tcscpy(szTerrainFile,_T(""));
      StartupStore(_T("... INVALID TERRAIN file <%s>%s"),szFile,NEWLINE);
	}
  } else {
    StartupStore(_T(". NO TERRAIN file available.%s"),NEWLINE);
  }
}
Ejemplo n.º 3
0
void RasterTerrain::OpenTerrain(void)
{
  terrain_initialised = false;
  #if TESTBENCH
  StartupStore(TEXT(". Loading Terrain... %s"),NEWLINE);
  #endif
  CreateProgressDialog(gettext(TEXT("_@M900_"))); // Loading Terrain File...

  TCHAR szFile[MAX_PATH] = _T("\0");

  _tcscpy(szFile,szTerrainFile);

  TCHAR szOrigFile[MAX_PATH] = _T("\0");
  ExpandLocalPath(szFile);
  _tcscpy(szOrigFile, szFile);
  ContractLocalPath(szOrigFile);

  // If no terrain will be found, the registry will be invalid on next run
  _tcscpy(szTerrainFile,_T(""));


#ifdef LKMTERRAIN
  static TCHAR  szMFile[MAX_PATH] = TEXT("\0");
  if (_tcslen(szFile)==0) {
    StartupStore(_T(". NO TERRAIN file configured%s"),NEWLINE);
    _tcscpy(szMFile,szMapFile);
    ExpandLocalPath(szMFile);
    _tcscpy(szFile,szMFile);

     _tcscpy(szFile,szMFile);
     _tcscat(szFile, _T("/terrain.dem")); 
     StartupStore(_T(". Attempting to use DEM <%s> inside mapfile%s"),szFile,NEWLINE);
  }

  if (CreateTerrainMap(szFile)) {
	_tcscpy(szTerrainFile,szOrigFile);
	terrain_initialised = true;
	return;
  } else {
	_tcscpy(szFile,szMFile);
	_tcscat(szFile, _T("/terrain.dat")); 
	StartupStore(_T(". Attempting to use DAT <%s> inside mapfile%s"),szFile,NEWLINE);

	if (CreateTerrainMap(szFile)) {
		_tcscpy(szTerrainFile,szOrigFile);
		terrain_initialised = true;
		return;
	}
   }
#else

  if ( (_tcslen(szFile)>0) && ( _tcsstr(szFile, _T(".DEM")) || _tcsstr(szFile, _T(".dem")) ) ) {
	if (CreateTerrainMap(szFile)) {
		_tcscpy(szterrainFile,szOrigFile);
		terrain_initialised = true;
		return;
	} else {
		StartupStore(_T("... INVALID TERRAIN file <%s>%s"),szFile,NEWLINE);
	}
  }

#endif

  if (TerrainMap) {
	TerrainMap->Close();
	delete TerrainMap;
	TerrainMap = NULL;
  }
  terrain_initialised = false;
  StartupStore(_T(". NO TERRAIN file available.%s"),NEWLINE);
}