public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
 {
   
   float w = info.GetSingle("Width");
   float h = info.GetSingle("Height");
   return new SizeF(w,h);
 }
예제 #2
0
      protected virtual ScatterPlotStyle SDeserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
      {
        ScatterPlotStyle s = null != o ? (ScatterPlotStyle)o : new ScatterPlotStyle();

        s._shape = (XYPlotScatterStyles.Shape)info.GetValue("Shape", typeof(XYPlotScatterStyles.Shape));
        s._style = (XYPlotScatterStyles.Style)info.GetValue("Style", typeof(XYPlotScatterStyles.Style));
        XYPlotScatterStyles.DropLine dropLine = (XYPlotScatterStyles.DropLine)info.GetValue("DropLine", typeof(XYPlotScatterStyles.DropLine));
        s._pen = (PenX)info.GetValue("Pen", typeof(PenX));
        s._symbolSize = info.GetSingle("SymbolSize");
        s._relativePenWidth = info.GetSingle("RelativePenWidth");

        if (0 != (dropLine & XYPlotScatterStyles.DropLine.Bottom))
          s._dropLine.Add(CSPlaneID.Bottom);
        if (0 != (dropLine & XYPlotScatterStyles.DropLine.Top))
          s._dropLine.Add(CSPlaneID.Top);
        if (0 != (dropLine & XYPlotScatterStyles.DropLine.Left))
          s._dropLine.Add(CSPlaneID.Left);
        if (0 != (dropLine & XYPlotScatterStyles.DropLine.Right))
          s._dropLine.Add(CSPlaneID.Right);



        return s;
      }
예제 #3
0
      public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
      {

        BrushX s = null != o ? (BrushX)o : new BrushX(Color.Black);

        s._brushType = (BrushType)info.GetValue("Type", s);
        switch (s._brushType)
        {
          case BrushType.SolidBrush:
            s._foreColor = (Color)info.GetValue("ForeColor", s);
            break;
          case BrushType.HatchBrush:
            s._foreColor = (Color)info.GetValue("ForeColor", s);
            s._backColor = (Color)info.GetValue("BackColor", s);
            s._exchangeColors = info.GetBoolean("ExchangeColors");
            s._hatchStyle = (HatchStyle)info.GetEnum("HatchStyle", typeof(HatchStyle));
            break;
          case BrushType.LinearGradientBrush:
            s._foreColor = (Color)info.GetValue("ForeColor", s);
            s._backColor = (Color)info.GetValue("BackColor", s);
            s._exchangeColors = info.GetBoolean("ExchangeColors");
            s._wrapMode = (WrapMode)info.GetEnum("WrapMode", typeof(WrapMode));
            s._gradientMode = (LinearGradientMode)info.GetEnum("GradientMode", typeof(LinearGradientMode));
            s._gradientShape = (LinearGradientShape)info.GetEnum("GradientShape", typeof(LinearGradientShape));
            s._scale = info.GetSingle("Scale");
            s._focus = info.GetSingle("Focus");
            break;
          case BrushType.PathGradientBrush:
            s._foreColor = (Color)info.GetValue("ForeColor", s);
            s._backColor = (Color)info.GetValue("BackColor", s);
            s._exchangeColors = info.GetBoolean("ExchangeColors");
            s._wrapMode = (WrapMode)info.GetEnum("WrapMode", typeof(WrapMode));
            break;
          case BrushType.TextureBrush:
            s.TextureImage = (ImageProxy)info.GetValue("Texture", s);
            s._wrapMode = (WrapMode)info.GetEnum("WrapMode", typeof(WrapMode));
            s._scale = info.GetSingle("Scale");
            break;
        }
        return s;
      }
예제 #4
0
			public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				TextGraphic s = null != o ? (TextGraphic)o : new TextGraphic(info);
				info.GetBaseValueEmbedded(s, "AltaxoBase,Altaxo.Graph.GraphicsObject,0", parent);

				// we have changed the meaning of rotation in the meantime, This is not handled in GetBaseValueEmbedded,
				// since the former versions did not store the version number of embedded bases
				//s._rotation = -s._rotation;

				s._text = info.GetString("Text");
				s._font = (FontX)info.GetValue("Font", s);
				s._textBrush = (BrushX)info.GetValue("Brush", s);
				if (null != s._textBrush) s._textBrush.ParentObject = s;
				s.BackgroundStyleOld = (BackgroundStyle)info.GetValue("BackgroundStyle", s);
				s._lineSpacingFactor = info.GetSingle("LineSpacing");
				info.GetSingle("ShadowLength");
				var xAnchorType = (XAnchorPositionType)info.GetValue("XAnchor", s);
				var yAnchorType = (YAnchorPositionType)info.GetValue("YAnchor", s);
				s._location.LocalAnchorX = RADouble.NewRel(0.5 * (int)xAnchorType);
				s._location.LocalAnchorY = RADouble.NewRel(0.5 * (int)yAnchorType);

				return s;
			}
