Example #1
0
        private void ResolvePanoInfo(PanoItem item)
        {
            string url     = string.Format(this.panoInfo, item.Code, DateTime.Now.ToString("YY-MMM-DD"), DateTime.Now.Ticks);
            var    content = HttpHelper.GetRequestContent(url);
            var    dic     = JsonHelper.JsonDeserialize <Dictionary <string, object> >(content);

            dic = (Dictionary <string, object>)(((ArrayList)dic["content"])[0]);

            item.MoveDir  = dic["MoveDir"];
            item.NorthDir = dic["NorthDir"];
            item.Pitch    = dic["Pitch"];
            item.Heading  = dic["Heading"];

            var list = dic["Roads"] as ArrayList;

            if (list != null && list.Count > 0)
            {
                dic = list[0] as Dictionary <string, object>;
                if (dic != null)
                {
                    list = dic["Panos"] as ArrayList;
                    if (list != null && list.Count != 0)
                    {
                        item.Panos = new List <string>();
                        for (int i = 0; i < list.Count; i++)
                        {
                            dic = (Dictionary <string, object>)list[i];
                            item.Panos.Add(string.Join("&", new[] { dic["PID"], dic["X"], dic["Y"] }));
                        }
                    }
                }
            }
        }
Example #2
0
        public void GeneratePano(PanoItem item)
        {
            string code = item.Code;

            DownLoadPano(code);
            WriteImage();
            // RunCmd(code);
            var path = Path.Combine(this.directory, item.Code);

            CreateCubic(Path.Combine(path, "panno.png"), path);
            item.SaveConfig(this.directory);
        }
Example #3
0
        public PanoItem GetPannoCode(int x, int y)
        {
            var url     = string.Format(codeUrl, x, y);
            var content = JsonHelper.JsonDeserialize <Dictionary <string, object> >(HttpHelper.GetRequestContent(url));

            if (((Dictionary <string, object>)(content["result"]))["error"].ToString() == "0")
            {
                var      dic  = ((Dictionary <string, object>)content["content"]);
                PanoItem item = new PanoItem()
                {
                    X = (int)dic["x"],
                    Y = (int)dic["y"]
                };
                item.Code     = dic["id"].ToString();
                item.RoadName = dic["RoadName"].ToString();

                ResolvePanoInfo(item);

                return(item);
            }
            return(null);
        }