Renames in RicPickEventHandler hierarchy

This commit is contained in:
Gaute Lindkvist 2019-02-06 09:45:30 +01:00
parent 4ec8869743
commit dbe21b7809
20 changed files with 75 additions and 54 deletions

View File

@ -48,6 +48,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicExportFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicSelectOrCreateViewFeatureImpl.h ${CMAKE_CURRENT_LIST_DIR}/RicSelectOrCreateViewFeatureImpl.h
${CMAKE_CURRENT_LIST_DIR}/RicPickEventHandler.h ${CMAKE_CURRENT_LIST_DIR}/RicPickEventHandler.h
${CMAKE_CURRENT_LIST_DIR}/Ric3dViewPickEventHandler.h
${CMAKE_CURRENT_LIST_DIR}/RicContourMapPickEventHandler.h ${CMAKE_CURRENT_LIST_DIR}/RicContourMapPickEventHandler.h
${CMAKE_CURRENT_LIST_DIR}/RicVec3dPickEventHandler.h ${CMAKE_CURRENT_LIST_DIR}/RicVec3dPickEventHandler.h
@ -126,7 +127,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RicExportFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicSelectOrCreateViewFeatureImpl.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSelectOrCreateViewFeatureImpl.cpp
${CMAKE_CURRENT_LIST_DIR}/RicPickEventHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/Ric3dViewPickEventHandler.cpp
${CMAKE_CURRENT_LIST_DIR}/RicContourMapPickEventHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/RicContourMapPickEventHandler.cpp
${CMAKE_CURRENT_LIST_DIR}/RicVec3dPickEventHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/RicVec3dPickEventHandler.cpp

View File

@ -18,9 +18,8 @@
#pragma once #pragma once
#include "RicPickEventHandler.h"
#include "cafCmdExecuteCommand.h" #include "cafCmdExecuteCommand.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
class RimIntersectionCollection; class RimIntersectionCollection;

View File

@ -19,9 +19,8 @@
#pragma once #pragma once
#include "RicPickEventHandler.h"
#include "cafCmdExecuteCommand.h" #include "cafCmdExecuteCommand.h"
#include "cafCmdFeature.h"
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
class RimIntersectionCollection; class RimIntersectionCollection;

View File

