Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Anchors
Anchors [message #745643] Sat, 22 October 2011 23:55 Go to next message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 188
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
Anchors, and the relation with its GraphicAlgorithms have little documentation - I have doubts with the location of a GA, in gral (I filled an enhancement bug, see issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=361736 )

Some tentative conceptual definitions for anchors, so that developers who know better than me can correct, redefine and complete (perhaps to copy to a wiki someday)

- Every anchor has a parentGA
It's just the GA (GraphicAlgorithm) from the parent shape (or connection)

- Every anchor has an POSITION
It's relative from its parentGA, and it never depends on the anchor's GA or children.
-- For a ChopboxAnchor, it's implicit: the center of the parentGA
-- For a positioned anchors, it's explicit (relative or fixed)
(Note: it's rather unusual in Graphiti that a PE has a position, normally GA specify positions)

- Every anchor has a REFERENCE POINT (logical end-point of the connection)
-- For ChopboxAnchor and positioned anchors with useAnchorLocationAsConnectionEndpoint=true, it coincides with the POSITION
-- Elsewhere, it's the center of the anchor GA

- Every anchor has a GA (only implicit for Chopbox)
-- It's just the GA that has been created for that anchor
(recall that an Anchor is a PictogramElement, and every PE should have a GA)
However, the GA for an anchor has two idiosyncracies:
1) ChopboxAnchor: it does not define it's own GA, (must not define it!), it's assumed to be the parentGA.
2) positioned anchors: its position is relative to the anchor POSITION (important!), position coordinates can be negative.

- An anchor has a refGA (referenceGraphitAlgoritm)
-- What is this??? who sets it???

- An anchor has (conceptually) two BOXES (the REFERENCE POINT should be inside them)
-- CAPTURE BOX: is the area (always rectangular?) where the mouse is captured for starting/ending a connection
-- BOUNDING BOX: is the rectangular area that determines the LOCATION (visible endpoint) for a connection
--- CAPTURE BOX == BOUNDING BOX always? (i'm not sure)
--- how are they computed ? is it the anchor GA bound box? (it seems so)
--- how does PeServiceImpe.getGaBoundsForAnchor() relates with this? (it uses refGA )

Some additional notes:

- Why the properties of the BoxRelativeAnchor are called RelativeWidth/RelativeHeight ? Is this a misnomer? Shouldn't they be
relativeX/RelativeY (relative to the widht/height of the parentGA)

- UseAnchorLocationAsConnectionEndpoint is awfully long (i would also prefer "PositionedAnchor" instead of "AdvancedAnchor")

[Updated on: Sun, 23 October 2011 02:35]

Report message to a moderator

Re: Anchors [message #755183 is a reply to message #745643] Mon, 07 November 2011 15:51 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
There's an open bugzilla for improving the documentation on that: https://bugs.eclipse.org/bugs/show_bug.cgi?id=359219

Michael
Re: Anchors [message #755793 is a reply to message #755183] Wed, 09 November 2011 15:39 Go to previous messageGo to next message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 188
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
I don't know if this is another lack of documentation issue, or a bug, or a GEF limitation or just that I'm missing something:

What determines the z-order of an anchor ? For Shapes, we can send them to back or front, with sibling GAs, it depend of the creation order (I think), but here again Anchors doesn't seem to fit anywhere.

Example: I have a shape with a 100x100 rectangle. Inside it, I want to create an Anchor with its own 50x50 rectangle (say, in the middle right side), and I also want to dray an horizontal line that cuts the 100x100 rectangle in half and is displayed over the anchor (I was trying this to avoid nested GA inside Anchors)


     outer shape 
 --------------------
|                    |
|           anchor   |
|         ---------- |
|        |          ||
| line   |          ||
|--------------------|
|        |          ||
|        |          ||
|         ---------- |
|                    |
|                    |
 --------------------


It seems to me it can't be done. Am I right?
Re: Anchors [message #755955 is a reply to message #755793] Thu, 10 November 2011 10:18 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Correct, that cannot be done.

Reason is that anchors are "special" children of shapes. The Z order is
determined by the sequence of the child shapes added to the list of
children, same is true for anchors (and also for decorators). But anchors
are added only after all child shapes have been added. That makes them
appear on top of all the shapes.

The underlying technical reason is that anchors are kept in a seperate list
apart from child shapes.

Michael
Re: Anchors [message #755984 is a reply to message #755955] Thu, 10 November 2011 11:56 Go to previous message
Hernan Gonzalez is currently offline Hernan GonzalezFriend
Messages: 188
Registered: October 2010
Location: Buenos Aires, Argentina
Senior Member
Michael Wenz wrote on Thu, 10 November 2011 07:18

Correct, that cannot be done.

Reason is that anchors are "special" children of shapes. The Z order is
determined by the sequence of the child shapes added to the list of
children, same is true for anchors (and also for decorators). But anchors
are added only after all child shapes have been added. That makes them
appear on top of all the shapes.

The underlying technical reason is that anchors are kept in a seperate list
apart from child shapes.

Michael


I guess that when you speak of "child shapes" you are meaning (also) GA.
Thanks for the info.
Previous Topic:Bug #323351
Next Topic:Connections with Horizontal start and end & Moving Bendpoints
Goto Forum:
  


Current Time: Thu Apr 25 11:53:01 GMT 2024

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

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

Back to the top