예제 #5
0
			public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				TextGraphic s = null != o ? (TextGraphic)o : new TextGraphic(info);
				if (info.CurrentElementName == "BaseType") // that was included since 2006-06-20
				{
					info.GetBaseValueEmbedded(s, typeof(TextGraphic).BaseType, parent);
				}
				else
				{
					info.GetBaseValueEmbedded(s, "AltaxoBase,Altaxo.Graph.GraphicsObject,0", parent); // before 2006-06-20, it was version 0 of the GraphicsObject
				}

				s._text = info.GetString("Text");
				s._font = (FontX)info.GetValue("Font", s);
				s._textBrush = (BrushX)info.GetValue("Brush", s);
				if (null != s._textBrush) s._textBrush.ParentObject = s;
				s._background = (IBackgroundStyle)info.GetValue("BackgroundStyle", s);
				if (null != s._background) s._background.ParentObject = s;
				s._lineSpacingFactor = info.GetSingle("LineSpacing");
				var xAnchorType = (XAnchorPositionType)info.GetValue("XAnchor", s);
				var yAnchorType = (YAnchorPositionType)info.GetValue("YAnchor", s);
				s._location.LocalAnchorX = RADouble.NewRel(0.5 * (int)xAnchorType);
				s._location.LocalAnchorY = RADouble.NewRel(0.5 * (int)yAnchorType);
				return s;
			}
예제 #6
0
			public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				ColumnStyle s = (ColumnStyle)o;

				if ("Size" == info.CurrentElementName)
					return new XmlSerializationSurrogate0().Deserialize(o, info, parent);

				s._columnStyleType = (ColumnStyleType)info.GetEnum("Type", typeof(ColumnStyleType));
				s._columnSize = (int)info.GetSingle("Size");
				s._textFormat.Alignment = (StringAlignment)Enum.Parse(typeof(StringAlignment), info.GetString("Alignment"));
				s._isCellPenCustom = info.GetBoolean("CustomPen");
				if (s._isCellPenCustom)
				{
					s.CellBorder = (PenX)info.GetValue("Pen", s);
				}
				else
				{
					s.SetDefaultCellBorder();
				}

				s._isTextBrushCustom = info.GetBoolean("CustomText");
				if (s._isTextBrushCustom)
				{
					s.TextBrush = (BrushX)info.GetValue("TextBrush", s);
				}
				else
				{
					s.SetDefaultTextBrush();
				}

				s._isBackgroundBrushCustom = info.GetBoolean("CustomBkg");
				if (s._isBackgroundBrushCustom)
				{
					s.BackgroundBrush = (BrushX)info.GetValue("BkgBrush", s);
				}
				else
				{
					s.SetDefaultBackgroundBrush();
				}

				bool isCustomFont = info.GetBoolean("CustomFont");
				if (isCustomFont)
					s.TextFont = (FontX)info.GetValue("Font", s);
				else
					s.SetDefaultTextFont();

				s.ParentObject = (Main.IDocumentNode)parent;
				return s;
			}
예제 #7
0
      public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
      {

        AxisLineStyle s = null != o ? (AxisLineStyle)o : new AxisLineStyle();

        s._axisPen = (PenX)info.GetValue("AxisPen", s);
        s._majorTickPen = (PenX)info.GetValue("MajorPen", s);
        s._minorTickPen = (PenX)info.GetValue("MinorPen", s);

        s._majorTickLength = (float)info.GetSingle("MajorLength");
        s._minorTickLength = (float)info.GetSingle("MinorLength");
        s._axisPosition = (Calc.RelativeOrAbsoluteValue)info.GetValue("AxisPosition", s);
        s._showFirstUpMajorTicks = (bool)info.GetBoolean("Major1Up");
        s._showFirstDownMajorTicks = (bool)info.GetBoolean("Major1Dw");
        s._showFirstUpMinorTicks = (bool)info.GetBoolean("Minor1Up");
        s._showFirstDownMinorTicks = (bool)info.GetBoolean("Minor1Dw");

        s.WireEventChain(true);

        return s;
      }
