RE: [ROOT] Update on X3D and postscript

From: Faine, Valeri (fine@bnl.gov)
Date: Mon Mar 10 2003 - 17:54:55 MET


He Brett,

> Valeri Fine writes:
>  > One can select "Save" or "Save As" to save the X3D widget with some
>  > "pixel" format or select "Print". The later allow you to select
"Print
>  > to file" to get the postscript file. Anyway the postscript file
will
>  > contain the bunch of the pixels rather the vectors.
> 
> Does this use the QCanvas for the X3D drawing area?  If so then I
> think one can get vector postscript if the double buffering
> optimization is turned off during the print via
> QCanvas::setDoubleBuffering().

No it doesn't use any new implementation of 3D rendering.
It still use x3d code and x11 widget "as is" wrapped into Qt
QMainWidget.
(By this reason it works on X11 terminal only).
At this point the only thing the Qt layer can do is to grab the pixmap
from the X11 widget created by x3d and print it out or save.


           Hope this helps. Valeri


#ifndef QTROOT_TQtX3DWidget
#define QTROOT_TQtX3DWidget

////////////////////////////////////////////////////////////////////////
//
//
//
// TQtX3DWidget
//
//
//
// Qt Widget to control X3D X11 window (for example by TQtViewerX3D).
//
//
//
// It can be used to insert x3d view into any QWidget
//
// The X3D graphics goes into this widget.
//
// This class is used to enable input events on this graphics
//
// widget and forward the events to X3D.
//
//
//
////////////////////////////////////////////////////////////////////////
//

#ifndef __CINT__
#include "Rtypes.h" 
#include "qwidget.h" 

class TQtX3DWidget : public QWidget {
  Q_OBJECT   
  protected:   // data-members
     Long_t         fX3DWin;    // child x3d X11 widget

  protected:   // methods
     virtual void mouseReleaseEvent(QMouseEvent *ev);
     virtual void paintEvent ( QPaintEvent * );
     virtual void resizeEvent ( QResizeEvent * );

     virtual bool TQtX3DWidget::x11Event(XEvent *ev);

  public:
     TQtX3DWidget(Float_t *longitude, Float_t *latitude
                  , Float_t *psi,QWidget *p=0,Option_t *option=0);
    ~TQtX3DWidget();
  public slots:
     virtual int execCommand(int px, int py, char command);
  signals:
     void x3dPosition(float longitude_rad
                    , float latitude_rad, float psi_rad);
};
#endif
#endif


and the main job is provided as follows:

bool TQtX3DWidget::x11Event(XEvent *ev) {
  // Dispatch X11 event for the child x3d window
   if (!fX3DWin) return FALSE;
   bool res = TRUE;
   switch (ev->type ) {
      case  Expose:
         (*ev).xexpose.window = fX3DWin;
      case  KeyPress:
      case  ColormapNotify:
         x3d_dispatch_event(Long_t(ev));        
         break;
      case  MotionNotify:
         if ( (*ev).xmotion.state & Button1Mask ) { 
             x3d_dispatch_event(Long_t(ev));       
         } 
         break;
      case  ConfigureNotify:
         (*ev).xconfigure.window = fX3DWin;
         x3d_dispatch_event(Long_t(ev));        
         break;
      default:
         res = FALSE;
         break;
   };
   return res;
}


 VF

> 
> -Brett.



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET