HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GA_Breakpoint.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: GA_Breakpoint.h ( GA Library, C++)
7  *
8  * COMMENTS: A simple class representing a breakpoint on a spline
9  * (curve or surface).
10  *
11  */
12 
13 #ifndef __GA_Breakpoint_h__
14 #define __GA_Breakpoint_h__
15 
16 #include "GA_API.h"
17 #include "GA_Primitive.h"
18 
19 class GA_LoadMap;
20 class GA_SaveMap;
21 
22 class UT_JSONParser;
23 class UT_JSONWriter;
24 
25 
27 {
28 public:
29  GA_Breakpoint(const GA_Primitive *prim = 0, int uidx = -1, int vidx = -1)
30  : mySpline(prim)
31  , myUidx(uidx)
32  , myVidx(vidx)
33  {
34  }
35  GA_Breakpoint(const GA_Breakpoint &b) = default;
37 
38  bool operator==(const GA_Breakpoint &b) const
39  {
40  return (this == &b ||
41  (mySpline == b.mySpline &&
42  myUidx == b.myUidx &&
43  myVidx == b.myVidx ));
44  }
45 
46  bool isPrimary() const
47  { return mySpline ? mySpline->isPrimary() : false; }
48 
49  // Data Access Methods
50  int u() const
51  { return myUidx; }
52  int v() const
53  { return myVidx; }
54  int getU() const
55  { return myUidx; }
56  int getV() const
57  { return myVidx; }
58  void setU(int u)
59  { myUidx = u; }
60  void setV(int v)
61  { myVidx = v; }
62 
63  const GA_Primitive *getSpline() const
64  { return mySpline; }
65  void setSpline(const GA_Primitive *p)
66  { mySpline = p; }
67 
68  /// Save data to a JSON stream.
69  /// @section JSON-GA_Breakpoint JSON Schema: GA_Breakpoint
70  /// @code
71  /// {
72  /// "name" : "GA_Breakpoint",
73  /// "description" : "An tuple describing the breakpoint.
74  /// (prim_number, uindex, vindex)",
75  /// "type" : "array",
76  /// "items" : "integer",
77  /// "minitems" : 3,
78  /// "maxitems" : 3,
79  /// }
80  /// @endcode
81  /// @see @ref JSON_FileFormat
82  bool jsonSave(UT_JSONWriter &w, const GA_SaveMap &map) const;
83 
84  /// Load from a JSON stream
85  bool jsonLoad(UT_JSONParser &p, const GA_LoadMap &map);
86 
87 private:
88  const GA_Primitive *mySpline;
89  int myUidx, myVidx;
90 };
91 
92 #endif
void setU(int u)
Definition: GA_Breakpoint.h:58
int getU() const
Definition: GA_Breakpoint.h:54
Used to pass options and map offset values during saving.
Definition: GA_SaveMap.h:48
const GLdouble * v
Definition: glcorearb.h:837
int v() const
Definition: GA_Breakpoint.h:52
GA_Breakpoint(const GA_Primitive *prim=0, int uidx=-1, int vidx=-1)
Definition: GA_Breakpoint.h:29
JSON reader class which handles parsing of JSON or bJSON files.
Definition: UT_JSONParser.h:87
#define GA_API
Definition: GA_API.h:14
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:37
bool operator==(const GA_Breakpoint &b) const
Definition: GA_Breakpoint.h:38
int getV() const
Definition: GA_Breakpoint.h:56
const GA_Primitive * getSpline() const
Definition: GA_Breakpoint.h:63
void setV(int v)
Definition: GA_Breakpoint.h:60
Options during loading.
Definition: GA_LoadMap.h:42
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1222
bool isPrimary() const
Definition: GA_Breakpoint.h:46
int u() const
Definition: GA_Breakpoint.h:50
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
void setSpline(const GA_Primitive *p)
Definition: GA_Breakpoint.h:65