4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "GlueMapWindow.hpp"
25 #include "Items/List.hpp"
26 #include "Items/Builder.hpp"
27 #include "Look/MapLook.hpp"
28 #include "Dialogs/MapItemListDialog.hpp"
29 #include "UIGlobals.hpp"
30 #include "Screen/Layout.hpp"
31 #include "Computer/GlideComputer.hpp"
32 #include "Dialogs/Message.hpp"
33 #include "Language/Language.hpp"
34 #include "Weather/Features.hpp"
35 #include "Interface.hpp"
38 GlueMapWindow::ShowMapItems(const GeoPoint
&location
,
39 bool show_empty_message
) const
41 /* not using MapWindowBlackboard here because this method is called
43 const ComputerSettings
&computer_settings
=
44 CommonInterface::GetComputerSettings();
45 const MapSettings
&settings
= CommonInterface::GetMapSettings();
46 const MoreData
&basic
= CommonInterface::Basic();
47 const DerivedInfo
&calculated
= CommonInterface::Calculated();
49 fixed range
= visible_projection
.DistancePixelsToMeters(Layout::GetHitRadius());
52 MapItemListBuilder
builder(list
, location
, range
);
54 if (settings
.item_list
.add_location
)
55 builder
.AddLocation(basic
, terrain
);
57 if (settings
.item_list
.add_arrival_altitude
&& route_planner
)
58 builder
.AddArrivalAltitudes(*route_planner
, terrain
,
59 computer_settings
.task
.safety_height_arrival
);
61 if (basic
.location_available
)
62 builder
.AddSelfIfNear(basic
.location
, basic
.attitude
.heading
);
65 builder
.AddTaskOZs(*task
);
67 const Airspaces
*airspace_database
= airspace_renderer
.GetAirspaces();
68 if (airspace_database
)
69 builder
.AddVisibleAirspace(*airspace_database
,
70 airspace_renderer
.GetWarningManager(),
71 computer_settings
.airspace
,
72 settings
.airspace
, basic
,
75 if (marks
&& visible_projection
.GetMapScale() <= fixed(30000))
76 builder
.AddMarkers(*marks
);
78 if (visible_projection
.GetMapScale() <= fixed(4000))
79 builder
.AddThermals(calculated
.thermal_locator
, basic
, calculated
);
82 builder
.AddWaypoints(*waypoints
);
86 builder
.AddWeatherStations(*noaa_store
);
89 builder
.AddTraffic(basic
.flarm
.traffic
);
91 #ifdef HAVE_SKYLINES_TRACKING_HANDLER
92 builder
.AddSkyLinesTraffic();
95 // Sort the list of map items
98 // Show the list dialog
100 if (show_empty_message
)
101 ShowMessageBox(_("There is nothing interesting near this location."),
102 _("Map elements at this location"), MB_OK
| MB_ICONINFORMATION
);
107 ShowMapItemListDialog(list
,
108 UIGlobals::GetDialogLook(), look
, traffic_look
,
109 final_glide_bar_renderer
.GetLook(), settings
,
110 glide_computer
!= NULL
111 ? &glide_computer
->GetAirspaceWarnings() : NULL
);