The stadium and its surroundings as two pages with a card model on one plate
The ground is drawn after the design: eight stands as deep as they have places, the equipment, the fourteen objects around it, trees, cars and people on one base plate. The stage works out itself which part lies under the pointer, the wheel zooms and dragging moves the view. The part's card, the figures and the building firm's offer follow the notes of the other pages. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
17c6d0a1d3
commit
c60b0e9b2c
14 files changed
+1025
-1178
No files matched your search
@@ -4,7 +4,7 @@
|
||||
#include "modern/ui/demo_reports.hpp"
|
||||
#include "modern/ui/demo_finance.hpp"
|
||||
#include "modern/ui/desktop.hpp"
|
||||
#include "modern/ui/stadium_model.hpp"
|
||||
#include "modern/ui/stadium_scene.hpp"
|
||||
#include "modern/ui/gui_assets.hpp"
|
||||
#include "modern/ui/model.hpp"
|
||||
#include "modern/ui/crest_contrast.hpp"
|
||||
@@ -544,34 +544,31 @@ int main(int argc, char **argv) try {
|
||||
{
|
||||
Json overview = {{"blocks", Json::array()}, {"facilities", Json::array()}, {"periphery", Json::array()}};
|
||||
for (int i = 0; i < 8; ++i)
|
||||
overview["blocks"].push_back({{"letter", std::string(1, char('A' + i))}, {"display_places", 3000 + 1000 * i}, {"max_places", 18000},
|
||||
{"display_seats", i % 2 == 0}, {"display_roof", i == 3}, {"building", i == 5}, {"job", {{"places", 9000}, {"weeks", 12}}}});
|
||||
for (int i = 0; i < 8; ++i) overview["facilities"].push_back({{"name", "Anlage"}, {"display_level", 2}, {"building", false}});
|
||||
for (int i = 0; i < 14; ++i) overview["periphery"].push_back({{"name", "Haus"}, {"level", i % 3}, {"max_level", 3}, {"building", false}});
|
||||
const auto scene = stadium3d::build(overview, "#aa2233", true);
|
||||
require(scene.centres.contains("block:7") && scene.centres.contains("facility:0") && !scene.centres.contains("periphery:0"),
|
||||
"The stadium's view should offer stands and facilities only");
|
||||
const auto inside = stadium3d::fixed_camera(false);
|
||||
const auto whole = stadium3d::draw(scene, inside, 2612, 1600);
|
||||
const auto again = stadium3d::draw(stadium3d::build(overview, "#aa2233", true), inside, 2612, 1600);
|
||||
require(whole.svg == again.svg && whole.svg.size() > 4000, "Stadium model is not drawn the same way twice");
|
||||
require(std::count_if(whole.anchors.begin(), whole.anchors.end(), [](const auto &a) { return a.id == "facility:0"; }) == 4,
|
||||
"Each floodlight mast should choose the floodlights");
|
||||
for (const auto &part : whole.parts)
|
||||
if (part.id.starts_with("block:"))
|
||||
require(part.cx > 100 && part.cx < 2512 && part.cy > 100 && part.cy < 1500, "A stand lies outside the fixed camera's picture");
|
||||
// the surroundings: every object is a part of its own, and every level draws more
|
||||
const auto around = stadium3d::build(overview, "#aa2233", true, 1);
|
||||
require(around.centres.size() == 14 && around.centres.contains("periphery:13") && !around.centres.contains("block:0"),
|
||||
"The surroundings should offer their fourteen objects only");
|
||||
overview["blocks"].push_back({{"letter", std::string(1, char('A' + i))}, {"places", 3000 + 1000 * i}, {"display_places", i == 5 ? 0 : 3000 + 1000 * i}, {"max_places", i % 2 ? 6000 : 18000},
|
||||
{"display_seats", i % 2 == 0}, {"display_roof", i == 2}, {"building", i == 5}, {"job", {{"places", 9000}, {"weeks", 12}}}});
|
||||
for (int i = 0; i < 8; ++i) overview["facilities"].push_back({{"name", "Anlage"}, {"level", 2}, {"display_level", 2}, {"max_level", 4}, {"building", false}});
|
||||
for (int i = 0; i < 14; ++i) overview["periphery"].push_back({{"name", "Haus"}, {"level", 0}, {"max_level", i == 0 ? 4 : 1}, {"building", false}});
|
||||
const auto scene = stadium_scene::build(overview, false, "ARENA");
|
||||
require(scene.svg == stadium_scene::build(overview, false, "ARENA").svg && scene.svg.size() > 20000 && scene.svg.ends_with("</svg>"), "Stadium model is not drawn the same way twice");
|
||||
const auto part = [&](const std::string &id) { return std::find_if(scene.hots.begin(), scene.hots.end(), [&](const auto &h) { return h.id == id; }); };
|
||||
for (int i = 0; i < 8; ++i) require(part("block:" + std::to_string(i)) != scene.hots.end() && part("facility:" + std::to_string(i)) != scene.hots.end(), "A stand or a facility cannot be chosen on the model");
|
||||
for (int i = 0; i < 14; ++i) require(part("periphery:" + std::to_string(i)) != scene.hots.end(), "An object of the surroundings cannot be chosen on the model");
|
||||
require(part("facility:0")->quads.size() == 4, "Each floodlight mast should choose the floodlights");
|
||||
require(scene.letters.size() == 8 && scene.letters[0].text == "A", "The stands should carry their letters");
|
||||
// every face one can choose lies on the picture
|
||||
for (const auto &hot : scene.hots)
|
||||
for (const auto &quad : hot.quads)
|
||||
for (const auto &corner : {quad.a, quad.b, quad.d}) {
|
||||
const auto p = stadium_scene::project(corner);
|
||||
require(p.x > 0 && p.x < stadium_scene::width && p.y > 0 && p.y < stadium_scene::height, "A part of the stadium lies outside the picture");
|
||||
}
|
||||
// what is built shows more than an empty plot, and a finished stand more than a building site
|
||||
auto grown = overview;
|
||||
grown["periphery"][0]["level"] = 4;
|
||||
grown["periphery"][4]["level"] = 3;
|
||||
require(stadium3d::build(grown, "#aa2233", true, 1).faces.size() > around.faces.size() + 20,
|
||||
"Higher levels of road and parking should show more");
|
||||
const auto outside = stadium3d::draw(around, stadium3d::fixed_camera(true), 2612, 1600);
|
||||
for (const auto &anchor : outside.anchors)
|
||||
require(anchor.x > 40 && anchor.x < 2572 && anchor.y > 40 && anchor.y < 1560, "An object of the surroundings lies outside the picture");
|
||||
grown["periphery"][4]["level"] = 1;
|
||||
grown["periphery"][3]["level"] = 1;
|
||||
require(stadium_scene::build(grown, false, "ARENA").svg.size() > scene.svg.size() + 4000, "Built surroundings should show more than their plots");
|
||||
require(scene.svg.find("#d08a1e") != std::string::npos && stadium_scene::build(overview, true, "ARENA").svg.find("#d08a1e") == std::string::npos, "A crane should stand only where building is going on today");
|
||||
}
|
||||
auto corrupt = layout;
|
||||
corrupt["objects"]["calendar"]["x"] = 999999;
|
||||
|
||||
Reference in new issue
Block a user