The Gnome Chemistry Utils  0.12.13
Public Member Functions | Protected Attributes | List of all members
gcu::GLView Class Reference

#include <gcu/glview.h>

Inheritance diagram for gcu::GLView:
gcu::Printable gcu::DialogOwner gcu::CrystalView

Public Member Functions

 GLView (GLDocument *pDoc) throw (std::runtime_error)
 Constructor.
virtual ~GLView ()
 Destructor.
GtkWidget * GetWidget ()
void Init ()
void Reshape (int width, int height)
void Draw ()
bool OnPressed (GdkEventButton *event)
bool OnMotion (GdkEventMotion *event)
void Update ()
void SetRotation (double psi, double theta, double phi)
void SaveAsImage (std::string const &filename, char const *type, std::map< std::string, std::string > &options, unsigned width, unsigned height) const
GdkPixbuf * BuildPixbuf (unsigned width, unsigned height) const
void DoPrint (GtkPrintOperation *print, GtkPrintContext *context, int page) const
GtkWindow * GetGtkWindow ()
void RenderToCairo (cairo_t *cr, unsigned width, unsigned height) const
void SetAngle (double val)
double GetAngle (void) const
double & GetRefAngle (void)
void SetPsi (double val)
double GetPsi (void) const
double & GetRefPsi (void)
void SetPhi (double val)
double GetPhi (void) const
double & GetRefPhi (void)
void SetTheta (double val)
double GetTheta (void) const
double & GetRefTheta (void)
void SetRed (float val)
float GetRed (void) const
float & GetRefRed (void)
void SetGreen (float val)
float GetGreen (void) const
float & GetRefGreen (void)
void SetBlue (float val)
float GetBlue (void) const
float & GetRefBlue (void)
void SetAlpha (float val)
float GetAlpha (void) const
float & GetRefAlpha (void)
GLDocumentGetDoc (void)
double GetRadius (void)
- Public Member Functions inherited from gcu::Printable
 Printable ()
virtual ~Printable ()
virtual bool SupportsHeaders ()
virtual bool SupportMultiplePages ()
virtual int GetPagesNumber ()
void Print (bool preview)
void SetPageSetup (GtkPageSetup *PageSetup)
GtkPrintSettings * GetPrintSettings (void) const
void SetUnit (GtkUnit val)
GtkUnit GetUnit (void) const
GtkUnit & GetRefUnit (void)
void SetHeaderHeight (double val)
double GetHeaderHeight (void) const
double & GetRefHeaderHeight (void)
void SetFooterHeight (double val)
double GetFooterHeight (void) const
double & GetRefFooterHeight (void)
void SetHorizCentered (bool val)
bool GetHorizCentered (void) const
bool & GetRefHorizCentered (void)
void SetVertCentered (bool val)
bool GetVertCentered (void) const
bool & GetRefVertCentered (void)
void SetScaleType (PrintScaleType val)
PrintScaleType GetScaleType (void) const
PrintScaleTypeGetRefScaleType (void)
void SetScale (double val)
double GetScale (void) const
double & GetRefScale (void)
void SetHorizFit (bool val)
bool GetHorizFit (void) const
bool & GetRefHorizFit (void)
void SetVertFit (bool val)
bool GetVertFit (void) const
bool & GetRefVertFit (void)
void SetHPages (int val)
int GetHPages (void) const
int & GetRefHPages (void)
void SetVPages (int val)
int GetVPages (void) const
int & GetRefVPages (void)
- Public Member Functions inherited from gcu::DialogOwner
 DialogOwner ()
virtual ~DialogOwner ()
DialogGetDialog (std::string name)
void ClearDialogs ()

Protected Attributes

GtkWidget * m_pWidget
double m_Radius

Detailed Description

View class based on OpenGL for rendering. Used to display 3d chemical structures such as molecules or crystals cells.

Definition at line 49 of file glview.h.

Constructor & Destructor Documentation

gcu::GLView::GLView ( GLDocument pDoc) throw (std::runtime_error)

Constructor.

Parameters
pDoc,:a pointer to the GLDocument instance.

Creates a view for the document.

virtual gcu::GLView::~GLView ( )
virtual

Destructor.

The destructor of GLView.

Member Function Documentation

GdkPixbuf* gcu::GLView::BuildPixbuf ( unsigned  width,
unsigned  height 
) const
Parameters
widththe width of the generated image.
heightthe height of the generated image.

Generates a pixbuf from the current view.

Returns
the pixbuf containing the generated image
void gcu::GLView::DoPrint ( GtkPrintOperation *  print,
GtkPrintContext *  context,
int  page 
) const
virtual
Parameters
printa GtkPrintOperation.
contexta GtkPrintContext.
pagethe page to print.

Prints the current view at 300 dpi.

Implements gcu::Printable.

void gcu::GLView::Draw ( )

Draws the contents of the associated widget. Automatically called by the framework.

gcu::GLView::GetAlpha ( void  ) const
inline

The alpha value for the background is not supported in this version and this is only a place holder.

Returns
the current alpha value of the background color.

Definition at line 261 of file glview.h.

gcu::GLView::GetAngle ( void  ) const
inline
Returns
the current half field of view.

Definition at line 184 of file glview.h.

gcu::GLView::GetBlue ( void  ) const
inline
Returns
the current blue component of the background color.

Definition at line 244 of file glview.h.

gcu::GLView::GetDoc ( void  )
inline
Returns
the associated document.

Definition at line 265 of file glview.h.

gcu::GLView::GetGreen ( void  ) const
inline
Returns
the current green component of the background color.

Definition at line 234 of file glview.h.

GtkWindow* gcu::GLView::GetGtkWindow ( )
inlinevirtual
Returns
the top level GtkWindow containing the view.

