From graphics-request at octave dot org Mon Feb 13 08:33:24 2006 Subject: Re: Handle graphics plotting functions From: Sebastien Loisel To: Ole Jacob Hagen Cc: Shai Ayal , octave-graphics , octave maintainers mailing list Date: Mon, 13 Feb 2006 04:32:59 -0600 ------=_Part_24619_1422871.1139826685415 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Ok, I just spent half an hour giving careful thought to Shay's private emai= l and writing an answer, and now you have another great proposition. I don't understand what this "props" is in relation to oplot and the underlying C++ GUI? It's the C++ GUI part? Does it support 3d data with OpenGL efficiently? What I really like is that you've apparently started on adding buttons to the plot, which was far off in my application in my mind. If this is what you've done, I would really like to foist the plotting widget onto you! Do you want to look at QT4 and implement a stripped-down pure-QT4 plotting widget with your props? I want to use this in MinGW so it really has to be clean portable non-linux QT4 code. No calling "gettimeofday" or any other unix OS calls. This is currently how my brain-dead plotting widget (you can see it in the screenshot) works, so let me tell you how I got mine to work. First off, the .oct file doesn't actually contain any GUI code. The .oct file just parses its octave_value inputs and groks it, then it calls anothe= r function, which is not in the .oct file. Like so: =3D=3D=3D=3D=3D=3D=3D=3DFILE internal_my_plot.cpp=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D #include #include #include using namespace std; void makeplot(int, const Cell &); DEFUN_DLD(internal_my_plot, args, , "Make a plot (internal function -- do not call!)") { if(args.length()!=3D2 || !args(0).is_real_scalar() || !args(1).is_cell()) { error("internal_my_plot: internal error-- bad arguments."); cout<I don't understand what this "props" is in relation to oplot and= the underlying C++ GUI? It's the C++ GUI part? Does it support 3d data wit= h OpenGL efficiently? What I really like is that you've apparently started = on adding buttons to the plot, which was far off in my application in my mi= nd.

If this is what you've done, I would really like to foist the plott= ing widget onto you! Do you want to look at QT4 and implement a stripped-do= wn pure-QT4 plotting widget with your props? I want to use this in MinGW so= it really has to be clean portable non-linux QT4 code. No calling "ge= ttimeofday" or any other unix OS calls.

This is currently how my brain-dead plotting widget (you can see it= in the screenshot) works, so let me tell you how I got mine to work.
First off, the .oct file doesn't actually contain any GUI code. The .oct = file just parses its octave_value inputs and groks it, then it calls anothe= r function, which is not in the .oct file. Like so:

=3D=3D=3D=3D=3D=3D=3D=3DFILE internal_my_plot.cpp=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D
#include <octave/oct.h>
#include <octave/Cel= l.h>
#include <iostream>
using namespace std;
void makepl= ot(int, const Cell &);


DEFUN_DLD(internal_my_plot, args, ,
     &n= bsp;    "Make a plot (internal function -- do not call!= )")
{
  if(args.length()!=3D2 || !args(0).is_real_scalar() = || !args(1).is_cell())
    {
    &= nbsp; error("internal_my_plot: internal error-- bad arguments.");
      cout<<args.length()<<" = "<<args(0).is_real_scalar()<<" "<<args(1).= is_cell()<<endl;
      return octave_valu= e();
    }
  int id=3Dargs(0).int_value();
  makeplot(id,args(1).cell_value());
  return octave_value= ();
}
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

The makeplot() f= unction is already linked to the mygui program, which embeds octave. When I= compile internal_my_plot.cpp, I use mkoctfile and I don't tell it anything= about QT (if you see above, it doesn't have any QT includes or anything). = This makes it easier to build the oct file.

To get your own working, you would take mygui-0.2.tar.gz, add some = .cpp and .h files to the mygui.pro file li= ke this

HEADERS +=3D props.h
SOURCES +=3D props.cpp

and th= en you would add whatever .oct files you want to build (on line 30 or so). = For instance, if you have props_oct1.cpp and props_oct2.cpp, you would do

OCT0 +=3D props_oct1 props_oct2

(notice there is no extensio= n!)

If you want to know how such a QT4/OpenGL widget is implemented,= check out plotter.h and plotter.cpp, total 169 lines of code:

$ wc = -l=20 plotter.h plotter.cpp
  58 plotter.h
 111 plotter.cpp
&n= bsp;169 total

That's a complete implementation.

How much time= do you need to get this working?

S=E9bastien Loisel

------=_Part_24619_1422871.1139826685415--