#3379 Holo Lens : Add source pdmObject to RivSouceInfo

This commit is contained in:
Magne Sjaastad 2018-09-19 09:51:55 +02:00
parent dbf0747036
commit 56c91c39fd
10 changed files with 97 additions and 52 deletions

View File

@ -232,7 +232,7 @@ void RivFaultPartMgr::generatePartGeometry()
part->setDrawable(geo.p()); part->setDrawable(geo.p());
// Set mapping from triangle face index to cell index // Set mapping from triangle face index to cell index
cvf::ref<RivSourceInfo> si = new RivSourceInfo(m_grid->gridIndex()); cvf::ref<RivSourceInfo> si = new RivSourceInfo(const_cast<RimFaultInView*>(m_rimFault), m_grid->gridIndex());
si->m_cellFaceFromTriangleMapper = m_nativeFaultGenerator->triangleToCellFaceMapper(); si->m_cellFaceFromTriangleMapper = m_nativeFaultGenerator->triangleToCellFaceMapper();
part->setSourceInfo(si.p()); part->setSourceInfo(si.p());
@ -284,7 +284,7 @@ void RivFaultPartMgr::generatePartGeometry()
part->setDrawable(geo.p()); part->setDrawable(geo.p());
// Set mapping from triangle face index to cell index // Set mapping from triangle face index to cell index
cvf::ref<RivSourceInfo> si = new RivSourceInfo(m_grid->gridIndex()); cvf::ref<RivSourceInfo> si = new RivSourceInfo(const_cast<RimFaultInView*>(m_rimFault), m_grid->gridIndex());
si->m_cellFaceFromTriangleMapper = m_oppositeFaultGenerator->triangleToCellFaceMapper(); si->m_cellFaceFromTriangleMapper = m_oppositeFaultGenerator->triangleToCellFaceMapper();
part->setSourceInfo(si.p()); part->setSourceInfo(si.p());
@ -334,7 +334,7 @@ void RivFaultPartMgr::generatePartGeometry()
part->setDrawable(geo.p()); part->setDrawable(geo.p());
// Set mapping from triangle face index to cell index // Set mapping from triangle face index to cell index
cvf::ref<RivSourceInfo> si = new RivSourceInfo(m_grid->gridIndex());; cvf::ref<RivSourceInfo> si = new RivSourceInfo(const_cast<RimFaultInView*>(m_rimFault), m_grid->gridIndex());
si->m_NNCIndices = m_NNCGenerator->triangleToNNCIndex().p(); si->m_NNCIndices = m_NNCGenerator->triangleToNNCIndex().p();
part->setSourceInfo(si.p()); part->setSourceInfo(si.p());

View File

