-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVisAtomSample.h
278 lines (220 loc) · 9.4 KB
/
VisAtomSample.h
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
/* This is a class used for in VisAtom, a visualiztion tool for
atomistic simulations.
AUTHOR: Qing HOU
INSTITUTION: Institute of Nuclear Science and Technology, Sichuan University
HISTROTY: First version: 1998
LAST MODIFICATION: 2013
*/
#ifndef _VISATOMSAMPLE_H
#define _VISATOMSAMPLE_H
#include "GlcObj.h"
#include "Scene.h"
#include "VisAtomSubSample.h"
#define atom_Statu_Invisiable 0
#define atom_Statu_Visiable 1
#define atom_Statu_Selected 2
#define atom_Statu_MarkedFound 4
#define atom_Statu_Deleted 8
#define file_format_Simple 0
#define atom_pick_Option_Single 0
#define atom_pick_Option_Subsample 1
#define atom_pick_Option_Multiple 2
#define atom_pick_Option_Square 3
#define atom_pick_Option_Tripoints 4
#define atom_pick_Statu_nopicked 0
#define atom_pick_Statu_picked 1
#define atom_pick_Statu_doublepicked 2
#define atom_pick_Statu_droped 4
#define sample_Statu_noChange 0
#define sample_Statu_Changed 1
class VisAtomDataSheet;
class VisAtomCliper;
class VisAtomTrajectory;
class VisAtomSample:public GlcObj
{
private:
//************ New or modified 2013-09 ************************
//
void ResetVisibilityByCliper();
void ResetVisibilityByCliper_OR(VisAtomCliper*cliper);
void ResetVisibilityByCliper_OR_ALSO(VisAtomCliper*cliper);
void ResetVisibilityByCliper_AND(VisAtomCliper*cliper);
void ResetVisibilityByCliper_ANYDIR();
bool IsCliped(double c, double n, float p) {if((p-c)*n > 0) return true; else return false;}
void SetStatAsHide(char&visstat){ char j; j = (visstat>>1); visstat = (j<<1);}
protected:
VisAtomDataSheet*m_pData;
QList<VisAtomCliper*>m_pCliper;
int m_numAtom;
char *m_aType;
float *m_aPx, *m_aPy, *m_aPz;
//display parameter for atoms
char *m_aVisStat;
float *m_aRadius;
float *m_aRed, *m_aGreen, *m_aBlue;
float *m_aRedex, *m_aGreenex, *m_aBlueex;
int *m_aGeomStyle;
//display parameter for vectors
float *m_vPx, *m_vPy, *m_vPz;
// the box range automatically determined by position of atoms
float m_aXmi, m_aXmx, m_aYmi, m_aYmx, m_aZmi, m_aZmx;
QList<VisAtomSubSample*> m_subSamples;
QList<int> m_selSubsamples;
int m_curSubsample;
int m_pick_style, m_pick_statu;
int m_pick_posx, m_pick_posy;
int m_pickedAtomID;
int statu;
VisAtomTrajectory*m_pTrajectory;
friend class VisAtomTrajectory;
public:
VisAtomSample();
~VisAtomSample();
void Clear(bool keepsubsample=false);
void SetDataSheet(VisAtomDataSheet*pData);
VisAtomDataSheet*GetDataSheet(){ return m_pData;}
int NumberofAtom(){return m_numAtom;};
int GetSampleType(int*);
int GetSampleX(float*);
int GetSampleY(float*);
int GetSampleZ(float*);
char* GetSampleTypeP(){if(m_aType != NULL) return m_aType; else return NULL;};
float*GetSampleXP(){if(m_aPx != NULL) return m_aPx; else return NULL;};
float*GetSampleYP(){if(m_aPy != NULL) return m_aPy; else return NULL;};
float*GetSampleZP(){if(m_aPz != NULL) return m_aPz; else return NULL;};
void AutoSampleBoxRange();
void GetSampleBoxRangeX(float&xmi, float&xmx){xmi = m_aXmi; xmx = m_aXmx;};
void GetSampleBoxRangeY(float&ymi, float&ymx){ymi = m_aYmi; ymx = m_aYmx;};
void GetSampleBoxRangeZ(float&zmi, float&zmx){zmi = m_aZmi; zmx = m_aZmx;};
void GetDefaultAtomRadiu(float&radiu, float&scal);
void GetDefaultVectorSize(float&lenscal, float&rad, float&arrowl, float&arrowr);
int NumberofSubsample(){ return m_subSamples.count();};
VisAtomSubSample*GetSubsample(int i){return m_subSamples[i];};
VisAtomSubSample*GetSubsample(QString name)
{ for(int i=0; i<m_subSamples.count(); i++)
if(m_subSamples[i]->GetName() == name) return m_subSamples[i];
return NULL;
};
void SetCurrentSubsample(int subsample){m_curSubsample = subsample; };
int SetCurrentSubsample(QString name)
{ for(int i=0; i<m_subSamples.count(); i++)
if(m_subSamples[i]->GetName() == name) { m_curSubsample = i; return m_curSubsample;}
return -1; };
int GetCurrentSubsampleID() { return m_curSubsample; };
VisAtomSubSample*GetCurrentSubsample(){ return m_subSamples[m_curSubsample]; };
bool IsCurrentSample(QString name)
{
if(name == m_subSamples[m_curSubsample]->GetName() ) return true;
else return false;
}
int SetSelSubsample(QString name)
{ for(int i=0; i<m_subSamples.count(); i++)
if(m_subSamples[i]->GetName() == name) { m_selSubsamples[i] = 1; return i;}
return -1; };
int SetUnselSubsample(QString name)
{ for(int i=0; i<m_subSamples.count(); i++)
if(m_subSamples[i]->GetName() == name) { m_selSubsamples[i] = 0; return i;}
return -1; };
int IsSelectedSubsample(int i)
{ return m_selSubsamples[i];}
//This part concerning display property
virtual void Paint();
void Draw();
void DrawSolidAtoms(int inbox);
void DrawWireAtoms(int inbox);
void DrawDotAtoms(int inbox);
void DrawCircleAtoms(int inbox);
void DrawLineVectors(int inbox);
void DrawSolidVectors(int inbox);
void DrawColorMappinBar(int*lablepos);
void DrawWignerSeizVolume(QString fname);
void DrawProjCirleAtoms(int nx, int ny, int nz);
void DrawProjSolidAtoms(int nx, int ny, int nz);
void DrawProjDotAtoms(int nx, int ny, int nz);
void HighlightSelectedAtoms();
void HighlightFoundAtoms();
void Save_Summary(FILE*);
void Save_Config_Selected(FILE*);
void Save_Config_PickedSubsample(FILE*);
void Save_Config_VisiableAtoms(FILE*);
void Save_Config(FILE*);
int NumberofVisiableAtom();
//Part concerning statu
int IfChanged();
void FinishChange();
int GetPickStatu();
int GetPickOption();
void ClearPickStatu();
void SetPickOption(int);
int PickAtom(int, int, Scene*, float*, float*, float*);
int PickSingle(int, int, Scene*, float*, float*, float*);
int PickMultiple(int, int, Scene*, float*, float*, float*);
int PickSquare(int, int, int, Scene*, float*, float*, float*);
int PickTriPoints(int, int, Scene*, float*, float*, float*);
int MovePickedAtom(int, int, Scene*, float*, float*, float*);
int MoveSinglePicked(int, int, Scene*, float*, float*, float*);
int MoveMultiplePicked(int, int, Scene*, float*, float*, float*);
int MoveSubsamplePicked(int, int, Scene*, float*, float*, float*);
int DropPickedAtom(int, int, Scene*,float*, float*, float*);
int DropSinglePicked(int, int, Scene*);
int InformPickedAtom(int*, int*, float*, float*, float*);
int Inf_of_SinglePicked(int*, int*, float*, float*, float*);
int Move_aAtom(float, float, float);
void Move_SelectedAtoms(float, float, float);
void Move_aAtomGroup(int, float, float, float);
void Move_aAtomGroup(float, float, float);
//*** this part concering the operation on atoms
int GetCurAtom();
void SetCurAtom(int id);
int GetTypeofCurAtom();
float GetXofCurAtom();
float GetYofCurAtom();
float GetZofCurAtom();
void Show_aAtom(int);
void Show_aAtom();
void Hide_aAtom(int);
void Hide_aAtom();
void Hide_SelectedAtoms();
void Hide_unSelectedAtoms();
void Show_SelectedAtoms();
void Show_unSelectedAtoms();
void Show_AllAtoms();
void Hide_AllAtoms();
void Select_aAtom(int);
void Select_aAtom();
void unSelect_aAtom(int);
void unSelect_aAtom();
void unSelect_Atoms(int from, int to);
void unSelect_aAtomGroup(int);
void unSelect_aAtomGroup();
void unSelect_AllAtoms();
//************ New or modified 2013-09 ************************
//
//*** this part concerning the clipping of scene
void SetCliper(QList<VisAtomCliper*>clip);
void AddCliper(VisAtomCliper*clip);
void ResetVisibility();
//*** this part concering the operation on atoms
void LoadSubsampleProp(int is);
void LoadCurSubsampleProp(){if(m_curSubsample>=0) LoadSubsampleProp(m_curSubsample);}
void SetAtomRadiusForSubsample(int is, float radius){ m_subSamples[is]->SetCurAtomSize(radius);};
void SetAtomShapeStyleForSubsample(int is, int style){ m_subSamples[is]->SetCurAtomShapeStyle(style);};
void SetColorForSubsample(int is, float R, float G, float B, float A=1.f){ m_subSamples[is]->SetCurColor(R, G, B, A);};
void SetAtomRadiusForCurrentSubsample(float radius)
{if(m_curSubsample>=0) SetAtomRadiusForSubsample(m_curSubsample, radius);};
void SetAtomShapeStyleForCurrentSubsample(int style)
{if(m_curSubsample>=0) SetAtomShapeStyleForSubsample(m_curSubsample, style);};
void SetColorForCurrentSubsample(float R, float G, float B, float A=1.f)
{if(m_curSubsample>=0) SetColorForSubsample(m_curSubsample, R, G, B);};
VisAtomVisualizingPolicy*GetSubsampleVisualPolicy(QString name, int policy);
//****
void AttachTrajectory(VisAtomTrajectory*pTraject);
VisAtomTrajectory*GetTrajectoryData(){return m_pTrajectory;};
//***
void MarkAtomsFound(int from, int to, int step);
void MarkGroupAtomsFound(int group, int from, int to);
void RemoveAtomsFoundMark();
void SetShowOnlyAtomsFound(int showonly);
void GeNextAtomMarkedFound(int here, int&gid, int&ingr, float&posx, float&posy, float&posz);
};
#endif