MapWinGis控件的引用:
#import "MapWinGIS.ocx" rename("IImage","gisIImage") rename("ImageType", "gisImageType") rename("Point", "gisPoint")
using namespace MapWinGIS;
创建新图层m_pShapefilePoint,并添加图层属性:
MapWinGIS::IShapefilePtr m_pShapefilePoint;
m_pShapefilePoint.CreateInstance(__uuidof(MapWinGIS::Shapefile));
if (!m_pShapefilePoint->Open("./maps/GpsPoints.shp", NULL))
{
CString sError = m_pShapefilePoint->GetErrorMsg(m_pShapefilePoint->GetLastErrorCode());
TRACE(sError);if (!m_pShapefilePoint->CreateNew("./maps/GpsPoints.shp", /*MapWinGIS::ShpfileType::*/SHP_POINT))
{
sError.Format("%s", m_pShapefilePoint->GetErrorMsg(m_pShapefilePoint->GetLastErrorCode()));
TRACE(sError);
return ;
}m_pShapefilePoint->StartEditingTable(NULL);
long lFieldIndex = 0;
lFieldIndex = m_pShapefilePoint->EditAddField(_bstr_t("name"), STRING_FIELD, 0, 64);// 添加的属性
lFieldIndex = m_pShapefilePoint->EditAddField(_bstr_t("type"), INTEGER_FIELD, 0, sizeof(int));//添加的属性
m_pShapefilePoint->StopEditingTable(TRUE, NULL);
}m_pShapefilePoint->put_CollisionMode(AllowCollisions);
来源:CSDN
作者:老狼主
链接:https://blog.csdn.net/u012156872/article/details/103849114