mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3948 HoloLens : Add labels
This commit is contained in:
parent
469437f320
commit
a32ebe4dff
@ -38,15 +38,16 @@
|
|||||||
#include "RivMeshLinesSourceInfo.h"
|
#include "RivMeshLinesSourceInfo.h"
|
||||||
#include "RivSimWellPipeSourceInfo.h"
|
#include "RivSimWellPipeSourceInfo.h"
|
||||||
#include "RivSourceInfo.h"
|
#include "RivSourceInfo.h"
|
||||||
|
#include "RivTextLabelSourceInfo.h"
|
||||||
#include "RivWellPathSourceInfo.h"
|
#include "RivWellPathSourceInfo.h"
|
||||||
|
|
||||||
#include "cafEffectGenerator.h"
|
#include "cafEffectGenerator.h"
|
||||||
|
|
||||||
#include "cvfPart.h"
|
#include "cvfPart.h"
|
||||||
#include "cvfRenderState.h"
|
#include "cvfRenderState.h"
|
||||||
#include "cvfRenderState_FF.h"
|
|
||||||
#include "cvfRenderStateCullFace.h"
|
#include "cvfRenderStateCullFace.h"
|
||||||
#include "cvfRenderStateTextureBindings.h"
|
#include "cvfRenderStateTextureBindings.h"
|
||||||
|
#include "cvfRenderState_FF.h"
|
||||||
#include "cvfTexture.h"
|
#include "cvfTexture.h"
|
||||||
#include "cvfTexture2D_FF.h"
|
#include "cvfTexture2D_FF.h"
|
||||||
|
|
||||||
@ -213,6 +214,27 @@ std::vector<VdeExportPart> RicHoloLensExportImpl::partsForExport(const RimGridVi
|
|||||||
return exportParts;
|
return exportParts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
///
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
std::vector<std::pair<cvf::Vec3f, cvf::String>> RicHoloLensExportImpl::labelsForExport(const RimGridView& view)
|
||||||
|
{
|
||||||
|
std::vector<std::pair<cvf::Vec3f, cvf::String>> labelAndPositions;
|
||||||
|
|
||||||
|
auto visibleParts = view.viewer()->visibleParts();
|
||||||
|
|
||||||
|
for (auto& visiblePart : visibleParts)
|
||||||
|
{
|
||||||
|
const RivTextLabelSourceInfo* textLabel = dynamic_cast<const RivTextLabelSourceInfo*>(visiblePart->sourceInfo());
|
||||||
|
if (textLabel)
|
||||||
|
{
|
||||||
|
labelAndPositions.push_back(std::make_pair(textLabel->textPositionDisplayCoord(), textLabel->text()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return labelAndPositions;
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
@ -40,6 +40,7 @@ class RicHoloLensExportImpl
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::vector<VdeExportPart> partsForExport(const RimGridView& view);
|
static std::vector<VdeExportPart> partsForExport(const RimGridView& view);
|
||||||
|
static std::vector<std::pair<cvf::Vec3f, cvf::String>> labelsForExport(const RimGridView& view);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void appendTextureImage(VdeExportPart& exportPart, cvf::Part* part);
|
static void appendTextureImage(VdeExportPart& exportPart, cvf::Part* part);
|
||||||
|
@ -63,6 +63,9 @@ void VdeVizDataExtractor::extractViewContents(QString* modelMetaJsonStr, std::ve
|
|||||||
// First extract the parts (cvfPart + info) to be exported from from the ResInsight view
|
// First extract the parts (cvfPart + info) to be exported from from the ResInsight view
|
||||||
const std::vector<VdeExportPart> exportPartsArr = RicHoloLensExportImpl::partsForExport(m_view);
|
const std::vector<VdeExportPart> exportPartsArr = RicHoloLensExportImpl::partsForExport(m_view);
|
||||||
|
|
||||||
|
// TODO: Convert this into JSON data
|
||||||
|
const std::vector<std::pair<cvf::Vec3f, cvf::String>> labelAndPositions = RicHoloLensExportImpl::labelsForExport(m_view);
|
||||||
|
|
||||||
// Convert this to an array of export ready meshes
|
// Convert this to an array of export ready meshes
|
||||||
const std::vector<std::unique_ptr<VdeMesh> > meshArr = buildMeshArray(exportPartsArr);
|
const std::vector<std::unique_ptr<VdeMesh> > meshArr = buildMeshArray(exportPartsArr);
|
||||||
const int buildMeshes_ms = static_cast<int>(tim.lapTime()*1000);
|
const int buildMeshes_ms = static_cast<int>(tim.lapTime()*1000);
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
RivTextLabelSourceInfo::RivTextLabelSourceInfo(caf::PdmObject* pdmObject, const cvf::String& text, const cvf::Vec3f& position)
|
RivTextLabelSourceInfo::RivTextLabelSourceInfo(caf::PdmObject* pdmObject, const cvf::String& text, const cvf::Vec3f& position)
|
||||||
: RivObjectSourceInfo(pdmObject)
|
: RivObjectSourceInfo(pdmObject)
|
||||||
, m_text(text)
|
, m_text(text)
|
||||||
, m_position(position)
|
, m_positionDisplayCoord(position)
|
||||||
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -40,7 +40,7 @@ cvf::String RivTextLabelSourceInfo::text() const
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
cvf::Vec3f RivTextLabelSourceInfo::textPosition() const
|
cvf::Vec3f RivTextLabelSourceInfo::textPositionDisplayCoord() const
|
||||||
{
|
{
|
||||||
return m_position;
|
return m_positionDisplayCoord;
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,12 @@
|
|||||||
class RivTextLabelSourceInfo : public RivObjectSourceInfo
|
class RivTextLabelSourceInfo : public RivObjectSourceInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit RivTextLabelSourceInfo(caf::PdmObject* pdmObject, const cvf::String& text, const cvf::Vec3f& position);
|
explicit RivTextLabelSourceInfo(caf::PdmObject* pdmObject, const cvf::String& text, const cvf::Vec3f& positionDisplayCoord);
|
||||||
|
|
||||||
cvf::String text() const;
|
cvf::String text() const;
|
||||||
cvf::Vec3f textPosition() const;
|
cvf::Vec3f textPositionDisplayCoord() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
cvf::String m_text;
|
cvf::String m_text;
|
||||||
cvf::Vec3f m_position;
|
cvf::Vec3f m_positionDisplayCoord;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user