Class AirdLayout

java.lang.Object
be.kuleuven.cs.distrinet.sparta.io.diagram.AirdLayout

public final class AirdLayout extends Object
Extracts the geometry of a Sirius diagram from its .aird representations file by reading it as plain XML - deliberately with no dependency on Sirius, GMF-runtime, draw2d or SWT, so it runs headlessly (RCP and standalone alike).

The mapping followed is the standard GMF/Sirius one:

   notation:Node[@element] --uid--> diagram:DNode/DNodeContainer/DNodeList
                                       └─ <target href="model#FRAGMENT"/>
   notation:Node/layoutConstraint (notation:Bounds x,y,width,height)
 
The result maps each semantic element's resource fragment (its xmi:id, matching Resource.getURIFragment(org.eclipse.emf.ecore.EObject)) to its absolute bounds on the diagram. GMF stores child coordinates relative to the parent node, so ancestor offsets are accumulated while walking the notation tree.

Any parse/IO error yields an empty layout rather than throwing: a missing or unreadable .aird simply means "no reusable layout", and the report generator falls back gracefully.

  • Method Details

    • boxFor

      public AirdLayout.Box boxFor(String fragment)
      Returns:
      bounds for the semantic element with the given resource fragment, or null.
    • isEmpty

      public boolean isEmpty()
    • title

      public String title()
      Returns:
      a best-effort diagram name, or null if none was found.
    • parse

      public static AirdLayout parse(File aird)
      Parse the given .aird. Never throws: on any error an empty layout is returned.