Skip to content

Commit 849eb26

Browse files
committed
gui: cleanup db descriptors use of rect vs dbbox
Signed-off-by: Peter Gadfort <[email protected]>
1 parent c71fb38 commit 849eb26

File tree

1 file changed

+14
-36
lines changed

1 file changed

+14
-36
lines changed

src/gui/src/dbDescriptors.cpp

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,7 +2349,8 @@ Descriptor::Properties DbBPinDescriptor::getDBProperties(
23492349
for (auto* box : bpin->getBoxes()) {
23502350
auto* layer = box->getTechLayer();
23512351
if (layer != nullptr) {
2352-
boxes.push_back({gui->makeSelected(box->getTechLayer()), box->getBox()});
2352+
boxes.push_back(
2353+
{gui->makeSelected(box->getTechLayer()), gui->makeSelected(box)});
23532354
}
23542355
}
23552356
props.push_back({"Boxes", boxes});
@@ -4101,13 +4102,7 @@ Descriptor::Properties DbTechViaDescriptor::getDBProperties(
41014102
PropertyList layers;
41024103
auto make_layer = [gui, &shapes, &layers](odb::dbTechLayer* layer) {
41034104
const auto& shape = shapes[layer];
4104-
std::string shape_text
4105-
= fmt::format("({}, {}), ({}, {})",
4106-
Property::convert_dbu(shape.xMin(), false),
4107-
Property::convert_dbu(shape.yMin(), false),
4108-
Property::convert_dbu(shape.xMax(), false),
4109-
Property::convert_dbu(shape.yMax(), false));
4110-
layers.push_back({gui->makeSelected(layer), shape_text});
4105+
layers.push_back({gui->makeSelected(layer), shape});
41114106
};
41124107
make_layer(via->getBottomLayer());
41134108
if (cut_layer != nullptr) {
@@ -4422,23 +4417,18 @@ Descriptor::Properties DbGenerateViaDescriptor::getDBProperties(
44224417
for (uint32_t l = 0; l < via->getViaLayerRuleCount(); l++) {
44234418
auto* rule = via->getViaLayerRule(l);
44244419
auto* layer = rule->getLayer();
4425-
std::string shape_text;
44264420
if (layer->getType() == odb::dbTechLayerType::CUT) {
44274421
odb::Rect shape;
44284422
rule->getRect(shape);
4429-
shape_text = fmt::format("({}, {}), ({}, {})",
4430-
Property::convert_dbu(shape.xMin(), false),
4431-
Property::convert_dbu(shape.yMin(), false),
4432-
Property::convert_dbu(shape.xMax(), false),
4433-
Property::convert_dbu(shape.yMax(), false));
4423+
layers.push_back({gui->makeSelected(layer), shape});
44344424
} else {
44354425
int enc0, enc1;
44364426
rule->getEnclosure(enc0, enc1);
4437-
shape_text = fmt::format("Enclosure: {} x {}",
4438-
Property::convert_dbu(enc0, true),
4439-
Property::convert_dbu(enc1, true));
4427+
std::string shape_text = fmt::format("Enclosure: {} x {}",
4428+
Property::convert_dbu(enc0, true),
4429+
Property::convert_dbu(enc1, true));
4430+
layers.push_back({gui->makeSelected(layer), shape_text});
44404431
}
4441-
layers.push_back({gui->makeSelected(layer), shape_text});
44424432
via_layer_rules.insert(gui->makeSelected(rule));
44434433
}
44444434
props.push_back({"Tech Via-Layer Rules", via_layer_rules});
@@ -5423,16 +5413,9 @@ std::string DbBoxDescriptor::getName(const std::any& object) const
54235413
odb::Rect box;
54245414
getBBox(object, box);
54255415

5426-
std::string shape_text
5427-
= fmt::format("({}, {}), ({}, {})",
5428-
Property::convert_dbu(box.xMin(), false),
5429-
Property::convert_dbu(box.yMin(), false),
5430-
Property::convert_dbu(box.xMax(), false),
5431-
Property::convert_dbu(box.yMax(), false));
5432-
54335416
return fmt::format("Box of {}: {}",
54345417
getObject(object)->getOwnerType().getString(),
5435-
shape_text);
5418+
Property::toString(box));
54365419
}
54375420

54385421
std::string DbBoxDescriptor::getTypeName() const
@@ -5556,8 +5539,10 @@ void DbBoxDescriptor::populateProperties(odb::dbBox* box, Properties& props)
55565539
if (box->getLayerMask() > 0) {
55575540
props.push_back({"Mask", box->getLayerMask()});
55585541
}
5559-
props.push_back({"Design rule width",
5560-
Property::convert_dbu(box->getDesignRuleWidth(), true)});
5542+
if (box->getDesignRuleWidth() >= 0) {
5543+
props.push_back({"Design rule width",
5544+
Property::convert_dbu(box->getDesignRuleWidth(), true)});
5545+
}
55615546
} else if (auto* via = box->getTechVia()) {
55625547
props.push_back({"Tech via", gui->makeSelected(via)});
55635548
} else if (auto* via = box->getBlockVia()) {
@@ -5595,16 +5580,9 @@ std::string DbSBoxDescriptor::getName(const std::any& object) const
55955580
odb::Rect box;
55965581
getBBox(object, box);
55975582

5598-
std::string shape_text
5599-
= fmt::format("({}, {}), ({}, {})",
5600-
Property::convert_dbu(box.xMin(), false),
5601-
Property::convert_dbu(box.yMin(), false),
5602-
Property::convert_dbu(box.xMax(), false),
5603-
Property::convert_dbu(box.yMax(), false));
5604-
56055583
return fmt::format("SBox of {}: {}",
56065584
getObject(object)->getOwnerType().getString(),
5607-
shape_text);
5585+
Property::toString(box));
56085586
}
56095587

56105588
std::string DbSBoxDescriptor::getTypeName() const

0 commit comments

Comments
 (0)