Exemplo n.º 1
0
/** 
 * @brief Recalculates zoom parameters
 */
void MapWindow::Zoom::ModifyMapScale()
{
  if(_scale == *_requestedScale)
    return;
  
  // limit zoomed in so doesn't reach silly levels
  *_requestedScale = LimitMapScale(*_requestedScale); // FIX VENTA remove limit
  _scaleOverDistanceModify = *_requestedScale / DISTANCEMODIFY;
  _resScaleOverDistanceModify = GetMapResolutionFactor() / _scaleOverDistanceModify;
  _drawScale = _scaleOverDistanceModify;
  _drawScale = _drawScale / 111194;
  _drawScale = GetMapResolutionFactor() / _drawScale;
  _invDrawScale = 1.0 / _drawScale;
  _scale = *_requestedScale;
}
Exemplo n.º 2
0
void MapWindow::Zoom::ModifyMapScale()
{
  // limit zoomed in so doesn't reach silly levels
  if(_bMapScale)
    *_requestedScale = LimitMapScale(*_requestedScale); // FIX VENTA remove limit
  _scaleOverDistanceModify = *_requestedScale / DISTANCEMODIFY;
  LKASSERT(_scaleOverDistanceModify!=0);
  _resScaleOverDistanceModify = GetMapResolutionFactor() / _scaleOverDistanceModify;
  _drawScale = _scaleOverDistanceModify;
  _drawScale = _drawScale / 111194;
  LKASSERT(_drawScale!=0);
  _drawScale = GetMapResolutionFactor() / _drawScale;
  _invDrawScale = 1.0 / _drawScale;
  _scale = *_requestedScale;
  _realscale = *_requestedScale/DISTANCEMODIFY/1000;
}
Exemplo n.º 3
0
fixed
MapWindowProjection::CalculateMapScale(unsigned scale) const
{
  assert(scale < ScaleListCount);
  return fixed(ScaleList[scale]) *
    GetMapResolutionFactor() / Layout::Scale(GetScreenWidth());
}
Exemplo n.º 4
0
double MapWindow::StepMapScale(int Step){
  if (abs(Step)>=4) {
    ScaleCurrent += Step/4;
  } else {
    ScaleCurrent += Step;
  }
  ScaleCurrent = max(0,min(ScaleListCount-1, ScaleCurrent));
  return((ScaleList[ScaleCurrent]*GetMapResolutionFactor())
         /(IBLSCALE(/*Appearance.DefaultMapWidth*/ MapRect.right)));
}
Exemplo n.º 5
0
double MapWindow::FindMapScale(double Value){

  int    i;
  double BestFit = 99999;
  int    BestFitIdx=-1;
  double DesiredScale = 
    (Value*IBLSCALE(/*Appearance.DefaultMapWidth*/ MapRect.right))/GetMapResolutionFactor();

  LKASSERT(DesiredScale!=0);
  for (i=0; i<ScaleListCount; i++){
    double err = fabs(DesiredScale - ScaleList[i])/DesiredScale;
    if (err < BestFit){
      BestFit = err;
      BestFitIdx = i;
    }
  }

  if (BestFitIdx != -1){
    ScaleCurrent = BestFitIdx;
    return((ScaleList[ScaleCurrent]*GetMapResolutionFactor())
           /IBLSCALE(/*Appearance.DefaultMapWidth*/ MapRect.right));
  }
  return(Value);
}
Exemplo n.º 6
0
unsigned
MapWindowProjection::FindMapScale(const fixed Value) const
{
  unsigned DesiredScale = Value *
                       Layout::Scale(GetScreenWidth()) / GetMapResolutionFactor();

  unsigned i;
  for (i = 0; i < ScaleListCount; i++) {
    if (DesiredScale < ScaleList[i]) {
      if (i == 0)
        return 0;

      return i - (DesiredScale < (ScaleList[i] + ScaleList[i - 1]) / 2);
    }
  }

  return ScaleListCount - 1;
}
Exemplo n.º 7
0
void MapWindow::FillScaleListForEngineeringUnits(void)
{
  int i;

  // Fill up discrete map scales
  // Consider scalelist size!!!
  switch (Units::GetUserDistanceUnit()) {
    default:
      ScaleListCount = 0;
      ScaleList[ScaleListCount++] = 0.01;		// km
      ScaleList[ScaleListCount++] = 0.015;
      ScaleList[ScaleListCount++] = 0.025;
      ScaleList[ScaleListCount++] = 0.040;
      ScaleList[ScaleListCount++] = 0.070;
      ScaleList[ScaleListCount++] = 0.1;
      ScaleList[ScaleListCount++] = 0.15;
      ScaleList[ScaleListCount++] = 0.2;
      ScaleList[ScaleListCount++] = 0.35;
      ScaleList[ScaleListCount++] = 0.5;
      ScaleList[ScaleListCount++] = 0.75;
      ScaleList[ScaleListCount++] = 1.0;
      ScaleList[ScaleListCount++] = 1.5;
      ScaleList[ScaleListCount++] = 2.0;
      ScaleList[ScaleListCount++] = 3.5;
      ScaleList[ScaleListCount++] = 5.0;
      ScaleList[ScaleListCount++] = 7.5;
      ScaleList[ScaleListCount++] = 10.0;
      ScaleList[ScaleListCount++] = 15.0;
      ScaleList[ScaleListCount++] = 20.0;
      ScaleList[ScaleListCount++] = 25.0;
      ScaleList[ScaleListCount++] = 40.0;
      ScaleList[ScaleListCount++] = 50.0;
      ScaleList[ScaleListCount++] = 75.0;
      break;
      
    case unStatuteMiles:
      ScaleListCount = 0;
      ScaleList[ScaleListCount++] = 50.0  * (0.0006214 / 3.281);		// to ft;
      ScaleList[ScaleListCount++] = 80.0  * (0.0006214 / 3.281);	// to ft
      ScaleList[ScaleListCount++] = 130.0 * (0.0006214 / 3.281);	// to ft
      ScaleList[ScaleListCount++] = 200.0 * (0.0006214 / 3.281);	// to ft
      ScaleList[ScaleListCount++] = 350.0 * (0.0006214 / 3.281);	// to ft
      ScaleList[ScaleListCount++] = 500.0 * (0.0006214 / 3.281);	// to ft
      ScaleList[ScaleListCount++] = 800.0 * (0.0006214 / 3.281);	// to ft
      ScaleList[ScaleListCount++] = 0.2;
      ScaleList[ScaleListCount++] = 0.35;
      ScaleList[ScaleListCount++] = 0.5;
      ScaleList[ScaleListCount++] = 0.75;
      ScaleList[ScaleListCount++] = 1.0;
      ScaleList[ScaleListCount++] = 1.5;
      ScaleList[ScaleListCount++] = 2.0;
      ScaleList[ScaleListCount++] = 3.5;
      ScaleList[ScaleListCount++] = 5.0;
      ScaleList[ScaleListCount++] = 7.5;
      ScaleList[ScaleListCount++] = 10.0;
      ScaleList[ScaleListCount++] = 15.0;
      ScaleList[ScaleListCount++] = 20.0;
      ScaleList[ScaleListCount++] = 25.0;
      ScaleList[ScaleListCount++] = 40.0;
      break;

    case unNauticalMiles:
      ScaleListCount = 0;
      ScaleList[ScaleListCount++] = 50.0  * (0.00053996 / 3.281);	// to ft;
      ScaleList[ScaleListCount++] = 100.0 * (0.00053996 / 3.281);	// to ft;
      ScaleList[ScaleListCount++] = 150.0 * (0.00053996 / 3.281);	// to ft
      ScaleList[ScaleListCount++] = 250.0 * (0.00053996 / 3.281);	// to ft
      ScaleList[ScaleListCount++] = 400.0 * (0.00053996 / 3.281);	// to ft
      ScaleList[ScaleListCount++] = 600.0 * (0.00053996 / 3.281);	// to ft
      ScaleList[ScaleListCount++] = 900.0 * (0.00053996 / 3.281);	// to ft
      ScaleList[ScaleListCount++] = 0.2;
      ScaleList[ScaleListCount++] = 0.35;
      ScaleList[ScaleListCount++] = 0.5;
      ScaleList[ScaleListCount++] = 0.75;
      ScaleList[ScaleListCount++] = 1.0;
      ScaleList[ScaleListCount++] = 1.5;
      ScaleList[ScaleListCount++] = 2.0;
      ScaleList[ScaleListCount++] = 3.5;
      ScaleList[ScaleListCount++] = 5.0;
      ScaleList[ScaleListCount++] = 7.5;
      ScaleList[ScaleListCount++] = 10.0;
      ScaleList[ScaleListCount++] = 15.0;
      ScaleList[ScaleListCount++] = 20.0;
      ScaleList[ScaleListCount++] = 25.0;
      ScaleList[ScaleListCount++] = 40.0;
      break;
  } //sw units
  
  double scalefactor = (double)GetMapResolutionFactor() / (double)IBLSCALE(/*Appearance.DefaultMapWidth*/ MapRect.right) * 1.4;
  for (i=0; i<ScaleListCount; i++) ScaleList[i] /= scalefactor;
}
Exemplo n.º 8
0
double
WindowProjection::GetMapScale() const
{
  return DistancePixelsToMeters(GetMapResolutionFactor());
}
Exemplo n.º 9
0
fixed
Projection::GetMapScale() const
{
  return fixed(GetMapResolutionFactor()) / scale;
}
Exemplo n.º 10
0
double MapWindow::GetApproxScreenRange() {
  return (zoom.Scale() * max(DrawRect.right-DrawRect.left,
                         DrawRect.bottom-DrawRect.top))
    *1000.0/GetMapResolutionFactor();
}
Exemplo n.º 11
0
 double DistanceScreenToUser(const unsigned x) const {
   return x*MapScale/GetMapResolutionFactor();
 }
Exemplo n.º 12
0
 double RequestDistancePixelsToMeters(const double x) const {
   return x*_RequestedMapScale/(DISTANCEMODIFY*GetMapResolutionFactor());
 }
Exemplo n.º 13
0
 gcc_pure
 fixed DistanceScreenToUser(const int x) const {
   return x * MapScale / GetMapResolutionFactor();
 }
Exemplo n.º 14
0
 gcc_pure
 fixed RequestDistancePixelsToMeters(const int x) const {
   return x * _RequestedMapScale / Units::ToUserUnit(fixed(GetMapResolutionFactor()),
                                                     Units::DistanceUnit);
 }
Exemplo n.º 15
0
void
MapWindowProjection::SetMapScale(const fixed x)
{
  SetScale(fixed(GetMapResolutionFactor()) / LimitMapScale(x));
}