コード例 #1
0
        private void Create2DVisualisation(int i, int j)
        {
            ViewBuilder builder = new ViewBuilder(geometryToMeshTopology(creationConfiguration.Geometry), "Scatterplot Matrix");

            builder.initialiseDataView(visualisationReference.dataSource.DataCount);

            builder.setDataDimension(visualisationReference.dataSource[visualisationReference.xScatterplotMatrixDimensions[i].Attribute].Data, ViewBuilder.VIEW_DIMENSION.X);
            builder.setDataDimension(visualisationReference.dataSource[visualisationReference.yScatterplotMatrixDimensions[j].Attribute].Data, ViewBuilder.VIEW_DIMENSION.Y);

            View v = ApplyGeometryAndRendering(creationConfiguration, ref builder);

            //destroy the view to clean the big mesh

            if (v != null)
            {
                v.transform.localPosition = new Vector3(i * xPadding, j * yPadding, 0);
                v.transform.SetParent(transform, false);
                viewList.Add(v);
            }
        }
コード例 #2
0
        // ******************************
        // SPECIFIC VISUALISATION METHODS
        // ******************************

        private View CreateSimpleVisualisation(CreationConfiguration configuration)
        {
            if (visualisationReference.dataSource != null)
            {
                if (!visualisationReference.dataSource.IsLoaded)
                {
                    visualisationReference.dataSource.load();
                }

                ViewBuilder builder = new ViewBuilder(geometryToMeshTopology(configuration.Geometry), "Simple Visualisation");

                if ((visualisationReference.dataSource[getAxis(configuration.Axies, CreationConfiguration.Axis.X)] != null) ||
                    (visualisationReference.dataSource[getAxis(configuration.Axies, CreationConfiguration.Axis.Y)] != null) ||
                    (visualisationReference.dataSource[getAxis(configuration.Axies, CreationConfiguration.Axis.Z)] != null))
                {
                    builder.initialiseDataView(visualisationReference.dataSource.DataCount);

                    if (visualisationReference.dataSource[getAxis(configuration.Axies, CreationConfiguration.Axis.X)] != null)
                    {
                        builder.setDataDimension(visualisationReference.dataSource[getAxis(configuration.Axies, CreationConfiguration.Axis.X)].Data, ViewBuilder.VIEW_DIMENSION.X);
                    }
                    if (visualisationReference.dataSource[getAxis(configuration.Axies, CreationConfiguration.Axis.Y)] != null)
                    {
                        builder.setDataDimension(visualisationReference.dataSource[getAxis(configuration.Axies, CreationConfiguration.Axis.Y)].Data, ViewBuilder.VIEW_DIMENSION.Y);
                    }
                    if (visualisationReference.dataSource[getAxis(configuration.Axies, CreationConfiguration.Axis.Z)] != null)
                    {
                        builder.setDataDimension(visualisationReference.dataSource[getAxis(configuration.Axies, CreationConfiguration.Axis.Z)].Data, ViewBuilder.VIEW_DIMENSION.Z);
                    }

                    //destroy the view to clean the big mesh
                    destroyView();

                    //return the appropriate geometry view
                    return(ApplyGeometryAndRendering(creationConfiguration, ref builder));
                }
            }

            return(null);
        }
コード例 #3
0
        public void LinkVisualisations()
        {
            View pv = GetComponentInChildren <View>();

            if (pv != null)
            {
                DestroyImmediate(pv.gameObject);
            }

            ViewBuilder viewLinked;

            Vector3[]    vSource = visualisationSource.theVisualizationObject.viewList[0].GetPositions(); // bigMesh.getBigMeshVertices();
            Vector3[]    vDest   = visualisationTarget.theVisualizationObject.viewList[0].GetPositions(); // bigMesh.getBigMeshVertices();
            List <Color> colors  = new List <Color>();

            Color[] cSource = visualisationSource.theVisualizationObject.viewList[0].GetColors(); // bigMesh.getColors();
            Color[] cDest   = visualisationTarget.theVisualizationObject.viewList[0].GetColors(); // bigMesh.getColors();

            List <Vector3> vertexBuffer = new List <Vector3>();
            List <int>     indexBuffer  = new List <int>();

            List <float>   positionsLocalX = new List <float>();
            List <float>   positionsLocalY = new List <float>();
            List <float>   positionsLocalZ = new List <float>();
            List <Vector3> normalsBuffer   = new List <Vector3>();

            for (int i = 0; i < vSource.Length; i++)
            {
                positionsLocalX.Add((vSource[i]).x);
                positionsLocalX.Add((vDest[i]).x);
                positionsLocalY.Add((vSource[i]).y);
                positionsLocalY.Add((vDest[i]).y);
                positionsLocalZ.Add((vSource[i]).z);
                positionsLocalZ.Add((vDest[i]).z);

                colors.Add(cSource[i]);
                colors.Add(cDest[i]);

                normalsBuffer.Add(new Vector3((float)i, 0, 0));
                normalsBuffer.Add(new Vector3((float)i, 0, 1));
            }

            for (int i = 0; i < positionsLocalX.Count; i += 2)
            {
                indexBuffer.Add(i);
                indexBuffer.Add(i + 1);
            }

            viewLinked = new ViewBuilder(MeshTopology.Lines, "Linked Visualisation");
            viewLinked.initialiseDataView(positionsLocalX.Count);
            viewLinked.setDataDimension(positionsLocalX.ToArray(), ViewBuilder.VIEW_DIMENSION.X);
            viewLinked.setDataDimension(positionsLocalY.ToArray(), ViewBuilder.VIEW_DIMENSION.Y);
            viewLinked.setDataDimension(positionsLocalZ.ToArray(), ViewBuilder.VIEW_DIMENSION.Z);

            viewLinked.Indices = indexBuffer;
            viewLinked.updateView();
            view = viewLinked.apply(this.gameObject, linkerMaterial);
            view.SetColors(colors.ToArray());
            view.SetAllChannels(normalsBuffer.ToArray());

            view.RecalculateBounds();

            transform.position = Vector3.zero;
            GetComponentInChildren <View>().transform.position = Vector3.zero;
        }
