00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __GDT_PointList_h__
00021 #define __GDT_PointList_h__
00022
00023 #include "GDT_API.h"
00024 #include "GDT_TokenList.h"
00025
00026 #include <GEO/GEO_Detail.h>
00027 #include "GDT_CaptureWeight.h"
00028 #include "GDT_Position.h"
00029 #include "GDT_CoordinateFrames.h"
00030
00031 class GB_PointGroup;
00032
00033 class GDT_API GDT_PointList : public GDT_TokenList
00034 {
00035 public:
00036 GDT_PointList() : myPosition(0), myCaptureWeight(0), myCoordinateFrames(0) {}
00037 GDT_PointList(const GDT_PointList &other);
00038 virtual ~GDT_PointList();
00039
00040
00041 virtual void applyDeltas(GEO_Detail &gdp, bool inverse=false) const;
00042
00043 virtual void applyScaledDelta(GEO_Detail &gdp,
00044 GEO_Point &pt, float scale) const;
00045 virtual void applyScaledPosDeltas(GEO_Detail &gdp,
00046 float scale,
00047 const GB_PointGroup *ptgroup = 0) const;
00048
00049
00050 void mergePointDeltas(const GDT_PointList &other,
00051 bool inverse = false);
00052
00053
00054 void beginPointPositionChange(const UT_Vector4 &startpos);
00055 void endPointPositionChange(const UT_Vector4 &endpos,
00056 unsigned int index);
00057
00058 void getOpPaths( UT_StringList &paths );
00059 void getOpPathsCopy( UT_PtrArray<char *> &paths );
00060 void setOpPaths( const UT_PtrArray<char *> &paths );
00061 int changeOpPaths( const char *old_name,
00062 const char *new_name );
00063 bool changeCaptureRegionRoot( const char *old_root,
00064 const char *new_root );
00065 void refreshCaptureFrameInfo(
00066 const GEO_Detail &gdp,
00067 GDT_CaptureRegionCB get_region,
00068 void *user_data );
00069 void initCaptureWeightChange( const GEO_Detail &gdp );
00070 void beginCaptureWeightChange(
00071 const GB_AttributeData &data );
00072 void endCaptureWeightChange(
00073 const GB_AttributeData &data,
00074 unsigned int point_index );
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092 virtual unsigned int getElementCount(const GEO_Detail &gdp) const
00093 { return gdp.points().entries(); }
00094
00095 virtual void initIterate() const { myLastIndex = -1; }
00096 virtual GB_AttributeElem *getNextAttributeElement(GEO_Detail &gdp) const
00097 { return gdp.points()(++myLastIndex); }
00098 virtual GB_AttributeElem *getAttributeElement(GEO_Detail &gdp,
00099 unsigned int index) const
00100 { return gdp.points()(index); }
00101
00102
00103
00104 virtual GB_AttributeDict &getAttributeDict(GEO_Detail &gdp) const
00105 { return gdp.pointAttribs(); }
00106
00107
00108 virtual int appendGdpAttribute(GEO_Detail &gdp,
00109 const char *name, int size,
00110 GB_AttribType type,
00111 const void *defvalue) const
00112 {
00113 return gdp.pointAttribs().append(
00114 name, size, type, defvalue);
00115 }
00116
00117 virtual int growGdpAttribute(GEO_Detail &gdp,
00118 const char *name, int oldsize,
00119 GB_AttribType type,
00120 unsigned int addedsize) const
00121 {
00122 return gdp.pointAttribs().grow(
00123 name, oldsize, type, addedsize);
00124 }
00125
00126 virtual bool hasChange() const;
00127 virtual bool haveAttributesChanged() const
00128 { return GDT_TokenList::hasChange(); }
00129
00130 bool hasPositionChanged() const
00131 {
00132 return (myPosition &&
00133 myPosition->changed() > 0);
00134 }
00135 bool hasCaptureWeightChanged() const
00136 {
00137 return (myCaptureWeight &&
00138 myCaptureWeight->changed() > 0);
00139 }
00140
00141 virtual unsigned int entries() const;
00142
00143 int savePos(ostream &os, int binary = 0) const;
00144
00145
00146
00147
00148
00149 bool loadPos(UT_IStream &is, uint numtotal);
00150
00151 int saveCaptureWeight(ostream &os,
00152 int binary = 0) const;
00153 bool loadCaptureWeight(UT_IStream &is,
00154 unsigned int numtotal);
00155
00156
00157 virtual void zeroDeltas();
00158
00159 virtual void clearDeltas();
00160
00161 virtual void destroy();
00162
00163 void setCoordinateFrames(const GDT_CoordinateFrames *coords);
00164 const GDT_CoordinateFrames *getCoordinateFrames();
00165
00166 void createSymmetryDeltas(const GDT_PointList &input, GDT_SymmetryTransform *transform);
00167
00168 protected:
00169
00170 virtual void getAttributeElements(const GEO_Detail &beforegdp,
00171 const GEO_Detail &aftergdp,
00172 unsigned int before_elem_index,
00173 unsigned int after_elem_index,
00174 const GB_AttributeElem *&beforeelem,
00175 const GB_AttributeElem *&afterelem) const
00176 {
00177 beforeelem = beforegdp.points()(before_elem_index);
00178 afterelem = aftergdp.points()(after_elem_index);
00179 }
00180
00181
00182 GDT_Position *newPosition(const GDT_Position &p);
00183 GDT_Position *newPosition(unsigned int numpos);
00184
00185 private:
00186
00187
00188
00189 GDT_Position *myPosition;
00190
00191 GDT_CaptureWeight *myCaptureWeight;
00192
00193 mutable int myLastIndex;
00194
00195
00196 const GDT_CoordinateFrames *myCoordinateFrames;
00197 };
00198 #endif