private static ShapeStroke createShapeStroke(dynamic shape) { StylusPointCollection points = new StylusPointCollection { new StylusPoint((double)shape.shapeStyle.coordinates.x / 2.1, (double)shape.shapeStyle.coordinates.y / 2.1) }; shape.shapeStyle.height = (double)shape.shapeStyle.height / 2.1; shape.shapeStyle.width = (double)shape.shapeStyle.width / 2.1; shape.shapeStyle.coordinates.x = (double)shape.shapeStyle.coordinates.x / 2.1; shape.shapeStyle.coordinates.y = (double)shape.shapeStyle.coordinates.y / 2.1; ShapeStroke shapeStroke; StrokeTypes type = (StrokeTypes)shape.type; switch (type) { case StrokeTypes.CLASS_SHAPE: shapeStroke = new ClassStroke(shape.ToObject <ClassShape>(), points); break; case StrokeTypes.ARTIFACT: shapeStroke = new ArtifactStroke(shape.ToObject <BasicShape>(), points); break; case StrokeTypes.ACTIVITY: shapeStroke = new ActivityStroke(shape.ToObject <BasicShape>(), points); break; case StrokeTypes.ROLE: shapeStroke = new ActorStroke(shape.ToObject <BasicShape>(), points); break; case StrokeTypes.COMMENT: shapeStroke = new CommentStroke(shape.ToObject <BasicShape>(), points); break; case StrokeTypes.PHASE: shapeStroke = new PhaseStroke(shape.ToObject <BasicShape>(), points); break; case StrokeTypes.FLOATINGTEXT: shapeStroke = new FloatingTextStroke(shape.ToObject <BasicShape>(), points); break; default: shapeStroke = new ClassStroke(shape.ToObject <ClassShape>(), points); break; } shapeStroke.guid = Guid.Parse((string)shape.id); return(shapeStroke); }
private static ShapeStroke ShapeStrokeFromShape(BasicShape shape) { StrokeTypes type = (StrokeTypes)shape.type; ShapeStroke shapeStroke; StylusPointCollection points = new StylusPointCollection(); StylusPoint point = new StylusPoint(shape.shapeStyle.coordinates.x, shape.shapeStyle.coordinates.y); points.Add(point); switch (type) { case StrokeTypes.CLASS_SHAPE: shapeStroke = new ClassStroke((ClassShape)shape, points); break; case StrokeTypes.ARTIFACT: shapeStroke = new ArtifactStroke(shape, points); break; case StrokeTypes.ACTIVITY: shapeStroke = new ActivityStroke(shape, points); break; case StrokeTypes.ROLE: shapeStroke = new ActorStroke(shape, points); break; case StrokeTypes.COMMENT: shapeStroke = new CommentStroke(shape, points); break; case StrokeTypes.PHASE: shapeStroke = new PhaseStroke(shape, points); break; case StrokeTypes.FLOATINGTEXT: shapeStroke = new FloatingTextStroke(shape, points); break; default: shapeStroke = new ActorStroke(shape, points); break; } return(shapeStroke); }