Moka controlers
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
operations-positioning.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 "g-map-vertex.hh"
26 #include "controler-gmap.hh"
27 #include <cassert>
28 
29 using namespace GMap3d;
30 //******************************************************************************
32 {
33  CDart *last=getLastSelectedDart();
34  if (last!=NULL)
35  {
36  CVertex* v = FMap->findVertex(last);
37  getParameterAimedPosition(AView)->setLookAt(0, v->getX());
38  getParameterAimedPosition(AView)->setLookAt(1, v->getY());
39  getParameterAimedPosition(AView)->setLookAt(2, v->getZ());
40  return true;
41  }
42  return false;
43 }
44 //******************************************************************************
46 {
47  CDart *last=getLastSelectedDart();
48  if (last!=NULL)
49  {
50  CVertex v = FMap->centerOfBoundingBox(last,ORBIT_01);
51  getParameterAimedPosition(AView)->setLookAt(0,v.getX());
52  getParameterAimedPosition(AView)->setLookAt(1,v.getY());
53  getParameterAimedPosition(AView)->setLookAt(2,v.getZ());
54  return true;
55  }
56  return false;
57 }
58 //******************************************************************************
60 {
61  CDart *last=getLastSelectedDart();
62  if (last!=NULL)
63  {
64  CVertex v = FMap->centerOfBoundingBox(last,ORBIT_012);
65  getParameterAimedPosition(AView)->setLookAt(0,v.getX());
66  getParameterAimedPosition(AView)->setLookAt(1,v.getY());
67  getParameterAimedPosition(AView)->setLookAt(2,v.getZ());
68  return true;
69  }
70  return false;
71 }
72 //******************************************************************************
74 {
75  CDart *last=getLastSelectedDart();
76  if (last!=NULL)
77  {
78  CVertex v = FMap->centerOfBoundingBox(last,ORBIT_0123);
79  getParameterAimedPosition(AView)->setLookAt(0,v.getX());
80  getParameterAimedPosition(AView)->setLookAt(1,v.getY());
81  getParameterAimedPosition(AView)->setLookAt(2,v.getZ());
82  return true;
83  }
84  return false;
85 }
86 //******************************************************************************
88 {
89  CVertex v = FMap->centerOfBoundingBox(getSelectionMark());
90 
91  getParameterAimedPosition(AView)->setLookAt(0,v.getX());
92  getParameterAimedPosition(AView)->setLookAt(1,v.getY());
93  getParameterAimedPosition(AView)->setLookAt(2,v.getZ());
94 
95  return true;
96 }
97 //******************************************************************************
99 {
100  int mark = FMap->getNewMark();
101 
102  FMap->negateMaskMark(mark);
103 
104  CVertex v = FMap->centerOfBoundingBox(mark);
105 
106  FMap->negateMaskMark(mark);
107 
108  FMap->freeMark(mark);
109 
110  getParameterAimedPosition(AView)->setLookAt(0,v.getX());
111  getParameterAimedPosition(AView)->setLookAt(1,v.getY());
112  getParameterAimedPosition(AView)->setLookAt(2,v.getZ());
113 
114  return true;
115 }
116 //******************************************************************************