ArcEngine 3D开发之3D符号化——添加3D符号
前面的博文http://blog.csdn.net/giser_whu/article/details/23047213介绍了3D符号化的主要接口。在这里总结下在座的过程中实现3D符号化的两种方式,第一种是将3ds文件作为符号,对点图层进行唯一值渲染,可以设置符号的大小,转角等属性;第二种则是借助GraphicsLayer添加到Globe显示,也可以对符号进行旋转等操作,两种方式的效率如何,还未做大范围的数据进行比较,待做了之后再对两种方式做一个比较。
本片博文主要是采用第二种方式显示3D符号,代码如下:
private void button_Add3DSymbol_Click (object sender,EventArgs e) { //首先添加一个GlobeGraphicLayer addGraphicLayer(); //创建3D图形 string filePath=@"D:\毕业设计\TowerModel\Tower_ZMP2_51.3ds"; IImport3DFile import3Dfile = new Import3DFileClass(); import3Dfile.CreateFromFile(filePath); IGeometry geometry = import3Dfile.Geometry; IMarker3DSymbol marker3DSymbol = new Marker3DSymbolClass(); marker3DSymbol.Shape = geometry; //设置符号的颜色大小等属性 OtherHelper otherHelper=new OtherHelper(); (marker3DSymbol as IMarkerSymbol).Color = otherHelper.CreateNewColor(143,156,234); IEnvelope pEnv = geometry.Envelope; (marker3DSymbol as IMarkerSymbol).Size = pEnv.Depth; //将3D符号作为element的符号显示 IElement element = new MarkerElementClass(); IPoint point = new PointClass(); point.PutCoords(114.359676,30.534487); element.Geometry = point; IMarkerElement markerElement = element as IMarkerElement; markerElement.Symbol = marker3DSymbol as IMarkerSymbol; graphicsLayer.AddElement(element,1); } public void addGraphicLayer () { graphicsLayer = new GlobeGraphicsLayerClass(); ILayer pLayer = graphicsLayer as ILayer; pLayer.Name = "CameraPathGraphicsLayer"; m_globeControl.Globe.AddLayerType(pLayer,esriGlobeLayerType.esriGlobeLayerTypeDraped,true); //设置为活动图层 m_globeControl.Globe.GlobeDisplay.Scene.ActiveGraphicsLayer = pLayer; }