3 XCSoar Glide Computer - http://www.xcsoar.org/
4 Copyright (C) 2000-2013 The XCSoar Project
5 A detailed list of copyright holders can be found in the file "AUTHORS".
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #ifndef AIRSPACE_ROUTE_HPP
23 #define AIRSPACE_ROUTE_HPP
25 #include "RoutePlanner.hpp"
26 #include "Airspace/Airspaces.hpp"
28 class AirspaceRoute
: public RoutePlanner
{
29 Airspaces m_airspaces
;
31 struct RouteAirspaceIntersection
{
32 const AbstractAirspace
*airspace
;
36 RouteAirspaceIntersection() = default;
39 RouteAirspaceIntersection(const AbstractAirspace
*_airspace
,
41 :airspace(_airspace
), point(_point
) {}
44 mutable RouteAirspaceIntersection m_inx
;
47 friend class PrintHelper
;
49 AirspaceRoute(const Airspaces
& master
);
50 virtual ~AirspaceRoute();
52 void Synchronise(const Airspaces
& master
,
53 const AGeoPoint
& origin
,
54 const AGeoPoint
& destination
);
58 unsigned AirspaceSize() const;
62 virtual void OnSolve(const AGeoPoint
& origin
,
63 const AGeoPoint
& destination
);
65 virtual bool IsTrivial() const {
66 return m_airspaces
.empty() && RoutePlanner::IsTrivial();
70 virtual bool CheckClearance(const RouteLink
&e
, RoutePoint
& inp
) const;
71 virtual void AddNearby(const RouteLink
& e
);
72 virtual bool CheckSecondary(const RouteLink
&e
);
74 void AddNearbyAirspace(const RouteAirspaceIntersection
&inx
, const RouteLink
& e
);
76 RouteAirspaceIntersection
77 FirstIntersecting(const RouteLink
& e
) const;
79 const AbstractAirspace
*
80 InsideOthers(const AGeoPoint
& origin
) const;
82 ClearingPair
FindClearingPair(const SearchPointVector
& spv
,
83 const SearchPointVector::const_iterator start
,
84 const SearchPointVector::const_iterator end
,
85 const AFlatGeoPoint
&dest
) const;
87 ClearingPair
GetPairs(const SearchPointVector
& spv
,
88 const RoutePoint
& start
,
89 const RoutePoint
& dest
) const;
91 ClearingPair
GetBackupPairs(const SearchPointVector
& spv
,
92 const RoutePoint
& start
,
93 const RoutePoint
& intc
) const;