You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
3.0 KiB
C++

#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); //<2F><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><E6B5B5><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD>Ϊ<EFBFBD><CEAA>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>
}
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<COne> ModifiedEntry::* member)
{
PerformOperation();
}