/// <summary> /// Serializes the configuration /// </summary> /// <param name="pathObjectToSerialize"></param> public void Serialize(string pathObjectToSerialize) { if (!disableWriting) { SerializableCreationConfiguration scc = new SerializableCreationConfiguration(); scc.Serialize(pathObjectToSerialize, this); } }
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; }
/// <summary> /// Deserialize the configuration /// </summary> /// <param name="pathObjectToSerialize"></param> public void Deserialize(string pathObjectToSerialize) { SerializableCreationConfiguration scc = new SerializableCreationConfiguration(); scc.DeSerialize(pathObjectToSerialize, this); }