The Gnome Chemistry Utils  0.13.7
Public Member Functions | Protected Member Functions | Protected Attributes
gcr::Document Class Reference

#include <gcr/document.h>

Inheritance diagram for gcr::Document:
gcu::GLDocument gcu::Document gcu::Object gcu::DialogOwner

List of all members.

Public Member Functions

 Document (gcu::Application *App)
virtual ~Document ()
void ParseXMLTree (xmlNode *xml)
void Update ()
ViewGetView ()
void Draw (gcu::Matrix const &m) const
virtual ViewCreateNewView ()
virtual AtomCreateNewAtom ()
virtual LineCreateNewLine ()
virtual CleavageCreateNewCleavage ()
xmlDocPtr BuildXMLTree () const
virtual const char * GetProgramId () const
bool SetProperty (unsigned property, char const *value)
std::string GetProperty (unsigned property) const
bool Loaded () throw (gcu::LoaderError)
void AddChild (Object *object)
gcu::SpaceGroup const * FindSpaceGroup ()
void Reinit ()
AtomListGetAtomList ()
CleavageListGetCleavageList ()
LineListGetLineList ()
void GetCell (Lattice *lattice, double *a, double *b, double *c, double *alpha, double *beta, double *gamma)
void SetCell (Lattice lattice, double a, double b, double c, double alpha, double beta, double gamma)
void GetSize (double *xmin, double *xmax, double *ymin, double *ymax, double *zmin, double *zmax)
void SetSize (double xmin, double xmax, double ymin, double ymax, double zmin, double zmax)
void CheckAtoms ()
void CheckCleavages ()
void CheckLines ()
void Define (unsigned nPage=0)
void AddView (View *pView)
bool RemoveView (View *pView)
void RemoveAllViews ()
ViewGetActiveView ()
std::list< gcr::View * > * GetViews ()
void RenameViews ()
bool VerifySaved ()
void SetWidget (GtkWidget *widget)
const gchar * GetFileName ()
void SetActiveView (View *pView)
void SaveAsImage (const std::string &filename, char const *type, std::map< std::string, std::string > &options)
void SetFileName (const std::string &filename)
void SetTitle (char const *title)
void SetTitle (std::string &title)
char const * GetTitle ()
void SetAuthor (char const *author)
void SetMail (char const *mail)
void SetComment (char const *comment)
void SetLabel (char const *label)
GDate * GetCreationDate ()
GDate * GetRevisionDate ()
char const * GetLabel ()
void OnExportVRML (const std::string &FileName) const
void Save () const
std::string GetNameCommon (void) const
std::string GetNameSystematic (void) const
std::string GetNameMineral (void) const
std::string GetNameStructure (void) const
void SetSpaceGroup (gcu::SpaceGroup const *val)
gcu::SpaceGroup const * GetSpaceGroup (void) const
gcu::SpaceGroup const *& GetRefSpaceGroup (void)
void SetAutoSpaceGroup (bool val)
bool GetAutoSpaceGroup (void) const
bool & GetRefAutoSpaceGroup (void)
void SetFixedSize (bool val)
bool GetFixedSize (void) const
bool & GetRefFixedSize (void)
void SetReadOnly (bool val)
bool GetReadOnly (void) const
bool & GetRefReadOnly (void)
char * GetMail (void)
char * GetComment (void)

Protected Member Functions

void Init ()
virtual bool LoadNewView (xmlNodePtr node)

Protected Attributes

Lattice m_lattice
gdouble m_a
gdouble m_b
gdouble m_c
gdouble m_alpha
gdouble m_beta
gdouble m_gamma
gdouble m_xmin
gdouble m_ymin
gdouble m_zmin
gdouble m_xmax
gdouble m_ymax
gdouble m_zmax
AtomList AtomDef
AtomList Atoms
LineList LineDef
LineList Lines
CleavageList Cleavages
std::list< View * > m_Views
GDate m_CreationDate
GDate m_RevisionDate
char * m_Author
char * m_Mail
char * m_Comment

