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