2019-02-05 09:01:29 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
2019-02-06 02:45:30 -06:00
|
|
|
#include "Ric3dViewPickEventHandler.h"
|
2019-02-05 09:01:29 -06:00
|
|
|
#include "RiuViewerCommands.h"
|
|
|
|
|
|
|
|
#include <typeinfo>
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-02-06 02:45:30 -06:00
|
|
|
void Ric3dViewPickEventHandler::registerAsPickEventHandler()
|
2019-02-05 09:01:29 -06:00
|
|
|
{
|
|
|
|
RiuViewerCommands::setPickEventHandler(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-02-06 02:45:30 -06:00
|
|
|
void Ric3dViewPickEventHandler::unregisterAsPickEventHandler()
|
2019-02-05 09:01:29 -06:00
|
|
|
{
|
|
|
|
RiuViewerCommands::removePickEventHandlerIfActive(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Override from caf::PickEventHandler. Translates to a 3d Pick event.
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-02-06 02:45:30 -06:00
|
|
|
bool Ric3dViewPickEventHandler::handlePickEvent(const caf::PickEvent& eventObject)
|
2019-02-05 09:01:29 -06:00
|
|
|
{
|
2019-02-06 02:45:30 -06:00
|
|
|
const Ric3dPickEvent* eventObject3d = dynamic_cast<const Ric3dPickEvent*>(&eventObject);
|
|
|
|
if (eventObject3d != nullptr)
|
2019-02-05 09:01:29 -06:00
|
|
|
{
|
2019-02-06 02:45:30 -06:00
|
|
|
return handle3dPickEvent(*eventObject3d);
|
2019-02-05 09:01:29 -06:00
|
|
|
}
|
2019-02-06 02:45:30 -06:00
|
|
|
return false;
|
2019-02-05 09:01:29 -06:00
|
|
|
}
|