Moka controlers
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros
controler-gmap.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 //******************************************************************************
25 #include "controler-gmap.hh"
26 #include "view-precompile.hh"
27 #include <cstdlib>
28 #include <sys/types.h>
29 #include <sys/stat.h>
30 #include <fcntl.h>
31 
32 using namespace std;
33 using namespace GMap3d;
34 //******************************************************************************
35 CControlerGMap::CControlerGMap(CGMapVertex* AGMapVertex,
36  const string & ADirectory) :
38  CONTROLER_GMAP_DIRECTORY, ADirectory),
39  // controler-gmap-object-transformation.hh
41 #ifdef MODULE_ROUNDING
42  // controler-gmap-rounding.hh
43  FRounding(NULL),
44 #endif // MODULE_ROUNDING
45  FDeselectMode(false),
46  // controler-gmap-protected-methods.hh
47  FNbDarts(0),
49  FNbVertices(0),
50  // controler-gmap.hh
51  FMap(AGMapVertex == NULL ? new CGMapVertex() : AGMapVertex),
52  FParameterGMapVertex(new CParameterGMapVertex(FMap, 1)),
53  FParameterSelection(new CParameterSelection(this, NB_SELECTION_LEVELS,
54  1)),
55  FParameterCreation(new CParameterCreation(1)),
56  FParameterPolylinePosition(new CParameterPolylinePosition(1)),
57  FParameterOperations(new CParameterOperations(1)),
58  FParameterTranslation(new CParameterObjectTranslation(1)),
59  FParameterRotation(new CParameterObjectRotation(1)),
60  FParameterScale(new CParameterObjectScale(1)),
61  FParameterPonderation(new CParameterObjectPonderation(1))
62 {
63  assert(FMap != NULL);
64 
65  for (int i = 0; i < NB_PREDEFINED_OBJECTS; ++i)
66  {
67  bool rotate = i == OBJECT_SPHERE || i == OBJECT_PYRAMID
68  || i == OBJECT_CYLINDER;
69  FParameterObjectPosition[i] = new CParameterObjectPosition(rotate, 1);
70  }
71 }
72 //******************************************************************************
74 {
75  FParameterGMapVertex->decNbRef();
76  FParameterSelection->decNbRef();
77  FParameterCreation->decNbRef();
78  FParameterPolylinePosition->decNbRef();
79  FParameterOperations->decNbRef();
80  FParameterTranslation->decNbRef();
81  FParameterRotation->decNbRef();
82  FParameterScale->decNbRef();
83  FParameterPonderation->decNbRef();
84 
85  for (int i = 0; i < NB_PREDEFINED_OBJECTS; ++i)
86  FParameterObjectPosition[i]->decNbRef();
87 }
88 //******************************************************************************
89 CGMapVertex* CControlerGMap::getMap()
90 { return FMap; }
91 //******************************************************************************