mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3948 HoloLens labels : Add text label source info
This commit is contained in:
parent
6695cf2a39
commit
5222950476
@ -55,6 +55,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationSourceInfo.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylinesAnnotationSourceInfo.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineGenerator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivMeasurementPartMgr.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivTextLabelSourceInfo.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -108,6 +109,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RivReachCircleAnnotationSourceInfo.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylinesAnnotationSourceInfo.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivPolylineGenerator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivMeasurementPartMgr.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RivTextLabelSourceInfo.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "RimTernaryLegendConfig.h"
|
||||
|
||||
#include "RivFaultGeometryGenerator.h"
|
||||
#include "RivMeshLinesSourceInfo.h"
|
||||
#include "RivNNCGeometryGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivResultToTextureMapper.h"
|
||||
@ -42,9 +43,9 @@
|
||||
#include "RivSourceInfo.h"
|
||||
#include "RivTernaryScalarMapper.h"
|
||||
#include "RivTernaryTextureCoordsCreator.h"
|
||||
#include "RivTextLabelSourceInfo.h"
|
||||
#include "RivTextureCoordsCreator.h"
|
||||
|
||||
#include "RivMeshLinesSourceInfo.h"
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfDrawableText.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
@ -520,6 +521,8 @@ void RivFaultPartMgr::createLabelWithAnchorLine(const cvf::Part* part)
|
||||
labelPart->setEffect(eff.p());
|
||||
labelPart->setPriority(RivPartPriority::PartType::Text);
|
||||
|
||||
labelPart->setSourceInfo(new RivTextLabelSourceInfo(m_rimFault, cvfString, textCoord));
|
||||
|
||||
m_faultLabelPart = labelPart;
|
||||
}
|
||||
|
||||
|
@ -3,23 +3,21 @@
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#include "RivMeasurementPartMgr.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
@ -30,44 +28,43 @@
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimMeasurement.h"
|
||||
#include "RimUserDefinedPolylinesAnnotationInView.h"
|
||||
#include "RimPolylinesFromFileAnnotationInView.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimUserDefinedPolylinesAnnotationInView.h"
|
||||
|
||||
#include "RivTextAnnotationPartMgr.h"
|
||||
#include "RivReachCircleAnnotationPartMgr.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivPolylineAnnotationPartMgr.h"
|
||||
#include "RivPolylineGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivReachCircleAnnotationPartMgr.h"
|
||||
#include "RivTextAnnotationPartMgr.h"
|
||||
#include "RivTextLabelSourceInfo.h"
|
||||
|
||||
#include <cvfModelBasicList.h>
|
||||
#include <cvfPart.h>
|
||||
#include <cvfDrawableGeo.h>
|
||||
#include <cvfDrawableText.h>
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfDrawableText.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfRenderStateDepth.h"
|
||||
#include "cvfRenderStatePoint.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafEffectGenerator.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivMeasurementPartMgr::RivMeasurementPartMgr(Rim3dView* view)
|
||||
: m_rimView(view), m_measurement(nullptr)
|
||||
: m_rimView(view)
|
||||
, m_measurement(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivMeasurementPartMgr::~RivMeasurementPartMgr()
|
||||
{
|
||||
|
||||
}
|
||||
RivMeasurementPartMgr::~RivMeasurementPartMgr() {}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -106,11 +103,11 @@ void RivMeasurementPartMgr::appendGeometryPartsToModel(cvf::ModelBasicList*
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RivMeasurementPartMgr::clearGeometryCache()
|
||||
{
|
||||
m_linePart = nullptr;
|
||||
m_linePart = nullptr;
|
||||
m_pointPart = nullptr;
|
||||
m_labelPart = nullptr;
|
||||
}
|
||||
@ -177,15 +174,15 @@ void RivMeasurementPartMgr::buildPolyLineParts(const caf::DisplayCoordTransform*
|
||||
}
|
||||
|
||||
// Text label
|
||||
if(pointsInDisplay.size() > 1)
|
||||
if (pointsInDisplay.size() > 1)
|
||||
{
|
||||
auto fontSize = RiaFontCache::FONT_SIZE_8;
|
||||
auto backgroundColor = RiaApplication::instance()->preferences()->defaultViewerBackgroundColor;
|
||||
auto fontColor = cvf::Color3f::BLACK;
|
||||
QString text = m_measurement->label();
|
||||
auto labelPosition = pointsInDisplay.back();
|
||||
auto fontSize = RiaFontCache::FONT_SIZE_8;
|
||||
auto backgroundColor = RiaApplication::instance()->preferences()->defaultViewerBackgroundColor;
|
||||
auto fontColor = cvf::Color3f::BLACK;
|
||||
QString text = m_measurement->label();
|
||||
auto labelPosition = pointsInDisplay.back();
|
||||
|
||||
auto font = RiaFontCache::getFont(fontSize);
|
||||
auto font = RiaFontCache::getFont(fontSize);
|
||||
cvf::ref<cvf::DrawableText> drawableText = new cvf::DrawableText;
|
||||
drawableText->setFont(font.p());
|
||||
drawableText->setCheckPosVisible(false);
|
||||
@ -209,6 +206,8 @@ void RivMeasurementPartMgr::buildPolyLineParts(const caf::DisplayCoordTransform*
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::Text);
|
||||
|
||||
part->setSourceInfo(new RivTextLabelSourceInfo(m_measurement, cvfString, textCoord));
|
||||
|
||||
m_labelPart = part;
|
||||
}
|
||||
}
|
||||
|
@ -34,18 +34,20 @@
|
||||
#include "RimTextAnnotation.h"
|
||||
#include "RimTextAnnotationInView.h"
|
||||
|
||||
#include "RivPolylineGenerator.h"
|
||||
#include "RivObjectSourceInfo.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivPolylineGenerator.h"
|
||||
#include "RivTextAnnotationSourceInfo.h"
|
||||
#include "RivTextLabelSourceInfo.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
|
||||
#include "cvfDrawableGeo.h"
|
||||
#include "cvfDrawableText.h"
|
||||
#include "cvfModelBasicList.h"
|
||||
#include "cvfPart.h"
|
||||
#include "cvfqtUtils.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -83,8 +85,6 @@ void RivTextAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform * dis
|
||||
{
|
||||
clearAllGeometry();
|
||||
|
||||
cvf::ref<RivTextAnnotationSourceInfo> sourceInfo = new RivTextAnnotationSourceInfo(rimAnnotation());
|
||||
|
||||
auto collection = annotationCollection();
|
||||
if (!collection) return;
|
||||
|
||||
@ -114,7 +114,7 @@ void RivTextAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform * dis
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
part->setSourceInfo(new RivObjectSourceInfo(rimAnnotation()));
|
||||
|
||||
m_linePart = part;
|
||||
}
|
||||
@ -145,7 +145,8 @@ void RivTextAnnotationPartMgr::buildParts(const caf::DisplayCoordTransform * dis
|
||||
cvf::ref<cvf::Effect> eff = new cvf::Effect();
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::MeshLines);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
part->setSourceInfo(new RivTextLabelSourceInfo(rimAnnotation(), cvfString, textCoord));
|
||||
|
||||
m_labelPart = part;
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RivTextLabelSourceInfo.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RivTextLabelSourceInfo::RivTextLabelSourceInfo(caf::PdmObject* pdmObject, const cvf::String& text, const cvf::Vec3f& position)
|
||||
: RivObjectSourceInfo(pdmObject)
|
||||
, m_text(text)
|
||||
, m_position(position)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::String RivTextLabelSourceInfo::text() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3f RivTextLabelSourceInfo::textPosition() const
|
||||
{
|
||||
return m_position;
|
||||
}
|
44
ApplicationCode/ModelVisualization/RivTextLabelSourceInfo.h
Normal file
44
ApplicationCode/ModelVisualization/RivTextLabelSourceInfo.h
Normal file
@ -0,0 +1,44 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// 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 <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RivObjectSourceInfo.h"
|
||||
|
||||
#include "cvfArray.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfString.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RivTextLabelSourceInfo : public RivObjectSourceInfo
|
||||
{
|
||||
public:
|
||||
explicit RivTextLabelSourceInfo(caf::PdmObject* pdmObject, const cvf::String& text, const cvf::Vec3f& position);
|
||||
|
||||
cvf::String text() const;
|
||||
cvf::Vec3f textPosition() const;
|
||||
|
||||
private:
|
||||
cvf::String m_text;
|
||||
cvf::Vec3f m_position;
|
||||
};
|
@ -35,11 +35,14 @@
|
||||
#include "RimSimWellInViewCollection.h"
|
||||
#include "RimSimWellInView.h"
|
||||
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include "RivPartPriority.h"
|
||||
#include "RivPipeGeometryGenerator.h"
|
||||
#include "RivSectionFlattner.h"
|
||||
#include "RivSimWellPipeSourceInfo.h"
|
||||
#include "RivTextLabelSourceInfo.h"
|
||||
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
|
||||
#include "cvfArrowGenerator.h"
|
||||
#include "cvfDrawableGeo.h"
|
||||
@ -49,8 +52,6 @@
|
||||
#include "cvfPart.h"
|
||||
#include "cvfTransform.h"
|
||||
#include "cvfqtUtils.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "RivSectionFlattner.h"
|
||||
|
||||
|
||||
|
||||
@ -319,7 +320,8 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex,
|
||||
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::PartType::Text);
|
||||
part->setSourceInfo(sourceInfo.p());
|
||||
|
||||
part->setSourceInfo(new RivTextLabelSourceInfo(m_rimWell, cvfString, textCoord));
|
||||
|
||||
m_wellHeadLabelPart = part;
|
||||
}
|
||||
|
@ -56,6 +56,7 @@
|
||||
#include "RivWellFracturePartMgr.h"
|
||||
#include "RivWellPathPartMgr.h"
|
||||
#include "RivWellPathSourceInfo.h"
|
||||
#include "RivTextLabelSourceInfo.h"
|
||||
|
||||
#include "RiuViewer.h"
|
||||
|
||||
@ -635,6 +636,8 @@ void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* di
|
||||
part->setEffect(eff.p());
|
||||
part->setPriority(RivPartPriority::Text);
|
||||
|
||||
part->setSourceInfo(new RivTextLabelSourceInfo(m_rimWellPath, cvfString, textCoord));
|
||||
|
||||
m_wellLabelPart = part;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user