ViSP  2.8.0
vpMbtXmlParser.h
1 /****************************************************************************
2  *
3  * $Id: vpMbtXmlParser.h 4320 2013-07-17 15:37:27Z ayol $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * Make the complete tracking of an object by using its CAD model
36  *
37  * Authors:
38  * Nicolas Melchior
39  * Romain Tallonneau
40  * Eric Marchand
41  *
42  *****************************************************************************/
43 
49 #ifndef vpMbtXmlParser_HH
50 #define vpMbtXmlParser_HH
51 
52 #include <visp/vpConfig.h>
53 
54 #ifdef VISP_HAVE_XML2
55 
56 #include <libxml/xmlmemory.h> /* Fonctions de la lib XML. */
57 
58 #include <visp/vpXmlParser.h>
59 #include <visp/vpMe.h>
60 #include <visp/vpCameraParameters.h>
61 
62 
63 
72 class VISP_EXPORT vpMbtXmlParser: public vpXmlParser
73 {
74 protected:
80  double angleAppear;
86  double nearClipping;
90  double farClipping;
93 
94  typedef enum{
96  ecm,
118  u0,
119  v0,
120  px,
121  py
122  } dataToParse;
123 
124 
125 public:
126 
127  vpMbtXmlParser();
128  virtual ~vpMbtXmlParser();
129 
135  inline double getAngleAppear() const {return angleAppear;}
136 
142  inline double getAngleDisappear() const {return angleDisappear;}
143 
144  void getCameraParameters(vpCameraParameters& _cam) const { _cam = this->cam;}
145 
151  inline double getFarClippingDistance() const {return farClipping;}
152 
158  inline bool getFovClipping() const {return fovClipping;}
159 
160  void getMe(vpMe& _ecm) const { _ecm = this->m_ecm;}
161 
167  inline double getNearClippingDistance() const {return nearClipping;}
168 
174  inline bool hasFarClippingDistance() const {return hasFarClipping;}
175 
181  inline bool hasNearClippingDistance() const {return hasNearClipping;}
182 
183  void parse(const char * filename);
184 
185  void readMainClass(xmlDocPtr doc, xmlNodePtr node);
186  void read_ecm (xmlDocPtr doc, xmlNodePtr node);
187  void read_sample (xmlDocPtr doc, xmlNodePtr node);
188  void read_camera (xmlDocPtr doc, xmlNodePtr node);
189  void read_mask (xmlDocPtr doc, xmlNodePtr node);
190  void read_range (xmlDocPtr doc, xmlNodePtr node);
191  void read_contrast (xmlDocPtr doc, xmlNodePtr node);
192  void read_face(xmlDocPtr doc, xmlNodePtr node);
193 
199  inline void setAngleAppear(const double &aappear) {angleAppear = aappear;}
200 
206  inline void setAngleDisappear(const double &adisappear) {angleDisappear = adisappear;}
207 
208  void setCameraParameters(const vpCameraParameters &_cam){ cam = _cam; }
209 
215  inline void setFarClippingDistance(const double &fclip) {farClipping = fclip;}
216 
217  void setMovingEdge(const vpMe &_ecm){ m_ecm = _ecm; }
218 
224  inline void setNearClippingDistance(const double &nclip) {nearClipping = nclip;}
225 
226  void writeMainClass(xmlNodePtr node);
227 
228 protected:
229  void init();
230 
231 };
232 
233 #endif
234 
235 #endif /* NMBTXMLPARSER_H_ */
236 
237 
238 
void setCameraParameters(const vpCameraParameters &_cam)
double farClipping
Near clipping distance.
double getAngleAppear() const
double getNearClippingDistance() const
bool hasNearClippingDistance() const
vpCameraParameters cam
Camera parameters.
Parse an Xml file to extract configuration parameters of a mbtConfig object.Data parser for the model...
bool fovClipping
Fov Clipping.
void setAngleDisappear(const double &adisappear)
void getMe(vpMe &_ecm) const
virtual void writeMainClass(xmlNodePtr node)=0
Contains predetermined masks for sites and holds moving edges tracking parameters.
Definition: vpMe.h:70
bool hasFarClippingDistance() const
double getAngleDisappear() const
bool hasNearClipping
Is near clipping distance specified?
This class intends to simplify the creation of xml parser based on the libxml2 third party library...
Definition: vpXmlParser.h:178
vpMe m_ecm
Moving edges parameters.
double angleAppear
Angle to determine if a face appeared.
Generic class defining intrinsic camera parameters.
bool getFovClipping() const
virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node)=0
void setFarClippingDistance(const double &fclip)
double angleDisappear
Angle to determine if a face disappeared.
double getFarClippingDistance() const
bool hasFarClipping
Is far clipping distance specified?
double nearClipping
Near clipping distance.
void getCameraParameters(vpCameraParameters &_cam) const
void setMovingEdge(const vpMe &_ecm)
void setAngleAppear(const double &aappear)
void setNearClippingDistance(const double &nclip)
void parse(const std::string &filename)