MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
PickObjects.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #pragma once
6 
7 #ifndef _MGPickObjects_HH_
8 #define _MGPickObjects_HH_
9 
10 #include <vector>
11 #include "mg/AbstractGels.h"
12 #include "mg/Pvector.h"
13 #include "mg/PickObject.h"
14 
15 class MGCurve;
16 class MGFSurface;
17 class MGOfstream;
18 class MGIfstream;
19 class MGGelPositions;
20 class MGPickObject;
21 
23 
28 class MG_DLL_DECLR MGPickObjects{
30 
31 public:
33 
42 
44 
46 
48 MGPickObjects(const MGPickObjects& pobjs);
49 
52  const MGPickObject& pobj
53 );
54 
56 
58 
59 const MGPickObject& operator[](size_t i)const{return *m_PickObjects[i];};
60 MGPickObject& operator[](size_t i){return *m_PickObjects[i];};
61 
62 MGPickObjects& operator=(const MGPickObjects& pobjs);
63 
65 MGPickObjects& operator+=(const MGPickObjects& gelps){push_back(gelps);return *this;};
66 MGPickObjects& operator+=(const MGPickObject& gelp);
67 MGPickObjects& operator-=(const MGPickObjects& gelps){remove(gelps);return *this;};
68 MGPickObjects& operator-=(const MGPickObject& gelp){remove(gelp);return *this;};
69 MGPickObjects& operator-=(const MGAbstractGels& types){remove(types);return *this;};
70 MGPickObjects& operator&=(const MGPickObjects& gelps){reset_with_common(gelps);return *this;};
71 
73 void append_object(const MGGelPositions& gelps);
74 
76 void assign(const_iterator first, const_iterator last);
77 
78 const MGPickObject& front()const{return *m_PickObjects.front();};
79 MGPickObject& front(){return *m_PickObjects.front();};
80 
81 const MGPickObject& back()const{return *m_PickObjects.back();};
82 MGPickObject& back(){return *m_PickObjects.back();};
83 
84 iterator begin(){return m_PickObjects.begin();};
85 const_iterator begin()const{return m_PickObjects.begin();};
86 
87 iterator end(){return m_PickObjects.end();};
88 const_iterator end()const{return m_PickObjects.end();};
89 
90 reverse_iterator rbegin(){return m_PickObjects.rbegin();};
91 const_reverse_iterator rbegin()const{return m_PickObjects.rbegin();};
92 
93 reverse_iterator rend(){return m_PickObjects.rend();};
94 const_reverse_iterator rend()const{return m_PickObjects.rend();};
95 
96 void clear(){m_PickObjects.clear();};
97 bool empty()const{return m_PickObjects.empty();};
98 
99 void pop_back(){m_PickObjects.pop_back();};
100 
102 iterator find(const MGPickObject& pobj);
103 const_iterator find(const MGPickObject& pobj)const;
104 
105 //Get an object to tessellate from this pick objects.
106 //Function's return value is the object pointer(MGFSurface).
107 const MGFSurface* get_object_to_tessellate()const;
108 
109 //Test if there is a MGPickObject that includes input objin
110 //in this MGPickObjects' member. If input objin is MGShell,
111 //and a member is_shell_face(), test is performed to the shell.
112 //Returns is the iterator of found obj.
113 iterator includes(const MGObject* objin);
114 
115 //Test if input MGPickObject is includes in this MGPickObjects' member.
116 //If input objin is MGShell, and a member is_shell_face(),
117 //test is performed to the shell.
118 //Returns is the iterator of found obj.
119 iterator includes(const MGPickObject& pobj);
120 
122 void erase(iterator first, iterator last);
123 
125 iterator erase(iterator i);
126 
128 void erase(int i){erase(begin()+i);};
129 
132 void erase_except_front();
133 
136 int push_back(const MGPickObject& pobj);
137 int push_back(const MGPickObjects& pobjs);
138 
140 void remove(const MGPickObject& pobj);
141 void remove(const MGPickObjects& pobjs);
142 
144 void remove(const MGAbstractGels& types);
145 
147 void remove(const MGGelPositions& gelps);
148 
150 void reset_with_common(const MGPickObjects& pobjs2);
151 
155 void reset_with_symmetric_difference(const MGPickObjects& pobjs2);
156 
158 void reserve(size_t n);
159 
160 //Erase all the objects that is not of specified types from this.
161 void reset_objects(const MGAbstractGels& types);
162 
164 void resize(size_t n){m_PickObjects.resize(n);};
165 
167 void reset(size_t i, const MGPickObject& pobj);
168 
172 MGPickObjects select(const MGAbstractGels& types)const;
173 
179 MGPickObject select_1st_curve()const;
180 
185 void select_curves(MGPickObjects& curves)const;
186 
192 MGPickObject select_1st_fsurface()const;
193 
198 void select_fsurfaces(MGPickObjects& surfaces)const;
199 
201 int size()const{return int(m_PickObjects.size());};
202 
203 container_type& object_vector(){return m_PickObjects;};
204 const container_type& object_vector()const{return m_PickObjects;};
205 
207 void setNoDisplay()const;
208 
210 void setDisplay()const;
211 
212 protected:
213  container_type m_PickObjects;
214 
215 };
216  // end of MGObjectRelated group
218 #endif // _MGPickObjects_HH_
std::vector< MGPickObject * >::reverse_iterator reverse_iterator
Definition: Pvector.h:33
const MGPickObject & front() const
Definition: PickObjects.h:78
MGCurve is an abstract class which represents a whole curve.
Definition: Curve.h:63
container_type::reference reference
types:
Definition: PickObjects.h:35
MGGelPosition Container Class.
Definition: GelPositions.h:23
std::vector< MGPickObject * >::size_type size_type
Definition: Pvector.h:37
std::vector< MGPickObject * >::const_iterator const_iterator
Definition: Pvector.h:32
void pop_back()
Definition: PickObjects.h:99
MGPickObjects & operator&=(const MGPickObjects &gelps)
Definition: PickObjects.h:70
reverse_iterator rend()
Definition: PickObjects.h:93
Is a container of MGAbstractGel, to specify what kind of gels are required.
Definition: AbstractGels.h:25
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
container_type::const_iterator const_iterator
Definition: PickObjects.h:38
bool empty() const
Definition: PickObjects.h:97
const_reverse_iterator rend() const
Definition: PickObjects.h:94
container_type::size_type size_type
Definition: PickObjects.h:39
const MGPickObject & back() const
Definition: PickObjects.h:81
const MGPickObject & operator[](size_t i) const
virtual ~MGPickObjects();
Definition: PickObjects.h:59
const container_type & object_vector() const
Definition: PickObjects.h:204
Is an abstract class which represents a whole geometry and a topology.
Definition: Object.h:42
MGPickObjects()
Constructors.
Definition: PickObjects.h:45
MGPickObject & back()
Definition: PickObjects.h:82
const_iterator begin() const
Definition: PickObjects.h:85
iterator end()
Definition: PickObjects.h:87
MGPickObjects & operator-=(const MGPickObjects &gelps)
Definition: PickObjects.h:67
const_reverse_iterator rbegin() const
Definition: PickObjects.h:91
reverse_iterator rbegin()
Definition: PickObjects.h:90
iterator begin()
Definition: PickObjects.h:84
MGPickObject & operator[](size_t i)
Definition: PickObjects.h:60
std::vector< MGPickObject * >::reference reference
Definition: Pvector.h:35
void resize(size_t n)
resize the length of the sequence.
Definition: PickObjects.h:164
std::vector< MGPickObject * >::iterator iterator
Definition: Pvector.h:31
MGPickObject & front()
Definition: PickObjects.h:79
MGPickObjects & operator-=(const MGAbstractGels &types)
Definition: PickObjects.h:69
container_type m_PickObjects
Definition: PickObjects.h:213
MGFSurface is an abstract class to provide the comman interfaces to MGFace and MGSurface.
Definition: FSurface.h:33
container_type & object_vector()
Definition: PickObjects.h:203
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
const_iterator end() const
Definition: PickObjects.h:88
MGPickObject is a class to locate where an object is in a group hierarchy.
Definition: PickObject.h:39
container_type::const_reference const_reference
Definition: PickObjects.h:36
MGPickObjects & operator-=(const MGPickObject &gelp)
Definition: PickObjects.h:68
container_type::iterator iterator
Definition: PickObjects.h:37
void clear()
Definition: PickObjects.h:96
MGPickObjects & operator+=(const MGPickObjects &gelps)
Set operation.
Definition: PickObjects.h:65
a container class for MGPickObject.
Definition: PickObjects.h:29
container_type::const_reverse_iterator const_reverse_iterator
Definition: PickObjects.h:41
std::vector< MGPickObject * >::const_reference const_reference
Definition: Pvector.h:36
container_type::reverse_iterator reverse_iterator
Definition: PickObjects.h:40
int size() const
Obtain the pobj number defined.
Definition: PickObjects.h:201
std::vector< MGPickObject * >::const_reverse_iterator const_reverse_iterator
Definition: Pvector.h:34
MGPvector< MGPickObject > container_type
Definition: PickObjects.h:32
void erase(int i)
erase i-th element.
Definition: PickObjects.h:128