Home » Modeling » Graphiti » GraphicsAlgorithm coordinates: relative to....?
GraphicsAlgorithm coordinates: relative to....? [message #873150] |
Thu, 17 May 2012 15:47 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
The GraphicAlgorithm's coordinates are relative to... what?
This is surely a very simple question but the docs are quite obscure (I've already filled a bug with respect to the docs).
Specifically: If, inside a parent ContainerShape I want to create the following
containerShape (active) -> Rectangle rect
|
|
containerShape2 (inactive) -> Rectangle rect2
|
| shape3 (active) -> Rectangle rect3
ContainerShape containerShape2 = peCreateService.createContainerShape(containerShape, false);
Rectangle rect2 = gaService.createRectangle(containerShape2);
gaService.setLocationAndSize(rect2, 3, 31, 23, 48);
rect2.setBackground(manageColor(IColorConstant.BLUE));
Shape shape3 = peCreateService.createContainerShape(containerShape2, true);
Rectangle rect3 = gaService.createRectangle(shape3);
// rect3.setParentGraphicsAlgorithm(rect2); // SO!!!
gaService.setLocationAndSize(rect3, 1, 1, 20, 12);
rect3.setBackground(manageColor(IColorConstant.YELLOW));
it seems that the coordinates of rect3 are relative to rect2 if containerShape2 is active, but if if it's not, it's relative to rect (the grandparent shape). Is this correct, and expected behaviuor?
Further, if I uncomment the setParentGraphicsAlgorithm() line, I get a StackOverflowException (I guess this is a bug?)
[Updated on: Thu, 17 May 2012 15:48] Report message to a moderator
|
|
| | | |
Re: GraphicsAlgorithm coordinates: relative to....? [message #875970 is a reply to message #875122] |
Wed, 23 May 2012 16:33 |
Hernan Gonzalez Messages: 188 Registered: October 2010 Location: Buenos Aires, Argentina |
Senior Member |
|
|
Hmmm are you sure about the second one?
If think that that's not true if the ContainerShape is inactive.
Example:
ContainerShape1 (active) ===> GA: rectangle1 400x400
|
--> ContainerShape2 (inactive) ===> GA: rectangle2 200x200, pos: 100,100
| (in the middle of rectangle1 )
|
---> Shape3 (active) ===> GA: rectangle3 20x20, pos: 40,40
Is the position of Shape3 relative to the rectangle2 or rectangle1?
That's the point of my question. And the answer, unless I'm mistaken,
is that IF ContainerShape2 IS INACTIVE, it's relative to rectangle1
(hence, it's drawn outside rectangle2)
This would implies two things:
1 - the layout can change dramatically when toggling the active/inactive flag for a shape (which makes sense, but is not very intuitive - that's why I think the javadocs of setActive/getActive should make this clear)
2 - rectangle3 cannot be (in the Draw2D world) a children of rectangle2
Please correct me if I got something wrong.
Michael Wenz wrote on Tue, 22 May 2012 04:29Simple answer to both questions: yes
Michael
"Hernan Gonzalez" schrieb im Newsbeitrag
news:jp3n73$8ab$1@xxxxxxxxe.org...
Still some doubts remain.
- Does a ContainerShape, even if it's intended only to group Shapes,
requires always a GA ? (it seems it does)
- Is the GA of a ContainerShape a parent (in Draw2D terms) of the GA of the
children shapes?
|
|
| | | | |
Goto Forum:
Current Time: Tue Apr 23 09:20:06 GMT 2024
Powered by FUDForum. Page generated in 0.03799 seconds
|