//------------------------------------------------------------------------------------- void CoordinateSystem::moveNodeY(CoordinateNode* pNode, float py, CoordinateNode* pCurrNode) { if(pCurrNode != NULL) { if(pCurrNode->y() > py) { CoordinateNode* pPreNode = pCurrNode->pPrevY(); pCurrNode->pPrevY(pNode); if(pPreNode) { pPreNode->pNextY(pNode); if(pNode == first_y_coordinateNode_ && pNode->pNextY()) first_y_coordinateNode_ = pNode->pNextY(); } else { first_y_coordinateNode_ = pNode; } if(pNode->pPrevY()) pNode->pPrevY()->pNextY(pNode->pNextY()); if(pNode->pNextY()) pNode->pNextY()->pPrevY(pNode->pPrevY()); pNode->pPrevY(pPreNode); pNode->pNextY(pCurrNode); } else { CoordinateNode* pNextNode = pCurrNode->pNextY(); if(pNextNode != pNode) { pCurrNode->pNextY(pNode); if(pNextNode) pNextNode->pPrevY(pNode); if(pNode->pPrevY()) pNode->pPrevY()->pNextY(pNode->pNextY()); if(pNode->pNextY()) { pNode->pNextY()->pPrevY(pNode->pPrevY()); if(pNode == first_y_coordinateNode_) first_y_coordinateNode_ = pNode->pNextY(); } pNode->pPrevY(pCurrNode); pNode->pNextY(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(); }