28 const std::string& topologyIdentifier,
29 const std::map<std::string, std::vector<ISM::VoteSpecifierPtr>>& objectDefinitons)
31 std::stringstream fileName;
32 fileName << topologyIdentifier <<
"_ISM.dot";
33 path filePath = outputPath / fileName.str();
35 std::vector<std::pair<std::string, std::string> > alreadyTakenCombinations;
37 std::ios_base::iostate exceptionMask = file.exceptions() |
40 file.exceptions(exceptionMask);
43 file.open(filePath.string());
44 file <<
"digraph " << topologyIdentifier <<
" {\n";
46 std::set<std::string> patternNames;
47 for (
const std::pair< std::string, std::vector<ISM::VoteSpecifierPtr>>& typeIt : objectDefinitons)
51 if (std::find(alreadyTakenCombinations.begin(),
52 alreadyTakenCombinations.end(),
53 std::make_pair(voteIt->patternName, voteIt->objectType))
54 == alreadyTakenCombinations.end())
56 file << voteIt->patternName <<
" -> " << voteIt->objectType <<
"[dir=\"back\"];\n";
58 alreadyTakenCombinations.push_back(std::make_pair(voteIt->patternName,
61 patternNames.insert(voteIt->patternName);
66 for (std::string name : patternNames)
68 file << name <<
"[shape=\"box\"];\n";
73 file << track->type <<
";\n";
80 catch (std::ios_base::failure& e)
82 std::cerr << e.what() <<
"\n";
87 const std::string& topologyIdentifier,
91 std::stringstream fileName;
92 fileName << topologyIdentifier <<
"_Relations.dot";
93 path filePath = outputPath / fileName.str();
96 std::ios_base::iostate exceptionMask = file.exceptions() |
99 file.exceptions(exceptionMask);
103 file.open(filePath.string());
104 file <<
"graph " << topologyIdentifier <<
" {\n";
106 if (referenceRelations.empty())
109 for (
const std::pair<unsigned int, ObjectRelationPtr>& relation : relations)
111 file << relation.second->getObjectTypeA() <<
" -- " 112 << relation.second->getObjectTypeB() <<
";\n";
122 for (
const std::pair<unsigned int, ObjectRelationPtr>& relation : relations)
124 if (referenceRelations.find(relation.first) == referenceRelations.end())
126 addedRelations.insert(relation);
130 unchangedRelations.insert(relation);
133 referenceRelations.erase(relation.first);
136 removedRelations = referenceRelations;
138 for (
auto relation : unchangedRelations)
140 file << relation.second->getObjectTypeA() <<
" -- " 141 << relation.second->getObjectTypeB() <<
";\n";
144 for (
auto relation : addedRelations)
146 file << relation.second->getObjectTypeA() <<
" -- " 147 << relation.second->getObjectTypeB() <<
"[color=\"green\", penwidth=\"2\"];\n";
150 for (
auto relation : removedRelations)
152 file << relation.second->getObjectTypeA() <<
" -- " 153 << relation.second->getObjectTypeB() <<
"[color=\"red\", style=\"dotted\", penwidth=\"2\"];\n";
163 (sin(angleStepSize) * sin(angleStepSize) + cos(angleStepSize) * cos(angleStepSize)));
168 double x = radius * floor(sin(angle) * 1000) / 1000;
169 double y = radius * floor(cos(angle) * 1000) / 1000;
171 file << track->type <<
" [pos=\"" << x <<
"," << y <<
"!\"];\n";
172 angle += angleStepSize;
179 catch (std::ios_base::failure& e)
181 std::cerr << e.what() <<
"\n";
std::map< std::string, ISM::TracksPtr > mTracksPerPattern
void storeRelationsToDot(const path outputPath, const std::string &patternName, const std::string &topologyIdentifier, const ISM::ObjectRelations &relations, ISM::ObjectRelations referenceRelations=ObjectRelations())
void storeISMToDot(const path outputPath, const std::string &patternName, const std::string &topologyIdentifier, const std::map< std::string, std::vector< ISM::VoteSpecifierPtr >> &objectDefinitons)
const double NODE_DISTANCE
std::map< unsigned int, ISM::ObjectRelationPtr, std::less< unsigned > > ObjectRelations
boost::shared_ptr< VoteSpecifier > VoteSpecifierPtr
boost::shared_ptr< Track > TrackPtr
this namespace contains all generally usable classes.