Detailed Description

The document containing the crystal structure.

Definition at line 88 of file gcr/document.h.


Constructor & Destructor Documentation

The constructor of Document

Reimplemented from gcu::Document.

virtual gcr::Document::~Document ( ) [virtual]

The destructor of Document

Reimplemented from gcu::Document.


Member Function Documentation

void gcr::Document::AddChild ( Object *  object)
Parameters:
objectthe Object instance to add as a child.
void gcr::Document::AddView ( View pView)
Parameters:
pViewa new view.

Adds a new view to the document.

xmlDocPtr gcr::Document::BuildXMLTree ( ) const

Builds the xmlDoc corresponding to the crystal structure.

Returns:
a pointer to the XML document.

Checks the atoms list and remove duplicates if needed.

Checks the cleavages list and remove duplicates if needed.

Checks the lines list and remove duplicates if needed.

virtual Atom* gcr::Document::CreateNewAtom ( ) [virtual]

Creates a new atom. This method should be overrided by programs deriving a new atom class from Atom.

Returns:
a pointer to the new Atom instance.

Creates a new cleavage. This method should be overrided by programs deriving a new line class from Cleavage

Returns:
a pointer to the new Cleavage instance.
virtual Line* gcr::Document::CreateNewLine ( ) [virtual]

Creates a new line. This method should be overrided by programs deriving a new view class from Line.

Returns:
a pointer to the new Line instance.
virtual View* gcr::Document::CreateNewView ( ) [virtual]

Creates a view of the document. This method should be overrided by programs deriving a new view class from View.

Returns:
a pointer to the new View instance.
void gcr::Document::Define ( unsigned  nPage = 0)
Parameters:
nPagethe dialog id.

Shows the dialog corresponding to nPage: 0: cell and lattice dialog, 1: atoms dialog, 2: lines dialog, 3: size dialog, 4: cleavages dialog.

void gcr::Document::Draw ( gcu::Matrix const &  m) const [virtual]
Parameters:
mthe Matrix giving the current model orientation

Displays the molecule using OpenGL.

Implements gcu::GLDocument.

Attempts to infer the symmetry space group for the crystal.

Returns:
the SpaceGroup found.
Returns:
the active view.

Definition at line 324 of file gcr/document.h.

Returns:
the list of atoms defining the crystal.

Definition at line 211 of file gcr/document.h.

References AtomDef.

gcr::Document::GetAutoSpaceGroup ( void  ) const [inline]
Returns:
whether the space group is automatically evaluated.

Definition at line 600 of file gcr/document.h.

void gcr::Document::GetCell ( Lattice lattice,
double *  a,
double *  b,
double *  c,
double *  alpha,
double *  beta,
double *  gamma 
)
Parameters:
latticewhere to store the lattice.
awhere to store the a cell parameter.
bwhere to store the b cell parameter.
cwhere to store the c cell parameter.
alphawhere to store the alpha cell parameter.
betawhere to store the beta cell parameter.
gammawhere to store the gamma cell parameter.

Retrieves the cell parameters.

Returns:
the list of defined cleavages.

Definition at line 216 of file gcr/document.h.

References Cleavages.

gcr::Document::GetComment ( void  ) [inline]
Returns:
the document comment.

Definition at line 651 of file gcr/document.h.

GDate* gcr::Document::GetCreationDate ( ) [inline]
Returns:
the document creation date.

Definition at line 424 of file gcr/document.h.

References m_CreationDate.

const gchar* gcr::Document::GetFileName ( ) [inline]
Returns:
the current document file name.

Definition at line 354 of file gcr/document.h.

gcr::Document::GetFixedSize ( void  ) const [inline]
Returns:
true if cleavages will not change atoms positions.

Definition at line 614 of file gcr/document.h.

char const* gcr::Document::GetLabel ( ) [inline]
Returns:
the label to use as window title for views.

Definition at line 434 of file gcr/document.h.

Returns:
the list of defined lines.

