Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Examples for Polyline/PolylineDecoration
Examples for Polyline/PolylineDecoration [message #6351] Fri, 31 May 2002 09:44 Go to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.de

Hi!

Where can I find examples for constructing, resizing and rotating
PolylineDecoration objects?

Cu, Gunnar
Re: Examples for Polyline/PolylineDecoration [message #6370 is a reply to message #6351] Fri, 31 May 2002 11:21 Go to previous messageGo to next message
Alex Selkov is currently offline Alex SelkovFriend
Messages: 73
Registered: July 2009
Member
Hmm. What kind of example you need? Everything is clear (at least for me) in
docs.

You can provide cunstructed PointList to created Polyline/Polygone
decoration using pd.setTemplate(yourPointList). Another useful methods are
setScale and setReferencePoint. I suggest to take Demo4 example and play
with it adding things one by one.

Looks strange that you want to rotate decorations. Can you explain what you
try to achieve?



"Gunnar Wagenknecht" <g.wagenknecht@intershop.de>
Re: Examples for Polyline/PolylineDecoration [message #6389 is a reply to message #6370] Fri, 31 May 2002 11:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.de

Hi!

"Alex Selkov" <as@empproject.com> schrieb im Newsbeitrag
news:ad7le2$330$1@rogue.oti.com...

> Looks strange that you want to rotate decorations. Can you explain what
you
> try to achieve?

First of all I'm looking for a quick guide on howto work with polylines. I
want to draw customized figures which are more complicated than the provided
once. In a second step, I want to rotate these figures in 90
Re: Examples for Polyline/PolylineDecoration [message #6407 is a reply to message #6389] Fri, 31 May 2002 12:30 Go to previous messageGo to next message
Alex Selkov is currently offline Alex SelkovFriend
Messages: 73
Registered: July 2009
Member
> Hi!
>
> "Alex Selkov" <as@empproject.com> schrieb im Newsbeitrag
> news:ad7le2$330$1@rogue.oti.com...
>
> > Looks strange that you want to rotate decorations. Can you explain what
> you
> > try to achieve?
>
> First of all I'm looking for a quick guide on howto work with polylines. I
> want to draw customized figures which are more complicated than the
provided
> once. In a second step, I want to rotate these figures in 90
Polylines ignored by FLowLayout? [message #6423 is a reply to message #6407] Fri, 31 May 2002 12:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.intershop.de

Hi!

Thanks for your information. I tried a poor sample but it's not working the
way I thought it would be. Look at the following source. I have a figure
with FlowLayout and add 2 polylines to it but the polylines aren't arranged
in FlowLayout. Both polylines are pushed into the first flow element. Any
ideas why?

-----------------------------------------

public static void main(String args[])
{
Shell shell = new Shell();
shell.open();
shell.setText("draw2d Figures");

LightweightSystem lws = new LightweightSystem(shell);

IFigure panel = new Figure();
panel.setLayoutManager( new FlowLayout(FlowLayout.HORIZONTAL) );

lws.setContents(panel);

Polyline polyline = new Polyline();
polyline.setStart(new Point( 5, 5));
polyline.addPoint(new Point( 5, 45));
polyline.addPoint(new Point( 45, 45));
polyline.addPoint(new Point( 45, 5));
panel.add(polyline);

Polyline polyline2 = new Polyline();
polyline2.setStart(new Point( 5, 5));
polyline2.addPoint(new Point( 45, 45));
panel.add(polyline2);

Display display = Display.getDefault();
while( !shell.isDisposed() )
{
if( !display.readAndDispatch() )
display.sleep();
}

}

-----------------------------------------

Cu, Gunnar
Re: Examples for Polyline/PolylineDecoration [message #6518 is a reply to message #6389] Thu, 30 May 2002 23:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

It sounds like you want a more general purpose Figure in which you can
define a Path (like in Java2D), and then a transformation.
PolygonDecoration is not meant for this, although it might work if you
re-implement primTranslate().

What are you trying to do? Maybe try using Graphics.drawPolyline(PointList)
from your own Figure class. Or create a class that manages mulitple
templates, a polyline/gon for each, and a transformation.

"Gunnar Wagenknecht" <g.wagenknecht@intershop.de> wrote in message
news:ad7mdq$3fi$1@rogue.oti.com...
> Hi!
>
> "Alex Selkov" <as@empproject.com> schrieb im Newsbeitrag
> news:ad7le2$330$1@rogue.oti.com...
>
> > Looks strange that you want to rotate decorations. Can you explain what
> you
> > try to achieve?
>
> First of all I'm looking for a quick guide on howto work with polylines. I
> want to draw customized figures which are more complicated than the
provided
> once. In a second step, I want to rotate these figures in 90
Re: Examples for Polyline/PolylineDecoration [message #6647 is a reply to message #6518] Sat, 01 June 2002 07:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.planet-wagenknecht.de

Hi!

"Randy Hudson" <none@ibm.com> schrieb im Newsbeitrag
news:ad832o$ah9$1@rogue.oti.com...
> It sounds like you want a more general purpose Figure in which you can
> define a Path (like in Java2D), and then a transformation.

I'm not sure, because this is a totaly new area for me. I haven't written
any Java2D code, yet. I started evaluating GEF and draw2d and now I want to
draw figures, which are just more than a rectangle or a ellipse. But later
these figures should be used in the GEF so the should be sizeable and
rotatable. I thought I could use Polylines to build these figures.

Cu, Gunnar
Re: Examples for Polyline/PolylineDecoration [message #6664 is a reply to message #6647] Sat, 01 June 2002 22:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

> "Randy Hudson" <none@ibm.com> schrieb im Newsbeitrag
> news:ad832o$ah9$1@rogue.oti.com...
> > It sounds like you want a more general purpose Figure in which you can
> > define a Path (like in Java2D), and then a transformation.
>
> I'm not sure, because this is a totaly new area for me. I haven't written
> any Java2D code, yet. I started evaluating GEF and draw2d and now I want
to
> draw figures, which are just more than a rectangle or a ellipse. But later
> these figures should be used in the GEF so the should be sizeable and
> rotatable. I thought I could use Polylines to build these figures.

It's a good point. You could probably fix our polygon is a subclass.
Notice that I didn't close your bug. We will look at supporting this, but
right now we are in code freeze just like Eclpise is.

> Cu, Gunnar
Re: Examples for Polyline/PolylineDecoration [message #6869 is a reply to message #6664] Sun, 02 June 2002 17:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: g.wagenknecht.planet-wagenknecht.de

Hi!

"Randy Hudson" <none@ibm.com> schrieb im Newsbeitrag
news:adbgur$gs1$1@rogue.oti.com...

> It's a good point. You could probably fix our polygon is a subclass.

You mean draw2d Polygon class has the same limits? I didn't try with this
class yet, but I will have a look at it next.

> Notice that I didn't close your bug. We will look at supporting this, but
> right now we are in code freeze just like Eclpise is.

Yes, but is there already a branch in CVS for 2.1 development? BTW, CVS
trees for GEF are still empty. I would like to see GEF/draw2d source in
Eclipse CVS.

Cu, Gunnar
Re: Examples for Polyline/PolylineDecoration [message #7719 is a reply to message #6869] Wed, 05 June 2002 07:55 Go to previous messageGo to next message
Bram Stieperaere is currently offline Bram StieperaereFriend
Messages: 15
Registered: July 2009
Junior Member
Hi,

I think this is the right thread to post my question.

I am making a simple draw2d demo app (no GEF) where I try to draw an UML
class diagram.
I have a Figure that represents a class (a rectanglefigure with labels in
it)
Now I want to add connections. I am using polylineconnection. I found out
what the use is of router and anchor (am using ChopboxAnchor).

Now I want to add several types of arrows, diamond shapes, multiplicty
indications (e.g. a \'*\' label) on both ends of the connection.
Is this what PolyLineDecoration is for, and how is it used?

I also noticed that routers can be \"chained\". In fact, if you call
route(),
it first looks for a next() router and first claas route on the next
router in the chain. As far as I can remember from the Decorator pattern
in GoF book, this type of chaining is related to Decorator.

Can someone explain how this fits together? some example code?

thx

Bram
Re: Examples for Polyline/PolylineDecoration [message #7781 is a reply to message #7719] Wed, 05 June 2002 12:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.ibm.com

> Now I want to add several types of arrows, diamond shapes, multiplicty
> indications (e.g. a \'*\' label) on both ends of the connection.
> Is this what PolyLineDecoration is for, and how is it used?
Yes

> I also noticed that routers can be \"chained\". In fact, if you call
> route(),
> it first looks for a next() router and first claas route on the next
> router in the chain. As far as I can remember from the Decorator pattern
> in GoF book, this type of chaining is related to Decorator.

The purpose of chaining routers is so that the first router can handle
conditions not avoided by the "next" router. For example, the next router
just applies manual bendpoints. But, the first router handles cases like 2
connections overlapping in exactly the same place, in which case it adds
*automatic* bends into the connection so the 2 overlapping connections can
be distinguished.
Re: Examples for Polyline/PolylineDecoration [message #7889 is a reply to message #7781] Wed, 05 June 2002 14:31 Go to previous message
Bram Stieperaere is currently offline Bram StieperaereFriend
Messages: 15
Registered: July 2009
Junior Member
> The purpose of chaining routers is so that the first router can handle
> conditions not avoided by the "next" router. For example, the next router
> just applies manual bendpoints. But, the first router handles cases like 2
> connections overlapping in exactly the same place, in which case it adds
> *automatic* bends into the connection so the 2 overlapping connections can
> be distinguished.

kewl.
so this could solve the problem I'm having now with multiple (overlapping)
connections between nodes

thanks!

Bram
Previous Topic:Overview doesn't work any more
Next Topic:ManhattanConnectionRouter example?
Goto Forum:
  


Current Time: Sat Aug 31 23:17:20 GMT 2024

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

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

Back to the top