GIS內核-製圖使用示例

製圖需要將製圖對象和視圖map綁定起來,並且刷新的時候不能調用map的update,只有退出視圖模式才能調用,否則可能財神線程安全問題, 也就是要控制視圖狀態,基本的使用如下:

當前視圖轉爲製圖視圖:

GsPageLayout m_pLayout = new GsPageLayout(space->m_ptrGeoMap->ScreenDisplay());
m_pLayout->ViewExtent(space->fullExtent());
m_pLayout->Page()->PageType(ePageA6);//這裏是固定類型的枚舉
m_pMapEle = new GsMapElement(space->m_ptrGeoMap);//圖廓元素
m_pMapEle->ShowBorder(true);
       //邊線
GsSimpleLineSymbolPtr ptrLine = new GsSimpleLineSymbol(GsColor::Blue, 10);
m_pMapEle->BorderSymbol(ptrLine);
//添加製圖的element
space->m_pLayout->ElementContainer()->Add(m_pMapEle);
//添加製圖的element
GsPointPtr point = new GsPoint(100, 36);	
GsSimplePointSymbolPtr ptrSymBol = new GsSimplePointSymbol(GsColor::Red,20);	
GsGeometyElementPtr pteGeometryEle = new GsGeometyElement(point, ptrSymBol);
space->m_pLayout->ElementContainer()->Add(pteGeometryEle);
	
//刷新
space->m_isLayOut = true;
space->stopRendering();
space->update();
如果需要加入不同的element 可以通過geometry和symbol 配合使用基本可以達到一般製圖效果
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章