Skip to main content



      Home
Home » Eclipse Projects » GEF » Draw curve in GEF
Draw curve in GEF [message #20150] Mon, 23 September 2002 20:08 Go to next message
Eclipse UserFriend
Hi,

Does GEF support curve drawing like the way in MS Word? in other word, user
clicks 3 points on the sreen, it will draw a smooth curve?

Thanks.
Sam
Re: Draw curve in GEF [message #20153 is a reply to message #20150] Mon, 23 September 2002 21:15 Go to previous messageGo to next message
Eclipse UserFriend
Check out org.eclipse.draw2d.SWTGraphics.drawArc(...) which basically just calls
org.eclipse.swt.graphics.GC.drawArc(...).

Eric

"Sam Cheung" <scheung@novarra.com> wrote in message
news:amo9bl$7i6$1@rogue.oti.com...
> Hi,
>
> Does GEF support curve drawing like the way in MS Word? in other word, user
> clicks 3 points on the sreen, it will draw a smooth curve?
>
> Thanks.
> Sam
>
>
>
Re: Draw curve in GEF [message #20156 is a reply to message #20150] Mon, 23 September 2002 22:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hudsonr.us.eye-bee-em.com

We don't have a ConnectionRouter for this. SWT does not support control
points, so you would have to approximate the curve with a polyline. There
are well-known algorithms for generating approximations with a given
"flatness". You could probably find something in AWT geometry packages to
do this. Look at GeneralPath, Shape, and Stroke.

If you find something useful or write your own curve-to-polyline converter,
feel free to share ;-)

"Sam Cheung" <scheung@novarra.com> wrote in message
news:amo9bl$7i6$1@rogue.oti.com...
> Hi,
>
> Does GEF support curve drawing like the way in MS Word? in other word,
user
> clicks 3 points on the sreen, it will draw a smooth curve?
>
> Thanks.
> Sam
>
>
>
Re: Draw curve in GEF [message #20165 is a reply to message #20156] Mon, 23 September 2002 22:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hudsonr.us.eye-bee-em.com

See AWT's CubicCurve2D#getPathIterator.
See GEF's StrokePointList class for an example using the iterator.

BTW, GEF uses this to produce an outline around a connection (for
representing focus). To see focus on a connection, select one of its nodes
and press Control+'/'


"Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
news:amogao$afd$1@rogue.oti.com...
> We don't have a ConnectionRouter for this. SWT does not support control
> points, so you would have to approximate the curve with a polyline. There
> are well-known algorithms for generating approximations with a given
> "flatness". You could probably find something in AWT geometry packages to
> do this. Look at GeneralPath, Shape, and Stroke.
>
> If you find something useful or write your own curve-to-polyline
converter,
> feel free to share ;-)
>
> "Sam Cheung" <scheung@novarra.com> wrote in message
> news:amo9bl$7i6$1@rogue.oti.com...
> > Hi,
> >
> > Does GEF support curve drawing like the way in MS Word? in other word,
> user
> > clicks 3 points on the sreen, it will draw a smooth curve?
> >
> > Thanks.
> > Sam
> >
> >
> >
>
>
Re: Draw curve in GEF [message #20292 is a reply to message #20165] Tue, 24 September 2002 11:36 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for your response.

But in MS Word, when you are drawing a curve, after you first the first 2
points, it shows you the curve dynamically as you move the mouse, and when
you click the 3rd point, it draws that curve. And you can continue by
clicking the 4th, 5th times... or you finish the curve drawing by double
clicking.

In others words, I need more than just a curve-to-polyline converter, right?
I need to capture mouse click and mouse move eveents and draw the curve
dynamically. Correct?

Thanks.

"Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
news:amoh9m$asd$1@rogue.oti.com...
> See AWT's CubicCurve2D#getPathIterator.
> See GEF's StrokePointList class for an example using the iterator.
>
> BTW, GEF uses this to produce an outline around a connection (for
> representing focus). To see focus on a connection, select one of its
nodes
> and press Control+'/'
>
>
> "Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
> news:amogao$afd$1@rogue.oti.com...
> > We don't have a ConnectionRouter for this. SWT does not support control
> > points, so you would have to approximate the curve with a polyline.
There
> > are well-known algorithms for generating approximations with a given
> > "flatness". You could probably find something in AWT geometry packages
to
> > do this. Look at GeneralPath, Shape, and Stroke.
> >
> > If you find something useful or write your own curve-to-polyline
> converter,
> > feel free to share ;-)
> >
> > "Sam Cheung" <scheung@novarra.com> wrote in message
> > news:amo9bl$7i6$1@rogue.oti.com...
> > > Hi,
> > >
> > > Does GEF support curve drawing like the way in MS Word? in other
word,
> > user
> > > clicks 3 points on the sreen, it will draw a smooth curve?
> > >
> > > Thanks.
> > > Sam
> > >
> > >
> > >
> >
> >
>
>
Re: Draw curve in GEF [message #20308 is a reply to message #20292] Tue, 24 September 2002 13:08 Go to previous message
Eclipse UserFriend
Originally posted by: hudsonr.us.eye-bee-em.com

Yes, you need a new ConnectionCreationTool subclass, or similar. It will
probably need some new states and some new handling of mouse Pressed.
And you'll need to generate the feedback somehow during the clicks. This is
done now by asking the source node to show feedback, but the tool can manage
this as well.


"Sam Cheung" <scheung@novarra.com> wrote in message
news:ampvnm$3ot$1@rogue.oti.com...
> Thanks for your response.
>
> But in MS Word, when you are drawing a curve, after you first the first 2
> points, it shows you the curve dynamically as you move the mouse, and when
> you click the 3rd point, it draws that curve. And you can continue by
> clicking the 4th, 5th times... or you finish the curve drawing by double
> clicking.
>
> In others words, I need more than just a curve-to-polyline converter,
right?
> I need to capture mouse click and mouse move eveents and draw the curve
> dynamically. Correct?
>
> Thanks.
>
> "Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
> news:amoh9m$asd$1@rogue.oti.com...
> > See AWT's CubicCurve2D#getPathIterator.
> > See GEF's StrokePointList class for an example using the iterator.
> >
> > BTW, GEF uses this to produce an outline around a connection (for
> > representing focus). To see focus on a connection, select one of its
> nodes
> > and press Control+'/'
> >
> >
> > "Randy Hudson" <hudsonr@us.eye-bee-em.com> wrote in message
> > news:amogao$afd$1@rogue.oti.com...
> > > We don't have a ConnectionRouter for this. SWT does not support
control
> > > points, so you would have to approximate the curve with a polyline.
> There
> > > are well-known algorithms for generating approximations with a given
> > > "flatness". You could probably find something in AWT geometry
packages
> to
> > > do this. Look at GeneralPath, Shape, and Stroke.
> > >
> > > If you find something useful or write your own curve-to-polyline
> > converter,
> > > feel free to share ;-)
> > >
> > > "Sam Cheung" <scheung@novarra.com> wrote in message
> > > news:amo9bl$7i6$1@rogue.oti.com...
> > > > Hi,
> > > >
> > > > Does GEF support curve drawing like the way in MS Word? in other
> word,
> > > user
> > > > clicks 3 points on the sreen, it will draw a smooth curve?
> > > >
> > > > Thanks.
> > > > Sam
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
Previous Topic:How to attach a moveble label to a connection
Next Topic:Questions about Logic Editor Example in GEF
Goto Forum:
  


Current Time: Wed Jun 04 11:32:19 EDT 2025

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

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

Back to the top