¶Ô±ÈÐÂÎļþ |
| | |
| | |  |
| | | using Hydro.Core.Model; |
| | | using Hydro.MapView; |
| | | using Hydro.MapView.Base; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Data; |
| | | using System.Data.Common; |
| | | using System.Diagnostics; |
| | | using System.Drawing; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Numerics; |
| | | using System.Reflection; |
| | | using System.Runtime.CompilerServices; |
| | | using System.Security.Cryptography; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows.Forms; |
| | | using System.Windows.Forms.DataVisualization.Charting; |
| | | using static Hydro.MapView.MapViewEnum; |
| | | using static System.Net.Mime.MediaTypeNames; |
| | | using static System.Windows.Forms.AxHost; |
| | | using static System.Windows.Forms.LinkLabel; |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.Button; |
| | | using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrackBar; |
| | | |
| | | namespace Hydro.WinfrmUI |
| | | { |
| | | |
| | | public class TContainer |
| | | { |
| | | |
| | | public MapDimensions mapOption = new MapDimensions(); |
| | | |
| | | public Template newTemplate = null; |
| | | |
| | | public Template template = null; |
| | | |
| | | } |
| | | public partial class ViewBrowser |
| | | { |
| | | |
| | | #region æ ¸å¿å±æ§ |
| | | TContainer TC = new TContainer(); |
| | | |
| | | |
| | | /// <summary> |
| | | /// å°å¾é项 |
| | | /// </summary> |
| | | public MapDimensions mapOption |
| | | { |
| | | get { return TC.mapOption; } |
| | | set { TC.mapOption = value; } |
| | | } |
| | | /// <summary> |
| | | /// å°å¾é项_èµ·å§æä½æ¶ |
| | | /// </summary> |
| | | private MapDimensions mapOption0 = new MapDimensions(); |
| | | /// <summary> |
| | | /// 临æ¶ç®¡ç½å± |
| | | /// </summary> |
| | | [Browsable(false)] |
| | | public Template _newTemplate |
| | | { |
| | | get { return TC.newTemplate; } |
| | | set { TC.newTemplate = value; } |
| | | } |
| | | |
| | | |
| | | [Browsable(false)] |
| | | public Template _Template |
| | | { |
| | | get {return TC.template; } |
| | | set |
| | | { |
| | | TC.template = value; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | #region 交äºå±æ§ |
| | | /// <summary> |
| | | /// æ¬å对象 |
| | | /// </summary> |
| | | private List<IBaseViewModel> hoveredObjs = new List<IBaseViewModel>(); |
| | | /// <summary> |
| | | /// éä¸å¯¹è±¡ |
| | | /// </summary> |
| | | public List<IBaseViewModel> selectedObjs = new List<IBaseViewModel>(); |
| | | |
| | | |
| | | private List<NodeViewModel> selectedNodes => selectedObjs.FindAll(o => o is NodeViewModel).Select(o => (NodeViewModel)o).ToList(); |
| | | private List<LinkViewModel> selectedLinks => selectedObjs.FindAll(o => o is LinkViewModel).Select(o => (LinkViewModel)o).ToList(); |
| | | |
| | | MouseState _mouseState = MouseState.æ ; |
| | | private NodeViewModel _OperaNode = null; |
| | | public PointF mouseXY = new PointF(0, 0); |
| | | |
| | | PointF DragStartPos; |
| | | PointF _ClickStartPos; |
| | | PointF RotaStartPos; |
| | | PointF BackGroudPicLeftPos; |
| | | bool _isPanning; |
| | | /// <summary> |
| | | /// ææ½éæ© |
| | | /// </summary> |
| | | bool _isDragging; |
| | | bool _isRotating; |
| | | bool _isPainting; |
| | | |
| | | |
| | | PointF mousePosition; |
| | | // control+é¼ æ ä¸é´æä¸ç¼©æ¾ |
| | | bool _isInsertingObject = false; |
| | | bool _isMovingObject = false; |
| | | bool _isPastingObject = false; |
| | | System.Windows.Forms.Cursor _lastCursor; |
| | | object _undoOldValue = null; |
| | | private List<PointF> polygonPoints = new List<PointF>(); |
| | | |
| | | private bool _isDrawingPolygon; |
| | | |
| | | #endregion |
| | | #region æ°å¢ç®¡ç½ï¼è¾
å©ï¼ |
| | | |
| | | MapViewNetWork _NewNet |
| | | { |
| | | get |
| | | { |
| | | if (_newTemplate==null) _newTemplate = new Template(); |
| | | if (_newTemplate.network == null) _newTemplate.network = new MapViewNetWork(); |
| | | return _newTemplate.network; |
| | | } |
| | | } |
| | | #endregion |
| | | #region æ¾ç¤ºé项ï¼è¾
å©ï¼ |
| | | |
| | | |
| | | private string _StartPoint = null; |
| | | private string _EndPoint = null; |
| | | private bool __isEditMode = true; |
| | | [Browsable(false)] |
| | | public bool _IsEditMode |
| | | { |
| | | get { return __isEditMode; } |
| | | set |
| | | { |
| | | __isEditMode = value; |
| | | toolStripComboBox_æµè§æ¨¡å¼.Text = __isEditMode ? "ç¼è¾æ¨¡å¼" : "æµè§æ¨¡å¼"; |
| | | } |
| | | } |
| | | |
| | | |
| | | [Browsable(false)] |
| | | public float Link_multiply |
| | | { |
| | | get |
| | | { |
| | | if (_Template == null || _Template.mapOption == null) return 1.0f; |
| | | return _Template.mapOption.Link_multiply; |
| | | } |
| | | set |
| | | { |
| | | if (_Template == null || _Template.mapOption == null) return;_Template.mapOption.Link_multiply = value; |
| | | } |
| | | } |
| | | [Browsable(false)] |
| | | public float junction_multiply |
| | | { |
| | | get |
| | | { |
| | | if (_Template == null || _Template.mapOption == null) return 1.0f; |
| | | return _Template.mapOption.junction_multiply; |
| | | } |
| | | set |
| | | { |
| | | if (_Template == null || _Template.mapOption == null) return;_Template.mapOption.junction_multiply = value; |
| | | } |
| | | } |
| | | [DisplayName("æ¾ç¤ºéé¨")] |
| | | |
| | | public bool _ShowValve |
| | | { |
| | | get |
| | | { |
| | | if (_Template == null || _Template.mapOption == null) return true; |
| | | return _Template.mapOption._ShowValve; |
| | | } |
| | | set |
| | | { |
| | | if (_Template == null || _Template.mapOption == null) return;_Template.mapOption._ShowValve = value; |
| | | } |
| | | } |
| | | [DisplayName("æ¾ç¤ºèç¹")] |
| | | public bool _ShowJunction |
| | | { |
| | | get |
| | | { |
| | | if (_Template == null || _Template.mapOption == null) return true; |
| | | return _Template.mapOption._ShowJunction; |
| | | } |
| | | set |
| | | { |
| | | |
| | | if (_Template == null || _Template.mapOption == null) return;_Template.mapOption._ShowJunction = value; |
| | | } |
| | | } |
| | | string _filePath |
| | | { |
| | | get |
| | | { |
| | | if (string.IsNullOrEmpty(_Template?.filePath)) |
| | | return null; |
| | | string path=_Template.filePath.TrimStart('\\'); |
| | | return |
| | | Path.Combine(Directory.GetCurrentDirectory(), path); |
| | | } |
| | | //set |
| | | //{ |
| | | |
| | | // _Template.è·¯å¾ = value; |
| | | //} |
| | | } |
| | | private MapViewNetWork _Network |
| | | { |
| | | get |
| | | { |
| | | return _Template?.network; |
| | | } |
| | | } |
| | | #endregion |
| | | #region 管ç½å±æ§ï¼è¾
å©ï¼ |
| | | [Browsable(false)] |
| | | public List<NodeCalcModel> _Nodes |
| | | { |
| | | get { return _Network?.Nodes??new List<NodeCalcModel>(); } |
| | | |
| | | } |
| | | [Browsable(false)] |
| | | public List<LinkCalcModel> _Links |
| | | { |
| | | get { return _Network?.Links??new List<LinkCalcModel>(); } |
| | | |
| | | } |
| | | |
| | | private List<Area> _areas = new List<Area>(); |
| | | [Browsable(false)] |
| | | public List<Area> _Areas |
| | | { |
| | | get { return _areas; } |
| | | |
| | | } |
| | | #endregion |
| | | #region è§è§è®¾ç½®ï¼è¾
å©ï¼ |
| | | |
| | | |
| | | |
| | | private const float MinZoom = 0.1f; |
| | | private const float MaxZoom = 1000.0f; |
| | | |
| | | [DisplayName("缩æ¾ç³»æ°")] |
| | | public float zoom |
| | | { |
| | | get |
| | | { |
| | | return mapOption.zoom; |
| | | } |
| | | set |
| | | { |
| | | if (OnChangeViewZoom != null) |
| | | { |
| | | OnChangeViewZoom.Invoke(zoom); |
| | | } |
| | | mapOption.zoom = value; |
| | | } |
| | | } |
| | | [DisplayName("æè½¬è§åº¦")] |
| | | public double Rotation |
| | | { |
| | | get |
| | | { |
| | | return mapOption.rotation; |
| | | } |
| | | set |
| | | { |
| | | if (OnChangeViewRotation != null) |
| | | { |
| | | OnChangeViewRotation.Invoke(Rotation, RotationF); |
| | | } |
| | | mapOption.rotation = value; |
| | | } |
| | | } |
| | | |
| | | private double Rotation0 = 0; |
| | | [Browsable(false)] |
| | | public PointF MapCenter |
| | | { |
| | | get |
| | | { |
| | | return mapOption.Center; |
| | | } |
| | | set |
| | | { |
| | | if (OnChangeViewCenter != null) |
| | | { |
| | | OnChangeViewCenter.Invoke(MapCenter); |
| | | } |
| | | mapOption.Center = value; |
| | | } |
| | | } |
| | | private PointF MapCenter0; |
| | | private bool is3Dview = false; |
| | | double 俯è§è§åº¦_start = 90; |
| | | |
| | | |
| | | |
| | | public bool Lock2DView |
| | | { |
| | | get |
| | | { |
| | | return mapOption.Lock2DView; |
| | | } |
| | | set |
| | | { |
| | | mapOption.Lock2DView = value; |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 俯è§çº¿ä¸åºé¢ç夹è§ï¼æå½±ç¨sin |
| | | /// </summary> |
| | | [DisplayName("俯è§è§åº¦")] |
| | | public double RotationF |
| | | { |
| | | get |
| | | { |
| | | return mapOption.rotationF; |
| | | } |
| | | set |
| | | { |
| | | mapOption.rotationF = value; |
| | | } |
| | | } |
| | | [Browsable(false)] |
| | | public double 俯è§å¼§åº¦ |
| | | { |
| | | get |
| | | { |
| | | return RotationF / 180 * Math.PI; |
| | | } |
| | | } |
| | | |
| | | [Browsable(false)] |
| | | public PointF Zoom |
| | | { |
| | | get |
| | | { |
| | | return new PointF(zoom, -zoom); |
| | | } |
| | | } |
| | | |
| | | |
| | | private PointF Z(float z) |
| | | { |
| | | return new PointF(0, 0); |
| | | } |
| | | #endregion |
| | | #region é¢è²å级ï¼è¾
å©ï¼ |
| | | Colour _NodeColour |
| | | { |
| | | get |
| | | { |
| | | return _Template?.Colours?.FirstOrDefault(cl => cl.isChoosed && cl.Type == mapOption.ColourNode); |
| | | } |
| | | } |
| | | Colour _LinkColour |
| | | { |
| | | get |
| | | { |
| | | return _Template?.Colours?.FirstOrDefault(cl => cl.isChoosed && cl.Type == mapOption.ColourLink); |
| | | } |
| | | } |
| | | |
| | | //private bool __isOrtho = true; |
| | | |
| | | #endregion |
| | | #region æ£äº¤æ¨¡å¼ |
| | | public Action<bool> OnChangeViewOrtho = null; |
| | | private bool _isOrtho |
| | | { |
| | | get |
| | | { |
| | | return mapOption.IsOrtho; |
| | | } |
| | | set |
| | | { |
| | | mapOption.IsOrtho = value; |
| | | if(OnChangeViewOrtho != null) |
| | | { |
| | | OnChangeViewOrtho.Invoke(mapOption.IsOrtho); |
| | | } |
| | | |
| | | } |
| | | } |
| | | #endregion |
| | | #region äºä»¶ |
| | | //æå¸§æ°å¤ææ¯å¦éç»ï¼åå°è®¡ç®éï¼æ¯å¸§æå¤éç»ä¸æ¬¡ï¼ |
| | | bool _timerDraw = false; |
| | | //æå¸§æ°å¤æé¼ æ æ¬å对象ï¼åå°è®¡ç®éï¼æ¯å¸§æå¤å¤æä¸æ¬¡ï¼ |
| | | bool _mouseHoverCheckFlag = false; |
| | | #endregion |
| | | } |
| | | } |