Moka controlers
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
controler-gmap-creations.cc
Go to the documentation of this file.
1 /*
2  * lib-controler-gmap : Le contrôleur de 3-G-cartes, surcouche de lib-controler.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-controler-gmap
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
25 #include "controler-gmap.hh"
26 #include "view-precompile.hh"
27 #include "parameter-creation.hh"
30 #include "transformation-matrix.hh"
31 #include "g-map-vertex.hh"
32 #include "vertex.hh"
33 #include "transformation-matrix.hh"
34 using namespace GMap3d;
35 //******************************************************************************
36 void CControlerGMap::modeCreationBegin()
37 {
38  setMessage("Mode création");
39 
40  for (unsigned int i=0; i<FViews.size(); ++i)
42 }
43 //******************************************************************************
44 void CControlerGMap::modeCreationEnd()
45 {
46  for (unsigned int i=0; i<FViews.size(); ++i)
48 }
49 //******************************************************************************
50 void CControlerGMap::modeCreationPolylineOperationStart()
51 {
52  float last3D[3];
53  FViews[FCurrentViewId]->unproject(FLastX, FLastY, last3D);
54  FParameterPolylinePosition->addVertex(CVertex(last3D[0],
55  last3D[1],
56  last3D[2]));
57 }
58 //******************************************************************************
59 void CControlerGMap::modeCreationOperationStart()
60 {
62 
63  float x = FFirst3D[0];
64  float y = FFirst3D[1];
65  float z = FFirst3D[2];
66 
67  CParameterObjectPosition * param = FParameterObjectPosition[FCreationType];
68 
69  param->setScale(0.0);
70  param->setCenter(x,y,z);
71  param->setNormalVector(FViews[FCurrentViewId]->getEyeDirection());
72  param->setFirstVertex(x,y,z, true);
73 }
74 //******************************************************************************
75 void CControlerGMap::modeCreationPolylineOperationMove()
76 {
77  float last3D[3];
78  FViews[FCurrentViewId]->unproject(FLastX, FLastY, last3D);
79  FParameterPolylinePosition->setLastVertex(CVertex(last3D[0],
80  last3D[1],
81  last3D[2]));
82 }
83 //******************************************************************************
84 void CControlerGMap::modeCreationOperationMove()
85 {
86  float last3D[3];
87 
88  FViews[FCurrentViewId]->unproject(FLastX, FLastY, last3D);
89 
90  float x = last3D[0];
91  float y = last3D[1];
92  float z = last3D[2];
93 
94  FParameterObjectPosition[FCreationType]->setFirstVertex(x,y,z, true);
95 }
96 //******************************************************************************
97 void CControlerGMap::modeCreationPolylineOperationStop()
98 {
99 }
100 //******************************************************************************
101 void CControlerGMap::modeCreationOperationStop()
102 {
103 }
104 //******************************************************************************
106 {
107  switch (getMode())
108  {
110  FParameterPolylinePosition->reinit(); break;
112  case MODE_CREATION_MESH:
116  case MODE_CREATION_TORUS:
117  FParameterObjectPosition[FCreationType]->reinit(); break;
118  }
119 }
120 //******************************************************************************