|
|
// WellPoleView.cpp: 实现文件
|
|
|
//
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
#include <list>
|
|
|
#include <algorithm>
|
|
|
#include "ItemBkGrid.h"
|
|
|
#include "PublicParam.h"
|
|
|
#include "./WellPoleLib/WellBaseObj.h"
|
|
|
#include "WellPoleLib/InTrackDepthSegment.h"
|
|
|
#include "WellPoleLib/TrackObj.h"
|
|
|
|
|
|
#include "WellPoleLib/InclinedTrack.h"
|
|
|
#include "WellPoleLib/InTrackLith.h"
|
|
|
#include "WellPoleLib/InTrackSymbol.h"
|
|
|
#include "WellPoleLib/InTrackResult.h"
|
|
|
#include "WellPoleLib/InTrackTextRange.h"
|
|
|
|
|
|
#include "WellPoleLib/TrackGroup.h"
|
|
|
#include "WellPoleLib/WellPole.h"
|
|
|
|
|
|
#include "WellPoleLib/TrackDepth.h"
|
|
|
#include "WellPoleLib/TrackCurve.h"
|
|
|
#include "WellPoleLib/TrackSymbol.h"
|
|
|
#include "WellPoleLib/TrackResult.h"
|
|
|
#include "WellPoleLib/TrackLith.h"
|
|
|
#include "WellPoleLib/TrackText.h"
|
|
|
#include "WellPoleLib/InTrackPicture.h"
|
|
|
|
|
|
#include "ItemSingleWell.h"
|
|
|
#include "ItemTrack.h"
|
|
|
#include "ItemTrackIn.h"
|
|
|
#include "WellPoleDoc.h"
|
|
|
#include "WellPoleView.h"
|
|
|
#include "CxImage\CxImage\ximagegeotiff.h"
|
|
|
|
|
|
//定时ID号(OnTimer)
|
|
|
|
|
|
void WellExtentObjMoveToPoint(CXyDC* pDC, double ptx, double pty, std::vector<COne*>& wellExtendObjs)
|
|
|
{
|
|
|
float matrix[6];
|
|
|
memset(matrix, 0, sizeof(float) * 6);
|
|
|
matrix[0] = matrix[3] = 1;
|
|
|
for (int ii = 0; ii < wellExtendObjs.size(); ii++)
|
|
|
{
|
|
|
if (wellExtendObjs[ii]->GetType() == KEP_WELL || wellExtendObjs[ii]->GetType() == KEP_WELLSECTION)
|
|
|
{
|
|
|
CWellBaseObj *pWellBase = (CWellBaseObj*)wellExtendObjs[ii]->GetValue();
|
|
|
CRect8 srect = pWellBase->GetRect();
|
|
|
|
|
|
matrix[4] = ptx - srect.left;
|
|
|
matrix[5] = pty - srect.top;
|
|
|
pWellBase->Transform(pDC, matrix);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// WellPoleView
|
|
|
|
|
|
CWellPoleView::CWellPoleView()
|
|
|
{
|
|
|
Initialize();
|
|
|
|
|
|
InitSelectBmpDC();
|
|
|
m_bLockWellHead = FALSE;
|
|
|
m_bTracking = false;
|
|
|
}
|
|
|
|
|
|
CWellPoleView::CWellPoleView(CXy* pXy)
|
|
|
:CWellPoleView()
|
|
|
{
|
|
|
//InitSelectBmpDC();
|
|
|
//m_bLockWellHead = FALSE;
|
|
|
//m_bTracking = false;
|
|
|
m_bLockWellHead = FALSE;
|
|
|
m_pDoc->m_pXy = pXy;
|
|
|
}
|
|
|
|
|
|
CWellPoleView::~CWellPoleView()
|
|
|
{
|
|
|
DeleteSelectBmpDC();
|
|
|
}
|
|
|
|
|
|
// WellPoleView 绘图
|
|
|
|
|
|
//void CWellPoleView::OnDraw(CDC* pDC)
|
|
|
//{
|
|
|
// CDrawView::OnDraw(pDC);
|
|
|
//}
|
|
|
|
|
|
//
|
|
|
//void CWellPoleView::OnDrawAllBefore(CXyDC& dc)
|
|
|
//{
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
//
|
|
|
// //当是符号制作状态时,画符号范围
|
|
|
// if (pDoc->m_pItemMakeMark)
|
|
|
// pDoc->m_pItemMakeMark->DrawRectangle(dc);
|
|
|
//}
|
|
|
|
|
|
void CWellPoleView::OnDrawAllAfter(CXyDC& dc)
|
|
|
{
|
|
|
//CWellPoleDoc* pDoc = GetDocument();
|
|
|
|
|
|
//if (pDoc->GetOtherItem())
|
|
|
// pDoc->GetOtherItem()->OnDraw(&dc);
|
|
|
|
|
|
//BeginSelectBmpDC();
|
|
|
|
|
|
//pDoc->DrawItem(dc, -1, -1);
|
|
|
|
|
|
CSigmaView::OnDrawAllAfter(dc);
|
|
|
}
|
|
|
// WellPoleView 诊断
|
|
|
|
|
|
//#ifdef _DEBUG
|
|
|
//void CWellPoleView::AssertValid() const
|
|
|
//{
|
|
|
// CView::AssertValid();
|
|
|
//}
|
|
|
//
|
|
|
//#ifndef _WIN32_WCE
|
|
|
//void CWellPoleView::Dump(CDumpContext& dc) const
|
|
|
//{
|
|
|
// CView::Dump(dc);
|
|
|
//}
|
|
|
//#endif
|
|
|
//#endif //_DEBUG
|
|
|
|
|
|
|
|
|
// WellPoleView 消息处理程序
|
|
|
void get45DegreeLines()
|
|
|
{//以原点为中心,边长为100的正方形,求8跟45度角度的斜线均匀切过正方形,获得这些在正方形内部的线段。
|
|
|
|
|
|
double ll = sqrt(100*100 + 100*100); //斜对角线长度
|
|
|
double tseg = ll / 8.0;
|
|
|
//斜率为 k= 1
|
|
|
CPoint2D diagonalIntectPt[7]; //斜对角线内交点
|
|
|
|
|
|
double teage = 51;
|
|
|
for (int ii = 0; ii < 7; ii++)
|
|
|
{
|
|
|
diagonalIntectPt[ii] = GetPtAlongVector(-teage, teage, teage, -teage, tseg*(ii + 1), 1);
|
|
|
}
|
|
|
|
|
|
CPoint2D ptArr1[7], ptArr2[7];
|
|
|
|
|
|
int k = 1;
|
|
|
int start = 0;
|
|
|
for (int ii = 0; ii < 4; ii++)
|
|
|
{
|
|
|
GetLineWithSegmentPt(FALSE,k, diagonalIntectPt[ii].x0, diagonalIntectPt[ii].y0, -teage, teage, teage, teage, ptArr1[ii].x0, ptArr1[ii].y0); //与正方形上边线交点
|
|
|
GetLineWithSegmentPt(FALSE, k, diagonalIntectPt[ii].x0, diagonalIntectPt[ii].y0, -teage, teage, -teage, -teage, ptArr2[ii].x0, ptArr2[ii].y0); //与正方形左边线交点
|
|
|
}
|
|
|
|
|
|
start = 4;
|
|
|
for (int ii =start+ 0; ii < (start+3); ii++)
|
|
|
{
|
|
|
GetLineWithSegmentPt(FALSE, k, diagonalIntectPt[ii].x0, diagonalIntectPt[ii].y0, -teage, -teage, teage, -teage, ptArr1[ii].x0, ptArr1[ii].y0); //与正方形下边线交点
|
|
|
GetLineWithSegmentPt(FALSE, k, diagonalIntectPt[ii].x0, diagonalIntectPt[ii].y0, teage, teage, teage, -teage, ptArr2[ii].x0, ptArr2[ii].y0); //与正方形右边线交点
|
|
|
}
|
|
|
for(int ii = 0; ii< 7; ii++)
|
|
|
TRACE("ii=%d ,pt1= %.4f,%.4f , pt2= %.4f,%.4f\r\n" ,ii, ptArr1[ii].x0/100, ptArr1[ii].y0/100, ptArr2[ii].x0/100,ptArr2[ii].y0/100);
|
|
|
|
|
|
|
|
|
//斜率 k = -1
|
|
|
for (int ii = 0; ii < 7; ii++)
|
|
|
{
|
|
|
diagonalIntectPt[ii] = GetPtAlongVector(-teage, -teage, teage, teage, tseg*(ii + 1), 1);
|
|
|
}
|
|
|
k = -1;
|
|
|
for (int ii = 0; ii < 4; ii++)
|
|
|
{
|
|
|
GetLineWithSegmentPt(FALSE, k, diagonalIntectPt[ii].x0, diagonalIntectPt[ii].y0, -teage, -teage, -teage, teage, ptArr1[ii].x0, ptArr1[ii].y0); //与正方形左边线交点
|
|
|
GetLineWithSegmentPt(FALSE, k, diagonalIntectPt[ii].x0, diagonalIntectPt[ii].y0, -teage, -teage, teage, -teage, ptArr2[ii].x0, ptArr2[ii].y0); //与正方形下边线交点
|
|
|
}
|
|
|
|
|
|
start = 4;
|
|
|
for (int ii = start + 0; ii < (start + 3); ii++)
|
|
|
{
|
|
|
GetLineWithSegmentPt(FALSE, k, diagonalIntectPt[ii].x0, diagonalIntectPt[ii].y0, -teage, teage, teage, teage, ptArr1[ii].x0, ptArr1[ii].y0); //与正方形上边线交点
|
|
|
GetLineWithSegmentPt(FALSE, k, diagonalIntectPt[ii].x0, diagonalIntectPt[ii].y0, teage, -teage, teage, teage, ptArr2[ii].x0, ptArr2[ii].y0); //与正方形右边线交点
|
|
|
}
|
|
|
for (int ii = 0; ii < 7; ii++)
|
|
|
TRACE("ii=%d ,pt1= %.4f,%.4f , pt2= %.4f,%.4f\r\n",ii, ptArr1[ii].x0 / 100, ptArr1[ii].y0 / 100, ptArr2[ii].x0 / 100, ptArr2[ii].y0 / 100);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CWellPoleView::OnSize(UINT nType, int cx, int cy)
|
|
|
{
|
|
|
if (cx < 1 || cy < 1)
|
|
|
return;
|
|
|
CreateSelectBmpDC(cx, cy);
|
|
|
if (m_bFirstSize)
|
|
|
{
|
|
|
m_bFirstSize = FALSE;
|
|
|
|
|
|
CWellPole* pWell = GetDocument()->GetWellPole();
|
|
|
if (pWell)
|
|
|
{
|
|
|
pWell->CalculateSize(pWell->GetRect().TopLeft());
|
|
|
ExtendViewForNewWell(pWell);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
m_pDoc->Invalidate();
|
|
|
}
|
|
|
|
|
|
CWellPoleDoc* CWellPoleView::GetDocument() const
|
|
|
{
|
|
|
return (CWellPoleDoc * )m_pDoc;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//int CWellPoleView::OnCreate(LPCREATESTRUCT lpCreateStruct)
|
|
|
//{
|
|
|
// if (CDrawView::OnCreate(lpCreateStruct) == -1)
|
|
|
// return -1;
|
|
|
//
|
|
|
// // 默认情况下,最好注册一个与框架窗口无关的放置目标。
|
|
|
// //这将防止拖放对象“错过”支持拖放的容器中。
|
|
|
// m_dropTarget.Register(this);
|
|
|
// // TODO: 在此添加您专用的创建代码
|
|
|
// m_pDrawDC = new CClientDC(this);
|
|
|
//
|
|
|
// return 0;
|
|
|
//}
|
|
|
|
|
|
|
|
|
void CWellPoleView::OnLButtonDown(int mouseX, int mouseY, HDC hdc, int vk)
|
|
|
{
|
|
|
if (IsViewState())
|
|
|
{
|
|
|
//int typeBak = pDoc->GetItemView().GetType();
|
|
|
//if (::IsKeyDown(GetPanKey())) pDoc->GetItemView().SetType(ID_VIEW_PAN);
|
|
|
CWellPoleDoc *pWDoc = (CWellPoleDoc *)m_pDoc;
|
|
|
|
|
|
CDC *pDC = CDC::FromHandle(hdc);
|
|
|
SetScreenDC(pDC);
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
int nFlags = 0;
|
|
|
pWDoc->GetItemView()->OnLButtonDown(pDC, 0, pt, vk);
|
|
|
//if (::IsKeyDown(GetPanKey())) pDoc->GetItemView().SetType(typeBak);
|
|
|
m_PrevPointXY.x = mouseX;
|
|
|
m_PrevPointXY.y = mouseY;
|
|
|
|
|
|
return ;
|
|
|
}
|
|
|
|
|
|
CSigmaView::OnLButtonDown(mouseX, mouseY, hdc, vk);
|
|
|
|
|
|
m_PrevPointXY.x = mouseX;
|
|
|
m_PrevPointXY.y = mouseY;
|
|
|
|
|
|
//if (GetItem() != NULL)
|
|
|
//{
|
|
|
// CItem* pItem = GetItem();
|
|
|
// CItem* pOldItem = GetItem();
|
|
|
|
|
|
// if (pItem->GetType() != ITEM_SELECT && pItem->GetType() != ITEM_WELLPOLE)
|
|
|
// {
|
|
|
// return CSigmaView::OnLButtonDown(mouseX, mouseY, hdc, vk);
|
|
|
// }
|
|
|
// else
|
|
|
// OnLButtonDownOther(mouseX, mouseY, hdc, vk);
|
|
|
//}
|
|
|
//else
|
|
|
// CSigmaView::OnLButtonDown(mouseX, mouseY, hdc, vk);
|
|
|
|
|
|
//CItem * pItem = GetItem();
|
|
|
//if (pItem == NULL)
|
|
|
// return;
|
|
|
|
|
|
//OnLButtonDownOther(mouseX, mouseY, hdc, vk);
|
|
|
}
|
|
|
|
|
|
int CWellPoleView::ViewSetItemForSelectedElement(int mouseX, int mouseY)
|
|
|
{
|
|
|
int itemType = eWellPoleCallbackMsgDef::tZeroData;
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
if (pDoc->GetItem())
|
|
|
{
|
|
|
CItem* pItem = pDoc->GetItem();
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
|
|
|
CItem* pOldItem = pDoc->GetItem();
|
|
|
|
|
|
CPoint2D ptReal = pDoc->GetDC().GetReal(pt);
|
|
|
CRect8 rectReal = pDoc->GetSelectedRect(ptReal);
|
|
|
BOOL bIn = FALSE;
|
|
|
CPtrList* pList = pDoc->GetDraw()->GetValueList();
|
|
|
////对象链表
|
|
|
pList = pDoc->GetDraw()->GetValueList();
|
|
|
POSITION pos = pList->GetHeadPosition();
|
|
|
while (NULL != pos)
|
|
|
{
|
|
|
COne* pOne = (COne*)pList->GetAt(pos);
|
|
|
|
|
|
if (pOne->GetType() != KEP_WELL)
|
|
|
{
|
|
|
|
|
|
bIn = pOne->IsInRange(rectReal);
|
|
|
if (bIn)
|
|
|
{
|
|
|
if ((pItem->GetType() != ITEM_SELECT && !pItem->IsNestItem()) || (pItem->GetType() == ITEM_WELLPOLE && pItem->IsNestItem()))
|
|
|
{
|
|
|
//pDoc->SetItem(pDoc->FindItem(ITEM_SELECT));
|
|
|
itemType = eWellPoleCallbackMsgDef::vSetSelectItem;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
pList->GetNext(pos);
|
|
|
}
|
|
|
BOOL bInWell = FALSE;
|
|
|
if (!bIn)
|
|
|
{
|
|
|
pos = pList->GetHeadPosition();
|
|
|
while (NULL != pos)
|
|
|
{
|
|
|
COne* pOne = (COne*)pList->GetAt(pos);
|
|
|
if (pOne->GetType() == KEP_WELL)
|
|
|
{
|
|
|
if (pOne->IsInRange(rectReal))
|
|
|
{
|
|
|
bInWell = TRUE;
|
|
|
|
|
|
if (pItem->GetType() != ITEM_WELLPOLE)
|
|
|
{
|
|
|
CItemSingleWell* pItemWell = new CItemSingleWell(GetDocument());
|
|
|
pItemWell->SetPos(pos);
|
|
|
pItemWell->SetDrawObj((CWellBaseObj*)pOne->GetValue());
|
|
|
pDoc->SetItem(pItemWell);
|
|
|
itemType = eWellPoleCallbackMsgDef::vSetWellPoleItem;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
pList->GetNext(pos);
|
|
|
}
|
|
|
|
|
|
if (!bInWell)
|
|
|
{
|
|
|
if (pItem->GetType() == ITEM_WELLPOLE /*&& pItem->IsInEdit()*/)
|
|
|
{
|
|
|
//pDoc->SetItem(pDoc->FindItem(ITEM_SELECT));
|
|
|
itemType = eWellPoleCallbackMsgDef::vSetSelectItem;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return itemType;
|
|
|
}
|
|
|
return itemType;
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::OnLButtonDownOther(int mouseX, int mouseY, HDC hdc, int vk)
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
if (pDoc->GetItem())
|
|
|
{
|
|
|
CItem* pItem = pDoc->GetItem();
|
|
|
|
|
|
pItem->m_client = m_client;
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
|
|
|
CItem* pOldItem = pDoc->GetItem();
|
|
|
|
|
|
CDC *pDC = NULL;
|
|
|
if (hdc != NULL)
|
|
|
{
|
|
|
pDC = CDC::FromHandle(hdc);
|
|
|
pItem->SetScreenDC(pDC);
|
|
|
pItem->SetBackGroundDC(m_pImgDC);
|
|
|
}
|
|
|
if (pDC == NULL)
|
|
|
return;
|
|
|
|
|
|
CPoint2D ptReal = pDoc->GetDC().GetReal(pt);
|
|
|
CRect8 rectReal = pDoc->GetSelectedRect(ptReal);
|
|
|
BOOL bIn = FALSE;
|
|
|
CPtrList* pList = pDoc->GetDraw()->GetValueList();
|
|
|
////对象链表
|
|
|
pList = pDoc->GetDraw()->GetValueList();
|
|
|
POSITION pos = pList->GetHeadPosition();
|
|
|
while (NULL != pos)
|
|
|
{
|
|
|
COne* pOne = (COne*)pList->GetAt(pos);
|
|
|
|
|
|
if (pOne->GetType() != KEP_WELL)
|
|
|
{
|
|
|
|
|
|
bIn = pOne->IsInRange(rectReal);
|
|
|
if (bIn)
|
|
|
{
|
|
|
if ((pItem->GetType() != ITEM_SELECT && !pItem->IsNestItem()) || (pItem->GetType() == ITEM_WELLPOLE && pItem->IsNestItem()))
|
|
|
{
|
|
|
//pDoc->SetItem(pDoc->FindItem(ITEM_SELECT));
|
|
|
m_pWndCallBack(tSetItemForElement, vSetSelectItem);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
pList->GetNext(pos);
|
|
|
}
|
|
|
BOOL bInWell = FALSE;
|
|
|
if (!bIn)
|
|
|
{
|
|
|
pos = pList->GetHeadPosition();
|
|
|
while (NULL != pos)
|
|
|
{
|
|
|
COne* pOne = (COne*)pList->GetAt(pos);
|
|
|
if (pOne->GetType() == KEP_WELL)
|
|
|
{
|
|
|
if (pOne->IsInRange(rectReal))
|
|
|
{
|
|
|
bInWell = TRUE;
|
|
|
|
|
|
if (pItem->GetType() != ITEM_WELLPOLE)
|
|
|
{
|
|
|
CItemSingleWell* pItemWell = new CItemSingleWell(GetDocument());
|
|
|
pItemWell->SetPos(pos);
|
|
|
pItemWell->SetDrawObj( (CWellBaseObj*)pOne->GetValue());
|
|
|
pDoc->SetItem(pItemWell);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
pList->GetNext(pos);
|
|
|
}
|
|
|
|
|
|
if (!bInWell)
|
|
|
{
|
|
|
if (pItem->GetType() == ITEM_WELLPOLE /*&& pItem->IsInEdit()*/)
|
|
|
{
|
|
|
//pDoc->SetItem(pDoc->FindItem(ITEM_SELECT));
|
|
|
m_pWndCallBack(tSetItemForElement, vSetSelectItem);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//pDoc->GetItem()->OnLButtonDown(pDC,0, pt,vk);
|
|
|
|
|
|
//if (pDoc->GetItem() != pOldItem && pDoc->GetItem()->GetType() != ITEM_WELLPOLE)
|
|
|
// pDoc->Invalidate();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//void CWellPoleView::OnLButtonUpOther(UINT nFlags, CPoint point)
|
|
|
//{
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
// if (pDoc->GetItem())
|
|
|
// pDoc->GetItem()->OnLButtonUp(nFlags, point);
|
|
|
// else if (pDoc->GetOtherItem())
|
|
|
// pDoc->GetOtherItem()->OnLButtonUp(nFlags, point);
|
|
|
// else
|
|
|
// CDrawView::OnLButtonUpOther(nFlags, point);
|
|
|
//}
|
|
|
|
|
|
int CWellPoleView::OnMouseMove(HDC hMemDC, int mouseX, int mouseY, int buttonStatus)
|
|
|
{
|
|
|
if (!m_bTracking)
|
|
|
{
|
|
|
TRACKMOUSEEVENT tme;
|
|
|
tme.cbSize = sizeof(tme);
|
|
|
tme.hwndTrack = GetHWND();
|
|
|
tme.dwFlags = TME_LEAVE | TME_HOVER;
|
|
|
tme.dwHoverTime = 1;
|
|
|
m_bTracking = _TrackMouseEvent(&tme);
|
|
|
}
|
|
|
|
|
|
if (IsViewState())
|
|
|
{
|
|
|
//int typeBak = pDoc->GetItemView().GetType();
|
|
|
//if (::IsKeyDown(GetPanKey())) pDoc->GetItemView().SetType(ID_VIEW_PAN);
|
|
|
CWellPoleDoc *pWDoc = (CWellPoleDoc *)m_pDoc;
|
|
|
|
|
|
CDC *pDC = CDC::FromHandle(hMemDC);
|
|
|
SetScreenDC(pDC);
|
|
|
CPoint pt;
|
|
|
pt.x = mouseX;
|
|
|
pt.y = mouseY;
|
|
|
int nFlags = 0;
|
|
|
pWDoc->GetItemView()->OnMouseMove(pDC,nFlags, pt);
|
|
|
|
|
|
//if (::IsKeyDown(GetPanKey())) pDoc->GetItemView().SetType(typeBak);
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
|
return CSigmaView::OnMouseMove(hMemDC, mouseX, mouseY, buttonStatus);
|
|
|
|
|
|
//if (::GetPreferences().WorkaroundDisplay.m_bViewCrossLine)
|
|
|
//{
|
|
|
// CDC *pDC = CWnd::GetDC();
|
|
|
// if (m_PrevPointXY.x >= 0)
|
|
|
// DrawCrossLine(/*m_pDrawDC*/pDC, m_PrevPointXY);
|
|
|
// m_PrevPointXY = point;
|
|
|
// DrawCrossLine(/*m_pDrawDC*/pDC, m_PrevPointXY);
|
|
|
|
|
|
// ReleaseDC(pDC);
|
|
|
//}
|
|
|
}
|
|
|
//
|
|
|
//void CWellPoleView::OnMouseMoveOther(UINT nFlags, CPoint point)
|
|
|
//{
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
// if (pDoc->GetItem())
|
|
|
// pDoc->GetItem()->OnMouseMove(nFlags, point);
|
|
|
// else if (pDoc->GetOtherItem())
|
|
|
// pDoc->GetOtherItem()->OnMouseMove(nFlags, point);
|
|
|
// else
|
|
|
// CDrawView::OnMouseMoveOther(nFlags, point);
|
|
|
//}
|
|
|
|
|
|
//void CWellPoleView::OnRButtonDblClkOther(UINT nFlags, CPoint point)
|
|
|
//{
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
// if (pDoc->GetItem())
|
|
|
// pDoc->GetItem()->OnRButtonUp(nFlags, point);
|
|
|
// else if (pDoc->GetOtherItem())
|
|
|
// pDoc->GetOtherItem()->OnRButtonUp(nFlags, point);
|
|
|
//}
|
|
|
//
|
|
|
//void CWellPoleView::OnRButtonDownOther(UINT nFlags, CPoint point)
|
|
|
//{
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
// if (pDoc->GetItem())
|
|
|
// pDoc->GetItem()->OnRButtonDown(nFlags, point);
|
|
|
// else if (pDoc->GetOtherItem())
|
|
|
// pDoc->GetOtherItem()->OnRButtonDown(nFlags, point);
|
|
|
//}
|
|
|
//
|
|
|
//void CWellPoleView::OnRButtonUpOther(UINT nFlags, CPoint point)
|
|
|
//{
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
// if (pDoc->GetItem())
|
|
|
// pDoc->GetItem()->OnRButtonUp(nFlags, point);
|
|
|
// else if (pDoc->GetOtherItem())
|
|
|
// pDoc->GetOtherItem()->OnRButtonUp(nFlags, point);
|
|
|
//}
|
|
|
//
|
|
|
//void CWellPoleView::WriteCusorPos(CPoint2D& point)
|
|
|
//{
|
|
|
// if (!::GetPreferences().IsMonitor()) return;
|
|
|
//
|
|
|
// CString str;
|
|
|
// str.Format("%lf,%lf", point.x0, point.y0);
|
|
|
// theIni.WriteParameter("Mouse", "xy", str, ::GetPreferences().Document.m_strRealCursor);
|
|
|
//}
|
|
|
|
|
|
void CWellPoleView::OnMouseWheelOther(UINT nFlags, short zDelta, CPoint pt)
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
if (pDoc->GetSelectItem())
|
|
|
pDoc->GetSelectItem()->ReloadTrackerPath();
|
|
|
}
|
|
|
|
|
|
|
|
|
//void CWellPoleView::OnContextMenu(CWnd* pWnd, CPoint point)
|
|
|
//{
|
|
|
// m_RButtonDownPoint = point;
|
|
|
// this->ScreenToClient(&m_RButtonDownPoint);
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
//
|
|
|
// if (!pDoc->GetItemView().IsPopupRightMenu()) return;
|
|
|
//
|
|
|
// CItem *pItem = pDoc->GetItem();
|
|
|
// if (pItem == NULL) pItem = pDoc->GetOtherItem();
|
|
|
// if (pItem && !pItem->IsPopupRightMenu()) return;
|
|
|
//
|
|
|
// CMenu menu;
|
|
|
// menu.LoadMenu(IDR_Menu_RButton);
|
|
|
// CMenu* pPopup = ExtendPopupMenu(pItem, &menu);
|
|
|
// ASSERT(pPopup);
|
|
|
// if (pPopup == NULL) return;
|
|
|
//
|
|
|
// CXTPCommandBars::TrackPopupMenu(pPopup, 0, point.x, point.y, AfxGetMainWnd());
|
|
|
//}
|
|
|
|
|
|
|
|
|
CMenu* CWellPoleView::ExtendPopupMenu(CItem* pItem, CMenu* pMenu)
|
|
|
{
|
|
|
if (pMenu == NULL) return NULL;
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
|
|
|
CMenu* pPopup = pMenu->GetSubMenu(3);
|
|
|
if (pItem == NULL) return pPopup;
|
|
|
|
|
|
int sub = pItem->GetSubMenu();
|
|
|
if (sub >= 0)
|
|
|
pPopup = pMenu->GetSubMenu(sub);
|
|
|
else if (pItem->GetType() == ITEM_SELECT &&
|
|
|
GetSelection()->GetCount() == 1 &&
|
|
|
pPopup != NULL)
|
|
|
{
|
|
|
//在缺省菜单[编辑]项之前增加扩展菜单
|
|
|
int index = FindMenuItem(pPopup, ID_EDIT_TOOL);
|
|
|
CPositionList *plist = GetSelection();
|
|
|
POSITION pos = plist->GetHead();
|
|
|
if (pos && index >= 0)
|
|
|
{
|
|
|
COne* pOne = (COne*)pDoc->GetDraw()->GetAt(pos);
|
|
|
CMenu* psub = NULL;
|
|
|
CString strTitle;
|
|
|
switch (pOne->GetType())
|
|
|
{
|
|
|
case DOUBLEFOX_WMF:
|
|
|
psub = pMenu->GetSubMenu(17);
|
|
|
strTitle.LoadString(IDS_STRING_META_FILE);
|
|
|
break;
|
|
|
case DOUBLEFOX_IMAGE: //图像自动矢量化
|
|
|
psub = pMenu->GetSubMenu(1);
|
|
|
strTitle.LoadString(IDS_STRING_IMAGE_TRACE);
|
|
|
break;
|
|
|
case DOUBLEFOX_NET: //根据经纬网生成直角网及边框
|
|
|
psub = pMenu->GetSubMenu(7);
|
|
|
strTitle.LoadString(IDS_STRING_CREATE_WITH_NET);
|
|
|
break;
|
|
|
case DOUBLEFOX_SCALERULER:
|
|
|
psub = pMenu->GetSubMenu(20);
|
|
|
strTitle.LoadString(IDS_STRING_DISSOLUTION_ELEMENT);
|
|
|
break;
|
|
|
case DOUBLEFOX_GRID: //根据直角网生成经纬网及边框
|
|
|
psub = pMenu->GetSubMenu(8);
|
|
|
strTitle.LoadString(IDS_STRING_CREATE_WITH_GRID);
|
|
|
break;
|
|
|
case DOUBLEFOX_OLE:
|
|
|
psub = pMenu->GetSubMenu(9);
|
|
|
strTitle.LoadString(IDS_STRING_OLE_LINK);
|
|
|
strTitle += _T("(&L)"); //加上快捷键
|
|
|
break;
|
|
|
case DOUBLEFOX_INSERT:
|
|
|
case DOUBLEFOX_DRAW:
|
|
|
psub = pMenu->GetSubMenu(10);
|
|
|
strTitle.LoadString(IDS_SELECT_ELEMENT);
|
|
|
strTitle += _T("(&L)"); //加上快捷键
|
|
|
break;
|
|
|
case DOUBLEFOX_MESH:
|
|
|
psub = pMenu->GetSubMenu(11);
|
|
|
strTitle.LoadString(IDS_STRING_MESH_TITLE);
|
|
|
break;
|
|
|
case DOUBLEFOX_SECTION:
|
|
|
psub = pMenu->GetSubMenu(15);
|
|
|
strTitle.LoadString(IDS_GI_SECTION);
|
|
|
break;
|
|
|
}
|
|
|
if (psub)
|
|
|
{
|
|
|
pPopup->InsertMenu(index, MF_BYPOSITION | MF_SEPARATOR);
|
|
|
pPopup->InsertMenu(index, MF_BYPOSITION | MF_POPUP, (UINT_PTR)psub->GetSafeHmenu(), strTitle);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else if (pItem->GetType() == ITEM_SELECT &&
|
|
|
GetSelection()->GetCount() == 2 &&
|
|
|
pPopup != NULL)
|
|
|
{
|
|
|
int index = FindMenuItem(pPopup, ID_EDIT_TOOL);
|
|
|
CPositionList *plist = GetSelection();
|
|
|
int n = plist->GetCount();
|
|
|
POSITION pos = plist->GetHead();
|
|
|
COne* pOne1 = (COne*)pDoc->GetDraw()->GetAt(pos);
|
|
|
plist->GetNext(pos);
|
|
|
COne* pOne2 = (COne*)pDoc->GetDraw()->GetAt(pos);
|
|
|
//if (pOne1->GetType() == DOUBLEFOX_WELL && pOne2->GetType() == DOUBLEFOX_WELL)
|
|
|
//{
|
|
|
// MENUITEMINFO item;
|
|
|
// item.fMask = MIIM_ID | MIIM_STRING;
|
|
|
// item.fType = MFT_STRING;
|
|
|
// item.fState = MFS_ENABLED;
|
|
|
// item.wID = ID_WELL_STRATUM_CONNECTION;
|
|
|
// item.hSubMenu = NULL;
|
|
|
// item.hbmpChecked = NULL;
|
|
|
// item.hbmpUnchecked = NULL;
|
|
|
// item.dwTypeData = _T("生成地层连线");
|
|
|
// item.cch = strlen(_T("生成地层连线"));
|
|
|
// item.cbSize = sizeof(item);
|
|
|
// pPopup->InsertMenuItem(0, &item, TRUE);
|
|
|
//}
|
|
|
}
|
|
|
return pPopup;
|
|
|
}
|
|
|
|
|
|
CPositionList* CWellPoleView::GetSelection(void)
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
if (pDoc->GetItem() == NULL) return NULL;
|
|
|
if (pDoc->GetItem()->GetType() != ITEM_SELECT) return NULL;
|
|
|
return &(((CItemSelect*)pDoc->GetItem())->m_selection);
|
|
|
}
|
|
|
|
|
|
int CWellPoleView::FindMenuItem(CMenu* Menu, LPCTSTR MenuString)
|
|
|
{
|
|
|
ASSERT(Menu);
|
|
|
ASSERT(::IsMenu(Menu->GetSafeHmenu()));
|
|
|
|
|
|
int count = Menu->GetMenuItemCount();
|
|
|
for (int i = 0; i < count; i++)
|
|
|
{
|
|
|
CString str;
|
|
|
if (Menu->GetMenuString(i, str, MF_BYPOSITION) &&
|
|
|
(strcmp(str, MenuString) == 0))
|
|
|
return i;
|
|
|
}
|
|
|
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
// FindMenuItem() will find a menu item ID from the specified
|
|
|
// popup menu and returns its position (0-based) in the specified
|
|
|
// popup menu. It returns -1 if no such menu item ID is found.
|
|
|
int CWellPoleView::FindMenuItem(CMenu* Menu, UINT nID)
|
|
|
{
|
|
|
ASSERT(Menu);
|
|
|
ASSERT(::IsMenu(Menu->GetSafeHmenu()));
|
|
|
|
|
|
int count = Menu->GetMenuItemCount();
|
|
|
for (int i = 0; i < count; i++)
|
|
|
{
|
|
|
if (Menu->GetMenuItemID(i) == nID)
|
|
|
return i;
|
|
|
}
|
|
|
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::ExtendViewForNewWell(CWellPole* pWell)
|
|
|
{
|
|
|
|
|
|
CRect8 rect ;
|
|
|
GetDocument()->GetDrawRange(rect);
|
|
|
|
|
|
CRect window;
|
|
|
window = GetClientRect();
|
|
|
if (window.Width() < 100)
|
|
|
window.SetRect(0, 0, 640, 480);
|
|
|
GetDocument()->GetDC().Extend(rect, window, EXTEND_MODE_WIDTH);
|
|
|
GetDocument()->Invalidate();
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::OnAddWellTrack()
|
|
|
{
|
|
|
CItem *pItem = GetDocument()->GetItem();
|
|
|
if (NULL == pItem)
|
|
|
return;
|
|
|
|
|
|
CItemSingleWell *pItemWell = NULL;
|
|
|
if (pItem->GetType() == ITEM_WELLPOLE)
|
|
|
{
|
|
|
pItemWell = (CItemSingleWell *)pItem;
|
|
|
pItemWell->AddTrack();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//void CWellPoleView::OnUpdateAddWellTrack(CCmdUI *pCmdUI)
|
|
|
//{
|
|
|
// CItem *pItem = GetDocument()->GetItem();
|
|
|
// if (NULL == pItem)
|
|
|
// {
|
|
|
// pCmdUI->Enable(FALSE);
|
|
|
// return;
|
|
|
// }
|
|
|
//
|
|
|
// if (pItem->GetType() == ITEM_WELLPOLE)
|
|
|
// {
|
|
|
// pCmdUI->Enable(TRUE);
|
|
|
// return;
|
|
|
// }
|
|
|
//
|
|
|
// pCmdUI->Enable(FALSE);
|
|
|
//}
|
|
|
|
|
|
void CWellPoleView::InitSelectBmpDC()
|
|
|
{
|
|
|
m_bSelectCreateDC = FALSE;
|
|
|
m_pSelectBmp = NULL;
|
|
|
m_ViewSelW = 8;
|
|
|
m_ViewSelH = 8;
|
|
|
}
|
|
|
void CWellPoleView::CreateSelectBmpDC(int ww, int hh)
|
|
|
{
|
|
|
CDC *pDC = this->m_pImgDC; // this->m_pDC; //GetDC()->GetDC(); //CWnd::GetDC();
|
|
|
m_ViewSelH = hh;
|
|
|
m_ViewSelW = ww;
|
|
|
|
|
|
if (m_ViewSelW < 8)
|
|
|
m_ViewSelW = 8;
|
|
|
if (m_ViewSelH < 8)
|
|
|
m_ViewSelH = 8;
|
|
|
|
|
|
if (m_bSelectCreateDC)
|
|
|
{
|
|
|
m_SelectDC.SelectObject(m_pSelectBmp);
|
|
|
m_SelectBmp.DeleteObject();
|
|
|
m_SelectBmp.CreateCompatibleBitmap(pDC, m_ViewSelW, m_ViewSelH);
|
|
|
m_pSelectBmp = m_SelectDC.SelectObject(&m_SelectBmp);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
BOOL b = m_SelectDC.CreateCompatibleDC(pDC);
|
|
|
m_SelectBmp.CreateCompatibleBitmap(pDC, m_ViewSelW, m_ViewSelH);
|
|
|
m_pSelectBmp = m_SelectDC.SelectObject(&m_SelectBmp);
|
|
|
|
|
|
m_bSelectCreateDC = TRUE;
|
|
|
|
|
|
}
|
|
|
//CWnd::ReleaseDC(pDC);
|
|
|
}
|
|
|
void CWellPoleView::DeleteSelectBmpDC()
|
|
|
{
|
|
|
if (m_pSelectBmp)
|
|
|
{
|
|
|
m_SelectDC.SelectObject(m_pSelectBmp);
|
|
|
m_SelectBmp.DeleteObject();
|
|
|
m_SelectDC.DeleteDC();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::BeginSelectBmpDC()
|
|
|
{
|
|
|
CBrush bru;
|
|
|
bru.CreateSolidBrush(RGB(255, 255, 255));
|
|
|
m_SelectDC.SetMapMode(MM_TEXT);
|
|
|
m_SelectDC.SetWindowOrg(0, 0);
|
|
|
m_SelectDC.SetViewportOrg(0, 0);
|
|
|
m_SelectDC.SetBrushOrg(0, 0);
|
|
|
m_SelectDC.FillRect(CRect(0, 0, m_ViewSelW, m_ViewSelH), &bru);
|
|
|
|
|
|
bru.DeleteObject();
|
|
|
|
|
|
//CMapWnd2D::PrepareDC(&m_SelectDC);
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::EndItemSelectBmpDC(CDC *pDC)
|
|
|
{
|
|
|
//CClientDC dc(this);
|
|
|
|
|
|
CDC* tdc = this->m_pImgDC;
|
|
|
if (pDC == NULL)
|
|
|
{
|
|
|
pDC = tdc; // &dc;
|
|
|
}
|
|
|
|
|
|
//GetMemDC()->SetMapMode(MM_TEXT);
|
|
|
//GetMemDC()->SetViewportOrg(0, 0);
|
|
|
//GetMemDC()->SetWindowOrg(0, 0);
|
|
|
//CRect client;
|
|
|
////pDC->GetClipBox(client);
|
|
|
//client = this->GetClientRect();
|
|
|
//pDC->BitBlt(client.left, client.top, client.Width(), client.Height(), GetMemDC(), 0, 0, SRCCOPY);
|
|
|
|
|
|
EndSelectBmpDC(pDC);
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::EndSelectBmpDC(CDC *pDC)
|
|
|
{
|
|
|
//pDC->SetMapMode(MM_TEXT);
|
|
|
//pDC->SetWindowOrg(0, 0);
|
|
|
//pDC->SetViewportOrg(0, 0);
|
|
|
//pDC->SetBrushOrg(0, 0);
|
|
|
|
|
|
m_SelectDC.SetMapMode(MM_TEXT);
|
|
|
m_SelectDC.SetWindowOrg(0, 0);
|
|
|
m_SelectDC.SetViewportOrg(0, 0);
|
|
|
m_SelectDC.SetBrushOrg(0, 0);
|
|
|
|
|
|
pDC->BitBlt(0, 0, m_ViewSelW, m_ViewSelH, &m_SelectDC, 0, 0, SRCAND);
|
|
|
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::OnEditDelete()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
if (pDoc->GetSelectItem())
|
|
|
pDoc->GetSelectItem()->DeleteSelection();
|
|
|
}
|
|
|
|
|
|
//void CWellPoleView::OnUpdateEditDelete(CCmdUI *pCmdUI)
|
|
|
//{
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
// CItem *pItem = pDoc->GetItem();
|
|
|
// if (NULL == pItem)
|
|
|
// return;
|
|
|
//
|
|
|
// if (pItem->IsNestItem())
|
|
|
// {
|
|
|
// pCmdUI->Enable(TRUE);
|
|
|
// }
|
|
|
// else
|
|
|
// pCmdUI->Enable(!IsEmptySelection());
|
|
|
//}
|
|
|
|
|
|
|
|
|
void CWellPoleView::OnTrackLeftGroup()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
|
|
|
CItem *pItem = pDoc->GetItem();
|
|
|
if (NULL == pItem)
|
|
|
return;
|
|
|
|
|
|
CItemSingleWell *pItemWell = NULL;
|
|
|
//if (pItem->GetType() == ITEM_WELLSECTION || pItem->GetType() == ITEM_WELLFENCE)
|
|
|
//{
|
|
|
// //CItemWellSection* pItemWellSection = (CItemWellSection*)pItem;
|
|
|
// //if(pItemWellSection->m_pItemSelected!=NULL)
|
|
|
// // pItemWell = (CItemSectionWell *)(pItemWellSection->m_pItemSelected);
|
|
|
//}
|
|
|
//else
|
|
|
if (pItem->GetType() == ITEM_WELLPOLE)
|
|
|
pItemWell = (CItemSingleWell *)pItem;
|
|
|
|
|
|
if (pItemWell == NULL)
|
|
|
return;
|
|
|
|
|
|
pItemWell->TrackLeftGroup();
|
|
|
m_pDoc->Invalidate();
|
|
|
|
|
|
//Invalidate(TRUE);
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::OnTrackRightGroup()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
|
|
|
CItem *pItem = pDoc->GetItem();
|
|
|
if (NULL == pItem)
|
|
|
return;
|
|
|
|
|
|
CItemSingleWell *pItemWell = NULL;
|
|
|
//if (pItem->GetType() == ITEM_WELLSECTION || pItem->GetType() == ITEM_WELLFENCE)
|
|
|
//{
|
|
|
// //CItemWellSection* pItemWellSection = (CItemWellSection*)pItem;
|
|
|
// //if(pItemWellSection->m_pItemSelected!=NULL)
|
|
|
// // pItemWell = (CItemSectionWell *)(pItemWellSection->m_pItemSelected);
|
|
|
//}
|
|
|
//else
|
|
|
if (pItem->GetType() == ITEM_WELLPOLE)
|
|
|
pItemWell = (CItemSingleWell *)pItem;
|
|
|
|
|
|
if (pItemWell == NULL)
|
|
|
return;
|
|
|
|
|
|
pItemWell->TrackRightGroup();
|
|
|
m_pDoc->Invalidate();
|
|
|
}
|
|
|
|
|
|
|
|
|
//void CWellPoleView::OnUpdateSelectedTrack(CCmdUI *pCmdUI)
|
|
|
//{
|
|
|
// //pCmdUI->Enable(FALSE);
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
// CItem *pItem = pDoc->GetItem();
|
|
|
// if (NULL == pItem)
|
|
|
// {
|
|
|
// pCmdUI->Enable(FALSE);
|
|
|
// return;
|
|
|
// }
|
|
|
//
|
|
|
// CItemSingleWell *pItemWell = NULL;
|
|
|
// if (pItem->GetType() == ITEM_WELLPOLE)
|
|
|
// {
|
|
|
// pItemWell = (CItemSingleWell *)pItem;
|
|
|
// CTrackObj* pTrack = pItemWell->GetSelectedTrack();
|
|
|
// if (pTrack)
|
|
|
// {
|
|
|
// pCmdUI->Enable(TRUE);
|
|
|
// return;
|
|
|
// }
|
|
|
// }
|
|
|
//
|
|
|
// pCmdUI->Enable(FALSE);
|
|
|
//}
|
|
|
|
|
|
void CWellPoleView::OnAddTrackAfterSelected()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
CItem *pItem = pDoc->GetItem();
|
|
|
if (NULL == pItem)
|
|
|
return;
|
|
|
|
|
|
CItemSingleWell *pItemWell = NULL;
|
|
|
if (pItem->GetType() == ITEM_WELLPOLE)
|
|
|
{
|
|
|
pItemWell = (CItemSingleWell *)pItem;
|
|
|
pItemWell->AddTrackAfterSelected();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
void CWellPoleView::OnViewTrackData()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = (CWellPoleDoc*)(GetDocument());
|
|
|
CItem *pItem = pDoc->GetItem();
|
|
|
if (NULL == pItem)
|
|
|
return;
|
|
|
|
|
|
CItemSingleWell *pItemWell = NULL;
|
|
|
//if (pItem->GetType() == ITEM_WELLSECTION || pItem->GetType() == ITEM_WELLFENCE)
|
|
|
//{
|
|
|
// //CItemWellSection* pItemWellSection = (CItemWellSection*)pItem;
|
|
|
// //if(pItemWellSection->m_pItemSelected!=NULL)
|
|
|
// // pItemWell = (CItemSectionWell *)(pItemWellSection->m_pItemSelected);
|
|
|
//}
|
|
|
//else
|
|
|
if (pItem->GetType() == ITEM_WELLPOLE)
|
|
|
pItemWell = (CItemSingleWell *)pItem;
|
|
|
|
|
|
if (pItemWell != NULL)
|
|
|
pItemWell->AddTrackInObjData();
|
|
|
}
|
|
|
|
|
|
|
|
|
void CWellPoleView::OnViewExtend()
|
|
|
{
|
|
|
//CWellPoleDoc* pDoc = GetDocument();
|
|
|
//pDoc->GetItemView().Extend(EXTEND_MODE_DEFAULT);
|
|
|
//pDoc->InvalidateAttachView(); //是否进行绑定更新其它视图
|
|
|
OnViewExtendCenter();
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::OnViewExtendCenter()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
pDoc->GetItemView()->Extend(EXTEND_MODE_CENTER);
|
|
|
//pDoc->InvalidateAttachView(); //是否进行绑定更新其它视图
|
|
|
|
|
|
if (m_bLockWellHead)
|
|
|
{
|
|
|
ReComputeLockWellHead();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::OnViewExtendHeight()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
pDoc->GetItemView()->Extend(EXTEND_MODE_HEIGHT);
|
|
|
MoveWellToHorizCenter();
|
|
|
//pDoc->InvalidateAttachView(); //是否进行绑定更新其它视图
|
|
|
if (m_bLockWellHead)
|
|
|
{
|
|
|
ReComputeLockWellHead();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::OnViewExtendWidth()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
pDoc->GetItemView()->Extend(EXTEND_MODE_WIDTH);
|
|
|
//pDoc->InvalidateAttachView(); //是否进行绑定更新其它视图
|
|
|
if (m_bLockWellHead)
|
|
|
{
|
|
|
ReComputeLockWellHead();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::SetScrollBarRange(void)
|
|
|
{
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
//
|
|
|
// if (pDoc->GetDraw() == NULL ||
|
|
|
// pDoc->GetDraw()->GetCount() == 0)
|
|
|
// {
|
|
|
// SCROLLINFO bar;
|
|
|
// // if (IsHScrollBarVisible())
|
|
|
// {
|
|
|
// ::SetScrollInfo(this->GetHWND(), SB_HORZ, 0, 1000);
|
|
|
// //CWnd::SetScrollRange(SB_HORZ, 0, 1000);
|
|
|
// ::GetScrollInfo(this->GetHWND(), SB_HORZ, &bar, SIF_ALL);
|
|
|
// bar.nPage = 980;
|
|
|
// SetScrollInfo(SB_HORZ, &bar, 0);
|
|
|
//
|
|
|
// // if (!IsVScrollBarVisible())
|
|
|
// // EnableVScrollBarVisible(false);
|
|
|
//
|
|
|
// }
|
|
|
//
|
|
|
// // if (IsVScrollBarVisible())
|
|
|
// {
|
|
|
// CWnd::SetScrollRange(SB_VERT, 0, 1000);
|
|
|
// GetScrollInfo(SB_VERT, &bar, SIF_ALL);
|
|
|
// bar.nPage = 980;
|
|
|
// SetScrollInfo(SB_VERT, &bar, 0);
|
|
|
//
|
|
|
// // if (!IsHScrollBarVisible())
|
|
|
// // EnableHScrollBarVisible(false);
|
|
|
// }
|
|
|
// return;
|
|
|
// }
|
|
|
// if (m_bLockWellHead)
|
|
|
// {
|
|
|
// SetScrollBarRangeLockHead();
|
|
|
// return;
|
|
|
// }
|
|
|
// CXyDC* pDC = &pDoc->GetDC();
|
|
|
// pDC->Create(m_pDrawDC);
|
|
|
// CRect8 range;
|
|
|
// pDoc->GetDrawRange(range);
|
|
|
//
|
|
|
// //图件总范围
|
|
|
// double dx = range.right - range.left;
|
|
|
// double dy = range.top - range.bottom;
|
|
|
//
|
|
|
// int hts = pDC->GetScreenWidth(dx);// *100 / m_zoom_in_out;
|
|
|
// int vts = pDC->GetScreenHeight(fabs(dy));// *100 / m_zoom_in_out;
|
|
|
// vts = abs(vts);
|
|
|
//
|
|
|
// //if (IsHScrollBarVisible())
|
|
|
// {
|
|
|
// CWnd::SetScrollRange(SB_HORZ, 0, hts);
|
|
|
//
|
|
|
// //if (!IsVScrollBarVisible())
|
|
|
// // EnableVScrollBarVisible(false);
|
|
|
// }
|
|
|
//// if (IsVScrollBarVisible())
|
|
|
// {
|
|
|
// CWnd::SetScrollRange(SB_VERT, 0, vts);
|
|
|
//
|
|
|
// //if (!IsHScrollBarVisible())
|
|
|
// // EnableHScrollBarVisible(false);
|
|
|
// }
|
|
|
//
|
|
|
// //获得屏幕范围
|
|
|
// CRect rcScreen; GetClientRect(&rcScreen);
|
|
|
// CRect8 rcScreenReal = pDC->GetReal(rcScreen);
|
|
|
// rcScreenReal.NormalizeRect();
|
|
|
//
|
|
|
// SCROLLINFO bar;
|
|
|
// //if (IsHScrollBarVisible())
|
|
|
// {
|
|
|
// GetScrollInfo(SB_HORZ, &bar, SIF_ALL);
|
|
|
// bar.nPage = AfxGetBaseFunction()->FloatToLong((rcScreenReal.right - rcScreenReal.left) / dx * hts);
|
|
|
// if (bar.nPage > (UINT)(hts - 5)) bar.nPage = hts - 5;
|
|
|
// SetScrollInfo(SB_HORZ, &bar, 0);
|
|
|
// }
|
|
|
//
|
|
|
// //if (IsVScrollBarVisible())
|
|
|
// {
|
|
|
// GetScrollInfo(SB_VERT, &bar, SIF_ALL);
|
|
|
// bar.nPage = AfxGetBaseFunction()->FloatToLong((rcScreenReal.top - rcScreenReal.bottom) / dy * vts);
|
|
|
// if (bar.nPage > (UINT)(vts - 5)) bar.nPage = vts - 5;
|
|
|
// SetScrollInfo(SB_VERT, &bar, 0);
|
|
|
// }
|
|
|
//
|
|
|
// //设置当前滚动条位置
|
|
|
// double xm = rcScreenReal.left - range.left;
|
|
|
// double ym = range.top - rcScreenReal.top;
|
|
|
// xm = xm / dx * hts;
|
|
|
// ym = ym / dy * vts;
|
|
|
// if (xm < 0) xm = 0; if (xm > hts) xm = hts;
|
|
|
// if (ym < 0) ym = 0; if (ym > vts) ym = vts;
|
|
|
//
|
|
|
// //if (IsHScrollBarVisible())
|
|
|
// {
|
|
|
// SetScrollPos(SB_HORZ, AfxGetBaseFunction()->FloatToLong(xm));
|
|
|
// }
|
|
|
// //if (IsVScrollBarVisible())
|
|
|
// {
|
|
|
// SetScrollPos(SB_VERT, AfxGetBaseFunction()->FloatToLong(ym));
|
|
|
// }
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::SetScrollBarRangeLockHead()
|
|
|
{
|
|
|
//CWellPoleDoc* pDoc = GetDocument();
|
|
|
//CWellPole* pWell = pDoc->GetWellPole();
|
|
|
////if (pWell->GetDepthLength() < m_LockWellHeadStruct.screenDepth)
|
|
|
////{
|
|
|
//// return;
|
|
|
////}
|
|
|
//double screeHeight = m_LockWellHeadStruct.screenHeight;
|
|
|
//if (screeHeight > m_LockWellHeadStruct.screenWellBodyLength)
|
|
|
// screeHeight = m_LockWellHeadStruct.screenWellBodyLength;
|
|
|
|
|
|
//SCROLLINFO bar;
|
|
|
//int vts = fabs(pDoc->GetDC().GetScreenHeight(m_LockWellHeadStruct.screenWellBodyLength));//设置滚动条范围、页大小、滑块位置都要转为像素大小进行
|
|
|
////int vts = int(fabs(m_LockWellHeadStruct.screenWellBodyLength));
|
|
|
//CWnd::SetScrollRange(SB_VERT, 0, vts);
|
|
|
//GetScrollInfo(SB_VERT, &bar, SIF_ALL);
|
|
|
////int pages = fabs(pDoc->GetDC().GetScreenHeight(m_LockWellHeadStruct.screenHeight));
|
|
|
//bar.nPage = m_LockWellHeadStruct.screenHeight*1.0 / m_LockWellHeadStruct.screenWellBodyLength*vts;// pDoc->GetDC().GetScreenHeight(m_LockWellHeadStruct.screenHeight);// AfxGetBaseFunction()->FloatToLong(pDoc->GetDC().GetScreenHeight(fabs(m_LockWellHeadStruct.screenHeight)));
|
|
|
//if (bar.nPage > (UINT)(vts - 5))
|
|
|
// bar.nPage = vts - 5;
|
|
|
//SetScrollInfo(SB_VERT, &bar, 0);
|
|
|
|
|
|
//double ym = pWell->GetHeadLockStartDepth() - pWell->m_dSdep;
|
|
|
//ym = ym / (pWell->GetDepthLength()) * vts;
|
|
|
|
|
|
////ym = ym /(pWell->GetDepthLength()- m_LockWellHeadStruct.screenDepth) * vts;
|
|
|
//SetScrollPos(SB_VERT, AfxGetBaseFunction()->FloatToLong(ym));
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::SetScrollBarVRangeForLockWellHead(int& vrange, int & page, int &value)
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
CWellPole* pWell = pDoc->GetWellPole();
|
|
|
|
|
|
double screeHeight = m_LockWellHeadStruct.screenHeight;
|
|
|
if (screeHeight > m_LockWellHeadStruct.screenWellBodyLength)
|
|
|
screeHeight = m_LockWellHeadStruct.screenWellBodyLength;
|
|
|
|
|
|
SCROLLINFO bar;
|
|
|
vrange = fabs(pDoc->GetDC().GetScreenHeight(m_LockWellHeadStruct.screenWellBodyLength));//设置滚动条范围、页大小、滑块位置都要转为像素大小进行
|
|
|
|
|
|
bar.nPage = m_LockWellHeadStruct.screenHeight*1.0 / m_LockWellHeadStruct.screenWellBodyLength* vrange;// pDoc->GetDC().GetScreenHeight(m_LockWellHeadStruct.screenHeight);// AfxGetBaseFunction()->FloatToLong(pDoc->GetDC().GetScreenHeight(fabs(m_LockWellHeadStruct.screenHeight)));
|
|
|
if (bar.nPage > (UINT)(vrange - 5))
|
|
|
bar.nPage = vrange - 5;
|
|
|
page = bar.nPage;
|
|
|
|
|
|
double ym = pWell->GetHeadLockStartDepth() - pWell->m_dSdep;
|
|
|
ym = ym / (pWell->GetDepthLength()) * vrange;
|
|
|
value = AfxGetBaseFunction()->FloatToLong(ym);
|
|
|
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::VScrollLockWellHead(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
|
|
{
|
|
|
//CWellPoleDoc* pDoc = GetDocument();
|
|
|
//CClientDC dc(this); pDoc->SetDC(&dc);
|
|
|
//CWellPole* pWell = pDoc->GetWellPole();
|
|
|
|
|
|
//if (m_LockWellHeadStruct.screenDepth > pWell->GetDepthLength())
|
|
|
//{//屏幕空间容纳整个井
|
|
|
// if (abs(pWell->GetHeadLockStartDepth() - pWell->m_dSdep) > 0.00001 ||
|
|
|
// abs(pWell->GetHeadLockEndDepth() - pWell->m_dEdep) > 0.00001)
|
|
|
// {
|
|
|
// pWell->SetHeadLockStateDepth(pWell->m_dSdep, pWell->m_dEdep);
|
|
|
// pDoc->Invalidate();
|
|
|
// }
|
|
|
// return;
|
|
|
//}
|
|
|
|
|
|
//CXyDC *pDC = &GetDC();
|
|
|
//CRect crt; this->GetClientRect(&crt);
|
|
|
|
|
|
//long ol = AfxGetPublicFunction()->FloatToLong(crt.Height()*::GetPreferences().Other.m_dScrollOneLine); //一行的象素个数
|
|
|
//long op = AfxGetPublicFunction()->FloatToLong(crt.Height()*::GetPreferences().Other.m_dScrollOnePage); //一页的象素个数
|
|
|
//if (ol < 1)ol = 1; if (op < 1)op = 1;
|
|
|
//double OneLine = pDC->GetRealHeight(ol); //(目前的坐标体系下,这个数一直是负数) //一行的实际单位数
|
|
|
//double OnePage = pDC->GetRealHeight(op); //一页的实际单位数
|
|
|
|
|
|
//double lineDepth = fabs(OneLine) / m_LockWellHeadStruct.screenHeight * m_LockWellHeadStruct.screenDepth; //每行所对应的偏移深度
|
|
|
//double pageDepth = fabs(OnePage) / m_LockWellHeadStruct.screenHeight * m_LockWellHeadStruct.screenDepth; //每页所对应的偏移深度
|
|
|
|
|
|
//int offset = 0;
|
|
|
//BOOL bFlash = FALSE;
|
|
|
|
|
|
//switch (nSBCode)
|
|
|
//{
|
|
|
//case SB_ENDSCROLL: // End scroll.
|
|
|
// break;
|
|
|
//case SB_BOTTOM: //Scroll to bottom.
|
|
|
// {
|
|
|
// double edep = pWell->m_dEdep;
|
|
|
// double sdep = edep - m_LockWellHeadStruct.screenDepth;
|
|
|
// pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
|
|
|
// offset = -ol;
|
|
|
// }
|
|
|
// break;
|
|
|
//case SB_TOP:
|
|
|
// {
|
|
|
// double sdep = pWell->m_dSdep;
|
|
|
// double edep = sdep + m_LockWellHeadStruct.screenDepth;
|
|
|
// pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
|
|
|
// offset = ol;
|
|
|
// }
|
|
|
// break;
|
|
|
//case SB_LINEDOWN: //Scroll one line down.,井柱向上移动,相当于显示井段的顶底都增加
|
|
|
// {
|
|
|
// double edep = pWell->GetHeadLockEndDepth() + lineDepth;
|
|
|
// if (edep > pWell->m_dEdep)
|
|
|
// edep = pWell->m_dEdep;
|
|
|
// double sdep = edep - m_LockWellHeadStruct.screenDepth;
|
|
|
// pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
// offset = -ol;
|
|
|
// }
|
|
|
// break;
|
|
|
//case SB_LINEUP: //Scroll one line up.
|
|
|
// {
|
|
|
// double sdep = pWell->GetHeadLockStartDepth() - lineDepth;
|
|
|
// if (sdep < pWell->m_dSdep)
|
|
|
// sdep = pWell->m_dSdep;
|
|
|
// double edep = sdep + m_LockWellHeadStruct.screenDepth;
|
|
|
// pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
// offset = ol;
|
|
|
// }
|
|
|
// break;
|
|
|
//case SB_PAGEDOWN: //Scroll one page down.
|
|
|
// {
|
|
|
// double edep = pWell->GetHeadLockEndDepth() + pageDepth;
|
|
|
// if (edep > pWell->m_dEdep)
|
|
|
// edep = pWell->m_dEdep;
|
|
|
// double sdep = edep - m_LockWellHeadStruct.screenDepth;
|
|
|
// pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
// offset = -op;
|
|
|
// }
|
|
|
// break;
|
|
|
// case SB_PAGEUP: //Scroll one page up.
|
|
|
// {
|
|
|
// double sdep = pWell->GetHeadLockStartDepth() - pageDepth;
|
|
|
// if (sdep < pWell->m_dSdep)
|
|
|
// sdep = pWell->m_dSdep;
|
|
|
// double edep = sdep + m_LockWellHeadStruct.screenDepth;
|
|
|
// pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
// offset = op;
|
|
|
// }
|
|
|
// break;
|
|
|
// case SB_THUMBPOSITION: //Scroll to the absolute position. The current position is provided in nPos.
|
|
|
// case SB_THUMBTRACK: //Drag scroll box to specified position. The current position is provided in nPos.
|
|
|
// {
|
|
|
// double nMax = this->GetScrollLimit(SB_VERT);
|
|
|
// double sdep = nPos / nMax * (pWell->m_dEdep - pWell->m_dSdep - m_LockWellHeadStruct.screenDepth) + pWell->m_dSdep;
|
|
|
// double edep = sdep + m_LockWellHeadStruct.screenDepth;
|
|
|
// pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
// bFlash = TRUE;
|
|
|
// break;
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
//if (offset != 0)
|
|
|
//{
|
|
|
// bFlash = TRUE;
|
|
|
//}
|
|
|
//if (bFlash)
|
|
|
//{
|
|
|
// pDoc->Invalidate();
|
|
|
//}
|
|
|
|
|
|
//CView::OnVScroll(nSBCode, nPos, pScrollBar);
|
|
|
}
|
|
|
//
|
|
|
//void CWellPoleView::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
|
|
//{
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
// CClientDC dc(this); pDoc->SetDC(&dc);
|
|
|
// if(pDoc->GetDraw()==NULL || pDoc->GetDraw()->GetCount()==0)
|
|
|
// {
|
|
|
// CView::OnVScroll(nSBCode, nPos, pScrollBar);
|
|
|
// return;
|
|
|
// }
|
|
|
// if (m_bLockWellHead)
|
|
|
// {
|
|
|
// return VScrollLockWellHead(nSBCode,nPos, pScrollBar);
|
|
|
// }
|
|
|
//
|
|
|
// CXyDC *pDC = &GetDC();
|
|
|
// CRect crt; this->GetClientRect(&crt);
|
|
|
// CRect8 rcScreenReal = pDC->GetReal(crt);
|
|
|
// rcScreenReal.NormalizeRect();
|
|
|
// CRect8 range; //井图范围
|
|
|
// pDoc->GetDrawRange(range);
|
|
|
//
|
|
|
// long ol = AfxGetPublicFunction()->FloatToLong(crt.Height()*::GetPreferences().Other.m_dScrollOneLine); //一行的象素个数
|
|
|
// long op = AfxGetPublicFunction()->FloatToLong(crt.Height()*::GetPreferences().Other.m_dScrollOnePage); //一页的象素个数
|
|
|
// if (ol < 1)ol = 1; if (op < 1)op = 1;
|
|
|
// double OneLine = pDC->GetRealHeight(ol); //(目前的坐标体系下,这个数一直是负数) //一行的实际单位数
|
|
|
// double OnePage = pDC->GetRealHeight(op); //一页的实际单位数
|
|
|
//
|
|
|
// int offset = 0;
|
|
|
// BOOL bFlash = FALSE;
|
|
|
//
|
|
|
// switch (nSBCode)
|
|
|
// {
|
|
|
// case SB_ENDSCROLL: // End scroll.
|
|
|
// break;
|
|
|
// case SB_BOTTOM: //Scroll to bottom.
|
|
|
// pDC->OffsetRect(0, pDoc->GetDraw()->m_range.bottom - rcScreenReal.bottom);
|
|
|
// offset = -ol;
|
|
|
// break;
|
|
|
// case SB_TOP:
|
|
|
// pDC->OffsetRect(0, pDoc->GetDraw()->m_range.top - rcScreenReal.top);
|
|
|
// offset = ol;
|
|
|
// break;
|
|
|
// case SB_LINEDOWN: //Scroll one line down.,看井柱的下面,相当于把图往上移动
|
|
|
// if ( (range.bottom + OneLine) > rcScreenReal.bottom)
|
|
|
// {
|
|
|
// OneLine = 0;// rcScreenReal.bottom - range.bottom;
|
|
|
// }
|
|
|
// pDC->OffsetRect(0, OneLine);
|
|
|
// offset = -ol;
|
|
|
// break;
|
|
|
// case SB_LINEUP: //Scroll one line up.
|
|
|
// if ((range.top + OneLine) < rcScreenReal.top)
|
|
|
// OneLine = 0;
|
|
|
//
|
|
|
// pDC->OffsetRect(0, -OneLine);
|
|
|
// offset = ol;
|
|
|
// break;
|
|
|
// case SB_PAGEDOWN: //Scroll one page down.
|
|
|
// pDC->OffsetRect(0, OnePage);
|
|
|
// offset = -op;
|
|
|
// break;
|
|
|
// case SB_PAGEUP: //Scroll one page up.
|
|
|
// pDC->OffsetRect(0, -OnePage);
|
|
|
// offset = op;
|
|
|
// break;
|
|
|
// case SB_THUMBPOSITION: //Scroll to the absolute position. The current position is provided in nPos.
|
|
|
// case SB_THUMBTRACK: //Drag scroll box to specified position. The current position is provided in nPos.
|
|
|
// if (pDoc->GetDraw()->GetCount() > 0)
|
|
|
// {
|
|
|
// double nMax = this->GetScrollLimit(SB_VERT);
|
|
|
// CRect8 rect = range; // pDoc->GetDraw()->m_range;
|
|
|
// double bak = rcScreenReal.top;
|
|
|
// double dy = rcScreenReal.top - rcScreenReal.bottom;
|
|
|
// pDC->top = rect.top - (rect.top - rect.bottom - dy)*(nPos / nMax);
|
|
|
// pDC->bottom = pDC->top - dy;
|
|
|
// if (bak != pDC->top)
|
|
|
// bFlash = TRUE;
|
|
|
// }
|
|
|
// break;
|
|
|
// }
|
|
|
//
|
|
|
// if (offset != 0)
|
|
|
// {
|
|
|
// bFlash = TRUE;
|
|
|
// }
|
|
|
// if (bFlash)
|
|
|
// {
|
|
|
// pDoc->Invalidate();
|
|
|
// }
|
|
|
//
|
|
|
// CView::OnVScroll(nSBCode, nPos, pScrollBar);
|
|
|
//}
|
|
|
//
|
|
|
//void CWellPoleView::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
|
|
|
//{
|
|
|
// CWellPoleDoc* pDoc = GetDocument();
|
|
|
// CClientDC dc(this); pDoc->SetDC(&dc);
|
|
|
// if(pDoc->GetDraw()==NULL || pDoc->GetDraw()->GetCount()==0)
|
|
|
// {
|
|
|
// CView::OnHScroll(nSBCode, nPos, pScrollBar);
|
|
|
// return;
|
|
|
// }
|
|
|
// CXyDC *pDC = &GetDC();
|
|
|
//
|
|
|
// CRect crt; this->GetClientRect(&crt);
|
|
|
// CRect8 rcScreenReal = pDC->GetReal(crt);
|
|
|
// rcScreenReal.NormalizeRect();
|
|
|
// CRect8 range;
|
|
|
// pDoc->GetDrawRange(range);
|
|
|
//
|
|
|
// long ol = AfxGetPublicFunction()->FloatToLong(crt.Width()*::GetPreferences().Other.m_dScrollOneLine); //一行的象素个数
|
|
|
// long op = AfxGetPublicFunction()->FloatToLong(crt.Width()*::GetPreferences().Other.m_dScrollOnePage); //一页的象素个数
|
|
|
// if (ol < 1)ol = 1; if (op < 1)op = 1;
|
|
|
// double OneLine = pDC->GetRealWidth(ol); //一行的实际单位数
|
|
|
// double OnePage = pDC->GetRealWidth(op); //一页的实际单位数
|
|
|
//
|
|
|
// int offset = 0;
|
|
|
// BOOL bFlash = FALSE;
|
|
|
//
|
|
|
// switch (nSBCode)
|
|
|
// {
|
|
|
// case SB_ENDSCROLL: // End scroll.
|
|
|
// break;
|
|
|
// case SB_LEFT: //Scroll to left.
|
|
|
// pDC->OffsetRect(pDoc->GetDraw()->m_range.left - rcScreenReal.left, 0);
|
|
|
// offset -= ol;
|
|
|
// break;
|
|
|
// case SB_RIGHT:
|
|
|
// pDC->OffsetRect(pDoc->GetDraw()->m_range.right - rcScreenReal.right, 0);
|
|
|
// offset = ol;
|
|
|
// break;
|
|
|
// case SB_LINERIGHT: //Scroll one line down.
|
|
|
// if ((range.right - OneLine) < rcScreenReal.right)
|
|
|
// {
|
|
|
// OneLine = range.right - rcScreenReal.right;
|
|
|
// if (OneLine < 0)
|
|
|
// OneLine = 0;
|
|
|
// }
|
|
|
// pDC->OffsetRect(OneLine, 0);
|
|
|
// offset = -ol;
|
|
|
// break;
|
|
|
// case SB_LINELEFT: //Scroll one line up.
|
|
|
// if ((range.left + OneLine) > rcScreenReal.left)
|
|
|
// {
|
|
|
// OneLine = rcScreenReal.left - range.left;
|
|
|
// if (OneLine < 0)
|
|
|
// OneLine = 0;
|
|
|
// }
|
|
|
// pDC->OffsetRect(-OneLine, 0);
|
|
|
// offset = ol;
|
|
|
// break;
|
|
|
// case SB_PAGERIGHT: //Scroll one page down.
|
|
|
// pDC->OffsetRect(OnePage, 0);
|
|
|
// offset = -op;
|
|
|
// break;
|
|
|
// case SB_PAGELEFT: //Scroll one page up.
|
|
|
// pDC->OffsetRect(-OnePage, 0);
|
|
|
// offset = op;
|
|
|
// break;
|
|
|
// case SB_THUMBPOSITION: //Scroll to the absolute position. The current position is provided in nPos.
|
|
|
// case SB_THUMBTRACK: //Drag scroll box to specified position. The current position is provided in nPos.
|
|
|
// if (pDoc->GetDraw()->GetCount() > 0)
|
|
|
// {
|
|
|
// double nMax = this->GetScrollLimit(SB_HORZ);
|
|
|
// CRect8 rect = range;// pDoc->GetDraw()->m_range;
|
|
|
// double bak = rcScreenReal.left;
|
|
|
// double dx = rcScreenReal.right - rcScreenReal.left; //一页的实际宽度
|
|
|
// pDC->left = rect.left + (rect.right - rect.left - dx)*(nPos / nMax);
|
|
|
// pDC->right = pDC->left + dx;
|
|
|
// if (bak != pDC->left)
|
|
|
// bFlash = TRUE;
|
|
|
// }
|
|
|
// break;
|
|
|
// }
|
|
|
// if (offset != 0)
|
|
|
// {
|
|
|
// //this->ScrollWindow(offset,0);
|
|
|
// //if(offset>0)//left
|
|
|
// // crt.right=crt.left+offset+3;
|
|
|
// //else
|
|
|
// // crt.left=crt.right+offset-3;
|
|
|
// //dc.SelectStockObject(WHITE_PEN); dc.Rectangle(crt);
|
|
|
// //InvalidateRect(crt);
|
|
|
// //SetScrollBarRange();
|
|
|
// bFlash = TRUE;
|
|
|
// }
|
|
|
//
|
|
|
// if (bFlash)
|
|
|
// {
|
|
|
// pDoc->Invalidate();
|
|
|
// }
|
|
|
//
|
|
|
// CView::OnHScroll(nSBCode, nPos, pScrollBar);
|
|
|
//}
|
|
|
|
|
|
BOOL CWellPoleView::MouseWheel(UINT nFlags, short zDelta, CPoint pt)
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
|
|
|
//::ScreenToClient(GetHWND(),&pt);
|
|
|
|
|
|
CPoint offsetpt = CPoint(0, 0);
|
|
|
switch (nFlags)
|
|
|
{
|
|
|
case 0:
|
|
|
//上下移动图件
|
|
|
MouseWheelV(nFlags, zDelta, pt);
|
|
|
break;
|
|
|
case 1:
|
|
|
//左右移动图件
|
|
|
{
|
|
|
if (fabs(zDelta) > 0)
|
|
|
{
|
|
|
int pp = 0;
|
|
|
}
|
|
|
MouseWheelH(nFlags, zDelta, pt);
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
BOOL CWellPoleView::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
//CClientDC dc(this);
|
|
|
//pDoc->SetDC(&dc);
|
|
|
|
|
|
if (pDoc->GetDraw() == NULL || pDoc->GetDraw()->GetCount() == 0)
|
|
|
return TRUE;
|
|
|
|
|
|
return MouseWheel(nFlags, zDelta, pt);
|
|
|
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
|
|
|
BOOL CWellPoleView::MouseWheelH(UINT nFlags, short zDelta, CPoint pt)
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
CXyDC* pdc = &pDoc->GetDC();
|
|
|
CRect crt;
|
|
|
crt = GetClientRect();
|
|
|
CRect8 rcScreenReal = pdc->GetReal(crt);
|
|
|
rcScreenReal.NormalizeRect();
|
|
|
|
|
|
CRect8 range;
|
|
|
pDoc->GetDrawRange(range);
|
|
|
|
|
|
double OneLine = pdc->GetRealWidth((long)zDelta); //一行的实际单位数
|
|
|
|
|
|
if (range.Width() < rcScreenReal.Width())
|
|
|
{//当图的范围小于屏幕范围时,(这时图的左侧或右侧,移动时不要超过屏幕的左右侧范围)
|
|
|
|
|
|
if (OneLine < 0)
|
|
|
{//往左滚动
|
|
|
if ((range.left + OneLine) < rcScreenReal.left)
|
|
|
{
|
|
|
OneLine = range.left - rcScreenReal.left;
|
|
|
}
|
|
|
|
|
|
if (OneLine >= 0)
|
|
|
return FALSE;
|
|
|
pdc->OffsetRect(-OneLine, 0);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if ((range.right + OneLine) > rcScreenReal.right)
|
|
|
{
|
|
|
OneLine = rcScreenReal.right - range.right;
|
|
|
}
|
|
|
if (OneLine <= 0)
|
|
|
return FALSE;
|
|
|
|
|
|
pdc->OffsetRect(-OneLine, 0);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{/*当图的范围大于屏幕范围时,(这时如果向右侧移动时,当图的左侧进入屏幕的左侧范围,就可以停止移动,
|
|
|
如果向左侧移动,图的右侧范围进入屏幕的右侧,就可以停止移动)*/
|
|
|
if (OneLine < 0)
|
|
|
{//往左滚动
|
|
|
if ((range.right + OneLine) < rcScreenReal.right)
|
|
|
{
|
|
|
OneLine = 0;// range.left - rcScreenReal.left;
|
|
|
}
|
|
|
|
|
|
if (OneLine >= 0)
|
|
|
return FALSE;
|
|
|
pdc->OffsetRect(-OneLine, 0);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if ((range.left + OneLine) > rcScreenReal.left)
|
|
|
{
|
|
|
OneLine = 0;// rcScreenReal.right - range.right;
|
|
|
}
|
|
|
if (OneLine <= 0)
|
|
|
return FALSE;
|
|
|
|
|
|
pdc->OffsetRect(-OneLine, 0);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
int offset = pdc->GetScreenWidth(OneLine);
|
|
|
|
|
|
if (offset != 0)
|
|
|
{
|
|
|
//ScrollWindow(offset, 0);
|
|
|
m_pDoc->Invalidate();
|
|
|
OnMouseWheelOther(nFlags, zDelta, pt);
|
|
|
}
|
|
|
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
BOOL CWellPoleView::MouseWheelVLockHead(UINT nFlags, short zDelta, CPoint pt)
|
|
|
{
|
|
|
if (zDelta == 0)
|
|
|
return TRUE;
|
|
|
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
CWellPole* pWell = pDoc->GetWellPole();
|
|
|
//double depDelta = pWell->ScreenCYToHeight(zDelta);
|
|
|
if (m_LockWellHeadStruct.screenDepth > pWell->GetDepthLength())
|
|
|
{//屏幕空间容纳整个井
|
|
|
if (abs(pWell->GetHeadLockStartDepth() - pWell->m_dSdep) > 0.00001 ||
|
|
|
abs(pWell->GetHeadLockEndDepth() - pWell->m_dEdep) > 0.00001)
|
|
|
{
|
|
|
pWell->SetHeadLockStateDepth(pWell->m_dSdep, pWell->m_dEdep);
|
|
|
m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0);
|
|
|
//pDoc->Invalidate();
|
|
|
}
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
double depDelta = fabs(pWell->ScreenCYToHeight(pDoc->GetDC().GetRealHeight(zDelta*1.0)));
|
|
|
double currSdep = pWell->GetHeadLockStartDepth();
|
|
|
|
|
|
double ssdep = currSdep;
|
|
|
double sedep = currSdep + m_LockWellHeadStruct.screenDepth;
|
|
|
if (zDelta > 0)
|
|
|
{//井柱向下滚动,相当于显示井段的顶底都减小
|
|
|
if ((currSdep - depDelta) < pWell->m_dSdep)
|
|
|
{
|
|
|
ssdep = pWell->m_dSdep;
|
|
|
}
|
|
|
else
|
|
|
ssdep = currSdep - depDelta;
|
|
|
|
|
|
sedep = currSdep + m_LockWellHeadStruct.screenDepth;
|
|
|
}
|
|
|
else
|
|
|
{//井柱向上滚动,相当于显示井段的顶底都增加
|
|
|
if ((pWell->GetHeadLockEndDepth() + depDelta) > pWell->m_dEdep)
|
|
|
{
|
|
|
sedep = pWell->m_dEdep;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
sedep = pWell->GetHeadLockEndDepth() + depDelta;
|
|
|
}
|
|
|
ssdep = sedep - m_LockWellHeadStruct.screenDepth;
|
|
|
}
|
|
|
|
|
|
pWell->SetHeadLockStateDepth( ssdep, sedep);
|
|
|
//pDoc->Invalidate();
|
|
|
m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0);
|
|
|
return TRUE;
|
|
|
}
|
|
|
BOOL CWellPoleView::MouseWheelV(UINT nFlags, short zDelta, CPoint pt)
|
|
|
{
|
|
|
if (m_bLockWellHead)
|
|
|
{
|
|
|
return MouseWheelVLockHead(nFlags, zDelta, pt);
|
|
|
}
|
|
|
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
CXyDC* pdc = &pDoc->GetDC();
|
|
|
CRect crt;
|
|
|
crt = GetClientRect();
|
|
|
CRect8 rcScreenReal = pdc->GetReal(crt);
|
|
|
rcScreenReal.NormalizeRect();
|
|
|
|
|
|
double OneLine = pdc->GetRealHeight((long)zDelta/*ol*/); //一行的实际单位数
|
|
|
|
|
|
CRect8 range;
|
|
|
pDoc->GetDrawRange(range);
|
|
|
|
|
|
if (range.Height() > rcScreenReal.Height())
|
|
|
{//图的显示范围大于屏幕
|
|
|
if (OneLine < 0)
|
|
|
{//显示井柱往上部分
|
|
|
if (rcScreenReal.top - OneLine >= range.top)
|
|
|
OneLine = rcScreenReal.top - range.top;
|
|
|
|
|
|
if (OneLine >= 0)
|
|
|
return FALSE;
|
|
|
|
|
|
pdc->OffsetRect(0, -OneLine);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (rcScreenReal.bottom - OneLine <= range.bottom)
|
|
|
OneLine = rcScreenReal.bottom - range.bottom;
|
|
|
|
|
|
if (OneLine <= 0)
|
|
|
return FALSE;
|
|
|
|
|
|
pdc->OffsetRect(0, -OneLine);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{ //图形小于屏幕
|
|
|
if (OneLine < 0)
|
|
|
{//显示井柱往上部分 ,图的底部不低于屏幕的底部
|
|
|
if ((range.bottom + OneLine) < rcScreenReal.bottom)
|
|
|
OneLine = rcScreenReal.bottom - range.bottom;
|
|
|
if (OneLine >= 0)
|
|
|
return FALSE;
|
|
|
pdc->OffsetRect(0, -OneLine);
|
|
|
}
|
|
|
else
|
|
|
{//图的顶部不高于屏幕的顶部
|
|
|
if ((range.top + OneLine) > rcScreenReal.top)
|
|
|
OneLine = rcScreenReal.top - range.top;
|
|
|
if (OneLine <= 0)
|
|
|
return FALSE;
|
|
|
pdc->OffsetRect(0, -OneLine);
|
|
|
}
|
|
|
}
|
|
|
int offset = pdc->GetScreenHeight(OneLine);
|
|
|
|
|
|
if (offset != 0)
|
|
|
{
|
|
|
m_pDoc->Invalidate();
|
|
|
OnMouseWheelOther(nFlags, zDelta, pt);
|
|
|
}
|
|
|
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::OnViewPan()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
CItemView* pItem = pDoc->GetItemView();
|
|
|
if (pItem == NULL)
|
|
|
return;
|
|
|
if (pItem->GetType() == ID_VIEW_PAN_WELL || pItem->GetType() == ID_VIEW_PAN)
|
|
|
{
|
|
|
pItem->SetType(0);
|
|
|
pDoc->SetDefaultCursor();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
if (pDoc->GetWellPole())
|
|
|
pItem->SetType(ID_VIEW_PAN_WELL);
|
|
|
else
|
|
|
pItem->SetType(ID_VIEW_PAN);
|
|
|
|
|
|
pDoc->SetDefaultCursor();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//void CWellPoleView::OnUpdateViewPan(CCmdUI *pCmdUI)
|
|
|
//{
|
|
|
// * pDoc = GetDocument();
|
|
|
// pCmdUI->SetCheck(pDoc->GetItemView().GetType() == ID_VIEW_PAN || pDoc->GetItemView().GetType() == ID_VIEW_PAN_WELL);
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
void CWellPoleView::MoveWellToHorizCenter()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
CWellPole* pWell = pDoc->GetWellPole();
|
|
|
if (pWell == NULL)
|
|
|
return;
|
|
|
|
|
|
CRect srect;
|
|
|
srect = GetClientRect();
|
|
|
|
|
|
CRect8 rrect;
|
|
|
rrect = pDoc->GetDC().GetReal(srect);
|
|
|
|
|
|
CRect8 wrect = pWell->GetRect();
|
|
|
|
|
|
float dx = rrect.CenterPoint().x0 - wrect.CenterPoint().x0;
|
|
|
|
|
|
pDoc->GetDC().OffsetRect(-dx, 0);
|
|
|
pDoc->Invalidate();
|
|
|
}
|
|
|
|
|
|
void CWellPoleView :: OnLockWellHead()
|
|
|
{
|
|
|
if (!m_bLockWellHead)
|
|
|
LockWellHead();
|
|
|
else
|
|
|
UnlockWellHead();
|
|
|
}
|
|
|
void CWellPoleView::OnUpdateLockWellHead(CCmdUI* pCmdUI)
|
|
|
{
|
|
|
pCmdUI->SetCheck(m_bLockWellHead);
|
|
|
}
|
|
|
|
|
|
|
|
|
void CWellPoleView::OnViewEnlarge()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
CRect srect;
|
|
|
srect = GetClientRect();
|
|
|
CRect8 oldRect = pDoc->GetDC().GetReal(srect);
|
|
|
|
|
|
pDoc->GetItemView()->Enlarge();
|
|
|
//pDoc->InvalidateAttachView(); //是否进行绑定更新其它视图
|
|
|
|
|
|
CRect8 newRect = pDoc->GetDC().GetReal(srect);
|
|
|
CPoint2D deltPt;
|
|
|
deltPt.x0 = newRect.CenterPoint().x0 - oldRect.CenterPoint().x0;
|
|
|
deltPt.y0 = newRect.CenterPoint().y0 - oldRect.CenterPoint().y0;
|
|
|
|
|
|
pDoc->GetDC().OffsetRect(-deltPt.x0, -deltPt.y0);
|
|
|
if (m_bLockWellHead)
|
|
|
{
|
|
|
ReComputeLockWellHead();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::OnViewReduce()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
CRect srect;
|
|
|
srect = GetClientRect();
|
|
|
CRect8 oldRect = pDoc->GetDC().GetReal(srect);
|
|
|
|
|
|
pDoc->GetItemView()->Reduce();
|
|
|
//pDoc->InvalidateAttachView(); //是否进行绑定更新其它视图
|
|
|
|
|
|
CRect8 newRect = pDoc->GetDC().GetReal(srect);
|
|
|
CPoint2D deltPt;
|
|
|
deltPt.x0 = newRect.CenterPoint().x0 - oldRect.CenterPoint().x0;
|
|
|
deltPt.y0 = newRect.CenterPoint().y0 - oldRect.CenterPoint().y0;
|
|
|
|
|
|
pDoc->GetDC().OffsetRect(-deltPt.x0, -deltPt.y0);
|
|
|
|
|
|
if (m_bLockWellHead)
|
|
|
{
|
|
|
ReComputeLockWellHead();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::ComputeLockWellHeadInfo(LOCKWELLHEAD& LockWellHeadStruct)
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
|
|
|
CWellPole* pWell = pDoc->GetWellPole();
|
|
|
double dWellBodyTop = pWell->GetRect().top - pWell->m_dHeightTrackHead - pWell->m_dHeightWellHead;
|
|
|
CRect srect;
|
|
|
srect = GetClientRect();
|
|
|
CRect8 screenRealRect = pDoc->GetDC().GetReal(srect);
|
|
|
|
|
|
//double hscrollBarWidth = GetSystemMetrics(SM_CYHSCROLL); //水平滚动条的厚度
|
|
|
//LockWellHeadStruct.screenRealWellHeight = dWellBodyTop - screenRealRect.bottom;
|
|
|
LockWellHeadStruct.screenHeight = dWellBodyTop - screenRealRect.bottom;// +fabs(pDoc->GetDC().GetRealHeight(hscrollBarWidth)));// fabs(pDoc->GetDC().GetScreenHeight(LockWellHeadStruct.screenRealWellHeight));
|
|
|
double ttsh = dWellBodyTop - (screenRealRect.bottom );
|
|
|
LockWellHeadStruct.screenDepth = pWell->ScreenCYToHeight(LockWellHeadStruct.screenHeight); //屏幕上井身空间能够显示的井段高度单位(米)
|
|
|
double tdep = pWell->m_dEdep - pWell->m_dSdep;// -LockWellHeadStruct.screenDepth;
|
|
|
if(tdep < 0)
|
|
|
tdep = LockWellHeadStruct.screenDepth;
|
|
|
LockWellHeadStruct.screenWellBodyLength = pWell->HeightToScreenCY(tdep );//(pWell->m_dEdep - pWell->m_dSdep) * 10000.0*pWell->m_dDepthRatio / pWell->m_fProportion;// pWell->DepthToScreenY(pWell->m_dEdep - pWell->m_dSdep);
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::ReComputeLockWellHead()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
ComputeLockWellHeadInfo(m_LockWellHeadStruct);
|
|
|
CWellPole* pWell = pDoc->GetWellPole();
|
|
|
double endSdep = pWell->m_dSdep + m_LockWellHeadStruct.screenDepth;
|
|
|
if (endSdep > pWell->m_dEdep)
|
|
|
endSdep = pWell->m_dEdep; //屏幕空间可以容纳井。
|
|
|
pWell->SetHeadLockState(TRUE, pWell->m_dSdep, endSdep);
|
|
|
m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0);
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::LockWellHead()
|
|
|
{
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
if (pDoc->GetWellPole() == NULL)
|
|
|
return;
|
|
|
|
|
|
MoveWellToHorizCenter();
|
|
|
|
|
|
m_bLockWellHead = TRUE; //放到这里,避免上面移动井时,进行进度条的设置
|
|
|
ReComputeLockWellHead();
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::UnlockWellHead()
|
|
|
{
|
|
|
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
if (pDoc->GetWellPole() == NULL)
|
|
|
return;
|
|
|
|
|
|
m_bLockWellHead = FALSE;
|
|
|
|
|
|
pDoc->GetWellPole()->SetHeadLockState(FALSE);
|
|
|
m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0);
|
|
|
}
|
|
|
|
|
|
|
|
|
void CWellPoleView::DrawCrossLine(CDC* pDC, CPoint point)
|
|
|
{
|
|
|
if (!m_bTracking)
|
|
|
return;
|
|
|
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
CWellPole* pWell = pDoc->GetWellPole();
|
|
|
if (pDoc->GetWellPole() != NULL)
|
|
|
{
|
|
|
CRect8 wRect = pWell->GetRect();
|
|
|
wRect.top = wRect.top - pWell->m_dHeightTrackHead - pWell->m_dHeightWellHead;
|
|
|
CRect sWRect = pDoc->GetDC().GetScreen(wRect);
|
|
|
sWRect.NormalizeRect();
|
|
|
if (point.y >= sWRect.bottom || point.y <= sWRect.top)
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
CRect rt = this->GetClientRect();
|
|
|
int nOldRop = pDC->SetROP2(R2_NOTXORPEN);
|
|
|
//pDC->MoveTo(point.x, rt.top);
|
|
|
//pDC->LineTo(point.x, rt.bottom);
|
|
|
pDC->MoveTo(rt.left, point.y);
|
|
|
pDC->LineTo(rt.right, point.y);
|
|
|
pDC->SetROP2(nOldRop);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
void CWellPoleView::SetLastRightButtonPoint(const CPoint& point)
|
|
|
{
|
|
|
CSigmaView::SetLastRightButtonPoint(point);
|
|
|
m_PrevPointXY = point;
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::OnMouseLeave()
|
|
|
{
|
|
|
//if (::GetPreferences().WorkaroundDisplay.m_bViewCrossLine)
|
|
|
//{
|
|
|
// if (m_PrevPointXY.x >= 0)
|
|
|
// DrawCrossLine(m_pDrawDC, m_PrevPointXY);
|
|
|
//}
|
|
|
|
|
|
m_PrevPointXY.SetPoint(-100, -100);
|
|
|
m_bTracking = FALSE;
|
|
|
//CView::OnMouseLeave();
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::DrawOneCrossLine(CPoint currentPoint)
|
|
|
{
|
|
|
//if (::GetPreferences().WorkaroundDisplay.m_bViewCrossLine && m_PrevPointXY.x >= 0)
|
|
|
//{
|
|
|
// DrawCrossLine(GetDC().GetDC(), currentPoint);
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
|
|
|
void CWellPoleView::SetClient(int l, int t, int r, int b)
|
|
|
{
|
|
|
CSigmaView::SetClient(l, t, r, b);
|
|
|
OnSize(0, r - l, b - t);
|
|
|
}
|
|
|
|
|
|
|
|
|
void CWellPoleView::Scroll(int orientation, double offset)
|
|
|
{
|
|
|
CSigmaView::Scroll(orientation, offset);
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::Initialize()
|
|
|
{
|
|
|
if (m_pDoc)
|
|
|
delete m_pDoc;
|
|
|
|
|
|
m_pDoc = new CWellPoleDoc();
|
|
|
m_pDoc->SetView(this);
|
|
|
m_pItemBkGrid->SetDoc(m_pDoc);
|
|
|
|
|
|
m_bFirstSize = TRUE;
|
|
|
m_pWndCallBack = NULL;
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::ViewExtendCenter()
|
|
|
{
|
|
|
OnViewExtendHeight();
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::ViewExtendWidth()
|
|
|
{
|
|
|
OnViewExtendWidth();
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::SetWellPoleViewPan()
|
|
|
{
|
|
|
if (m_pDoc->GetItemView()->GetType() == ID_VIEW_PAN_WELL)
|
|
|
{
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
m_pDoc->GetItemView()->SetType(ID_VIEW_PAN_WELL);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::SetViewPanInvalidate()
|
|
|
{
|
|
|
m_pDoc->GetItemView()->SetType(0);
|
|
|
}
|
|
|
|
|
|
|
|
|
BOOL CWellPoleView::IsViewState()
|
|
|
{
|
|
|
CWellPoleDoc *pDoc = (CWellPoleDoc*)m_pDoc;
|
|
|
if (pDoc->GetItemView()->GetType() != 0 /*|| ::IsKeyDown(GetPanKey())*/)
|
|
|
return TRUE;
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::InitWellPosition(int lrEdge)
|
|
|
{
|
|
|
if (lrEdge < 0)
|
|
|
lrEdge = 0;
|
|
|
|
|
|
CRect rect = m_client;
|
|
|
if (rect.Width() < 100)
|
|
|
rect.SetRect(0, 0, 640, 480);
|
|
|
CWellPoleDoc *pDoc = (CWellPoleDoc*)m_pDoc;
|
|
|
if (pDoc->GetWellPole() == NULL)
|
|
|
return;
|
|
|
CRect8 rrect(1e100, -1e100, -1e100, 1e100);
|
|
|
rrect = pDoc->GetDraw()->GetRange();
|
|
|
|
|
|
rect.left += lrEdge;
|
|
|
rect.right -= lrEdge;
|
|
|
pDoc->GetDC().Extend(rrect, rect, EXTEND_MODE_WIDTH);
|
|
|
|
|
|
m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0);
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::SetLockWellHead(bool block)
|
|
|
{
|
|
|
if (block == false)
|
|
|
{
|
|
|
if (m_bLockWellHead == TRUE)
|
|
|
UnlockWellHead();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (!m_bLockWellHead)
|
|
|
LockWellHead();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
void CWellPoleView::ScrollVForLockWellHead( int nFlags, int scrollValue, int pageSize, int lineSize, int scrollMin, int scrollMax)
|
|
|
{
|
|
|
UINT nSBCode = nFlags;
|
|
|
int nPos = scrollValue;
|
|
|
CWellPoleDoc* pDoc = GetDocument();
|
|
|
//CClientDC dc(this); pDoc->SetDC(&dc);
|
|
|
CWellPole* pWell = pDoc->GetWellPole();
|
|
|
|
|
|
if (m_LockWellHeadStruct.screenDepth > pWell->GetDepthLength())
|
|
|
{//屏幕空间容纳整个井
|
|
|
if (abs(pWell->GetHeadLockStartDepth() - pWell->m_dSdep) > 0.00001 ||
|
|
|
abs(pWell->GetHeadLockEndDepth() - pWell->m_dEdep) > 0.00001)
|
|
|
{
|
|
|
pWell->SetHeadLockStateDepth(pWell->m_dSdep, pWell->m_dEdep);
|
|
|
pDoc->Invalidate();
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
//CXyDC *pDC = &GetDC();
|
|
|
//CRect crt; this->GetClientRect(&crt);
|
|
|
|
|
|
long ol = lineSize;//AfxGetPublicFunction()->FloatToLong(crt.Height()*::GetPreferences().Other.m_dScrollOneLine); //一行的象素个数
|
|
|
long op = pageSize; // AfxGetPublicFunction()->FloatToLong(crt.Height()*::GetPreferences().Other.m_dScrollOnePage); //一页的象素个数
|
|
|
if (ol < 1)ol = 1; if (op < 1)op = 1;
|
|
|
double OneLine = pDoc->GetDC().GetRealHeight(ol); //(目前的坐标体系下,这个数一直是负数) //一行的实际单位数
|
|
|
double OnePage = pDoc->GetDC().GetRealHeight(op); //一页的实际单位数
|
|
|
|
|
|
double lineDepth = fabs(OneLine) / m_LockWellHeadStruct.screenHeight * m_LockWellHeadStruct.screenDepth; //每行所对应的偏移深度
|
|
|
double pageDepth = fabs(OnePage) / m_LockWellHeadStruct.screenHeight * m_LockWellHeadStruct.screenDepth; //每页所对应的偏移深度
|
|
|
|
|
|
int offset = 0;
|
|
|
BOOL bFlash = FALSE;
|
|
|
|
|
|
switch (nSBCode)
|
|
|
{
|
|
|
case SB_ENDSCROLL: // End scroll.
|
|
|
break;
|
|
|
case SB_BOTTOM: //Scroll to bottom.
|
|
|
{
|
|
|
double edep = pWell->m_dEdep;
|
|
|
double sdep = edep - m_LockWellHeadStruct.screenDepth;
|
|
|
pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
|
|
|
offset = -ol;
|
|
|
}
|
|
|
break;
|
|
|
case SB_TOP:
|
|
|
{
|
|
|
double sdep = pWell->m_dSdep;
|
|
|
double edep = sdep + m_LockWellHeadStruct.screenDepth;
|
|
|
pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
|
|
|
offset = ol;
|
|
|
}
|
|
|
break;
|
|
|
case SB_LINEDOWN: //Scroll one line down.,井柱向上移动,相当于显示井段的顶底都增加
|
|
|
{
|
|
|
double edep = pWell->GetHeadLockEndDepth() + lineDepth;
|
|
|
if (edep > pWell->m_dEdep)
|
|
|
edep = pWell->m_dEdep;
|
|
|
double sdep = edep - m_LockWellHeadStruct.screenDepth;
|
|
|
pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
offset = -ol;
|
|
|
}
|
|
|
break;
|
|
|
case SB_LINEUP: //Scroll one line up.
|
|
|
{
|
|
|
double sdep = pWell->GetHeadLockStartDepth() - lineDepth;
|
|
|
if (sdep < pWell->m_dSdep)
|
|
|
sdep = pWell->m_dSdep;
|
|
|
double edep = sdep + m_LockWellHeadStruct.screenDepth;
|
|
|
pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
offset = ol;
|
|
|
}
|
|
|
break;
|
|
|
case SB_PAGEDOWN: //Scroll one page down.
|
|
|
{
|
|
|
double edep = pWell->GetHeadLockEndDepth() + pageDepth;
|
|
|
if (edep > pWell->m_dEdep)
|
|
|
edep = pWell->m_dEdep;
|
|
|
double sdep = edep - m_LockWellHeadStruct.screenDepth;
|
|
|
pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
offset = -op;
|
|
|
}
|
|
|
break;
|
|
|
case SB_PAGEUP: //Scroll one page up.
|
|
|
{
|
|
|
double sdep = pWell->GetHeadLockStartDepth() - pageDepth;
|
|
|
if (sdep < pWell->m_dSdep)
|
|
|
sdep = pWell->m_dSdep;
|
|
|
double edep = sdep + m_LockWellHeadStruct.screenDepth;
|
|
|
pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
offset = op;
|
|
|
}
|
|
|
break;
|
|
|
case SB_THUMBPOSITION: //Scroll to the absolute position. The current position is provided in nPos.
|
|
|
case SB_THUMBTRACK: //Drag scroll box to specified position. The current position is provided in nPos.
|
|
|
{
|
|
|
double nMax = scrollMax - pageSize + 1; // this->GetScrollLimit(SB_VERT);
|
|
|
double sdep = nPos / nMax * (pWell->m_dEdep - pWell->m_dSdep - m_LockWellHeadStruct.screenDepth) + pWell->m_dSdep;
|
|
|
double edep = sdep + m_LockWellHeadStruct.screenDepth;
|
|
|
pWell->SetHeadLockStateDepth(sdep, edep);
|
|
|
bFlash = TRUE;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (offset != 0)
|
|
|
{
|
|
|
bFlash = TRUE;
|
|
|
}
|
|
|
if (bFlash)
|
|
|
{
|
|
|
m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0);
|
|
|
//pDoc->Invalidate();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
BOOL CWellPoleView::GetSelectWellObject(int& type, int& ttype, ULONGLONG& objHandle)
|
|
|
{
|
|
|
type = -1;
|
|
|
ttype = -1;
|
|
|
objHandle = 0;
|
|
|
|
|
|
CWellPoleDoc* pWellDoc = (CWellPoleDoc*)m_pDoc;
|
|
|
|
|
|
if (m_pDoc->GetItem() == NULL)
|
|
|
return FALSE;
|
|
|
|
|
|
if (m_pDoc->GetItem()->GetType() == ITEM_WELLPOLE)
|
|
|
{
|
|
|
CItemSingleWell* pItemWell = (CItemSingleWell*)m_pDoc->GetItem();
|
|
|
if (pItemWell->m_pItemSelected == NULL)
|
|
|
{
|
|
|
CWellPole* pWell = pWellDoc->GetWellPole();
|
|
|
type = KEP_WELL;
|
|
|
ttype = KEP_WELL;
|
|
|
objHandle = (ULONGLONG)(pWell);
|
|
|
return TRUE;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if (pItemWell->m_pItemSelected->GetType() == ITEM_TRACK)
|
|
|
{
|
|
|
CItemTrack* pItemTrack = (CItemTrack*)pItemWell->m_pItemSelected;
|
|
|
type = KEP_TRACK;
|
|
|
CTrackObj* pTrack = (CTrackObj*)pItemTrack->GetDrawObj();
|
|
|
ttype = pTrack->GetTrackType();
|
|
|
objHandle = (ULONGLONG)(pItemTrack->GetDrawObj());
|
|
|
|
|
|
return TRUE;
|
|
|
}
|
|
|
if (pItemWell->m_pItemSelected->GetType() == ITEM_TRACKIN)
|
|
|
{
|
|
|
CItemTrackIn* pItemTrackIn = (CItemTrackIn*)pItemWell->m_pItemSelected;
|
|
|
type = KEP_TRACKINDATA;
|
|
|
CWellBaseObj* pTrack = (CWellBaseObj*)pItemTrackIn->GetDrawObj();
|
|
|
ttype = pTrack->GetType();
|
|
|
objHandle = (ULONGLONG)(pItemTrackIn->GetDrawObj());
|
|
|
|
|
|
return TRUE;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
BOOL CWellPoleView::AddTrackAfterSelectedWellObject(int trackType[], int trackNum)
|
|
|
{
|
|
|
BOOL b = FALSE;
|
|
|
|
|
|
CWellPoleDoc* pWellDoc = (CWellPoleDoc*)m_pDoc;
|
|
|
|
|
|
if (m_pDoc->GetItem() == NULL)
|
|
|
return b;
|
|
|
|
|
|
if (m_pDoc->GetItem()->GetType() == ITEM_WELLPOLE)
|
|
|
{
|
|
|
CItemSingleWell* pItemWell = (CItemSingleWell*)m_pDoc->GetItem();
|
|
|
CTrackObj* pSelectTrack = NULL;
|
|
|
|
|
|
if (pItemWell->m_WellObjSelectlist.GetCount() > 0)
|
|
|
{
|
|
|
CWellBaseObj* pObjSelected = pItemWell->m_WellObjSelectlist.GetHead();
|
|
|
if (pObjSelected->GetType() == KEP_TRACK)
|
|
|
{
|
|
|
pSelectTrack = (CTrackObj*)pObjSelected;
|
|
|
}
|
|
|
}
|
|
|
pItemWell->AddTrack(pSelectTrack, trackType, trackNum);
|
|
|
m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0);
|
|
|
b = TRUE;
|
|
|
}
|
|
|
return b;
|
|
|
}
|
|
|
|
|
|
BOOL CWellPoleView::DeleteSelectedWellObject()
|
|
|
{
|
|
|
BOOL b = FALSE;
|
|
|
|
|
|
CWellPoleDoc* pWellDoc = (CWellPoleDoc*)m_pDoc;
|
|
|
|
|
|
if (m_pDoc->GetItem() == NULL)
|
|
|
return b;
|
|
|
|
|
|
if (m_pDoc->GetItem()->GetType() == ITEM_WELLPOLE)
|
|
|
{
|
|
|
CItemSingleWell* pItemWell = (CItemSingleWell*)m_pDoc->GetItem();
|
|
|
pItemWell->DeleteSelection();
|
|
|
m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0);
|
|
|
b = TRUE;
|
|
|
}
|
|
|
|
|
|
return b;
|
|
|
}
|
|
|
|
|
|
BOOL CWellPoleView::CombineLeftTrack()
|
|
|
{
|
|
|
BOOL b = FALSE;
|
|
|
|
|
|
CWellPoleDoc* pWellDoc = (CWellPoleDoc*)m_pDoc;
|
|
|
|
|
|
if (m_pDoc->GetItem() == NULL)
|
|
|
return b;
|
|
|
|
|
|
if (m_pDoc->GetItem()->GetType() == ITEM_WELLPOLE)
|
|
|
{
|
|
|
CItemSingleWell* pItemWell = (CItemSingleWell*)m_pDoc->GetItem();
|
|
|
pItemWell->TrackLeftGroup();
|
|
|
m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0);
|
|
|
b = TRUE;
|
|
|
}
|
|
|
|
|
|
return b;
|
|
|
}
|
|
|
|
|
|
BOOL CWellPoleView::CombineRightTrack()
|
|
|
{
|
|
|
BOOL b = FALSE;
|
|
|
|
|
|
CWellPoleDoc* pWellDoc = (CWellPoleDoc*)m_pDoc;
|
|
|
|
|
|
if (m_pDoc->GetItem() == NULL)
|
|
|
return b;
|
|
|
|
|
|
if (m_pDoc->GetItem()->GetType() == ITEM_WELLPOLE)
|
|
|
{
|
|
|
CItemSingleWell* pItemWell = (CItemSingleWell*)m_pDoc->GetItem();
|
|
|
pItemWell->TrackRightGroup();
|
|
|
m_pWndCallBack(eWellPoleCallbackMsgDef::tInvalidateWnd, 0);
|
|
|
b = TRUE;
|
|
|
}
|
|
|
|
|
|
return b;
|
|
|
}
|
|
|
|
|
|
BOOL CWellPoleView::GetSelectedWell( ULONGLONG& objHandle)
|
|
|
{
|
|
|
objHandle = 0;
|
|
|
|
|
|
CWellPoleDoc* pWellDoc = (CWellPoleDoc*)m_pDoc;
|
|
|
|
|
|
if (m_pDoc->GetItem() == NULL)
|
|
|
return FALSE;
|
|
|
|
|
|
if (m_pDoc->GetItem()->GetType() == ITEM_WELLPOLE)
|
|
|
{
|
|
|
CItemSingleWell* pItemWell = (CItemSingleWell*)m_pDoc->GetItem();
|
|
|
if (pItemWell->m_pItemSelected == NULL)
|
|
|
{
|
|
|
CWellPole* pWell = pWellDoc->GetWellPole();
|
|
|
objHandle = (ULONGLONG)(pWell);
|
|
|
return TRUE;
|
|
|
}
|
|
|
}
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
BOOL CWellPoleView::GetWellTrackDataJson(ULONGLONG& objHandle, CString& strJson)
|
|
|
{
|
|
|
CWellBaseObj* pt = (CWellBaseObj*)(objHandle);
|
|
|
CTrackObj* pTrack = NULL;
|
|
|
try
|
|
|
{
|
|
|
pTrack = dynamic_cast<CTrackObj*>(pt);
|
|
|
if (pTrack == NULL)
|
|
|
return FALSE;
|
|
|
}
|
|
|
catch (std::exception e)
|
|
|
{
|
|
|
return FALSE;
|
|
|
}
|
|
|
pTrack->GetChildDatas(strJson);
|
|
|
return TRUE;
|
|
|
}
|
|
|
|
|
|
BOOL CWellPoleView::SetWellTrackDataJson(ULONGLONG& objHandle, LPCTSTR strJson)
|
|
|
{
|
|
|
CWellBaseObj* pt = (CWellBaseObj*)(objHandle);
|
|
|
CTrackObj* pTrack = NULL;
|
|
|
try
|
|
|
{
|
|
|
pTrack = dynamic_cast<CTrackObj*>(pt);
|
|
|
if (pTrack == NULL)
|
|
|
return FALSE;
|
|
|
}
|
|
|
catch (std::exception e)
|
|
|
{
|
|
|
return FALSE;
|
|
|
}
|
|
|
CString str = strJson;
|
|
|
return pTrack->SetChildDatas(str);
|
|
|
}
|
|
|
|
|
|
CImageInsert* ReadImage(LPCTSTR lpcsImageName)
|
|
|
{
|
|
|
int type = CImageBase::GetImageType(lpcsImageName);
|
|
|
|
|
|
if (type == CXIMAGE_FORMAT_TIF) //读取GeoTiff文件
|
|
|
{
|
|
|
FILE* hFile = fopen(lpcsImageName, "rb");
|
|
|
if (hFile == NULL) return FALSE;
|
|
|
|
|
|
CImageBase *pi = new CImageBase;
|
|
|
CxImageGeoTIFF newima;
|
|
|
if (!newima.CxImageTIF::Decode(hFile))
|
|
|
{
|
|
|
fclose(hFile);
|
|
|
delete pi;
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
CImageInsert* pImage = new CImageInsert();
|
|
|
pi->Transfer(newima);
|
|
|
pImage->m_pImage = pi;
|
|
|
pImage->SetName(lpcsImageName);
|
|
|
|
|
|
if (newima.m_bIsGeoTiff && fabs(newima.dx) > 1e-15 && fabs(newima.dy) > 1e-15)
|
|
|
{
|
|
|
pImage->x0 = newima.x0;
|
|
|
pImage->y0 = newima.y0;
|
|
|
pImage->m_size.cx = newima.dx*pImage->m_pImage->GetWidth();
|
|
|
pImage->m_size.cy = newima.dy*pImage->m_pImage->GetHeight();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
pImage->m_size.cx = pImage->GetImage()->GetWidth();
|
|
|
pImage->m_size.cy = pImage->GetImage()->GetHeight();
|
|
|
pImage->x0 = 0;
|
|
|
pImage->y0 = 0;
|
|
|
}
|
|
|
|
|
|
fclose(hFile);
|
|
|
return pImage;
|
|
|
}
|
|
|
|
|
|
CImageInsert* pImage = new CImageInsert();
|
|
|
if (!pImage->LoadImage(lpcsImageName))
|
|
|
{
|
|
|
delete pImage;
|
|
|
::AfxMessageBox("Load image file error!");
|
|
|
return NULL;
|
|
|
}
|
|
|
pImage->m_size.cx = pImage->GetImage()->GetWidth();
|
|
|
pImage->m_size.cy = pImage->GetImage()->GetHeight();
|
|
|
pImage->x0 = 0;
|
|
|
pImage->y0 = 0;
|
|
|
return pImage;
|
|
|
}
|
|
|
|
|
|
BOOL CWellPoleView::SetPictureInWellTrack(ULONGLONG pictureObjHandle, LPCSTR filePath)
|
|
|
{
|
|
|
CWellBaseObj* pt = (CWellBaseObj*)(pictureObjHandle);
|
|
|
CInTrackPicture* pInPicture = NULL;
|
|
|
try
|
|
|
{
|
|
|
pInPicture = dynamic_cast<CInTrackPicture*>(pt);
|
|
|
if (pInPicture == NULL)
|
|
|
return FALSE;
|
|
|
}
|
|
|
catch (std::exception e)
|
|
|
{
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
CImageInsert* pImage = ReadImage(filePath);
|
|
|
if (pImage != NULL)
|
|
|
{
|
|
|
CRect8 rect = pInPicture->GetPos();
|
|
|
CRect8 rt = m_pDoc->GetDC().GetReal(pInPicture->GetPos());
|
|
|
|
|
|
pImage->x0 = rt.left;
|
|
|
pImage->y0 = rt.bottom;
|
|
|
if (pImage->m_size.cx > pImage->m_size.cy)
|
|
|
{
|
|
|
pImage->m_size.cy = rt.Width()*pImage->m_size.cy / pImage->m_size.cx;
|
|
|
pImage->m_size.cx = rt.Width();
|
|
|
pImage->y0 += (rt.Height() - pImage->m_size.cy)*0.5;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
pImage->m_size.cx = rt.Height()*pImage->m_size.cx / pImage->m_size.cy;
|
|
|
pImage->m_size.cy = rt.Height();
|
|
|
pImage->x0 += (rt.Width() - pImage->m_size.cx)*0.5;
|
|
|
}
|
|
|
if (pInPicture->m_pImage)
|
|
|
delete pInPicture->m_pImage;
|
|
|
pInPicture->m_pImage = pImage;
|
|
|
pInPicture->m_pImage->SetRect(pInPicture->GetPos());
|
|
|
pInPicture->m_pImage->SetName("");
|
|
|
}
|
|
|
|
|
|
return TRUE;
|
|
|
} |