10 #ifndef ApproxMVBB_KdTreeXml_hpp 11 #define ApproxMVBB_KdTreeXml_hpp 13 #ifndef ApproxMVBB_SUPPORT_XML 14 #warning "Your using the KdTreeXml header, which needs to be linked with the Xml library!" 17 #include <pugixml.hpp> 32 template<
typename TTraits>
35 static const auto nodePCData = pugi::node_pcdata;
41 node.append_child(nodePCData).set_value( ss.str().c_str() );
45 template<
typename Traits>
48 static const auto nodePCData = pugi::node_pcdata;
55 aabb.append_child(nodePCData).set_value(ss.str().c_str());
62 node.append_attribute(
"level").set_value(l->getLevel());
63 node.append_attribute(
"idx").set_value(
std::to_string(l->getIdx()).c_str());
64 aabb = node.append_child(
"AABB");
68 aabb.append_child(nodePCData).set_value(ss.str().c_str());
72 XMLNodeType aabbTree = kdNode.append_child(
"AABBTree");
73 std::deque<NodeType*> q;
76 unsigned int currLevel = obj.
m_root->getLevel();
82 if(f->getLevel() > currLevel) {
84 aabb = aabbTree.append_child(
"AABBSubTree");
85 aabb.append_attribute(
"level").set_value(currLevel);
86 aabb.append_child(nodePCData).set_value( ss.str().c_str() );
88 currLevel = f->getLevel();
98 auto * n = f->leftNode();
113 aabb = aabbTree.append_child(
"AABBSubTree");
114 aabb.append_attribute(
"level").set_value(currLevel);
115 aabb.append_child(nodePCData).set_value( s.c_str() );
121 auto stat = kdNode.append_child(
"Statistics");
124 stat.append_attribute(
"m_treeDepth").set_value( obj.
m_treeDepth );
126 stat.append_attribute(
"m_minLeafExtent").set_value( obj.
m_minLeafExtent );
127 stat.append_attribute(
"m_maxLeafExtent").set_value( obj.
m_maxLeafExtent );
128 stat.append_attribute(
"m_avgLeafSize").set_value( obj.
m_avgLeafSize );
129 stat.append_attribute(
"m_minLeafDataSize").set_value( (
long long unsigned int)obj.
m_minLeafDataSize );
130 stat.append_attribute(
"m_maxLeafDataSize").set_value( (
long long unsigned int)obj.
m_maxLeafDataSize );
131 stat.append_attribute(
"m_computedNeighbourStats").set_value( (
long long unsigned int)obj.
m_computedNeighbourStats );
132 stat.append_attribute(
"m_minNeighbours").set_value( (
long long unsigned int)obj.
m_minNeighbours );
133 stat.append_attribute(
"m_maxNeighbours").set_value( (
long long unsigned int)obj.
m_maxNeighbours );
134 stat.append_attribute(
"m_avgNeighbours").set_value( obj.
m_avgNeighbours );
138 template<
typename TTraits>
140 const Matrix33 & A_IK = Matrix33::Identity()
144 static const auto nodePCData = pugi::node_pcdata;
146 std::stringstream ss;
150 kdNode.append_attribute(
"aligned").set_value( aligned );
154 a.append_child(nodePCData).set_value(ss.str().c_str());
156 appendToXML(static_cast<const Base &>(obj), kdNode);
163 template<
typename TTraits>
167 const Matrix33 & A_IK = Matrix33::Identity()) {
169 static const auto nodePCData = pugi::node_pcdata;
171 std::stringstream ss;
175 kdNode.append_attribute(
"aligned").set_value( aligned );
179 a.append_child(nodePCData).set_value(ss.str().c_str());
181 appendToXML(static_cast<const Base &>(obj), kdNode);
NodeContainerType m_leafs
Only leaf nodes , continously index ordered: leafs[idx]->getIdx() < leafs[idx+1]->getIdx();.
static void appendToXML(const Tree< TTraits > &obj, XMLNodeType &root, bool aligned=true, const Matrix33 &A_IK=Matrix33::Identity())
These are some container definitions.
PREC m_avgSplitPercentage
pugi::xml_node XMLNodeType
std::size_t m_minLeafDataSize
static void appendToXML(PointData< TTraits > const &obj, XMLNodeType &root)
typename Traits::PointGetter PointGetter
std::size_t m_maxNeighbours
bool m_computedNeighbourStats
Eigen::Matrix< Scalar, 3, 3 > Matrix33
std::size_t m_maxLeafDataSize
static void appendToXML(const TreeStatistics &obj, XMLNodeType &kdNode)
static void appendToXML(TreeBase< Traits > const &obj, XMLNodeType kdNode)
TreeStatistics m_statistics
std::string to_string(const T &n)
TreeStatistics m_statistics
NodeType * m_root
Root node, has index 0!
static void appendToXML(const TreeSimple< TTraits > &obj, XMLNodeType root, bool aligned=true, const Matrix33 &A_IK=Matrix33::Identity())
std::size_t m_minNeighbours