void MapItemListBuilder::AddArrivalAltitudes( const ProtectedRoutePlanner &route_planner, const RasterTerrain *terrain, double safety_height) { if (list.full()) return; // Calculate terrain elevation if possible double elevation = LocationMapItem::UNKNOWN_ELEVATION; if (terrain != nullptr) elevation = terrain->GetTerrainHeight(location) .ToDouble(LocationMapItem::UNKNOWN_ELEVATION); // Calculate target altitude double safety_elevation(safety_height); if (elevation > ArrivalAltitudeMapItem::UNKNOWN_ELEVATION_THRESHOLD) safety_elevation += elevation; // Save destination point incl. elevation and safety height const AGeoPoint destination(location, safety_elevation); // Calculate arrival altitudes ReachResult reach; ProtectedRoutePlanner::Lease leased_route_planner(route_planner); if (!leased_route_planner->FindPositiveArrival(destination, reach)) return; reach.Subtract(safety_height); list.append(new ArrivalAltitudeMapItem(elevation, reach)); }
void MapItemListBuilder::AddArrivalAltitudes( const ProtectedRoutePlanner &route_planner, const RasterTerrain *terrain, fixed safety_height) { if (list.full()) return; // Calculate terrain elevation if possible short elevation; if (terrain != NULL) elevation = terrain->GetTerrainHeight(location); else elevation = RasterBuffer::TERRAIN_INVALID; // Calculate target altitude RoughAltitude safety_elevation(safety_height); if (!RasterBuffer::IsInvalid(elevation)) safety_elevation += RoughAltitude(elevation); // Save destination point incl. elevation and safety height const AGeoPoint destination(location, safety_elevation); // Calculate arrival altitudes ReachResult reach; ProtectedRoutePlanner::Lease leased_route_planner(route_planner); if (!leased_route_planner->FindPositiveArrival(destination, reach)) return; reach.Subtract(RoughAltitude(safety_height)); list.append(new ArrivalAltitudeMapItem(RoughAltitude(elevation), reach)); }