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.

130 lines
3.0 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#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 "ActionMoveSectionWellItem.h"
#include "MultiWellSectionDoc.h"
#include "MultiWellSectionlView.h"
#include "ItemSectionWell.h"
CActionMoveSectionWell::CActionMoveSectionWell(CSigmaDoc* ppDoc, UINT actionType)
: CActionModifiedItem(ppDoc, actionType)
{
}
CActionMoveSectionWell::CActionMoveSectionWell(CSigmaDoc* ppDoc, UINT actionType, const CPositionList& list, CWellBaseObj* pWellBase, CPoint2D delta)
: 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,delta);
break;
}
}
}
CActionMoveSectionWell::~CActionMoveSectionWell(void)
{
}
bool CActionMoveSectionWell::AddCloneItem(POSITION pos, COne* pOne, CWellBaseObj* pWellBase, CPoint2D delta)
{
if (pos == NULL || pOne == NULL)
return false;
long index = GetDoc()->GetDraw()->GetElementIndex(pos);
m_indexArray.Add(index);
CWellBaseObj* pObj = (CWellBaseObj*)pOne->value;
CWellSection* pSection = (CWellSection*)pObj;
POSITION pos1 = pSection->m_WellList.GetHeadPosition();
int id = 0;
while (pos1)
{
CWellBaseObj* pt = pSection->m_WellList.GetNext(pos1);
if (pt == pWellBase)
{
m_WellPosInList.push_back(id);
m_deltaPts.push_back(delta);
break;
}
id++;
}
return true;
}
void CActionMoveSectionWell::PerformOperation(std::unique_ptr<COne> ModifiedEntry::* member)
{
PerformOperation();
}
void CActionMoveSectionWell::PerformOperation(void)
{
GetDoc()->ClearSelection();
CRect8 range(1e100, -1e100, -1e100, 1e100);
POSITION ps;
long i = 0;
for (int ii = 0; ii < m_indexArray.GetCount(); 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])
{
CPoint2D delta = m_deltaPts[ii];
delta.x0 = -delta.x0; delta.y0 = -delta.y0; //<2F><><EFBFBD>ƶ<EFBFBD>λ<EFBFBD>÷<EFBFBD><C3B7><EFBFBD>һ<EFBFBD><D2BB>
CItemSectionWell sectionWellItem(GetDoc());
sectionWellItem.MoveWellInSection(pSection,pThatWell , delta);
pSection->ReSetPosition();
m_deltaPts[ii] = delta;
break;
}
id++;
}
pSection->GetRange(range);
i++;
}
}
GetDoc()->Invalidate();
}