I am working on my new Graphiti diagram and actually got some problems with the location of anchors.
I used the code in the Graphiti tutorial, where a anchor on the middle right side is located. This is the code:
// create an box relative anchor at middle-right
final BoxRelativeAnchor boxAnchorLeft = peCreateService
// anchor references visible rectangle instead of invisible rectangle
// assign a graphics algorithm for the box relative anchor
Rectangle rectangleLeft = gaService.createRectangle(boxAnchorLeft);
gaService.setLocationAndSize(rectangleLeft, -2 * edge, edge, 2 * edge, 2 * edge);
// call the layout feature
Now I want to move that anchor to the middle left side.
I tried to experiment with the parameters in setLocationAndSize(), setRelativeWidth() and setRelativeHeight() but unfortunately I do not get reasonable results.
I do not understand the way the methods work and depend on each other. Editing the third parameter in setLocationAndSize() (the y coordinate) moves the anchor on the y axis but the effects on chaging the second parameter (the x coordinate) seems not logical to me. A bigger number moves the anchor to the left and if I resize the EClass the anchor is not docked to the left edge (like the right anchor in the Graphiti tutorial).
Could someone explain how they work and how I can create two anchors, one docking at the middle-right and on on the middle-left side? Also two other anchors at the middle-top and middle-bottom.
Michael Wenz Messages: 1790 Registered: July 2009 Location: Walldorf, Germany
depending on the structure of a diagram, this might become rather tricky. In
general every graphics algorithm is located relative to its next active
parent shape (or rather the shape's graphics algorithm), which again is
located relative to its parent...