@@ -3838,39 +3838,15 @@ Descriptor::Properties DbModITermDescriptor::getDBProperties(
38383838 auto * gui = Gui::get ();
38393839
38403840 Properties props;
3841- if (moditerm != nullptr ) {
3842- auto * parent = moditerm->getParent ();
3843- if (parent != nullptr ) {
3844- props.push_back ({" Parent" , gui->makeSelected (parent)});
3845- }
3846- }
3847-
3848- /*
3849- SelectionSet children;
3850- for (auto* child : module->getChildren()) {
3851- children.insert(gui->makeSelected(child->getMaster()));
3852- }
3853- if (!children.empty()) {
3854- props.push_back({"Children", children});
3855- }
3856-
3857- SelectionSet insts;
3858- for (auto* inst : module->getInsts()) {
3859- insts.insert(gui->makeSelected(inst));
3860- }
3861- props.push_back({"Instances", insts});
3862-
3863- SelectionSet bmodterms;
3864- for (auto* bmodterm : module->getModBTerms()) {
3865- std::cout << bmodterm->getName() << std::endl;
3866- bmodterms.insert(gui->makeSelected(bmodterm));
3841+ auto * parent = moditerm->getParent ();
3842+ if (parent != nullptr ) {
3843+ props.push_back ({" Parent" , gui->makeSelected (parent)});
38673844 }
3868- props.push_back({"ModBTerms", bmodterms});
38693845
3870- if (mod_inst != nullptr) {
3871- populateODBProperties(props, mod_inst, "Instance");
3846+ auto * modnet = moditerm->getModNet ();
3847+ if (modnet != nullptr ) {
3848+ props.push_back ({" ModNet" , gui->makeSelected (modnet)});
38723849 }
3873- */
38743850
38753851 return props;
38763852}
@@ -4005,6 +3981,127 @@ void DbModInstDescriptor::visitAllObjects(
40053981
40063982// ////////////////////////////////////////////////
40073983
3984+ DbModNetDescriptor::DbModNetDescriptor (odb::dbDatabase* db)
3985+ : BaseDbDescriptor<odb::dbModNet>(db)
3986+ {
3987+ }
3988+
3989+ std::string DbModNetDescriptor::getShortName (const std::any& object) const
3990+ {
3991+ auto * modnet = std::any_cast<odb::dbModNet*>(object);
3992+ return modnet->getName ();
3993+ }
3994+
3995+ std::string DbModNetDescriptor::getName (const std::any& object) const
3996+ {
3997+ auto * modnet = std::any_cast<odb::dbModNet*>(object);
3998+ return modnet->getHierarchicalName ();
3999+ }
4000+
4001+ std::string DbModNetDescriptor::getTypeName () const
4002+ {
4003+ return " ModNet" ;
4004+ }
4005+
4006+ bool DbModNetDescriptor::getBBox (const std::any& object, odb::Rect& bbox) const
4007+ {
4008+ // auto* module = std::any_cast<odb::dbModBTerm*>(object);
4009+ bbox.mergeInit ();
4010+ /*
4011+ for (auto* child : module->getChildren()) {
4012+ odb::Rect child_bbox;
4013+ if (getBBox(child->getMaster(), child_bbox)) {
4014+ bbox.merge(child_bbox);
4015+ }
4016+ }
4017+
4018+ for (auto* inst : module->getInsts()) {
4019+ auto* box = inst->getBBox();
4020+ odb::Rect box_rect = box->getBox();
4021+ bbox.merge(box_rect);
4022+ }
4023+ */
4024+ return !bbox.isInverted ();
4025+ }
4026+
4027+ void DbModNetDescriptor::highlight (const std::any& object,
4028+ Painter& painter) const
4029+ {
4030+ /*
4031+ auto* module = std::any_cast<odb::dbModule*>(object);
4032+
4033+ auto* inst_descriptor = Gui::get()->getDescriptor<odb::dbInst*>();
4034+ for (auto* inst : module->getInsts()) {
4035+ inst_descriptor->highlight(inst, painter);
4036+ }
4037+
4038+ const int level_alpha_scale = 2;
4039+ painter.saveState();
4040+ auto pen_color = painter.getPenColor();
4041+ pen_color.a /= level_alpha_scale;
4042+ painter.setPen(pen_color, true);
4043+ for (auto* children : module->getChildren()) {
4044+ highlight(children->getMaster(), painter);
4045+ }
4046+ painter.restoreState();
4047+ */
4048+ }
4049+
4050+ Descriptor::Properties DbModNetDescriptor::getDBProperties (
4051+ odb::dbModNet* modnet) const
4052+ {
4053+ auto * gui = Gui::get ();
4054+
4055+ Properties props;
4056+ auto * parent = modnet->getParent ();
4057+ if (parent != nullptr ) {
4058+ props.push_back ({" Parent" , gui->makeSelected (parent)});
4059+ }
4060+
4061+ SelectionSet moditerms;
4062+ for (auto * moditerm : modnet->getModITerms ()) {
4063+ moditerms.insert (gui->makeSelected (moditerm));
4064+ }
4065+ props.push_back ({" ModITerms" , moditerms});
4066+
4067+ SelectionSet modbterms;
4068+ for (auto * modbterm : modnet->getModBTerms ()) {
4069+ modbterms.insert (gui->makeSelected (modbterm));
4070+ }
4071+ props.push_back ({" ModBTerms" , modbterms});
4072+
4073+ SelectionSet iterms;
4074+ for (auto * iterm : modnet->getITerms ()) {
4075+ iterms.insert (gui->makeSelected (iterm));
4076+ }
4077+ props.push_back ({" ITerms" , iterms});
4078+
4079+ SelectionSet bterms;
4080+ for (auto * bterm : modnet->getBTerms ()) {
4081+ bterms.insert (gui->makeSelected (bterm));
4082+ }
4083+ props.push_back ({" BTerms" , bterms});
4084+
4085+ return props;
4086+ }
4087+
4088+ void DbModNetDescriptor::visitAllObjects (
4089+ const std::function<void (const Selected&)>& func) const
4090+ {
4091+ auto * chip = db_->getChip ();
4092+ if (chip == nullptr ) {
4093+ return ;
4094+ }
4095+ auto * block = chip->getBlock ();
4096+ if (block == nullptr ) {
4097+ return ;
4098+ }
4099+
4100+ // getModules(block->getTopModule(), func);
4101+ }
4102+
4103+ // ////////////////////////////////////////////////
4104+
40084105DbTechViaDescriptor::DbTechViaDescriptor (odb::dbDatabase* db)
40094106 : BaseDbDescriptor<odb::dbTechVia>(db)
40104107{
0 commit comments