예제 #1
0
    // Update is called once per frame
    void Update()
    {
        // Set camera pos text
        if (m_MainCamera.transform.position.y > maxCameraPos)
        {
            m_MainCamera.transform.position = new Vector3(m_MainCamera.transform.position.x, maxCameraPos, m_MainCamera.transform.position.z);
        }


        // Update colors of point cloud if camera is below a object height
        if (!useColors && m_MainCamera.transform.position.y < max_h)
        {
            SetColorsByPos(m_MainCamera.transform.position.y, min_h);
        }

        if (updateVisual)
        {
            // Calculate bounds of the mesh
            Bounds  pointcloudbounds  = CalculateLocalBounds();
            Vector3 pointcloudcenter  = pointcloudbounds.center;
            Vector3 pointcloudextents = pointcloudbounds.extents;

            max_h = pointcloudcenter[1] + pointcloudextents[1];
            min_h = pointcloudcenter[1] - pointcloudextents[1];

            // Adjust camera position
            if (m_MainCamera != null)
            {
                // float vFOV = m_MainCamera.fieldOfView * Mathf.PI / 180;
                m_MainCamera.orthographicSize = Mathf.Max(pointcloudextents[0], pointcloudextents[2]);
                //float pos_camera_y = Mathf.Max(pointcloudextents[0], pointcloudextents[2]) / Mathf.Tan(vFOV / 2.0f);
                float pos_camera_y = max_h * 2.0f;
                float center_x     = pointcloudcenter[0];
                float center_z     = pointcloudcenter[2];
                maxCameraPos = pos_camera_y * yfactor;
                m_MainCamera.transform.position = new Vector3(center_x, maxCameraPos, center_z);
            }

            updateVisual = false;
        }

        // Volver abrir File Browser
        if (loaded && Input.GetKeyDown(KeyCode.Escape))
        {
            Debug.Log("Back Button Pressed");

            // Destroy point cloud object
            loaded = false;
            Destroy(pointCloud);

            // Re-open file browser
            FileBrowserScript fileBrowserScript = gameObject.GetComponent <FileBrowserScript>();
            fileBrowserScript.OpenFileBrowerLoadMode();

            // disable script
            enabled = false;
        }
    }
예제 #2
0
    private void Receive_HDF5Damiler_SessionName(string sessionName_inp)
    {
        datatype    = Util.Datatype.hdf5_DaimlerLidar;
        sessionName = sessionName_inp;
        string desktopPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);
        string userInfo    = "Choose a directory or a file with HDF5-Data";

        FileBrowserScript.Show(desktopPath, ".hdf5", LoadFromPath, userInfo);
    }
예제 #3
0
    private void Receive_PCD_SessionName(string sessionName_inp)
    {
        datatype    = Util.Datatype.pcd;
        sessionName = sessionName_inp;
        string desktopPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop);
        string userInfo    = "Choose a directory or a file with PCD-Data";

        FileBrowserScript.Show(desktopPath, ".pcd", LoadFromPath, userInfo);
    }
예제 #4
0
    /// <summary>
    /// Set DiskContentItem properties
    /// </summary>
    /// <param name="path">Item path</param>
    /// <param name="isFile">Whether item is directory</param>
    /// <param name="browserScript">Reference to FileBrowserSript. Usually the one, who calls this method</param>
    public void SetButton(string path, bool isFile, FileBrowserScript browserScript)
    {
        this.browserScript = browserScript;

        this.itemPath = path;
        this.isFile   = isFile;
        if (isFile)
        {
            // get file name
            itemName         = Path.GetFileName(path);
            IconField.sprite = FileIcon;
        }
        else
        {
            //get folder name
            itemName         = Path.GetFileName(Path.GetDirectoryName(path));
            IconField.sprite = FolderIcon;
        }
        NameField.text  = itemName;
        gameObject.name = itemName;
    }
예제 #5
0
    public void OnExportClick()
    {
        string userInfo = "Choose the directory you want for the export!";

        FileBrowserScript.Show(Util.DataLoadInfo._sourceDataPath, "", StartExport, userInfo);
    }
예제 #6
0
    public void OnLoadClick()
    {
        string userInfo = "Choose the Save File you want to load!";

        FileBrowserScript.Show(Application.persistentDataPath, ".dat", LoadSessionFromPath, userInfo);
    }