You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

285 lines
9.0 KiB
C#

// <copyright file="FrmDoc.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using DevExpress.XtraBars.Docking;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Windows.Forms;
namespace PcgDrawR
{
/// <summary>
/// The frm doc.
/// </summary>
public partial class FrmDoc : DevExpress.XtraBars.Ribbon.RibbonForm
{
/// <summary>
/// Gets or sets the new file saved event.
/// </summary>
public NewFileSavedHandler NewFileSavedEvent
{
get
{
return this.DrawEditor.NewFileSavedEvent;
}
set
{
this.DrawEditor.NewFileSavedEvent = value;
}
}
/// <summary>
/// Gets or sets the z color width.
/// </summary>
public double ZColorWidth
{
get
{
return this.DrawEditor.ZColorWidth;
}
set
{
this.DrawEditor.ZColorWidth = value;
}
}
/// <summary>
/// Gets or sets the file full path.
/// </summary>
public string FileFullPath { get; set; }
/// <summary>
/// 图层面板
/// </summary>
//public DockPanel LayerPanel
//{
// get
// {
// return this.DrawEditor.LayerPanel;
// }
// set
// {
// this.DrawEditor.LayerPanel = value;
// }
//}
/// <summary>
/// Gets or sets the property panel.
/// </summary>
public DockPanel PropertyPanel
{
get
{
return this.DrawEditor.PropertyPanel;
}
set
{
this.DrawEditor.PropertyPanel = value;
}
}
/// <summary>
/// Gets or sets the statistic panel.
/// </summary>
// public DockPanel StatisticPanel { get; set; }
private bool setZColor;
/// <summary>
/// Initializes a new instance of the <see cref="FrmDoc"/> class.
/// </summary>
public FrmDoc()
{
InitializeComponent();
this.DoubleBuffered = true;
}
/// <summary>
/// Initializes a new instance of the <see cref="FrmDoc"/> class.
/// </summary>
/// <param name="fileFullPath">文件路径</param>
/// <param name="setZColor">是否散点显示为色卡</param>
public FrmDoc(string fileFullPath, bool setZColor = false)
: this()
{
this.FileFullPath = fileFullPath;
this.setZColor = setZColor;
}
/// <summary>
/// Frms the doc_ load.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
private void FrmDoc_Load(object sender, EventArgs e)
{
// 窗口加载
this.DrawEditor.LayerSelected += SetCurrentLayer;
this.DrawEditor.ShowStatisticResult += ShowStatic;
this.DrawEditor.FileModifiedEvent += (object editor, bool isModified) => { this.Text = this.DrawEditor.Text; };
// this.DrawEditor.FileClosedEvent +=
}
/// <summary>
/// Docs the float.
/// </summary>
public void DocFloat()
{
this.ribbonControl1.Visible = true;
this.DrawEditor.ribbonMain.MergeOwner = this.ribbonControl1;
if (!object.ReferenceEquals(this.ribbonControl1.MergedRibbon, this.DrawEditor.ribbonMain))
{
this.DrawEditor.ribbonMain.Visible = true;
this.ribbonControl1.MergeRibbon(this.DrawEditor.ribbonMain);
}
}
/// <summary>
/// Uns the merge control.
/// </summary>
public void UnMergeControl()
{
this.SuspendLayout();
//this.Controls.Add(this.ribbonControl1);
//this.ribbonControl1.SendToBack();
//this.Ribbon = this.ribbonControl1;
this.ResumeLayout();
this.PerformLayout();
//if (this.LayerPanel.ControlContainer.Controls.Count > 0)
//{
// this.LayerPanel.ControlContainer.Controls.Clear();
//}
//if (this.PropertyPanel.ControlContainer.Controls.Count > 0)
//{
// this.PropertyPanel.ControlContainer.Controls.Clear();
//}
//if (this.StatisticPanel.ControlContainer.Controls.Count > 0)
//{
// this.StatisticPanel.ControlContainer.Controls.Clear();
//}
}
/// <summary>
/// Merges the control.
/// </summary>
public void MergeControl()
{
//this.Controls.Remove(this.ribbonControl1);
//this.Ribbon = null;
//// 图层树控件的处理
//UCDraw.LayerTree layerTree = this.DrawEditor.LayerControl;
//if (layerTree != null)
//{
// this.LayerPanel.ControlContainer.Controls.Add(layerTree);
// layerTree.Dock = DockStyle.Fill;
//}
//// 属性控件的处理
//UCDraw.PanelProperty propertyControl = this.DrawEditor.PropertyControl;
//if (propertyControl != null)
//{
// this.PropertyPanel.ControlContainer.Controls.Add(propertyControl);
// propertyControl.Dock = DockStyle.Fill;
//}
//// 统计面板
//DataGridView dgvStatistic = this.DrawEditor.StatisticControl;
//if (dgvStatistic != null)
//{
// this.StatisticPanel.ControlContainer.Controls.Add(dgvStatistic);
// dgvStatistic.Dock = DockStyle.Fill;
//}
}
/// <summary>
/// 创建新文件
/// </summary>
/// <param name="fileName">文件名称</param>
public void CreateNewFile(string fileName)
{
this.DrawEditor.CreateNewFile(fileName, GeoSigmaDrawLib.GeoSigmaXY.eViewType.wellsection);
this.Text = this.DrawEditor.Text;
}
/// <summary>
/// 打开文件
/// </summary>
/// <param name="fileFullPath">文件全路径</param>
/// <param name="setZColor">Z块显示的颜色</param>
/// <returns>是否成功</returns>
public bool OpenFile(string fileFullPath, bool setZColor = false)
{
this.FileFullPath = fileFullPath;
this.setZColor = setZColor;
try
{
this.SuspendLayout();
// 打开文件
this.DrawEditor.ZColorWidth = this.ZColorWidth;
bool bOpend = this.DrawEditor.OpenFile(this.FileFullPath, this.setZColor);
if (bOpend == false)
{
return false;
}
// this.DrawEditor.InitDrawerView();
this.Text = this.DrawEditor.Text;
// MergeControl();
return true;
}
catch (Exception ex)
{
Trace.WriteLine(ex.Message);
return false;
}
finally
{
this.ResumeLayout();
}
}
/// <summary>
/// 保存文件
/// </summary>
/// <returns>是否成功</returns>
public bool SaveFile()
{
return this.DrawEditor.SaveFile();
}
/// <summary>
/// 另存为
/// </summary>
/// <returns>是否成功</returns>
public bool SaveAs()
{
return this.DrawEditor.SaveAs();
}
/// <summary>
/// Sets the current layer.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
private void SetCurrentLayer(object sender, PropertyChangedEventArgs e)
{
//if (this.LayerPanel != null)
//{
// this.LayerPanel.Text = e.PropertyName;
//}
}
/// <summary>
/// 显示统计面板.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ShowStatic(object sender, EventArgs e)
{
//try
//{
// this.StatisticPanel.Visibility = DockVisibility.Visible;
//}
//finally
//{
//}
}
/// <summary>
/// Frms the doc_ form closing.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
private void FrmDoc_FormClosing(object sender, FormClosingEventArgs e)
{
this.DrawEditor.UCDrawEdit_FormClosing(this.DrawEditor, e);
}
}
}