#include "opencv2/highgui.hpp"
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
#include <json/json.h>
#include <fstream>
#include <filesystem>
#include "pointbase.cpp"


using namespace cv;
using namespace std;
namespace fs = std::filesystem;

//C++17
//sudo apt install libjsoncpp-dev
//sudo ln -s /usr/include/jsoncpp/json/ /usr/include/json
int main(int argc, char** argv)
{
    /* //print point values manually
    std::string path = "../data/";
    for (const auto & entry : fs::directory_iterator(path))
        {
            string filePath = entry.path();
            //cout << filePath.find(".json") << std::endl;
            if (filePath.find(".json") != string::npos) 
            {
                std::cout << filePath << std::endl;
                std::ifstream coord_file(filePath, std::ifstream::binary);
                Json::Value coords;

                coord_file >> coords;
                cout << "x: " << coords["depthPos"]["x"].asDouble() << std::endl;
                cout << "y: " << coords["depthPos"]["y"].asDouble() << std::endl;
            }

        }
    */

    //test pointbase load
    PointBase pb;
    pb.load("../data/");

    //test print all point info
    pb.printPoints(1);

    /* test get path
    path: ../data/0000044.json; 
    x: 206.5; 
    y: 1051; 
    */
    cout << pb.getPath(206.500,1051.00) << '\n';

    pb.showPointImg();

}