|
阅读:1702回复:1
[求助]如何在新建shp文件时添加属性字段
小弟 最近在做一个项目,需要在新建shp文件时添加属性字段,我是个菜鸟,请求高手指点一二啊
|
|
|
1楼#
发布于:2008-08-26 09:10
<P> CMoLayers layers(m_map.GetLayers());<BR> CMoMapLayer layer;<BR> layer.AttachDispatch(layers.Item(COleVariant((short)0)));<BR> CMoSymbol sym(layer.GetSymbol());<BR> <BR> <BR> // create a font to be used by the LabelPlacer<BR> CMoFont fnt;<BR> fnt.SetName(TEXT("Ariel"));<BR> fnt.SetWeight(FW_THIN);<BR> fnt.SetSize(5);</P>
<P> CMoLabelPlacer labelPlacer;<BR> labelPlacer.CreateDispatch("MapObjects2.LabelPlacer");<BR> labelPlacer.SetField(TEXT("NAME"));<BR> labelPlacer.SetDrawBackground(true); //change to true to see the roads<BR> labelPlacer.SetAllowDuplicates(false);<BR> //labelPlacer.SetMaskColor(m_map.GetBackColor());<BR> labelPlacer.SetPlaceAbove(false);<BR> labelPlacer.SetPlaceBelow(false);<BR> labelPlacer.SetPlaceOn(true);</P> <P> // Set the symbol text height as a ratio of the map height<BR> CMoTextSymbol textSym(labelPlacer.GetDefaultSymbol());<BR> CMoRectangle fullExtent(m_map.GetExtent());<BR> textSym.SetHeight(fullExtent.GetHeight() / 50.0);<BR> textSym.SetFont(fnt); */ // default symbol</P> |
|