void doUndoMoveODPoint( UndoAction* action ) { double lat, lon; ODPoint* currentPoint = (ODPoint*) action->after[0]; wxRealPoint* lastPoint = (wxRealPoint*) action->before[0]; lat = currentPoint->m_lat; lon = currentPoint->m_lon; currentPoint->m_lat = lastPoint->y; currentPoint->m_lon = lastPoint->x; lastPoint->y = lat; lastPoint->x = lon; SelectItem* selectable = (SelectItem*) action->selectable[0]; selectable->m_slat = currentPoint->m_lat; selectable->m_slon = currentPoint->m_lon; if( ( NULL != pMarkPropDialog ) && ( pMarkPropDialog->IsShown() ) ){ if( currentPoint == pMarkPropDialog->GetRoutePoint() ) pMarkPropDialog->UpdateProperties(true); } wxArrayPtrVoid* pathArray = g_pPathMan->GetPathArrayContaining( currentPoint ); if( pathArray ) { for( unsigned int ir = 0; ir < pathArray->GetCount(); ir++ ) { ODPath *pp = (ODPath *) pathArray->Item( ir ); pp->FinalizeForRendering(); pp->UpdateSegmentDistances(); g_pODConfig->UpdatePath( pp ); } delete pathArray; } }
void GZ::UpdateGZ( ODPoint *pGZPoint, bool bUpdateSelectablePath ) { if(pGZPoint == m_pODPointList->GetFirst()->GetData()) { DistanceBearingMercator_Plugin( pGZPoint->m_lat, pGZPoint->m_lon, g_pfFix.Lat, g_pfFix.Lon, &m_dFirstLineDirection, &m_dFirstDistance ); if(m_bRotateWithBoat) { switch(m_iMaintainWith) { case ID_MAINTAIN_WITH_HEADING: m_dFirstLineDirection -= g_pfFix.Hdt; break; case ID_MAINTAIN_WITH_COG: m_dFirstLineDirection -= g_pfFix.Cog; break; } } } else { DistanceBearingMercator_Plugin( pGZPoint->m_lat, pGZPoint->m_lon, g_pfFix.Lat, g_pfFix.Lon, &m_dSecondLineDirection, &m_dSecondDistance ); if(m_bRotateWithBoat) { switch(m_iMaintainWith) { case ID_MAINTAIN_WITH_HEADING: m_dSecondLineDirection -= g_pfFix.Hdt; break; case ID_MAINTAIN_WITH_COG: m_dSecondLineDirection -= g_pfFix.Cog; break; } } } UpdateGZ( bUpdateSelectablePath ); bool prev_bskip = g_pODConfig->m_bSkipChangeSetUpdate; g_pODConfig->m_bSkipChangeSetUpdate = false; g_pODConfig->UpdatePath( this ); g_pODConfig->m_bSkipChangeSetUpdate = prev_bskip; for( unsigned int ip = 0; ip < m_pODPointList->GetCount(); ip++ ) { ODPath *pp = (ODPath *) m_pODPointList->Item( ip ); if( g_pPathMan->IsPathValid(pp) ) { pp->FinalizeForRendering(); pp->m_bIsBeingEdited = false; g_pODConfig->UpdatePath( pp ); pp->SetHiLite( 0 ); } } // Update the PathProperties Dialog, if currently shown if( ( NULL != g_pGZPropDialog ) && ( g_pGZPropDialog->IsShown() ) ) { for( unsigned int ip = 0; ip < m_pODPointList->GetCount(); ip++ ) { ODPath *pp = (ODPath *) m_pODPointList->Item( ip ); if( g_pPathMan->IsPathValid(pp) ) { g_pGZPropDialog->SetPathAndUpdate( pp, true ); } } } }
void EBL::UpdateEBL( void ) { g_pODSelect->DeleteAllSelectablePathSegments( this ); g_pODSelect->DeleteAllSelectableODPoints( this ); g_pODSelect->AddAllSelectablePathSegments( this ); g_pODSelect->AddAllSelectableODPoints( this ); FinalizeForRendering(); UpdateSegmentDistances(); bool prev_bskip = g_pODConfig->m_bSkipChangeSetUpdate; g_pODConfig->m_bSkipChangeSetUpdate = false; if(m_iPersistenceType == ID_EBL_PERSISTENT || m_iPersistenceType == ID_EBL_PERSISTENT_CRASH) g_pODConfig->UpdatePath( this ); g_pODConfig->m_bSkipChangeSetUpdate = prev_bskip; for( unsigned int ip = 0; ip < m_pODPointList->GetCount(); ip++ ) { ODPath *pp = (ODPath *) m_pODPointList->Item( ip ); if( g_pPathMan->IsPathValid(pp) ) { pp->FinalizeForRendering(); pp->UpdateSegmentDistances(); pp->m_bIsBeingEdited = false; g_pODConfig->UpdatePath( pp ); pp->SetHiLite( 0 ); } } // Update the PathProperties Dialog, if currently shown if( ( NULL != g_pEBLPropDialog ) && ( g_pEBLPropDialog->IsShown() ) ) { if( m_pODPointList ) { for( unsigned int ip = 0; ip < m_pODPointList->GetCount(); ip++ ) { ODPath *pp = (ODPath *) m_pODPointList->Item( ip ); if( g_pPathMan->IsPathValid(pp) ) { g_pEBLPropDialog->SetPathAndUpdate( pp, true ); } } } } }