HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  // Overload hiding base class method which requires a GA_AIFEditDeltaMap.
47  void endAttributeChange(const GEO_Detail &gdp);
48 
49  // Begin/end a change to a point position
50  void beginPointPositionChange(const GA_Attribute *P,
51  GA_Offset element);
52  void beginPointPositionChange(const GA_Attribute *P,
53  const GA_Range &range);
54  void endPointPositionChange(const GEO_Detail &gdp);
55 
56  void getOpPaths( UT_StringList &paths );
57  void getOpPathsCopy( UT_ValArray<char *> &paths );
58  void setOpPaths( const UT_ValArray<char *> &paths );
59  int changeOpPaths( const char *old_name,
60  const char *new_name );
61  bool changeCaptureRegionRoot( const char *old_root,
62  const char *new_root );
63  void refreshCaptureFrameInfo(
64  const GEO_Detail &gdp,
65  GDT_CaptureRegionCB get_region,
66  void *user_data );
67  void initCaptureWeightChange( const GEO_Detail &gdp );
68  void beginCaptureWeightChange(
69  GA_Offset element );
70  void endCaptureWeightChange(const GEO_Detail &gdp);
71 
73  const GEO_Detail &gdp) const
74  { return gdp.pointAttribs(); }
75 
76  virtual bool hasChange() const;
77  virtual bool haveAttributesChanged() const
78  { return GDT_TokenList::hasChange(); }
79  // Returns true if point position data is present, return false otherwise
80  bool hasPositionChanged() const
81  {
82  return (myPosition &&
83  myPosition->changed() > 0);
84  }
86  {
87  return (myCaptureWeight &&
88  myCaptureWeight->changed() > 0);
89  }
90 
91  // If myPosition has been blanked out, then loadPos will pre-allocate
92  // numtotal slots in the position array. If myPosition exists, then this
93  // number is ignored and the data is loaded and merged with what already
94  // exists.
95  bool legacyLoadPos(UT_IStream &is, uint numtotal);
96 
97  bool savePos(UT_JSONWriter &w,
98  const GDT_JSON &json) const;
99  bool loadPos(UT_JSONParser &p,
100  const GDT_JSON &json);
101 
102  bool legacyLoadCaptureWeight(UT_IStream &is,
103  unsigned int numtotal);
104 
105  bool saveCaptureWeight(UT_JSONWriter &w,
106  const GDT_JSON &json) const;
107  bool loadCaptureWeight(UT_JSONParser &p,
108  const GDT_JSON &json);
109 
110  // Zero the point deltas
111  virtual void zeroDeltas();
112  // Destroy the point deltas, but not the attribute lists
113  virtual void clearDeltas();
114  // Destroy the point deltas
115  virtual void destroy();
116 
117  void setCoordinateFrames(const GDT_CoordinateFrames *coords);
118  const GDT_CoordinateFrames *getCoordinateFrames();
119 
120  void createSymmetryDeltas(const GDT_PointList &input, GDT_SymmetryTransform *transform);
121 
122 protected:
123  GDT_Position *newPosition(const GDT_Position &p);
124  GDT_Position *newPosition();
125 
126 private:
127  // The position token is kept apart from the token list, so that
128  // we can make the token list general and not have to check extra cases.
129  GDT_Position *myPosition;
130 
131  GDT_CaptureWeight *myCaptureWeight;
132 
133  const GDT_CoordinateFrames *myCoordinateFrames;
134 };
135 #endif
Definition of a geometry attribute.
Definition: GA_Attribute.h:189
#define GDT_API
Definition: GDT_API.h:10
GLenum GLint * range
Definition: glcorearb.h:1924
SYS_FORCE_INLINE const GA_AttributeDict & pointAttribs() const
Definition: GEO_Detail.h:1821
virtual void zeroDeltas()
bool hasCaptureWeightChanged() const
Definition: GDT_PointList.h:85
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:72
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:617
GA_API const UT_StringHolder scale
GA_API const UT_StringHolder transform
unsigned int uint
Definition: SYS_Types.h:33
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
virtual bool haveAttributesChanged() const
Definition: GDT_PointList.h:77
virtual const GA_AttributeDict & getAttributeDict(const GEO_Detail &gdp) const
Definition: GDT_PointList.h:72
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
void endAttributeChange(const GA_AIFEditDeltaMap &map)
virtual bool hasChange() const
virtual void clearDeltas()
virtual void destroy()
bool hasPositionChanged() const
Definition: GDT_PointList.h:80