コード例 #4
0
        public override void CreateVisualisation()
        {
            if (visualisationReference.parallelCoordinatesDimensions.Length > 1 && visualisationReference.parallelCoordinatesDimensions.None(x => x == null || x.Attribute == "Undefined"))
            {
                viewList.Clear();
                destroyView();

                ViewBuilder viewParallel;

                List <float> positionsLocalX = new List <float>();
                List <float> positionsLocalY = new List <float>();
                List <float> positionsLocalZ = new List <float>();
                List <int>   indices         = new List <int>();

                for (int i = 0; i < visualisationReference.parallelCoordinatesDimensions.Length; i++)
                {
                    if (visualisationReference.parallelCoordinatesDimensions[i] != null && visualisationReference.parallelCoordinatesDimensions[i].Attribute != "Undefined")
                    {
                        float[] positions = visualisationReference.dataSource[visualisationReference.parallelCoordinatesDimensions[i].Attribute].Data;
                        for (int k = 0; k < positions.Length; k++)
                        {
                            positionsLocalX.Add((float)GameObject_Axes_Holders[i].transform.localPosition.x);
                            positionsLocalY.Add(positions[k] + (float)GameObject_Axes_Holders[i].transform.localPosition.y);
                            positionsLocalZ.Add((float)GameObject_Axes_Holders[i].transform.localPosition.z);
                        }
                    }
                }

                //build indices
                for (int i = 0; i < visualisationReference.dataSource.DataCount; i++)
                {
                    for (int j = 0; j < visualisationReference.parallelCoordinatesDimensions.Length - 1; j++)
                    {
                        indices.Add(j * visualisationReference.dataSource.DataCount + i);
                        indices.Add((j + 1) * visualisationReference.dataSource.DataCount + i);
                    }
                }

                int[] lineLength = new int[visualisationReference.dataSource.DataCount];
                for (int i = 0; i < visualisationReference.dataSource.DataCount; i++)
                {
                    lineLength[i] = visualisationReference.parallelCoordinatesDimensions.Length;
                }

                viewParallel = new ViewBuilder(MeshTopology.Lines, "parallel coordinates");
                viewParallel.initialiseDataView(positionsLocalX.Count);
                viewParallel.setDataDimension(positionsLocalX.ToArray(), ViewBuilder.VIEW_DIMENSION.X);
                viewParallel.setDataDimension(positionsLocalY.ToArray(), ViewBuilder.VIEW_DIMENSION.Y);
                viewParallel.setDataDimension(positionsLocalZ.ToArray(), ViewBuilder.VIEW_DIMENSION.Z);
                viewParallel.Indices    = indices;
                viewParallel.LineLength = lineLength.ToList();
                Material mt = new Material(Shader.Find("IATK/PCPShader"));
                mt.renderQueue = 3000;
                viewParallel.updateView();
                View v = viewParallel.apply(gameObject, mt);

                viewList.Add(v);

                //Creation configuration management
                if (creationConfiguration == null)
                {
                    creationConfiguration = new CreationConfiguration();
                }

                creationConfiguration.VisualisationType             = AbstractVisualisation.VisualisationTypes.PARALLEL_COORDINATES;
                creationConfiguration.parallelCoordinatesDimensions = visualisationReference.parallelCoordinatesDimensions;
                creationConfiguration.colour           = visualisationReference.colour;
                creationConfiguration.ColourDimension  = visualisationReference.colourDimension;
                creationConfiguration.colourKeys       = visualisationReference.dimensionColour;
                creationConfiguration.Geometry         = visualisationReference.geometry;
                creationConfiguration.LinkingDimension = visualisationReference.linkingDimension;
                creationConfiguration.SizeDimension    = visualisationReference.sizeDimension;
                creationConfiguration.Axies            = new Dictionary <CreationConfiguration.Axis, string>();

                //restore properties
                UpdateVisualisation(AbstractVisualisation.PropertyType.Colour);
                UpdateVisualisation(AbstractVisualisation.PropertyType.Size);
                UpdateVisualisation(AbstractVisualisation.PropertyType.SizeValues);
            }
        }