Added collection class for well log plots

This commit is contained in:
Pål Hagen 2015-08-28 10:42:57 +02:00
parent 75a34e605f
commit af9bbfdede
9 changed files with 163 additions and 42 deletions

View File

@ -19,9 +19,11 @@
#include "RicNewWellLogPlotFeature.h"
#include "RimProject.h"
#include "RimMainPlotCollection.h"
#include "RimWellLogPlotCollection.h"
#include "cafSelectionManager.h"
#include "RiaApplication.h"
#include <QAction>
@ -33,7 +35,7 @@ CAF_CMD_SOURCE_INIT(RicNewWellLogPlotFeature, "RicNewWellLogPlotFeature");
//--------------------------------------------------------------------------------------------------
bool RicNewWellLogPlotFeature::isCommandEnabled()
{
return selectedMainPlotCollection() != NULL;
return wellLogPlotCollection() != NULL;
}
//--------------------------------------------------------------------------------------------------
@ -41,10 +43,10 @@ bool RicNewWellLogPlotFeature::isCommandEnabled()
//--------------------------------------------------------------------------------------------------
void RicNewWellLogPlotFeature::onActionTriggered(bool isChecked)
{
RimMainPlotCollection* mainPlotCollection = selectedMainPlotCollection();
if (mainPlotCollection)
RimWellLogPlotCollection* wellLogPlotColl = wellLogPlotCollection();
if (wellLogPlotColl)
{
mainPlotCollection->addWellLogPlot();
wellLogPlotColl->addWellLogPlot();
}
}
@ -59,9 +61,10 @@ void RicNewWellLogPlotFeature::setupActionLook(QAction* actionToSetup)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimMainPlotCollection* RicNewWellLogPlotFeature::selectedMainPlotCollection()
RimWellLogPlotCollection* RicNewWellLogPlotFeature::wellLogPlotCollection()
{
std::vector<RimMainPlotCollection*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
return selection.size() > 0 ? selection[0] : NULL;
RimProject* project = RiaApplication::instance()->project();
RimMainPlotCollection* mainPlotCollection = project ? project->mainPlotCollection() : NULL;
return mainPlotCollection ? mainPlotCollection->wellLogPlotCollection() : NULL;
}

View File

@ -21,7 +21,7 @@
#include "cafCmdFeature.h"
class RimMainPlotCollection;
class RimWellLogPlotCollection;
//==================================================================================================
///
@ -37,6 +37,5 @@ protected:
virtual void setupActionLook( QAction* actionToSetup );
private:
RimMainPlotCollection* selectedMainPlotCollection();
RimWellLogPlotCollection* wellLogPlotCollection();
};

View File

@ -62,6 +62,7 @@ ${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.h
${CEE_CURRENT_LIST_DIR}RimManagedViewConfig.h
${CEE_CURRENT_LIST_DIR}RimManagedViewCollection.h
${CEE_CURRENT_LIST_DIR}RimMainPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimWellLogPlotCollection.h
${CEE_CURRENT_LIST_DIR}RimWellLogPlot.h
${CEE_CURRENT_LIST_DIR}RimWellLogPlotTrace.h
${CEE_CURRENT_LIST_DIR}RimWellLogPlotCurve.h
@ -125,6 +126,7 @@ ${CEE_CURRENT_LIST_DIR}RimTreeViewStateSerializer.cpp
${CEE_CURRENT_LIST_DIR}RimManagedViewConfig.cpp
${CEE_CURRENT_LIST_DIR}RimManagedViewCollection.cpp
${CEE_CURRENT_LIST_DIR}RimMainPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogPlotCollection.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogPlot.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogPlotTrace.cpp
${CEE_CURRENT_LIST_DIR}RimWellLogPlotCurve.cpp

View File

@ -18,7 +18,7 @@
/////////////////////////////////////////////////////////////////////////////////
#include "RimMainPlotCollection.h"
#include "RimWellLogPlot.h"
#include "RimWellLogPlotCollection.h"
#include "RiuMainWindow.h"
@ -36,8 +36,10 @@ RimMainPlotCollection::RimMainPlotCollection()
CAF_PDM_InitField(&show, "Show", true, "Show plots", "", "", "");
show.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&wellLogPlots, "WellLogPlots", "", "", "", "");
wellLogPlots.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&wellLogPlotCollection, "WellLogPlotCollection", "", "", "", "");
wellLogPlotCollection.uiCapability()->setUiHidden(true);
wellLogPlotCollection = new RimWellLogPlotCollection();
}
//--------------------------------------------------------------------------------------------------
@ -45,6 +47,7 @@ RimMainPlotCollection::RimMainPlotCollection()
//--------------------------------------------------------------------------------------------------
RimMainPlotCollection::~RimMainPlotCollection()
{
if (wellLogPlotCollection()) delete wellLogPlotCollection();
}
//--------------------------------------------------------------------------------------------------
@ -61,15 +64,3 @@ caf::PdmFieldHandle* RimMainPlotCollection::objectToggleField()
{
return &show;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimMainPlotCollection::addWellLogPlot()
{
RimWellLogPlot* view = new RimWellLogPlot();
wellLogPlots.push_back(view);
RiuMainWindow::instance()->projectTreeView()->setExpanded(this, true);
updateConnectedEditors();
}

View File

@ -21,9 +21,9 @@
#include "cafPdmObject.h"
#include "cafPdmField.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmChildField.h"
class RimWellLogPlot;
class RimWellLogPlotCollection;
//==================================================================================================
@ -37,7 +37,7 @@ public:
RimMainPlotCollection();
virtual ~RimMainPlotCollection();
void addWellLogPlot();
caf::PdmChildField<RimWellLogPlotCollection*> wellLogPlotCollection;
protected:
@ -49,5 +49,4 @@ private:
private:
caf::PdmField<bool> show;
caf::PdmChildArrayField<RimWellLogPlot*> wellLogPlots;
};

