📄 depscaleunit.cpp
字号:
// DepScaleUnit.cpp: implementation of the CDepScaleUnit class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "welldataprocess.h"
#include "DepScaleUnit.h"
#include "GlobalData.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CDepScaleUnit::CDepScaleUnit()
{
m_fStartDep = 0.0f;
m_fEndDep = 100.0f;
m_color = COR_BLUE;
m_nMinScale = 10;
m_nMaxScale = 100;
m_nColWidth = 50;
m_nColHeight = 600;
m_nXBase = 0;
m_nYBase = 0;
}
CDepScaleUnit::~CDepScaleUnit()
{
}
void CDepScaleUnit::SetScaleStartDep(float fStartDep)
{
m_fStartDep = fStartDep;
}
void CDepScaleUnit::SetScaleEndDep(float fEndDep)
{
m_fEndDep = fEndDep;
}
void CDepScaleUnit::SetScaleLineColor(COLORREF color)
{
m_color = color;
}
void CDepScaleUnit::SetMinScale(int nMinScale)
{
m_nMinScale = nMinScale;
}
void CDepScaleUnit::SetMaxScale(int nMaxScale)
{
m_nMaxScale = nMaxScale;
}
float CDepScaleUnit::GetScaleStartDep()
{
return m_fStartDep;
}
float CDepScaleUnit::GetScaleEndDep()
{
return m_fEndDep;
}
COLORREF CDepScaleUnit::GetScaleLineColor()
{
return m_color;
}
int CDepScaleUnit::GetMinScale()
{
return m_nMinScale;
}
int CDepScaleUnit::GetMaxScale()
{
return m_nMaxScale;
}
void CDepScaleUnit::Draw(CDC *pDC)
{
CPoint point;
CString strLabel;
COLORREF color;
CPen pen;
CPen *pOrgPen;
if(m_bSelect)
color = COR_WHITE;
else
color = m_color;
pen.CreatePen(PS_SOLID, 1, color);
pOrgPen = pDC->SelectObject(&pen);
int nStart = int(m_fStartDep);
int nEnd = int(m_fEndDep);
float fScale = float(m_nColHeight / (m_fEndDep - m_fStartDep));
point.x = m_nXBase + m_nColWidth;
point.y = m_nYBase;
for(int i = nStart; i <= nEnd; i ++)
{
if((i % m_nMinScale) == 0)
{
point.y = m_nYBase + (i - nStart) * fScale;
pDC->MoveTo(point);
pDC->LineTo(point.x - 10, point.y);
strLabel.Format("%5d", i);
PutText(TRUE, m_nXBase + m_nColWidth / 2 - 6, point.y + 6, 12, 0, strLabel, pDC);
}
}
pDC->SelectObject(pOrgPen);
}
BOOL CDepScaleUnit::HitTest(CPoint point)
{
return TRUE;
}
void CDepScaleUnit::SetColWidth(int nColWidth)
{
m_nColWidth = nColWidth;
}
void CDepScaleUnit::SetColHeight(int nColHeight)
{
m_nColHeight = nColHeight;
}
void CDepScaleUnit::SetXBase(int nXBase)
{
m_nXBase = nXBase;
}
void CDepScaleUnit::SetYBase(int nYBase)
{
m_nYBase = nYBase;
}
int CDepScaleUnit::GetColWidth()
{
return m_nColWidth;
}
int CDepScaleUnit::GetColHeight()
{
return m_nColHeight;
}
int CDepScaleUnit::GetXBase()
{
return m_nXBase;
}
int CDepScaleUnit::GetYBase()
{
return m_nYBase;
}
void CDepScaleUnit::SetRoad(CRoadUnit* pRoadUnit)
{
m_nColHeight = pRoadUnit->GetRoadHeight() - pRoadUnit->GetRoadHeadHeight();
m_nColWidth = pRoadUnit->GetRoadWidth();
CPoint point = pRoadUnit->GetOrgPoint();
m_nXBase = point.x;
m_nYBase = point.y + pRoadUnit->GetRoadHeadHeight();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -