14 int main(
int argc,
char** argv) {
17 std::cerr <<
"Error: you need to specify a testfile (.bt) as argument to read" << std::endl;
21 std::cout <<
"Testing empty OcTree...\n";
35 AbstractOcTree* readTreeAbstract = AbstractOcTree::read(
"empty.ot");
37 OcTree* readTreeOt =
dynamic_cast<OcTree*
>(readTreeAbstract);
44 std::cout <<
"Testing reference OcTree from file ...\n";
45 string filename = string(argv[1]);
48 string filenameOt =
"test_io_file.ot";
49 string filenameBtOut =
"test_io_file.bt";
50 string filenameBtCopyOut =
"test_io_file_copy.bt";
56 std::cout <<
" Copy Constructor / assignment / ==\n";
81 std::cout <<
" Swap\n";
86 emptySw.swapContent(otherSw);
98 std::cout <<
" Write to .ot / read through AbstractOcTree\n";
102 AbstractOcTree* readTreeAbstract = AbstractOcTree::read(filenameOt);
105 OcTree* readTreeOt =
dynamic_cast<OcTree*
>(readTreeAbstract);
110 point3d coord(0.1f, 0.1f, 0.1f);
111 node = readTreeOt->
search(coord);
124 std::cout <<
"Testing ColorOcTree...\n";
127 std::string filenameColor =
"test_io_color_file.ot";
132 colorNode->setColor(color_red);
138 AbstractOcTree* readTreeAbstract = AbstractOcTree::read(filenameColor);
144 colorNode = colorTree.
search(0.0, 0.0, 0.0);
146 EXPECT_EQ(colorNode->getColor(), color_red);
147 delete readColorTree;
152 std::cout <<
"Testing OcTreeStamped...\n";
154 std::string filenameStamped =
"test_io_stamped_file.ot";
166 AbstractOcTree* readTreeAbstract = AbstractOcTree::read(filenameStamped);
176 delete readStampedTree;
180 std::cerr <<
"Test successful.\n";
void setResolution(double r)
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
ColorOcTreeNode * setNodeColor(const OcTreeKey &key, uint8_t r, uint8_t g, uint8_t b)
#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