📄 drawvw.cpp
字号:
//DEL CRect client;
//DEL COLORREF color;
//DEL GetClientRect(&client); //取屏幕宽度与高度 736 415
//DEL CDrawRect* pObj = new CDrawRect(recttext,client,"");
//DEL color = m_ColorRed;
//DEL //pObj->m_text = "kkkkkkkkkkkk";
//DEL pObj->m_ArrText.Add("P1 100");
//DEL pObj->m_ArrText.Add("0.8 2.0 39.3");
//DEL pObj->m_bBrush = FALSE;
//DEL //CRectTool* pTool = new CRectTool(line);
//DEL //pTool->SetTest(pObj,line);
//DEL GetDocument()->Add(pObj);
//DEL
//DEL pObj->SetFillColor(color);
//DEL Select(pObj);
//DEL }
//DEL if (i==0)
//DEL {
//DEL
//DEL CRect _rect;
//DEL _rect.top=215;
//DEL _rect.bottom=531;
//DEL _rect.left=397;
//DEL _rect.right=235;
//DEL
//DEL CDrawRect* pObj = new CDrawRect(_rect);
//DEL GetDocument()->Add(pObj);
//DEL Select(pObj);
//DEL
//DEL _rect.top=215;
//DEL _rect.bottom=531;
//DEL _rect.left=197;
//DEL _rect.right=35;
//DEL
//DEL pObj = new CDrawRect(_rect);
//DEL GetDocument()->Add(pObj);
//DEL Select(pObj);
//DEL }
//DEL if (i==2)
//DEL {
//DEL CRect client;
//DEL GetClientRect(&client); //取屏幕宽度与高度 736 415
//DEL CDrawRect* pObj = new CDrawRect(client);
//DEL GetDocument()->Add(pObj);
//DEL Select(pObj);
//DEL }
//DEL if (i==3)
//DEL {
//DEL CRect client;
//DEL GetClientRect(&client); //取屏幕宽度与高度 736 415
//DEL CDC *pDC = GetDC();
//DEL pDC->Rectangle(client);
//DEL }
//DEL if (i==1)
//DEL {
//DEL CRect _rect;
//DEL _rect.top=95;
//DEL _rect.bottom=218;
//DEL _rect.left=367;
//DEL _rect.right=582;
//DEL CDrawPoly* pObj = new CDrawPoly(_rect);
//DEL GetDocument()->Add(pObj);
//DEL Select(pObj);
//DEL pObj->AddPoint(CPoint(323,270),this);
//DEL pObj->AddPoint(CPoint(353,490),this);
//DEL pObj->AddPoint(CPoint(153,390),this);
//DEL }
//DEL }
/*****************************************************************************
//说明:划单口井 画布绘的图形坐标是从右下到左上的,所以坐标处理时用减法
// 有井号、井类、层(五种属性及中心线)
// 此井层与主井相应的连通线
//修改:
*****************************************************************************/
BOOL CDrawView::DrawWell(const int pX,const int pY,const int pTag,CDWell *pCWell)
{
int iX = pX; //横轴 此值基本不变
int iY = pY; //终轴 每个元素都在变化
CRect rect;
COLORREF color;
if (pTag == 1) //如果是主井,就存起来,否则就进入其它井判断是否连接
{
// CPoint point = CalcuScrollToView(pCWell->fX,pCWell->fY);
//CPoint point ;
//CSize size = GeoToView(pCWell->fX,pCWell->fY);
//point.x = size.cx - 640*g_fZoom;//-= 500*g_fZoom;
//point.y = size.cy;//-= 250*g_fZoom;
//DocToClient(point);
// point.x -= 640*(g_fZoom*g_fZoom);
// point.y -= 300*(g_fZoom*g_fZoom);
// ScrollToPosition(point);
}
//写井号
/*
rect.left = pX-25;
rect.top = pY;
rect.right = pX - 50*g_fZoom;
rect.bottom = pY - 15*g_fZoom;*/
rect.left = pX - 25;
rect.top = iY;
rect.right = iY - 25;
rect.bottom = iY - 15;
CDrawRect* pObj = new CDrawRect(text,rect,pCWell->sWellNO);
pObj->m_text = pCWell->sWellNO;
GetDocument()->Add(pObj);
//pObj->m_position;
iY -= 10*g_fZoom;
//划圆
pCWell->sMQJB.TrimRight();
if (pCWell->sMQJB == "31" )
{//水井 其它类别有 11
color = m_ColorGreen;
//pObj->SetLineColor(color);
rect.left = iX - 5*g_fZoom;
rect.top = iY - 5*g_fZoom;
rect.right = iX + 5*g_fZoom;
rect.bottom = iY + 5*g_fZoom;
pObj = new CDrawRect(ellipse,rect,pCWell->sWellNO,pCWell->cSubList);
pObj->m_DShape = ellipseCenter; //不移动类别之一
pObj->m_bBrush = FALSE;
GetDocument()->Add(pObj);
//color = m_ColorGreen;
pObj->SetLineColor(color);
pCWell->m_WellMidRect = rect;
}
else
{
color = m_ColorRed;
}
rect.left = iX - 10*g_fZoom;
rect.top = iY - 10*g_fZoom;
rect.right = iX + 10*g_fZoom;
rect.bottom = iY + 10*g_fZoom;
pObj = new CDrawRect(ellipse,rect,pCWell->sWellNO,pCWell->cSubList);
pObj->m_bBrush = FALSE;
GetDocument()->Add(pObj);
//pObj->m_sWellNO = pCWell->sWellNO; //移动位置需要,所以只对井口(圆)加上井号
pObj->SetLineColor(color);
pCWell->m_WellRect = rect;
pCWell->m_Color = color;
iY -= 12*g_fZoom;
//划层
int iL = pCWell->pLayers.GetSize();
int iW = 0;
for(int j=0;j<iL;j++)
{
CDLayer *clayer = (CDLayer *)pCWell->pLayers[j];
CRect plrect ;//= new tagRECT();
plrect.top = iY - iW;
int iLHeight = (int)(clayer->fSYHD/LINK_LAYER_THICK_UNIT * LINK_LAYER_THICK_NUM) ;
iW += iLHeight*g_fZoom ;
plrect.bottom = iY - iW ;
iW += LINK_LAYER_SPACE*g_fZoom;
//int iLWidth = LINK_WELL_WIDTH;
plrect.left = iX - (LINK_WELL_WIDTH/2)*g_fZoom;
plrect.right = iX + (LINK_WELL_WIDTH/2)*g_fZoom;
CDrawRect* pObj = new CDrawRect(recttext,plrect,pCWell->sWellNO,pCWell->cSubList);
pObj->m_fontsize = 8 * g_fZoom;
CString stmp;
stmp.Format(" %s %s", clayer->strYCZMC ,clayer->strXCH);
pObj->m_ArrText.Add(stmp);
stmp.Format("%.1f %.1f %.1f", clayer->fSYHD ,clayer->fYXHD, clayer->fSTL);
pObj->m_ArrText.Add(stmp);
GetDocument()->Add(pObj);
//1油层2气层3水层4油气同层5油水同层6气水同层7差油层8干层
//A可疑油层B可疑气层C水淹层D含油水层E一类灰岩油层F二类灰岩油层G三类灰岩油层
switch(clayer->cDCJSJG)
{
case '1'://'2':'4':'7':'A':'B':
color = m_ColorOil;
break;
case '5'://'6':'D':
color = m_ColorOWSame;
break;
case 'C':
color = m_ColorPink;
break;
case '3':
color = m_ColorWater;
break;
}
pObj->SetFillColor(color);
//if (pCWell->cFault == 'Y') //断层井内颜色不填充
// pObj->m_bBrush = FALSE;
pObj->m_sXCH = clayer->strXCH;
clayer->m_Color = color;
clayer->m_LayerRect = plrect;
//if (pTag == 1) //如果是主井,就存起来,否则就进入其它井判断是否连接
//{
//CCenterLayer *centerlayer = new CCenterLayer;
//centerlayer->strXCH = clayer->strXCH;
//centerlayer->m_LayerRect = plrect;
//centerlayer->m_Color = color;
//pArrCenterWLayer.Add(centerlayer);
//}
//else
#if 0
if (pTag !=1 && pCWell->cFault != 'Y')
{//开始划连接线
//clayer->strLink2xch.TrimRight();
//if (clayer->strLink2xch.GetLength() > 0)
//{
// DrawLink(clayer->strLink2xch,plrect,color,pCWell->sParentNO);//传入link2xch号,rect
//}
int icnt1= clayer->m_ArrLink2xch.GetSize();
int icnt2= pCWell->m_ArrParentNO.GetSize();
if (icnt1>0)
{
for(int k=0; k<icnt2; k++)
{
stmp = pCWell->m_ArrParentNO[k];
for(int n=0; n<icnt1 ; n++)
{
tagLayerLink2xch *tagLink2xch ;//= (tagLayerLink2xch *)malloc(sizeof(tagLayerLink2xch ));
tagLink2xch = (tagLayerLink2xch *)clayer->m_ArrLink2xch[n];
if (!tagLink2xch->sWellNO.IsEmpty() && tagLink2xch->sWellNO.Compare(stmp) == 0)
{
DrawLink(tagLink2xch->sLayerNO,plrect,color,tagLink2xch->sWellNO,pCWell->sWellNO,clayer->strXCH);
}
}
}
}
}
#endif
}
if ('Y' == pCWell->cFault )
{//开始处理断层
DrawFault(pCWell);
}
pCWell->cMoveFlag = 'Y';
pCWell->CopyToOld();
// UpdateWellLayerInfo(pCWell);
return TRUE;
}
BOOL CDrawView::DrawWell2(const int pX, const int pY, const int pTag, CDWell *pCWell)
{
int iX = pX; //横轴 此值基本不变
int iY = pY; //终轴 每个元素都在变化
CRect rect;
COLORREF color;
if (pTag == 1) //如果是主井,就存起来,否则就进入其它井判断是否连接
{
// CPoint point = CalcuScrollToView(pCWell->fX,pCWell->fY);
//CPoint point ;
//CSize size = GeoToView(pCWell->fX,pCWell->fY);
//point.x = size.cx - 640*g_fZoom;//-= 500*g_fZoom;
//point.y = size.cy;//-= 250*g_fZoom;
//DocToClient(point);
// point.x -= 640*(g_fZoom*g_fZoom);
// point.y -= 300*(g_fZoom*g_fZoom);
// ScrollToPosition(point);
}
//写井号
rect.left = pX - 25;
rect.top = iY;
rect.right = iY - 25;
rect.bottom = iY - 15;
CDrawRect* pObj = new CDrawRect(text,rect,pCWell->sWellNO);
pObj->m_text = pCWell->sWellNO;
GetDocument()->Add(pObj);
iY -= 10*g_fZoom;
//划圆
pCWell->sMQJB.TrimRight();
if (pCWell->sMQJB == "31" )
{//水井 其它类别有 11
color = m_ColorGreen;
rect.left = iX - 5*g_fZoom;
rect.top = iY - 5*g_fZoom;
rect.right = iX + 5*g_fZoom;
rect.bottom = iY + 5*g_fZoom;
pObj = new CDrawRect(ellipse,rect,pCWell->sWellNO,pCWell->cSubList);
pObj->m_DShape = ellipseCenter; //不移动类别之一
pObj->m_bBrush = FALSE;
GetDocument()->Add(pObj);
pObj->SetLineColor(color);
pCWell->m_WellMidRect = rect;
}
else
{
color = m_ColorRed;
}
rect.left = iX - 10*g_fZoom;
rect.top = iY - 10*g_fZoom;
rect.right = iX + 10*g_fZoom;
rect.bottom = iY + 10*g_fZoom;
pObj = new CDrawRect(ellipse,rect,pCWell->sWellNO,pCWell->cSubList);
pObj->m_bBrush = FALSE;
GetDocument()->Add(pObj);
//pObj->m_sWellNO = pCWell->sWellNO; //移动位置需要,所以只对井口(圆)加上井号
pObj->SetLineColor(color);
pCWell->m_WellRect = rect;
pCWell->m_Color = color;
iY -= 12*g_fZoom;
//划层
int iL = pCWell->pLayers.GetSize();
int iW = 0;
for(int j=0;j<iL;j++)
{
CDLayer *clayer = (CDLayer *)pCWell->pLayers[j];
CRect plrect ;//= new tagRECT();
plrect.top = iY - iW;
int iLHeight = (int)(clayer->fSYHD/LINK_LAYER_THICK_UNIT * LINK_LAYER_THICK_NUM) ;
iW += iLHeight*g_fZoom ;
plrect.bottom = iY - iW ;
iW += LINK_LAYER_SPACE*g_fZoom;
//int iLWidth = LINK_WELL_WIDTH;
plrect.left = iX - (LINK_WELL_WIDTH/2)*g_fZoom;
plrect.right = iX + (LINK_WELL_WIDTH/2)*g_fZoom;
CDrawRect* pObj = new CDrawRect(recttext,plrect,pCWell->sWellNO,pCWell->cSubList);
pObj->m_fontsize = 8 * g_fZoom;
CString stmp;
stmp.Format(" %s %s", clayer->strYCZMC ,clayer->strXCH);
pObj->m_ArrText.Add(stmp);
stmp.Format("%.1f %.1f %.1f", clayer->fSYHD ,clayer->fYXHD, clayer->fSTL);
pObj->m_ArrText.Add(stmp);
GetDocument()->Add(pObj);
//1油层2气层3水层4油气同层5油水同层6气水同层7差油层8干层
//A可疑油层B可疑气层C水淹层D含油水层E一类灰岩油层F二类灰岩油层G三类灰岩油层
switch(clayer->cDCJSJG)
{
case '1'://'2':'4':'7':'A':'B':
color = m_ColorOil;
break;
case '5'://'6':'D':
color = m_ColorOWSame;
break;
case 'C':
color = m_ColorPink;
break;
case '3':
color = m_ColorWater;
break;
}
pObj->SetFillColor(color);
//if (pCWell->cFault == 'Y') //断层井内颜色不填充
// pObj->m_bBrush = FALSE;
pObj->m_sXCH = clayer->strXCH;
clayer->m_Color = color;
clayer->m_LayerRect = plrect;
if (pTag !=1 && pCWell->cFault != 'Y')
{//开始划连接线
int icnt1= clayer->m_ArrLink2xch.GetSize();
int icnt2= pCWell->m_ArrParentNO.GetSize();
if (icnt1>0)
{
for(int k=0; k<icnt2; k++)
{
stmp = pCWell->m_ArrParentNO[k];
for(int n=0; n<icnt1 ; n++)
{
tagLayerLink2xch *tagLink2xch ;//= (tagLayerLink2xch *)malloc(sizeof(tagLayerLink2xch ));
tagLink2xch = (tagLayerLink2xch *)clayer->m_ArrLink2xch[n];
if (!tagLink2xch->sWellNO.IsEmpty() && tagLink2xch->sWellNO.Compare(stmp) == 0)
{
DrawLink2(tagLink2xch->sLayerNO,plrect,color,tagLink2xch->sWellNO,pCWell->sWellNO,clayer->strXCH);
}
}
}
}
}
}
if ('Y' == pCWell->cFault )
{//开始处理断层
DrawFault(pCWell);
}
pCWell->cMoveFlag = 'Y';
pCWell->CopyToOld();
// UpdateWellLayerInfo(pCWell);
return TRUE;
}
/*******************************************************************
//绘井算法描述:
// 取出m_ArrayWell中最后一个元素----主元素,放置在屏幕中央
// 计算其余有几个,均匀放置在主元素四周(目前没有井坐标表)
// 每口井的各层厚度按其层厚比例绘出
// 根据层的井、层类别,先绘主井,然后绘其相连,同时将每层与主井相连的层连接起来
//修改:
*******************************************************************/
BOOL CDrawView::DrawWellLink(const char pType)
{
int icnt = m_ArrayWell.GetSize();
if(icnt <=0 ) return FALSE;
// CDC *pDC = GetDC();
CDWell *cwell;
CRect client;
CSize size ,psize;
//int iPreX,iPreY;
GetClientRect(&client); //取屏幕宽度与高度 736 415
// CRect lrect(120 * g_fZoom,20 * g_fZoom,m_CanvasWidth,m_CanvasHeight);
CPoint pt;
pt.x = 120 * g_fZoom;
pt.y = 20 ;//* g_fZoom;
ClientToDoc(pt);
psize.cx = pt.x;
psize.cy = pt.y;
// ClientToDoc(lrect);
// CRect prect = lrect;
for(int i=0; i<icnt; i++)
{
cwell = (CDWell *)m_ArrayWell[i];
//如果是移动就以存储对象中的rect来绘图,否则就从坐标计算出其位置
if ('1' == pType ) // && '2' != pType
{//移动 时画图 ,使用新的位置,同时需要将老的位置作一个偏移
if (i != 0)
DrawWell(0,cwell );
else
DrawWell(1,cwell );
}
else
{
if('Y' == cwell->cMoveFlag)
{//点下级连通图时,画出以前的图,使用老的位置
if (i != 0)
DrawWell2(0,cwell);
else
DrawWell2(1,cwell);
}
else
{
size = GeoToView(cwell->fX,cwell->fY);
if(size.cx == pt.x && size.cy ==pt.y)
{
size = psize ;
psize.cx += 150*g_fZoom;//有时坐标相同的,就将其平移一段距离
}
if('2' == pType)
{
if (i != 0)
DrawWell2(size.cx,size.cy,0,cwell);
else
DrawWell2(size.cx,size.cy,1,cwell);
}
else
{
if (i != 0)
DrawWell(size.cx,size.cy,0,cwell);
else
DrawWell(size.cx,size.cy,1,cwell);
}
if ('2' == pType)
{
if(size.cx < m_NewRect.left)
{
m_NewRect.left = size.cx - 120*g_fZoom;
}
if (size.cx>m_NewRect.right)
{
m_NewRect.right = size.cx + 120*g_fZoom;
}
if(size.cy>m_NewRect.top)//top move than bottom,因为向上为正
{
m_NewRect.top = size.cy+20;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -