示例#1
0
        private GameObject CreateCloudPoint(List <float[]> collumnDataList, string file_path = null, bool isJSON = false, string json_path = null, int SMAPcolorcolumn = 100, bool isSMAP = false)
        {
            GameObject container = Instantiate(_cloudPointPrefab) as GameObject;      /// GameObject that is the parent of the CloudPoint (used for CloudParent offset)
            GameObject root      = container.transform.Find("CloudPoint").gameObject; /// GameObject where the mesh will be displayed

            // Init Cloud Status and references
            CloudData rootdata = root.GetComponent <CloudData>();

            rootdata.columnData = collumnDataList;

            if (isJSON && json_path != null)
            {
                LoadJSON(json_path, rootdata);
            }
            else
            {
                int[] intarray = new int[9] {
                    0, 0, 0, 0, 0, 0, 0, 0, 0
                };
                for (int i = 0; i < collumnDataList.Count; i++)
                {
                    if (i < intarray.Length)
                    {
                        intarray[i] = i;
                    }
                }

                rootdata.globalMetaData.displayCollumnsConfiguration = intarray;

                /**
                 * Vincent Casamayou 13/05/2020 - SMAP COMMUNICATION
                 * - Affect Color Coding to the specified Column in SMAP
                 * - Add a display/hide bool to the data table for each point
                 **/

                if (SMAPcolorcolumn != 100)
                {
                    rootdata.globalMetaData.displayCollumnsConfiguration[3] = SMAPcolorcolumn;
                }

                rootdata.globalMetaData.displayCollumnsConfiguration[8] = 5;
            }
            for (int i = 0; i < collumnDataList[0].Length; i++)
            {
                rootdata.CreatePointData(i, Vector3.zero, Vector3.zero, 0f, 0f, 0f, Color.black, 0f);

                rootdata.CreatePointMetaData(i, 0);
            }

            LoadCloudData(rootdata, file_path, isJSON, isSMAP);

            root.name = "CloudPoint";
            root.transform.position   = container.transform.position;
            root.transform.localScale = new Vector3(1, 1, 1);

            CloudBox box = root.AddComponent <CloudBox>();

            box.Activate();


            container.GetComponent <CloudObjectRefference>().cloud = root;
            return(root);
        }
示例#2
0
        private GameObject CreateCloudPoint(List <float[]> columnDataList, string file_path = null, bool isJSON = false, string json_path = null)
        {
            GameObject container = Instantiate(_cloudPointPrefab) as GameObject;      /// GameObject that is the parent of the CloudPoint (used for CloudParent offset)
            GameObject root      = container.transform.Find("CloudPoint").gameObject; /// GameObject where the mesh will be displayed

            // Init Cloud Status and references
            CloudData rootdata = root.GetComponent <CloudData>();

            rootdata.columnData = columnDataList;

            if (isJSON && json_path != null)
            {
                LoadJSON(json_path, rootdata);
            }
            else
            {
                int[] intarray = new int[9] {
                    0, 0, 0, 0, 0, 0, 0, 0, 0
                };
                for (int i = 0; i < columnDataList.Count; i++)
                {
                    if (i < intarray.Length)
                    {
                        intarray[i] = i;
                    }
                }

                rootdata.globalMetaData.displayCollumnsConfiguration = intarray;
            }

            for (int j = 0; j < columnDataList.Count; j++)
            {
                ColumnMetadata metadata = new ColumnMetadata();
                metadata.ColumnID     = j;
                metadata.MinValue     = Mathf.Infinity;
                metadata.MaxValue     = Mathf.NegativeInfinity;
                metadata.Range        = 0;
                metadata.MinThreshold = 0;
                metadata.MaxThreshold = 0;
                rootdata.globalMetaData.columnMetaDataList.Add(metadata);
            }

            for (int i = 0; i < columnDataList[0].Length; i++)
            {
                rootdata.CreatePointData(i, Vector3.zero, Vector3.zero, 0f, 0f, 0f, Color.black, 0f);

                rootdata.CreatePointMetaData(i, 0);

                for (int j = 0; j < columnDataList.Count; j++)
                {
                    float nbr = columnDataList[j][i];
                    if (nbr < rootdata.globalMetaData.columnMetaDataList[j].MinValue)
                    {
                        rootdata.globalMetaData.columnMetaDataList[j].MinValue = nbr;
                    }

                    if (nbr > rootdata.globalMetaData.columnMetaDataList[j].MaxValue)
                    {
                        rootdata.globalMetaData.columnMetaDataList[j].MaxValue = nbr;
                    }
                }
                foreach (ColumnMetadata md in rootdata.globalMetaData.columnMetaDataList)
                {
                    md.MaxThreshold = md.MaxValue;
                    md.MinThreshold = md.MinValue;
                    md.Range        = md.MaxValue - md.MinValue;
                }
            }

            LoadCloudData(rootdata, file_path, isJSON);

            root.name = "CloudPoint";
            root.transform.position   = container.transform.position;
            root.transform.localScale = new Vector3(1, 1, 1);

            CloudBox box = root.AddComponent <CloudBox>();

            box.Activate();


            container.GetComponent <CloudObjectRefference>().cloud = root;
            return(root);
        }