Esempio n. 1
0
        public void LoadFromConnection(List <float[]> columnDataList)
        {
            savedata = null;
            //window = ModalWindowManager.instance.CreateModalWindow("Loading the cloud, please wait...");

            foreach (float[] i in columnDataList)
            {
                foreach (float pointvalue in i)
                {
                    if (!(pointvalue.GetType() == typeof(float)))
                    {
                        ModalWindowManager.instance.CreateModalWindow("ERROR : Data number format is not float, data not loaded");
                        UIManager.instance.ChangeStatusText("ERROR : Data number format can't be translated to float");
                        return;
                    }
                }
            }
            GameObject cloud = CreateCloudPoint(columnDataList);

            PutInMemory(cloud);
            //Destroy(window);
            CloudSelector.instance.UpdateSelection(cloud.GetComponent <CloudData>().globalMetaData.cloud_id);

            //OnCloudCreated(cloud.GetComponent<CloudData>().globalMetaData.cloud_id);
        }
Esempio n. 2
0
        public void LoadFromFile(string file_path)
        {
            savedata = null;
            bool   isJSON;
            string directory = Path.GetDirectoryName(file_path);
            string filename  = Path.GetFileNameWithoutExtension(file_path);
            string jsonpath  = directory + Path.DirectorySeparatorChar + filename + ".JSON";

            if (File.Exists(jsonpath))
            {
                isJSON = true;
            }
            else
            {
                isJSON = false;
            }

            string[] lines = File.ReadAllLines(file_path);
            int      N     = lines.Length;

            List <float[]> collumnDataList = new List <float[]>();

            int columnNumber = lines[0].Split('\t').Length;

            for (int i = 0; i < columnNumber; i++)
            {
                collumnDataList.Add(new float[N]);
            }
            for (int j = 0; j < lines.Length; j++)
            {
                string[] entries = lines[j].Split('\t');
                for (int k = 0; k < entries.Length; k++)
                {
                    collumnDataList[k][j] = Single.Parse(entries[k], System.Globalization.NumberStyles.Any, CultureInfo.InvariantCulture);
                }
            }

            GameObject cloud = CreateCloudPoint(collumnDataList, file_path, isJSON, jsonpath);

            PutInMemory(cloud);

            if (isJSON)
            {
                CreateSubGameObjects(cloud.GetComponent <CloudData>());
            }

            Destroy(window);

            CloudSelector.instance.UpdateSelection(cloud.GetComponent <CloudData>().globalMetaData.cloud_id);

            //OnCloudCreated(cloud.GetComponent<CloudData>().globalMetaData.cloud_id);
        }
Esempio n. 3
0
        public void SaveJSON(string path)
        {
            CloudData         data      = CloudUpdater.instance.LoadCurrentStatus();
            CloudSaveableData savedata  = new CloudSaveableData(data);
            string            JSON      = JsonUtility.ToJson(savedata);
            string            directory = Path.GetDirectoryName(path);
            string            filename  = Path.GetFileNameWithoutExtension(path);

            using (System.IO.StreamWriter writer = new System.IO.StreamWriter(directory + Path.DirectorySeparatorChar + filename + ".JSON"))
            {
                writer.WriteLine(JSON);
            }
        }
Esempio n. 4
0
        public void LoadFromRawData(List <float[]> columnDataList)
        {
            savedata = null;
            //window = ModalWindowManager.instance.CreateModalWindow("Loading the cloud, please wait...",false);

            GameObject cloud = CreateCloudPoint(columnDataList);

            PutInMemory(cloud);
            Destroy(window);
            CloudSelector.instance.UpdateSelection(cloud.GetComponent <CloudData>().globalMetaData.cloud_id);

            //OnCloudCreated(cloud.GetComponent<CloudData>().globalMetaData.cloud_id);
        }
Esempio n. 5
0
        public void LoadJSON(string path, CloudData data)
        {
            string[] json = File.ReadAllLines(path);
            savedata = JsonUtility.FromJson <CloudSaveableData>(json[0]);

            //data.pointMetaDataTable = savedata.pointMetaDataTable;
            data.globalMetaData.displayCollumnsConfiguration = savedata.displayCollumnsConfiguration;
            data.globalMetaData.colormapName              = savedata.colormapName;
            data.globalMetaData.colormapReversed          = savedata.colormapReversed;
            data.globalMetaData.current_colormap_variable = savedata.currentColormapVariable;
            data.globalMetaData.current_normed_variable   = savedata.currentNormedVariable;
            data.globalMetaData.point_size          = savedata.pointSize;
            data.globalMetaData.scale               = savedata.scale;
            data.globalMetaData.fileName            = savedata.fileName;
            data.globalMetaData.pointbyLocationList = savedata.pointsByLocationDict;
        }
Esempio n. 6
0
        public void LoadFromConnection(List <float[]> collumnDataList, int SMAPColorField)
        {
            savedata = null;
            window   = ModalWindowManager.instance.CreateModalWindow("Loading the cloud, please wait...");

            foreach (float[] i in collumnDataList)
            {
                foreach (float pointvalue in i)
                {
                    if (!(pointvalue.GetType() == typeof(float)))
                    {
                        ModalWindowManager.instance.CreateModalWindow("ERROR : Data number format is not float");
                        return;
                    }
                }
            }
            GameObject cloud = CreateCloudPoint(collumnDataList, SMAPcolorcolumn: SMAPColorField, isSMAP: true);

            PutInMemory(cloud);
            Destroy(window);
            //OnCloudCreated(cloud.GetComponent<CloudData>().globalMetaData.cloud_id);
        }