Print Library, Svg Library, Utils Library, XYPlots

This commit is contained in:
2026-07-24 13:36:46 -04:00
parent 06c3136566
commit f67d37801a
68 changed files with 12173 additions and 16618 deletions
+38 -114
View File
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Drawing;
@@ -13,146 +11,72 @@ namespace Volian.Svg.Library
public SvgLine() { ;}
public SvgLine(PointF location1, PointF location2, Color lineColor, float lineWidth)
{
_X1.Value = location1.X;
_Y1.Value = location1.Y;
_X2.Value = location2.X;
_Y2.Value = location2.Y;
X1.Value = location1.X;
Y1.Value = location1.Y;
X2.Value = location2.X;
Y2.Value = location2.Y;
LineColor = lineColor;
LineWidth = new SvgMeasurement(lineWidth);
}
//XMLElementAttribute(ElementName = "PREFIX", IsNullable = false)
#endregion
#region Location1
private SvgMeasurement _X1 = new SvgMeasurement();
[XmlIgnore]
public SvgMeasurement X1
{
get { return _X1; }
set { _X1 = value; }
}
[XmlAttribute("x1")]
#endregion
#region Location1
[XmlIgnore]
public SvgMeasurement X1 { get; set; } = new SvgMeasurement();
[XmlAttribute("x1")]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public string X1_XmlSurrogate
{
get { return SvgXmlConverter<SvgMeasurement>.GetString(_X1); }
set { _X1 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
get { return SvgXmlConverter<SvgMeasurement>.GetString(X1); }
set { X1 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
}
private SvgMeasurement _Y1 = new SvgMeasurement();
[XmlIgnore]
public SvgMeasurement Y1
{
get { return _Y1; }
set { _Y1 = value; }
}
[XmlAttribute("y1")]
[XmlIgnore]
public SvgMeasurement Y1 { get; set; } = new SvgMeasurement();
[XmlAttribute("y1")]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public string Y1_XmlSurrogate
{
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Y1); }
set { _Y1 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
get { return SvgXmlConverter<SvgMeasurement>.GetString(Y1); }
set { Y1 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
}
#endregion
#region Location2
private SvgMeasurement _X2 = new SvgMeasurement();
[XmlIgnore]
public SvgMeasurement X2
{
get { return _X2; }
set { _X2 = value; }
}
[XmlAttribute("x2")]
#endregion
#region Location2
[XmlIgnore]
public SvgMeasurement X2 { get; set; } = new SvgMeasurement();
[XmlAttribute("x2")]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public string X2_XmlSurrogate
{
get { return SvgXmlConverter<SvgMeasurement>.GetString(_X2); }
set { _X2 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
get { return SvgXmlConverter<SvgMeasurement>.GetString(X2); }
set { X2 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
}
private SvgMeasurement _Y2 = new SvgMeasurement();
[XmlIgnore]
public SvgMeasurement Y2
{
get { return _Y2; }
set { _Y2 = value; }
}
[XmlAttribute("y2")]
[XmlIgnore]
public SvgMeasurement Y2 { get; set; } = new SvgMeasurement();
[XmlAttribute("y2")]
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public string Y_XmlSurrogate
{
get { return SvgXmlConverter<SvgMeasurement>.GetString(_Y2); }
set { _Y2 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
get { return SvgXmlConverter<SvgMeasurement>.GetString(Y2); }
set { Y2 = SvgXmlConverter<SvgMeasurement>.GetObject(value); }
}
#endregion
#region Description
private string _Description = string.Empty;
[System.ComponentModel.DefaultValueAttribute("")]
[XmlElement("desc")]
public string Description
{
get { return _Description; }
set { _Description = value; }
}
#endregion
#region LineColor
//protected Color _LineColor = Color.Empty;
//[XmlIgnoreAttribute()]
//public Color LineColor
//{
// get { return _LineWidth.Value == 0 ? Color.LightGray : _LineColor == Color.Empty ? Color.Gray : _LineColor; }
// set { _LineColor = value; }
//}
private Color AdjustColorForWidth(Color myColor, float myWidth)
#endregion
#region Description
[System.ComponentModel.DefaultValueAttribute("")]
[XmlElement("desc")]
public string Description { get; set; } = string.Empty;
#endregion
#region LineColor
private Color AdjustColorForWidth(Color myColor, float myWidth)
{
if (myWidth > 1F) return myColor;
//Console.WriteLine("Line Width = {0}, Alpha = {1}", myWidth, Convert.ToInt32(myWidth * 255));
return Color.FromArgb(Convert.ToInt32(myWidth * 255), myColor);
}
// Serializes the 'BackgroundColor' Color to XML.
//[System.ComponentModel.DefaultValueAttribute("none")]
//[XmlAttribute("stroke")]
//public string Stroke
//{
// get { return _LineColor == Color.Empty ? "none" : _LineColor == Color.Black ? "" : ColorTranslator.ToHtml(_LineColor); }
// set { _LineColor = (value == "none" ? Color.Empty : (value == "" ? Color.Empty : ColorTranslator.FromHtml(value))); }
//}
#endregion
#region LineWidth
//private SvgMeasurement GetLineWidth()
//{
// if (_LineWidth.Value == -1) return new SvgMeasurement(1F);// Minimum Strokewidth
// if (_LineWidth.Value == 0) return new SvgMeasurement(.01F);// Minimum Strokewidth
// if (_LineColor == Color.Empty) return new SvgMeasurement( .01F);// No Color - Minimum Strokewidth
// return _LineWidth;
//}
//private SvgMeasurement _LineWidth = new SvgMeasurement();
//[XmlIgnore]
//public SvgMeasurement LineWidth
//{
// get { return _LineWidth; }
// set { _LineWidth = value; }
//}
//[XmlAttribute("stroke-width")]
//[Browsable(false)]
//[EditorBrowsable(EditorBrowsableState.Never)]
//public string LineWidth_XmlSurrogate
//{
// get
// {
// if (_LineWidth.Value == -1)
// return "none";
// return VolianXmlConverter<SvgMeasurement>.GetString(_LineWidth);
// }
// set
// {
// if (value == "none")
// _LineWidth = VolianXmlConverter<SvgMeasurement>.GetObject("-1");
// else
// _LineWidth = VolianXmlConverter<SvgMeasurement>.GetObject(value);
// }
//}
#endregion
}
}