GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
glc_mover.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 
3  This file is part of the GLC-lib library.
4  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
5  http://glc-lib.sourceforge.net
6 
7  GLC-lib is free software; you can redistribute it and/or modify
8  it under the terms of the GNU Lesser General Public License as published by
9  the Free Software Foundation; either version 3 of the License, or
10  (at your option) any later version.
11 
12  GLC-lib is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with GLC-lib; if not, write to the Free Software
19  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 
21  *****************************************************************************/
22 
24 
25 #include "glc_mover.h"
26 #include "glc_viewport.h"
27 
28 GLC_Mover::GLC_Mover(GLC_Viewport* pViewport, const QList<GLC_RepMover*>& repsList)
29 : QObject()
30 , m_RepMoverList(repsList)
31 , m_PreviousVector()
32 , m_pViewport(pViewport)
33 , m_MoverInfo()
34 {
35  const int size= m_RepMoverList.size();
36  for (int i= 0; i < size; ++i)
37  {
38  m_RepMoverList[i]->setRepMoverInfo(&m_MoverInfo);
39  }
40 }
41 
42 // Copy constructor
44 : QObject()
45 , m_RepMoverList()
46 , m_PreviousVector(mover.m_PreviousVector)
47 , m_pViewport(mover.m_pViewport)
48 , m_MoverInfo(mover.m_MoverInfo)
49 {
50  const int size= mover.m_RepMoverList.size();
51  for (int i= 0; i < size; ++i)
52  {
53  m_RepMoverList.append(mover.m_RepMoverList.at(i)->clone());
54  m_RepMoverList.last()->setRepMoverInfo(&m_MoverInfo);
55  }
56 }
57 
59 {
61 }
62 
64 // Set Functions
66 
67 // Set the mover representation list
68 void GLC_Mover::setRepresentationsList(const QList<GLC_RepMover*>& listOfRep)
69 {
70  qDebug() << "GLC_Mover::setRepresentationsList";
72  m_RepMoverList= listOfRep;
73  const int size= m_RepMoverList.size();
74  for (int i= 0; i < size; ++i)
75  {
76  m_RepMoverList[i]->setRepMoverInfo(&m_MoverInfo);
77  }
78 }
79 
80 // Update representation
82 {
83  const int size= m_RepMoverList.size();
84  for (int i= 0; i < size; ++i)
85  {
86  m_RepMoverList[i]->init();
87  }
88 }
89 
90 // Update representation
92 {
93  const int size= m_RepMoverList.size();
94  for (int i= 0; i < size; ++i)
95  {
96  m_RepMoverList[i]->update();
97  }
98 
99 }
100 
102 // OpenGL Functions
104 
105 // Mover representations list display
107 {
108  const int size= m_RepMoverList.size();
109  for (int i= 0; i < size; ++i)
110  {
111  m_RepMoverList[i]->render();
112  }
113 }
114 
116 // Private services Functions
118 
119 // Clear mover representation
121 {
122  // Delete mover representations
123  const int size= m_RepMoverList.size();
124  for (int i= 0; i < size; ++i)
125  {
126  delete m_RepMoverList.at(i);
127  }
128 }
129 
130 

©2005-2013 Laurent Ribon