//
// Copyright (c) PlaceholderCompany. All rights reserved.
//
using DevExpress.Utils.Extensions;
using GeoSigma.UCDraw.Tool;
namespace PcgDrawR
{
using DevExpress.Utils.Menu;
using DevExpress.Utils.Svg;
using DevExpress.XtraBars;
using DevExpress.XtraBars.Docking;
using DevExpress.XtraBars.Ribbon;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid;
using DrawerInterface;
using GeoSigma.SigmaDrawerStyle;
using GeoSigma.SigmaDrawerUtil;
using GeoSigma.UCDraw;
using GeoSigma.UCDraw.UC;
using GeoSigma.UCDraw.WellAndSection;
using GeoSigmaDrawLib;
using InterfaceWorkAreaData;
using SigmaDrawerElement;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data.SqlTypes;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Windows.Forms;
using System.Xml.Linq;
using UCDraw;
using WellWorkDataUI;
using WorkData;
///
/// The NewFileSavedHandler.
///
/// The fileFullName.
public delegate void NewFileSavedHandler(string fileFullName);
///
/// The FileClosedEventHandler.
///
/// The sender.
/// The e.
public delegate void FileClosedEventHandler(object sender, EventArgs e);
/////
///// 显示VTK窗口
/////
///// The sender.
///// The instance containing the event data.
//public delegate void ShowVtkEventHandler(object sender, ShowVtkEventArgs e);
/////
///// 关闭VTK窗口
/////
///// The VTK edit.
//public delegate void CloseVtkHandler(UCVtkEdit vtkEdit);
///
/// 图层选择通知代理(带状态)
///
/// 图层
/// 状态
public delegate void LayerSelectedNotifyWithStatusHandler(string layers, LayerStatus status);
///
/// 通知上层打开一个新文件
///
/// 文件路径
public delegate void OpenNewFileHandler(string filePath);
///
/// Ribbon风格图形编辑.
///
public partial class WellPoleUCDrawEdit : XtraUserControl // DevExpress.XtraBars.Ribbon.RibbonForm
{
private BarButtonItem btnSectionAddWellMap;
private DevExpress.XtraBars.BarStaticItem info1;
public delegate void SaveFileToWorkArea(string fileName, WellPoleUCDrawEdit wellViewDoc); //定义保存到工区的委托类型
public event SaveFileToWorkArea OnSaveFileToWorkArea; //定义委托
///
/// Defines the NewFileSavedEvent.
///
public NewFileSavedHandler NewFileSavedEvent { get; set; }
///
/// Defines the FileClosedEvent.
///
public FileClosedEventHandler FileClosedEvent { get; set; }
public bool bMapLibDoc { get; set; }
///
/// Defines the ShowStatisticResult.
///
public event EventHandler ShowStatisticResult;
///
/// Defines the FileModifiedEvent.
///
public event FileModifyEventHandle FileModifiedEvent;
///
/// 打开新文件
///
public event OpenNewFileHandler OpenNewFile;
///
/// 2维图层选择通知(带状态)
///
public LayerSelectedNotifyWithStatusHandler LayerSelectedNotify2dWithStatus { get; set; }
///
/// Defines the layerPanel.
///
private DockPanel layerPanel;
///
/// Gets or sets the main mesh property.
///
///
/// The main mesh property.
///
public SigmaDrawerElement.DrawerElementProperty MainMeshProperty { get; set; } = null;
///
/// Gets or sets the LayerPanel
/// 图层面板.
///
//public DockPanel LayerPanel
//{
// get
// {
// return layerPanel;
// }
// set
// {
// layerPanel = value;
// try
// {
// if (!object.ReferenceEquals(value, dcpLayer))
// {
// if (dcpLayer.Parent.Controls.Count == 1)
// {
// Controls.Remove(dcpLayer.Parent);
// }
// else
// {
// dockManager1.RemovePanel(dcpLayer);
// }
// }
// //else
// //{
// // this.dcpLayer.Visibility = DockVisibility.Visible;
// //}
// }
// finally
// {
// }
// }
//}
private DockPanel propertyPanel;
///
/// Gets or sets the PropertyPanel
/// 属性面板.
///
public DockPanel PropertyPanel
{
get
{
return propertyPanel;
}
set
{
propertyPanel = value;
if (!object.ReferenceEquals(value, dcpProperty))
{
if (dcpProperty.Parent.Controls.Count == 1)
{
Controls.Remove(dcpProperty.Parent);
}
else if (dcpProperty.Parent.Controls.Count == 2
&& dcpProperty.Parent.Controls.Contains(dcpCreate))
{
dockManager1.RemovePanel((DockPanel)dcpProperty.Parent);
//Controls.Remove(dcpProperty.Parent);
}
else
{
dockManager1.RemovePanel(dcpProperty);
}
}
}
}
private DockPanel elePropertyPanel;
public DockPanel ElePropertyPanel
{
get
{
return elePropertyPanel;
}
set
{
elePropertyPanel = value;
if (!object.ReferenceEquals(value, elePropertyPanel))
{
if (elePropertyPanel.Parent.Controls.Count == 1)
{
Controls.Remove(dcpCreate.Parent);
}
else if (dcpCreate.Parent.Controls.Count == 2
&& dcpCreate.Parent.Controls.Contains(dcpCreate))
{
dockManager1.RemovePanel((DockPanel)dcpCreate.Parent);
//Controls.Remove(dcpProperty.Parent);
}
else
{
dockManager1.RemovePanel(dcpCreate);
}
}
}
}
///
/// Defines the statisticPanel.
///
// private DockPanel statisticPanel;
///
/// Gets or sets the StatisticPanel
/// 统计面板.
///
//public DockPanel StatisticPanel
//{
// get
// {
// return statisticPanel;
// }
// set
// {
// statisticPanel = value;
// if (!object.ReferenceEquals(dcpStatistic, value))
// {
// if (dcpStatistic.Parent.Controls.Count == 1)
// {
// Controls.Remove(dcpStatistic.Parent);
// }
// else
// {
// dockManager1.RemovePanel(dcpStatistic);
// }
// }
// //else
// //{
// // this.dcpStatistic.Visibility = DockVisibility.Visible;
// //}
// }
//}
///
/// Defines the drawerStatusBar.
///
private RibbonStatusBar drawerStatusBar;
///
/// Gets or sets the DrawerStatusBar
/// 状态条,显示鼠标位置等提示信息.
///
public RibbonStatusBar DrawerStatusBar
{
get
{
return drawerStatusBar;
}
set
{
drawerStatusBar = value;
}
}
///
/// Gets the DrawerView
/// 主绘图控件.
///
public WellPoleMainView DrawerView => mainView;
///
/// Gets or sets the LayerControl
/// 树控件.
///
public LayerTree LayerControl { get; set; }
///
/// Gets or sets the PropertyControl
/// 属性控件.
///
public WellPolePanelProperty PropertyWellControl { get; set; }
public PanelEleProperty PropertyEleControl { get; set; }
private PanelGraph panelGraph = null;
///
/// 数据成图控件
///
public PanelGraph GraphControl
{
get
{
return panelGraph;
}
}
///
/// Gets or sets the StatisticControl
/// 统计数据控件.
///
// public PanelControl StatisticControl { get; set; }
///
/// Gets or sets the LayerSelected
/// 图层选择事件.
///
public EventHandler LayerSelected
{
get
{
return DrawerView?.LayerSelected;
}
set
{
if (DrawerView != null)
{
DrawerView.LayerSelected = value;
}
}
}
///
/// Gets or sets the ZColorWidth
/// 色块尺寸,当散点显示为色块时使用此属性。.
///
public double ZColorWidth { get; set; } = 25;
///
/// Gets or sets the FileFullName
/// 文件全路径.
///
public string FileFullName
{
get
{
return mainView.FileFullName;
}
set
{
mainView.FileFullName = value;
}
}
///
/// 等值线图层名
///
public string GridContourLayer { get; set; } = "等值线";
///
/// 断层图层名
///
public string GridFaultLayer { get; set; } = "断层";
///
/// 网格编辑控制点图层
///
public string ControlPointLayer { get; set; } = string.Empty;
///
/// 网格编辑器其它线类图层
///
public string OtherLineLayer { get; set; } = string.Empty;
///
/// 三维挖空图层
///
public string HoleLayer { get; set; } = string.Empty;
///
/// 范围边界
///
public string BorderControlLayer { get; set; } = string.Empty;
private string popupTreeType = string.Empty;
///
/// Gets or sets a value indicating whether EnableMeshPack.
///
public bool EnableMeshPack
{
get
{
return mainView.EnableMeshPack;
}
set
{
mainView.EnableMeshPack = value;
if (bbtnMeshPack.Down != mainView.EnableMeshPack)
{
bbtnMeshPack.Down = mainView.EnableMeshPack;
}
}
}
///
/// Gets or sets a value indicating whether StatusBarVisible
/// Gets or sets 状态条是否可见..
///
public bool StatusBarVisible
{
get
{
return ribbonStatusBar1.Visible;
}
set
{
ribbonStatusBar1.Visible = value;
}
}
///
/// Gets or sets a value indicating whether ViewGroupVisible
/// 视图工具组是否可见.
///
public bool ViewGroupVisible
{
get
{
return rgpViews.Visible;
}
set
{
rgpViews.Visible = value;
}
}
///
/// Gets or sets the DrawerGotFocus
/// 获得焦点事件.
///
public EventHandler DrawerGotFocus
{
get
{
if (mainView != null)
{
return mainView.DrawerGotFocus;
}
return null;
}
set
{
if (mainView != null)
{
mainView.DrawerGotFocus = value;
}
}
}
///
/// Gets the RibbonDraw
/// 绘图工具RibbonPage.
///
public RibbonPage RibbonDraw
{
get
{
return ribbonPage1;
}
}
///
/// Defines the mainView.
///
private WellPoleMainView mainView = null;
///
/// Defines the layerPopNode.
///
private string layerPopNode = string.Empty;
///
/// Gets or sets a value indicating whether StatisticPanelVisible
/// get/set 统计面板的可见性.
///
///
/// Gets or sets a value indicating whether PropertyPanelVisible
/// get/set 属性面板可见性.
///
public bool PropertyPanelVisible
{
get
{
return PropertyPanel.Visibility == DockVisibility.Visible;
}
set
{
try
{
if (value == true)
{
if (bckiPanelProperty.Checked != true)
{
bckiPanelProperty.Checked = true;
return;
}
this.PropertyPanel.Index = 0;
ElePropertyPanel.Visibility = DockVisibility.Visible;
PropertyPanel.Visibility = DockVisibility.Visible;
this.PropertyPanel.ParentPanel.ActiveChild = this.PropertyPanel;
}
else
{
ElePropertyPanel.Visibility = DockVisibility.Hidden;
PropertyPanel.Visibility = DockVisibility.Hidden;
if (bckiPanelProperty.Checked == true)
{
bckiPanelProperty.Checked = false;
}
}
}
catch
{
}
}
}
private bool batchSetZColorFlag;
///
/// Gets or sets a value indicating whether [batch set z color flag].
///
///
/// true if [batch set z color flag]; otherwise, false.
///
public bool BatchSetZColorFlag
{
get
{
return batchSetZColorFlag;
}
set
{
this.btnSetXyzClore.Enabled = value;
batchSetZColorFlag = value;
}
}
///
/// 将全部内容当前分辨率保存到指定输出文件.
///
/// The output file.
/// 左
/// 上
/// 右
/// 下
public void Draw2Image(string outputFile, double left = 0, double top = 0, double right = 0, double bottom = 0)
{
mainView?.Draw2Image(outputFile, left, top, right, bottom);
}
private BarManager bmDrawer;
private string layoutFilePath;
///
/// Initializes a new instance of the class.
///
public WellPoleUCDrawEdit(GeoSigmaXY.eViewType vType = GeoSigmaXY.eViewType.plane)
{
InitializeComponent();
InitRibbonControls();
bMapLibDoc = false;
SetStatusWorkAreaName(Config.ProjectPath);
// 测试代码,注册一下需要特殊处理的类型
//var lazyAction = new Lazy