Ejemplo n.º 1
0
        public void Save()
        {
            var pointList        = new List <float[]>();
            var triList          = new List <int[]>();
            var routeList        = new List <float[]>();
            int vendorPointIndex = -1;

            var pointIndices = new Dictionary <Point, int>();

            foreach (Point p in Points)
            {
                pointList.Add(new float[2] {
                    p.X, p.Y
                });
                pointIndices[p] = pointList.Count - 1;
            }

            foreach (Tri t in Tris)
            {
                triList.Add(t.Points.Select(p => pointIndices[p]).ToArray());
            }

            foreach (Point p in Route)
            {
                routeList.Add(new float[2] {
                    p.X, p.Y
                });

                if (p == VendorPoint)
                {
                    vendorPointIndex = routeList.Count - 1;
                }
            }

            var serializablePlan = new Plan.Serializable {
                Points = pointList, Tris = triList, Route = routeList, VendorPoint = vendorPointIndex
            };

            planProvider.Save(serializablePlan, MapId);
        }
Ejemplo n.º 2
0
 public void Save(Plan.Serializable plan, int mapId)
 {
     FileManager.SaveToFile(plan, Folder, String.Format(FileFormat, mapId));
 }