예제 #8
0
      public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
      {

        TextGraphic s = null != o ? (TextGraphic)o : new TextGraphic();
        info.GetBaseValueEmbedded(s, typeof(TextGraphic).BaseType, parent);

        s._text = info.GetString("Text");
        s._font = (Font)info.GetValue("Font", typeof(Font));
        s._textBrush = (BrushX)info.GetValue("Brush", typeof(BrushX));
        s._background = (IBackgroundStyle)info.GetValue("BackgroundStyle", typeof(IBackgroundStyle));
        s._lineSpacingFactor = info.GetSingle("LineSpacing");
        s._xAnchorType = (XAnchorPositionType)info.GetValue("XAnchor", typeof(XAnchorPositionType));
        s._yAnchorType = (YAnchorPositionType)info.GetValue("YAnchor", typeof(YAnchorPositionType));

        return s;
      }
예제 #9
0
 public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
 {
   
   GraphController s = null!=o ? (GraphController)o : new GraphController(null,true);
   s.m_AutoZoom = info.GetBoolean("AutoZoom");
   s.m_Zoom = info.GetSingle("Zoom");
   s.m_Graph = null;
   
   XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0();
   surr._GraphController = s;
   surr._PathToGraph = (Main.DocumentPath)info.GetValue("Graph",s);
   info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished);
   
   return s;
 }
예제 #10
0
			protected virtual ScatterPlotStyle SDeserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				ScatterPlotStyle s = null != o ? (ScatterPlotStyle)o : new ScatterPlotStyle(info);

				s._independentSkipFreq = info.GetBoolean("IndependentSkipFreq");
				s._skipFreq = info.GetInt32("SkipFreq");

				s._symbolShape = (IScatterSymbol)info.GetValue("Shape", s);
				s._independentSymbolSize = info.GetBoolean("IndependentSymbolSize");
				s._symbolSize = info.GetSingle("SymbolSize");

				s._material = (IMaterial)info.GetValue("Material", s);
				s._independentColor = info.GetBoolean("IndependentColor");
				return s;
			}
예제 #11
0
      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;
      }
			public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				var s = (ScatterPlotStyle)o ?? new ScatterPlotStyle(info);

				s._independentSkipFreq = info.GetBoolean("IndependentSkipFreq");
				s._skipFreq = info.GetInt32("SkipFreq");

				s._ignoreMissingDataPoints = info.GetBoolean("IgnoreMissingDataPoints");
				s._independentOnShiftingGroupStyles = info.GetBoolean("IndependentOnShiftingGroupStyles");

				s._independentScatterSymbol = info.GetBoolean("IndependentScatterSymbol");
				s._scatterSymbol = (IScatterSymbol)info.GetValue("ScatterSymbol", s);

				s._independentSymbolSize = info.GetBoolean("IndependentSymbolSize");
				s._symbolSize = info.GetSingle("SymbolSize");
				s._independentColor = info.GetBoolean("IndependentColor");
				s._color = (NamedColor)info.GetValue("Color", s);

				s._overrideFrame = info.GetBoolean("OverrideFrame");
				s._overriddenFrame = (IScatterSymbolFrame)info.GetValue("OverriddenFrame", s);
				s._overrideInset = info.GetBoolean("OverrideInset");
				s._overriddenInset = (IScatterSymbolInset)info.GetValue("OverriddenInset", s);
				s._overrideStructureWidthOffset = info.GetNullableDouble("OverriddenStructureWidthOffset");
				s._overrideStructureWidthFactor = info.GetNullableDouble("OverriddenStructureWidthFactor");
				s._overridePlotColorInfluence = info.GetNullableEnum<PlotColorInfluence>("OverriddenPlotColorInfluence");
				s._overrideFillColor = (NamedColor?)info.GetValue("OverriddenFillColor", s);
				s._overrideFrameColor = (NamedColor?)info.GetValue("OverriddenFrameColor", s);
				s._overrideInsetColor = (NamedColor?)info.GetValue("OverriddenInsetColor", s);

				return s;
			}
			public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				const double Sqrt2 = 1.4142135623730950488016887242097;

				var s = (ScatterPlotStyle)o ?? new ScatterPlotStyle(info);

				var shape = (DeprecatedShape)info.GetValue("Shape", s);
				var style = (DeprecatedStyle)info.GetValue("Style", s);
				s._scatterSymbol = GetScatterSymbol(shape, style);

				var dropLineTargets = (CSPlaneIDList)info.GetValue("DropLine", s);
				var pen = (PenX)info.GetValue("Pen", s);
				s._color = pen.Color;
				s._symbolSize = info.GetSingle("SymbolSize");
				s._overrideStructureWidthFactor = info.GetSingle("RelativePenWidth");
				s._symbolSize *= Sqrt2 * (1 + s._overrideStructureWidthFactor.Value);
				s._independentColor = info.GetBoolean("IndependentColor");
				s._independentSymbolSize = info.GetBoolean("IndependentSymbolSize");
				s._skipFreq = info.GetInt32("SkipFreq");

				if (dropLineTargets != null && dropLineTargets.Count != 0)
				{
					return new object[] { s, new DropLinePlotStyle(dropLineTargets, pen) };
				}
				else
				{
					return s;
				}
			}
			public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				const double Sqrt2 = 1.4142135623730950488016887242097;
				var s = (ScatterPlotStyle)o ?? new ScatterPlotStyle(info);

				var shape = (DeprecatedShape)info.GetValue("Shape", typeof(DeprecatedShape));
				var style = (DeprecatedStyle)info.GetValue("Style", typeof(DeprecatedStyle));
				s._scatterSymbol = GetScatterSymbol(shape, style);

				var dropLine = (DeprecatedDropLine)info.GetValue("DropLine", s);
				var pen = (PenX)info.GetValue("Pen", s);
				s._color = pen.Color;
				s._symbolSize = info.GetSingle("SymbolSize");
				s._overrideStructureWidthFactor = info.GetSingle("RelativePenWidth");
				s._symbolSize *= Sqrt2 * (1 + s._overrideStructureWidthFactor.Value);

				if (dropLine != DeprecatedDropLine.NoDrop)
				{
					return new object[] { s, new DropLinePlotStyle(GetCSPlaneIds(dropLine), pen) };
				}
				else
				{
					return s;
				}
			}
