Add a name to the NetShape class.
This commit is contained in:
parent
05477cf9c4
commit
690369ae9c
@ -17,6 +17,7 @@ namespace EduNetworkBuilder
|
|||||||
public Rectangle InArea;
|
public Rectangle InArea;
|
||||||
public Color LineColor = Color.Empty;
|
public Color LineColor = Color.Empty;
|
||||||
public Color FillColor = Color.Empty;
|
public Color FillColor = Color.Empty;
|
||||||
|
public string Name = "";
|
||||||
int DragSize = 15;
|
int DragSize = 15;
|
||||||
|
|
||||||
public NetShape(NetShapeType What, Rectangle Where, Color fillcolor, Color linecolor)
|
public NetShape(NetShapeType What, Rectangle Where, Color fillcolor, Color linecolor)
|
||||||
@ -136,7 +137,7 @@ namespace EduNetworkBuilder
|
|||||||
|
|
||||||
public override string ToString()
|
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 + " X:" + InArea.X + " Y:" + InArea.Y;
|
||||||
answer = answer + "W:" + InArea.Width + " H:" + InArea.Height;
|
answer = answer + "W:" + InArea.Width + " H:" + InArea.Height;
|
||||||
return answer;
|
return answer;
|
||||||
@ -151,6 +152,9 @@ namespace EduNetworkBuilder
|
|||||||
{
|
{
|
||||||
switch (Individual.Name.ToLower())
|
switch (Individual.Name.ToLower())
|
||||||
{
|
{
|
||||||
|
case "name":
|
||||||
|
Name = Individual.InnerText;
|
||||||
|
break;
|
||||||
case "what":
|
case "what":
|
||||||
MyShape = NB.TryParseEnum<NetShapeType>(Individual.InnerText, NetShapeType.none);
|
MyShape = NB.TryParseEnum<NetShapeType>(Individual.InnerText, NetShapeType.none);
|
||||||
break;
|
break;
|
||||||
@ -172,6 +176,7 @@ namespace EduNetworkBuilder
|
|||||||
public void Save(XmlWriter writer)
|
public void Save(XmlWriter writer)
|
||||||
{
|
{
|
||||||
writer.WriteStartElement("shape");
|
writer.WriteStartElement("shape");
|
||||||
|
writer.WriteElementString("name", Name);
|
||||||
writer.WriteElementString("what", MyShape.ToString());
|
writer.WriteElementString("what", MyShape.ToString());
|
||||||
RectangleConverter converter = new RectangleConverter();
|
RectangleConverter converter = new RectangleConverter();
|
||||||
writer.WriteElementString("where", converter.ConvertToString(InArea));
|
writer.WriteElementString("where", converter.ConvertToString(InArea));
|
||||||
|
Loading…
Reference in New Issue
Block a user