|
|
#include "Stdafx.h"
|
|
|
#include "ItemBend.h"
|
|
|
|
|
|
#include "MultiWellSectionDoc.h"
|
|
|
#include "MultiWellSectionlView.h"
|
|
|
#include "WellPoleLib/WellMarkNamesList.h"
|
|
|
#include "WellPoleLib/WellCommonDef.h"
|
|
|
#include "WellPoleLib/WellBaseObj.h"
|
|
|
#include "WellPoleLib/WellClassObjGroup.h"
|
|
|
#include "WellPoleLib/InTrackDepthSegment.h"
|
|
|
#include "WellPoleLib/InTrackResult.h"
|
|
|
#include "WellPoleLib/InTrackLayerGroup.h"
|
|
|
#include "WellPoleLib/WellPole.h"
|
|
|
#include "MultiWellSectionLib/BendObj.h"
|
|
|
#include "MultiWellSectionLib/FenceBendObj.h"
|
|
|
#include "MultiWellSectionLib/FaultObj.h"
|
|
|
#include "MultiWellSectionLib/SectionWellObj.h"
|
|
|
#include "MultiWellSectionLib/WellSection.h"
|
|
|
#include "MultiWellSectionLib/WellFence.h"
|
|
|
|
|
|
namespace NItem
|
|
|
{
|
|
|
CItemBend::CItemBend(CSigmaDoc* pDoc)
|
|
|
: CItemWellBase(pDoc)
|
|
|
{
|
|
|
SetType(ITEM_BEND);
|
|
|
m_pItemWellSection = NULL;
|
|
|
m_pBend = NULL;
|
|
|
m_SelectCurveMode = CurveNone;
|
|
|
m_bChangeAll = FALSE;
|
|
|
m_bOnLine = FALSE;
|
|
|
|
|
|
m_SelectHandle = 0;
|
|
|
}
|
|
|
|
|
|
CItemBend::~CItemBend(void)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
CBendObj *CItemBend::GetBendObject()
|
|
|
{
|
|
|
return m_pBend/*(CBendObj *)GetDoc()->GetDraw()->GetAtValue(GetPos())*/;
|
|
|
}
|
|
|
|
|
|
|
|
|
void CItemBend::OnLButtonDown(CDC *pDC, UINT nFlags, CPoint point, int vk)
|
|
|
{
|
|
|
m_downPoint = m_firstPoint = m_lastPoint = point;
|
|
|
|
|
|
if(m_pBend != NULL)
|
|
|
{
|
|
|
CPoint2D ptReal = GetDC()->GetReal(point);
|
|
|
CRect8 r(ptReal.x0, ptReal.y0, ptReal.x0, ptReal.y0);
|
|
|
CSize8 sz = GetDoc()->GetSelectSize();
|
|
|
double sx = GetDC()->GetRealWidth(sz.cx);
|
|
|
double sy = fabs(GetDC()->GetRealHeight(sz.cy));
|
|
|
int nHandleSize = HANDLESIZE;
|
|
|
double dHandleSize = GetDC()->GetRealSize(CSize(nHandleSize / 2, nHandleSize / 2)).cx;
|
|
|
r.InflateRect(sx, sy);
|
|
|
CWellSection *pWellSection = (CWellSection*)m_pBend->GetParent();
|
|
|
if (pWellSection->m_bResForm)
|
|
|
{
|
|
|
CurveType newSelectedMode = CurveNone;
|
|
|
if (m_pBend->m_curveBreakLitho.IsInRange(r))
|
|
|
{
|
|
|
if (m_pBend->bPlug)
|
|
|
{
|
|
|
newSelectedMode = CurveBend;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
newSelectedMode = CurveBreakLithoLine;
|
|
|
}
|
|
|
}
|
|
|
else if (m_pBend->IsLayerLineIncludePoint(TRUE, ptReal, dHandleSize / 2))
|
|
|
{
|
|
|
newSelectedMode = CurveTopLine;
|
|
|
}
|
|
|
else if (m_pBend->IsLayerLineIncludePoint(FALSE, ptReal, dHandleSize / 2))
|
|
|
{
|
|
|
newSelectedMode = CurveBotLine;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
newSelectedMode = CurveBend;
|
|
|
}
|
|
|
|
|
|
|
|
|
if (newSelectedMode != m_SelectCurveMode)
|
|
|
{
|
|
|
if (m_SelectCurveMode != CurveNone)
|
|
|
OnDraw_Resform(GetDC(), m_pBend,pDC);
|
|
|
|
|
|
if (m_SelectCurveMode == CurveTopLine || m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
if (m_SelectHandle > 0)
|
|
|
DrawLayerLineSelectHandle(GetDC(), m_SelectCurveMode, nHandleSize,pDC); //<2F><><EFBFBD><EFBFBD><EFBFBD>ϴλ<CFB4><CEBB><EFBFBD>handle״̬<D7B4><CCAC>
|
|
|
}
|
|
|
m_SelectHandle = 0;
|
|
|
nDragHandle = 0;
|
|
|
|
|
|
m_SelectCurveMode = newSelectedMode;
|
|
|
OnDraw_Resform(GetDC(), m_pBend,pDC);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (m_SelectCurveMode == CurveTopLine || m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
BOOL bChangeHandle = FALSE;
|
|
|
if (m_SelectHandle != nDragHandle)
|
|
|
{
|
|
|
if (m_SelectHandle > 0)
|
|
|
DrawLayerLineSelectHandle(GetDC(), m_SelectCurveMode, nHandleSize,pDC); //<2F><><EFBFBD><EFBFBD><EFBFBD>ϴλ<CFB4><CEBB><EFBFBD>handle״̬<D7B4><CCAC>
|
|
|
bChangeHandle = TRUE;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
nDragHandle = HitTestMode(ptReal);
|
|
|
if (nDragHandle == 0)
|
|
|
{
|
|
|
if (m_pBend->m_curveBreakLitho.IsInRange(r))
|
|
|
{
|
|
|
if (m_pBend->bPlug)
|
|
|
{
|
|
|
m_SelectCurveMode = CurveBend;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
m_SelectCurveMode = CurveBreakLithoLine;
|
|
|
}
|
|
|
}
|
|
|
else if (m_pBend->m_curveTop.IsInRange(r))
|
|
|
{
|
|
|
m_SelectCurveMode = CurveTopLine;
|
|
|
}
|
|
|
else if (m_pBend->m_curveBot.IsInRange(r))
|
|
|
{
|
|
|
m_SelectCurveMode = CurveBotLine;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
m_SelectCurveMode = CurveBend;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (nDragHandle!=0)
|
|
|
{
|
|
|
selectMode = ESelectMode::size;
|
|
|
}
|
|
|
}
|
|
|
//ˢ<><CBA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҳ
|
|
|
//CXTPPropertyGrid &grid = GetPropertyGrid(GetDoc()->GetMainFrame());
|
|
|
//InitPropertyGrid(grid);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CItemBend::OnLButtonUp(CDC *pDC, UINT nFlags, CPoint point, int vk)
|
|
|
{
|
|
|
if(m_pBend == NULL)
|
|
|
return;
|
|
|
|
|
|
CWellSection* pWellSection = (CWellSection*)m_pBend->GetParent();
|
|
|
|
|
|
m_firstPoint = m_lastPoint = point;
|
|
|
|
|
|
CPoint2D lastPoint = GetDC()->GetReal(point);
|
|
|
|
|
|
if((m_downPoint.x-m_lastPoint.x)!=0 || (m_downPoint.y-m_lastPoint.y)!=0)
|
|
|
{
|
|
|
if (m_pBend != NULL)
|
|
|
{
|
|
|
if (IsCaptureState())
|
|
|
{
|
|
|
if(m_pItemWellSection != NULL)
|
|
|
SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE,2);
|
|
|
|
|
|
if (selectMode==CItemSelect::size && nDragHandle!=0)
|
|
|
{
|
|
|
CRect8 rectold = m_pBend->GetRect();
|
|
|
rectold.top = pWellSection->GetRect().top;
|
|
|
rectold.bottom = pWellSection->GetRect().bottom;
|
|
|
//<2F><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><F3BDBBBB><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
m_pBend->MoveHandleToTop(nDragHandle, lastPoint);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
m_pBend->MoveHandleToBot(nDragHandle, lastPoint);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
m_pBend->MoveHandleToBreakLitho(nDragHandle, lastPoint);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBend)
|
|
|
{
|
|
|
if (pWellSection->m_bResForm)
|
|
|
{
|
|
|
m_pBend->MoveHandleTo(nDragHandle, lastPoint);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
int count = m_pBend->GetControlCount();
|
|
|
if (nDragHandle > count)
|
|
|
m_pBend->MoveHandleTo(nDragHandle, lastPoint);
|
|
|
else
|
|
|
{
|
|
|
BOOL bInvert0 = FALSE;
|
|
|
BOOL bInvert = FALSE;
|
|
|
int nHandleInvert;
|
|
|
if (nDragHandle == 1)
|
|
|
nHandleInvert = count;
|
|
|
else
|
|
|
nHandleInvert = 1;
|
|
|
|
|
|
if (m_pBend->m_ptBeginBreak.x0 > m_pBend->m_ptEndBreak.x0)
|
|
|
bInvert0 = TRUE;
|
|
|
CPoint2D pt = m_pBend->GetHandleControl(nDragHandle);
|
|
|
int dy = lastPoint.y0 - pt.y0;
|
|
|
CBendObj* pBend = NULL;
|
|
|
POSITION pos = m_WellObjSelectlist.GetHeadPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
pBend = (CBendObj*)m_WellObjSelectlist.GetNext(pos);
|
|
|
|
|
|
if (pBend->m_ptBeginBreak.x0 > pBend->m_ptEndBreak.x0)
|
|
|
bInvert = TRUE;
|
|
|
else
|
|
|
bInvert = FALSE;
|
|
|
|
|
|
if (bInvert0 == bInvert)
|
|
|
{
|
|
|
pt = pBend->GetHandleControl(nDragHandle);
|
|
|
pt.y0 += dy;
|
|
|
pBend->MoveHandleTo(nDragHandle, pt);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
pt = pBend->GetHandleControl(nHandleInvert);
|
|
|
pt.y0 += dy;
|
|
|
pBend->MoveHandleTo(nHandleInvert, pt);
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
CRect8 rect = m_pBend->GetRect();
|
|
|
rect.CombinRect(rectold);
|
|
|
CRect rt = GetDC()->GetScreen(rect);
|
|
|
GetDoc()->Invalidate();// rt);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
ReleaseCapture();
|
|
|
m_bDrag = FALSE;
|
|
|
//nDragHandle = 0;
|
|
|
}
|
|
|
|
|
|
int CItemBend::OnMouseMove(CDC *pDC, UINT nFlags, CPoint point)
|
|
|
{
|
|
|
//if(m_pBend == NULL)
|
|
|
// return;
|
|
|
|
|
|
CPoint2D lastPoint = GetDC()->GetReal(point);
|
|
|
if(IsCaptureState())
|
|
|
{
|
|
|
CWellSection* pWellSection = (CWellSection*)m_pBend->GetParent();
|
|
|
if (pWellSection->m_bResForm)
|
|
|
{
|
|
|
CPoint lpt,rpt;
|
|
|
if (m_pBend->m_pLayerRight != NULL)
|
|
|
{
|
|
|
lpt = GetDC()->GetScreen(m_pBend->m_ptLeft);
|
|
|
rpt = GetDC()->GetScreen(m_pBend->m_ptRight);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
lpt = GetDC()->GetScreen(m_pBend->m_ptBeginBreak);
|
|
|
rpt = GetDC()->GetScreen(m_pBend->m_pointBorder);
|
|
|
}
|
|
|
|
|
|
int maxx = lpt.x > rpt.x ? lpt.x : rpt.x;
|
|
|
int minx = lpt.x < rpt.x ? lpt.x : rpt.x;
|
|
|
if (point.x < minx)
|
|
|
point.x = minx;
|
|
|
if (point.x > maxx)
|
|
|
point.x = maxx;
|
|
|
}
|
|
|
|
|
|
//ˢ<><CBA2>
|
|
|
OnDraw(GetDC() ,pDC);
|
|
|
|
|
|
m_bDrag = TRUE;
|
|
|
m_lastPoint = point;
|
|
|
|
|
|
//ˢ<><CBA2>
|
|
|
OnDraw(GetDC(),pDC);
|
|
|
|
|
|
m_firstPoint = m_lastPoint;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
int nHandleSize= HANDLESIZE;
|
|
|
double dHandleSize = GetDC()->GetRealSize(CSize(nHandleSize/2, nHandleSize/2)).cx;
|
|
|
|
|
|
CBendObj* pBend = NULL;
|
|
|
POSITION pos = m_WellObjSelectlist.GetHeadPosition();
|
|
|
while(pos != NULL)
|
|
|
{
|
|
|
pBend = (CBendObj*)m_WellObjSelectlist.GetNext(pos);
|
|
|
|
|
|
nDragHandle = pBend->HitTest(lastPoint,dHandleSize,TRUE);
|
|
|
if(nDragHandle > 0)
|
|
|
{
|
|
|
m_pBend = pBend;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(nDragHandle == 0)
|
|
|
{
|
|
|
m_bOnLine = FALSE;
|
|
|
CPoint2D ptReal = GetDC()->GetReal(point);
|
|
|
CRect8 rectReal = CRect8(ptReal.x0,ptReal.y0,ptReal.x0,ptReal.y0);
|
|
|
rectReal.InflateRect(dHandleSize,dHandleSize);
|
|
|
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
if(m_pBend->IntersectsTop(rectReal,dHandleSize))
|
|
|
{
|
|
|
m_bOnLine = TRUE;
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
if(m_pBend->IntersectsBot(rectReal,dHandleSize))
|
|
|
{
|
|
|
m_bOnLine = TRUE;
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
if(m_pBend->IntersectsBreakLitho(rectReal,dHandleSize))
|
|
|
{
|
|
|
m_bOnLine = TRUE;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
void CItemBend::OnLButtonDblClk(UINT nFlags, CPoint point)
|
|
|
{
|
|
|
if(m_pBend == NULL)
|
|
|
return;
|
|
|
|
|
|
CWellSection* pWellSection = (CWellSection*)m_pBend->GetParent();
|
|
|
if (nDragHandle!= 0)
|
|
|
{
|
|
|
CRect8 rectold = m_pBend->GetRect();
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
m_pBend->m_ptArrCurveTopOld.RemoveAt(nDragHandle);
|
|
|
m_pBend->m_ptArrCurveTop.RemoveAt(nDragHandle-1);
|
|
|
}
|
|
|
else if(m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
m_pBend->m_ptArrCurveBotOld.RemoveAt(nDragHandle);
|
|
|
m_pBend->m_ptArrCurveBot.RemoveAt(nDragHandle-1);
|
|
|
}
|
|
|
else if(m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
if (nDragHandle != m_pBend->m_curveBreakLithoOld.num && nDragHandle!=1)
|
|
|
{
|
|
|
CPointArr LithoBreakArr;
|
|
|
for (int i = 0;i<m_pBend->m_curveBreakLithoOld.num; i++)
|
|
|
{
|
|
|
dfPoint temppoint;
|
|
|
temppoint.x0 = m_pBend->m_curveBreakLithoOld.x[i];
|
|
|
temppoint.y0 = m_pBend->m_curveBreakLithoOld.y[i];
|
|
|
LithoBreakArr.Add(temppoint);
|
|
|
}
|
|
|
LithoBreakArr.RemoveAt(nDragHandle-1);
|
|
|
m_pBend->m_curveBreakLithoOld.Clear();
|
|
|
m_pBend->m_curveBreakLithoOld.Create(LithoBreakArr.GetCount());
|
|
|
m_pBend->m_curveBreakLithoInteract.Clear();
|
|
|
m_pBend->m_curveBreakLithoInteract.Create(LithoBreakArr.GetCount());
|
|
|
for (int i = 0;i<m_pBend->m_curveBreakLithoOld.num; i++)
|
|
|
{
|
|
|
m_pBend->m_curveBreakLithoOld.x[i]=LithoBreakArr.GetAt(i).x0;
|
|
|
m_pBend->m_curveBreakLithoOld.y[i]=LithoBreakArr.GetAt(i).y0;
|
|
|
m_pBend->m_curveBreakLithoInteract.x[i]=LithoBreakArr.GetAt(i).x0;
|
|
|
m_pBend->m_curveBreakLithoInteract.y[i]=LithoBreakArr.GetAt(i).y0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
m_pBend->CreateBendLines();
|
|
|
m_pBend->CreateBendFills();
|
|
|
|
|
|
CRect8 rect = m_pBend->GetRect();
|
|
|
rect.CombinRect(rectold);
|
|
|
CRect rt = GetDC()->GetScreen(rect);
|
|
|
GetDoc()->Invalidate();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if(m_bOnLine)
|
|
|
{
|
|
|
CRect8 rectold = m_pBend->GetRect();
|
|
|
|
|
|
CPoint2D ptReal = GetDC()->GetReal(point);
|
|
|
dfPoint dp;
|
|
|
dp.x0 = ptReal.x0;
|
|
|
dp.y0 = ptReal.y0;
|
|
|
AddControlPoint(dp);
|
|
|
|
|
|
CRect8 rect = m_pBend->GetRect();
|
|
|
rect.CombinRect(rectold);
|
|
|
CRect rt = GetDC()->GetScreen(rect);
|
|
|
GetDoc()->Invalidate();
|
|
|
}
|
|
|
}
|
|
|
nDragHandle = 0;
|
|
|
}
|
|
|
|
|
|
BOOL CItemBend::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
|
|
|
{
|
|
|
if(nDragHandle!=0)
|
|
|
{
|
|
|
if(m_SelectCurveMode == CurveBend && nDragHandle<=m_pBend->GetControlCount())
|
|
|
SetCursor(AfxGetApp()->LoadCursor(IDC_CROSS));
|
|
|
else
|
|
|
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR_MOVE_HANDLE/*IDC_DRAG_BREAK*/));
|
|
|
|
|
|
return TRUE;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if(m_bOnLine)
|
|
|
{
|
|
|
SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR_ADD_HANDLE));
|
|
|
return TRUE;
|
|
|
}
|
|
|
}
|
|
|
SetCursor(AfxGetApp()->LoadCursor(IDC_UPARROW));
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
BOOL CItemBend::OnSetCursor(CPoint pt, int& handle)
|
|
|
{
|
|
|
if (m_pBend == NULL)
|
|
|
{
|
|
|
return FALSE;
|
|
|
}
|
|
|
CPoint2D ptReal = GetDC()->GetReal(pt);
|
|
|
CWellSection *pWellSection = (CWellSection*)m_pBend->GetParent();
|
|
|
int tHandle = 0;
|
|
|
if (pWellSection->m_bResForm)
|
|
|
{
|
|
|
tHandle = HitTestMode_Resform(ptReal);
|
|
|
}
|
|
|
else
|
|
|
tHandle = HitTestMode(ptReal);
|
|
|
|
|
|
if (tHandle != 0)
|
|
|
{
|
|
|
if (m_SelectCurveMode == CurveBend && nDragHandle <= m_pBend->GetControlCount())
|
|
|
handle = 13;// SetCursor(AfxGetApp()->LoadCursor(IDC_CROSS));
|
|
|
else
|
|
|
handle = 15; //SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR_MOVE_HANDLE/*IDC_DRAG_BREAK*/));
|
|
|
|
|
|
return TRUE;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (tHandle == 0)
|
|
|
{
|
|
|
m_bOnLine = FALSE;
|
|
|
int nHandleSize = HANDLESIZE;
|
|
|
double dHandleSize = GetDC()->GetRealSize(CSize(nHandleSize / 2, nHandleSize / 2)).cx;
|
|
|
CRect8 rectReal = CRect8(ptReal.x0, ptReal.y0, ptReal.x0, ptReal.y0);
|
|
|
rectReal.InflateRect(dHandleSize, dHandleSize);
|
|
|
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
if (m_pBend->IntersectsTop(rectReal, dHandleSize))
|
|
|
{
|
|
|
m_bOnLine = TRUE;
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
if (m_pBend->IntersectsBot(rectReal, dHandleSize))
|
|
|
{
|
|
|
m_bOnLine = TRUE;
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
if (m_pBend->IntersectsBreakLitho(rectReal, dHandleSize))
|
|
|
{
|
|
|
m_bOnLine = TRUE;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (m_bOnLine)
|
|
|
{
|
|
|
handle = 12;//SetCursor(AfxGetApp()->LoadCursor(IDC_CURSOR_ADD_HANDLE));
|
|
|
return TRUE;
|
|
|
}
|
|
|
}
|
|
|
//SetCursor(AfxGetApp()->LoadCursor(IDC_UPARROW));
|
|
|
handle = 14;
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
int CItemBend::GetSubMenu()
|
|
|
{
|
|
|
// <20><>
|
|
|
int iRMenu = 47;
|
|
|
|
|
|
//if(m_pBend == NULL)
|
|
|
//{
|
|
|
// iRMenu = 21;
|
|
|
// return iRMenu;
|
|
|
//}
|
|
|
|
|
|
return iRMenu;
|
|
|
}
|
|
|
|
|
|
void CItemBend::OnDraw_DFPCG(CXyDC* pXyDC, CBendObj* pBend, CDC *pDC)
|
|
|
{
|
|
|
//CDC *pDC = pXyDC->GetDC();
|
|
|
CPen *pOldPen = NULL;
|
|
|
int old = pDC->SetROP2(R2_NOTXORPEN);
|
|
|
|
|
|
CWellSection* pWellSection = (CWellSection*)pBend->GetParent();
|
|
|
//<2F><><EFBFBD><EFBFBD>ק<EFBFBD><D7A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>塢<EFBFBD><E5A1A2><EFBFBD>Ƶ㣩
|
|
|
if (pBend == m_pBend && m_bDrag && m_lastPoint != m_downPoint)
|
|
|
{
|
|
|
if (nDragHandle != 0)//<2F><><EFBFBD>Ƶ<EFBFBD>
|
|
|
{
|
|
|
CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
|
|
|
|
|
|
CPen *pOldPen = (CPen *)pDC->SelectObject(&pen);
|
|
|
CPoint pt;
|
|
|
if (m_SelectCurveMode == CurveTopLine || m_SelectCurveMode == CurveBotLine || m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
CPoint ptNow = m_lastPoint;
|
|
|
CPoint *pPoint = new CPoint[3];
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
//bend<6E><64><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
CPointArr ptTop;
|
|
|
ptTop.Add(m_pBend->m_ptArrCurveTopOld.GetAt(0));
|
|
|
for (int ii = 0; ii < m_pBend->m_ptArrCurveTop.GetCount(); ii++)
|
|
|
{
|
|
|
ptTop.Add(m_pBend->m_ptArrCurveTop.GetAt(ii));
|
|
|
}
|
|
|
if (m_pBend->m_pLayerRight == NULL)
|
|
|
{
|
|
|
ptTop.Add(m_pBend->m_ptEndBreakInteract);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptTop.Add(m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1));
|
|
|
}
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
{
|
|
|
if (i == 1)
|
|
|
{
|
|
|
pPoint[i] = m_lastPoint;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CPoint2D ptTemp;
|
|
|
ptTemp = ptTop.GetAt(nDragHandle + i - 1);
|
|
|
pPoint[i] = pXyDC->GetScreen(ptTemp);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
//bend<6E><64><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
CPointArr ptBot;
|
|
|
ptBot.Add(m_pBend->m_ptArrCurveBotOld.GetAt(0));
|
|
|
for (int ii = 0; ii < m_pBend->m_ptArrCurveBot.GetCount(); ii++)
|
|
|
{
|
|
|
ptBot.Add(m_pBend->m_ptArrCurveBot.GetAt(ii));
|
|
|
}
|
|
|
if (m_pBend->m_pLayerRight == NULL)
|
|
|
{
|
|
|
ptBot.Add(m_pBend->m_ptEndBreakInteract);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptBot.Add(m_pBend->m_ptArrCurveBotOld.GetAt(m_pBend->m_ptArrCurveBotOld.GetCount() - 1));
|
|
|
}
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
{
|
|
|
if (i == 1)
|
|
|
{
|
|
|
pPoint[i] = m_lastPoint;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CPoint2D ptTemp;
|
|
|
ptTemp = ptBot.GetAt(nDragHandle + i - 1);
|
|
|
pPoint[i] = pXyDC->GetScreen(ptTemp);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
if (!m_pBend->bPlug)
|
|
|
{
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
{
|
|
|
if (i == 1)
|
|
|
{
|
|
|
pPoint[i] = m_lastPoint;
|
|
|
for (int kk = 0; kk < m_pBend->m_curveBreakLithoInteract.num; kk++)
|
|
|
{
|
|
|
if (m_pBend->m_curveBreakLithoInteract.x[kk] == m_pBend->GetHandleBreakLitho(nDragHandle).x0&&m_pBend->m_curveBreakLithoInteract.y[kk] == m_pBend->GetHandleBreakLitho(nDragHandle).y0)
|
|
|
{
|
|
|
if (kk == 0 || kk == m_pBend->m_curveBreakLithoInteract.num - 1)//ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵Ķ˵<C4B6><CBB5>϶<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD>
|
|
|
{
|
|
|
if (kk == 0)
|
|
|
{
|
|
|
CPoint2D ptNew = pXyDC->GetReal(m_lastPoint);
|
|
|
if (m_pBend->m_ptArrCurveTopOld.GetAt(0).x0 < m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).x0)
|
|
|
{
|
|
|
if (ptNew.y0 > m_pBend->m_ptArrCurveTopOld.GetAt(0).y0)
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveTopOld.GetAt(0).y0;
|
|
|
}
|
|
|
else if (ptNew.y0 <= m_pBend->m_ptArrCurveTopOld.GetAt(0).y0
|
|
|
&& ptNew.y0 >= m_pBend->m_ptArrCurveBotOld.GetAt(0).y0)
|
|
|
{
|
|
|
//lastPoint.y0 = m_lastPoint.y;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveBotOld.GetAt(0).y0;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (ptNew.y0 > m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0)
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0;
|
|
|
}
|
|
|
else if (ptNew.y0 <= m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0
|
|
|
&& ptNew.y0 >= m_pBend->m_ptArrCurveBotOld.GetAt(m_pBend->m_ptArrCurveBotOld.GetCount() - 1).y0)
|
|
|
{
|
|
|
//lastPoint.y0 = m_lastPoint.y;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveBotOld.GetAt(m_pBend->m_ptArrCurveBotOld.GetCount() - 1).y0;
|
|
|
}
|
|
|
}
|
|
|
ptNew.x0 = m_pBend->m_curveBreakLithoOld.x[kk];
|
|
|
ptNow = pXyDC->GetScreen(ptNew);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//CPoint2D ptNew = GetBreakPt(m_pBend->GetHandle(nDragHandle),&m_pBend->m_curveBotNew);
|
|
|
//ptNow = pXyDC->GetScreen(ptNew);
|
|
|
CPoint2D ptNew = pXyDC->GetReal(m_lastPoint);
|
|
|
if (m_pBend->m_ptArrCurveBotOld.GetAt(0).x0 < m_pBend->m_ptArrCurveBotOld.GetAt(m_pBend->m_ptArrCurveBotOld.GetCount() - 1).x0)
|
|
|
{
|
|
|
if (ptNew.y0 > m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0)
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0;
|
|
|
}
|
|
|
else if (ptNew.y0 <= m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0
|
|
|
&& ptNew.y0 >= m_pBend->m_ptArrCurveBotOld.GetAt(m_pBend->m_ptArrCurveBotOld.GetCount() - 1).y0)
|
|
|
{
|
|
|
//lastPoint.y0 = m_lastPoint.y;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveBotOld.GetAt(m_pBend->m_ptArrCurveBotOld.GetCount() - 1).y0;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (ptNew.y0 > m_pBend->m_ptArrCurveTopOld.GetAt(0).y0)
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveTopOld.GetAt(0).y0;
|
|
|
}
|
|
|
else if (ptNew.y0 <= m_pBend->m_ptArrCurveTopOld.GetAt(0).y0
|
|
|
&& ptNew.y0 >= m_pBend->m_ptArrCurveBotOld.GetAt(0).y0)
|
|
|
{
|
|
|
//lastPoint.y0 = m_lastPoint.y;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveBotOld.GetAt(0).y0;
|
|
|
}
|
|
|
}
|
|
|
ptNew.x0 = m_pBend->m_curveBreakLithoOld.x[kk];
|
|
|
ptNow = pXyDC->GetScreen(ptNew);
|
|
|
}
|
|
|
pPoint[i] = ptNow;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CPoint2D ptTemp;
|
|
|
for (int kk = 0; kk < m_pBend->m_curveBreakLithoInteract.num; kk++)
|
|
|
{
|
|
|
if (m_pBend->m_curveBreakLithoInteract.x[kk] == m_pBend->GetHandleBreakLitho(nDragHandle).x0&&m_pBend->m_curveBreakLithoInteract.y[kk] == m_pBend->GetHandleBreakLitho(nDragHandle).y0)
|
|
|
{
|
|
|
if (kk == 0 || kk == m_pBend->m_curveBreakLithoInteract.num - 1)//ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵Ķ˵<C4B6><CBB5>϶<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD>
|
|
|
{
|
|
|
if (kk == 0)
|
|
|
{
|
|
|
ptTemp.x0 = m_pBend->m_curveBreakLithoInteract.x[kk + 1];
|
|
|
ptTemp.y0 = m_pBend->m_curveBreakLithoInteract.y[kk + 1];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptTemp.x0 = m_pBend->m_curveBreakLithoInteract.x[kk - 1];
|
|
|
ptTemp.y0 = m_pBend->m_curveBreakLithoInteract.y[kk - 1];
|
|
|
}
|
|
|
if (i == 2)
|
|
|
{
|
|
|
ptTemp = pXyDC->GetReal(pPoint[1]);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptTemp.x0 = m_pBend->m_curveBreakLithoInteract.x[i + kk - 1];
|
|
|
ptTemp.y0 = m_pBend->m_curveBreakLithoInteract.y[i + kk - 1];
|
|
|
}
|
|
|
pPoint[i] = pXyDC->GetScreen(ptTemp);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
pDC->Polyline(pPoint, 3);
|
|
|
delete[]pPoint;
|
|
|
pPoint = NULL;
|
|
|
//<2F><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD>Ƶ<EFBFBD>
|
|
|
pt = ptNow;
|
|
|
int nHandleSize = HANDLESIZE;
|
|
|
CRect rect(pt.x - nHandleSize / 2, pt.y - nHandleSize / 2, pt.x + nHandleSize / 2, pt.y + nHandleSize / 2);
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
else if (/*m_pBend->m_pLayerRight==NULL&&*/m_SelectCurveMode == CurveBend)
|
|
|
{
|
|
|
pt = pXyDC->GetScreen(m_pBend->GetHandleControl(nDragHandle));
|
|
|
|
|
|
if (nDragHandle <= m_pBend->GetControlCount()) //<2F><><EFBFBD>м<EFBFBD><D0BC><EFBFBD><EFBFBD>Ƶ<EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>
|
|
|
{
|
|
|
CPoint2D lastpt = pXyDC->GetReal(m_lastPoint);
|
|
|
dfPoint point, pointBegin, pointEnd;
|
|
|
CPointList ptlist;
|
|
|
|
|
|
pointBegin.x0 = m_pBend->m_ptBeginBreak.x0;
|
|
|
pointBegin.y0 = m_pBend->m_pLayerLeft->GetPosition().CenterPoint().y0;
|
|
|
|
|
|
pointEnd = m_pBend->m_ptEndBreak;
|
|
|
if (m_pBend->m_pLayerRight != NULL)
|
|
|
pointEnd.y0 = m_pBend->m_pLayerRight->GetPosition().CenterPoint().y0;
|
|
|
|
|
|
for (int i = 1; i <= m_pBend->GetControlCount(); i++)
|
|
|
{
|
|
|
point.x0 = m_pBend->GetHandleControl(i).x0;
|
|
|
point.y0 = m_pBend->GetHandleControl(i).y0;
|
|
|
if (i == nDragHandle)
|
|
|
{
|
|
|
point.y0 = lastpt.y0;
|
|
|
pt.y = m_lastPoint.y;
|
|
|
}
|
|
|
//else if(i == 2)
|
|
|
//{
|
|
|
// point.y0 = (pointBegin.y0+pointEnd.y0)/2;
|
|
|
//}
|
|
|
ptlist.AddTail(point);
|
|
|
}
|
|
|
|
|
|
ptlist.AddHead(pointBegin);
|
|
|
if (m_pBend->m_pLayerRight != NULL)
|
|
|
{
|
|
|
ptlist.AddTail(pointEnd);
|
|
|
}
|
|
|
|
|
|
CCurveEx cu;
|
|
|
cu.SetPoints(ptlist, ptlist.GetCount());
|
|
|
ptlist.RemoveAll();
|
|
|
cu.CurveToSpline(ptlist, pXyDC->GetMiniSmoothStep() * 3, 0);
|
|
|
|
|
|
dfPoint dp1 = ptlist.GetHead();
|
|
|
POSITION pos = ptlist.GetHeadPosition();
|
|
|
if (pos) ptlist.GetNext(pos);
|
|
|
while (pos)
|
|
|
{
|
|
|
dfPoint dp2 = ptlist.GetNext(pos);
|
|
|
pXyDC->MoveTo(dp1);
|
|
|
pXyDC->LineTo(dp2);
|
|
|
|
|
|
dp1 = dp2;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
pDC->MoveTo(pt);
|
|
|
pt = m_lastPoint;
|
|
|
pDC->LineTo(pt);
|
|
|
}
|
|
|
//<2F><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD>Ƶ<EFBFBD>
|
|
|
int nHandleSize = HANDLESIZE;
|
|
|
CRect rect(pt.x - nHandleSize / 2, pt.y - nHandleSize / 2, pt.x + nHandleSize / 2, pt.y + nHandleSize / 2);
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
pDC->SelectObject(pOldPen);
|
|
|
pen.DeleteObject();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//<2F><>ѡ<EFBFBD><D1A1>״̬
|
|
|
if (!m_bDrag || m_firstPoint == m_downPoint)
|
|
|
{
|
|
|
CRect rect;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>
|
|
|
CPoint2D point;
|
|
|
CPoint pt;
|
|
|
|
|
|
CPen pen;
|
|
|
pen.CreatePen(PS_SOLID, 2, RGB(200, 0, 0));
|
|
|
pOldPen = pDC->SelectObject(&pen);
|
|
|
int nHandleSize = HANDLESIZE;// ::GetPreferences().WorkaroundHandle.m_nHandleSize;
|
|
|
if (m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
if (!pBend->bPlug)
|
|
|
{
|
|
|
BOOL bleft;
|
|
|
BOOL bright;
|
|
|
CString strLeft;
|
|
|
CString strRight;
|
|
|
BOOL bleftResult = FALSE;
|
|
|
BOOL brightResult = FALSE;
|
|
|
CString strleftResult;
|
|
|
CString strrightResult;
|
|
|
if (pBend->m_pLayerLeft->GetType() == KEP_RESULT)
|
|
|
{
|
|
|
CInTrackResult* pLayerLeft = (CInTrackResult*)pBend->m_pLayerLeft;
|
|
|
CInTrackResult* pLayerRight = (CInTrackResult*)pBend->m_pLayerRight;
|
|
|
bleft = pLayerLeft->m_strLitho.IsEmpty();
|
|
|
strLeft = pLayerLeft->m_strLitho;
|
|
|
bleftResult = pLayerLeft->m_strResult.IsEmpty();
|
|
|
strleftResult = pLayerLeft->m_strResult;
|
|
|
if (pLayerRight != NULL)
|
|
|
{
|
|
|
bright = pLayerRight->m_strLitho.IsEmpty();
|
|
|
strRight = pLayerRight->m_strLitho;
|
|
|
brightResult = pLayerRight->m_strResult.IsEmpty();
|
|
|
strrightResult = pLayerRight->m_strResult;
|
|
|
}
|
|
|
}
|
|
|
else if (pBend->m_pLayerLeft->GetType() == KEP_LAYERGROUP)
|
|
|
{
|
|
|
CInTrackLayerGroup* pLayerLeft = (CInTrackLayerGroup*)pBend->m_pLayerLeft;
|
|
|
CInTrackLayerGroup* pLayerRight = (CInTrackLayerGroup*)pBend->m_pLayerRight;
|
|
|
bleft = pLayerLeft->m_strLitho.IsEmpty();
|
|
|
strLeft = pLayerLeft->m_strLitho;
|
|
|
if (pLayerRight != NULL)
|
|
|
{
|
|
|
bright = pLayerRight->m_strLitho.IsEmpty();
|
|
|
strRight = pLayerRight->m_strLitho;
|
|
|
}
|
|
|
}
|
|
|
if ((strLeft != strRight/* && !bleft && !bright*/) || (strleftResult != strrightResult/* && !bleftResult && !brightResult*/))
|
|
|
{
|
|
|
int num = pBend->m_curveBreakLitho.num;
|
|
|
CPoint *pts = new CPoint[num];
|
|
|
for (int ii = 0; ii < num; ii++)
|
|
|
{
|
|
|
point.x0 = pBend->m_curveBreakLitho.x[ii];
|
|
|
point.y0 = pBend->m_curveBreakLitho.y[ii];
|
|
|
pts[ii] = pXyDC->GetScreen(point);
|
|
|
}
|
|
|
pDC->Polyline(pts, num);
|
|
|
delete[]pts;
|
|
|
dfPoint dfpoint1;
|
|
|
for (int kk = 0; kk < pBend->m_curveBreakLithoInteract.num; kk++)
|
|
|
{
|
|
|
dfpoint1.x0 = pBend->m_curveBreakLithoInteract.x[kk];
|
|
|
dfpoint1.y0 = pBend->m_curveBreakLithoInteract.y[kk];
|
|
|
pt = pXyDC->GetScreen(dfpoint1);
|
|
|
rect = CRect(pt.x - nHandleSize / 2, pt.y - nHandleSize / 2, pt.x + nHandleSize / 2, pt.y + nHandleSize / 2);
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
int num = pBend->m_curveTop.num;
|
|
|
CPoint *pts = new CPoint[num];
|
|
|
for (int ii = 0; ii < num; ii++)
|
|
|
{
|
|
|
point.x0 = pBend->m_curveTop.x[ii];
|
|
|
point.y0 = pBend->m_curveTop.y[ii];
|
|
|
pts[ii] = pXyDC->GetScreen(point);
|
|
|
}
|
|
|
pDC->Polyline(pts, num);
|
|
|
delete[]pts;
|
|
|
|
|
|
|
|
|
|
|
|
for (int kk = 0; kk < pBend->m_ptArrCurveTop.GetCount(); kk++)
|
|
|
{
|
|
|
pt = pXyDC->GetScreen(pBend->m_ptArrCurveTop.GetAt(kk));
|
|
|
rect = CRect(pt.x - nHandleSize / 2, pt.y - nHandleSize / 2, pt.x + nHandleSize / 2, pt.y + nHandleSize / 2);
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
int num = pBend->m_curveBot.num;
|
|
|
CPoint *pts = new CPoint[num];
|
|
|
for (int ii = 0; ii < num; ii++)
|
|
|
{
|
|
|
point.x0 = pBend->m_curveBot.x[ii];
|
|
|
point.y0 = pBend->m_curveBot.y[ii];
|
|
|
pts[ii] = pXyDC->GetScreen(point);
|
|
|
}
|
|
|
pDC->Polyline(pts, num);
|
|
|
delete[]pts;
|
|
|
|
|
|
{
|
|
|
for (int kk = 0; kk < pBend->m_ptArrCurveBot.GetCount(); kk++)
|
|
|
{
|
|
|
pt = pXyDC->GetScreen(pBend->m_ptArrCurveBot.GetAt(kk));
|
|
|
rect = CRect(pt.x - nHandleSize / 2, pt.y - nHandleSize / 2, pt.x + nHandleSize / 2, pt.y + nHandleSize / 2);
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//////////////////////////////////////////////////////////ѡ<><D1A1>bend<6E><64>λ<EFBFBD><CEBB>
|
|
|
else if (m_SelectCurveMode == CurveBend)
|
|
|
{
|
|
|
int num = pBend->m_curveTop.num;
|
|
|
CPoint *pts = new CPoint[num];
|
|
|
for (int ii = 0; ii < num; ii++)
|
|
|
{
|
|
|
point.x0 = pBend->m_curveTop.x[ii];
|
|
|
point.y0 = pBend->m_curveTop.y[ii];
|
|
|
pts[ii] = pXyDC->GetScreen(point);
|
|
|
}
|
|
|
pDC->Polyline(pts, num);
|
|
|
delete[]pts;
|
|
|
|
|
|
num = pBend->m_curveBot.num;
|
|
|
pts = new CPoint[num];
|
|
|
for (int ii = 0; ii < num; ii++)
|
|
|
{
|
|
|
point.x0 = pBend->m_curveBot.x[ii];
|
|
|
point.y0 = pBend->m_curveBot.y[ii];
|
|
|
pts[ii] = pXyDC->GetScreen(point);
|
|
|
}
|
|
|
pDC->Polyline(pts, num);
|
|
|
delete[]pts;
|
|
|
|
|
|
//bend<6E><64>ѡ<EFBFBD><D1A1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>
|
|
|
int nHandleCount = pBend->GetControlCount();
|
|
|
CBrush brush;
|
|
|
brush.CreateSolidBrush(RGB(0, 0, 255));
|
|
|
|
|
|
if (m_pItemWellSection->GetWellSection()->IsStratumSmooth())
|
|
|
{
|
|
|
CBrush* pOldBrush = pDC->SelectObject(&brush);
|
|
|
|
|
|
/*CPoint **/pts = new CPoint[4];
|
|
|
int nHandleSize = HANDLESIZE;// ::GetPreferences().WorkaroundHandle.m_nHandleSize;
|
|
|
for (int i = 1; i <= 2; i++)
|
|
|
{
|
|
|
point = pBend->GetHandleControl(i);
|
|
|
pt = pXyDC->GetScreen(point);
|
|
|
rect = CRect(pt.x - nHandleSize / 2, pt.y - nHandleSize / 2, pt.x + nHandleSize / 2, pt.y + nHandleSize / 2);
|
|
|
pts[0].x = rect.CenterPoint().x;
|
|
|
pts[0].y = rect.CenterPoint().y - rect.Height() / 2;
|
|
|
pts[1].x = rect.CenterPoint().x + rect.Width() / 2;
|
|
|
pts[1].y = rect.CenterPoint().y;
|
|
|
pts[2].x = rect.CenterPoint().x;
|
|
|
pts[2].y = rect.CenterPoint().y + rect.Height() / 2;
|
|
|
pts[3].x = rect.CenterPoint().x - rect.Width() / 2;
|
|
|
pts[3].y = rect.CenterPoint().y;
|
|
|
pDC->Polygon(pts, 4);
|
|
|
}
|
|
|
delete[]pts;
|
|
|
pDC->SelectObject(pOldBrush);
|
|
|
}
|
|
|
|
|
|
brush.DeleteObject();
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if (pBend->m_pLayerRight == NULL)
|
|
|
{
|
|
|
point = pBend->GetHandleControl(nHandleCount + 1);
|
|
|
pt = pXyDC->GetScreen(point);
|
|
|
rect = CRect(pt.x - nHandleSize / 2, pt.y - nHandleSize / 2, pt.x + nHandleSize / 2, pt.y + nHandleSize / 2);
|
|
|
brush.CreateSolidBrush(RGB(0, 255, 0));
|
|
|
CBrush* pOldBrush = pDC->SelectObject(&brush);
|
|
|
pDC->Ellipse(rect);
|
|
|
pDC->SelectObject(pOldBrush);
|
|
|
brush.DeleteObject();
|
|
|
}
|
|
|
}
|
|
|
pDC->SelectObject(pOldPen);
|
|
|
pen.DeleteObject();
|
|
|
|
|
|
pDC->SetROP2(old);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CItemBend::DrawDragLayerLinePt(CXyDC* pXyDC, CPointArr& linePtArr, int nHandleSize, int nHandle, CPoint ptNow, CDC *pDC)
|
|
|
{
|
|
|
int pid = nHandle - 1;
|
|
|
if (pid <1 || pid >= (linePtArr.GetSize()-1))
|
|
|
return;
|
|
|
|
|
|
vector<dfPoint> pts;
|
|
|
pts.resize(linePtArr.GetSize());
|
|
|
for (int ii = 0; ii < linePtArr.GetSize(); ii++)
|
|
|
pts[ii] = linePtArr[ii];
|
|
|
|
|
|
if (m_pBend->m_pLayerRight == NULL)
|
|
|
{
|
|
|
pts[pts.size() - 1] = m_pBend->m_ptEndBreakInteract;
|
|
|
}
|
|
|
|
|
|
//CDC* pDC = pXyDC->GetDC();
|
|
|
//CPoint pt = pXyDC->GetScreen(linePtArr.GetAt(pid));
|
|
|
|
|
|
CPoint pt1, pt2;
|
|
|
int bid = pid % 4;//<2F><>һ<EFBFBD>α<EFBFBD><CEB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>λ<EFBFBD><CEBB>
|
|
|
if (bid == 0)//<2F><>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>ŵ<EFBFBD><C5B5><EFBFBD>4<EFBFBD><34>һ<EFBFBD><D2BB><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>ߣ<EFBFBD>ǰһ<C7B0><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>ͺ<EFBFBD>һ<EFBFBD>εĵ<CEB5>һ<EFBFBD><D2BB><EFBFBD>غ<EFBFBD>
|
|
|
{
|
|
|
pt1 = pXyDC->GetScreen(pts[pid - 2 ]);
|
|
|
pt2 = pXyDC->GetScreen(pts[pid + 1]);
|
|
|
pDC->MoveTo(ptNow); pDC->LineTo(pt1);
|
|
|
pDC->MoveTo(ptNow); pDC->LineTo(pt2);
|
|
|
}
|
|
|
else if (bid == 3)
|
|
|
{
|
|
|
pt1 = pXyDC->GetScreen(pts[pid - 1]);
|
|
|
pt2 = pXyDC->GetScreen(pts[pid + 2]);
|
|
|
pDC->MoveTo(ptNow); pDC->LineTo(pt1);
|
|
|
pDC->MoveTo(ptNow); pDC->LineTo(pt2);
|
|
|
}
|
|
|
else if (bid == 1)
|
|
|
{
|
|
|
pt1 = pXyDC->GetScreen(pts[pid - 1]);
|
|
|
pDC->MoveTo(ptNow); pDC->LineTo(pt1);
|
|
|
}
|
|
|
else if (bid == 2)
|
|
|
{
|
|
|
pt2 = pXyDC->GetScreen(pts[pid + 1]);
|
|
|
pDC->MoveTo(ptNow); pDC->LineTo(pt2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CItemBend::DrawLayerLine(CXyDC* pXyDC, CPointArr& linePtArr, int nHandleSize, CDC *pDC)
|
|
|
{
|
|
|
//CDC* pDC = pXyDC->GetDC();
|
|
|
CRect rect;
|
|
|
CPoint pt;
|
|
|
std::vector<CPoint> spoints;
|
|
|
spoints.resize(linePtArr.GetCount());
|
|
|
for (int kk = 0; kk < linePtArr.GetCount(); kk++)
|
|
|
{
|
|
|
pt = pXyDC->GetScreen(linePtArr.GetAt(kk));
|
|
|
spoints[kk] = pt;
|
|
|
}
|
|
|
if (m_pBend->m_pLayerRight == NULL)
|
|
|
{
|
|
|
pt = pXyDC->GetScreen(m_pBend->m_ptEndBreakInteract);
|
|
|
spoints[spoints.size() - 1] = pt;
|
|
|
}
|
|
|
int thSize = nHandleSize / 2.0;
|
|
|
int gnum = int(spoints.size() / 4);
|
|
|
|
|
|
CPoint pt1, pt2, pt3, pt4;
|
|
|
for (int i = 0; i < gnum; i++)
|
|
|
{
|
|
|
pt1 = spoints[i * 4]; pt2 = spoints[i * 4 + 1]; pt3 = spoints[i * 4 + 2]; pt4 = spoints[i * 4 + 3];
|
|
|
pDC->MoveTo(pt1); pDC->LineTo(pt2);
|
|
|
pDC->MoveTo(pt3); pDC->LineTo(pt4);
|
|
|
|
|
|
for (int j = 0; j < 4; j++)
|
|
|
{
|
|
|
pt = spoints[i * 4 + j];
|
|
|
if (!(i != 0 && j == 0))//<2F><>һ<EFBFBD>α<EFBFBD><CEB1><EFBFBD><EFBFBD><EFBFBD><DFBB>ĸ<EFBFBD><C4B8>㣬<EFBFBD><E3A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD>㲻<EFBFBD>û<EFBFBD>
|
|
|
{
|
|
|
rect = CRect(pt.x - thSize, pt.y - thSize, pt.x + thSize, pt.y + thSize);
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void CItemBend::OnDraw_Resform(CXyDC* pXyDC, CBendObj* pBend, CDC *pDC)
|
|
|
{
|
|
|
//CDC *pDC = pXyDC->GetDC();
|
|
|
CPen *pOldPen = NULL;
|
|
|
int old = pDC->SetROP2(R2_NOTXORPEN);
|
|
|
|
|
|
// CBendObj* pBend = (CBendObj*)m_WellObjSelectlist.GetNext(pos);
|
|
|
CWellSection* pWellSection = (CWellSection*)pBend->GetParent();
|
|
|
//<2F><><EFBFBD><EFBFBD>ק<EFBFBD><D7A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>塢<EFBFBD><E5A1A2><EFBFBD>Ƶ㣩
|
|
|
if (pBend == m_pBend && m_bDrag && m_lastPoint != m_downPoint)
|
|
|
{
|
|
|
if (nDragHandle != 0)//<2F><><EFBFBD>Ƶ<EFBFBD>
|
|
|
{
|
|
|
CPen pen(PS_SOLID, 1, RGB(255, 0, 0));
|
|
|
int nHandleSize = HANDLESIZE;// ::GetPreferences().WorkaroundHandle.m_nHandleSize;
|
|
|
CPen *pOldPen = (CPen *)pDC->SelectObject(&pen);
|
|
|
CPoint pt;
|
|
|
if (m_SelectCurveMode == CurveTopLine || m_SelectCurveMode == CurveBotLine || m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
CPoint ptNow = m_lastPoint;
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
DrawDragLayerLinePt(pXyDC, m_pBend->m_ptArrCurveTop, nHandleSize, nDragHandle,ptNow,pDC);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
DrawDragLayerLinePt(pXyDC, m_pBend->m_ptArrCurveBot, nHandleSize, nDragHandle, ptNow,pDC);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
if (!m_pBend->bPlug)
|
|
|
{
|
|
|
CPoint* pPoint = new CPoint[3];
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
{
|
|
|
if (i == 1)
|
|
|
{
|
|
|
pPoint[i] = m_lastPoint;
|
|
|
for (int kk = 0; kk < m_pBend->m_curveBreakLithoInteract.num; kk++)
|
|
|
{
|
|
|
if (m_pBend->m_curveBreakLithoInteract.x[kk] == m_pBend->GetHandleBreakLitho(nDragHandle).x0&&m_pBend->m_curveBreakLithoInteract.y[kk] == m_pBend->GetHandleBreakLitho(nDragHandle).y0)
|
|
|
{
|
|
|
if (kk == 0 || kk == m_pBend->m_curveBreakLithoInteract.num - 1)//ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵Ķ˵<C4B6><CBB5>϶<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD>
|
|
|
{
|
|
|
if (kk == 0)
|
|
|
{
|
|
|
CPoint2D ptNew = pXyDC->GetReal(m_lastPoint);
|
|
|
if (m_pBend->m_ptArrCurveTopOld.GetAt(0).x0 < m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).x0)
|
|
|
{
|
|
|
if (ptNew.y0 > m_pBend->m_ptArrCurveTopOld.GetAt(0).y0)
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveTopOld.GetAt(0).y0;
|
|
|
}
|
|
|
else if (ptNew.y0 <= m_pBend->m_ptArrCurveTopOld.GetAt(0).y0
|
|
|
&& ptNew.y0 >= m_pBend->m_ptArrCurveBotOld.GetAt(0).y0)
|
|
|
{
|
|
|
//lastPoint.y0 = m_lastPoint.y;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveBotOld.GetAt(0).y0;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (ptNew.y0 > m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0)
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0;
|
|
|
}
|
|
|
else if (ptNew.y0 <= m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0
|
|
|
&& ptNew.y0 >= m_pBend->m_ptArrCurveBotOld.GetAt(m_pBend->m_ptArrCurveBotOld.GetCount() - 1).y0)
|
|
|
{
|
|
|
//lastPoint.y0 = m_lastPoint.y;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveBotOld.GetAt(m_pBend->m_ptArrCurveBotOld.GetCount() - 1).y0;
|
|
|
}
|
|
|
}
|
|
|
ptNew.x0 = m_pBend->m_curveBreakLithoOld.x[kk];
|
|
|
ptNow = pXyDC->GetScreen(ptNew);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//CPoint2D ptNew = GetBreakPt(m_pBend->GetHandle(nDragHandle),&m_pBend->m_curveBotNew);
|
|
|
//ptNow = pXyDC->GetScreen(ptNew);
|
|
|
CPoint2D ptNew = pXyDC->GetReal(m_lastPoint);
|
|
|
if (m_pBend->m_ptArrCurveBotOld.GetAt(0).x0 < m_pBend->m_ptArrCurveBotOld.GetAt(m_pBend->m_ptArrCurveBotOld.GetCount() - 1).x0)
|
|
|
{
|
|
|
if (ptNew.y0 > m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0)
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0;
|
|
|
}
|
|
|
else if (ptNew.y0 <= m_pBend->m_ptArrCurveTopOld.GetAt(m_pBend->m_ptArrCurveTopOld.GetCount() - 1).y0
|
|
|
&& ptNew.y0 >= m_pBend->m_ptArrCurveBotOld.GetAt(m_pBend->m_ptArrCurveBotOld.GetCount() - 1).y0)
|
|
|
{
|
|
|
//lastPoint.y0 = m_lastPoint.y;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveBotOld.GetAt(m_pBend->m_ptArrCurveBotOld.GetCount() - 1).y0;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (ptNew.y0 > m_pBend->m_ptArrCurveTopOld.GetAt(0).y0)
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveTopOld.GetAt(0).y0;
|
|
|
}
|
|
|
else if (ptNew.y0 <= m_pBend->m_ptArrCurveTopOld.GetAt(0).y0
|
|
|
&& ptNew.y0 >= m_pBend->m_ptArrCurveBotOld.GetAt(0).y0)
|
|
|
{
|
|
|
//lastPoint.y0 = m_lastPoint.y;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptNew.y0 = m_pBend->m_ptArrCurveBotOld.GetAt(0).y0;
|
|
|
}
|
|
|
}
|
|
|
ptNew.x0 = m_pBend->m_curveBreakLithoOld.x[kk];
|
|
|
ptNow = pXyDC->GetScreen(ptNew);
|
|
|
}
|
|
|
pPoint[i] = ptNow;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
CPoint2D ptTemp;
|
|
|
for (int kk = 0; kk < m_pBend->m_curveBreakLithoInteract.num; kk++)
|
|
|
{
|
|
|
if (m_pBend->m_curveBreakLithoInteract.x[kk] == m_pBend->GetHandleBreakLitho(nDragHandle).x0&&m_pBend->m_curveBreakLithoInteract.y[kk] == m_pBend->GetHandleBreakLitho(nDragHandle).y0)
|
|
|
{
|
|
|
if (kk == 0 || kk == m_pBend->m_curveBreakLithoInteract.num - 1)//ʹ<><CAB9><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˵Ķ˵<C4B6><CBB5>϶<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غ<EFBFBD>
|
|
|
{
|
|
|
if (kk == 0)
|
|
|
{
|
|
|
ptTemp.x0 = m_pBend->m_curveBreakLithoInteract.x[kk + 1];
|
|
|
ptTemp.y0 = m_pBend->m_curveBreakLithoInteract.y[kk + 1];
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptTemp.x0 = m_pBend->m_curveBreakLithoInteract.x[kk - 1];
|
|
|
ptTemp.y0 = m_pBend->m_curveBreakLithoInteract.y[kk - 1];
|
|
|
}
|
|
|
if (i == 2)
|
|
|
{
|
|
|
ptTemp = pXyDC->GetReal(pPoint[1]);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ptTemp.x0 = m_pBend->m_curveBreakLithoInteract.x[i + kk - 1];
|
|
|
ptTemp.y0 = m_pBend->m_curveBreakLithoInteract.y[i + kk - 1];
|
|
|
}
|
|
|
pPoint[i] = pXyDC->GetScreen(ptTemp);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
pDC->Polyline(pPoint, 3);
|
|
|
delete[]pPoint;
|
|
|
pPoint = NULL;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD>Ƶ<EFBFBD>
|
|
|
pt = ptNow;
|
|
|
|
|
|
CRect rect(pt.x - nHandleSize / 2, pt.y - nHandleSize / 2, pt.x + nHandleSize / 2, pt.y + nHandleSize / 2);
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
if (nDragHandle < pBend->GetTopCount())
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
if (nDragHandle < pBend->GetBotCount())
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
else
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
else if (/*m_pBend->m_pLayerRight==NULL&&*/m_SelectCurveMode == CurveBend)
|
|
|
{
|
|
|
if (nDragHandle == 2)
|
|
|
{
|
|
|
pDC->MoveTo(pXyDC->GetScreen(m_pBend->GetHandleControl(1)));
|
|
|
pDC->LineTo(m_lastPoint);
|
|
|
}
|
|
|
else if (nDragHandle == 3)
|
|
|
{
|
|
|
pDC->MoveTo(pXyDC->GetScreen(m_pBend->GetHandleControl(4)));
|
|
|
pDC->LineTo(m_lastPoint);
|
|
|
}
|
|
|
else if (nDragHandle == 5)
|
|
|
{
|
|
|
if (m_pBend->m_pLayerRight == NULL)
|
|
|
{
|
|
|
pt = pXyDC->GetScreen(m_pBend->m_ptEndBreakInteract);
|
|
|
pDC->MoveTo(pt);
|
|
|
pDC->LineTo(m_lastPoint);
|
|
|
|
|
|
CPoint2D endPt = m_pBend->GetPinchOutPointToWellPoint(pXyDC->GetReal(m_lastPoint));
|
|
|
CPoint endCpt = pXyDC->GetScreen(endPt);
|
|
|
|
|
|
CPoint ptBegin = pXyDC->GetScreen(m_pBend->m_ptBeginBreak);
|
|
|
pDC->MoveTo(ptBegin);
|
|
|
pDC->LineTo(endCpt);
|
|
|
|
|
|
int nHandleSize = HANDLESIZE;// ::GetPreferences().WorkaroundHandle.m_nHandleSize;
|
|
|
CRect rect(endCpt.x - nHandleSize / 2, endCpt.y - nHandleSize / 2, endCpt.x + nHandleSize / 2, endCpt.y + nHandleSize / 2);
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//<2F><><EFBFBD>϶<EFBFBD><CFB6><EFBFBD><EFBFBD>Ƶ<EFBFBD>
|
|
|
int nHandleSize = HANDLESIZE;// ::GetPreferences().WorkaroundHandle.m_nHandleSize;
|
|
|
CRect rect(m_lastPoint.x - nHandleSize / 2, m_lastPoint.y - nHandleSize / 2, m_lastPoint.x + nHandleSize / 2, m_lastPoint.y + nHandleSize / 2);
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
pDC->SelectObject(pOldPen);
|
|
|
pen.DeleteObject();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//<2F><>ѡ<EFBFBD><D1A1>״̬
|
|
|
if (!m_bDrag || m_firstPoint == m_downPoint)
|
|
|
{
|
|
|
CRect rect;
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>
|
|
|
CPoint2D point;
|
|
|
CPoint pt;
|
|
|
|
|
|
CPen pen;
|
|
|
pen.CreatePen(PS_SOLID, 1, RGB(0, 150, 0));
|
|
|
pOldPen = pDC->SelectObject(&pen);
|
|
|
int nHandleSize = HANDLESIZE;// ::GetPreferences().WorkaroundHandle.m_nHandleSize;
|
|
|
if (m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
if (!pBend->bPlug)
|
|
|
{
|
|
|
BOOL bleft;
|
|
|
BOOL bright;
|
|
|
CString strLeft;
|
|
|
CString strRight;
|
|
|
BOOL bleftResult = FALSE;
|
|
|
BOOL brightResult = FALSE;
|
|
|
CString strleftResult;
|
|
|
CString strrightResult;
|
|
|
if (pBend->m_pLayerLeft->GetType() == KEP_RESULT)
|
|
|
{
|
|
|
CInTrackResult* pLayerLeft = (CInTrackResult*)pBend->m_pLayerLeft;
|
|
|
CInTrackResult* pLayerRight = (CInTrackResult*)pBend->m_pLayerRight;
|
|
|
bleft = pLayerLeft->m_strLitho.IsEmpty();
|
|
|
strLeft = pLayerLeft->m_strLitho;
|
|
|
bleftResult = pLayerLeft->m_strResult.IsEmpty();
|
|
|
strleftResult = pLayerLeft->m_strResult;
|
|
|
if (pLayerRight != NULL)
|
|
|
{
|
|
|
bright = pLayerRight->m_strLitho.IsEmpty();
|
|
|
strRight = pLayerRight->m_strLitho;
|
|
|
brightResult = pLayerRight->m_strResult.IsEmpty();
|
|
|
strrightResult = pLayerRight->m_strResult;
|
|
|
}
|
|
|
}
|
|
|
else if (pBend->m_pLayerLeft->GetType() == KEP_LAYERGROUP)
|
|
|
{
|
|
|
CInTrackLayerGroup* pLayerLeft = (CInTrackLayerGroup*)pBend->m_pLayerLeft;
|
|
|
CInTrackLayerGroup* pLayerRight = (CInTrackLayerGroup*)pBend->m_pLayerRight;
|
|
|
bleft = pLayerLeft->m_strLitho.IsEmpty();
|
|
|
strLeft = pLayerLeft->m_strLitho;
|
|
|
if (pLayerRight != NULL)
|
|
|
{
|
|
|
bright = pLayerRight->m_strLitho.IsEmpty();
|
|
|
strRight = pLayerRight->m_strLitho;
|
|
|
}
|
|
|
}
|
|
|
if ((strLeft != strRight/* && !bleft && !bright*/) || (strleftResult != strrightResult/* && !bleftResult && !brightResult*/))
|
|
|
{
|
|
|
int num = pBend->m_curveBreakLitho.num;
|
|
|
CPoint *pts = new CPoint[num];
|
|
|
for (int ii = 0; ii < num; ii++)
|
|
|
{
|
|
|
point.x0 = pBend->m_curveBreakLitho.x[ii];
|
|
|
point.y0 = pBend->m_curveBreakLitho.y[ii];
|
|
|
pts[ii] = pXyDC->GetScreen(point);
|
|
|
}
|
|
|
pDC->Polyline(pts, num);
|
|
|
delete[]pts;
|
|
|
dfPoint dfpoint1;
|
|
|
for (int kk = 0; kk < pBend->m_curveBreakLithoInteract.num; kk++)
|
|
|
{
|
|
|
dfpoint1.x0 = pBend->m_curveBreakLithoInteract.x[kk];
|
|
|
dfpoint1.y0 = pBend->m_curveBreakLithoInteract.y[kk];
|
|
|
pt = pXyDC->GetScreen(dfpoint1);
|
|
|
rect = CRect(pt.x - nHandleSize / 2, pt.y - nHandleSize / 2, pt.x + nHandleSize / 2, pt.y + nHandleSize / 2);
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
int num = pBend->m_curveTop.num;
|
|
|
CPoint *pts = new CPoint[num];
|
|
|
for (int ii = 0; ii < num; ii++)
|
|
|
{
|
|
|
point.x0 = pBend->m_curveTop.x[ii];
|
|
|
point.y0 = pBend->m_curveTop.y[ii];
|
|
|
pts[ii] = pXyDC->GetScreen(point);
|
|
|
}
|
|
|
pDC->Polyline(pts, num);
|
|
|
delete[]pts;
|
|
|
|
|
|
DrawLayerLine( pXyDC, pBend->m_ptArrCurveTop, nHandleSize,pDC);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
int num = pBend->m_curveBot.num;
|
|
|
CPoint *pts = new CPoint[num];
|
|
|
for (int ii = 0; ii < num; ii++)
|
|
|
{
|
|
|
point.x0 = pBend->m_curveBot.x[ii];
|
|
|
point.y0 = pBend->m_curveBot.y[ii];
|
|
|
pts[ii] = pXyDC->GetScreen(point);
|
|
|
}
|
|
|
pDC->Polyline(pts, num);
|
|
|
delete[]pts;
|
|
|
DrawLayerLine(pXyDC, pBend->m_ptArrCurveBot, nHandleSize,pDC);
|
|
|
}
|
|
|
//////////////////////////////////////////////////////////ѡ<><D1A1>bend<6E><64>λ<EFBFBD><CEBB>
|
|
|
else if (m_SelectCurveMode == CurveBend)
|
|
|
{
|
|
|
int num = pBend->m_curveTop.num;
|
|
|
CPoint *pts = new CPoint[num];
|
|
|
for (int ii = 0; ii < num; ii++)
|
|
|
{
|
|
|
point.x0 = pBend->m_curveTop.x[ii];
|
|
|
point.y0 = pBend->m_curveTop.y[ii];
|
|
|
pts[ii] = pXyDC->GetScreen(point);
|
|
|
}
|
|
|
pDC->Polyline(pts, num);
|
|
|
delete[]pts;
|
|
|
|
|
|
num = pBend->m_curveBot.num;
|
|
|
pts = new CPoint[num];
|
|
|
for (int ii = 0; ii < num; ii++)
|
|
|
{
|
|
|
point.x0 = pBend->m_curveBot.x[ii];
|
|
|
point.y0 = pBend->m_curveBot.y[ii];
|
|
|
pts[ii] = pXyDC->GetScreen(point);
|
|
|
}
|
|
|
pDC->Polyline(pts, num);
|
|
|
delete[]pts;
|
|
|
|
|
|
//bend<6E><64>ѡ<EFBFBD><D1A1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>
|
|
|
int nHandleCount = pBend->GetControlCount();
|
|
|
CBrush brush;
|
|
|
brush.CreateSolidBrush(RGB(0, 0, 255));
|
|
|
|
|
|
dfPoint resCtrlPts[4];
|
|
|
pBend->GetResformCtrlPoints(0,resCtrlPts);
|
|
|
CPoint points[4], tpoints[4];
|
|
|
CBrush* pOldBrush = pDC->SelectObject(&brush);
|
|
|
int nHandleSize = HANDLESIZE; // ::GetPreferences().WorkaroundHandle.m_nHandleSize;
|
|
|
for (int i = 0; i < 4; ++i)
|
|
|
{
|
|
|
points[i] = pXyDC->GetScreen(resCtrlPts[i].x0, resCtrlPts[i].y0);
|
|
|
|
|
|
rect = CRect(points[i].x - nHandleSize / 2, points[i].y - nHandleSize / 2, points[i].x + nHandleSize / 2, points[i].y + nHandleSize / 2);
|
|
|
tpoints[0].x = rect.CenterPoint().x;
|
|
|
tpoints[0].y = rect.CenterPoint().y - rect.Height() / 2;
|
|
|
tpoints[1].x = rect.CenterPoint().x + rect.Width() / 2;
|
|
|
tpoints[1].y = rect.CenterPoint().y;
|
|
|
tpoints[2].x = rect.CenterPoint().x;
|
|
|
tpoints[2].y = rect.CenterPoint().y + rect.Height() / 2;
|
|
|
tpoints[3].x = rect.CenterPoint().x - rect.Width() / 2;
|
|
|
tpoints[3].y = rect.CenterPoint().y;
|
|
|
pDC->Polygon(tpoints, 4);
|
|
|
}
|
|
|
pDC->SelectObject(pOldBrush);
|
|
|
pDC->MoveTo(points[0]); pDC->LineTo(points[1]);
|
|
|
pDC->MoveTo(points[2]); pDC->LineTo(points[3]);
|
|
|
|
|
|
brush.DeleteObject();
|
|
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
if (pBend->m_pLayerRight == NULL)
|
|
|
{
|
|
|
point = pBend->GetHandleControl(nHandleCount + 1);
|
|
|
pt = pXyDC->GetScreen(point);
|
|
|
rect = CRect(pt.x - nHandleSize / 2, pt.y - nHandleSize / 2, pt.x + nHandleSize / 2, pt.y + nHandleSize / 2);
|
|
|
brush.CreateSolidBrush(RGB(0, 255, 0));
|
|
|
CBrush* pOldBrush = pDC->SelectObject(&brush);
|
|
|
pDC->Ellipse(rect);
|
|
|
pDC->SelectObject(pOldBrush);
|
|
|
brush.DeleteObject();
|
|
|
}
|
|
|
}
|
|
|
pDC->SelectObject(pOldPen);
|
|
|
pen.DeleteObject();
|
|
|
|
|
|
//TRACE("select nHandle = %d \r\n", m_SelectHandle);
|
|
|
}
|
|
|
pDC->SetROP2(old);
|
|
|
}
|
|
|
|
|
|
void CItemBend::OnDraw(CXyDC* pXyDC)
|
|
|
{
|
|
|
POSITION pos = m_WellObjSelectlist.GetHeadPosition();
|
|
|
if (pos == NULL)
|
|
|
return;
|
|
|
|
|
|
CBendObj* pBend = (CBendObj*)m_WellObjSelectlist.GetHead();
|
|
|
CWellSection* pWellSection = (CWellSection*)pBend->GetParent();
|
|
|
if (pWellSection->m_bResForm)
|
|
|
{
|
|
|
OnDraw_Resform(pXyDC, pBend, pXyDC->GetDC());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
OnDraw_DFPCG(pXyDC, pBend, pXyDC->GetDC());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CItemBend::OnDraw(CXyDC* pXyDC, CDC *pDC)
|
|
|
{
|
|
|
POSITION pos = m_WellObjSelectlist.GetHeadPosition();
|
|
|
if (pos == NULL)
|
|
|
return;
|
|
|
|
|
|
CBendObj* pBend = (CBendObj*)m_WellObjSelectlist.GetHead();
|
|
|
CWellSection* pWellSection = (CWellSection*)pBend->GetParent();
|
|
|
if (pWellSection->m_bResForm)
|
|
|
{
|
|
|
OnDraw_Resform(pXyDC, pBend,pDC);
|
|
|
if (m_SelectHandle > 0)
|
|
|
{
|
|
|
DrawLayerLineSelectHandle(pXyDC, m_SelectCurveMode, HANDLESIZE,pDC);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
OnDraw_DFPCG(pXyDC, pBend,pDC);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
int CItemBend::DeleteSelection(void)
|
|
|
{
|
|
|
//if(m_pBend == NULL)
|
|
|
// return;
|
|
|
if (this->m_WellObjSelectlist.GetCount() == 0)
|
|
|
return 1;
|
|
|
|
|
|
CBendObj* pBendHead = (CBendObj*)m_WellObjSelectlist.GetHead();
|
|
|
CWellSection* pSection = (CWellSection*)pBendHead->GetParent();
|
|
|
CBendObj* pBend = NULL;
|
|
|
POSITION pos = m_WellObjSelectlist.GetTailPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
pBend = (CBendObj*)m_WellObjSelectlist.GetPrev(pos);
|
|
|
pSection->DeleteBend(pBend);
|
|
|
}
|
|
|
m_WellObjSelectlist.RemoveAll();
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
int CItemBend::HitTestMode(CPoint2D pt )
|
|
|
{
|
|
|
if (m_pBend == NULL)
|
|
|
return 0;
|
|
|
|
|
|
//CRect8 r(pt.x0, pt.y0, pt.x0, pt.y0);
|
|
|
//CSize8 sz = GetDoc()->GetSelectSize();
|
|
|
//double sx = GetDC()->GetRealWidth(sz.cx);
|
|
|
//double sy = fabs(GetDC()->GetRealHeight(sz.cy));
|
|
|
//r.InflateRect(sx, sy);
|
|
|
int tHandle = 0;
|
|
|
int nHandleSize = HANDLESIZE; // ::GetPreferences().WorkaroundHandle.m_nHandleSize;
|
|
|
double dHandleSize = GetDC()->GetRealSize(CSize(nHandleSize / 2, nHandleSize / 2)).cx;
|
|
|
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
tHandle = m_pBend->HitTestTop(pt, dHandleSize, TRUE);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
tHandle = m_pBend->HitTestBot(pt, dHandleSize, TRUE);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
if (!m_pBend->bPlug)
|
|
|
{
|
|
|
tHandle = m_pBend->HitTestBreakLitho(pt, dHandleSize, TRUE);
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBend)
|
|
|
{
|
|
|
tHandle = m_pBend->HitTestControl(pt, dHandleSize, TRUE);
|
|
|
}
|
|
|
return tHandle;
|
|
|
/*if (nDragHandle == 0)
|
|
|
{
|
|
|
if (m_pBend->m_curveBreakLitho.IsInRange(r))
|
|
|
{
|
|
|
if (m_pBend->bPlug)
|
|
|
{
|
|
|
m_SelectCurveMode = CurveBend;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
m_SelectCurveMode = CurveBreakLithoLine;
|
|
|
}
|
|
|
}
|
|
|
else if (m_pBend->m_curveTop.IsInRange(r))
|
|
|
{
|
|
|
m_SelectCurveMode = CurveTopLine;
|
|
|
}
|
|
|
else if (m_pBend->m_curveBot.IsInRange(r))
|
|
|
{
|
|
|
m_SelectCurveMode = CurveBotLine;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
m_SelectCurveMode = CurveBend;
|
|
|
}
|
|
|
}*/
|
|
|
|
|
|
}
|
|
|
|
|
|
void CItemBend::AddControlPoint(dfPoint dp)
|
|
|
{
|
|
|
double dis = 0;
|
|
|
int nHandleSize = HANDLESIZE;// ::GetPreferences().WorkaroundHandle.m_nHandleSize;
|
|
|
double dHandleSize = GetDC()->GetRealSize(CSize(nHandleSize / 2, nHandleSize / 2)).cx;
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
for (int i = 0; i < m_pBend->m_ptArrCurveTopOld.GetCount() - 1; i++)
|
|
|
{
|
|
|
dis = AfxGetPublicFunction()->PointLineDistance(dp.x0, dp.y0, m_pBend->m_ptArrCurveTopOld[i].x0, m_pBend->m_ptArrCurveTopOld[i].y0,
|
|
|
m_pBend->m_ptArrCurveTopOld[i + 1].x0, m_pBend->m_ptArrCurveTopOld[i + 1].y0);
|
|
|
if (dis <= dHandleSize)
|
|
|
{
|
|
|
m_pBend->m_ptArrCurveTopOld.InsertAt(i + 1, dp);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
if (m_pBend->m_ptArrCurveBotOld.GetCount() >= 2)
|
|
|
{
|
|
|
for (int i = 0; i < m_pBend->m_ptArrCurveBotOld.GetCount() - 1; i++)
|
|
|
{
|
|
|
dis = AfxGetPublicFunction()->PointLineDistance(dp.x0, dp.y0, m_pBend->m_ptArrCurveBotOld[i].x0, m_pBend->m_ptArrCurveBotOld[i].y0,
|
|
|
m_pBend->m_ptArrCurveBotOld[i + 1].x0, m_pBend->m_ptArrCurveBotOld[i + 1].y0);
|
|
|
if (dis <= dHandleSize)
|
|
|
{
|
|
|
m_pBend->m_ptArrCurveBotOld.InsertAt(i + 1, dp);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
if (m_pBend->m_curveBreakLithoOld.num >= 2)
|
|
|
{
|
|
|
CPointArr LithoBreakArr;
|
|
|
for (int i = 0; i < m_pBend->m_curveBreakLithoOld.num; i++)
|
|
|
{
|
|
|
dfPoint temppoint;
|
|
|
temppoint.x0 = m_pBend->m_curveBreakLithoOld.x[i];
|
|
|
temppoint.y0 = m_pBend->m_curveBreakLithoOld.y[i];
|
|
|
LithoBreakArr.Add(temppoint);
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < LithoBreakArr.GetCount() - 1; i++)
|
|
|
{
|
|
|
|
|
|
dis = AfxGetPublicFunction()->PointLineDistance(dp.x0, dp.y0, LithoBreakArr[i].x0, LithoBreakArr[i].y0,
|
|
|
LithoBreakArr[i + 1].x0, LithoBreakArr[i + 1].y0);
|
|
|
if (dis <= dHandleSize)
|
|
|
{
|
|
|
LithoBreakArr.InsertAt(i + 1, dp);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
m_pBend->m_curveBreakLithoOld.Clear();
|
|
|
m_pBend->m_curveBreakLithoOld.Create(LithoBreakArr.GetCount());
|
|
|
m_pBend->m_curveBreakLithoInteract.Clear();
|
|
|
m_pBend->m_curveBreakLithoInteract.Create(LithoBreakArr.GetCount());
|
|
|
for (int i = 0; i < m_pBend->m_curveBreakLithoOld.num; i++)
|
|
|
{
|
|
|
m_pBend->m_curveBreakLithoOld.x[i] = LithoBreakArr.GetAt(i).x0;
|
|
|
m_pBend->m_curveBreakLithoOld.y[i] = LithoBreakArr.GetAt(i).y0;
|
|
|
m_pBend->m_curveBreakLithoInteract.x[i] = LithoBreakArr.GetAt(i).x0;
|
|
|
m_pBend->m_curveBreakLithoInteract.y[i] = LithoBreakArr.GetAt(i).y0;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
m_pBend->CreateBendLines();
|
|
|
m_pBend->CreateBendFills();
|
|
|
}
|
|
|
|
|
|
void CItemBend::AddControlPoints()
|
|
|
{
|
|
|
double fSlope;
|
|
|
fSlope = -(m_pBend->m_ptArrControls.GetAt(1).Y - m_pBend->m_ptArrControls.GetAt(0).Y) / (m_pBend->m_ptArrControls.GetAt(1).X - m_pBend->m_ptArrControls.GetAt(0).X);
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
ComputeControls(m_pBend->m_ptArrCurveTopOld, fSlope);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
ComputeControls(m_pBend->m_ptArrCurveBotOld, fSlope);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
CPointArr LithoBreakArr;
|
|
|
for (int i = 0; i < m_pBend->m_curveBreakLithoOld.num; i++)
|
|
|
{
|
|
|
dfPoint temppoint;
|
|
|
temppoint.x0 = m_pBend->m_curveBreakLithoOld.x[i];
|
|
|
temppoint.y0 = m_pBend->m_curveBreakLithoOld.y[i];
|
|
|
LithoBreakArr.Add(temppoint);
|
|
|
}
|
|
|
dfPoint AddPoint1;
|
|
|
dfPoint AddPoint2;
|
|
|
if (LithoBreakArr.GetCount() == 2)
|
|
|
{
|
|
|
AddPoint1.x0 = LithoBreakArr.GetAt(0).x0 * 2 / 3 + LithoBreakArr.GetAt(1).x0 / 3;
|
|
|
AddPoint1.y0 = LithoBreakArr.GetAt(0).y0 * 2 / 3 + LithoBreakArr.GetAt(1).y0 / 3;
|
|
|
AddPoint2.x0 = LithoBreakArr.GetAt(LithoBreakArr.GetCount() - 1).x0 / 3 + LithoBreakArr.GetAt(LithoBreakArr.GetCount() - 2).x0 * 2 / 3;
|
|
|
AddPoint2.y0 = LithoBreakArr.GetAt(LithoBreakArr.GetCount() - 1).y0 / 3 + LithoBreakArr.GetAt(LithoBreakArr.GetCount() - 2).y0 * 2 / 3;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
AddPoint1.x0 = LithoBreakArr.GetAt(0).x0 / 4 + LithoBreakArr.GetAt(1).x0 * 3 / 4;
|
|
|
AddPoint1.y0 = LithoBreakArr.GetAt(0).y0 / 4 + LithoBreakArr.GetAt(1).y0 * 3 / 4;
|
|
|
AddPoint2.x0 = LithoBreakArr.GetAt(LithoBreakArr.GetCount() - 1).x0 / 4 + LithoBreakArr.GetAt(LithoBreakArr.GetCount() - 2).x0 * 3 / 4;
|
|
|
AddPoint2.y0 = LithoBreakArr.GetAt(LithoBreakArr.GetCount() - 1).y0 / 4 + LithoBreakArr.GetAt(LithoBreakArr.GetCount() - 2).y0 * 3 / 4;
|
|
|
}
|
|
|
LithoBreakArr.InsertAt(1, AddPoint1);
|
|
|
LithoBreakArr.InsertAt(LithoBreakArr.GetCount() - 1, AddPoint2);
|
|
|
m_pBend->m_curveBreakLithoOld.Clear();
|
|
|
m_pBend->m_curveBreakLithoOld.Create(LithoBreakArr.GetCount());
|
|
|
m_pBend->m_curveBreakLithoInteract.Clear();
|
|
|
m_pBend->m_curveBreakLithoInteract.Create(LithoBreakArr.GetCount());
|
|
|
for (int i = 0; i < m_pBend->m_curveBreakLithoOld.num; i++)
|
|
|
{
|
|
|
m_pBend->m_curveBreakLithoOld.x[i] = LithoBreakArr.GetAt(i).x0;
|
|
|
m_pBend->m_curveBreakLithoOld.y[i] = LithoBreakArr.GetAt(i).y0;
|
|
|
m_pBend->m_curveBreakLithoInteract.x[i] = LithoBreakArr.GetAt(i).x0;
|
|
|
m_pBend->m_curveBreakLithoInteract.y[i] = LithoBreakArr.GetAt(i).y0;
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBend)
|
|
|
{
|
|
|
ComputeControls(m_pBend->m_ptArrCurveTopOld, fSlope);
|
|
|
ComputeControls(m_pBend->m_ptArrCurveBotOld, fSlope);
|
|
|
}
|
|
|
m_pBend->CreateBendLines();
|
|
|
m_pBend->CreateBendFills();
|
|
|
}
|
|
|
|
|
|
void CItemBend::ComputeControls(CPointArr &ptArr, double fSlope)
|
|
|
{
|
|
|
dfPoint AddPoint1;
|
|
|
dfPoint AddPoint2;
|
|
|
double xLength;
|
|
|
double yHeight;
|
|
|
int nNumber;
|
|
|
xLength = /*fabs*/(ptArr.GetAt(ptArr.GetCount() - 1).x0 - ptArr.GetAt(0).x0);
|
|
|
yHeight = fSlope * (ptArr.GetAt(0).x0 - ptArr.GetAt(ptArr.GetCount() - 1).x0) + ptArr.GetAt(ptArr.GetCount() - 1).y0;
|
|
|
nNumber = ptArr.GetCount() / 2 + 1;
|
|
|
yHeight = /*fabs*/(ptArr.GetAt(0).y0 - yHeight);
|
|
|
AddPoint1.x0 = ptArr.GetAt(ptArr.GetCount() - 1).x0 - 4 * xLength / (nNumber * 3);
|
|
|
AddPoint1.y0 = fSlope * (AddPoint1.x0 - ptArr.GetAt(ptArr.GetCount() - 1).x0) + ptArr.GetAt(ptArr.GetCount() - 1).y0 + yHeight / (nNumber * 3 + 2);
|
|
|
AddPoint2.x0 = AddPoint1.x0 + 4 * xLength / (nNumber * 3) / 3;
|
|
|
AddPoint2.y0 = fSlope * (AddPoint2.x0 - ptArr.GetAt(ptArr.GetCount() - 1).x0) + ptArr.GetAt(ptArr.GetCount() - 1).y0 + yHeight / (nNumber - 1);
|
|
|
if (ptArr.GetCount() > 2)
|
|
|
{
|
|
|
double xOld;
|
|
|
double yOld;
|
|
|
xOld = ptArr[ptArr.GetCount() - 2].x0;
|
|
|
yOld = ptArr[ptArr.GetCount() - 2].y0;
|
|
|
double xLengthOld;
|
|
|
double yHeightOld;
|
|
|
xLengthOld = xOld - ptArr.GetAt(0).x0;
|
|
|
yHeightOld = fSlope * (ptArr.GetAt(0).x0 - xOld) + yOld;
|
|
|
yHeightOld = /*fabs*/(ptArr.GetAt(0).y0 - yHeightOld);
|
|
|
ptArr[ptArr.GetCount() - 2].x0 = AddPoint2.x0 - 4 * xLength / (nNumber * 3);
|
|
|
ptArr[ptArr.GetCount() - 2].y0 = fSlope * (ptArr[ptArr.GetCount() - 2].x0 - AddPoint2.x0) + AddPoint2.y0;
|
|
|
double xNew;
|
|
|
double yNew;
|
|
|
xNew = ptArr[ptArr.GetCount() - 2].x0;
|
|
|
yNew = ptArr[ptArr.GetCount() - 2].y0;
|
|
|
double xLengthNew;
|
|
|
double yHeightNew;
|
|
|
xLengthNew = xNew - ptArr.GetAt(0).x0;
|
|
|
yHeightNew = fSlope * (ptArr.GetAt(0).x0 - xNew) + yNew;
|
|
|
yHeightNew = /*fabs*/(ptArr.GetAt(0).y0 - yHeightNew);
|
|
|
for (int i = 1; i < ptArr.GetCount() - 2; i++)
|
|
|
{
|
|
|
double tempSlope;
|
|
|
tempSlope = (ptArr[1].y0 - ptArr[0].y0) / (ptArr[1].x0 - ptArr[0].x0);
|
|
|
double tempX;
|
|
|
tempX = ptArr[i].x0;
|
|
|
ptArr[i].x0 = (ptArr[i].x0 - ptArr[0].x0)*xLengthNew / xLengthOld + ptArr[0].x0;
|
|
|
if (i == 1)
|
|
|
{
|
|
|
ptArr[i].y0 = tempSlope * (ptArr[i].x0 - ptArr[0].x0) + ptArr[0].y0;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
double fHeight = ptArr[i].y0 - (fSlope*(tempX - xOld) + yOld);
|
|
|
fHeight = fHeight / yHeightOld * yHeightNew;
|
|
|
ptArr[i].y0 = fHeight + (fSlope*(ptArr[i].x0 - xNew) + yNew);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
ptArr.InsertAt(ptArr.GetCount() - 1, AddPoint2);
|
|
|
ptArr.InsertAt(ptArr.GetCount() - 1, AddPoint1);
|
|
|
}
|
|
|
|
|
|
void CItemBend::SetBendBreakStyle(CString strBreak)
|
|
|
{
|
|
|
if (m_pItemWellSection == NULL)
|
|
|
return;
|
|
|
|
|
|
SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2);
|
|
|
|
|
|
CWellSection* pWellSection = m_pItemWellSection->GetWellSection();
|
|
|
|
|
|
CString strMark;
|
|
|
strMark.Format("%s", LIB_MARK_BREAKSTRATUM);
|
|
|
CString str = strMark + strBreak;
|
|
|
CBendObj* pBend = NULL;
|
|
|
|
|
|
POSITION pos = this->m_WellObjSelectlist.GetHeadPosition();
|
|
|
while (pos != NULL)
|
|
|
{
|
|
|
pBend = (CBendObj*)m_WellObjSelectlist.GetNext(pos);
|
|
|
pBend->m_strLineBreakStyle = strBreak;
|
|
|
pBend->m_pMarkBreak = (CXy*)AfxGetGlobalWellXy()->FindMark(str);
|
|
|
if (pWellSection->IsStratumSmooth())
|
|
|
{
|
|
|
for (int i = 0; i < 2; i++)
|
|
|
{
|
|
|
pBend->m_ptArrControlsOffSet[i].OneOffSet = 0;
|
|
|
pBend->m_ptArrControlsOffSet[i].TwoOffSet = 0;
|
|
|
}
|
|
|
pBend->CreateBendLinesForOld();
|
|
|
pBend->CreateBendFills();
|
|
|
pBend->SmoothBendLines();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
pBend->CreateBendLinesForOld();
|
|
|
pBend->ComputeSlopeAndConstant();
|
|
|
pBend->CreateBendFills();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
GetDoc()->Invalidate();
|
|
|
}
|
|
|
|
|
|
int CItemBend::HitTestMode_Resform(CPoint2D pt)
|
|
|
{
|
|
|
if (m_pBend == NULL)
|
|
|
return 0;
|
|
|
|
|
|
//CRect8 r(pt.x0, pt.y0, pt.x0, pt.y0);
|
|
|
//CSize8 sz = GetDoc()->GetSelectSize();
|
|
|
//double sx = GetDC()->GetRealWidth(sz.cx);
|
|
|
//double sy = fabs(GetDC()->GetRealHeight(sz.cy));
|
|
|
//r.InflateRect(sx, sy);
|
|
|
int tHandle = 0;
|
|
|
int nHandleSize = HANDLESIZE;// ::GetPreferences().WorkaroundHandle.m_nHandleSize;
|
|
|
double dHandleSize = GetDC()->GetRealSize(CSize(nHandleSize / 2, nHandleSize / 2)).cx;
|
|
|
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
tHandle = m_pBend->HitTestTop_Resform(pt, dHandleSize, TRUE);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
tHandle = m_pBend->HitTestBot_Resform(pt, dHandleSize, TRUE);
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBreakLithoLine)
|
|
|
{
|
|
|
if (!m_pBend->bPlug)
|
|
|
{
|
|
|
tHandle = m_pBend->HitTestBreakLitho(pt, dHandleSize, TRUE);
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBend)
|
|
|
{
|
|
|
tHandle = m_pBend->HitTestControl_Resform(pt, dHandleSize, TRUE);
|
|
|
}
|
|
|
return tHandle;
|
|
|
|
|
|
//if (nDragHandle == 0)
|
|
|
//{
|
|
|
// if (m_pBend->m_curveBreakLitho.IsInRange(r))
|
|
|
// {
|
|
|
// if (m_pBend->bPlug)
|
|
|
// {
|
|
|
// m_SelectCurveMode = CurveBend;
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// m_SelectCurveMode = CurveBreakLithoLine;
|
|
|
// }
|
|
|
// }
|
|
|
// else if (m_pBend->IsLayerLineIncludePoint(TRUE, pt, dHandleSize/3))
|
|
|
// {
|
|
|
// m_SelectCurveMode = CurveTopLine;
|
|
|
// }
|
|
|
// else if (m_pBend->IsLayerLineIncludePoint(FALSE, pt, dHandleSize/3))
|
|
|
// {
|
|
|
// m_SelectCurveMode = CurveBotLine;
|
|
|
// }
|
|
|
// else
|
|
|
// {
|
|
|
// m_SelectCurveMode = CurveBend;
|
|
|
// }
|
|
|
//}
|
|
|
//
|
|
|
//if (m_SelectCurveMode == CurveTopLine || m_SelectCurveMode == CurveBotLine)
|
|
|
//{
|
|
|
// if (m_SelectHandle != nDragHandle)
|
|
|
// {
|
|
|
// OnDraw(GetDC() ,pDC);
|
|
|
// m_SelectHandle = nDragHandle;
|
|
|
// OnDraw(GetDC() ,pDC);
|
|
|
// }
|
|
|
//}
|
|
|
//else
|
|
|
//{
|
|
|
// if (m_SelectHandle != 0)
|
|
|
// {
|
|
|
// OnDraw(GetDC() ,pDC);
|
|
|
// m_SelectHandle = 0;
|
|
|
// OnDraw(GetDC() ,pDC);
|
|
|
// }
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
void CItemBend::AddBendLayerPoint()
|
|
|
{
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2);
|
|
|
if (m_pBend->AddBendLayerPoint(TRUE, (m_SelectHandle - 1)))
|
|
|
{
|
|
|
GetDoc()->Invalidate(); //GetView()->Invalidate();
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2);
|
|
|
if (m_pBend->AddBendLayerPoint(FALSE, (m_SelectHandle - 1)))
|
|
|
{
|
|
|
GetDoc()->Invalidate();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CItemBend::DeleteBendLayerPoint()
|
|
|
{
|
|
|
if (m_SelectCurveMode == CurveTopLine)
|
|
|
{
|
|
|
SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2);
|
|
|
if (m_pBend->DeleteBendLayerPoint(TRUE, (m_SelectHandle - 1)))
|
|
|
{
|
|
|
m_SelectHandle = 0;
|
|
|
GetDoc()->Invalidate();
|
|
|
}
|
|
|
}
|
|
|
else if (m_SelectCurveMode == CurveBotLine)
|
|
|
{
|
|
|
SetReUnDoAction(FALSE, IDS_STRING_ACTION_MOVE, 2);
|
|
|
if (m_pBend->DeleteBendLayerPoint(FALSE, (m_SelectHandle - 1)))
|
|
|
{
|
|
|
m_SelectHandle = 0;
|
|
|
GetDoc()->Invalidate();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CItemBend::OnLButtonDownAfterHitTest(UINT nFlags, CPoint point, int tnDragHandle, CDC* pDC)
|
|
|
{
|
|
|
m_downPoint = m_firstPoint = m_lastPoint = point;
|
|
|
nDragHandle = tnDragHandle;
|
|
|
int nHandleSize = HANDLESIZE;
|
|
|
if (nDragHandle != 0)
|
|
|
{
|
|
|
selectMode = ESelectMode::size;
|
|
|
//GetView()->SetCapture();
|
|
|
|
|
|
if (m_SelectHandle != nDragHandle)
|
|
|
DrawLayerLineSelectHandle(GetDC(), m_SelectCurveMode, nHandleSize,pDC);
|
|
|
|
|
|
m_SelectHandle = nDragHandle;
|
|
|
if (m_SelectHandle > 0)
|
|
|
DrawLayerLineSelectHandle(GetDC(), m_SelectCurveMode, nHandleSize, pDC);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
void CItemBend::DrawLayerLineSelectHandle(CXyDC* pXyDC, CurveType selectType, int nHandleSize, CDC* pDC)
|
|
|
{
|
|
|
if (m_SelectHandle < 1)
|
|
|
return;
|
|
|
|
|
|
CPointArr* plinePtArr = NULL;
|
|
|
if (selectType == CurveTopLine)
|
|
|
plinePtArr = &m_pBend->m_ptArrCurveTop;
|
|
|
else if (selectType == CurveBotLine)
|
|
|
plinePtArr = &m_pBend->m_ptArrCurveBot;
|
|
|
else
|
|
|
return;
|
|
|
|
|
|
CPointArr& linePtArr = *plinePtArr;
|
|
|
CRect rect;
|
|
|
CPoint pt;
|
|
|
std::vector<CPoint> spoints;
|
|
|
spoints.resize(linePtArr.GetCount());
|
|
|
for (int kk = 0; kk < linePtArr.GetCount(); kk++)
|
|
|
{
|
|
|
pt = pXyDC->GetScreen(linePtArr.GetAt(kk));
|
|
|
spoints[kk] = pt;
|
|
|
}
|
|
|
if (m_pBend->m_pLayerRight == NULL)
|
|
|
{
|
|
|
pt = pXyDC->GetScreen(m_pBend->m_ptEndBreakInteract);
|
|
|
spoints[spoints.size() - 1] = pt;
|
|
|
}
|
|
|
int thSize = nHandleSize / 2.0;
|
|
|
int gnum = int(spoints.size() / 4);
|
|
|
|
|
|
int old = pDC->SetROP2(R2_NOTXORPEN);
|
|
|
|
|
|
int tSelHandle = (m_SelectHandle - 1) / 4;
|
|
|
if (m_SelectHandle > 0)
|
|
|
{
|
|
|
CPoint pts[5];
|
|
|
int thSize1 = thSize + 1;
|
|
|
for (int j = 0; j < 4; j++)
|
|
|
{
|
|
|
if ((tSelHandle * 4 + j) >= spoints.size())
|
|
|
continue;
|
|
|
|
|
|
pt = spoints[tSelHandle * 4 + j];
|
|
|
|
|
|
pDC->PatBlt(pt.x - thSize, pt.y - thSize, thSize * 2, thSize * 2, PATINVERT);
|
|
|
|
|
|
rect = CRect(pt.x - thSize1, pt.y - thSize1, pt.x + thSize1, pt.y + thSize1);
|
|
|
pDC->Rectangle(rect);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
pDC->SetROP2(old);
|
|
|
}
|
|
|
} |