Obtain Diagram Element from the base elements? (+their attributes)

Hello,
I have got this simple aql code:

System functions:
{m:for SF|self.eAllContents(ctx::SystemFunction) }
{m:SF.name}
{m:endfor}
  1. I was wondering if it was possible to get the diagram element associated to one of my system functions?
  2. Extract from that element the coordinates of the said element inside a diagram given. (Let’s suppose the element is displayed in only one diagram)

Thanks

You will need to create your own Java service to do this. You can try:

DSemanticDiagram.getOwnedAnnotationEntries().getData()

To access the GMF Notation model.

Node.getElement()

Will give you the DDiagramElement.

DDiagramElement.getTarget()

Will give you the semantic element.

Node.getLayoutConstraint()

Will give you coordinates and size of the element.

It might be possible with an AQL expression but the service will allow you to walk the Notation model once and cache the result. An AQL expression will need to walk the Notation model many times and will be pretty slow.

1 Like