ldtypes.cpp

changeset 164
8c93d8e38494
parent 162
b7d65e89861a
child 168
96691a009dff
equal deleted inserted replaced
163:46955613626d 164:8c93d8e38494
60 LDObject::LDObject () { 60 LDObject::LDObject () {
61 qObjListEntry = null; 61 qObjListEntry = null;
62 parent = null; 62 parent = null;
63 } 63 }
64 64
65 LDGibberish::LDGibberish () {
66 dColor = -1;
67 }
68
69 LDGibberish::LDGibberish (str _zContent, str _zReason) { 65 LDGibberish::LDGibberish (str _zContent, str _zReason) {
70 zContents = _zContent; 66 zContents = _zContent;
71 zReason = _zReason; 67 zReason = _zReason;
72 dColor = -1;
73 }
74
75 LDEmpty::LDEmpty () {
76 dColor = -1;
77 }
78
79 LDComment::LDComment () {
80 dColor = -1;
81 }
82
83 LDSubfile::LDSubfile () {
84
85 }
86
87 LDLine::LDLine () {
88
89 }
90
91 LDTriangle::LDTriangle () {
92
93 }
94
95 LDQuad::LDQuad () {
96
97 }
98
99 LDCondLine::LDCondLine () {
100
101 }
102
103 LDVertex::LDVertex () {
104
105 }
106
107 LDBFC::LDBFC () {
108
109 } 68 }
110 69
111 // ============================================================================= 70 // =============================================================================
112 str LDComment::getContents () { 71 str LDComment::getContents () {
113 return fmt ("0 %s", zText.chars ()); 72 return fmt ("0 %s", text.chars ());
114 } 73 }
115 74
116 str LDSubfile::getContents () { 75 str LDSubfile::getContents () {
117 str val = fmt ("1 %d %s ", dColor, vPosition.stringRep (false).chars ()); 76 str val = fmt ("1 %d %s ", dColor, vPosition.stringRep (false).chars ());
118 val += mMatrix.stringRep (); 77 val += mMatrix.stringRep ();
171 } 130 }
172 131
173 // ============================================================================= 132 // =============================================================================
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
175 // ============================================================================= 134 // =============================================================================
176 const char* LDBFC::saStatements[] = { 135 const char* LDBFC::statements[] = {
177 "CERTIFY CCW", 136 "CERTIFY CCW",
178 "CCW", 137 "CCW",
179 "CERTIFY CW", 138 "CERTIFY CW",
180 "CW", 139 "CW",
181 "NOCERTIFY", 140 "NOCERTIFY",
182 "INVERTNEXT", 141 "INVERTNEXT",
183 }; 142 };
184 143
185 str LDBFC::getContents () { 144 str LDBFC::getContents () {
186 return fmt ("0 BFC %s", LDBFC::saStatements[eStatement]); 145 return fmt ("0 BFC %s", LDBFC::statements[type]);
187 } 146 }
188 147
189 // ============================================================================= 148 // =============================================================================
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
191 // ============================================================================= 150 // =============================================================================
249 // Remove this object from the selection array if it is there. 208 // Remove this object from the selection array if it is there.
250 for (ulong i = 0; i < g_win->sel ().size(); ++i) 209 for (ulong i = 0; i < g_win->sel ().size(); ++i)
251 if (g_win->sel ()[i] == this) 210 if (g_win->sel ()[i] == this)
252 g_win->sel ().erase (g_win->sel ().begin() + i); 211 g_win->sel ().erase (g_win->sel ().begin() + i);
253 } 212 }
254
255 LDComment::~LDComment () {}
256 LDCondLine::~LDCondLine () {}
257 LDEmpty::~LDEmpty () {}
258 LDGibberish::~LDGibberish () {}
259 LDLine::~LDLine () {}
260 LDQuad::~LDQuad () {}
261 LDSubfile::~LDSubfile () {}
262 LDTriangle::~LDTriangle () {}
263 LDVertex::~LDVertex () {}
264 LDBFC::~LDBFC () {}
265 LDRadial::~LDRadial () {}
266 213
267 // ============================================================================= 214 // =============================================================================
268 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
269 // ============================================================================= 216 // =============================================================================
270 static void transformObject (LDObject* obj, matrix<3> transform, vertex pos, short parentcolor) { 217 static void transformObject (LDObject* obj, matrix<3> transform, vertex pos, short parentcolor) {
319 case OBJ_Vertex: 266 case OBJ_Vertex:
320 continue; 267 continue;
321 268
322 case OBJ_BFC: 269 case OBJ_BFC:
323 // Filter non-INVERTNEXT statements 270 // Filter non-INVERTNEXT statements
324 if (static_cast<LDBFC*> (obj)->eStatement != LDBFC::InvertNext) 271 if (static_cast<LDBFC*> (obj)->type != LDBFC::InvertNext)
325 continue; 272 continue;
326 break; 273 break;
327 274
328 default: 275 default:
329 break; 276 break;
500 } 447 }
501 448
502 // ============================================================================= 449 // =============================================================================
503 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 450 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
504 // ============================================================================= 451 // =============================================================================
505 LDRadial::LDRadial () {
506
507 }
508
509 static char const* g_saRadialTypeNames[] = { 452 static char const* g_saRadialTypeNames[] = {
510 "Circle", 453 "Circle",
511 "Cylinder", 454 "Cylinder",
512 "Disc", 455 "Disc",
513 "Disc Negative", 456 "Disc Negative",
681 // ============================================================================= 624 // =============================================================================
682 str LDRadial::makeFileName () { 625 str LDRadial::makeFileName () {
683 short dNumerator = dSegments, 626 short dNumerator = dSegments,
684 dDenominator = dDivisions; 627 dDenominator = dDivisions;
685 628
686 // Simplify the fractional part, but the denominator is at least 4. 629 // Simplify the fractional part, but the denominator must be at least 4.
687 simplify (dNumerator, dDenominator); 630 simplify (dNumerator, dDenominator);
688 631
689 if (dDenominator < 4) { 632 if (dDenominator < 4) {
690 const short dFactor = (4 / dDenominator); 633 const short dFactor = (4 / dDenominator);
691 634

mercurial