📄 geolayers.cpp
字号:
}
if(strLyerName=="V")
{
nPenStyle = PS_SOLID;
nWidth = 1;
clPLPen = CL_V_PEN;
}
if(strLyerName=="H")
{
nPenStyle = PS_SOLID;
nWidth = 1;
clPLPen = CL_H_PEN;
}
if(strLyerName=="C")
{
nPenStyle = PS_SOLID;
nWidth = 1;
clPLPen = CL_C_PEN;
}
pen.CreatePen(nPenStyle,nWidth,clPLPen);
}
//根据图层来设置面的笔和画刷
void CGeoLayers::SetPGPenBrush(CString strLyerName, CPen &pen, CBrush &brush)
{
int nPenStyle;
int nWidth;
COLORREF clPGPen;
int nBrushIndex;
COLORREF clPGBrush;
if(strLyerName=="P")
{
nPenStyle = PS_SOLID;
nWidth = 1;
clPGPen = CL_P_PEN;
nBrushIndex = HS_CROSS;
clPGBrush = CL_P_BRUSH;
}
if(strLyerName=="B")
{
nPenStyle = PS_SOLID;
nWidth = 1;
clPGPen = CL_B_PEN;
nBrushIndex = HS_CROSS;
clPGBrush = CL_B_BRUSH;
}
if(strLyerName=="R")
{
nPenStyle = PS_SOLID;
nWidth = 1;
clPGPen = CL_R_PEN;
nBrushIndex = HS_CROSS;
clPGBrush = CL_R_BRUSH;
}
if(strLyerName=="T")
{
nPenStyle = PS_SOLID;
nWidth = 1;
clPGPen = CL_T_PEN;
nBrushIndex = HS_CROSS;
clPGBrush = CL_T_BRUSH;
}
if(strLyerName=="F")
{
nPenStyle = PS_SOLID;
nWidth = 1;
clPGPen = CL_F_PEN;
nBrushIndex = HS_CROSS;
clPGBrush = CL_F_BRUSH;
}
if(strLyerName=="V")
{
nPenStyle = PS_SOLID;
nWidth = 1;
clPGPen = CL_V_PEN;
nBrushIndex = HS_CROSS;
clPGBrush = CL_V_BRUSH;
}
if(strLyerName=="H")
{
nPenStyle = PS_SOLID;
nWidth = 1;
clPGPen = CL_H_PEN;
nBrushIndex = HS_CROSS;
clPGBrush = CL_H_BRUSH;
}
if(strLyerName=="C")
{
nPenStyle = PS_SOLID;
nWidth = 1;
clPGPen = CL_C_PEN;
nBrushIndex = HS_CROSS;
clPGBrush = CL_C_BRUSH;
}
pen.CreatePen(nPenStyle,nWidth,clPGPen);
brush.CreateSolidBrush(clPGBrush);
}
BOOL CGeoLayers::GetDisplay()
{
return m_bDisplay;
}
void CGeoLayers::DrawPoint(CDC *pDC)
{
int nPTNums = m_vecPoint.size();
CString strLyerName;
GetLayerName(strLyerName);
CPen PTPen;
CBrush PTBrush;
int nCircle;
SetPTPenBrush(strLyerName,PTPen,PTBrush,nCircle);
CPen *pOldPen = pDC->SelectObject(&PTPen);
CBrush *pOldBrush = pDC->SelectObject(&PTBrush);
for(int i=0;i<nPTNums;i++)
{
CGeoPoint cGeoPoint = m_vecPoint.at(i);
cGeoPoint.Draw(pDC,m_bDisplay,nCircle);
}
pDC->SelectObject(pOldPen);
pDC->SelectObject(pOldBrush);
}
void CGeoLayers::DrawPolyline(CDC *pDC)
{
int nPLNums = m_vecPolyline.size();
CString strLyerName;
GetLayerName(strLyerName);
CPen PLPen;
SetPLPen(strLyerName,PLPen);
CPen *pOldPen = pDC->SelectObject(&PLPen);
for(int i=0;i<nPLNums;i++)
{
CGeoPolyline cGeoPolyline = m_vecPolyline.at(i);
cGeoPolyline.Draw(pDC,GetDisplay());
}
pDC->SelectObject(pOldPen);
}
void CGeoLayers::DrawPolygon(CDC *pDC)
{
int nPGNums = m_vecPolygon.size();
CString strLyerName;
GetLayerName(strLyerName);
//绘制面
CPen PGPen;
CBrush PGBrush;
SetPGPenBrush(strLyerName,PGPen,PGBrush);
CPen *pOldPen=pDC->SelectObject(&PGPen); //将画面的pen和brush选入设备环境
CBrush *pOldBrush=pDC->SelectObject(&PGBrush
);
for(int i=0;i<nPGNums;i++)
{
CGeoPolygon cGeoPolygon = m_vecPolygon.at(i);
cGeoPolygon.Draw(pDC,GetDisplay());
}
pDC->SelectObject(pOldPen);
pDC->SelectObject(pOldBrush);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -