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.
153 lines
3.7 KiB
C++
153 lines
3.7 KiB
C++
#include "stdafx.h"
|
|
#include "ActionModifiedWellItem.h"
|
|
#include "WellPoleDoc.h"
|
|
#include "WellPoleView.h"
|
|
#include "../Visitor.h"
|
|
|
|
int c_wellActionNum = 0;
|
|
CActionModifiedWell::CActionModifiedWell(CSigmaDoc* ppDoc, UINT actionType, BOOL bNoSaveData)
|
|
: CActionModifiedItem(ppDoc, actionType)
|
|
{
|
|
m_bNoSaveData = bNoSaveData;
|
|
|
|
//TRACE("%d ----------- --------- create CActionModifiedWell \r\n", c_wellActionNum++);
|
|
}
|
|
|
|
CActionModifiedWell::CActionModifiedWell(CSigmaDoc* ppDoc, UINT actionType, const CPositionList& list, BOOL bNoSaveData)
|
|
: CActionModifiedItem(ppDoc, actionType)
|
|
{
|
|
m_bNoSaveData = bNoSaveData;
|
|
AddCloneItem(list);
|
|
//TRACE("%d ----------- --------- create CActionModifiedWell \r\n", c_wellActionNum++);
|
|
}
|
|
|
|
CActionModifiedWell::~CActionModifiedWell(void)
|
|
{
|
|
//TRACE("%d -------------------- decreat CActionModifiedWell ,wellNUm=%d \r\n", c_wellActionNum--, int(m_WellObjBaseArr.size()));
|
|
for (int ii = 0; ii < m_WellObjBaseArr.size(); ii++)
|
|
{
|
|
delete m_WellObjBaseArr[ii];
|
|
}
|
|
}
|
|
|
|
void CActionModifiedWell::AddCloneItem(const CPositionList& list)
|
|
{
|
|
COne* pOne;
|
|
POSITION pt, pos;
|
|
pos = list.GetHeadPosition();
|
|
while (pos)
|
|
{
|
|
pt = list.GetNext(pos);
|
|
pOne = GetDoc()->GetDraw()->GetAt(pt);
|
|
|
|
if (pOne->GetType() >= KEP_WELL || pOne->GetType() < KEP_ENDWELLOBJ)
|
|
AddCloneItem(pt, pOne);
|
|
}
|
|
}
|
|
|
|
bool CActionModifiedWell::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)
|
|
{
|
|
CWellBaseObj* pObj = (CWellBaseObj*)pOne->value;
|
|
//pObj->SetActionNoSaveData(m_bNoSaveData);
|
|
//CWellBaseObj* pNewObj =(CWellBaseObj*) pObj->CloneElement();
|
|
//pObj->SetActionNoSaveData(FALSE);
|
|
CWellBaseObj* pNewObj = pObj->CloneWellObject();
|
|
m_WellObjBaseArr.push_back(pNewObj);
|
|
|
|
//pOne->SetValue(pNewObj,KEP_WELL);
|
|
//m_WellObjBaseArr.push_back(pObj); //将当前井存档,新建立的井设为当前井。
|
|
|
|
}
|
|
return true;
|
|
}
|
|
|
|
void CActionModifiedWell::PerformOperation(void)
|
|
{
|
|
GetDoc()->ClearSelection();
|
|
|
|
CRect8 range(1e100, -1e100, -1e100, 1e100);
|
|
//CDrawObj* pThat;
|
|
//CDrawObj* pThis;
|
|
//long i = 0;
|
|
//POSITION ps;
|
|
//POSITION pts = value.GetHeadPosition();
|
|
//while (pts)
|
|
//{
|
|
// pThis = (CDrawObj*)(value.GetAt(pts));
|
|
// ps = GetDoc()->GetDraw()->FindIndex(m_indexArray[i]);
|
|
// pThat = (CDrawObj*)GetDoc()->GetDraw()->GetAt(ps);
|
|
|
|
// //数据转移
|
|
// if (m_bNoSaveData)
|
|
// pThis->TransferData(pThat);
|
|
|
|
// //交换指针
|
|
// value.SetAt(pts, pThat);
|
|
// GetDoc()->GetDraw()->SetAt(ps, pThis);
|
|
// if (GetDoc()->GetItem())
|
|
// GetDoc()->GetItem()->SetPos(ps);
|
|
|
|
// AfterRedoUndo(pThat);
|
|
|
|
// value.GetNext(pts);
|
|
|
|
// pThis->GetRange(range);
|
|
// pThat->GetRange(range);
|
|
// i++;
|
|
|
|
// list.AddTail(ps);
|
|
//}
|
|
POSITION ps;
|
|
CWellBaseObj* pThat;
|
|
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_WELL || pOne->GetType() < KEP_ENDWELLOBJ)
|
|
{
|
|
pThat = (CWellBaseObj*)pOne->value;
|
|
|
|
//数据转移
|
|
//if (m_bNoSaveData)
|
|
// pThis->TransferData(pThat);
|
|
|
|
//交换指针
|
|
//value.SetAt(pts, pThat);
|
|
m_WellObjBaseArr[ii] = pThat;
|
|
//GetDoc()->GetDraw()->SetAt(ps, pThis);
|
|
pOne->value = pThis;
|
|
if (GetDoc()->GetItem())
|
|
GetDoc()->GetItem()->SetPos(ps);
|
|
|
|
//AfterRedoUndo(pThat);
|
|
|
|
//value.GetNext(pts);
|
|
|
|
pThis->GetRange(range);
|
|
pThat->GetRange(range);
|
|
i++;
|
|
}
|
|
}
|
|
|
|
Invalidate(range);
|
|
}
|
|
|
|
void CActionModifiedWell::PerformOperation(std::unique_ptr<COne> ModifiedEntry::* member)
|
|
{
|
|
PerformOperation();
|
|
}
|
|
|
|
void NAction::CActionModifiedWell::accept(CActionVisitor& visitor)
|
|
{
|
|
//visitor.visit(*this);
|
|
}
|