[Gcblue-commits] gcb_wx/src/sim tcDemTileReader.cpp,NONE,1.1 tcMapData.cpp,1.10,1.11 tcMapView.cpp,1
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-06-24 01:43:57
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25454/src/sim Modified Files: tcMapData.cpp tcMapView.cpp tcTerrainView.cpp Added Files: tcDemTileReader.cpp Log Message: Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tcMapView.cpp 21 Jun 2004 22:22:00 -0000 1.24 --- tcMapView.cpp 24 Jun 2004 01:43:44 -0000 1.25 *************** *** 1929,1933 **** } /***********************************************************************************/ ! void tcWorldMapView::DrawGrid(Graphics *apGraphics) { float lat,lon; tcPoint pgeo,pscreen; --- 1929,1934 ---- } /***********************************************************************************/ ! void tcWorldMapView::DrawGrid(Gdiplus::Graphics *apGraphics) ! { float lat,lon; tcPoint pgeo,pscreen; *************** *** 1950,1954 **** } /***********************************************************************************/ ! void tcWorldMapView::DrawTheaterBox(Graphics *apGraphics) { float width,height; --- 1951,1955 ---- } /***********************************************************************************/ ! void tcWorldMapView::DrawTheaterBox(Gdiplus::Graphics *apGraphics) { float width,height; *************** *** 1958,1963 **** mpMapData->GetTheaterArea(mrectTheater); // for box to indicate theater area - mpPen->SetColor(Color(0xFFFFFFFF)); // TODO: centralized color selection structure - p1.x = mrectTheater.left; p1.y = mrectTheater.bottom; --- 1959,1962 ---- *************** *** 1968,1975 **** width = p2.x - p1.x; height = p1.y - p2.y; ! apGraphics->DrawRectangle(mpPen,p1.x,p2.y,width,height); } /***********************************************************************************/ ! int tcWorldMapView::DrawSymbol(Graphics *apGraphics, tsWorldMapObj *pMO) { tcPoint pscreen; RectF rclipbounds; --- 1967,1978 ---- width = p2.x - p1.x; height = p1.y - p2.y; ! ! Pen* pen = (width > 16.0f) ? mpPen : mpPenThin; ! pen->SetColor(Color(0xFFFFFFFF)); // TODO: centralized color selection structure ! ! apGraphics->DrawRectangle(pen, p1.x, p2.y, width, height); } /***********************************************************************************/ ! int tcWorldMapView::DrawSymbol(Gdiplus::Graphics *apGraphics, tsWorldMapObj *pMO) { tcPoint pscreen; RectF rclipbounds; *************** *** 2013,2016 **** --- 2016,2023 ---- tcSound::Get()->PlayEffect(SEFFECT_BEEP2); tcPoint geoPoint = ScreenToGeo(point); // geopoint (lon,lat) in radians + + // center new theater on clicked location + geoPoint.x -= 0.5f * mrectTheater.Width(); + geoPoint.y += 0.5f * mrectTheater.Height(); wxCommandEvent command(wxEVT_COMMAND_BUTTON_CLICKED, ID_SETTHEATER) ; Index: tcTerrainView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcTerrainView.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tcTerrainView.cpp 20 Mar 2004 18:46:47 -0000 1.9 --- tcTerrainView.cpp 24 Jun 2004 01:43:44 -0000 1.10 *************** *** 156,161 **** mp2DSurface->GetBits(pBits); wxASSERT(pBits != NULL); ! mpMapData->CreateHighResMapImage(mpOptions->mnMapMode, pBits); ! mp2DSurface->mbModified = true; mp2DSurface->SetRenderTexture(mbTextureMaps); --- 156,161 ---- mp2DSurface->GetBits(pBits); wxASSERT(pBits != NULL); ! //mpMapData->CreateHighResMapImage(mpOptions->mnMapMode, pBits); ! mpMapData->CreateMapImage(mpOptions->mnMapMode, 1, pBits); // 1 for high res mp2DSurface->mbModified = true; mp2DSurface->SetRenderTexture(mbTextureMaps); Index: tcMapData.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapData.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** tcMapData.cpp 21 Jun 2004 22:22:00 -0000 1.10 --- tcMapData.cpp 24 Jun 2004 01:43:44 -0000 1.11 *************** *** 2,6 **** ** tcMapData.cpp ** ! ** Copyright (C) 2003 Dewitt "Cole" Colclough (de...@tw...) ** All rights reserved. --- 2,6 ---- ** tcMapData.cpp ** ! ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. [...3406 lines suppressed...] //LoadHighResB(-1.0f, 12.0f); *************** *** 1758,1763 **** } /********************************************************************/ ! tcMapData::~tcMapData() { ! } /********************************************************************/ \ No newline at end of file --- 1981,1987 ---- } /********************************************************************/ ! tcMapData::~tcMapData() ! { ! delete demTileReader; } /********************************************************************/ \ No newline at end of file --- NEW FILE: tcDemTileReader.cpp --- /* ** @file tcDemTileReader.cpp ** ** Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef WX_PRECOMP #include "stdwx.h" #endif #include "tcDemTileReader.h" /** * Sets namestring to path + filename of 10 x 10 dem tile for northwest * point of (lat_deg, lon_deg). lat_deg and lon_deg must be multiples * of 10 to get a valid file name */ void tcDemTileReader::GetTileName(wxString& nameString, int lat_deg, int lon_deg) { wxASSERT(lat_deg % 10 == 0); wxASSERT(lon_deg % 10 == 0); nameString = mzDemPath.GetBuffer(); nameString += wxString::Format("%dx%d.dat", lat_deg, lon_deg); } bool tcDemTileReader::IsTileAvailable(int lat, int lon) { std::map<long, bool>::const_iterator mapIter; long key = LatLonToKey(lat, lon); mapIter = tileStatus.find(key); if (mapIter == tileStatus.end()) // not found { tcFile demTile; LoadDemTile(demTile, lat, lon); tileStatus[key] = demTile.IsOpen(); demTile.Close(); return tileStatus[key]; } else { return tileStatus[key]; } } void tcDemTileReader::KeyToLatLon(long key, int& lat, int& lon) { lon = (key / 256) - 180; lat = (key % 256) - 90; } long tcDemTileReader::LatLonToKey(int lat, int lon) { return (lat + 90) + 256 * (lon + 180); } /** * Loads 10 x 10 deg DEM tile specified by Northwest corner point * (lat_deg, lon_deg). If tile does not exist no load takes place. * @param lat_deg latitude of Northwest corner point in deg * @param lat_deg should be mult of 10 deg between -80 and 90 * @param lon_deg longitude of Northwest corner point in deg * @param lon_deg should be mult of 10 deg between -180 and 170 */ void tcDemTileReader::LoadDemTile(tcFile& tileFile, int lat_deg, int lon_deg) { //static int errorCount = 0; wxString demTileName; GetTileName(demTileName, lat_deg, lon_deg); if (tileFile.Open(demTileName.c_str(), tcFile::modeRead) ==0) { /* if ((errorCount < 10)||(errorCount++ % 100 == 0)) { fprintf(stderr, "Map tile not found: %s\n", demTileName.c_str()); } */ } } void tcDemTileReader::MarkTileUnavailable(int lat, int lon) { long key = LatLonToKey(lat, lon); tileStatus[key] = false; } void tcDemTileReader::ScanTiles() { int availCount = 0; for (int lat = -80; lat <= 90; lat += 10) { for (int lon = -180; lon <=170; lon += 10) { availCount += IsTileAvailable(lat, lon) ? 1 : 0; } } fprintf(stdout, "%d / %d map tiles available\n", availCount, 648); } tcDemTileReader::tcDemTileReader() { mzDemPath = "maps\\tiles\\"; ScanTiles(); } tcDemTileReader::~tcDemTileReader() { } |