Anchors [message #745643] |
Sat, 22 October 2011 23:55 |
Hernan Gonzalez 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 #755793 is a reply to message #755183] |
Wed, 09 November 2011 15:39 |
Hernan Gonzalez 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?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03281 seconds