depict.h
Go to the documentation of this file.
00001 /**********************************************************************
00002 depict.h - 2D Depiction of molecules using OBPainter.
00003 
00004 Copyright (C) 2009-2010 by Tim Vandermeersch
00005 Some portions Copyright (C) 2009 by Chris Morley
00006 
00007 This file is part of the Open Babel project.
00008 For more information, see <http://openbabel.org/>
00009 
00010 This program is free software; you can redistribute it and/or modify
00011 it under the terms of the GNU General Public License as published by
00012 the Free Software Foundation version 2 of the License.
00013 
00014 This program is distributed in the hope that it will be useful,
00015 but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 ***********************************************************************/
00019 #ifndef OB_DEPICT_H
00020 #define OB_DEPICT_H
00021 
00022 #include <openbabel/babelconfig.h>
00023 #include <openbabel/math/vector3.h>
00024 
00025 namespace OpenBabel
00026 {
00027 
00028   class OBMol;
00029   class OBPainter;
00030   class OBDepictPrivate;
00031 
00032   #ifndef OBDEPICT
00033     #define OBDEPICT
00034   #endif
00035 
00041   class OBDEPICT OBDepict
00042   {
00043     public:
00044       enum AtomLabelType {
00045         AtomId = 1,
00046         AtomIndex,
00047         AtomSymmetryClass,
00048         AtomValence,
00049         AtomTetrahedralStereo
00050       };
00051 
00052       enum OptionType{
00053         bwAtoms              = 0x0001,
00054         internalColor        = 0x0002,
00055         drawTermC            = 0x0010,
00056         drawAllC             = 0x0020,
00057         noWedgeHashGen       = 0x0100,
00058         asymmetricDoubleBond = 0x0200
00059       };
00060 
00064       OBDepict(OBPainter *painter);
00068       ~OBDepict();
00074       bool DrawMolecule(OBMol *mol);
00080       bool AddAtomLabels(AtomLabelType type);
00081 
00082       void SetBondLength(double length);
00083       double GetBondLength() const;
00084 
00085       void SetPenWidth(double length);
00086       double GetPenWidth() const;
00087 
00088       void SetBondSpacing(double spacing);
00089       double GetBondSpacing() const;
00090 
00091       void SetBondWidth(double width);
00092       double GetBondWidth() const;
00093 
00094       //void SetDrawingTerminalCarbon(bool enabled);
00095       //bool GetDrawingTerminalCarbon() const;
00096 
00097       void SetOption(unsigned opts); //extendable with binary compatibility
00098       unsigned GetOptions() const;
00099       void ClearOptions();
00100 
00101       void SetFontFamily(const std::string &family);
00102       const std::string& GetFontFamily() const;
00103 
00104       void SetFontSize(int pointSize, bool subscript = false);
00105       int GetFontSize(bool subscript = false) const;
00106 
00107       void SetAliasMode(bool b=true);
00108 
00109       void SetBondColor(const std::string& scolor);
00110 
00111     private:
00112       OBDepictPrivate * const d;
00113   };
00114 
00115 }
00116 
00117 #endif
00118 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines