MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
Position_list.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGPosition_list_HH_
6 #define _MGPosition_list_HH_
7 
12 #include <list>
13 #include "mg/Position.h"
14 
15 //Forward class declaration.
16 class MGBox;
17 class MGCurve;
18 class MGFSurface;
19 class MGIfstream;
20 class MGOfstream;
21 class MGSSisect;
22 
24 
27 class MG_DLL_DECLR MGPosition_list{
28 
29 public:
30 
31 typedef std::list<MGPosition> container_type;
32 
33 typedef container_type::iterator iterator;
34 typedef container_type::const_iterator const_iterator;
35 
37 
40 
42 MGPosition_list(const MGPosition& P): m_Plist(1,P){;};
43 
47  const MGPosition_list& list,
48  int start1,
49  int start2
51 );
52 
55 
58 
60 
62 MG_DLL_DECLR friend std::ostream& operator << (std::ostream&, const MGPosition_list& );
63 
66 
68 
71 bool append(const MGPosition& pos);
72 void push_back(const MGPosition& pos){m_Plist.push_back(pos);};
73 
77 bool append(
78  const MGCurve& crv1,
79  const MGCurve& crv2,
80  const MGPosition& p
81 );
82 
85 void append(
86  const MGCurve& crv1,
87  const MGCurve& crv2,
88  const MGPosition_list& list
89 );
90 
94 bool append(
95  const MGFSurface& srf,
96  const MGPosition& uv
97 );
98 
101 void append(
102  const MGFSurface& srf,
103  const MGPosition_list& list
104 );
105 
108 bool append(
109  const MGCurve& crv,
110  const MGFSurface& srf,
111  const MGPosition& tuv
112 );
113 
117 bool append(
118  const MGFSurface& srf1,
119  const MGFSurface& srf2,
120  const MGPosition& uvuv
121 ){ return add(true,srf1,srf2,uvuv);}
122 
124 void append(
125  const MGFSurface& srf1,
126  const MGFSurface& srf2,
127  const MGPosition_list& list
128 );
129 
131 iterator begin(){return m_Plist.begin();}
132 const_iterator begin() const{return m_Plist.begin();}
133 
135 void clear(){m_Plist.clear();}
136 
138 iterator end(){return m_Plist.end();}
139 const_iterator end() const{return m_Plist.end();}
140 
142 int entries() const{return int(m_Plist.size());};
143 int size() const{return int(m_Plist.size());};
144 
147 iterator erase(iterator i){return m_Plist.erase(i);}
148 
151 const MGPosition& first() const{return m_Plist.front();};
152 const MGPosition& front() const{return m_Plist.front();};
153 MGPosition& first(){return m_Plist.front();};
154 MGPosition& front(){return m_Plist.front();};
155 
166 bool in(const MGBox& box, const_iterator& id, int n=0) const;
167 bool in(const MGBox& box, iterator& id, int n=0);
168 
172 void insertAt(iterator i, const MGPosition& pos)
173 {m_Plist.insert(i, pos);};
174 
177 bool isEmpty() const{return m_Plist.empty();};
178 bool empty() const{return m_Plist.empty();};
179 
182 const MGPosition& last() const{return m_Plist.back();};
183 const MGPosition& back() const{return m_Plist.back();};
184 MGPosition& last(){return m_Plist.back();};
185 MGPosition& back(){return m_Plist.back();};
186 
188 void pop_back(){m_Plist.pop_back();}
189 
191 void pop_front(){m_Plist.pop_front();}
192 
194 void prepend(const MGPosition& pos){m_Plist.push_front(pos);};
195 void push_front(const MGPosition& pos){m_Plist.push_front(pos);};
196 
199 bool prepend(
200  const MGFSurface& srf1,
201  const MGFSurface& srf2,
202  const MGPosition& uvuv
203 ){ return add(false,srf1,srf2,uvuv);};
204 
208 int remove(
209  double error,
210  const MGPosition& P,
211  int n=0
212 );
214 
217 int remove(
218  const MGFSurface& srf,
219  const MGPosition& uv
220 );
221 
228 int remove(
229  const MGFSurface& srf1,
230  const MGFSurface& srf2,
231  const MGPosition& uvuv
232 );
233 
239 int remove_uvuv(
240  const MGFSurface& srf1,
241  const MGFSurface& srf2
242 );
243 
246 MGPosition removeAt(iterator i);
247 
250 MGPosition removeFirst();
251 
254 MGPosition removeLast();
255 
258 int removeOn(
259  const MGFSurface& srf1,
260  const MGFSurface& srf2,
261  const MGSSisect& ssi
262 );
263 
265 void reverse_order();
266 
270 void sort_uv_space(int id);
271 
272 private:
273  container_type m_Plist;
274 
276 int dump_size() const;
277 
279 int dump(MGOfstream& ) const;
280 
282 int restore(MGIfstream& );
283 
286 bool add(
287  bool append,
288  const MGFSurface& srf1,
289  const MGFSurface& srf2,
290  const MGPosition& uvuv
291 );
292 
293 };
294  // end of IsectContainer group
296 #endif
void push_back(const MGPosition &pos)
Definition: Position_list.h:72
MGCurve is an abstract class which represents a whole curve.
Definition: Curve.h:63
MGPosition & back()
Definition: Position_list.h:185
const MGPosition & first() const
Definition: Position_list.h:151
int size() const
Definition: Position_list.h:143
MGPosition & first()
Definition: Position_list.h:153
container_type::const_iterator const_iterator
Definition: Position_list.h:34
iterator end()
Get the pointer of the next of the last element of the m_Plist.
Definition: Position_list.h:138
MGIfstream is a class to read the serialized data generated by MGOfstream.
Definition: Ifstream.h:30
std::ostream & operator<<(std::ostream &ostrm, const MGisect &is)
Debug Function.
Definition: isect.h:95
bool isEmpty() const
Definition: Position_list.h:177
iterator begin()
Get the pointer of the first element of the m_Plist.
Definition: Position_list.h:131
const_iterator begin() const
Definition: Position_list.h:132
Defines a Box of any space dimendion.
Definition: Box.h:34
MGSSisect represents one intersection line of two surfaces.
Definition: SSisect.h:29
void push_front(const MGPosition &pos)
Definition: Position_list.h:195
Represent a positional data.
Definition: Position.h:28
iterator erase(iterator i)
Definition: Position_list.h:147
const MGPosition & last() const
Definition: Position_list.h:182
bool append(const MGFSurface &srf1, const MGFSurface &srf2, const MGPosition &uvuv)
Definition: Position_list.h:117
void insertAt(iterator i, const MGPosition &pos)
Definition: Position_list.h:172
bool empty() const
Definition: Position_list.h:178
MGFSurface is an abstract class to provide the comman interfaces to MGFace and MGSurface.
Definition: FSurface.h:33
MGOfstream is a class to serialize all of the subclasses of MGGel.
Definition: Ofstream.h:31
const MGPosition & front() const
Definition: Position_list.h:152
void pop_back()
Erase the last element of m_Plist if not null.
Definition: Position_list.h:188
MGPosition_list provides a list of Positions.
Definition: Position_list.h:27
container_type::iterator iterator
Definition: Position_list.h:33
bool prepend(const MGFSurface &srf1, const MGFSurface &srf2, const MGPosition &uvuv)
Definition: Position_list.h:199
MGPosition_list(const MGPosition &P)
Constructor of length 1.
Definition: Position_list.h:42
const MGPosition & back() const
Definition: Position_list.h:183
const_iterator end() const
Definition: Position_list.h:139
MGPosition_list()
Void constructor(Constructor of length 0).
Definition: Position_list.h:39
void prepend(const MGPosition &pos)
Adds the parameter to the beginning of the list.
Definition: Position_list.h:194
void pop_front()
Erase the first element of m_Plist if not null.
Definition: Position_list.h:191
void clear()
Clear all the elements in m_Plist.
Definition: Position_list.h:135
MGPosition & front()
Definition: Position_list.h:154
MGPosition & last()
Definition: Position_list.h:184
~MGPosition_list()
Definition: Position_list.h:57
std::list< MGPosition > container_type
Definition: Position_list.h:31
int entries() const
Returns the number of items that are in the list.
Definition: Position_list.h:142