Visual Servoing Platform  version 3.2.0
vpMbXmlParser.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Load XML Parameter for Model Based Tracker.
33  *
34  * Authors:
35  * Aurelien Yol
36  *
37  *****************************************************************************/
38 
45 #ifndef vpMbXmlParser_HH
46 #define vpMbXmlParser_HH
47 
48 #include <visp3/core/vpConfig.h>
49 
50 #ifdef VISP_HAVE_XML2
51 
52 #include <libxml/xmlmemory.h> /* Fonctions de la lib XML. */
53 
54 #include <visp3/core/vpCameraParameters.h>
55 #include <visp3/core/vpXmlParser.h>
56 
65 class VISP_EXPORT vpMbXmlParser : public vpXmlParser
66 {
67 protected:
71  double angleAppear;
73  double angleDisappear;
75  bool hasNearClipping;
77  double nearClipping;
79  bool hasFarClipping;
81  double farClipping;
83  bool fovClipping;
85  bool useLod;
87  double minLineLengthThreshold;
89  double minPolygonAreaThreshold;
90 
91  typedef enum {
92  conf,
93  face,
94  angle_appear,
95  angle_disappear,
96  near_clipping,
97  far_clipping,
98  fov_clipping,
99  camera,
100  height,
101  width,
102  u0,
103  v0,
104  px,
105  py,
106  lod,
107  use_lod,
108  min_line_length_threshold,
109  min_polygon_area_threshold,
110  last
111  } dataToParseMb;
112 
113 public:
116  vpMbXmlParser();
117  virtual ~vpMbXmlParser();
118 
124  inline double getAngleAppear() const { return angleAppear; }
125 
131  inline double getAngleDisappear() const { return angleDisappear; }
132 
133  void getCameraParameters(vpCameraParameters &_cam) const { _cam = this->cam; }
134 
140  inline double getFarClippingDistance() const { return farClipping; }
141 
147  inline bool getFovClipping() const { return fovClipping; }
148 
154  inline bool getLodState() const { return useLod; }
155 
161  inline double getMinLineLengthThreshold() const { return minLineLengthThreshold; }
162 
168  inline double getMinPolygonAreaThreshold() const { return minPolygonAreaThreshold; }
169 
175  inline double getNearClippingDistance() const { return nearClipping; }
176 
182  inline bool hasFarClippingDistance() const { return hasFarClipping; }
183 
189  inline bool hasNearClippingDistance() const { return hasNearClipping; }
190 
191  virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node);
192  void read_camera(xmlDocPtr doc, xmlNodePtr node);
193  void read_face(xmlDocPtr doc, xmlNodePtr node);
194  void read_lod(xmlDocPtr doc, xmlNodePtr node);
195 
201  inline void setAngleAppear(const double &aappear) { angleAppear = aappear; }
202 
208  inline void setAngleDisappear(const double &adisappear) { angleDisappear = adisappear; }
209 
210  void setCameraParameters(const vpCameraParameters &_cam) { cam = _cam; }
211 
217  inline void setFarClippingDistance(const double &fclip) { farClipping = fclip; }
218 
224  inline void setNearClippingDistance(const double &nclip) { nearClipping = nclip; }
225 
226  void writeMainClass(xmlNodePtr node);
228 
229 protected:
232  void init();
234 };
235 
236 #endif
237 
238 #endif /* NMBXMLPARSER_H_ */
vpXmlParser
This class intends to simplify the creation of xml parser based on the libxml2 third party library.
Definition: vpXmlParser.h:176
vpCameraParameters
Generic class defining intrinsic camera parameters.
Definition: vpCameraParameters.h:232
vpMbXmlParser
Parse an Xml file to extract configuration parameters of a mbtConfig object.
Definition: vpMbXmlParser.h:64
vpXmlParser::writeMainClass
virtual void writeMainClass(xmlNodePtr node)=0
vpXmlParser::readMainClass
virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node)=0