// 设置设备显示、隐藏 public void SetDeviceVisible(string deviceName, bool visible) { IMFLayer layer = mapLogic.GetLayer("设备服务图层"); if (layer == null) { return; } IMFElement element = layer.GetElement(deviceName); if (element != null) { I3DModel model = element as I3DModel; if (model != null) { model.SetVisible(visible); } } IMFElement ele = layer.GetElement(deviceName + "polygon"); if (ele != null) { IMFCircle circle = ele as IMFCircle; if (circle != null) { circle.SetVisible(visible); } } }
private void SetGlobeElementColor(string layerName, string elementName, Color color, bool isSatellite) { var layer = globeBusiness.mapLogic.GetLayer(layerName); if (layer == null) { return; } var ele = layer.GetElement(elementName); if (ele == null) { return; } if (isSatellite) { I3DModel model = ele as I3DModel; if (model == null) { return; } model.SetColor(color); } else { IMFPolygon polygon = ele as IMFPolygon; if (polygon == null) { return; } polygon.SetFillColor(color); } }
// 更新卫星模型图元位置 private bool UpdateModelPosition(Model3D model) { // 更新卫星位置 var layer = mapLogic.GetLayer(model.LayerName); if (layer == null) { return(false); } var element = layer.GetElement(model.ModelName); if (element == null) { return(false); } I3DModel modelElement = element as I3DModel; if (modelElement == null) { return(false); } MapLngLat lnglat = new MapLngLat(model.Coordinate.Lng, model.Coordinate.Lat, model.Coordinate.Alt); modelElement.UpdateModel(lnglat, model.Azimuth + 90); // 更新模型 layer.Refresh(); return(true); }
private void 闪烁ToolStripMenuItem1_Click(object sender, EventArgs e) { RealData data = gvRealData.GetFocusedRow() as RealData; if (data == null) { return; } try { var element = globeBusiness.mapLogic.GetElement(data.TargetNum.ToString()); if (element == null) { return; } I3DModel model = element as I3DModel; if (model == null) { return; } bool flash = !model.IsFlash; model.Flash(flash, 500); } catch (Exception ex) { Log4Allen.WriteLog(typeof(RealDataListControl), ex.Message); } }
private void 设置颜色ToolStripMenuItem1_Click(object sender, EventArgs e) { RealData data = gvRealData.GetFocusedRow() as RealData; if (data == null) { return; } try { using (ColorDialog dlg = new ColorDialog()) { if (dlg.ShowDialog() == DialogResult.OK) { var color = dlg.Color; var element = globeBusiness.mapLogic.GetElement(data.TargetNum.ToString()); if (element == null) { return; } I3DModel model = element as I3DModel; if (model == null) { return; } model.SetColor(color.ToArgb()); } } } catch (Exception ex) { Log4Allen.WriteLog(typeof(RealDataListControl), ex.Message); } }
/// <summary> /// 跳转到某目标 /// </summary> /// <param name="targetType">目标类型</param> /// <param name="elementName">目标名称</param> public void JumpToPlane(byte targetType, string elementName) { if (mapLogic == null) { return; } IMFLayer layer = mapLogic.GetLayer(GetModelLayerName(targetType)); if (layer == null) { return; } IMFElement element = layer.GetElement(elementName); if (element == null) { return; } I3DModel model = element as I3DModel; if (model == null) { return; } MapLngLat position = model.GetPosition(); IMFToolBox toolBox = mapLogic.GetToolBox(); if (toolBox == null) { return; } toolBox.ZoomToPosition(position); }
public void モデルを追加する(I3DModel モデル) { 表示モデル.Add(モデル); }