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 "parameter-polyline-position.hh" 00026 #include "vertex.hh" 00027 #include "controler-gmap-types.hh" 00028 using namespace std; 00029 using namespace GMap3d; 00030 //****************************************************************************** 00031 CParameterPolylinePosition::CParameterPolylinePosition(int ANbRef) : 00032 CParameter(ANbRef) 00033 {} 00034 //****************************************************************************** 00035 CParameterPolylinePosition:: 00036 CParameterPolylinePosition(const CParameterPolylinePosition & AParam) : 00037 CParameter (AParam), 00038 FVertexList(AParam.FVertexList) 00039 {} 00040 //****************************************************************************** 00041 CParameterPolylinePosition::~CParameterPolylinePosition() 00042 {} 00043 //****************************************************************************** 00044 CParameter * CParameterPolylinePosition::copy() const 00045 { return new CParameterPolylinePosition(*this); } 00046 //****************************************************************************** 00047 void CParameterPolylinePosition::load(istream& /*AStream*/) 00048 {} 00049 //------------------------------------------------------------------------------ 00050 void CParameterPolylinePosition::save(ostream& /*AStream*/) 00051 {} 00052 //------------------------------------------------------------------------------ 00053 void CParameterPolylinePosition::reinit() 00054 { 00055 if ( getNbVertices()>0 ) 00056 { 00057 FVertexList.clear(); 00058 putAllNeedToUpdate(); 00059 } 00060 } 00061 //****************************************************************************** 00062 unsigned int CParameterPolylinePosition::getNbVertices() const 00063 { return FVertexList.size(); } 00064 //****************************************************************************** 00065 const CVertex & CParameterPolylinePosition::getVertex(unsigned int AIndex) const 00066 { 00067 assert( AIndex<getNbVertices() ); 00068 return FVertexList[AIndex]; 00069 } 00070 //****************************************************************************** 00071 const CVertex & CParameterPolylinePosition::getLastVertex() const 00072 { 00073 assert( getNbVertices()>0 ); 00074 return FVertexList[FVertexList.size()-1]; 00075 } 00076 //****************************************************************************** 00077 const vector<CVertex> & CParameterPolylinePosition::getVertices() const 00078 { return FVertexList; } 00079 //****************************************************************************** 00080 void CParameterPolylinePosition::removeLastVertex() 00081 { 00082 if ( getNbVertices()>0 ) 00083 { 00084 FVertexList.pop_back(); 00085 putAllNeedToUpdate(); 00086 } 00087 } 00088 //****************************************************************************** 00089 void CParameterPolylinePosition::addVertex(const CVertex & AVertex) 00090 { 00091 FVertexList.push_back(AVertex); 00092 putAllNeedToUpdate(); 00093 } 00094 //****************************************************************************** 00095 void CParameterPolylinePosition::setVertex(unsigned int AIndex, 00096 const CVertex & AVertex) 00097 { 00098 assert( AIndex<getNbVertices() ); 00099 if ( FVertexList[AIndex]!=AVertex ) 00100 { 00101 FVertexList[AIndex] = AVertex; 00102 putAllNeedToUpdate(); 00103 } 00104 } 00105 //****************************************************************************** 00106 void CParameterPolylinePosition::setLastVertex(const CVertex & AVertex) 00107 { 00108 assert( getNbVertices()>0 ); 00109 setVertex(FVertexList.size()-1,AVertex); 00110 } 00111 //****************************************************************************** 00112 int CParameterPolylinePosition::getType() const 00113 { return PARAMETER_POLYLINE_POSITION; } 00114 //******************************************************************************
1.5.8