///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) Statoil ASA, Ceetron Solutions AS // // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. // // See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RivFaultPartMgr.h" #include "cvfPart.h" #include "cvfModelBasicList.h" #include "cvfColor3.h" #include "cvfTransform.h" #include "cafPdmFieldCvfColor.h" #include "RimFaultCollection.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RivFaultPartMgr::RivFaultPartMgr(const RigGridBase* grid, size_t gridIdx, const RimFaultCollection* faultCollection) : m_gridIdx(gridIdx), m_grid(grid), m_faultCollection(faultCollection) { CVF_ASSERT(grid); if (faultCollection) { for (size_t i = 0; i < faultCollection->faults.size(); i++) { m_faultParts.push_back(new RivFaultPart(grid, faultCollection->faults[i])); } } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RivFaultPartMgr::~RivFaultPartMgr() { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivFaultPartMgr::setTransform(cvf::Transform* scaleTransform) { m_scaleTransform = scaleTransform; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivFaultPartMgr::setCellVisibility(cvf::UByteArray* cellVisibilities) { CVF_ASSERT(cellVisibilities); for (size_t i = 0; i < m_faultParts.size(); i++) { m_faultParts.at(i)->setCellVisibility(cellVisibilities); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivFaultPartMgr::appendPartsToModel(cvf::ModelBasicList* model) { CVF_ASSERT(model != NULL); // Faults are only present for main grid if (!m_grid->isMainGrid()) return; if (!m_faultCollection->showFaultCollection()) return; cvf::ModelBasicList parts; for (size_t i = 0; i < m_faultParts.size(); i++) { m_faultParts[i]->appendPartsToModel(&parts); } for (size_t i = 0; i < parts.partCount(); i++) { cvf::Part* part = parts.part(i); part->setTransform(m_scaleTransform.p()); model->addPart(part); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivFaultPartMgr::updateCellColor(cvf::Color4f color) { for (size_t i = 0; i < m_faultParts.size(); i++) { m_faultParts[i]->updateCellColor(color); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivFaultPartMgr::updateCellResultColor(size_t timeStepIndex, RimResultSlot* cellResultSlot) { for (size_t i = 0; i < m_faultParts.size(); i++) { m_faultParts[i]->updateCellResultColor(timeStepIndex, cellResultSlot); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RivFaultPartMgr::updateCellEdgeResultColor(size_t timeStepIndex, RimResultSlot* cellResultSlot, RimCellEdgeResultSlot* cellEdgeResultSlot) { for (size_t i = 0; i < m_faultParts.size(); i++) { m_faultParts[i]->updateCellEdgeResultColor(timeStepIndex, cellResultSlot, cellEdgeResultSlot); } }