From: Matthew G. <mat...@us...> - 2007-03-04 03:12:58
|
Update of /cvsroot/jsbsimcommander/src/gui In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv31330/src/gui Modified Files: shape.cpp shape.h Log Message: Replace 'first' with 'head', replace 'last' with 'tail' to correct its meaning in member function 'MyEvtHandler::OnEndDragLeft' Index: shape.cpp =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/shape.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shape.cpp 4 Mar 2007 03:03:31 -0000 1.14 --- shape.cpp 4 Mar 2007 03:12:54 -0000 1.15 *************** *** 263,276 **** } ! void MyEvtHandler::FindOneSegment(wxNode* &first, unsigned int &j, wxNode* last) { // shift the dup control points wxRealPoint* p1; ! wxRealPoint* p2 = (wxRealPoint*)last->GetData(); ! while (first && (p1 = (wxRealPoint*)first->GetData()) && fabs(p1->x - p2->x) < 1e-4 && fabs(p1->y - p2->y) < 1e-4 ) { ! first = first->GetNext(); ++j; } --- 263,276 ---- } ! void MyEvtHandler::FindOneSegment(wxNode* &head, unsigned int &j, wxNode* tail) { // shift the dup control points wxRealPoint* p1; ! wxRealPoint* p2 = (wxRealPoint*)tail->GetData(); ! while (head && (p1 = (wxRealPoint*)head->GetData()) && fabs(p1->x - p2->x) < 1e-4 && fabs(p1->y - p2->y) < 1e-4 ) { ! head = head->GetNext(); ++j; } *************** *** 278,289 **** // shift the lines in the same slope double dx,dy; ! if (first) { dy = p1->y - p2->y; dx = p1->x - p2->x; ! wxNode * prio = first->GetNext(); while (prio) { ! p1 = (wxRealPoint*)first->GetData(); p2 = (wxRealPoint*)prio->GetData(); double ddx, ddy; --- 278,289 ---- // shift the lines in the same slope double dx,dy; ! if (head) { dy = p1->y - p2->y; dx = p1->x - p2->x; ! wxNode * prio = head->GetNext(); while (prio) { ! p1 = (wxRealPoint*)head->GetData(); p2 = (wxRealPoint*)prio->GetData(); double ddx, ddy; *************** *** 295,299 **** || fabs(dy / dx - ddy/ddx) < 1e-4) { ! first = prio; ++j; prio = prio->GetNext(); --- 295,299 ---- || fabs(dy / dx - ddy/ddx) < 1e-4) { ! head = prio; ++j; prio = prio->GetNext(); *************** *** 338,353 **** wxList * cp = current->GetLineControlPoints(); // find first segment line ! wxNode * last = cp->GetFirst(); unsigned int i=0; // one step ! wxNode *first = last->GetNext(); unsigned int j=1; ! FindOneSegment(first, j, last); ! while (first) { ! wxRealPoint* p1 = (wxRealPoint*)first->GetData(); ! wxRealPoint* p2 = (wxRealPoint*)last->GetData(); double l = p1->x < p2->x ? p1->x : p2->x ; double r = p1->x > p2->x ? p1->x : p2->x ; --- 338,353 ---- wxList * cp = current->GetLineControlPoints(); // find first segment line ! wxNode * tail = cp->GetFirst(); unsigned int i=0; // one step ! wxNode *head = tail->GetNext(); unsigned int j=1; ! FindOneSegment(head, j, tail); ! while (head) { ! wxRealPoint* p1 = (wxRealPoint*)head->GetData(); ! wxRealPoint* p2 = (wxRealPoint*)tail->GetData(); double l = p1->x < p2->x ? p1->x : p2->x ; double r = p1->x > p2->x ? p1->x : p2->x ; *************** *** 362,371 **** break; } ! last = first; i = j; ! first = first->GetNext(); ++j; ! FindOneSegment(first, j, last); } if (flag) --- 362,371 ---- break; } ! tail = head; i = j; ! head = head->GetNext(); ++j; ! FindOneSegment(head, j, tail); } if (flag) *************** *** 410,419 **** diagram->AddShape (theShape); from->AddLine ((wxLineShape *) theShape, cshape, attachFrom, 1); ! first = cp->GetFirst(); for (int k=0; k<i+2; ++k) { *((wxRealPoint *) lineShape->GetLineControlPoints ()->Item (k)-> ! GetData ()) = *((wxRealPoint *) first->GetData()); ! first = first->GetNext(); } cshape->GetAttachmentPosition(1, &(((wxRealPoint *) lineShape->GetLineControlPoints ()->GetLast()-> GetData ())->x), &(((wxRealPoint *) lineShape->GetLineControlPoints ()->GetLast()-> GetData ())->y)); --- 410,419 ---- diagram->AddShape (theShape); from->AddLine ((wxLineShape *) theShape, cshape, attachFrom, 1); ! head = cp->GetFirst(); for (int k=0; k<i+2; ++k) { *((wxRealPoint *) lineShape->GetLineControlPoints ()->Item (k)-> ! GetData ()) = *((wxRealPoint *) head->GetData()); ! head = head->GetNext(); } cshape->GetAttachmentPosition(1, &(((wxRealPoint *) lineShape->GetLineControlPoints ()->GetLast()-> GetData ())->x), &(((wxRealPoint *) lineShape->GetLineControlPoints ()->GetLast()-> GetData ())->y)); *************** *** 424,433 **** wxRealPoint* startp = (wxRealPoint*)cp->Item(j-1)->GetData(); cshape->GetAttachmentPosition (0, &(startp->x), &(startp->y)); ! first = cp->GetFirst(); ! while(first != start) { ! last = first; ! first = first->GetNext(); ! cp->DeleteNode(last); } current->Straighten(); --- 424,433 ---- wxRealPoint* startp = (wxRealPoint*)cp->Item(j-1)->GetData(); cshape->GetAttachmentPosition (0, &(startp->x), &(startp->y)); ! head = cp->GetFirst(); ! while(head != start) { ! tail = head; ! head = head->GetNext(); ! cp->DeleteNode(tail); } current->Straighten(); Index: shape.h =================================================================== RCS file: /cvsroot/jsbsimcommander/src/gui/shape.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shape.h 4 Mar 2007 03:03:31 -0000 1.9 --- shape.h 4 Mar 2007 03:12:54 -0000 1.10 *************** *** 53,58 **** protected: ! /// find one look-like Segment Line from a line list start from last. ! void FindOneSegment(wxNode* &first, unsigned int &j, wxNode* last); }; --- 53,58 ---- protected: ! /// find one look-like Segment Line from a line list start from tail. ! void FindOneSegment(wxNode* &head, unsigned int &j, wxNode* tail); }; |