Skip to content

Commit

Permalink
#1948 PLT plot. Initial version, RFT plot copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjørn Erik Jensen committed Oct 25, 2017
1 parent be8c227 commit a353295
Show file tree
Hide file tree
Showing 21 changed files with 2,440 additions and 2 deletions.
18 changes: 17 additions & 1 deletion ApplicationCode/Application/RiaApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include "RimFlowPlotCollection.h"
#include "RimFormationNamesCollection.h"
#include "RimRftPlotCollection.h"
#include "RimPltPlotCollection.h"

#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
Expand All @@ -61,7 +62,6 @@
#include "RimOilField.h"
#include "RimProject.h"
#include "RimReservoirCellResultsStorage.h"
#include "RimRftPlotCollection.h"
#include "RimScriptCollection.h"
#include "RimSummaryCase.h"
#include "RimSummaryCaseMainCollection.h"
Expand All @@ -77,6 +77,7 @@
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellRftPlot.h"
#include "RimWellPltPlot.h"

#include "RiuMainPlotWindow.h"
#include "RiuMainWindow.h"
Expand Down Expand Up @@ -622,6 +623,7 @@ void RiaApplication::loadAndUpdatePlotData()
RimSummaryPlotCollection* spColl = nullptr;
RimFlowPlotCollection* flowColl = nullptr;
RimRftPlotCollection* rftColl = nullptr;
RimPltPlotCollection* pltColl = nullptr;

if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection())
{
Expand All @@ -639,12 +641,17 @@ void RiaApplication::loadAndUpdatePlotData()
{
rftColl = m_project->mainPlotCollection()->rftPlotCollection();
}
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->pltPlotCollection())
{
pltColl = m_project->mainPlotCollection()->pltPlotCollection();
}

size_t plotCount = 0;
plotCount += wlpColl ? wlpColl->wellLogPlots().size() : 0;
plotCount += spColl ? spColl->summaryPlots().size() : 0;
plotCount += flowColl ? flowColl->plotCount() : 0;
plotCount += rftColl ? rftColl->rftPlots().size() : 0;
plotCount += pltColl ? pltColl->pltPlots().size() : 0;

caf::ProgressInfo plotProgress(plotCount, "Loading Plot Data");
if (wlpColl)
Expand Down Expand Up @@ -680,6 +687,15 @@ void RiaApplication::loadAndUpdatePlotData()
plotProgress.incrementProgress();
}
}

if (pltColl)
{
for (const auto& pltPlot : pltColl->pltPlots())
{
pltPlot->loadDataAndUpdate();
plotProgress.incrementProgress();
}
}
}

//--------------------------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ ${CEE_CURRENT_LIST_DIR}RicNewWellLogCurveExtractionFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellLogRftCurveFeature.h
${CEE_CURRENT_LIST_DIR}RicNewRftPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicDeleteRftPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicNewPltPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicDeletePltPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellLogFileCurveFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.h
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeatureImpl.h
Expand All @@ -33,6 +35,8 @@ ${CEE_CURRENT_LIST_DIR}RicNewWellLogCurveExtractionFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellLogRftCurveFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewRftPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicDeleteRftPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewPltPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicDeletePltPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellLogFileCurveFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeature.cpp
${CEE_CURRENT_LIST_DIR}RicNewWellLogPlotFeatureImpl.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicDeletePltPlotFeature.h"

#include "RimPltPlotCollection.h"
#include "RimWellPltPlot.h"
#include "cafSelectionManager.h"

#include <QAction>

