Skip to content

Commit

Permalink
Update json export
Browse files Browse the repository at this point in the history
  • Loading branch information
fontanf committed Jan 25, 2025
1 parent 793d898 commit 1475a28
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/irregular/branching_scheme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2487,12 +2487,19 @@ nlohmann::json BranchingScheme::json_export_init() const
nlohmann::json BranchingScheme::json_export(
const std::shared_ptr<Node>& node) const
{
const TrapezoidSet& trapezoid_set = trapezoid_sets_[(int)node->last_bin_direction][node->trapezoid_set_id];
Point bl_orig = convert_point_back({node->x, node->y}, node->last_bin_direction);
nlohmann::json json = {
{"Id", node->id},
{"ParentId", (node->parent == nullptr)? -1: node->parent->id},
{"TrapezoidSetId", node->trapezoid_set_id},
{"ItemTypeId", trapezoid_set.item_type_id},
{"Angle", trapezoid_set.angle},
{"Mirror", trapezoid_set.mirror},
{"X", node->x},
{"Y", node->y},
{"XOrig", bl_orig.x},
{"YOrig", bl_orig.y},
{"NumberOfItems", node->number_of_items},
{"NumberOfBins", node->number_of_bins},
{"Profit", node->profit},
Expand Down Expand Up @@ -2524,6 +2531,8 @@ nlohmann::json BranchingScheme::json_export(
{"X", bl_corner.x},
{"Y", bl_corner.y},
};
if (node_tmp == node)
plot[i]["FillColor"] = "green";
i++;
}
json["Plot"] = plot;
Expand Down

0 comments on commit 1475a28

Please sign in to comment.