Book a Demo

Author Topic: Getting the position of a Swimline in a Diagram  (Read 7544 times)

ea1222

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Getting the position of a Swimline in a Diagram
« on: September 18, 2023, 10:02:53 pm »
I'm developing a script to create the PlantUML diagram.
And I need to get the position of a Swimline on a Sequence or Activity diagram according to the links and objects in the diagram.
The object Swimline has property "Width", but it don't appropriate to the swimline width.
How can I get the position or the actual width of the Swimlines in the Diagram?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Getting the position of a Swimline in a Diagram
« Reply #1 on: September 18, 2023, 11:08:50 pm »
Are you talkin about swimlanes, or Activity Partitions?

Those are two completely different things in EA.

Geert

PS. I've never seen swimlanes or activity partitionsin sequence diagrams. Are you sure about that?

ea1222

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Getting the position of a Swimline in a Diagram
« Reply #2 on: September 18, 2023, 11:55:11 pm »
I'm talking about Swimlines, not Activity Partitions

BobM

  • EA User
  • **
  • Posts: 144
  • Karma: +9/-0
    • View Profile
Re: Getting the position of a Swimline in a Diagram
« Reply #3 on: September 19, 2023, 12:05:30 am »
Can you post a screenshot of what exactly you need?
There might be an error in translation

you can use the [img] [/ img] in order to add images here (after uploading it to an image board)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Getting the position of a Swimline in a Diagram
« Reply #4 on: September 19, 2023, 12:11:47 am »
I'm talking about Swimlines, not Activity Partitions
Do you have swimlanes in sequence diagrams?

Anyways, you can access the swimlane objects throught the EA.Dagram.Swimlanes. This is an ordered collection.
Each of the swimlanes has a width. To get the left edge of a swimlane n you'll have to to add all widths of all swimlanes up to n-1.
The right edge is ofcourse left + width.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Getting the position of a Swimline in a Diagram
« Reply #5 on: September 19, 2023, 02:17:13 am »
You shouldn't be using SL at all. They are just graphical gimmicks with no semantics.

q.

ea1222

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Getting the position of a Swimline in a Diagram
« Reply #6 on: September 19, 2023, 06:47:27 pm »
I know that Swimlines are praphical gimmicks, but I need to use them in PlantUML scripts.

My test gave me the following result:  the values of the "Swimline.Width" property is 200 px for all Swimlines!
But in the picture they are different.

diagram.SwimlaneDef.Swimlanes.Count = 3

diagram.SwimlaneDef.Swimlanes.Items(0).Width = 200
diagram.SwimlaneDef.Swimlanes.Items(0).Title = Header

diagram.SwimlaneDef.Swimlanes.Items(1).Width = 200
diagram.SwimlaneDef.Swimlanes.Items(1).Title = Save method

diagram.SwimlaneDef.Swimlanes.Items(2).Width = 200
diagram.SwimlaneDef.Swimlanes.Items(2).Title = Delete method

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Getting the position of a Swimline in a Diagram
« Reply #7 on: September 19, 2023, 07:11:46 pm »
I can confirm. Seems like a bug in the API; please report to Sparx using the link on the bottom.

Workaround is to get the information yourself from the database using Repository.SQLQuery.

Use a query like this:

Code: [Select]
select x.requirement, x.Partition, x.Name
from t_diagram d
inner join t_xref x on x.client = d.ea_guid
and x.type = 'swimlane'
where d.ea_guid = '{2BC3E8C3-2293-4e49-A126-E750106900DC}'
order by x.Partition

The requirement field contains something like this:

Code: [Select]
back=-1;SW=280;
The SW is the real width of the swimlane.

Geert

PS. The name of this thing is really swimlane, not swimline as you keep using.
« Last Edit: September 19, 2023, 07:13:17 pm by Geert Bellekens »

ea1222

  • EA Novice
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
Re: Getting the position of a Swimline in a Diagram
« Reply #8 on: September 19, 2023, 08:42:42 pm »
Many thanks!