Definition at line 221 of file gcr/document.h.

References LineDef.

gcr::Document::GetMail ( void  ) [inline]
Returns:
the document author's mail address.

Definition at line 643 of file gcr/document.h.

gcr::Document::GetNameCommon ( void  ) const [inline]
Returns:
the common name or the chemical entity.

Definition at line 564 of file gcr/document.h.

gcr::Document::GetNameMineral ( void  ) const [inline]
Returns:
the mineral name or the chemical entity.

Definition at line 572 of file gcr/document.h.

gcr::Document::GetNameStructure ( void  ) const [inline]
Returns:
the structure name or the chemical entity.

Definition at line 576 of file gcr/document.h.

gcr::Document::GetNameSystematic ( void  ) const [inline]
Returns:
the systematic name or the chemical entity.

Definition at line 568 of file gcr/document.h.

virtual const char* gcr::Document::GetProgramId ( ) const [virtual]
Returns:
the identity of the program as saved in files in the generator tag. This method should be overrided by programs able to save crystal structures in XML files conforming to gcrystal.dtd. It is used mainly to ensure compatiblity with files created by older versions of the program.
std::string gcr::Document::GetProperty ( unsigned  property) const [virtual]
Parameters:
propertythe property id as defined in objprops.h

Used when saving to get properties from the document.

Returns:
the property as a string. The returned string might be empty.

Reimplemented from gcu::Object.

gcr::Document::GetReadOnly ( void  ) const [inline]
Returns:
whether the file can be modified.
the document author's name.

Definition at line 627 of file gcr/document.h.

Returns:
whether the space group is automatically evaluated as a reference.

Definition at line 600 of file gcr/document.h.

gcr::Document::GetRefFixedSize ( void  ) [inline]
Returns:
whether cleavages will not change atoms positions as a reference.

Definition at line 614 of file gcr/document.h.

gcr::Document::GetRefReadOnly ( void  ) [inline]
Returns:
whether the file can be modified as a reference.

Definition at line 627 of file gcr/document.h.

gcr::Document::GetRefSpaceGroup ( void  ) [inline]
Returns:
the space group associated with the lattice as a reference.

Definition at line 587 of file gcr/document.h.

GDate* gcr::Document::GetRevisionDate ( ) [inline]
Returns:
the document last change date.

Definition at line 429 of file gcr/document.h.

References m_RevisionDate.

void gcr::Document::GetSize ( double *  xmin,
double *  xmax,
double *  ymin,
double *  ymax,
double *  zmin,
double *  zmax 
)
Parameters:
xminwhere to store the minimum x.
xmaxwhere to store the maximum x.
yminwhere to store the minimum y.
ymaxwhere to store the maximum y.
zminwhere to store the minimum z.
zmaxwhere to store the maximum z.

Retrieves the visible volume in cell coordinates.

gcr::Document::GetSpaceGroup ( void  ) const [inline]
Returns:
the space group associated with the lattice.

Definition at line 587 of file gcr/document.h.

char const* gcr::Document::GetTitle ( ) [inline]
Returns:
the current document title.

Reimplemented from gcu::Document.

Definition at line 390 of file gcr/document.h.

References gcu::Document::m_Title.

Returns:
a pointer to the first View of the document. The view will be created if it does not already exist.

Reimplemented from gcu::GLDocument.

std::list<gcr::View *>* gcr::Document::GetViews ( ) [inline]
Returns:
the list of all views.

Definition at line 329 of file gcr/document.h.

References m_Views.

void gcr::Document::Init ( ) [protected]

Initialize a new Document instance.

bool gcr::Document::Loaded ( ) throw (gcu::LoaderError) [virtual]

Called by the application when the document has been loaded to update the title and add some lines.

Reimplemented from gcu::Document.

virtual bool gcr::Document::LoadNewView ( xmlNodePtr  node) [protected, virtual]
Parameters:
node,:the xmlNode containing the serialized view.

Loads a view from a XML document. This methd must be overrided by applications supporting multiple views.

