ningshuxia
2 天以前 71c12ff40d58c3dbdde6867396dd99224e57fc32
WinFrmUI/Yw.WinFrmUI.Hydro.Q3d.Core/MapView/Common/MapOption.cs
@@ -1,12 +1,12 @@
using Hydro.CommonBase;
using System;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yw.WinFrmUI.Q3d;
namespace Hydro.MapView
namespace Yw.WinFrmUI.Q3d
{
    [Serializable]
    public class MapOption
@@ -20,7 +20,7 @@
        public bool _ShowFlowDirection { get; set; } = false;
    }
    [Serializable]
    public class Colour
@@ -29,11 +29,11 @@
        public ColourType Type { get; set; }
        public List<ColourItem> Items { get; set; }
        public bool isNode
        {
            get
            {
                if (Type==ColourType.节点自由压力 || Type==ColourType.节点需水量)
        public bool isNode
        {
            get
            {
                if (Type == ColourType.节点自由压力 || Type == ColourType.节点需水量)
                {
                    return true;
                }
@@ -41,25 +41,25 @@
                {
                    return false;
                }
            }
            }
        }
        public bool isChoosed { get; set; } = false;
        public float minNum=0;
        public float maxNum=50;
        public float minNum = 0;
        public float maxNum = 50;
        public int ColourCount = 5;
        public Color color0 = Color.Red;
        public Color color1 = Color.Blue;
        public Colour(ColourType type=ColourType.节点自由压力, List<ColourItem> value=null, string name =null)
        public Colour(ColourType type = ColourType.节点自由压力, List<ColourItem> value = null, string name = null)
        {
            Name =name;
            Name = name;
            Type = type;
            Items = value;
            if (Items == null) Items = new List<ColourItem>();
            if (Name==null) Name= type.ToString();
            if (Name == null) Name = type.ToString();
        }
        public override string ToString()
        {
@@ -97,10 +97,34 @@
        public static int NodeTypeCount = 3;
    }
    public class DRange
    {
        public double Min { get; set; }
        public double Max { get; set; }
        public DRange(double min, double max)
        {
            Min = min;
            Max = max;
        }
        public DRange()
        {
        }
        //实现方法Union
        public static DRange Union(DRange range1, DRange range2)
        {
            //实现方法Union
            return new DRange(Math.Min(range1.Min, range2.Min), Math.Max(range1.Max, range2.Max));
        }
        //实现方法IsInside
        public bool IsInside(double value)
        {
            return value >= Min && value < Max;
        }
    }
    [Serializable]
    public class ColourItem
    {
        public DRange DRange { get; set; }=new DRange();
        public DRange DRange { get; set; } = new DRange();
        public Color value;
        public ColourItem(DRange dRange, Color value)
        {
@@ -113,7 +137,7 @@
        public ColourItem(ColourItem item)
        {
            this.DRange = item.DRange;
            this.value = item.value;
            this.value = item.value;
        }
        public override string ToString()
        {
@@ -122,11 +146,11 @@
    }
    public enum ColourType
    {
        无=0,
        节点自由压力=1,
        节点绝对压力=2,
        节点需水量=3,
        管线流量=4,
        管线流速=5
        无 = 0,
        节点自由压力 = 1,
        节点绝对压力 = 2,
        节点需水量 = 3,
        管线流量 = 4,
        管线流速 = 5
    }
}