Skip to content

Commit

Permalink
Correct active track rendering logic at large scale zoom.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Register committed Aug 23, 2015
1 parent 4bfa60f commit eb157b9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 7 additions & 6 deletions src/Route.cpp
Expand Up @@ -481,6 +481,11 @@ void Route::DrawGLLines( ViewPort &VP, ocpnDC *dc )
FromSegNo = ToSegNo;
r1valid = false;
} else {

wxPoint2DDouble r2;
cc1->GetDoubleCanvasPointPix( prp2->m_lat, prp2->m_lon, &r2);
lastpoint = r2; // For active track segment to ownship

// Handle offscreen points
LLBBox bbox = VP.GetBBox();

Expand All @@ -507,9 +512,6 @@ void Route::DrawGLLines( ViewPort &VP, ocpnDC *dc )
if(!r1valid)
cc1->GetDoubleCanvasPointPix( prp1->m_lat, prp1->m_lon, &r1);

wxPoint2DDouble r2;
cc1->GetDoubleCanvasPointPix( prp2->m_lat, prp2->m_lon, &r2);

// In the cases where one point is on, and one off
// we must decide which way to go in longitude

Expand Down Expand Up @@ -550,12 +552,11 @@ void Route::DrawGLLines( ViewPort &VP, ocpnDC *dc )

r1 = r2;
r1valid = true;
lastpoint = r1;
}
}

// Draw tentative segment from last point to Ownship, if running.
if( lastpoint.m_y && IsTrack() ) {
if( IsTrack() ) {
/* Active tracks */
if( dynamic_cast<Track *>(this)->IsRunning() ){
wxPoint2DDouble rs;
Expand All @@ -565,7 +566,7 @@ void Route::DrawGLLines( ViewPort &VP, ocpnDC *dc )
else {
glVertex2f(lastpoint.m_x, lastpoint.m_y);
glVertex2f(rs.m_x, rs.m_y);
}
}
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/glChartCanvas.cpp
Expand Up @@ -1608,8 +1608,10 @@ void glChartCanvas::DrawDynamicRoutesAndWaypoints( ViewPort &vp, OCPNRegion &reg

if( pRouteDraw->IsTrack() ) {
/* Active tracks */
if( dynamic_cast<Track *>(pRouteDraw)->IsRunning() )
drawit++;
if( dynamic_cast<Track *>(pRouteDraw)->IsRunning() ){
pRouteDraw->DrawGL( vp, region );
continue;
}
}

/* Routes being edited */
Expand Down

0 comments on commit eb157b9

Please sign in to comment.