Line | |
---|
1 | using Netron.Diagramming.Core.Analysis;
|
---|
2 | namespace Netron.Diagramming.Core {
|
---|
3 | public partial class Connection : IEdge {
|
---|
4 | #region Fields
|
---|
5 | private bool mIsDirected = false;
|
---|
6 |
|
---|
7 | #endregion
|
---|
8 |
|
---|
9 |
|
---|
10 | bool IEdge.IsDirected {
|
---|
11 | get { return mIsDirected; }
|
---|
12 | set { mIsDirected = value; }
|
---|
13 | }
|
---|
14 |
|
---|
15 | INode IEdge.SourceNode {
|
---|
16 | get {
|
---|
17 | if (From.AttachedTo == null)
|
---|
18 | return null;
|
---|
19 | else
|
---|
20 | return From.AttachedTo.Parent as INode;
|
---|
21 | }
|
---|
22 | }
|
---|
23 |
|
---|
24 | INode IEdge.TargetNode {
|
---|
25 | get {
|
---|
26 | if (To.AttachedTo == null)
|
---|
27 | return null;
|
---|
28 | else
|
---|
29 | return To.AttachedTo.Parent as INode;
|
---|
30 | }
|
---|
31 | }
|
---|
32 |
|
---|
33 | INode IEdge.AdjacentNode(INode node) {
|
---|
34 | if (From.AttachedTo != null && (node as IShape) == From.AttachedTo.Parent) {
|
---|
35 | if (To.AttachedTo == null)
|
---|
36 | return null;
|
---|
37 | else
|
---|
38 | return To.AttachedTo.Parent as INode;
|
---|
39 | } else if (To.AttachedTo.Parent != null && (node as IShape) == To.AttachedTo.Parent) {
|
---|
40 | if (From.AttachedTo == null)
|
---|
41 | return null;
|
---|
42 | else
|
---|
43 | return From.AttachedTo.Parent as INode;
|
---|
44 | } else
|
---|
45 | throw new InconsistencyException("The given node is not part of the edge.");
|
---|
46 |
|
---|
47 | }
|
---|
48 | }
|
---|
49 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.