Exemple #1
0
    public override byte[] renderSegmentThreadSafe(int x, int y, int z)
    {
        //Debug.Log("BING_MAP_RENDER");
        var    qpath  = GISparser.getQuadPath(x, y, z);
        string qpaths = "";

        foreach (var ele in qpath)
        {
            qpaths += ele.ToString();
        }
        //Debug.Log("BING_MAP_RENDER qpaths");
        string url      = @"http://t.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/" + qpaths + @"?mkt=pl-PL&it=A,G,RL&shading=hill&n=z&og=268&c4w=1";
        string name     = "BING." + z + "." + x + "." + y + ".png";
        string filePath = GISparser.webImagesPath + name;

        byte[] fileData = null;
        //Debug.Log("BING_MAP_RENDER WebClient next");
        using (WebClient client = new WebClient())
        {
            if (File.Exists(filePath))
            {
                //Debug.Log("BING_MAP_RENDER Exists: "+ filePath);
                fileData = GISlayer.bingPath(filePath);
                //Debug.Log("BING_MAP_RENDER Exists: udalo sie");
            }
            else
            {
                //Debug.Log("BING_MAP_RENDER not exists");
                //client.DownloadFile(new Uri(url), filePath);//tu jest problem
                //Debug.Log("BING_MAP_RENDER after download");
                try
                {
                    client.DownloadFile(new Uri(url), filePath);
                }
                catch (Exception ex)
                {
                    Debug.Log(ex.Message);
                    if (File.Exists(filePath))
                    {
                        File.Delete(filePath);
                    }
                }
                if (File.Exists(filePath))
                {
                    //Debug.Log("BING_MAP_RENDER exists now");
                    fileData = GISlayer.bingPath(filePath);
                }
                else
                {
                    Debug.Log("Błąd sieci, nie można pobrać pliku png");
                }
            }
        }
        //Debug.Log("BING_MAP_RENDER koniec");
        return(fileData);
    }
    private byte[] generateTexture(int cx, int cy, int z)
    {
        byte[] tex = new byte[256 * 256 * 4];
        //var path = GISparser.getQuadPath(new Vector2Int(cx, cy), z);
        //List<GISway> waysList = null;

        Vector2d chunkLow  = new Vector2d(((double)(cx) / (double)(1 << z)), ((double)(cy) / (double)(1 << z)));
        Vector2d chunkHigh = new Vector2d(((double)(cx + 1) / (double)(1 << z)), ((double)(cy + 1) / (double)(1 << z)));

        var c = new Vector4(0f, 0f, 0f, 0f);

        for (int x = 0; x < 256; ++x)
        {
            for (int y = 0; y < 256; ++y)
            {
                setPixel(tex, x, y, c);
            }
        }

        if (gisdata == null)
        {
            return(tex);
        }

        float[] heatMap = renderFloat(cx, cy, z);

        if (heatMap != null)
        {
            for (int x = 0; x < 256; ++x)
            {
                for (int y = 0; y < 256; ++y)
                {
                    var v  = (heatMap[x + 256 * y] - minvalue) / (maxvalue - minvalue);
                    var hc = GISparser.valueToHeatColor(v);
                    setPixel(tex, x, y, hc);
                }
            }
        }

        foreach (var punkt in uzytecznePunkty)
        {
            drawPointOptimal(tex, punkt, chunkLow, chunkHigh);
        }

        /*foreach (var way in waysList)
         * {
         *  drawWayOptimal(tex, way, chunkLow, chunkHigh);
         * }*/

        return(tex);
    }
    public void init(string path)
    {
        gisdata = GISparser.LoadOSM(path);
        this.clearCache();
        map.clearSegmentCache();

        /*qt = new GISquadtree(null);
         * qt.size = new Vector2d(1, 1);
         * qt.position = new Vector2d(0, 0);
         * foreach (var way in gisdata.wayContainer)
         * {
         *  qt.insert(way);
         * }  */
    }
