MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / recursiveCSSubgraphs

Method recursiveCSSubgraphs

src/App/Graphviz.cpp:510–557  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

508 }
509
510 void recursiveCSSubgraphs(DocumentObject* cs, DocumentObject* parent)
511 {
512
513 auto graph = parent ? GraphList[parent] : &DepList;
514 // check if the value for the key 'parent' is null
515 if (!graph) {
516 return;
517 }
518 auto& sub = graph->create_subgraph();
519 GraphList[cs] = ⊂
520 get_property(sub, graph_name) = getClusterName(cs);
521
522 // build random color string
523 std::stringstream stream;
524 stream << "#" << std::setfill('0') << std::setw(2) << std::hex << distribution(seed)
525 << std::setfill('0') << std::setw(2) << std::hex << distribution(seed)
526 << std::setfill('0') << std::setw(2) << std::hex << distribution(seed) << 80;
527 std::string result(stream.str());
528
529 get_property(sub, graph_graph_attribute)["bgcolor"] = result;
530 get_property(sub, graph_graph_attribute)["style"] = "rounded,filled";
531 setGraphLabel(sub, cs);
532
533 for (auto obj : cs->getOutList()) {
534 if (obj->hasExtension(GeoFeatureGroupExtension::getExtensionClassTypeId())) {
535 // in case of dependencies loops check if obj is already part of the
536 // map to avoid infinite recursions
537 auto it = GraphList.find(obj);
538 if (it == GraphList.end()) {
539 recursiveCSSubgraphs(obj, cs);
540 }
541 }
542 }
543
544 // setup the origin if available
545 if (cs->hasExtension(App::OriginGroupExtension::getExtensionClassTypeId())) {
546 auto origin = cs->getExtensionByType<OriginGroupExtension>()->Origin.getValue();
547 if (!origin) {
548 std::cerr << "Origin feature not found" << std::endl;
549 return;
550 }
551 auto& osub = sub.create_subgraph();
552 GraphList[origin] = &osub;
553 get_property(osub, graph_name) = getClusterName(origin);
554 get_property(osub, graph_graph_attribute)["bgcolor"] = "none";
555 setGraphLabel(osub, origin);
556 }
557 }
558
559 void addSubgraphs()
560 {

Callers

nothing calls this directly

Calls 6

strMethod · 0.45
getOutListMethod · 0.45
hasExtensionMethod · 0.45
findMethod · 0.45
endMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected