#include "component_display.h" #include "schema_display.h" namespace display { Schema::Schema() { this->setScene(&scene); } void Schema::setSchema(domain::Schema* schema) { scene.clear(); this->schema = schema; if(schema != nullptr) { for(auto &instance: schema->instances) { ComponentWrapper *group = nullptr; auto component = dynamic_cast(instance); if(component) { group = ComponentWrapper::ofComponent(component); } auto bus = dynamic_cast(instance); if(bus) { group = ComponentWrapper::ofBus(bus); } if(group != nullptr) { group->setPos(instance->position.first, instance->position.second); scene.addItem(group); } } for(auto &wire: schema->wires) { auto group = ComponentWrapper::ofWire(wire); group->setPos(wire->position.first, wire->position.second); scene.addItem(group); } } } } // namespace display