#include "stdafx.h" #include "WellPoleLib/WellBaseObj.h" #include "WellPoleLib/WellClassObjGroup.h" #include "WellPoleLib/InTrackDepthSegment.h" #include "WellPoleLib/WellPole.h" #include "WellPoleLib\InTrackResult.h" #include "WellPoleLib\InTrackLayerGroup.h" #include "MultiWellSectionLib/BendObj.h" #include "MultiWellSectionLib/FenceBendObj.h" #include "MultiWellSectionLib/FaultObj.h" #include "MultiWellSectionLib/SectionWellObj.h" #include "MultiWellSectionLib/WellSection.h" #include "MultiWellSectionDoc.h" #include "MultiWellSectionlView.h" #include "ActionModifiedSectionNotWellsItem.h" //int c_wellActionNum = 0; CActionModifiedNotWell::CActionModifiedNotWell(CSigmaDoc* ppDoc, UINT actionType) : CActionModifiedItem(ppDoc, actionType) { } CActionModifiedNotWell::CActionModifiedNotWell(CSigmaDoc* ppDoc, UINT actionType, const CPositionList& list) : CActionModifiedItem(ppDoc, actionType) { AddCloneItem(list); } CActionModifiedNotWell::~CActionModifiedNotWell(void) { for (int ii = 0; ii < m_WellObjBaseArr.size(); ii++) { delete m_WellObjBaseArr[ii]; } } void CActionModifiedNotWell::AddCloneItem(const CPositionList& list) { COne* pOne; POSITION pt, pos; pos = list.GetHeadPosition(); while (pos) { pt = list.GetNext(pos); CXy* pXy = GetDoc()->GetDraw(); pOne = pXy->GetAt(pt); if(pOne->GetType() == KEP_WELLSECTION) AddCloneItem(pt, pOne); } } bool CActionModifiedNotWell::AddCloneItem(POSITION pos, COne* pOne, bool bCreateAdd) { if (pos == NULL || pOne == NULL) return false; long index = GetDoc()->GetDraw()->GetElementIndex(pos); m_indexArray.Add(index); if (bCreateAdd) { CWellSection* pObj = (CWellSection*)pOne->value; DWORD stick = GetTickCount(); TRACE("undo redo Start time=%d ---------------\r\n", stick); //CWellBaseObj* pNewObj =(CWellBaseObj*) pObj->CloneElement(); CWellSection* pNewObj = (CWellSection*)pObj->CloneElementWithoutWells(); m_WellObjBaseArr.push_back(pNewObj); DWORD etick = GetTickCount(); TRACE("undo redo end time=%d, spend time=%d ---------------\r\n",etick, etick - stick); //pOne->SetValue(pNewObj,KEP_WELL); //m_WellObjBaseArr.push_back(pObj); //将当前井存档,新建立的井设为当前井。 } return true; } void CActionModifiedNotWell::PerformOperation(void) { GetDoc()->ClearSelection(); CRect8 range(1e100, -1e100, -1e100, 1e100); POSITION ps; CWellSection* pThat; CWellSection* pNoWellSection; long i = 0; for (int ii = 0; ii < m_WellObjBaseArr.size(); ii++) { pNoWellSection = (CWellSection*)m_WellObjBaseArr[ii]; ps = GetDoc()->GetDraw()->FindIndex(m_indexArray[i]); COne* pOne = GetDoc()->GetDraw()->GetAt(ps); if (pOne->GetType() == KEP_WELLSECTION) { pThat = (CWellSection*)pOne->value; pThat->ExchangeBendsAndFaults(pNoWellSection); if (GetDoc()->GetItem()) GetDoc()->GetItem()->SetPos(ps); pThat->GetRange(range); i++; } } Invalidate(range); } void CActionModifiedNotWell::PerformOperation(std::unique_ptr ModifiedEntry::* member) { PerformOperation(); }