MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
Context.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 
6 #ifndef _MGContext_HH_
7 #define _MGContext_HH_
8 
9 #include "mg/Pvector.h"
10 #include "mg/Attrib.h"
11 #include "mgGL/Color.h"
12 #include "mgGL/Appearance.h"
13 #include "mgGL/SnapAttrib.h"
14 #include "mgGL/glViewAttrib.h"
15 #include "Tl2/TLInputParam.h"
16 
18 
19 class MGOpenGLView;
20 class MGOfstream;
21 class MGIfstream;
22 
27 
33 class MG_DLL_DECLR MGContext: public MGAttrib{
34 
35 public:
36 
37 MGContext();
38 MGContext(const MGBox& bx);
39 
40 MGContext(
41  const MGSnapAttrib& snap_attrib,
42 
43  int line_density,
44  const MGColor& Bcolor,
45  const MGColor& Gcolor,
46  const MGColor& Hcolor,
47  float smooth,
48  float pick_aperture,
51  const MGglViewAttrib& view,
52  const MGColor gridColor[4],
53 
54  const int gridNum[2],
55  const double gridSpan[2],
56 
57  const double torelance[6],
58  const mgTLInputParam& tessellate_param,
65  MGAppearance* appearance=0
66 );
68 
70 MGContext(const MGContext& context);
71 
73 
74 ~MGContext();
75 
77 void InitializeCPlane(const MGBox& box);
78 
80 MGContext& operator=(const MGGel& gel2);
81 MGContext& operator=(const MGContext& gel2);
82 
84 bool operator<(const MGContext& gel2)const;
85 bool operator<(const MGGel& gel2)const;
86 
89 MGContext* clone()const{return new MGContext(*this);};
90 
92 const MGSnapAttrib& snap_attrib()const{return m_snap_attrib;}; //Snap data
93 MGSnapAttrib& snap_attrib(){return m_snap_attrib;}; //Snap data
94 void set_snap_attrib(const MGSnapAttrib& snap_attrib){m_snap_attrib=snap_attrib;};
95 
96 //set/get line_density attrib data.
97 int line_density()const{return m_line_density;};
98 void set_line_density(int line_density){m_line_density=line_density;};
99 
101 
103 const MGColor& Bcolor()const{return m_Bcolor;};
104 
106 MGColor& Bcolor(){return m_Bcolor;};
107 
109 void set_Bcolor(const MGColor& Bcolor);
110 
112 const MGColor& Gcolor()const{return m_Gcolor;};
113 
115 MGColor& Gcolor(){return m_Gcolor;};
116 
118 void set_Gcolor(const MGColor& Gcolor);
119 
121 const MGColor& Hcolor()const{return m_Hcolor;};
122 
124 MGColor& Hcolor(){return m_Hcolor;};
125 
127 void set_Hcolor(const MGColor& Hcolor);
128 
129 
132 const MGColor* gridColors()const{return m_gridColor;};
133 const int* gridNum()const{return m_gridNum;};
134 const double* gridSpan()const{return m_gridSpan;};
135 void set_gridColors(const MGColor gridColor[4]);
136 void set_gridNum(const int gridNum[2]);
137 void set_gridSpan(const double gridSpan[2]);
138 
139 // Grid color operations.
141 const MGColor& gridColor()const{return m_gridColor[0];};
142 
144 MGColor& gridColor(){return m_gridColor[0];};
145 
147 void set_gridColor(const MGColor& color){m_gridColor[0] = color;};
148 
149 // X-axis(u-axis) color operations.
151 const MGColor& axisXcolor()const{return m_gridColor[1];};
152 
154 MGColor& axisXcolor(){return m_gridColor[1];};
155 
157 void set_axisXcolor(const MGColor& color){m_gridColor[1] = color;};
158 
159 // Y-axis(v-axis) color operations.
161 const MGColor& axisYcolor()const{return m_gridColor[2];};
162 
164 MGColor& axisYcolor(){return m_gridColor[2];};
165 
167 void set_axisYcolor(const MGColor& color){m_gridColor[2] = color;};
168 
169 // Z-axis color operations.
171 const MGColor& axisZcolor()const{return m_gridColor[3];};
172 
174 MGColor& axisZcolor(){return m_gridColor[3];};
175 
177 void set_axisZcolor(const MGColor& color){m_gridColor[3] = color;};
178 
182 float smooth()const{return m_smooth;};
183 
184 void set_smooth(float smooth){m_smooth=smooth;};
185 
188 float pick_aperture()const{return m_pick_aperture;};
189 void set_pick_aperture(double pick_aperture){m_pick_aperture=float(pick_aperture);};
190 void set_pick_aperture(float pick_aperture){m_pick_aperture=pick_aperture;};
191 
193 const MGglViewAttrib& theView()const{return m_view;};
194 MGglViewAttrib& theView(){return m_view;};
195 
197 void set_view(
198  const MGglViewAttrib& view
199 );
200 
202 void set_view_context(
203  const MGOpenGLView& view
204 );
205 
209 void applyDrawAttrib(MGOpenGLView& view);
210 
212 double* tolerance(){return m_tolerance;};
213 const double* tolerance()const{return m_tolerance;};
214 void set_tolerance(
215  double wc_zero,
216  double rc_zero,
217  double mach_zero,
218  double line_zero,
219  double angle_zero,
220  double max_knot_ratio
221 );
222 
224 const mgTLInputParam& tessellate_param()const{return m_tessellate_param;};
225 mgTLInputParam& tessellate_param(){return m_tessellate_param;};
226 void set_tessellate_param(const mgTLInputParam& tessellate_param){
227  m_tessellate_param=tessellate_param;};
228 
229 double tess_maximum_edge_length()const{return m_tessellate_param.max_edge_len();};
230 double tess_surface_tolerance()const{return m_tessellate_param.surfTol();};
231 double tess_curve_tolerance()const{return m_tessellate_param.crvTol();};
232 
234 const MGAppearance* appearance()const{return m_appearance;};
235 MGAppearance* appearance(){return m_appearance;};
236 
238 void set_appearance(
239  MGAppearance* appearance
240 );
242 
244 long identify_type() const{return MGCONTEXT_TID;};
245 
247 
249 void exec_tolerance()const;
250 
253 void exec_draw_attributes(mgVBO& vbo)const;
254 
257 void exec_render_attributes(mgVBO& vbo)const;
258 
260 std::ostream& out(std::ostream& ostrm) const;
261 
262 std::string whoami()const{return "Context";};
263 
265 void ReadMembers(MGIfstream& buf);
267 void WriteMembers(MGOfstream& buf)const;
268 
269 private:
270 
271  MGSnapAttrib m_snap_attrib;
272 
274 
275  int m_line_density;
276  MGColor m_Bcolor;
277  MGColor m_Gcolor;
278  MGColor m_Hcolor;
279  float m_smooth;
280  float m_pick_aperture;
283  MGglViewAttrib m_view;
284  MGColor m_gridColor[4];
285  //[0]=grid color, [1]=X-axis color, [2]=Y-axis color, [3]=Z-axis color.
286  int m_gridNum[2];
287  double m_gridSpan[2];
288 
289 
291 
292  double m_tolerance[6];
293  mgTLInputParam m_tessellate_param;
300  MGAppearance* m_appearance;
301 
302  //void setDefaultTolerance();
303 };
304  // end of DisplayHandling group
306 #endif //#ifndef _MGContext_HH_
MGColor & axisZcolor()
Z-axis color.
Definition: Context.h:174
const MGColor & Hcolor() const
Object highlight color.
Definition: Context.h:121
virtual MGAttrib & operator=(const MGAttrib &gel2)
Definition: Attrib.h:37
virtual bool operator<(const MGGel &gel2) const
MGAppearance * appearance()
Definition: Context.h:235
const MGColor & Gcolor() const
Object lines color.
Definition: Context.h:112
MGColor & Hcolor()
Object highlight color.
Definition: Context.h:124
MGColor & Gcolor()
Object lines color.
Definition: Context.h:115
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
MGSnapAttrib & snap_attrib()
Definition: Context.h:93
void set_snap_attrib(const MGSnapAttrib &snap_attrib)
Definition: Context.h:94
MGColor & axisYcolor()
Y-axis(v-axis) color.
Definition: Context.h:164
A class that contains all the necessary input parameters to make tessellation.
Definition: TLInputParam.h:24
virtual void ReadMembers(MGIfstream &buf)
Read all member data.
double tess_curve_tolerance() const
Definition: Context.h:231
void set_pick_aperture(float pick_aperture)
Definition: Context.h:190
int line_density() const
Definition: Context.h:97
const MGSnapAttrib & snap_attrib() const
set/get snap attrib data.
Definition: Context.h:92
MGContext defines the attributes of a document.
Definition: Context.h:33
Defines a Box of any space dimendion.
Definition: Box.h:34
const MGColor & axisZcolor() const
Z-axis color.
Definition: Context.h:171
MGglViewAttrib & theView()
Definition: Context.h:194
float pick_aperture() const
Definition: Context.h:188
MGColor defines the OpenGL color (R,G,B,A).
Definition: Color.h:26
const MGColor & Bcolor() const
set/get color data.
Definition: Context.h:103
virtual std::ostream & out(std::ostream &) const =0
Output virtual function.
MGColor & gridColor()
Grid color.
Definition: Context.h:144
const double * tolerance() const
Definition: Context.h:213
MGContext * clone() const
Definition: Context.h:89
MGGel is an abstract class which represents a group element.
Definition: Gel.h:53
mgTLInputParam & tessellate_param()
Definition: Context.h:225
std::string whoami() const
Definition: Context.h:262
void set_line_density(int line_density)
Definition: Context.h:98
long identify_type() const
Return This object's typeID.
Definition: Context.h:244
Defines Snap attributes.
Definition: SnapAttrib.h:26
const mgTLInputParam & tessellate_param() const
Tessellation parameter.
Definition: Context.h:224
void set_gridColor(const MGColor &color)
Grid color setter.
Definition: Context.h:147
const MGColor & axisYcolor() const
Y-axis(v-axis) color.
Definition: Context.h:161
Defines OpenGL display class for MGCL objects.
Definition: openglView.h:43
const MGColor * gridColors() const
Definition: Context.h:132
float smooth() const
Definition: Context.h:182
const MGColor & gridColor() const
Grid color.
Definition: Context.h:141
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
virtual void WriteMembers(MGOfstream &buf) const
Write all member data.
const MGglViewAttrib & theView() const
Get the view attribute.
Definition: Context.h:193
double tess_surface_tolerance() const
Definition: Context.h:230
const MGColor & axisXcolor() const
X-axis(u-axis) color.
Definition: Context.h:151
void set_pick_aperture(double pick_aperture)
Definition: Context.h:189
void set_tessellate_param(const mgTLInputParam &tessellate_param)
Definition: Context.h:226
const int * gridNum() const
Definition: Context.h:133
const MGAppearance * appearance() const
Appearance data.
Definition: Context.h:234
MGglViewAttrib is a class to serialize MGOpenGLView.
Definition: glViewAttrib.h:27
const double * gridSpan() const
Definition: Context.h:134
A container class to hold MGGLAttrib objects.
Definition: Appearance.h:33
void set_axisYcolor(const MGColor &color)
Y-axis(v-axis) color setter.
Definition: Context.h:167
void set_axisXcolor(const MGColor &color)
X-axis(u-axis) color setter.
Definition: Context.h:157
void set_axisZcolor(const MGColor &color)
Z-axis color setter.
Definition: Context.h:177
MGColor & Bcolor()
Background color.
Definition: Context.h:106
MGColor & axisXcolor()
X-axis(u-axis) color.
Definition: Context.h:154
OpenGL 4 用描画のためのクラス, in other words, display list.
Definition: VBO.h:76
double * tolerance()
Tolerance data.
Definition: Context.h:212
double tess_maximum_edge_length() const
Definition: Context.h:229
MGAttrib is an abstract class that defines attribute elements of MGGel.
Definition: Attrib.h:28
void set_smooth(float smooth)
Definition: Context.h:184