C#-AE-ArcGlobe-图层上画点、画线、图层矢量数据查询上课讲义.docVIP

  • 16
  • 0
  • 约5.76千字
  • 约 7页
  • 2020-06-20 发布于浙江
  • 举报

C#-AE-ArcGlobe-图层上画点、画线、图层矢量数据查询上课讲义.doc

C#-AE-ArcGlobe-图层上画点、画线、图层矢量数据查询 精品文档 精品文档 收集于网络,如有侵权请联系管理员删除 收集于网络,如有侵权请联系管理员删除 精品文档 收集于网络,如有侵权请联系管理员删除 ///C# AE ArcGlobe 图层上画点 private void toolStripButton1_Click(object sender, EventArgs e) { //首先要获取图层,也就是说你要先加载一个点图层 //因为shp文件也是分点线面,而且现在画的是点,所以此时必须加载点shp文件,可以在ArcCatalog里生成shp文件 ILayer pLayer = (IFeatureLayer)axGlobeControl1.Globe.GlobeDisplay.Scene.get_Layer(0); IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;//转换一下,以便获取图层上的要素 IFeatureClass pFeatureCls = pFeatureLayer.FeatureClass;//再定义一个要素集合,这样才能编辑,搞这么麻烦。。我也不知道为什么 //用过ArcMap你就知道,要想编辑shp文件上的数据,首先要打开可编辑状态,就是下面打开工作空间 IWorkspaceEdit pWorkSpace = (pFeatureCls as IDataset).Workspace as IWorkspaceEdit; pWorkSpace.StartEditing(true);//开启编辑状态 pWorkSpace.StartEditOperation();//开始编辑操作 // IPoint pPoint = new PointClass();// // pPoint.PutCoords(22, 44);//点的位置 m_pGlobeDisplay = axGlobeControl1.Globe.GlobeDisplay; //IPoint pPoint = GlobeUtility.GlobeToDD(m_pGlobeDisplay, 2222, 1111, true); ////设置点高程 //GlobeUtility.MakeZAware(pPoint); //将点添加到场景 IPoint pPoint = GlobeUtility.GlobeToDD(m_pGlobeDisplay, 50, 50, true); if (pPoint != null) { pPoint.Z = pPoint.Z * 1000; } // pPoint.SpatialReference = GlobeUtil.getGeographicCoordinateSystem(esriSRGeoCSType.esriSRGeoCS_WGS1984); //pGlobeGraphicsLayer.PutElementName(pElement, quot;定位点quot;); IFeature pPointFeature = pFeatureCls.CreateFeature();//这里要定义一个可以加到图层上的要素,这样才能加上去 //但还不知道这个要素是什么呢,所以要把刚刚创建的点给赋给这个要素 pPointFeature.Shape = pPoint;//好!现在这个要素的样子是点 pPointFeature.Store();//将这个点要素保存下来 //接下来要把要素加到图层上 IFeatureClassWrite pFeatClsWr = pFeatureCls as IFeatureClassWrite;//添加要素到图层的方法在 IFeatureClassWrite 里面 pFeatClsWr.WriteFeature(pPointFeature); pWorkSpace.StopEditOperation();//前后呼应 pWorkSpace.StopEditing(true);//有始有终~~ IPoint pPointCenter = new PointClass();//定义这个点为了设置中心位置 pPointCenter.PutCoords(350, 350); } ///C# AE ArcGlobe 图层上画线 private void toolStripButton3_Click(object sender, EventArgs e) { ILayer pLayer = (IFeatureLayer)GetGlobeLayer(m_pGlobe.GlobeDisplay.Scene, quot;疏散路线quot

文档评论(0)

1亿VIP精品文档

相关文档