private void ConnectNodes(DiagramProperties model, string sourceNode, string targetNode, Collection segments = null, Label label = null, string sourcePort = "", string targetPort = "") { Connector connector = new Connector(); connector.Name = "line" + model.Connectors.Count + 1; connector.TargetNode = targetNode; connector.SourceNode = sourceNode; connector.SourcePort = sourcePort; connector.TargetPort = targetPort; connector.LineWidth = 2; connector.Constraints = ConnectorConstraints.Default | ConnectorConstraints.Bridging; if (segments == null) { segments = new Collection() { new Segment() { Type = Segments.Orthogonal } } } ; connector.Segments = segments; if (label != null) { label.FillColor = "white"; connector.Labels = new Collection() { label }; } model.Connectors.Add(connector); } }
private void GenerateDiagramNodes(DiagramProperties DiagramContent) { DiagramContent.Nodes.Add(GenerateDiagramNode("server1", 50, 65, 130, 75, "svgTemplate7", "server", "Bottom", 10, 0F, 0F, "port")); DiagramContent.Nodes.Add(GenerateDiagramNode("server2", 50, 65, 80, 75, "svgTemplate7", "", "", 0, 0.5f, 0.5f, "port")); DiagramContent.Nodes.Add(GenerateDiagramNode("WorkStation1", 60, 70, 250, 75, "svgTemplate8", "WorkStation", "Bottom", 10, 1.4f, 0.2f, "port2")); DiagramContent.Nodes.Add(GenerateDiagramNode("WorkStation2", 60, 75, 350, 75, "svgTemplate8", "", "", 0, 0.5f, 0.5f, "port2")); DiagramContent.Nodes.Add(GenerateDiagramNode("modem1", 40, 40, 450, 125, "svgTemplate6", "Modem", "Right", 20, 0f, 0.5f, "portmo")); DiagramContent.Nodes.Add(GenerateDiagramNode("modem2", 40, 40, 525, 175, "svgTemplate6", "Modem1", "Bottom", 10, 0.5f, 0f, "portmo")); DiagramContent.Nodes.Add(GenerateDiagramNode("RemoteController1", 25, 50, 600, 125, "svgTemplate4", "RemoteController", "Bottom", 10, 0.5f, 0f, "portrc")); DiagramContent.Nodes.Add(GenerateDiagramNode("modem3", 40, 40, 350, 205, "svgTemplate6", "Modem4", "Left", 25, 1f, 0.5f, "portmo")); DiagramContent.Nodes.Add(GenerateDiagramNode("modem4", 40, 40, 450, 245, "svgTemplate6", "Modem2", "", 0, 0.5f, 1.2f, "portmo")); DiagramContent.Nodes.Add(GenerateDiagramNode("modem5", 40, 40, 350, 330, "svgTemplate6", "Modem3", "Right", 25, 0f, 0.5f, "portmo")); DiagramContent.Nodes.Add(GenerateDiagramNode("WorkStation3", 60, 70, 600, 250, "svgTemplate8", "RemoteWorkstation", "Bottom", 7, 0.5f, 0, "port2")); DiagramContent.Nodes.Add(GenerateDiagramNode("WorkStation4", 60, 70, 600, 335, "svgTemplate8", "PortableWorkstation", "Top", 7, 0.5f, 1f, "port2")); DiagramContent.Nodes.Add(GenerateDiagramNode("RemoteController2", 25, 50, 70, 400, "svgTemplate4", "ControlLogic", "Top", 8, 0.5f, 1f, "portrc")); DiagramContent.Nodes.Add(GenerateDiagramNode("RemoteController3", 25, 50, 500, 400, "svgTemplate4", "ControlLogic1", "Top", 8, 0.5f, 1f, "portrc")); DiagramContent.Nodes.Add(GenerateDiagramNode("AnalogIO", 40, 50, 160, 500, "svgTemplate5", "AnalogIO", "Top", 13, 0.5f, 1f, "port")); DiagramContent.Nodes.Add(GenerateDiagramNode("sensor", 50, 55, 260, 510, "svgTemplate1", "sensor", "Right", 15, 0.7f, 1f, "portws")); DiagramContent.Nodes.Add(GenerateDiagramNode("DeviceDriver1", 40, 50, 360, 500, "svgTemplate2", "Driver", "", 0, 0.5f, 1.2f, "port")); DiagramContent.Nodes.Add(GenerateDiagramNode("DeviceDriver2", 40, 50, 460, 500, "svgTemplate2", "Driver", "", 0, 0.5f, 1.2f, "port")); DiagramContent.Nodes.Add(GenerateDiagramNode("DeviceDriver3", 40, 50, 550, 500, "svgTemplate2", "Driver", "", 0, 0.5f, 1.2f, "port")); DiagramContent.Nodes.Add(GenerateDiagramNode("HMI", 40, 50, 625, 450, "svgTemplate3", "HMI", "", 0, 0.5f, 1.2f, "portmo")); DiagramContent.Nodes.Add(CreateTextNode("controlNet", 127, 40, "Control Net", 218.5, 380)); DiagramContent.Nodes.Add(CreateTextNode("etherNet", 127, 40, "Ethernet", 218.5, 190)); DiagramContent.Nodes.Add(CreateTextNode("deviceNet", 127, 40, "Device Net", 345.5, 575)); }
// // GET: /SymmetricalLayout/ public ActionResult SymmetricalLayout() { DiagramProperties model = new DiagramProperties(); model.Height = "550px"; model.Width = "100%"; model.PageSettings.ScrollLimit = ScrollLimit.Diagram; model.Layout.Type = LayoutTypes.SymmetricLayout; model.Layout.SpringLength = 80; model.Layout.MaxIteration = 500; model.Layout.SpringFactor = .8F; model.Layout.Margin.Left = 0; model.Layout.Margin.Top = 20; Collection Nodes = new Collection(); Collection Connectors = new Collection(); populateNodes(Nodes, Connectors); model.Nodes = Nodes; model.Connectors = Connectors; model.DefaultSettings.Node = new Node() { Constraints = NodeConstraints.Default & ~NodeConstraints.Drag, }; model.DefaultSettings.Connector = new Connector() { Constraints = ConnectorConstraints.Default & ConnectorConstraints.Select, }; model.EnableContextMenu = false; ViewData["diagramModel"] = model; return(View()); }
private static void GenerateHeader(StringBuilder sb, string uid, DiagramProperties prop) { sb.Append(Constants.PrefixRoot); sb.Append(Constants.ArgumentSeparator); sb.Append(uid == null ? DefaultUid : uid); sb.Append(Constants.ArgumentSeparator); sb.Append(prop.PageWidth); sb.Append(Constants.ArgumentSeparator); sb.Append(prop.PageHeight); sb.Append(Constants.ArgumentSeparator); sb.Append(prop.GridOriginX); sb.Append(Constants.ArgumentSeparator); sb.Append(prop.GridOriginY); sb.Append(Constants.ArgumentSeparator); sb.Append(prop.GridWidth); sb.Append(Constants.ArgumentSeparator); sb.Append(prop.GridHeight); sb.Append(Constants.ArgumentSeparator); sb.Append(prop.GridSize); sb.Append(Constants.ArgumentSeparator); sb.Append(prop.SnapX); sb.Append(Constants.ArgumentSeparator); sb.Append(prop.SnapY); sb.Append(Constants.ArgumentSeparator); sb.Append(prop.SnapOffsetX); sb.Append(Constants.ArgumentSeparator); sb.Append(prop.SnapOffsetY); sb.Append(Environment.NewLine); }
//Adding a connection private void Connect(Node tail, Node head, DiagramProperties model) { Connector conn = new Connector(); conn.Segments = new Collection(); Segment seg = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Segment(Segments.Bezier); conn.Segments.Add(seg); conn.Constraints = conn.Constraints & ~(ConnectorConstraints.Select); conn.Name = "connector_" + model.Connectors.Count; conn.TargetNode = head.Name; conn.SourceNode = tail.Name; conn.Visible = false; Dictionary <string, object> addInfo = head.AddInfo as Dictionary <string, object>; if (addInfo["type"].ToString() == "right" || addInfo["type"].ToString() == "subright") { conn.SourcePort = (tail.Ports[1] as Port).Name; conn.TargetPort = (head.Ports[0] as Port).Name; } else if (addInfo["type"].ToString() == "left" || addInfo["type"].ToString() == "subleft") { conn.SourcePort = (tail.Ports[0] as Port).Name; conn.TargetPort = (head.Ports[1] as Port).Name; } conn.TargetDecorator.Shape = DecoratorShapes.None; model.Connectors.Add(conn); }
private void ConnBPMNNode(DiagramProperties model, string sourceNode, string targetNode, Collection segments = null, Label label = null) { Connector connector = new Connector(); connector.TargetNode = targetNode; connector.SourceNode = sourceNode; if (segments == null) { segments = new Collection() { new Segment() { Type = Segments.Orthogonal } } } ; connector.Segments = segments; if (label != null) { label.FillColor = "white"; connector.Labels = new Collection() { label }; } model.Connectors.Add(connector); } }
private Connector ConnectDiagramNode(DiagramProperties model, Node targetNode, Node sourceNode, string labelText) { Connector connector = new Connector(); connector.Name = "line" + model.Connectors.Count + 1; connector.Segments = new Collection(); Segment seg = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.Segment(Segments.Orthogonal); connector.Segments.Add(seg); connector.TargetNode = targetNode.Name; connector.SourceNode = sourceNode.Name; connector.LineWidth = 2; if (!string.IsNullOrEmpty(labelText)) { 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 = Syncfusion.JavaScript.DataVisualization.DiagramEnums.DecoratorShapes.Arrow; connector.TargetDecorator.Shape = Syncfusion.JavaScript.DataVisualization.DiagramEnums.DecoratorShapes.None; connector.TargetDecorator.BorderColor = "#606060"; connector.TargetDecorator.Width = 10; connector.TargetDecorator.Height = 10; model.Connectors.Add(connector); return(connector); }
private BPMNNode CreateBPMN(DiagramProperties model, String name, BPMNShapes shape, double width, double height, double offsetx, double offsety, string text = "") { BPMNNode node = new BPMNNode(); node.Name = name; node.Shape = shape; node.Width = width; node.Height = height; node.OffsetX = offsetx; node.OffsetY = offsety; Label label = new Label(); label.Text = text; label.FontColor = "black"; if (shape == BPMNShapes.Event && shape == BPMNShapes.Activity && text != "") { label.Offset = new DiagramPoint() { Y = 1 }; label.VerticalAlignment = VerticalAlignment.Top; } else { label.Offset = new DiagramPoint() { Y = 0.5f } }; node.Labels.Add(label); model.Nodes.Add(node); return(node); }
public void CreateDiagram(DiagramProperties Diagram) { Diagram.Height = "600px"; Diagram.Width = "100%"; Diagram.RulerSettings.ShowRulers = true; Diagram.RulerSettings.HorizontalRuler.Interval = 6; Diagram.RulerSettings.HorizontalRuler.ArrangeTick = "arrangeTick"; Diagram.RulerSettings.VerticalRuler.Interval = 6; Diagram.RulerSettings.VerticalRuler.ArrangeTick = "arrangeTick"; CreateRularNode("NewIdea", 150, 60, 300, 60, "New idea identified", FlowShapes.Terminator, Diagram); CreateRularNode("Meeting", 150, 60, 300, 155, "Meeting with board", FlowShapes.Process, Diagram); CreateRularNode("BoardDecision", 150, 110, 300, 280, "Board decides \nwhether \nto proceed", FlowShapes.Decision, Diagram); CreateRularNode("Project", 150, 100, 300, 430, "Find Project \nmanager", FlowShapes.Decision, Diagram); CreateRularNode("End", 150, 60, 300, 555, "Implement and Deliver", FlowShapes.Process, Diagram); CreateRularNode("Decision", 250, 60, 550, 60, "Decision Process for new software ideas", FlowShapes.Card, Diagram); CreateRularNode("Reject", 150, 60, 550, 285, "Reject and write report", FlowShapes.Process, Diagram); CreateRularNode("Resources", 150, 60, 550, 430, "Hire new resources", FlowShapes.Process, Diagram); createRulerConnector("connector1", "NewIdea", "Meeting", null, Diagram); createRulerConnector("connector2", "Meeting", "BoardDecision", null, Diagram); createRulerConnector("connector3", "BoardDecision", "Project", "Yes", Diagram); createRulerConnector("connector4", "Project", "End", "Yes", Diagram); createRulerConnector("connector5", "BoardDecision", "Reject", "No", Diagram); createRulerConnector("connector6", "Project", "Resources", "No", Diagram); }
public void GenerateDiagram(DiagramProperties diagram) { diagram.Height = "100%"; diagram.Width = "100%"; diagram.SelectorConstraints = SelectorConstraints.All ^ SelectorConstraints.Rotator; GenerateDiagramNodes(diagram); GenerateDiagramConnectors(diagram); }
public void GenerateDiagram1(DiagramProperties DiagramContent) { DiagramContent.Height = "100%"; DiagramContent.Width = "100%"; DiagramContent.SnapSettings.SnapConstraints = SnapConstraints.None; GenerateDiagramNodes(DiagramContent); GenerateDiagramConnectors(DiagramContent); }
public ActionResult Ruler() { DiagramProperties Diagram = new DiagramProperties(); CreateDiagram(Diagram); ViewData["diagramModel"] = Diagram; return(View()); }
// // 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 void GenerateDiagramConnectors(DiagramProperties diagram) { diagram.Connectors.Add(GenerateDiagramConnector("connector1", "Order", "selectItemaddcart")); diagram.Connectors.Add(GenerateDiagramConnector("connector2", "selectItemaddcart", "paymentondebitcreditcard")); diagram.Connectors.Add(GenerateDiagramConnector("connector3", "paymentondebitcreditcard", "getmaildetailaboutorder")); diagram.Connectors.Add(GenerateDiagramConnector("connector4", "getmaildetailaboutorder", "pakingitem")); diagram.Connectors.Add(GenerateDiagramConnector("connector5", "pakingitem", "sendcourieraboutaddress")); diagram.Connectors.Add(GenerateDiagramConnector("connector6", "sendcourieraboutaddress", "deliveryonthataddress")); diagram.Connectors.Add(GenerateDiagramConnector("connector7", "deliveryonthataddress", "getitItem")); }
// // GET: /HierarchicalLayout/ public ActionResult HierarchicalLayout() { DiagramProperties model = new DiagramProperties(); model.Height = "400px"; model.Width = "100%"; model.PageSettings.ScrollLimit = ScrollLimit.Diagram; model.Layout.Type = LayoutTypes.HierarchicalTree; model.Layout.HorizontalSpacing = 25; model.Layout.VerticalSpacing = 35; model.Layout.Margin.Left = 0; model.Layout.Margin.Top = 10; model.DataSourceSettings.DataSource = GetHierarchicalLayout(); model.DataSourceSettings.Parent = "ReportingPerson"; model.DataSourceSettings.Id = "Name"; model.Create = "create"; model.DefaultSettings.Node = new Node() { Constraints = NodeConstraints.Select | NodeConstraints.PointerEvents, FillColor = "#88C65C", Width = 115, Height = 45, BorderWidth = 1, BorderColor = "black" }; Label label = new Label() { FontColor = "white", FontSize = 12 }; model.DefaultSettings.Node.Labels.Add(label); model.DefaultSettings.Connector = new Connector() { LineColor = "#000000", Segments = new Collection() { new Segment(Segments.Orthogonal) }, TargetDecorator = new Decorator() { Shape = DecoratorShapes.Arrow }, Constraints = ConnectorConstraints.None }; model.SelectedItems.Constraints = ~SelectorConstraints.Rotator; model.SelectionChange = "selectionChange"; model.SnapSettings.SnapConstraints = SnapConstraints.None; model.EnableContextMenu = false; model.Tool = Tool.SingleSelect; model.NodeTemplate = "nodeTemplate"; ViewData["diagramModel"] = model; return(View()); }
public ActionResult BPMNDiagram() { DiagramProperties Diagram = new DiagramProperties(); SymbolPaletteProperties SymbolPalette = new SymbolPaletteProperties(); createSymbolPalette(SymbolPalette); GenerateDiagram(Diagram); GeneratePalette(SymbolPalette); ViewData["diagramModel"] = Diagram; ViewData["symbolPaletteModel"] = SymbolPalette; return(View()); }
// // GET: /Model/ public ActionResult Model() { DiagramProperties model = new DiagramProperties(); model.Height = "500px"; model.Width = "100%"; model.PageSettings.ScrollLimit = ScrollLimit.Diagram; model.PageSettings.PageHeight = 500; model.PageSettings.PageWidth = 690; model.PageSettings.PageOrientation = PageOrientation.Landscape; model.SnapSettings.SnapConstraints = SnapConstraints.ShowLines; model.PageSettings.PageBackgroundColor = "transparent"; model.BackgroundImage.Source = "../images/Employee/Artboard 13.png"; model.BackgroundImage.Alignment = ImageAlignment.XMinYMid; model.BackgroundImage.Scale = ScaleConstraints.Meet; //Initialize shapes CreateShape("node1", FlowShapes.Terminator, 90, 40, 380, 30, "#C44E5F", "Start", model); CreateShape("node2", FlowShapes.Process, 90, 40, 380, 100, "#5E5F5F", "Design", model, true); CreateShape("node3", FlowShapes.Process, 90, 40, 380, 180, "#5E5F5F", "Coding", model, true); CreateShape("node4", FlowShapes.Process, 90, 40, 380, 260, "#5E5F5F", "Testing", model); CreateShape("node5", FlowShapes.Decision, 90, 40, 380, 340, "#4EAB8B", "Errors?", model); CreateShape("node6", FlowShapes.Terminator, 90, 40, 380, 450, "#C44E5F", "End", model); CreateShape("node7", FlowShapes.Decision, 90, 40, 200, 180, "#4EAB8B", "Decision Error?", model, true); //Connect Shapes ConnectNodes(model, "node1", "node2"); ConnectNodes(model, "node2", "node3"); ConnectNodes(model, "node3", "node4"); Label label1 = new Label() { Text = "Yes", FillColor = "white", Offset = new DiagramPoint(0.44f, 0.27f) }; ConnectNodes(model, "node5", "node7", null, label1, null, "innn"); Label label2 = new Label() { Text = "Yes", FillColor = "white", Offset = new DiagramPoint(0.44f, 0.27f) }; ConnectNodes(model, "node7", "node2", null, label2, "inn", "in"); Label label3 = new Label() { Text = "No", FillColor = "white", Offset = new DiagramPoint(0.44f, 0.27f) }; ConnectNodes(model, "node7", "node3", null, label3); ConnectNodes(model, "node4", "node5"); ConnectNodes(model, "node5", "node6"); ViewData["diagramModel"] = model; return(View()); }
public ActionResult Network() { DiagramProperties Diagram = new DiagramProperties(); SymbolPaletteProperties symbolPalette = new SymbolPaletteProperties(); createSymbolPaletteNetwork(symbolPalette); GenerateNaiveShapes(symbolPalette); createSymbolPaletteNode(symbolPalette); GenerateDiagram1(Diagram); Diagram.Create = "created"; ViewData["diagramModel"] = Diagram; ViewData["symbolPaletteModel"] = symbolPalette; return(View()); }
public static string GenerateDiagram(ICanvas canvas, string uid, DiagramProperties properties) { var sb = new StringBuilder(); var elements = (canvas == null) ? null : canvas.GetElements(); GenerateHeader(sb, uid, properties); if (elements != null) { sb.Append(Generate(elements)); } return(sb.ToString()); }
private void SetProperties(DiagramProperties prop) { TextPageWidth.Text = prop.PageWidth.ToString(); TextPageHeight.Text = prop.PageHeight.ToString(); TextGridOriginX.Text = prop.GridOriginX.ToString(); TextGridOriginY.Text = prop.GridOriginY.ToString(); TextGridWidth.Text = prop.GridWidth.ToString(); TextGridHeight.Text = prop.GridHeight.ToString(); TextGridSize.Text = prop.GridSize.ToString(); TextSnapX.Text = prop.SnapX.ToString(); TextSnapY.Text = prop.SnapY.ToString(); TextSnapOffsetX.Text = prop.SnapOffsetX.ToString(); TextSnapOffsetY.Text = prop.SnapOffsetY.ToString(); }
private void UpdateProperties(DiagramProperties prop) { prop.PageWidth = int.Parse(TextPageWidth.Text); prop.PageHeight = int.Parse(TextPageHeight.Text); prop.GridOriginX = int.Parse(TextGridOriginX.Text); prop.GridOriginY = int.Parse(TextGridOriginY.Text); prop.GridWidth = int.Parse(TextGridWidth.Text); prop.GridHeight = int.Parse(TextGridHeight.Text); prop.GridSize = int.Parse(TextGridSize.Text); prop.SnapX = double.Parse(TextSnapX.Text); prop.SnapY = double.Parse(TextSnapY.Text); prop.SnapOffsetX = double.Parse(TextSnapOffsetX.Text); prop.SnapOffsetY = double.Parse(TextSnapOffsetY.Text); }
// GET: MultipleParent public ActionResult MultipleParent() { DiagramProperties model = new DiagramProperties(); model.Height = "450px"; model.Width = "100%"; model.PageSettings.ScrollLimit = ScrollLimit.Diagram; model.Layout.Type = LayoutTypes.HierarchicalTree; model.Layout.HorizontalSpacing = 40; model.Layout.VerticalSpacing = 40; model.Layout.Margin.Left = 0; model.Layout.Margin.Top = 30; model.DataSourceSettings.DataSource = GetMultipleParent(); model.DataSourceSettings.Parent = "ReportingPerson"; model.DataSourceSettings.Id = "Name"; model.DefaultSettings.Node = new BasicShape() { Constraints = NodeConstraints.Select | NodeConstraints.PointerEvents, FillColor = "#88C65C", Width = 40, Height = 40, BorderWidth = 1, BorderColor = "#5e5e5e", CornerRadius = 7, }; model.DefaultSettings.Connector = new Connector() { LineColor = "#000000", Segments = new Collection() { new Segment(Segments.Orthogonal) }, TargetDecorator = new Decorator() { Shape = DecoratorShapes.Arrow, Width = 5, Height = 5 }, Constraints = ConnectorConstraints.None, CornerRadius = 10 }; model.SelectedItems.Constraints = ~SelectorConstraints.Rotator; model.SelectionChange = "selectionChange"; model.SnapSettings.SnapConstraints = SnapConstraints.None; model.EnableContextMenu = false; model.Tool = Tool.SingleSelect; model.Create = "diagramCreate"; ViewData["diagramModel"] = model; return(View()); }
// // GET: /Diagram/ public ActionResult HistoryManager() { DiagramProperties model = new DiagramProperties(); model.Height = "500px"; model.Width = "100%"; model.PageSettings.ScrollLimit = ScrollLimit.Diagram; model.NodeCollectionChange = "nodecollectionchange"; model.HistoryChange = "historyChange"; model.HistoryManager.StackLimit = 3; CreateShape("node1", FlowShapes.Terminator, 90, 40, 380, 30, "#C44E5F", "Start", model); CreateShape("node2", FlowShapes.Process, 90, 40, 380, 100, "#5E5F5F", "Design", model, true); CreateShape("node3", FlowShapes.Process, 90, 40, 380, 180, "#5E5F5F", "Coding", model, true); CreateShape("node4", FlowShapes.Process, 90, 40, 380, 260, "#5E5F5F", "Testing", model); CreateShape("node5", FlowShapes.Decision, 90, 40, 380, 340, "#4EAB8B", "Errors?", model); CreateShape("node6", FlowShapes.Terminator, 90, 40, 380, 450, "#C44E5F", "End", model); CreateShape("node7", FlowShapes.Decision, 120, 40, 200, 180, "#4EAB8B", "Decision Error?", model, true); ConnectHistoryShapes(model, "node1", "node2"); ConnectHistoryShapes(model, "node2", "node3"); ConnectHistoryShapes(model, "node3", "node4"); Label label1 = new Label() { Text = "Yes", FillColor = "white", Offset = new DiagramPoint(0.44f, 0.27f) }; Connector connector = ConnectHistoryShapes(model, "node5", "node7", null, "innn"); connector.Labels.Add(label1); Label label2 = new Label() { Text = "Yes", FillColor = "white", Offset = new DiagramPoint(0.44f, 0.27f) }; connector = ConnectHistoryShapes(model, "node7", "node2", "inn", "in"); connector.Labels.Add(label2); Label label3 = new Label() { Text = "No", FillColor = "white", Offset = new DiagramPoint(0.44f, 0.27f) }; connector = ConnectHistoryShapes(model, "node7", "node3"); connector.Labels.Add(label3); ConnectHistoryShapes(model, "node4", "node5"); ConnectHistoryShapes(model, "node5", "node6"); ViewData["diagramModel"] = model; return(View()); }
// // GET: /Organization/ public ActionResult BusinessChart() { DiagramProperties model = new DiagramProperties(); model.Width = "100%"; model.Height = "650px"; model.PageSettings.ScrollLimit = ScrollLimit.Diagram; model.Layout.Type = LayoutTypes.OrganizationalChart; model.Layout.HorizontalSpacing = 40; model.Layout.VerticalSpacing = 40; model.Layout.Margin.Top = 30; model.Layout.GetLayoutInfo = "getLayoutInfo"; model.DataSourceSettings.DataSource = GetBusinessOrgChart(); model.DataSourceSettings.Parent = "Manager"; model.DataSourceSettings.Id = "Id"; model.DefaultSettings.Node = new Node() { Width = 150, Height = 50, BorderColor = "transparent" }; Label label = new Label() { FontColor = "#ffffff", Margin = new LabelMargin() { Left = 5, Right = 5 } }; model.DefaultSettings.Node.Labels.Add(label); model.DefaultSettings.Connector = new Connector() { Segments = new Collection() { new Segment(Segments.Orthogonal) }, TargetDecorator = new Decorator() { Shape = DecoratorShapes.None } }; model.SnapSettings.SnapConstraints = SnapConstraints.None; model.EnableContextMenu = false; model.Tool = Tool.ZoomPan; model.NodeTemplate = "nodeTemplate"; ViewData["diagramModel"] = model; return(View()); }
// // GET: /ShapesGallery/ public ActionResult ShapesGallery() { DiagramProperties model = new DiagramProperties(); model.Height = "550px"; model.Width = "100%"; model.PageSettings.ScrollLimit = ScrollLimit.Diagram; model.SnapSettings.SnapConstraints = SnapConstraints.None; model.Create = "diaramCreate"; model.DefaultSettings.Node = new Node() { MarginLeft = 10, MarginBottom = 10, MarginRight = 10, MarginTop = 10 }; ViewData["diagramModel"] = model; return(View()); }
// // GET: /Organization/ public ActionResult TeamOrgchart() { DiagramProperties model = new DiagramProperties(); model.Width = "100%"; model.Height = "600px"; model.PageSettings.ScrollLimit = ScrollLimit.Diagram; model.Layout.Type = LayoutTypes.OrganizationalChart; model.Layout.Margin.Top = 50; model.Layout.HorizontalSpacing = 30; model.Layout.VerticalSpacing = 30; model.DataSourceSettings.DataSource = GetTeamChartData(); model.DataSourceSettings.Parent = "ReportingPerson"; model.DataSourceSettings.Id = "Id"; model.DefaultSettings.Node = new ImageNode() { Width = 140, Height = 50, BorderColor = "transparent", BorderWidth = 0 }; Label label = new Label() { Name = "name1", Text = "", HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, FontSize = 11, Bold = true, FontFamily = "Segoe UI", Margin = new LabelMargin(-17, -17, 0, 0) }; Label label1 = new Label() { Name = "name2", Text = "", HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top, FontSize = 10, FontFamily = "Segoe UI", Margin = new LabelMargin(-2, -17, 0, 0) }; model.DefaultSettings.Node.Labels.Add(label); model.DefaultSettings.Node.Labels.Add(label1); model.DefaultSettings.Connector = new Connector() { Segments = new Collection() { new Segment(Segments.Orthogonal) }, TargetDecorator = new Decorator() { Shape = DecoratorShapes.None } }; model.SnapSettings.SnapConstraints = SnapConstraints.None; model.EnableContextMenu = false; model.NodeTemplate = "nodeTemplate"; model.Tool = Tool.ZoomPan; ViewData["diagramModel"] = model; return(View()); }
public object CreateDiagram(DiagramProperties properties) { if (ParserPath != null) { CreateGrid(properties.GridOriginX, properties.GridOriginY, properties.GridWidth, properties.GridHeight, properties.GridSize); } if (ParserCanvas != null) { ParserCanvas.SetWidth(properties.PageWidth); ParserCanvas.SetHeight(properties.PageHeight); } return(null); }
// // GET: /Organization/ public ActionResult LocalDataBinding() { DiagramProperties model = new DiagramProperties(); model.Width = "100%"; model.Height = "490px"; model.PageSettings.ScrollLimit = ScrollLimit.Diagram; model.Layout.Type = LayoutTypes.HierarchicalTree; model.Layout.MarginY = 50; model.Layout.HorizontalSpacing = 30; model.Layout.VerticalSpacing = 40; model.DataSourceSettings.DataSource = GetData(); model.DataSourceSettings.Parent = "TeamLead"; model.DataSourceSettings.Id = "Id"; model.DefaultSettings.Node = new Node() { Width = 110, Height = 40, BorderColor = "transparent" }; Label label = new Label() { FontColor = "#ffffff", Margin = new LabelMargin() { Left = 5, Right = 5 } }; model.DefaultSettings.Node.Labels.Add(label); model.DefaultSettings.Connector = new Connector() { Segments = new Collection() { new Segment(Segments.Orthogonal) }, TargetDecorator = new Decorator() { Shape = DecoratorShapes.Arrow } }; model.SnapSettings.SnapConstraints = SnapConstraints.None; model.EnableContextMenu = false; model.NodeTemplate = "nodeTemplate"; model.Tool = Tool.ZoomPan; ViewData["diagramModel"] = model; return(View()); }
// // GET: /ZoomAndPan/ public ActionResult ZoomAndPan() { DiagramProperties model = new DiagramProperties(); model.Height = "500px"; model.Width = "100%"; model.PageSettings.ScrollLimit = ScrollLimit.Diagram; model.PageSettings.PageHeight = 500; model.PageSettings.PageWidth = 635; model.PageSettings.PageOrientation = PageOrientation.Landscape; model.SnapSettings.SnapConstraints = SnapConstraints.None; model.EnableContextMenu = false; model.PageSettings.PageBackgroundColor = "transparent"; model.BackgroundImage.Source = "../images/Employee/ZoomImage.jpg"; model.BackgroundImage.Alignment = ImageAlignment.XMinYMid; model.BackgroundImage.Scale = ScaleConstraints.Slice; ViewData["diagramModel"] = model; return(View()); }