public static CustomStroke stringToStroke(JObject serialized, CustomStrokeCollection strokes) { switch (serialized.ToObject <SerializedStroke>().ShapeType) { case "RECTANGLE": SerializedShape rectangle = serialized.ToObject <SerializedShape>(); var rectangleStroke = new BaseRectangleStroke(rectangle.Id, rectangle.Index, getExtrimities(rectangle.ShapeInfo), strokes, (Color)ColorConverter.ConvertFromString(rectangle.ShapeInfo.Color)); return(rectangleStroke); case "TRIANGLE": SerializedShape triangle = serialized.ToObject <SerializedShape>(); var triangleStroke = new BaseTrangleStroke(triangle.Id, triangle.Index, getExtrimities(triangle.ShapeInfo), strokes, (Color)ColorConverter.ConvertFromString(triangle.ShapeInfo.Color)); return(triangleStroke); case "ELLIPSE": SerializedShape elipse = serialized.ToObject <SerializedShape>(); var elipseStroke = new BaseElipseStroke(elipse.Id, elipse.Index, getExtrimities(elipse.ShapeInfo), strokes, (Color)ColorConverter.ConvertFromString(elipse.ShapeInfo.Color)); return(elipseStroke); case "CLASS": SerializedTextable classCase = serialized.ToObject <SerializedTextable>(); var classStroke = new ClassStroke(classCase.Id, classCase.Index, getExtrimities(classCase.ShapeInfo), strokes, UseCaseStroke.fromServerStyle(classCase.ShapeInfo.Content)); return(classStroke); case "TEXT": SerializedTextable text = serialized.ToObject <SerializedTextable>(); var textStroke = new TextStroke(text.Id, text.Index, getExtrimities(text.ShapeInfo), strokes, UseCaseStroke.fromServerStyle(text.ShapeInfo.Content)); return(textStroke); case "USE": SerializedTextable use = serialized.ToObject <SerializedTextable>(); var useStroke = new UseCaseStroke(use.Id, use.Index, getExtrimities(use.ShapeInfo), strokes, UseCaseStroke.fromServerStyle(use.ShapeInfo.Content)); return(useStroke); case "ACTOR": SerializedTextable actor = serialized.ToObject <SerializedTextable>(); var actorStroke = new PersonStroke(actor.Id, actor.Index, getExtrimities(actor.ShapeInfo), strokes, actor.ShapeInfo.Content[0]); return(actorStroke); case "LINE": SerializedLine line = serialized.ToObject <SerializedLine>(); var points = line.ShapeInfo.Points.ConvertAll <StylusPoint>(point => { return(new StylusPoint(point.X, point.Y)); }); var lineStroke = new BaseLine( line.Id, line.Index, new StylusPointCollection(points), strokes, line.ShapeInfo.FirstAnchorId, line.ShapeInfo.FirstAnchorIndex, line.ShapeInfo.SecondAnchorId, line.ShapeInfo.SecondAnchorIndex, line.ShapeInfo.FirstEndLabel, line.ShapeInfo.SecondEndLabel, line.ShapeInfo.FirstEndRelation, line.ShapeInfo.SecondEndRelation); return(lineStroke); } return(null); }
public UseCaseStroke(StylusPointCollection pts, CustomStrokeCollection strokes) : base(pts, strokes) { this.textContent = new List <string> { "Use Case" }; }
public BaseLine(string id, int index, StylusPointCollection pts, CustomStrokeCollection strokes) : base(id, index, pts, strokes) { this.HandlePoints = new List <Guid>(); for (int i = 0; i < pts.Count; i++) { this.HandlePoints.Add(Guid.NewGuid()); } }
public TextStroke(StylusPointCollection pts, CustomStrokeCollection strokes, bool showBorder) : base(pts, strokes) { this.showBorder = showBorder; this.textContent = new List <string> { "Sample Text" }; }
public ClassStroke(StylusPointCollection pts, CustomStrokeCollection strokes) : base(pts, strokes) { this.textContent = new List <string> { "Class title", "--", "Attribute", "--", "Operations()" }; }
public BaseLine(StylusPointCollection pts, CustomStrokeCollection strokes, string firstAnchorId, int firstAnchorIndex, string secondAnchorId, int secondAnchorIndex) : this(pts, strokes) { if (firstAnchorId != null) { this.FirstAnchorId = firstAnchorId; this.FirstAnchorIndex = firstAnchorIndex; } if (secondAnchorId != null) { this.SecondAncorId = secondAnchorId; this.SecondAncorIndex = secondAnchorIndex; } }
public BaseLine(string id, int index, StylusPointCollection pts, CustomStrokeCollection strokes, string firstAnchorId, int firstAnchorIndex, string secondAnchorId, int secondAnchorIndex, string firstLabel, string secondLabel, string firstRelation, string secondRelation) : this(id, index, pts, strokes) { this.FirstText = firstLabel; this.SecondText = secondLabel; this.FirstRelation = this.GetRelationByName(firstRelation); this.SecondRelation = this.GetRelationByName(secondRelation); if (firstAnchorId != null) { this.FirstAnchorId = firstAnchorId; this.FirstAnchorIndex = firstAnchorIndex; } if (secondAnchorId != null) { this.SecondAncorId = secondAnchorId; this.SecondAncorIndex = secondAnchorIndex; } }
public BaseTrangleStroke(string id, int index, StylusPointCollection pts, CustomStrokeCollection strokes, Color color) : base(id, index, pts, strokes, color) { }
public BaseTrangleStroke(StylusPointCollection pts, CustomStrokeCollection strokes, Color color) : base(pts, strokes, color) { }
public PersonStroke(string id, int index, StylusPointCollection pts, CustomStrokeCollection strokes, string name) : base(id, index, pts, strokes, Colors.White) { this.Name = name; }
public PersonStroke(StylusPointCollection pts, CustomStrokeCollection strokes, string name) : base(pts, strokes) { this.Name = name; }
public PersonStroke(StylusPointCollection pts, CustomStrokeCollection strokes) : this(pts, strokes, "Actor") { }
public ClassStroke(string id, int index, StylusPointCollection pts, CustomStrokeCollection strokes, List <string> Content) : base(id, index, pts, strokes, Colors.White) { this.textContent = Content; }
public ClassStroke(StylusPointCollection pts, CustomStrokeCollection strokes, List <string> Content) : base(pts, strokes) { this.textContent = Content; }
public BaseRectangleStroke(StylusPointCollection pts, CustomStrokeCollection strokes) : base(pts, strokes) { }
public DragHandle(StylusPointCollection pts, int index, CustomStrokeCollection strokes, Guid id, string parentId) : base(index, pts, strokes) { this.Id = id; this.ParentId = parentId; }