Exemplo n.º 1
0
        /// <summary>
        /// Serialize view configuraiton to disk
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public void SerializeViewConfiguration(CreationConfiguration creationConfiguration)
        {
            string path = ConfigurationFileName();

            if (!Directory.Exists(Path.GetDirectoryName(path)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(path));
            }
            creationConfiguration.Serialize(ConfigurationFileName());
        }
        public void DeSerialize(string serializedObjectPath, CreationConfiguration cf)
        {
            SerializableCreationConfiguration scc = JsonUtility.FromJson <SerializableCreationConfiguration>(File.ReadAllText(serializedObjectPath));

            cf.VisualisationType = (AbstractVisualisation.VisualisationTypes)System.Enum.Parse(typeof(AbstractVisualisation.VisualisationTypes), scc.VisualisationType);

            //rebuild the parallel coordinates dimensions filtering
            string[] attributesPCP = scc.parallelCoordinatesDimensionsAttributes;
            float[]  minFiltersPCP = scc.parallelCoordinatesDimensionsMinFilter;
            float[]  maxFiltersPCP = scc.parallelCoordinatesDimensionsMaxFilter;
            float[]  minScalesPCP  = scc.parallelCoordinatesDimensionsMinScale;
            float[]  maxScalesPCP  = scc.parallelCoordinatesDimensionsMaxScale;

            DimensionFilter[] parallelCoordinatesDimensions = new DimensionFilter[attributesPCP.Length];

            for (int i = 0; i < parallelCoordinatesDimensions.Length; i++)
            {
                DimensionFilter df = new DimensionFilter();
                df.Attribute = attributesPCP[i];
                df.minFilter = minFiltersPCP[i];
                df.maxFilter = maxFiltersPCP[i];
                df.minScale  = minScalesPCP[i];
                df.maxScale  = maxScalesPCP[i];

                parallelCoordinatesDimensions[i] = df;
            }

            cf.parallelCoordinatesDimensions = parallelCoordinatesDimensions;

            cf.Geometry = scc.Geometry;
            cf.Axies    = new Dictionary <CreationConfiguration.Axis, string>();
            for (int i = 0; i < scc.AxiesKeys.Length; i++)
            {
                if (!cf.Axies.ContainsKey(scc.AxiesKeys[i]))
                {
                    cf.Axies.Add(scc.AxiesKeys[i], scc.AxiesValues[i]);
                }
            }
            cf.ColourDimension  = scc.ColourDimension;
            cf.SizeDimension    = scc.SizeDimension;
            cf.LinkingDimension = scc.LinkingDimension;
            cf.colourKeys       = scc.colourKeys;
            cf.colour           = scc.colour;
            cf.Size             = scc.Size;
            cf.MinSize          = scc.MinSize;
            cf.MaxSize          = scc.MaxSize;

            cf.VisualisationWidth  = scc.VisualisationWidth;
            cf.VisualisationHeight = scc.VisualisationHeight;
            cf.VisualisationDepth  = scc.VisualisationDepth;
        }
        public void Serialize(string serializedObjectPath, CreationConfiguration cf)
        {
            VisualisationType = cf.VisualisationType.ToString();

            //hacky, needed to serialize DimensionFilters objects
            if (cf.parallelCoordinatesDimensions != null)
            {
                parallelCoordinatesDimensionsAttributes = new string[cf.parallelCoordinatesDimensions.Length];
                parallelCoordinatesDimensionsMinFilter  = new float[cf.parallelCoordinatesDimensions.Length];
                parallelCoordinatesDimensionsMaxFilter  = new float[cf.parallelCoordinatesDimensions.Length];
                parallelCoordinatesDimensionsMinScale   = new float[cf.parallelCoordinatesDimensions.Length];
                parallelCoordinatesDimensionsMaxScale   = new float[cf.parallelCoordinatesDimensions.Length];

                for (int i = 0; i < parallelCoordinatesDimensionsAttributes.Length; i++)
                {
                    parallelCoordinatesDimensionsAttributes[i] = cf.parallelCoordinatesDimensions[i].Attribute;
                    parallelCoordinatesDimensionsMinFilter[i]  = cf.parallelCoordinatesDimensions[i].minFilter;
                    parallelCoordinatesDimensionsMaxFilter[i]  = cf.parallelCoordinatesDimensions[i].maxFilter;
                    parallelCoordinatesDimensionsMinScale[i]   = cf.parallelCoordinatesDimensions[i].minScale;
                    parallelCoordinatesDimensionsMaxScale[i]   = cf.parallelCoordinatesDimensions[i].maxScale;
                }
            }

            Geometry    = cf.Geometry;
            AxiesKeys   = cf.Axies.Keys.ToArray();
            AxiesValues = cf.Axies.Values.ToArray();

            ColourDimension  = cf.ColourDimension;
            SizeDimension    = cf.SizeDimension;
            LinkingDimension = cf.LinkingDimension;

            colourKeys = cf.colourKeys;
            colour     = cf.colour;

            Size    = cf.Size;
            MinSize = cf.MinSize;
            MaxSize = cf.MaxSize;

            VisualisationWidth  = cf.VisualisationWidth;
            VisualisationHeight = cf.VisualisationHeight;
            VisualisationDepth  = cf.VisualisationDepth;

            File.WriteAllText(serializedObjectPath, JsonUtility.ToJson(this));
        }
