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


C++ AbstractAirspace::GetType方法代码示例

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


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

示例1: Intersection

  /**
   * Check whether this intersection should be added to, or updated in, the warning manager
   *
   * @param airspace Airspace corresponding to current intersection
   */
  void Intersection(const AbstractAirspace& airspace) {
    if (!airspace.IsActive())
      return; // ignore inactive airspaces completely

    if (!warning_manager.GetConfig().IsClassEnabled(airspace.GetType()) ||
        ExcludeAltitude(airspace))
      return;

    AirspaceWarning *warning = warning_manager.GetWarningPtr(airspace);
    if (warning == NULL || warning->IsStateAccepted(warning_state)) {

      AirspaceInterceptSolution solution;

      if (mode_inside) {
        airspace.Intercept(state, perf, solution, state.location, state.location);
      } else {
        solution = Intercept(airspace, state, perf);
      }
      if (!solution.IsValid())
        return;
      if (solution.elapsed_time > max_time)
        return;

      if (warning == NULL)
        warning = warning_manager.GetNewWarningPtr(airspace);

      warning->UpdateSolution(warning_state, solution);
      found = true;
    }
  }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:35,代码来源:AirspaceWarningManager.cpp

示例2: setup_outline

 void setup_outline(const AbstractAirspace &airspace) {
   if (settings.black_outline)
     canvas.SelectBlackPen();
   else
     canvas.Select(airspace_look.pens[airspace.GetType()]);
   canvas.SelectHollowBrush();
 }
开发者ID:davidswelt,项目名称:XCSoar,代码行数:7,代码来源:AirspaceRenderer.cpp

示例3:

