Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Making Polyline a "normal" figure
Making Polyline a "normal" figure [message #215624] Fri, 05 May 2006 16:04 Go to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello!
Currently org.eclipse.draw2d.Polyline figure calculate it's bounds based
on points variable. This behavior make it impossible to layout this figure
by any layout manager. AFAIU, this was done intentionally to make it easy to
visualize connections with this figure
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=27227,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=18431). In the same time there
is a "PolylineConnection" figure which is used for this purposes AFAIU. Can
we move the functionality which calculates bounds of the polyline figure
into PolylineConnection figure and make Polyline just a normal figure which
could be layouted and contains _relative_ positions of the points in it?

--
Alex Shatalin
Re: Making Polyline a "normal" figure [message #215649 is a reply to message #215624] Sat, 06 May 2006 01:24 Go to previous messageGo to next message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
I think this is reasonable. However, a workaround would be to subclass the
Polyline figure and override the primTranslate to have the base Figure
functionality.

-Steve

"Alex Shatalin" <vano@borland.com> wrote in message
news:e3ft1j$384$1@utils.eclipse.org...
> Hello!
> Currently org.eclipse.draw2d.Polyline figure calculate it's bounds
based
> on points variable. This behavior make it impossible to layout this figure
> by any layout manager. AFAIU, this was done intentionally to make it easy
to
> visualize connections with this figure
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=27227,
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=18431). In the same time
there
> is a "PolylineConnection" figure which is used for this purposes AFAIU.
Can
> we move the functionality which calculates bounds of the polyline figure
> into PolylineConnection figure and make Polyline just a normal figure
which
> could be layouted and contains _relative_ positions of the points in it?
>
> --
> Alex Shatalin
>
>
Re: Making Polyline a "normal" figure [message #215681 is a reply to message #215624] Mon, 08 May 2006 17:10 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"Alex Shatalin" <vano@borland.com> wrote in message
news:e3ft1j$384$1@utils.eclipse.org...
> Hello!
> Currently org.eclipse.draw2d.Polyline figure calculate it's bounds
> based on points variable. This behavior make it impossible to layout this
> figure

Right, the bounds are a function of the Points. How could setting the bounds
have any effect if this contract were maintained?

> by any layout manager. AFAIU, this was done intentionally to make it easy
> to visualize connections with this figure
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=27227,
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=18431). In the same time
> there is a "PolylineConnection" figure which is used for this purposes
> AFAIU. Can we move the functionality which calculates bounds of the
> polyline figure into PolylineConnection figure and make Polyline just a
> normal figure which

Polygon is also relying on this behavior.

> could be layouted and contains _relative_ positions of the points in it?

What you are describing should just be a totally different figure. For lack
of a better unused name, you want a rectangular "label" which displays a
line instead of a string/icon.

>
> --
> Alex Shatalin
>
Re: Making Polyline a "normal" figure [message #215716 is a reply to message #215649] Tue, 09 May 2006 11:14 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello!
>I think this is reasonable. However, a workaround would be to subclass the
> Polyline figure and override the primTranslate to have the base Figure
> functionality.
Actually, this request covers only a part of my original question. In
general I'd like (as a part of GMF WYSIWYG editor) to let user to define
"standalone" polyline/polygon figures, i.e. polylines/polygons which could
be located inside parent figure in accordance with the specified layout
manager + layout constraints. For this task it sounds reasonable to make
polyline/polygon holding own preferred size, store all the points in "local"
coordinates - actual coordinates of the figure - and set bounds using normal
layout manager.
Definetely, I can override all the necessary methods of polyline/polygon
but it will be at least:
- outlineShape (translate the graphics before painting the figure to make
points coordinated relative to the figure bounds)
- primTranslate()
- getBounds()/setBounds() to allow layouting this figure
So, my Idea was to create special figures extended from polyline/polygon
which will support current behavior of the polyline/polygon and stay with
standard implementation of primTranslate/getBounds/setBounds methods for
super-classes.

--
Alex Shatalin
Re: Making Polyline a "normal" figure [message #215733 is a reply to message #215681] Tue, 09 May 2006 11:41 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello!
> Right, the bounds are a function of the Points. How could setting the
> bounds have any effect if this contract were maintained?
I'm just suggesting to change this contract and specify relative
coordinates of the points (coordinates inside polyline/polygon figure) and
create subclass (e.g. PolylineConnnection) to support current behavior.

> Polygon is also relying on this behavior.
What about making the same subclass for polygon?

> What you are describing should just be a totally different figure. For
> lack
Yes, I agree. This figure is similar to the current polyline/polygon,
but holds relative coordinates of the points. Imagine, that you are going to
create complex GEF figure with a polyline in it - in this case it sounds
natural to layout this figure in a same way as the rest of the figures.

> of a better unused name, you want a rectangular "label" which displays a
> line instead of a string/icon.
Not a line, but a connected lines (exactly like current implementation
of polyline do ;-)). I'd say that currently existing polyline is
implementing the behavior which I'm looking for and in addition perform some
bounds translation. AFAIU these translations are important for drawing the
connections. Probably this is not the only place where this functionality is
important, but I'm not so deeply know GEF to highlight them.
I suggest to separate these two parts of functionality into two classes
say, PolylineFigure and Polyline extending this PolylineFigure and
overriding all the required methods. Definitely, I have two other options:

1. Create my own figure which will extend current Polyline and override all
the methods which was overridden in Polyline with the code taken from
Figure, but this code will be duplicated..
2. Create my own figure which will extend Figure directly and draw the
polyline in it and duplicate the code from current Polyline figure ;-)

