⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maplayer.cpp

📁 本程序是用VC++ 开发出的比较底层的GIS系统代码。对于希望从底层学GIS开发的很有帮助
💻 CPP
字号:
#include "stdafx.h"
#include "MapLayer.h"
#include "MapPoint.h"
#include "MapPoints.h"
#include "MapLine.h"
#include "MapPolygon.h"
#include "MapRecordSet.h"
#include "MapTableDesc.h"


CMapLayer::CMapLayer()
{
	m_bVisible = TRUE;
	m_Valid = FALSE;
	m_csLayerName = _T("");
	m_pRender = new CMapRender;
    m_pRender->SetRenderType(SIMPLE_RENDER);  
}

CMapLayer::~CMapLayer()
{
     
	 
	if ( m_pRender != NULL )
		delete m_pRender;

}
BOOL CMapLayer::LoadData(CString& csFileName)
{
	CString csDbfName;
	if (m_shpFile.ReadShp(csFileName))   
    {
		m_Valid = TRUE;
	
		return TRUE;
    } 
	else
    {    
		m_Valid = FALSE;
		return FALSE;
    
	} 
   

}
CMapRectangle CMapLayer::GetExtent()
{

	return m_shpFile.GetExtent();
}



long CMapLayer::GetShpType()
{
	return m_shpFile.GetShpType(); 
}

BOOL CMapLayer::GetVisible()
{
	return m_bVisible;
}

void CMapLayer::SetVisible(bool bVisible)
{
	m_bVisible = bVisible;
}

void CMapLayer::SetLayerName(CString& csLayerName )
{

	m_csLayerName = csLayerName;
}

CString CMapLayer::GetLayerName()
{
	
	return m_csLayerName;
}

void CMapLayer::SetExtent(CMapRectangle& extent )
{
	
	m_shpFile.SetExtent(extent); 
	 
}

void CMapLayer::SetShpType(int lShpType )
{
	m_shpFile.SetShpType(lShpType); 
		
}
int CMapLayer::SearchShape(CMapPoint& pt )
{

      if ( GetShpType() != POLYGON )
		  return -1;
	  else
      {  
		 return m_shpFile.SearchShape(pt);   
	  } 

}
void CMapLayer::SetRender(CMapRender* pRender )
{
	if ( m_pRender != NULL )
		delete m_pRender;
	m_pRender = pRender;

}

void CMapLayer::DrawLayer(CDC*pDC , DrawParam& draw)
{

	m_shpFile.DrawShp(pDC , m_pRender ,  draw );

}

void CMapLayer::FlashShp(CDC*pDC , DrawParam& draw , int iIndex)
{
	m_shpFile.FlashShp(pDC,draw,iIndex);


}

⌨️ 快捷键说明

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