Exemple #4
0
    /*private void ExecuteInForeground(Thread main)
     * {
     *  while(true)
     *  {
     *      try
     *      {
     *          if (main.ThreadState == ThreadState.AbortRequested) { Debug.Log("AbortRequested - Aplikacja zamknieta"); return; }
     *
     *          Vector3Int element;
     *          try
     *          {
     *              element = toProcessChunks[0];
     *          } catch
     *          {
     *              continue;
     *          }
     *          toProcessChunks.RemoveAt(0);
     *          //_pool.Release();
     *          if (element.x >= ch1.x && element.y >= ch1.y && element.x < ch2.x && element.y < ch2.y)
     *          {
     *              int size = (1 << zoom);
     *              double length = 256.0 / (double)size;
     *              var tex = generateTexture(element.x, element.y,zoom);
     *              //_pool.WaitOne();
     *              toAddChunks.Add(new textureContainer(element,tex));
     *              //_pool.Release();
     *          }
     *      } catch
     *      {
     *      }
     *  }
     * }*/

    private Texture2D generateTexture(int cx, int cy, int z)
    {
        Texture2D tex      = new Texture2D(256, 256);
        var       path     = GISparser.getQuadPath(new Vector2Int(cx, cy), z);
        var       waysList = qt.getObjects(path);

        //return GISparser.downloadBINGpng(cx,cy,z);

        Vector2d chunkLow  = new Vector2d(((double)(cx) / (double)(1 << z)) * 256.0, ((double)(cy) / (double)(1 << z)) * 256.0);
        Vector2d chunkHigh = new Vector2d(((double)(cx + 1) / (double)(1 << z)) * 256.0, ((double)(cy + 1) / (double)(1 << z)) * 256.0);

        var c = Color.white;

        for (int x = 0; x < 256; ++x)
        {
            for (int y = 0; y < 256; ++y)
            {
                tex.SetPixel(x, y, c);
            }
        }

        foreach (var way in waysList)
        {
            //lineChecker(Vector2d l1, Vector2d l2, Vector2d p, float thickness);
            //drawWay(ref tex, way, chunkLow, chunkHigh);
            drawWayOptimal(ref tex, way, chunkLow, chunkHigh);
        }


        if (false)
        {
            Color bor = Color.gray;
            for (int i = 0; i < 256; ++i)
            {
                tex.SetPixel(0, i, bor);
                tex.SetPixel(255, i, bor);
                tex.SetPixel(i, 0, bor);
                tex.SetPixel(i, 255, bor);
            }
        }

        return(tex);
    }
Exemple #5
0
    public void ladowaniePrzyciskiem()
    {
        //loadFile(ipath.text);
        loadFile("G:\\POLITECHNIKA\\PROJEKTY\\#8 Technologie map cyfrowych\\maly.osm");
        qt          = new GISquadtree(null);
        qt.size     = new Vector2d(256, 256);
        qt.position = new Vector2d(0, 0);
        foreach (var way in gisdata.wayContainer)
        {
            qt.insert(way);
        }

        //gisdata.maxLat

        //ustawienie kamery tam gdzie coś jest
        Vector2d sr             = new Vector2d((gisdata.maxLat + gisdata.minLat) / 2.0, (gisdata.maxLon + gisdata.minLon) / 2.0);
        var      cameraStartPos = GISparser.LatLonToWeb(sr);

        ghostCamera.transform.position = new Vector3((float)cameraStartPos.x, cam.transform.position.y, -(float)cameraStartPos.y);
    }
Exemple #6
0
    public void extra(string key, string value)
    {
        const float mnoznik = 1;
        //Destroy(mapplane);
        var        tmp = Resources.Load("Prefabs/GISplane", typeof(GameObject));
        GameObject go  = (GameObject)Instantiate(tmp);

        go.transform.position = new Vector3(ghostPivot.transform.position.x, 0, ghostPivot.transform.position.z);
        //go.transform.localScale = Vector3.one * (tmpsize * (float)planeSize / 1000.0f)/2.0f;
        go.transform.localScale = Vector3.one * (tmpsize * 2.0f * 100.0f / planeSize) * whproportion / mnoznik;
        var comp = go.GetComponent <MapPlane>();
        var spr  = go.GetComponent <SpriteRenderer>();

        comp.resolution = new Vector2Int((int)(planeSize * mnoznik), (int)(planeSize * mnoznik));
        //go.transform.rotation.eulerAngles(90,0,0);
        MapPlane mp = go.GetComponent <MapPlane>();

        go.transform.parent = this.transform;
        mapplane            = mp;
        spr.sortingOrder    = orderCounter;
        ++orderCounter;

        //texture
        var min = GISparser.LatlonToXY(new Vector2d(gisdata.minLon, gisdata.minLat));
        var max = GISparser.LatlonToXY(new Vector2d(gisdata.maxLon, gisdata.maxLat));

        var sr = (max - min) / 2;

        sr += max;

        double kat    = 0.005;
        double obszar = kat * tmpsize * 2.0f * whproportion;

        min = sr - new Vector2d(obszar, obszar);
        max = sr + new Vector2d(obszar, obszar);

        min += new Vector2d(ghostPivot.transform.position.x * kat * 2.0f, ghostPivot.transform.position.z * kat * 2.0f);
        max += new Vector2d(ghostPivot.transform.position.x * kat * 2.0f, ghostPivot.transform.position.z * kat * 2.0f);

        comp.fillHeatMap(min, max, gisdata, key, value);
    }
