summaryrefslogtreecommitdiff
path: root/cad/plugins/NanoVision-1/include/Nanorex/Interface/NXAtomData.h
blob: c130ba27a34da433d9c965d11a7eaa48b0dfb8d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// Copyright 2008 Nanorex, Inc.  See LICENSE file for details.

#ifndef NX_ATOMDATA_H
#define NX_ATOMDATA_H

#include <openbabel/generic.h>
#define NXAtomDataType OBGenericDataType::CustomData1

#ifndef OB_ATOM_H
#include <openbabel/atom.h>
#endif

using namespace OpenBabel;

#include <string>
#include <cassert>

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(int atomicNum)
	{ _type = NXAtomDataType; _atomicNum = atomicNum; }
    
	void setAtomicNum(int atomicNum) { _atomicNum = atomicNum; }
	int const& getAtomicNum(void) const { return _atomicNum; }
	
	void setIdx(int idx) { _idx = idx; }
    int getIdx() const { return _idx; }
    
	// void SetRenderStyle(RenderStyleID rsid) { _rsid = rsid; }
	// RenderStyleID const& GetRenderStyle(void) const { return _rsid; }
    
	void setRenderStyleCode(std::string const& renderStyleCode) {
		_renderStyleCode = renderStyleCode;
	}
	std::string const& getRenderStyleCode(void) const {
		return _renderStyleCode;
	}
	
	void setDnaBaseName(char const& name) { dnaBaseName = name; }
	char const& getDnaBaseName(void) const { return dnaBaseName; }
	
	std::vector<void const*> const& getSupplementalData(void) const
	{ return supplementalData; }
	
	void setSupplementalData(std::vector<void const *> const& suppData)
	{ supplementalData = suppData; }
	
	void addSupplementalData(void const *dataPtr)
	{ supplementalData.push_back(dataPtr); }
	
	// static char const *const GetRenderStyleName(RenderStyleID rsid)
	// { return _s_renderStyleNames[rsid]; }
    
private:
	
	int _atomicNum;
	int _idx;
	std::string _renderStyleCode;
	char dnaBaseName;
	std::vector<void const*> supplementalData;
	
	// static char const *const _s_renderStyleNames[NUM_STYLES];
};


/// @fixme relocate to a better place
inline int get_NV1_atom_idx(OBAtom *const atomPtr)
{
	assert(atomPtr->HasData(NXAtomDataType));
	NXAtomData *atomData = static_cast<NXAtomData*>(atomPtr->GetData(NXAtomDataType));
	int idx = atomData->getIdx();
	return idx;
}



} // Nanorex::

#endif // NX_ATOM_H