Skip to content

Commit 789dd1a

Browse files
Merge pull request #53 from BalaVigneshRaviChandran/ES-1007098-UGCorrectionsPH4
1007098: Code standard validation for code example
2 parents def07ed + 73ffb60 commit 789dd1a

16 files changed

Lines changed: 684 additions & 18 deletions

Diagram/Server/Pages/Connectors/Segments/Bezier.razor

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
@using Syncfusion.Blazor.Diagram
44

5-
<SfDiagramComponent Width="1000px" Height="500px" Connectors="@connectors" />
5+
<SfDiagramComponent Width="1000px" Height="500px" Connectors="@_connectors" />
66

77
@code
88
{
99
//Defines diagram's connector collection.
10-
private DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
10+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
1111

1212
protected override void OnInitialized()
1313
{
14-
Connector Connector = new Connector()
14+
Connector connector = new Connector()
1515
{
1616
ID = "connector1",
1717
SourcePoint = new DiagramPoint()
@@ -34,6 +34,6 @@
3434
}
3535
};
3636
//Add the connector into connectors's collection.
37-
connectors.Add(Connector);
37+
_connectors.Add(connector);
3838
}
3939
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
@page "/BezierSegmentEditOrientationSample"
2+
3+
@using Syncfusion.Blazor.Diagram
4+
5+
<SfDiagramComponent Width="1000px" Height="500px" Nodes="@_nodes" Connectors="@_connectors"></SfDiagramComponent>
6+
7+
@code {
8+
//Define the diagram's connector collection.
9+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
10+
//Define the diagram's node collection.
11+
private DiagramObjectCollection<Node> _nodes = new DiagramObjectCollection<Node>();
12+
13+
protected override void OnInitialized()
14+
{
15+
_nodes.Add(
16+
new Node()
17+
{
18+
ID = "node1",
19+
OffsetX = 300,
20+
OffsetY = 100,
21+
Width = 100,
22+
Height = 100,
23+
Ports = new DiagramObjectCollection<PointPort>()
24+
{
25+
new PointPort()
26+
{
27+
ID="Port1",
28+
Visibility = PortVisibility.Visible,
29+
Offset = new DiagramPoint() { X = 1, Y = 0.5 },
30+
},
31+
}
32+
});
33+
_nodes.Add(new Node()
34+
{
35+
ID = "node2",
36+
OffsetX = 300,
37+
OffsetY = 350,
38+
Width = 100,
39+
Height = 100,
40+
Ports = new DiagramObjectCollection<PointPort>()
41+
{
42+
new PointPort()
43+
{
44+
ID="Port1",
45+
Visibility = PortVisibility.Visible,
46+
Offset = new DiagramPoint() { X = 0, Y = 0.5 },
47+
},
48+
}
49+
});
50+
Connector connector1 = new Connector()
51+
{
52+
ID = "connector1",
53+
SourceID = "node1",
54+
TargetID = "node2",
55+
SourcePortID = "Port1",
56+
TargetPortID = "Port1",
57+
Type = ConnectorSegmentType.Bezier,
58+
BezierConnectorSettings = new BezierConnectorSettings()
59+
{
60+
//Define the smoothness for a bezier connector.
61+
Smoothness = BezierSmoothness.SymmetricAngle,
62+
//Define the orientation of the segment editing controls.
63+
SegmentEditOrientation = BezierSegmentEditOrientation.FreeForm
64+
},
65+
Constraints = ConnectorConstraints.Default | ConnectorConstraints.DragSegmentThumb
66+
};
67+
_connectors.Add(connector1);
68+
}
69+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
@page "/BezierSegment"
2+
3+
@using Syncfusion.Blazor.Diagram
4+
5+
<SfDiagramComponent Width="1000px" Height="500px" Connectors="@_connectors">
6+
</SfDiagramComponent>
7+
8+
@code
9+
{
10+
//Defines diagram's connector collection.
11+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
12+
13+
protected override void OnInitialized()
14+
{
15+
Connector connector1 = new Connector()
16+
{
17+
ID = "Connector1",
18+
Type = ConnectorSegmentType.Bezier,
19+
SourcePoint = new DiagramPoint { X = 500, Y = 200 },
20+
TargetPoint = new DiagramPoint { X = 600, Y = 300 },
21+
Segments = new DiagramObjectCollection<ConnectorSegment>
22+
{
23+
new BezierSegment()
24+
{
25+
Type = ConnectorSegmentType.Bezier,
26+
//Defines the point1 and point2 for the bezier connector.
27+
Point1 = new DiagramPoint { X = 500, Y = 100 },
28+
Point2 = new DiagramPoint { X = 600, Y = 200 }
29+
}
30+
}
31+
};
32+
//Add the connector into connectors's collection.
33+
_connectors.Add(connector1);
34+
Connector connector2 = new Connector()
35+
{
36+
ID = "Connector2",
37+
Type = ConnectorSegmentType.Bezier,
38+
SourcePoint = new DiagramPoint { X = 200, Y = 100 },
39+
TargetPoint = new DiagramPoint { X = 300, Y = 200 },
40+
Segments = new DiagramObjectCollection<ConnectorSegment>
41+
{
42+
new BezierSegment()
43+
{
44+
Type = ConnectorSegmentType.Bezier,
45+
//Defines the Vector1 and Vector2 for the bezier connector.
46+
Vector1 = new Vector(){Distance = 100 ,Angle = 90 },
47+
Vector2 = new Vector(){Distance = 45 ,Angle = 45 }
48+
}
49+
}
50+
};
51+
//Add the connector into connectors's collection.
52+
_connectors.Add(connector2);
53+
}
54+
}

Diagram/Server/Pages/Connectors/Segments/BezierSegmentShape.razor

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
@using Syncfusion.Blazor.Diagram
44
@using Syncfusion.Blazor.Diagram.Internal
55

6-
<SfDiagramComponent Width="1000px" Height="500px" Connectors="@connectors"></SfDiagramComponent>
6+
<SfDiagramComponent Width="1000px" Height="500px" Connectors="@_connectors"></SfDiagramComponent>
77

88
@code
99
{
1010
//Define the diagram's connector collection.
11-
private DiagramObjectCollection<Connector> connectors = new DiagramObjectCollection<Connector>();
11+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
1212

1313
protected override void OnInitialized()
1414
{
@@ -20,8 +20,24 @@
2020
SourceDecorator = new DecoratorSettings() { Shape = DecoratorShape.Diamond },
2121
Segments = new DiagramObjectCollection<ConnectorSegment>()
2222
{
23-
new BezierSegment(){Type = ConnectorSegmentType.Bezier, Point = new DiagramPoint(){X = 200, Y = 100}},
24-
new BezierSegment(){Type = ConnectorSegmentType.Bezier, Point = new DiagramPoint(){X = 260, Y = 150}}
23+
new BezierSegment()
24+
{
25+
Type = ConnectorSegmentType.Bezier,
26+
Point = new DiagramPoint()
27+
{
28+
X = 200,
29+
Y = 100
30+
}
31+
},
32+
new BezierSegment()
33+
{
34+
Type = ConnectorSegmentType.Bezier,
35+
Point = new DiagramPoint()
36+
{
37+
X = 260,
38+
Y = 150
39+
}
40+
}
2541
},
2642
Type = ConnectorSegmentType.Bezier,
2743
BezierConnectorSettings = new BezierConnectorSettings()
@@ -31,6 +47,6 @@
3147
Constraints = ConnectorConstraints.Default | ConnectorConstraints.DragSegmentThumb,
3248
SegmentThumbSettings = new SegmentThumbSettings() { Shape = SegmentThumbShapes.Square },
3349
};
34-
connectors.Add(connector);
50+
_connectors.Add(connector);
3551
}
3652
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@page "/BezierSegmentShape1"
2+
3+
@using Syncfusion.Blazor.Diagram
4+
@using Syncfusion.Blazor.Diagram.Internal
5+
6+
<SfDiagramComponent Width="1000px" Height="500px" Connectors="@_connectors"></SfDiagramComponent>
7+
@code
8+
{
9+
//Define the diagram's connector collection.
10+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
11+
12+
protected override void OnInitialized()
13+
{
14+
Connector connector = new Connector()
15+
{
16+
ID = "connector",
17+
SourcePoint = new DiagramPoint() { X = 100, Y = 100 },
18+
TargetPoint = new DiagramPoint() { X = 300, Y = 300 },
19+
SourceDecorator = new DecoratorSettings() { Shape = DecoratorShape.Diamond },
20+
Segments = new DiagramObjectCollection<ConnectorSegment>()
21+
{
22+
new BezierSegment(){Type = ConnectorSegmentType.Bezier, Point = new DiagramPoint(){X = 200, Y = 100}
23+
,
24+
},
25+
new BezierSegment(){Type = ConnectorSegmentType.Bezier, Point = new DiagramPoint(){X = 260, Y = 150}}
26+
},
27+
Type = ConnectorSegmentType.Bezier,
28+
BezierConnectorSettings = new BezierConnectorSettings()
29+
{
30+
ControlPointsVisibility = ControlPointsVisibility.All
31+
},
32+
Constraints = ConnectorConstraints.Default | ConnectorConstraints.DragSegmentThumb,
33+
SegmentThumbSettings = new SegmentThumbSettings() { Shape = SegmentThumbShapes.Square },
34+
};
35+
_connectors.Add(connector);
36+
}
37+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@page "/BezierSegmentThumb"
2+
3+
@using Syncfusion.Blazor.Diagram
4+
5+
<SfDiagramComponent Width="1000px" Height="500px" Nodes="@_nodes" Connectors="@_connectors"></SfDiagramComponent>
6+
7+
@code {
8+
//Define the diagram's connector collection.
9+
DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
10+
//Define the diagram's node collection.
11+
DiagramObjectCollection<Node> _nodes = new DiagramObjectCollection<Node>();
12+
13+
protected override void OnInitialized()
14+
{
15+
_nodes.Add(
16+
new Node()
17+
{
18+
ID = "node1",
19+
OffsetX = 300,
20+
OffsetY = 100,
21+
Width = 100,
22+
Height = 100,
23+
Ports = new DiagramObjectCollection<PointPort>()
24+
{
25+
new PointPort()
26+
{
27+
ID="Port1",
28+
Visibility = PortVisibility.Visible,
29+
Offset = new DiagramPoint() { X = 1, Y = 0.5 },
30+
},
31+
}
32+
});
33+
_nodes.Add(new Node()
34+
{
35+
ID = "node2",
36+
OffsetX = 300,
37+
OffsetY = 350,
38+
Width = 100,
39+
Height = 100,
40+
Ports = new DiagramObjectCollection<PointPort>()
41+
{
42+
new PointPort()
43+
{
44+
ID="Port1",
45+
Visibility = PortVisibility.Visible,
46+
Offset = new DiagramPoint() { X = 0, Y = 0.5 },
47+
},
48+
}
49+
});
50+
Connector connector1 = new Connector()
51+
{
52+
ID = "connector1",
53+
SourceID = "node1",
54+
TargetID = "node2",
55+
SourcePortID = "Port1",
56+
TargetPortID = "Port1",
57+
Type = ConnectorSegmentType.Bezier,
58+
Constraints = ConnectorConstraints.Default | ConnectorConstraints.DragSegmentThumb
59+
};
60+
_connectors.Add(connector1);
61+
}
62+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
@page "/ControlPointsVisibilitySample"
2+
3+
@using Syncfusion.Blazor.Diagram
4+
<SfDiagramComponent Width="1000px" Height="500px" Connectors="@_connectors"></SfDiagramComponent>
5+
@code {
6+
//Define the diagram's connector collection.
7+
private DiagramObjectCollection<Connector> _connectors = new DiagramObjectCollection<Connector>();
8+
protected override void OnInitialized()
9+
{
10+
Connector connector1 = new Connector()
11+
{
12+
ID = "connector1",
13+
SourcePoint = new DiagramPoint() { X = 700, Y = 200 },
14+
TargetPoint = new DiagramPoint() { X = 1000, Y = 400 },
15+
Segments = new DiagramObjectCollection<ConnectorSegment>()
16+
{
17+
new BezierSegment(){Type = ConnectorSegmentType.Bezier, Point = new DiagramPoint(){X = 750, Y = 250}},
18+
new BezierSegment(){Type = ConnectorSegmentType.Bezier, Point = new DiagramPoint(){X = 900, Y = 350}}
19+
},
20+
Type = ConnectorSegmentType.Bezier,
21+
BezierConnectorSettings = new BezierConnectorSettings()
22+
{
23+
//Define the visibility of the control points.
24+
ControlPointsVisibility = ControlPointsVisibility.Intermediate
25+
},
26+
};
27+
_connectors.Add(connector1);
28+
}
29+
}

0 commit comments

Comments
 (0)