73 const int tz_selection)
74 :
BasePrintout(_(
"Route Print").ToStdString()), m_route(route) {
79 m_table.StartFillHeader();
84 m_table << _(
"Waypoint");
87 m_table << _(
"Position");
90 m_table << _(
"Course");
93 m_table << _(
"Distance");
96 m_table << _(
"Speed");
105 m_table << _(
"Next tide event");
108 m_table << _(
"Description");
112 m_table.StartFillWidths();
143 m_table.StartFillData();
145 for (
int n = 1; n <= m_route->GetnPoints(); n++) {
147 if (NULL == point)
continue;
156 m_table << point->GetName();
159 std::wostringstream point_position;
160 point_position << toSDMM(1, point->m_lat,
false) <<
"\n"
161 << toSDMM(2, point->m_lon,
false);
162 m_table << point_position.str();
166 m_table << formatAngle(point->GetCourse());
173 std::ostringstream point_distance;
174 point_distance << std::fixed << std::setprecision(2) << std::setw(6)
176 << getUsrDistanceUnit();
177 m_table << point_distance.str();
183 std::wostringstream point_speed;
185 point_speed << std::fixed << std::setprecision(1);
191 point_speed << getUsrSpeedUnit().ToStdString();
192 m_table << point_speed.str();
199 .FormatISOCombined(
' ');
205 .FormatISOCombined(
' ');
211 std::wostringstream point_tide;
213 int station_id =
ptcmgr->GetStationIDXbyName(
215 if (station_id > 0) {
216 point_tide <<
ptcmgr->GetTidalEventStr(station_id, point->
GetETA(),
217 point->m_lat, point->m_lon,
220 m_table << point_tide.str();
229 m_table << point->GetDescription();
267 wxFont title_font(16, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
269 wxFont subtitle_font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
270 wxFONTWEIGHT_NORMAL);
271 wxFont header_font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
273 wxFont normal_font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
274 wxFONTWEIGHT_NORMAL);
276 wxBrush brush(wxColour(255, 255, 255), wxBRUSHSTYLE_TRANSPARENT);
279 int current_x = m_margin_x;
280 int current_y = m_margin_y;
282 std::wostringstream title;
283 std::wostringstream subtitle;
284 std::wostringstream distance;
286 distance << std::fixed << std::setprecision(1)
288 << getUsrDistanceUnit().ToStdString();
292 title <<
" (" << distance.str() <<
")";
294 title << _(
"Total distance ").ToStdString() << distance.str();
298 subtitle << _(
"From").ToStdString() <<
" "
301 subtitle <<
" " << _(
"To").ToStdString() <<
" "
305 subtitle << _(
"Destination").ToStdString() <<
" "
309 int title_width, title_height;
310 dc->SetFont(title_font);
311 dc->GetTextExtent(title.str(), &title_width, &title_height);
312 dc->DrawText(title.str(), current_x, current_y);
313 current_y += title_height + m_text_offset_y;
315 if (subtitle.str().length() > 0) {
316 int subtitle_width, subtitle_height;
317 dc->SetFont(subtitle_font);
318 dc->GetTextExtent(subtitle.str(), &subtitle_width, &subtitle_height);
319 dc->DrawText(subtitle.str(), current_x, current_y);
320 current_y += subtitle_height + m_text_offset_y;
323 dc->SetFont(normal_font);
327 int page_size_x, page_size_y;
328 dc->GetSize(&page_size_x, &page_size_y);
332 dc->DrawText(cell_desc.GetText(), current_x, current_y);
333 current_y += cell_desc.GetHeight() + m_text_offset_y;
336 vector<PrintCell>& header_content = m_table.GetHeader();
337 for (
size_t j = 0; j < header_content.size(); j++) {
339 dc->DrawRectangle(current_x, current_y, cell.GetWidth() + m_text_offset_x,
340 cell.GetHeight() + m_text_offset_y);
341 dc->DrawText(cell.GetText(), current_x + m_text_offset_x,
342 current_y + m_text_offset_y);
343 current_x += cell.GetWidth() + m_text_offset_x;
346 wxFont routePrintFont_normal(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
347 wxFONTWEIGHT_NORMAL);
348 dc->SetFont(routePrintFont_normal);
350 vector<vector<PrintCell> >& cells = m_table.GetContent();
351 current_y += m_table.GetHeaderHeight() + m_text_offset_y;
352 int current_height = 0;
353 for (
size_t i = 0; i < cells.size(); i++) {
354 vector<PrintCell>& content_row = cells[i];
355 current_x = m_margin_x;
356 for (
size_t j = 0; j < content_row.size(); j++) {
358 if (cell.GetPage() == page) {
359 wxRect r(current_x, current_y, cell.GetWidth() + m_text_offset_x,
360 cell.GetHeight() + m_text_offset_y);
361 dc->DrawRectangle(r);
362 r.Offset(m_text_offset_x, m_text_offset_y);
363 dc->DrawLabel(cell.GetText(), r);
364 current_x += cell.GetWidth() + m_text_offset_x;
365 current_height = cell.GetHeight() + m_text_offset_y;
368 current_y += current_height;