private CaptionShape GetShape(string line, List <Ornament> ornaments) { Shape shape = null; string[] split = line.Split(' '); //string split string[] numbersInString = new string[split.Length - 1]; //new array for storing integers minus first index aka name of shape Array.Copy(split, 1, numbersInString, 0, split.Length - 1); //copy string array to new string array without first index int[] numbers = Array.ConvertAll(numbersInString, int.Parse); //convert strings to integers if (split[0].Equals("rectangle")) { shape = new BasicShape(new Point(numbers[0], numbers[1]), new Point(numbers[0] + numbers[2], numbers[1] + numbers[3]), RectangleDrawer.Instance); } else if (split[0].Equals("ellipse")) { shape = new BasicShape(new Point(numbers[0], numbers[1]), new Point(numbers[0] + numbers[2], numbers[1] + numbers[3]), EllipsDrawer.Instance); } if (shape != null) { CaptionShape s = new CaptionShape(shape); foreach (Ornament ornament in ornaments) { s.AddOrnament(ornament); } return(s); } return(null); }
private BasicShape CreateNodes(String name, double width, double height, double offsetx, double offsety, string borderColor, string stopsColor) { BasicShape node = new BasicShape(); node.Name = name; node.Width = width; node.Height = height; node.OffsetX = offsetx; node.OffsetY = offsety; node.BorderColor = borderColor; node.Shape = BasicShapes.Ellipse; RadialGradient Radial = new RadialGradient(); Radial.CX = 50; Radial.CY = 50; Radial.FX = 50; Radial.FY = 50; Collection Stops = new Collection(); Stop Stop = new Stop(); Stop.Opacity = 0; Stop.Color = "white"; Stop.Offset = 0; Stops.Add(Stop); Stop = new Stop(); Stop.Opacity = 1; Stop.Color = stopsColor; Stop.Offset = 100; Stops.Add(Stop); Radial.Stops = Stops; node.Gradient = Radial; node.BorderWidth = 1; DiagramWebControl1.Nodes.Add(node); return(node); }
static void Main() { Triangle triangle = new Triangle(); triangle.Side = 5; triangle.Heigth = 12.5; Rectangle rectangle = new Rectangle(); rectangle.Width = 4.1; rectangle.Heigth = 2; Circle circle = new Circle(); circle.Radius = 6.3; BasicShape[] shapes = new BasicShape[] { triangle, rectangle, circle, new Rectangle(2, 9), new Circle(7.8), new Triangle(5.3, 4) }; // Printing the surfaces of the figures foreach (BasicShape shape in shapes) { Console.WriteLine("{0,-15}: Area:{1:F4} Perimeter:{2:F4}", shape.GetType().Name, shape.CalculateArea(), shape.CalculatePerimeter()); } }
private Collection populateNodes(Collection Nodes, Collection Connectors) { BasicShape ParentRect = GetRectangle("p"); Nodes.Add(ParentRect); for (int i = 0; i < 2; i++) { BasicShape ChildRect = GetRectangle("c" + i); Nodes.Add(ChildRect); for (int j = 0; j < 2; j++) { BasicShape ChildRect_j = GetRectangle("c" + i + j); Nodes.Add(ChildRect_j); for (int k = 0; k < 6; k++) { BasicShape ChildRect_k = GetRectangle("c" + i + j + k);; Nodes.Add(ChildRect_k); Connectors.Add(ConnectNodes(ChildRect_j, ChildRect_k)); } Connectors.Add(ConnectNodes(ChildRect, ChildRect_j)); } Connectors.Add(ConnectNodes(ParentRect, ChildRect)); } return(Nodes); }
private Node CreateDiagramNode(string name, int width, int height, double x, double y, string text, float labelX, float labelY, string fillColor) { BasicShape node = new BasicShape(); node.Name = name; node.Width = width; node.Height = height; if (fillColor != null) { node.FillColor = fillColor; } node.OffsetX = x; node.OffsetY = y; Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label label = new Label() { Text = text, FontSize = 18, FontFamily = "segoe UI" }; if (labelX != 0 && labelY != 0) { label.Offset = new DiagramPoint() { X = labelX, Y = labelY } } ; node.Labels.Add(label); return(node); } }
private Node CreateNodes(string name, string type, Collection points, string color, string text, double width, double height) { BasicShape node = new BasicShape(); node.Name = name; node.Width = width; node.Height = height; node.OffsetX = node.Width / 2; node.OffsetY = 30; if (type == "polygon") { node.Shape = BasicShapes.Polygon; node.Points = points; } else if (type == "ellipse") { node.Shape = BasicShapes.Path; node.PathData = "M 120 24.9999 C 120 38.8072 109.642 50 96.8653 50 L 23.135 50 C 10.3578 50 0 38.8072 0 24.9999 L 0 24.9999 C 0 11.1928 10.3578 0 23.135 0 L 96.8653 0 C 109.642 0 120 11.1928 120 24.9999 Z"; } else if (type == "rectangle") { node.Shape = BasicShapes.Rectangle; } node.FillColor = color != null ? color : "white"; node.BorderWidth = 2; node.Labels.Add(new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label { Text = "" }); return(node); }
protected void Page_Load(object sender, EventArgs e) { DiagramWebControl1.Height = "500px"; DiagramWebControl1.Width = "100%"; DiagramWebControl1.PageSettings.ScrollLimit = ScrollLimit.Diagram; DiagramWebControl1.PageSettings.PageHeight = 500; DiagramWebControl1.PageSettings.PageWidth = 500; DiagramWebControl1.PageSettings.PageBorderWidth = 1; DiagramWebControl1.PageSettings.PageBackgroundColor = "white"; DiagramWebControl1.PageSettings.PageBorderColor = "black"; DiagramWebControl1.PageSettings.PageMargin = 20; DiagramWebControl1.PageSettings.ShowPageBreak = true; DiagramWebControl1.PageSettings.MultiplePage = true; DiagramWebControl1.PageSettings.PageOrientation = PageOrientation.Landscape; DiagramWebControl1.PageSettings.BoundaryConstraints = BoundaryConstraints.Diagram; DiagramWebControl1.SnapSettings.EnableSnapToObject = true; DiagramWebControl1.SnapSettings.SnapAngle = 1; DiagramWebControl1.SnapSettings.SnapObjectDistance = 10; DiagramWebControl1.SnapSettings.SnapConstraints = SnapConstraints.All; DiagramWebControl1.OnClientCreate = "diagramCreate"; BasicShape node1 = CreateNodes("node1", 60, 60, 170, 105, "#99SF13", "#FBB040"); BasicShape node2 = CreateNodes("node2", 60, 90, 240, 105, "#8BB23F", "#A0D05F"); BasicShape node3 = CreateNodes("node3", 60, 120, 310, 105, "#27A9CC", "#7FDEFF"); BasicShape node4 = CreateNodes("node4", 60, 90, 160, 255, "#99SF13", "#FBB040"); BasicShape node5 = CreateNodes("node5", 90, 90, 240, 255, "#8BB23F", "#A0D05F"); BasicShape node6 = CreateNodes("node6", 60, 90, 320, 255, "#27A9CC", "#7FDEFF"); BasicShape node7 = CreateNodes("node7", 90, 60, 165, 400, "#99SF13", "#FBB040"); BasicShape node8 = CreateNodes("node8", 90, 60, 240, 400, "#8BB23F", "#A0D05F"); BasicShape node9 = CreateNodes("node9", 90, 60, 315, 400, "#27A9CC", "#7FDEFF"); BasicShape node10 = CreateText("node10", 90, 40, 240, 170, "Same Width"); BasicShape node11 = CreateText("node11", 90, 40, 240, 320, "Same Height"); BasicShape node12 = CreateText("node12", 90, 40, 240, 450, "Same Size"); }
private Node CreateNode(string name, double width, double height, double offsetx, double offsety, BasicShapes shape, string text, double corner, string fillColor, double opacity) { BasicShape node = new BasicShape(); node.Name = name; node.Width = width; node.Height = height; node.OffsetX = offsetx; node.OffsetY = offsety; node.FillColor = fillColor; node.CornerRadius = corner; node.Type = Shapes.Basic; node.BorderColor = "transparent"; node.Opacity = opacity; Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label label = new Label() { Text = text, FontSize = 18, FontFamily = "segoe", FontColor = "white", Bold = true }; node.Labels.Add(label); if (shape != null) { node.Shape = shape; } else { node.Shape = BasicShapes.Rectangle; } return(node); }
IEnumerable <IBasicShape> IBar.Render(int currentPosition, PresentationInfo presentationInfo) { List <IBasicShape> shapes = new List <IBasicShape>(); int slidesCount = presentationInfo.SlidesCount; if (presentationInfo.DisableOnFirstSlide && currentPosition == 1) { return(shapes); } if (presentationInfo.DisableOnFirstSlide) { currentPosition -= 1; slidesCount -= 1; } for (int i = 0; i < slidesCount; i++) { IBasicShape shape = new BasicShape(); shape.Height = shape.Width = presentationInfo.UserSize; if (_positionOptions.Top.Selected) { shape.Top = _gap; } else { shape.Top = presentationInfo.Height - presentationInfo.UserSize - _gap; } shape.Left = _gap + (i * (presentationInfo.UserSize + _gap)); if (_positionOptions.Right.Selected) { float leftConstant = slidesCount * presentationInfo.UserSize; leftConstant = presentationInfo.Width - leftConstant - (slidesCount * _gap) - _gap; // Add constant to left margin shape.Left = leftConstant + shape.Left; } shape.Type = MsoAutoShapeType.msoShapeRectangle; // Slides are NOT indexed from 0! if ((i + 1) == currentPosition) { shape.ColorType = ShapeType.Active; } else { shape.ColorType = ShapeType.Inactive; } shapes.Add(shape); } return(shapes); }
IEnumerable<IBasicShape> IBar.Render(int currentPosition, PresentationInfo presentationInfo) { List<IBasicShape> shapes = new List<IBasicShape>(); int slidesCount = presentationInfo.SlidesCount; if (presentationInfo.DisableOnFirstSlide && currentPosition == 1) { return shapes; } if (presentationInfo.DisableOnFirstSlide) { currentPosition -= 1; slidesCount -= 1; } for (int i = 0; i < slidesCount; i++) { IBasicShape shape = new BasicShape(); shape.Height = shape.Width = presentationInfo.UserSize; if (_positionOptions.Top.Selected) { shape.Top = _gap; } else { shape.Top = presentationInfo.Height - presentationInfo.UserSize - _gap; } shape.Left = _gap + (i*(presentationInfo.UserSize + _gap)); if (_positionOptions.Right.Selected) { float leftConstant = slidesCount*presentationInfo.UserSize; leftConstant = presentationInfo.Width - leftConstant - (slidesCount*_gap) - _gap; // Add constant to left margin shape.Left = leftConstant + shape.Left; } shape.Type = MsoAutoShapeType.msoShapeRectangle; // Slides are NOT indexed from 0! if ((i + 1) == currentPosition) { shape.ColorType = ShapeType.Active; } else { shape.ColorType = ShapeType.Inactive; } shapes.Add(shape); } return shapes; }
public ShapeStroke(StylusPointCollection pts, BasicShape basicShape) : base(pts) { guid = Guid.Parse(basicShape.id); name = basicShape.name; strokeType = basicShape.type; shapeStyle = basicShape.shapeStyle; linksTo = basicShape.linksTo; linksFrom = basicShape.linksFrom; }
private BasicShape GetRectangle(string name) { BasicShape node = new BasicShape() { Name = name, Height = 25, Width = 25, BorderColor = "#5e5e5e", BorderWidth = 1, FillColor = "#ff6329", Shape = BasicShapes.Ellipse }; return(node); }
// // GET: /Diagram/ public ActionResult DiagramFeatures() { DiagramProperties model = new DiagramProperties(); model.Height = "600px"; model.Width = "900px"; BasicShape newIdea = CreateNode("NewIdea", 150, 60, 300, 60, "New Idea Identified"); newIdea.Shape = BasicShapes.Path; newIdea.PathData = "M 45 220 L 45 220 A 20 30 0 0 1 45 280 L 45 280 A 20 30 0 0 1 45 220 Z"; BasicShape meeting = CreateNode("Meeting", 150, 60, 300, 150, "Meeting with board"); BasicShape boardDecision = CreateNode("BoardDecision", 150, 100, 300, 270, "Board decides \\nwhether to proceed"); LabelMargin margin = new LabelMargin(0, 20, 20, 0); ((Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label)boardDecision.Labels[0]).Margin = margin; boardDecision.Shape = BasicShapes.Polygon; boardDecision.Points = GetDecisionPoints(); BasicShape project = CreateNode("project", 150, 100, 300, 420, "Find Project manager"); project.Shape = BasicShapes.Polygon; project.Points = GetDecisionPoints(); BasicShape end = CreateNode("End", 120, 60, 300, 545, "Implement\\n and Deliver"); BasicShape decision = CreateNode("Decision", 250, 60, 550, 60, "Decision Process for new software ideas"); Collection points = new Collection(); points.Add(new DiagramPoint(280, 60)); points.Add(new DiagramPoint(400, 60)); points.Add(new DiagramPoint(400, 110)); points.Add(new DiagramPoint(260, 110)); points.Add(new DiagramPoint(260, 75)); decision.Shape = BasicShapes.Polygon; decision.Points = points; decision.FillColor = "#858585"; decision.BorderColor = "#1BA0E2"; BasicShape reject = CreateNode("Reject", 150, 60, 550, 270, "Reject and write report"); BasicShape resources = CreateNode("Resources", 150, 60, 550, 420, "Hire new resources"); ConnectNode(model, newIdea, meeting, "", false); ConnectNode(model, meeting, boardDecision, "", false); ConnectNode(model, boardDecision, reject, "No", true); ConnectNode(model, boardDecision, project, "Yes", true); ConnectNode(model, project, resources, "No", true); ConnectNode(model, project, end, "No", true); model.Nodes.Add(newIdea); model.Nodes.Add(meeting); model.Nodes.Add(boardDecision); model.Nodes.Add(project); model.Nodes.Add(end); model.Nodes.Add(decision); model.Nodes.Add(reject); model.Nodes.Add(resources); model.EnableContextMenu = false; model.SnapSettings.SnapConstraints = SnapConstraints.ShowLines | SnapConstraints.SnapToLines; ViewData["diagramModel"] = model; return(View()); }
// // GET: /Diagram/ public ActionResult PageSettings() { DiagramProperties model = new DiagramProperties(); model.Height = "500px"; model.Width = "100%"; model.PageSettings.ScrollLimit = ScrollLimit.Diagram; model.PageSettings.PageHeight = 500; model.PageSettings.PageWidth = 500; model.PageSettings.PageBorderWidth = 1; model.PageSettings.PageBackgroundColor = "white"; model.PageSettings.PageBorderColor = "black"; model.PageSettings.PageMargin = 20; model.PageSettings.ShowPageBreak = true; model.PageSettings.MultiplePage = true; model.PageSettings.PageOrientation = PageOrientation.Landscape; model.PageSettings.BoundaryConstraints = BoundaryConstraints.Diagram; model.SnapSettings.EnableSnapToObject = true; model.SnapSettings.SnapAngle = 1; model.SnapSettings.SnapObjectDistance = 10; model.EnableContextMenu = false; model.Create = "diagramCreate"; BasicShape node1 = CreateNodes("node1", 60, 60, 170, 105, "#99SF13", "#FBB040"); BasicShape node2 = CreateNodes("node2", 60, 90, 240, 105, "#8BB23F", "#A0D05F"); BasicShape node3 = CreateNodes("node3", 60, 120, 310, 105, "#27A9CC", "#7FDEFF"); BasicShape node4 = CreateNodes("node4", 60, 90, 160, 255, "#99SF13", "#FBB040"); BasicShape node5 = CreateNodes("node5", 90, 90, 240, 255, "#8BB23F", "#A0D05F"); BasicShape node6 = CreateNodes("node6", 60, 90, 320, 255, "#27A9CC", "#7FDEFF"); BasicShape node7 = CreateNodes("node7", 90, 60, 165, 400, "#99SF13", "#FBB040"); BasicShape node8 = CreateNodes("node8", 90, 60, 240, 400, "#8BB23F", "#A0D05F"); BasicShape node9 = CreateNodes("node9", 90, 60, 315, 400, "#27A9CC", "#7FDEFF"); BasicShape node10 = CreateText("node10", 90, 40, 240, 170, "Same Width"); BasicShape node11 = CreateText("node11", 90, 40, 240, 320, "Same Height"); BasicShape node12 = CreateText("node12", 90, 40, 240, 450, "Same Size"); model.Nodes.Add(node1); model.Nodes.Add(node2); model.Nodes.Add(node3); model.Nodes.Add(node4); model.Nodes.Add(node5); model.Nodes.Add(node6); model.Nodes.Add(node7); model.Nodes.Add(node8); model.Nodes.Add(node9); model.Nodes.Add(node10); model.Nodes.Add(node11); model.Nodes.Add(node12); ViewData["diagramModel"] = model; ViewData["DropDownSource"] = DropDownData.GetColors(); ViewData["SnapDataSource"] = DropDownData.GetSnapItems(); ViewData["Orientation"] = DropDownData.GetOrientation(); ViewData["Boundary"] = DropDownData.GetBoundary(); return(View()); }
private IBasicShape MakeShapeStub(PresentationInfo presentation) { IBasicShape shapeStub = new BasicShape(); shapeStub.Height = presentation.UserSize; shapeStub.Top = 0; shapeStub.Left = 0; shapeStub.Type = MsoAutoShapeType.msoShapeRectangle; return(shapeStub); }
private Connector ConnectNodes(BasicShape ParentNode, BasicShape ChildNode) { Connector connector = new Connector() { Name = ParentNode.Name + ChildNode.Name, SourceNode = ParentNode.Name, TargetNode = ChildNode.Name, LineColor = "black", TargetDecorator = new Decorator() { Shape = DecoratorShapes.None } }; return(connector); }
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); }
private static UpdateFormsData createUpdateFormsData(StrokeCollection strokes) { List <BasicShape> forms = new List <BasicShape>(); foreach (CustomStroke customStroke in strokes) { if (!customStroke.isLinkStroke()) { if (customStroke.strokeType == (int)StrokeTypes.CLASS_SHAPE) { BasicShape basicShape = (customStroke as ClassStroke).GetBasicShape().forServer(); if (basicShape.linksTo == null) { basicShape.linksTo = new List <string>(); } if (basicShape.linksFrom == null) { basicShape.linksFrom = new List <string>(); } if (basicShape.shapeStyle == null) { basicShape.shapeStyle = new ShapeStyle(new Coordinates(0, 0), 1, 1, 0, "#000000", 0, "#00000000"); } forms.Add(basicShape); } else { BasicShape basicShape = (customStroke as ShapeStroke).GetBasicShape().forServer(); if (basicShape.linksTo == null) { basicShape.linksTo = new List <string>(); } if (basicShape.linksFrom == null) { basicShape.linksFrom = new List <string>(); } if (basicShape.shapeStyle == null) { basicShape.shapeStyle = new ShapeStyle(new Coordinates(0, 0), 1, 1, 0, "#000000", 0, "#00000000"); } forms.Add(basicShape); } } } return(new UpdateFormsData(username, canvasName, forms)); }
//Adding Elements private BasicShape AddNode(Dictionary <Elements, string> dict, int id, double x, double y, Elements element, double width, double height) { BasicShape node = new BasicShape() { Name = "node" + id.ToString(), OffsetX = x, OffsetY = y, Shape = BasicShapes.Path, PathData = dict[element], Width = width, Height = height, FillColor = "black", BorderColor = "none" }; return(node); }
private BasicShape CreateNode(String name, double width, double height, double offsetx, double offsety, string labelText) { BasicShape node = new BasicShape(); node.Name = name; node.Width = width; node.Height = height; node.OffsetX = offsetx; node.OffsetY = offsety; node.FillColor = "#1BA0E2"; node.BorderColor = "#1BA0E2"; Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label label = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label(); label.Text = labelText; label.FontColor = "white"; label.Name = name + "_label"; node.Labels.Add(label); return(node); }
private BasicShape CreateText(String name, double width, double height, double offsetx, double offsety, string labelText) { BasicShape node = new BasicShape(); node.Name = name; node.Width = width; node.Height = height; node.OffsetX = offsetx; node.OffsetY = offsety; node.FillColor = "transparent"; node.BorderWidth = 1; node.BorderColor = "transparent"; node.Constraints = NodeConstraints.Default & ~NodeConstraints.Select; Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label label = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label(); label.Text = labelText; label.Name = name + "_label"; node.Labels.Add(label); return(node); }
private Node CreateDiagramNode(string name, int width, int height, string fillColor, string text, int mLeft, int mTop, bool path) { BasicShape node = new BasicShape(); node.Name = name; node.Width = width; node.Height = height; node.FillColor = fillColor; node.Labels.Add(new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label { Text = text, FontSize = 11 }); if (path) { node.Shape = BasicShapes.Path; node.PathData = "M 120 24.9999 C 120 38.8072 109.642 50 96.8653 50 L 23.135 50 C 10.3578 50 0 38.8072 0 24.9999 L 0 24.9999 C 0 11.1928 10.3578 0 23.135 0 L 96.8653 0 C 109.642 0 120 11.1928 120 24.9999 Z"; } node.MarginLeft = mLeft; node.MarginTop = mTop; return(node); }
private Node CreateDefaultNode(string text, string fill) { BasicShape node = new BasicShape(); node.Shape = BasicShapes.Rectangle; node.FillColor = fill; node.Width = 120; node.Height = 70; node.BorderWidth = 0; Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label label = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label(); label.Offset = new DiagramPoint(0.5F, 0.3F); label.FontColor = "white"; node.Labels.Add(label); Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label label1 = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label(); label1.Offset = new DiagramPoint(0.5F, 0.6F); label1.FontColor = "white"; node.Labels.Add(label1); return(node); }
private void CreateNode(String nodeName, int x, int y, int width, int height, List <Node> nodeCollection, String addInfo = null) { BasicShape node = new BasicShape(); node.Name = nodeName; node.OffsetX = x + 7; node.OffsetY = y + 12; node.Width = width; node.Height = height; if (addInfo == "booked") { node.FillColor = "red"; node.AddInfo = addInfo; } else { node.AddInfo = ""; } nodeCollection.Add(node); }
private Node CreateDiagramNode(string name, int width, int height, string fillColor, string text, int x, int y, bool path) { BasicShape node = new BasicShape(); node.Name = name; node.Width = width; node.Height = height; node.FillColor = fillColor; node.OffsetX = x; node.OffsetY = y; node.BorderColor = "black"; node.Labels.Add(new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label { Text = text, FontSize = 11 }); if (path) { node.Shape = BasicShapes.Path; node.PathData = "M 0 26.4576 L 26.4576 0 L 26.4576 0 L 26.4576 17.46239 L 26.4576 17.46239 L 113.3856 17.46239 L 113.3856 17.46239 L 113.3856 35.45279 L 113.3856 35.45279 L 26.4576 35.45279 L 26.4576 35.45279 L 26.4576 52.91519 L 26.4576 52.91519 L 0 26.4576 Z"; } return(node); }
private Node addNode(string type, string text, string fill, DiagramProperties model) { if (type == "right" || type == "left" || type == "root") { BasicShape node = new BasicShape(); node.Ports.Add(GetPort(0, 0.5f, node)); node.Ports.Add(GetPort(1, 0.5f, node)); node.Shape = BasicShapes.Rectangle; node.CornerRadius = 5; InitializeNode(node, type, text, fill, model); return(node); } else { NativeNode node = new NativeNode(); node.Ports.Add(GetPort(0, 1, node)); node.Ports.Add(GetPort(1, 1, node)); node.TemplateId = "nativeContent"; InitializeNode(node, type, text, fill, model); return(node); } }
//Adding Element label private BasicShape AddLabel(int id, double x, double y, string label) { BasicShape node = new BasicShape() { Name = "node" + id.ToString(), OffsetX = x, OffsetY = y, Width = 100, Height = 50, Labels = new Collection() { new Label() { Text = label, Bold = true, FontSize = 14, FontFamily = "segoe UI" } }, FillColor = "transparent", BorderColor = "none" }; return(node); }
//Adding node private Node addNode(string type, string text, string fill) { if (type == "right" || type == "left" || type == "root") { BasicShape node = new BasicShape(); node.Ports.Add(GetPort(0, 0.5f, node)); node.Ports.Add(GetPort(1, 0.5f, node)); node.Shape = BasicShapes.Rectangle; node.CornerRadius = 5; initializeNode(node, type, text, fill); return(node); } else { NativeNode node = new NativeNode(); node.Ports.Add(GetPort(0, 1, node)); node.Ports.Add(GetPort(1, 1, node)); node.TemplateId = "nativeContent"; node.Scale = ScaleConstraints.Stretch; initializeNode(node, type, text, fill); return(node); } }
private Node CreateNode(string nodeName, double x, double y, double width, double height, string addInfo) { BasicShape node = new BasicShape(); node.Name = nodeName; node.Width = width; node.Height = height; node.OffsetX = x; node.OffsetY = y + 5; if (addInfo == "booked") { node.FillColor = "red"; Dictionary <string, object> addInfo1 = new Dictionary <string, object>(); addInfo1.Add("type", addInfo as object); node.AddInfo = addInfo1; } else { node.AddInfo = null; } return(node); }
private void ConnectNode(DiagramProperties model, BasicShape targetNode, BasicShape sourceNode, string labelText, bool hasLabel) { Connector connector = new Connector(); connector.Name = "line" + model.Connectors.Count + 1; connector.Segments = new Collection() { new Segment(Segments.Straight) }; connector.TargetNode = targetNode.Name; connector.SourceNode = sourceNode.Name; if (hasLabel) { Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label label = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Label(); label.FontColor = "black"; label.FillColor = "white"; label.Text = labelText; connector.Labels.Add(label); } connector.SourceDecorator.Shape = DecoratorShapes.Arrow; connector.TargetDecorator.Shape = DecoratorShapes.None; model.Connectors.Add(connector); }
private IBasicShape MakeShapeStub(PresentationInfo presentation) { IBasicShape shapeStub = new BasicShape(); shapeStub.Height = presentation.UserSize; shapeStub.Top = 0; shapeStub.Left = 0; shapeStub.Type = MsoAutoShapeType.msoShapeRectangle; return shapeStub; }
// // GET: /DrawingTools/ public ActionResult DrawingTools() { DiagramProperties model = new DiagramProperties(); model.Height = "700px"; model.Width = "700px"; BasicShape rectangle = CreateNode(BasicShapes.Rectangle, 100, 100, 150, 150, "Rectangle", "#fcbc7c", "#f89b4c"); BasicShape RoundedRectangle = CreateNode(BasicShapes.Rectangle, 100, 100, 350, 150, "RoundRect", "#f58f7a", "#f15e50"); RoundedRectangle.CornerRadius = 5; BasicShape Ellipse = CreateNode(BasicShapes.Ellipse, 100, 100, 550, 150, "Ellipse", "#85cec1", "#4bbca7"); BasicShape Polygon = CreateNode(BasicShapes.Polygon, 100, 100, 150, 350, "Polygon", "#c19ab8", "#ad6fa1"); Collection points = new Collection(); points.Add(new DiagramPoint(13.560f, 67.524f)); points.Add(new DiagramPoint(21.941f, 41.731f)); points.Add(new DiagramPoint(0.05f, 25.790f)); points.Add(new DiagramPoint(27.120f, 25.790f)); points.Add(new DiagramPoint(35.501f, 0.05f)); points.Add(new DiagramPoint(43.882f, 25.790f)); points.Add(new DiagramPoint(71.000f, 25.790f)); points.Add(new DiagramPoint(49.061f, 41.731f)); points.Add(new DiagramPoint(57.441f, 67.524f)); points.Add(new DiagramPoint(35.501f, 51.583f)); points.Add(new DiagramPoint(13.560f, 67.524f)); Polygon.Points = points; BasicShape Path = CreateNode(BasicShapes.Path, 100, 100, 350, 350, "Path", "#fbe172", "#f4cd2a"); Path.PathData = "M78.631,3.425c-0.699-1.229-2.177-2.653-5.222-2.394c-8.975,0.759-26.612,16.34-30.804,22.411c-0.167-0.79-0.551-2.049-1.377-2.741c1.176-2.069,3.035-5.709,3.813-9.156c0.18-0.044,0.338-0.161,0.385-0.41c0.083-0.423,0.146-0.848,0.23-1.268c0.135-0.706-0.962-0.944-1.086-0.245c-0.078,0.431-0.158,0.852-0.234,1.286c-0.04,0.26,0.076,0.464,0.26,0.569c-0.756,3.361-2.575,6.93-3.737,8.975c-0.2-0.105-0.415-0.189-0.661-0.224c-0.07-0.009-0.132,0.005-0.199,0.003c-0.067,0.002-0.129-0.012-0.199-0.003c-0.246,0.035-0.461,0.119-0.661,0.224c-1.162-2.045-2.981-5.613-3.737-8.975c0.185-0.104,0.301-0.309,0.26-0.569c-0.076-0.434-0.156-0.855-0.234-1.286c-0.124-0.699-1.221-0.46-1.086,0.245c0.085,0.42,0.147,0.845,0.23,1.268c0.047,0.249,0.205,0.367,0.385,0.41c0.777,3.446,2.637,7.087,3.813,9.156c-0.826,0.692-1.21,1.951-1.377,2.741C33.203,17.371,15.566,1.789,6.591,1.031C3.546,0.772,2.068,2.196,1.369,3.425c-0.818,1.407-0.185,4.303,0.993,9.321c0.53,2.228,1.075,4.521,1.465,6.779c0.208,1.239,0.404,2.471,0.59,3.65c0.819,5.33,1.503,9.766,3.714,11.187c0.606,0.39,1.313,0.55,2.179,0.442c2.107-0.46,4.627-0.845,7.293-1.12c-2.613,1.77-5.88,4.65-6.953,8.474c-0.827,2.989-0.175,6.031,1.932,9.083c2.482,3.569,5.027,5.915,7.406,7.444c4.756,3.057,8.874,2.843,10.613,2.75c0.179-0.002,0.318-0.014,0.453-0.018c1.324-0.017,2.23-1.868,4.161-6.064c0.948-2.044,2.358-5.088,3.546-6.638c0.249,0.57,0.96,0.972,1.331,1.085c-0.03,0.014-0.067,0.039-0.094,0.049c0.034-0.007,0.074-0.03,0.111-0.042c0.022,0.006,0.055,0.023,0.074,0.027c-0.017-0.006-0.046-0.022-0.066-0.03c0.391-0.131,0.876-0.532,1.119-1.088c1.188,1.549,2.598,4.594,3.546,6.638c1.931,4.196,2.838,6.047,4.161,6.064c0.135,0.004,0.274,0.016,0.453,0.018c1.739,0.093,5.857,0.307,10.613-2.75c2.379-1.529,4.924-3.875,7.406-7.444c2.106-3.052,2.759-6.094,1.932-9.083c-1.073-3.823-4.34-6.704-6.953-8.474c2.667,0.274,5.186,0.659,7.293,1.12c0.866,0.108,1.573-0.053,2.179-0.442c2.211-1.421,2.895-5.857,3.714-11.187c0.185-1.18,0.382-2.411,0.59-3.65c0.39-2.258,0.935-4.551,1.465-6.779C78.816,7.728,79.448,4.832,78.631,3.425z M41.184,48.732c-0.343,0.551-0.781,0.918-1.082,1.065c-0.324-0.135-0.933-0.497-1.286-1.065c0,0-1.506-19.959-1.349-24.911c0,0,0.509-3.147,2.533-3.169c2.024,0.022,2.533,3.169,2.533,3.169C42.69,28.773,41.184,48.732,41.184,48.732z"; ImageNode Image = new ImageNode { Name = "Image", Width = 100, Height = 100, OffsetX = 550, OffsetY = 350, FillColor = "white", BorderColor = "black", Scale = ScaleConstraints.Stretch, Labels = new Collection() { new Label() } }; Image.Source = "../images/Employee/6.png"; HtmlNode Html = new HtmlNode() { Name = "Html", Type = Shapes.Html, Width = 100, Height = 100, OffsetX = 150, OffsetY = 550, FillColor = "#68a3d6", BorderColor = "#3382c4", TemplateId = "htmlTemplate" }; NativeNode Native = new NativeNode { Name = "Native", Width = 100, Height = 100, OffsetX = 350, OffsetY = 550, FillColor = "#de6ca9", BorderColor = "#de6ca9", Scale = ScaleConstraints.Stretch, TemplateId = "svgTemplate", Labels = new Collection() { new Label() } }; TextNode Text = new TextNode() { Name = "Text", Width = 100, Height = 100, OffsetX = 550, OffsetY = 550, FillColor = "transparent", BorderColor = "transparent", Labels = new Collection() { new Label() } }; TextBlock block = new TextBlock(); block.Text = "Text Node"; Text.TextBlock = block; model.Nodes.Add(rectangle); model.Nodes.Add(RoundedRectangle); model.Nodes.Add(Ellipse); model.Nodes.Add(Polygon); model.Nodes.Add(Path); model.Nodes.Add(Image); model.Nodes.Add(Html); model.Nodes.Add(Native); model.Nodes.Add(Text); model.NodeCollectionChange = "nodeCollectionChange"; ViewData["diagramModel"] = model; return(View()); }
public virtual void ResetColors() { BasicShape shape = new BasicShape(); this.backColor = shape.BackColor; this.borderColor = shape.BorderColor; }