Exemple #7
0
    void drawWay(ref Texture2D tex, GISway way, Vector2d chunkLow, Vector2d chunkHigh)
    {
        GISnode  prev       = null;
        Vector2d?pprev      = null;
        bool     renderPrev = false;
        float    thickness  = 10;

        foreach (var node in way.localNodeContainer)
        {
            var p = new Vector2d();
            p.x = (node.XY.x - chunkLow.x) / (chunkHigh.x - chunkLow.x) * 256.0;
            p.y = (node.XY.y - chunkLow.y) / (chunkHigh.y - chunkLow.y) * 256.0;

            //if (prev == null) {prev = node; continue;}
            if (((p.x >= 0 && p.y >= 0 && p.x < 256 && p.y < 256) || renderPrev) && pprev != null)
            {
                //punkt node jest w chunku
                for (int y = 0; y < 256; y++)
                {
                    for (int x = 0; x < 256; x++)
                    {
                        bool rysuj = GISparser.lineChecker((Vector2d)pprev, p, new Vector2d(x, y), thickness);
                        if (rysuj)
                        {
                            tex.SetPixel(x, y, Color.black);
                        }
                    }
                }
                //koniec
                renderPrev = true;
            }
            else
            {
                renderPrev = false;
            }
            pprev = p;
        }
    }
 public void init(string path)
 {
     gisdata = GISparser.LoadOSM(path);
     this.clearCache();
     map.clearSegmentCache();
     uzytecznePunkty = new List <GISnode>();
     dostepneNazwy   = new Dictionary <string, string>();
     foreach (var node in gisdata.nodeContainer)
     {
         string output = null;
         node.tags.TryGetValue("amenity", out output);
         if (output != null)
         {
             uzytecznePunkty.Add(node);
             try
             {
                 dostepneNazwy.Add(output, output);
             } catch
             {
             }
         }
     }
 }
Exemple #9
0
    Texture2D generateFullViewTexture()
    {
        int width  = ch2.x - ch1.x + 1;
        int height = ch2.y - ch1.y + 1;

        Vector2d range = getCameraRange();
        Vector2d p1    = new Vector2d(-(float)range.x / 2f + cam.transform.position.x, -(float)range.y / 2f + -cam.transform.position.z);
        Vector2d p2    = new Vector2d((float)range.x / 2f + cam.transform.position.x, (float)range.y / 2f + -cam.transform.position.z);

        Texture2D tex = new Texture2D(width * 256, height * 256);

        Vector2d chunkLow  = new Vector2d(((double)(ch1.x) / (double)(1 << zoom)) * 256.0, ((double)(ch1.y) / (double)(1 << zoom)) * 256.0);
        Vector2d chunkHigh = new Vector2d(((double)(ch2.x + 1) / (double)(1 << zoom)) * 256.0, ((double)(ch2.y + 1) / (double)(1 << zoom)) * 256.0);

        var c = Color.cyan;

        //fill

        /*for (int x = 0; x < tex.width; ++x)
         * {
         *  for (int y = 0; y < tex.height; ++y)
         *  {
         *      tex.SetPixel(x, y, c);
         *  }
         * }*/
        //heatmap
        //float[,] heatmap = new float[resolution.x, resolution.y];
        float[,] heatmap = new float[tex.width, tex.height];
        foreach (var zad in zadania)
        {
            float[,] tmpheat;
            if (zad.isMax)
            {
                tmpheat = heatmapCreatorMax(ref tex, chunkLow, chunkHigh, zad.key, zad.value);
            }
            else
            {
                tmpheat = heatmapCreatorMin(ref tex, chunkLow, chunkHigh, zad.key, zad.value);
            }
            for (int x = 0; x < tex.width; ++x)
            {
                for (int y = 0; y < tex.height; ++y)
                {
                    heatmap[x, y] += tmpheat[x, y];
                }
            }
        }
        //var heat = heatmapCreatorMax(ref tex, chunkLow, chunkHigh, "amenity", "restaurant");
        //var heat2= heatmapCreatorMin(ref tex, chunkLow, chunkHigh, "emergency", "fire_hydrant");

        /*for (int x = 0; x < tex.width; ++x)
         * {
         *  for (int y = 0; y < tex.height; ++y)
         *  {
         *      heat[x,y] += heat2[x,y];
         *  }
         * }*/

        float minvalue = float.PositiveInfinity, maxvalue = float.NegativeInfinity;

        for (int x = 0; x < tex.width; ++x)
        {
            for (int y = 0; y < tex.height; ++y)
            {
                var v = heatmap[x, y];
                if (v < minvalue)
                {
                    minvalue = v;
                }
                if (v > maxvalue)
                {
                    maxvalue = v;
                }
                //tex.SetPixel(x, y, c);
            }
        }
        for (int x = 0; x < tex.width; ++x)
        {
            for (int y = 0; y < tex.height; ++y)
            {
                var v  = (heatmap[x, y] - minvalue) / (maxvalue - minvalue);
                var hc = GISparser.valueToHeatColor(v);
                tex.SetPixel(x, y, hc);
            }
        }

        //details
        foreach (var way in gisdata.wayContainer)
        {
            drawWayOptimal(ref tex, way, chunkLow, chunkHigh);
        }

        return(tex);
    }
