Author Topic: Move EmbeddedElement from one Element to another  (Read 13026 times)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13136
  • Karma: +547/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Move EmbeddedElement from one Element to another
« Reply #30 on: June 18, 2020, 05:11:49 pm »
Quote
Well, EA "usually" (but as EA is, not always) puts embedded elements inside or attached to their parents. Whether or not elements are graphically overlapping can only be detected by their position (top, left, bottom, right). That's quite simple geometry to use here. There is no attribute where you can detect that a diagram object is embedded or not (except via the parent relation of the underlying objects).

Well I agree that the mathematics involved are not complex but it is quite some coding as you have to check ALL elements on the diagram to see if they are in the same position (a full table scan implemented in scripting code). Then I have to check if the items are simply in the same place (they have no parent/child) relation or they should actually be embedded on diagram level.
Well I have some coding to do, however a collection of embedded (child) Diagram objects on the (parent) diagram object just like the Element itself would make life easier for me  :'(

There are lots of things that could make our life easier. The API is a very thing layer on top of the database.
I ended up writing a whole framework in C# that gives me a more functional interface.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13570
  • Karma: +395/-301
  • I'm no guru at all
    • View Profile
Re: Move EmbeddedElement from one Element to another
« Reply #31 on: June 18, 2020, 05:31:01 pm »
Same here. I always wonder what a wonderful tool EA could be if not every user had to do that frameworking but if Sparx had provided it already. Well, I guess I know the answer.

q.

Viking

  • EA User
  • **
  • Posts: 400
  • Karma: +2/-2
    • View Profile
Re: Move EmbeddedElement from one Element to another
« Reply #32 on: June 18, 2020, 06:41:53 pm »
Orientation LRTB element and port to the right
E: 210 310 -190 -270
P: 303 318 -230 -245
-> port L 303 = element R 310 - 7
    port R 318 = element R 310 + 8

For completness and because it makes calculations easier. Just take the middle:
port L 303 = element R 310 - (15/2)
port R 318 = element R 310 + (15/2)

qwerty

  • EA Guru
  • *****
  • Posts: 13570
  • Karma: +395/-301
  • I'm no guru at all
    • View Profile
Re: Move EmbeddedElement from one Element to another
« Reply #33 on: June 18, 2020, 07:51:52 pm »
15/2 is an integer division. It yields 7 (I'd guess in all compilers). Don't know if that would be a way to go.

So did you get it to work?

q.

Viking

  • EA User
  • **
  • Posts: 400
  • Karma: +2/-2
    • View Profile
Re: Move EmbeddedElement from one Element to another
« Reply #34 on: June 19, 2020, 12:09:33 am »
15/2 is an integer division. It yields 7 (I'd guess in all compilers). Don't know if that would be a way to go.
So did you get it to work? q.

Yes, see above.

I also mentioned the reason. The update-statement was at the wrong place.

I just added this information with "15/2" because than it does not need to be considered if it is 8 or 7.