Ejemplo n.º 1
0
    private void split()
    {
        if (nodes == null)
        {
            nodes = new GISquadtree[4];

            Vector2d halfsize = size / 2.0;

            nodes[0]          = new GISquadtree(this);
            nodes[0].position = new Vector2d(position.x, position.y);
            nodes[0].size     = halfsize;
            nodes[1]          = new GISquadtree(this);
            nodes[1].position = new Vector2d(position.x + halfsize.x, position.y);
            nodes[1].size     = halfsize;
            nodes[2]          = new GISquadtree(this);
            nodes[2].position = new Vector2d(position.x, position.y + halfsize.y);
            nodes[2].size     = halfsize;
            nodes[3]          = new GISquadtree(this);
            nodes[3].position = new Vector2d(position.x + halfsize.x, position.y + halfsize.y);
            nodes[3].size     = halfsize;
        }
        else
        {
            Debug.Log("WARNING - quadtree już podzielone");
        }
    }
Ejemplo n.º 2
0
 public GISquadtree(GISquadtree par)
 {
     totalNodes++;
     parent = par;
     if (parent != null)
     {
         level = parent.level + 1;
     }
 }
Ejemplo n.º 3
0
    public List <GISway> getObjects(List <byte> path)
    {
        GISquadtree tmp = this;

        foreach (var dir in path)
        {
            if (tmp.nodes != null)
            {
                tmp = tmp.nodes[dir];
            }
            else
            {
                break;
            }
        }
        return(tmp.list);
        //wszystkie podelementy tmp są rozwiązaniami
    }
Ejemplo n.º 4
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);
    }