Moka controlers
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
parameter-polyline-position.cc
Go to the documentation of this file.
1 /*
2  * lib-controler-gmap : Le contrôleur de 3-G-cartes, surcouche de lib-controler.
3  * Copyright (C) 2004, Moka Team, Université de Poitiers, Laboratoire SIC
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * Copyright (C) 2009, Guillaume Damiand, CNRS, LIRIS,
6  * guillaume.damiand@liris.cnrs.fr, http://liris.cnrs.fr/
7  *
8  * This file is part of lib-controler-gmap
9  *
10  * This program is free software: you can redistribute it and/or modify
11  * it under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation, either version 3 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 //******************************************************************************
26 #include "vertex.hh"
27 #include "controler-gmap-types.hh"
28 using namespace std;
29 using namespace GMap3d;
30 //******************************************************************************
31 CParameterPolylinePosition::CParameterPolylinePosition(int ANbRef) :
32  CParameter(ANbRef)
33 {}
34 //******************************************************************************
37  CParameter (AParam),
38  FVertexList(AParam.FVertexList)
39 {}
40 //******************************************************************************
42 {}
43 //******************************************************************************
45 { return new CParameterPolylinePosition(*this); }
46 //******************************************************************************
47 void CParameterPolylinePosition::load(istream& /*AStream*/)
48 {}
49 //------------------------------------------------------------------------------
50 void CParameterPolylinePosition::save(ostream& /*AStream*/)
51 {}
52 //------------------------------------------------------------------------------
54 {
55  if ( getNbVertices()>0 )
56  {
57  FVertexList.clear();
59  }
60 }
61 //******************************************************************************
63 { return FVertexList.size(); }
64 //******************************************************************************
65 const CVertex & CParameterPolylinePosition::getVertex(unsigned int AIndex) const
66 {
67  assert( AIndex<getNbVertices() );
68  return FVertexList[AIndex];
69 }
70 //******************************************************************************
72 {
73  assert( getNbVertices()>0 );
74  return FVertexList[FVertexList.size()-1];
75 }
76 //******************************************************************************
77 const vector<CVertex> & CParameterPolylinePosition::getVertices() const
78 { return FVertexList; }
79 //******************************************************************************
81 {
82  if ( getNbVertices()>0 )
83  {
84  FVertexList.pop_back();
86  }
87 }
88 //******************************************************************************
89 void CParameterPolylinePosition::addVertex(const CVertex & AVertex)
90 {
91  FVertexList.push_back(AVertex);
93 }
94 //******************************************************************************
95 void CParameterPolylinePosition::setVertex(unsigned int AIndex,
96  const CVertex & AVertex)
97 {
98  assert( AIndex<getNbVertices() );
99  if ( FVertexList[AIndex]!=AVertex )
100  {
101  FVertexList[AIndex] = AVertex;
103  }
104 }
105 //******************************************************************************
106 void CParameterPolylinePosition::setLastVertex(const CVertex & AVertex)
107 {
108  assert( getNbVertices()>0 );
109  setVertex(FVertexList.size()-1,AVertex);
110 }
111 //******************************************************************************
113 { return PARAMETER_POLYLINE_POSITION; }
114 //******************************************************************************