public override void Run(object sender, System.EventArgs e) { Map2DCommandManager.Push(this); IMap2DView mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView; if (mapView == null) { return; } Layer2DTreePad wsPad = (Layer2DTreePad)UCService.GetContent(typeof(Layer2DTreePad)); this.treelist = wsPad.TreeList; bool bBind = mapView.Bind(this); if (!bBind) { return; } DF2DApplication app = DF2DApplication.Application; if (app == null || app.Current2DMapControl == null || app.Workbench == null) { return; } app.Workbench.SetMenuEnable(false); app.Current2DMapControl.MousePointer = esriControlsMousePointer.esriPointerArrow; FrmMajorClass.Instance.Show(); }
public override void OnExtentUpdated(object displayTransformation, bool sizeChanged, object newEnvelope) { DF2DApplication app = DF2DApplication.Application; if (app == null || app.Current2DMapControl == null) { return; } try { Layer2DTreePad wsPad = (Layer2DTreePad)UCService.GetContent(typeof(Layer2DTreePad)); string lyrName; TreeListNodes treeListNodes = wsPad.TreeList.Nodes; IMap map = app.Current2DMapControl.Map; for (int i = 0; i < map.LayerCount; i++) { ILayer lyr = map.get_Layer(i); lyrName = lyr.Name; bool _visible = lyr.Visible; UpdateTreeList(lyrName, treeListNodes, wsPad.TreeList, _visible); //TreeListNodes tlns = treeList.Nodes; //foreach (TreeListNode tln in tlns) //{ // string tlnName = tln.ToString(); // if (tlnName == lyrName) // { // tln.Visible = false; // } // if (tln.Nodes != null) // { // } //} } } catch (System.Exception ex) { } }
public override void Run(object sender, System.EventArgs e) { Map2DView mapView = (Map2DView)UCService.GetContent(typeof(Map2DView)); bool bBind = mapView.Bind(this); if (!bBind) { return; } DF2DApplication app = (DF2DApplication)this.Hook; if (app == null || app.Current2DMapControl == null) { return; } try { Layer2DTreePad wsPad = (Layer2DTreePad)UCService.GetContent(typeof(Layer2DTreePad)); EagleEyePad epad = UCService.GetContent(typeof(EagleEyePad)) as EagleEyePad; if (wsPad == null || epad == null) { return; } app.Workbench.SetStatusInfo("二维数据加载中…"); SplashScreenManager.Default.SendCommand(null, "开始加载二维数据......"); if (wsPad != null && epad != null) { DataUtils2D.AddAndVisualizeTreelistPipe(wsPad.TreeList, app.Current2DMapControl); //加载管线图层 DataUtils2D.AddAndVisualizeTreelistBackground(wsPad.TreeList, app.Current2DMapControl); //加载背景图及辅助图层,为鹰眼加载影像图 DataUtils2D.AddAndVisualizeEgleEyeControlBackground(epad.MapControl); } app.Workbench.SetStatusInfo("就绪"); LoggingService.Info("二维数据加载成功!"); } catch (Exception ex) { app.Workbench.SetStatusInfo("二维数据加载错误"); LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace); } }