[Gcblue-commits] gcb_wx/src/sim tcMapView.cpp,1.20,1.21
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-04-03 15:51:51
|
Update of /cvsroot/gcblue/gcb_wx/src/sim In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22160/src/sim Modified Files: tcMapView.cpp Log Message: selection box drawing Index: tcMapView.cpp =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/src/sim/tcMapView.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** tcMapView.cpp 20 Mar 2004 18:46:46 -0000 1.20 --- tcMapView.cpp 3 Apr 2004 15:39:31 -0000 1.21 *************** *** 301,328 **** ! ! ! /** ! * Override for tactical map. Calls terrainView to copy elevation map image to ! * tc2DGraphicsSurface bitmap. */ ! /* ! int tcTacticalMapView::CreateSurfaces(tcGraphicsEngine* apGraphicsEngine) { ! // set terrain to high res ! terrainView->mbHighRes = true; ! if (mpMapData == NULL) ! { ! wxMessageBox("Error - tcMapView - CreateSurfaces called before attaching tcMapData obj"); ! } ! else ! { ! if (terrainView->CreateSurfaces(apGraphicsEngine) == false) {return false;} ! } ! return tcWindow::CreateSurfaces(apGraphicsEngine); // MapView on top of TerrainView } - */ ! /***********************************************************************************/ void tcTacticalMapView::DrawGrid(Graphics *apGraphics) { --- 301,325 ---- ! /** ! * Draws selection box if left mouse button is down */ ! void tcTacticalMapView::DrawSelectionBox(Gdiplus::Graphics *graphics) { ! if (!isLButtonDown) return; ! ! mpPen->SetColor(Color(0xFFFFFFFF)); ! ! int xLeft = min(buttonDownPoint.x, mpointMouse.x); ! int yTop = min(buttonDownPoint.y, mpointMouse.y); ! int width = abs(mpointMouse.x - buttonDownPoint.x); ! int height = abs(mpointMouse.y - buttonDownPoint.y); ! ! graphics->DrawRectangle(mpPen, xLeft, yTop, width, height); } ! ! /** ! * Draws tactical map grid ! */ void tcTacticalMapView::DrawGrid(Graphics *apGraphics) { *************** *** 346,351 **** } } ! /***********************************************************************************/ ! void tcTacticalMapView::DrawScaleBar(Graphics *apGraphics) { float fKmPerPel, fKmScale; int nScaleBarWidth, nBarX1, nBarX2; --- 343,352 ---- } } ! ! /** ! * Draws tactical map scale bar ! */ ! void tcTacticalMapView::DrawScaleBar(Graphics *apGraphics) ! { float fKmPerPel, fKmScale; int nScaleBarWidth, nBarX1, nBarX2; *************** *** 401,405 **** } /***********************************************************************************/ ! void tcTacticalMapView::DrawMapCmd(Graphics *apGraphics, tcMapObj *pMO, teMapCmdType type) { int x,y; --- 402,407 ---- } /***********************************************************************************/ ! void tcTacticalMapView::DrawMapCmd(Graphics *apGraphics, tcMapObj *pMO, teMapCmdType type) ! { int x,y; *************** *** 449,455 **** } ! /***********************************************************************************/ ! // draw indicator symbol box at appropriate location, for error indication currently ! void tcTacticalMapView::DrawIndicator(int anType) { return; // TODO: update this --- 451,459 ---- } ! /** ! * Draw indicator symbol box at appropriate location, for error indication currently ! */ ! void tcTacticalMapView::DrawIndicator(int anType) ! { return; // TODO: update this *************** *** 539,542 **** --- 543,549 ---- DrawTerrainText(pGraphics); + /*** Draw selection box ***/ + DrawSelectionBox(pGraphics); + /*** Draw date and time text ***/ tcString sText; *************** *** 1332,1336 **** /***********************************************************************************/ ! int tcTacticalMapView::GetClosest(wxPoint pscreen) { tcMapObj *pMO; tcPoint geopoint = ScreenToGeo(pscreen), geopointi; --- 1339,1344 ---- /***********************************************************************************/ ! int tcTacticalMapView::GetClosest(wxPoint pscreen) ! { tcMapObj *pMO; tcPoint geopoint = ScreenToGeo(pscreen), geopointi; *************** *** 1342,1352 **** fMinDistance = 1e15f; nMinID = NULL_INDEX; ! for(int i=0;i<MAXMAPOBJ;i++) { pMO = &maMapObj[i]; ! if (pMO->mbExists) { geopointi.x = pMO->mfLon; geopointi.y = pMO->mfLat; fDistance = geopoint.DistanceTo(geopointi); ! if (fDistance < fMinDistance) { fMinDistance = fDistance; nMinID = pMO->mnID; --- 1350,1363 ---- fMinDistance = 1e15f; nMinID = NULL_INDEX; ! for(int i=0;i<MAXMAPOBJ;i++) ! { pMO = &maMapObj[i]; ! if (pMO->mbExists) ! { geopointi.x = pMO->mfLon; geopointi.y = pMO->mfLat; fDistance = geopoint.DistanceTo(geopointi); ! if (fDistance < fMinDistance) ! { fMinDistance = fDistance; nMinID = pMO->mnID; *************** *** 1354,1361 **** } } ! if (fMinDistance <= fHookDistance) { return nMinID; } ! else { return NULL_INDEX; } --- 1365,1374 ---- } } ! if (fMinDistance <= fHookDistance) ! { return nMinID; } ! else ! { return NULL_INDEX; } *************** *** 1403,1409 **** --- 1416,1426 ---- } + /** + * OnLeaveWindow event handler + */ void tcTacticalMapView::OnLeaveWindow(wxMouseEvent& event) { mnScrollState = 0; + isLButtonDown = false; } *************** *** 1483,1490 **** bool bFlagsSet = (isShiftDown || isControlDown); ! wxPoint point = event.GetPosition(); if ((mbMapCmdActive)&&(!bFlagsSet)) { ! OnLButtonDownMapCmd(point); return; } --- 1500,1509 ---- bool bFlagsSet = (isShiftDown || isControlDown); ! buttonDownPoint = event.GetPosition(); ! ! if ((mbMapCmdActive)&&(!bFlagsSet)) { ! OnLButtonDownMapCmd(buttonDownPoint); return; } *************** *** 1492,1496 **** if (isControlDown) { ! SetViewCenterZoom(point,1.5f); tcSound::Get()->PlayEffect(SEFFECT_BEEP2); return; --- 1511,1515 ---- if (isControlDown) { ! SetViewCenterZoom(buttonDownPoint, 1.5f); tcSound::Get()->PlayEffect(SEFFECT_BEEP2); return; *************** *** 1498,1509 **** else if (isShiftDown) { ! SetViewCenterZoom(point,1.0f); tcSound::Get()->PlayEffect(SEFFECT_BEEP2); return; } ! Hook(point); tcWindow::SkipMouseEvent(event); } ! /***********************************************************************************/ /** * Old version returned true if button click is accepted, false otherwise. --- 1517,1544 ---- else if (isShiftDown) { ! SetViewCenterZoom(buttonDownPoint, 1.0f); tcSound::Get()->PlayEffect(SEFFECT_BEEP2); return; } ! Hook(buttonDownPoint); ! if (mnHookID == -1) ! { ! isLButtonDown = true; ! } tcWindow::SkipMouseEvent(event); } ! ! /** ! * Left mouse button up event handler. ! */ ! void tcTacticalMapView::OnLButtonUp(wxMouseEvent& event) ! { ! if (isLButtonDown) ! { ! isLButtonDown = false; ! } ! } ! ! /** * Old version returned true if button click is accepted, false otherwise. *************** *** 1540,1544 **** wxPoint point = event.GetPosition(); const int nScrollBorder = 10; ! mpointMouse = point; //TranslatePoint(point); if (mpointMouse.x <= nScrollBorder) { --- 1575,1581 ---- wxPoint point = event.GetPosition(); const int nScrollBorder = 10; ! ! mpointMouse = point; ! if (mpointMouse.x <= nScrollBorder) { *************** *** 1638,1641 **** --- 1675,1679 ---- maNavPointScreen.clear(); meSymbology = NTDS; + isLButtonDown = false; ClearMapObjects(); *************** *** 1746,1750 **** } /***********************************************************************************/ ! void tcWorldMapView::DrawTheaterBox(Graphics *apGraphics) { float width,height; tcPoint p1, p2; --- 1784,1789 ---- } /***********************************************************************************/ ! void tcWorldMapView::DrawTheaterBox(Graphics *apGraphics) ! { float width,height; tcPoint p1, p2; |