OcmModel.cpp
Go to the documentation of this file.
1 
19 
21 
23  {
24  // Create a new root node for the OCM tree.
25  mRoot.reset(new OcmTree(pRoot));
26  }
27 
29  {
30  }
31 
33  {
34  if(mRoot)
35  mRoot->initializeVisualizer(mSuperior);
36  }
37 
38  void OcmModel::save(double pWorkspaceVolume, boost::property_tree::ptree& pPt)
39  {
40  // Save the number of slots.
41  pPt.add("slots.<xmlattr>.number", mRoot->getNumberOfNodes());
42 
43  // Save the model.
44  saveShape(pWorkspaceVolume, pPt);
45  saveAppearance(pPt);
46  saveOcclusion(pPt);
47  }
48 
49  void OcmModel::saveShape(double pWorkspaceVolume, boost::property_tree::ptree& pPt)
50  {
51  // Create a seperate tree.
52  boost::property_tree::ptree subtree;
53 
54  // Add root node.
55  subtree.add("<xmlattr>.volume", pWorkspaceVolume);
56 
57  // Iterate over all children of the root node and save them.
58  BOOST_FOREACH(boost::shared_ptr<OcmTree> child, mRoot->mChildren)
59  child->saveShape(subtree);
60 
61  // Add subtree to main tree.
62  pPt.add_child("shape.root", subtree);
63  }
64 
65  void OcmModel::saveAppearance(boost::property_tree::ptree& pPt)
66  {
67  // Create a seperate tree.
68  boost::property_tree::ptree subtree;
69 
70  // Save the appearance mapping.
71  mAppearanceTable->save(subtree);
72 
73  // Add subtree to main tree.
74  pPt.add_child("appearance", subtree);
75  }
76 
77  void OcmModel::saveOcclusion(boost::property_tree::ptree& pPt)
78  {
79  // Create a seperate tree.
80  boost::property_tree::ptree subtree;
81 
82  // Save the hypothesis mapping.
83  mOcclusionTable->save(subtree);
84 
85  // Add subtree to main tree.
86  pPt.add_child("occlusion", subtree);
87  }
88 
90  {
91  return mRoot->getNumberOfNodes();
92  }
93 
94 }
void initializeVisualizer(boost::shared_ptr< Visualization::ProbabilisticPrimarySceneObjectVisualization > mSuperior)
Definition: OcmModel.cpp:32
void saveAppearance(boost::property_tree::ptree &pPt)
Definition: OcmModel.cpp:65
boost::shared_ptr< MappedProbabilityTable > mAppearanceTable
Definition: OcmModel.h:118
void saveOcclusion(boost::property_tree::ptree &pPt)
Definition: OcmModel.cpp:77
OcmModel(const boost::shared_ptr< SceneModel::TreeNode > pRoot)
Definition: OcmModel.cpp:22
boost::shared_ptr< ProbabilityTable > mOcclusionTable
Definition: OcmModel.h:128
void saveShape(double pWorkspaceVolume, boost::property_tree::ptree &pPt)
Definition: OcmModel.cpp:49
void save(double pWorkspaceVolume, boost::property_tree::ptree &pPt)
Definition: OcmModel.cpp:38
boost::shared_ptr< OcmTree > mRoot
Definition: OcmModel.h:113


asr_psm
Author(s): Braun Kai, Gehrung Joachim, Heizmann Heinrich, Meißner Pascal
autogenerated on Fri Nov 15 2019 03:57:54