00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __GEO_Vertex_H__
00025 #define __GEO_Vertex_H__
00026
00027 #include "GEO_API.h"
00028 #include <GB/GB_Vertex.h>
00029 #include <GB/GB_Attribute.h>
00030 #include "GEO_Point.h"
00031
00032 class GEO_Detail;
00033
00034 class GEO_API GEO_Vertex : public GB_Vertex, public GB_AttributeElem
00035 {
00036 public:
00037 explicit GEO_Vertex( GEO_Point *p=0) : GB_Vertex(p) {}
00038 explicit GEO_Vertex(GEO_Detail *d,GEO_Point *p=0) : GB_Vertex(p)
00039 { initAttributeData(d); }
00040
00041 virtual ~GEO_Vertex() { }
00042
00043
00044 GEO_Vertex(const GEO_Vertex &vtx)
00045 : GB_Vertex(vtx.getBasePt()), GB_AttributeElem(vtx) {}
00046
00047 void initAttributeData(GEO_Detail *d);
00048 void swapAttributeData(GEO_Vertex &v);
00049
00050 GEO_Point *getPt(void) const { return (GEO_Point*)getBasePt(); }
00051
00052 UT_Vector4 &getPos()
00053 {
00054 return ((GEO_Point*)getBasePt())->getPos();
00055 }
00056 const UT_Vector4 &getPos() const
00057 {
00058 return ((const GEO_Point*)getBasePt())->getPos();
00059 }
00060 void setPos(const UT_Vector4 &p)
00061 { getPt()->setPos(p); }
00062 void setPos(const UT_Vector3 &p, float w=1)
00063 { getPt()->setPos(p, w); }
00064 void setPos(fpreal x, fpreal y, fpreal z, fpreal w=1)
00065 { getPt()->setPos(x, y, z, w); }
00066
00067 void steal(GEO_Vertex &src)
00068 {
00069 GB_Vertex::steal(src);
00070 getAttrib().steal(src.getAttrib());
00071 }
00072
00073
00074 void SYS_DEPRECATED copyAttributeData(const GEO_Vertex *src, int size);
00075
00076
00077 void SYS_DEPRECATED copyVertex(const GEO_Vertex *src, GEO_Point *pt,
00078 int avsize);
00079
00080
00081 void SYS_DEPRECATED copyVertex(const GEO_Vertex *src, int avsize);
00082
00083
00084 void copyVertex(const GEO_Vertex &src, GEO_Point *pt,
00085 const GB_AttributeDict &vertex_dict)
00086 {
00087 setPt(pt);
00088 copyAttributeValues(src, vertex_dict);
00089 }
00090 void copyVertex(const GEO_Vertex &src,
00091 const GB_AttributeDict &vertex_dict)
00092 {
00093 setPt(src.getBasePt());
00094 copyAttributeValues(src, vertex_dict);
00095 }
00096 void copyVertex(const GEO_Vertex &v,
00097 const GB_AttributeDict &point_dict,
00098 const GB_AttributeDict &vertex_dict,
00099 bool copyP=true)
00100 {
00101 if (copyP)
00102 setPos(v.getPos());
00103 getPt()->copyAttributeValues(*(v.getPt()),
00104 point_dict);
00105 copyAttributeValues(v, vertex_dict);
00106 }
00107
00108
00109 GEO_Vertex &operator=(const GEO_Vertex &vtx)
00110 {
00111 if (this != &vtx)
00112 {
00113 setPt(vtx.getBasePt());
00114 getAttrib() = vtx.getAttrib();
00115 }
00116 return *this;
00117
00118 }
00119 int operator==(const GEO_Vertex &vtx) const
00120 {
00121
00122 return this == &vtx;
00123 }
00124
00125 private:
00126
00127 };
00128
00129 #endif