--- a/src/basics.cpp Sun Sep 06 20:45:51 2015 +0300 +++ b/src/basics.cpp Tue Sep 22 00:59:21 2015 +0300 @@ -101,6 +101,11 @@ return false; } +unsigned int qHash (const Vertex& vertex) +{ + return qHash (vertex.toString()); +} + // ============================================================================= // Matrix::Matrix (double vals[]) @@ -221,26 +226,21 @@ // void LDBoundingBox::calcObject (LDObject* obj) { - switch (obj->type()) + LDSubfile* ref; + + if (obj->hasVertices()) { - case OBJ_Line: - case OBJ_Triangle: - case OBJ_Quad: - case OBJ_CondLine: - for (int i = 0; i < obj->numVertices(); ++i) - calcVertex (obj->vertex (i)); - break; - - case OBJ_Subfile: - for (LDObject* it : static_cast<LDSubfile*> (obj)->inlineContents (true, false)) + LDVertexObject* vo = static_cast<LDVertexObject*> (obj); + for (int i = 0; i < vo->numVertices(); ++i) + calcVertex (vo->vertex (i)); + } + else if ((ref = dynamic_cast<LDSubfile*> (obj)) != nullptr) + { + for (LDObject* it : ref->inlineContents (true, false)) { calcObject (it); it->destroy(); } - break; - - default: - break; } }