Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

Molecule.h

Go to the documentation of this file.
00001 #ifndef MoleculeH
00002 #define MoleculeH
00003 
00004 /*******************************************************************************
00005 Copyright 1998,1999,2000,2001,2002 Petr Kulhanek
00006 
00007     This file is part of Core plugin.
00008 
00009     Core plugin is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     Core plugin 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     You should have received a copy of the GNU General Public License
00020     along with Core plugin; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 *******************************************************************************/
00023 /*******************************************************************************
00024 ** PROJEKT:             Projekt NEMESIS
00025 ** SOUBOR:              Molecule
00026 ** ůČEL:                popis tříd shromaždujících informace o molekule
00027 ** VERZE:               4.0
00028 ** JAZYK:               CBuilder C++
00029 ** CÍLOVÝ POČÍTAČ:      IBM PC
00030 ** PROGRAMÁTOR:         Petr Kulhánek
00031 ** HISTORIE ůPRAV:
00032 VERZE   DATUM       POZNÁMKA
00033 3.0                 zavedení projektu
00034 3.1     27.05.2000  převedení vykreslování do CStandardModel
00035                     zustává pouze strukturní záležitost
00036 4.0     04.09.2000  přenesení geometrie měření do třídy CGeometry, změna
00037                     koncepce třídy
00038                 2000-11-28      všechny funkce týkající se geometrie a konektování
00039                                 byly přeneseny do třídy CGeometry
00040 *******************************************************************************/
00041 
00045 /* HLAVIČKOVÉ SOUBORY  ********************************************************/
00046 
00047 #include "CoreMainHeader.h"
00048 #include "ExtObject.h"
00049 #include "Atom.h"
00050 #include "Bond.h"
00051 #include "Constraint.h"
00052 #include "StructureUnit.h"
00053 #include "Fragment.h"
00054 #include "ContainerEnumerator.h"
00055 #include "InsertAdapter.h"
00056 #include "Cell.h"
00057 #include "Sequences.h"
00058 
00059 /* KONEC HLAVIČKOVÝCH SOUBORů *************************************************/
00060 
00061 class CStructure;
00062 class CProject;
00063 class CHistoryList;
00064 class CIndexCounter;
00065 class CXMLElement;
00066 
00067 extern CPluginObjectInfo MoleculeObjectInfo;
00068 
00069 /* DEFINICE TŘÍD **************************************************************/
00070 
00072 
00075 class NEMESIS_CORE_PACKAGE CMolecule : public CExtObject{
00076     public:
00077  // metody - konstruktor / destruktor ------------------------------------------
00078            __fastcall CMolecule(CComObject* owner,CProject* project);
00079            __fastcall ~CMolecule(void);
00080            
00081  // metody - výkonné operace - se záznamem do history listu --------------------
00082     bool __fastcall ChangePos(const CPoint& pos);
00083 
00084  // vstupně výstupní operace ---------------------------------------------------
00085     bool __fastcall Load(istream& stream);  // nahraje molekulu z proudu
00086 
00087     bool __fastcall Load(CStructure* p_structure);
00088     
00089     bool __fastcall Load(CXMLElement* p_el);
00090     bool __fastcall Save(CXMLElement* p_el);
00091     bool __fastcall SaveInStructureFormat(CXMLElement* p_el);
00092 
00093     CExtObject* __fastcall FindObject(int index);
00094     void __fastcall GetMoleculeMetrics(CPoint& low,CPoint& high);
00095 
00096  // metody - výkonné operace
00097     void __fastcall Clear(void);
00098 
00099  // metody - zjištovací operace
00100     inline bool                 __fastcall IsEmpty(void) const;
00101 
00102  // constraints management -----------------------------------------------------
00103     inline CConstraintsList* __fastcall GetActiveConstraintsList(void);
00104     void __fastcall SetActiveConstraintsList(CConstraintsList* p_lis);
00105 
00106  // veřejná data ---------------------------------------------------------------
00107 
00108     CInsertAdapter                  InsertAdapter;   // umožňuje vkládání struktur do molekuly
00109 
00110     CCell                           Cell;            // cela pro molekulu
00111     CAtomsList                      Atoms;           // atomy
00112     CBondsList                      Bonds;           // vazby
00113     CStructureUnitsList             StructureUnits;  // strukturní jednotky
00114     CFragmentsList                                      Fragments;               // samostatné fragmenty molekuly
00115     CSequencesList                  Sequences;       // sekvence jednotek
00116 
00117         __property CHistoryList*        HistoryList     = {read = FHistoryList};
00118     __property CIndexCounter*   IndexCounter    = {read = FIndexCounter};
00119     __property CProject*        Project         = {read = GetProject};
00120     
00121  // ............. SEKCE PRIVÁTNÍCH DAT .........................................
00122     private:
00123     CConstraintsList*   ActualConstraints; // active constrain list
00124     CConstraintsList    Constraints;       // internal constraints list
00125     CHistoryList*       FHistoryList;      // seznam pro ukládání změn
00126     CIndexCounter*      FIndexCounter;     // počítadlo odkazů
00127     };
00128 
00129 // ----------------------------------------------------------------------------
00130 
00131 DECLARE_EVENT(Molecule_SetConstraintsList);
00132 
00133 // ----------------------------------------------------------------------------
00134 // ############################################################################
00135 // ----------------------------------------------------------------------------
00136 
00137 extern CPluginObjectInfo MoleculeEnumObjectInfo;
00138 extern CExtUUID          ID_MoleculeEnum;
00139 
00140 // ----------------------------------------------------------------------------
00141 
00143 
00146 class NEMESIS_CORE_PACKAGE CMoleculeEnumerator : public CContainerEnumerator {
00147     public:
00148         __fastcall CMoleculeEnumerator(CComObject* owner,CMolecule* molecule);
00149 
00150     virtual CContainerEnumerator* __fastcall GetFirstSubContainer(void);
00151     virtual CContainerEnumerator* __fastcall GetNextSubContainer(void);
00152 
00153     virtual bool __fastcall ContainSubContainers(void);
00154 
00155     virtual int __fastcall NumOfColumns(void);  // počet sloupců popisujících objekt
00156     virtual const CSmallString __fastcall GetColumnCaption(int index); // popis sloupce
00157     virtual const CSmallString __fastcall GetObjectProperty(int index); // vlastnost objektu
00158     virtual int __fastcall GetObjectImageIndex(void);
00159 
00160     virtual int         __fastcall NumOfObjects(void);
00161     virtual bool        __fastcall PrepareObjects(int startpos,int size,int rstart,int rend);
00162     virtual CExtObject* __fastcall GetObject(int pos);
00163 
00164     virtual CExtObject* __fastcall GetCurrentObject(void);
00165     virtual bool __fastcall SetCurrentObject(CExtObject* p_object);
00166 
00167     inline CMolecule* __fastcall GetMolecule(void);
00168     virtual CExtObject* __fastcall GetMyMaster(void);
00169 
00170     private:
00171     CSimpleList<CContainerEnumerator>       SubContainers;
00172     CSimpleIterator<CContainerEnumerator>   Pointer;
00173     CMolecule*                              Molecule;
00174     CContainerEnumerator*                   CurrentObject;
00175     CContainerEnumerator*                   ActualConstraintsEnum;
00176     bool                                    Changed;
00177     bool         __fastcall PrepareSubContainers(void);
00178     virtual void __fastcall ProcessEvent(const CEventIdentifier& event,CExtObject* Sender,void* p_data);
00179     };
00180 
00181 
00182 // ----------------------------------------------------------------------------
00183 
00184 class CMoleculePosHistory:public CCoreElementsRecord{
00185     public:
00186  // konstruktor a destruktor ---------------------------------------------------
00187         __fastcall CMoleculePosHistory(CMolecule* p_mol,const CPoint& deltapos);
00188 
00189                 // zjištění celého řetězce popisujícího změnu
00190     virtual CSmallString __fastcall GetDescription(const CSmallString& format);
00191 
00192  // sekce soukromých dat -------------------------------------------------------
00193     private:
00194     CMolecule*  Molecule;  // vlastník atomu
00195     CPoint              DeltaPos;  // zmenová hodnota
00196 
00197     virtual void __fastcall Forward(void);
00198     virtual void __fastcall Backward(void);
00199     };
00200 
00201 
00202 /* KONEC DEFINICE TŘÍD ********************************************************/
00203 
00204 
00205 //------------------------------------------------------------------------------
00206 
00207 inline bool __fastcall CMolecule::IsEmpty(void) const
00208 {
00209  return(Atoms.NumOfMembers()==0);
00210 }
00211 
00212 //------------------------------------------------------------------------------
00213 
00214 inline CMolecule* __fastcall CMoleculeEnumerator::GetMolecule(void)
00215 {
00216  return(Molecule);
00217 }
00218 
00219 //------------------------------------------------------------------------------
00220 
00221 inline CConstraintsList* __fastcall CMolecule::GetActiveConstraintsList(void)
00222 {
00223  return(ActualConstraints);
00224 }
00225 
00226 //------------------------------------------------------------------------------
00227 
00228 #endif

Generated on Sun Feb 9 12:53:51 2003 for NemesisCore by doxygen1.3-rc2