@ -69,13 +69,14 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RivGridPartMgr::RivGridPartMgr(const RigGridBase* grid, size_t gridIdx) RivGridPartMgr::RivGridPartMgr(RimEclipseCase* eclipseCase, const RigGridBase* grid, size_t gridIdx)
: m_surfaceGenerator(grid) : m_surfaceGenerator(grid)
, m_gridIdx(gridIdx) , m_gridIdx(gridIdx)
, m_grid(grid) , m_grid(grid)
, m_surfaceFaceFilter(grid) , m_surfaceFaceFilter(grid)
, m_opacityLevel(1.0f) , m_opacityLevel(1.0f)
, m_defaultColor(cvf::Color3::WHITE) , m_defaultColor(cvf::Color3::WHITE)
, m_eclipseCase(eclipseCase)
{ {
CVF_ASSERT(grid); CVF_ASSERT(grid);
m_cellVisibility = new cvf::UByteArray; m_cellVisibility = new cvf::UByteArray;
@ -131,7 +132,7 @@ void RivGridPartMgr::generatePartGeometry(cvf::StructGridGeometryGenerator& geoB
part->setTransform(m_scaleTransform.p()); part->setTransform(m_scaleTransform.p());
// Set mapping from triangle face index to cell index // Set mapping from triangle face index to cell index
cvf::ref<RivSourceInfo> si = new RivSourceInfo(m_gridIdx); cvf::ref<RivSourceInfo> si = new RivSourceInfo(m_eclipseCase, m_gridIdx);
si->m_cellFaceFromTriangleMapper = geoBuilder.triangleToCellFaceMapper(); si->m_cellFaceFromTriangleMapper = geoBuilder.triangleToCellFaceMapper();
part->setSourceInfo(si.p()); part->setSourceInfo(si.p());

View File

@ -22,6 +22,8 @@
#include "RigGridBase.h" #include "RigGridBase.h"
#include "cafPdmPointer.h"
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfObject.h" #include "cvfObject.h"
@ -38,6 +40,7 @@ namespace cvf
class RimEclipseCellColors; class RimEclipseCellColors;
class RimCellEdgeColors; class RimCellEdgeColors;
class RimEclipseCase;
@ -52,7 +55,7 @@ class RimCellEdgeColors;
class RivGridPartMgr: public cvf::Object class RivGridPartMgr: public cvf::Object
{ {
public: public:
RivGridPartMgr(const RigGridBase* grid, size_t gridIdx); RivGridPartMgr(RimEclipseCase* eclipseCase, const RigGridBase* grid, size_t gridIdx);
~RivGridPartMgr(); ~RivGridPartMgr();
void setTransform(cvf::Transform* scaleTransform); void setTransform(cvf::Transform* scaleTransform);
void setCellVisibility(cvf::UByteArray* cellVisibilities ); void setCellVisibility(cvf::UByteArray* cellVisibilities );
@ -87,4 +90,6 @@ private:
cvf::ref<cvf::Part> m_surfaceGridLines; cvf::ref<cvf::Part> m_surfaceGridLines;
cvf::ref<cvf::UByteArray> m_cellVisibility; cvf::ref<cvf::UByteArray> m_cellVisibility;
caf::PdmPointer<RimEclipseCase> m_eclipseCase;
}; };

View File

@ -1,17 +1,17 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2017 - Statoil ASA // Copyright (C) 2017 - Statoil ASA
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // FITNESS FOR A PARTICULAR PURPOSE.
// //
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> // See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@ -21,16 +21,15 @@
#include "cafPdmObject.h" #include "cafPdmObject.h"
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RivObjectSourceInfo::RivObjectSourceInfo(caf::PdmObject* object) RivObjectSourceInfo::RivObjectSourceInfo(caf::PdmObject* object)
: m_object(object) : m_object(object)
{ {
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
caf::PdmObject* RivObjectSourceInfo::object() const caf::PdmObject* RivObjectSourceInfo::object() const
{ {

View File

@ -1,17 +1,17 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2017 - Statoil ASA // Copyright (C) 2017 - Statoil ASA
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // FITNESS FOR A PARTICULAR PURPOSE.
// //
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> // See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@ -23,21 +23,22 @@
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfObject.h" #include "cvfObject.h"
namespace caf { namespace caf
class PdmObject; {
class PdmObject;
} }
//================================================================================================== //==================================================================================================
/// ///
/// ///
//================================================================================================== //==================================================================================================
class RivObjectSourceInfo : public cvf::Object class RivObjectSourceInfo : public cvf::Object
{ {
public: public:
RivObjectSourceInfo(caf::PdmObject* object); RivObjectSourceInfo(caf::PdmObject* object);
caf::PdmObject* object() const; caf::PdmObject* object() const;
private: private:
caf::PdmPointer<caf::PdmObject> m_object; caf::PdmPointer<caf::PdmObject> m_object;
}; };

View File

@ -22,6 +22,8 @@
#include "RigEclipseCaseData.h" #include "RigEclipseCaseData.h"
#include "RimEclipseCase.h"
#include "RivGridPartMgr.h" #include "RivGridPartMgr.h"
#include "RivReservoirFaultsPartMgr.h" #include "RivReservoirFaultsPartMgr.h"
@ -30,17 +32,20 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RivReservoirPartMgr::clearAndSetReservoir(const RigEclipseCaseData* eclipseCase, RimEclipseView* reservoirView) void RivReservoirPartMgr::clearAndSetReservoir(RimEclipseCase* eclipseCase, RimEclipseView* reservoirView)
{ {
m_allGrids.clear(); m_allGrids.clear();
if (eclipseCase)
if (eclipseCase && eclipseCase->eclipseCaseData())
{ {
RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData();
std::vector<const RigGridBase*> grids; std::vector<const RigGridBase*> grids;
eclipseCase->allGrids(&grids); eclipseCaseData->allGrids(&grids);
for (size_t i = 0; i < grids.size() ; ++i) for (size_t i = 0; i < grids.size() ; ++i)
{ {
m_allGrids.push_back(new RivGridPartMgr(grids[i], i)); m_allGrids.push_back(new RivGridPartMgr(eclipseCase, grids[i], i));
} }
if (eclipseCase->mainGrid()) if (eclipseCase->mainGrid())

View File

@ -32,6 +32,7 @@ namespace cvf
class RimEclipseCellColors; class RimEclipseCellColors;
class RimCellEdgeColors; class RimCellEdgeColors;
class RimEclipseCase;
class RigEclipseCaseData; class RigEclipseCaseData;
class RimEclipseView; class RimEclipseView;
class RivReservoirFaultsPartMgr; class RivReservoirFaultsPartMgr;
@ -47,7 +48,7 @@ class RivGridPartMgr;
class RivReservoirPartMgr: public cvf::Object class RivReservoirPartMgr: public cvf::Object
{ {
public: public:
void clearAndSetReservoir(const RigEclipseCaseData* eclipseCase, RimEclipseView* reservoirView); void clearAndSetReservoir(RimEclipseCase* eclipseCase, RimEclipseView* reservoirView);
void setTransform(cvf::Transform* scaleTransform); void setTransform(cvf::Transform* scaleTransform);
void setCellVisibility(size_t gridIndex, cvf::UByteArray* cellVisibilities ); void setCellVisibility(size_t gridIndex, cvf::UByteArray* cellVisibilities );

View File

@ -151,6 +151,13 @@ void RivReservoirViewPartMgr::scheduleGeometryRegen(RivCellSetEnum geometryType)
void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType) void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType)
{ {
RigEclipseCaseData* eclipseCase = nullptr; RigEclipseCaseData* eclipseCase = nullptr;
RimEclipseCase* rimEclipseCase = nullptr;
if (m_reservoirView)
{
m_reservoirView->firstAncestorOrThisOfType(rimEclipseCase);
}
if (m_reservoirView != nullptr && m_reservoirView->eclipseCase()) if (m_reservoirView != nullptr && m_reservoirView->eclipseCase())
{ {
eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData(); eclipseCase = m_reservoirView->eclipseCase()->eclipseCaseData();
@ -163,7 +170,7 @@ void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType)
m_propFilteredGeometryFramesNeedsRegen[i] = true; m_propFilteredGeometryFramesNeedsRegen[i] = true;
if (m_propFilteredGeometryFrames[i].notNull()) if (m_propFilteredGeometryFrames[i].notNull())
{ {
m_propFilteredGeometryFrames[i]->clearAndSetReservoir(eclipseCase, m_reservoirView); m_propFilteredGeometryFrames[i]->clearAndSetReservoir(rimEclipseCase, m_reservoirView);
m_propFilteredGeometryFrames[i]->setTransform(m_scaleTransform.p()); m_propFilteredGeometryFrames[i]->setTransform(m_scaleTransform.p());
} }
} }
@ -175,7 +182,7 @@ void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType)
m_propFilteredWellGeometryFramesNeedsRegen[i] = true; m_propFilteredWellGeometryFramesNeedsRegen[i] = true;
if (m_propFilteredWellGeometryFrames[i].notNull()) if (m_propFilteredWellGeometryFrames[i].notNull())
{ {
m_propFilteredWellGeometryFrames[i]->clearAndSetReservoir(eclipseCase, m_reservoirView); m_propFilteredWellGeometryFrames[i]->clearAndSetReservoir(rimEclipseCase, m_reservoirView);
m_propFilteredWellGeometryFrames[i]->setTransform(m_scaleTransform.p()); m_propFilteredWellGeometryFrames[i]->setTransform(m_scaleTransform.p());
} }
} }
@ -183,7 +190,7 @@ void RivReservoirViewPartMgr::clearGeometryCache(RivCellSetEnum geomType)
else else
{ {
m_geometriesNeedsRegen[geomType] = true; m_geometriesNeedsRegen[geomType] = true;
m_geometries[geomType].clearAndSetReservoir(eclipseCase, m_reservoirView); m_geometries[geomType].clearAndSetReservoir(rimEclipseCase, m_reservoirView);
m_geometries[geomType].setTransform(m_scaleTransform.p()); m_geometries[geomType].setTransform(m_scaleTransform.p());
} }
} }
@ -275,7 +282,8 @@ void RivReservoirViewPartMgr::ensureDynamicGeometryPartsCreated(RivCellSetEnum g
void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType) void RivReservoirViewPartMgr::createGeometry(RivCellSetEnum geometryType)
{ {
RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData(); RigEclipseCaseData* res = m_reservoirView->eclipseCase()->eclipseCaseData();
m_geometries[geometryType].clearAndSetReservoir(res, m_reservoirView);
m_geometries[geometryType].clearAndSetReservoir(m_reservoirView->eclipseCase(), m_reservoirView);
m_geometries[geometryType].setTransform(m_scaleTransform.p()); m_geometries[geometryType].setTransform(m_scaleTransform.p());
std::vector<RigGridBase*> grids; std::vector<RigGridBase*> grids;
@ -434,7 +442,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredNoneWellCellGeometry(size_t
if ( m_propFilteredGeometryFrames[frameIndex].isNull()) m_propFilteredGeometryFrames[frameIndex] = new RivReservoirPartMgr; if ( m_propFilteredGeometryFrames[frameIndex].isNull()) m_propFilteredGeometryFrames[frameIndex] = new RivReservoirPartMgr;
m_propFilteredGeometryFrames[frameIndex]->clearAndSetReservoir(res, m_reservoirView); m_propFilteredGeometryFrames[frameIndex]->clearAndSetReservoir(m_reservoirView->eclipseCase(), m_reservoirView);
m_propFilteredGeometryFrames[frameIndex]->setTransform(m_scaleTransform.p()); m_propFilteredGeometryFrames[frameIndex]->setTransform(m_scaleTransform.p());
std::vector<RigGridBase*> grids; std::vector<RigGridBase*> grids;
@ -510,7 +518,7 @@ void RivReservoirViewPartMgr::createPropertyFilteredWellGeometry(size_t frameInd
if ( m_propFilteredWellGeometryFrames[frameIndex].isNull()) m_propFilteredWellGeometryFrames[frameIndex] = new RivReservoirPartMgr; if ( m_propFilteredWellGeometryFrames[frameIndex].isNull()) m_propFilteredWellGeometryFrames[frameIndex] = new RivReservoirPartMgr;
m_propFilteredWellGeometryFrames[frameIndex]->clearAndSetReservoir(res, m_reservoirView); m_propFilteredWellGeometryFrames[frameIndex]->clearAndSetReservoir(m_reservoirView->eclipseCase(), m_reservoirView);
m_propFilteredWellGeometryFrames[frameIndex]->setTransform(m_scaleTransform.p()); m_propFilteredWellGeometryFrames[frameIndex]->setTransform(m_scaleTransform.p());
std::vector<RigGridBase*> grids; std::vector<RigGridBase*> grids;

View File

@ -2,27 +2,44 @@
// //
// Copyright (C) Statoil ASA // Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS // Copyright (C) Ceetron Solutions AS
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // FITNESS FOR A PARTICULAR PURPOSE.
// //
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> // See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "RivSourceInfo.h" #include "RivSourceInfo.h"
#include "cvfStructGridGeometryGenerator.h" #include "cvfStructGridGeometryGenerator.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RivSourceInfo::RivSourceInfo(caf::PdmObject* pdmObject, size_t gridIndex)
: RivObjectSourceInfo(pdmObject)
, m_gridIndex(gridIndex)
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//--------------------------------------------------------------------------------------------------
size_t RivSourceInfo::gridIndex() const
{
return m_gridIndex;
}
//--------------------------------------------------------------------------------------------------
///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RivSourceInfo::hasCellFaceMapping() const bool RivSourceInfo::hasCellFaceMapping() const
{ {
@ -30,7 +47,7 @@ bool RivSourceInfo::hasCellFaceMapping() const
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RivSourceInfo::hasNNCIndices() const bool RivSourceInfo::hasNNCIndices() const
{ {

View File

@ -2,40 +2,48 @@
// //
// Copyright (C) Statoil ASA // Copyright (C) Statoil ASA
// Copyright (C) Ceetron Solutions AS // Copyright (C) Ceetron Solutions AS
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // FITNESS FOR A PARTICULAR PURPOSE.
// //
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html> // See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once
#include "RivObjectSourceInfo.h"
#include "cvfArray.h"
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfObject.h" #include "cvfObject.h"
#include "cvfArray.h"
#include "cvfStructGridGeometryGenerator.h" #include "cvfStructGridGeometryGenerator.h"
class RivSourceInfo : public cvf::Object //==================================================================================================
///
///
//==================================================================================================
class RivSourceInfo : public RivObjectSourceInfo
{ {
public: public:
explicit RivSourceInfo(size_t gridIndex) : m_gridIndex(gridIndex) {} explicit RivSourceInfo(caf::PdmObject* pdmObject, size_t gridIndex);
size_t gridIndex() const { return m_gridIndex; } size_t gridIndex() const;
bool hasCellFaceMapping() const; bool hasCellFaceMapping() const;
bool hasNNCIndices() const; bool hasNNCIndices() const;
public: public:
cvf::cref<cvf::StuctGridTriangleToCellFaceMapper> m_cellFaceFromTriangleMapper; cvf::cref<cvf::StuctGridTriangleToCellFaceMapper> m_cellFaceFromTriangleMapper;
cvf::ref<cvf::Array<size_t> > m_NNCIndices; cvf::ref<cvf::Array<size_t>> m_NNCIndices;
private:
private:
size_t m_gridIndex; size_t m_gridIndex;
}; };