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


C++ GeoPoint::distance方法代码示例

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


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

示例1: brush

  /**
   * Renders the AbstractAirspace on the canvas
   * @param as AbstractAirspace to render
   */
  void
  Render(const AbstractAirspace& as)
  {
    int type = as.get_type();
    if (type <= 0)
      return;

    // No intersections for this airspace
    if (m_intersections.empty())
      return;

    // Select pens and brushes
#ifdef ENABLE_SDL
    Color color =
      Graphics::GetAirspaceColour(settings.colours[type]);
#ifdef ENABLE_OPENGL
    color = color.with_alpha(48);
#endif
    Brush brush(color);
#else
    const Brush &brush = Graphics::GetAirspaceBrushByClass(type, settings);
    canvas.set_text_color(light_color(Graphics::GetAirspaceColourByClass(type, settings)));
#endif

    PixelRect rcd;
    // Calculate top and bottom coordinate
    rcd.top = chart.screenY(as.get_top_altitude(state));
    if (as.is_base_terrain())
      rcd.bottom = chart.screenY(fixed_zero);
    else
      rcd.bottom = chart.screenY(as.get_base_altitude(state));

    // Iterate through the intersections
    for (AirspaceIntersectionVector::const_iterator it = m_intersections.begin();
         it != m_intersections.end(); ++it) {
      const GeoPoint p_start = it->first;
      const GeoPoint p_end = it->second;
      const fixed distance_start = start.distance(p_start);
      const fixed distance_end = start.distance(p_end);

      // Determine left and right coordinate
      rcd.left = chart.screenX(distance_start);
      rcd.right = chart.screenX(distance_end);

      // only one edge found, next edge must be beyond screen
      if ((rcd.left == rcd.right) && (p_start == p_end)) {
        rcd.right = chart.screenX(chart.getXmax());
      }

      // Draw the airspace
      RenderBox(rcd, brush, settings.black_outline, type);
    }
  }
开发者ID:Mrdini,项目名称:XCSoar,代码行数:57,代码来源:CrossSectionWindow.cpp

示例2: task_manager

bool
GlueMapWindow::isClickOnTarget(const RasterPoint pc)
{
    if (task == NULL)
        return false;

    if (XCSoarInterface::SettingsMap().TargetPan) {
        ProtectedTaskManager::Lease task_manager(*task);
        if (!task_manager->target_is_locked(XCSoarInterface::SettingsMap().TargetPanIndex))
            return false;

        const GeoPoint gnull(Angle::native(fixed_zero), Angle::native(fixed_zero));
        const GeoPoint& t = task_manager->get_location_target(
                                XCSoarInterface::SettingsMap().TargetPanIndex, gnull);

        if (t == gnull)
            return false;

        const GeoPoint gp = visible_projection.ScreenToGeo(pc.x, pc.y);
        if (visible_projection.GeoToScreenDistance(gp.distance(t)) <
                unsigned(Layout::Scale(10)))
            return true;
    }
    return false;
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:25,代码来源:GlueMapWindowTarget.cpp

示例3:

GeoPoint 
AirspaceCircle::closest_point(const GeoPoint& loc) const
{
  const fixed d = loc.distance(m_center);
  if (d <= m_radius)
    return loc;
  else
    return m_center.intermediate_point(loc, m_radius);
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:9,代码来源:AirspaceCircle.cpp

示例4: endpoint

void
AircraftSim::integrate(const Angle& heading, const fixed timestep)
{
  GeoPoint v = endpoint(heading, timestep);
  state.track = state.location.bearing(v);
  state.ground_speed = v.distance(state.location)/timestep;
  state.location = v;
  state.altitude += state.vario*timestep;
  state.time += timestep;
}
开发者ID:macsux,项目名称:XCSoar,代码行数:10,代码来源:AircraftSim.cpp

示例5: min

void
AATPoint::get_target_range_radial(fixed &range, fixed &radial) const
{
  const fixed oldrange = range;

  const GeoPoint fprev = get_previous()->get_location_remaining();
  const GeoPoint floc = get_location();
  const Angle radialraw = (floc.bearing(get_location_target()) -
      fprev.bearing(floc)).as_bearing();

  const fixed d = floc.distance(get_location_target());
  const fixed radius = floc.distance(get_location_min());
  const fixed rangeraw = min(fixed_one, d / radius);

  radial = radialraw.as_delta().value_degrees();
  const fixed rangesign = (fabs(radial) > fixed(90)) ?
      fixed_minus_one : fixed_one;
  range = rangeraw * rangesign;

  if ((oldrange == fixed_zero) && (range == fixed_zero))
    radial = fixed_zero;
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:22,代码来源:AATPoint.cpp

示例6: task_manager

bool
TargetMapWindow::isClickOnTarget(const RasterPoint pc)
{
  if (task == NULL)
    return false;

  ProtectedTaskManager::Lease task_manager(*task);
  if (!task_manager->has_target(target_index))
    return false;

  const GeoPoint gnull(Angle::zero(), Angle::zero());
  const GeoPoint& t = task_manager->get_location_target(target_index, gnull);

  if (t == gnull)
    return false;

  const GeoPoint gp = projection.ScreenToGeo(pc.x, pc.y);
  if (projection.GeoToScreenDistance(gp.distance(t)) <
      unsigned(Layout::Scale(10)))
    return true;

  return false;
}
开发者ID:macsux,项目名称:XCSoar,代码行数:23,代码来源:TargetMapWindowDrag.cpp

示例7: return

bool 
AirspaceCircle::inside(const GeoPoint &loc) const
{
  return (loc.distance(m_center) <= m_radius);
}
开发者ID:Plantain,项目名称:XCSoar,代码行数:5,代码来源:AirspaceCircle.cpp


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