Exemplo n.º 1
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);
    }
Exemplo n.º 2
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();
    }