What I'm talking about is introduction of additional Polyline/Polygon
figures into the GEF which will be layouted exactly like normal figures.

--
Alex Shatalin
Re: Making Polyline a "normal" figure [message #215750 is a reply to message #215733] Tue, 09 May 2006 13:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

What do you want this figure to do if the bounds are set in a way that it
isn't large enough to display the polyline? Should it ignore the
width/height? Should it scale the polyline?

"Alex Shatalin" <vano@borland.com> wrote in message
news:e3pv4o$3fi$1@utils.eclipse.org...
> Hello!
>> Right, the bounds are a function of the Points. How could setting the
>> bounds have any effect if this contract were maintained?
> I'm just suggesting to change this contract and specify relative
> coordinates of the points (coordinates inside polyline/polygon figure) and
> create subclass (e.g. PolylineConnnection) to support current behavior.
>
>> Polygon is also relying on this behavior.
> What about making the same subclass for polygon?
>
>> What you are describing should just be a totally different figure. For
>> lack
> Yes, I agree. This figure is similar to the current polyline/polygon,
> but holds relative coordinates of the points. Imagine, that you are going
> to create complex GEF figure with a polyline in it - in this case it
> sounds natural to layout this figure in a same way as the rest of the
> figures.
>
>> of a better unused name, you want a rectangular "label" which displays a
>> line instead of a string/icon.
> Not a line, but a connected lines (exactly like current implementation
> of polyline do ;-)). I'd say that currently existing polyline is
> implementing the behavior which I'm looking for and in addition perform
> some bounds translation. AFAIU these translations are important for
> drawing the connections. Probably this is not the only place where this
> functionality is important, but I'm not so deeply know GEF to highlight
> them.
> I suggest to separate these two parts of functionality into two classes
> say, PolylineFigure and Polyline extending this PolylineFigure and
> overriding all the required methods. Definitely, I have two other options:
>
> 1. Create my own figure which will extend current Polyline and override
> all the methods which was overridden in Polyline with the code taken from
> Figure, but this code will be duplicated..
> 2. Create my own figure which will extend Figure directly and draw the
> polyline in it and duplicate the code from current Polyline figure ;-)
>
> What I'm talking about is introduction of additional Polyline/Polygon
> figures into the GEF which will be layouted exactly like normal figures.
>
> --
> Alex Shatalin
>
Re: Making Polyline a "normal" figure [message #215758 is a reply to message #215750] Tue, 09 May 2006 14:05 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hi!
> What do you want this figure to do if the bounds are set in a way that it
> isn't large enough to display the polyline? Should it ignore the
> width/height? Should it scale the polyline?
I think, it should be figure with minimum size and in the situation then
bounds of the figure was set incorrectly (less then minimum size) this
figure could be drawn in any way. For example, the same way as ImageFigure
do - just draw it and don't worry about surrounding figures. BTW, why
ImageFigure do not use MinimumSize property?

--
Alex Shatalin
Re: Making Polyline a "normal" figure [message #220464 is a reply to message #215716] Mon, 31 July 2006 14:08 Go to previous message
Sebastián Gurin is currently offline Sebastián GurinFriend
Messages: 43
Registered: July 2009
Member
Has anybody done this?
If so, where can I find a Polygon class that can be "layouted"?

Thanks

On Tue, 9 May 2006 13:14:42 +0200
"Alex Shatalin" <vano@borland.com> wrote:

> Hello!
> >I think this is reasonable. However, a workaround would be to subclass the
> > Polyline figure and override the primTranslate to have the base Figure
> > functionality.
> Actually, this request covers only a part of my original question. In
> general I'd like (as a part of GMF WYSIWYG editor) to let user to define
> "standalone" polyline/polygon figures, i.e. polylines/polygons which could
> be located inside parent figure in accordance with the specified layout
> manager + layout constraints. For this task it sounds reasonable to make
> polyline/polygon holding own preferred size, store all the points in "local"
> coordinates - actual coordinates of the figure - and set bounds using normal
> layout manager.
> Definetely, I can override all the necessary methods of polyline/polygon
> but it will be at least:
> - outlineShape (translate the graphics before painting the figure to make
> points coordinated relative to the figure bounds)
> - primTranslate()
> - getBounds()/setBounds() to allow layouting this figure
> So, my Idea was to create special figures extended from polyline/polygon
> which will support current behavior of the polyline/polygon and stay with
> standard implementation of primTranslate/getBounds/setBounds methods for
> super-classes.
>
> --
> Alex Shatalin
>
>
Previous Topic:is there an update site
Next Topic:ScrollPane scrollbar placement
Goto Forum:
  


Current Time: Wed Apr 24 17:46:06 GMT 2024

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

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

Back to the top