CAF_CMD_SOURCE_INIT(RicDeletePltPlotFeature, "RicDeletePltPlotFeature");

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicDeletePltPlotFeature::isCommandEnabled()
{
std::vector<RimWellPltPlot*> objects;
caf::SelectionManager::instance()->objectsByType(&objects);

if (objects.size() > 0)
{
return true;
}

return false;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeletePltPlotFeature::onActionTriggered(bool isChecked)
{
std::vector<RimWellPltPlot*> selectedPlots;
caf::SelectionManager::instance()->objectsByType(&selectedPlots);

if (selectedPlots.size() == 0) return;

RimWellPltPlot* firstPlot = selectedPlots[0];

RimPltPlotCollection* pltPlotCollection = nullptr;
firstPlot->firstAncestorOrThisOfType(pltPlotCollection);
if (!pltPlotCollection) return;

for (RimWellPltPlot* plot : selectedPlots)
{
pltPlotCollection->removePlot(plot);
delete plot;
}

pltPlotCollection->uiCapability()->updateConnectedEditors();
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicDeletePltPlotFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("Delete PLT Plot");
actionToSetup->setIcon(QIcon(":/Erase.png"));
}
36 changes: 36 additions & 0 deletions ApplicationCode/Commands/WellLogCommands/RicDeletePltPlotFeature.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "cafCmdFeature.h"

//==================================================================================================
///
//==================================================================================================
class RicDeletePltPlotFeature : public caf::CmdFeature
{
CAF_CMD_HEADER_INIT;
protected:

// Overrides
virtual bool isCommandEnabled() override;
virtual void onActionTriggered( bool isChecked ) override;
virtual void setupActionLook( QAction* actionToSetup ) override;
};
184 changes: 184 additions & 0 deletions ApplicationCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
/////////////////////////////////////////////////////////////////////////////////
//
// 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 "RicNewPltPlotFeature.h"

#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h"

#include "RiaApplication.h"

#include "RigWellLogCurveData.h"

#include "RimProject.h"
#include "RimSimWellInView.h"
#include "RimView.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellPltPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPath.h"
#include "RimPltPlotCollection.h"
#include "RimMainPlotCollection.h"
#include "RimEclipseResultCase.h"

#include "RiuMainPlotWindow.h"
#include "RiuSelectionManager.h"

#include "cafSelectionManagerTools.h"

#include <QAction>

#include <vector>


CAF_CMD_SOURCE_INIT(RicNewPltPlotFeature, "RicNewPltPlotFeature");

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPltPlotFeature::isCommandEnabled()
{
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false;

RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
RimWellPath* rimWellPath = simWell == nullptr ? caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>() : nullptr;

bool enable = true;
if (simWell != nullptr)
{
RimEclipseResultCase* eclCase = caf::firstAncestorOfTypeFromSelectedObject<RimEclipseResultCase*>();
if (simWell != nullptr)
{
enable &= RimWellPltPlot::hasPressureData(eclCase);
}
}
else if (rimWellPath)
{
enable &= RimWellPltPlot::hasPressureData(rimWellPath);
}
return enable;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::onActionTriggered(bool isChecked)
{
RimProject* proj = RiaApplication::instance()->project();

RimPltPlotCollection* pltPlotColl = proj->mainPlotCollection()->pltPlotCollection();
if (pltPlotColl)
{
QString wellName;
RimWellPath* wellPath = nullptr;
RimSimWellInView* eclipseWell = nullptr;
if ((wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>()) != nullptr)
{
wellName = wellPath->name();
}
else if ((eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>()) != nullptr)
{
wellName = eclipseWell->name();
}

QString plotName = QString(RimWellPltPlot::plotNameFormatString()).arg(wellName);

RimWellPltPlot* pltPlot = new RimWellPltPlot();
pltPlot->setCurrentWellName(wellName);

RimWellLogTrack* plotTrack = new RimWellLogTrack();
pltPlot->wellLogPlot()->addTrack(plotTrack);
plotTrack->setDescription(QString("Track %1").arg(pltPlot->wellLogPlot()->trackCount()));

pltPlotColl->addPlot(pltPlot);
pltPlot->setDescription(plotName);

pltPlot->applyInitialSelections();
pltPlot->loadDataAndUpdate();
pltPlotColl->updateConnectedEditors();

RiuMainPlotWindow* mainPlotWindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
if (mainPlotWindow)
{
mainPlotWindow->setExpanded(plotTrack);
mainPlotWindow->selectAsCurrentItem(pltPlot);
}
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::setupActionLook(QAction* actionToSetup)
{
actionToSetup->setText("New PLT Plot");
actionToSetup->setIcon(QIcon(":/SummaryPlot16x16.png"));
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RicNewPltPlotFeature::selectedWellLogPlotTrack() const
{
auto selection = caf::selectedObjectsByType<RimWellLogTrack*>();
return selection.size() > 0 ? selection[0] : nullptr;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPath* RicNewPltPlotFeature::selectedWellPath() const
{
auto selection = caf::selectedObjectsByType<RimWellPath*>();
return selection.size() > 0 ? selection[0] : nullptr;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell(int * branchIndex) const
{
RiuSelectionItem* selItem = RiuSelectionManager::instance()->selectedItem(RiuSelectionManager::RUI_TEMPORARY);
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem);
if (simWellSelItem)
{
(*branchIndex) = static_cast<int>(simWellSelItem->m_branchIndex);
return simWellSelItem->m_simWell;
}
else
{
std::vector<RimSimWellInView*> selection;
caf::SelectionManager::instance()->objectsByType(&selection);
(*branchIndex) = 0;
return selection.size() > 0 ? selection[0] : nullptr;
}
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicNewPltPlotFeature::caseAvailable() const
{
std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases(cases);

return cases.size() > 0;
}

Loading

0 comments on commit a353295

Please sign in to comment.