Add a name to the NetShape class.

This commit is contained in:
Tim Young 2018-03-06 14:20:37 -06:00
parent 05477cf9c4
commit 690369ae9c

View File

@ -17,6 +17,7 @@ namespace EduNetworkBuilder
public Rectangle InArea;
public Color LineColor = Color.Empty;
public Color FillColor = Color.Empty;
public string Name = "";
int DragSize = 15;
public NetShape(NetShapeType What, Rectangle Where, Color fillcolor, Color linecolor)
@ -136,7 +137,7 @@ namespace EduNetworkBuilder
public override string ToString()
{
string answer = MyShape.ToString() + " " + LineColor.Name + "/" + FillColor.Name;
string answer = Name + " " + MyShape.ToString() + " " + LineColor.Name + "/" + FillColor.Name;
answer = answer + " X:" + InArea.X + " Y:" + InArea.Y;
answer = answer + "W:" + InArea.Width + " H:" + InArea.Height;
return answer;
@ -151,6 +152,9 @@ namespace EduNetworkBuilder
{
switch (Individual.Name.ToLower())
{
case "name":
Name = Individual.InnerText;
break;
case "what":
MyShape = NB.TryParseEnum<NetShapeType>(Individual.InnerText, NetShapeType.none);
break;
@ -172,6 +176,7 @@ namespace EduNetworkBuilder
public void Save(XmlWriter writer)
{
writer.WriteStartElement("shape");
writer.WriteElementString("name", Name);
writer.WriteElementString("what", MyShape.ToString());
RectangleConverter converter = new RectangleConverter();
writer.WriteElementString("where", converter.ConvertToString(InArea));