using RichCreator.Utility.Structs;
using RichCreator.Utility.Utilitys;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RichCreator.Utility.Maps
{
///
/// 路径信息
///
public class HousePathInfo
{
public HousePathInfo()
{
Obstacles = new List();
LocationPoints = new List();
FindPathPoints = new List();
FindPathLines = new List();
NextGates = new List();
PathGuides = new List();
LoopPoint = new ZTPoint();
}
public HousePathInfo(Int32 width, Int32 height) : this()
{
this.Width = width;
this.Height = height;
}
#region Propertys
///
/// 宽
///
public int Width { get; set; }
///
/// 高
///
public int Height { get; set; }
///
/// 障碍物
///
public List Obstacles { get; set; }
///
/// 定位点
///
public List LocationPoints { get; set; }
///
/// 寻路点
///
public List FindPathPoints { get; set; }
///
/// 寻路线
///
public List FindPathLines { get; set; }
///
/// 巡逻点
///
public ZTPoint LoopPoint { get; set; }
///
/// 下一关进门点
/// 参数意义 0:上 1:右 2:下 3:左
///
public List NextGates { get; set; }
///
/// 路径向导,把某一区域的点导向某一点
///
public List PathGuides { get; set; }
#endregion
#region Editor
///
/// 添加障碍物
///
///
public bool AddObstacle(ZTPolygon obstacle)
{
Int32 index = 0;
if (ExistsObstacle(out index, obstacle))
{
return false;
}
this.Obstacles.Add(obstacle);
return true;
}
///
/// 删除障碍物
///
///
///
public bool RemoveObstacle(ZTPolygon obstacle)
{
Int32 index = 0;
if (!ExistsObstacle(out index, obstacle))
{
return true;
}
this.Obstacles.RemoveAt(index);
return true;
}
///
/// 是否存在障碍物
///
///
///
private bool ExistsObstacle(out Int32 index, ZTPolygon obstacle)
{
index = 0;
for (int i = 0; i < Obstacles.Count; i++)
{
if (Obstacles[i] .Equals( obstacle))
{
index = i;
return true;
}
}
return false;
}
///
/// 添加定位点
///
///
///
///
public bool AddLocationPosition(ParametersPoint point)
{
if (this.LocationPoints.Exists((p) => { return point.Point.Equals(p.Point); }))
{
return false;
}
this.LocationPoints.Add(point);
return true;
}
///
/// 清空定位点
///
///
public void ClearLocationPosiltion()
{
this.LocationPoints.Clear();
}
///
/// 添加寻路点
///
///
///
public bool AddFindPathPoint(ZTPoint point)
{
Int32 index = 0;
if (ExistsFindPathPoint(out index, point))
{
return false;
}
this.FindPathPoints.Add(point);
return true;
}
///
/// 删除寻路点
///
///
///
public bool RemoveFindPathPoint(ZTPoint point)
{
Int32 index = 0;
if (!ExistsFindPathPoint(out index, point))
{
return true;
}
//查询巡逻线和寻路线是否有用到此点
if (ExistsPointInAllLine(point))
{
return false;
}
this.FindPathPoints.RemoveAt(index);
return true;
}
///
/// 是否存在指定寻路点
///
///
///
///
private bool ExistsFindPathPoint(out Int32 index, ZTPoint point)
{
index = 0;
for (int i = 0; i < this.FindPathPoints.Count; i++)
{
if (this.FindPathPoints[i].Equals(point))
{
index = i;
return true;
}
}
return false;
}
///
/// 添加寻路线
///
///
///
public bool AddFindPathLine(ZTLinePoint line)
{
Int32 index = 0;
if (ExistsFindPathLine(out index, line))
{
return false;
}
this.FindPathLines.Add(line);
return true;
}
///
/// 删除寻路线
///
///
///
public bool RemoveFindPathLine(ZTLinePoint line)
{
Int32 index = 0;
if (!ExistsFindPathLine(out index, line))
{
return true;
}
this.FindPathLines.RemoveAt(index);
return true;
}
///
/// 是否存在寻路线
///
///
///
///
private bool ExistsFindPathLine(out Int32 index, ZTLinePoint line)
{
index = 0;
for (int i = 0; i < this.FindPathLines.Count; i++)
{
if (this.FindPathLines[i] .Equals( line))
{
index = i;
return true;
}
}
return false;
}
///
/// 巡逻线或寻路线中是否存在某点
///
///
///
private bool ExistsPointInAllLine(ZTPoint point)
{
for (int i = 0; i < this.FindPathLines.Count; i++)
{
if (this.FindPathLines[i].P1.Equals(point) || this.FindPathLines[i].P2.Equals(point))
{
return true;
}
}
return false;
}
///
/// 添加下一关的门
///
///
///
public bool AddNextGate(ParametersPoint point)
{
Int32 index = 0;
if (ExistsNextGate(out index, point))
{
return false;
}
this.NextGates.Add(point);
return true;
}
///
/// 移除下一关的门
///
///
///
public bool RemoveNextGate(ParametersPoint point)
{
Int32 index = 0;
if (!ExistsNextGate(out index, point))
{
return true;
}
this.NextGates.RemoveAt(index);
return true;
}
///
/// 是否存在到达下一关的点
///
///
///
public bool ExistsNextGate(out Int32 index,ParametersPoint point)
{
index = -1;
for (int i = 0; i < this.NextGates.Count; i++)
{
if (this.NextGates.Equals(point))
{
index = i;
return true;
}
}
return false;
}
///
/// 添加路径导引多边形
///
///
///
public bool AddPathGuide(ZTTargetPolygon polygon)
{
Int32 index = 0;
if (ExistsPathGuide(out index, polygon))
{
return false;
}
this.PathGuides.Add(polygon);
return true;
}
///
/// 移除路径导引多边形
///
///
///
public bool RemovePathGuide(ZTTargetPolygon polygon)
{
Int32 index = 0;
if (!ExistsPathGuide(out index, polygon))
{
return true;
}
this.PathGuides.RemoveAt(index);
return true;
}
///
/// 是否存在路径导引
///
///
///
///
public bool ExistsPathGuide(out Int32 index, ZTTargetPolygon polygon)
{
index = -1;
for (int i = 0; i < this.PathGuides.Count; i++)
{
if (this.PathGuides.Equals(polygon))
{
index = i;
return true;
}
}
return false;
}
#endregion
#region json info
//凛冬
private static readonly string[] Lingdong = new string[] {
//0
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//1
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//2
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//3
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//4
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//5
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//6
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//7
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//8
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//9
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//10
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//11
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//12
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//13
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//14
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//15
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//16
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//17
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//18
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}",
//19
"{\"Width\":1350,\"Height\":901,\"Obstacles\":[],\"LocationPoints\":[],\"FindPathPoints\":[],\"LoopLines\":[],\"FindPathLines\":[]}"
};
//卡勒特
private static readonly string[] Kalete = new string[] {
//0:
"{\"Width\":896,\"Height\":686,\"Obstacles\":[{\"Points\":[{\"X\":2,\"Y\":320},{\"X\":460,\"Y\":310},{\"X\":493,\"Y\":319},{\"X\":556,\"Y\":334},{\"X\":668,\"Y\":344},{\"X\":759,\"Y\":330},{\"X\":873,\"Y\":308},{\"X\":893,\"Y\":300},{\"X\":891,\"Y\":1},{\"X\":2,\"Y\":3}],\"Length\":10},{\"Points\":[{\"X\":2,\"Y\":552},{\"X\":71,\"Y\":545},{\"X\":76,\"Y\":427},{\"X\":165,\"Y\":439},{\"X\":166,\"Y\":521},{\"X\":253,\"Y\":559},{\"X\":703,\"Y\":550},{\"X\":703,\"Y\":521},{\"X\":823,\"Y\":513},{\"X\":834,\"Y\":568},{\"X\":893,\"Y\":559},{\"X\":893,\"Y\":684},{\"X\":4,\"Y\":683}],\"Length\":13}],\"LocationPoints\":[{\"Point\":{\"X\":797,\"Y\":348},\"Parameter\":0},{\"Point\":{\"X\":671,\"Y\":348},\"Parameter\":1},{\"Point\":{\"X\":547,\"Y\":348},\"Parameter\":2},{\"Point\":{\"X\":423,\"Y\":348},\"Parameter\":3},{\"Point\":{\"X\":298,\"Y\":347},\"Parameter\":4},{\"Point\":{\"X\":172,\"Y\":348},\"Parameter\":5},{\"Point\":{\"X\":47,\"Y\":348},\"Parameter\":6}],\"FindPathPoints\":[{\"X\":51,\"Y\":392},{\"X\":438,\"Y\":418},{\"X\":775,\"Y\":400}],\"LoopLines\":[],\"FindPathLines\":[{\"P1\":{\"X\":51,\"Y\":392},\"P2\":{\"X\":775,\"Y\":400}},{\"P1\":{\"X\":438,\"Y\":418},\"P2\":{\"X\":775,\"Y\":400}},{\"P1\":{\"X\":438,\"Y\":418},\"P2\":{\"X\":51,\"Y\":392}}],\"NextGates\":[{\"Point\":{\"X\":778,\"Y\":346},\"Parameter\":1}],\"PathGuides\":[]}",
//1:
"{\"Width\":1349,\"Height\":900,\"Obstacles\":[{\"Points\":[{\"X\":124,\"Y\":324},{\"X\":760,\"Y\":310},{\"X\":956,\"Y\":414},{\"X\":1124,\"Y\":372},{\"X\":1113,\"Y\":301},{\"X\":1346,\"Y\":297},{\"X\":1345,\"Y\":3},{\"X\":0,\"Y\":2},{\"X\":0,\"Y\":375}],\"Length\":9},{\"Points\":[{\"X\":1342,\"Y\":675},{\"X\":1189,\"Y\":675},{\"X\":1191,\"Y\":713},{\"X\":949,\"Y\":712},{\"X\":867,\"Y\":772},{\"X\":840,\"Y\":897},{\"X\":1345,\"Y\":899}],\"Length\":7},{\"Points\":[{\"X\":651,\"Y\":668},{\"X\":459,\"Y\":671},{\"X\":446,\"Y\":641},{\"X\":247,\"Y\":641},{\"X\":236,\"Y\":608},{\"X\":155,\"Y\":612},{\"X\":150,\"Y\":549},{\"X\":295,\"Y\":541},{\"X\":376,\"Y\":557},{\"X\":472,\"Y\":592},{\"X\":473,\"Y\":609},{\"X\":627,\"Y\":606}],\"Length\":12},{\"Points\":[{\"X\":565,\"Y\":815},{\"X\":464,\"Y\":737},{\"X\":0,\"Y\":721},{\"X\":1,\"Y\":896},{\"X\":839,\"Y\":894},{\"X\":851,\"Y\":815}],\"Length\":6}],\"LocationPoints\":[{\"Point\":{\"X\":270,\"Y\":462},\"Parameter\":0},{\"Point\":{\"X\":732,\"Y\":461},\"Parameter\":1},{\"Point\":{\"X\":1192,\"Y\":461},\"Parameter\":2},{\"Point\":{\"X\":708,\"Y\":344},\"Parameter\":8},{\"Point\":{\"X\":706,\"Y\":197},\"Parameter\":9},{\"Point\":{\"X\":706,\"Y\":53},\"Parameter\":10}],\"FindPathPoints\":[{\"X\":1211,\"Y\":323},{\"X\":193,\"Y\":419},{\"X\":1251,\"Y\":446},{\"X\":746,\"Y\":498},{\"X\":769,\"Y\":657},{\"X\":111,\"Y\":660}],\"LoopLines\":[{\"P1\":{\"X\":193,\"Y\":419},\"P2\":{\"X\":1251,\"Y\":446}}],\"FindPathLines\":[{\"P1\":{\"X\":193,\"Y\":419},\"P2\":{\"X\":746,\"Y\":498}},{\"P1\":{\"X\":746,\"Y\":498},\"P2\":{\"X\":1251,\"Y\":446}},{\"P1\":{\"X\":746,\"Y\":498},\"P2\":{\"X\":769,\"Y\":657}},{\"P1\":{\"X\":769,\"Y\":657},\"P2\":{\"X\":1251,\"Y\":446}},{\"P1\":{\"X\":769,\"Y\":657},\"P2\":{\"X\":193,\"Y\":419}},{\"P1\":{\"X\":1251,\"Y\":446},\"P2\":{\"X\":1211,\"Y\":323}},{\"P1\":{\"X\":769,\"Y\":657},\"P2\":{\"X\":1211,\"Y\":323}},{\"P1\":{\"X\":111,\"Y\":660},\"P2\":{\"X\":193,\"Y\":419}},{\"P1\":{\"X\":111,\"Y\":660},\"P2\":{\"X\":769,\"Y\":657}}]}",
string.Empty,//2
//3:
"{\"Width\":1348,\"Height\":900,\"Obstacles\":[{\"Points\":[{\"X\":0,\"Y\":313},{\"X\":927,\"Y\":295},{\"X\":963,\"Y\":334},{\"X\":1275,\"Y\":314},{\"X\":1343,\"Y\":300},{\"X\":1343,\"Y\":2},{\"X\":1,\"Y\":1}],\"Length\":7},{\"Points\":[{\"X\":878,\"Y\":366},{\"X\":750,\"Y\":369},{\"X\":733,\"Y\":354},{\"X\":740,\"Y\":325},{\"X\":876,\"Y\":324}],\"Length\":5},{\"Points\":[{\"X\":1345,\"Y\":551},{\"X\":1170,\"Y\":587},{\"X\":1173,\"Y\":643},{\"X\":1275,\"Y\":713},{\"X\":1346,\"Y\":706}],\"Length\":5},{\"Points\":[{\"X\":285,\"Y\":307},{\"X\":312,\"Y\":576},{\"X\":195,\"Y\":626},{\"X\":208,\"Y\":691},{\"X\":153,\"Y\":723},{\"X\":150,\"Y\":897},{\"X\":2,\"Y\":896},{\"X\":0,\"Y\":319}],\"Length\":8},{\"Points\":[{\"X\":156,\"Y\":752},{\"X\":369,\"Y\":714},{\"X\":793,\"Y\":734},{\"X\":932,\"Y\":822},{\"X\":1032,\"Y\":814},{\"X\":1058,\"Y\":896},{\"X\":159,\"Y\":894}],\"Length\":7},{\"Points\":[{\"X\":1037,\"Y\":824},{\"X\":1243,\"Y\":820},{\"X\":1229,\"Y\":748},{\"X\":1269,\"Y\":718},{\"X\":1344,\"Y\":709},{\"X\":1345,\"Y\":896},{\"X\":1064,\"Y\":897}],\"Length\":7}],\"LocationPoints\":[{\"Point\":{\"X\":1108,\"Y\":329},\"Parameter\":8},{\"Point\":{\"X\":1107,\"Y\":182},\"Parameter\":9},{\"Point\":{\"X\":1107,\"Y\":37},\"Parameter\":10}],\"FindPathPoints\":[{\"X\":358,\"Y\":342},{\"X\":378,\"Y\":505},{\"X\":1270,\"Y\":415},{\"X\":1038,\"Y\":650}],\"LoopLines\":[{\"P1\":{\"X\":358,\"Y\":342},\"P2\":{\"X\":1038,\"Y\":650}}],\"FindPathLines\":[{\"P1\":{\"X\":358,\"Y\":342},\"P2\":{\"X\":1270,\"Y\":415}},{\"P1\":{\"X\":1270,\"Y\":415},\"P2\":{\"X\":1038,\"Y\":650}},{\"P1\":{\"X\":1270,\"Y\":415},\"P2\":{\"X\":378,\"Y\":505}},{\"P1\":{\"X\":378,\"Y\":505},\"P2\":{\"X\":358,\"Y\":342}},{\"P1\":{\"X\":378,\"Y\":505},\"P2\":{\"X\":1038,\"Y\":650}}]}",
string.Empty,//4
string.Empty,//5
//6:
"{\"Width\":1350,\"Height\":900,\"Obstacles\":[{\"Points\":[{\"X\":325,\"Y\":425},{\"X\":437,\"Y\":447},{\"X\":567,\"Y\":437},{\"X\":565,\"Y\":395},{\"X\":631,\"Y\":398},{\"X\":675,\"Y\":410},{\"X\":809,\"Y\":405},{\"X\":810,\"Y\":375},{\"X\":933,\"Y\":329},{\"X\":1279,\"Y\":303},{\"X\":1345,\"Y\":367},{\"X\":1345,\"Y\":5},{\"X\":1,\"Y\":6}],\"Length\":13},{\"Points\":[{\"X\":1347,\"Y\":481},{\"X\":1246,\"Y\":501},{\"X\":1235,\"Y\":551},{\"X\":1188,\"Y\":617},{\"X\":1192,\"Y\":669},{\"X\":1348,\"Y\":673}],\"Length\":6},{\"Points\":[{\"X\":1349,\"Y\":701},{\"X\":791,\"Y\":719},{\"X\":803,\"Y\":659},{\"X\":396,\"Y\":665},{\"X\":361,\"Y\":723},{\"X\":2,\"Y\":711},{\"X\":0,\"Y\":896},{\"X\":1345,\"Y\":898}],\"Length\":8}],\"LocationPoints\":[{\"Point\":{\"X\":1080,\"Y\":425},\"Parameter\":4},{\"Point\":{\"X\":592,\"Y\":427},\"Parameter\":5},{\"Point\":{\"X\":103,\"Y\":427},\"Parameter\":6}],\"FindPathPoints\":[{\"X\":174,\"Y\":537},{\"X\":1197,\"Y\":430},{\"X\":602,\"Y\":502}],\"LoopLines\":[{\"P1\":{\"X\":174,\"Y\":537},\"P2\":{\"X\":1197,\"Y\":430}}],\"FindPathLines\":[{\"P1\":{\"X\":174,\"Y\":537},\"P2\":{\"X\":602,\"Y\":502}},{\"P1\":{\"X\":602,\"Y\":502},\"P2\":{\"X\":1197,\"Y\":430}}]}",
//7:
"{\"Width\":1350,\"Height\":900,\"Obstacles\":[{\"Points\":[{\"X\":31,\"Y\":409},{\"X\":127,\"Y\":312},{\"X\":505,\"Y\":351},{\"X\":570,\"Y\":394},{\"X\":733,\"Y\":418},{\"X\":888,\"Y\":410},{\"X\":896,\"Y\":334},{\"X\":1066,\"Y\":328},{\"X\":1100,\"Y\":401},{\"X\":1315,\"Y\":425},{\"X\":1349,\"Y\":427},{\"X\":1343,\"Y\":1},{\"X\":4,\"Y\":4},{\"X\":1,\"Y\":341}],\"Length\":14},{\"Points\":[{\"X\":467,\"Y\":896},{\"X\":472,\"Y\":733},{\"X\":325,\"Y\":676},{\"X\":178,\"Y\":636},{\"X\":0,\"Y\":625},{\"X\":2,\"Y\":900}],\"Length\":6}],\"LocationPoints\":[{\"Point\":{\"X\":270,\"Y\":462},\"Parameter\":0},{\"Point\":{\"X\":730,\"Y\":463},\"Parameter\":1},{\"Point\":{\"X\":1191,\"Y\":463},\"Parameter\":2},{\"Point\":{\"X\":1078,\"Y\":499},\"Parameter\":4},{\"Point\":{\"X\":589,\"Y\":497},\"Parameter\":5},{\"Point\":{\"X\":100,\"Y\":498},\"Parameter\":6}],\"FindPathPoints\":[{\"X\":146,\"Y\":440},{\"X\":1226,\"Y\":720}],\"LoopLines\":[{\"P1\":{\"X\":146,\"Y\":440},\"P2\":{\"X\":1226,\"Y\":720}}],\"FindPathLines\":[]}",
//8:
"{\"Width\":1686,\"Height\":720,\"Obstacles\":[{\"Points\":[{\"X\":2,\"Y\":420},{\"X\":130,\"Y\":439},{\"X\":311,\"Y\":462},{\"X\":313,\"Y\":400},{\"X\":221,\"Y\":319},{\"X\":453,\"Y\":288},{\"X\":632,\"Y\":5},{\"X\":4,\"Y\":2}],\"Length\":8},{\"Points\":[{\"X\":574,\"Y\":104},{\"X\":743,\"Y\":319},{\"X\":961,\"Y\":306},{\"X\":1014,\"Y\":343},{\"X\":1099,\"Y\":326},{\"X\":1165,\"Y\":369},{\"X\":1534,\"Y\":365},{\"X\":1684,\"Y\":309},{\"X\":1680,\"Y\":4},{\"X\":633,\"Y\":5}],\"Length\":10},{\"Points\":[{\"X\":1682,\"Y\":470},{\"X\":1540,\"Y\":514},{\"X\":1442,\"Y\":590},{\"X\":1173,\"Y\":641},{\"X\":858,\"Y\":670},{\"X\":814,\"Y\":708},{\"X\":1681,\"Y\":715}],\"Length\":7}],\"LocationPoints\":[{\"Point\":{\"X\":277,\"Y\":501},\"Parameter\":0},{\"Point\":{\"X\":735,\"Y\":502},\"Parameter\":1},{\"Point\":{\"X\":1196,\"Y\":502},\"Parameter\":2},{\"Point\":{\"X\":1418,\"Y\":390},\"Parameter\":4},{\"Point\":{\"X\":930,\"Y\":387},\"Parameter\":5},{\"Point\":{\"X\":441,\"Y\":388},\"Parameter\":6}],\"FindPathPoints\":[{\"X\":186,\"Y\":483},{\"X\":1565,\"Y\":393},{\"X\":549,\"Y\":448}],\"LoopLines\":[{\"P1\":{\"X\":186,\"Y\":483},\"P2\":{\"X\":1565,\"Y\":393}}],\"FindPathLines\":[{\"P1\":{\"X\":186,\"Y\":483},\"P2\":{\"X\":549,\"Y\":448}},{\"P1\":{\"X\":549,\"Y\":448},\"P2\":{\"X\":1565,\"Y\":393}}]}",
//9:
"{\"Width\":1688,\"Height\":720,\"Obstacles\":[{\"Points\":[{\"X\":3,\"Y\":333},{\"X\":390,\"Y\":305},{\"X\":600,\"Y\":389},{\"X\":746,\"Y\":389},{\"X\":766,\"Y\":327},{\"X\":890,\"Y\":334},{\"X\":914,\"Y\":247},{\"X\":1092,\"Y\":225},{\"X\":1305,\"Y\":396},{\"X\":1489,\"Y\":346},{\"X\":1684,\"Y\":411},{\"X\":1683,\"Y\":3},{\"X\":3,\"Y\":3}],\"Length\":13},{\"Points\":[{\"X\":389,\"Y\":671},{\"X\":398,\"Y\":614},{\"X\":868,\"Y\":605},{\"X\":1037,\"Y\":631},{\"X\":1125,\"Y\":589},{\"X\":1536,\"Y\":632},{\"X\":1678,\"Y\":682},{\"X\":1682,\"Y\":715},{\"X\":378,\"Y\":715}],\"Length\":9}],\"LocationPoints\":[{\"Point\":{\"X\":274,\"Y\":500},\"Parameter\":0},{\"Point\":{\"X\":738,\"Y\":502},\"Parameter\":1},{\"Point\":{\"X\":1200,\"Y\":501},\"Parameter\":2},{\"Point\":{\"X\":1658,\"Y\":503},\"Parameter\":3}],\"FindPathPoints\":[{\"X\":216,\"Y\":456},{\"X\":1545,\"Y\":466},{\"X\":985,\"Y\":515}],\"LoopLines\":[{\"P1\":{\"X\":216,\"Y\":456},\"P2\":{\"X\":1545,\"Y\":466}}],\"FindPathLines\":[{\"P1\":{\"X\":216,\"Y\":456},\"P2\":{\"X\":985,\"Y\":515}},{\"P1\":{\"X\":985,\"Y\":515},\"P2\":{\"X\":1545,\"Y\":466}}]}",
string.Empty,//10
//11:
"{\"Width\":1686,\"Height\":720,\"Obstacles\":[{\"Points\":[{\"X\":1678,\"Y\":410},{\"X\":1576,\"Y\":341},{\"X\":1258,\"Y\":344},{\"X\":1241,\"Y\":379},{\"X\":1153,\"Y\":380},{\"X\":849,\"Y\":377},{\"X\":765,\"Y\":353},{\"X\":598,\"Y\":352},{\"X\":498,\"Y\":387},{\"X\":0,\"Y\":360},{\"X\":1,\"Y\":1},{\"X\":1681,\"Y\":2}],\"Length\":12},{\"Points\":[{\"X\":1566,\"Y\":714},{\"X\":1502,\"Y\":662},{\"X\":875,\"Y\":654},{\"X\":780,\"Y\":660},{\"X\":550,\"Y\":636},{\"X\":365,\"Y\":614},{\"X\":183,\"Y\":626},{\"X\":72,\"Y\":636},{\"X\":10,\"Y\":655},{\"X\":0,\"Y\":715}],\"Length\":10}],\"LocationPoints\":[{\"Point\":{\"X\":929,\"Y\":450},\"Parameter\":5},{\"Point\":{\"X\":440,\"Y\":452},\"Parameter\":6},{\"Point\":{\"X\":1416,\"Y\":451},\"Parameter\":4}],\"FindPathPoints\":[{\"X\":71,\"Y\":469},{\"X\":1529,\"Y\":462},{\"X\":826,\"Y\":576}],\"LoopLines\":[{\"P1\":{\"X\":71,\"Y\":469},\"P2\":{\"X\":1529,\"Y\":462}}],\"FindPathLines\":[{\"P1\":{\"X\":71,\"Y\":469},\"P2\":{\"X\":826,\"Y\":576}},{\"P1\":{\"X\":826,\"Y\":576},\"P2\":{\"X\":1529,\"Y\":462}}]}",
//12:
"{\"Width\":2024,\"Height\":720,\"Obstacles\":[{\"Points\":[{\"X\":795,\"Y\":351},{\"X\":1897,\"Y\":323},{\"X\":2019,\"Y\":271},{\"X\":2019,\"Y\":4},{\"X\":1,\"Y\":2},{\"X\":3,\"Y\":347},{\"X\":111,\"Y\":400},{\"X\":200,\"Y\":377},{\"X\":294,\"Y\":344},{\"X\":560,\"Y\":351},{\"X\":623,\"Y\":381}],\"Length\":11},{\"Points\":[{\"X\":2020,\"Y\":614},{\"X\":1464,\"Y\":615},{\"X\":1137,\"Y\":589},{\"X\":895,\"Y\":606},{\"X\":855,\"Y\":715},{\"X\":2020,\"Y\":716}],\"Length\":6},{\"Points\":[{\"X\":525,\"Y\":715},{\"X\":451,\"Y\":589},{\"X\":156,\"Y\":603},{\"X\":2,\"Y\":495},{\"X\":2,\"Y\":716}],\"Length\":5}],\"LocationPoints\":[{\"Point\":{\"X\":270,\"Y\":461},\"Parameter\":0},{\"Point\":{\"X\":731,\"Y\":461},\"Parameter\":1},{\"Point\":{\"X\":1192,\"Y\":462},\"Parameter\":2},{\"Point\":{\"X\":1650,\"Y\":463},\"Parameter\":3},{\"Point\":{\"X\":1278,\"Y\":347},\"Parameter\":5},{\"Point\":{\"X\":788,\"Y\":347},\"Parameter\":6},{\"Point\":{\"X\":301,\"Y\":346},\"Parameter\":7},{\"Point\":{\"X\":628,\"Y\":175},\"Parameter\":8},{\"Point\":{\"X\":627,\"Y\":28},\"Parameter\":9}],\"FindPathPoints\":[{\"X\":201,\"Y\":457},{\"X\":1894,\"Y\":423},{\"X\":699,\"Y\":513}],\"LoopLines\":[{\"P1\":{\"X\":201,\"Y\":457},\"P2\":{\"X\":1894,\"Y\":423}}],\"FindPathLines\":[{\"P1\":{\"X\":201,\"Y\":457},\"P2\":{\"X\":699,\"Y\":513}},{\"P1\":{\"X\":699,\"Y\":513},\"P2\":{\"X\":1894,\"Y\":423}}]}",
//13:
"{\"Width\":2024,\"Height\":900,\"Obstacles\":[{\"Points\":[{\"X\":1607,\"Y\":189},{\"X\":1761,\"Y\":360},{\"X\":2022,\"Y\":405},{\"X\":2022,\"Y\":1},{\"X\":1565,\"Y\":1}],\"Length\":5},{\"Points\":[{\"X\":1350,\"Y\":400},{\"X\":1605,\"Y\":186},{\"X\":1562,\"Y\":1},{\"X\":121,\"Y\":1},{\"X\":335,\"Y\":410},{\"X\":385,\"Y\":402}],\"Length\":6},{\"Points\":[{\"X\":2017,\"Y\":719},{\"X\":1228,\"Y\":729},{\"X\":1137,\"Y\":666},{\"X\":667,\"Y\":689},{\"X\":417,\"Y\":671},{\"X\":123,\"Y\":649},{\"X\":121,\"Y\":891},{\"X\":2020,\"Y\":896}],\"Length\":8},{\"Points\":[{\"X\":294,\"Y\":564},{\"X\":121,\"Y\":566},{\"X\":122,\"Y\":19},{\"X\":322,\"Y\":394},{\"X\":233,\"Y\":457}],\"Length\":5},{\"Points\":[{\"X\":1,\"Y\":2},{\"X\":127,\"Y\":3},{\"X\":128,\"Y\":896},{\"X\":0,\"Y\":894}],\"Length\":4}],\"LocationPoints\":[{\"Point\":{\"X\":537,\"Y\":496},\"Parameter\":0},{\"Point\":{\"X\":997,\"Y\":497},\"Parameter\":1},{\"Point\":{\"X\":1458,\"Y\":497},\"Parameter\":2},{\"Point\":{\"X\":1918,\"Y\":496},\"Parameter\":3},{\"Point\":{\"X\":777,\"Y\":484},\"Parameter\":6},{\"Point\":{\"X\":1266,\"Y\":484},\"Parameter\":5},{\"Point\":{\"X\":1753,\"Y\":485},\"Parameter\":4}],\"FindPathPoints\":[{\"X\":425,\"Y\":495},{\"X\":1885,\"Y\":496},{\"X\":1294,\"Y\":541}],\"LoopLines\":[{\"P1\":{\"X\":425,\"Y\":495},\"P2\":{\"X\":1885,\"Y\":496}}],\"FindPathLines\":[{\"P1\":{\"X\":425,\"Y\":495},\"P2\":{\"X\":1294,\"Y\":541}},{\"P1\":{\"X\":1294,\"Y\":541},\"P2\":{\"X\":1885,\"Y\":496}}]}",
//14:
"{\"Width\":1687,\"Height\":901,\"Obstacles\":[{\"Points\":[{\"X\":98,\"Y\":310},{\"X\":408,\"Y\":314},{\"X\":418,\"Y\":425},{\"X\":530,\"Y\":416},{\"X\":593,\"Y\":451},{\"X\":721,\"Y\":452},{\"X\":762,\"Y\":449},{\"X\":783,\"Y\":337},{\"X\":840,\"Y\":302},{\"X\":1207,\"Y\":300},{\"X\":1239,\"Y\":321},{\"X\":1418,\"Y\":320},{\"X\":1584,\"Y\":378},{\"X\":1679,\"Y\":377},{\"X\":1681,\"Y\":4},{\"X\":4,\"Y\":4},{\"X\":0,\"Y\":436}],\"Length\":17},{\"Points\":[{\"X\":1681,\"Y\":717},{\"X\":1319,\"Y\":706},{\"X\":1165,\"Y\":653},{\"X\":1053,\"Y\":654},{\"X\":835,\"Y\":609},{\"X\":732,\"Y\":624},{\"X\":680,\"Y\":667},{\"X\":0,\"Y\":650},{\"X\":0,\"Y\":898},{\"X\":1682,\"Y\":898}],\"Length\":10}],\"LocationPoints\":[{\"Point\":{\"X\":278,\"Y\":481},\"Parameter\":0},{\"Point\":{\"X\":739,\"Y\":481},\"Parameter\":1},{\"Point\":{\"X\":1200,\"Y\":479},\"Parameter\":2},{\"Point\":{\"X\":1656,\"Y\":480},\"Parameter\":3}],\"FindPathPoints\":[{\"X\":140,\"Y\":474},{\"X\":1453,\"Y\":466},{\"X\":763,\"Y\":520},{\"X\":373,\"Y\":565}],\"LoopLines\":[{\"P1\":{\"X\":140,\"Y\":474},\"P2\":{\"X\":1453,\"Y\":466}}],\"FindPathLines\":[{\"P1\":{\"X\":140,\"Y\":474},\"P2\":{\"X\":373,\"Y\":565}},{\"P1\":{\"X\":140,\"Y\":474},\"P2\":{\"X\":763,\"Y\":520}},{\"P1\":{\"X\":373,\"Y\":565},\"P2\":{\"X\":763,\"Y\":520}},{\"P1\":{\"X\":763,\"Y\":520},\"P2\":{\"X\":1453,\"Y\":466}},{\"P1\":{\"X\":373,\"Y\":565},\"P2\":{\"X\":1453,\"Y\":466}}]}",
string.Empty,//15
//16:
"{\"Width\":1687,\"Height\":901,\"Obstacles\":[{\"Points\":[{\"X\":3,\"Y\":385},{\"X\":257,\"Y\":388},{\"X\":655,\"Y\":320},{\"X\":711,\"Y\":264},{\"X\":1682,\"Y\":279},{\"X\":1682,\"Y\":1},{\"X\":0,\"Y\":4}],\"Length\":7},{\"Points\":[{\"X\":5,\"Y\":713},{\"X\":265,\"Y\":754},{\"X\":432,\"Y\":862},{\"X\":405,\"Y\":900},{\"X\":1,\"Y\":896}],\"Length\":5},{\"Points\":[{\"X\":720,\"Y\":883},{\"X\":825,\"Y\":776},{\"X\":1034,\"Y\":851},{\"X\":985,\"Y\":900},{\"X\":712,\"Y\":900}],\"Length\":5},{\"Points\":[{\"X\":1173,\"Y\":871},{\"X\":1569,\"Y\":644},{\"X\":1674,\"Y\":661},{\"X\":1684,\"Y\":772},{\"X\":1679,\"Y\":887},{\"X\":1187,\"Y\":893},{\"X\":1200,\"Y\":852}],\"Length\":7}],\"LocationPoints\":[{\"Point\":{\"X\":1391,\"Y\":410},\"Parameter\":4},{\"Point\":{\"X\":905,\"Y\":409},\"Parameter\":5},{\"Point\":{\"X\":416,\"Y\":410},\"Parameter\":6}],\"FindPathPoints\":[{\"X\":633,\"Y\":693},{\"X\":1494,\"Y\":434},{\"X\":139,\"Y\":505},{\"X\":834,\"Y\":367}],\"LoopLines\":[{\"P1\":{\"X\":139,\"Y\":505},\"P2\":{\"X\":1494,\"Y\":434}}],\"FindPathLines\":[{\"P1\":{\"X\":139,\"Y\":505},\"P2\":{\"X\":834,\"Y\":367}},{\"P1\":{\"X\":834,\"Y\":367},\"P2\":{\"X\":1494,\"Y\":434}},{\"P1\":{\"X\":633,\"Y\":693},\"P2\":{\"X\":1494,\"Y\":434}},{\"P1\":{\"X\":633,\"Y\":693},\"P2\":{\"X\":834,\"Y\":367}},{\"P1\":{\"X\":633,\"Y\":693},\"P2\":{\"X\":139,\"Y\":505}}]}",
//17:
"{\"Width\":1687,\"Height\":720,\"Obstacles\":[{\"Points\":[{\"X\":1681,\"Y\":368},{\"X\":1591,\"Y\":363},{\"X\":1487,\"Y\":252},{\"X\":1475,\"Y\":4},{\"X\":1683,\"Y\":3}],\"Length\":5},{\"Points\":[{\"X\":1348,\"Y\":358},{\"X\":544,\"Y\":345},{\"X\":534,\"Y\":453},{\"X\":115,\"Y\":450},{\"X\":0,\"Y\":390},{\"X\":0,\"Y\":3},{\"X\":1480,\"Y\":3},{\"X\":1487,\"Y\":245}],\"Length\":8},{\"Points\":[{\"X\":108,\"Y\":685},{\"X\":76,\"Y\":720},{\"X\":1682,\"Y\":718},{\"X\":1684,\"Y\":683}],\"Length\":4}],\"LocationPoints\":[{\"Point\":{\"X\":276,\"Y\":499},\"Parameter\":0},{\"Point\":{\"X\":736,\"Y\":502},\"Parameter\":1},{\"Point\":{\"X\":1198,\"Y\":500},\"Parameter\":2},{\"Point\":{\"X\":1655,\"Y\":502},\"Parameter\":3}],\"FindPathPoints\":[{\"X\":196,\"Y\":514},{\"X\":1622,\"Y\":491},{\"X\":605,\"Y\":518}],\"LoopLines\":[{\"P1\":{\"X\":196,\"Y\":514},\"P2\":{\"X\":1622,\"Y\":491}}],\"FindPathLines\":[{\"P1\":{\"X\":196,\"Y\":514},\"P2\":{\"X\":605,\"Y\":518}},{\"P1\":{\"X\":605,\"Y\":518},\"P2\":{\"X\":1622,\"Y\":491}}]}",
};
///
/// 获取json
///
///
public string ToJsonString()
{
HousePathInfoObj obj=HousePathInfoObj.From(this);
string json = ZTImage.Json.JsonBuilder.ToJsonString(obj);
return json;
}
///
/// 从json字符串生成对象
///
///
///
public static HousePathInfo FromJsonString(string json)
{
HousePathInfoObj obj= ZTImage.Json.JsonParser.ToObject(json);
return obj.To();
}
public static HousePathInfo From(MapType mapType, Int32 houseIndex)
{
string info = null;
if (mapType == MapType.Lingdong)
{
if (houseIndex > Lingdong.Length - 1)
{
throw new ArgumentOutOfRangeException("houseIndex");
}
info = Lingdong[houseIndex];
}
else if (mapType == MapType.Kalete)
{
if (houseIndex > Kalete.Length - 1)
{
throw new ArgumentOutOfRangeException("houseIndex");
}
info = Kalete[houseIndex];
}
try
{
return HousePathInfo.FromJsonString(info);
}
catch (Exception e)
{
throw e;
}
}
#endregion
}
}