Beispiel #1
0
        public void ProcessRequest(HttpContext context)
        {
            //DFMGps g = new DFMGps() { lng = "104.03.40.95", lat = "30.39.46.04" };
            //Gps g = new Gps() { lng = 104.0613755710, lat = 30.6627876858 };//谷歌地球
            //Gps g = new Gps() { lng = 104.0638732910, lat = 30.660359565 };//腾讯高德
            //Gps g = new Gps() { lng = 104.0703438917, lat = 30.6664848935 };//百度
            Gps        g = new Gps();
            GpsConvert gs;
            int        _gt = 0;

            //0:谷歌地球,1:腾讯高德,2:百度
            if (int.TryParse(context.Request["t"], out _gt))
            {
                ;
            }
            try
            {
                string[] _g = context.Request["g"].Split(',');
                if (double.TryParse(_g[0], out g.lng) && double.TryParse(_g[1], out g.lat))
                {
                    gs = new GpsConvert(g, (GpsType)_gt);
                }
                else
                {
                    gs = new GpsConvert(new DFMGps()
                    {
                        lng = _g[0], lat = _g[1]
                    });
                }
                context.Response.ContentType = "text/plain";
                context.Response.Write(JsonConvert.SerializeObject(gs));
                context.Response.End();
            }
            catch (Exception)
            {
                throw new Exception("invaild parameter");
            }
        }
Beispiel #2
0
    // Use this for initialization
    private void Awake()
    {
        instance = this;
        n        = (equatorialRadius - polarRadius) / (equatorialRadius + polarRadius);
        rm       = POW(equatorialRadius * polarRadius, 1 / 2.0);
        e        = Math.Sqrt(1 - POW(polarRadius / equatorialRadius, 2));
        e1sq     = e * e / (1 - e * e);

        if (!isDown)
        {
            HttpManager.Instance.GetNavigationInfo((b =>
            {
                if (b)
                {
                    isDown = true;
                    Debug.Log(JsonClass.Instance.NavigationInfos.Count);
                    int totalCount = 0;
                    int curCount = 0;
                    totalCount = JsonClass.Instance.NavigationInfos.Count;
                    foreach (var info in JsonClass.Instance.NavigationInfos)
                    {
                        // Debug.Log(info.type);
                        HttpManager.Instance.Download(info.baseEntity.thumbnail, (() =>
                        {
                            // Debug.Log("下载实景导览图片");
                            GPSItem item = GameObject.Instantiate <GPSItem>(obj);
                            item.id = info.baseEntity.id;
                            item.locationX = info.baseEntity.locationX;
                            item.locationY = info.baseEntity.locationY;
                            item.name = info.baseEntity.name;
                            item.height = info.baseEntity.height;
                            item.typeName = info.type;
                            item.content = info.baseEntity.description;
                            item.thumbnail = info.baseEntity.thumbnail;
                            item.address = info.baseEntity.address;
                            GPSItems.Add(item);
                        }));

                        curCount++;
                        if (curCount == totalCount)
                        {
                            StartCoroutine(StartGPS());
                        }
                    }
                }
            }));
        }
        else
        {
            int totalCount = 0;
            int curCount   = 0;
            totalCount = JsonClass.Instance.NavigationInfos.Count;
            foreach (var info in JsonClass.Instance.NavigationInfos)
            {
                Debug.Log(info.type);
                HttpManager.Instance.Download(info.baseEntity.thumbnail, (() =>
                {
                    GPSItem item = GameObject.Instantiate <GPSItem>(obj);
                    item.id = info.baseEntity.id;
                    item.locationX = info.baseEntity.locationX;
                    item.locationY = info.baseEntity.locationY;
                    item.name = info.baseEntity.name;
                    item.height = info.baseEntity.height;
                    item.typeName = info.type;
                    item.content = info.baseEntity.description;
                    item.thumbnail = info.baseEntity.thumbnail;
                    item.address = info.baseEntity.address;
                    GPSItems.Add(item);
                }));

                curCount++;
                if (curCount == totalCount)
                {
                    StartCoroutine(StartGPS());
                }
            }
        }


        point = getLocation();
    }