From 34aabcc6e22a5214a146b244326ccacc49c43e2f Mon Sep 17 00:00:00 2001 From: Brenno Date: Thu, 12 Nov 2020 21:30:11 -0300 Subject: [PATCH] Removed Excess information from json. --- src/KeyFrameBBox.cpp | 7 ++++--- src/effects/Tracker.cpp | 17 ++++++++++------- tests/KeyFrame_Tests.cpp | 5 +---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/KeyFrameBBox.cpp b/src/KeyFrameBBox.cpp index 7bb0bebb4..98307a890 100644 --- a/src/KeyFrameBBox.cpp +++ b/src/KeyFrameBBox.cpp @@ -381,13 +381,13 @@ Json::Value KeyFrameBBox::JsonValue() { root["boxes"] = Json::Value(Json::arrayValue); // loop through points - for (auto const& x : BoxVec){ + /*for (auto const& x : BoxVec){ Json::Value elem; elem["key"] = x.first; elem["val"] = x.second.JsonValue(); root["boxes"].append(elem); } - + */ root["delta_x"] = delta_x.JsonValue(); root["delta_y"] = delta_y.JsonValue(); @@ -445,7 +445,7 @@ void KeyFrameBBox::SetJsonValue(const Json::Value root) { if (!root["TimeScale"].isNull()) { this->TimeScale = (double) root["TimeScale"].asDouble(); } - + /* if (!root["boxes"].isNull()){ // loop through points for (const auto existing_point : root["boxes"]) { @@ -456,5 +456,6 @@ void KeyFrameBBox::SetJsonValue(const Json::Value root) { BoxVec.insert({existing_point["key"].asDouble(), box}); } } + */ return; } \ No newline at end of file diff --git a/src/effects/Tracker.cpp b/src/effects/Tracker.cpp index 5205a7460..423328b39 100644 --- a/src/effects/Tracker.cpp +++ b/src/effects/Tracker.cpp @@ -207,6 +207,16 @@ void Tracker::SetJsonValue(const Json::Value root) { // Set parent data EffectBase::SetJsonValue(root); + + if (!root["BaseFPS"].isNull() && root["BaseFPS"].isObject()) { + if (!root["BaseFPS"]["num"].isNull()) + BaseFPS.num = (int) root["BaseFPS"]["num"].asInt(); + if (!root["BaseFPS"]["den"].isNull()) + BaseFPS.den = (int) root["BaseFPS"]["den"].asInt(); + } + + trackedData.SetBaseFPS(this->BaseFPS); + // Set data from Json (if key is found) if (!root["protobuf_data_path"].isNull()){ protobuf_data_path = (root["protobuf_data_path"].asString()); @@ -216,13 +226,6 @@ void Tracker::SetJsonValue(const Json::Value root) { protobuf_data_path = ""; } } - - if (!root["BaseFPS"].isNull() && root["BaseFPS"].isObject()) { - if (!root["BaseFPS"]["num"].isNull()) - BaseFPS.num = (int) root["BaseFPS"]["num"].asInt(); - if (!root["BaseFPS"]["den"].isNull()) - BaseFPS.den = (int) root["BaseFPS"]["den"].asInt(); - } } // Get all properties for a specific frame diff --git a/tests/KeyFrame_Tests.cpp b/tests/KeyFrame_Tests.cpp index 13a4c68f7..dcdab721e 100644 --- a/tests/KeyFrame_Tests.cpp +++ b/tests/KeyFrame_Tests.cpp @@ -587,11 +587,8 @@ TEST(KeyFrameBBox_Json_set) { KeyFrameBBox from_json; from_json.SetJson(data); - BBox val = kfb.GetValue(0); - BBox val_json = from_json.GetValue(0); - std::cout << from_json.Json() << std::endl; - CHECK_EQUAL(val.cx, val_json.cx); + CHECK_EQUAL(kfb.GetBaseFPS().num, from_json.GetBaseFPS().num); }