using Yw.WinFrmUI.Q3D;
|
using Newtonsoft.Json;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Drawing;
|
using System.Drawing.Design;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using static Yw.WinFrmUI.Q3D.MapViewEnum;
|
|
namespace Yw.WinFrmUI.Q3D
|
{
|
[Serializable]
|
public class Area : BaseModel, IBaseViewModel
|
{
|
public List<PointF> Points { get; set; }
|
|
[Category("基本信息")]
|
[Description("对象的ID唯一标识")]
|
[DisplayName(" 编号 ")]
|
public string ID { get; set; }
|
|
|
|
public string Name { get; set; }
|
|
[Category("其他参数")]
|
[Description("选中")]
|
[DisplayName("选中")]
|
[Browsable(false)]
|
public bool Selected { get; set; }
|
|
[Category("其他参数")]
|
[Description("鼠标悬于上方")]
|
[DisplayName("鼠标悬于上方")]
|
[Browsable(false)]
|
public bool Hovered { get; set; }
|
|
|
|
[Category("其他参数")]
|
[Description("选中")]
|
[DisplayName("位置信息")]
|
[Browsable(false)]
|
|
|
|
public PointF Position { get; set; } = new PointF(0, 0);
|
|
[Browsable(false)]
|
[JsonIgnore]
|
public String regionName { get; set; } = null;
|
|
[Category("基本信息")]
|
[Description("X坐标")]
|
[DisplayName("X坐标")]
|
[Browsable(true)]
|
public float X
|
{
|
get
|
{
|
return Position.X;
|
}
|
set
|
{
|
Position = new PointF(value, Position.Y);
|
}
|
}
|
[Category("基本信息")]
|
[Description("Y坐标")]
|
[DisplayName("Y坐标")]
|
[Browsable(true)]
|
public float Y
|
{
|
get
|
{
|
return Position.Y;
|
}
|
set
|
{
|
Position = new PointF(Position.X, value);
|
}
|
}
|
|
[Category("基本信息")]
|
[Description("标高")]
|
[DisplayName("标高")]
|
[Browsable(true)]
|
public float Z { get; set; }
|
|
[Category("其他参数")]
|
[Description("对象的等级")]
|
[DisplayName("级别")]
|
|
|
public int Level { get; set; } = 0;
|
[Category("其他参数")]
|
[Description("对象的等级")]
|
[DisplayName("是否显示")]
|
public bool Visible { get; set; } = true;
|
|
|
[Category("基本信息")]
|
[Description("类型")]
|
[DisplayName("类型")]
|
public MapObjectType Type { get { return this.GetTypeString(); } }
|
|
|
[Category("其他参数")]
|
[Description("ID类型")]
|
[DisplayName("ID类型")]
|
[Browsable(false)]
|
public string IDType => Type.ToString() + "\t" + ID;
|
|
|
//[Category("其他参数")]
|
//[Description("标签")]
|
//[DisplayName("标签")]
|
//[Editor(typeof(MyEditor), typeof(UITypeEditor))]
|
//public TagList Tags { get; set; } = null;
|
|
|
|
public MapObjectType GetTypeString()
|
{
|
if (this is JunctionViewModel) return MapObjectType.节点;
|
if (this is ReservoirViewModel) return MapObjectType.水库;
|
if (this is TankViewModel) return MapObjectType.水池;
|
if (this is MeterViewModel) return MapObjectType.水表;
|
if (this is NozzleViewModel) return MapObjectType.喷头;
|
|
|
if (this is PipeViewModel) return MapObjectType.管线;
|
if (this is ValveViewModel) return MapObjectType.阀门;
|
|
if (this is PumpViewModel) return MapObjectType.水泵;
|
|
|
return MapObjectType.节点;
|
}
|
|
public bool isNode()
|
{
|
if (this is JunctionViewModel) return true;
|
if (this is ReservoirViewModel) return true;
|
if (this is TankViewModel) return true;
|
if (this is MeterViewModel) return true;
|
if (this is NozzleViewModel) return true;
|
return false;
|
}
|
}
|
}
|