Implements gcu::Printable.

Definition at line 141 of file glview.h.

References m_pWidget.

gcu::GLView::GetPhi ( void  ) const
inline
Returns
the current phi Euler's angle.

Definition at line 204 of file glview.h.

gcu::GLView::GetPsi ( void  ) const
inline
Returns
the current psi Euler's angle.

Definition at line 194 of file glview.h.

gcu::GLView::GetRadius ( void  )
inline
Returns
the distance between the center of the model and the point of view.

Definition at line 272 of file glview.h.

gcu::GLView::GetRed ( void  ) const
inline
Returns
the current red component of the background color.

Definition at line 224 of file glview.h.

gcu::GLView::GetRefAlpha ( void  )
inline

The alpha value for the background is not supported in this version and this is only a place holder.

Returns
the current alpha value of the background color as a reference.

Definition at line 261 of file glview.h.

gcu::GLView::GetRefAngle ( void  )
inline
Returns
the current half field of view as a reference.

Definition at line 184 of file glview.h.

gcu::GLView::GetRefBlue ( void  )
inline
Returns
the current blue component of the background color as a reference.

Definition at line 244 of file glview.h.

gcu::GLView::GetRefGreen ( void  )
inline
Returns
the current green component of the background color as a reference.

Definition at line 234 of file glview.h.

gcu::GLView::GetRefPhi ( void  )
inline
Returns
the current psh Euler's angle as a reference.

Definition at line 204 of file glview.h.

gcu::GLView::GetRefPsi ( void  )
inline
Returns
the current psi Euler's angle as a reference.

Definition at line 194 of file glview.h.

gcu::GLView::GetRefRed ( void  )
inline
Returns
the current red component of the background color as a reference.

Definition at line 224 of file glview.h.

gcu::GLView::GetRefTheta ( void  )
inline
Returns
the current theta Euler's angle as a reference.

Definition at line 214 of file glview.h.

gcu::GLView::GetTheta ( void  ) const
inline
Returns
the current theta Euler's angle.

Definition at line 214 of file glview.h.

GtkWidget* gcu::GLView::GetWidget ( )
inline
Returns
the associated GtkWidget.

Definition at line 68 of file glview.h.

References m_pWidget.

void gcu::GLView::Init ( )

Initialize the associated widget. Automatically called by the framework.

bool gcu::GLView::OnMotion ( GdkEventMotion *  event)
Parameters
event,:a pointer to a GdkEvent.

Automatically called by the framework when the mouse cursor moves over the associated widget drawing area.

Returns
true if a motion really occured, false otherwise.
bool gcu::GLView::OnPressed ( GdkEventButton *  event)
Parameters
event,:a pointer to a GdkEvent.

Automatically called by the framework when a left button click occurs in the associated widget drawing area.

void gcu::GLView::RenderToCairo ( cairo_t *  cr,
unsigned  width,
unsigned  height 
) const
Parameters
cra cairo_t.
widththe width used for rendering.
heightthe height used for rendering.

Outputs a bitmap to cairo. Used internally for printing and various image formats exports.

void gcu::GLView::Reshape ( int  width,
int  height 
)

Automatically called by the framework when the associated widget size changes.

void gcu::GLView::SaveAsImage ( std::string const &  filename,
char const *  type,
std::map< std::string, std::string > &  options,
unsigned  width,
unsigned  height 
) const
Parameters
filenamethe name of the file.
typethe type as supported by GdkPixbuf (e.g. "png" or "jpeg").
optionsthe pairs of keys/values to pass GdkPixbuf.
widththe width of the generated image.
heightthe height of the generated image.

Export the view contents as an image. The size of the new image is defined by the width and height parameters.

gcu::GLView::SetAlpha ( float  alpha)
inline
Parameters
alphathe new alpha value for the background.

The alpha value for the background is not supported in this version and this is only a place holder.

Definition at line 261 of file glview.h.

gcu::GLView::SetAngle ( double  angle)
inline
Parameters
anglethe new half field of view.

Definition at line 184 of file glview.h.

gcu::GLView::SetBlue ( float  blue)
inline
Parameters
bluethe new blue component for the background color.

Definition at line 244 of file glview.h.

gcu::GLView::SetGreen ( float  green)
inline
Parameters
greenthe new green component for the background color.

Definition at line 234 of file glview.h.

gcu::GLView::SetPhi ( double  phi)
inline
Parameters
phithe new phi Euler's angle.

Definition at line 204 of file glview.h.

gcu::GLView::SetPsi ( double  psi)
inline
Parameters
psithe new psi Euler's angle.

Definition at line 194 of file glview.h.

gcu::GLView::SetRed ( float  red)
inline
Parameters
redthe new red component for the background color.

Definition at line 224 of file glview.h.

void gcu::GLView::SetRotation ( double  psi,
double  theta,
double  phi 
)
Parameters
psithe first Euler's angle.
thetathe second Euler's angle.
phithe third Euler's angle.

Sets the orientation of the model, using the Euler's angles.

gcu::GLView::SetTheta ( double  theta)
inline
Parameters
thetathe new theta Euler's angle.

Definition at line 214 of file glview.h.

void gcu::GLView::Update ( )

Update the contents of the associated widget. This method must be called each time the document or the view are modified.

Member Data Documentation

GtkWidget* gcu::GLView::m_pWidget
protected

The associated widget.

Definition at line 164 of file glview.h.

Referenced by GetGtkWindow(), and GetWidget().

gcu::GLView::m_Radius
protected

The distance between the center of the model and the point of view.

Definition at line 272 of file glview.h.


The documentation for this class was generated from the following file: