mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Created baseclass for PropertyFilterCollections
This commit is contained in:
parent
a57b27b6c0
commit
8b8fd51862
@ -9,6 +9,7 @@ ${CEE_CURRENT_LIST_DIR}RimEclipseCaseCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCaseCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCellFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipsePropertyFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilterCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipsePropertyFilterCollection.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCellRangeFilter.h
|
||||
${CEE_CURRENT_LIST_DIR}RimCellRangeFilterCollection.h
|
||||
@ -78,6 +79,7 @@ ${CEE_CURRENT_LIST_DIR}RimEclipseCaseCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCaseCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCellFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipsePropertyFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimPropertyFilterCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimEclipsePropertyFilterCollection.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCellRangeFilter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RimCellRangeFilterCollection.cpp
|
||||
|
@ -41,8 +41,6 @@ RimEclipsePropertyFilterCollection::RimEclipsePropertyFilterCollection()
|
||||
CAF_PDM_InitFieldNoDefault(&propertyFilters, "PropertyFilters", "Property Filters", "", "", "");
|
||||
propertyFilters.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
||||
isActive.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -64,17 +62,6 @@ RimEclipseView* RimEclipsePropertyFilterCollection::reservoirView()
|
||||
return eclipseView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilterCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
updateIconState();
|
||||
uiCapability()->updateConnectedEditors();
|
||||
|
||||
updateDisplayModelNotifyManagedViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -127,26 +114,6 @@ bool RimEclipsePropertyFilterCollection::hasActiveDynamicFilters() const
|
||||
return false;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimEclipsePropertyFilterCollection::objectToggleField()
|
||||
{
|
||||
return &isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilterCollection::updateDisplayModelNotifyManagedViews()
|
||||
{
|
||||
RimEclipseView* view = NULL;
|
||||
this->firstAnchestorOrThisOfType(view);
|
||||
CVF_ASSERT(view);
|
||||
|
||||
view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -179,25 +146,3 @@ void RimEclipsePropertyFilterCollection::updateIconState()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimEclipsePropertyFilterCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
|
||||
{
|
||||
PdmObject::defineUiTreeOrdering(uiTreeOrdering, uiConfigName);
|
||||
|
||||
RimView* rimView = NULL;
|
||||
this->firstAnchestorOrThisOfType(rimView);
|
||||
RimViewController* viewController = rimView->viewController();
|
||||
if (viewController && (viewController->isPropertyFilterOveridden()
|
||||
|| viewController->isVisibleCellsOveridden()))
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly(true, uiConfigName);
|
||||
}
|
||||
else
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly(false, uiConfigName);
|
||||
}
|
||||
|
||||
updateIconState();
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
@ -21,37 +23,34 @@
|
||||
#include "RimEclipsePropertyFilter.h"
|
||||
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "RimPropertyFilterCollection.h"
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimEclipsePropertyFilterCollection : public caf::PdmObject
|
||||
class RimEclipsePropertyFilterCollection : public RimPropertyFilterCollection
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimEclipsePropertyFilterCollection();
|
||||
virtual ~RimEclipsePropertyFilterCollection();
|
||||
|
||||
RimEclipseView* reservoirView();
|
||||
|
||||
// Fields:
|
||||
caf::PdmField<bool> isActive;
|
||||
caf::PdmChildArrayField<RimEclipsePropertyFilter*> propertyFilters;
|
||||
|
||||
// Methods
|
||||
bool hasActiveFilters() const;
|
||||
bool hasActiveDynamicFilters() const;
|
||||
|
||||
RimEclipseView* reservoirView();
|
||||
|
||||
void loadAndInitializePropertyFilters();
|
||||
|
||||
void updateDisplayModelNotifyManagedViews();
|
||||
void updateIconState();
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName);
|
||||
virtual void initAfterRead();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
};
|
||||
|
@ -40,8 +40,6 @@ RimGeoMechPropertyFilterCollection::RimGeoMechPropertyFilterCollection()
|
||||
CAF_PDM_InitFieldNoDefault(&propertyFilters, "PropertyFilters", "Property Filters", "", "", "");
|
||||
propertyFilters.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
||||
isActive.uiCapability()->setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -63,16 +61,6 @@ RimGeoMechView* RimGeoMechPropertyFilterCollection::reservoirView()
|
||||
return geoMechView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilterCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
updateIconState();
|
||||
uiCapability()->updateConnectedEditors();
|
||||
|
||||
updateDisplayModelNotifyManagedViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -129,27 +117,6 @@ bool RimGeoMechPropertyFilterCollection::hasActiveDynamicFilters() const
|
||||
return hasActiveFilters();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimGeoMechPropertyFilterCollection::objectToggleField()
|
||||
{
|
||||
return &isActive;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilterCollection::updateDisplayModelNotifyManagedViews()
|
||||
{
|
||||
RimGeoMechView* view = NULL;
|
||||
this->firstAnchestorOrThisOfType(view);
|
||||
CVF_ASSERT(view);
|
||||
|
||||
view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -181,25 +148,3 @@ void RimGeoMechPropertyFilterCollection::updateIconState()
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimGeoMechPropertyFilterCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
|
||||
{
|
||||
PdmObject::defineUiTreeOrdering(uiTreeOrdering, uiConfigName);
|
||||
|
||||
RimView* rimView = NULL;
|
||||
this->firstAnchestorOrThisOfType(rimView);
|
||||
RimViewController* viewController = rimView->viewController();
|
||||
if (viewController && (viewController->isPropertyFilterOveridden()
|
||||
|| viewController->isVisibleCellsOveridden()))
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly(true, uiConfigName);
|
||||
}
|
||||
else
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly(false, uiConfigName);
|
||||
}
|
||||
|
||||
updateIconState();
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPointer.h"
|
||||
#include "RimPropertyFilterCollection.h"
|
||||
|
||||
class RimGeoMechPropertyFilter;
|
||||
class RimGeoMechView;
|
||||
@ -31,7 +32,7 @@ class RimGeoMechView;
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimGeoMechPropertyFilterCollection : public caf::PdmObject
|
||||
class RimGeoMechPropertyFilterCollection : public RimPropertyFilterCollection
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
@ -41,7 +42,6 @@ public:
|
||||
RimGeoMechView* reservoirView();
|
||||
|
||||
// Fields:
|
||||
caf::PdmField<bool> isActive;
|
||||
caf::PdmChildArrayField<RimGeoMechPropertyFilter*> propertyFilters;
|
||||
|
||||
// Methods
|
||||
@ -49,13 +49,9 @@ public:
|
||||
bool hasActiveDynamicFilters() const;
|
||||
|
||||
void loadAndInitializePropertyFilters();
|
||||
void updateDisplayModelNotifyManagedViews();
|
||||
void updateIconState();
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName);
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
virtual void initAfterRead();
|
||||
};
|
||||
|
@ -0,0 +1,99 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2015- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RimPropertyFilterCollection.h"
|
||||
#include "RimView.h"
|
||||
#include "RimViewController.h"
|
||||
|
||||
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(RimPropertyFilterCollection, "RimPropertyFilterCollection"); // Abstract class
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPropertyFilterCollection::RimPropertyFilterCollection()
|
||||
{
|
||||
CAF_PDM_InitField(&isActive, "Active", true, "Active", "", "", "");
|
||||
isActive.uiCapability()->setUiHidden(true);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimPropertyFilterCollection::~RimPropertyFilterCollection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPropertyFilterCollection::updateDisplayModelNotifyManagedViews()
|
||||
{
|
||||
RimView* view = NULL;
|
||||
this->firstAnchestorOrThisOfType(view);
|
||||
CVF_ASSERT(view);
|
||||
|
||||
view->scheduleGeometryRegen(PROPERTY_FILTERED);
|
||||
view->scheduleCreateDisplayModelAndRedraw();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPropertyFilterCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
updateIconState();
|
||||
uiCapability()->updateConnectedEditors();
|
||||
|
||||
updateDisplayModelNotifyManagedViews();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimPropertyFilterCollection::objectToggleField()
|
||||
{
|
||||
return &isActive;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimPropertyFilterCollection::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName)
|
||||
{
|
||||
PdmObject::defineUiTreeOrdering(uiTreeOrdering, uiConfigName);
|
||||
|
||||
RimView* rimView = NULL;
|
||||
this->firstAnchestorOrThisOfType(rimView);
|
||||
RimViewController* viewController = rimView->viewController();
|
||||
if (viewController && (viewController->isPropertyFilterOveridden()
|
||||
|| viewController->isVisibleCellsOveridden()))
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly(true, uiConfigName);
|
||||
}
|
||||
else
|
||||
{
|
||||
isActive.uiCapability()->setUiReadOnly(false, uiConfigName);
|
||||
}
|
||||
|
||||
updateIconState();
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2015- Ceetron Solutions AS
|
||||
//
|
||||
// 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 "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
///
|
||||
//==================================================================================================
|
||||
class RimPropertyFilterCollection : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
public:
|
||||
RimPropertyFilterCollection();
|
||||
virtual ~RimPropertyFilterCollection();
|
||||
|
||||
// Fields:
|
||||
caf::PdmField<bool> isActive;
|
||||
|
||||
// Methods
|
||||
virtual bool hasActiveFilters() const = 0;
|
||||
virtual bool hasActiveDynamicFilters() const = 0;
|
||||
|
||||
virtual void loadAndInitializePropertyFilters() = 0;
|
||||
|
||||
void updateDisplayModelNotifyManagedViews();
|
||||
virtual void updateIconState() = 0;
|
||||
|
||||
protected:
|
||||
// Overridden methods
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
|
||||
virtual void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName);
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user