This example demonstrates how to create an UML class diagrams.

| Language: C# |
using Nevron.Nov;
using Nevron.Nov.DataStructures;
using Nevron.Nov.Diagram;
using Nevron.Nov.Diagram.Layout;
using Nevron.Nov.Dom;
using Nevron.Nov.Graphics;
using Nevron.Nov.Layout;
using Nevron.Nov.UI;
using Nevron.Nov.Windows.Forms;
using System;
using System.Windows.Forms;
namespace NovWinFormsProject
{
public partial class Form1 : Form
{
#region Constructors
public Form1()
{
InitializeComponent();
// Set form title
Text = "NOV WinForms - NUmlClassDiagramExample";
// Create the NOV example and its controls
NWidget exampleContent = CreateExampleContent();
NWidget exampleControls = CreateExampleControls();
if (exampleControls != null)
{
exampleControls.PreferredWidth = 300;
}
// Place the example and its controls in a pair box
NPairBox pairBox = new NPairBox(exampleContent, exampleControls);
pairBox.FillMode = ENStackFillMode.First;
pairBox.FitMode = ENStackFitMode.First;
pairBox.Margins = new NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing);
// Host the example in the form
NNovWidgetHost host = new NNovWidgetHost(pairBox);
host.Dock = DockStyle.Fill;
Controls.Add(host);
}
#endregion
#region Example
public NWidget CreateExampleContent()
{
// Create a simple drawing
NDrawingViewWithRibbon drawingViewWithRibbon = new NDrawingViewWithRibbon();
m_DrawingView = drawingViewWithRibbon.View;
m_DrawingView.Document.HistoryService.Pause();
try
{
InitDiagram(m_DrawingView.Document);
}
finally
{
m_DrawingView.Document.HistoryService.Resume();
}
return drawingViewWithRibbon;
}
public NWidget CreateExampleControls()
{
return null;
}
public string GetExampleDescription()
{
return @"This example demonstrates how to create an UML class diagrams.
";
}
///
/// Gets the relevant documentation links for the example
///
///
public (string Name, string Url)[] GetDocumentationUrls()
{
return new[]
{
("Predefined Libraries", "https://www.nevron.com/docs/openvision/diagram-predefined-libraries.html"),
("Shapes", "https://www.nevron.com/docs/openvision/diagram-shapes.html"),
("Routable Connectors", "https://www.nevron.com/docs/openvision/diagram-routable-connectors.html"),
};
}
private void InitDiagram(NDrawingDocument drawingDocument)
{
// Get drawing and active page
NDrawing drawing = drawingDocument.Content;
NPage activePage = drawing.ActivePage;
// Hide ports and grid
drawing.ScreenVisibility.ShowGrid = false;
// Create styles
NRule rule = CreateConnectorOneToManyRule();
NStyleSheet styleSheet = new NStyleSheet();
styleSheet.Add(rule);
drawingDocument.StyleSheets.Add(styleSheet);
// Create some UML shapes
NShape shapeDevice = CreateUmlShape("Device", new NMemberInfo[] {
new NMemberInfo(ENMemberVisibility.Public, "DeviceID", "integer(10)"),
new NMemberInfo(ENMemberVisibility.Protected, "DeviceCategory", "integer(10)"),
new NMemberInfo(ENMemberVisibility.Private, "name", "varchar(50)"),
new NMemberInfo(ENMemberVisibility.Private, "description", "blob"),
new NMemberInfo(ENMemberVisibility.Private, "detail", "blob")
});
activePage.Items.Add(shapeDevice);
NShape shapeDeviceCategory = CreateUmlShape("DeviceCategory", new NMemberInfo[] {
new NMemberInfo(ENMemberVisibility.Public, "CategoryID", "integer(10)"),
new NMemberInfo(ENMemberVisibility.Private, "description", "blob")
});
activePage.Items.Add(shapeDeviceCategory);
NShape shapeSupportRequest = CreateUmlShape("SupportRequest", new NMemberInfo[] {
new NMemberInfo(ENMemberVisibility.Protected, "Device", "integer(10)"),
new NMemberInfo(ENMemberVisibility.Public, "RequestID", "integer(10)"),
new NMemberInfo(ENMemberVisibility.Protected, "User", "integer(10)"),
new NMemberInfo(ENMemberVisibility.Private, "reportDate", "date"),
new NMemberInfo(ENMemberVisibility.Private, "description", "blob")
});
activePage.Items.Add(shapeSupportRequest);
NShape shapeUser = CreateUmlShape("User", new NMemberInfo[] {
new NMemberInfo(ENMemberVisibility.Public, "ID", "integer(10)"),
new NMemberInfo(ENMemberVisibility.Public, "firstName", "varchar(50)"),
new NMemberInfo(ENMemberVisibility.Protected, "lastName", "varchar(50)"),
new NMemberInfo(ENMemberVisibility.Private, "phone", "varchar(12)"),
new NMemberInfo(ENMemberVisibility.Private, "email", "varchar(50)"),
new NMemberInfo(ENMemberVisibility.Private, "address", "blob"),
new NMemberInfo(ENMemberVisibility.Private, "remarks", "blob")
});
activePage.Items.Add(shapeUser);
// Connect the shapes
Connect(GetShapeByName("DeviceCategory"), "CategoryID", GetShapeByName("Device"), "DeviceCategory");
Connect(GetShapeByName("Device"), "DeviceID", GetShapeByName("SupportRequest"), "Device");
Connect(GetShapeByName("User"), "ID", GetShapeByName("SupportRequest"), "User");
// Subscribe to the drawing view's Registered event to layout the shapes
// when the drawing view is registered in its owner document
m_DrawingView.Registered += OnDrawingViewRegistered;
}
#endregion
#region Implementation
///
/// Creates the rule for one to many connectors.
///
///
private NRule CreateConnectorOneToManyRule()
{
NRule rule = new NRule();
NSelectorBuilder sb = rule.GetSelectorBuilder();
sb.Start();
sb.Type(NGeometry.NGeometrySchema);
sb.ChildOf();
sb.UserClass(ConnectorOneToManyClassName);
sb.End();
rule.Declarations.Add(new NValueDeclaration(NGeometry.StrokeProperty,
new NStroke(1, NColor.Black, ENDashStyle.Dash)));
rule.Declarations.Add(new NValueDeclaration(NGeometry.BeginArrowheadProperty,
new NArrowhead(ENArrowheadShape.VerticalLine, 8, 8, null, new NStroke(1, NColor.Black))));
rule.Declarations.Add(new NValueDeclaration(NGeometry.EndArrowheadProperty,
new NArrowhead(ENArrowheadShape.InvertedLineArrowWithCircleNoFill, 8, 8, null, new NStroke(1, NColor.Black))));
return rule;
}
///
/// Creates a one to many connector from the member1 of shape1 to
/// member2 of shape2.
///
///
///
///
///
private void Connect(NShape shape1, string member1, NShape shape2, string member2)
{
NRoutableConnector connector = new NRoutableConnector();
connector.UserClass = ConnectorOneToManyClassName;
m_DrawingView.ActivePage.Items.Add(connector);
// Get or create the ports
NPort port1 = GetOrCreatePort(shape1, member1);
NPort port2 = GetOrCreatePort(shape2, member2);
if (port1 == null)
throw new ArgumentException("A member with name '" + member1 + "' not found in shape '" + shape1.Name + "'", "member");
if (port1 == null)
throw new ArgumentException("A member with name '" + member2 + "' not found in shape '" + shape2.Name + "'", "member");
// Connect the ports
connector.GlueBeginToPort(port1);
connector.GlueEndToPort(port2);
}
///
/// Gets the port with the given name or creates one if a port with the given name
/// does not exist in the specified shape.
///
///
///
///
private NPort GetOrCreatePort(NShape shape, string member)
{
NPort port = shape.GetPortByName(member);
if (port != null)
return port;
// The port does not exist, so create it
NLabel label = (NLabel)shape.Widget.GetFirstDescendant(new NLabelByTextFilter(member));
if (label == null)
return null;
NPairBox pairBox = (NPairBox)label.GetFirstAncestor(NPairBox.NPairBoxSchema);
NStackPanel stack = (NStackPanel)pairBox.ParentNode;
double yRelative = (pairBox.GetAggregationInfo().Index + 0.5) / stack.Count;
port = new NPort(0.5, yRelative, true);
port.SetDirection(ENBoxDirection.Right);
shape.Ports.Add(port);
return port;
}
///
/// Creates an UML class diagram shape.
///
///
///
///
private NShape CreateUmlShape(string name, NMemberInfo[] memberInfos)
{
// Create the shape
NShape shape = new NShape();
shape.Name = name;
// Set a rounded rectangle geometry
NDrawRectangle drawRectangle = new NDrawRectangle(0, 0, 1, 1);
drawRectangle.Relative = true;
shape.Geometry.Add(drawRectangle);
shape.Geometry.CornerRounding = 15;
// Create a stack panel
NStackPanel stack = new NStackPanel();
stack.Margins = new NMargins(5);
stack.Direction = ENHVDirection.TopToBottom;
// Create the title label
NLabel titleLabel = new NLabel(name);
titleLabel.TextAlignment = ENContentAlignment.MiddleCenter;
titleLabel.Border = NBorder.CreateFilledBorder(NColor.Black);
titleLabel.BorderThickness = new NMargins(0, 0, 0, 1);
stack.Add(titleLabel);
// Create the member info pair boxes
for (int i = 0; i < memberInfos.Length; i++)
{
stack.Add(CreatePairBox(memberInfos[i]));
}
shape.Widget = new NUniSizeBoxGroup(stack);
BindSizeToDesiredSize(shape);
return shape;
}
///
/// Creates a pair box from the given member information.
///
///
///
private NPairBox CreatePairBox(NMemberInfo memberInfo)
{
NPairBox pairBox = new NPairBox((char)memberInfo.Visibility + memberInfo.Name, memberInfo.Type, true);
pairBox.Spacing = NDesign.HorizontalSpacing * 2;
pairBox.FillMode = ENStackFillMode.Equal;
pairBox.FitMode = ENStackFitMode.Last;
switch (memberInfo.Visibility)
{
case ENMemberVisibility.Public:
// Set bold font style
pairBox.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 9, ENFontStyle.Bold);
break;
case ENMemberVisibility.Protected:
// Set italic font style
pairBox.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 9, ENFontStyle.Italic);
break;
case ENMemberVisibility.Private:
// Do not change the font style
break;
}
return pairBox;
}
///
/// Binds the size of the shape to the embedded widget desired size.
///
///
private void BindSizeToDesiredSize(NShape shape)
{
NWidget widget = shape.Widget;
// bind shape width to button desired width
NBindingFx bx = new NBindingFx(widget, NButton.DesiredWidthProperty);
bx.Guard = true;
shape.SetFx(NShape.WidthProperty, bx);
// bind shape height to button desired height
NBindingFx by = new NBindingFx(widget, NButton.DesiredHeightProperty);
by.Guard = true;
shape.SetFx(NShape.HeightProperty, by);
shape.AllowResizeX = false;
shape.AllowRotate = false;
shape.AllowResizeY = false;
}
///
/// Gets the first shape with the given name in the drawing document's active page.
///
///
///
private NShape GetShapeByName(string name)
{
NPage activePage = m_DrawingView.ActivePage;
return (NShape)activePage.GetFirstDescendant(new NShapeByNameFilter(name));
}
///
/// Arranges the shapes in the active page.
///
private void ArrangeDiagram()
{
// Create and configure a layout
NLayeredGraphLayout layout = new NLayeredGraphLayout();
// Get all top-level shapes that reside in the active page
NPage activePage = m_DrawingView.ActivePage;
NList shapes = activePage.GetShapes(false);
// Create a layout context and use it to arrange the shapes using the current layout
NDrawingLayoutContext layoutContext = new NDrawingLayoutContext(m_DrawingView.Document, activePage);
layout.Arrange(shapes.CastAll | Language: VB.NET |
Imports Nevron.Nov
Imports Nevron.Nov.DataStructures
Imports Nevron.Nov.Diagram
Imports Nevron.Nov.Diagram.Layout
Imports Nevron.Nov.Dom
Imports Nevron.Nov.Graphics
Imports Nevron.Nov.Layout
Imports Nevron.Nov.UI
Imports Nevron.Nov.Windows.Forms
Imports System
Public Class Form1
#Region "Constructors"
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
' Set form title
Text = "NOV WinForms - NUmlClassDiagramExample"
' Create the NOV example and its controls
Dim exampleContent As NWidget = CreateExampleContent()
Dim exampleControls As NWidget = CreateExampleControls()
If Not exampleControls Is Nothing Then
exampleControls.PreferredWidth = 300
End If
' Place the example and its controls in a pair box
Dim pairBox As NPairBox = New NPairBox(exampleContent, exampleControls)
pairBox.FillMode = ENStackFillMode.First
pairBox.FitMode = ENStackFitMode.First
pairBox.Margins = New NMargins(NDesign.HorizontalSpacing, NDesign.VerticalSpacing)
' Host the example in the form
Dim host As NNovWidgetHost(Of NWidget) = New NNovWidgetHost(Of NWidget)(pairBox)
host.Dock = DockStyle.Fill
Controls.Add(host)
End Sub
#End Region
#Region "Example"
Public Function CreateExampleContent() As NWidget
' Create a simple drawing
Dim drawingViewWithRibbon As NDrawingViewWithRibbon = New NDrawingViewWithRibbon()
m_DrawingView = drawingViewWithRibbon.View
m_DrawingView.Document.HistoryService.Pause()
Try
InitDiagram(m_DrawingView.Document)
Finally
m_DrawingView.Document.HistoryService.Resume()
End Try
Return drawingViewWithRibbon
End Function
Public Function CreateExampleControls() As NWidget
Return Nothing
End Function
Public Function GetExampleDescription() As String
Return "This example demonstrates how to create an UML class diagrams.
"
End Function
'''
''' Gets the relevant documentation links for the example
'''
'''
Public Function GetDocumentationUrls() As (String, String)()
Return {("Predefined Libraries", "https://www.nevron.com/docs/openvision/diagram-predefined-libraries.html"), ("Shapes", "https://www.nevron.com/docs/openvision/diagram-shapes.html"), ("Routable Connectors", "https://www.nevron.com/docs/openvision/diagram-routable-connectors.html")}
End Function
Private Sub InitDiagram(drawingDocument As NDrawingDocument)
' Get drawing and active page
Dim drawing = drawingDocument.Content
Dim activePage = drawing.ActivePage
' Hide ports and grid
drawing.ScreenVisibility.ShowGrid = False
' Create styles
Dim rule As NRule = CreateConnectorOneToManyRule()
Dim styleSheet As NStyleSheet = New NStyleSheet()
styleSheet.Add(rule)
drawingDocument.StyleSheets.Add(styleSheet)
' Create some UML shapes
Dim shapeDevice As NShape = CreateUmlShape("Device", New NMemberInfo() {New NMemberInfo(ENMemberVisibility.Public, "DeviceID", "integer(10)"), New NMemberInfo(ENMemberVisibility.Protected, "DeviceCategory", "integer(10)"), New NMemberInfo(ENMemberVisibility.Private, "name", "varchar(50)"), New NMemberInfo(ENMemberVisibility.Private, "description", "blob"), New NMemberInfo(ENMemberVisibility.Private, "detail", "blob")})
activePage.Items.Add(shapeDevice)
Dim shapeDeviceCategory As NShape = CreateUmlShape("DeviceCategory", New NMemberInfo() {New NMemberInfo(ENMemberVisibility.Public, "CategoryID", "integer(10)"), New NMemberInfo(ENMemberVisibility.Private, "description", "blob")})
activePage.Items.Add(shapeDeviceCategory)
Dim shapeSupportRequest As NShape = CreateUmlShape("SupportRequest", New NMemberInfo() {New NMemberInfo(ENMemberVisibility.Protected, "Device", "integer(10)"), New NMemberInfo(ENMemberVisibility.Public, "RequestID", "integer(10)"), New NMemberInfo(ENMemberVisibility.Protected, "User", "integer(10)"), New NMemberInfo(ENMemberVisibility.Private, "reportDate", "date"), New NMemberInfo(ENMemberVisibility.Private, "description", "blob")})
activePage.Items.Add(shapeSupportRequest)
Dim shapeUser As NShape = CreateUmlShape("User", New NMemberInfo() {New NMemberInfo(ENMemberVisibility.Public, "ID", "integer(10)"), New NMemberInfo(ENMemberVisibility.Public, "firstName", "varchar(50)"), New NMemberInfo(ENMemberVisibility.Protected, "lastName", "varchar(50)"), New NMemberInfo(ENMemberVisibility.Private, "phone", "varchar(12)"), New NMemberInfo(ENMemberVisibility.Private, "email", "varchar(50)"), New NMemberInfo(ENMemberVisibility.Private, "address", "blob"), New NMemberInfo(ENMemberVisibility.Private, "remarks", "blob")})
activePage.Items.Add(shapeUser)
' Connect the shapes
Connect(GetShapeByName("DeviceCategory"), "CategoryID", GetShapeByName("Device"), "DeviceCategory")
Connect(GetShapeByName("Device"), "DeviceID", GetShapeByName("SupportRequest"), "Device")
Connect(GetShapeByName("User"), "ID", GetShapeByName("SupportRequest"), "User")
' Subscribe to the drawing view's Registered event to layout the shapes
' when the drawing view is registered in its owner document
Me.m_DrawingView.Registered += AddressOf OnDrawingViewRegistered
End Sub
#End Region
#Region "Implementation"
'''
''' Creates the rule for one to many connectors.
'''
'''
Private Function CreateConnectorOneToManyRule() As NRule
Dim rule As NRule = New NRule()
Dim sb As NSelectorBuilder = rule.GetSelectorBuilder()
sb.Start()
sb.Type(NGeometry.NGeometrySchema)
sb.ChildOf()
sb.UserClass(ConnectorOneToManyClassName)
sb.End()
rule.Declarations.Add(New NValueDeclaration(Of NStroke)(NGeometry.StrokeProperty, New NStroke(1, NColor.Black, ENDashStyle.Dash)))
rule.Declarations.Add(New NValueDeclaration(Of NArrowhead)(NGeometry.BeginArrowheadProperty, New NArrowhead(ENArrowheadShape.VerticalLine, 8, 8, Nothing, New NStroke(1, NColor.Black))))
rule.Declarations.Add(New NValueDeclaration(Of NArrowhead)(NGeometry.EndArrowheadProperty, New NArrowhead(ENArrowheadShape.InvertedLineArrowWithCircleNoFill, 8, 8, Nothing, New NStroke(1, NColor.Black))))
Return rule
End Function
'''
''' Creates a one to many connector from the member1 of shape1 to
''' member2 of shape2.
'''
'''
'''
'''
'''
Private Sub Connect(shape1 As NShape, member1 As String, shape2 As NShape, member2 As String)
Dim connector As NRoutableConnector = New NRoutableConnector()
connector.UserClass = ConnectorOneToManyClassName
m_DrawingView.ActivePage.Items.Add(connector)
' Get or create the ports
Dim port1 = GetOrCreatePort(shape1, member1)
Dim port2 = GetOrCreatePort(shape2, member2)
If port1 Is Nothing Then Throw New ArgumentException("A member with name '" & member1 & "' not found in shape '" & shape1.Name & "'", "member")
If port1 Is Nothing Then Throw New ArgumentException("A member with name '" & member2 & "' not found in shape '" & shape2.Name & "'", "member")
' Connect the ports
connector.GlueBeginToPort(port1)
connector.GlueEndToPort(port2)
End Sub
'''
''' Gets the port with the given name or creates one if a port with the given name
''' does not exist in the specified shape.
'''
'''
'''
'''
Private Function GetOrCreatePort(shape As NShape, member As String) As NPort
Dim port = shape.GetPortByName(member)
If port IsNot Nothing Then Return port
' The port does not exist, so create it
Dim label As NLabel = CType(shape.Widget.GetFirstDescendant(New NLabelByTextFilter(member)), NLabel)
If label Is Nothing Then Return Nothing
Dim pairBox = CType(label.GetFirstAncestor(NPairBox.NPairBoxSchema), NPairBox)
Dim stack = CType(pairBox.ParentNode, NStackPanel)
Dim yRelative As Double = (pairBox.GetAggregationInfo().Index + 0.5) / stack.Count
port = New NPort(0.5, yRelative, True)
port.SetDirection(ENBoxDirection.Right)
shape.Ports.Add(port)
Return port
End Function
'''
''' Creates an UML class diagram shape.
'''
'''
'''
'''
Private Function CreateUmlShape(name As String, memberInfos As NMemberInfo()) As NShape
' Create the shape
Dim shape As NShape = New NShape()
shape.Name = name
' Set a rounded rectangle geometry
Dim drawRectangle As NDrawRectangle = New NDrawRectangle(0, 0, 1, 1)
drawRectangle.Relative = True
shape.Geometry.Add(drawRectangle)
shape.Geometry.CornerRounding = 15
' Create a stack panel
Dim stack As NStackPanel = New NStackPanel()
stack.Margins = New NMargins(5)
stack.Direction = ENHVDirection.TopToBottom
' Create the title label
Dim titleLabel As NLabel = New NLabel(name)
titleLabel.TextAlignment = ENContentAlignment.MiddleCenter
titleLabel.Border = NBorder.CreateFilledBorder(NColor.Black)
titleLabel.BorderThickness = New NMargins(0, 0, 0, 1)
stack.Add(titleLabel)
' Create the member info pair boxes
For i = 0 To memberInfos.Length - 1
stack.Add(CreatePairBox(memberInfos(i)))
Next
shape.Widget = New NUniSizeBoxGroup(stack)
BindSizeToDesiredSize(shape)
Return shape
End Function
'''
''' Creates a pair box from the given member information.
'''
'''
'''
Private Function CreatePairBox(memberInfo As NMemberInfo) As NPairBox
Dim pairBox As NPairBox = New NPairBox(CChar(memberInfo.Visibility).ToString() & memberInfo.Name, memberInfo.Type, True)
pairBox.Spacing = NDesign.HorizontalSpacing * 2
pairBox.FillMode = ENStackFillMode.Equal
pairBox.FitMode = ENStackFitMode.Last
Select Case memberInfo.Visibility
Case ENMemberVisibility.Public
' Set bold font style
pairBox.Font = New NFont(NFontDescriptor.DefaultSansFamilyName, 9, ENFontStyle.Bold)
Case ENMemberVisibility.Protected
' Set italic font style
pairBox.Font = New NFont(NFontDescriptor.DefaultSansFamilyName, 9, ENFontStyle.Italic)
' Do not change the font style
Case ENMemberVisibility.Private
End Select
Return pairBox
End Function
'''
''' Binds the size of the shape to the embedded widget desired size.
'''
'''
Private Sub BindSizeToDesiredSize(shape As NShape)
Dim widget = shape.Widget
' bind shape width to button desired width
Dim bx As NBindingFx = New NBindingFx(widget, NBoxElement.DesiredWidthProperty)
bx.Guard = True
shape.SetFx(NShape.WidthProperty, bx)
' bind shape height to button desired height
Dim by As NBindingFx = New NBindingFx(widget, NBoxElement.DesiredHeightProperty)
by.Guard = True
shape.SetFx(NShape.HeightProperty, by)
shape.AllowResizeX = False
shape.AllowRotate = False
shape.AllowResizeY = False
End Sub
'''
''' Gets the first shape with the given name in the drawing document's active page.
'''
'''
'''
Private Function GetShapeByName(name As String) As NShape
Dim activePage = m_DrawingView.ActivePage
Return CType(activePage.GetFirstDescendant(New NShapeByNameFilter(name)), NShape)
End Function
'''
''' Arranges the shapes in the active page.
'''
Private Sub ArrangeDiagram()
' Create and configure a layout
Dim layout As NLayeredGraphLayout = New NLayeredGraphLayout()
' Get all top-level shapes that reside in the active page
Dim activePage = m_DrawingView.ActivePage
Dim shapes = activePage.GetShapes(False)
' Create a layout context and use it to arrange the shapes using the current layout
Dim layoutContext As NDrawingLayoutContext = New NDrawingLayoutContext(m_DrawingView.Document, activePage)
layout.Arrange(shapes.CastAll(Of Object)(), layoutContext)
' Size the page to the content size
activePage.SizeToContent()
End Sub
#End Region
#Region "Event Handlers"
'''
''' Called when the drawing view is registered to its owner document.
'''
'''
Private Sub OnDrawingViewRegistered(arg As NEventArgs)
' Evaluate the drawing document
m_DrawingView.Document.Evaluate()
' Layout the shapes
ArrangeDiagram()
End Sub
#End Region
#Region "Fields"
Private m_DrawingView As NDrawingView
#End Region
#Region "Static Methods"
#End Region
#Region "Constants"
Private Const ConnectorOneToManyClassName As String = "ConnectorOneToMany"
#End Region
#Region "Nested Types"
Private Enum ENMemberVisibility
[Public] = Microsoft.VisualBasic.AscW("+"c)
[Protected] = Microsoft.VisualBasic.AscW("#"c)
[Private] = Microsoft.VisualBasic.AscW("-"c)
End Enum
Private Structure NMemberInfo
Public Sub New(visibility As ENMemberVisibility, name As String, type As String)
Me.Visibility = visibility
Me.Name = name
Me.Type = type
End Sub
Public Visibility As ENMemberVisibility
Public Name As String
Public Type As String
End Structure
Private Class NShapeByNameFilter
Implements INFilter(Of NNode)
Public Sub New(name As String)
Me.Name = name
End Sub
Public Function Filter(item As NNode) As Boolean Implements INFilter(Of NNode).Filter
Dim shape As NShape = TryCast(item, NShape)
Return shape IsNot Nothing AndAlso Equals(shape.Name, Name)
End Function
Public Name As String
End Class
Private Class NLabelByTextFilter
Implements INFilter(Of NNode)
Public Sub New(text As String)
Me.Text = text
End Sub
Public Function Filter(item As NNode) As Boolean Implements INFilter(Of NNode).Filter
Dim label As NLabel = TryCast(item, NLabel)
Return label IsNot Nothing AndAlso Equals(label.Text.Substring(1), Text)
End Function
Public Text As String
End Class
#End Region
End Class