Moka controlers
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
parameter-object-transformation.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-types.hh"
28 #include <cassert>
29 #include <cstring>
30 using namespace std;
31 using namespace GMap3d;
32 //******************************************************************************
33 CParameterObjectTransformation::CParameterObjectTransformation(int ANbRef) :
34  CParameter(ANbRef)
35 {
36  reinit();
37 }
38 //******************************************************************************
41  CParameter (AParam),
42  FLWObjectTransformation(AParam.FLWObjectTransformation)
43 {
45 }
46 //******************************************************************************
48 {}
49 //******************************************************************************
51 { return new CParameterObjectTransformation(*this); }
52 //******************************************************************************
54 { AStream<<(*this); }
55 //------------------------------------------------------------------------------
57 { AStream>>(*this); }
58 //------------------------------------------------------------------------------
60 {
61  FLWObjectTransformation = DEFAULT_OBJECT_TRANSFORMATION_LINE_WIDTH;
65 
67 }
68 //******************************************************************************
69 namespace GMap3d
70 {
71 //------------------------------------------------------------------------------
72 ostream& operator<<(ostream& AStream,
73  const CParameterObjectTransformation & AParameter)
74 {
75  AStream<<"CParameterObjectTransformation:"<<endl;
76 
77  AStream<<" LineWidth: "<<AParameter.FLWObjectTransformation<<endl;
78 
79  AStream<<" Color: "<<AParameter.FCLObjectTransformation[0]<<" "
80  <<AParameter.FCLObjectTransformation[1]<<" "
81  <<AParameter.FCLObjectTransformation[2]<<endl;
82 
83  AStream<<endl;
84 
85  return AStream;
86 }
87 //------------------------------------------------------------------------------
88 istream& operator>>(istream& AStream,
89  CParameterObjectTransformation & AParameter)
90 {
91  char tmp[256];
92 
93  AStream>>tmp; assert ( !strcmp(tmp, "CParameterObjectTransformation:") );
94 
95  AStream>>tmp; assert ( !strcmp(tmp, "LineWidth:") );
96  AStream>>AParameter.FLWObjectTransformation;
97 
98  AStream>>tmp; assert ( !strcmp(tmp, "Color:") );
99  AStream>>AParameter.FCLObjectTransformation[0]
100  >>AParameter.FCLObjectTransformation[1]
101  >>AParameter.FCLObjectTransformation[2];
102 
103  AParameter.putAllNeedToUpdate();
104 
105  return AStream;
106 }
107 //------------------------------------------------------------------------------
108 } // namespace GMap3d
109 //******************************************************************************
111 { return FLWObjectTransformation; }
113 {
114  if ( FLWObjectTransformation!=AValue )
115  {
117  FLWObjectTransformation= AValue;
118  }
119 }
120 //******************************************************************************
122 {
123  assert(0<=AIndice && AIndice<=2);
124  return FCLObjectTransformation[AIndice];
125 }
127  float AValue)
128 {
129  assert(0<=AIndice && AIndice<=2);
130  if ( FCLObjectTransformation[AIndice]!=AValue )
131  {
133  FCLObjectTransformation[AIndice]= AValue;
134  }
135 }
137 { return FCLObjectTransformation; }
139  float AValue1,
140  float AValue2)
141 {
142  if ( FCLObjectTransformation[0]!=AValue0 ||
143  FCLObjectTransformation[1]!=AValue1 ||
144  FCLObjectTransformation[2]!=AValue2 )
145  {
147  FCLObjectTransformation[0]= AValue0;
148  FCLObjectTransformation[1]= AValue1;
149  FCLObjectTransformation[2]= AValue2;
150  }
151 }
153 setCLObjectTransformation(const float ATab[3])
154 { setCLObjectTransformation(ATab[0],ATab[1],ATab[2]); }
155 //******************************************************************************
158 //******************************************************************************