73 {
74 if (p.type == "Point")
75 {
76 List<PointD> points = new List<PointD>();
77 double[] gs = JsonConvert.DeserializeObject<double[]>(p.coordinates.ToString());
78 points.Add(new PointD(gs[0], gs[1]));
79 for (int i = 0; i < points.Count; i++)
80 {
81 points[i] = new PointD(b.StageSizeX + (points[i].X / b.SizeX) * b.Volume.Width, b.StageSizeY + (points[i].Y / b.SizeY) * b.Volume.Height);
82 }
83 return points.ToArray();
84 }
85 else if(p.type == "Polygon")
86 {
87 List<PointD> points = new List<PointD>();
88 double[][][] gs = JsonConvert.DeserializeObject<double[][][]>(p.coordinates.ToString());
89 foreach (double[] item in gs[0])
90 {
91 points.Add(new PointD(item[0], item[1]));
92 }
93 for (int i = 0; i < points.Count; i++)
94 {
95 points[i] = new PointD(b.StageSizeX + (points[i].X / b.SizeX)*b.Volume.Width, b.StageSizeY + (points[i].Y / b.SizeY) * b.Volume.Height);
96 }
97 return points.ToArray();
98 }
99 else
100 {
101 List<PointD> points = new List<PointD>();
102 double[][] gs = JsonConvert.DeserializeObject<double[][]>(p.coordinates.ToString());
103 foreach (double[] item in gs)
104 {
105 points.Add(new PointD(item[0], item[1]));
106 }
107 for (int i = 0; i < points.Count; i++)
108 {
109 points[i] = new PointD(b.StageSizeX + (points[i].X / b.SizeX) * b.Volume.Width, b.StageSizeY + (points[i].Y / b.SizeY) * b.Volume.Height);
110 }
111 return points.ToArray();
112 }
113 }