Book a Demo

Author Topic: v16.1 - Line Width management BROKEN!  (Read 27335 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
v16.1 - Line Width management BROKEN!
« on: March 08, 2024, 04:05:03 pm »
The management of line widths in EA is broken!
When creating a profile, you can specify the (default) line width of the Stereotype by the <context Menu>|> Appearance | Default Appearance [F4] | Border width dialog.  When you generate the MDG, the value DOES appear in the Stereotype definition as the borderwidth="<value>" attribute.   So far, so good!
When you use the toolbox or the QuickLinker to draw the line, the line will appear as the appropriate width.  BUT ALL is NOT what it seems!
If you have a line width that is NOT "1" (say "2"), then the first diagram you draw the line on will be drawn width="2".  But on any other diagram on which the line usually appears, EA will draw it width="1"!
Why is this? 
Investigation reveals that in t_connector, the IsBold column is (apparently) used to hold the "Default" value of the line width using the <context Menu>|> Appearance | Default Appearance [F4] | Border width dialog on the drawn line.  A value of "0" appears to imply "use the default value from the profile (since that is the value set when the line is created initially on the diagram and is the width made on the diagram).  The values 1,2 & 3 correspond to the values selected in the dialog.

Now "the plot thickens"!
So, since the value is set ("0") to use the profile default, you would expect the lines on the other diagrams to be drawn with width=2.  But they aren't!  They are drawn with width="1"!  Checking t_diagramlinks for the instance of the line indicates the Style.LWidth value is set to "0" for that diagram link, meaning "use the default value" (in this case, that is shown in t_connector.IsBold - which is set to "0", meaning use the profile value)!  But instead of drawing the width="2" as required by the profile, they are drawn with width="1!
Why was the line on the first diagram drawn correctly?
Well, an investigation of the t_diagramlinks for the instance of the line indicates the Style.LWidth value is set to "2" (not "0"!)  In other words, instead of saying "use the default value", it explicitly sets the width to the default value!  Inconsistency!
This inconsistency means that if we change the value in t_connector.IsBold (say to "3"), then ALL the OTHER diagrams will change their line width to the new "default", but the original will remain at width="2"!  Inconsistency!

What needs to be fixed?
Firstly, the "0" value in all the relevant locations must mean "use the applicable default".  In t_digramlinks.Style.LWidth: this means using the setting in t_connector.IsBold!  For t_connector.IsBold, this means using the value in the profile.  The default value should then cascade so that if the width is set to "0" in both places and the profile changes, the rendering automatically changes (as one should expect)!  The first time the line is drawn on the diagram, the t_digramlinks.Style.LWidth value should be set to "0" and only changed if the local value is changed using the widget!  This rectification will maintain consistency across all diagrams when the linewidth has not been explicitly changed!

Lastly, there is NO getDefaultLineWidth() for shapescripts (analogous to getDefaultFillColor() and getDefaultLineColor()).  This lack may have contributed to the problems described above (but may not).  When fixing the defect reported above, adding the getDefaultLineWidth() to the "Color Queries" would allow better flexibility in shapescripts to achieve the desired ends.

Reported,
Paolo
« Last Edit: March 08, 2024, 04:07:25 pm by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: v16.1 - Line Width management BROKEN!
« Reply #1 on: March 08, 2024, 09:12:28 pm »
I remember some oddities with linewidth from the time I worked on my shapescript book, but the details are burried somewhere in my brain. I would guess you recovered just some of them...

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: v16.1 - Line Width management BROKEN!
« Reply #2 on: March 12, 2024, 08:44:49 am »
Feature Request: Connector Line width does not have a "profile default" lookup. (I don't think other profile styles for connectors do either) You'd like to see that added as new functionality. (Even if it's described as as an inconsistency issue with the way objects work)
Bug: Creating a profiled connector writes the profile line width into the local colour instead of the default.

I think those two points explain your observations.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: v16.1 - Line Width management BROKEN!
« Reply #3 on: March 14, 2024, 11:12:22 am »

Feature Request: Connector Line width does not have a "profile default" lookup. (I don't think other profile styles for connectors do either) You'd like to see that added as new functionality. (Even if it's described as an inconsistency issue with the way objects work)
As to the other profile style lookup for connectors,
  • getDefaultFillColor() - returns the default fill color for the current element without using the colors applied to this element
  • getDefaultLineColor() - returns the default line color for the current element without using the colors applied to this element
Work for connectors, too, so we assumed that was as designed.  If that's not the case, please create these also.Bug: Creating a profiled connector writes the profile line width into the local colour instead of the default.

I think those two points explain your observations.
 The second point DID occur to me when describing the problem, but I feel it only cures the symptom, not the disease.  The mechanisms for using the defaults for Shapes work well and should be analogous for lines.  If that requires feature requests, then so be it.  Let me know.
Since the code needs to be fixed because of the defect.  Why not fix it properly?

Paolo
« Last Edit: March 14, 2024, 11:15:36 am by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: v16.1 - Line Width management BROKEN!
« Reply #4 on: March 14, 2024, 12:17:00 pm »
The second point DID occur to me when describing the problem
And that was really the whole point of my reply. Your initial post came across to me as a rant about everything being broken again. I attempted to bring the tone back to the point that there was a disconnect between your expectations and reality and one little defect that impacts one use case.

Since the code needs to be fixed because of the defect.  Why not fix it properly?
If I lived in an ideal world where I had unlimited developer hours I would agree. I don't get to pretend I live in that world, I'd rather push for the easy fix to be done before the harder one can even be considered.