MGCL V10  V10
MGCL V10
 全て クラス 名前空間 関数 変数 型定義 列挙型 列挙値 フレンド グループ ページ
SnapPositions.h
1 /********************************************************************/
2 /* Copyright (c) 2015 DG Technologies Inc. and Yuzi Mizuno */
3 /* All rights reserved. */
4 /********************************************************************/
5 #ifndef _MGPositions_HH_
6 #define _MGPositions_HH_
7 
8 #include <vector>
9 #include <list>
10 #include <set>
11 #include "mg/Position.h"
12 #include "mg/PickObjects.h"
13 #include "mgGL/VBO.h"
14 
15 //
16 //Define MGSnapPositions Class.
17 
18 class MGCurve;
19 class MGGroup;
20 class MGGel;
21 class MGFace;
22 class MGShell;
23 
25 class MG_DLL_DECLR MGSnapPositions: public mgVBO{
26 
27 public:
28 
29 enum snap_kind{
30  DELETE_POINT=-1,
31  nopos=0,
37  ON_SURFACE
38 };
39 
41 
43 MGSnapPositions(snap_kind kind=nopos);
44 
47 
49 virtual ~MGSnapPositions();
50 
52 
53 typedef std::vector<MGPosition>::const_iterator const_iterator;
54 typedef std::vector<MGPosition>::iterator iterator;
55 typedef std::pair<const MGObject*, int> obj_num;
56 
58 void append_position_data(std::vector<MGPosition>& points)const;
59 
62 
64 void extract(
65  const MGCurve& crv
66 );
67 void extract(
68  const MGSurface& srf
69 );
70 void extract(
71  const MGPoint& point
72 );
74  const MGFace& face
75 );
77  const MGShell& shell
78 );
79 void extract(
80  const std::list<const MGGel*>& gel_list
81 );
82 void extract(
83  const MGGel& gel
84 );
85 void extract(
86  const MGPickObjects& pobjs
87 );
88 
90 
94 // 派生もとのクラスはVirtual宣言されてるが、このクラスから派生クラスを作ることは
95 // 想定していないので、Virtualをはずしている。
97 
98 void get_pick_data(
99  const std::set<unsigned>& selected,
100  MGPosition& point,
101  const MGObject*& obj,
102  double& t
103 )const;
105 
107 snap_kind get_snap_kind()const{return m_snap_kind;};
108 void set_snap_kind(snap_kind kind){m_snap_kind=kind;};
109 
110 const MGPosition& back()const{return m_positions.back();};
111 MGPosition& back(){return m_positions.back();};
112 iterator begin(){return m_positions.begin();};
113 const_iterator begin()const{return m_positions.begin();};
114 void clear();
115 
117 const MGObject* object(int posID)const;
118 
119 bool empty()const{return m_positions.empty();};
120 iterator end(){return m_positions.end();};
121 const_iterator end()const{return m_positions.end();};
122 const MGPosition& front()const{return m_positions.front();};
123 MGPosition& front(){return m_positions.front();};
124 const MGPosition& operator[](int i)const{return m_positions[i];};
125 MGPosition& operator[](int i){return m_positions[i];};
126 void pop_back(){m_positions.pop_back();};
127 void push_back(const MGPosition& pos){m_positions.push_back(pos);};
128 size_t size(){return m_positions.size();};
129 
131 const std::vector<MGPosition>& points()const{return m_positions;};
132 std::vector<MGPosition>& points(){return m_positions;};
133 
134 private:
135 std::vector<obj_num> m_obj_nums;
136 std::vector<MGPosition> m_positions;
139 snap_kind m_snap_kind;
140 
141 
142 };
143 
144 #endif
MGCurve is an abstract class which represents a whole curve.
Definition: Curve.h:63
void push_back(const MGPosition &pos)
Definition: SnapPositions.h:127
void pop_back()
Definition: SnapPositions.h:126
void extract(const MGCurve &crv)
Extract position data.
Definition: SnapPositions.h:35
MGPosition & back()
Definition: SnapPositions.h:111
Definition: MGCL.h:272
MGPoint represents one dimensional manifold, a point in a space.
Definition: Point.h:28
virtual void make_display_list(MGCL::VIEWMODE vmode=MGCL::DONTCARE)
size_t size()
Definition: SnapPositions.h:128
Definition: SnapPositions.h:34
Definition: SnapPositions.h:32
Definition: SnapPositions.h:33
MGPosition & front()
Definition: SnapPositions.h:123
Is an abstract class which represents a whole geometry and a topology.
Definition: Object.h:42
std::pair< const MGObject *, int > obj_num
Definition: SnapPositions.h:55
MGShell is a composition of MGFace's(trimmed surface).
Definition: Shell.h:32
std::vector< MGPosition > & points()
Definition: SnapPositions.h:132
MGSnapPositions is a class to store array(vector) of MGPosition's.
Definition: SnapPositions.h:25
iterator begin()
Definition: SnapPositions.h:112
const std::vector< MGPosition > & points() const
Get the point data array.
Definition: SnapPositions.h:131
snap_kind
Definition: SnapPositions.h:29
MGFace is a trimmed surface.
Definition: Face.h:51
MGGel is an abstract class which represents a group element.
Definition: Gel.h:53
Represent a positional data.
Definition: Position.h:28
MGSurface is an abstract class of 3D surface.
Definition: Surface.h:54
const MGPosition & front() const
Definition: SnapPositions.h:122
const MGPosition & operator[](int i) const
Definition: SnapPositions.h:124
VIEWMODE
Definition: MGCL.h:271
virtual void selectionDraw(MGCL::VIEWMODE viewMode=MGCL::DONTCARE)
const MGPosition & back() const
Definition: SnapPositions.h:110
iterator end()
Definition: SnapPositions.h:120
mgVBO & operator=(const mgVBO &vbo)
Assignment.
MGGroup is a class which constains MGGel elements.
Definition: Group.h:35
snap_kind get_snap_kind() const
Get and set the snap_kind.
Definition: SnapPositions.h:107
const_iterator end() const
Definition: SnapPositions.h:121
const_iterator begin() const
Definition: SnapPositions.h:113
a container class for MGPickObject.
Definition: PickObjects.h:29
std::vector< MGPosition >::const_iterator const_iterator
Definition: SnapPositions.h:53
void set_snap_kind(snap_kind kind)
Definition: SnapPositions.h:108
OpenGL 4 用描画のためのクラス, in other words, display list.
Definition: VBO.h:76
Definition: SnapPositions.h:36
std::vector< MGPosition >::iterator iterator
Definition: SnapPositions.h:54
MGPosition & operator[](int i)
Definition: SnapPositions.h:125
bool empty() const
Definition: SnapPositions.h:119