|Anchors [message #1062891]
||Tue, 11 June 2013 05:23
| John Cole
Registered: June 2013
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.
I'm grateful for any help!
Powered by FUDForum
. Page generated in 0.01515 seconds