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

#include <gcu/glview.h>

Inheritance diagram for gcu::GLView:
gcugtk::GLView gcr::View gcugtk::Chem3dView

Public Member Functions

 GLView (GLDocument *pDoc) throw (std::runtime_error)
 Constructor.
virtual ~GLView ()
 Destructor.
virtual 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, bool use_bg) const
virtual GdkPixbuf * BuildPixbuf (unsigned width, unsigned height, bool use_bg) const
void RenderToCairo (cairo_t *cr, unsigned width, unsigned height, bool use_bg) 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)

Protected Member Functions

void Rotate (gdouble x, gdouble y)
virtual bool GLBegin ()=0
virtual void GLEnd ()=0

Protected Attributes

Matrix m_Euler
double m_Lastx
double m_Lasty
int m_WindowHeight
int m_WindowWidth
double m_Height
double m_Width
double m_Near
double m_Far
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 47 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.

Reimplemented in gcugtk::GLView.

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

Destructor.

The destructor of GLView.

Reimplemented in gcugtk::GLView.

Member Function Documentation

virtual GdkPixbuf* gcu::GLView::BuildPixbuf ( unsigned  width,
unsigned  height,
bool  use_bg 
) const
virtual
Parameters
widththe width of the generated image.
heightthe height of the generated image.
use_bgwhether to use the window background or a transparent background.

Generates a pixbuf from the current view.

Returns
the pixbuf containing the generated image

Reimplemented in gcugtk::GLView.

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 254 of file glview.h.

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

Definition at line 177 of file glview.h.

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

Definition at line 237 of file glview.h.

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

Definition at line 258 of file glview.h.

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

Definition at line 227 of file glview.h.

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

Definition at line 197 of file glview.h.

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

Definition at line 187 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 265 of file glview.h.

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

Definition at line 217 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 254 of file glview.h.

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

Definition at line 177 of file glview.h.

Referenced by gcr::View::GetFoV().

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

Definition at line 237 of file glview.h.

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

Definition at line 227 of file glview.h.

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

Definition at line 197 of file glview.h.

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

Definition at line 187 of file glview.h.

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

Definition at line 217 of file glview.h.

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

Definition at line 207 of file glview.h.

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

Definition at line 207 of file glview.h.

virtual bool gcu::GLView::GLBegin ( )
protectedpure virtual

Starts an OpenGL drawing operation. Will set the appropriate context. This method is pure virtual and must be implemented in derived classes.

Returns
true if successful.

Implemented in gcugtk::GLView.

virtual void gcu::GLView::GLEnd ( )
protectedpure virtual

Ends an OpenGL drawing operation. This method is pure virtual and must be implemented in derived classes.

Implemented in gcugtk::GLView.

void gcu::GLView::RenderToCairo ( cairo_t *  cr,
unsigned  width,
unsigned  height,
bool  use_bg 
) const
Parameters
cra cairo_t.
widththe width used for rendering.
heightthe height used for rendering.
use_bgwhether to use the window background or a transparent background.

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

void gcu::GLView::Rotate ( gdouble  x,
gdouble  y 
)
protected
Parameters
xthe x component of the rotation.
ythe y component of the rotation. std:: Called by OnMotion(). x and y are the displacement coordinates of the mouse.
void gcu::GLView::SaveAsImage ( std::string const &  filename,
char const *  type,
std::map< std::string, std::string > &  options,
unsigned  width,
unsigned  height,
bool  use_bg 
) 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.
use_bgwhether to use the window background or a transparent background.

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 254 of file glview.h.

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

Definition at line 177 of file glview.h.

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

Definition at line 237 of file glview.h.

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

Definition at line 227 of file glview.h.

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

Definition at line 197 of file glview.h.

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

Definition at line 187 of file glview.h.

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

Definition at line 217 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 207 of file glview.h.

virtual void gcu::GLView::Update ( )
virtual

Update the contents of the associated widget if any. This method must be called each time the document or the view are modified. Default implementation doesn't do anything.

Reimplemented in gcugtk::GLView.

Member Data Documentation

Matrix gcu::GLView::m_Euler
protected

A Matrix reprenting the scene spatial orientation

Definition at line 133 of file glview.h.

double gcu::GLView::m_Far
protected

The distance from the view point to the farest scene point.

Definition at line 165 of file glview.h.

double gcu::GLView::m_Height
protected

The scene height.

Definition at line 153 of file glview.h.

double gcu::GLView::m_Lastx
protected

A matrix

Definition at line 137 of file glview.h.

double gcu::GLView::m_Lasty
protected

A Matrix

Definition at line 141 of file glview.h.

double gcu::GLView::m_Near
protected

The distance from the view point to the nearest scene point.

Definition at line 161 of file glview.h.

gcu::GLView::m_Radius
protected

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

Definition at line 265 of file glview.h.

Referenced by gcr::View::GetPos().

double gcu::GLView::m_Width
protected

The scene width.

Definition at line 157 of file glview.h.

int gcu::GLView::m_WindowHeight
protected

The view height.

Definition at line 145 of file glview.h.

int gcu::GLView::m_WindowWidth
protected

The view witdth.

Definition at line 149 of file glview.h.


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