Exemplo n.º 1
0
    public void DrawTowers(List <List <W3Object> > objects, Color clr, int type, float scale, float edgeScale)
    {
        int index  = 0;
        int number = 0;

        foreach (W3Object listObj in objects[0])
        {
            //Debug.Log(number++);
            if (listObj.GetType() == typeof(W3Number))
            {
                W3Number ObjNumber = (W3Number)listObj;
                float    value     = (float)ObjNumber.value + 1;

                GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Cube);
                obj.transform.localScale = new Vector3(towerEdgeSize * edgeScale, towerEdgeSize * edgeScale, towerEdgeSize * towerHeigthScale * scale * (float)value);
                obj.GetComponent <Renderer>().material.color = clr;
                obj.name = "tower";

                obj.transform.position = XYZfromLatLon((float)ObjNumber.latitude, (float)ObjNumber.longitude);
                obj.transform.LookAt(this.transform);
                Tower twr = obj.AddComponent <Tower>() as Tower;
                twr.SetW3(ObjNumber);
                twr.SetColor(clr);
                twr.SetType(type);
            }
        }
    }
Exemplo n.º 2
0
    public void SetW3(W3Number W3n)
    {
        W3 = W3n;

        string tooltip = "Name: " + (string)W3.name;
        tooltip += "\n" + "Type: " + (string)W3.type;
        tooltip += "\n" + "Tag: " + (string)W3.tag;
        tooltip += "\n" + "Indicator: " + (string)(W3.indicator).ToString();
        tooltip += "\n" + "Value: " + (string)(W3.value).ToString();
        tooltip += "\n" + "\n" + "Latitude: " + (string)W3.latitude.ToString();
        tooltip += "\n" + "Longitude: " + (string)W3.longitude.ToString();

        toolTipText = tooltip;
    }
Exemplo n.º 3
0
    public void SetW3(W3Number W3n)
    {
        W3 = W3n;

        string tooltip = "Name: " + (string)W3.name;

        tooltip += "\n" + "Type: " + (string)W3.type;
        tooltip += "\n" + "Tag: " + (string)W3.tag;
        tooltip += "\n" + "Indicator: " + (string)(W3.indicator).ToString();
        tooltip += "\n" + "Value: " + (string)(W3.value).ToString();
        tooltip += "\n" + "\n" + "Latitude: " + (string)W3.latitude.ToString();
        tooltip += "\n" + "Longitude: " + (string)W3.longitude.ToString();

        toolTipText = tooltip;
    }
Exemplo n.º 4
0
    public List <List <W3Object> > getLists(Dictionary <string, string> query, string url)
    {
        this.data = this.getJSON(query, url);

        //while(fetching)
        //	yield return new WaitForSeconds(0.1f);

        int indicatorCount = 0;

        if (data != null && data.list.Count > 0)
        {
            var first = data.list[0];
            var keys  = first["d"].keys;
            indicatorCount = keys.Count;
        }

        var res = new List <List <W3Object> >();

        for (int i = 0; i < indicatorCount; i++)
        {
            res.Add(new List <W3Object>());
        }

        foreach (var item in data.list)
        {
            for (int i = 0; i < indicatorCount; i++)
            {
                var obj = new W3Number();

                obj.value     = item["d"][item["d"].keys[i]].n;
                obj.type      = item["type"].str;
                obj.tag       = item["tag"].str;
                obj.indicator = item["d"].keys[i];
                obj.name      = item["Name"].str;
                obj.longitude = double.Parse(item["long"].str, CultureInfo.InvariantCulture);
                obj.latitude  = double.Parse(item["lat"].str, CultureInfo.InvariantCulture);

                res[i].Add(obj);
            }
        }

        this.lists = res;
        return(res);
    }
Exemplo n.º 5
0
    public List<List<W3Object>> getLists(Dictionary<string,string> query, string url)
    {
        this.data = this.getJSON(query, url);

        //while(fetching)
        //	yield return new WaitForSeconds(0.1f);

        int indicatorCount = 0;
        if(data != null && data.list.Count > 0) {
            var first = data.list[0];
            var keys = first["d"].keys;
            indicatorCount = keys.Count;
        }

        var res = new List<List<W3Object>>();

        for(int i = 0;i < indicatorCount; i++) {
            res.Add(new List<W3Object>());
        }

        foreach(var item in data.list) {
            for(int i = 0;i < indicatorCount; i++) {
                var obj = new W3Number();

                obj.value = item["d"][item["d"].keys[i]].n;
                obj.type = item["type"].str;
                obj.tag = item["tag"].str;
                obj.indicator = item["d"].keys[i];
                obj.name = item["Name"].str;
                obj.longitude = double.Parse(item["long"].str,  CultureInfo.InvariantCulture);
                obj.latitude = double.Parse(item["lat"].str,  CultureInfo.InvariantCulture);

                res[i].Add(obj);
            }
        }

        this.lists = res;
        return res;
    }