Esempio n. 1
0
const SearchPointVector&
AbstractAirspace::GetClearance(const FlatProjection &projection) const
{
  #define RADIUS 5

  if (!m_clearance.empty())
    return m_clearance;

  m_clearance = m_border;
  if (is_convex != TriState::FALSE)
    is_convex = m_clearance.PruneInterior() ? TriState::FALSE : TriState::TRUE;

  FlatBoundingBox bb = m_clearance.CalculateBoundingbox();
  FlatGeoPoint center = bb.GetCenter();

  for (SearchPoint &i : m_clearance) {
    FlatGeoPoint p = i.GetFlatLocation();
    FlatRay r(center, p);
    int mag = r.Magnitude();
    int mag_new = mag + RADIUS;
    p = r.Parametric((double)mag_new / mag);
    i = SearchPoint(projection.Unproject(p), p);
  }

  return m_clearance;
}
const SearchPointVector&
AbstractAirspace::get_clearance() const
{
  #define RADIUS 5

  if (!m_clearance.empty())
    return m_clearance;

  assert(m_task_projection != NULL);

  m_clearance = m_border;
  if (!m_is_convex) {
    prune_interior(m_clearance);
  }

  FlatBoundingBox bb = ::compute_boundingbox(m_clearance);
  FlatGeoPoint center = bb.get_center();

  for (SearchPointVector::iterator i= m_clearance.begin();
       i != m_clearance.end(); ++i) {
    FlatGeoPoint p = i->get_flatLocation();
    FlatRay r(center, p);
    int mag = hypot(r.vector.Longitude, r.vector.Latitude);
    int mag_new = mag+RADIUS;
    p = r.parametric((fixed)mag_new/mag);
    *i = SearchPoint(m_task_projection->unproject(p));
    i->project(*m_task_projection);
  }
  return m_clearance;
}
Esempio n. 3
0
const SearchPointVector&
AbstractAirspace::GetClearance(const TaskProjection &projection) const
{
  #define RADIUS 5

  if (!m_clearance.empty())
    return m_clearance;

  m_clearance = m_border;
  if (!m_is_convex)
    m_clearance.PruneInterior();

  FlatBoundingBox bb = m_clearance.CalculateBoundingbox();
  FlatGeoPoint center = bb.GetCenter();

  for (auto i= m_clearance.begin(); i != m_clearance.end(); ++i) {
    FlatGeoPoint p = i->get_flatLocation();
    FlatRay r(center, p);
    int mag = r.Magnitude();
    int mag_new = mag + RADIUS;
    p = r.Parametric((fixed)mag_new / mag);
    *i = SearchPoint(projection.unproject(p), p);
  }

  return m_clearance;
}
Esempio n. 4
0
GeoBounds
FlatProjection::Unproject(const FlatBoundingBox &bb) const
{
    assert(IsValid());

    return GeoBounds(Unproject(bb.GetTopLeft()), Unproject(bb.GetBottomRight()));
}
Esempio n. 5
0
GeoBounds
FlatProjection::Unproject(const FlatBoundingBox &bb) const
{
  assert(IsValid());

  return GeoBounds(Unproject(FlatGeoPoint(bb.GetLowerLeft().longitude,
                                          bb.GetUpperRight().latitude)),
                   Unproject(FlatGeoPoint(bb.GetUpperRight().longitude,
                                          bb.GetLowerLeft().latitude)));
}
Esempio n. 6
0
void
FlatTriangleFanTree::AcceptInRange(const FlatBoundingBox &bb,
                                   const TaskProjection &task_proj,
                                   TriangleFanVisitor &visitor) const
{
  if (!bb.Overlaps(bb_children))
    return;

  if (bb.Overlaps(bounding_box)) {
    visitor.StartFan();
    for (auto it = vs.cbegin(), end = vs.cend(); it != end; ++it)
      visitor.AddPoint(task_proj.Unproject(*it));

    visitor.EndFan();
  }

  for (auto it = children.cbegin(), end = children.cend(); it != end; ++it)
    it->AcceptInRange(bb, task_proj, visitor);
}
Esempio n. 7
0
void
FlatTriangleFanTree::AcceptInRange(const FlatBoundingBox &bb,
                                   const FlatProjection &projection,
                                   TriangleFanVisitor &visitor) const
{
  if (!bb.Overlaps(bb_children))
    return;

  if (bb.Overlaps(bounding_box)) {
    visitor.StartFan();
    for (const auto &v : vs)
      visitor.AddPoint(projection.Unproject(v));

    visitor.EndFan();
  }

  for (const auto &child : children)
    child.AcceptInRange(bb, projection, visitor);
}