50#include "user_colors.h"
53#include "user_colors.h"
63 if (NULL != rpn) *rpn = r;
65 if (!RoutePointGui(m_point).IsVisibleSelectable(canvas, boverride_viz))
69 if ((abs(r.x) > canvas->GetCanvasWidth() * 4) ||
70 (abs(r.y) > canvas->GetCanvasHeight() * 4))
74 if ((abs(r.x) == INVALID_COORD) || (abs(r.y) == INVALID_COORD))
return;
77 if (m_point.m_IconName ==
"empty" && !m_point.m_bShowName &&
78 !m_point.m_bPtIsSelected) {
89 if (m_point.m_IconIsDirty) ReLoadIcon();
91 if ((m_point.m_bIsActive) && (m_point.m_IconName !=
"mob"))
92 pbm = pWayPointMan->GetIconBitmap(
"activepoint");
94 pbm = m_point.m_pbmIcon;
96 wxBitmap *pbms = NULL;
97 if ((g_MarkScaleFactorExp > 1.0) && !m_point.m_bPreScaled) {
98 if (m_point.m_IconScaleFactor != g_MarkScaleFactorExp) {
99 wxImage scaled_image = pbm->ConvertToImage();
100 int new_width = pbm->GetWidth() * g_MarkScaleFactorExp;
101 int new_height = pbm->GetHeight() * g_MarkScaleFactorExp;
102 m_point.m_ScaledBMP = wxBitmap(
103 scaled_image.Scale(new_width, new_height, wxIMAGE_QUALITY_HIGH));
105 m_point.m_IconScaleFactor = g_MarkScaleFactorExp;
107 if (m_point.m_ScaledBMP.IsOk()) pbm = &m_point.m_ScaledBMP;
110 int sx2 = pbm->GetWidth() / 2;
111 int sy2 = pbm->GetHeight() / 2;
114 wxRect r1(r.x - sx2, r.y - sy2, sx2 * 2, sy2 * 2);
116 if (m_point.m_bShowName) {
117 if (0 == m_point.m_pMarkFont) {
118 wxFont *dFont = FontMgr::Get().
GetFont(_(
"Marks"));
119 int font_size = wxMax(8, dFont->GetPointSize());
123 font_size, dFont->GetFamily(), dFont->GetStyle(), dFont->GetWeight(),
124 false, dFont->GetFaceName());
126 m_point.m_FontColor = FontMgr::Get().
GetFontColor(_(
"Marks"));
127 m_point.CalculateNameExtents();
130 if (m_point.m_pMarkFont) {
131 wxRect r2(r.x + m_point.m_NameLocationOffsetX,
132 r.y + m_point.m_NameLocationOffsetY, m_point.m_NameExtents.x,
133 m_point.m_NameExtents.y);
143 hilitebox.Inflate(20);
146 hilitebox.Inflate(4);
150 wxColour hi_colour = pen->GetColour();
151 unsigned char transparency = 100;
152 if (m_point.m_bRPIsBeingEdited) {
153 hi_colour = GetGlobalColor(
"YELO1");
158 if (m_point.m_bPtIsSelected || m_point.m_bRPIsBeingEdited) {
159 AlphaBlending(dc, r.x + hilitebox.x, r.y + hilitebox.y, hilitebox.width,
160 hilitebox.height, radius, hi_colour, transparency);
163 bool bDrawHL =
false;
165 if (m_point.m_bBlink && (g_blinker_tick & 1)) bDrawHL =
true;
167 if ((!bDrawHL) && (NULL != m_point.m_pbmIcon)) {
168 dc.DrawBitmap(*pbm, r.x - sx2, r.y - sy2,
true);
171 dc.CalcBoundingBox(r.x - sx2, r.y - sy2);
172 dc.CalcBoundingBox(r.x + sx2, r.y + sy2);
175 if (m_point.m_bShowName && m_point.m_MarkName.Length()) {
176 if (m_point.m_pMarkFont) {
177 dc.SetFont(*m_point.m_pMarkFont);
178 dc.SetTextForeground(m_point.m_FontColor);
180 dc.DrawText(m_point.m_MarkName, r.x + m_point.m_NameLocationOffsetX,
181 r.y + m_point.m_NameLocationOffsetY);
186 if (m_point.m_iWaypointRangeRingsNumber &&
187 m_point.m_bShowWaypointRangeRings) {
188 double factor = 1.00;
189 if (m_point.m_iWaypointRangeRingsStepUnits == 1)
192 factor *= m_point.m_fWaypointRangeRingsStep;
196 ll_gc_ll(m_point.m_lat, m_point.m_lon, 0, factor, &tlat, &tlon);
200 sqrt(pow((
double)(r.x - r1.x), 2) + pow((
double)(r.y - r1.y), 2));
201 int pix_radius = (int)lpp;
203 wxPen ppPen1(m_point.m_wxcWaypointRangeRingsColour, 2);
204 wxBrush saveBrush = dc.GetBrush();
205 wxPen savePen = dc.GetPen();
207 dc.SetBrush(wxBrush(m_point.m_wxcWaypointRangeRingsColour,
208 wxBRUSHSTYLE_TRANSPARENT));
210 for (
int i = 1; i <= m_point.m_iWaypointRangeRingsNumber; i++)
211 dc.StrokeCircle(r.x, r.y, i * pix_radius);
213 dc.SetBrush(saveBrush);
218 m_point.CurrentRect_in_DC.x = r.x + hilitebox.x;
219 m_point.CurrentRect_in_DC.y = r.y + hilitebox.y;
220 m_point.CurrentRect_in_DC.width = hilitebox.width;
221 m_point.CurrentRect_in_DC.height = hilitebox.height;
223 if (m_point.m_bBlink)
231 bool use_cached_screen_coords,
bool bVizOverride) {
232 if (!RoutePointGui(m_point).IsVisibleSelectable(canvas, bVizOverride))
return;
235 if (m_point.m_IconName ==
"empty" && !m_point.m_bShowName &&
236 !m_point.m_bPtIsSelected)
239 if (m_point.m_wpBBox.GetValid() &&
241 vp.
rotation == m_point.m_wpBBox_rotation) {
243 LLBBox vpBBox = vp.GetBBox();
244 if (vpBBox.IntersectOut(m_point.m_wpBBox)) {
246 if (m_point.m_bShowWaypointRangeRings &&
247 (m_point.m_iWaypointRangeRingsNumber > 0)) {
248 double factor = 1.00;
249 if (m_point.m_iWaypointRangeRingsStepUnits == 1)
252 double radius = factor * m_point.m_iWaypointRangeRingsNumber *
253 m_point.m_fWaypointRangeRingsStep / 60.;
255 LLBBox radar_box = m_point.m_wpBBox;
256 radar_box.EnLarge(radius * 2);
257 if (vpBBox.IntersectOut(radar_box)) {
267 unsigned char transparency = 150;
269 if (use_cached_screen_coords && m_point.m_pos_on_screen)
270 r.x = m_point.m_screen_pos.m_x, r.y = m_point.m_screen_pos.m_y;
274 if (r.x == INVALID_COORD)
return;
277 if (m_point.m_IconIsDirty) ReLoadIcon();
279 if ((m_point.m_bIsActive) && (m_point.m_IconName !=
"mob"))
280 pbm = pWayPointMan->GetIconBitmap(
"activepoint");
282 pbm = m_point.m_pbmIcon;
285 if (!pbm || !pbm->IsOk())
return;
287 int sx2 = pbm->GetWidth() / 2;
288 int sy2 = pbm->GetHeight() / 2;
291 wxRect r1(r.x - sx2, r.y - sy2, sx2 * 2, sy2 * 2);
294 if (m_point.m_bShowName) {
295 if (!m_point.m_pMarkFont) {
296 wxFont *dFont = FontMgr::Get().
GetFont(_(
"Marks"));
297 int font_size = wxMax(8, dFont->GetPointSize());
301 font_size, dFont->GetFamily(), dFont->GetStyle(), dFont->GetWeight(),
302 false, dFont->GetFaceName());
304 m_point.m_FontColor = FontMgr::Get().
GetFontColor(_(
"Marks"));
305 if (m_point.m_iTextTexture) {
306 glDeleteTextures(1, &m_point.m_iTextTexture);
307 m_point.m_iTextTexture = 0;
310 m_point.CalculateNameExtents();
313 if (m_point.m_pMarkFont) {
314 wxRect r2(r.x + m_point.m_NameLocationOffsetX,
315 r.y + m_point.m_NameLocationOffsetY, m_point.m_NameExtents.x,
316 m_point.m_NameExtents.y);
325 if (!m_point.m_bPreScaled) {
326 hilitebox.x *= g_MarkScaleFactorExp;
327 hilitebox.y *= g_MarkScaleFactorExp;
328 hilitebox.width *= g_MarkScaleFactorExp;
329 hilitebox.height *= g_MarkScaleFactorExp;
334 hilitebox.Inflate(20);
337 hilitebox.Inflate(4);
342 if (!m_point.m_wpBBox.GetValid() ||
344 vp.
rotation != m_point.m_wpBBox_rotation) {
345 double lat1, lon1, lat2, lon2;
347 r.y + hilitebox.y + hilitebox.height, lat1, lon1);
349 r.y + hilitebox.y, lat2, lon2);
352 m_point.m_wpBBox.Set(lat1, lon1, lat2, lon2 + 360);
354 m_point.m_wpBBox.Set(lat1, lon1, lat2, lon2);
357 m_point.m_wpBBox_rotation = vp.
rotation;
366 if (m_point.m_bPtIsSelected) {
368 if (m_point.m_bBlink) {
369 wxPen *pen =
g_pRouteMan->GetActiveRoutePointPen();
370 hi_colour = pen->GetColour();
372 hi_colour = GetGlobalColor(
"YELO1");
375 AlphaBlending(dc, r.x + hilitebox.x, r.y + hilitebox.y, hilitebox.width,
376 hilitebox.height, radius, hi_colour, transparency);
379 bool bDrawHL =
false;
381 if (m_point.m_bBlink && (g_blinker_tick & 1)) bDrawHL =
true;
383 if ((!bDrawHL) && (NULL != m_point.m_pbmIcon)) {
385 unsigned int IconTexture =
386 WayPointmanGui(*pWayPointMan).GetIconTexture(pbm, glw, glh);
388 glBindTexture(GL_TEXTURE_2D, IconTexture);
390 glEnable(GL_TEXTURE_2D);
393 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
394 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
396 int w = r1.width, h = r1.height;
399 if (!m_point.m_bPreScaled) {
400 scale = g_MarkScaleFactorExp;
406 float ws = r1.width * scale;
407 float hs = r1.height * scale;
408 float xs = r.x - ws / 2.;
409 float ys = r.y - hs / 2.;
410 float u = (float)w / glw, v = (
float)h / glh;
431 coords[6] = xs, coords[7] = ys + hs;
433 glChartCanvas::RenderSingleTexture(dc, coords, uv, &vp, 0, 0, 0);
436 glDisable(GL_TEXTURE_2D);
439 if (m_point.m_bShowName && m_point.m_pMarkFont) {
440 int w = m_point.m_NameExtents.x, h = m_point.m_NameExtents.y;
441 if (!m_point.m_iTextTexture && w && h) {
445 dc.SelectObject(tbm);
446 dc.SetBackground(wxBrush(*wxBLACK));
448 dc.SetFont(*m_pMarkFont);
449 dc.SetTextForeground(*wxWHITE);
450 dc.DrawText(m_MarkName, 0, 0);
451 dc.SelectObject(wxNullBitmap);
454 wxImage image = tbm.ConvertToImage();
455 unsigned char *d = image.GetData();
456 unsigned char *e =
new unsigned char[w * h];
458 for (
int p = 0; p < w * h; p++) e[p] = d[3 * p + 0];
462 glGenTextures(1, &m_iTextTexture);
463 glBindTexture(GL_TEXTURE_2D, m_iTextTexture);
465 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
466 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
468 m_iTextTextureWidth = NextPow2(w);
469 m_iTextTextureHeight = NextPow2(h);
470 glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, m_iTextTextureWidth,
471 m_iTextTextureHeight, 0, GL_ALPHA, GL_UNSIGNED_BYTE, NULL);
472 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_ALPHA, GL_UNSIGNED_BYTE,
477 sdc.SetFont(*m_point.m_pMarkFont);
482 temp_dc.SelectObject(bmp);
485 temp_dc.SetBackground(wxBrush(wxColour(0, 0, 0)));
489 temp_dc.SetFont(*m_point.m_pMarkFont);
490 temp_dc.SetTextForeground(wxColour(255, 255, 255));
491 temp_dc.DrawText(m_point.m_MarkName, 0, 0);
492 temp_dc.SelectObject(wxNullBitmap);
496 wxImage image = bmp.ConvertToImage();
498 unsigned char *data =
new unsigned char[w * h * 4];
499 unsigned char *im = image.GetData();
502 unsigned int r = m_point.m_FontColor.Red();
503 unsigned int g = m_point.m_FontColor.Green();
504 unsigned int b = m_point.m_FontColor.Blue();
505 for (
int i = 0; i < h; i++) {
506 for (
int j = 0; j < w; j++) {
507 unsigned int index = ((i * w) + j) * 4;
511 data[index + 3] = im[((i * w) + j) * 3];
516 glGenTextures(1, &m_point.m_iTextTexture);
518 glBindTexture(GL_TEXTURE_2D, m_point.m_iTextTexture);
520 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
521 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
523 m_point.m_iTextTextureWidth = NextPow2(w);
524 m_point.m_iTextTextureHeight = NextPow2(h);
525 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_point.m_iTextTextureWidth,
526 m_point.m_iTextTextureHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE,
528 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE,
533 glEnable(GL_TEXTURE_2D);
535 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
540 if (m_point.m_iTextTexture) {
542 glBindTexture(GL_TEXTURE_2D, m_point.m_iTextTexture);
544 glEnable(GL_TEXTURE_2D);
547 int x = r.x + m_point.m_NameLocationOffsetX,
548 y = r.y + m_point.m_NameLocationOffsetY;
549 float u = (float)w / m_point.m_iTextTextureWidth,
550 v = (
float)h / m_point.m_iTextTextureHeight;
570 coords[6] = x, coords[7] = y + h;
572 glChartCanvas::RenderSingleTexture(dc, coords, uv, &vp, 0, 0, 0);
575 glDisable(GL_TEXTURE_2D);
580 if (m_point.m_iWaypointRangeRingsNumber &&
581 m_point.m_bShowWaypointRangeRings) {
582 double factor = 1.00;
583 if (m_point.m_iWaypointRangeRingsStepUnits == 1)
586 factor *= m_point.m_fWaypointRangeRingsStep;
590 ll_gc_ll(m_point.m_lat, m_point.m_lon, 0, factor, &tlat, &tlon);
594 sqrt(pow((
double)(r.x - r1.x), 2) + pow((
double)(r.y - r1.y), 2));
595 int pix_radius = (int)lpp;
597 wxColor ring_dim_color =
598 user_colors::GetDimColor(m_point.m_wxcWaypointRangeRingsColour);
601 double platform_pen_width =
602 wxRound(wxMax(1.0,
g_Platform->GetDisplayDPmm() / 2));
603 wxPen ppPen1(ring_dim_color, platform_pen_width);
604 wxBrush saveBrush = dc.GetBrush();
605 wxPen savePen = dc.GetPen();
607 dc.SetBrush(wxBrush(ring_dim_color, wxBRUSHSTYLE_TRANSPARENT));
609 for (
int i = 1; i <= m_point.m_iWaypointRangeRingsNumber; i++)
610 dc.StrokeCircle(r.x, r.y, i * pix_radius);
612 dc.SetBrush(saveBrush);
616 if (m_point.m_bDrawDragHandle && m_point.m_dragIcon.IsOk()) {
618 double platform_pen_width = wxRound(
622 wxColor dh_color = GetGlobalColor(
"YELO1");
623 wxPen ppPen1(dh_color, 3 * platform_pen_width);
625 dc.DrawLine(r.x + hilitebox.width / 4, r.y + hilitebox.height / 4,
626 r.x + m_point.m_drag_line_length_man,
627 r.y + m_point.m_drag_line_length_man);
629 dh_color = wxColor(0, 0, 0);
630 wxPen ppPen2(dh_color, platform_pen_width);
632 dc.DrawLine(r.x + hilitebox.width / 4, r.y + hilitebox.height / 4,
633 r.x + m_point.m_drag_line_length_man,
634 r.y + m_point.m_drag_line_length_man);
637 glBindTexture(GL_TEXTURE_2D, m_point.m_dragIconTexture);
639 glEnable(GL_TEXTURE_2D);
642 int x = r.x + m_point.m_drag_icon_offset,
643 y = r.y + m_point.m_drag_icon_offset, w = m_point.m_dragIcon.GetWidth(),
644 h = m_point.m_dragIcon.GetHeight();
648 float ws = w * scale;
649 float hs = h * scale;
650 float xs = x - ws / 2.;
651 float ys = y - hs / 2.;
652 float u = (float)w / m_point.m_dragIconTextureWidth,
653 v = (
float)h / m_point.m_dragIconTextureWidth;
674 coords[6] = xs, coords[7] = ys + hs;
676 glChartCanvas::RenderSingleTexture(dc, coords, uv, &vp, 0, 0, 0);
679 glDisable(GL_TEXTURE_2D);
682 if (m_point.m_bBlink)
686 m_point.CurrentRect_in_DC.x = r.x + hilitebox.x;
687 m_point.CurrentRect_in_DC.y = r.y + hilitebox.y;
688 m_point.CurrentRect_in_DC.width = hilitebox.width;
689 m_point.CurrentRect_in_DC.height = hilitebox.height;
691 if (m_point.m_bBlink)
696void RoutePointGui::CalculateDCRect(wxDC &dc,
ChartCanvas *canvas,
699 dc.ResetBoundingBox();
700 dc.DestroyClippingRegion();
704 odc.SetVP(canvas->GetVP());
706 Draw(odc, canvas, NULL);
709 prect->x = dc.MinX() - 1;
710 prect->y = dc.MinY() - 1;
711 prect->width = dc.MaxX() - dc.MinX() + 2;
712 prect->height = dc.MaxY() - dc.MinY() + 2;
716bool RoutePointGui::IsVisibleSelectable(
ChartCanvas *cc,
bool boverrideViz) {
717 return m_point.IsVisibleSelectable(cc->GetScaleValue(), boverrideViz);
720wxPoint2DDouble RoutePointGui::GetDragHandlePoint(
ChartCanvas *canvas) {
721 if (!m_point.m_bDrawDragHandle)
722 return wxPoint2DDouble(m_point.m_lon, m_point.m_lat);
724 return computeDragHandlePoint(canvas);
727void RoutePointGui::SetPointFromDraghandlePoint(
ChartCanvas *canvas,
double lat,
733 r.y - m_point.m_drag_icon_offset, tlat, tlon);
734 m_point.m_lat = tlat;
735 m_point.m_lon = tlon;
738void RoutePointGui::SetPointFromDraghandlePoint(
ChartCanvas *canvas,
int x,
742 x - m_point.m_drag_icon_offset - m_point.m_draggingOffsetx,
743 y - m_point.m_drag_icon_offset - m_point.m_draggingOffsety, tlat, tlon);
744 m_point.m_lat = tlat;
745 m_point.m_lon = tlon;
748void RoutePointGui::PresetDragOffset(
ChartCanvas *canvas,
int x,
int y) {
752 m_point.m_draggingOffsetx = x - (r.x + m_point.m_drag_icon_offset);
753 m_point.m_draggingOffsety = y - (r.y + m_point.m_drag_icon_offset);
756wxPoint2DDouble RoutePointGui::computeDragHandlePoint(
ChartCanvas *canvas) {
761 r.y + m_point.m_drag_icon_offset, lat, lon);
764 m_point.m_dragHandleLat = lat;
765 m_point.m_dragHandleLon = lon;
767 return wxPoint2DDouble(lon, lat);
770void RoutePointGui::ShowScaleWarningMessage(
ChartCanvas *canvas) {
771 wxString strA = _(
"The ScaMin value for new waypoints is set to");
772 wxString strB = _(
"but current chartscale is");
774 _(
"Therefore the new waypoint will not be visible at this zoom level.");
776 wxString::Format(
"%s %li,\n %s %.0f.\n%s", strA, m_point.GetScaMin(),
777 strB, canvas->GetScaleValue(), strC);
778 OCPNMessageBox(canvas, MessStr);
781void RoutePointGui::EnableDragHandle(
bool bEnable) {
782 m_point.m_bDrawDragHandle = bEnable;
784 if (!m_point.m_dragIcon.IsOk()) {
787 int bm_size =
g_Platform->GetDisplayDPmm() * 9;
790 wxString UserIconPath =
g_Platform->GetSharedDataDir() +
"uidata" +
791 wxFileName::GetPathSeparator();
793 m_point.m_dragIcon =
LoadSVG(UserIconPath +
"DragHandle.svg", bm_size,
794 bm_size, m_point.m_pbmIcon);
799 if (m_point.m_dragIconTexture == 0) {
800 glGenTextures(1, &m_point.m_dragIconTexture);
801 glBindTexture(GL_TEXTURE_2D, m_point.m_dragIconTexture);
803 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
804 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
805 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
807 wxImage image = m_point.m_dragIcon.ConvertToImage();
808 int w = image.GetWidth(), h = image.GetHeight();
810 m_point.m_dragIconTextureWidth = NextPow2(w);
811 m_point.m_dragIconTextureHeight = NextPow2(h);
813 unsigned char *d = image.GetData();
814 unsigned char *a = image.GetAlpha();
816 unsigned char mr, mg, mb;
817 image.GetOrFindMaskColour(&mr, &mg, &mb);
819 unsigned char *e =
new unsigned char[4 * w * h];
821 for (
int y = 0; y < h; y++)
822 for (
int x = 0; x < w; x++) {
823 unsigned char r, g, b;
824 int off = (y * image.GetWidth() + x);
833 a ? a[off] : ((r == mr) && (g == mg) && (b == mb) ? 0 : 255);
837 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_point.m_dragIconTextureWidth,
838 m_point.m_dragIconTextureHeight, 0, GL_RGBA,
839 GL_UNSIGNED_BYTE, NULL);
840 glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE,
848 if (m_point.m_dragIcon.IsOk()) {
849 m_point.m_drag_line_length_man = bm_size;
850 m_point.m_drag_icon_offset = bm_size;
852 m_point.m_drag_line_length_man = 64;
853 m_point.m_drag_icon_offset = 64;
859void RoutePointGui::ReLoadIcon() {
860 if (!pWayPointMan)
return;
861 bool icon_exists = pWayPointMan->DoesIconExist(m_point.m_IconName);
863 wxString iconUse = m_point.m_IconName;
867 wxString tentative_icon = m_point.m_IconName.Lower();
868 if (pWayPointMan->DoesIconExist(tentative_icon)) {
870 m_point.m_IconName = tentative_icon;
871 iconUse = m_point.m_IconName;
876 if (!pWayPointMan->DoesIconExist(
"tempsub")) {
879 wxBitmap bmp = style->GetIcon(
"circle");
881 wxImage image = bmp.ConvertToImage();
882 WayPointmanGui(*pWayPointMan)
883 .ProcessIcon(image,
"tempsub",
"tempsub");
891 m_point.m_pbmIcon = pWayPointMan->GetIconBitmap(iconUse);
892 m_point.m_bPreScaled = pWayPointMan->GetIconPrescaled(iconUse);
895 m_point.m_wpBBox_view_scale_ppm = -1;
897 m_point.m_iTextTexture = 0;
900 m_point.m_IconScaleFactor = -1;
901 m_point.m_pMarkFont = 0;
902 m_point.m_IconIsDirty =
false;
905bool RoutePointGui::SendToGPS(
const wxString &com_name,
SendToGpsDlg *dialog) {
906 N0183DlgCtx dlg_ctx = GetDialogCtx(dialog);
907 ::wxBeginBusyCursor();
908 int result = SendWaypointToGPS_N0183(&m_point, com_name, *g_pMUX, dlg_ctx);
913 msg = _(
"Waypoint(s) Transmitted.");
917 msg = _(
"Error on Waypoint Upload. Garmin GPS not connected");
920 msg = _(
"Error on Waypoint Upload. GPS driver not available");
924 msg = _(
"Error on Waypoint Upload. Please check logfiles...");
929 OCPNMessageBox(NULL, msg, _(
"OpenCPN Info"), wxOK | wxICON_INFORMATION);
931 return (result == 0);
934int RoutePointGui::GetIconImageIndex() {
935 if (m_point.IsShared()) {
937 wxArrayPtrVoid *proute_array =
941 bool brp_viz =
false;
943 for (
unsigned int ir = 0; ir < proute_array->GetCount(); ir++) {
944 Route *pr = (Route *)proute_array->Item(ir);
945 if (pr->IsVisible()) {
956 if (m_point.IsVisible())
957 return (pWayPointMan->GetIconImageListIndex(GetIconBitmap()));
964 if (m_point.IsVisible())
965 return (pWayPointMan->GetIconImageListIndex(GetIconBitmap()));
ChartCanvas - Main chart display and interaction component.
bool GetCanvasPointPix(double rlat, double rlon, wxPoint *r)
Convert latitude/longitude to canvas pixel coordinates (physical pixels) rounded to nearest integer.
void GetCanvasPixPoint(double x, double y, double &lat, double &lon)
Convert canvas pixel coordinates (physical pixels) to latitude/longitude.
wxFont * FindOrCreateFont(int point_size, wxFontFamily family, wxFontStyle style, wxFontWeight weight, bool underline=false, const wxString &facename=wxEmptyString, wxFontEncoding encoding=wxFONTENCODING_DEFAULT)
Creates or finds a matching font in the font cache.
wxColour GetFontColor(const wxString &TextElement) const
Gets the text color for a UI element.
wxFont * GetFont(const wxString &TextElement, int requested_font_size=0)
Get a font object for a UI element.
wxArrayPtrVoid * GetRouteArrayContaining(RoutePoint *pWP)
Find all routes that contain the given waypoint.
Dialog for sending routes/waypoints to a GPS device.
ViewPort - Core geographic projection and coordinate transformation engine.
double view_scale_ppm
Requested view scale in physical pixels per meter (ppm), before applying projections.
double rotation
Rotation angle of the viewport in radians.
int GetXIconImageListIndex(const wxBitmap *pbm) const
index of "X-ed out" icon in the image list
int GetFIconImageListIndex(const wxBitmap *pbm) const
index of "fixed viz" icon in the image list
Device context class that can use either wxDC or OpenGL for drawing.
Global color handling by name.
NMEA Data Multiplexer Object.
#define ERR_GPS_DRIVER_NOT_AVAILAIBLE
GPS driver not available.
#define ERR_GARMIN_SEND_MESSAGE
Failed to send message to Garmin device.
#define ERR_GARMIN_INITIALIZE
Failed to initialize Garmin device.
Extern C linked utilities.
OpenGL chart rendering canvas.
Miscellaneous globals primarely used by gui layer, not persisted in configuration file.
Multiplexer class and helpers.
Wrapper creating a N0183DlgCtx based on a SendToGpsDlg instance.
PlugIn Object Definition/API.
wxWindow * GetOCPNCanvasWindow()
Gets OpenCPN's main canvas window.
double OCPN_GetWinDIPScaleFactor()
Gets Windows-specific DPI scaling factor.
wxRect g_blink_rect
Global instance.
Purpose: Track and Trackpoint drawing stuff.
Routeman * g_pRouteMan
Global instance.
ocpnStyle::StyleManager * g_StyleManager
Global instance.
wxBitmap LoadSVG(const wxString filename, const unsigned int width, const unsigned int height, wxBitmap *default_bitmap, bool use_cache)
Load SVG file and return it's bitmap representation of requested size In case file can't be loaded an...
Geographic projection and coordinate transformations.
WaypointMan drawing stuff.