@ -18,12 +18,12 @@
#pragma once #pragma once
#include "RicPickEventHandler.h" #include "Ric3dViewPickEventHandler.h"
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class RicMeasurementPickEventHandler : public RicPickEventHandler class RicMeasurementPickEventHandler : public Ric3dViewPickEventHandler
{ {
public: public:
static RicMeasurementPickEventHandler* instance(); static RicMeasurementPickEventHandler* instance();

View File

@ -15,7 +15,7 @@
// for more details. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "RicPickEventHandler.h" #include "Ric3dViewPickEventHandler.h"
#include "RiuViewerCommands.h" #include "RiuViewerCommands.h"
#include <typeinfo> #include <typeinfo>
@ -23,7 +23,7 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicPickEventHandler::registerAsPickEventHandler() void Ric3dViewPickEventHandler::registerAsPickEventHandler()
{ {
RiuViewerCommands::setPickEventHandler(this); RiuViewerCommands::setPickEventHandler(this);
} }
@ -31,7 +31,7 @@ void RicPickEventHandler::registerAsPickEventHandler()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicPickEventHandler::unregisterAsPickEventHandler() void Ric3dViewPickEventHandler::unregisterAsPickEventHandler()
{ {
RiuViewerCommands::removePickEventHandlerIfActive(this); RiuViewerCommands::removePickEventHandlerIfActive(this);
} }
@ -39,15 +39,12 @@ void RicPickEventHandler::unregisterAsPickEventHandler()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// Override from caf::PickEventHandler. Translates to a 3d Pick event. /// Override from caf::PickEventHandler. Translates to a 3d Pick event.
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicPickEventHandler::handlePickEvent(const caf::PickEvent& eventObject) bool Ric3dViewPickEventHandler::handlePickEvent(const caf::PickEvent& eventObject)
{ {
try const Ric3dPickEvent* eventObject3d = dynamic_cast<const Ric3dPickEvent*>(&eventObject);
if (eventObject3d != nullptr)
{ {
const Ric3dPickEvent& eventObject3d = dynamic_cast<const Ric3dPickEvent&>(eventObject); return handle3dPickEvent(*eventObject3d);
return handle3dPickEvent(eventObject3d);
} }
catch (const std::bad_cast&)
{
return false; return false;
}
} }

View File

@ -0,0 +1,38 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicPickEventHandler.h"
#include "cafPdmField.h"
//==================================================================================================
/// A temporary, dynamic pick handler that overrides the default ones
//==================================================================================================
class Ric3dViewPickEventHandler : public caf::PickEventHandler
{
public:
// Override from caf
void registerAsPickEventHandler() override;
void unregisterAsPickEventHandler() override;
bool handlePickEvent(const caf::PickEvent& eventObject) override;
virtual bool handle3dPickEvent(const Ric3dPickEvent& eventObject) = 0;
};

View File

@ -43,7 +43,7 @@ RicContourMapPickEventHandler* RicContourMapPickEventHandler::instance()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicContourMapPickEventHandler::handlePickEvent(const Ric3dPickEvent& eventObject) bool RicContourMapPickEventHandler::handle3dPickEvent(const Ric3dPickEvent& eventObject)
{ {
if (eventObject.m_pickItemInfos.empty()) return false; if (eventObject.m_pickItemInfos.empty()) return false;

View File

@ -29,6 +29,6 @@ public:
static RicContourMapPickEventHandler* instance(); static RicContourMapPickEventHandler* instance();
protected: protected:
bool handlePickEvent(const Ric3dPickEvent& eventObject) override; bool handle3dPickEvent(const Ric3dPickEvent& eventObject) override;
}; };

View File

@ -1,6 +1,7 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Statoil ASA
// Copyright (C) 2019- Equinor ASA
// Copyright (C) 2015- Ceetron Solutions AS // Copyright (C) 2015- Ceetron Solutions AS
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
@ -23,7 +24,6 @@
#include "cafCmdFeature.h" #include "cafCmdFeature.h"
#include "cafPickEventHandler.h" #include "cafPickEventHandler.h"
#include "cafPdmField.h"
#include "cvfBase.h" #include "cvfBase.h"
#include "cvfObject.h" #include "cvfObject.h"
@ -59,19 +59,6 @@ public:
class RicDefaultPickEventHandler class RicDefaultPickEventHandler
{ {
public: public:
virtual bool handlePickEvent(const Ric3dPickEvent& eventObject) = 0;
};
//==================================================================================================
/// A temporary, dynamic pick handler that overrides the default ones
//==================================================================================================
class RicPickEventHandler : public caf::PickEventHandler
{
public:
// Override from caf
void registerAsPickEventHandler() override;
void unregisterAsPickEventHandler() override;
bool handlePickEvent(const caf::PickEvent& eventObject) override;
virtual bool handle3dPickEvent(const Ric3dPickEvent& eventObject) = 0; virtual bool handle3dPickEvent(const Ric3dPickEvent& eventObject) = 0;
}; };

View File

@ -17,7 +17,7 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once
#include "RicPickEventHandler.h" #include "Ric3dViewPickEventHandler.h"
#include "cafPdmUiCoreVec3d.h" #include "cafPdmUiCoreVec3d.h"
@ -26,7 +26,7 @@ class Rim3dView;
//================================================================================================== //==================================================================================================
/// A 3d view pick handler for Vec3d fields /// A 3d view pick handler for Vec3d fields
//================================================================================================== //==================================================================================================
class RicVec3dPickEventHandler : public RicPickEventHandler class RicVec3dPickEventHandler : public Ric3dViewPickEventHandler
{ {
public: public:
RicVec3dPickEventHandler(caf::PdmField<cvf::Vec3d>* vectorField); RicVec3dPickEventHandler(caf::PdmField<cvf::Vec3d>* vectorField);

View File

@ -39,7 +39,7 @@ Ric3dWellLogCurvePickEventHandler* Ric3dWellLogCurvePickEventHandler::instance()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool Ric3dWellLogCurvePickEventHandler::handlePickEvent(const Ric3dPickEvent& eventObject) bool Ric3dWellLogCurvePickEventHandler::handle3dPickEvent(const Ric3dPickEvent& eventObject)
{ {
if (eventObject.m_pickItemInfos.empty()) return false; if (eventObject.m_pickItemInfos.empty()) return false;

View File

@ -29,5 +29,5 @@ class Ric3dWellLogCurvePickEventHandler : public RicDefaultPickEventHandler
public: public:
static Ric3dWellLogCurvePickEventHandler* instance(); static Ric3dWellLogCurvePickEventHandler* instance();
bool handlePickEvent(const Ric3dPickEvent& eventObject) override; bool handle3dPickEvent(const Ric3dPickEvent& eventObject) override;
}; };

View File

@ -18,7 +18,7 @@
#pragma once #pragma once
#include "RicPickEventHandler.h" #include "Ric3dViewPickEventHandler.h"
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
@ -28,7 +28,7 @@ class RigWellPath;
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class RicCreateWellTargetsPickEventHandler : public RicPickEventHandler class RicCreateWellTargetsPickEventHandler : public Ric3dViewPickEventHandler
{ {
public: public:
RicCreateWellTargetsPickEventHandler(RimWellPathGeometryDef* wellGeometryDef); RicCreateWellTargetsPickEventHandler(RimWellPathGeometryDef* wellGeometryDef);

View File

@ -39,7 +39,7 @@ RicIntersectionPickEventHandler* RicIntersectionPickEventHandler::instance()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicIntersectionPickEventHandler::handlePickEvent(const Ric3dPickEvent& eventObject) bool RicIntersectionPickEventHandler::handle3dPickEvent(const Ric3dPickEvent& eventObject)
{ {
std::vector<RimIntersection*> selection; std::vector<RimIntersection*> selection;
caf::SelectionManager::instance()->objectsByType(&selection); caf::SelectionManager::instance()->objectsByType(&selection);

View File

@ -29,6 +29,6 @@ public:
static RicIntersectionPickEventHandler* instance(); static RicIntersectionPickEventHandler* instance();
protected: protected:
bool handlePickEvent(const Ric3dPickEvent& eventObject) override; bool handle3dPickEvent(const Ric3dPickEvent& eventObject) override;
}; };

View File

@ -18,7 +18,7 @@
#pragma once #pragma once
#include "RicPickEventHandler.h" #include "Ric3dViewPickEventHandler.h"
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
@ -27,7 +27,7 @@ class RimUserDefinedPolylinesAnnotation;
//================================================================================================== //==================================================================================================
/// ///
//================================================================================================== //==================================================================================================
class RicPolylineTargetsPickEventHandler : public RicPickEventHandler class RicPolylineTargetsPickEventHandler : public Ric3dViewPickEventHandler
{ {
public: public:
RicPolylineTargetsPickEventHandler(RimUserDefinedPolylinesAnnotation* polylineDef); RicPolylineTargetsPickEventHandler(RimUserDefinedPolylinesAnnotation* polylineDef);

View File

@ -53,7 +53,7 @@ RicWellPathPickEventHandler* RicWellPathPickEventHandler::instance()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicWellPathPickEventHandler::handlePickEvent(const Ric3dPickEvent& eventObject) bool RicWellPathPickEventHandler::handle3dPickEvent(const Ric3dPickEvent& eventObject)
{ {
if (eventObject.m_pickItemInfos.empty()) return false; if (eventObject.m_pickItemInfos.empty()) return false;

View File

@ -30,6 +30,6 @@ class RicWellPathPickEventHandler : public RicDefaultPickEventHandler
public: public:
static RicWellPathPickEventHandler* instance(); static RicWellPathPickEventHandler* instance();
bool handlePickEvent(const Ric3dPickEvent& eventObject) override; bool handle3dPickEvent(const Ric3dPickEvent& eventObject) override;
}; };

View File

@ -112,7 +112,7 @@
// RiaViewerCommands // RiaViewerCommands
// //
//================================================================================================== //==================================================================================================
RicPickEventHandler* RiuViewerCommands::sm_overridingPickHandler = nullptr; Ric3dViewPickEventHandler* RiuViewerCommands::sm_overridingPickHandler = nullptr;
std::vector<RicDefaultPickEventHandler*> RiuViewerCommands::sm_defaultPickEventHandlers; std::vector<RicDefaultPickEventHandler*> RiuViewerCommands::sm_defaultPickEventHandlers;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -551,7 +551,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
for (size_t i = 0; i < sm_defaultPickEventHandlers.size(); i++) for (size_t i = 0; i < sm_defaultPickEventHandlers.size(); i++)
{ {
if (sm_defaultPickEventHandlers[i]->handlePickEvent(viewerEventObject)) if (sm_defaultPickEventHandlers[i]->handle3dPickEvent(viewerEventObject))
{ {
return; return;
} }
@ -926,7 +926,7 @@ void RiuViewerCommands::handlePickAction(int winPosX, int winPosY, Qt::KeyboardM
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuViewerCommands::setPickEventHandler(RicPickEventHandler* pickEventHandler) void RiuViewerCommands::setPickEventHandler(Ric3dViewPickEventHandler* pickEventHandler)
{ {
if (sm_overridingPickHandler) sm_overridingPickHandler->notifyUnregistered(); if (sm_overridingPickHandler) sm_overridingPickHandler->notifyUnregistered();
@ -936,7 +936,7 @@ void RiuViewerCommands::setPickEventHandler(RicPickEventHandler* pickEventHandle
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuViewerCommands::removePickEventHandlerIfActive(RicPickEventHandler* pickEventHandler) void RiuViewerCommands::removePickEventHandlerIfActive(Ric3dViewPickEventHandler* pickEventHandler)
{ {
if (sm_overridingPickHandler == pickEventHandler) if (sm_overridingPickHandler == pickEventHandler)
{ {

View File

@ -26,7 +26,7 @@
#include <QPointer> #include <QPointer>
class RicDefaultPickEventHandler; class RicDefaultPickEventHandler;
class RicPickEventHandler; class Ric3dViewPickEventHandler;
class RimEclipseView; class RimEclipseView;
class RimGeoMechView; class RimGeoMechView;
class RimIntersection; class RimIntersection;
@ -60,8 +60,8 @@ public:
void displayContextMenu(QMouseEvent* event); void displayContextMenu(QMouseEvent* event);
void handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers); void handlePickAction(int winPosX, int winPosY, Qt::KeyboardModifiers keyboardModifiers);
static void setPickEventHandler(RicPickEventHandler* pickEventHandler); static void setPickEventHandler(Ric3dViewPickEventHandler* pickEventHandler);
static void removePickEventHandlerIfActive(RicPickEventHandler* pickEventHandler); static void removePickEventHandlerIfActive(Ric3dViewPickEventHandler* pickEventHandler);
cvf::Vec3d lastPickPositionInDomainCoords() const; cvf::Vec3d lastPickPositionInDomainCoords() const;
private: private:
@ -87,7 +87,7 @@ private:
caf::PdmPointer<Rim3dView> m_reservoirView; caf::PdmPointer<Rim3dView> m_reservoirView;
QPointer<RiuViewer> m_viewer; QPointer<RiuViewer> m_viewer;
static RicPickEventHandler* sm_overridingPickHandler; static Ric3dViewPickEventHandler* sm_overridingPickHandler;
static std::vector<RicDefaultPickEventHandler*> sm_defaultPickEventHandlers; static std::vector<RicDefaultPickEventHandler*> sm_defaultPickEventHandlers;
void handleTextPicking(int winPosX, int winPosY, cvf::HitItemCollection* hitItems); void handleTextPicking(int winPosX, int winPosY, cvf::HitItemCollection* hitItems);
}; };