void MapWindow::SetPanTaskEdit(unsigned TskPoint) { LockTaskData(); if (ValidTaskPointFast(TskPoint)) { MapWindow::Event_Pan(1); PanTaskEdit = TskPoint; PanLongitude = WayPointList[Task[PanTaskEdit].Index].Longitude; PanLatitude = WayPointList[Task[PanTaskEdit].Index].Latitude; if ((mode.Is(Mode::MODE_PAN)) || (mode.Is(Mode::MODE_TARGET_PAN))) { { if (Task[PanTaskEdit].Index != RESWP_PANPOS) { RealActiveWaypoint = Task[PanTaskEdit].Index; LKASSERT(ValidWayPoint(Task[PanTaskEdit].Index)); WayPointList[RESWP_PANPOS].Latitude = WayPointList[RealActiveWaypoint].Latitude; WayPointList[RESWP_PANPOS].Longitude = WayPointList[RealActiveWaypoint].Longitude; WayPointList[RESWP_PANPOS].Altitude = WayPointList[RealActiveWaypoint].Altitude; Task[PanTaskEdit].Index = RESWP_PANPOS; RefreshMap(); } } } } UnlockTaskData(); }
void MapWindow::Event_Pan(int vswitch) { // static bool oldfullscreen = 0; never assigned! bool oldPan = mode.AnyPan(); if (vswitch == -2) { // superpan, toggles fullscreen also // new mode mode.Special(Mode::MODE_SPECIAL_PAN, !oldPan); } else if (vswitch == -1) { mode.Special(Mode::MODE_SPECIAL_PAN, !oldPan); } else { mode.Special(Mode::MODE_SPECIAL_PAN, vswitch != 0); // 0 off, 1 on } if (mode.AnyPan() != oldPan) { if (mode.AnyPan()) { PanLongitude = DrawInfo.Longitude; PanLatitude = DrawInfo.Latitude; InputEvents::setMode(TEXT("pan")); } else { InputEvents::setMode(TEXT("default")); MapWindow::ForceVisibilityScan=true; } } RefreshMap(); }
/** * @brief Sets provided value as current zoom * * @param value zoom ratio to set */ void MapWindow::Zoom::EventSetZoom(double value) { double _lastRequestedScale = *_requestedScale; *_requestedScale = LimitMapScale(value); if(*_requestedScale != _lastRequestedScale) { RefreshMap(); } }
void MapWindow::Event_TerrainTopology(int vswitch) { char val; if (vswitch== -1) { // toggle through 4 possible options val = 0; if (EnableTopology) val++; if (EnableTerrain) val += (char)2; val++; if (val>3) val=0; EnableTopology = ((val & 0x01) == 0x01); EnableTerrain = ((val & 0x02) == 0x02); RefreshMap(); } else if (vswitch == -2) { // toggle terrain EnableTerrain = !EnableTerrain; RefreshMap(); } else if (vswitch == -3) { // toggle topology EnableTopology = !EnableTopology; RefreshMap(); } else if (vswitch == 1) { // Turn on toplogy EnableTopology = true; RefreshMap(); } else if (vswitch == 2) { // Turn off toplogy EnableTopology = false; RefreshMap(); } else if (vswitch == 3) { // Turn on terrain EnableTerrain = true; RefreshMap(); } else if (vswitch == 4) { // Turn off terrain EnableTerrain = false; RefreshMap(); } else if (vswitch == 0) { // Show terrain/Topology // ARH Let user know what's happening TCHAR buf[128]; if (EnableTopology) { if (EnableTerrain) _stprintf(buf, _T("Topo:ON Terra:ON")); else _stprintf(buf, _T("Topo:ON Terra:OFF")); } else { if (EnableTerrain) _stprintf(buf, _T("Topo:OFF Terra:ON")); else _stprintf(buf, _T("Topo:OFF Terra:OFF")); } Message::Lock(); // 091211 Message::AddMessage(500, 3, buf); // 091125 Message::Unlock(); // DoStatusMessage(TEXT("Topology / Terrain"), buf); } }
/** * @brief Modifies current zoom ratio * * @param vswitch Modifier value: */ void MapWindow::Zoom::EventScaleZoom(int vswitch) { if (IsMultiMapNoMain() && !INPAN) { if (vswitch>0) LKevent=LKEVENT_UP; else LKevent=LKEVENT_DOWN; return; } // disable AutoZoom if possible if(_autoZoom && mode.Special() == Mode::MODE_SPECIAL_NONE && !(_circleZoom && mode.Is(Mode::MODE_CIRCLING))) { // Disable Auto Zoom only if not in Special or Circling Zoom DoStatusMessage(gettext(TEXT("_@M857_"))); // AutoZoom OFF _autoZoom = false; } // For best results, zooms should be multiples or roots of 2 double value = *_requestedScale; if(ScaleListCount > 0) { value = FindMapScale(*_requestedScale); value = StepMapScale(-vswitch); } else { if (abs(vswitch)>=4) { if (vswitch==4) vswitch = 1; if (vswitch==-4) vswitch = -1; } if (vswitch==1) { // zoom in a little value /= 1.414; } if (vswitch== -1) { // zoom out a little value *= 1.414; } if (vswitch==2) { // zoom in a lot value /= 2.0; } if (vswitch== -2) { // zoom out a lot value *= 2.0; } } double _lastRequestedScale = *_requestedScale; *_requestedScale = LimitMapScale(value); if(*_requestedScale != _lastRequestedScale) { RefreshMap(); } }
/** * @brief Assigns proper zoom ratio for new Display Mode */ void MapWindow::Zoom::SwitchMode() { if(!_inited) return; if((mode._mode & Mode::MODE_TARGET_PAN) && !(mode._lastMode & Mode::MODE_TARGET_PAN)) { // TARGET_PAN enabled _requestedScale = &_modeScale[SCALE_TARGET_PAN]; CalculateTargetPanZoom(); zoom._bigZoom = true; } else if(mode._mode & Mode::MODE_TARGET_PAN) { // do not change zoom for other mode changes while in TARGET_PAN mode return; } else if(mode._mode & Mode::MODE_PAN) { if(!(mode._lastMode & Mode::MODE_PAN)) // PAN enabled - use current map scale if PAN enabled _modeScale[SCALE_PAN] = *_requestedScale; _requestedScale = &_modeScale[SCALE_PAN]; // do not change zoom for other mode changes while in PAN mode return; } else if((mode._mode & Mode::MODE_PANORAMA) && !(mode._lastMode & Mode::MODE_PANORAMA)) { // PANORAMA enabled _requestedScale = &_modeScale[SCALE_PANORAMA]; zoom._bigZoom = true; } else if(mode._mode & Mode::MODE_PANORAMA) { // do not change zoom for mode changes while in PANORAMA mode return; } else { if((mode._mode & Mode::MODE_CIRCLING) && _circleZoom) { _requestedScale = &_modeScale[SCALE_CIRCLING]; } else { _requestedScale = &_modeScale[SCALE_CRUISE]; if(_autoZoom) CalculateAutoZoom(); } _bigZoom = true; } *_requestedScale = LimitMapScale(*_requestedScale); RefreshMap(); }
void MapWindow::Event_PanCursor(int dx, int dy) { int X= (MapRect.right+MapRect.left)/2; int Y= (MapRect.bottom+MapRect.top)/2; double Xstart, Ystart, Xnew, Ynew; Screen2LatLon(X, Y, Xstart, Ystart); X+= (MapRect.right-MapRect.left)*dx/4; Y+= (MapRect.bottom-MapRect.top)*dy/4; Screen2LatLon(X, Y, Xnew, Ynew); if(mode.AnyPan()) { PanLongitude += Xstart-Xnew; PanLatitude += Ystart-Ynew; } RefreshMap(); }
void SSizeMap::SetRootAssetPackageNames( const TArray<FName>& NewRootAssetPackageNames ) { RootAssetPackageNames = NewRootAssetPackageNames; FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry")); if ( AssetRegistryModule.Get().IsLoadingAssets() ) { // We are still discovering assets, listen for the completion delegate before building the graph if (!AssetRegistryModule.Get().OnFilesLoaded().IsBoundToObject(this)) { AssetRegistryModule.Get().OnFilesLoaded().AddSP( this, &SSizeMap::OnInitialAssetRegistrySearchComplete ); } } else { // All assets are already discovered, build the graph now. RefreshMap(); } }
void MapWindow::Event_PanCursor(int dx, int dy) { const ScreenProjection _Proj; RasterPoint pt = { (MapRect.right+MapRect.left)/2, (MapRect.bottom+MapRect.top)/2 }; double Xstart, Ystart, Xnew, Ynew; _Proj.Screen2LonLat(pt, Xstart, Ystart); pt.x += (MapRect.right-MapRect.left)*dx/4; pt.y += (MapRect.bottom-MapRect.top)*dy/4; _Proj.Screen2LonLat(pt, Xnew, Ynew); if(mode.AnyPan()) { PanLongitude += Xstart-Xnew; PanLatitude += Ystart-Ynew; } RefreshMap(); }
void MapWindow::Event_Pan(int vswitch) { // static bool oldfullscreen = 0; never assigned! bool oldPan = mode.AnyPan(); if(vswitch !=1) { if(ValidTaskPoint(PanTaskEdit)) { Task[PanTaskEdit].Index = RealActiveWaypoint; RefreshTask(); PanTaskEdit = -1; RealActiveWaypoint = -1; WayPointList[RESWP_PANPOS].Longitude = RESWP_INVALIDNUMBER; WayPointList[RESWP_PANPOS].Latitude = RESWP_INVALIDNUMBER; } } if (vswitch == -2) { // superpan, toggles fullscreen also // new mode mode.Special(Mode::MODE_SPECIAL_PAN, !oldPan); } else if (vswitch == -1) { mode.Special(Mode::MODE_SPECIAL_PAN, !oldPan); } else { mode.Special(Mode::MODE_SPECIAL_PAN, vswitch != 0); // 0 off, 1 on } if (mode.AnyPan() != oldPan) { if (mode.AnyPan()) { PanLongitude = DrawInfo.Longitude; PanLatitude = DrawInfo.Latitude; InputEvents::setMode(TEXT("pan")); } else { InputEvents::setMode(TEXT("default")); MapWindow::ForceVisibilityScan=true; } } RefreshMap(); }
// // Called by LKDrawLook8000, this is what happens when we change mapspace mode, advancing through types. // We paint infopages, nearest, tri, etc.etc. // Normally there is plenty of cpu available because the map is not even calculated. // This is why we bring to the Draw thread, in the nearest pages case, also calculations. // void MapWindow::DrawMapSpace(HDC hdc, RECT rc ) { HFONT oldfont; HBRUSH hB; TextInBoxMode_t TextDisplayMode = {0}; TCHAR Buffer[LKSIZEBUFFERLARGE*2]; #ifdef DRAWLKSTATUS bool dodrawlkstatus=false; #endif static POINT p[10]; if (MapSpaceMode==MSM_WELCOME) { if (INVERTCOLORS) hB=LKBrush_Petrol; else hB=LKBrush_Mlight; } else { if (INVERTCOLORS) hB=LKBrush_Mdark; else hB=LKBrush_Mlight; } oldfont = (HFONT)SelectObject(hdc, LKINFOFONT); // save font if (MapSpaceMode!=MSM_WELCOME) FillRect(hdc,&rc, hB); if (DoInit[MDI_DRAWMAPSPACE]) { p[0].x=0; p[0].y=rc.bottom-BottomSize-NIBLSCALE(2); p[1].x=rc.right-1; p[1].y=p[0].y; p[2].x=0; p[2].y=0; p[3].x=rc.right-1; p[3].y=0; // 091230 right-1 p[4].x=0; p[4].y=0; p[5].x=0; p[5].y=rc.bottom-BottomSize-NIBLSCALE(2); p[6].x=rc.right-1; p[6].y=0; p[7].x=rc.right-1; p[7].y=rc.bottom-BottomSize-NIBLSCALE(2); // 091230 right-1 // p[8].x=0; p[8].y=rc.bottom-BottomSize-NIBLSCALE(2); p[9].x=rc.right; p[9].y=p[8].y; /* StartupStore(_T("DOINIT DRAWMAPSPACE 21=%d=%d 22=%d=%d 23=%d=%d 24=%d=%d 31=%d=%d 32=%d=%d\n"), ConfIP[LKMODE_WP][0],ConfIP21, ConfIP[LKMODE_WP][1],ConfIP22, ConfIP[LKMODE_WP][2],ConfIP23, ConfIP[LKMODE_WP][3],ConfIP24, ConfIP[LKMODE_NAV][0],ConfIP31, ConfIP[LKMODE_NAV][1],ConfIP32); */ if (MapSpaceMode==MSM_WELCOME) LoadSplash(hdc,_T("LKPROFILE")); DoInit[MDI_DRAWMAPSPACE]=false; } // Paint borders in green, but only in nearest pages and welcome if (MapSpaceMode==MSM_WELCOME || (!IsMultiMap() && MapSpaceMode!=MSM_MAP) ) { if (INVERTCOLORS) { _DrawLine(hdc, PS_SOLID, NIBLSCALE(1), p[2], p[3], RGB_GREEN, rc); _DrawLine(hdc, PS_SOLID, NIBLSCALE(1), p[4], p[5], RGB_GREEN, rc); _DrawLine(hdc, PS_SOLID, NIBLSCALE(1), p[6], p[7], RGB_GREEN, rc); _DrawLine(hdc, PS_SOLID, NIBLSCALE(1), p[0], p[1], RGB_GREEN, rc); } else { _DrawLine(hdc, PS_SOLID, NIBLSCALE(1), p[2], p[3], RGB_DARKGREEN, rc); _DrawLine(hdc, PS_SOLID, NIBLSCALE(1), p[4], p[5], RGB_DARKGREEN, rc); _DrawLine(hdc, PS_SOLID, NIBLSCALE(1), p[6], p[7], RGB_DARKGREEN, rc); _DrawLine(hdc, PS_SOLID, NIBLSCALE(1), p[0], p[1], RGB_DARKGREEN, rc); } } #ifdef DRAWLKSTATUS if (LKevent==LKEVENT_NEWRUN) dodrawlkstatus=true; #endif // We are entering mapspacemodes with no initial check on configured subpages. // Thus we need to ensure that the page is really available, or find the first valid. // However, this will prevent direct customkey access to pages! // Instead, we do it when we call next page from InfoPageChange // if (!ConfIP[ModeIndex][CURTYPE]) NextModeType(); switch (MapSpaceMode) { case MSM_WELCOME: #if (1) if (!DrawInfo.NAVWarning) { static double firsttime=DrawInfo.Time; // delayed automatic exit from welcome mode if ( DrawInfo.Time > (firsttime+1.0) ) { SetModeType(LKMODE_MAP,MP_MOVING); LKevent=LKEVENT_NONE; if (EnableSoundModes) LKSound(_T("LK_BEEP1.WAV")); RefreshMap(); break; } } #endif if(GlobalModelType==MODELTYPE_PNA_MINIMAP) { SetModeType(LKMODE_MAP,MP_MOVING); LKevent=LKEVENT_NONE; break; } DrawWelcome8000(hdc, rc); break; case MSM_MAPTRK: SetSideviewPage(IM_HEADING); LKDrawMultimap_Asp(hdc,rc); break; case MSM_MAPWPT: #if 0 // If there is no destination, force jump to the map if (GetOvertargetIndex()<0) { SetModeType(LKMODE_MAP,MP_MOVING); LKevent=LKEVENT_NONE; break; } #endif SetSideviewPage(IM_NEXT_WP); LKDrawMultimap_Asp(hdc,rc); break; case MSM_MAPASP: SetSideviewPage(IM_NEAR_AS); LKDrawMultimap_Asp(hdc,rc); break; case MSM_MAPRADAR: LKDrawMultimap_Radar(hdc,rc); break; case MSM_VISUALGLIDE: SetSideviewPage(IM_VISUALGLIDE); LKDrawMultimap_Asp(hdc,rc); break; case MSM_MAPTEST: LKDrawMultimap_Test(hdc,rc); break; case MSM_LANDABLE: case MSM_NEARTPS: case MSM_AIRPORTS: DrawNearest(hdc, rc); break; case MSM_AIRSPACES: DrawAspNearest(hdc, rc); break; case MSM_COMMON: case MSM_RECENT: DrawCommon(hdc, rc); break; case MSM_MAP: break; case MSM_INFO_THERMAL: case MSM_INFO_CRUISE: case MSM_INFO_TASK: case MSM_INFO_AUX: case MSM_INFO_TRI: case MSM_INFO_HSI: case MSM_INFO_TRF: case MSM_INFO_TARGET: case MSM_INFO_CONTEST: DrawInfoPage(hdc,rc, false); break; case MSM_TRAFFIC: DrawTraffic(hdc,rc); break; case MSM_THERMALS: DrawThermalHistory(hdc,rc); break; default: memset((void*)&TextDisplayMode, 0, sizeof(TextDisplayMode)); TextDisplayMode.Color = RGB_WHITE; TextDisplayMode.NoSetFont = 1; TextDisplayMode.AlligneCenter = 1; SelectObject(hdc, LK8TargetFont); _stprintf(Buffer,TEXT("MapSpaceMode=%d"),MapSpaceMode); TextInBox(hdc, &rc, Buffer, (rc.right-rc.left)/2, NIBLSCALE(50) , 0, &TextDisplayMode, false); break; } #ifdef DRAWLKSTATUS // no need to clear dodrawlkstatus, it is already reset at each run if (dodrawlkstatus) DrawLKStatus(hdc, rc); #endif SelectObject(hdc, oldfont); }
void SSizeMap::OnInitialAssetRegistrySearchComplete() { RefreshMap(); }
// // Called by LKDrawLook8000, this is what happens when we change mapspace mode, advancing through types. // We paint infopages, nearest, tri, etc.etc. // Normally there is plenty of cpu available because the map is not even calculated. // This is why we bring to the Draw thread, in the nearest pages case, also calculations. // void MapWindow::DrawMapSpace(LKSurface& Surface, const RECT& rc) { BrushReference hB; TextInBoxMode_t TextDisplayMode = {0}; TCHAR Buffer[LKSIZEBUFFERLARGE*2]; #ifdef DRAWLKSTATUS bool dodrawlkstatus=false; #endif #ifndef DITHER if (MapSpaceMode==MSM_WELCOME) { if (INVERTCOLORS) hB=LKBrush_Petrol; else hB=LKBrush_Mlight; } else { if (INVERTCOLORS) hB=LKBrush_Mdark; else hB=LKBrush_Mlight; } #else if (INVERTCOLORS) hB=LKBrush_Black; else hB=LKBrush_White; #endif const auto oldfont = Surface.SelectObject(LKINFOFONT); // save font if (MapSpaceMode==MSM_WELCOME) { LKBitmap WelcomeBitmap = LoadSplash(_T("LKPROFILE")); if(WelcomeBitmap) { DrawSplash(Surface, WelcomeBitmap); } } else { Surface.FillRect(&rc, hB); } // Paint borders in green, but only in nearest pages and welcome, and not in DITHER mode // In case we want it in dithered mode, some changes are ready to be used. #ifndef DITHER if (MapSpaceMode==MSM_WELCOME || (!IsMultiMap() && MapSpaceMode!=MSM_MAP) ) { #ifdef DITHER LKPen BorderPen(PEN_SOLID, ScreenThinSize, INVERTCOLORS?RGB_WHITE:RGB_BLACK); #else LKPen BorderPen(PEN_SOLID, ScreenThinSize, INVERTCOLORS?RGB_GREEN:RGB_DARKGREEN); #endif auto OldPen = Surface.SelectObject(BorderPen); auto OldBrush = Surface.SelectObject(LK_HOLLOW_BRUSH); Surface.Rectangle(rc.left, rc.top, rc.right, rc.bottom - BottomSize); Surface.SelectObject(OldPen); Surface.SelectObject(OldBrush); } #endif #ifdef DRAWLKSTATUS if (LKevent==LKEVENT_NEWRUN) dodrawlkstatus=true; #endif // We are entering mapspacemodes with no initial check on configured subpages. // Thus we need to ensure that the page is really available, or find the first valid. // However, this will prevent direct customkey access to pages! // Instead, we do it when we call next page from InfoPageChange // if (!ConfIP[ModeIndex][CURTYPE]) NextModeType(); switch (MapSpaceMode) { case MSM_WELCOME: #if 0 SetModeType(LKMODE_MAP,MP_MOVING); RefreshMap(); break; #endif #if (1) if (!DrawInfo.NAVWarning) { static double firsttime=DrawInfo.Time; // delayed automatic exit from welcome mode if ( DrawInfo.Time > (firsttime+3.0) ) { SetModeType(LKMODE_MAP,MP_MOVING); LKevent=LKEVENT_NONE; LKSound(_T("LK_BEEP1.WAV")); RefreshMap(); break; } } #endif if(GlobalModelType==MODELTYPE_PNA_MINIMAP) { SetModeType(LKMODE_MAP,MP_MOVING); LKevent=LKEVENT_NONE; break; } DrawWelcome8000(Surface, rc); break; case MSM_MAPTRK: SetSideviewPage(IM_HEADING); LKDrawMultimap_Asp(Surface,rc); break; case MSM_MAPWPT: #if 0 // If there is no destination, force jump to the map if (GetOvertargetIndex()<0) { SetModeType(LKMODE_MAP,MP_MOVING); LKevent=LKEVENT_NONE; break; } #endif SetSideviewPage(IM_NEXT_WP); LKDrawMultimap_Asp(Surface,rc); break; case MSM_MAPASP: SetSideviewPage(IM_NEAR_AS); LKDrawMultimap_Asp(Surface,rc); break; case MSM_MAPRADAR: LKDrawMultimap_Radar(Surface,rc); break; case MSM_VISUALGLIDE: SetSideviewPage(IM_VISUALGLIDE); LKDrawMultimap_Asp(Surface,rc); break; case MSM_MAPTEST: LKDrawMultimap_Test(Surface,rc); break; case MSM_LANDABLE: case MSM_NEARTPS: case MSM_AIRPORTS: case MSM_COMMON: case MSM_RECENT: case MSM_AIRSPACES: case MSM_THERMALS: case MSM_TRAFFIC: DrawNearest(Surface, rc); break; case MSM_MAP: break; case MSM_INFO_THERMAL: case MSM_INFO_CRUISE: case MSM_INFO_TASK: case MSM_INFO_AUX: case MSM_INFO_TRI: case MSM_INFO_HSI: case MSM_INFO_TRF: case MSM_INFO_TARGET: case MSM_INFO_CONTEST: DrawInfoPage(Surface,rc, false); break; default: memset((void*)&TextDisplayMode, 0, sizeof(TextDisplayMode)); TextDisplayMode.Color = RGB_WHITE; TextDisplayMode.NoSetFont = 1; TextDisplayMode.AlligneCenter = 1; Surface.SelectObject(LK8TargetFont); _stprintf(Buffer,TEXT("MapSpaceMode=%d"),MapSpaceMode); TextInBox(Surface, &rc, Buffer, (rc.right+rc.left)/2, NIBLSCALE(50) , &TextDisplayMode, false); break; } #ifdef DRAWLKSTATUS // no need to clear dodrawlkstatus, it is already reset at each run if (dodrawlkstatus) DrawLKStatus(hdc, rc); #endif Surface.SelectObject(oldfont); }