geopolygon.cpp

来自「VC++开发广州市交通运输干线」· C++ 代码 · 共 75 行

CPP
75
字号
// GeoPolygon.cpp: implementation of the CGeoPolygon class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "DigitalMap.h"
#include "GeoPolygon.h"

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

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

CGeoPolygon::CGeoPolygon()
{

}

CGeoPolygon::CGeoPolygon(CGeoPointXY *ptXY,int pointNums,int attriCode)
{
	for(int i=0;i<pointNums;i++)
	{
		m_vecPolyPoint.push_back(ptXY[i]);
	}
	m_attriCode = attriCode;
}

CGeoPolygon::~CGeoPolygon()
{

}

void CGeoPolygon::GetPolygonXY(CGeoPointXY *ptXY, int &pointNums)
{
	//取出
	for(int i=0;i<m_vecPolyPoint.size();i++)
	{
		m_vecPolyPoint.push_back(ptXY[i]);
	}
	pointNums = m_vecPolyPoint.size();
}

void CGeoPolygon::SetPolygonXY(CGeoPointXY *ptXY, int pointNums)
{

}

//DEL void CGeoPolygon::SetAttriCode(int attriCode)
//DEL {
//DEL 	m_attriCode = attriCode;
//DEL }

//DEL void CGeoPolygon::GetAttriCode(int &attriCode)
//DEL {
//DEL 	attriCode = m_attriCode;
//DEL }

void CGeoPolygon::Draw(CDC *pDC,BOOL bDisplay)
{
	if(bDisplay==0)//就是擦除图像
		return;//	pDC->SetROP2(R2_NOTXORPEN);
	POINT *Point = new POINT[m_vecPolyPoint.size()];
	for(int i=0;i<m_vecPolyPoint.size();i++)
	{
		Point[i].x = m_vecPolyPoint.at(i).X;
		Point[i].y = m_vecPolyPoint.at(i).Y;
	}
	pDC->Polygon(Point,m_vecPolyPoint.size());
}

⌨️ 快捷键说明

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