HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GDT_PointList.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GDT Library. (Geo Delta)
7  *
8  * COMMENTS: GDT_PointList contains tokens for point attributes and
9  * a position token. All these tokens are not sparse.
10  *
11  */
12 #ifndef __GDT_PointList_h__
13 #define __GDT_PointList_h__
14 
15 #include "GDT_API.h"
16 #include "GDT_TokenList.h"
17 
18 #include <GA/GA_Types.h>
19 #include <GEO/GEO_Detail.h>
20 #include "GDT_CaptureWeight.h"
21 #include "GDT_Position.h"
22 #include "GDT_CoordinateFrames.h"
23 
24 class GA_PointGroup;
25 
27 {
28 public:
29  GDT_PointList() : myPosition(0), myCaptureWeight(0), myCoordinateFrames(0) {}
30  GDT_PointList(const GDT_PointList &other);
31  virtual ~GDT_PointList();
32 
33  // Implement the pure virtual applyDeltas() from GDT_TokenList.
34  virtual void applyDeltas(GEO_Detail &gdp, bool inverse=false) const;
35 
36  virtual void applyScaledDelta(GEO_Detail &gdp,
37  GA_Offset pt, float scale) const;
38  virtual void applyScaledPosDeltas(GEO_Detail &gdp,
39  float scale,
40  const GA_PointGroup *ptgroup = 0) const;
41 
42  // Merge the point deltas from another GDT_PointList into this one
43  void mergePointDeltas(const GDT_PointList &other,
44  bool inverse = false);
45 
46  // Reset elements with deltas to the values from the source detail.
47  void resetElementsFromSource(GEO_Detail &gdp,
48  const GEO_Detail &src_gdp) const;
49 
50  // Apply stored deltas for elements also recordered in other to the
51  // given gdp.
52  void applyIntersectionDeltas(GEO_Detail &gdp,
53  const GDT_PointList &other) const;
54 
55  // Overload hiding base class method which requires a GA_AIFEditDeltaMap.
56  void endAttributeChange(const GEO_Detail &gdp);
57 
58  // Begin/end a change to a point position
59  void beginPointPositionChange(const GA_Attribute *P,
60  GA_Offset element);
61  void beginPointPositionChange(const GA_Attribute *P,
62  const GA_Range &range);
63  void endPointPositionChange(const GEO_Detail &gdp);
64 
65  void getOpPaths( UT_StringList &paths );
66  void getOpPathsCopy( UT_ValArray<char *> &paths );
67  void setOpPaths( const UT_ValArray<char *> &paths );
68  int changeOpPaths( const char *old_name,
69  const char *new_name );
70  bool changeCaptureRegionRoot( const char *old_root,
71  const char *new_root );
72  void refreshCaptureFrameInfo(
73  const GEO_Detail &gdp,
74  GDT_CaptureRegionCB get_region,
75  void *user_data );
76  void initCaptureWeightChange( const GEO_Detail &gdp );
77  void beginCaptureWeightChange(
78  GA_Offset element );
79  void endCaptureWeightChange(const GEO_Detail &gdp);
80 
82  const GEO_Detail &gdp) const
83  { return gdp.pointAttribs(); }
84 
85  virtual bool hasChange() const;
86  virtual bool haveAttributesChanged() const
87  { return GDT_TokenList::hasChange(); }
88  // Returns true if point position data is present, return false otherwise
89  bool hasPositionChanged() const
90  {
91  return (myPosition &&
92  myPosition->changed() > 0);
93  }
95  {
96  return (myCaptureWeight &&
97  myCaptureWeight->changed() > 0);
98  }
99 
100  // If myPosition has been blanked out, then loadPos will pre-allocate
101  // numtotal slots in the position array. If myPosition exists, then this
102  // number is ignored and the data is loaded and merged with what already
103  // exists.
104  bool legacyLoadPos(UT_IStream &is, uint numtotal);
105 
106  bool savePos(UT_JSONWriter &w,
107  const GDT_JSON &json) const;
108  bool loadPos(UT_JSONParser &p,
109  const GDT_JSON &json);
110 
111  bool legacyLoadCaptureWeight(UT_IStream &is,
112  unsigned int numtotal);
113 
114  bool saveCaptureWeight(UT_JSONWriter &w,
115  const GDT_JSON &json) const;
116  bool loadCaptureWeight(UT_JSONParser &p,
117  const GDT_JSON &json);
118 
119  // Zero the point deltas
120  virtual void zeroDeltas();
121  // Destroy the point deltas, but not the attribute lists
122  virtual void clearDeltas();
123  // Destroy the point deltas
124  virtual void destroy();
125 
126  void setCoordinateFrames(const GDT_CoordinateFrames *coords);
127  const GDT_CoordinateFrames *getCoordinateFrames();
128 
129  void createSymmetryDeltas(const GDT_PointList &input, GDT_SymmetryTransform *transform);
130 
131 protected:
132  GDT_Position *newPosition(const GDT_Position &p);
133  GDT_Position *newPosition();
134 
135 private:
136  // The position token is kept apart from the token list, so that
137  // we can make the token list general and not have to check extra cases.
138  GDT_Position *myPosition;
139 
140  GDT_CaptureWeight *myCaptureWeight;
141 
142  const GDT_CoordinateFrames *myCoordinateFrames;
143 };
144 #endif
GLenum GLint * range
Definition: glew.h:3500
Definition of a geometry attribute.
Definition: GA_Attribute.h:190
GLenum GLenum GLenum input
Definition: glew.h:13879
#define GDT_API
Definition: GDT_API.h:10
SYS_FORCE_INLINE const GA_AttributeDict & pointAttribs() const
Definition: GEO_Detail.h:1891
virtual void zeroDeltas()
GLuint GLenum GLenum transform
Definition: glew.h:14742
GLenum GLenum GLenum GLenum GLenum scale
Definition: glew.h:13880
bool hasCaptureWeightChanged() const
Definition: GDT_PointList.h:94
GLenum GLuint coords
Definition: glew.h:7906
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:75
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
A range of elements in an index-map.
Definition: GA_Range.h:42
A string map of attributes to ease backward compatibility In the GB/GEO/GU library code would often p...
GA_Size GA_Offset
Definition: GA_Types.h:637
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
unsigned int uint
Definition: SYS_Types.h:44
int(* GDT_CaptureRegionCB)(void *user_data, char *cregion, UT_Matrix4 &parent_xform, GU_DetailHandle &tube_gdp)
virtual void applyDeltas(GEO_Detail &gdp, bool inverse=0) const =0
GLfloat GLfloat p
Definition: glew.h:16321
virtual bool haveAttributesChanged() const
Definition: GDT_PointList.h:86
virtual const GA_AttributeDict & getAttributeDict(const GEO_Detail &gdp) const
Definition: GDT_PointList.h:81
void endAttributeChange(const GA_AIFEditDeltaMap &map)
virtual bool hasChange() const
virtual void clearDeltas()
virtual void destroy()
GLenum const void * paths
Definition: glew.h:13589
bool hasPositionChanged() const
Definition: GDT_PointList.h:89