#3343 Holo Lens : Use default surface color from geo mech

This commit is contained in:
Magne Sjaastad 2018-09-21 14:09:32 +02:00
parent ea78f85755
commit 0127e0c1b5
6 changed files with 55 additions and 32 deletions

View File

@ -32,6 +32,7 @@
#include "RiuViewer.h" #include "RiuViewer.h"
#include "RivFemPickSourceInfo.h" #include "RivFemPickSourceInfo.h"
#include "RivGeoMechVizLogic.h"
#include "RivIntersectionBoxSourceInfo.h" #include "RivIntersectionBoxSourceInfo.h"
#include "RivIntersectionSourceInfo.h" #include "RivIntersectionSourceInfo.h"
#include "RivMeshLinesSourceInfo.h" #include "RivMeshLinesSourceInfo.h"
@ -83,40 +84,50 @@ std::vector<VdeExportPart> RicHoloLensExportImpl::partsForExport(const RimGridVi
} }
} }
auto* si = dynamic_cast<RivSourceInfo*>(visiblePart->sourceInfo());
if (si)
{ {
RimFaultInView* faultInView = dynamic_cast<RimFaultInView*>(si->object()); auto* sourceInfo = dynamic_cast<RivSourceInfo*>(visiblePart->sourceInfo());
if (faultInView) if (sourceInfo)
{ {
exportPart.setSourceObjectName(faultInView->name()); RimFaultInView* faultInView = dynamic_cast<RimFaultInView*>(sourceInfo->object());
exportPart.setColor(faultInView->faultColor()); if (faultInView)
{
exportPart.setSourceObjectName(faultInView->name());
exportPart.setColor(faultInView->faultColor());
}
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(sourceInfo->object());
if (eclipseCase)
{
QString nameOfObject = rimEclipseCase->gridFileName();
auto gridSourceInfo = dynamic_cast<const RivSourceInfo*>(visiblePart->sourceInfo());
if (gridSourceInfo)
{
size_t gridIndex = gridSourceInfo->gridIndex();
nameOfObject += " Grid " + QString::number(gridIndex);
}
const RimEclipseView* eclipseView = dynamic_cast<const RimEclipseView*>(&view);
if (eclipseView)
{
cvf::Color4f color = eclipseView->colorFromCellCategory(sourceInfo->cellSetType());
exportPart.setColor(color.toColor3f());
exportPart.setOpacity(color.a());
QString text = RicHoloLensExportImpl::gridCellSetTypeText(sourceInfo->cellSetType());
exportPart.setSourceObjectCellSetType(text);
}
exportPart.setSourceObjectName(nameOfObject);
}
} }
}
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(si->object()); {
if (eclipseCase) auto femPartPickInfo = dynamic_cast<RivFemPickSourceInfo*>(visiblePart->sourceInfo());
if (femPartPickInfo)
{ {
QString nameOfObject = rimEclipseCase->gridFileName(); exportPart.setColor(RivGeoMechVizLogic::staticCellColor());
auto gridSourceInfo = dynamic_cast<const RivSourceInfo*>(visiblePart->sourceInfo());
if (gridSourceInfo)
{
size_t gridIndex = gridSourceInfo->gridIndex();
nameOfObject += " Grid " + QString::number(gridIndex);
}
const RimEclipseView* eclipseView = dynamic_cast<const RimEclipseView*>(&view);
if (eclipseView)
{
cvf::Color4f color = eclipseView->colorFromCellCategory(si->cellSetType());
exportPart.setColor(color.toColor3f());
exportPart.setOpacity(color.a());
QString text = RicHoloLensExportImpl::gridCellSetTypeText(si->cellSetType());
exportPart.setSourceObjectCellSetType(text);
}
exportPart.setSourceObjectName(nameOfObject);
} }
} }

View File

@ -19,6 +19,7 @@
#pragma once #pragma once
#include "cvfBase.h"
#include "cvfArray.h" #include "cvfArray.h"
#include "cvfCollection.h" #include "cvfCollection.h"

View File

@ -20,6 +20,7 @@
#pragma once #pragma once
#include "RivCellSetEnum.h" #include "RivCellSetEnum.h"
#include "RivGeoMechPartMgr.h"
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfObject.h" #include "cvfObject.h"
@ -27,7 +28,6 @@
#include <cstddef> #include <cstddef>
#include <map> #include <map>
class RivGeoMechPartMgr;
class RivGeoMechPartMgrGeneratorInterface; class RivGeoMechPartMgrGeneratorInterface;
class RivGeoMechPartMgrCache : public cvf::Object class RivGeoMechPartMgrCache : public cvf::Object

View File

@ -105,7 +105,8 @@ void RivGeoMechVizLogic::updateStaticCellColors(int timeStepIndex)
for (size_t pmIdx = 0; pmIdx < visiblePartMgrs.size(); ++pmIdx) for (size_t pmIdx = 0; pmIdx < visiblePartMgrs.size(); ++pmIdx)
{ {
RivGeoMechPartMgr* partMgr = m_partMgrCache->partMgr(visiblePartMgrs[pmIdx]); RivGeoMechPartMgr* partMgr = m_partMgrCache->partMgr(visiblePartMgrs[pmIdx]);
partMgr->updateCellColor(cvf::Color4f(cvf::Color3f::ORANGE)); auto color = staticCellColor();
partMgr->updateCellColor(cvf::Color4f(color));
} }
} }
@ -173,6 +174,14 @@ const cvf::ref<RivGeoMechPartMgrCache> RivGeoMechVizLogic::partMgrCache() const
return m_partMgrCache; return m_partMgrCache;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Color3f RivGeoMechVizLogic::staticCellColor()
{
return cvf::Color3f::ORANGE;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -51,6 +51,8 @@ public:
void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStepIndex); void calculateCurrentTotalCellVisibility(cvf::UByteArray* totalVisibility, int timeStepIndex);
std::vector<RivGeoMechPartMgrCache::Key> keysToVisiblePartMgrs(int timeStepIndex) const; std::vector<RivGeoMechPartMgrCache::Key> keysToVisiblePartMgrs(int timeStepIndex) const;
const cvf::ref<RivGeoMechPartMgrCache> partMgrCache() const; const cvf::ref<RivGeoMechPartMgrCache> partMgrCache() const;
static cvf::Color3f staticCellColor();
private: private:
RivGeoMechPartMgr* getUpdatedPartMgr(RivGeoMechPartMgrCache::Key partMgrKey); RivGeoMechPartMgr* getUpdatedPartMgr(RivGeoMechPartMgrCache::Key partMgrKey);

View File

@ -19,8 +19,8 @@
#pragma once #pragma once
#include "cvfArray.h"
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfArray.h"
#include "cvfColor4.h" #include "cvfColor4.h"
#include "cvfMatrix4.h" #include "cvfMatrix4.h"
#include "cvfObject.h" #include "cvfObject.h"