Ejemplo n.º 1
0
    APICalls()
    {
        Debug.Log("API Calls being made");
        osmMapData = await Task.Run(() => api.GetOsmMap());   //working

        mapBounds = await Task.Run(() => api.GetMapBounds()); //working

        Debug.Log("Datapoint getting");
        dataPointId = await Task.Run(() => api.GetPointLocations());

        models = await Task.Run(() => api.GetModels());

        try
        {
            histMapContainer = api.GetHistMap();
            historyMapData   = histMapContainer.MapData;
            historyMap       = gWorld.LoadDataIntoTexture(historyMapData);
        }
        catch (Exception e)
        {
            Debug.Log("Historical map not found: " + e);
            // This means there was no historical map in the db
        }
        goForApi = true;
    }
Ejemplo n.º 2
0
    /// <summary>
    /// This method gets the historical map from database and return the obj
    /// </summary>
    /// <returns></returns>
    public HistMapObj GetHistMap()
    {
        JSONObject jobject = MakeWebRequest(histMapApiRequest);
        HistMapObj obj     = new HistMapObj();

        if (jobject != null)
        {
            for (int i = 0; i < jobject.list[0].list[0].keys.Count; i++)
            {
                switch (jobject.list[0].list[0].keys[i])
                {
                case "image_data":
                    obj.MapData = HexStringToBinary(jobject.list[0].list[0].list[i].ToString());
                    break;

                case "center_point":
                    obj.CenterPoint = ParsePointStr(jobject.list[0].list[0].list[i].ToString());
                    break;

                case "image_rotation":
                    obj.Rotation = StringToFloat(jobject.list[0].list[0].list[i].ToString());
                    break;

                case "km_height":
                    obj.HeightKM = StringToFloat(jobject.list[0].list[0].list[i].ToString());
                    break;

                case "km_width":
                    obj.WidthKM = StringToFloat(jobject.list[0].list[0].list[i].ToString());
                    break;

                default:
                    // this is data we don't need here
                    break;
                }
            }
        }
        return(obj);
    }