geolayers.cpp

来自「VC++开发广州市交通运输干线」· C++ 代码 · 共 360 行 · 第 1/2 页

CPP
360
字号
// GeoLayers.cpp: implementation of the CGeoLayers class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "DigitalMap.h"
#include "GeoLayers.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CGeoLayers::CGeoLayers()
{
	//初始时表示该层显示
	m_bDisplay = 1;
}

CGeoLayers::~CGeoLayers()
{
}

void CGeoLayers::SetLayerName(CString strName)
{
	m_strName = strName;
}

void CGeoLayers::GetLayerName(CString &strName)
{
	strName = m_strName;
}

void CGeoLayers::SetDisplay(BOOL bDisplay)
{
	m_bDisplay = !m_bDisplay;
}

void CGeoLayers::Draw(CDC *pDC)
{
}

//根据图层来设点的笔和画刷和画的半径
void CGeoLayers::SetPTPenBrush(CString strLyerName, CPen &pen, CBrush &brush,int &nCircle)
{
	int nPenStyle;
	int nWidth;
	COLORREF clPTPen;

	int nBrushIndex ;
	COLORREF clPTBrush ;
	if(strLyerName=="P")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPTPen = CL_P_PEN;
		nCircle = 4;

		nBrushIndex = HS_CROSS;
		clPTBrush = CL_P_BRUSH;
	}
	if(strLyerName=="B")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPTPen = CL_B_PEN;
		nCircle = 4;
		
		nBrushIndex = HS_CROSS;
		clPTBrush = CL_B_BRUSH;
	}
	if(strLyerName=="R")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPTPen = CL_R_PEN;
		nCircle = 4;
		
		nBrushIndex = HS_CROSS;
		clPTBrush = CL_R_BRUSH;
	}
	if(strLyerName=="T")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPTPen = CL_T_PEN;
		nCircle = 4;
		
		nBrushIndex = HS_CROSS;
		clPTBrush = CL_T_BRUSH;
	}
	if(strLyerName=="F")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPTPen = CL_F_PEN;
		nCircle = 4;
		
		nBrushIndex = HS_CROSS;
		clPTBrush = CL_F_BRUSH;
	}
	if(strLyerName=="V")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPTPen = CL_V_PEN;
		nCircle = 4;
		
		nBrushIndex = HS_CROSS;
		clPTBrush = CL_V_BRUSH;
	}
	if(strLyerName=="H")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPTPen = CL_H_PEN;
		nCircle = 4;
		
		nBrushIndex = HS_CROSS;
		clPTBrush = CL_H_BRUSH;
	}
	if(strLyerName=="C")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPTPen = CL_C_PEN;
		nCircle = 4;
		
		nBrushIndex = HS_CROSS;
		clPTBrush = CL_C_BRUSH;
	}
	pen.CreatePen(nPenStyle,nWidth,clPTPen);
//	brush.CreateHatchBrush(nBrushIndex,clPTBrush);
	brush.CreateSolidBrush(clPTBrush);
}

//根据图层来设置线的笔
void CGeoLayers::SetPLPen(CString strLyerName, CPen &pen)
{
	int nPenStyle;
	int nWidth;
	COLORREF clPLPen;

	if(strLyerName=="P")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPLPen = CL_P_PEN;
	}
	if(strLyerName=="B")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPLPen = CL_B_PEN;
	}
	if(strLyerName=="R")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPLPen = CL_R_PEN;
	}
	if(strLyerName=="T")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPLPen = CL_T_PEN;
	}
	if(strLyerName=="F")
	{
		nPenStyle = PS_SOLID;
		nWidth = 1;
		clPLPen = CL_F_PEN;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?