예제 #1
0
double MapWindow::LimitMapScale(double value) {
  
  double minreasonable=5.0;		// give minreasonable values in system units, in meters! (what you would like to see on the mapscale)

  if (mode.Is(Mode::MODE_CIRCLING)) {
      // during circling
      minreasonable = 50.0;
      if ( ISPARAGLIDER ) minreasonable = 10.0;
  } else {
      // if not circling
      minreasonable = 100.0;
      if ( ISPARAGLIDER || ISCAR ) minreasonable = 10.0;
      if (zoom.AutoZoom()) {
	if (AATEnabled && (ActiveWayPoint>0)) {
	  if ( ISPARAGLIDER ) minreasonable = 10.0; else minreasonable = 1200.0;
	} else {
	  if ( ISPARAGLIDER ) minreasonable = 10.0; else minreasonable = 600.0; 
	}
      }
  }

  minreasonable = Units::ToUserDistance(minreasonable / 1.4);		// 1.4 for mapscale symbol
  
  // return value in user distance units!!!
  if (ScaleListCount>0) {
    return FindMapScale(max(minreasonable,min(160.0,value)));		//maximum limit in user distance units!
  } else {
    return max(minreasonable,min(160.0,value));				//maximum limit in user distance units!
  }
}
예제 #2
0
fixed
MapWindowProjection::StepMapScale(const fixed scale, int Step) const
{
  int i = FindMapScale(scale) + Step;
  i = max(0, min((int)ScaleListCount - 1, i));
  return CalculateMapScale(i);
}
예제 #3
0
/** 
 * @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();
  }
}
예제 #4
0
fixed
MapWindowProjection::LimitMapScale(const fixed value) const
{
  return HaveScaleList() ? CalculateMapScale(FindMapScale(value)) : value;
}