+json layer::to_json() const {
+ auto is_full = this->rect == genivi::full_rect;
+
+ json r{};
+ if (is_full) {
+ r = {{"type", "full"}};
+ } else {
+ r = {{"type", "rect"},
+ {"rect",
+ {{"x", this->rect.x},
+ {"y", this->rect.y},
+ {"width", this->rect.w},
+ {"height", this->rect.h}}}};
+ }
+
+ return {
+ {"id_min", this->id_min},
+ {"id_max", this->id_max},
+ {"name", this->name},
+ {"layer_id", this->layer_id},
+ {"area", r},
+ };
+}
+
+json layer_map::to_json() const {
+ json j{};
+ for (auto const &i: this->mapping) {
+ j.push_back(i.to_json());
+ }
+ return j;
+}
+