Exemplo n.º 4
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);
        }
        public override void CreateVisualisation()
        {
            viewList.Clear();
            destroyView();

            //TODO: not optimal - destroying all the axes when creating the new visualisation again...
            for (int i = 0; i < 64; i++)
            {
                for (int j = 0; j < 64; j++)
                {
                    for (int k = 0; k < 64; k++)
                    {
                        //    if (i != j)//
                        if (AxisHolder[i, j, k] != null)
                        {
                            foreach (var item in AxisHolder[i, j, k])
                            {
                                DestroyImmediate(item.gameObject);
                            }
                            AxisHolder[i, j, k] = null;
                        }
                        #region to test again
                        //if (AxisHolder[i, j, k] != null &&
                        //    (AxisHolder[i, j, k][0].GetComponent<Axis>().axisId != i ||
                        //    AxisHolder[i, j, k][1].GetComponent<Axis>().axisId != j))
                        ////AxisHolder[i, j, k][2].GetComponent<Axis>().axisId != k))
                        //{
                        //    foreach (var item in AxisHolder[i, j, k])
                        //    {
                        //        DestroyImmediate(item.gameObject);
                        //    }
                        //    AxisHolder[i, j, k] = null;
                        //}

                        //if (((k * AxisHolder.Length * AxisHolder.Length) + (j * AxisHolder.Length) + i) > viewList.Count && AxisHolder[i, j, k] != null)
                        //{
                        //    foreach (var item in AxisHolder[i, j, k])
                        //    {
                        //        DestroyImmediate(item.gameObject);
                        //    }
                        //    AxisHolder[i, j, k] = null;
                        //}
                        #endregion
                    }
                }
            }

            if (creationConfiguration == null)
            {
                creationConfiguration = new CreationConfiguration(visualisationReference.geometry, new Dictionary <CreationConfiguration.Axis, string>());
            }
            else
            {
                creationConfiguration.Geometry          = visualisationReference.geometry;
                creationConfiguration.Axies             = new Dictionary <CreationConfiguration.Axis, string>();
                creationConfiguration.VisualisationType = AbstractVisualisation.VisualisationTypes.SCATTERPLOT_MATRIX;
            }

            if (visualisationReference.zScatterplotMatrixDimensions.Length > 0)
            {
                for (int i = 0; i < visualisationReference.xScatterplotMatrixDimensions.Length; i++)
                {
                    for (int j = 0; j < visualisationReference.yScatterplotMatrixDimensions.Length; j++)
                    {
                        for (int k = 0; k < visualisationReference.zScatterplotMatrixDimensions.Length; k++)
                        {
                            if (!(i == j && j == k && i == k))
                            {
                                if (visualisationReference.xScatterplotMatrixDimensions[i] != null &&
                                    visualisationReference.yScatterplotMatrixDimensions[j] != null &&
                                    visualisationReference.zScatterplotMatrixDimensions[k] != null)
                                {
                                    Create3DVisualisation(i, j, k);

                                    Vector3 posX = new Vector3(i * xPadding, j * yPadding - 0.05f, k * zPadding);
                                    Vector3 posY = new Vector3(i * xPadding - 0.05f, j * yPadding, k * zPadding);
                                    Vector3 posZ = new Vector3(i * xPadding - 0.05f, j * yPadding - 0.05f, k * zPadding);

                                    List <GameObject> localList = new List <GameObject>
                                    {
                                        CreateAxis(PropertyType.X,
                                                   visualisationReference.xScatterplotMatrixDimensions[i],
                                                   posX,
                                                   new Vector3(0f, 0f, -90f), i
                                                   ),

                                        CreateAxis(
                                            PropertyType.Y,
                                            visualisationReference.yScatterplotMatrixDimensions[j],
                                            posY,
                                            new Vector3(0f, 0f, 0f), j),

                                        CreateAxis(
                                            PropertyType.Z,
                                            visualisationReference.zScatterplotMatrixDimensions[k],
                                            posZ,
                                            new Vector3(90f, 0f, 0f), k)
                                    };

                                    AxisHolder[i, j, k] = localList;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                for (int i = 0; i < visualisationReference.xScatterplotMatrixDimensions.Length; i++)
                {
                    for (int j = 0; j < visualisationReference.yScatterplotMatrixDimensions.Length; j++)
                    {
                        if (i != j)
                        {
                            if (visualisationReference.xScatterplotMatrixDimensions[i] != null &&
                                visualisationReference.yScatterplotMatrixDimensions[j] != null)
                            {
                                Create2DVisualisation(i, j);

                                Vector3 posX = new Vector3(i * xPadding, j * yPadding - 0.05f, 0);
                                Vector3 posY = new Vector3(i * xPadding - 0.05f, j * yPadding, 0);

                                List <GameObject> localList = new List <GameObject>
                                {
                                    CreateAxis(PropertyType.X,
                                               visualisationReference.xScatterplotMatrixDimensions[i],
                                               posX,
                                               new Vector3(0f, 0f, -90f), i
                                               ),

                                    CreateAxis(
                                        PropertyType.Y,
                                        visualisationReference.yScatterplotMatrixDimensions[j],
                                        posY,
                                        new Vector3(0f, 0f, 0f), j)
                                };

                                AxisHolder[i, j, 0] = localList;
                            }
                        }
                    }
                }
            }

            if (viewList.Count > 0)
            {
                UpdateVisualisation(PropertyType.Colour);
                UpdateVisualisation(PropertyType.Size);
                UpdateVisualisation(PropertyType.SizeValues);
            }
        }
Exemplo n.º 6
0
        public override void CreateVisualisation()
        {
            string savedName = name;

            foreach (View v in viewList)
            {
                DestroyImmediate(v.gameObject);
            }

            viewList.Clear();

            // Create new
            Dictionary <CreationConfiguration.Axis, string> axies = new Dictionary <CreationConfiguration.Axis, string>();

            if (visualisationReference.xDimension.Attribute != "" && visualisationReference.xDimension.Attribute != "Undefined")
            {
                axies.Add(CreationConfiguration.Axis.X, visualisationReference.xDimension.Attribute);
            }
            if (visualisationReference.yDimension.Attribute != "" && visualisationReference.yDimension.Attribute != "Undefined")
            {
                axies.Add(CreationConfiguration.Axis.Y, visualisationReference.yDimension.Attribute);
            }
            if (visualisationReference.zDimension.Attribute != "" && visualisationReference.zDimension.Attribute != "Undefined")
            {
                axies.Add(CreationConfiguration.Axis.Z, visualisationReference.zDimension.Attribute);
            }

            // Create the configuration object
            if (creationConfiguration == null)
            {
                creationConfiguration = new CreationConfiguration(visualisationReference.geometry, axies);
            }
            else
            {
                creationConfiguration.Axies            = axies;
                creationConfiguration.Geometry         = visualisationReference.geometry;
                creationConfiguration.LinkingDimension = visualisationReference.linkingDimension;
                creationConfiguration.Size             = visualisationReference.size;
                creationConfiguration.MinSize          = visualisationReference.minSize;
                creationConfiguration.MaxSize          = visualisationReference.maxSize;
                creationConfiguration.colour           = visualisationReference.colour;
            }

            View view = CreateSimpleVisualisation(creationConfiguration);

            if (view != null)
            {
                view.transform.localPosition = Vector3.zero;
                view.transform.SetParent(transform, false);
                view.onViewChangeEvent += UpdateVisualisation;   // Receive notifications when the view configuration changes

                viewList.Add(view);
            }

            if (viewList.Count > 0 && visualisationReference.colourDimension != "Undefined")
            {
                for (int i = 0; i < viewList.Count; i++)
                {
                    viewList[i].SetColors(mapColoursContinuous(visualisationReference.dataSource[visualisationReference.colourDimension].Data));
                }
            }
            else if (viewList.Count > 0 && visualisationReference.colorPaletteDimension != "Undefined")
            {
                for (int i = 0; i < viewList.Count; i++)
                {
                    viewList[i].SetColors(mapColoursPalette(visualisationReference.dataSource[visualisationReference.colorPaletteDimension].Data, visualisationReference.coloursPalette));
                }
            }
            else if (viewList.Count > 0 && visualisationReference.colour != null)
            {
                for (int i = 0; i < viewList.Count; i++)
                {
                    Color[] colours = viewList[i].GetColors();
                    for (int j = 0; j < colours.Length; ++j)
                    {
                        colours[j] = visualisationReference.colour;
                    }
                    viewList[i].SetColors(colours);
                }
            }


            if (viewList.Count > 0)
            {
                for (int i = 0; i < viewList.Count; i++)
                {
                    viewList[i].SetSize(visualisationReference.size);
                    viewList[i].SetMinSize(visualisationReference.minSize);
                    viewList[i].SetMaxSize(visualisationReference.maxSize);

                    viewList[i].SetMinNormX(visualisationReference.xDimension.minScale);
                    viewList[i].SetMaxNormX(visualisationReference.xDimension.maxScale);
                    viewList[i].SetMinNormY(visualisationReference.yDimension.minScale);
                    viewList[i].SetMaxNormY(visualisationReference.yDimension.maxScale);
                    viewList[i].SetMinNormZ(visualisationReference.zDimension.minScale);
                    viewList[i].SetMaxNormZ(visualisationReference.zDimension.maxScale);

                    viewList[i].SetMinX(visualisationReference.xDimension.minFilter);
                    viewList[i].SetMaxX(visualisationReference.xDimension.maxFilter);
                    viewList[i].SetMinY(visualisationReference.yDimension.minFilter);
                    viewList[i].SetMaxY(visualisationReference.yDimension.maxFilter);
                    viewList[i].SetMinZ(visualisationReference.zDimension.minFilter);
                    viewList[i].SetMaxZ(visualisationReference.zDimension.maxFilter);
                }
            }

            if (viewList.Count > 0 && visualisationReference.sizeDimension != "Undefined")
            {
                for (int i = 0; i < viewList.Count; i++)
                {
                    viewList[i].SetSizeChannel(visualisationReference.dataSource[visualisationReference.sizeDimension].Data);
                }
            }

            name = savedName;
        }
Exemplo n.º 7
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);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// returns a View with the specific geometry configuration
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="builder"></param>
        /// <returns></returns>
        protected View ApplyGeometryAndRendering(CreationConfiguration configuration, ref ViewBuilder builder)
        {
            Material mt = null;

            switch (configuration.Geometry)
            {
            case AbstractVisualisation.GeometryType.Undefined:
                return(null);

            case AbstractVisualisation.GeometryType.Points:
                builder.createIndicesPointTopology();
                mt             = new Material(Shader.Find("IATK/OutlineDots"));
                mt.mainTexture = Resources.Load("circle-outline-basic") as Texture2D;
                mt.renderQueue = 3000;
                return(builder.updateView().
                       apply(gameObject, mt));

            case AbstractVisualisation.GeometryType.Lines:
                if (visualisationReference.linkingDimension == "Undefined")
                {
                    throw new UnityException("The linking field 'Linkinfield' is undefined. Please select a linking field");
                }
                builder.createIndicesLinkedTopology(visualisationReference.dataSource[visualisationReference.linkingDimension].Data, visualisationReference.dataSource[visualisationReference.xDimension.Attribute].Data);
                mt             = new Material(Shader.Find("IATK/LinesShader"));
                mt.renderQueue = 3000;
                return(builder.updateView().
                       apply(gameObject, mt));

            case AbstractVisualisation.GeometryType.Quads:
                builder.createIndicesPointTopology();
                mt             = new Material(Shader.Find("IATK/Quads"));
                mt.renderQueue = 3000;
                return(builder.updateView().
                       apply(gameObject, mt));

            case AbstractVisualisation.GeometryType.LinesAndDots:

                if (visualisationReference.linkingDimension == "Undefined")
                {
                    throw new UnityException("The linking field 'Linkinfield' is undefined. Please select a linking field");
                }
                builder.createIndicesLinkedTopology(visualisationReference.dataSource[visualisationReference.linkingDimension].Data, visualisationReference.dataSource[visualisationReference.xDimension.Attribute].Data);
                mt             = new Material(Shader.Find("IATK/LineAndDotsShader"));
                mt.renderQueue = 3000;
                return(builder.updateView().
                       apply(gameObject, mt));

            case AbstractVisualisation.GeometryType.Cubes:
                builder.createIndicesPointTopology();     // createIndicesLinkedTopology(dataSource[linkingDimension].Data);
                mt             = new Material(Shader.Find("IATK/CubeShader"));
                mt.renderQueue = 3000;
                return(builder.updateView().
                       apply(gameObject, mt));

            case AbstractVisualisation.GeometryType.Bars:
                builder.createIndicesPointTopology();     // createIndicesLinkedTopology(dataSource[linkingDimension].Data);
                mt             = new Material(Shader.Find("IATK/BarShader"));
                mt.renderQueue = 3000;

                return(builder.updateView().
                       apply(gameObject, mt));

            case AbstractVisualisation.GeometryType.Spheres:
                builder.createIndicesPointTopology();     // createIndicesLinkedTopology(dataSource[linkingDimension].Data);
                mt             = new Material(Shader.Find("IATK/SphereShader"));
                mt.mainTexture = Resources.Load("sphere-texture") as Texture2D;
                mt.renderQueue = 3000;
                return(builder.updateView().
                       apply(gameObject, mt));

            default:
                return(null);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// returns a View with the specific geometry configuration
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="builder"></param>
        /// <returns></returns>
        protected View ApplyGeometryAndRendering(CreationConfiguration configuration, ref ViewBuilder builder)
        {
            Material mt = null;

            switch (configuration.Geometry)
            {
            case AbstractVisualisation.GeometryType.Undefined:
                return(null);

            case AbstractVisualisation.GeometryType.Points:
                builder.createIndicesPointTopology();
                mt                  = new Material(Shader.Find("IATK/OutlineDots"));
                mt.mainTexture      = Resources.Load("circle-outline-basic") as Texture2D;
                mt.renderQueue      = 3000;
                mt.enableInstancing = true;
                return(builder.updateView().
                       apply(gameObject, mt));

            case AbstractVisualisation.GeometryType.Lines:
                if (visualisationReference.graphDimension != "Undefined")
                {
                    CSVDataSource csvds = (CSVDataSource)(visualisationReference.dataSource);
                    builder.createIndicesGraphTopology(csvds.GraphEdges);
                    mt                  = new Material(Shader.Find("IATK/LinesShader"));
                    mt.renderQueue      = 3000;
                    mt.enableInstancing = true;
                    return(builder.updateView().
                           apply(gameObject, mt));
                }
                else
                if (visualisationReference.linkingDimension != "Undefined")
                {
                    builder.createIndicesConnectedLineTopology(visualisationReference.dataSource[visualisationReference.linkingDimension].Data);
                    mt                  = new Material(Shader.Find("IATK/LinesShader"));
                    mt.renderQueue      = 3000;
                    mt.enableInstancing = true;
                    return(builder.updateView().
                           apply(gameObject, mt));
                }
                else
                {
                    throw new UnityException("'Linkinfield' or 'GraphDimension' is undefined. Please select a linking field or a graph dimension");
                }
                break;

            case AbstractVisualisation.GeometryType.Quads:
                builder.createIndicesPointTopology();
                mt                  = new Material(Shader.Find("IATK/Quads"));
                mt.renderQueue      = 3000;
                mt.enableInstancing = true;
                return(builder.updateView().
                       apply(gameObject, mt));

            case AbstractVisualisation.GeometryType.LinesAndDots:
                if (visualisationReference.graphDimension != "Undefined")
                {
                    CSVDataSource csvds = (CSVDataSource)(visualisationReference.dataSource);
                    builder.createIndicesGraphTopology(csvds.GraphEdges);
                    mt                  = new Material(Shader.Find("IATK/LineAndDotsShader"));
                    mt.renderQueue      = 3000;
                    mt.enableInstancing = true;
                    return(builder.updateView().
                           apply(gameObject, mt));
                }
                if (visualisationReference.linkingDimension != "Undefined")
                {
                    builder.createIndicesConnectedLineTopology(visualisationReference.dataSource[visualisationReference.linkingDimension].Data);
                    mt                  = new Material(Shader.Find("IATK/LineAndDotsShader"));
                    mt.renderQueue      = 3000;
                    mt.enableInstancing = true;
                    return(builder.updateView().
                           apply(gameObject, mt));
                }
                else
                {
                    throw new UnityException("'Linkinfield' or 'GraphDimension' is undefined. Please select a linking field or a graph dimension");
                }


            case AbstractVisualisation.GeometryType.Cubes:
                builder.createIndicesPointTopology();     // createIndicesLinkedTopology(dataSource[linkingDimension].Data);
                mt                  = new Material(Shader.Find("IATK/CubeShader"));
                mt.renderQueue      = 3000;
                mt.enableInstancing = true;
                return(builder.updateView().
                       apply(gameObject, mt));

            case AbstractVisualisation.GeometryType.Bars:
                builder.createIndicesPointTopology();     // createIndicesLinkedTopology(dataSource[linkingDimension].Data);
                mt                  = new Material(Shader.Find("IATK/BarShader"));
                mt.renderQueue      = 3000;
                mt.enableInstancing = true;
                return(builder.updateView().
                       apply(gameObject, mt));

            case AbstractVisualisation.GeometryType.Spheres:
                builder.createIndicesPointTopology();     // createIndicesLinkedTopology(dataSource[linkingDimension].Data);
                mt                  = new Material(Shader.Find("IATK/SphereShader"));
                mt.mainTexture      = Resources.Load("sphere-texture") as Texture2D;
                mt.renderQueue      = 3000;
                mt.enableInstancing = true;
                return(builder.updateView().
                       apply(gameObject, mt));

            default:
                return(null);
            }
        }