ResInsight/ApplicationCode/ProjectDataModel/RimGridCollection.cpp
2017-02-27 14:01:18 +01:00

77 lines
2.7 KiB
C++

/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) Statoil ASA
// Copyright (C) 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 "RimGridCollection.h"
#include "RimView.h"
CAF_PDM_SOURCE_INIT(RimGridCollection, "GridCollection");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridCollection::RimGridCollection()
{
CAF_PDM_InitObject("Grids", ":/draw_style_faults_24x24.png", "", "");
CAF_PDM_InitField(&isActive, "IsActive", true, "Show grid cells", "", "", "");
isActive.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridCollection::~RimGridCollection()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimGridCollection::objectToggleField()
{
return &isActive;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
if (changedField == &isActive)
{
RimView* rimView = NULL;
this->firstAncestorOrThisOfType(rimView);
CVF_ASSERT(rimView);
if (rimView) rimView->showGridCells(isActive);
updateUiIconFromState(isActive);
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimGridCollection::initAfterRead()
{
updateUiIconFromState(isActive);
}