/** * @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(); }
/** * @brief Updates current map scale */ void MapWindow::Zoom::UpdateMapScale() { static bool pg_autozoom_turned_on = false; if(mode.Is(Mode::MODE_TARGET_PAN)) { // update TARGET_PAN CalculateTargetPanZoom(); if(_scale != *_requestedScale) ModifyMapScale(); return; } // in PG mode if autozoom is set to on, and waypoint distance drops below // PGAutoZoomThreshold, we should turn on autozoom if it is off. Do this only once, let the user able to turn it off near WP if ( ISPARAGLIDER && AutoZoom_Config && !_autoZoom && (DerivedDrawInfo.ZoomDistance>0) && (DerivedDrawInfo.ZoomDistance < PGAutoZoomThreshold)) { if (!pg_autozoom_turned_on) { EventAutoZoom(1); pg_autozoom_turned_on = true; } } if (DerivedDrawInfo.ZoomDistance > (PGAutoZoomThreshold + 200.0)) { // Set state variable back to false, with some distance hysteresis pg_autozoom_turned_on = false; } if(_autoZoom && mode.Special() == Mode::MODE_SPECIAL_NONE && !(_circleZoom && mode.Is(Mode::MODE_CIRCLING))) { // Calculate Auto Zoom only if not in Special or Circling Zoom CalculateAutoZoom(); if(_scale != *_requestedScale) ModifyMapScale(); return; } // if there is user intervention in the scale if(_scale != *_requestedScale) ModifyMapScale(); }
/** * @brief Updates current map scale */ void MapWindow::Zoom::UpdateMapScale() { if(mode.Is(Mode::MODE_TARGET_PAN)) { // update TARGET_PAN CalculateTargetPanZoom(); if(_scale != *_requestedScale) ModifyMapScale(); return; } if(_autoZoom && mode.Special() == Mode::MODE_SPECIAL_NONE && !(_circleZoom && mode.Is(Mode::MODE_CIRCLING))) { // Calculate Auto Zoom only if not in Special or Circling Zoom CalculateAutoZoom(); if(_scale != *_requestedScale) ModifyMapScale(); return; } // if there is user intervention in the scale if(_scale != *_requestedScale) ModifyMapScale(); }