C++ main module for gpm Package  1.0
GPM_Vertex.h
Go to the documentation of this file.
1 #ifndef GPM_Vertex_H
2 #define GPM_Vertex_H
3 
4 #include "GPM_GraphElement.h"
5 
6 
7 
8 
17  SP_OBJECT(GPM_Vertex);
18  // ATTRIBUTES
19 
20 public:
21  static const tFlag X;
22  static const tFlag Y;
23  static const tFlag Z;
24  static double R;
25 
26 
27 
28 private:
29 
30  double *mCoord;
31  double *mTriggerCoord;
32  tFlag *mTriggerCoordAction;
33 
34 protected:
35  // METHODS
36 
37  // CONSTRUCTORS
38 
40  GPM_Vertex(void);
41 
42 
43 
44  // DESTRUCTORS
45 
46 
49  virtual ~GPM_Vertex(void);
50 
51 
52 public:
53 
54  // NEW methods
55 
56 
57  // SET & GET methods
58 
61  virtual void copy(const GPM_GraphElement& node);
62 
63 
64  // COORDINATES
65  // ===========
66 
67 
70  inline void setCoordinates(const double& x,const double& y, const double& z) {
71  mCoord[X]=x;
72  mCoord[Y]=y;
73  mCoord[Z]=z;
74  }
77  inline void setCoordinates(const tReal* X) {
78  setCoordinates(X[0],X[1],X[2]);
79  }
82  inline void setCoordinates(const double* X) {
83  setCoordinates(X[0],X[1],X[2]);
84 
85  }
86 
89  inline void setCoordinate(const tFlag& k,const double& x) {
90  mCoord[k]=x;
91  }
92 
95  inline const double* getCoordinates() const {
96  return &mCoord[0];
97  }
100  inline double* getCoordinates() {
101  return &mCoord[0];
102  }
103 
106  inline void getCoordinates(double coord[3]) const {
107  for (int k=0;k<3;k++) coord[k]=mCoord[k];
108 
109 
110  }
113  inline double getCoordinate(const tFlag& k) const {
114  return mCoord[k];
115 
116  }
117 
118 
121  virtual tBoolean setTriggerCoordinates(const tFlag& action,const double* value);
124  const double* getTriggerCoordinates() const {
125  return mTriggerCoord;
126  }
129  inline tBoolean setTriggerCoordinates(const tFlag& action,const double& x,const double& y,const double& z) {
130  double v[3];
131  v[0]=x;
132  v[1]=y;
133  v[2]=z;
134  return setTriggerCoordinates(action,v);
135  }
138  virtual tBoolean setTriggerCoordinate(const tFlag& action,const int& k,const double& v);
139 
142  virtual void clearActions() {
144  for (int k=0;k<3;k++) mTriggerCoordAction[k]=UNSET;
145  }
146 
149  virtual void executeTriggerActions() {
151  if (mTriggerCoord!=null) {
152  for (int k=0;k<3;k++) {
153  if (mTriggerCoordAction[k]!=UNSET) {
154  setCoordinate(k,mTriggerCoord[k]);
155  mTriggerCoordAction[k]=UNSET;
156  }
157  }
158  }
159  }
160 
163  virtual tString getGroupCoordinatesName(const tReal& eps) const;
167  return getGroupCoordinatesName(R);
168  }
169 
174  virtual tBoolean canMerge(const GPM_Vertex& elt) const;
175 
176  // IO methods
179  virtual void saveToStream(ofstream& f) const;
182  virtual tBoolean loadFromStream(tString& tokenizer);
183 
186  virtual tString toString() const;
187 };
188 
189 #endif
virtual void copy(const GPM_GraphElement &node)
copy
Definition: GPM_Vertex.cpp:96
static double R
Definition: GPM_Vertex.h:24
virtual tBoolean setTriggerCoordinates(const tFlag &action, const double *value)
set trigger coordinate action
double getCoordinate(const tFlag &k) const
get k-coordinate
Definition: GPM_Vertex.h:113
virtual tBoolean canMerge(const GPM_Vertex &elt) const
return true if the graph element can be merge with elt
Definition: GPM_Vertex.cpp:192
void setCoordinates(const double &x, const double &y, const double &z)
set coordinate
Definition: GPM_Vertex.h:70
virtual void executeTriggerActions()
execute trigger actions
Definition: GPM_Vertex.h:149
virtual tBoolean loadFromStream(tString &tokenizer)
Definition: GPM_Vertex.cpp:109
void setCoordinate(const tFlag &k, const double &x)
set coordinate
Definition: GPM_Vertex.h:89
const double * getTriggerCoordinates() const
get trigger coordinate
Definition: GPM_Vertex.h:124
virtual tString toString() const
to string
Definition: GPM_Vertex.cpp:248
#define tBoolean
Definition: types.h:35
static const tFlag X
Definition: GPM_Vertex.h:21
#define null
Definition: types.h:13
This class describes a node.
Definition: GPM_Vertex.h:16
virtual ~GPM_Vertex(void)
destroy an object.
Definition: GPM_Vertex.cpp:26
void getCoordinates(double coord[3]) const
get coordinates
Definition: GPM_Vertex.h:106
GPM_Vertex(void)
create an object
Definition: GPM_Vertex.cpp:10
DEFINE_SPTR(GPM_Vertex)
static const tFlag Z
Definition: GPM_Vertex.h:23
const double * getCoordinates() const
get coordinates
Definition: GPM_Vertex.h:95
DEFINE_SVPTR(GPM_Vertex)
static const tFlag Y
Definition: GPM_Vertex.h:22
virtual void clearActions()
clear actions
Definition: GPM_Vertex.h:142
virtual void executeTriggerActions()
execute trigger actions
Definition: GPM_GraphElement.cpp:441
void setCoordinates(const tReal *X)
set coordinates
Definition: GPM_Vertex.h:77
tString getGroupCoordinatesName() const
update the group name using coordinate
Definition: GPM_Vertex.h:166
virtual void clearActions()
clear actions
Definition: GPM_GraphElement.cpp:431
#define tString
Definition: types.h:36
tBoolean setTriggerCoordinates(const tFlag &action, const double &x, const double &y, const double &z)
set trigger coordinates action
Definition: GPM_Vertex.h:129
virtual void saveToStream(ofstream &f) const
Definition: GPM_Vertex.cpp:105
void setCoordinates(const double *X)
set coordinates
Definition: GPM_Vertex.h:82
#define tReal
Definition: types.h:18
double * getCoordinates()
get coordinates
Definition: GPM_Vertex.h:100
virtual tBoolean setTriggerCoordinate(const tFlag &action, const int &k, const double &v)
set trigger coordinates action
Definition: GPM_Vertex.cpp:63
This class describes an element of a graph.
Definition: GPM_GraphElement.h:17
#define tFlag
Definition: types.h:14