public frmAreaChart(IMFToolBox _toolBox) { InitializeComponent(); this.LookAndFeel.SkinName = AppConfigFacade.DefaultTheme; Icon icon = global::GlobleSituation.Properties.Resources.App; this.Icon = icon; toolBox = _toolBox; SetChartVisible(false); btnExpand.Text = ">>"; Init(); }
public GMapControlBusiness mapBusiness = null; // 业务类 public GMapControlEx(TrackLineManager trackMgr, ArcGlobeBusiness _globeBusiness) { InitializeComponent(); InitMapFrame mapFrame = new InitMapFrame(MapEngineType.GMap, null); mapLogic = mapFrame.GetMapLogic(); toolBox = mapLogic.GetToolBox(); map = mapLogic.GetIMFMap(); map.ElementClickEvent += Map_ElementClickEvent; map.MouseMoveEvent += new EventHandler <MFMouseEventArgs>(map_MouseMoveEvent); Control mapControl = (Control)mapLogic.GetMapControl(); mapControl.Dock = DockStyle.Fill; this.mapPanel.Controls.Add(mapControl); mapBusiness = new GMapControlBusiness(mapLogic, trackMgr, _globeBusiness); }
/// <summary> /// 跳转到某目标 /// </summary> /// <param name="name"></param> public void JumpToPlane(byte type, string elementName) { if (mapLogic == null) { return; } IMFLayer layer = mapLogic.GetLayer(GetModelLayerName(type)); if (layer == null) { return; } IMFElement element = layer.GetElement(elementName); if (element == null) { return; } IMFPicture model = element as IMFPicture; if (model == null) { return; } MapLngLat position = model.GetLngLat();; IMFToolBox toolBox = mapLogic.GetToolBox(); if (toolBox == null) { return; } toolBox.ZoomToPosition(position); }
/// <summary> /// 创建地图地图工具箱 /// </summary> /// <param name="mapObject">地图控件对象</param> /// <returns></returns> private IMFToolBox CreateToolBox(object mapObject) { IMFToolBox _toolBox = null; #region 反射 object RetObj = null; object[] obj = new object[] { mapObject, this }; LibraryInfo info = GetLibraryInfoByName("MapTool", mapEngineType.ToString()); if (info == null) { return(null); } try { Assembly asm = Assembly.Load(info.LibraryName); Type[] tp = asm.GetTypes(); RetObj = (object)asm.CreateInstance(info.NameSpaceClass, true, BindingFlags.CreateInstance | BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase , null, obj, CultureInfo.CurrentCulture, null); } catch (Exception ex) { Debug.WriteLine(string.Format("通过反射创建IToolBox对象异常:{0}", ex.Message)); return(null); } if (null == RetObj) { Debug.WriteLine("通过反射创建IToolBox对象失败!"); return(null); } _toolBox = RetObj as IMFToolBox; #endregion return(_toolBox); }
/// <summary> /// 加载地图引擎 /// </summary> /// <param name="mapObject">地图控件对象</param> private void LoadMapEngine(object mapObject) { mapFactory = CreateFactory(mapObject); toolBox = CreateToolBox(mapFactory.GetMapControl()); }