#ifndef MESHOBJECTSTESTINFOVISITOR_HPP #define MESHOBJECTSTESTINFOVISITOR_HPP #include "meshobjectstestinfovisitor.h" template MeshObjectsTestInfoVisitor::MeshObjectsTestInfoVisitor(Scene::ObjectType type) { Q_ASSERT((type == Scene::TriangleGlobalCloud) || (type == Scene::LineGlobalCloud)); if ((type != Scene::TriangleGlobalCloud) && (type != Scene::LineGlobalCloud)) {qDebug() << "MeshObjectsTestInfoVisitor::MeshObjectsTestInfoVisitor" << ", " << "(type != Scene::TriangleGlobalCloud) && (type != Scene::LineGlobalCloud)"; return;} m_objectType = type; m_testFunction = nullptr; m_foundedObjects = new FoundedCloudIndex(); } template MeshObjectsTestInfoVisitor::~MeshObjectsTestInfoVisitor() { delete m_foundedObjects; } template void MeshObjectsTestInfoVisitor::compute(PermanentItemSceneByModel* scene) { scene->visitObjectsOfTypes(QList() << m_objectType, *this); } template void MeshObjectsTestInfoVisitor::visitChunk(const IChunk* chunk) { Q_ASSERT(m_testFunction != nullptr); if (m_testFunction == nullptr) {qDebug() << "MeshObjectsTestInfoVisitor::visitChunk" << ", " << "m_testFunction == nullptr"; return;} const AbstractChunkGenericCloudObject* objectChunk = dynamic_cast(chunk); ElementInfo* foin = objectChunk->getFirstObjectInfo(); const size_t nObjects = objectChunk->countObjects(); const size_t firstGlobalIndex = objectChunk->getBeginningOfObjectCloud(); GLuint* foi = objectChunk->getFirstObjectIndex(); if(foin != nullptr) { for(size_t i=0; iaddIndex(firstGlobalIndex + localIndex); } } else { const ElementInfo defaultInfo = ElementInfo(); if(m_testFunction(defaultInfo)) { for(size_t i=0; iaddIndex(firstGlobalIndex + foi[i]); } } } template void MeshObjectsTestInfoVisitor::setFunction(testFunction f) { m_testFunction = f; } template FoundedCloudIndex* MeshObjectsTestInfoVisitor::getFoundedObjects() const { return m_foundedObjects; } template FoundedCloudIndex* MeshObjectsTestInfoVisitor::takeFoundedObjects() { FoundedCloudIndex* s = m_foundedObjects; m_foundedObjects = new FoundedCloudIndex(); return s; } #endif // MESHOBJECTSTESTINFOVISITOR_HPP