Beispiel #1
0
void doRedoAppendWaypoint( UndoAction* action )
{
    ODPoint* point = (ODPoint*) action->before[0];
    ODPath* path = (ODPath*) action->after[0];

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

    ODPoint* prevpoint = ODPath->GetLastPoint();

    path->AddPoint( point );
    pSelect->AddSelectablePathSegment( prevpoint->m_lat, prevpoint->m_lon,
            point->m_lat, point->m_lon, prevpoint, point, path );

    if( g_pPathManagerDialog && g_pPathManagerDialog->IsShown() ) g_pPathManagerDialog->UpdateODPointsListCtrl();

    if( gFrame->nPath_State > 1 ) {
        gFrame->nPath_State++;
        cc1->m_prev_pMousePoint = path->GetLastPoint();
        cc1->m_prev_rlat = cc1->m_prev_pMousePoint->m_lat;
        cc1->m_prev_rlon = cc1->m_prev_pMousePoint->m_lon;
        path->m_lastMousePointIndex = path->GetnPoints();
    }
}
Beispiel #2
0
void doUndoAppenODPoint( UndoAction* action )
{
    ODPoint* point = (ODPoint*) action->before[0];
    ODPath* path = (ODPath*) action->after[0];

    bool noPathLeftToRedo = false;
    if( (path->GetnPoints() == 2) && (gFrame->nPath_State == 0) )
        noPathLeftToRedo = true;

    m_pPath->RemovePointFromPath( point, path );

    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();
    }
}
Beispiel #3
0
void PointMan::DestroyODPoint( ODPoint *pRp, bool b_update_changeset )
{
    if( ! b_update_changeset )
        g_pODConfig->m_bSkipChangeSetUpdate = true;             // turn OFF change-set updating if requested
        
    if( pRp ) {
        // Get a list of all boundaries containing this point
        // and remove the point from them all
        wxArrayPtrVoid *ppath_array = g_pPathMan->GetPathArrayContaining( pRp );
        if( ppath_array ) {
            for( unsigned int ib = 0; ib < ppath_array->GetCount(); ib++ ) {
                ODPath *pb = (ODPath *) ppath_array->Item( ib );

                pb->RemovePoint( pRp );

            }

            //    Scrub the paths, looking for one-point routes
            for( unsigned int ib = 0; ib < ppath_array->GetCount(); ib++ ) {
                ODPath *pb = (ODPath *) ppath_array->Item( ib );
                if( pb->GetnPoints() < 2 ) {
                    bool prev_bskip = g_pODConfig->m_bSkipChangeSetUpdate;
                    g_pODConfig->m_bSkipChangeSetUpdate = true;
                    g_pODConfig->DeleteConfigPath( pb );
                    g_pPathMan->DeletePath( pb );
                    g_pODConfig->m_bSkipChangeSetUpdate = prev_bskip;
                }
            }

            delete ppath_array;
        }

        // Now it is safe to delete the point
        g_pODConfig->DeleteODPoint( pRp );
        g_pODConfig->m_bSkipChangeSetUpdate = false;
        
        g_pODSelect->DeleteSelectableODPoint( pRp );


        RemoveODPoint( pRp);

    }
}