public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { int independentVariable = info.GetInt32("IndependentVariable"); int dependentVariable = info.GetInt32("DependentVariable"); double[] parameter; info.GetArray("ParameterValues",out parameter); object fo = info.GetValue("FitFunction"); if( fo is Altaxo.Serialization.Xml.AssemblyAndTypeSurrogate) fo = ((Altaxo.Serialization.Xml.AssemblyAndTypeSurrogate)fo).CreateInstance(); FitFunctionToScalarFunctionDDWrapper s; if(o == null) { s = new FitFunctionToScalarFunctionDDWrapper(fo as IFitFunction,dependentVariable,independentVariable,parameter); } else { s = (FitFunctionToScalarFunctionDDWrapper)o; s = (FitFunctionToScalarFunctionDDWrapper)o; s._independentVariable = independentVariable; s._dependentVariable = dependentVariable; s._parameter = parameter; s._fitFunction = fo as IFitFunction; } return s; }
public virtual object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { ProductFunction s = null != o ? (ProductFunction)o : new ProductFunction(); info.GetArray("Coefficients", out s._coefficients); int cnt = info.OpenArray(); s._functions = new Altaxo.Calc.IScalarFunctionDD[cnt]; for (int i = 0; i < cnt; i++) s._functions[i] = (Altaxo.Calc.IScalarFunctionDD)info.GetValue("e", parent); info.CloseArray(cnt); return s; }
public virtual object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { PolynomialFunction s = null != o ? (PolynomialFunction)o : new PolynomialFunction(); info.GetArray("Coefficients", out s._coefficients); return s; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { Altaxo.Data.DoubleColumn s = null != o ? (Altaxo.Data.DoubleColumn)o : new Altaxo.Data.DoubleColumn(); // deserialize the base class info.GetBaseValueEmbedded(s, typeof(Altaxo.Data.DataColumn), parent); int count = info.GetInt32Attribute("Count"); s._data = new double[count]; info.GetArray(s._data, count); s._capacity = null == s._data ? 0 : s._data.Length; s._count = s._capacity; return s; }
public virtual object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { FitElement s = o != null ? (FitElement)o : new FitElement(); s.ChildSetMemberAlt(ref s._fitFunction, (IFitFunction)info.GetValue("FitFunction", s)); int numRows = info.GetInt32("NumberOfRows"); int firstRow = info.GetInt32("FirstRow"); s._rangeOfRows = RangeOfRowIndices.FromStartAndCount(firstRow, numRows); if (null != s._rangeOfRows) s._rangeOfRows.ParentObject = s; int arraycount = info.OpenArray(); s._independentVariables = new IReadableColumnProxy[arraycount]; for (int i = 0; i < arraycount; ++i) { s._independentVariables[i] = (IReadableColumnProxy)info.GetValue("e", s); if (null != s._independentVariables[i]) s._independentVariables[i].ParentObject = s; } info.CloseArray(arraycount); arraycount = info.OpenArray(); s._dependentVariables = new IReadableColumnProxy[arraycount]; for (int i = 0; i < arraycount; ++i) { s._dependentVariables[i] = (IReadableColumnProxy)info.GetValue("e", s); if (null != s._dependentVariables[i]) s._dependentVariables[i].ParentObject = s; } info.CloseArray(arraycount); arraycount = info.OpenArray(); s._errorEvaluation = new IVarianceScaling[arraycount]; for (int i = 0; i < arraycount; ++i) s._errorEvaluation[i] = (IVarianceScaling)info.GetValue("e", s); info.CloseArray(arraycount); info.GetArray("ParameterNames", out s._parameterNames); for (int i = 0; i < s._parameterNames.Length; ++i) if (s._parameterNames[i] == string.Empty) s._parameterNames[i] = null; // serialization can not distinguish between an empty string and a null string s._parameterNameStart = info.GetString("ParameterNameStart"); // now some afterwork if (s.InternalCheckAndCorrectArraySize(false, false)) Current.Console.WriteLine("Error: Fitelement array size mismatch"); return s; }
public virtual object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { FitElement s = o!=null ? (FitElement)o : new FitElement(); s.FitFunction = (IFitFunction)info.GetValue("FitFunction",s); int numRows = info.GetInt32("NumberOfRows"); int firstRow = info.GetInt32("FirstRow"); s._rangeOfRows = PositiveIntegerRange.NewFromFirstAndCount(firstRow,numRows); int arraycount = info.OpenArray(); s._independentVariables = new NumericColumnProxy[arraycount]; for(int i=0;i<arraycount;++i) s._independentVariables[i] = (NumericColumnProxy)info.GetValue(s); info.CloseArray(arraycount); arraycount = info.OpenArray(); s._dependentVariables = new NumericColumnProxy[arraycount]; for(int i=0;i<arraycount;++i) s._dependentVariables[i] = (NumericColumnProxy)info.GetValue(s); info.CloseArray(arraycount); arraycount = info.OpenArray(); s._errorEvaluation = new IVarianceScaling[arraycount]; for(int i=0;i<arraycount;++i) s._errorEvaluation[i] = (IVarianceScaling)info.GetValue(s); info.CloseArray(arraycount); info.GetArray("ParameterNames",out s._parameterNames); for(int i=0;i<s._parameterNames.Length;++i) if(s._parameterNames[i]==string.Empty) s._parameterNames[i]=null; // serialization can not distinguish between an empty string and a null string s._parameterNameStart = info.GetString("ParameterNameStart"); return s; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { PenX s = null != o ? (PenX)o : new PenX(); s._configuredProperties = (Configured)info.GetInt32("Configured"); Configured cp = s._configuredProperties; if (0 != (cp & PenX.Configured.PenType)) s._penType = (PenType)info.GetEnum("Type", typeof(PenType)); else s._penType = PenType.SolidColor; if (0 != (cp & PenX.Configured.Alignment)) s._alignment = (PenAlignment)info.GetEnum("Alignment", typeof(PenAlignment)); else s._alignment = PenAlignment.Center; if (0 != (cp & PenX.Configured.Brush)) s._brush = (BrushX)info.GetValue("Brush", s); else s._brush = new BrushX(NamedColors.Black) { ParentObject = s }; if (0 != (cp & PenX.Configured.Color)) s._color = (NamedColor)info.GetValue("Color", s); else s._color = NamedColors.Black; if (0 != (cp & PenX.Configured.CompoundArray)) info.GetArray(out s._compoundArray); else s._compoundArray = new float[0]; if (0 != (cp & PenX.Configured.DashStyle)) s._cachedDashStyle = (DashStyle)info.GetEnum("DashStyle", typeof(DashStyle)); else s._cachedDashStyle = DashStyle.Solid; if (0 != (cp & PenX.Configured.DashCap)) s._dashCap = (DashCap)info.GetEnum("DashCap", typeof(DashCap)); else s._dashCap = DashCap.Flat; if (0 != (cp & PenX.Configured.DashOffset)) s._cachedDashOffset = (float)info.GetSingle("DashOffset"); else s._cachedDashOffset = 0; if (0 != (cp & PenX.Configured.DashPattern)) info.GetArray(out s._cachedDashPattern); else s._cachedDashPattern = null; s.SetDashPatternFromCachedDashPropertiesAfterOldDeserialization(); if (0 != (cp & PenX.Configured.EndCap)) { LineCap cap = (LineCap)info.GetEnum("EndCap", typeof(LineCap)); s._endCap = LineCapExtension.FromName(Enum.GetName(typeof(LineCap), cap)); } else s._endCap = LineCapExtension.Flat; if (0 != (cp & PenX.Configured.LineJoin)) s._lineJoin = (LineJoin)info.GetEnum("LineJoin", typeof(LineJoin)); else s._lineJoin = LineJoin.Miter; if (0 != (cp & PenX.Configured.MiterLimit)) s._miterLimit = info.GetSingle("MiterLimit"); else s._miterLimit = 10; if (0 != (cp & PenX.Configured.StartCap)) { LineCap cap = (LineCap)info.GetEnum("StartCap", typeof(LineCap)); s._startCap = LineCapExtension.FromName(Enum.GetName(typeof(LineCap), cap)); } else s._startCap = LineCapExtension.Flat; if (0 != (cp & PenX.Configured.Transform)) { float[] el; info.GetArray(out el); s._transformation = new Matrix(el[0], el[1], el[2], el[3], el[4], el[5]); } else s._transformation = new Matrix(); if (0 != (cp & PenX.Configured.Width)) s._width = info.GetDouble("Width"); else s._width = 1; if (s.ParentObject == null) s.ParentObject = (Main.IDocumentNode)parent; return s; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { PenX s = null != o ? (PenX)o : new PenX(); s._configuredProperties = (Configured)info.GetInt32("Configured"); Configured cp = s._configuredProperties; if (0 != (cp & PenX.Configured.PenType)) s._penType = (PenType)info.GetEnum("Type", typeof(PenType)); else s._penType = PenType.SolidColor; if (0 != (cp & PenX.Configured.Alignment)) s._alignment = (PenAlignment)info.GetEnum("Alignment", typeof(PenAlignment)); else s._alignment = PenAlignment.Center; if (0 != (cp & PenX.Configured.Brush)) s._brush = (BrushX)info.GetValue("Brush", s); else s._brush = new BrushX(NamedColors.Black); s._brush.ParentObject = s; if (0 != (cp & PenX.Configured.Color)) s._color = (NamedColor)info.GetValue("Color", s); else s._color = NamedColors.Black; if (0 != (cp & PenX.Configured.CompoundArray)) info.GetArray(out s._compoundArray); else s._compoundArray = new float[0]; if (info.CurrentElementName == "DashPattern") { s._dashPattern = (IDashPattern)info.GetValue("DashPattern", null); if (!Drawing.DashPatterns.Solid.Instance.Equals(s._dashPattern)) { if (0 != (cp & PenX.Configured.DashCap)) s._dashCap = (DashCap)info.GetEnum("DashCap", typeof(DashCap)); else s._dashCap = DashCap.Flat; } } s.SetCachedDashProperties(); if (0 != (cp & PenX.Configured.EndCap)) { string name = info.GetString("EndCap"); var absSize = info.GetDouble("EndCapAbsSize"); var relSize = info.GetDouble("EndCapRelSize"); s._endCap = LineCapExtension.FromNameAndAbsAndRelSize(name, absSize, relSize); } else s._endCap = LineCapExtension.Flat; if (0 != (cp & PenX.Configured.LineJoin)) s._lineJoin = (LineJoin)info.GetEnum("LineJoin", typeof(LineJoin)); else s._lineJoin = LineJoin.Miter; if (0 != (cp & PenX.Configured.MiterLimit)) s._miterLimit = info.GetSingle("MiterLimit"); else s._miterLimit = 10; if (0 != (cp & PenX.Configured.StartCap)) { string name = info.GetString("StartCap"); var absSize = info.GetDouble("StartCapAbsSize"); var relSize = info.GetDouble("StartCapRelSize"); s._startCap = LineCapExtension.FromNameAndAbsAndRelSize(name, absSize, relSize); } else s._startCap = LineCapExtension.Flat; if (0 != (cp & PenX.Configured.Transform)) { float[] el; info.GetArray(out el); s._transformation = new Matrix(el[0], el[1], el[2], el[3], el[4], el[5]); } else s._transformation = new Matrix(); if (0 != (cp & PenX.Configured.Width)) s._width = info.GetDouble("Width"); else s._width = 1; s.ParentObject = (Main.IDocumentNode)parent; return s; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { var s = (o == null ? new FixedColumnWidthWithTabSeparationStrategy() : (FixedColumnWidthWithTabSeparationStrategy)o); info.GetArray("StartPositions", out s._startPositions); s._tabSize = info.GetInt32("TabSize"); return s; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { MultivariateContentMemento s = null!=o ? (MultivariateContentMemento)o : new MultivariateContentMemento(); s.TableName = info.GetString("Name"); s.SpectrumIsRow = info.GetBoolean("SpectrumIsRow"); s.SpectralIndices = (IAscendingIntegerCollection)info.GetValue("SpectralIndices",s); s.ConcentrationIndices = (IAscendingIntegerCollection)info.GetValue("ConcentrationIndices",s); s.MeasurementIndices = (IAscendingIntegerCollection)info.GetValue("MeasurementIndices",s); s._PreferredNumberOfFactors = info.GetInt32("PreferredNumberOfFactors"); // new in version 1 int[] regions; info.GetArray("SpectralPreprocessingRegions", out regions); s._spectralPreprocessing.Regions = regions; s._spectralPreprocessing.Method = (SpectralPreprocessingMethod)info.GetEnum("SpectralPreprocessingMethod",typeof(SpectralPreprocessingMethod)); s._spectralPreprocessing.DetrendingOrder = info.GetInt32("SpectralPreprocessingDetrending"); s._spectralPreprocessing.EnsembleScale = info.GetBoolean("SpectralPreprocessingEnsembleScale"); // new in version 2 s._ClassNameOfAnalysisClass = info.GetString("ClassNameOfAnalysisClass"); return s; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { MultivariateContentMemento s = null != o ? (MultivariateContentMemento)o : new MultivariateContentMemento(); s.OriginalDataTableName = info.GetString("Name"); s.SpectrumIsRow = info.GetBoolean("SpectrumIsRow"); s.SpectralIndices = (IAscendingIntegerCollection)info.GetValue("SpectralIndices", s); s.ConcentrationIndices = (IAscendingIntegerCollection)info.GetValue("ConcentrationIndices", s); s.MeasurementIndices = (IAscendingIntegerCollection)info.GetValue("MeasurementIndices", s); s._PreferredNumberOfFactors = info.GetInt32("PreferredNumberOfFactors"); // new in version 1 int[] regions; info.GetArray("SpectralPreprocessingRegions", out regions); s._spectralPreprocessing.Regions = regions; s._spectralPreprocessing.Method = (SpectralPreprocessingMethod)info.GetEnum("SpectralPreprocessingMethod", typeof(SpectralPreprocessingMethod)); s._spectralPreprocessing.DetrendingOrder = info.GetInt32("SpectralPreprocessingDetrending"); s._spectralPreprocessing.EnsembleScale = info.GetBoolean("SpectralPreprocessingEnsembleScale"); // new in version 2 s._ClassNameOfAnalysisClass = info.GetString("ClassNameOfAnalysisClass"); // added fix after version 2 : forgotten to serialize crossPRESSCalculationType if (info.GetNodeName() == "CrossPRESSCalculationType") s._crossPRESSCalculationType = (CrossPRESSCalculationType)info.GetValue("CrossPRESSCalculationType", s); else s._crossPRESSCalculationType = CrossPRESSCalculationType.ExcludeGroupsOfSimilarMeasurements; return s; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { FitFunctionScript s = null != o ? (FitFunctionScript)o : new FitFunctionScript(); s._fitFunctionCategory = info.GetString("Category"); s._fitFunctionName = info.GetString("Name"); s._fitFunctionCreationTime = info.GetDateTime("CreationTime"); s._fitFunctionDescription = info.GetString("Description"); // deserialize the base class info.GetBaseValueEmbedded(s, typeof(AbstractScript), parent); s._NumberOfParameters = info.GetInt32("NumberOfParameters"); s._IsUsingUserDefinedParameterNames = info.GetBoolean("UserDefinedParameters"); if (s._IsUsingUserDefinedParameterNames) info.GetArray("UserDefinedParameterNames", out s._UserDefinedParameterNames); info.GetArray("IndependentVariableNames", out s._IndependentVariablesNames); info.GetArray("DependentVariableNames", out s._DependentVariablesNames); XmlSerializationSurrogate2 surr = new XmlSerializationSurrogate2(); surr._deserializedObject = s; info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.info_DeserializationFinished); return s; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { PenX s = null != o ? (PenX)o : new PenX(); s.m_ConfiguredProperties = (Configured)info.GetInt32("Configured"); Configured cp = s.m_ConfiguredProperties; if (0 != (cp & PenX.Configured.PenType)) s.m_PenType = (PenType)info.GetEnum("Type", typeof(PenType)); else s.m_PenType = PenType.SolidColor; if (0 != (cp & PenX.Configured.Alignment)) s.m_Alignment = (PenAlignment)info.GetEnum("Alignment", typeof(PenAlignment)); else s.m_Alignment = PenAlignment.Center; if (0 != (cp & PenX.Configured.Brush)) s.m_Brush = (BrushX)info.GetValue("Brush", typeof(BrushX)); else s.m_Brush = new BrushX(Color.Black); if (0 != (cp & PenX.Configured.Color)) s.m_Color = (Color)info.GetValue("Color", typeof(Color)); else s.m_Color = Color.Black; if (0 != (cp & PenX.Configured.CompoundArray)) info.GetArray(out s.m_CompoundArray); else s.m_CompoundArray = new float[0]; if (0 != (cp & PenX.Configured.DashStyle)) s.m_DashStyle = (DashStyle)info.GetEnum("DashStyle", typeof(DashStyle)); else s.m_DashStyle = DashStyle.Solid; if (0 != (cp & PenX.Configured.DashCap)) s.m_DashCap = (DashCap)info.GetEnum("DashCap", typeof(DashCap)); else s.m_DashCap = DashCap.Flat; if (0 != (cp & PenX.Configured.DashOffset)) s.m_DashOffset = (float)info.GetSingle("DashOffset"); else s.m_DashOffset = 0; if (0 != (cp & PenX.Configured.DashPattern)) info.GetArray(out s.m_DashPattern); else s.m_DashPattern = null; if (0 != (cp & PenX.Configured.EndCap)) { string name = info.GetString("EndCap"); float size = info.GetSingle("EndCapSize"); s.m_EndCap = new LineCapEx(name, size); } else s.m_EndCap = LineCapEx.Flat; if (0 != (cp & PenX.Configured.LineJoin)) s.m_LineJoin = (LineJoin)info.GetEnum("LineJoin", typeof(LineJoin)); else s.m_LineJoin = LineJoin.Miter; if (0 != (cp & PenX.Configured.MiterLimit)) s.m_MiterLimit = info.GetSingle("MiterLimit"); else s.m_MiterLimit = 10; if (0 != (cp & PenX.Configured.StartCap)) { string name = info.GetString("StartCap"); float size = info.GetSingle("StartCapSize"); s.m_StartCap = new LineCapEx(name, size); } else s.m_StartCap = LineCapEx.Flat; if (0 != (cp & PenX.Configured.Transform)) { float[] el; info.GetArray(out el); s.m_Transform = new Matrix(el[0], el[1], el[2], el[3], el[4], el[5]); } else s.m_Transform = new Matrix(); if (0 != (cp & PenX.Configured.Width)) s.m_Width = info.GetSingle("Width"); else s.m_Width = 1; return s; }