14 int main(
int argc,
char** argv) {
17 std::cerr <<
"Error: you need to specify a testfile (.bt) as argument to read" << std::endl;
36 string filename = string(argv[1]);
38 string filenameOt =
"test_io_file.ot";
39 string filenameBtOut =
"test_io_file.bt";
40 string filenameBtCopyOut =
"test_io_file_copy.bt";
49 EXPECT_TRUE(treeCopy->writeBinary(filenameBtCopyOut));
60 if (node && treeCopy->isNodeOccupied(node))
61 treeCopy->updateNode(pt,
false);
63 treeCopy->updateNode(pt,
true);
74 emptySw.swapContent(otherSw);
89 AbstractOcTree* readTreeAbstract = AbstractOcTree::read(filenameOt);
92 OcTree* readTreeOt =
dynamic_cast<OcTree*
>(readTreeAbstract);
97 point3d coord(0.1f, 0.1f, 0.1f);
98 node = readTreeOt->
search(coord);
109 std::string filenameColor =
"test_io_color_file.ot";
114 colorNode->setColor(color_red);
120 readTreeAbstract = AbstractOcTree::read(filenameColor);
126 colorNode = colorTree.
search(0.0, 0.0, 0.0);
128 EXPECT_EQ(colorNode->getColor(), color_red);
129 delete readColorTree;
134 std::string filenameStamped =
"test_io_stamped_file.ot";
146 readTreeAbstract = NULL;
147 readTreeAbstract = AbstractOcTree::read(filenameStamped);
160 std::cerr <<
"Test successful.\n";
virtual NODE * updateNode(const OcTreeKey &key, float log_odds_update, bool lazy_eval=false)
std::string getTreeType() const
returns actual class name as string for identification
NODE * search(double x, double y, double z, unsigned int depth=0) const
#define EXPECT_FALSE(args)
int main(int argc, char **argv)
std::string getTreeType() const
returns actual class name as string for identification
bool writeBinary(const std::string &filename)
bool write(const std::string &filename) const
Write file header and complete tree to file (serialization)
This class represents a three-dimensional vector.
double getResolution() const
octomath::Vector3 point3d
Use Vector3 (float precision) as a point3d in octomap.
bool readBinary(std::istream &s)
#define EXPECT_TRUE(args)
bool isNodeOccupied(const OcTreeNode *occupancyNode) const
queries whether a node is occupied according to the tree's parameter for "occupancy" ...
virtual size_t size() const
ColorOcTreeNode * setNodeColor(const OcTreeKey &key, const unsigned char &r, const unsigned char &g, const unsigned char &b)