bool
AirspaceFilterData::Match(const GeoPoint &location,
                          const FlatProjection &projection,
                          const AbstractAirspace &as) const
{
  if (cls != AirspaceClass::AIRSPACECLASSCOUNT && as.GetType() != cls)
    return false;

  if (name_prefix != nullptr && !as.MatchNamePrefix(name_prefix))
    return false;

  if (!direction.IsNegative()) {
    const auto closest = as.ClosestPoint(location, projection);
    const auto bearing = location.Bearing(closest);
    auto direction_error = (bearing - direction).AsDelta().AbsoluteDegrees();
    if (direction_error > fixed(18))
      return false;
  }

  if (!negative(distance)) {
    const auto closest = as.ClosestPoint(location, projection);
    const auto distance = location.Distance(closest);
    if (distance > distance)
      return false;
  }

  return true;
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:28,代码来源:AirspaceSorter.cpp

示例4:

gcc_pure
static bool
CheckAirspace(const AbstractAirspace &airspace)
{
  const AirspaceWarningConfig &config =
    CommonInterface::GetComputerSettings().airspace.warnings;

  return config.IsClassEnabled(airspace.GetType()) && !IsAcked(airspace);
}
开发者ID:damianob,项目名称:xcsoar,代码行数:9,代码来源:Airspace.cpp

示例5: SetupInterior

  bool SetupInterior(const AbstractAirspace &airspace) {
    if (settings.fill_mode == AirspaceRendererSettings::FillMode::NONE)
      return false;

    const AirspaceClassLook &class_look = look.classes[airspace.GetType()];

    canvas.Select(Brush(class_look.fill_color.WithAlpha(48)));
    canvas.SelectNullPen();

    return true;
  }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:11,代码来源:AirspaceRenderer.cpp

示例6: SetupCanvas

  bool SetupCanvas(const AbstractAirspace &airspace) {
    if (settings.black_outline)
      return true;

    AirspaceClass type = airspace.GetType();
    if (settings.classes[type].border_width == 0)
      // Don't draw outlines if border_width == 0
      return false;

    canvas.Select(look.classes[type].border_pen);

    return true;
  }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:13,代码来源:AirspaceRenderer.cpp

示例7: brush

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

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

    // Select pens and brushes
#ifndef USE_GDI
    Color color = airspace_look.colors[settings.colours[type]];
#ifdef ENABLE_OPENGL
    color = color.WithAlpha(48);
#endif
    Brush brush(color);
#else
    const Brush &brush = airspace_look.brushes[settings.brushes[type]];
    canvas.SetTextColor(LightColor(airspace_look.colors[settings.colours[type]]));
#endif

    PixelRect rcd;
    // Calculate top and bottom coordinate
    rcd.top = chart.screenY(as.GetTopAltitude(state));
    if (as.IsBaseTerrain())
      rcd.bottom = chart.screenY(fixed_zero);
    else
      rcd.bottom = chart.screenY(as.GetBaseAltitude(state));

    // Iterate through the intersections
    for (auto 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:pascaltempez,项目名称:xcsoar,代码行数:55,代码来源:CrossSectionWindow.cpp

示例8: setup_interior

  void setup_interior(const AbstractAirspace &airspace,
                      bool check_fillstencil = false) {
    // restrict drawing area and don't paint over previously drawn outlines
    if (check_fillstencil)
      glStencilFunc(GL_EQUAL, 1, 3);
    else
      glStencilFunc(GL_EQUAL, 0, 2);
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

    Color color = airspace_look.colors[settings.colours[airspace.GetType()]];
    canvas.Select(Brush(color.WithAlpha(90)));
    canvas.SelectNullPen();
  }
开发者ID:davidswelt,项目名称:XCSoar,代码行数:14,代码来源:AirspaceRenderer.cpp

示例9: SetupOutline

  bool SetupOutline(const AbstractAirspace &airspace) {
    AirspaceClass type = airspace.GetType();

    if (settings.black_outline)
      canvas.SelectBlackPen();
    else if (settings.classes[type].border_width == 0)
      // Don't draw outlines if border_width == 0
      return false;
    else
      canvas.Select(look.classes[type].border_pen);

    canvas.SelectHollowBrush();

    return true;
  }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:15,代码来源:AirspaceRenderer.cpp

示例10: set_buffer_pens

  void set_buffer_pens(const AbstractAirspace &airspace) {
    const unsigned color_index = settings.colours[airspace.GetType()];

#ifndef HAVE_HATCHED_BRUSH
    m_buffer.Select(airspace_look.solid_brushes[color_index]);
#else /* HAVE_HATCHED_BRUSH */

#ifdef HAVE_ALPHA_BLEND
    if (settings.transparency && AlphaBlendAvailable()) {
      m_buffer.Select(airspace_look.solid_brushes[color_index]);
    } else {
#endif
      // this color is used as the black bit
      m_buffer.SetTextColor(LightColor(airspace_look.colors[color_index]));

      // get brush, can be solid or a 1bpp bitmap
      m_buffer.Select(airspace_look.brushes[settings.brushes[airspace.GetType()]]);

      m_buffer.SetBackgroundOpaque();
      m_buffer.SetBackgroundColor(COLOR_WHITE);
#ifdef HAVE_ALPHA_BLEND
    }
#endif

    m_buffer.SelectNullPen();

    if (m_warnings.is_warning(airspace) || m_warnings.is_inside(airspace)) {
      m_stencil.SelectBlackBrush();
      m_stencil.Select(airspace_look.medium_pen);
    } else {
      m_stencil.Select(airspace_look.thick_pen);
      m_stencil.SelectHollowBrush();
    }

#endif /* HAVE_HATCHED_BRUSH */
  }
开发者ID:davidswelt,项目名称:XCSoar,代码行数:36,代码来源:AirspaceRenderer.cpp

示例11: DrawPolygon

void
AirspacePreviewRenderer::Draw(Canvas &canvas, const AbstractAirspace &airspace,
                              const RasterPoint pt, unsigned radius,
                              const AirspaceRendererSettings &settings,
                              const AirspaceLook &look)
{
  canvas.SelectHollowBrush();

  if (settings.black_outline)
    canvas.SelectBlackPen();
  else
    canvas.Select(look.pens[airspace.GetType()]);

  if (airspace.shape == AbstractAirspace::Shape::CIRCLE)
    canvas.circle(pt.x, pt.y, radius);
  else
    DrawPolygon(canvas, (const AirspacePolygon &)airspace, pt, radius);
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例12: SetBufferPens

  void SetBufferPens(const AbstractAirspace &airspace) {
    AirspaceClass airspace_class = airspace.GetType();

#ifndef HAVE_HATCHED_BRUSH
    buffer.Select(look.solid_brushes[airspace_class]);
#else /* HAVE_HATCHED_BRUSH */

#ifdef HAVE_ALPHA_BLEND
    if (settings.transparency && AlphaBlendAvailable()) {
      buffer.Select(look.solid_brushes[airspace_class]);
    } else {
#endif
      // this color is used as the black bit
      buffer.SetTextColor(LightColor(settings.classes[airspace_class].fill_color));

      // get brush, can be solid or a 1bpp bitmap
      buffer.Select(look.brushes[settings.classes[airspace_class].brush]);

      buffer.SetBackgroundOpaque();
      buffer.SetBackgroundColor(COLOR_WHITE);
#ifdef HAVE_ALPHA_BLEND
    }
#endif

    buffer.SelectNullPen();

    if (use_stencil) {
      if (warnings.HasWarning(airspace) || warnings.IsInside(airspace) ||
          settings.classes[airspace_class].fill_mode ==
          AirspaceClassRendererSettings::FillMode::ALL) {
        stencil.SelectBlackBrush();
        stencil.SelectNullPen();
      } else {
        stencil.Select(look.thick_pen);
        stencil.SelectHollowBrush();
      }
    }

#endif /* HAVE_HATCHED_BRUSH */
  }
开发者ID:rjsikarwar,项目名称:XCSoar,代码行数:40,代码来源:AirspaceRenderer.cpp

示例13: GetPolygonPoints

void
AirspacePreviewRenderer::Draw(Canvas &canvas, const AbstractAirspace &airspace,
                              const RasterPoint pt, unsigned radius,
                              const AirspaceRendererSettings &settings,
                              const AirspaceLook &look)
{
  AbstractAirspace::Shape shape = airspace.GetShape();
  AirspaceClass type = airspace.GetType();

  // Container for storing the points of a polygon airspace
  std::vector<RasterPoint> pts;
  if (shape == AbstractAirspace::Shape::POLYGON && !IsAncientHardware())
    GetPolygonPoints(pts, (const AirspacePolygon &)airspace, pt, radius);

  if (PrepareFill(canvas, type, look, settings)) {
    DrawShape(canvas, shape, pt, radius, pts);
    UnprepareFill(canvas);
  }

  if (PrepareOutline(canvas, type, look, settings))
    DrawShape(canvas, shape, pt, radius, pts);
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:22,代码来源:AirspacePreviewRenderer.cpp

示例14: Visit

  virtual void Visit(const AbstractAirspace &airspace) override {
    if (warnings.IsAcked(airspace))
      return;

    AirspaceClass airspace_class = airspace.GetType();
    if (settings.fill_mode == AirspaceRendererSettings::FillMode::NONE ||
        settings.classes[airspace_class].fill_mode ==
        AirspaceClassRendererSettings::FillMode::NONE)
      return;

    Begin();
    SetBufferPens(airspace);

    switch (airspace.GetShape()) {
    case AbstractAirspace::Shape::CIRCLE:
      VisitCircle((const AirspaceCircle &)airspace);
      break;

    case AbstractAirspace::Shape::POLYGON:
      VisitPolygon((const AirspacePolygon &)airspace);
      break;
    }
  }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:23,代码来源:AirspaceRenderer.cpp

示例15: tstring

tstring
AirspaceFormatter::GetNameAndClass(const AbstractAirspace &airspace)
{
  return tstring(airspace.GetName()) + _T(" ") + GetClass(airspace.GetType());
}
开发者ID:damianob,项目名称:xcsoar,代码行数:5,代码来源:AirspaceFormatter.cpp


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