Ejemplo n.º 1
0
        Visualisation CreateVisFromSource()
        {
            visGo = new GameObject("myTester");
            Debug.Log("Spawned myTester");

            vis = visGo.AddComponent <Visualisation>();
            Debug.Log("Add Visualizsation");

            if (vis != null)
            {
                if (vis.theVisualizationObject == null)
                {
                    vis.CreateVisualisation(AbstractVisualisation.VisualisationTypes.SCATTERPLOT);
                }

                vis.dataSource    = rtds;
                vis.xDimension    = "DimA";
                vis.yDimension    = "DimB";
                vis.zDimension    = "DimC";
                vis.sizeDimension = "DimD";
                vis.CreateVisualisation(AbstractVisualisation.VisualisationTypes.SCATTERPLOT);


                AbstractVisualisation abstractVisualisation = vis.theVisualizationObject;

                // Axis
                abstractVisualisation.visualisationReference.xDimension.Attribute = "DimA";
                abstractVisualisation.UpdateVisualisation(AbstractVisualisation.PropertyType.X);
                abstractVisualisation.visualisationReference.yDimension.Attribute = "DimB";
                abstractVisualisation.UpdateVisualisation(AbstractVisualisation.PropertyType.Y);
                abstractVisualisation.visualisationReference.zDimension.Attribute = "DimC";
                abstractVisualisation.UpdateVisualisation(AbstractVisualisation.PropertyType.Z);
                abstractVisualisation.visualisationReference.sizeDimension = "DimD";
                abstractVisualisation.UpdateVisualisation(AbstractVisualisation.PropertyType.OriginDimension);

                vis.geometry = AbstractVisualisation.GeometryType.Bars;

                Debug.Log("Init vis 6");
                isVisReady = true;
            }
            return(vis);
        }
Ejemplo n.º 2
0
    public void DisplayTrajectories()
    {
        // Assignments data parsing
        List <List <int> > assignments = ParseListOfListOfInts(assignmentsData);

        // Trajectories files data parsing
        List <String> fileNames = ParseListOfString(filesData);

        // Create Trajectories objects
        int nb_files = assignments.Count;

        int[] assignments_counter = new int[nb_files];
        Array.Clear(assignments_counter, 0, nb_files); // Fills array with 0s
        for (int i = 0; i < assignments.Count; i++)
        {
            GameObject t = Instantiate(trajectoryPrefab, new Vector3(assignments_counter[assignments[i][0]]++, assignments[i][0], 0), Quaternion.identity);
            t.transform.parent = transform;

            // upload CSV file
            CSVDataSource dataSource = t.transform.Find("[IATK] New Data Source").GetComponent <CSVDataSource>();
            dataSource.data = Resources.Load(fileNames[i]) as TextAsset;

            // set up visualisation
            Visualisation dataVisualisation = t.transform.Find("[IATK] New Visualisation").GetComponent <Visualisation>();
            dataVisualisation.dataSource = dataSource;
            dataVisualisation.CreateVisualisation(AbstractVisualisation.VisualisationTypes.SCATTERPLOT);
            dataVisualisation.colour     = randomColorFromInt(assignments[i][0]);
            dataVisualisation.xDimension = new DimensionFilter {
                Attribute = "x"
            };
            dataVisualisation.yDimension = new DimensionFilter {
                Attribute = "y"
            };
            dataVisualisation.zDimension = new DimensionFilter {
                Attribute = "z"
            };
            dataVisualisation.geometry         = AbstractVisualisation.GeometryType.Lines;
            dataVisualisation.linkingDimension = "TrajectoryID";
            dataVisualisation.theVisualizationObject.UpdateVisualisation(AbstractVisualisation.PropertyType.X);
            dataVisualisation.theVisualizationObject.UpdateVisualisation(AbstractVisualisation.PropertyType.Y);
            dataVisualisation.theVisualizationObject.UpdateVisualisation(AbstractVisualisation.PropertyType.Z);
            dataVisualisation.theVisualizationObject.UpdateVisualisation(AbstractVisualisation.PropertyType.GeometryType);
            dataVisualisation.theVisualizationObject.UpdateVisualisation(AbstractVisualisation.PropertyType.LinkingDimension);
        }
    }
    void CreateVisualization(DataSource source)
    {
        if (Visualization != null)
        {
            Destroy(Visualization.gameObject);
        }

        Visualization = new GameObject("Visualization").AddComponent <Visualisation>();

        Visualization.transform.SetParent(transform, false);

        InitVisualization(Visualization);

        Visualization.dataSource = source;
        Visualization.CreateVisualisation(AbstractVisualisation.VisualisationTypes.PARALLEL_COORDINATES);

        UpdateVizScaling(Visualization);
        Collider.enabled = true;

        VisualizationCreated.Invoke(Visualization);
    }