using RichCreator.Utility.Maps;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace RichCreator.Utility.Structs
|
{
|
public class HousePathInfoObj
|
{
|
public HousePathInfoObj()
|
{
|
this.NextGates = new List<ParametersPointObj>();
|
this.PathGuides = new List<ZTTargetPolygonObj>();
|
}
|
public HousePathInfoObj(Int32 width, Int32 height)
|
{
|
this.Width = width;
|
this.Height = height;
|
}
|
/// <summary>
|
/// 宽
|
/// </summary>
|
public int Width { get; set; }
|
|
/// <summary>
|
/// 高
|
/// </summary>
|
public int Height { get; set; }
|
|
|
|
|
/// <summary>
|
/// 障碍物
|
/// </summary>
|
public List<ZTPolygonObj> Obstacles { get; set; }
|
|
|
/// <summary>
|
/// 定位点
|
/// </summary>
|
public List<ParametersPointObj> LocationPoints { get; set; }
|
|
|
/// <summary>
|
/// 寻路点
|
/// </summary>
|
public List<ZTPointObj> FindPathPoints { get; set; }
|
|
|
/// <summary>
|
/// 巡逻点
|
/// </summary>
|
public ZTPointObj LoopPoint { get; set; }
|
|
/// <summary>
|
/// 寻路线
|
/// </summary>
|
public List<ZTLinePointObj> FindPathLines { get; set; }
|
|
/// <summary>
|
/// 下一关进门点
|
/// 参数意义 0:上 1:右 2:下 3:左
|
/// </summary>
|
public List<ParametersPointObj> NextGates { get; set; }
|
|
/// <summary>
|
/// 路径向导,把某一区域的点导向某一点
|
/// </summary>
|
public List<ZTTargetPolygonObj> PathGuides { get; set; }
|
|
public HousePathInfo To()
|
{
|
HousePathInfo info = new HousePathInfo(this.Width, this.Height);
|
|
info.Obstacles = new List<ZTPolygon>();
|
foreach (var item in this.Obstacles)
|
{
|
info.Obstacles.Add(item.To());
|
}
|
|
info.LocationPoints = new List<ParametersPoint>();
|
foreach (var item in this.LocationPoints)
|
{
|
info.LocationPoints.Add(item.To());
|
}
|
|
info.FindPathPoints = new List<ZTPoint>();
|
foreach (var item in this.FindPathPoints)
|
{
|
info.FindPathPoints.Add(item.To());
|
}
|
|
if (this.LoopPoint == null)
|
{
|
info.LoopPoint = ZTPoint.Empty;
|
}
|
else
|
{
|
info.LoopPoint = this.LoopPoint.To();
|
}
|
|
|
info.FindPathLines = new List<ZTLinePoint>();
|
foreach (var item in this.FindPathLines)
|
{
|
info.FindPathLines.Add(item.To());
|
}
|
|
info.NextGates = new List<ParametersPoint>();
|
foreach (var item in this.NextGates)
|
{
|
info.NextGates.Add(item.To());
|
}
|
|
info.PathGuides = new List<ZTTargetPolygon>();
|
foreach (var item in this.PathGuides)
|
{
|
info.PathGuides.Add(item.To());
|
}
|
|
|
return info;
|
}
|
|
public static HousePathInfoObj From(HousePathInfo info)
|
{
|
HousePathInfoObj infoObj = new HousePathInfoObj(info.Width, info.Height);
|
|
infoObj.Obstacles = new List<ZTPolygonObj>();
|
foreach (var item in info.Obstacles)
|
{
|
infoObj.Obstacles.Add(ZTPolygonObj.From(item));
|
}
|
|
infoObj.LocationPoints = new List<ParametersPointObj>();
|
foreach (var item in info.LocationPoints)
|
{
|
infoObj.LocationPoints.Add(ParametersPointObj.From(item));
|
}
|
|
infoObj.FindPathPoints = new List<ZTPointObj>();
|
foreach (var item in info.FindPathPoints)
|
{
|
infoObj.FindPathPoints.Add(ZTPointObj.From(item));
|
}
|
|
infoObj.LoopPoint = ZTPointObj.From(info.LoopPoint);
|
|
infoObj.FindPathLines = new List<ZTLinePointObj>();
|
foreach (var item in info.FindPathLines)
|
{
|
infoObj.FindPathLines.Add(ZTLinePointObj.From(item));
|
}
|
|
infoObj.NextGates = new List<ParametersPointObj>();
|
foreach (var item in info.NextGates)
|
{
|
infoObj.NextGates.Add(ParametersPointObj.From(item));
|
}
|
|
|
infoObj.PathGuides = new List<ZTTargetPolygonObj>();
|
foreach (var item in info.PathGuides)
|
{
|
infoObj.PathGuides.Add(ZTTargetPolygonObj.From(item));
|
}
|
|
|
return infoObj;
|
|
}
|
}
|
}
|