void gcr::Document::OnExportVRML ( const std::string &  FileName) const
Parameters:
FileNamea file name.

Saves the scene as a VRML file.

void gcr::Document::ParseXMLTree ( xmlNode *  xml)
Parameters:
xml,:a pointer to the root xmlNode of the xmlDoc containing the definition of the crystal.

Analyses the contents of the XML document and builds the crystal structure from the data. Typical usage is:

Document *crystal = new Document();
xmlDocPtr doc = xmlParseFile (filename);
crystal->ParseXMLTree (doc->children);

Reinitialize a Document instance. Used when loading a file in an already existing document.

Removes all views from the document. This should be done only when destroying the document.

bool gcr::Document::RemoveView ( View pView)
Parameters:
pViewthe view to remove.

Removes a view from the document when possible.

Returns:
true if the view could be removed.

Updates the views window titles.

void gcr::Document::Save ( ) const [virtual]

Saves the document.

Reimplemented from gcu::Document.

void gcr::Document::SaveAsImage ( const std::string &  filename,
char const *  type,
std::map< std::string, std::string > &  options 
)
Parameters:
filenamea file name
typean image type such as "png" or "jpeg".
optionsthe options to use if any.

Saves the scene as a bitmap.

void gcr::Document::SetActiveView ( View pView) [inline]
Parameters:
pViewthe new active view.

Sets the new active view.

Definition at line 361 of file gcr/document.h.

void gcr::Document::SetAuthor ( char const *  author)
Parameters:
authorthe file author's name

Sets the author's name.

gcr::Document::SetAutoSpaceGroup ( bool  val) [inline]
Parameters:
valwhether the lattice SpaceGroup should be automatically searched for.

If true, after each change, the framework will reevaluate the space group according to the Bravais lattice and the defines atoms.

Definition at line 600 of file gcr/document.h.

void gcr::Document::SetCell ( Lattice  lattice,
double  a,
double  b,
double  c,
double  alpha,
double  beta,
double  gamma 
)
Parameters:
latticethe new lattice.
athe new a value.
bthe new b value.
cthe new c value.
alphathe new alpha value.
betathe new beta value.
gammathe new gamma value.

Sets the cell parameters.

void gcr::Document::SetComment ( char const *  comment)
Parameters:
commenta comment

Adds a comment to the document. Currently only one comment is allowed per document.

void gcr::Document::SetFileName ( const std::string &  filename)
Parameters:
filenamea new file name

Changes the file name.

gcr::Document::SetFixedSize ( bool  val) [inline]
Parameters:
valwhether cleavages should not change positions in the view.

If true, adding cleavages will not change atoms positions, otherwise, the scene will be made as large as possible.

Definition at line 614 of file gcr/document.h.

void gcr::Document::SetLabel ( char const *  label)
Parameters:
labelthe new window title.

Sets the label to use as window title for views.

void gcr::Document::SetMail ( char const *  mail)
Parameters:
mailthe file author's mail address

Sets the author's mail address.

bool gcr::Document::SetProperty ( unsigned  property,
char const *  value 
) [virtual]
Parameters:
propertythe property id as defined in objprops.h
valuethe property value as a string

Used when loading to set properties to the document

Returns:
true if the property could be set, or if the property is not relevant, false otherwise.

Reimplemented from gcu::Object.

gcr::Document::SetReadOnly ( bool  val) [inline]
Parameters:
valwhether the file can be modified.

If true, the document can't be saved using the original file name.

Definition at line 627 of file gcr/document.h.

void gcr::Document::SetSize ( double  xmin,
double  xmax,
double  ymin,
double  ymax,
double  zmin,
double  zmax 
)
Parameters:
xminthe new minimum x.
xmaxthe new maximum x.
yminthe new minimum y.
ymaxthe new maximum y.
zminthe new minimum z.
zmaxthe new maximum z.

Sets the visible volume in cell coordinates.