Exemple #10
0
    //qt = new GISquadtree(null);

    public void loadFile(string text)
    {
        gisdata = GISparser.LoadOSM(text);
    }
Exemple #11
0
    // Use this for initialization
    void Start()
    {
        rend = GetComponent <SpriteRenderer>();

        _pool = new Semaphore(1, 1);

        int    x      = 0;
        int    y      = 0;
        int    z      = 1;
        var    qpath  = GISparser.getQuadPath(x, y, z);
        string qpaths = "";

        foreach (var ele in qpath)
        {
            qpaths += ele.ToString();
        }
        string url      = @"http://t.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/" + qpaths + @"?mkt=pl-PL&it=A,G,RL&shading=hill&n=z&og=268&c4w=1";
        string name     = "BING." + z + "." + x + "." + y + ".png";
        string filePath = GISparser.webImagesPath + name;

        byte[] fileData;
        using (WebClient client = new WebClient())
        {
            if (File.Exists(filePath))
            {
                //fileData = File.ReadAllBytes(filePath);
                Bitmap original = new Bitmap(filePath);
                Bitmap clone    = new Bitmap(original.Width, original.Height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
                //var arr = GISlayer.ImageToByte2(clone);

                //var arr = GISlayer.getImageRasterBytes(clone, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);

                Texture2D tex = new Texture2D(256, 256, TextureFormat.RGBA32, false);
                //Texture2D tex = new Texture2D(16, 16, TextureFormat.PVRTC_RGBA4, false);

                /*for (int xx = 0; xx < tex.width; ++xx)
                 * {
                 *  for (int yy = 0; yy < tex.height; ++yy)
                 *  {
                 *      tex.SetPixel(xx, yy, randomColor());
                 *  }
                 * }
                 * tex.SetPixel(0, 0, UnityEngine.Color.black);
                 * tex.SetPixel(1, 0, UnityEngine.Color.black);
                 * tex.SetPixel(2, 0, UnityEngine.Color.black);
                 * tex.filterMode = FilterMode.Point;*/
                var arr2 = GISlayer.bingPath(filePath);
                tex.LoadRawTextureData(arr2);
                tex.filterMode = FilterMode.Point;
                tex.Apply();

                /*fileData = File.ReadAllBytes(filePath);
                 * tex = new Texture2D(2, 2);
                 * tex.LoadImage(fileData);*/

                Sprite newSprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0, 0));
                rend.sprite = newSprite;
                Debug.Log("obrazek");
                //tex.LoadImage(fileData);
            }
            else
            {
                Debug.Log("Błąd sieci, nie można pobrać pliku png");
            }
        }
    }
