Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Anchors(Locating anchors properly)
Anchors [message #1062891] Tue, 11 June 2013 09:23 Go to next message
John Cole is currently offline John ColeFriend
Messages: 66
Registered: June 2013
Hello everyone,

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!
Re: Anchors [message #1064075 is a reply to message #1062891] Mon, 17 June 2013 13:46 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1927
Registered: July 2009
Location: Walldorf, Germany
Senior Member

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...

Did you see
? It provides an introduction to the specific anchors in Graphiti.

Previous Topic:decorating visual representation of business objects with icons provided from outside of the editor
Next Topic:Insert image as shape
Goto Forum:

Current Time: Mon Jul 26 20:16:13 GMT 2021

Powered by FUDForum. Page generated in 0.02163 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top