mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3343 Holo Lens : Add export of winding, color and cell set type
This commit is contained in:
parent
aa3287f615
commit
7fe4a83589
@ -18,6 +18,9 @@
|
||||
|
||||
#include "RicHoloLensExportImpl.h"
|
||||
|
||||
#include "RigMainGrid.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimGridView.h"
|
||||
#include "RimSimWellInView.h"
|
||||
#include "RimWellPath.h"
|
||||
@ -31,6 +34,8 @@
|
||||
#include "cvfPart.h"
|
||||
#include "cvfScene.h"
|
||||
|
||||
#include "RimFaultInView.h"
|
||||
#include "cafEffectGenerator.h"
|
||||
#include <QString>
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -62,15 +67,18 @@ void RicHoloLensExportImpl::partsForExport(const RimGridView* view, cvf::Collect
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<VdeExportPart> RicHoloLensExportImpl::partsForExport(const RimGridView* view)
|
||||
std::vector<VdeExportPart> RicHoloLensExportImpl::partsForExport(const RimGridView& view)
|
||||
{
|
||||
std::vector<VdeExportPart> exportParts;
|
||||
|
||||
if (view->viewer())
|
||||
RimEclipseCase* rimEclipseCase = nullptr;
|
||||
view.firstAncestorOrThisOfType(rimEclipseCase);
|
||||
|
||||
if (view.viewer())
|
||||
{
|
||||
cvf::Scene* scene = view->viewer()->mainScene();
|
||||
cvf::Scene* scene = view.viewer()->mainScene();
|
||||
if (scene)
|
||||
{
|
||||
cvf::Collection<cvf::Part> sceneParts;
|
||||
@ -80,17 +88,82 @@ std::vector<VdeExportPart> RicHoloLensExportImpl::partsForExport(const RimGridVi
|
||||
{
|
||||
if (RicHoloLensExportImpl::isGrid(scenePart.p()))
|
||||
{
|
||||
VdeExportPart part(scenePart.p());
|
||||
part.setSourceObjectType(VdeExportPart::OBJ_TYPE_GRID);
|
||||
VdeExportPart partForExport(scenePart.p());
|
||||
partForExport.setSourceObjectType(VdeExportPart::OBJ_TYPE_GRID);
|
||||
|
||||
exportParts.push_back(part);
|
||||
if (rimEclipseCase && rimEclipseCase->mainGrid())
|
||||
{
|
||||
if (rimEclipseCase->mainGrid()->isFaceNormalsOutwards())
|
||||
{
|
||||
partForExport.setWinding(VdeExportPart::CLOCKWISE);
|
||||
}
|
||||
else
|
||||
{
|
||||
partForExport.setWinding(VdeExportPart::COUNTERCLOCKWISE);
|
||||
}
|
||||
}
|
||||
|
||||
auto* singleColorEffect = dynamic_cast<caf::SurfaceEffectGenerator*>(scenePart->effect());
|
||||
|
||||
auto* si = dynamic_cast<RivSourceInfo*>(scenePart->sourceInfo());
|
||||
if (si)
|
||||
{
|
||||
RimFaultInView* faultInView = dynamic_cast<RimFaultInView*>(si->object());
|
||||
if (faultInView && singleColorEffect)
|
||||
{
|
||||
partForExport.setSourceObjectName(faultInView->name());
|
||||
partForExport.setColor(faultInView->faultColor());
|
||||
}
|
||||
|
||||
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(si->object());
|
||||
if (eclipseCase)
|
||||
{
|
||||
QString nameOfObject = rimEclipseCase->gridFileName();
|
||||
auto gridSourceInfo = dynamic_cast<const RivSourceInfo*>(scenePart->sourceInfo());
|
||||
if (gridSourceInfo)
|
||||
{
|
||||
size_t gridIndex = gridSourceInfo->gridIndex();
|
||||
|
||||
nameOfObject += " Grid " + QString::number(gridIndex);
|
||||
}
|
||||
|
||||
partForExport.setSourceObjectName(nameOfObject);
|
||||
|
||||
QString text = RicHoloLensExportImpl::gridCellSetTypeText(si->cellSetType());
|
||||
partForExport.setSourceObjectCellSetType(text);
|
||||
}
|
||||
}
|
||||
|
||||
exportParts.push_back(partForExport);
|
||||
}
|
||||
else if (RicHoloLensExportImpl::isPipe(scenePart.p()))
|
||||
{
|
||||
VdeExportPart part(scenePart.p());
|
||||
part.setSourceObjectType(VdeExportPart::OBJ_TYPE_PIPE);
|
||||
VdeExportPart partForExport(scenePart.p());
|
||||
partForExport.setSourceObjectType(VdeExportPart::OBJ_TYPE_PIPE);
|
||||
|
||||
exportParts.push_back(part);
|
||||
auto simWellSourceInfo = dynamic_cast<const RivSimWellPipeSourceInfo*>(scenePart->sourceInfo());
|
||||
if (simWellSourceInfo)
|
||||
{
|
||||
auto simWell = simWellSourceInfo->well();
|
||||
if (simWell)
|
||||
{
|
||||
partForExport.setSourceObjectName(simWell->name());
|
||||
partForExport.setColor(simWell->wellPipeColor());
|
||||
}
|
||||
}
|
||||
|
||||
auto wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(scenePart->sourceInfo());
|
||||
if (wellPathSourceInfo)
|
||||
{
|
||||
RimWellPath* wellPath = wellPathSourceInfo->wellPath();
|
||||
if (wellPath)
|
||||
{
|
||||
partForExport.setSourceObjectName(wellPath->name());
|
||||
partForExport.setColor(wellPath->wellPathColor());
|
||||
}
|
||||
}
|
||||
|
||||
exportParts.push_back(partForExport);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -141,6 +214,62 @@ QString RicHoloLensExportImpl::nameFromPart(const cvf::Part* part)
|
||||
return nameOfObject;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicHoloLensExportImpl::gridCellSetTypeText(RivCellSetEnum cellSetType)
|
||||
{
|
||||
switch (cellSetType)
|
||||
{
|
||||
case OVERRIDDEN_CELL_VISIBILITY:
|
||||
return "OVERRIDDEN_CELL_VISIBILITY";
|
||||
break;
|
||||
case ALL_CELLS:
|
||||
return "ALL_CELLS";
|
||||
break;
|
||||
case ACTIVE:
|
||||
return "ACTIVE";
|
||||
break;
|
||||
case ALL_WELL_CELLS:
|
||||
return "ALL_WELL_CELLS";
|
||||
break;
|
||||
case VISIBLE_WELL_CELLS:
|
||||
return "VISIBLE_WELL_CELLS";
|
||||
break;
|
||||
case VISIBLE_WELL_FENCE_CELLS:
|
||||
return "VISIBLE_WELL_FENCE_CELLS";
|
||||
break;
|
||||
case INACTIVE:
|
||||
return "INACTIVE";
|
||||
break;
|
||||
case RANGE_FILTERED:
|
||||
return "RANGE_FILTERED";
|
||||
break;
|
||||
case RANGE_FILTERED_INACTIVE:
|
||||
return "RANGE_FILTERED_INACTIVE";
|
||||
break;
|
||||
case RANGE_FILTERED_WELL_CELLS:
|
||||
return "RANGE_FILTERED_WELL_CELLS";
|
||||
break;
|
||||
case VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER:
|
||||
return "VISIBLE_WELL_CELLS_OUTSIDE_RANGE_FILTER";
|
||||
break;
|
||||
case VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER:
|
||||
return "VISIBLE_WELL_FENCE_CELLS_OUTSIDE_RANGE_FILTER";
|
||||
break;
|
||||
case PROPERTY_FILTERED:
|
||||
return "PROPERTY_FILTERED";
|
||||
break;
|
||||
case PROPERTY_FILTERED_WELL_CELLS:
|
||||
return "PROPERTY_FILTERED_WELL_CELLS";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "INVALID_CELL_SET_TYPE";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -18,9 +18,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RivCellSetEnum.h"
|
||||
|
||||
#include "VdeExportPart.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfCollection.h"
|
||||
#include "VdeExportPart.h"
|
||||
|
||||
class QString;
|
||||
class RimGridView;
|
||||
@ -38,9 +41,10 @@ class RicHoloLensExportImpl
|
||||
public:
|
||||
static void partsForExport(const RimGridView* view, cvf::Collection<cvf::Part>* partCollection);
|
||||
|
||||
static std::vector<VdeExportPart> partsForExport(const RimGridView* view);
|
||||
static std::vector<VdeExportPart> partsForExport(const RimGridView& view);
|
||||
|
||||
static QString nameFromPart(const cvf::Part* part);
|
||||
static QString gridCellSetTypeText(RivCellSetEnum cellSetType);
|
||||
|
||||
static bool isGrid(const cvf::Part* part);
|
||||
static bool isPipe(const cvf::Part* part);
|
||||
|
@ -23,19 +23,23 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
VdeExportPart::VdeExportPart(cvf::Part* part)
|
||||
: m_part(part)
|
||||
, m_sourceObjectName("Unnamed Object")
|
||||
, m_sourceObjectType(OBJ_TYPE_UNKNOWN)
|
||||
, m_color(cvf::Color3f::MAGENTA)
|
||||
, m_winding(COUNTERCLOCKWISE)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void VdeExportPart::setSourceObjectType(SourceObjectType sourceObjectType)
|
||||
{
|
||||
m_sourceObjectType = sourceObjectType;
|
||||
m_sourceObjectType = sourceObjectType;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void VdeExportPart::setSourceObjectName(const QString& sourceObjectName)
|
||||
{
|
||||
@ -43,15 +47,23 @@ void VdeExportPart::setSourceObjectName(const QString& sourceObjectName)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void VdeExportPart::setColor(cvf::Color3ub color)
|
||||
void VdeExportPart::setSourceObjectCellSetType(const QString& sourceObjectCellSetType)
|
||||
{
|
||||
m_sourceObjectCellSetType = sourceObjectCellSetType;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void VdeExportPart::setColor(const cvf::Color3f& color)
|
||||
{
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void VdeExportPart::setWinding(Winding winding)
|
||||
{
|
||||
@ -59,7 +71,7 @@ void VdeExportPart::setWinding(Winding winding)
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString VdeExportPart::sourceObjectName() const
|
||||
{
|
||||
@ -67,7 +79,15 @@ QString VdeExportPart::sourceObjectName() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString VdeExportPart::sourceObjectCellSetType() const
|
||||
{
|
||||
return m_sourceObjectCellSetType;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
VdeExportPart::SourceObjectType VdeExportPart::sourceObjectType() const
|
||||
{
|
||||
@ -75,7 +95,7 @@ VdeExportPart::SourceObjectType VdeExportPart::sourceObjectType() const
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Part* VdeExportPart::part()
|
||||
{
|
||||
@ -83,9 +103,9 @@ cvf::Part* VdeExportPart::part()
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Color3ub VdeExportPart::color() const
|
||||
cvf::Color3f VdeExportPart::color() const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
@ -49,19 +49,23 @@ public:
|
||||
|
||||
void setSourceObjectType(SourceObjectType sourceObjectType);
|
||||
void setSourceObjectName(const QString& sourceObjectName);
|
||||
void setColor(cvf::Color3ub color);
|
||||
void setSourceObjectCellSetType(const QString& sourceObjectCellSetType);
|
||||
void setColor(const cvf::Color3f& color);
|
||||
void setWinding(Winding winding);
|
||||
|
||||
QString sourceObjectName() const;
|
||||
SourceObjectType sourceObjectType() const;
|
||||
cvf::Part* part();
|
||||
cvf::Color3ub color() const;
|
||||
QString sourceObjectName() const;
|
||||
QString sourceObjectCellSetType() const;
|
||||
SourceObjectType sourceObjectType() const;
|
||||
cvf::Color3f color() const;
|
||||
Winding winding() const;
|
||||
|
||||
private:
|
||||
QString m_sourceObjectName;
|
||||
SourceObjectType m_sourceObjectType;
|
||||
cvf::Color3ub m_color;
|
||||
cvf::ref<cvf::Part> m_part;
|
||||
Winding m_winding;
|
||||
|
||||
QString m_sourceObjectName;
|
||||
QString m_sourceObjectCellSetType;
|
||||
SourceObjectType m_sourceObjectType;
|
||||
cvf::Color3f m_color;
|
||||
Winding m_winding;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user