void EBL::MoveEndPoint( bool bUpdateEBL ) { ODPoint *pEndPoint = m_pODPointList->GetLast()->GetData(); ODPoint *pStartPoint = m_pODPointList->GetFirst()->GetData(); if(m_dLength == 0.) m_dLength = pEndPoint->m_seg_len; if(m_bRotateWithBoat) { MaintainWith(); } else { if(!m_bFixedEndPosition) PositionBearingDistanceMercator_Plugin(pStartPoint->m_lat, pStartPoint->m_lon, m_dEBLAngle, m_dLength, &pEndPoint->m_lat, &pEndPoint->m_lon); } if(m_bVRM) pStartPoint->SetODPointRangeRingsStep( m_dLength / pStartPoint->GetODPointRangeRingsNumber() ); if(g_pEBLPropDialog && g_pEBLPropDialog->IsShown()) g_pEBLPropDialog->UpdateProperties(); if(bUpdateEBL) { bool l_bSaveUpdatesState = m_bSaveUpdates; m_bSaveUpdates = true; UpdateEBL(); m_bSaveUpdates = l_bSaveUpdatesState; } else UpdateEBL(); }
void EBL::CentreOnBoat( bool bMoveEndPoint ) { ODPoint *pStartPoint = m_pODPointList->GetFirst()->GetData(); ODPoint *pEndPoint = m_pODPointList->GetLast()->GetData(); pStartPoint->m_lat = g_pfFix.Lat; pStartPoint->m_lon = g_pfFix.Lon; if(m_dLength == 0.) m_dLength = pEndPoint->m_seg_len; if(bMoveEndPoint && !m_bEndPointMoving) { if(m_bRotateWithBoat) { MaintainWith(); } else { if(!m_bFixedEndPosition) { PositionBearingDistanceMercator_Plugin(pStartPoint->m_lat, pStartPoint->m_lon, m_dEBLAngle, m_dLength, &pEndPoint->m_lat, &pEndPoint->m_lon); } else { double brg; double hdg = 0.; DistanceBearingMercator_Plugin(pEndPoint->m_lat, pEndPoint->m_lon, pStartPoint->m_lat, pStartPoint->m_lon, &brg, &m_dLength); switch(m_iMaintainWith) { case ID_EBL_MAINTAIN_WITH_HEADING: if(!isnan(g_pfFix.Hdt)) hdg = g_pfFix.Hdt; break; case ID_EBL_MAINTAIN_WITH_COG: if(!isnan(g_pfFix.Cog)) hdg = g_pfFix.Cog; break; } if(hdg > brg) m_dEBLAngle = brg + 360 - hdg; else if(hdg < brg) m_dEBLAngle = hdg - brg; else m_dEBLAngle = 0; } } } else { DistanceBearingMercator_Plugin(pEndPoint->m_lat, pEndPoint->m_lon, pStartPoint->m_lat, pStartPoint->m_lon, &m_dEBLAngle, &m_dLength); m_dBoatHeading = g_pfFix.Hdt; m_dBoatCOG = g_pfFix.Cog; } pStartPoint->m_ODPointName = _("Boat"); m_bCentreOnBoat = true; UpdateEBL(); if(m_bVRM) { ODPoint *pStartPoint = m_pODPointList->GetFirst()->GetData(); pStartPoint->SetODPointRangeRingsStep( m_dLength / pStartPoint->GetODPointRangeRingsNumber() ); } bool l_bRequestRefresh = true; if(g_pEBLPropDialog && g_pEBLPropDialog->IsShown()) l_bRequestRefresh = g_pEBLPropDialog->UpdateProperties(); m_bSaveUpdates = false; if(l_bRequestRefresh) RequestRefresh( g_ocpn_draw_pi->m_parent_window ); return; }
void EBL::CentreOnLatLon( double lat, double lon ) { ODPoint *pStartPoint = m_pODPointList->GetFirst()->GetData(); pStartPoint->m_lat = lat; pStartPoint->m_lon = lon; pStartPoint->m_ODPointName = _("Start"); if(pStartPoint->GetIconName() != wxEmptyString) { pStartPoint->SetIconName( g_sEBLStartIconName ); pStartPoint->ReLoadIcon(); } m_bCentreOnBoat = false; m_bSaveUpdates = true; UpdateEBL(); if(g_pEBLPropDialog && g_pEBLPropDialog->IsShown()) g_pEBLPropDialog->UpdateProperties(); RequestRefresh( g_ocpn_draw_pi->m_parent_window ); return; }
void EBL::CentreOnBoat( void ) { ODPoint *pStartPoint = m_pODPointList->GetFirst()->GetData(); pStartPoint->m_lat = g_pfFix.Lat; pStartPoint->m_lon = g_pfFix.Lon; pStartPoint->m_ODPointName = _("Boat"); m_bCentreOnBoat = true; UpdateEBL(); if(m_bVRM) { ODPoint *pStartPoint = m_pODPointList->GetFirst()->GetData(); ODPoint *pEndPoint = m_pODPointList->GetLast()->GetData(); pStartPoint->SetODPointRangeRingsStep( pEndPoint->m_seg_len / pStartPoint->GetODPointRangeRingsNumber() ); } if(g_pEBLPropDialog && g_pEBLPropDialog->IsShown()) g_pEBLPropDialog->UpdateProperties(); m_bSaveUpdates = false; RequestRefresh( g_ocpn_draw_pi->m_parent_window ); return; }
void EBL::CentreOnLatLon( double lat, double lon ) { ODPoint *pStartPoint = m_pODPointList->GetFirst()->GetData(); ODPoint *pEndPoint = m_pODPointList->GetLast()->GetData(); pStartPoint->m_lat = lat; pStartPoint->m_lon = lon; DistanceBearingMercator_Plugin(pEndPoint->m_lat, pEndPoint->m_lon, pStartPoint->m_lat, pStartPoint->m_lon, &m_dEBLAngle, &m_dLength); m_bRotateWithBoat = false; m_bCentreOnBoat = false; pStartPoint->m_ODPointName = _("Start"); if(pStartPoint->GetIconName() != wxEmptyString) { pStartPoint->SetIconName( g_sEBLStartIconName ); pStartPoint->ReLoadIcon(); } m_bCentreOnBoat = false; m_bSaveUpdates = true; UpdateEBL(); if(g_pEBLPropDialog && g_pEBLPropDialog->IsShown()) g_pEBLPropDialog->UpdateProperties(); RequestRefresh( g_ocpn_draw_pi->m_parent_window ); return; }