예제 #15
0
      protected virtual ScatterPlotStyle SDeserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
      {
        ScatterPlotStyle s = null != o ? (ScatterPlotStyle)o : new ScatterPlotStyle();

        s._shape = (XYPlotScatterStyles.Shape)info.GetValue("Shape", s);
        s._style = (XYPlotScatterStyles.Style)info.GetValue("Style", s);
        s._dropLine = (CSPlaneIDList)info.GetValue("DropLine", s);
        s._pen = (PenX)info.GetValue("Pen", s);
        s._symbolSize = info.GetSingle("SymbolSize");
        s._relativePenWidth = info.GetSingle("RelativePenWidth");
        s._independentColor = info.GetBoolean("IndependentColor");
        s._independentSymbolSize = info.GetBoolean("IndependentSymbolSize");
        s._skipFreq = info.GetInt32("SkipFreq");
        return s;
      }
예제 #16
0
      public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
      {

        GraphicBase s = (GraphicBase)o;

        s._position = (PointF)info.GetValue("Position", s);
        s._bounds = (RectangleF)info.GetValue("Bounds", s);
        s._rotation = info.GetSingle("Rotation");
        s._autoSize = info.GetBoolean("AutoSize");

        return s;
      }
예제 #17
0
      public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
      {
        
        TextGraphic s = null!=o ? (TextGraphic)o : new TextGraphic(); 
        info.GetBaseValueEmbedded(s,typeof(TextGraphic).BaseType,parent);

        // we have changed the meaning of rotation in the meantime, This is not handled in GetBaseValueEmbedded, 
        // since the former versions did not store the version number of embedded bases
        s._rotation = -s._rotation;

        s._text = info.GetString("Text");
        s._font = (Font)info.GetValue("Font",typeof(Font));
        s._textBrush = (BrushX)info.GetValue("Brush",typeof(BrushX));
        s.BackgroundStyleOld = (BackgroundStyle)info.GetValue("BackgroundStyle",typeof(BackgroundStyle));
        s._lineSpacingFactor = info.GetSingle("LineSpacing");
        info.GetSingle("ShadowLength");
        s._xAnchorType = (XAnchorPositionType)info.GetValue("XAnchor",typeof(XAnchorPositionType));
        s._yAnchorType = (YAnchorPositionType)info.GetValue("YAnchor",typeof(YAnchorPositionType));

        return s;
      }
예제 #18
0
파일: PenX.cs 프로젝트: Altaxo/Altaxo
			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;
			}
