00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "controler-types.hh"
00026 #include "parameters-default-values.hh"
00027 #include "parameter-axis.hh"
00028 #include <cassert>
00029 #include <cstring>
00030 using namespace std;
00031
00032 CParameterAxis::CParameterAxis(int ANbRef) :
00033 CParameter(ANbRef)
00034 {
00035 reinit();
00036 }
00037
00038 CParameterAxis::CParameterAxis(const CParameterAxis & AParam) :
00039 CParameter(AParam),
00040 FLWAxis (AParam.FLWAxis),
00041 FLGAxis (AParam.FLGAxis)
00042 {
00043 setCLAxisX(AParam.getCLAxisX());
00044 setCLAxisY(AParam.getCLAxisY());
00045 setCLAxisZ(AParam.getCLAxisZ());
00046 }
00047
00048 CParameterAxis::~CParameterAxis()
00049 {}
00050
00051 CParameter * CParameterAxis::copy() const
00052 { return new CParameterAxis(*this); }
00053
00054 void CParameterAxis::save(ostream& AStream)
00055 { AStream<<(*this); }
00056
00057 void CParameterAxis::load(istream& AStream)
00058 { AStream>>(*this); }
00059
00060 void CParameterAxis::reinit()
00061 {
00062 FLWAxis = DEFAULT_AXIS_LINE_WIDTH;
00063 FLGAxis = DEFAULT_AXIS_LENGTH;
00064
00065 setCLAxisX(DEFAULT_AXIS_COLOR_X_0,
00066 DEFAULT_AXIS_COLOR_X_1,
00067 DEFAULT_AXIS_COLOR_X_2);
00068
00069 setCLAxisY(DEFAULT_AXIS_COLOR_Y_0,
00070 DEFAULT_AXIS_COLOR_Y_1,
00071 DEFAULT_AXIS_COLOR_Y_2);
00072
00073 setCLAxisZ(DEFAULT_AXIS_COLOR_Z_0,
00074 DEFAULT_AXIS_COLOR_Z_1,
00075 DEFAULT_AXIS_COLOR_Z_2);
00076
00077 putAllNeedToUpdate();
00078 }
00079
00080 ostream& operator<<(ostream& AStream, const CParameterAxis & AParameter)
00081 {
00082 AStream<<"CParameterAxis:"<<endl;
00083
00084 AStream<<" LineWidth: "<<AParameter.FLWAxis<<endl;
00085
00086 AStream<<" Length: "<<AParameter.FLGAxis<<endl;
00087
00088 AStream<<" ColorX: "<<AParameter.FCLAxisX[0]<<" "
00089 <<AParameter.FCLAxisX[1]<<" "<<AParameter.FCLAxisX[2]<<endl;
00090
00091 AStream<<" ColorY: "<<AParameter.FCLAxisY[0]<<" "
00092 <<AParameter.FCLAxisY[1]<<" "<<AParameter.FCLAxisY[2]<<endl;
00093
00094 AStream<<" ColorZ: "<<AParameter.FCLAxisZ[0]<<" "
00095 <<AParameter.FCLAxisZ[1]<<" "<<AParameter.FCLAxisZ[2]<<endl;
00096
00097 AStream<<endl;
00098
00099 return AStream;
00100 }
00101
00102 istream& operator>>(istream& AStream,
00103 CParameterAxis & AParameter)
00104 {
00105 char tmp[256];
00106
00107 AStream>>tmp; assert ( !strcmp(tmp, "CParameterAxis:") );
00108
00109 AStream>>tmp; assert ( !strcmp(tmp, "LineWidth:") );
00110 AStream>>AParameter.FLWAxis;
00111
00112 AStream>>tmp; assert ( !strcmp(tmp, "Length:") );
00113 AStream>>AParameter.FLGAxis;
00114
00115 AStream>>tmp; assert ( !strcmp(tmp, "ColorX:") );
00116 AStream>>AParameter.FCLAxisX[0]>>AParameter.FCLAxisX[1]
00117 >>AParameter.FCLAxisX[2];
00118
00119 AStream>>tmp; assert ( !strcmp(tmp, "ColorY:") );
00120 AStream>>AParameter.FCLAxisY[0]>>AParameter.FCLAxisY[1]
00121 >>AParameter.FCLAxisY[2];
00122
00123 AStream>>tmp; assert ( !strcmp(tmp, "ColorZ:") );
00124 AStream>>AParameter.FCLAxisZ[0]>>AParameter.FCLAxisZ[1]
00125 >>AParameter.FCLAxisZ[2];
00126
00127 AParameter.putAllNeedToUpdate();
00128
00129 return AStream;
00130 }
00131
00132 int CParameterAxis::getLWAxis() const
00133 { return FLWAxis; }
00134 void CParameterAxis::setLWAxis(int AValue)
00135 {
00136 if ( FLWAxis!=AValue )
00137 {
00138 putAllNeedToUpdate();
00139 FLWAxis= AValue;
00140 }
00141 }
00142
00143 float CParameterAxis::getLGAxis() const
00144 { return FLGAxis; }
00145 void CParameterAxis::setLGAxis(float AValue)
00146 {
00147 if ( FLGAxis!=AValue )
00148 {
00149 putAllNeedToUpdate();
00150 FLGAxis= AValue;
00151 }
00152 }
00153
00154 float CParameterAxis::getCLAxisX(int AIndice) const
00155 {
00156 assert(0<=AIndice && AIndice<=2);
00157 return FCLAxisX[AIndice];
00158 }
00159 void CParameterAxis::setCLAxisX(int AIndice, float AValue)
00160 {
00161 assert(0<=AIndice && AIndice<=2);
00162 if ( FCLAxisX[AIndice]!=AValue )
00163 {
00164 putAllNeedToUpdate();
00165 FCLAxisX[AIndice]= AValue;
00166 }
00167 }
00168 const float * CParameterAxis::getCLAxisX() const
00169 { return FCLAxisX; }
00170 void CParameterAxis::setCLAxisX(float AValue0, float AValue1, float AValue2)
00171 {
00172 if ( FCLAxisX[0]!=AValue0 ||
00173 FCLAxisX[1]!=AValue1 ||
00174 FCLAxisX[2]!=AValue2 )
00175 {
00176 putAllNeedToUpdate();
00177 FCLAxisX[0]= AValue0;
00178 FCLAxisX[1]= AValue1;
00179 FCLAxisX[2]= AValue2;
00180 }
00181 }
00182 void CParameterAxis::setCLAxisX(const float ATab[3])
00183 { setCLAxisX(ATab[0],ATab[1],ATab[2]); }
00184
00185 float CParameterAxis::getCLAxisY(int AIndice) const
00186 {
00187 assert(0<=AIndice && AIndice<=2);
00188 return FCLAxisY[AIndice];
00189 }
00190 void CParameterAxis::setCLAxisY(int AIndice, float AValue)
00191 {
00192 assert(0<=AIndice && AIndice<=2);
00193 if ( FCLAxisY[AIndice]!=AValue )
00194 {
00195 putAllNeedToUpdate();
00196 FCLAxisY[AIndice]= AValue;
00197 }
00198 }
00199 const float * CParameterAxis::getCLAxisY() const
00200 { return FCLAxisY; }
00201 void CParameterAxis::setCLAxisY(float AValue0, float AValue1, float AValue2)
00202 {
00203 if ( FCLAxisY[0]!=AValue0 ||
00204 FCLAxisY[1]!=AValue1 ||
00205 FCLAxisY[2]!=AValue2 )
00206 {
00207 putAllNeedToUpdate();
00208 FCLAxisY[0]= AValue0;
00209 FCLAxisY[1]= AValue1;
00210 FCLAxisY[2]= AValue2;
00211 }
00212 }
00213 void CParameterAxis::setCLAxisY(const float ATab[3])
00214 { setCLAxisY(ATab[0],ATab[1],ATab[2]); }
00215
00216 float CParameterAxis::getCLAxisZ(int AIndice) const
00217 {
00218 assert(0<=AIndice && AIndice<=2);
00219 return FCLAxisZ[AIndice];
00220 }
00221 void CParameterAxis::setCLAxisZ(int AIndice, float AValue)
00222 {
00223 assert(0<=AIndice && AIndice<=2);
00224 if ( FCLAxisZ[AIndice]!=AValue )
00225 {
00226 putAllNeedToUpdate();
00227 FCLAxisZ[AIndice]= AValue;
00228 }
00229 }
00230 const float * CParameterAxis::getCLAxisZ() const
00231 { return FCLAxisZ; }
00232 void CParameterAxis::setCLAxisZ(float AValue0, float AValue1, float AValue2)
00233 {
00234 if ( FCLAxisZ[0]!=AValue0 ||
00235 FCLAxisZ[1]!=AValue1 ||
00236 FCLAxisZ[2]!=AValue2 )
00237 {
00238 putAllNeedToUpdate();
00239 FCLAxisZ[0]= AValue0;
00240 FCLAxisZ[1]= AValue1;
00241 FCLAxisZ[2]= AValue2;
00242 }
00243 }
00244 void CParameterAxis::setCLAxisZ(const float ATab[3])
00245 { setCLAxisZ(ATab[0],ATab[1],ATab[2]); }
00246
00247 int CParameterAxis::getType() const
00248 { return PARAMETER_AXIS; }
00249