Making Polyline a "normal" figure [message #215624] |
Fri, 05 May 2006 12:04  |
Eclipse User |
|
|
|
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 #215733 is a reply to message #215681] |
Tue, 09 May 2006 07:41   |
Eclipse User |
|
|
|
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 09:11   |
Eclipse User |
|
|
|
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 #220464 is a reply to message #215716] |
Mon, 31 July 2006 10:08  |
Eclipse User |
|
|
|
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
>
>
|
|
|
Powered by
FUDForum. Page generated in 2.30911 seconds