schema_editor/comdel/display/schema_display.cpp

31 lines
801 B
C++
Raw Normal View History

2022-04-07 22:21:23 +00:00
#include "component_display.h"
#include "schema_display.h"
namespace display {
Schema::Schema()
{
this->setScene(&scene);
}
2022-04-18 09:41:02 +00:00
void Schema::setSchema(domain::Schema* schema)
2022-04-07 22:21:23 +00:00
{
scene.clear();
this->schema = schema;
2022-04-18 09:41:02 +00:00
if(schema != nullptr) {
2022-05-07 11:20:09 +00:00
for(auto &instance: schema->componentInstances) {
ComponentWrapper *component = ComponentWrapper::ofComponent(&instance);
component->setPos(instance.position.first, instance.position.second);
scene.addItem(component);
2022-04-07 22:21:23 +00:00
}
2022-05-07 11:20:09 +00:00
for(auto &instance: schema->busInstances) {
ComponentWrapper *bus = ComponentWrapper::ofBus(&instance);
bus->setPos(instance.position.first, instance.position.second);
scene.addItem(bus);
2022-04-07 22:21:23 +00:00
}
}
}
} // namespace display