Labels with non rectangular borders [message #19147] |
Thu, 05 September 2002 10:11  |
Eclipse User |
|
|
|
Originally posted by: Hermann.Weindl.mind8.com.no.spam
We need labels with non rectangular borders (eg. trapezoid,
parallelogram, rounded rectangle, ...). Our first tries showed that we
cannot implement these as borders because there are (at least) two
problems. The background color of the label is painted outside the
labels shape using the bounding box and the connections (ChopboxAnchor)
are calculated using the bounding box of the label.
Therefore we think that it is necessary to implement the different
shapes as subclasses of Label which draw the border themselves. A
special implementation of ConnectionAnchor will cooperate with the
shapes to handle the calculation of the location point (getLocation()).
What do you think? Is this the right way to implement Labels with non
rectangular borders or is there a better approach?
--hermann
|
|
|
|
|
Re: Labels with non rectangular borders [message #19153 is a reply to message #19151] |
Thu, 05 September 2002 15:09   |
Eclipse User |
|
|
|
Originally posted by: hudsonr.spam.com
You need to either put a label figure inside of a shape like a trapezoid, or
somehow cause the Label's insets to change so sthat it knows where to place
the text. I would put a label inside the geometric shape (in a stack
layout), and then perhaps promote the "setText(String)" method to that outer
shape.
If your connection anchors work generically (for example, given a polygon
represented by a PointList), then maybe you would consider donating them to
the community ;-)?
"Hermann Weindl" <Hermann.Weindl@mind8.com.no.spam> wrote in message
news:3D77888D.2020507@mind8.com.no.spam...
> Randy Hudson wrote:
>
> > Do you need labels which wrap to multiple lines? We have released
> > word-wrapping figures to one of the test/example projects because
someone
> > said he wanted to help with the code.
> >
> > We have word-wrap, but not for the case where the available width of a
line
> > of text is a function of the height of the text. for example, a
trapezoid
> > that gets progressively narrower, would need to know the height of the
> > current line in order to answer the available width for a run of text.
>
>
> For now, there is no need to wrap lines.
>
>
> > Connection Anchors for such shapes do not exist yet either. Are you
going
> > to connect at varoius locations around the shape, or at specific
locations
> > like the top-center?
>
>
> Connections should be possible at various locations around the shape. As
> they do not exist yet we will implement this ourselves.
>
>
> What do you think: subclassing Label and drawing the shape, implementing
> a ConnectionAnchor which cooperates with the shape figures - is this a
> way to go?
>
> --hermann
>
|
|
|
|
|
Re: Labels with non rectangular borders [message #19162 is a reply to message #19159] |
Fri, 06 September 2002 10:40  |
Eclipse User |
|
|
|
Originally posted by: hudsonr.spam.com
What do you think about refactoring the current polyline class? It's
original purpose was to support drawling lines between nodes. In this use
case, a polyline is in the "absolute" coordinate system, and its bounds are
merely a by-product of its bendpoints. It is not meant to be treated like a
regular figure.
But, its subclass polygon is different. People want to treat polygon as a
box with a polygon inside it, and they want to be able to move the box
around like a shape. (Again, polygon's original use case was to draw
arrowheads at the ends of polyline, so it too is in absolute coordinate
system, with bounds being an afterthought).
Maybe there should be two separate implementations for each use case, with a
common superclass. (5 classes in total). In this case, the "boxed" polygon
would need a more sophisticated Transform class that would scale the polygon
to fill the box's bounds.
"Alex Selkov" <as@empproject.com> wrote in message
news:al8ovd$9hh$1@rogue.oti.com...
>
> "Alex Selkov" <as@empproject.com>
|
|
|
Powered by
FUDForum. Page generated in 0.07919 seconds