|
|
#include "StdAfx.h"
|
|
|
#include "ItemSectionWell.h"
|
|
|
|
|
|
#include "WellPoleLib/WellCommonDef.h"
|
|
|
#include "WellPoleLib/WellBaseObj.h"
|
|
|
#include "WellPoleLib/WellClassObjGroup.h"
|
|
|
#include "WellPoleLib/TrackObj.h"
|
|
|
#include "WellPoleLib/InclinedTrack.h"
|
|
|
#include "WellPoleLib\TrackResult.h"
|
|
|
#include "WellPoleLib\InTrackResult.h"
|
|
|
#include "WellPoleLib\TrackStratum.h"
|
|
|
#include "WellPoleLib\InTrackLayerGroup.h"
|
|
|
#include "WellPoleLib/WellPole.h"
|
|
|
|
|
|
#include "MultiWellSectionLib/BendObj.h"
|
|
|
#include "MultiWellSectionLib/SectionWellObj.h"
|
|
|
#include "MultiWellSectionLib\VirtualWellObj.h"
|
|
|
#include "MultiWellSectionLib\WellSection.h"
|
|
|
|
|
|
#include "ItemWcsTrack.h"
|
|
|
#include "ItemWcsTrackIn.h"
|
|
|
#include "MultiWellSectionDoc.h"
|
|
|
#include "MultiWellSectionlView.h"
|
|
|
#include "ActionMoveSectionWellItem.h"
|
|
|
namespace NItem
|
|
|
{
|
|
|
CItemSectionWell::CItemSectionWell(CSigmaDoc* pDoc, BOOL bAdd)
|
|
|
: CItemWcsSingleWell(pDoc)
|
|
|
{
|
|
|
SetType(ITEM_SECTIONWELL);
|
|
|
m_bAddWell = bAdd;
|
|
|
}
|
|
|
|
|
|
CItemSectionWell::~CItemSectionWell(void)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
void CItemSectionWell::OnDraw(CXyDC* pXyDC, CDC* pDC)
|
|
|
{
|
|
|
if (m_bAddWell)
|
|
|
{
|
|
|
if(!m_bLDown)
|
|
|
return;
|
|
|
|
|
|
CPen pen(PS_DOT, 0, RGB(0, 0, 0));
|
|
|
CPen *pOldPen = (CPen *)pDC->SelectObject(&pen);
|
|
|
int old = pDC->SetROP2(R2_NOTXORPEN);
|
|
|
CPoint p1,p2;
|
|
|
p1 = m_downPoint;
|
|
|
p2 = m_lastPoint;
|
|
|
p2.x = p1.x;
|
|
|
pDC->MoveTo(p1);
|
|
|
pDC->LineTo(p2);
|
|
|
pDC->SelectObject(pOldPen);
|
|
|
pen.DeleteObject();
|
|
|
pDC->SetROP2(old);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CItemWcsSingleWell::OnDraw(pXyDC ,pDC);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CItemSectionWell::OnLButtonDown(CDC *pDC, UINT nFlags, CPoint point, int vk)
|
|
|
{
|
|
|
if (m_bAddWell)
|
|
|
{
|
|
|
m_bLDown = TRUE;
|
|
|
m_downPoint = m_firstPoint = m_lastPoint = point;
|
|
|
OnDraw(GetDC(),pDC);
|
|
|
//GetView()->SetCapture();
|
|
|
////Ë¢ÐÂÊôÐÔÒ³
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CItemWcsSingleWell::OnLButtonDown(pDC,nFlags,point ,vk);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int CItemSectionWell::OnMouseMove(CDC *pDC, UINT nFlags, CPoint point)
|
|
|
{
|
|
|
if (m_bAddWell)
|
|
|
{
|
|
|
CPoint2D lastPoint = GetDC()->GetReal(point);
|
|
|
if(IsCaptureState() && m_bLDown)
|
|
|
{
|
|
|
OnDraw(GetDC() ,pDC);
|
|
|
m_bDrag = TRUE;
|
|
|
m_lastPoint = point;
|
|
|
OnDraw(GetDC(), pDC);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CItemWcsSingleWell::OnMouseMove(pDC,nFlags, point);
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
void CItemSectionWell::MoveWellInSection(CWellSection* pSection, CWellPole* pMoveWellObj, CPoint2D delta)
|
|
|
{
|
|
|
//¾®Òƶ¯µÄÔÔò£¬Ö»ºáÏòÒÆ¶¯£¬×î×ó²à¾®²»Òƶ¯£¬ÆäÓà¾®ÒÆ¶¯Ê±´ø¶¯ÓҲྮһÆðÒÆ¶¯£¬Òƶ¯µÄ¾®Óë×ó²à¾®µÄλÖÃÓб仯¡£
|
|
|
std::vector<CWellPole*> wellArr;
|
|
|
std::set<CWellPole*> wellsSet;
|
|
|
int moveId = -1;
|
|
|
POSITION pos = pSection->m_WellList.GetHeadPosition();
|
|
|
while (pos)
|
|
|
{
|
|
|
CWellPole* pWell = (CWellPole*)pSection->m_WellList.GetNext(pos);
|
|
|
wellArr.push_back(pWell);
|
|
|
if (pWell == pMoveWellObj)
|
|
|
moveId = int(wellArr.size() - 1);
|
|
|
}
|
|
|
|
|
|
CRect8 preRect = wellArr[moveId - 1]->GetRect();
|
|
|
CRect8 oldRect = wellArr[moveId]->GetRect();
|
|
|
double left = preRect.right;
|
|
|
double moveLeft = oldRect.left;
|
|
|
|
|
|
if (preRect.right > (oldRect.left + delta.x0))
|
|
|
{//²»ÄܽøÈë×ó²à¾®µÄ·¶Î§
|
|
|
delta.x0 = preRect.right - oldRect.left + 20;
|
|
|
}
|
|
|
wellArr[moveId]->m_delta = delta;
|
|
|
oldRect.OffsetRect(delta.x0, delta.y0);
|
|
|
wellArr[moveId]->MoveTo(oldRect);
|
|
|
|
|
|
CSectionWellObj* pSectionWell = (CSectionWellObj*)wellArr[moveId];
|
|
|
pSectionWell->m_fHorzDistance += pSection->ScreenCXToWidth(delta.x0);
|
|
|
|
|
|
double right1 = moveLeft + delta.x0;
|
|
|
pos = pSection->m_FaultList.GetHeadPosition();
|
|
|
while (pos)
|
|
|
{
|
|
|
CFaultObj* pFault = (CFaultObj*)pSection->m_FaultList.GetNext(pos);
|
|
|
|
|
|
//ÒÆ¶¯µÄµÚÒ»¿Ú¾®£¬ÆäÓë×ó²àµÄ¾®Î»Ö÷¢Éú±ä»¯£¬¼ÆËãÒ»ÏÂËüÃÇÖмä¶Ï²ãµÄÏà¶ÔλÖá£
|
|
|
for (int j = 0; j < pFault->m_OrgCtrlPts.size(); j++)
|
|
|
{
|
|
|
dfPoint pt = pFault->m_OrgCtrlPts[j];
|
|
|
if (left < pt.x0 && pt.x0 < (moveLeft + 0.00001))
|
|
|
{
|
|
|
pt.x0 = left + (pt.x0 - left) / (moveLeft - left) * (right1 - left);
|
|
|
pFault->m_OrgCtrlPts[j] = pt;
|
|
|
}
|
|
|
else if (pt.x0 > moveLeft)
|
|
|
{
|
|
|
dfPoint pt = pFault->m_OrgCtrlPts[j];
|
|
|
pFault->m_OrgCtrlPts[j].x0 = pt.x0 + delta.x0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
pFault->ComputedFaultCurvePoints(pFault->IsBSPline());
|
|
|
}
|
|
|
|
|
|
for (int i = moveId + 1; i < wellArr.size(); i++)
|
|
|
{
|
|
|
oldRect = wellArr[i]->GetRect();
|
|
|
wellArr[i]->m_delta = delta;
|
|
|
|
|
|
oldRect.OffsetRect(delta.x0, delta.y0);
|
|
|
wellArr[i]->MoveTo(oldRect);
|
|
|
}
|
|
|
|
|
|
//¾®ºÍ¶Ï²ãÒÆ¶¯µ½Î»Öúó£¬ÖØÐ¼ÆËãbend
|
|
|
pos = pSection->m_BendList.GetHeadPosition();
|
|
|
while (pos)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)pSection->m_BendList.GetNext(pos);
|
|
|
|
|
|
std::vector<CWellPole*>::iterator lit = std::find(wellArr.begin() + (moveId - 1), wellArr.end(), pBend->m_pWellLeft);
|
|
|
std::vector<CWellPole*>::iterator rit = std::find(wellArr.begin() + (moveId - 1), wellArr.end(), pBend->m_pWellRight);
|
|
|
if (lit != wellArr.end() || rit != wellArr.end())
|
|
|
{
|
|
|
pBend->ComputeBend();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void CItemSectionWell::SetUndoRedoForMoveWell(POSITION pos, CWellPole* pMoveWellObj, CPoint2D delta)
|
|
|
{
|
|
|
CPositionList list;
|
|
|
list.AddTail(pos);
|
|
|
(GetDoc())->SetActionItem(new CActionMoveSectionWell(GetDoc(), IDS_STRING_ACTION_MOVE, list, pMoveWellObj, delta));
|
|
|
}
|
|
|
|
|
|
void CItemSectionWell::MoveWell_ResForm(CDC* pDC, UINT nFlags, CPoint point, CWellPole* pMoveWellObj)
|
|
|
{
|
|
|
|
|
|
CWellSection* pSection = (CWellSection*)pMoveWellObj->GetParent();
|
|
|
|
|
|
CWellPole* pWell = (CWellPole*)pSection->m_WellList.GetHead();
|
|
|
if (pMoveWellObj == pWell)
|
|
|
return;
|
|
|
if (selectMode == CItemSelect::size)
|
|
|
{
|
|
|
SetReUnDoAction();
|
|
|
pSection->ReComputeBends(pMoveWellObj);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
point.y = this->m_downPoint.y; //Ö»ÄܺáÏòÒÆ¶¯
|
|
|
//CItemWcsSingleWell::OnLButtonUp(nFlags, point);
|
|
|
|
|
|
CPoint2D downPoint = GetDC()->GetReal(m_downPoint);
|
|
|
CPoint2D lastPoint = GetDC()->GetReal(m_lastPoint);
|
|
|
|
|
|
CPoint2D delta(lastPoint.x0 - downPoint.x0, 0);
|
|
|
|
|
|
CWellPole* pWell = (CWellPole*)pSection->m_WellList.GetHead();
|
|
|
if (pWell == pMoveWellObj)
|
|
|
return;
|
|
|
|
|
|
//SetReUnDoAction();
|
|
|
SetUndoRedoForMoveWell(GetPos(), pMoveWellObj, delta);
|
|
|
|
|
|
MoveWellInSection(pSection, pMoveWellObj, delta);
|
|
|
}
|
|
|
pSection->ReSetPosition();
|
|
|
//GetView()->SetScrollBarRange();
|
|
|
CMultiWellSectionView* pView = (CMultiWellSectionView*)GetView();
|
|
|
pView->m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0);
|
|
|
}
|
|
|
|
|
|
void CItemSectionWell::MoveWell_oldDF(CDC* pDC, UINT nFlags, CPoint point, CWellPole* pWellObj)
|
|
|
{
|
|
|
SetReUnDoAction();
|
|
|
CWellSection* pSection = (CWellSection*)pWellObj->GetParent();
|
|
|
POSITION posBend = pSection->m_BendList.GetHeadPosition();
|
|
|
while (NULL != posBend)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)pSection->m_BendList.GetNext(posBend);
|
|
|
if (pBend->m_pWellLeft == pWellObj || pBend->m_pWellRight == pWellObj)
|
|
|
{
|
|
|
double XLeft = 0.0;
|
|
|
double XRight = 0.0;
|
|
|
pBend->GetBendXValue(XLeft, XRight);
|
|
|
if (XLeft > XRight)
|
|
|
{
|
|
|
double temp;
|
|
|
temp = XLeft;
|
|
|
XLeft = XRight;
|
|
|
XRight = temp;
|
|
|
}
|
|
|
for (int i = 0; i < pBend->m_faultArr.GetCount(); i++)
|
|
|
{
|
|
|
FaultOnBendStruct BendStruct = pBend->m_faultArr.GetAt(i);
|
|
|
CFaultObj* pFault = BendStruct.pFault;
|
|
|
for (int j = 0; j < pFault->m_ptArr.GetCount(); j++)
|
|
|
{
|
|
|
pFault->m_ptArr.GetAt(j).z0 = (pFault->m_ptArr.GetAt(j).x0 - XLeft) / (XRight - XLeft);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
CItemWcsSingleWell::OnLButtonUp(pDC, nFlags, point);
|
|
|
|
|
|
CPoint2D downPoint = GetDC()->GetReal(m_downPoint);
|
|
|
CPoint2D lastPoint = GetDC()->GetReal(m_lastPoint);
|
|
|
CPoint2D delta(lastPoint.x0 - downPoint.x0, lastPoint.y0 - downPoint.y0);
|
|
|
|
|
|
CRect8 position = pWellObj->GetPos();
|
|
|
if (selectMode == CItemSelect::move && m_firstPoint != m_downPoint && GetWellObject()->GetParent()->GetType() != KEP_FENCE)
|
|
|
{
|
|
|
//ÆäËû¾®ÉÏÏÂÒÆ¶¯
|
|
|
POSITION pos = pSection->m_WellList.GetHeadPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
CWellPole* pWell = (CWellPole*)pSection->m_WellList.GetNext(pos);
|
|
|
if (pWell != pWellObj)
|
|
|
{
|
|
|
pWell->m_delta.x0 = 0;
|
|
|
pWell->m_delta.y0 = delta.y0;
|
|
|
position = pWell->GetPos();
|
|
|
position.OffsetRect(0, delta.y0);
|
|
|
pWell->MoveTo(position);
|
|
|
}
|
|
|
}
|
|
|
//¾®ÉÏÏÂÍ϶¯ºó¶Ï²ãºÍÐéÄâ¾®Ò²¸ú×ÅÉÏÏÂÍ϶¯
|
|
|
//Åж϶ϲãÁ´±í
|
|
|
pos = pSection->m_FaultList.GetTailPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
CFaultObj* pObj = (CFaultObj*)pSection->m_FaultList.GetPrev(pos);
|
|
|
pObj->m_delta.x0 = 0;
|
|
|
pObj->m_delta.y0 = delta.y0;
|
|
|
position = pObj->GetPos();
|
|
|
position.OffsetRect(0, pObj->m_delta.y0);
|
|
|
pObj->MoveTo(position);
|
|
|
}
|
|
|
|
|
|
//ȡǰºó¾®
|
|
|
CWellPole* pWellNext = NULL;
|
|
|
CWellPole* pWellPre = NULL;
|
|
|
POSITION posFind = pSection->m_WellList.Find(pWellObj);
|
|
|
pSection->m_WellList.GetNext(posFind);
|
|
|
if (posFind != NULL)
|
|
|
pWellNext = (CWellPole*)pSection->m_WellList.GetNext(posFind);
|
|
|
|
|
|
posFind = pSection->m_WellList.Find(pWellObj);
|
|
|
pSection->m_WellList.GetPrev(posFind);
|
|
|
if (posFind != NULL)
|
|
|
pWellPre = (CWellPole*)pSection->m_WellList.GetPrev(posFind);
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
//ÅÅÁо®¶ÔÏóÊý×é(´Ó×óµ½ÓÒ)
|
|
|
//ÁÙʱ¾®¶ÔÏóÊý×é
|
|
|
CArray<CWellBaseObj*, CWellBaseObj*> wellArr;
|
|
|
pos = pSection->m_WellList.GetHeadPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
CWellBaseObj* pWell = (CWellBaseObj*)pSection->m_WellList.GetNext(pos);
|
|
|
|
|
|
wellArr.Add(pWell);
|
|
|
|
|
|
}
|
|
|
for (int i = 0; i < wellArr.GetCount() - 1; i++)
|
|
|
{
|
|
|
for (int j = i + 1; j < wellArr.GetCount(); j++)
|
|
|
{
|
|
|
if (wellArr[i]->GetPos().left > wellArr[j]->GetPos().left)
|
|
|
{
|
|
|
CWellBaseObj* pObj = wellArr[i];
|
|
|
wellArr[i] = wellArr[j];
|
|
|
wellArr[j] = pObj;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
pSection->m_WellList.RemoveAll();
|
|
|
for (int ii = 0; ii < wellArr.GetCount(); ii++)
|
|
|
{
|
|
|
pSection->m_WellList.AddTail(wellArr[ii]);
|
|
|
}
|
|
|
//Çå¿ÕÊý×é
|
|
|
wellArr.RemoveAll();
|
|
|
//ȡǰºó¾®
|
|
|
CWellPole* pWellNextNew = NULL;
|
|
|
CWellPole* pWellPreNew = NULL;
|
|
|
posFind = pSection->m_WellList.Find(pWellObj);
|
|
|
pSection->m_WellList.GetNext(posFind);
|
|
|
if (posFind != NULL)
|
|
|
pWellNextNew = (CWellPole*)pSection->m_WellList.GetNext(posFind);
|
|
|
|
|
|
posFind = pSection->m_WellList.Find(pWellObj);
|
|
|
pSection->m_WellList.GetPrev(posFind);
|
|
|
if (posFind != NULL)
|
|
|
pWellPreNew = (CWellPole*)pSection->m_WellList.GetPrev(posFind);
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
if (pWellPre != pWellPreNew || pWellNext != pWellNextNew)//¾®Î»Ö÷¢Éú»¥»»
|
|
|
{
|
|
|
POSITION pos = pSection->m_BendList.GetHeadPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)pSection->m_BendList.GetNext(pos);
|
|
|
if (pBend->m_pLayerLeft != NULL && pBend->m_pLayerLeft->GetWell() == pWellObj || (pBend->m_pLayerRight != NULL && pBend->m_pLayerRight->GetWell() == pWellObj))
|
|
|
{
|
|
|
POSITION posF = pSection->m_BendList.Find(pBend);
|
|
|
pSection->m_BendList.RemoveAt(posF);
|
|
|
|
|
|
//// ¾®Î»Ö÷¢Éú±ä»¯Ê±£¬ÔÚ²ãµÄ×óÓÒÁ´±íÖÐɾ³ýÏà¹ØµÄÁ¬²ã
|
|
|
pSection->DeleteBend(pBend);
|
|
|
|
|
|
//delete pBend;
|
|
|
}
|
|
|
else if (pWellPre != pWellPreNew && pWellPre != NULL && pBend->m_pLayerLeft != NULL && pBend->m_pLayerRight == NULL)
|
|
|
{
|
|
|
POSITION posF = pSection->m_BendList.Find(pBend);
|
|
|
pSection->m_BendList.RemoveAt(posF);
|
|
|
|
|
|
/////// ¾®Î»Ö÷¢Éú±ä»¯Ê±£¬ÔÚ²ãµÄ×óÓÒÁ´±íÖÐɾ³ýÏà¹ØµÄÁ¬²ã
|
|
|
pSection->DeleteBend(pBend);
|
|
|
|
|
|
//delete pBend;
|
|
|
}
|
|
|
else if (pWellNext != pWellNextNew && pWellNext != NULL && ((pBend->m_pLayerLeft != NULL && pBend->m_pLayerLeft->GetWell() == pWellNext) || (pBend->m_pLayerRight != NULL && pBend->m_pLayerRight->GetWell() == pWellNext)))
|
|
|
{
|
|
|
POSITION posF = pSection->m_BendList.Find(pBend);
|
|
|
pSection->m_BendList.RemoveAt(posF);
|
|
|
|
|
|
//////// ¾®Î»Ö÷¢Éú±ä»¯Ê±£¬ÔÚ²ãµÄ×óÓÒÁ´±íÖÐɾ³ýÏà¹ØµÄÁ¬²ã
|
|
|
pSection->DeleteBend(pBend);
|
|
|
|
|
|
//delete pBend;
|
|
|
}
|
|
|
else if (pWellPreNew != NULL && (pBend->m_pLayerLeft != NULL && pBend->m_pLayerLeft->GetWell() == pWellPreNew || (pBend->m_pLayerRight != NULL && pBend->m_pLayerRight->GetWell() == pWellPreNew)))
|
|
|
{
|
|
|
POSITION posF = pSection->m_BendList.Find(pBend);
|
|
|
pSection->m_BendList.RemoveAt(posF);
|
|
|
|
|
|
//////// ¾®Î»Ö÷¢Éú±ä»¯Ê±£¬ÔÚ²ãµÄ×óÓÒÁ´±íÖÐɾ³ýÏà¹ØµÄÁ¬²ã
|
|
|
pSection->DeleteBend(pBend);
|
|
|
|
|
|
//delete pBend;
|
|
|
}
|
|
|
else if (pWellNextNew != NULL && (pBend->m_pLayerLeft != NULL && pBend->m_pLayerLeft->GetWell() == pWellNextNew || (pBend->m_pLayerRight != NULL && pBend->m_pLayerRight->GetWell() == pWellNextNew)))
|
|
|
{
|
|
|
POSITION posF = pSection->m_BendList.Find(pBend);
|
|
|
pSection->m_BendList.RemoveAt(posF);
|
|
|
|
|
|
//////¾®Î»Ö÷¢Éú±ä»¯Ê±£¬ÔÚ²ãµÄ×óÓÒÁ´±íÖÐɾ³ýÏà¹ØµÄÁ¬²ã
|
|
|
pSection->DeleteBend(pBend);
|
|
|
|
|
|
//delete pBend;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//pcg½á¹ûµ÷ÕûºóµÄÖØÐ¼ÆËã
|
|
|
pSection->ReComputeBends(pWellObj);
|
|
|
CPoint2D ptDeltaY(0, pWellObj->m_delta.y0);
|
|
|
if (fabs(ptDeltaY.y0) > 0)
|
|
|
{
|
|
|
pos = pSection->m_BendList.GetHeadPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)pSection->m_BendList.GetNext(pos);
|
|
|
for (int i = 0; i < pBend->m_ptArrControls.GetCount(); i++)
|
|
|
{
|
|
|
pBend->m_ptArrControls[i].Y -= ptDeltaY.y0;
|
|
|
}
|
|
|
for (int kk = 0; kk < pBend->m_ptArrCurveTopOld.GetCount(); kk++)
|
|
|
{
|
|
|
pBend->m_ptArrCurveTopOld.GetAt(kk).y0 += ptDeltaY.y0;
|
|
|
}
|
|
|
for (int kk = 0; kk < pBend->m_ptArrCurveBotOld.GetCount(); kk++)
|
|
|
{
|
|
|
pBend->m_ptArrCurveBotOld.GetAt(kk).y0 += ptDeltaY.y0;
|
|
|
}
|
|
|
|
|
|
for (int kk = 0; kk < pBend->m_curveBreakLithoOld.num; kk++)
|
|
|
{
|
|
|
pBend->m_curveBreakLithoOld.y[kk] += ptDeltaY.y0;
|
|
|
}
|
|
|
for (int kk = 0; kk < pBend->m_curveBreakLitho.num; kk++)
|
|
|
{
|
|
|
pBend->m_curveBreakLitho.y[kk] += ptDeltaY.y0;
|
|
|
}
|
|
|
for (int kk = 0; kk < pBend->m_curveBreakLithoInteract.num; kk++)
|
|
|
{
|
|
|
pBend->m_curveBreakLithoInteract.y[kk] += ptDeltaY.y0;
|
|
|
}
|
|
|
|
|
|
pBend->m_ptLeft.y0 += ptDeltaY.y0;
|
|
|
pBend->m_ptRight.y0 += ptDeltaY.y0;
|
|
|
|
|
|
pBend->m_ptEndBreakInteract.y0 += ptDeltaY.y0;
|
|
|
pBend->m_ptBeginBreak.y0 += ptDeltaY.y0;
|
|
|
pBend->m_ptEndBreak.y0 += ptDeltaY.y0;
|
|
|
pBend->ComputeSlopeAndConstant();
|
|
|
pBend->CreateBendLines();
|
|
|
pBend->CreateBendFills();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/// ¶Ï²ãÏà¶Ô×óÓÒ¾®µÄλÖùØÏµ
|
|
|
POSITION posBend1 = pSection->m_BendList.GetHeadPosition();
|
|
|
while (NULL != posBend1)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)pSection->m_BendList.GetNext(posBend1);
|
|
|
if (pBend->m_pWellLeft == pWellObj || pBend->m_pWellRight == pWellObj)
|
|
|
{
|
|
|
double XLeft = 0.0;
|
|
|
double XRight = 0.0;
|
|
|
pBend->GetBendXValue(XLeft, XRight);
|
|
|
if (XLeft > XRight)
|
|
|
{
|
|
|
double temp;
|
|
|
temp = XLeft;
|
|
|
XLeft = XRight;
|
|
|
XRight = temp;
|
|
|
}
|
|
|
for (int i = 0; i < pBend->m_faultArr.GetCount(); i++)
|
|
|
{
|
|
|
FaultOnBendStruct BendStruct = pBend->m_faultArr.GetAt(i);
|
|
|
CFaultObj* pFault = BendStruct.pFault;
|
|
|
for (int j = 0; j < pFault->m_ptArr.GetCount(); j++)
|
|
|
{
|
|
|
pFault->m_ptArr.GetAt(j).x0 = XLeft + (XRight - XLeft) * pFault->m_ptArr.GetAt(j).z0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//ÅжÏÐé¾®Á´±í
|
|
|
pos = pSection->m_VirtualWellList.GetTailPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
CVirtualWellObj* pObj = (CVirtualWellObj*)pSection->m_VirtualWellList.GetPrev(pos);
|
|
|
pObj->m_delta.x0 = 0;
|
|
|
pObj->m_delta.y0 = delta.y0;
|
|
|
position = pObj->GetPos();
|
|
|
position.OffsetRect(0, pObj->m_delta.y0);
|
|
|
pObj->MoveTo(position);
|
|
|
}
|
|
|
}
|
|
|
else if (selectMode == CItemSelect::size)
|
|
|
{
|
|
|
pSection->ReComputeBends(pWellObj);
|
|
|
}
|
|
|
//¶Ï²ãÖØÐÂÇиî²ãλ
|
|
|
POSITION pos = pSection->m_FaultList.GetHeadPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
CWellBaseObj* pObj = pSection->m_FaultList.GetNext(pos);
|
|
|
if (pObj->GetType() == KEP_SECTIONFAULT)
|
|
|
{
|
|
|
CFaultObj* FaultObj = (CFaultObj*)pObj;
|
|
|
FaultObj->FaultReCut();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//¼ÆËãÆÊÃæ·¶Î§
|
|
|
pSection->ReSetPosition();
|
|
|
|
|
|
//Ë¢ÐÂ
|
|
|
CRect rect = GetDC()->GetScreen(pSection->GetRect());
|
|
|
//GetDoc()->Invalidate(rect);
|
|
|
}
|
|
|
|
|
|
|
|
|
void CItemSectionWell::OnLButtonUp(CDC *pDC, UINT nFlags, CPoint point, int vk)
|
|
|
{
|
|
|
if (m_bAddWell)
|
|
|
{
|
|
|
m_firstPoint = m_lastPoint = point;
|
|
|
m_bLDown = FALSE;
|
|
|
m_bDrag = FALSE;
|
|
|
nDragHandle = 0;
|
|
|
ReleaseCapture();
|
|
|
|
|
|
CPoint2D ptDown = GetDC()->GetReal(m_downPoint);
|
|
|
CPoint2D ptLast = GetDC()->GetReal(m_lastPoint);
|
|
|
double yMin = min(ptDown.y0,ptLast.y0);
|
|
|
double yMax = max(ptDown.y0,ptLast.y0);
|
|
|
if (fabs(yMin-yMax)==0.0)
|
|
|
return;
|
|
|
|
|
|
CItemWellSection* pItemWellSection = (CItemWellSection*)GetItemSection();
|
|
|
if(NULL != pItemWellSection)
|
|
|
pItemWellSection->SetReUnDoAction();
|
|
|
|
|
|
CWellSection* pWellSection = GetItemSection()->GetWellSection();
|
|
|
|
|
|
CSectionWellObj* pSectionWell;
|
|
|
pSectionWell = new CSectionWellObj;
|
|
|
pSectionWell->m_fX = 0.0;
|
|
|
pSectionWell->m_fY = 0.0;
|
|
|
pSectionWell->m_fLevel = 0.0;
|
|
|
pSectionWell->GetPos().left = ptDown.x0-20;
|
|
|
pSectionWell->GetPos().right = ptDown.x0+20;
|
|
|
pSectionWell->GetPos().bottom = min(ptDown.y0, ptLast.y0);
|
|
|
pSectionWell->GetPos().top = max(ptDown.y0, ptLast.y0);
|
|
|
pSectionWell->m_fProportion = pWellSection->m_fDepthScale;
|
|
|
pSectionWell->SetParent(pWellSection);
|
|
|
pWellSection->m_WellList.AddTail(pSectionWell);
|
|
|
|
|
|
//ÁÙʱ¾®¶ÔÏóÊý×é
|
|
|
CArray<CWellBaseObj*, CWellBaseObj*> wellArr;
|
|
|
POSITION pos = pWellSection->m_WellList.GetHeadPosition();
|
|
|
while (pos!=NULL)
|
|
|
{
|
|
|
CWellBaseObj* pWell = (CWellBaseObj*)pWellSection->m_WellList.GetNext(pos);
|
|
|
wellArr.Add(pWell);
|
|
|
}
|
|
|
for (int i = 0; i < wellArr.GetCount() - 1; i++)
|
|
|
{
|
|
|
for (int j = i + 1; j < wellArr.GetCount(); j++)
|
|
|
{
|
|
|
if (wellArr[i]->GetPos().left > wellArr[j]->GetPos().left)
|
|
|
{
|
|
|
CWellBaseObj *pObj = wellArr[i];
|
|
|
wellArr[i] = wellArr[j];
|
|
|
wellArr[j] = pObj;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
pWellSection->m_WellList.RemoveAll();
|
|
|
for (int ii=0;ii<wellArr.GetCount();ii++)
|
|
|
{
|
|
|
pWellSection->m_WellList.AddTail(wellArr[ii]);
|
|
|
}
|
|
|
//Çå¿ÕÊý×é
|
|
|
wellArr.RemoveAll();
|
|
|
|
|
|
CWellPole* pWell = NULL;
|
|
|
pos = pWellSection->m_WellList.Find(pSectionWell);
|
|
|
if (pWellSection->m_WellList.GetPrev(pos) != NULL)
|
|
|
{
|
|
|
pWell = (CWellPole*)pWellSection->m_WellList.GetPrev(pos);
|
|
|
}
|
|
|
if (NULL == pWell)
|
|
|
{
|
|
|
pos = pWellSection->m_WellList.Find(pSectionWell);
|
|
|
if (pWellSection->m_WellList.GetNext(pos) != NULL)
|
|
|
{
|
|
|
pWell = (CWellPole*)pWellSection->m_WellList.GetNext(pos);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (NULL != pWell)
|
|
|
{
|
|
|
pWell->SetActionTemplate(TRUE);
|
|
|
pWell->SetNoSaveCallouts(TRUE);
|
|
|
CMemFile fw;
|
|
|
AfxGetPublicFunction()->InitSaveCounter();
|
|
|
//AfxGetPublicFunction()->__CurrentSaveFilePath="";//filepathstr;
|
|
|
AfxGetPublicFunction()->SetCodeType(CODE_GB2321);
|
|
|
WriteDML_Head_Version(fw);
|
|
|
WriteDML_Head_Xmlns(fw);
|
|
|
pWell->WriteDML(fw, -1, 1);
|
|
|
AfxGetPublicFunction()->WriteDML_Tail(fw,0);
|
|
|
//AfxGetPublicFunction()->SetCodeType((DWORD)::GetPreferences().WorkaroundSave.m_nCodeMode);
|
|
|
AfxGetPublicFunction()->InitSaveCounter();
|
|
|
//fw.Close();
|
|
|
pWell->SetActionTemplate(FALSE);
|
|
|
pWell->SetNoSaveCallouts(FALSE);
|
|
|
|
|
|
//Ñ¡ÖÐ
|
|
|
pItemWellSection->Select(pSectionWell);
|
|
|
pItemWellSection->ApplingTemplateFile(fw,FALSE);
|
|
|
|
|
|
pSectionWell->GetPos().left = ptDown.x0 - pWell->GetPos().Width()*0.5;
|
|
|
pSectionWell->GetPos().right = ptDown.x0 + pWell->GetPos().Width()*0.5;
|
|
|
pSectionWell->GetPos().top = yMax + pSectionWell->m_dHeightTrackHead + pSectionWell->m_dHeightWellHead;
|
|
|
pSectionWell->GetPos().bottom = yMin;
|
|
|
|
|
|
pSectionWell->m_dSdep = pWell->m_dSdep-pWell->m_fLevel - pWell->ScreenCYToHeight(yMax-(pWell->GetPos().top-pWell->m_dHeightWellHead-pWell->m_dHeightTrackHead));
|
|
|
pSectionWell->m_dEdep = pWell->m_dSdep-pWell->m_fLevel - pWell->ScreenCYToHeight(yMin-(pWell->GetPos().top-pWell->m_dHeightWellHead-pWell->m_dHeightTrackHead));
|
|
|
pSectionWell->AddWellInterval(pSectionWell->m_dSdep, pSectionWell->m_dEdep, 0);
|
|
|
pSectionWell->CalculateSize(pSectionWell->GetPos().TopLeft());
|
|
|
}
|
|
|
|
|
|
//ȡǰºó¾®
|
|
|
CWellPole* pWellNext = NULL;
|
|
|
CWellPole* pWellPre = NULL;
|
|
|
POSITION posFind = pWellSection->m_WellList.Find(pSectionWell);
|
|
|
pWellSection->m_WellList.GetNext(posFind);
|
|
|
if (posFind!=NULL)
|
|
|
pWellNext = (CWellPole*)pWellSection->m_WellList.GetNext(posFind);
|
|
|
|
|
|
posFind = pWellSection->m_WellList.Find(pSectionWell);
|
|
|
pWellSection->m_WellList.GetPrev(posFind);
|
|
|
if (posFind!=NULL)
|
|
|
pWellPre = (CWellPole*)pWellSection->m_WellList.GetPrev(posFind);
|
|
|
if (pWellNext != NULL && pWellPre != NULL)
|
|
|
{
|
|
|
POSITION pos = pWellSection->m_BendList.GetHeadPosition();
|
|
|
while (pos!=NULL)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)pWellSection->m_BendList.GetNext(pos);
|
|
|
BOOL bOne = pBend->m_pWellLeft == pWellPre && pBend->m_pWellRight == pWellNext;
|
|
|
BOOL bTwo = pBend->m_pWellLeft == pWellNext && pBend->m_pWellRight == pWellPre;
|
|
|
if (bOne || bTwo)
|
|
|
{
|
|
|
POSITION posF = pWellSection->m_BendList.Find(pBend);
|
|
|
pWellSection->m_BendList.RemoveAt(posF);
|
|
|
pWellSection->DeleteBend(pBend);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
pWellSection->ReSetPosition();
|
|
|
//GetView()->SetScrollBarRange();
|
|
|
GetDoc()->Invalidate();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CWellBaseObj* pObjSelected = NULL;
|
|
|
if(this->m_WellObjSelectlist.GetCount() == 1)
|
|
|
pObjSelected = m_WellObjSelectlist.GetHead();
|
|
|
if(m_pItemSelected!=NULL && pObjSelected!=NULL && m_bEditTrackInData)
|
|
|
{
|
|
|
m_bEditTrackInData = FALSE;
|
|
|
m_pItemSelected->OnLButtonUp(pDC, nFlags, point ,vk);
|
|
|
CPoint2D ptDown = GetDC()->GetReal(m_downPoint);
|
|
|
CPoint2D ptLast = GetDC()->GetReal(m_lastPoint);
|
|
|
double yMin = min(ptDown.y0,ptLast.y0);
|
|
|
double yMax = max(ptDown.y0,ptLast.y0);
|
|
|
if (fabs(yMin-yMax) > ZERO)
|
|
|
{
|
|
|
//CXTPPropertyGrid &grid = GetPropertyGrid(GetDoc()->GetMainFrame());
|
|
|
//if(pObjSelected->GetElementType()==GDOUBLEFOX_RESULT||
|
|
|
// pObjSelected->GetElementType()==GDOUBLEFOX_LAYERGROUP||
|
|
|
// pObjSelected->GetElementType()==GDOUBLEFOX_STANDARD)
|
|
|
{
|
|
|
if(m_pItemSelected != NULL)
|
|
|
delete m_pItemSelected;
|
|
|
CItemWcsTrackIn *pTrackIn = new CItemWcsTrackIn(GetDoc());
|
|
|
m_pItemSelected = pTrackIn;
|
|
|
pTrackIn->SetDrawObj(pObjSelected);
|
|
|
POSITION pos = m_WellObjSelectlist.GetHeadPosition();
|
|
|
while(pos)
|
|
|
{
|
|
|
pTrackIn->m_WellObjSelectlist.AddTail(m_WellObjSelectlist.GetNext(pos));
|
|
|
}
|
|
|
pTrackIn->SetPos(GetPos());
|
|
|
// pTrackIn->InitPropertyGrid(grid);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
m_firstPoint = m_lastPoint = point;
|
|
|
|
|
|
CWellPole *pWellObj = GetWellObject();
|
|
|
CWellSection* pSection = (CWellSection*)pWellObj->GetParent();
|
|
|
if(pSection == NULL)
|
|
|
{
|
|
|
CItemWcsSingleWell::OnLButtonUp(pDC,nFlags,point,vk);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
if((m_downPoint.x-m_lastPoint.x)!=0 || (m_downPoint.y-m_lastPoint.y)!=0)
|
|
|
{
|
|
|
if (pObjSelected == NULL)
|
|
|
{
|
|
|
if (IsCaptureState()) //Í϶¯¾®
|
|
|
{
|
|
|
if (pSection->m_bResForm)
|
|
|
{
|
|
|
MoveWell_ResForm(pDC,nFlags, point, pWellObj);
|
|
|
GetDoc()->Invalidate();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
MoveWell_oldDF(pDC,nFlags, point, pWellObj);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CWellBaseObj* pObj = (CWellBaseObj* )pObjSelected;
|
|
|
|
|
|
if (IsCaptureState())
|
|
|
{
|
|
|
CRect8 rect = pObj->GetRect();
|
|
|
CItemWcsSingleWell::OnLButtonUp(pDC,nFlags, point ,vk);
|
|
|
|
|
|
if(pObj->GetType()== KEP_RESULT || pObj->GetType()== KEP_LAYERGROUP)
|
|
|
{
|
|
|
CInTrackDepthSegment* pLayer = (CInTrackDepthSegment*)pObj;
|
|
|
|
|
|
if (pSection->m_bResForm)
|
|
|
{//251124
|
|
|
WELLOBJLIST::iterator it = pLayer->m_BendLeftList.begin();
|
|
|
for (; it != pLayer->m_BendLeftList.end(); it++)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)*it;
|
|
|
pBend->ComputeBend();
|
|
|
}
|
|
|
|
|
|
it = pLayer->m_BendRightList.begin();
|
|
|
for (; it != pLayer->m_BendRightList.end(); it++)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)*it;
|
|
|
pBend->ComputeBend();
|
|
|
}
|
|
|
|
|
|
POSITION pos = pSection->m_BendList.GetHeadPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)pSection->m_BendList.GetNext(pos);
|
|
|
if (pBend->m_pLayerLeft == pObj && pBend->m_pLayerRight == NULL)
|
|
|
{
|
|
|
pBend->ComputeBend();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
////////²ã×ó±ßÁ¬½ÓµÄ·Ç¼âÃðÁ¬²ãµÄ±ä»¯
|
|
|
pSection->ComputeBendControlsHeight(pLayer, TRUE);
|
|
|
|
|
|
WELLOBJLIST::iterator it = pLayer->m_BendLeftList.begin();
|
|
|
for (; it != pLayer->m_BendLeftList.end(); it++)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)*it;
|
|
|
CInTrackDepthSegment* pLayerLeft = pBend->m_pLayerLeft;
|
|
|
if (pBend->m_pLayerLeft->GetPos().left > pBend->m_pLayerRight->GetPos().left)
|
|
|
pLayerLeft = pBend->m_pLayerRight;
|
|
|
pSection->ComputeBendControlsHeight(pLayerLeft, FALSE);
|
|
|
}
|
|
|
////////²ãÓÒ±ßÁ¬½ÓµÄ·Ç¼âÃðÁ¬²ãµÄ±ä»¯
|
|
|
pSection->ComputeBendControlsHeight(pLayer, FALSE);
|
|
|
WELLOBJLIST::iterator itLeft = pLayer->m_BendRightList.begin();
|
|
|
for (; itLeft != pLayer->m_BendRightList.end(); itLeft++)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)*itLeft;
|
|
|
CInTrackDepthSegment* pLayerRight = pBend->m_pLayerRight;
|
|
|
if (pBend->m_pLayerLeft->GetPos().left > pBend->m_pLayerRight->GetPos().left)
|
|
|
pLayerRight = pBend->m_pLayerLeft;
|
|
|
pSection->ComputeBendControlsHeight(pLayerRight, TRUE);
|
|
|
}
|
|
|
|
|
|
////////²ãÁ¬½ÓµÄ¼âÃðÁ¬²ãµÄ±ä»¯
|
|
|
POSITION pos = pSection->m_BendList.GetHeadPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)pSection->m_BendList.GetNext(pos);
|
|
|
if (pBend->m_pLayerLeft == pObj && pBend->m_pLayerRight == NULL)
|
|
|
{
|
|
|
double a1, b1, a2, b2;
|
|
|
double yRatio;
|
|
|
double yLeftNew, yRightNew;
|
|
|
if (rect.top != pObj->GetPos().top || rect.bottom != pObj->GetPos().bottom)
|
|
|
{
|
|
|
a1 = (pBend->m_ptEndBreak.y0 - rect.CenterPoint().y0)
|
|
|
/ (pBend->m_ptEndBreak.x0 - pBend->m_ptArrCurveTopOld.GetAt(0).x0);
|
|
|
b1 = rect.CenterPoint().y0 - a1 * pBend->m_ptArrCurveTopOld.GetAt(0).x0;
|
|
|
b2 = pObj->GetPos().CenterPoint().y0 - a1 * pBend->m_ptArrCurveTopOld.GetAt(0).x0;
|
|
|
dfPoint dfpoint;
|
|
|
for (int kk = 0; kk < pBend->m_ptArrCurveTopOld.GetCount(); kk++)
|
|
|
{
|
|
|
yRatio = (pBend->m_ptArrCurveTopOld.GetAt(kk).y0 - (a1 * pBend->m_ptArrCurveTopOld.GetAt(kk).x0 + b1)) / (rect.Height());
|
|
|
dfpoint.y0 = yRatio * pObj->GetPos().Height() + (a1 * pBend->m_ptArrCurveTopOld.GetAt(kk).x0 + b2);
|
|
|
pBend->m_ptArrCurveTopOld.GetAt(kk).y0 = dfpoint.y0;
|
|
|
}
|
|
|
for (int kk = 0; kk < pBend->m_ptArrCurveBotOld.GetCount(); kk++)
|
|
|
{
|
|
|
yRatio = (pBend->m_ptArrCurveBotOld.GetAt(kk).y0 - (a1 * pBend->m_ptArrCurveBotOld.GetAt(kk).x0 + b1)) / (rect.Height());
|
|
|
dfpoint.y0 = yRatio * pObj->GetPos().Height() + (a1 * pBend->m_ptArrCurveBotOld.GetAt(kk).x0 + b2);
|
|
|
pBend->m_ptArrCurveBotOld.GetAt(kk).y0 = dfpoint.y0;
|
|
|
}
|
|
|
yRatio = (pBend->m_ptEndBreak.y0 - (a1 * pBend->m_ptEndBreak.x0 + b1)) / (rect.Height());
|
|
|
dfpoint.y0 = yRatio * pObj->GetPos().Height() + (a1 * pBend->m_ptEndBreak.x0 + b2);
|
|
|
pBend->m_ptEndBreak.y0 = dfpoint.y0;
|
|
|
yRatio = (pBend->m_ptEndBreakInteract.y0 - (a1 * pBend->m_ptEndBreakInteract.x0 + b1)) / (rect.Height());
|
|
|
dfpoint.y0 = yRatio * pObj->GetPos().Height() + (a1 * pBend->m_ptEndBreakInteract.x0 + b2);
|
|
|
pBend->m_ptEndBreakInteract.y0 = dfpoint.y0;
|
|
|
}
|
|
|
yLeftNew = pBend->m_ptArrCurveTopOld.GetAt(0).y0 - (pBend->m_ptArrCurveTopOld.GetAt(0).y0 - pBend->m_ptArrCurveBotOld.GetAt(0).y0) / 2;
|
|
|
yRightNew = pBend->m_ptArrCurveTopOld.GetAt(pBend->m_ptArrCurveTopOld.GetCount() - 1).y0 - (pBend->m_ptArrCurveTopOld.GetAt(pBend->m_ptArrCurveTopOld.GetCount() - 1).y0 - pBend->m_ptArrCurveBotOld.GetAt(pBend->m_ptArrCurveBotOld.GetCount() - 1).y0) / 2;
|
|
|
a2 = (yRightNew - yLeftNew) / (pBend->m_ptArrCurveTopOld.GetAt(pBend->m_ptArrCurveTopOld.GetCount() - 1).x0 - pBend->m_ptArrCurveTopOld.GetAt(0).x0);
|
|
|
b2 = yLeftNew - a2 * pBend->m_ptArrCurveTopOld.GetAt(0).x0;
|
|
|
for (int kk = 0; kk < pBend->m_ptArrControls.GetCount(); kk++)
|
|
|
{
|
|
|
pBend->m_ptArrControls[kk].Y = -(a2 * pBend->m_ptArrControls[kk].X + b2);
|
|
|
}
|
|
|
pBend->ComputeSlopeAndConstant();
|
|
|
pBend->CreateBendLines();
|
|
|
pBend->CreateBendFills();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Invalidate();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if(selectMode==CItemSelect::move || selectMode==CItemSelect::size)
|
|
|
{
|
|
|
if (pObj->GetType()==KEP_TRACK)
|
|
|
{
|
|
|
DWORD stick = GetTickCount();
|
|
|
|
|
|
pSection->ReComputeBends(pWellObj);
|
|
|
|
|
|
if (pSection->m_bResForm == FALSE)
|
|
|
{
|
|
|
//¶Ï²ãÖØÐÂÇиî²ãλ
|
|
|
POSITION pos = pSection->m_FaultList.GetHeadPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
CWellBaseObj* pObj = pSection->m_FaultList.GetNext(pos);
|
|
|
if (pObj->GetType() == KEP_SECTIONFAULT)
|
|
|
{
|
|
|
CFaultObj* FaultObj = (CFaultObj*)pObj;
|
|
|
FaultObj->FaultReCut();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
DWORD etick = GetTickCount();
|
|
|
TRACE("Drag Track Size time=%d ---------------\r\n", (etick - stick)/100);
|
|
|
|
|
|
CRect rect = GetDC()->GetScreen(pSection->GetRect());
|
|
|
GetDoc()->Invalidate();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// End dragging image
|
|
|
if(m_pDragImage != NULL)
|
|
|
{
|
|
|
CWnd* pWnd = CWnd::FromHandle(GetView()->GetHWND());
|
|
|
m_pDragImage->DragLeave(pWnd);
|
|
|
m_pDragImage->EndDrag();
|
|
|
delete m_pDragImage; m_pDragImage=NULL;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CItemWcsSingleWell::OnLButtonUp(pDC,nFlags, point,vk);
|
|
|
}
|
|
|
|
|
|
ReleaseCapture();
|
|
|
m_bDrag = FALSE;
|
|
|
m_bLDown = FALSE;
|
|
|
nDragHandle = 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
BOOL CItemSectionWell::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
|
|
|
{
|
|
|
if(m_bAddWell)
|
|
|
{
|
|
|
::SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR_RANGE));
|
|
|
return TRUE;
|
|
|
}
|
|
|
else
|
|
|
return CItemWcsSingleWell::OnSetCursor(pWnd, nHitTest, message);
|
|
|
|
|
|
//GetDoc()->GetCursor().SetCursor(CursorSelect);
|
|
|
//return GetDoc()->GetCursor().SetCursor();
|
|
|
}
|
|
|
|
|
|
void CItemSectionWell::ReSetWell(CWellPole* pWell)
|
|
|
{
|
|
|
CPoint2D pt = pWell->GetAnchorPoint();
|
|
|
pWell->CalculateSize(pt/*pWell->GetPos().TopLeft()*/);
|
|
|
pWell->ReadCurveData();
|
|
|
pWell->ResetChildPosition();
|
|
|
|
|
|
CWellBaseObj *pObj = (CWellBaseObj*)pWell->GetParent();
|
|
|
if(pObj != NULL && pObj->GetType() == KEP_WELLSECTION)
|
|
|
{
|
|
|
//ɾ³ýÏà¹ØÁ¬²ã
|
|
|
CWellSection *pWellSection = (CWellSection*)pObj;
|
|
|
POSITION posBend = pWellSection->m_BendList.GetHeadPosition();
|
|
|
while (posBend!=NULL)
|
|
|
{
|
|
|
CBendObj* pBend = (CBendObj*)pWellSection->m_BendList.GetNext(posBend);
|
|
|
if (!pBend->m_pLayerLeft->IsView()||(pBend->m_pLayerRight!=NULL&&!pBend->m_pLayerRight->IsView()))
|
|
|
{
|
|
|
POSITION posFind = pWellSection->m_BendList.Find(pBend);
|
|
|
if (posFind!=NULL)
|
|
|
{
|
|
|
pWellSection->DeleteBend(pBend);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
pWellSection->ReSetPosition();
|
|
|
}
|
|
|
//ÖØÉè¹ö¶¯Ìõ
|
|
|
SetScrollBarRange();
|
|
|
}
|
|
|
|
|
|
int CItemSectionWell::GetSubMenu()
|
|
|
{
|
|
|
int iRMenu = CItemWcsSingleWell::GetSubMenu();
|
|
|
if (iRMenu == 42)
|
|
|
iRMenu = 46; //½«WellPole²Ëµ¥¸ü»»Îª SectionWell²Ëµ¥
|
|
|
return iRMenu;
|
|
|
}
|
|
|
|
|
|
//bool CItemSectionWell::AddTrack()
|
|
|
//{
|
|
|
// //if(NULL != m_pItemWellSection)
|
|
|
// // m_pItemWellSection->SetReUnDoAction();
|
|
|
|
|
|
// return CItemWcsSingleWell::AddTrack();
|
|
|
//}
|
|
|
|
|
|
int CItemSectionWell::DeleteSelection(void)
|
|
|
{
|
|
|
if(GetDrawObj() == NULL)
|
|
|
return 0;
|
|
|
|
|
|
if (m_pItemSelected!=NULL)
|
|
|
{
|
|
|
if (m_WellObjSelectlist.GetCount()>1)
|
|
|
{
|
|
|
delete m_pItemSelected;
|
|
|
CItemWcsTrackIn *pItemTrackIn = new CItemWcsTrackIn(GetDoc());
|
|
|
m_pItemSelected = pItemTrackIn;
|
|
|
POSITION pos = m_WellObjSelectlist.GetHeadPosition();
|
|
|
while(pos!=NULL)
|
|
|
{
|
|
|
CWellBaseObj* pObj = m_WellObjSelectlist.GetNext(pos);
|
|
|
pItemTrackIn->SetDrawObj(pObj);
|
|
|
CWellSection* pSection = (CWellSection*)m_pWell->GetParent();
|
|
|
|
|
|
pItemTrackIn->DeleteSelection();
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
((CItemWellBase*)m_pItemSelected)->DeleteSelection();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
m_pItemWellSection->RemoveWell(m_pWell);
|
|
|
}
|
|
|
m_pItemSelected = NULL;
|
|
|
m_WellObjSelectlist.RemoveAll();
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
BOOL CItemSectionWell::IsAddWell()
|
|
|
{
|
|
|
return m_bAddWell;
|
|
|
}
|
|
|
|
|
|
CWellPole *CItemSectionWell::GetWellObject()
|
|
|
{
|
|
|
return m_pWell;
|
|
|
}
|
|
|
} |