void Route::DrawGLRouteLines( ViewPort &vp ) { #ifdef ocpnUSE_GL // Hiliting first // Being special case to draw something for a 1 point route.... ocpnDC dc; if(m_hiliteWidth) { wxColour y = GetGlobalColor( _T ( "YELO1" ) ); wxColour hilt( y.Red(), y.Green(), y.Blue(), 128 ); wxPen HiPen( hilt, m_hiliteWidth, wxPENSTYLE_SOLID ); ocpnDC dc; dc.SetPen( HiPen ); DrawGLLines(vp, &dc); } /* determine color and width */ wxColour col; int width = g_pRouteMan->GetRoutePen()->GetWidth(); //g_route_line_width; if( m_width != wxPENSTYLE_INVALID ) width = m_width; if( m_bRtIsActive ) { col = g_pRouteMan->GetActiveRoutePen()->GetColour(); } else if( m_bRtIsSelected ) { col = g_pRouteMan->GetSelectedRoutePen()->GetColour(); } else { if( m_Colour == wxEmptyString ) { col = g_pRouteMan->GetRoutePen()->GetColour(); } else { for( unsigned int i = 0; i < sizeof( ::GpxxColorNames ) / sizeof(wxString); i++ ) { if( m_Colour == ::GpxxColorNames[i] ) { col = ::GpxxColors[i]; break; } } } } wxPenStyle style = wxPENSTYLE_SOLID; if( m_style != wxPENSTYLE_INVALID ) style = m_style; dc.SetPen( *wxThePenList->FindOrCreatePen( col, width, style ) ); glColor3ub(col.Red(), col.Green(), col.Blue()); glLineWidth( wxMax( g_GLMinSymbolLineWidth, width ) ); dc.SetGLStipple(); DrawGLLines(vp, NULL); glDisable (GL_LINE_STIPPLE); /* direction arrows.. could probably be further optimized for opengl */ wxRoutePointListNode *node = pRoutePointList->GetFirst(); wxPoint rpt1, rpt2; while(node) { RoutePoint *prp = node->GetData(); cc1->GetCanvasPointPix( prp->m_lat, prp->m_lon, &rpt2 ); if(node != pRoutePointList->GetFirst()) RenderSegmentArrowsGL( rpt1.x, rpt1.y, rpt2.x, rpt2.y, vp ); rpt1 = rpt2; node = node->GetNext(); } #endif }
void Route::DrawGL( ViewPort &VP, OCPNRegion ®ion ) { #ifdef ocpnUSE_GL if( m_nPoints < 1 || !m_bVisible ) return; if(m_hiliteWidth) { wxColour y = GetGlobalColor( _T ( "YELO1" ) ); wxColour hilt( y.Red(), y.Green(), y.Blue(), 128 ); wxPen HiPen( hilt, m_hiliteWidth, wxPENSTYLE_SOLID ); ocpnDC dc; dc.SetPen( HiPen ); DrawGLLines(VP, &dc); } /* determine color and width */ wxColour col; int width = g_pRouteMan->GetRoutePen()->GetWidth(); //g_route_line_width; if( m_width != wxPENSTYLE_INVALID ) width = m_width; if(m_bIsTrack) width = g_pRouteMan->GetTrackPen()->GetWidth(); if( m_bRtIsActive ) { col = g_pRouteMan->GetActiveRoutePen()->GetColour(); } else if( m_bRtIsSelected ) { col = g_pRouteMan->GetSelectedRoutePen()->GetColour(); } else { if( m_Colour == wxEmptyString ) { col = g_pRouteMan->GetRoutePen()->GetColour(); // For tracks, establish colour based on first icon name if(m_bIsTrack){ wxRoutePointListNode *node = pRoutePointList->GetFirst(); RoutePoint *prp = node->GetData(); if( prp->GetIconName().StartsWith( _T("xmred") ) ) col = GetGlobalColor( _T ( "URED" ) ); else if( prp->GetIconName().StartsWith( _T("xmblue") ) ) col = GetGlobalColor( _T ( "BLUE3" ) ); else if( prp->GetIconName().StartsWith( _T("xmgreen") ) ) col = GetGlobalColor( _T ( "UGREN" ) ); else col = GetGlobalColor( _T ( "CHMGD" ) ); } } else { for( unsigned int i = 0; i < sizeof( ::GpxxColorNames ) / sizeof(wxString); i++ ) { if( m_Colour == ::GpxxColorNames[i] ) { col = ::GpxxColors[i]; break; } } } } glColor3ub(col.Red(), col.Green(), col.Blue()); glLineWidth(wxMax( g_GLMinSymbolLineWidth, width )); #ifndef ocpnUSE_GLES // linestipple is emulated poorly if( m_style != wxPENSTYLE_INVALID ) glEnable( GL_LINE_STIPPLE ); switch( m_style ) { case wxDOT: glLineStipple( 1, 0x3333 ); break; case wxLONG_DASH: glLineStipple( 1, 0xFFF8 ); break; case wxSHORT_DASH: glLineStipple( 1, 0x3F3F ); break; case wxDOT_DASH: glLineStipple( 1, 0x8FF1 ); break; default: break; } #endif DrawGLLines(VP, NULL); glDisable (GL_LINE_STIPPLE); /* direction arrows.. could probably be further optimized for opengl */ if( !m_bIsTrack ) { wxRoutePointListNode *node = pRoutePointList->GetFirst(); wxPoint2DDouble rpt1, rpt2; while(node) { RoutePoint *prp = node->GetData(); // cc1->GetDoubleCanvasPointPix( prp->m_lat, prp->m_lon, &rpt2 ); rpt2 = prp->m_screen_pos; if(node != pRoutePointList->GetFirst() && prp->m_pos_on_screen) RenderSegmentArrowsGL( rpt1.m_x, rpt1.m_y, rpt2.m_x, rpt2.m_y, cc1->GetVP() ); rpt1 = rpt2; node = node->GetNext(); } } /* Route points */ for(wxRoutePointListNode *node = pRoutePointList->GetFirst(); node; node = node->GetNext()) { RoutePoint *prp = node->GetData(); if ( m_bVisible || prp->m_bKeepXRoute ) prp->DrawGL( VP, region, true ); } #endif }