Author Topic: Selected Objects Collection Order  (Read 100 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6303
  • Karma: +108/-91
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Selected Objects Collection Order
« on: December 03, 2018, 12:40:36 pm »
We are reinvestigating Visual Enclosure with some scripts to help with the relationships between the enclosed and enclosing objects.

We have observed that the selected objects collection seems to have a special property.  The objects in the collection appear to be returned in reverse Z-Order.

Is this intentional?  Can we rely on this behaviour?  It seems eminently reasonable that they are returned in that order.  If we can rely on this behaviour we can simplify our code tremendously and determine enclosure in one pass.

TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6488
  • Karma: +57/-6
    • View Profile
Re: Selected Objects Collection Order
« Reply #1 on: December 06, 2018, 01:56:04 pm »
I'd say that the order is a product of the internal ordering rather than something official.

That said, I can't see a reason why it would be changed.

PS. Looking for a single object enclosing "the rest" of the selection?
Simon

support@sparxsystems.com

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6303
  • Karma: +108/-91
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Selected Objects Collection Order
« Reply #2 on: December 06, 2018, 02:59:36 pm »
I'd say that the order is a product of the internal ordering rather than something official.

That said, I can't see a reason why it would be changed.

PS. Looking for a single object enclosing "the rest" of the selection?
More general - looking for objects visually enclosing other objects.  In the selection, there may be more than one set of enclosures.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Simon M

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 6488
  • Karma: +57/-6
    • View Profile
Re: Selected Objects Collection Order
« Reply #3 on: December 07, 2018, 08:58:18 am »
Then you'll still require multiple passes through the list won't you? Check each object against all possible parents/children. You can optimize by starting after the element you're checking, but I can't see that you'll only need a single pass.
Simon

support@sparxsystems.com

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 6303
  • Karma: +108/-91
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Selected Objects Collection Order
« Reply #4 on: December 07, 2018, 09:20:59 am »
Then you'll still require multiple passes through the list, won't you? Check each object against all possible parents/children. You can optimize by starting after the element you're checking, but I can't see that you'll only need a single pass.
Neither did we, initially, but the algorithm seems to work.  It doesn't calculate the enclosure level correctly, but it DOES figure out who is enclosed by whom.

When we're done, I'll post here.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!