Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic SVGNodes and performance (Read 3486 times)
mberger
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Jan 6th, 2009
SVGNodes and performance
Nov 2nd, 2009 at 9:54am
Print Post  
Hi,

i have a in my application several custom iconnodes. When i add a bigger number of nodes (about 200 nodes)  to my diagram, the performance decreases.

Could it be, that this performance decrease depends on the svg size. The size of the svg-image is 4000x4000 pixels, but in the diagram i shrink those images to bounds of 20x20 pixels.

regards Marco
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SVGNodes and performance
Reply #1 - Nov 2nd, 2009 at 12:53pm
Print Post  
Hi,

Performance depends on the number of graphic elements in the SVG images and how they are filled. A solid color fill should be much faster than gradients.

Stoyan
  
Back to top
 
IP Logged
 
mberger
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Jan 6th, 2009
Re: SVGNodes and performance
Reply #2 - Nov 2nd, 2009 at 1:12pm
Print Post  
hi Stoyo,

i tested it with SVGNodes which have only solid colors and no gradients. the result is the same...

Do you have an other hint what could decrease the performance?

...could it depent on the draw methode?

Code
Select All
    ' ...
    Public Sub New(ByVal diagram As Diagram)
        ' ...
        MyBase.New(diagram)
        ' ...
        ' SVG-Content ....
        Dim newContent As New SvgContent()
        newContent.Parse(Application.StartupPath & "\images\Node.svg")
        Content = newContent
        Transparent = True
        ' ...
        ' Knotenspezifisch
        Bounds = New System.Drawing.Rectangle(0, 0, 20, 20)
        EnabledHandles = AdjustmentHandles.Move
        HandlesStyle = MindFusion.Diagramming.HandlesStyle.EasyMove
        Label_Druck = "p = 0,0bar"
        Label_Temperatur = "T = 0,0°C"
        Tag = "Node"
        ToolTip = Nothing
        ' ...
        ' DataTable Properties generieren
        genDataTableProperties()
        ' ...
        ' DataTable FluidTemperatures generieren
        genDataTableFluidTemperatures()
        ' ...
        ' DataTable Knoten Warnungen generieren
        genDatatableNodeWarnings()
        ' ...
    End Sub
    ' ...
    Public Overrides Sub Draw(ByVal graphics As MindFusion.Drawing.IGraphics, ByVal options As MindFusion.Diagramming.RenderOptions)
        MyBase.Draw(graphics, options)
        ' ...
        ' ... Label
        Dim Font_Name As New System.Drawing.Font(New System.Drawing.FontFamily("Verdana"), 7, FontStyle.Bold, GraphicsUnit.Point)
        Dim Font_Value As New System.Drawing.Font(New System.Drawing.FontFamily("Verdana"), 7, FontStyle.Regular, GraphicsUnit.Point)
        ' ...
        ' ... Label Benennung
        If FlowSim_AppWindow.ShowNodeName.EditValue = True And Me.Visible = True Then
            ' ...
            Dim LabelFormat As New StringFormat(StringAlignment.Center)
            Dim LabelSize As New SizeF(FlowSim_Designer.Diagram1.MeasureString(_Label_NodeName, Font_Name, Integer.MaxValue, LabelFormat))
            Dim LabelCenter As New RectangleF(GetCenter.X + 1, Bounds.Bottom - 1, LabelSize.Width, LabelSize.Height)
            ' ...
            graphics.FillRectangle(Brushes.White, LabelCenter)
            graphics.DrawString(_Label_NodeName, Font_Name, Brushes.Black, LabelCenter, LabelFormat)
            ' ...
        End If
        ' ...
        ' Label Druck
        If FlowSim_AppWindow.RadioGroup_Node.EditValue = 2 And Me.Visible = True Then
            ' ...
            Dim LabelFormat As New StringFormat(StringAlignment.Center)
            Dim LabelSize As New SizeF(FlowSim_Designer.Diagram1.MeasureString(_Label_NodeDruck, Font_Value, Integer.MaxValue, LabelFormat))
            Dim LabelCenter As New RectangleF(GetCenter.X, Bounds.Bottom + 9, LabelSize.Width, LabelSize.Height)
            ' ...
            graphics.FillRectangle(Brushes.White, LabelCenter)
            graphics.DrawString(_Label_NodeDruck, Font_Value, Brushes.DarkSlateGray, LabelCenter, LabelFormat)
            ' ...
        End If
        ' ...
        ' Label Temperatur
        If FlowSim_AppWindow.RadioGroup_Node.EditValue = 3 And Me.Visible = True Then
            ' ...
            Dim LabelFormat As New StringFormat(StringAlignment.Center)
            Dim LabelSize As New SizeF(FlowSim_Designer.Diagram1.MeasureString(_Label_NodeTemperatur, Font_Value, Integer.MaxValue, LabelFormat))
            Dim LabelCenter As New RectangleF(GetCenter.X, Bounds.Bottom + 9, LabelSize.Width, LabelSize.Height)
            ' ...
            graphics.FillRectangle(Brushes.White, LabelCenter)
            graphics.DrawString(_Label_NodeTemperatur, Font_Value, Brushes.DarkSlateGray, LabelCenter, LabelFormat)
            ' ...
        End If
        ' ...
    End Sub
 




Marco
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SVGNodes and performance
Reply #3 - Nov 3rd, 2009 at 6:38am
Print Post  
Are all the 200 nodes shown at the same time, either in the DiagramView or in an Overview control / FitAll mode?
  
Back to top
 
IP Logged
 
mberger
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 44
Joined: Jan 6th, 2009
Re: SVGNodes and performance
Reply #4 - Nov 3rd, 2009 at 11:00am
Print Post  
Hi Stoyo,

the half of the nodes are shown in the diagrnview and all of the nodes are shown in the overview with fitAll mode...
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SVGNodes and performance
Reply #5 - Nov 5th, 2009 at 7:21am
Print Post  
Hi Marco,

I've tried this with the resistance.svg file you sent us before but couldn't see anything wrong with the performance. Are you using more complex svg drawings than it? Regarding your custom-draw method, you might try caching the result of MeasureString instead of calling it upon each redraw operation.

Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: SVGNodes and performance
Reply #6 - Nov 5th, 2009 at 7:29am
Print Post  
Additionally, if you have a lot of text in the nodes, you might set overview.DisplayText to false, and do not call DrawString from the Draw override when options.EnableText is false.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint