hmmm,
it doesn't work for me...
"Registration of the Custom DiagramItems"
Public Sub RegisterDiagramItems()
' ...
' Registrieren der DiagramItems
Diagram.RegisterItemClass(GetType(SVGNode_Node), "SVGNode", 1)
Diagram.RegisterItemClass(GetType(SVGNode_Inlet), "SVGInlet", 1)
Diagram.RegisterItemClass(GetType(SVGNode_Outlet), "SVGOutlet", 1)
Diagram.RegisterItemClass(GetType(SVGNode_Resistance), "SVGResistance", 1)
Diagram.RegisterItemClass(GetType(CustomLink), "CustomLink", 1)
' ...
End Sub
"CustomLink Class"
Public Class CustomLink
' ...
Inherits DiagramLink
' ...
Public Sub New(ByVal prototype As CustomLink, ByVal origin As DiagramNode, ByVal destination As DiagramNode)
MyBase.new(prototype, origin, destination)
' ...
Tag_BrokenLink = prototype.Tag_BrokenLink
FakeVolumFlow = prototype.FakeVolumFlow
' ...
End Sub
' ...
Public Sub New(ByVal diagram As Diagram, ByVal Origin As DiagramNode, ByVal Destination As DiagramNode)
MyBase.New(diagram, Origin, Destination)
' ...
Tag = "hasNoAttechedNodes"
Tag_BrokenLink = ""
FakeVolumFlow = 0
' ...
' Look and Feel
BaseShape = MindFusion.Diagramming.ArrowHead.None
HeadShape = MindFusion.Diagramming.ArrowHead.Triangle
Pen.DashStyle = Drawing2D.DashStyle.Solid
' ...
Dim CBrush As New MindFusion.Drawing.SolidBrush(System.Drawing.Color.FromArgb(255, 60, 60, 60))
Pen.Brush = CBrush
Brush = CBrush
HeadPen.Brush = CBrush
' ...
Selected = False
' ...
End Sub
' ...
Public Overrides Function Clone(ByVal clipboard As Boolean) As MindFusion.Diagramming.DiagramItem
Return New CustomLink(Me, Me.Origin, Me.Destination)
' ...
End Function
' ...
#Region "Save / Load"
' ...
Protected Overrides Sub SaveTo(ByVal writer As System.IO.BinaryWriter, ByVal ctx As PersistContext)
MyBase.SaveTo(writer, ctx)
' ...
writer.Write(_Tag_BrokenLink)
writer.Write(_FakeVolumFlow)
End Sub
' ...
Protected Overrides Sub LoadFrom(ByVal reader As System.IO.BinaryReader, ByVal ctx As PersistContext)
MyBase.LoadFrom(reader, ctx)
' ...
_Tag_BrokenLink = reader.ReadString
_FakeVolumFlow = reader.ReadDouble
End Sub
' ...
#End Region
' ...
Public Property Tag_BrokenLink() As String
Get
Return _Tag_BrokenLink
End Get
Set(ByVal value As String)
_Tag_BrokenLink = value
End Set
End Property
' ...
Public Property FakeVolumFlow() As Double
Get
Return _FakeVolumFlow
End Get
Set(ByVal value As Double)
_FakeVolumFlow = value
End Set
End Property
' ...
Private _Tag_BrokenLink
Private _FakeVolumFlow
' ...
End Class
Should i implement the DiagramItem.Clone method in all custom nodes or only in the customLink class ?