| | |
| | | _overrideColorHelper = new LogicalOverrideColorHelper(); |
| | | _overrideOpacityHelper = new LogicalOverrideOpacityHelper(); |
| | | _overrideVisibleHelper = new LogicalOverrideVisibleHelper(); |
| | | _backgroundHelper = new LogicalBackgroudHelper(_viewport); |
| | | _gridLinesHelper = new LogicalGridLineHelper(_viewport); |
| | | _highlightHelper = new LogicalHighlightHelper(_viewport); |
| | | _selectionHelper = new LogicalSelectionHelper(_viewport); |
| | | _zoomHelper = new LogicalZoomHelper(_viewport); |
| | | _billboardTextHelper = new LogicalBillboardLeadLabelHelper(_viewport); |
| | | } |
| | | |
| | | #region 事件集合 |
| | |
| | | protected readonly LogicalOverrideColorHelper _overrideColorHelper = null;//覆盖颜色辅助类 |
| | | protected readonly LogicalOverrideOpacityHelper _overrideOpacityHelper = null;//覆盖透明度辅助类 |
| | | protected readonly LogicalOverrideVisibleHelper _overrideVisibleHelper = null;//覆盖可见性辅助类 |
| | | protected readonly LogicalBackgroudHelper _backgroundHelper = null;//背景辅助类 |
| | | protected readonly LogicalGridLineHelper _gridLinesHelper = null;//网格线辅助类 |
| | | protected readonly LogicalHighlightHelper _highlightHelper = null;//高亮辅助类 |
| | | protected readonly LogicalSelectionHelper _selectionHelper = null;//选择辅助类 |
| | | protected readonly LogicalZoomHelper _zoomHelper = null;//缩放辅助类 |
| | | protected readonly LogicalBillboardLeadLabelHelper _billboardTextHelper = null;//公告版文字辅助类 |
| | | |
| | | #endregion |
| | | |
| | |
| | | return; |
| | | } |
| | | _viewport.Children.Clear(); |
| | | _viewport.Children.Add(new DefaultLights()); |
| | | _viewport.Children.Add(new SunLight()); |
| | | _allVisualLogicalDict?.Values.ToList().ForEach(x => _viewport.Children.Add(x)); |
| | | _viewport.ZoomExtents(); |
| | | } |
| | |
| | | } |
| | | |
| | | //高亮状态改变事件 |
| | | private void HighlightHelper_StateChangedEvent(LogicalVisual3D logicalVisual, eLogicalHighlight highlightType) |
| | | private void HighlightHelper_StateChangedEvent(LogicalVisual3D logicalVisual, bool operation) |
| | | { |
| | | if (logicalVisual == null) |
| | | { |
| | | return; |
| | | } |
| | | switch (highlightType) |
| | | if (operation) |
| | | { |
| | | case eLogicalHighlight.Load: |
| | | { |
| | | _stateHelper.LoadState(logicalVisual.Vmo, eLogicalState.Highlight); |
| | | } |
| | | break; |
| | | case eLogicalHighlight.Unload: |
| | | { |
| | | _stateHelper.UnloadState(logicalVisual.Vmo, eLogicalState.Highlight); |
| | | } |
| | | break; |
| | | default: break; |
| | | _stateHelper.LoadState(logicalVisual.Vmo, eLogicalState.Highlight); |
| | | } |
| | | else |
| | | { |
| | | _stateHelper.UnloadState(logicalVisual.Vmo, eLogicalState.Highlight); |
| | | } |
| | | logicalVisual.UpdateVisual(); |
| | | } |
| | | |
| | | //选择状态改变事件 |
| | | private void SelectionHelper_StateChangedEvent(LogicalVisual3D logicalVisual, eLogicalSelection selectionType) |
| | | private void SelectionHelper_StateChangedEvent(LogicalVisual3D logicalVisual, bool operation) |
| | | { |
| | | if (logicalVisual == null) |
| | | { |
| | | return; |
| | | } |
| | | switch (selectionType) |
| | | if (operation) |
| | | { |
| | | case eLogicalSelection.Load: |
| | | { |
| | | _stateHelper.LoadState(logicalVisual.Vmo, eLogicalState.Selection); |
| | | } |
| | | break; |
| | | case eLogicalSelection.Unload: |
| | | { |
| | | _stateHelper.UnloadState(logicalVisual.Vmo, eLogicalState.Selection); |
| | | } |
| | | break; |
| | | default: break; |
| | | _stateHelper.LoadState(logicalVisual.Vmo, eLogicalState.Selection); |
| | | } |
| | | else |
| | | { |
| | | _stateHelper.UnloadState(logicalVisual.Vmo, eLogicalState.Selection); |
| | | } |
| | | logicalVisual.UpdateVisual(); |
| | | } |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 背景 |
| | | |
| | | /// <summary> |
| | | /// 显示背景 |
| | | /// </summary> |
| | | public virtual void ShowBackgroud() |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _backgroundHelper.Show(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 隐藏背景 |
| | | /// </summary> |
| | | public virtual void HideBackgroud() |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _backgroundHelper.Hide(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 背景可见性 |
| | | /// </summary> |
| | | public virtual bool BackgroudVisible |
| | | { |
| | | get |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return false; |
| | | } |
| | | return _backgroundHelper.Visible; |
| | | } |
| | | set |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _backgroundHelper.Visible = value; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置背景 |
| | | /// </summary> |
| | | public virtual void SetBackgroud(string url) |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _backgroundHelper.Set(url); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置背景 |
| | | /// </summary> |
| | | public virtual void SetBackgroud(string url, double width, double height) |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _backgroundHelper.Set(url, width, height); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 网格线 |
| | | |
| | | /// <summary> |
| | | /// 显示网格线 |
| | | /// </summary> |
| | | public virtual void ShowGridLines() |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _gridLinesHelper.Show(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 隐藏网格线 |
| | | /// </summary> |
| | | public virtual void HideGridLines() |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _gridLinesHelper.Hide(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 网格线可见性 |
| | | /// </summary> |
| | | public virtual bool GridLinesVisible |
| | | { |
| | | get |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return false; |
| | | } |
| | | return _gridLinesHelper.Visible; |
| | | } |
| | | set |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _gridLinesHelper.Visible = value; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 公告板文本 |
| | | |
| | | /// <summary> |
| | | /// 设置公告板文本 |
| | | /// </summary> |
| | | public virtual void SetBillboardText(List<LogicalTextL3d> items) |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _billboardTextHelper.Set(items); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新公告板文本 |
| | | /// </summary> |
| | | public virtual void UpdateBillboardText(LogicalTextL3d item) |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _billboardTextHelper.Update(item); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新公告板文本 |
| | | /// </summary> |
| | | public virtual void UpdateBillboardText(List<LogicalTextL3d> items) |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _billboardTextHelper.Update(items); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 清理公告板文本 |
| | | /// </summary> |
| | | public virtual void ClearBillboardText() |
| | | { |
| | | if (!Initialized) |
| | | { |
| | | return; |
| | | } |
| | | _billboardTextHelper.Clear(); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |