Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __igtlPointMessage_h
00018 #define __igtlPointMessage_h
00019
00020 #include <vector>
00021 #include <string>
00022
00023 #include "igtlObject.h"
00024
00025 #include "igtlMath.h"
00026 #include "igtlMessageBase.h"
00027 #include "igtlTypes.h"
00028
00029 #include "igtlImageMessage.h"
00030
00031 namespace igtl
00032 {
00033
00034 class IGTLCommon_EXPORT PointElement: public Object
00035 {
00036 public:
00037 typedef PointElement Self;
00038 typedef Object Superclass;
00039 typedef SmartPointer<Self> Pointer;
00040 typedef SmartPointer<const Self> ConstPointer;
00041
00042 igtlTypeMacro(igtl::PointElement, igtl::Object);
00043 igtlNewMacro(igtl::PointElement);
00044
00045 public:
00046 int SetName(const char* name);
00047 const char* GetName() { return this->m_Name.c_str(); };
00048
00049 int SetGroupName(const char* grpname);
00050 const char* GetGroupName() { return this->m_GroupName.c_str(); };
00051
00052 void SetRGBA(igtlUint8 rgba[4]);
00053 void SetRGBA(igtlUint8 r, igtlUint8 g, igtlUint8 b, igtlUint8 a);
00054 void GetRGBA(igtlUint8* rgba);
00055 void GetRGBA(igtlUint8& r, igtlUint8& g, igtlUint8& b, igtlUint8& a);
00056
00057 void SetPosition(igtlFloat32 position[3]);
00058 void SetPosition(igtlFloat32 x, igtlFloat32 y, igtlFloat32 z);
00059 void GetPosition(igtlFloat32* position);
00060 void GetPosition(igtlFloat32& x, igtlFloat32& y, igtlFloat32& z);
00061
00062 void SetRadius(igtlFloat32 radius) { this->m_Radius = radius; };
00063 igtlFloat32 GetRadius() { return this->m_Radius; };
00064
00065 int SetOwner(const char* owner);
00066 const char* GetOwner() { return this->m_Owner.c_str(); };
00067
00068 protected:
00069 PointElement();
00070 ~PointElement();
00071
00072 protected:
00073
00074 std::string m_Name;
00075 std::string m_GroupName;
00076 igtlUint8 m_RGBA[4];
00077 igtlFloat32 m_Position[3];
00078 igtlFloat32 m_Radius;
00079 std::string m_Owner;
00080 };
00081
00082
00083 class IGTLCommon_EXPORT GetPointMessage: public MessageBase
00084 {
00085 public:
00086 typedef GetPointMessage Self;
00087 typedef MessageBase Superclass;
00088 typedef SmartPointer<Self> Pointer;
00089 typedef SmartPointer<const Self> ConstPointer;
00090
00091 igtlTypeMacro(igtl::GetPointMessage, igtl::MessageBase);
00092 igtlNewMacro(igtl::GetPointMessage);
00093
00094 protected:
00095 GetPointMessage() : MessageBase() { this->m_DefaultBodyType = "GET_POINT"; };
00096 ~GetPointMessage() {};
00097 protected:
00098 virtual int GetBodyPackSize() { return 0; };
00099 virtual int PackBody() { AllocatePack(); return 1; };
00100 virtual int UnpackBody() { return 1; };
00101 };
00102
00103
00104 class IGTLCommon_EXPORT PointMessage: public MessageBase
00105 {
00106 public:
00107 typedef PointMessage Self;
00108 typedef MessageBase Superclass;
00109 typedef SmartPointer<Self> Pointer;
00110 typedef SmartPointer<const Self> ConstPointer;
00111
00112 igtlTypeMacro(igtl::PointMessage, igtl::MessageBase);
00113 igtlNewMacro(igtl::PointMessage);
00114
00115 public:
00116 int AddPointElement(PointElement::Pointer& elem);
00117 void ClearPointElement();
00118
00119 int GetNumberOfPointElement();
00120 void GetPointElement(int index, PointElement::Pointer& elem);
00121
00122
00123 protected:
00124 PointMessage();
00125 ~PointMessage();
00126
00127 protected:
00128
00129 virtual int GetBodyPackSize();
00130 virtual int PackBody();
00131 virtual int UnpackBody();
00132
00133 std::vector<PointElement::Pointer> m_PointList;
00134
00135 };
00136
00137
00138 }
00139
00140 #endif // _igtlPointMessage_h
00141
00142
00143
00144