asmrobot
2019-11-13 576b92fd82f568572bc4beb125fa0ba0191a602f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
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;
 
        }
    }
}