How it works

The idea is to provide a pure ansi/iso c++ plot class (called PPlot). Of course no actual plotting can be done in c++. The connection to the graphical world (widgets) is done via an abstract class that you have to implement. The class is called Painter and asks you to implement things like
I have implemented the Painter class in QT (a nice c++ framework) and Zinc (an obscure API used in real time computing).  I followed the following strategy to turn a native widget into a pplot window:

class PPlotNativeWidget: public NativeWidget, public Painter
{
   // implement Painter interface

   virtual NativeDraw () { // this is the draw function of your OS, or portable framework
     mPPlot.Draw (*this); // this causes calls to Painter interface  (=drawing!)
   }

private:
   PPlot mPPlot;// no reason to inherit from PPlot,rather make it a member
};
You can fill your native widget with an example plot like this
PPlotNativeWidget *a =  new PPlotNativeWidget (x,y,w,h,...)
MakeExamplePlot (1, a->mPPlot); // fill it with one of the default plots


Pier
SourceForge Logo