00001 /* 00002 * lib-controler-gmap : Le contrôleur de 3-G-cartes, surcouche de lib-controler. 00003 * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC 00004 * http://www.sic.sp2mi.univ-poitiers.fr/ 00005 * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS, 00006 * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/ 00007 * 00008 * This file is part of lib-controler-gmap 00009 * 00010 * This program is free software: you can redistribute it and/or modify 00011 * it under the terms of the GNU Lesser General Public License as published by 00012 * the Free Software Foundation, either version 3 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public License 00021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00022 */ 00023 00024 //****************************************************************************** 00025 #include "controler-gmap-types.hh" 00026 #include "precompile-vertex.hh" 00027 #include "dart-vertex.hh" 00028 #include "parameter-gmap-vertex.hh" 00029 #include "parameter-vertex.hh" 00030 #include <cassert> 00031 using namespace GMap3d; 00032 //****************************************************************************** 00033 CPrecompileVertex::CPrecompileVertex(CParameterGMapVertex * AParameterGMapV, 00034 CParameterVertex * AParameterVertex) : 00035 FParameterGMapV (AParameterGMapV), 00036 FParameterVertex (AParameterVertex) 00037 { 00038 assert(FParameterGMapV!=NULL && FParameterVertex!=NULL); 00039 00040 FParameterGMapV->addPrecompileToUpdate(this); 00041 FParameterVertex->addPrecompileToUpdate(this); 00042 } 00043 //****************************************************************************** 00044 CPrecompileVertex::CPrecompileVertex(const CPrecompileVertex & APrecompile) : 00045 CPrecompile (APrecompile), 00046 FParameterGMapV (APrecompile.FParameterGMapV), 00047 FParameterVertex (static_cast<CParameterVertex*> 00048 (APrecompile.FParameterVertex->copy())) 00049 { 00050 assert(FParameterGMapV!=NULL && FParameterVertex!=NULL); 00051 00052 FParameterGMapV->addPrecompileToUpdate(this); 00053 FParameterVertex->addPrecompileToUpdate(this); 00054 } 00055 //****************************************************************************** 00056 CPrecompileVertex::~CPrecompileVertex() 00057 { 00058 FParameterGMapV->removePrecompileToUpdate(this); 00059 FParameterVertex->removePrecompileToUpdate(this); 00060 } 00061 //****************************************************************************** 00062 CPrecompile * CPrecompileVertex::copy() const 00063 { return new CPrecompileVertex(*this); } 00064 //****************************************************************************** 00065 void CPrecompileVertex::setParameter(CParameter * AParameter) 00066 { 00067 switch (AParameter->getType()) 00068 { 00069 case PARAMETER_GMAP_VERTEX: 00070 setGMapVertex(static_cast<CParameterGMapVertex *>(AParameter)); 00071 break; 00072 case PARAMETER_VERTEX: 00073 setVertex(static_cast<CParameterVertex *>(AParameter)); 00074 break; 00075 } 00076 } 00077 //****************************************************************************** 00078 CParameter* CPrecompileVertex::getParameter() const 00079 { return FParameterVertex; } 00080 //****************************************************************************** 00081 void CPrecompileVertex::setGMapVertex(CParameterGMapVertex* AParameterGMapV) 00082 { 00083 assert(AParameterGMapV != NULL); 00084 AParameterGMapV->addPrecompileToUpdate(this); 00085 FParameterGMapV->removePrecompileToUpdate(this); 00086 FParameterGMapV = AParameterGMapV; 00087 setToUpdate(); 00088 } 00089 //****************************************************************************** 00090 void CPrecompileVertex::setVertex(CParameterVertex * AVertex) 00091 { 00092 assert(AVertex != NULL); 00093 AVertex->addPrecompileToUpdate(this); 00094 FParameterVertex->removePrecompileToUpdate(this); 00095 FParameterVertex = AVertex; 00096 setToUpdate(); 00097 } 00098 //****************************************************************************** 00099 TPrecompile CPrecompileVertex::getType() const 00100 { return PRECOMPILE_VERTEX; } 00101 //****************************************************************************** 00102 void CPrecompileVertex::drawModel() 00103 { 00104 glPointSize(FParameterVertex->getSVertex()); 00105 glColor3fv(FParameterVertex->getCLVertex()); 00106 00107 glBegin(GL_POINTS); 00108 00109 for (CDynamicCoverageAll it(FParameterGMapV->getMap()); it.cont(); ++it) 00110 { 00111 CVertex * vertex = FParameterGMapV->getMap()->getVertex(*it); 00112 00113 if (vertex != NULL) 00114 PLOT(vertex); 00115 } 00116 00117 glEnd(); 00118 } 00119 //******************************************************************************
1.5.8