Esempio n. 1
0
    public void ImportFile(string filePath)
    {
        string importedFilePath = ProjectScene.CurrentProjectPath + StorePath + "/" + FileName + (Count + 1).ToString("0000") + FileExtension;

        if (!Directory.Exists(ProjectScene.CurrentProjectPath + "/" + StorePath + "/"))
        {
            Directory.CreateDirectory(ProjectScene.CurrentProjectPath + "/" + StorePath + "/");
        }
        if (File.Exists(importedFilePath))
        {
            File.Delete(importedFilePath);
        }
        File.Copy(filePath, importedFilePath);
        importedFilePath = GetRelativePath(ProjectScene.CurrentProjectPath, importedFilePath);
        ProjectManager.projectManifest.Frames.Add(importedFilePath);
        FrameData frameData = new FrameData(importedFilePath, true);

        FrameManager.Frames.Add(frameData);

        Vector3[] points = frameData.Data.ToVector3(CullOutliers, OutlierThreshold);
        foreach (Vector3 point in points)
        {
            PointsManager.AddPoint(point);
        }

        UpdateLabels();
    }
Esempio n. 2
0
    public void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            activated      = !activated;
            NextImportTime = Time.time + 5f;
        }
        if (activated && Time.time > NextImportTime && FolderFound)
        {
            if (index > Files.Length)
            {
                activated = false;
            }
            if (!activated)
            {
                return;
            }

            string    json      = File.ReadAllText(Files[index].FullName);
            Frame     frameData = JsonConvert.DeserializeObject <Frame>(json);
            Vector3[] points    = frameData.ToVector3();
            foreach (Vector3 point in points)
            {
                PointCloud.AddPoint(point);
            }

            index++;
            NextImportTime = Time.time + ImportInterval;
            if (index >= Files.Length)
            {
                index     = 0;
                activated = false;
            }
        }
    }
    public void FudgeIt()
    {
        if (triggered)
        {
            return;
        }

        triggered = true;

        FudgeData fudgeData = JsonConvert.DeserializeObject <FudgeData>(File.ReadAllText(fudgeLocation));

        foreach (FudgedPoint point in fudgeData.points)
        {
            pointCloudManager.AddPoint(new Vector3(point.x, point.y, point.z));
        }
    }
Esempio n. 4
0
    public void PrepareExistingProject(string directory)
    {
        string manifestFileContents = File.ReadAllText(directory + "/manifest.json");

        projectManifest = JsonConvert.DeserializeObject <ProjectManifest>(manifestFileContents);
        frameManager.Frames.Clear();
        foreach (string frameFilePath in projectManifest.Frames)
        {
            frameManager.Frames.Add(new FrameData(frameFilePath));
        }
        foreach (FrameData frameData in frameManager.Frames)
        {
            frameData.LoadFrame();
            Vector3[] points = frameData.Data.ToVector3();
            foreach (Vector3 point in points)
            {
                pointCloudManager.AddPoint(point);
            }
        }
        ProjectNameInputField.text = projectManifest.Name;
        ProjectLoaded = true;
    }