当前位置: 首页>>代码示例>>C++>>正文


C++ ChartRenderer::ScaleYFromValue方法代码示例

本文整理汇总了C++中ChartRenderer::ScaleYFromValue方法的典型用法代码示例。如果您正苦于以下问题:C++ ChartRenderer::ScaleYFromValue方法的具体用法?C++ ChartRenderer::ScaleYFromValue怎么用?C++ ChartRenderer::ScaleYFromValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ChartRenderer的用法示例。


在下文中一共展示了ChartRenderer::ScaleYFromValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fixed

void
ChartWindow::DrawChart(ChartRenderer &renderer)
{
  renderer.ScaleXFromValue(fixed(0));
  renderer.ScaleXFromValue(fixed(100));

  renderer.ScaleYFromValue(fixed(0));
  renderer.ScaleYFromValue(fixed(100));

  if (chart == 0) {
    renderer.DrawLine(fixed(0), fixed(10), fixed(100), fixed(70),
                      look.GetPen(ChartLook::STYLE_BLUETHIN));
  } else if (chart == 1) {
    renderer.ScaleXFromValue(fixed(-50));
    renderer.ScaleXFromValue(fixed(110));
    renderer.ScaleYFromValue(fixed(110));

    renderer.DrawLine(fixed(0), fixed(10), fixed(100), fixed(70),
                      look.GetPen(ChartLook::STYLE_BLUETHIN));

    renderer.DrawLine(fixed(0), fixed(10), fixed(100), fixed(80),
                      look.GetPen(ChartLook::STYLE_DASHGREEN));

    renderer.DrawLine(fixed(0), fixed(10), fixed(100), fixed(100),
                      look.GetPen(ChartLook::STYLE_MEDIUMBLACK));

    renderer.DrawXGrid(fixed(20), look.GetPen(ChartLook::STYLE_THINDASHPAPER),
                       fixed(20), true);

    renderer.DrawYGrid(fixed(20), look.GetPen(ChartLook::STYLE_THINDASHPAPER),
                       fixed(20), true);
}
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:33,代码来源:RunChartRenderer.cpp

示例2: if

void
ChartWindow::DrawChart(ChartRenderer &renderer)
{
  renderer.ScaleXFromValue(0);
  renderer.ScaleXFromValue(100);

  renderer.ScaleYFromValue(0);
  renderer.ScaleYFromValue(100);

  if (chart == 0) {
    renderer.DrawLine(0, 10, 100, 70,
                      look.GetPen(ChartLook::STYLE_BLUETHINDASH));
  } else if (chart == 1) {
    renderer.ScaleXFromValue(-50);
    renderer.ScaleXFromValue(110);
    renderer.ScaleYFromValue(110);

    renderer.DrawLine(0, 10, 100, 70,
                      look.GetPen(ChartLook::STYLE_BLUETHINDASH));

    renderer.DrawLine(0, 10, 100, 80,
                      look.GetPen(ChartLook::STYLE_GREENDASH));

    renderer.DrawLine(0, 10, 100, 100,
                      look.GetPen(ChartLook::STYLE_BLACK));

    renderer.DrawXGrid(20, 20, ChartRenderer::UnitFormat::NUMERIC);

    renderer.DrawYGrid(20, 20, ChartRenderer::UnitFormat::NUMERIC);

    renderer.DrawLabel(_T("hello"), 50, 50);
    renderer.DrawXLabel(_T("VVV"),_T("m/s"));
    renderer.DrawYLabel(_T("AAA"),_T("m/s"));
  }
}
开发者ID:Advi42,项目名称:XCSoar,代码行数:35,代码来源:RunChartRenderer.cpp

示例3:

void
ThermalBandRenderer::ScaleChart(const DerivedInfo &calculated,
                                 const ComputerSettings &settings_computer,
                                 ChartRenderer &chart) const
{
  chart.ScaleYFromValue(fixed(0));
  chart.ScaleYFromValue(calculated.thermal_band.max_thermal_height);

  chart.ScaleXFromValue(fixed(0));
  chart.ScaleXFromValue(fixed(0.5));
  chart.ScaleXFromValue(settings_computer.polar.glide_polar_task.GetMC());
}
开发者ID:rjsikarwar,项目名称:XCSoar,代码行数:12,代码来源:ThermalBandRenderer.cpp

示例4: fixed

void
TraceHistoryRenderer::ScaleChart(ChartRenderer &chart,
                                  const TraceVariableHistory& var,
                                  const bool centered) const
{
  chart.padding_bottom = 0;
  chart.padding_left = 0;
  chart.ScaleXFromValue(fixed(0));
  chart.ScaleXFromValue(fixed(var.capacity()-1));

  fixed vmin = fixed(0);
  fixed vmax = fixed(0);
  for (auto it = var.begin(); it != var.end(); ++it) {
    vmin = std::min(*it, vmin);
    vmax = std::max(*it, vmax);
  }
  if (!(vmax>vmin)) {
    vmax += fixed(1);
  }
  if (centered) {
    vmax = std::max(vmax, -vmin);
    vmin = std::min(vmin, -vmax);
  }
  chart.ScaleYFromValue(vmax);
  chart.ScaleYFromValue(vmin);
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:26,代码来源:TraceHistoryRenderer.cpp

示例5: blend

void
ThermalBandRenderer::_DrawThermalBand(const MoreData &basic,
                                      const DerivedInfo& calculated,
                                      const ComputerSettings &settings_computer,
                                      ChartRenderer &chart,
                                      const TaskBehaviour& task_props,
                                      const bool is_infobox,
                                      const OrderedTaskBehaviour *ordered_props) const
{
  const ThermalBandInfo &thermal_band = calculated.thermal_band;

  // calculate height above safety height
  fixed hoffset = task_props.route_planner.safety_height_terrain +
    calculated.GetTerrainBaseFallback();

  fixed h = fixed(0);
  if (basic.NavAltitudeAvailable()) {
    h = basic.nav_altitude - hoffset;
    chart.ScaleYFromValue(h);
  }

  bool draw_start_height = false;
  fixed hstart = fixed(0);

  draw_start_height = ordered_props
    && calculated.ordered_task_stats.task_valid
    && ordered_props->start_constraints.max_height != 0
    && calculated.terrain_valid;
  if (draw_start_height) {
    hstart = fixed(ordered_props->start_constraints.max_height);
    if (ordered_props->start_constraints.max_height_ref == AltitudeReference::AGL &&
        calculated.terrain_valid)
      hstart += calculated.terrain_altitude;

    hstart -= hoffset;
    chart.ScaleYFromValue(hstart);
  }

  // no thermalling has been done above safety height
  if (!positive(calculated.thermal_band.max_thermal_height))
    return;

  // calculate averages
  int numtherm = 0;

  fixed Wmax = fixed(0);
  fixed Wav = fixed(0);
  fixed Wt[ThermalBandInfo::NUMTHERMALBUCKETS];
  fixed ht[ThermalBandInfo::NUMTHERMALBUCKETS];

  for (unsigned i = 0; i < ThermalBandInfo::NUMTHERMALBUCKETS; ++i) {
    if (thermal_band.thermal_profile_n[i] < 6) 
      continue;

    if (positive(thermal_band.thermal_profile_w[i])) {
      // height of this thermal point [0,mth]
      // requires 5 items in bucket before displaying, to eliminate kinks
      fixed wthis = thermal_band.thermal_profile_w[i] / thermal_band.thermal_profile_n[i];
      ht[numtherm] = i * calculated.thermal_band.max_thermal_height 
        / ThermalBandInfo::NUMTHERMALBUCKETS;
      Wt[numtherm] = wthis;
      Wmax = std::max(Wmax, wthis);
      Wav+= wthis;
      numtherm++;
    }
  }
  chart.ScaleXFromValue(Wmax);
  if (!numtherm)
    return;
  chart.ScaleXFromValue(fixed(1.5)*Wav/numtherm);

  if ((!draw_start_height) && (numtherm<=1))
    // don't display if insufficient statistics
    // but do draw if start height needs to be drawn
    return;

  const Pen *fpen = is_infobox ? NULL : &look.pen;

  // position of thermal band
  if (numtherm > 1) {
    std::vector< std::pair<fixed, fixed> > thermal_profile;
    thermal_profile.reserve(numtherm);
    for (int i = 0; i < numtherm; ++i)
      thermal_profile.emplace_back(Wt[i], ht[i]);

    if (!is_infobox) {
#ifdef ENABLE_OPENGL
      const GLEnable blend(GL_BLEND);
#endif
      chart.DrawFilledY(thermal_profile, look.brush, fpen);
    } else
      chart.DrawFilledY(thermal_profile, look.brush, fpen);
  }

  // position of thermal band
  if (basic.NavAltitudeAvailable()) {
    const Pen &pen = is_infobox && look.inverse
      ? look.white_pen : look.black_pen;
    chart.DrawLine(fixed(0), h,
                   settings_computer.polar.glide_polar_task.GetMC(), h, pen);
//.........这里部分代码省略.........
开发者ID:rjsikarwar,项目名称:XCSoar,代码行数:101,代码来源:ThermalBandRenderer.cpp


注:本文中的ChartRenderer::ScaleYFromValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。