예제 #19
0
      public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
      {
        
        AxisLineStyle s = null!=o ? (AxisLineStyle)o : new AxisLineStyle();
        
        Edge edge         = (Edge)info.GetValue("Edge",s);
        s._axisPen      = (PenX)info.GetValue("AxisPen",s);
        s._majorTickPen = (PenX)info.GetValue("MajorPen",s);
        s._minorTickPen = (PenX)info.GetValue("MinorPen",s);

        s._majorTickLength = (float)info.GetSingle("MajorLength");
        s._minorTickLength = (float)info.GetSingle("MinorLength");
        bool bOuterMajorTicks = (bool)info.GetBoolean("MajorOuter");
        bool bInnerMajorTicks = (bool)info.GetBoolean("MajorInner");
        bool bOuterMinorTicks = (bool)info.GetBoolean("MinorOuter");
        bool bInnerMinorTicks = (bool)info.GetBoolean("MinorInner");
        s._axisPosition = (Calc.RelativeOrAbsoluteValue)info.GetValue("AxisPosition",s);

        if (edge.TypeOfEdge == EdgeType.Top || edge.TypeOfEdge == EdgeType.Right)
        {
          s._showFirstUpMajorTicks = bOuterMajorTicks;
          s._showFirstDownMajorTicks = bInnerMajorTicks;
          s._showFirstUpMinorTicks = bOuterMinorTicks;
          s._showFirstDownMinorTicks = bInnerMinorTicks;
        }
        else
        {
          s._showFirstUpMajorTicks = bInnerMajorTicks;
          s._showFirstDownMajorTicks = bOuterMajorTicks;
          s._showFirstUpMinorTicks = bInnerMinorTicks;
          s._showFirstDownMinorTicks = bOuterMinorTicks;
        }

        s.WireEventChain(true);
 
        return s;
      }
예제 #20
0
파일: PenX.cs 프로젝트: Altaxo/Altaxo
			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;
			}
예제 #21
0
			protected virtual XYPlotLayer SDeserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				XYPlotLayer s = null != o ? (XYPlotLayer)o : new XYPlotLayer(info);

				bool fillLayerArea = info.GetBoolean("FillLayerArea");
				BrushX layerAreaFillBrush = (BrushX)info.GetValue("LayerAreaFillBrush", s);

				if (fillLayerArea)
				{
					if (!s.GridPlanes.Contains(CSPlaneID.Front))
						s.GridPlanes.Add(new GridPlane(CSPlaneID.Front));
					s.GridPlanes[CSPlaneID.Front].Background = layerAreaFillBrush;
				}

				// size, position, rotation and scale

				var widthType = (XYPlotLayerSizeType)info.GetValue("WidthType", s);
				var heightType = (XYPlotLayerSizeType)info.GetValue("HeightType", s);
				var width = info.GetDouble("Width");
				var height = info.GetDouble("Height");
				s._cachedLayerSize = (SizeF)info.GetValue("CachedSize", s);
				s._coordinateSystem.UpdateAreaSize(s._cachedLayerSize);

				var xPositionType = (XYPlotLayerPositionType)info.GetValue("XPositionType", s);
				var yPositionType = (XYPlotLayerPositionType)info.GetValue("YPositionType", s);
				var xPosition = info.GetDouble("XPosition");
				var yPosition = info.GetDouble("YPosition");
				s._cachedLayerPosition = (PointF)info.GetValue("CachedPosition", s);
				var rotation = info.GetSingle("Rotation");
				var scale = info.GetSingle("Scale");
				s.Location = new XYPlotLayerPositionAndSize_V0(widthType, width, heightType, height, xPositionType, xPosition, yPositionType, yPosition, rotation, scale).ConvertToCurrentLocationVersion(s._cachedLayerSize, s._cachedLayerPosition);

				// axis related

				var xAxis = (Altaxo.Graph.Scales.Deprecated.Scale)info.GetValue("XAxis", s);
				var yAxis = (Altaxo.Graph.Scales.Deprecated.Scale)info.GetValue("YAxis", s);
				bool xIsLinked = info.GetBoolean("LinkXAxis");
				bool yIsLinked = info.GetBoolean("LinkYAxis");
				double xOrgA = info.GetDouble("LinkXAxisOrgA");
				double xOrgB = info.GetDouble("LinkXAxisOrgB");
				double xEndA = info.GetDouble("LinkXAxisEndA");
				double xEndB = info.GetDouble("LinkXAxisEndB");
				double yOrgA = info.GetDouble("LinkYAxisOrgA");
				double yOrgB = info.GetDouble("LinkYAxisOrgB");
				double yEndA = info.GetDouble("LinkYAxisEndA");
				double yEndB = info.GetDouble("LinkYAxisEndB");
				s.SetupOldAxis(0, xAxis, xIsLinked, xOrgA, xOrgB, xEndA, xEndB);
				s.SetupOldAxis(1, yAxis, yIsLinked, yOrgA, yOrgB, yEndA, yEndB);

				// Styles
				bool showLeft = info.GetBoolean("ShowLeftAxis");
				bool showBottom = info.GetBoolean("ShowBottomAxis");
				bool showRight = info.GetBoolean("ShowRightAxis");
				bool showTop = info.GetBoolean("ShowTopAxis");

				s._axisStyles.AxisStyleEnsured(CSLineID.Y0).AxisLineStyle = (AxisLineStyle)info.GetValue("LeftAxisStyle", s);
				s._axisStyles.AxisStyleEnsured(CSLineID.X0).AxisLineStyle = (AxisLineStyle)info.GetValue("BottomAxisStyle", s);
				s._axisStyles.AxisStyleEnsured(CSLineID.Y1).AxisLineStyle = (AxisLineStyle)info.GetValue("RightAxisStyle", s);
				s._axisStyles.AxisStyleEnsured(CSLineID.X1).AxisLineStyle = (AxisLineStyle)info.GetValue("TopAxisStyle", s);

				s._axisStyles[CSLineID.Y0].MajorLabelStyle = (AxisLabelStyle)info.GetValue("LeftLabelStyle", s);
				s._axisStyles[CSLineID.X0].MajorLabelStyle = (AxisLabelStyle)info.GetValue("BottomLabelStyle", s);
				s._axisStyles[CSLineID.Y1].MajorLabelStyle = (AxisLabelStyle)info.GetValue("RightLabelStyle", s);
				s._axisStyles[CSLineID.X1].MajorLabelStyle = (AxisLabelStyle)info.GetValue("TopLabelStyle", s);

				// Titles and legend
				s._axisStyles[CSLineID.Y0].Title = (TextGraphic)info.GetValue("LeftAxisTitle", s);
				s._axisStyles[CSLineID.X0].Title = (TextGraphic)info.GetValue("BottomAxisTitle", s);
				s._axisStyles[CSLineID.Y1].Title = (TextGraphic)info.GetValue("RightAxisTitle", s);
				s._axisStyles[CSLineID.X1].Title = (TextGraphic)info.GetValue("TopAxisTitle", s);

				if (!showLeft)
					s._axisStyles.Remove(CSLineID.Y0);
				if (!showRight)
					s._axisStyles.Remove(CSLineID.Y1);
				if (!showBottom)
					s._axisStyles.Remove(CSLineID.X0);
				if (!showTop)
					s._axisStyles.Remove(CSLineID.X1);

				var legend = (TextGraphic)info.GetValue("Legend", s);

				// XYPlotLayer specific
				object linkedLayer = info.GetValue("LinkedLayer", s);
				if (linkedLayer is Main.AbsoluteDocumentPath)
				{
					ProvideLinkedScalesWithLinkedLayerIndex(s, (Main.AbsoluteDocumentPath)linkedLayer, info);
				}
				else if (linkedLayer is Main.RelativeDocumentPath)
				{
					ProvideLinkedScalesWithLinkedLayerIndex(s, (Main.RelativeDocumentPath)linkedLayer, info);
				}
				s.GraphObjects.AddRange((IEnumerable<IGraphicBase>)info.GetValue("GraphObjects", s));

				s._plotItems = (PlotItemCollection)info.GetValue("Plots", s);
				if (null != s._plotItems) s._plotItems.ParentObject = s;

				if (null != legend)
				{
					var legend1 = new LegendText(legend);
					s._graphObjects.Add(legend1);
				}

				return s;
			}