View File

@ -565,7 +565,11 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
std::vector<caf::PdmUiItem*> uiItems;
caf::SelectionManager::instance()->selectedItems(uiItems);
if (uiItems.size() > 1)
if (uiItems.size() == 0)
{
commandIds << "RicNewWellLogPlotFeature";
}
else if (uiItems.size() > 1)
{
commandIds << "RicCopyReferencesToClipboardFeature";
}
@ -718,10 +722,6 @@ void RimProject::actionsBasedOnSelection(QMenu& contextMenu)
{
commandIds << "RicDeleteItemFeature";
}
else if (dynamic_cast<RimMainPlotCollection*>(uiItem))
{
commandIds << "RicNewWellLogPlotFeature";
}
if (dynamic_cast<RimManagedViewCollection*>(uiItem))
{

View File

@ -62,6 +62,7 @@ public:
caf::PdmChildArrayField<RimOilField*> oilFields;
caf::PdmChildField<RimScriptCollection*> scriptCollection;
caf::PdmChildField<RimWellPathImport*> wellPathImport;
caf::PdmChildField<RimMainPlotCollection*> mainPlotCollection;
caf::PdmChildArrayField<RimCommandObject*> commandObjects;
caf::PdmField<QString> treeViewState;
caf::PdmField<QString> currentModelIndexPath;
@ -104,6 +105,4 @@ private:
caf::PdmChildArrayField<RimEclipseCase*> casesObsolete; // obsolete
caf::PdmChildArrayField<RimIdenticalGridCaseGroup*> caseGroupsObsolete; // obsolete
caf::PdmChildField<RimMainPlotCollection*> mainPlotCollection;
};

View File

@ -0,0 +1,75 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RimWellLogPlotCollection.h"
#include "RimWellLogPlot.h"
#include "RiuMainWindow.h"
#include "cafPdmUiTreeView.h"
CAF_PDM_SOURCE_INIT(RimWellLogPlotCollection, "WellLogPlotCollection");
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCollection::RimWellLogPlotCollection()
{
CAF_PDM_InitObject("Well Log Plots", "", "", "");
CAF_PDM_InitField(&show, "Show", true, "Show plots", "", "", "");
show.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&wellLogPlots, "WellLogPlots", "", "", "", "");
wellLogPlots.uiCapability()->setUiHidden(true);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotCollection::~RimWellLogPlotCollection()
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
{
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::PdmFieldHandle* RimWellLogPlotCollection::objectToggleField()
{
return &show;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCollection::addWellLogPlot()
{
RimWellLogPlot* view = new RimWellLogPlot();
wellLogPlots.push_back(view);
RiuMainWindow::instance()->projectTreeView()->setExpanded(this, true);
updateConnectedEditors();
}

View File

@ -0,0 +1,53 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "cafPdmObject.h"
#include "cafPdmField.h"
#include "cafPdmChildArrayField.h"
class RimWellLogPlot;
//==================================================================================================
///
///
//==================================================================================================
class RimWellLogPlotCollection : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
RimWellLogPlotCollection();
virtual ~RimWellLogPlotCollection();
void addWellLogPlot();
protected:
// Overridden PDM methods
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
private:
virtual caf::PdmFieldHandle* objectToggleField();
private:
caf::PdmField<bool> show;
caf::PdmChildArrayField<RimWellLogPlot*> wellLogPlots;
};