Imports DWSIM.Drawing.SkiaSharp.GraphicObjects Imports DWSIM.Interfaces.Enums.GraphicObjects Imports DWSIM.DrawingTools.Point Namespace GraphicObjects.Shapes Public Class AbsorptionColumnGraphic Inherits ShapeGraphic #Region "Constructors" Public Sub New() Me.ObjectType = DWSIM.Interfaces.Enums.GraphicObjects.ObjectType.AbsorptionColumn CreateConnectors(10, 10) Me.Description = "Absorption Column" EmbeddedResourceIconName = "abscol_new.png" End Sub Public Sub New(ByVal graphicPosition As SKPoint) Me.New() Me.SetPosition(graphicPosition) End Sub Public Sub New(ByVal posX As Integer, ByVal posY As Integer) Me.New(New SKPoint(posX, posY)) End Sub Public Sub New(ByVal graphicPosition As SKPoint, ByVal graphicSize As SKSize) Me.New(graphicPosition) Me.SetSize(graphicSize) End Sub Public Sub New(ByVal posX As Integer, ByVal posY As Integer, ByVal graphicSize As SKSize) Me.New(New SKPoint(posX, posY), graphicSize) End Sub Public Sub New(ByVal posX As Integer, ByVal posY As Integer, ByVal width As Integer, ByVal height As Integer) Me.New(New SKPoint(posX, posY), New SKSize(width, height)) End Sub #End Region Public Overrides Sub CreateConnectors(InCount As Integer, OutCount As Integer) 'Creates all the connection points. If InputConnectors.Count = 0 Then For I As Integer = 1 To InCount Dim Con As New ConnectionPoint Con.Type = ConType.ConIn InputConnectors.Add(Con) Next End If If OutputConnectors.Count = 0 Then For I As Integer = 1 To OutCount Dim Con As New ConnectionPoint Con.Type = ConType.ConOut OutputConnectors.Add(Con) Next End If Dim myIC1 As New ConnectionPoint If DrawMode = 2 Then With InputConnectors For i As Integer = 0 To InCount - 1 .Item(i).Position = New Point(X + 0.2 * Width, Y + Height * 0.2 + (i + 1) / InCount * Height * 0.6) .Item(i).Direction = ConDir.Right .Item(i).ConnectorName = "Column Feed Port #" & (i + 1) Next If .Item(0).IsAttached Then .Item(0).Position = New Point(X + 0.2 * Width, Y + 0.2 * Height) End If If .Item(1).IsAttached Then .Item(1).Position = New Point(X + 0.2 * Width, Y + 0.88 * Height) End If End With With OutputConnectors .Item(0).Position = New Point(X + 0.5 * Width, Y + 0.2 * Height) .Item(1).Position = New Point(X + 0.5 * Width, Y + 0.88 * Height) .Item(0).ConnectorName = "Top Product" .Item(1).ConnectorName = "Bottoms Product" For i As Integer = 2 To OutCount - 1 .Item(i).Position = New Point(X + 0.05 * 1.25 * Width + 0.2 * 1.25 * Width, Y + Height * 0.2 + (i + 1) / OutCount * Height * 0.6) .Item(i).Direction = ConDir.Left .Item(i).ConnectorName = "Side Draw #" & (i - 1) Next End With Else With InputConnectors For i As Integer = 0 To InCount - 1 .Item(i).Position = New Point(X + 0.05 * 1.25 * Width, Y + Height * 0.2 + (i + 1) / InCount * Height * 0.6) .Item(i).Direction = ConDir.Right .Item(i).ConnectorName = "Column Feed Port #" & (i + 1) Next End With With OutputConnectors .Item(0).Position = New Point(X + Width, Y + 0.02 * Height) .Item(1).Position = New Point(X + Width, Y + 0.98 * Height) .Item(0).ConnectorName = "Top Product" .Item(1).ConnectorName = "Bottoms Product" For i As Integer = 2 To OutCount - 1 .Item(i).Position = New Point(X + 0.05 * 1.25 * Width + 0.2 * 1.25 * Width, Y + Height * 0.2 + (i + 1) / OutCount * Height * 0.6) .Item(i).Direction = ConDir.Left .Item(i).ConnectorName = "Side Draw #" & (i - 1) Next End With End If EnergyConnector.Active = False End Sub Public Overrides Sub PositionConnectors() CreateConnectors(10, 10) End Sub Public Overrides Sub Draw(ByVal g As Object) Dim canvas As SKCanvas = DirectCast(g, SKCanvas) CreateConnectors(10, 10) UpdateStatus() MyBase.Draw(g) Select Case DrawMode Case 0 'default Dim gradPen As New SKPaint() With gradPen .Color = LineColor.WithAlpha(50) .StrokeWidth = LineWidth .IsStroke = False .IsAntialias = GlobalSettings.Settings.DrawingAntiAlias End With canvas.DrawRoundRect(New SKRect(X + (0.05) * 1.25 * Width, Y + 0.1 * Height, X + (0.05) * 1.25 * Width + 0.2 * 1.25 * Width, Y + 0.1 * Height + 0.8 * Height), 10, 10, gradPen) Dim myPen As New SKPaint() With myPen .Color = LineColor .StrokeWidth = LineWidth .IsStroke = True .IsAntialias = GlobalSettings.Settings.DrawingAntiAlias End With canvas.DrawRoundRect(New SKRect(X + (0.05) * 1.25 * Width, Y + 0.1 * Height, X + (0.05) * 1.25 * Width + 0.2 * 1.25 * Width, Y + 0.1 * Height + 0.8 * Height), 10, 10, myPen) canvas.DrawPoints(SKPointMode.Polygon, New SKPoint() {New SKPoint(X + 0.175 * Width, Y + 0.1 * Height), New SKPoint(X + 0.175 * Width, Y + 0.02 * Height), New SKPoint(X + Width, Y + 0.02 * Height)}, myPen) canvas.DrawPoints(SKPointMode.Polygon, New SKPoint() {New SKPoint(X + 0.175 * Width, Y + 0.9 * Height), New SKPoint(X + 0.175 * Width, Y + 0.98 * Height), New SKPoint(X + Width, Y + 0.98 * Height)}, myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.2 * Height), (X + 0.31 * Width), (Y + 0.2 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.3 * Height), (X + 0.31 * Width), (Y + 0.3 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.4 * Height), (X + 0.31 * Width), (Y + 0.4 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.5 * Height), (X + 0.31 * Width), (Y + 0.5 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.6 * Height), (X + 0.31 * Width), (Y + 0.6 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.7 * Height), (X + 0.31 * Width), (Y + 0.7 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.8 * Height), (X + 0.31 * Width), (Y + 0.8 * Height), myPen) Case 1 'b/w Dim myPen As New SKPaint() With myPen .Color = SKColors.Black .StrokeWidth = LineWidth .IsStroke = True .IsAntialias = GlobalSettings.Settings.DrawingAntiAlias End With canvas.DrawRoundRect(New SKRect(X + (0.05) * 1.25 * Width, Y + 0.1 * Height, X + (0.05) * 1.25 * Width + 0.2 * 1.25 * Width, Y + 0.1 * Height + 0.8 * Height), 10, 10, myPen) canvas.DrawPoints(SKPointMode.Polygon, New SKPoint() {New SKPoint(X + 0.175 * Width, Y + 0.1 * Height), New SKPoint(X + 0.175 * Width, Y + 0.02 * Height), New SKPoint(X + Width, Y + 0.02 * Height)}, myPen) canvas.DrawPoints(SKPointMode.Polygon, New SKPoint() {New SKPoint(X + 0.175 * Width, Y + 0.9 * Height), New SKPoint(X + 0.175 * Width, Y + 0.98 * Height), New SKPoint(X + Width, Y + 0.98 * Height)}, myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.2 * Height), (X + 0.31 * Width), (Y + 0.2 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.3 * Height), (X + 0.31 * Width), (Y + 0.3 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.4 * Height), (X + 0.31 * Width), (Y + 0.4 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.5 * Height), (X + 0.31 * Width), (Y + 0.5 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.6 * Height), (X + 0.31 * Width), (Y + 0.6 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.7 * Height), (X + 0.31 * Width), (Y + 0.7 * Height), myPen) canvas.DrawLine((X + 0.05 * 1.25 * Width), (Y + 0.8 * Height), (X + 0.31 * Width), (Y + 0.8 * Height), myPen) Case 2 DrawIcon(canvas) Case 3 'Temperature Gradients Case 4 'Pressure Gradients Case 5 'Temperature/Pressure Gradients End Select End Sub End Class End Namespace