Exemple #12
0
    public void fillHeatMap(Vector2d min, Vector2d max, GISdata data, string key, string value)
    {
        rend = GetComponent <SpriteRenderer>();
        tex  = new Texture2D(resolution.x, resolution.y);

        var maxD = GISparser.LatlonToXY(new Vector2d(data.maxLat, data.maxLon));
        var minD = GISparser.LatlonToXY(new Vector2d(data.minLat, data.minLon));

        maxL = max;
        minL = min;

        float[,] heatmap = new float[resolution.x, resolution.y];
        float maxOdl = 255;
        float minOdl = 10000;

        foreach (var node in data.nodeContainer)
        {
            try
            {
                if (node.tags[key] == value)
                {
                    minOdl = 10000;
                    Vector2Int pos = XYtoPixel(GISparser.LatlonToXY(node.latlon));
                    float[,] heatmapLocal = new float[resolution.x, resolution.y];
                    //heatmapLocal[pos.x, pos.y] = 255;
                    for (int y = 0; y < resolution.y; ++y)
                    {
                        for (int x = 0; x < resolution.x; ++x)
                        {
                            float odl = 1000 - Mathf.Sqrt((pos.x - x) * (pos.x - x) + (pos.y - y) * (pos.y - y));
                            //odl = Mathf.Sqrt(odl);
                            if (odl > maxOdl)
                            {
                                maxOdl = odl;
                            }
                            heatmapLocal[x, y] = odl;
                        }
                    }
                    for (int y = 0; y < resolution.y; ++y)
                    {
                        for (int x = 0; x < resolution.x; ++x)
                        {
                            if (heatmapLocal[x, y] > heatmap[x, y])
                            {
                                heatmap[x, y] = heatmapLocal[x, y];
                            }
                            if (heatmap[x, y] < minOdl)
                            {
                                minOdl = heatmap[x, y];
                            }
                        }
                    }
                }
            }
            catch
            {
            }
        }
        for (int y = 0; y < resolution.y; ++y)
        {
            for (int x = 0; x < resolution.x; ++x)
            {
                heatmap[x, y] = (heatmap[x, y] - minOdl) / (maxOdl - minOdl);
                heatmap[x, y] = 1 - heatmap[x, y];
                Color c = new Color(heatmap[x, y], 0, heatmap[x, y]);
                tex.SetPixel(x, y, c);
            }
        }
        tex.filterMode = FilterMode.Point;
        tex.Apply();

        Sprite newSprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.one * 0.5f);

        rend.sprite = newSprite;
    }
Exemple #13
0
    public void fillTexture(Vector2d min, Vector2d max, GISdata data)
    {
        rend = GetComponent <SpriteRenderer>();
        tex  = new Texture2D(resolution.x, resolution.y);

        var maxD = GISparser.LatlonToXY(new Vector2d(data.maxLat, data.maxLon));
        var minD = GISparser.LatlonToXY(new Vector2d(data.minLat, data.minLon));

        maxL = max;
        minL = min;

        /*if (maxD.x < max.y) return;
        *  if (maxD.y < max.y) return;
        *
        *  if (minD.x > min.y) return;
        *  if (minD.y > min.y) return;*/

        /*for (int y = 0; y < resolution.y; ++y)
         * {
         *  for (int x = 0; x < resolution.x; ++x)
         *  {
         *
         *
         *
         *      tex.SetPixel(x, y, randomColor());
         *  }
         * }*/

        foreach (var way in data.wayContainer)
        {
            Color    color = Color.black;
            Vector2d pos0  = Vector2d.zero;
            bool     first = true;

            try
            {
                if (way.tags["highway"] == "residential")
                {
                    color = Color.red;
                }
                if (way.tags["highway"] == "living_street")
                {
                    color = Color.red;
                }
                if (way.tags["highway"] == "primary")
                {
                    color = Color.red;
                }
                if (way.tags["highway"] == "secondary")
                {
                    color = Color.red;
                }
                if (way.tags["highway"] == "tertiary")
                {
                    color = Color.red;
                }
                if (way.tags["highway"] == "service")
                {
                    color = Color.red;
                }
                if (way.tags["highway"] == "track")
                {
                    color = Color.red;
                }
                if (way.tags["highway"] == "motorway")
                {
                    color = Color.red;
                }
                if (way.tags["highway"] == "road")
                {
                    color = Color.red;
                }
                if (way.tags["highway"] == "path")
                {
                    color = Color.red;
                }
                if (way.tags["highway"] == "motorway")
                {
                    color = Color.red;
                }
                if (way.tags["highway"] == "motorway")
                {
                    color = Color.red;
                }
                if (way.tags["route"] == "road")
                {
                    color = Color.red;
                }
            }
            catch
            {
            }


            foreach (var node in way.localNodeContainer)
            {
                var pos1 = GISparser.LatlonToXY(node.latlon);
                if (first)
                {
                    first = false;
                    pos0  = pos1;
                    continue;
                }

                var pixel0 = XYtoPixel(pos0);
                var pixel1 = XYtoPixel(pos1);

                double thickness = 0.00001;

                double pixelSize = ((0.5) / (double)(resolution.y)) * (maxL.y - minL.y);

                int pthick = (int)(pixelSize / thickness);


                int pixminx = 0; int pixminy = 0;
                int pixmaxx = 0; int pixmaxy = 0;
                if (pixel0.x < pixel1.x)
                {
                    pixminx = pixel0.x - pthick;
                    pixmaxx = pixel1.x + pthick;
                }
                else
                {
                    pixminx = pixel1.x - pthick;
                    pixmaxx = pixel0.x + pthick;
                }

                if (pixel0.y < pixel1.y)
                {
                    pixminy = pixel0.y - pthick;
                    pixmaxy = pixel1.y + pthick;
                }
                else
                {
                    pixminy = pixel1.y - pthick;
                    pixmaxy = pixel0.y + pthick;
                }

                if (pixminx < 0)
                {
                    pixminx = 0;
                }
                if (pixminy < 0)
                {
                    pixminy = 0;
                }

                if (pixmaxx >= resolution.x)
                {
                    pixmaxx = resolution.x;
                }
                if (pixmaxy >= resolution.y)
                {
                    pixmaxy = resolution.y;
                }

                for (int y = pixminy; y <= pixmaxy; ++y)
                {
                    for (int x = pixminx; x < pixmaxx; ++x)
                    {
                        bool check = GISparser.lineChecker(pos0, pos1, pixelToXY(new Vector2Int(x, y)), (float)thickness);
                        if (check)
                        {
                            tex.SetPixel(x, y, color);
                        }
                    }
                }
                pos0 = pos1;
            }
        }

        tex.filterMode = FilterMode.Point;
        tex.Apply();

        Sprite newSprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.one * 0.5f);

        rend.sprite = newSprite;
    }
