Exemplo n.º 1
0
        // PUBLIC
        public void CreateVisualisation(AbstractVisualisation.VisualisationTypes visualizationType)
        {
            //destroy the previous visualisations
            AbstractVisualisation[] previousVisualizations = GetComponentsInChildren<AbstractVisualisation>();

            foreach (var item in previousVisualizations)
            {
                item.destroyView();
                DestroyImmediate(item);
            }

            //destroy the previous axes
            Axis[] previousAxes = GetComponentsInChildren<Axis>();

            foreach (var item in previousAxes)
            {
                DestroyImmediate(item.gameObject);
            }

            //destroy previous key
            if(key!=null)
            DestroyImmediate(key.gameObject);

            visualisationType = visualizationType;

            switch (visualisationType)
            {
                case AbstractVisualisation.VisualisationTypes.SCATTERPLOT:
                    theVisualizationObject = gameObject.AddComponent<ScatterplotVisualisation>();// new Simple2D3DVisualisation();                    
                    theVisualizationObject.visualisationReference = this;

                    theVisualizationObject.CreateVisualisation();
                    break;
                case AbstractVisualisation.VisualisationTypes.SCATTERPLOT_MATRIX:
        
                    int dimensionCount = dataSource.DimensionCount;
                    if (dimensionCount > MAX_INIT_SCATTERPLOTMATRIX) dimensionCount = MAX_INIT_SCATTERPLOTMATRIX;

                    xScatterplotMatrixDimensions = new DimensionFilter[dimensionCount];
                    yScatterplotMatrixDimensions = new DimensionFilter[dimensionCount];

                    for (int i = 0; i < dimensionCount; i++)
                    {
                        xScatterplotMatrixDimensions[i] = new DimensionFilter { Attribute = dataSource[i].Identifier };
                        yScatterplotMatrixDimensions[i] = new DimensionFilter { Attribute = dataSource[i].Identifier };
                    }

                    theVisualizationObject = gameObject.AddComponent<ScatterplotMatrixVisualisation>();// new Simple2D3DVisualisation();                    
                    theVisualizationObject.visualisationReference = this;

                    theVisualizationObject.CreateVisualisation();
                    break;
                case AbstractVisualisation.VisualisationTypes.PARALLEL_COORDINATES:
                    parallelCoordinatesDimensions = new DimensionFilter[dataSource.DimensionCount];

                    for (int i = 0; i < dataSource.DimensionCount; i++)
                    {
                        parallelCoordinatesDimensions[i] = new DimensionFilter { Attribute = dataSource[i].Identifier };
                    }
                    theVisualizationObject = gameObject.AddComponent<ParallelCoordinatesVisualisation>();// new ParrallelCoordinates();
                    
                    theVisualizationObject.visualisationReference = this;
                    theVisualizationObject.UpdateVisualisation(AbstractVisualisation.PropertyType.DimensionChange);

                    theVisualizationObject.CreateVisualisation();


                    break;
                case AbstractVisualisation.VisualisationTypes.GRAPH_LAYOUT:
                    break;
                default:
                    break;
            }

            theVisualizationObject.UpdateVisualisation(AbstractVisualisation.PropertyType.None);

            RuntimeEditorLoadAndSaveConfiguration();

            key = (GameObject)Instantiate(Resources.Load("Key"));
            key.transform.parent = transform;
            key.transform.localPosition = new Vector3(0.15f, 1.165f, 0f);
        }