FlatBoundingBox OrderedTask::GetBoundingBox(const GeoBounds &bounds) const { if (!TaskSize()) { // undefined! return FlatBoundingBox(FlatGeoPoint(0,0),FlatGeoPoint(0,0)); } FlatGeoPoint ll = task_projection.ProjectInteger(GeoPoint(bounds.west, bounds.south)); FlatGeoPoint lr = task_projection.ProjectInteger(GeoPoint(bounds.east, bounds.south)); FlatGeoPoint ul = task_projection.ProjectInteger(GeoPoint(bounds.west, bounds.north)); FlatGeoPoint ur = task_projection.ProjectInteger(GeoPoint(bounds.east, bounds.north)); FlatGeoPoint fmin(min(ll.longitude, ul.longitude), min(ll.latitude, lr.latitude)); FlatGeoPoint fmax(max(lr.longitude, ur.longitude), max(ul.latitude, ur.latitude)); // note +/- 1 to ensure rounding keeps bb valid fmin.longitude -= 1; fmin.latitude -= 1; fmax.longitude += 1; fmax.latitude += 1; return FlatBoundingBox (fmin, fmax); }
const FlatBoundingBox AirspacePolygon::get_bounding_box(const TaskProjection& task_projection) { FlatGeoPoint fmin; FlatGeoPoint fmax; project(task_projection); bool empty=true; for (SearchPointVector::const_iterator v = m_border.begin(); v != m_border.end(); ++v) { FlatGeoPoint f = v->get_flatLocation(); if (empty) { empty = false; fmin = f; fmax = f; } else { fmin.Longitude = min(fmin.Longitude, f.Longitude); fmin.Latitude = min(fmin.Latitude, f.Latitude); fmax.Longitude = max(fmax.Longitude, f.Longitude); fmax.Latitude = max(fmax.Latitude, f.Latitude); } } if (!empty) { // note +/- 1 to ensure rounding keeps bb valid fmin.Longitude-= 1; fmin.Latitude-= 1; fmax.Longitude+= 1; fmax.Latitude+= 1; return FlatBoundingBox(fmin,fmax); } else { return FlatBoundingBox(FlatGeoPoint(0,0),FlatGeoPoint(0,0)); } }
FlatBoundingBox OrderedTask::get_bounding_box(const GeoPoint& point) const { if (!TaskSize()) { // undefined! return FlatBoundingBox(FlatGeoPoint(0,0),FlatGeoPoint(0,0)); } return FlatBoundingBox (task_projection.project(point), 1); }
void OrderedTaskPoint::update_boundingbox(const TaskProjection& task_projection) { FlatGeoPoint fmin; FlatGeoPoint fmax; bool empty = true; for (fixed t=fixed_zero; t<= fixed_one; t+= fixed_steps) { FlatGeoPoint f = task_projection.project(get_boundary_parametric(t)); if (empty) { empty = false; fmin = f; fmax = f; } else { fmin.Longitude = min(fmin.Longitude, f.Longitude); fmin.Latitude = min(fmin.Latitude, f.Latitude); fmax.Longitude = max(fmax.Longitude, f.Longitude); fmax.Latitude = max(fmax.Latitude, f.Latitude); } } // note +/- 1 to ensure rounding keeps bb valid fmin.Longitude-= 1; fmin.Latitude-= 1; fmax.Longitude+= 1; fmax.Latitude+= 1; flat_bb = FlatBoundingBox(fmin,fmax); }
FlatBoundingBox FlatProjection::ProjectSquare(const GeoPoint center, double radius) const { FlatGeoPoint flat_center = ProjectInteger(center); int flat_radius = ProjectRangeInteger(center, radius); return FlatBoundingBox(flat_center, flat_radius); }
const FlatBoundingBox AirspaceCircle::get_bounding_box(const TaskProjection& task_projection) { static const Angle a225 = Angle::degrees(fixed(225)); static const Angle a135 = Angle::degrees(fixed(135)); static const Angle a045 = Angle::degrees(fixed(045)); static const Angle a315 = Angle::degrees(fixed(315)); const fixed eradius = m_radius * fixed(1.42); const GeoPoint ll = GeoVector(eradius, a225).end_point(m_center); const GeoPoint lr = GeoVector(eradius, a135).end_point(m_center); const GeoPoint ur = GeoVector(eradius, a045).end_point(m_center); const GeoPoint ul = GeoVector(eradius, a315).end_point(m_center); FlatGeoPoint fll = task_projection.project(ll); FlatGeoPoint flr = task_projection.project(lr); FlatGeoPoint ful = task_projection.project(ul); FlatGeoPoint fur = task_projection.project(ur); // note +/- 1 to ensure rounding keeps bb valid return FlatBoundingBox(FlatGeoPoint(min(fll.Longitude, ful.Longitude) - 1, min(fll.Latitude, flr.Latitude) - 1), FlatGeoPoint(max(flr.Longitude, fur.Longitude) + 1, max(ful.Latitude, fur.Latitude) + 1)); }
void OrderedTaskPoint::update_boundingbox(const TaskProjection& task_projection) { flat_bb = FlatBoundingBox(task_projection.project(get_location())); for (fixed t=fixed_zero; t<= fixed_one; t+= fixed_steps) flat_bb.expand(task_projection.project(get_boundary_parametric(t))); flat_bb.expand(); // add 1 to fix rounding }
void FlatTriangleFan::CalcBoundingBox() { assert(!vs.empty()); auto it = vs.begin(), end = vs.end(); bounding_box = FlatBoundingBox(*it); for (++it; it != end; ++it) bounding_box.Expand(*it); }
void OrderedTaskPoint::UpdateBoundingBox(const TaskProjection &task_projection) { flat_bb = FlatBoundingBox(task_projection.ProjectInteger(GetLocation())); for (const auto &i : GetBoundary()) flat_bb.Expand(task_projection.ProjectInteger(i)); flat_bb.ExpandByOne(); // add 1 to fix rounding }
void OrderedTaskPoint::update_boundingbox(const TaskProjection &task_projection) { flat_bb = FlatBoundingBox(task_projection.project(GetLocation())); const ObservationZone::Boundary boundary = GetBoundary(); for (auto i = boundary.begin(), end = boundary.end(); i != end; ++i) flat_bb.Expand(task_projection.project(*i)); flat_bb.ExpandByOne(); // add 1 to fix rounding }
FlatBoundingBox SearchPointVector::CalculateBoundingbox() const { if (empty()) return FlatBoundingBox(FlatGeoPoint(0,0),FlatGeoPoint(0,0)); FlatBoundingBox bb((*this)[0].GetFlatLocation()); for (const auto &i : *this) bb.Expand(i.GetFlatLocation()); bb.ExpandByOne(); // add 1 to fix rounding return bb; }
FlatBoundingBox SearchPointVector::CalculateBoundingbox() const { if (empty()) return FlatBoundingBox(FlatGeoPoint(0,0),FlatGeoPoint(0,0)); FlatBoundingBox bb((*this)[0].get_flatLocation()); for (const_iterator v = begin(); v != end(); ++v) bb.expand(v->get_flatLocation()); bb.expand(); // add 1 to fix rounding return bb; }