-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1948 PLT plot. Initial version, RFT plot copy
- Loading branch information
Bjørn Erik Jensen
committed
Oct 25, 2017
1 parent
be8c227
commit a353295
Showing
21 changed files
with
2,440 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
ApplicationCode/Commands/WellLogCommands/RicDeletePltPlotFeature.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
36
ApplicationCode/Commands/WellLogCommands/RicDeletePltPlotFeature.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
184
ApplicationCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
Oops, something went wrong.