//------------------------------------------------------------------------------------- void CoordinateSystem::moveNodeX(CoordinateNode* pNode, float px, CoordinateNode* pCurrNode) { if(pCurrNode != NULL) { if(pCurrNode->x() > px) { CoordinateNode* pPreNode = pCurrNode->pPrevX(); pCurrNode->pPrevX(pNode); if(pPreNode) { pPreNode->pNextX(pNode); if(pNode == first_x_coordinateNode_ && pNode->pNextX()) first_x_coordinateNode_ = pNode->pNextX(); } else { first_x_coordinateNode_ = pNode; } if(pNode->pPrevX()) pNode->pPrevX()->pNextX(pNode->pNextX()); if(pNode->pNextX()) pNode->pNextX()->pPrevX(pNode->pPrevX()); pNode->pPrevX(pPreNode); pNode->pNextX(pCurrNode); } else { CoordinateNode* pNextNode = pCurrNode->pNextX(); if(pNextNode != pNode) { pCurrNode->pNextX(pNode); if(pNextNode) pNextNode->pPrevX(pNode); if(pNode->pPrevX()) pNode->pPrevX()->pNextX(pNode->pNextX()); if(pNode->pNextX()) { pNode->pNextX()->pPrevX(pNode->pPrevX()); if(pNode == first_x_coordinateNode_) first_x_coordinateNode_ = pNode->pNextX(); } pNode->pPrevX(pCurrNode); pNode->pNextX(pNextNode); } } } }
//------------------------------------------------------------------------------------- CoordinateSystem::~CoordinateSystem() { dels_.clear(); dels_count_ = 0; if(first_x_coordinateNode_) { CoordinateNode* pNode = first_x_coordinateNode_; while(pNode != NULL) { CoordinateNode* pNextNode = pNode->pNextX(); if (pNextNode) pNextNode->pPrevX(NULL); pNode->pCoordinateSystem(NULL); pNode->pPrevX(NULL); pNode->pNextX(NULL); pNode->pPrevY(NULL); pNode->pNextY(NULL); pNode->pPrevZ(NULL); pNode->pNextZ(NULL); delete pNode; pNode = pNextNode; } // 上面已经销毁过了 first_x_coordinateNode_ = NULL; first_y_coordinateNode_ = NULL; first_z_coordinateNode_ = NULL; } releaseNodes(); }