using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using SuperMap.UI;
using SuperMap.Mapping;
using WeifenLuo.WinFormsUI.Docking;
using WWPipeLine.MapBasic.Conditions;
using SuperMap.Data;
namespace WWPipeLine.MapBasic
{
///
/// 二维场景MapEx
///
public partial class MapEx : DockContent //DocWindowExtend
{
///
/// 二维场景MapEx
///
public MapEx()
{
InitializeComponent();
this.TabText = "二维场景MapEx";
this.Tag = "MainControls";
this.AutoScaleMode = AutoScaleMode.Dpi;
this.CloseButtonVisible = false;
this.CloseButton = false;
this.AllowEndUserDocking = false;
this.DockAreas = DockAreas.Document;
this.FormBorderStyle = FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.ControlBox = false;
}
private MapControl m_MapControl;
public MapControl MapControl { get => m_MapControl; set => m_MapControl = value; }
private MapControl m_EagleEyeControl;
public MapControl MapControlOfEagleEye { get => m_EagleEyeControl; set => m_EagleEyeControl = value; }
//private DockPanel m_DockPanel;
//public void SetDockPanel(DockPanel dp)
//{
// m_DockPanel = dp;
//}
protected override void OnLoad(EventArgs e)
{
if (m_MapControl != null) return;
if (m_EagleEyeControl != null) return;
m_MapControl = new MapControl { Dock = DockStyle.Fill };
m_MapControl.InteractionMode = InteractionMode.CustomKeyboard;
m_MapControl.KeyDown += new KeyEventHandler(m_MapControl_KeyDown);
m_MapControl.MarginPanEnabled = false;
this.Controls.Add(m_MapControl);
LayersTreeEx layersTreeEx = new LayersTreeEx(m_MapControl);
layersTreeEx.Show(ComsStatic.DockPanel, DockState.DockLeft);
layersTreeEx.DockPanel.DockLeftPortion = 0.15;
m_EagleEyeControl = new MapControl { Dock = DockStyle.Fill };
m_EagleEyeControl.MarginPanEnabled = false;
m_EagleEyeControl.IsWaitCursorEnabled = false;
m_EagleEyeControl.InteractionMode = InteractionMode.CustomAll;
this.Controls.Add(m_EagleEyeControl);
EagleEyeEx eagleEyeEx = new EagleEyeEx(m_EagleEyeControl);
eagleEyeEx.Show(layersTreeEx.Pane, DockAlignment.Top, 0.3);
}
protected class MapControlover : MapControl
{
protected override void OnMouseWheel(MouseEventArgs e)
{
try
{
if (e.Delta != 120 && e.Delta != -120) return;
base.OnMouseWheel(e);
System.Threading.Thread.Sleep(500);
}
catch (Exception ex)
{
Commons.LogHelper.Fatal(ex);
}
}
}
private void m_MapControl_KeyDown(object sender, KeyEventArgs e)
{
switch (e.KeyCode)
{
case Keys.A: m_MapControl.Action = SuperMap.UI.Action.Pan; break;
case Keys.S: m_MapControl.Action = SuperMap.UI.Action.Select; break;
case Keys.F5: m_MapControl.Map.Refresh(); break;
default: break;
}
}
public void RemoveAllToolBar()
{
foreach (Control control in this.Controls)
{
if (control is BasicToolBar)
{
(control as BasicToolBar).AfterClose();
this.Controls.Remove(control);
break;
}
}
}
public void AddToolBar(BasicToolBar basicToolBar)
{
basicToolBar.Dock = DockStyle.Top;
this.Controls.Add(basicToolBar);
}
}
}