// 根据矩形id删除一个矩形 void CEventAreaEditAction::DeleteRect(int iId) { SHOW_RECT_MAP::iterator itEventAreaEnd; SHOW_RECT_MAP::iterator it; it = m_RectShowMap.find(iId); Ogre::Vector3 p1; Ogre::Vector3 p2; int iRectid = 0; if(it != m_RectShowMap.end()) { CEventAreaInfo* pEventAreaInfo = NULL; pEventAreaInfo = it->second; if(pEventAreaInfo) { iRectid = pEventAreaInfo->m_iId; p1.x = pEventAreaInfo->m_rect.m_LeftTop.x; p1.z = pEventAreaInfo->m_rect.m_LeftTop.y; p2.x = pEventAreaInfo->m_rect.m_RightBottom.x; p2.z = pEventAreaInfo->m_rect.m_RightBottom.y; delete pEventAreaInfo; } m_RectShowMap.erase(it); getSceneManipulator()->_fireDelRect(0, iRectid); // 删除redo undo CEventAreaEditDelOperator* pDelOperator = NULL; pDelOperator = new CEventAreaEditDelOperator; pDelOperator->SetAction(this); pDelOperator->SetInstanceId(m_iEditRectId); pDelOperator->SetPosition(p1, p2);// getOperatorManager()->addOperator(pDelOperator);// m_pCurOperatorRect = NULL; } }
// 根据矩形id删除一个矩形 void CEventAreaEditAction::DeleteRect(int iId) { SHOW_RECT_MAP::iterator itEventAreaEnd; SHOW_RECT_MAP::iterator it; SHOW_RECT_MAP::iterator endIt; if (!m_bLocalArea) { it = m_RectShowMap.find(iId); endIt = m_RectShowMap.end(); } else { it = m_LocalRectShowMap.find(iId); endIt = m_LocalRectShowMap.end(); } Ogre::Vector3 p1; Ogre::Vector3 p2; Ogre::StringVector nameVector; Ogre::StringVector valueVector; int iRectid = 0; if(it != endIt) { CEventAreaInfo* pEventAreaInfo = NULL; pEventAreaInfo = it->second; if(pEventAreaInfo) { iRectid = pEventAreaInfo->m_iId; p1.x = pEventAreaInfo->m_rect.m_LeftTop.x; p1.z = pEventAreaInfo->m_rect.m_LeftTop.y; p2.x = pEventAreaInfo->m_rect.m_RightBottom.x; p2.z = pEventAreaInfo->m_rect.m_RightBottom.y; if (m_bLocalArea) { for (int i = 0; i<10; ++i) { Ogre::String paramName = pEventAreaInfo->m_paramsName[i]; Ogre::String paramValue = pEventAreaInfo->m_paramsValue[i]; if (!paramName.empty() && !paramValue.empty()) { nameVector.push_back(paramName); valueVector.push_back(paramValue); } } } delete pEventAreaInfo; } m_bLocalArea?(m_LocalRectShowMap.erase(it)):(m_RectShowMap.erase(it)); getSceneManipulator()->_fireDelRect(0, iRectid); // 删除redo undo CEventAreaEditDelOperator* pDelOperator = NULL; pDelOperator = new CEventAreaEditDelOperator; pDelOperator->SetAction(this); pDelOperator->SetInstanceId(iRectid, m_bLocalArea); pDelOperator->SetPosition(p1, p2);// for (int index = 0; index<(int)nameVector.size(); ++index) { pDelOperator->m_paramName.push_back(nameVector[index]); pDelOperator->m_paramValue.push_back(valueVector[index]); } getOperatorManager()->addOperator(pDelOperator);// m_pCurOperatorRect = NULL; } }