MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
Group.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGGroup_HH_
6 #define _MGGroup_HH_
7 
8 #include "mg/Plist.h"
9 #include "mg/Pvector.h"
10 #include "mg/Object.h"
11 #include "mg/Gel.h"
12 #include "mg/AttribedGel.h"
13 
14 //
15 //Define MGGroup Class.
16 //
17 class MGIfstream;
18 class MGOfstream;
19 class MGBox;
20 class MGObject;
21 class MGAttrib;
22 class MGGLAttrib;
23 class MGAppearance;
24 class MGContext;
25 
30 
35 class MG_DLL_DECLR MGGroup:public MGAttribedGel{
36 
37 public:
43 
45 
47 MGGroup();
48 MGGroup(MGGel* gel);
49 
56 MGGroup(const TCHAR* file, int& error);
57 
60 
63 
65 
69 virtual MGGroup& operator=(const MGGel& gel2);
70 virtual MGGroup& operator=(const MGGroup& gel2);
71 
73 virtual bool operator<(const MGGroup& gel2)const;
74 virtual bool operator<(const MGGel& gel2)const;
75 
77 
81 const MGAppearance* appearance()const;
82 
84 //virtual bool displayList_is_made(MGCL::VIEWMODE vmode)const;
85 
88 const MGGel* back() const{return m_gels.back();};
89 MGGel* back(){return m_gels.back();};
90 
92 const_iterator begin() const{return m_gels.begin();}
93 iterator begin(){return m_gels.begin();}
94 
97 MGBox box()const;
98 
100 void clear(){m_gels.clear();};
101 
104 virtual MGGroup* clone()const;
105 
108 MGContext* context();
109 const MGContext* context()const;
110 
112 virtual void display_arrows(mgSysGL& sgl)const;
113 virtual void display_break_points(mgSysGL& sgl)const;
114 virtual void display_control_polygon(mgSysGL& sgl)const;
115 virtual void display_curvatures(
116  mgSysGL& sgl,
117  double scale,
118  int density,
119  bool use_radius
120 )const;
121 
124 
127 bool empty() const{return m_gels.empty();};
128 
130 const_iterator end() const{return m_gels.end();};
131 iterator end(){return m_gels.end();};
132 
135 iterator erase(iterator x){return m_gels.erase(x);};
136 
139 iterator erase(iterator first, iterator last){return m_gels.erase(first,last);};
140 
144 const_iterator find(
145  const MGGel* gel,
146  const MGGroup*& grp
147 )const;
149 
153 iterator find(
154  MGGel* gel,
155  MGGroup*& grp
156 );
158 
162 int getMemberGroupNumber()const;
163 
166 const MGGroup* get_i_th_MemberGroup(int i)const;
167 MGGroup* get_i_th_MemberGroup(int i);
168 
171 iterator search_by_id(MGGEL_TID tid);
172 const_iterator search_by_id(MGGEL_TID tid)const;
173 
177 void nameSearch(
178  const MGName& name,
179  MGGroup*& groupIncluding,
180  MGAttribedGel*& gelFound
182 );
183 
187 void nameSearch(
188  const MGName& name,
189  const MGGroup*& groupIncluding,
190  const MGAttribedGel*& gelFound
192 )const;
193 
196 const MGGel* front() const{return m_gels.front();};
197 MGGel* front(){return m_gels.front();};
198 
200 MGGroup* group(){return this;};
201 const MGGroup* group()const{return this;};
202 
204 virtual long identify_type() const{return MGGROUP_TID;};
205 
209 const MGObject* includes_object()const;
211 
214 iterator insert(iterator it, MGGel* x){return m_gels.insert(it,x);};
215 
222 int make_file(const TCHAR* file);
223 
225 void make_display_list(
227 )const;
228 
231 virtual int manifold_dimension() const{return 2;};
232 
234 void delete_displayList(
235  const_iterator x
236 )const;
237 
239 void delete_displayList(
240  const_iterator first, const_iterator last
241 )const;
242 
244 void delete_displayList(
245  const std::vector<const MGGel*>& gels_to_delete
246 )const;
247 
249 void drawAttrib(
250  mgVBO& vbo,
251  bool no_color=false
252 )const;
253 
255 int max_size() const{return int(m_gels.max_size());};
256 
258 int num_of_objects() const;
259 
261 virtual int out_to_IGES(
262  MGIgesOfstream& igesfile,
263  int SubordinateEntitySwitch=0
264 )const;
265 
267 virtual std::ostream& out(std::ostream&) const;
268 
270 void pop_back(){m_gels.pop_back();};
271 
273 void pop_front(){m_gels.pop_front();};
274 
275 void push_appearance(MGAppearance* appr);
276 void push_context(MGContext* cntx);
277 
279 void push_back(MGGel* x);
280 
283 void push_back(MGPvector<MGObject>& objs);
284 void push_back(MGPlist<MGObject>& objs);
285 void push_back(MGPvector<MGGel>& gels);
286 void push_back(MGPlist<MGGel>& gels);
287 
290 void push_front(MGGel* x);
291 
293 const_reverse_iterator rbegin() const{return m_gels.rbegin();};
294 reverse_iterator rbegin(){return m_gels.rbegin();};
295 
297 const_reverse_iterator rend() const{return m_gels.rend();};
298 reverse_iterator rend(){return m_gels.rend();};
299 
302 iterator release(iterator i){return m_gels.release(i);};
303 
306 void releaseAll();
307 
309 void remove_appearance();
310 
314 MGGel* removeAt(iterator x){return m_gels.removeAt(x);};
315 
317 void reverse(){m_gels.reverse();};
318 
331 void scalePolar(
332  double angleBase,
333  double angle1,
334  double angle2
335 );
336 
337 //set the copy of appr2 to this MGAttribedgel.
338 void set_appearance(const MGAppearance& appr2);
339 
341 int size() const{return int(m_gels.size());};
342 
344 void getSmallGroupData(
345  std::vector<MGObject*>& outputObjects
346 );
347 
349 void getAllObjects(
350  std::vector<MGObject*>& allObjects
351 );
352 
354 void sort(){ m_gels.sort();}
355 
356 template<class Traits>
357 void sort(Traits _Comp){m_gels.sort(_Comp);}
358 
360 
362 virtual void transform(const MGVector& v);
363 
365 virtual void transform(double scale);
366 
368 virtual void transform(const MGMatrix& mat);
369 
371 virtual void transform(const MGTransf& tr);
372 
373 virtual std::string whoami()const{return "Group";};
374 
375 protected:
376 
378 virtual void ReadMembers(MGIfstream& buf);
379 
381 virtual void WriteMembers(MGOfstream& buf)const;
382 
383 private:
384 
386  MGPlist<MGGel> m_gels;
387 
391 void search_by_nameSub(
392  const MGName& name,
393  MGGroup*& groupIncluding,
394  MGAttribedGel*& gelFound
396 );
397 
398 
399 friend class MGIfstream;
400 friend class MGOfstream;
401 };
402 
404 MG_DLL_DECLR MGGroup* MGNullGroup(long TID);
405  // end of GelRelated group
407 #endif
MGTransf represents a transformation of a space dimension.
Definition: Transf.h:35
reverse_iterator rend()
Definition: Group.h:298
MGGLAttrib is an abstract class which defines the enum of undefined or disabled.
Definition: GLAttrib.h:35
Definition: MGCL.h:272
virtual int out_to_IGES(MGIgesOfstream &igesfile, int SubordinateEntitySwitch=0) const
Definition: Gel.h:93
int size() const
Return the number of items that are in the list.
Definition: Group.h:341
virtual bool operator<(const MGGel &gel2) const
virtual void WriteMembers(MGOfstream &buf) const
Write all member data.
virtual void display_curvatures(mgSysGL &sgl, double scale, int density, bool use_radius) const
Definition: Gel.h:195
iterator erase(iterator first, iterator last)
Definition: Group.h:139
virtual std::string whoami() const
Definition: Group.h:373
Defines List of newed object pointers.
Definition: Plist.h:31
reverse_iterator rbegin()
Definition: Group.h:294
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
virtual int manifold_dimension() const
Definition: Group.h:231
void reverse()
reverse sequence.
Definition: Group.h:317
virtual MGAppearance * ensure_appearance()=0
iterator insert(iterator it, MGGel *x)
Definition: Group.h:214
bool empty() const
Definition: Group.h:127
MGGel * front()
Definition: Group.h:197
Is an abstract class which represents a whole geometry and a topology.
Definition: Object.h:42
iterator end()
Definition: Group.h:131
Vector of a general n space dimension.
Definition: Vector.h:26
const_iterator end() const
Return const_iterator at the end of MGGel.
Definition: Group.h:130
MGContext defines the attributes of a document.
Definition: Context.h:33
Defines a Box of any space dimendion.
Definition: Box.h:34
virtual void display_break_points(mgSysGL &sgl) const
Definition: Gel.h:193
void clear()
clear list, that is, erase(delete) all the elements in the MGGel.
Definition: Group.h:100
MGGel is an abstract class which represents a group element.
Definition: Gel.h:53
Is an abstract class which provides interfaces of MGGel that has MGAppearance.
Definition: AttribedGel.h:32
Defines MGAttribedGel's Name data.
Definition: Name.h:29
virtual void transform(const MGVector &v)
Transform the gel by the argument.
Definition: Gel.h:176
virtual void set_appearance(const MGAppearance &appr2)=0
const_iterator begin() const
Return const_iterator at the beginning of list.
Definition: Group.h:92
MGPlist< MGGel >::const_reverse_iterator const_reverse_iterator
Definition: Group.h:42
virtual MGAttribedGel & operator=(const MGAttribedGel &gel2)
iterator begin()
Definition: Group.h:93
MGPlist< MGGel >::iterator iterator
別名定義
Definition: Group.h:39
const MGGroup * group() const
Definition: Group.h:201
virtual MGAppearance * appearance()=0
VIEWMODE
Definition: MGCL.h:271
virtual std::ostream & out(std::ostream &) const =0
Output virtual function.
virtual const MGObject * includes_object() const =0
Test if this gel includes an object.
const MGGel * front() const
Definition: Group.h:196
void sort()
Equivalent to call std::list::sort().
Definition: Group.h:354
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
MGGel * removeAt(iterator x)
Definition: Group.h:314
MGOgesIfstream write out to *.iges file, transforming MGCL objects to IGES objects.
Definition: IgesOfstream.h:26
const_reverse_iterator rend() const
Return const_reverse_iterator at the end of list.
Definition: Group.h:297
friend class MGGroup
Definition: AttribedGel.h:33
int max_size() const
Returns the size of maximum size.
Definition: Group.h:255
virtual void drawAttrib(mgVBO &vbo, bool no_color=false) const
Process of draw or render attributes.
void pop_front()
pop first element.
Definition: Group.h:273
iterator erase(iterator x)
Definition: Group.h:135
virtual void remove_appearance()=0
Remove the MGAppearance of this MGAttribedGel.
MGGroup is a class which constains MGGel elements.
Definition: Group.h:35
iterator release(iterator i)
Definition: Group.h:302
A container class to hold MGGLAttrib objects.
Definition: Appearance.h:33
void pop_back()
pop last element.
Definition: Group.h:270
const MGGel * back() const
Judge if the display list for vmode is made or not.
Definition: Group.h:88
MGPlist< MGGel >::const_iterator const_iterator
Definition: Group.h:40
virtual long identify_type() const
Return This object's typeID.
Definition: Group.h:204
MGGel * back()
Definition: Group.h:89
virtual void ReadMembers(MGIfstream &buf)
Read all member data.
const_reverse_iterator rbegin() const
Return const_reverse_iterator at the beginning of list.
Definition: Group.h:293
MGGroup * group()
Return MGGroup pointer if this MGGel is an MGGroup, else return null.
Definition: Group.h:200
mgSysGL is a class to provide a facility to draw temporal pictures.
Definition: sysGL.h:26
OpenGL 4 用描画のためのクラス, in other words, display list.
Definition: VBO.h:76
Defines Vector of newed object pointers.
Definition: Pvector.h:27
virtual void display_control_polygon(mgSysGL &sgl) const
Definition: Gel.h:194
virtual MGGel * clone() const =0
void sort(Traits _Comp)
Definition: Group.h:357
virtual void make_display_list(MGCL::VIEWMODE vmode=MGCL::DONTCARE) const
Make a display list of this gel.
Definition: Gel.h:112
MGPlist< MGGel >::reverse_iterator reverse_iterator
Definition: Group.h:41
MGAttrib is an abstract class that defines attribute elements of MGGel.
Definition: Attrib.h:28
virtual void display_arrows(mgSysGL &sgl) const
Definition: Gel.h:192
MGMatrix is a matix of m by m, where m is the space dimension.
Definition: Matrix.h:30