| | |
| | | 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; |
| | |
| | | { |
| | | |
| | | } |
| | | public class TContainer |
| | | { |
| | | |
| | | public MapDimensions mapOption = new MapDimensions(); |
| | | |
| | | public Template newTemplate = null; |
| | | |
| | | public Template template = null; |
| | | |
| | | } |
| | | public partial class MapViewer |
| | | { |
| | | |
| | | #region 新增管网 |
| | | #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; set; } = null;// new Template(); |
| | | public Template _newTemplate |
| | | { |
| | | get { return TC.newTemplate; } |
| | | set { TC.newTemplate = value; } |
| | | } |
| | | |
| | | |
| | | [Browsable(false)] |
| | | public Template _Template |
| | | { |
| | | get {return TC.template; } |
| | | set |
| | | { |
| | | TC.template = value; |
| | | |
| | | label_file.Text = TC.template?.filePath; |
| | | } |
| | | } |
| | | |
| | | #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; |
| | | Cursor _lastCursor; |
| | | object _undoOldValue = null; |
| | | private List<PointF> polygonPoints = new List<PointF>(); |
| | | |
| | | private bool _isDrawingPolygon; |
| | | |
| | | #endregion |
| | | #region 新增管网(辅助) |
| | | |
| | | MapViewNetWork _NewNet |
| | | { |
| | | get |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 属性 |
| | | #region 显示选项(辅助) |
| | | |
| | | |
| | | private string _StartPoint = null; |
| | |
| | | } |
| | | } |
| | | |
| | | private Template __template = null; |
| | | [Browsable (false)] |
| | | public Template _Template |
| | | { |
| | | get { return __template; } |
| | | set |
| | | { |
| | | __template = value; |
| | | |
| | | label_file.Text = __template==null?"": __template.filePath; |
| | | } |
| | | } |
| | | |
| | | [Browsable(false)] |
| | | public float Link_multiply |
| | | { |
| | |
| | | return _Template?.network; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | #region 管网属性(辅助) |
| | | [Browsable(false)] |
| | | public List<NodeCalcModel> _Nodes |
| | | { |
| | |
| | | |
| | | } |
| | | #endregion |
| | | #region 视角设置(辅助) |
| | | |
| | | |
| | | #region 基础地图视图选项 |
| | | |
| | | MapDimensions mapOption = new MapDimensions(); |
| | | MapDimensions mapOption0 = new MapDimensions(); |
| | | |
| | | |
| | | private const float MinZoom = 0.1f; |
| | | private const float MaxZoom = 1000.0f; |
| | |
| | | return mapOption.zoom; |
| | | } |
| | | set |
| | | { |
| | | { |
| | | label_zoom.Text = $"Zoom:{zoom.ToString("0.000")}"; |
| | | mapOption.zoom = value; |
| | | } |
| | | } |
| | |
| | | return mapOption.rotation; |
| | | } |
| | | set |
| | | { |
| | | { |
| | | toolStripStatusLabel_rotation.Text = $"Rotation:({Rotation.ToString("0")},{RotationF.ToString("0")})"; |
| | | mapOption.rotation = value; |
| | | } |
| | | } |
| | |
| | | return mapOption.Center; |
| | | } |
| | | set |
| | | { |
| | | { |
| | | label_center.Text = $"center:({MapCenter.X.ToString("0.00")} ,{MapCenter.Y.ToString("0.00")})"; |
| | | 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 |
| | |
| | | { |
| | | get |
| | | { |
| | | if (Lock2DView) |
| | | mapOption.rotationF = 90; |
| | | |
| | | return mapOption.rotationF; |
| | | } |
| | | set |
| | | { |
| | | |
| | | if (Lock2DView) |
| | | mapOption.rotationF = 90; |
| | | else |
| | | mapOption.rotationF = value; |
| | | mapOption.rotationF = value; |
| | | } |
| | | } |
| | | [Browsable(false)] |
| | |
| | | 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 正交模式 |
| | | private bool _isOrtho |
| | | { |
| | | get |
| | | { |
| | | return mapOption.IsOrtho; |
| | | } |
| | | set |
| | | { |
| | | mapOption.IsOrtho = value; |
| | | if (mapOption.IsOrtho) |
| | | { |
| | | label_ZZ.Text = "正交模式:开"; |
| | | } |
| | | else |
| | | { |
| | | label_ZZ.Text = "正交模式:关"; |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | #region 事件 |
| | | //按帧数判断是否重绘,减少计算量(每帧最多重绘一次) |
| | | bool _timerDraw = false; |
| | | //按帧数判断鼠标悬停对象,减少计算量(每帧最多判断一次) |
| | | bool _mouseHoverCheckFlag = false; |
| | | #endregion |
| | | } |
| | | } |