src/model.cpp

changeset 379
8d88adffb779
parent 374
75efc3ba5a56
equal deleted inserted replaced
378:01537fbe096e 379:8d88adffb779
34 34
35 static_assert(gcd(16, 15) == 1); 35 static_assert(gcd(16, 15) == 1);
36 static_assert(gcd(16, 4) == 4); 36 static_assert(gcd(16, 4) == 4);
37 static_assert(gcd(272, 192) == 16); 37 static_assert(gcd(272, 192) == 16);
38 38
39 static constexpr const char* circularPrimitiveTypeString(const CircularPrimitive& circ) 39 static constexpr const char* circularPrimitiveTypeString(const circular_primitive& circ)
40 { 40 {
41 return circularPrimitiveStems[circ.type]; 41 return circularPrimitiveStems[static_cast<unsigned int>(circ.type)];
42 } 42 }
43 43
44 static QString circularPrimitiveFilePath(const CircularPrimitive& circ) 44 static QString circularPrimitiveFilePath(const circular_primitive& circ)
45 { 45 {
46 QString result; 46 QString result;
47 if (circ.fraction.divisions != 16) { 47 if (circ.fraction.divisions != 16) {
48 result += QString::number(circ.fraction.divisions) + QStringLiteral("\\"); 48 result += QString::number(circ.fraction.divisions) + QStringLiteral("\\");
49 } 49 }
76 return ":/icons/linetype-quadrilateral.png"; 76 return ":/icons/linetype-quadrilateral.png";
77 }, 77 },
78 [](const Colored<ConditionalEdge>&) { 78 [](const Colored<ConditionalEdge>&) {
79 return ":/icons/linetype-conditionaledge.png"; 79 return ":/icons/linetype-conditionaledge.png";
80 }, 80 },
81 [](const Colored<CircularPrimitive>&) { 81 [](const Colored<circular_primitive>&) {
82 return ":/icons/linetype-circularprimitive.png"; 82 return ":/icons/linetype-circularprimitive.png";
83 }, 83 },
84 [](const Comment&) { 84 [](const Comment&) {
85 return ":/icons/chatbubble-ellipses-outline.png"; 85 return ":/icons/chatbubble-ellipses-outline.png";
86 }, 86 },
146 .arg(vertexToString(cedge.element.p1)) 146 .arg(vertexToString(cedge.element.p1))
147 .arg(vertexToString(cedge.element.p2)) 147 .arg(vertexToString(cedge.element.p2))
148 .arg(vertexToString(cedge.element.c1)) 148 .arg(vertexToString(cedge.element.c1))
149 .arg(vertexToString(cedge.element.c2)); 149 .arg(vertexToString(cedge.element.c2));
150 }, 150 },
151 [](const Colored<CircularPrimitive>& circ) { 151 [](const Colored<circular_primitive>& circ) {
152 return QStringLiteral("1 %1 %2 %3") 152 return QStringLiteral("1 %1 %2 %3")
153 .arg(circ.color.index) 153 .arg(circ.color.index)
154 .arg(transformToString(circ.element.transformation)) 154 .arg(transformToString(circ.element.transformation))
155 .arg(circularPrimitiveFilePath(circ.element)); 155 .arg(circularPrimitiveFilePath(circ.element));
156 }, 156 },

mercurial