37 #include <visp3/core/vpConfig.h>
45 #include <libxml/xmlmemory.h>
47 #include <visp3/mbt/vpMbXmlParser.h>
55 : cam(), angleAppear(70), angleDisappear(80),
56 hasNearClipping(false), nearClipping(false),
57 hasFarClipping(false), farClipping(false), fovClipping(false),
58 useLod(false), minLineLengthThreshold(50.0), minPolygonAreaThreshold(2500.0)
108 std::string file = filename;
133 bool camera_node =
false;
134 bool face_node =
false;
135 bool lod_node =
false;
137 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
138 if(dataNode->type == XML_ELEMENT_NODE){
139 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
140 if(iter_data !=
nodeMap.end()){
141 switch (iter_data->second){
163 std::cout <<
"camera : u0 : "<< this->
cam.
get_u0() <<
" (default)" <<std::endl;
164 std::cout <<
"camera : v0 : "<< this->
cam.
get_v0() <<
" (default)" <<std::endl;
165 std::cout <<
"camera : px : "<< this->
cam.
get_px() <<
" (default)" <<std::endl;
166 std::cout <<
"camera : py : "<< this->
cam.
get_py() <<
" (default)" <<std::endl;
170 std::cout <<
"face : Angle Appear : "<<
angleAppear <<
" (default)" <<std::endl;
171 std::cout <<
"face : Angle Disappear : "<<
angleDisappear <<
" (default)" <<std::endl;
175 std::cout <<
"lod : use lod : " <<
useLod <<
" (default)" << std::endl;
192 bool u0_node =
false;
193 bool v0_node =
false;
194 bool px_node =
false;
195 bool py_node =
false;
203 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
204 if(dataNode->type == XML_ELEMENT_NODE){
205 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
206 if(iter_data !=
nodeMap.end()){
207 switch (iter_data->second){
235 std::cout <<
"camera : u0 : "<< this->
cam.
get_u0() <<
" (default)" <<std::endl;
237 std::cout <<
"camera : u0 : "<< this->
cam.
get_u0() <<std::endl;
240 std::cout <<
"camera : v0 : "<< this->
cam.
get_v0() <<
" (default)" <<std::endl;
242 std::cout <<
"camera : v0 : "<< this->
cam.
get_v0() <<std::endl;
245 std::cout <<
"camera : px : "<< this->
cam.
get_px() <<
" (default)" <<std::endl;
247 std::cout <<
"camera : px : "<< this->
cam.
get_px() <<std::endl;
250 std::cout <<
"camera : py : "<< this->
cam.
get_py() <<
" (default)" <<std::endl;
252 std::cout <<
"camera : py : "<< this->
cam.
get_py() <<std::endl;
266 bool angle_appear_node =
false;
267 bool angle_disappear_node =
false;
268 bool near_clipping_node =
false;
269 bool far_clipping_node =
false;
270 bool fov_clipping_node =
false;
272 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
273 if(dataNode->type == XML_ELEMENT_NODE){
274 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
275 if(iter_data !=
nodeMap.end()){
276 switch (iter_data->second){
279 angle_appear_node =
true;
283 angle_disappear_node =
true;
287 near_clipping_node =
true;
292 far_clipping_node =
true;
300 fov_clipping_node =
true;
310 if(!angle_appear_node)
311 std::cout <<
"face : Angle Appear : "<<
angleAppear <<
" (default)" <<std::endl;
313 std::cout <<
"face : Angle Appear : "<<
angleAppear <<std::endl;
315 if(!angle_disappear_node)
316 std::cout <<
"face : Angle Disappear : "<<
angleDisappear <<
" (default)" <<std::endl;
318 std::cout <<
"face : Angle Disappear : "<<
angleDisappear <<std::endl;
320 if(near_clipping_node)
321 std::cout <<
"face : Near Clipping : "<<
nearClipping <<std::endl;
323 if(far_clipping_node)
324 std::cout <<
"face : Far Clipping : "<<
farClipping <<std::endl;
326 if(fov_clipping_node) {
328 std::cout <<
"face : Fov Clipping : True" <<std::endl;
330 std::cout <<
"face : Fov Clipping : False" <<std::endl;
336 bool use_lod_node =
false;
337 bool min_line_length_threshold_node =
false;
338 bool min_polygon_area_threshold_node =
false;
341 for(xmlNodePtr dataNode = node->xmlChildrenNode; dataNode != NULL; dataNode = dataNode->next) {
342 if(dataNode->type == XML_ELEMENT_NODE){
343 std::map<std::string, int>::iterator iter_data= this->
nodeMap.find((
char*)dataNode->name);
344 if(iter_data !=
nodeMap.end()){
345 switch (iter_data->second){
352 min_line_length_threshold_node =
true;
356 min_polygon_area_threshold_node =
true;
367 std::cout <<
"lod : use lod : " <<
useLod <<
" (default)" <<std::endl;
369 std::cout <<
"lod : use lod : " <<
useLod << std::endl;
371 if(!min_line_length_threshold_node)
376 if(!min_polygon_area_threshold_node)
382 #elif !defined(VISP_BUILD_SHARED_LIBS)
384 void dummy_vpMbXmlParser() {};
vpCameraParameters cam
Camera parameters.
void setMainTag(const std::string &tag)
void read_lod(xmlDocPtr doc, xmlNodePtr node)
double nearClipping
Near clipping distance.
double angleAppear
Angle to determine if a face appeared.
error that can be emited by ViSP classes.
double minLineLengthThreshold
Minimum line length to track a segment when LOD is enabled.
virtual void readMainClass(xmlDocPtr doc, xmlNodePtr node)
double xmlReadDoubleChild(xmlDocPtr doc, xmlNodePtr node)
bool hasFarClipping
Is far clipping distance specified?
double angleDisappear
Angle to determine if a face disappeared.
void initPersProjWithoutDistortion(const double px, const double py, const double u0, const double v0)
double farClipping
Near clipping distance.
void read_camera(xmlDocPtr doc, xmlNodePtr node)
void writeMainClass(xmlNodePtr node)
int xmlReadIntChild(xmlDocPtr doc, xmlNodePtr node)
void read_face(xmlDocPtr doc, xmlNodePtr node)
bool hasNearClipping
Is near clipping distance specified?
void parse(const char *filename)
bool fovClipping
Fov Clipping.
std::map< std::string, int > nodeMap
double minPolygonAreaThreshold
Minimum polygon area to track a face when LOD is enabled.
bool useLod
If true, the LOD is enabled, otherwise it is not.
void parse(const std::string &filename)