Skip to main content



      Home
Home » Eclipse Projects » GEF » [draw2d] What are FreeformFigures ?
[draw2d] What are FreeformFigures ? [message #104199] Sat, 08 November 2003 11:43 Go to next message
Eclipse UserFriend
Originally posted by: rlemaigr.ulb.ac.be

Hello everybody,
I'm new here and I'm frenchspeaking so sorry if my english isn't perfect.

I'm trying to have a global understanding and view of draw2d before
beginning a project which will use it with GEF. I've seen some classes are
about FreeformFigures: freeformlayout, freeformlayer, freeformviewport,
freeformxxx...
I've tried to understand all that by reading the code but without succes...

I don't understand what all this is, neither what it is for.

To start with the beginning, in the description of FreeformFigure it is
said that a freeformfigure is "a figure that allows its children to extend
into negative coordinates.", it already makes me a little confused...:S

I really would appreciate a little help about all that if you have time
for it!

Thanks in advance,

régis
Re: [draw2d] What are FreeformFigures ? [message #104254 is a reply to message #104199] Sat, 08 November 2003 21:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

You should first start with using ScalableRootEditPart, instead of
FreeformRootEditPart. Then, you will realize what it is for.

Basically, a normal figure has a rectangular bounds, and it's children are
placed relative to that rectangle. A freeform figure let's its children get
placed anywhere, and later its bounds are calculated such that they include
all of their children's locations. So, if a child is at (-100, -100), then
the freeform figure's bounds will be sure to include that area. Try playing
with the Logic example for a better idea.

"r
Re: [draw2d] What are FreeformFigures ? [message #104274 is a reply to message #104254] Sun, 09 November 2003 05:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rlemaigr.ulb.ac.be

Thanks a lot.

I haven't already taken a look at GEF but I will.

> a normal figure has a rectangular bounds, and it's children are
placed relative to that rectangle.

The default behaviour of a Figure isn't its children to be placed using
absolute coordinates? The method useLocalCoordinates() return false by
default in the Figure class so I thought that the behaviour you describe
was not the normal behaviour. And the two classes I've looked at in draw2d
witch implement the FreeformFigure interface (FreeformLayer and
FreeformLayeredPane), don't override this method anyway.
That's why the sentence "a figure that allows its children to extend into
negative coordinates." made me confused.

> A freeform figure let's its children get
> placed anywhere, and later its bounds are calculated such that they include
> all of their children's locations.

I think I understand that. It's quite like a polyline : when I add a point
to a polyline, the bounds of the polyline are automaticaly modified to
include all the polyline. Okay. When I read the code of the polyline
class, it looked quite simple and the behaviour you describe is
implemented by just recalculate the bounds when needed by overriding the
getBounds method.
So why the code of the freeform classes looks so complicated?
I guess I missed something there...


Randy Hudson wrote:

> You should first start with using ScalableRootEditPart, instead of
> FreeformRootEditPart. Then, you will realize what it is for.

> Basically, a normal figure has a rectangular bounds, and it's children are
> placed relative to that rectangle. A freeform figure let's its children get
> placed anywhere, and later its bounds are calculated such that they include
> all of their children's locations. So, if a child is at (-100, -100), then
> the freeform figure's bounds will be sure to include that area. Try playing
> with the Logic example for a better idea.
Re: [draw2d] What are FreeformFigures ? [message #104290 is a reply to message #104274] Sun, 09 November 2003 09:58 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

> > a normal figure has a rectangular bounds, and it's children are
> placed relative to that rectangle.
>
> The default behaviour of a Figure isn't its children to be placed using
> absolute coordinates? The method useLocalCoordinates() return false by
> default in the Figure class so I thought that the behaviour you describe
> was not the normal behaviour. And the two classes I've looked at in draw2d
> witch implement the FreeformFigure interface (FreeformLayer and
> FreeformLayeredPane), don't override this method anyway.
> That's why the sentence "a figure that allows its children to extend into
> negative coordinates." made me confused

Even though default coordinates are absolute, if you call setBounds() on a
normal figure and move it, it will call translate() on its children so that
the children also move the same amount. Freeform figures don't do this.

FYI, XYLayout uses relative rectangle constraints to place children in
absolute coordinates.
..
> I think I understand that. It's quite like a polyline : when I add a point
> to a polyline, the bounds of the polyline are automaticaly modified to
> include all the polyline. Okay. When I read the code of the polyline
> class, it looked quite simple and the behaviour you describe is
> implemented by just recalculate the bounds when needed by overriding the
> getBounds method.
> So why the code of the freeform classes looks so complicated?
> I guess I missed something there...

Because the can be nested inside each other (layers and layered panes), and
because they must listen to and track their children to see when they move.
Previous Topic:Labels on Connections
Next Topic:architecture struggle with actions vs commands
Goto Forum:
  


Current Time: Tue Jul 22 08:41:23 EDT 2025

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

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

Back to the top