111 // ============================================================================= |
111 // ============================================================================= |
112 // ----------------------------------------------------------------------------- |
112 // ----------------------------------------------------------------------------- |
113 str LDLine::raw() |
113 str LDLine::raw() |
114 { str val = fmt ("2 %1", color()); |
114 { str val = fmt ("2 %1", color()); |
115 |
115 |
116 for (ushort i = 0; i < 2; ++i) |
116 for (int i = 0; i < 2; ++i) |
117 val += fmt (" %1", getVertex (i)); |
117 val += fmt (" %1", getVertex (i)); |
118 |
118 |
119 return val; |
119 return val; |
120 } |
120 } |
121 |
121 |
122 // ============================================================================= |
122 // ============================================================================= |
123 // ----------------------------------------------------------------------------- |
123 // ----------------------------------------------------------------------------- |
124 str LDTriangle::raw() |
124 str LDTriangle::raw() |
125 { str val = fmt ("3 %1", color()); |
125 { str val = fmt ("3 %1", color()); |
126 |
126 |
127 for (ushort i = 0; i < 3; ++i) |
127 for (int i = 0; i < 3; ++i) |
128 val += fmt (" %1", getVertex (i)); |
128 val += fmt (" %1", getVertex (i)); |
129 |
129 |
130 return val; |
130 return val; |
131 } |
131 } |
132 |
132 |
133 // ============================================================================= |
133 // ============================================================================= |
134 // ----------------------------------------------------------------------------- |
134 // ----------------------------------------------------------------------------- |
135 str LDQuad::raw() |
135 str LDQuad::raw() |
136 { str val = fmt ("4 %1", color()); |
136 { str val = fmt ("4 %1", color()); |
137 |
137 |
138 for (ushort i = 0; i < 4; ++i) |
138 for (int i = 0; i < 4; ++i) |
139 val += fmt (" %1", getVertex (i)); |
139 val += fmt (" %1", getVertex (i)); |
140 |
140 |
141 return val; |
141 return val; |
142 } |
142 } |
143 |
143 |
145 // ----------------------------------------------------------------------------- |
145 // ----------------------------------------------------------------------------- |
146 str LDCndLine::raw() |
146 str LDCndLine::raw() |
147 { str val = fmt ("5 %1", color()); |
147 { str val = fmt ("5 %1", color()); |
148 |
148 |
149 // Add the coordinates |
149 // Add the coordinates |
150 for (ushort i = 0; i < 4; ++i) |
150 for (int i = 0; i < 4; ++i) |
151 val += fmt (" %1", getVertex (i)); |
151 val += fmt (" %1", getVertex (i)); |
152 |
152 |
153 return val; |
153 return val; |
154 } |
154 } |
155 |
155 |
252 |
252 |
253 // ============================================================================= |
253 // ============================================================================= |
254 // ----------------------------------------------------------------------------- |
254 // ----------------------------------------------------------------------------- |
255 LDObject::~LDObject() |
255 LDObject::~LDObject() |
256 { // Remove this object from the selection array if it is there. |
256 { // Remove this object from the selection array if it is there. |
257 for (ulong i = 0; i < g_win->sel().size(); ++i) |
257 for (int i = 0; i < g_win->sel().size(); ++i) |
258 if (g_win->sel() [i] == this) |
258 if (g_win->sel() [i] == this) |
259 g_win->sel().erase (i); |
259 g_win->sel().erase (i); |
260 |
260 |
261 // Delete the GL lists |
261 // Delete the GL lists |
262 GL::deleteLists (this); |
262 GL::deleteLists (this); |
263 |
263 |
264 // Remove this object from the list of LDObjects |
264 // Remove this object from the list of LDObjects |
265 ulong pos = g_LDObjects.find (this); |
265 int pos; |
266 |
266 |
267 if (pos < g_LDObjects.size()) |
267 if ((pos = g_LDObjects.find (this)) != -1) |
268 g_LDObjects.erase (pos); |
268 g_LDObjects.erase (pos); |
269 } |
269 } |
270 |
270 |
271 // ============================================================================= |
271 // ============================================================================= |
272 // ----------------------------------------------------------------------------- |
272 // ----------------------------------------------------------------------------- |
393 if (objs.size() == 0) |
393 if (objs.size() == 0) |
394 return "nothing"; // :) |
394 return "nothing"; // :) |
395 |
395 |
396 for (long i = 0; i < LDObject::NumTypes; ++i) |
396 for (long i = 0; i < LDObject::NumTypes; ++i) |
397 { LDObject::Type objType = (LDObject::Type) i; |
397 { LDObject::Type objType = (LDObject::Type) i; |
398 ulong objCount = 0; |
398 int count = 0; |
399 |
399 |
400 for (LDObject * obj : objs) |
400 for (LDObject * obj : objs) |
401 if (obj->getType() == objType) |
401 if (obj->getType() == objType) |
402 objCount++; |
402 count++; |
403 |
403 |
404 if (objCount == 0) |
404 if (count == 0) |
405 continue; |
405 continue; |
406 |
406 |
407 if (!firstDetails) |
407 if (!firstDetails) |
408 text += ", "; |
408 text += ", "; |
409 |
409 |
410 str noun = fmt ("%1%2", typeName (objType), plural (objCount)); |
410 str noun = fmt ("%1%2", typeName (objType), plural (count)); |
411 |
411 |
412 // Plural of "vertex" is "vertices". Stupid English. |
412 // Plural of "vertex" is "vertices". Stupid English. |
413 if (objType == LDObject::Vertex && objCount != 1) |
413 if (objType == LDObject::Vertex && count != 1) |
414 noun = "vertices"; |
414 noun = "vertices"; |
415 |
415 |
416 text += fmt ("%1 %2", objCount, noun); |
416 text += fmt ("%1 %2", count, noun); |
417 firstDetails = false; |
417 firstDetails = false; |
418 } |
418 } |
419 |
419 |
420 return text; |
420 return text; |
421 } |
421 } |
576 // a BFC INVERTNEXT statement. Thus we need to toggle this status. |
576 // a BFC INVERTNEXT statement. Thus we need to toggle this status. |
577 // For flat primitives it's sufficient that the determinant is |
577 // For flat primitives it's sufficient that the determinant is |
578 // flipped but I don't have a method for checking flatness yet. |
578 // flipped but I don't have a method for checking flatness yet. |
579 // Food for thought... |
579 // Food for thought... |
580 |
580 |
581 ulong idx = getIndex(); |
581 int idx = getIndex(); |
582 |
582 |
583 if (idx > 0) |
583 if (idx > 0) |
584 { LDBFC* bfc = dynamic_cast<LDBFC*> (prev()); |
584 { LDBFC* bfc = dynamic_cast<LDBFC*> (prev()); |
585 |
585 |
586 if (bfc && bfc->type == LDBFC::InvertNext) |
586 if (bfc && bfc->type == LDBFC::InvertNext) |