25 #include "planargraph.h" 35 enum class ParticleType {
57 using Type =
unsigned char;
64 static Color fromStr(std::string
const &str) {
67 std::istringstream sin(str);
89 std::string toStr()
const {
90 std::ostringstream sout;
91 sout << int(R) <<
" " << int(G) <<
" " << int(B) <<
" " << int(A);
96 inline static constexpr Color Black{0, 0, 0, 255};
97 inline static constexpr Color White{255, 255, 255, 255};
98 inline static constexpr Color Red{255, 0, 0, 255};
99 inline static constexpr Color Blue{0, 0, 255, 255};
100 inline static constexpr Color Green{0, 255, 0, 255};
102 enum class NodeType {
111 std::string name =
"";
112 NodeType type = NodeType::None;
119 ParticleType type = ParticleType::Scalar;
120 std::string name =
"";
123 bool flipped =
false;
128 LatexLinker() =
default;
130 LatexLinker(Graph
const& graph);
134 LatexLinker(LatexLinker
const&) =
default;
135 LatexLinker(LatexLinker&&) =
default;
136 LatexLinker& operator=(LatexLinker
const&) =
default;
137 LatexLinker& operator=(LatexLinker&&) =
default;
142 std::string getName()
const {
146 void setName(std::string
const &t_name) {
154 void setParticlesType(
size_t i,
156 ParticleType type = ParticleType::Scalar,
157 std::string
const& t_name =
"",
160 bool flipped =
false,
164 void addOperator(
size_t pos);
166 void replaceParticlesType(
size_t i,
168 ParticleType type = ParticleType::Scalar,
171 void removeEdge(
size_t i,
size_t j);
173 void setVertexName(
size_t pos,
174 std::string
const& name);
176 void setEdgeName(
size_t i,
178 std::string
const& name);
180 void setEdgeSign(
size_t i,
184 void write(std::ostream& out);
188 void save(std::string
const& fileName)
const;
192 void load(std::string
const& fileName);
194 static void saveMultiple(std::string
const& fileName,
195 std::vector<LatexLinker>
const& links);
197 static std::vector<LatexLinker> loadMultiple(std::string
const& fileName);
199 void exportPDF(std::string
const& fileName,
200 std::string
const& path =
".");
202 void exportPNG(std::string
const& fileName,
203 std::string
const& path =
".");
205 void scale(
float factor);
207 std::vector<Node>& getNodes() {
211 std::vector<Node>
const &getNodes()
const {
215 std::vector<Edge>& getEdges() {
219 std::vector<Edge>
const& getEdges()
const {
223 void removeNode(
size_t pos);
227 std::string getNameExternal(
size_t i)
const;
232 std::string getNameVertex(
size_t pos);
234 void getFlippedEdgeLabels()
const;
236 void getStringValue(std::ostream& out,
239 void writeVertex(std::ostream & out,
242 std::string
const& nameVertex,
243 std::string
const& nameParticle =
"");
245 void writeEdge(std::ostream & out,
247 std::string
const& nameA,
248 std::string
const& nameB,
250 std::string
const& nameEdge =
"",
251 bool flipLabel =
false);
253 void writeLoopEdge(std::ostream & out,
255 std::string
const& nameA,
256 std::string
const& nameB,
259 std::string
const& nameEdge =
"",
260 bool flipLabel =
false);
264 LatexLinker& linker);
268 inline static bool autoLabel =
true;
270 inline static const std::string nameOrigin =
"O";
276 float scaleFactor = 1.3;
281 std::vector<Edge> edges;
284 std::map<std::pair<size_t, size_t>,
int> multiplicity;
286 std::vector<Node> nodes;
std::ostream & operator<<(std::ostream &fout, csl::Type type)
Definition: planargraph.h:169
Inherits from JSON::Object, specialized in JSON Node. A Node owns a vector of Object. The Node's children can either be Leaf or other Node objects. This allows to store the tree structure of a .json file.
Definition: jsonObject.h:97
Definition: amplitudeSimplification.h:38
Contains all objects related to JSON reading / writing.
Definition: csldatahandler.h:30