71 const int tz_selection)
72 :
BasePrintout(_(
"Route Print").ToStdString()), m_route(route) {
77 m_table.StartFillHeader();
82 m_table << _(
"Waypoint");
85 m_table << _(
"Position");
88 m_table << _(
"Course");
91 m_table << _(
"Distance");
94 m_table << _(
"Speed");
103 m_table << _(
"Next tide event");
106 m_table << _(
"Description");
110 m_table.StartFillWidths();
141 m_table.StartFillData();
143 for (
int n = 1; n <= m_route->GetnPoints(); n++) {
145 if (NULL == point)
continue;
154 m_table << point->GetName();
157 std::wostringstream point_position;
158 point_position << toSDMM(1, point->m_lat,
false) <<
"\n"
159 << toSDMM(2, point->m_lon,
false);
160 m_table << point_position.str();
164 m_table << formatAngle(point->GetCourse());
171 std::ostringstream point_distance;
172 point_distance << std::fixed << std::setprecision(2) << std::setw(6)
174 << getUsrDistanceUnit();
175 m_table << point_distance.str();
181 std::wostringstream point_speed;
183 point_speed << std::fixed << std::setprecision(1);
189 point_speed << getUsrSpeedUnit().ToStdString();
190 m_table << point_speed.str();
197 .FormatISOCombined(
' ');
203 .FormatISOCombined(
' ');
209 std::wostringstream point_tide;
211 int station_id =
ptcmgr->GetStationIDXbyName(
213 if (station_id > 0) {
214 point_tide <<
ptcmgr->GetTidalEventStr(station_id, point->
GetETA(),
215 point->m_lat, point->m_lon,
218 m_table << point_tide.str();
227 m_table << point->GetDescription();
265 wxFont title_font(16, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
267 wxFont subtitle_font(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
268 wxFONTWEIGHT_NORMAL);
269 wxFont header_font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
271 wxFont normal_font(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
272 wxFONTWEIGHT_NORMAL);
274 wxBrush brush(wxColour(255, 255, 255), wxBRUSHSTYLE_TRANSPARENT);
277 int current_x = m_margin_x;
278 int current_y = m_margin_y;
280 std::wostringstream title;
281 std::wostringstream subtitle;
282 std::wostringstream distance;
284 distance << std::fixed << std::setprecision(1)
286 << getUsrDistanceUnit().ToStdString();
290 title <<
" (" << distance.str() <<
")";
292 title << _(
"Total distance ").ToStdString() << distance.str();
296 subtitle << _(
"From").ToStdString() <<
" "
299 subtitle <<
" " << _(
"To").ToStdString() <<
" "
303 subtitle << _(
"Destination").ToStdString() <<
" "
307 int title_width, title_height;
308 dc->SetFont(title_font);
309 dc->GetTextExtent(title.str(), &title_width, &title_height);
310 dc->DrawText(title.str(), current_x, current_y);
311 current_y += title_height + m_text_offset_y;
313 if (subtitle.str().length() > 0) {
314 int subtitle_width, subtitle_height;
315 dc->SetFont(subtitle_font);
316 dc->GetTextExtent(subtitle.str(), &subtitle_width, &subtitle_height);
317 dc->DrawText(subtitle.str(), current_x, current_y);
318 current_y += subtitle_height + m_text_offset_y;
321 dc->SetFont(normal_font);
325 int page_size_x, page_size_y;
326 dc->GetSize(&page_size_x, &page_size_y);
330 dc->DrawText(cell_desc.GetText(), current_x, current_y);
331 current_y += cell_desc.GetHeight() + m_text_offset_y;
334 vector<PrintCell>& header_content = m_table.GetHeader();
335 for (
size_t j = 0; j < header_content.size(); j++) {
337 dc->DrawRectangle(current_x, current_y, cell.GetWidth() + m_text_offset_x,
338 cell.GetHeight() + m_text_offset_y);
339 dc->DrawText(cell.GetText(), current_x + m_text_offset_x,
340 current_y + m_text_offset_y);
341 current_x += cell.GetWidth() + m_text_offset_x;
344 wxFont routePrintFont_normal(10, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL,
345 wxFONTWEIGHT_NORMAL);
346 dc->SetFont(routePrintFont_normal);
348 vector<vector<PrintCell> >& cells = m_table.GetContent();
349 current_y += m_table.GetHeaderHeight() + m_text_offset_y;
350 int current_height = 0;
351 for (
size_t i = 0; i < cells.size(); i++) {
352 vector<PrintCell>& content_row = cells[i];
353 current_x = m_margin_x;
354 for (
size_t j = 0; j < content_row.size(); j++) {
356 if (cell.GetPage() == page) {
357 wxRect r(current_x, current_y, cell.GetWidth() + m_text_offset_x,
358 cell.GetHeight() + m_text_offset_y);
359 dc->DrawRectangle(r);
360 r.Offset(m_text_offset_x, m_text_offset_y);
361 dc->DrawLabel(cell.GetText(), r);
362 current_x += cell.GetWidth() + m_text_offset_x;
363 current_height = cell.GetHeight() + m_text_offset_y;
366 current_y += current_height;