mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#632) Update application items when selection changes using a separate class
Added RiuSelectionChangedHandler Moved code from ViewerCommands into SelectionChangedHandler
This commit is contained in:
@@ -18,16 +18,20 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafPdmPointer.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfColor3.h"
|
||||
#include "cvfStructGrid.h"
|
||||
|
||||
#include <vector>
|
||||
#include <assert.h>
|
||||
|
||||
class RimEclipseView;
|
||||
|
||||
class RiuSelectionChangedHandler;
|
||||
class RiuSelectionItem;
|
||||
class RimGeoMechView;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
@@ -37,27 +41,35 @@ class RiuSelectionItem;
|
||||
class RiuSelectionManager
|
||||
{
|
||||
public:
|
||||
RiuSelectionManager();
|
||||
~RiuSelectionManager();
|
||||
|
||||
static RiuSelectionManager* instance();
|
||||
|
||||
// Returns selected items
|
||||
// Selection manager owns the selection items and is responsible for delete
|
||||
// Selection manager owns the selection items
|
||||
void selectedItems(std::vector<RiuSelectionItem*>& items) const;
|
||||
|
||||
// Set vector of items as selected items in SelectionManager
|
||||
// SelectionManager takes ownership of the selection items
|
||||
void setSelectedItems(const std::vector<RiuSelectionItem*>& items);
|
||||
|
||||
// Append item to selected items in SelectionManager
|
||||
// Append item to selected items
|
||||
// SelectionManager takes ownership of the item
|
||||
void appendItemToSelection(RiuSelectionItem* item);
|
||||
|
||||
// Set one selected item
|
||||
// SelectionManager takes ownership of the item
|
||||
void setSelectedItem(RiuSelectionItem* item);
|
||||
|
||||
// Deletes all items in the SelectionManager
|
||||
void deleteAllItems();
|
||||
|
||||
bool isEmpty() const;
|
||||
|
||||
private:
|
||||
void deleteAllItemsFromSelection();
|
||||
|
||||
private:
|
||||
std::vector < RiuSelectionItem* > m_selection;
|
||||
|
||||
RiuSelectionChangedHandler* m_notificationCenter;
|
||||
};
|
||||
|
||||
|
||||
@@ -79,7 +91,7 @@ public:
|
||||
RiuSelectionItem() {}
|
||||
virtual ~RiuSelectionItem() {};
|
||||
|
||||
virtual RiuSelectionType type() = 0;
|
||||
virtual RiuSelectionType type() const = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -91,10 +103,12 @@ public:
|
||||
class RiuEclipseSelectionItem : public RiuSelectionItem
|
||||
{
|
||||
public:
|
||||
explicit RiuEclipseSelectionItem(RimEclipseView* view, size_t gridIndex, size_t cellIndex, cvf::Color3f color);
|
||||
explicit RiuEclipseSelectionItem(RimEclipseView* view, size_t gridIndex, size_t cellIndex, size_t nncIndex,
|
||||
cvf::Color3f color, cvf::StructGridInterface::FaceType face, const cvf::Vec3d& localIntersectionPoint);
|
||||
|
||||
virtual ~RiuEclipseSelectionItem() {};
|
||||
|
||||
virtual RiuSelectionType type()
|
||||
virtual RiuSelectionType type() const
|
||||
{
|
||||
return ECLIPSE_SELECTION_OBJECT;
|
||||
}
|
||||
@@ -103,7 +117,34 @@ public:
|
||||
caf::PdmPointer<RimEclipseView> m_view;
|
||||
size_t m_gridIndex;
|
||||
size_t m_cellIndex;
|
||||
size_t m_nncIndex;
|
||||
cvf::Color3f m_color;
|
||||
cvf::StructGridInterface::FaceType m_face;
|
||||
cvf::Vec3d m_localIntersectionPoint;
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiuGeoMechSelectionItem : public RiuSelectionItem
|
||||
{
|
||||
public:
|
||||
explicit RiuGeoMechSelectionItem(RimGeoMechView* view, size_t gridIndex, size_t cellIndex, cvf::Color3f color, const cvf::Vec3d& localIntersectionPoint);
|
||||
virtual ~RiuGeoMechSelectionItem() {};
|
||||
|
||||
virtual RiuSelectionType type() const
|
||||
{
|
||||
return GEOMECH_SELECTION_OBJECT;
|
||||
}
|
||||
|
||||
public:
|
||||
caf::PdmPointer<RimGeoMechView> m_view;
|
||||
size_t m_gridIndex;
|
||||
size_t m_cellIndex;
|
||||
cvf::Color3f m_color;
|
||||
cvf::Vec3d m_localIntersectionPoint;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user