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


C++ Chart::screenX方法代码示例

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


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

示例1: map

void
CrossSectionWindow::PaintTerrain(Canvas &canvas, Chart &chart)
{
  if (terrain == NULL)
    return;

  const GeoPoint p_diff = vec.EndPoint(start) - start;

  RasterTerrain::Lease map(*terrain);

  RasterPoint points[2 + AIRSPACE_SCANSIZE_X];

  points[0].x = chart.screenX(vec.distance);
  points[0].y = chart.screenY(fixed_zero);
  points[1].x = chart.screenX(fixed_zero);
  points[1].y = chart.screenY(fixed_zero);

  unsigned i = 2;
  for (unsigned j = 0; j < AIRSPACE_SCANSIZE_X; ++j) {
    const fixed t_this = fixed(j) / (AIRSPACE_SCANSIZE_X - 1);
    const GeoPoint p_this = start + p_diff * t_this;

    short h = map->GetHeight(p_this);
    if (RasterBuffer::is_special(h)) {
      if (RasterBuffer::is_water(h))
        /* water is at 0m MSL */
        /* XXX paint in blue? */
        h = 0;
      else
        /* skip "unknown" values */
        continue;
    }

    points[i].x = chart.screenX(t_this * vec.distance);
    points[i].y = chart.screenY(fixed(h));
    i++;
  }

  if (i >= 4) {
    canvas.SelectNullPen();
    canvas.Select(look.terrain_brush);
    canvas.polygon(&points[0], i);
  }
}
开发者ID:pascaltempez,项目名称:xcsoar,代码行数:44,代码来源:CrossSectionWindow.cpp

示例2:

void
CrossSectionWindow::PaintAircraft(Canvas &canvas, const Chart &chart,
                                  const PixelRect rc)
{
  canvas.Select(look.aircraft_brush);
  canvas.SelectNullPen();

  RasterPoint line[4];
  line[0].x = chart.screenX(fixed_zero);
  line[0].y = chart.screenY(gps_info.nav_altitude);
  line[1].x = rc.left;
  line[1].y = line[0].y;
  line[2].x = line[1].x;
  line[2].y = line[0].y - (line[0].x - line[1].x) / 2;
  line[3].x = (line[1].x + line[0].x) / 2;
  line[3].y = line[0].y;
  canvas.DrawTriangleFan(line, 4);
}
开发者ID:pascaltempez,项目名称:xcsoar,代码行数:18,代码来源:CrossSectionWindow.cpp

示例3: brush

void
CrossSectionWindow::PaintAircraft(Canvas &canvas, const Chart &chart,
                                  const PixelRect rc)
{
  Brush brush(text_color);
  canvas.select(brush);

  Pen pen(1, text_color);
  canvas.select(pen);

  RasterPoint line[4];
  line[0].x = chart.screenX(fixed_zero);
  line[0].y = chart.screenY(gps_info.NavAltitude);
  line[1].x = rc.left;
  line[1].y = line[0].y;
  line[2].x = line[1].x;
  line[2].y = line[0].y - (line[0].x - line[1].x) / 2;
  line[3].x = (line[1].x + line[0].x) / 2;
  line[3].y = line[0].y;
  canvas.polygon(line, 4);
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:21,代码来源:CrossSectionWindow.cpp


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