Exemple #14
0
 // Update is called once per frame
 void Update()
 {
     sr.color = GISparser.valueToHeatColor(value);
 }
Exemple #15
0
    //public GISquadtree qt;

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.W))
        {
            Move(Vector2.up);
        }
        if (Input.GetKey(KeyCode.A))
        {
            Move(Vector2.left);
        }
        if (Input.GetKey(KeyCode.S))
        {
            Move(Vector2.down);
        }
        if (Input.GetKey(KeyCode.D))
        {
            Move(Vector2.right);
        }
        if (Input.GetKey(KeyCode.Q))
        {
            Rotate(1);
        }
        if (Input.GetKey(KeyCode.E))
        {
            Rotate(-1);
        }
        if (Input.GetKey(KeyCode.Z))
        {
            Bend(1);
        }
        if (Input.GetKey(KeyCode.C))
        {
            Bend(-1);
        }
        if (Input.mouseScrollDelta.y < 0)
        {
            ZoomOut();
        }
        if (Input.mouseScrollDelta.y > 0)
        {
            ZoomIn();
        }
        if (Input.GetKey(KeyCode.X))
        {
            extra(ikey.text, ivalue.text);
        }
        if (Input.GetKey(KeyCode.L))
        {
            loadFile(ipath.text);
        }
        if (Input.GetKey(KeyCode.M))
        {
            czyszczenie();
        }
        if (Input.GetKeyDown(KeyCode.T))
        {
            //quadtree

            /*qt.clear();
             * foreach (var way in gisdata.wayContainer)
             * {
             *  qt.insert(way);
             * }
             * Debug.Log("zaladowano drzewo");*/
            Vector2d tmp;
            tmp = GISparser.LatlonToXY(new Vector2d(-85.06, -180));
            Debug.Log(tmp.x + " " + tmp.y);
            tmp = GISparser.LatlonToXY(new Vector2d(85.06, 180));
            Debug.Log(tmp.x + " " + tmp.y);

            tmp = GISparser.LatLonToWeb(new Vector2d(-85.051129, 180), 0);
            Debug.Log("web: " + tmp.x + " " + tmp.y);
            tmp = GISparser.LatLonToWeb(new Vector2d(0, 0), 0);
            Debug.Log("web: " + tmp.x + " " + tmp.y);
            tmp = GISparser.LatLonToWeb(new Vector2d(85.051129, -180), 0);
            Debug.Log("web: " + tmp.x + " " + tmp.y);
        }
        camUpdate();
        planeUpdate();
    }
Exemple #16
0
 public void loadFile(string text)
 {
     gisdata = GISparser.LoadOSM(text);
     setPlaneSize();
     setPlane();
 }