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.

141 lines
3.3 KiB
C++

1 month ago
#include "stdafx.h"
#include "ActionDragSizeSectionWellItem.h"
#include "WellPoleLib/WellBaseObj.h"
#include "WellPoleLib/WellClassObjGroup.h"
#include "WellPoleLib/InTrackDepthSegment.h"
#include "WellPoleLib/WellPole.h"
#include "MultiWellSectionLib/BendObj.h"
#include "WellPoleLib/InTrackDepthSegment.h"
#include "MultiWellSectionLib/WellSection.h"
#include "MultiWellSectionDoc.h"
#include "MultiWellSectionlView.h"
//int c_wellActionNum = 0;
CActionDragSizeSectionWell::CActionDragSizeSectionWell(CSigmaDoc* ppDoc, UINT actionType, BOOL bNoSaveData)
: CActionModifiedItem(ppDoc, actionType)
{
}
CActionDragSizeSectionWell::CActionDragSizeSectionWell(CSigmaDoc* ppDoc, UINT actionType, const CPositionList& list,CWellBaseObj* pWellBase)
: CActionModifiedItem(ppDoc, actionType)
{
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, pWellBase);
break;
}
}
}
CActionDragSizeSectionWell::~CActionDragSizeSectionWell(void)
{
for (int ii = 0; ii < m_WellObjBaseArr.size(); ii++)
{
delete m_WellObjBaseArr[ii];
}
m_WellPosInList.clear();
}
bool CActionDragSizeSectionWell::AddCloneItem(POSITION pos, COne* pOne, CWellBaseObj* pWellBase, bool bCreateAdd)
{
if (pos == NULL || pOne == NULL)
return false;
long index = GetDoc()->GetDraw()->GetElementIndex(pos);
m_indexArray.Add(index);
if (bCreateAdd)
{
CWellBaseObj* pObj = (CWellBaseObj*)pOne->value;
CWellSection* pSection = (CWellSection*)pObj;
//CWellBaseObj* pNewObj =(CWellBaseObj*) pObj->CloneElement();
CWellBaseObj* pNewObj = (CWellBaseObj*)pWellBase->CloneElement(); //<2F><><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD>
POSITION pos = pSection->m_WellList.GetHeadPosition();
int id = 0;
while (pos)
{
CWellBaseObj* pt = pSection->m_WellList.GetNext(pos);
if (pt == pWellBase)
{
m_WellPosInList.push_back(id);
break;
}
id++;
}
m_WellObjBaseArr.push_back(pNewObj);
//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 CActionDragSizeSectionWell::PerformOperation(void)
{
GetDoc()->ClearSelection();
CRect8 range(1e100, -1e100, -1e100, 1e100);
POSITION ps;
CWellBaseObj* pThis;
long i = 0;
for (int ii = 0; ii < m_WellObjBaseArr.size(); ii++)
{
pThis = m_WellObjBaseArr[ii];
ps = GetDoc()->GetDraw()->FindIndex(m_indexArray[i]);
COne* pOne = GetDoc()->GetDraw()->GetAt(ps);
if (pOne->GetType() == KEP_WELLSECTION)
{
CWellSection* pSection = (CWellSection*)pOne->value;
//<2F><><EFBFBD><EFBFBD>ָ<EFBFBD><D6B8>
int id = 0;
POSITION wellpos = pSection->m_WellList.GetHeadPosition();
while (wellpos != NULL)
{
CWellPole* pThatWell = (CWellPole * )pSection->m_WellList.GetNext(wellpos);
if (id == m_WellPosInList[ii])
{
pSection->ExchangeModifiedSizeWell(pThatWell, (CWellPole*)pThis);
m_WellObjBaseArr[ii] = pThatWell;
break;
}
id++;
}
//pOne->value = pThis;
//if (GetDoc()->GetItem())
// GetDoc()->GetItem()->SetPos(ps);
pSection->GetRange(range);
i++;
}
}
Invalidate(range);
}
void CActionDragSizeSectionWell::PerformOperation(std::unique_ptr<COne> ModifiedEntry::* member)
{
PerformOperation();
}