bbox.cpp

changeset 71
c9f02d2dd9eb
parent 70
e6b8dab8f81a
child 104
6e29bb0e83c5
equal deleted inserted replaced
70:e6b8dab8f81a 71:c9f02d2dd9eb
32 reset (); 32 reset ();
33 33
34 if (!g_CurrentFile) 34 if (!g_CurrentFile)
35 return; 35 return;
36 36
37 for (LDObject* obj : g_CurrentFile->objects) { 37 for (LDObject* obj : g_CurrentFile->objects)
38 switch (obj->getType ()) { 38 checkObject (obj);
39 case OBJ_Line: 39 }
40 { 40
41 LDLine* line = static_cast<LDLine*> (obj); 41 // =============================================================================
42 for (short i = 0; i < 2; ++i) 42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
43 checkVertex (line->vaCoords[i]); 43 // =============================================================================
44 void bbox::checkObject (LDObject* obj) {
45 switch (obj->getType ()) {
46 case OBJ_Line:
47 {
48 LDLine* line = static_cast<LDLine*> (obj);
49 for (short i = 0; i < 2; ++i)
50 checkVertex (line->vaCoords[i]);
51 }
52 break;
53
54 case OBJ_Triangle:
55 {
56 LDTriangle* tri = static_cast<LDTriangle*> (obj);
57 for (short i = 0; i < 3; ++i)
58 checkVertex (tri->vaCoords[i]);
59 }
60 break;
61
62 case OBJ_Quad:
63 {
64 LDQuad* quad = static_cast<LDQuad*> (obj);
65 for (short i = 0; i < 4; ++i)
66 checkVertex (quad->vaCoords[i]);
67 }
68 break;
69
70 case OBJ_CondLine:
71 {
72 LDCondLine* line = static_cast<LDCondLine*> (obj);
73 for (short i = 0; i < 4; ++i)
74 checkVertex (line->vaCoords[i]);
75 }
76 break;
77
78 case OBJ_Subfile:
79 {
80 LDSubfile* ref = static_cast<LDSubfile*> (obj);
81 vector<LDObject*> objs = ref->inlineContents (true, true);
82
83 for (LDObject* obj : objs) {
84 checkObject (obj);
85 delete obj;
44 } 86 }
45 break;
46
47 case OBJ_Triangle:
48 {
49 LDTriangle* tri = static_cast<LDTriangle*> (obj);
50 for (short i = 0; i < 3; ++i)
51 checkVertex (tri->vaCoords[i]);
52 }
53 break;
54
55 case OBJ_Quad:
56 {
57 LDQuad* quad = static_cast<LDQuad*> (obj);
58 for (short i = 0; i < 4; ++i)
59 checkVertex (quad->vaCoords[i]);
60 }
61 break;
62
63 case OBJ_CondLine:
64 {
65 LDCondLine* line = static_cast<LDCondLine*> (obj);
66 for (short i = 0; i < 4; ++i)
67 checkVertex (line->vaCoords[i]);
68 }
69 break;
70
71 default:
72 break;
73 } 87 }
88
89 default:
90 break;
74 } 91 }
75 } 92 }
76 93
77 // ============================================================================= 94 // =============================================================================
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

mercurial