예제 #22
0
			public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				var s = (TextGraphic)o ?? new TextGraphic(info);

				info.GetBaseValueEmbedded(s, typeof(TextGraphic).BaseType, parent);

				s._text = info.GetString("Text");
				s._font = (FontX3D)info.GetValue("Font", s);
				s._textBrush = (IMaterial)info.GetValue("Brush", s);
				s.Background = (IBackgroundStyle)info.GetValue("BackgroundStyle", s);
				s._lineSpacingFactor = info.GetSingle("LineSpacing");

				s.UpdateTransformationMatrix();

				return s;
			}
예제 #23
0
			public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				ColumnStyle s = (ColumnStyle)o;
				s._columnSize = (int)info.GetSingle("Size");

				object notneeded;
				notneeded = info.GetValue("Pen", s);
				notneeded = info.GetValue("TextBrush", s);

				notneeded = info.GetValue("SelTextBrush", s);
				notneeded = info.GetValue("BkgBrush", s);

				notneeded = info.GetValue("SelBkgBrush", s);
				s._textFormat.Alignment = (StringAlignment)Enum.Parse(typeof(StringAlignment), info.GetString("Alignment"));
				s._textFont = (FontX)info.GetValue("Font", s);

				s.ParentObject = (Main.IDocumentNode)parent;
				return s;
			}
예제 #24
0
		public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
		{
			float x = info.GetSingle("X");
			float y = info.GetSingle("Y");
			float w = info.GetSingle("Width");
			float h = info.GetSingle("Height");
			return new System.Drawing.RectangleF(x, y, w, h);
		}
