Esempio n. 1
0
void doRedoAppendWaypoint( UndoAction* action )
{
    RoutePoint* point = (RoutePoint*) action->before[0];
    Route* route = (Route*) action->after[0];

    if( action->beforeType[0] == Undo_IsOrphanded ) {
        pConfig->AddNewWayPoint( point, -1 );
        pSelect->AddSelectableRoutePoint( point->m_lat, point->m_lon, point );
    }

    RoutePoint* prevpoint = route->GetLastPoint();

    route->AddPoint( point );
    pSelect->AddSelectableRouteSegment( prevpoint->m_lat, prevpoint->m_lon,
            point->m_lat, point->m_lon, prevpoint, point, route );

    if( pRouteManagerDialog && pRouteManagerDialog->IsShown() ) pRouteManagerDialog->UpdateWptListCtrl();

    if( gFrame->nRoute_State > 1 ) {
        gFrame->nRoute_State++;
        cc1->m_prev_pMousePoint = route->GetLastPoint();
        cc1->m_prev_rlat = cc1->m_prev_pMousePoint->m_lat;
        cc1->m_prev_rlon = cc1->m_prev_pMousePoint->m_lon;
        route->m_lastMousePointIndex = route->GetnPoints();
    }
}
Esempio n. 2
0
void doUndoAppendWaypoint( UndoAction* action )
{
    RoutePoint* point = (RoutePoint*) action->before[0];
    Route* route = (Route*) action->after[0];

    bool noRouteLeftToRedo = false;
    if( (route->GetnPoints() == 2) && (gFrame->nRoute_State == 0) )
        noRouteLeftToRedo = true;

    cc1->RemovePointFromRoute( point, route );

    if( action->beforeType[0] == Undo_IsOrphanded ) {
        pConfig->DeleteWayPoint( point );
        pSelect->DeleteSelectablePoint( point, SELTYPE_ROUTEPOINT );
        if( NULL != pWayPointMan ) pWayPointMan->RemoveRoutePoint( point );
    }

    if( noRouteLeftToRedo ) {
        cc1->undo->InvalidateRedo();
    }

    if( pRouteManagerDialog && pRouteManagerDialog->IsShown() ) pRouteManagerDialog->UpdateWptListCtrl();

    if( gFrame->nRoute_State > 1 ) {
        gFrame->nRoute_State--;
        cc1->m_prev_pMousePoint = route->GetLastPoint();
        cc1->m_prev_rlat = cc1->m_prev_pMousePoint->m_lat;
        cc1->m_prev_rlon = cc1->m_prev_pMousePoint->m_lon;
        route->m_lastMousePointIndex = route->GetnPoints();
    }
}
Esempio n. 3
0
bool TrackPropDlg::IsThisTrackExtendable()
{
    m_pExtendRoute = NULL;
    m_pExtendPoint = NULL;
    if( m_pRoute == g_pActiveTrack || m_pRoute->m_bIsInLayer ) return false;

    RoutePoint *pLastPoint = m_pRoute->GetPoint( 1 );
    if( !pLastPoint->GetCreateTime().IsValid() ) return false;

    wxRouteListNode *route_node = pRouteList->GetFirst();
    while( route_node ) {
        Route *proute = route_node->GetData();
        if( proute->m_bIsTrack && proute->IsVisible() && ( proute->m_GUID != m_pRoute->m_GUID ) ) {
            RoutePoint *track_node = proute->GetLastPoint();
            if( track_node->GetCreateTime().IsValid() ) {
                if( track_node->GetCreateTime() <= pLastPoint->GetCreateTime() )
                    if( !m_pExtendPoint || track_node->GetCreateTime() > m_pExtendPoint->GetCreateTime() ) {
                    m_pExtendPoint = track_node;
                    m_pExtendRoute = proute;
                }
            }
        }
        route_node = route_node->GetNext();                         // next route
    }
    if( m_pExtendRoute ) return ( !m_pExtendRoute->m_bIsInLayer );
    else
        return false;
}