74 const int tz_selection)
75 :
BasePrintout(_(
"Route Print").ToStdString()), m_route(route) {
80 m_table.StartFillHeader();
85 m_table << _(
"Waypoint");
88 m_table << _(
"Position");
91 m_table << _(
"Course");
94 m_table << _(
"Distance");
97 m_table << _(
"Speed");
106 m_table << _(
"Next tide event");
109 m_table << _(
"Description");
113 m_table.StartFillWidths();
144 m_table.StartFillData();
146 for (
int n = 1; n <= m_route->GetnPoints(); n++) {
148 if (NULL == point)
continue;
157 m_table << point->GetName();
160 std::wostringstream point_position;
161 point_position << toSDMM(1, point->m_lat,
false) <<
"\n"
162 << toSDMM(2, point->m_lon,
false);
163 m_table << point_position.str();
167 m_table << formatAngle(point->GetCourse());
174 std::ostringstream point_distance;
175 point_distance << std::fixed << std::setprecision(2) << std::setw(6)
176 << toUsrDistance(point->GetDistance())
177 << getUsrDistanceUnit();
178 m_table << point_distance.str();
184 std::wostringstream point_speed;
186 point_speed << std::fixed << std::setprecision(1);
192 point_speed << getUsrSpeedUnit().ToStdString();
193 m_table << point_speed.str();
199 m_table << toUsrDateTime(point->
GetETA(), tz_selection, point->m_lon)
200 .FormatISOCombined(
' ');
204 m_table << toUsrDateTime(point->
GetManualETD(), tz_selection,
206 .FormatISOCombined(
' ');
212 std::wostringstream point_tide;
214 int station_id = ptcmgr->GetStationIDXbyName(
216 if (station_id > 0) {
217 point_tide << ptcmgr->GetTidalEventStr(station_id, point->
GetETA(),
218 point->m_lat, point->m_lon,
221 m_table << point_tide.str();
230 m_table << point->GetDescription();
268 wxFont title_font(16, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
270 wxFont subtitle_font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
271 wxFONTWEIGHT_NORMAL);
272 wxFont header_font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
274 wxFont normal_font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
275 wxFONTWEIGHT_NORMAL);
277 wxBrush brush(wxColour(255, 255, 255), wxBRUSHSTYLE_TRANSPARENT);
280 int current_x = m_margin_x;
281 int current_y = m_margin_y;
283 std::wostringstream title;
284 std::wostringstream subtitle;
285 std::wostringstream distance;
287 distance << std::fixed << std::setprecision(1)
289 << getUsrDistanceUnit().ToStdString();
293 title <<
" (" << distance.str() <<
")";
295 title << _(
"Total distance ").ToStdString() << distance.str();
299 subtitle << _(
"From").ToStdString() <<
" "
302 subtitle <<
" " << _(
"To").ToStdString() <<
" "
306 subtitle << _(
"Destination").ToStdString() <<
" "
310 int title_width, title_height;
311 dc->SetFont(title_font);
312 dc->GetTextExtent(title.str(), &title_width, &title_height);
313 dc->DrawText(title.str(), current_x, current_y);
314 current_y += title_height + m_text_offset_y;
316 if (subtitle.str().length() > 0) {
317 int subtitle_width, subtitle_height;
318 dc->SetFont(subtitle_font);
319 dc->GetTextExtent(subtitle.str(), &subtitle_width, &subtitle_height);
320 dc->DrawText(subtitle.str(), current_x, current_y);
321 current_y += subtitle_height + m_text_offset_y;
324 dc->SetFont(normal_font);
328 int page_size_x, page_size_y;
329 dc->GetSize(&page_size_x, &page_size_y);
333 dc->DrawText(cell_desc.GetText(), current_x, current_y);
334 current_y += cell_desc.GetHeight() + m_text_offset_y;
337 vector<PrintCell>& header_content = m_table.GetHeader();
338 for (
size_t j = 0; j < header_content.size(); j++) {
340 dc->DrawRectangle(current_x, current_y, cell.GetWidth() + m_text_offset_x,
341 cell.GetHeight() + m_text_offset_y);
342 dc->DrawText(cell.GetText(), current_x + m_text_offset_x,
343 current_y + m_text_offset_y);
344 current_x += cell.GetWidth() + m_text_offset_x;
347 wxFont routePrintFont_normal(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
348 wxFONTWEIGHT_NORMAL);
349 dc->SetFont(routePrintFont_normal);
351 vector<vector<PrintCell> >& cells = m_table.GetContent();
352 current_y += m_table.GetHeaderHeight() + m_text_offset_y;
353 int current_height = 0;
354 for (
size_t i = 0; i < cells.size(); i++) {
355 vector<PrintCell>& content_row = cells[i];
356 current_x = m_margin_x;
357 for (
size_t j = 0; j < content_row.size(); j++) {
359 if (cell.GetPage() == page) {
360 wxRect r(current_x, current_y, cell.GetWidth() + m_text_offset_x,
361 cell.GetHeight() + m_text_offset_y);
362 dc->DrawRectangle(r);
363 r.Offset(m_text_offset_x, m_text_offset_y);
364 dc->DrawLabel(cell.GetText(), r);
365 current_x += cell.GetWidth() + m_text_offset_x;
366 current_height = cell.GetHeight() + m_text_offset_y;
369 current_y += current_height;