#4045 Don't accept pick events if the current selected object isn't the object owning the pick handler.

This commit is contained in:
Gaute Lindkvist
2019-02-06 13:20:33 +01:00
parent dbe21b7809
commit c4f5065032
13 changed files with 98 additions and 17 deletions

View File

@@ -159,6 +159,7 @@ set( PROJECT_FILES
cafPdmUniqueIdValidator.cpp
cafPdmDoubleStringValidator.cpp
cafPickEventHandler.h
cafPickEventHandler.cpp
)
add_library( ${PROJECT_NAME}

View File

@@ -0,0 +1,44 @@
//##################################################################################################
//
// Custom Visualization Core library
// Copyright (C) 2019- Ceetron Solution AS
//
// This library may be used under the terms of either the GNU General Public License or
// the GNU Lesser General Public License as follows:
//
// GNU General Public License Usage
// This library 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.
//
// This library 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.
//
// GNU Lesser General Public License Usage
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2.1 of the License, or
// (at your option) any later version.
//
// This library 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 Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
// for more details.
//
//##################################################################################################
#include "cafPickEventHandler.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool caf::PickEventHandler::isObjectBeingModified(const PdmObjectHandle* object) const
{
return m_objectBeingModified == object;
}

View File

@@ -36,6 +36,8 @@
#pragma once
#include "cafPdmObjectHandle.h"
namespace caf
{
@@ -54,11 +56,18 @@ public:
class PickEventHandler
{
public:
PickEventHandler(const PdmObjectHandle* objectBeingModified) : m_objectBeingModified(objectBeingModified) {}
bool isObjectBeingModified(const PdmObjectHandle* testObject) const;
virtual void registerAsPickEventHandler() = 0;
virtual void unregisterAsPickEventHandler() = 0;
// TODO: Rename to just handlePickEvent when the RicPickEventHandler::handlePickEvent has been renamed
virtual bool handlePickEvent(const PickEvent& eventObject) = 0;
virtual void notifyUnregistered() = 0;
private:
const PdmObjectHandle* m_objectBeingModified;
};
}