mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3876 Implement rotated labels on contour maps
This commit is contained in:
@@ -49,6 +49,7 @@ const cvf::Mat4d defaultViewMatrix(1, 0, 0, 0,
|
||||
0, 0, 0, 1);
|
||||
|
||||
RimContourMapView::RimContourMapView()
|
||||
: m_cameraPositionLastUpdate(cvf::Vec3d::UNDEFINED)
|
||||
{
|
||||
CAF_PDM_InitObject("Contour Map View", ":/2DMap16x16.png", "", "");
|
||||
|
||||
@@ -224,7 +225,9 @@ void RimContourMapView::updateGeometry()
|
||||
|
||||
appendWellsAndFracturesToModel();
|
||||
|
||||
createContourMapGeometry();
|
||||
appendContourMapProjectionToModel();
|
||||
appendContourLinesToModel();
|
||||
|
||||
appendPickPointVisToModel();
|
||||
|
||||
@@ -243,6 +246,17 @@ void RimContourMapView::setFaultVisParameters()
|
||||
faultResultSettings()->customFaultResult()->setResultVariable("None");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimContourMapView::createContourMapGeometry()
|
||||
{
|
||||
if (m_viewer && m_contourMapProjection->isChecked())
|
||||
{
|
||||
m_contourMapProjectionPartMgr->createProjectionGeometry();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -268,6 +282,31 @@ void RimContourMapView::appendContourMapProjectionToModel()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimContourMapView::appendContourLinesToModel()
|
||||
{
|
||||
if (m_viewer && m_contourMapProjection->isChecked())
|
||||
{
|
||||
cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep);
|
||||
if (frameScene)
|
||||
{
|
||||
cvf::String name = "ContourMapLines";
|
||||
this->removeModelByName(frameScene, name);
|
||||
|
||||
cvf::ref<cvf::ModelBasicList> contourMapLabelModelBasicList = new cvf::ModelBasicList;
|
||||
contourMapLabelModelBasicList->setName(name);
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> transForm = this->displayCoordTransform();
|
||||
|
||||
m_contourMapProjectionPartMgr->appendContourLinesToModel(viewer()->mainCamera(), contourMapLabelModelBasicList.p(), transForm.p());
|
||||
contourMapLabelModelBasicList->updateBoundingBoxesRecursive();
|
||||
frameScene->addModel(contourMapLabelModelBasicList.p());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -414,3 +453,26 @@ QWidget* RimContourMapView::createViewWidget(QWidget* mainWindowParent)
|
||||
}
|
||||
return widget;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimContourMapView::onViewNavigationChanged()
|
||||
{
|
||||
cvf::Vec3d currentCameraPosition = viewer()->mainCamera()->position();
|
||||
if (m_cameraPositionLastUpdate.isUndefined() || zoomChangeAboveTreshold(currentCameraPosition))
|
||||
{
|
||||
appendContourLinesToModel();
|
||||
m_cameraPositionLastUpdate = currentCameraPosition;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimContourMapView::zoomChangeAboveTreshold(const cvf::Vec3d& currentCameraPosition) const
|
||||
{
|
||||
double distance = std::max(std::fabs(m_cameraPositionLastUpdate.z()), std::fabs(currentCameraPosition.z()));
|
||||
const double threshold = 0.01 * distance;
|
||||
return (m_cameraPositionLastUpdate - currentCameraPosition).length() > threshold;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user