mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4999 Fixed well target manipulators not sensitive sometimes
This commit is contained in:
parent
25b97c9cca
commit
6850a37c11
@ -48,6 +48,7 @@ RicPointTangentManipulatorPartMgr::RicPointTangentManipulatorPartMgr()
|
||||
, m_originOnStartManipulation( cvf::Vec3d::UNDEFINED )
|
||||
, m_activeHandle( NONE )
|
||||
, m_handleSize( 1.0 )
|
||||
, m_isGeometryUpdateNeeded( true )
|
||||
{
|
||||
}
|
||||
|
||||
@ -66,7 +67,7 @@ void RicPointTangentManipulatorPartMgr::setOrigin( const cvf::Vec3d& origin )
|
||||
m_origin = origin;
|
||||
if ( m_originOnStartManipulation.isUndefined() ) m_originOnStartManipulation = origin;
|
||||
|
||||
clearAllGeometryAndParts();
|
||||
m_isGeometryUpdateNeeded = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -79,7 +80,7 @@ void RicPointTangentManipulatorPartMgr::setTangent( const cvf::Vec3d& tangent )
|
||||
m_tangent = tangent;
|
||||
if ( m_tangentOnStartManipulation.isUndefined() ) m_tangentOnStartManipulation = m_tangent;
|
||||
|
||||
clearAllGeometryAndParts();
|
||||
m_isGeometryUpdateNeeded = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -88,6 +89,8 @@ void RicPointTangentManipulatorPartMgr::setTangent( const cvf::Vec3d& tangent )
|
||||
void RicPointTangentManipulatorPartMgr::setHandleSize( double handleSize )
|
||||
{
|
||||
m_handleSize = handleSize;
|
||||
|
||||
m_isGeometryUpdateNeeded = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -117,6 +120,11 @@ void RicPointTangentManipulatorPartMgr::appendPartsToModel( cvf::ModelBasicList*
|
||||
recreateAllGeometryAndParts();
|
||||
}
|
||||
|
||||
if ( m_isGeometryUpdateNeeded )
|
||||
{
|
||||
createGeometryOnly();
|
||||
}
|
||||
|
||||
for ( auto& idPartIt : m_handleParts )
|
||||
{
|
||||
model->addPart( idPartIt.second.p() );
|
||||
@ -193,7 +201,7 @@ void RicPointTangentManipulatorPartMgr::updateManipulatorFromRay( const cvf::Ray
|
||||
}
|
||||
// m_tangent = newTangent;
|
||||
|
||||
clearAllGeometryAndParts();
|
||||
m_isGeometryUpdateNeeded = true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -204,32 +212,13 @@ void RicPointTangentManipulatorPartMgr::endManipulator()
|
||||
m_activeHandle = NONE;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::clearAllGeometryAndParts()
|
||||
{
|
||||
m_handleParts.clear();
|
||||
m_activeDragModeParts.clear();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::recreateAllGeometryAndParts()
|
||||
{
|
||||
createAllHandleParts();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::clearGeometryOnly()
|
||||
{
|
||||
for ( auto& idPartIt : m_handleParts )
|
||||
{
|
||||
idPartIt.second->setDrawable( nullptr );
|
||||
}
|
||||
createHorizontalPlaneHandle();
|
||||
createVerticalAxisHandle();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -237,16 +226,8 @@ void RicPointTangentManipulatorPartMgr::clearGeometryOnly()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createGeometryOnly()
|
||||
{
|
||||
// m_handleParts[]
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicPointTangentManipulatorPartMgr::createAllHandleParts()
|
||||
{
|
||||
createHorizontalPlaneHandle();
|
||||
createVerticalAxisHandle();
|
||||
m_handleParts[HORIZONTAL_PLANE]->setDrawable( createHorizontalPlaneGeo().p() );
|
||||
m_handleParts[VERTICAL_AXIS]->setDrawable( createVerticalAxisGeo().p() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -297,7 +278,7 @@ cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createHorizontalPl
|
||||
void RicPointTangentManipulatorPartMgr::createVerticalAxisHandle()
|
||||
{
|
||||
using namespace cvf;
|
||||
cvf::ref<cvf::DrawableGeo> geo = createVertexAxisGeo();
|
||||
cvf::ref<cvf::DrawableGeo> geo = createVerticalAxisGeo();
|
||||
|
||||
HandleType handleId = VERTICAL_AXIS;
|
||||
cvf::Color4f color = cvf::Color4f( 0.0f, 0.2f, 0.8f, 0.5f );
|
||||
@ -309,7 +290,7 @@ void RicPointTangentManipulatorPartMgr::createVerticalAxisHandle()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createVertexAxisGeo()
|
||||
cvf::ref<cvf::DrawableGeo> RicPointTangentManipulatorPartMgr::createVerticalAxisGeo()
|
||||
{
|
||||
using namespace cvf;
|
||||
|
||||
|
@ -72,18 +72,14 @@ public:
|
||||
void appendPartsToModel( cvf::ModelBasicList* model );
|
||||
|
||||
private:
|
||||
void clearGeometryOnly();
|
||||
void createGeometryOnly();
|
||||
|
||||
void createAllHandleParts();
|
||||
void clearAllGeometryAndParts();
|
||||
void recreateAllGeometryAndParts();
|
||||
|
||||
void createHorizontalPlaneHandle();
|
||||
cvf::ref<cvf::DrawableGeo> createHorizontalPlaneGeo();
|
||||
|
||||
void createVerticalAxisHandle();
|
||||
cvf::ref<cvf::DrawableGeo> createVertexAxisGeo();
|
||||
cvf::ref<cvf::DrawableGeo> createVerticalAxisGeo();
|
||||
|
||||
void addHandlePart( cvf::DrawableGeo* geo, const cvf::Color4f& color, HandleType handleId, const cvf::String& partName );
|
||||
|
||||
@ -98,13 +94,16 @@ private:
|
||||
static cvf::ref<cvf::Part> createPart( cvf::DrawableGeo* geo, const cvf::Color4f& color, const cvf::String& partName );
|
||||
|
||||
private:
|
||||
HandleType m_activeHandle;
|
||||
std::map<HandleType, cvf::ref<cvf::Part>> m_handleParts; // These arrays have the same length
|
||||
cvf::Collection<cvf::Part> m_activeDragModeParts;
|
||||
cvf::Vec3d m_origin;
|
||||
cvf::Vec3d m_tangent;
|
||||
double m_handleSize;
|
||||
cvf::Vec3d m_initialPickPoint;
|
||||
cvf::Vec3d m_tangentOnStartManipulation;
|
||||
cvf::Vec3d m_originOnStartManipulation;
|
||||
|
||||
cvf::Vec3d m_origin;
|
||||
cvf::Vec3d m_tangent;
|
||||
double m_handleSize;
|
||||
bool m_isGeometryUpdateNeeded;
|
||||
|
||||
HandleType m_activeHandle;
|
||||
cvf::Vec3d m_initialPickPoint;
|
||||
cvf::Vec3d m_tangentOnStartManipulation;
|
||||
cvf::Vec3d m_originOnStartManipulation;
|
||||
};
|
||||
|
@ -92,13 +92,17 @@ void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
if ( m_manipulator.isNull() )
|
||||
{
|
||||
m_manipulator = new RicPointTangentManipulator( ownerRiuViewer );
|
||||
|
||||
QObject::connect( m_manipulator,
|
||||
SIGNAL( notifyUpdate( const cvf::Vec3d&, const cvf::Vec3d& ) ),
|
||||
this,
|
||||
SLOT( slotUpdated( const cvf::Vec3d&, const cvf::Vec3d& ) ) );
|
||||
|
||||
QObject::connect( m_manipulator, SIGNAL( notifySelected() ), this, SLOT( slotSelectedIn3D() ) );
|
||||
QObject::connect( m_manipulator, SIGNAL( notifyDragFinished() ), this, SLOT( slotDragFinished() ) );
|
||||
|
||||
m_cvfModel = new cvf::ModelBasicList;
|
||||
|
||||
ownerRiuViewer->addStaticModelOnce( m_cvfModel.p() );
|
||||
}
|
||||
|
||||
@ -113,6 +117,7 @@ void RicWellTarget3dEditor::configureAndUpdateUi( const QString& uiConfigName )
|
||||
m_manipulator->setOrigin( dispXf->transformToDisplayCoord( target->targetPointXYZ() + geomDef->referencePointXyz() ) );
|
||||
m_manipulator->setTangent( target->tangent() );
|
||||
m_manipulator->setHandleSize( handleSize );
|
||||
|
||||
m_cvfModel->removeAllParts();
|
||||
m_manipulator->appendPartsToModel( m_cvfModel.p() );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user