[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

vector graphics library with pan and zoom

Patrick Doyle

8/14/2008 11:21:00 PM

Hello,
I'm not trying to open a debate about which GUI library is the best.
I would just like a pointer to a graphics library I can use to draw
some vector graphics (lines, arcs, circles, polygons, possibly filled
polygons, etc...) which would be presented to a Windows user in a
window which (s)he could pan and zoom in and out.

Does anybody know if such a beast exists?

If not, can anybody point me at the easiest way to get something close to that?

If not, can anybody point me at the easiest way to get any sort of
vector graphics drawn in a Windows window? (This is the part I cringe
at -- I'm _really_ not trying to ignite a holy war here.)

Thanks for any pointers...

--wpd

9 Answers

Joel VanderWerf

8/15/2008 3:10:00 AM

0

Patrick Doyle wrote:
> Hello,
> I'm not trying to open a debate about which GUI library is the best.
> I would just like a pointer to a graphics library I can use to draw
> some vector graphics (lines, arcs, circles, polygons, possibly filled
> polygons, etc...) which would be presented to a Windows user in a
> window which (s)he could pan and zoom in and out.
>
> Does anybody know if such a beast exists?
>
> If not, can anybody point me at the easiest way to get something close to that?
>
> If not, can anybody point me at the easiest way to get any sort of
> vector graphics drawn in a Windows window? (This is the part I cringe
> at -- I'm _really_ not trying to ignite a holy war here.)
>
> Thanks for any pointers...
>
> --wpd

TkCanvas is very good for that.

You can use it as a library, but what I've found useful recently is to
isolate the vector drawing and user interaction (select, drag, drop,
pan, zoom) in a separate process. This permits using it from simulink,
for example.

http://path.berkeley.edu/~vjoel...

There's a protocol for talking to tkar, documented in the above.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Patrick Doyle

8/15/2008 12:01:00 PM

0

Thanks.
I'll take a look at that.

It's funny you should mention simulink -- I meant to add to my
original post that I was hoping to find something that provided
similar capabilities (zoom, aspect ratio control, and auto scale, in
particular) as are provided by the plotting capabilities of MATLAB.

Basically, I would like to plot some shapes I've drawn in a Ruby
program and to be able to zoom in and out to see more or less detail.
My current "simplest, because I know exactly how to do it, but
stupidly complex" plan is to dump the data to a file which I would
read and plot from a MATLAB script.

I'm hoping to find a more elegant solution than that, and to add that
capability to my bag o' tricks.

I'll try talking to your Tkar process. I don't need the animation
capabilities you provide, but if I can draw my lines, arcs, and
polygons, and I can zoom in and out of the drawn figure, then I can
check this box off and move on to the next problem.

--wpd

Axel Etzold

8/15/2008 3:45:00 PM

0


-------- Original-Nachricht --------
> Datum: Fri, 15 Aug 2008 21:01:02 +0900
> Von: "Patrick Doyle" <wpdster@gmail.com>
> An: ruby-talk@ruby-lang.org
> Betreff: Re: vector graphics library with pan and zoom

> Thanks.
> I'll take a look at that.
>
> It's funny you should mention simulink -- I meant to add to my
> original post that I was hoping to find something that provided
> similar capabilities (zoom, aspect ratio control, and auto scale, in
> particular) as are provided by the plotting capabilities of MATLAB.
>
> Basically, I would like to plot some shapes I've drawn in a Ruby
> program and to be able to zoom in and out to see more or less detail.
> My current "simplest, because I know exactly how to do it, but
> stupidly complex" plan is to dump the data to a file which I would
> read and plot from a MATLAB script.
>
> I'm hoping to find a more elegant solution than that, and to add that
> capability to my bag o' tricks.
>
> I'll try talking to your Tkar process. I don't need the animation
> capabilities you provide, but if I can draw my lines, arcs, and
> polygons, and I can zoom in and out of the drawn figure, then I can
> check this box off and move on to the next problem.
>
> --wpd

Dear Patrick,

scalable vector graphics can be created using the Processing language :

http://proce...

There are Ruby bindings for it by _why:

http://the-shoebox.o...

Also, you might like RMagick:

http://rmagick.rubyforge.org/portf...

Best regards,

Axel


--
GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen!
Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_...

Patrick Doyle

8/15/2008 3:54:00 PM

0

> Dear Patrick,
>
> scalable vector graphics can be created using the Processing language :
>
> http://proce...
>
> There are Ruby bindings for it by _why:
>
> http://the-shoebox.o...
Thank you. I'll take a look at that.

>
> Also, you might like RMagick:
>
> http://rmagick.rubyforge.org/portf...
Unfortunately, it appears that RMagick doesn't appear to be able to
display on a Windows platform. (I could generate the .gif file in the
example fine, but it seemed like it really wanted to talk to an X
server to display something on the screen.)

--wpd

Axel Etzold

8/15/2008 9:54:00 PM

0



> >
> > Also, you might like RMagick:
> >
> > http://rmagick.rubyforge.org/portf...
> Unfortunately, it appears that RMagick doesn't appear to be able to
> display on a Windows platform. (I could generate the .gif file in the
> example fine, but it seemed like it really wanted to talk to an X
> server to display something on the screen.)
>
> --wpd

Dear Patrick,

you're right. Tim Hunter, the developer of RMagick, says so somewhere....
I'm using Linux mostly, so I tend to forget about Windows specificities. However, you might be able
to combine a gif created by RMagick with a display software on Windows,
even though that's less elegant ...


Best regards,

Axel

--
Psssst! Schon das coole Video vom GMX MultiMessenger gesehen?
Der Eine für Alle: http://www.gmx.net/de/go/m...

Axel Etzold

8/15/2008 10:00:00 PM

0


-------- Original-Nachricht --------
> Datum: Sat, 16 Aug 2008 06:54:15 +0900
> Von: "Axel Etzold" <AEtzold@gmx.de>
> An: ruby-talk@ruby-lang.org
> Betreff: Re: vector graphics library with pan and zoom

>
>
> > >
> > > Also, you might like RMagick:
> > >
> > > http://rmagick.rubyforge.org/portf...
> > Unfortunately, it appears that RMagick doesn't appear to be able to
> > display on a Windows platform. (I could generate the .gif file in the
> > example fine, but it seemed like it really wanted to talk to an X
> > server to display something on the screen.)
> >
> > --wpd
>
> Dear Patrick,
>
> you're right. Tim Hunter, the developer of RMagick, says so somewhere....
> I'm using Linux mostly, so I tend to forget about Windows specificities.
> However, you might be able
> to combine a gif created by RMagick with a display software on Windows,
> even though that's less elegant ...
>

This could be a solution that works on Windows together with RMagick:

http://cairogra...
http://cairogra...rcairo/

Best regards,

Axel
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/...

Joel VanderWerf

8/17/2008 10:27:00 PM

0

Patrick Doyle wrote:
> It's funny you should mention simulink -- I meant to add to my
> original post that I was hoping to find something that provided
> similar capabilities (zoom, aspect ratio control, and auto scale, in
> particular) as are provided by the plotting capabilities of MATLAB.

I've never tried using it directly from MATLAB, as opposed to simulink.
The simulink dir (http://path.berkeley.edu/~vjoel/vis/tkar...)
contains a zip of the files that build the simulink block, including
tkar.c which starts the external process and translates simulink port
data to winsock socket comm. (Yeah, windows--this was used as part of a
project for general motors, which is slowly discovering linux). This
file builds with the MATLAB mex compiler, and it might be a starting
point to adapt it as a matlab extension.

--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

Patrick Doyle

8/18/2008 1:47:00 AM

0

Hi Joel,
Thanks for the tip. However, I'm not planning on interfacing Tkar to
MATLAB, I just mentioned MATLAB because I am quite enamoured of the
visualization capabilities provided by the "plot" command in MATLAB,
and was hoping to find something of a similar nature I could access
from a Ruby script. Thus far, I have found (or, more accurately, been
shown -- by you) Tkar, which provides the pan and zoom capability I
desire. I have also found rgplot, which provides an interface to
gnuplot.

For the ridiculously large amount of data I want to plot, I have found
TKar to be too slow for my needs (taking 20 minutes to plot a single
data set). gnuplot can handle that amount of data easily, but the
pipe between ruby and gnuplot seems to overflow as the data are
written. (I found a description very similar to the problem I have
observed on an Octave mailing list. Unfortunately, I have misplaced
that page at the moment).

So, right now I am looking at 4 options:
1) Read through your Tkar code enough to extract out the code that
plots lines and arcs on a zoomable, pan-able canvas and integrate that
with my code.

2) Find that darn web page again, verify that Ruby has the same issue
as Octave and, hopefully, can be fixed by the same patch proposed, and
submit a patch against Ruby to fix that.

3) Give up on plotting altogether.

4) Dump my data to a file readable and plottable by MATLAB and use
MATLAB to visualize my data.

--wpd

Charles Oliver Nutter

8/18/2008 4:33:00 AM

0

Patrick Doyle wrote:
> Hello,
> I'm not trying to open a debate about which GUI library is the best.
> I would just like a pointer to a graphics library I can use to draw
> some vector graphics (lines, arcs, circles, polygons, possibly filled
> polygons, etc...) which would be presented to a Windows user in a
> window which (s)he could pan and zoom in and out.
>
> Does anybody know if such a beast exists?
>
> If not, can anybody point me at the easiest way to get something close to that?
>
> If not, can anybody point me at the easiest way to get any sort of
> vector graphics drawn in a Windows window? (This is the part I cringe
> at -- I'm _really_ not trying to ignite a holy war here.)

Batik in JRuby?

- Charlie