예제 #25
0
			public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
			{
				var s = null != o ? (TextGraphic)o : new TextGraphic(info);

				info.GetBaseValueEmbedded(s, typeof(TextGraphic).BaseType, parent);

				s._text = info.GetString("Text");
				s._font = (FontX)info.GetValue("Font", s);
				s._textBrush = (BrushX)info.GetValue("Brush", s);
				s._textBrush.ParentObject = s;

				s.Background = (IBackgroundStyle)info.GetValue("BackgroundStyle", s);

				s._lineSpacingFactor = info.GetSingle("LineSpacing");
				return s;
			}
예제 #26
0
		public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
		{
			float x = info.GetSingle("X");
			float y = info.GetSingle("Y");
			return new PointF(x, y);
		}
예제 #27
0
      protected virtual XYPlotLayer SDeserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
      {

        XYPlotLayer s = null != o ? (XYPlotLayer)o : new XYPlotLayer();

        bool fillLayerArea = info.GetBoolean("FillLayerArea");
        BrushX layerAreaFillBrush = (BrushX)info.GetValue("LayerAreaFillBrush", typeof(BrushX));

        if (fillLayerArea)
        {
          if(!s.GridPlanes.Contains(CSPlaneID.Front))
            s.GridPlanes.Add(new GridPlane(CSPlaneID.Front));
          s.GridPlanes[CSPlaneID.Front].Background = layerAreaFillBrush;
        }




        // size, position, rotation and scale

        s._location.WidthType = (XYPlotLayerSizeType)info.GetValue("WidthType", typeof(XYPlotLayerSizeType));
        s._location.HeightType = (XYPlotLayerSizeType)info.GetValue("HeightType", typeof(XYPlotLayerSizeType));
        s._location.Width = info.GetDouble("Width");
        s._location.Height = info.GetDouble("Height");
        s._cachedLayerSize = (SizeF)info.GetValue("CachedSize", typeof(SizeF));
        s._coordinateSystem.UpdateAreaSize(s._cachedLayerSize);

        s._location.XPositionType = (XYPlotLayerPositionType)info.GetValue("XPositionType", typeof(XYPlotLayerPositionType));
        s._location.YPositionType = (XYPlotLayerPositionType)info.GetValue("YPositionType", typeof(XYPlotLayerPositionType));
        s._location.XPosition = info.GetDouble("XPosition");
        s._location.YPosition = info.GetDouble("YPosition");
        s._cachedLayerPosition = (PointF)info.GetValue("CachedPosition", typeof(PointF));

        s._location.Angle = info.GetSingle("Rotation");
        s._location.Scale = info.GetSingle("Scale");

        // axis related

        s._linkedScales.X.Scale = (Scale)info.GetValue("XAxis", typeof(Scale));
        s._linkedScales.Y.Scale = (Scale)info.GetValue("YAxis", typeof(Scale));
        s._linkedScales.X.IsLinked = info.GetBoolean("LinkXAxis");
        s._linkedScales.Y.IsLinked = info.GetBoolean("LinkYAxis");
        s._linkedScales.X.LinkOrgA = info.GetDouble("LinkXAxisOrgA");
        s._linkedScales.X.LinkOrgB = info.GetDouble("LinkXAxisOrgB");
        s._linkedScales.X.LinkEndA = info.GetDouble("LinkXAxisEndA");
        s._linkedScales.X.LinkEndB = info.GetDouble("LinkXAxisEndB");
        s._linkedScales.Y.LinkOrgA = info.GetDouble("LinkYAxisOrgA");
        s._linkedScales.Y.LinkOrgB = info.GetDouble("LinkYAxisOrgB");
        s._linkedScales.Y.LinkEndA = info.GetDouble("LinkYAxisEndA");
        s._linkedScales.Y.LinkEndB = info.GetDouble("LinkYAxisEndB");


        // Styles
        bool showLeft = info.GetBoolean("ShowLeftAxis");
        bool showBottom = info.GetBoolean("ShowBottomAxis");
        bool showRight = info.GetBoolean("ShowRightAxis");
        bool showTop = info.GetBoolean("ShowTopAxis");

        s._axisStyles.AxisStyleEnsured(CSLineID.Y0).AxisLineStyle = (AxisLineStyle)info.GetValue("LeftAxisStyle", typeof(AxisLineStyle));
        s._axisStyles.AxisStyleEnsured(CSLineID.X0).AxisLineStyle = (AxisLineStyle)info.GetValue("BottomAxisStyle", typeof(AxisLineStyle));
        s._axisStyles.AxisStyleEnsured(CSLineID.Y1).AxisLineStyle = (AxisLineStyle)info.GetValue("RightAxisStyle", typeof(AxisLineStyle));
        s._axisStyles.AxisStyleEnsured(CSLineID.X1).AxisLineStyle = (AxisLineStyle)info.GetValue("TopAxisStyle", typeof(AxisLineStyle));


        s._axisStyles[CSLineID.Y0].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("LeftLabelStyle", typeof(AxisLabelStyleBase));
        s._axisStyles[CSLineID.X0].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("BottomLabelStyle", typeof(AxisLabelStyleBase));
        s._axisStyles[CSLineID.Y1].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("RightLabelStyle", typeof(AxisLabelStyleBase));
        s._axisStyles[CSLineID.X1].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("TopLabelStyle", typeof(AxisLabelStyleBase));


        // Titles and legend
        s._axisStyles[CSLineID.Y0].Title = (TextGraphic)info.GetValue("LeftAxisTitle", typeof(TextGraphic));
        s._axisStyles[CSLineID.X0].Title = (TextGraphic)info.GetValue("BottomAxisTitle", typeof(TextGraphic));
        s._axisStyles[CSLineID.Y1].Title = (TextGraphic)info.GetValue("RightAxisTitle", typeof(TextGraphic));
        s._axisStyles[CSLineID.X1].Title = (TextGraphic)info.GetValue("TopAxisTitle", typeof(TextGraphic));

        if (!showLeft)
          s._axisStyles.Remove(CSLineID.Y0);
        if (!showRight)
          s._axisStyles.Remove(CSLineID.Y1);
        if (!showBottom)
          s._axisStyles.Remove(CSLineID.X0);
        if (!showTop)
          s._axisStyles.Remove(CSLineID.X1);



        s.Legend = (TextGraphic)info.GetValue("Legend", typeof(TextGraphic));

        // XYPlotLayer specific
        Main.DocumentPath linkedLayer = (Main.DocumentPath)info.GetValue("LinkedLayer", typeof(XYPlotLayer));
        if (linkedLayer != null)
        {
          XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0();
          surr._Layer = s;
          surr._LinkedLayerPath = linkedLayer;
          info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished);
        }

        s._graphObjects = (GraphicCollection)info.GetValue("GraphObjects", typeof(GraphicCollection));

        s._plotItems = (PlotItemCollection)info.GetValue("Plots", typeof(PlotItemCollection));


        return s;
      }
