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-gmap-types.hh"
00026 #include "parameters-gmap-default-values.hh"
00027 #include "parameter-object-transformation.hh"
00028 #include <cassert>
00029 #include <cstring>
00030 using namespace std;
00031 using namespace GMap3d;
00032
00033 CParameterObjectTransformation::CParameterObjectTransformation(int ANbRef) :
00034 CParameter(ANbRef)
00035 {
00036 reinit();
00037 }
00038
00039 CParameterObjectTransformation::
00040 CParameterObjectTransformation(const CParameterObjectTransformation & AParam) :
00041 CParameter (AParam),
00042 FLWObjectTransformation(AParam.FLWObjectTransformation)
00043 {
00044 setCLObjectTransformation(AParam.getCLObjectTransformation());
00045 }
00046
00047 CParameterObjectTransformation::~CParameterObjectTransformation()
00048 {}
00049
00050 CParameter * CParameterObjectTransformation::copy() const
00051 { return new CParameterObjectTransformation(*this); }
00052
00053 void CParameterObjectTransformation::save(ostream& AStream)
00054 { AStream<<(*this); }
00055
00056 void CParameterObjectTransformation::load(istream& AStream)
00057 { AStream>>(*this); }
00058
00059 void CParameterObjectTransformation::reinit()
00060 {
00061 FLWObjectTransformation = DEFAULT_OBJECT_TRANSFORMATION_LINE_WIDTH;
00062 setCLObjectTransformation(DEFAULT_OBJECT_TRANSFORMATION_COLOR_0,
00063 DEFAULT_OBJECT_TRANSFORMATION_COLOR_1,
00064 DEFAULT_OBJECT_TRANSFORMATION_COLOR_2);
00065
00066 putAllNeedToUpdate();
00067 }
00068
00069 namespace GMap3d
00070 {
00071
00072 ostream& operator<<(ostream& AStream,
00073 const CParameterObjectTransformation & AParameter)
00074 {
00075 AStream<<"CParameterObjectTransformation:"<<endl;
00076
00077 AStream<<" LineWidth: "<<AParameter.FLWObjectTransformation<<endl;
00078
00079 AStream<<" Color: "<<AParameter.FCLObjectTransformation[0]<<" "
00080 <<AParameter.FCLObjectTransformation[1]<<" "
00081 <<AParameter.FCLObjectTransformation[2]<<endl;
00082
00083 AStream<<endl;
00084
00085 return AStream;
00086 }
00087
00088 istream& operator>>(istream& AStream,
00089 CParameterObjectTransformation & AParameter)
00090 {
00091 char tmp[256];
00092
00093 AStream>>tmp; assert ( !strcmp(tmp, "CParameterObjectTransformation:") );
00094
00095 AStream>>tmp; assert ( !strcmp(tmp, "LineWidth:") );
00096 AStream>>AParameter.FLWObjectTransformation;
00097
00098 AStream>>tmp; assert ( !strcmp(tmp, "Color:") );
00099 AStream>>AParameter.FCLObjectTransformation[0]
00100 >>AParameter.FCLObjectTransformation[1]
00101 >>AParameter.FCLObjectTransformation[2];
00102
00103 AParameter.putAllNeedToUpdate();
00104
00105 return AStream;
00106 }
00107
00108 }
00109
00110 int CParameterObjectTransformation::getLWObjectTransformation() const
00111 { return FLWObjectTransformation; }
00112 void CParameterObjectTransformation::setLWObjectTransformation(int AValue)
00113 {
00114 if ( FLWObjectTransformation!=AValue )
00115 {
00116 putAllNeedToUpdate();
00117 FLWObjectTransformation= AValue;
00118 }
00119 }
00120
00121 float CParameterObjectTransformation::getCLObjectTransformation(int AIndice) const
00122 {
00123 assert(0<=AIndice && AIndice<=2);
00124 return FCLObjectTransformation[AIndice];
00125 }
00126 void CParameterObjectTransformation::setCLObjectTransformation(int AIndice,
00127 float AValue)
00128 {
00129 assert(0<=AIndice && AIndice<=2);
00130 if ( FCLObjectTransformation[AIndice]!=AValue )
00131 {
00132 putAllNeedToUpdate();
00133 FCLObjectTransformation[AIndice]= AValue;
00134 }
00135 }
00136 const float * CParameterObjectTransformation::getCLObjectTransformation() const
00137 { return FCLObjectTransformation; }
00138 void CParameterObjectTransformation::setCLObjectTransformation(float AValue0,
00139 float AValue1,
00140 float AValue2)
00141 {
00142 if ( FCLObjectTransformation[0]!=AValue0 ||
00143 FCLObjectTransformation[1]!=AValue1 ||
00144 FCLObjectTransformation[2]!=AValue2 )
00145 {
00146 putAllNeedToUpdate();
00147 FCLObjectTransformation[0]= AValue0;
00148 FCLObjectTransformation[1]= AValue1;
00149 FCLObjectTransformation[2]= AValue2;
00150 }
00151 }
00152 void CParameterObjectTransformation::
00153 setCLObjectTransformation(const float ATab[3])
00154 { setCLObjectTransformation(ATab[0],ATab[1],ATab[2]); }
00155
00156 int CParameterObjectTransformation::getType() const
00157 { return PARAMETER_OBJECT_TRANSFORMATION; }
00158