Home » Modeling » Graphiti » Nested GA inside FixedPointAnchors?
Nested GA inside FixedPointAnchors? [message #715897] |
Mon, 15 August 2011 21:45 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
This is driving me nuts. I (thought) understood that all coordinates for a GA (Graphic Algorithm) are relative to its parent GA. But I can't understand how that applies to a FixedPointAnchor.
[url=http://imageshack.us/photo/my-images/856/graphiti.png/]image[/img]
The figure (grid size=10) corresponds to this hierarchy:
containerShape ----> invisibleRectangle (100x200)
| | |
| | |__ roundedRectangle1 (BLUE, 10px right/left margins)
| | |
| | |__ roundedRectangle2 (RED)
| |
| shape2 ---> roundedRectangle3 (GREEN)
| |
| |___ roundedRectangle4 ( ORANGE)
|
anchor (FIXED POINT ANCHOR: at 0-100)
|
|___ roundedRectangle5 (LIGHT_GREEN)
|
|__ roundedRectangle6 (LIGHT_ORANGE)
The coordinates of the first 4 roundedRectangles works as expected.
With the FixedPointAnchor, they don't, specially the nested roundedRectangle6
First: I had found out that every Pictogram Element (PE) (at least a Shape)
must contain a GA: a Shape per se doesnt know about its size or position, it's
its GA who knows that. But , what about anchors?
It's reasonable that roundedRectangle5 has its coordinates relative to the anchor position ? Has a FixedPointAnchor an implicit GA inside? (it seems to have a position but not a size).
But I could buy that; what I dont get is the behaviour of the nested GA (roundedRectangle6). To make it work, I had to specify a position that is not relative to its parent GA (roundedRectangle5), but to some combination of its parent and the anchor position. See code below. Is this a bug?
ContainerShape containerShape = peCreateService.createContainerShape(targetDiagram, true);
int width = 100;
int height = 200;
int grid = 10;
{
Rectangle invisibleRectangle = gaService.createInvisibleRectangle(containerShape);
gaService.setLocationAndSize(invisibleRectangle,
context.getX(),context.getY(),width,height);
RoundedRectangle roundedRectangle = gaService.createRoundedRectangle(invisibleRectangle, 5, 5);
roundedRectangle.setBackground(manageColor(IColorConstant.BLUE));
gaService.setLocationAndSize(roundedRectangle, grid,0,width-grid*2,height);
RoundedRectangle roundedRectangle2 = gaService.createRoundedRectangle(roundedRectangle, 5, 5);
roundedRectangle2.setBackground(manageColor(IColorConstant.RED));
gaService.setLocationAndSize(roundedRectangle2, 5,5,20,20);
}
{
Shape shape2 = peCreateService.createShape(containerShape, true);
RoundedRectangle roundedRectangle3 = gaService.createRoundedRectangle(shape2, 5, 5);
roundedRectangle3.setBackground(manageColor(IColorConstant.GREEN));
gaService.setLocationAndSize(roundedRectangle3, 5,30,70,40);
RoundedRectangle roundedRectangle4 = gaService.createRoundedRectangle(roundedRectangle3, 5, 5);
roundedRectangle4.setBackground(manageColor(IColorConstant.ORANGE));
gaService.setLocationAndSize(roundedRectangle4, 10,10,20,20);
}
{
FixPointAnchor anchor = peCreateService.createFixPointAnchor(containerShape);
Point fixPoint = gaService.createPoint(0,100);
anchor.setLocation(fixPoint);
RoundedRectangle rrect5 = gaService.createRoundedRectangle(anchor, 5, 5);
rrect5.setBackground(manageColor(IColorConstant.LIGHT_GREEN));
gaService.setLocationAndSize(rrect5, 5,-10,70,40);
RoundedRectangle rrect6 = gaService.createRoundedRectangle(rrect5, 5, 5);
rrect6.setBackground(manageColor(IColorConstant.LIGHT_ORANGE));
//gaService.setLocationAndSize(rrect6, 10,10,20,20); // THIS SHOULD WORK, IT DOESNT
gaService.setLocationAndSize(rrect6, 10,-90,20,20);
}
[Updated on: Mon, 15 August 2011 21:49] Report message to a moderator
|
|
| | |
Goto Forum:
Current Time: Sat Apr 27 00:49:38 GMT 2024
Powered by FUDForum. Page generated in 0.03677 seconds
|