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), myUidx(uidx), myVidx(vidx) {}
32  : mySpline(b.mySpline), myUidx(b.myUidx), myVidx(b.myVidx) {}
34 
35  bool operator==(const GA_Breakpoint &b) const
36  {
37  return (this == &b ||
38  (mySpline == b.mySpline &&
39  myUidx == b.myUidx &&
40  myVidx == b.myVidx ));
41  }
42 
43  bool isPrimary() const
44  { return mySpline ? mySpline->isPrimary() : false; }
45 
46  // Data Access Methods
47  int u() const
48  { return myUidx; }
49  int v() const
50  { return myVidx; }
51  int getU() const
52  { return myUidx; }
53  int getV() const
54  { return myVidx; }
55  void setU(int u)
56  { myUidx = u; }
57  void setV(int v)
58  { myVidx = v; }
59 
60  const GA_Primitive *getSpline() const
61  { return mySpline; }
62  void setSpline(const GA_Primitive *p)
63  { mySpline = p; }
64 
65  /// Save data to a JSON stream.
66  /// @section JSON-GA_Breakpoint JSON Schema: GA_Breakpoint
67  /// @code
68  /// {
69  /// "name" : "GA_Breakpoint",
70  /// "description" : "An tuple describing the breakpoint.
71  /// (prim_number, uindex, vindex)",
72  /// "type" : "array",
73  /// "items" : "integer",
74  /// "minitems" : 3,
75  /// "maxitems" : 3,
76  /// }
77  /// @endcode
78  /// @see @ref JSON_FileFormat
79  bool jsonSave(UT_JSONWriter &w, const GA_SaveMap &map) const;
80 
81  /// Load from a JSON stream
82  bool jsonLoad(UT_JSONParser &p, const GA_LoadMap &map);
83 
84 private:
85  const GA_Primitive *mySpline;
86  int myUidx, myVidx;
87 };
88 
89 #endif
void setU(int u)
Definition: GA_Breakpoint.h:55
int getU() const
Definition: GA_Breakpoint.h:51
Used to pass options and map offset values during saving.
Definition: GA_SaveMap.h:48
const GLdouble * v
Definition: glcorearb.h:836
int v() const
Definition: GA_Breakpoint.h:49
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:75
#define GA_API
Definition: GA_API.h:12
Class which writes ASCII or binary JSON streams.
Definition: UT_JSONWriter.h:32
bool operator==(const GA_Breakpoint &b) const
Definition: GA_Breakpoint.h:35
int getV() const
Definition: GA_Breakpoint.h:53
const GA_Primitive * getSpline() const
Definition: GA_Breakpoint.h:60
void setV(int v)
Definition: GA_Breakpoint.h:57
Options during loading.
Definition: GA_LoadMap.h:42
GA_Breakpoint(const GA_Breakpoint &b)
Definition: GA_Breakpoint.h:31
GLboolean GLboolean GLboolean b
Definition: glcorearb.h:1221
bool isPrimary() const
Definition: GA_Breakpoint.h:43
int u() const
Definition: GA_Breakpoint.h:47
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
void setSpline(const GA_Primitive *p)
Definition: GA_Breakpoint.h:62