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++
141 lines
3.3 KiB
C++
#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(); //½«±ä»¯µÄ¾®±£´æ
|
|
|
|
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); //½«µ±Ç°¾®´æµµ£¬Ð½¨Á¢µÄ¾®ÉèΪµ±Ç°¾®¡£
|
|
|
|
}
|
|
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;
|
|
|
|
//½»»»Ö¸Õë
|
|
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();
|
|
} |