diff options
author | Manoj Rajagopalan <manoj@nanorex.com> | 2008-02-21 23:08:42 +0000 |
---|---|---|
committer | Manoj Rajagopalan <manoj@nanorex.com> | 2008-02-21 23:08:42 +0000 |
commit | 964bdbb48a345904df2d218c4aea49b854f9a442 (patch) | |
tree | 9ece8d310b4970fc30a3c10aa05017ef9a1965e3 | |
parent | 555e653398d12e39f6b6abce3acebeb3d3f59b68 (diff) | |
download | nanoengineer-964bdbb48a345904df2d218c4aea49b854f9a442.tar.gz nanoengineer-964bdbb48a345904df2d218c4aea49b854f9a442.zip |
Created NXAtomData, NXMoleculeSet::title, NXMoleculeSet::getTitle(), NXMoleculeSet::setTitle()
4 files changed, 98 insertions, 34 deletions
diff --git a/cad/plugins/NanoVision-1/include/Nanorex/Interface/NXAtomData.h b/cad/plugins/NanoVision-1/include/Nanorex/Interface/NXAtomData.h new file mode 100644 index 000000000..2c9427065 --- /dev/null +++ b/cad/plugins/NanoVision-1/include/Nanorex/Interface/NXAtomData.h @@ -0,0 +1,44 @@ +// Copyright 2008 Nanorex, Inc. See LICENSE file for details. + +#ifndef NX_ATOM_H +#define NX_ATOM_H + +#include <openbabel/generic.h> +#define NXAtomDataType OBGenericDataType::CustomData1 +using namespace OpenBabel; + +namespace Nanorex { + + +/* CLASS: NXAtomData */ +/** + * A set of Nanorex-specific data stored in OBAtom objects. + * + * @ingroup ChemistryDataModel, NanorexInterface + */ +class NXAtomData : public OBGenericData { +public: + typedef enum { DEF = 0, INV, VDW, LIN, CPK, TUB, NUM_STYLES } RenderStyleID; + + NXAtomData() { _type = NXAtomDataType; _rsid = DEF; } + + void SetIdx(int idx) { _idx = idx; } + unsigned int GetIdx() { return _idx; } + + void SetRenderStyle(RenderStyleID rsid) { _rsid = rsid; } + RenderStyleID const& GetRenderStyle(void) const { return _rsid; } + + static char const *const GetRenderStyleName(RenderStyleID rsid) + { return _s_renderStyleNames[rsid]; } + +private: + unsigned int _idx; + RenderStyleID _rsid; + + static char const *const _s_renderStyleNames[NUM_STYLES]; +}; + + +} // Nanorex:: + +#endif // NX_ATOM_H diff --git a/cad/plugins/NanoVision-1/include/Nanorex/Interface/NXMoleculeSet.h b/cad/plugins/NanoVision-1/include/Nanorex/Interface/NXMoleculeSet.h index df03e96cd..5b593575f 100644 --- a/cad/plugins/NanoVision-1/include/Nanorex/Interface/NXMoleculeSet.h +++ b/cad/plugins/NanoVision-1/include/Nanorex/Interface/NXMoleculeSet.h @@ -4,6 +4,7 @@ #define NX_MOLECULESET_H #include <list> +#include <string> using namespace std; #include <openbabel/mol.h> @@ -27,39 +28,44 @@ typedef std::list<OBMol*>::iterator OBMolIterator; * @ingroup ChemistryDataModel, NanorexInterface */ class NXMoleculeSet { - public: - NXMoleculeSet(); - ~NXMoleculeSet(); - - void addChild(NXMoleculeSet* child) { children.push_back(child); } - NXMoleculeSetIterator childrenBegin() { return children.begin(); } - NXMoleculeSetIterator childrenEnd() { return children.end(); } - NXMSInt childCount() { return children.size(); } - - // - // Molecules - // - OBMol* newMolecule(); - OBMolIterator moleculesBegin() { return molecules.begin(); } - OBMolIterator moleculesEnd() { return molecules.end(); } - NXABMInt moleculeCount() { return molecules.size(); } - - void getCounts(unsigned int& moleculeCount, unsigned int& atomCount, - unsigned int& bondCount); - - /// Does the molecule-set tree have any atoms? - bool empty(void); +public: + NXMoleculeSet(); + ~NXMoleculeSet(); + + void addChild(NXMoleculeSet* child) { children.push_back(child); } + NXMoleculeSetIterator childrenBegin() { return children.begin(); } + NXMoleculeSetIterator childrenEnd() { return children.end(); } + NXMSInt childCount() { return children.size(); } + + // + // Molecules + // + OBMol* newMolecule(); + OBMolIterator moleculesBegin() { return molecules.begin(); } + OBMolIterator moleculesEnd() { return molecules.end(); } + NXABMInt moleculeCount() { return molecules.size(); } + + void getCounts(unsigned int& moleculeCount, unsigned int& atomCount, + unsigned int& bondCount); + + /// Does the molecule-set tree have any atoms? + bool empty(void); + + void setTitle(std::string const& theTitle) { title = theTitle; } + std::string const& getTitle(void) const { return title; } + +private: + static unsigned int NextMoleculeIndex; + + std::list<NXMoleculeSet*> children; + std::list<OBMol*> molecules; + + std::string title; - private: - static unsigned int NextMoleculeIndex; - - std::list<NXMoleculeSet*> children; - std::list<OBMol*> molecules; - - void getCountsHelper(unsigned int& moleculeCount, - unsigned int& atomCount, - unsigned int& bondCount, - NXMoleculeSet* moleculeSet); + void getCountsHelper(unsigned int& moleculeCount, + unsigned int& atomCount, + unsigned int& bondCount, + NXMoleculeSet* moleculeSet); }; diff --git a/cad/plugins/NanoVision-1/src/Interface/NXAtomData.cpp b/cad/plugins/NanoVision-1/src/Interface/NXAtomData.cpp new file mode 100644 index 000000000..344877be8 --- /dev/null +++ b/cad/plugins/NanoVision-1/src/Interface/NXAtomData.cpp @@ -0,0 +1,12 @@ +// Copyright 2008 Nanorex, Inc. See LICENSE file for details. + +#include "NXAtomData.h" + +namespace Nanorex { + +char const *const NXAtomData::_s_renderStyleNames[NUM_STYLES] = +{ + "def", "inv", "vdw", "lin", "cpk", "tub" +}; + +} // Nanorex:: diff --git a/cad/plugins/NanoVision-1/src/KDevelop/Interface/Interface.pro b/cad/plugins/NanoVision-1/src/KDevelop/Interface/Interface.pro index 97fb7f9b4..65dde7ed2 100644 --- a/cad/plugins/NanoVision-1/src/KDevelop/Interface/Interface.pro +++ b/cad/plugins/NanoVision-1/src/KDevelop/Interface/Interface.pro @@ -17,7 +17,8 @@ HEADERS += \ ../../../include/Nanorex/Interface/NXSceneGraph.h \ ../../../include/Nanorex/Interface/NXTrackball.h \ ../../../include/Nanorex/Interface/NXRendererPlugin.h \ - ../../../include/Nanorex/Interface/NXRenderingEngine.h + ../../../include/Nanorex/Interface/NXRenderingEngine.h \ + ../../../include/Nanorex/Interface/NXAtomData.h INCLUDEPATH += ../../../include \ $(OPENBABEL_INCPATH) @@ -31,7 +32,8 @@ SOURCES += ../../Interface/NXDataStoreInfo.cpp \ ../../Interface/NXBondRenderData.cpp \ ../../Interface/NXNanoVisionResultCodes.cpp \ ../../Interface/NXSceneGraph.cpp \ - ../../Interface/NXRenderingEngine.cpp + ../../Interface/NXRenderingEngine.cpp \ + ../../Interface/NXAtomData.cpp TEMPLATE = lib |