gcr::Document::SetSpaceGroup ( gcu::SpaceGroup const *  val) [inline]
Parameters:
vala SpaceGroup. Associates a the space group with the lattice.

Definition at line 587 of file gcr/document.h.

void gcr::Document::SetTitle ( char const *  title) [virtual]
Parameters:
titlethe new title.

Changes the document title.

Reimplemented from gcu::Document.

void gcr::Document::SetTitle ( std::string &  title) [virtual]
Parameters:
titlethe new document title.

Reimplemented from gcu::Document.

void gcr::Document::SetWidget ( GtkWidget *  widget) [inline]
Parameters:
widgetthe new current widget.

Sets the currently active widget.

Definition at line 349 of file gcr/document.h.

This method must be called when a new document is loaded or when the definition of the crystal is changed. It recalculates everything and updates all the views.

Checks if the document needs to be saved and ask the user about what to do when needed.

Returns:
tue unless the user cancelled the dialog.

Member Data Documentation

List of the atoms in the definition of the crystal

Definition at line 521 of file gcr/document.h.

Referenced by GetAtomList().

List of the atoms displayed.

Definition at line 525 of file gcr/document.h.

List of the cleavages defined.

Definition at line 537 of file gcr/document.h.

Referenced by GetCleavageList().

List of the lines in the definition of the crystal

Definition at line 529 of file gcr/document.h.

Referenced by GetLineList().

List of the lines displayed.

Definition at line 533 of file gcr/document.h.

gdouble gcr::Document::m_a [protected]

The a parameter of the unit cell.

Definition at line 473 of file gcr/document.h.

gdouble gcr::Document::m_alpha [protected]

The alpha angle of the unit cell.

Definition at line 485 of file gcr/document.h.

The document author's name.

Definition at line 635 of file gcr/document.h.

gdouble gcr::Document::m_b [protected]

The b parameter of the unit cell.

Definition at line 477 of file gcr/document.h.

gdouble gcr::Document::m_beta [protected]

The beta angle of the unit cell.

Definition at line 489 of file gcr/document.h.

gdouble gcr::Document::m_c [protected]

The c parameter of the unit cell.

Definition at line 481 of file gcr/document.h.

The document comment.

Definition at line 651 of file gcr/document.h.

GDate gcr::Document::m_CreationDate [protected]

The document creation date.

Definition at line 546 of file gcr/document.h.

Referenced by GetCreationDate().

gdouble gcr::Document::m_gamma [protected]

The gamma angle of the unit cell.

Definition at line 493 of file gcr/document.h.

The Bravais lattice of the crystal.

Definition at line 469 of file gcr/document.h.

gcr::Document::m_Mail [protected]

The document author's mail address.

Definition at line 643 of file gcr/document.h.

GDate gcr::Document::m_RevisionDate [protected]

The document last revision date.

Definition at line 551 of file gcr/document.h.

Referenced by GetRevisionDate().

std::list<View *> gcr::Document::m_Views [protected]

List of the views of the document.

Definition at line 541 of file gcr/document.h.

Referenced by GetViews().

gdouble gcr::Document::m_xmax [protected]

The maximum x coordinate in the representation of the crystal structure.

Definition at line 509 of file gcr/document.h.

gdouble gcr::Document::m_xmin [protected]

The minimum x coordinate in the representation of the crystal structure.

Definition at line 497 of file gcr/document.h.

gdouble gcr::Document::m_ymax [protected]

The maximum y coordinate in the representation of the crystal structure.

Definition at line 513 of file gcr/document.h.

gdouble gcr::Document::m_ymin [protected]

The minimum y coordinate in the representation of the crystal structure.

Definition at line 501 of file gcr/document.h.

gdouble gcr::Document::m_zmax [protected]

The maximum z coordinate in the representation of the crystal structure.

Definition at line 517 of file gcr/document.h.

gdouble gcr::Document::m_zmin [protected]

The minimum z coordinate in the representation of the crystal structure.

Definition at line 505 of file gcr/document.h.


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