예제 #28
0
      public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
      {

        BrushX s = null != o ? (BrushX)o : new BrushX(Color.Black);

        s._brushType = (BrushType)info.GetValue("Type", s);
        switch (s._brushType)
        {
          case BrushType.SolidBrush:
            s._foreColor = (Color)info.GetValue("ForeColor", s);
            break;
          case BrushType.HatchBrush:
            s._foreColor = (Color)info.GetValue("ForeColor", s);
            s._backColor = (Color)info.GetValue("BackColor", s);
            s._hatchStyle = (HatchStyle)info.GetEnum("HatchStyle", typeof(HatchStyle));
            break;
          case BrushType.LinearGradientBrush:
             s._foreColor = (Color)info.GetValue("ForeColor",s);
             s._backColor = (Color)info.GetValue("BackColor", s);
             s._wrapMode = (WrapMode)info.GetEnum("WrapMode", typeof(WrapMode));
             LinearGradientModeEx gm = (LinearGradientModeEx)info.GetEnum("GradientMode", typeof(LinearGradientModeEx));
             string gmname = Enum.GetName(typeof(LinearGradientModeEx), gm);
             if (gmname.StartsWith("Rev"))
             {
               s._exchangeColors = true;
               s._gradientMode = (LinearGradientMode)Enum.Parse(typeof(LinearGradientMode), gmname.Substring(3));
             }
             else
             {
               s._gradientMode = (LinearGradientMode)Enum.Parse(typeof(LinearGradientMode), gmname);
             }

            s._gradientShape = (LinearGradientShape)info.GetEnum("GradientShape", typeof(LinearGradientShape));
            s._scale = info.GetSingle("Scale");
            s._focus = info.GetSingle("Focus");
            break;
          case BrushType.PathGradientBrush:
            s._foreColor = (Color)info.GetValue("ForeColor", s);
            s._backColor = (Color)info.GetValue("BackColor", s);
            s._wrapMode = (WrapMode)info.GetEnum("WrapMode", typeof(WrapMode));
            break;
          case BrushType.TextureBrush:
            s.TextureImage = (ImageProxy)info.GetValue("Texture", s);
            s._wrapMode = (WrapMode)info.GetEnum("WrapMode", typeof(WrapMode));
            s._scale = info.GetSingle("Scale");
            break;
        }
        return s;
      }