CppCheck : Several fixes

Add missing initializers
Guard potential null pointer access
This commit is contained in:
Magne Sjaastad
2018-08-02 19:22:03 +02:00
parent 39c4319fa4
commit fe07b60392
21 changed files with 184 additions and 148 deletions

View File

@@ -81,20 +81,22 @@ void RicExportFaultsFeature::onActionTriggered(bool isChecked)
RimEclipseCase* eclCase = nullptr; RimEclipseCase* eclCase = nullptr;
rimFault->firstAncestorOrThisOfType(eclCase); rimFault->firstAncestorOrThisOfType(eclCase);
QString caseName; if (eclCase)
{
if (eclCase) caseName = eclCase->caseUserDescription(); QString caseName = eclCase->caseUserDescription();
QString faultName = rimFault->name(); QString faultName = rimFault->name();
if ( faultName == RiaDefines::undefinedGridFaultName() ) faultName = "UNDEF"; if (faultName == RiaDefines::undefinedGridFaultName()) faultName = "UNDEF";
if ( faultName == RiaDefines::undefinedGridFaultWithInactiveName() ) faultName = "UNDEF_IA"; if (faultName == RiaDefines::undefinedGridFaultWithInactiveName()) faultName = "UNDEF_IA";
QString baseFilename = "Fault_" + faultName + "_" + caseName; QString baseFilename = "Fault_" + faultName + "_" + caseName;
baseFilename = caf::Utils::makeValidFileBasename(baseFilename); baseFilename = caf::Utils::makeValidFileBasename(baseFilename);
QString completeFilename = selectedDir + "/" + baseFilename + ".grdecl"; QString completeFilename = selectedDir + "/" + baseFilename + ".grdecl";
RicExportFaultsFeature::saveFault(completeFilename, eclCase->eclipseCaseData()->mainGrid(), rimFault->faultGeometry()->faultFaces(), faultName); RicExportFaultsFeature::saveFault(
completeFilename, eclCase->eclipseCaseData()->mainGrid(), rimFault->faultGeometry()->faultFaces(), faultName);
}
} }

View File

@@ -136,9 +136,10 @@ QImage RicGridStatisticsDialog::screenShotImage()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicGridStatisticsDialog::setInfoText(RimGridView* view) void RicGridStatisticsDialog::setInfoText(RimGridView* view)
{ {
Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig(); if (view && view->overlayInfoConfig())
if (view && overlayInfo)
{ {
Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig();
QString text; QString text;
text = overlayInfo->timeStepText(); text = overlayInfo->timeStepText();
text += overlayInfo->caseInfoText(); text += overlayInfo->caseInfoText();
@@ -156,9 +157,10 @@ void RicGridStatisticsDialog::setHistogramData(RimGridView* view)
deletePlotItems(m_historgramPlot); deletePlotItems(m_historgramPlot);
deletePlotItems(m_aggregatedPlot); deletePlotItems(m_aggregatedPlot);
Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig(); if (view && view->overlayInfoConfig())
if (view && overlayInfo)
{ {
Rim3dOverlayInfoConfig* overlayInfo = view->overlayInfoConfig();
auto hist = new QwtPlotHistogram("Histogram"); auto hist = new QwtPlotHistogram("Histogram");
auto aggr = new QwtPlotCurve("Aggregated"); auto aggr = new QwtPlotCurve("Aggregated");

View File

@@ -36,6 +36,7 @@
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RicSummaryCurveCalculatorEditor::RicSummaryCurveCalculatorEditor() RicSummaryCurveCalculatorEditor::RicSummaryCurveCalculatorEditor()
: m_pdmTableView(nullptr)
{ {
m_calculator = std::unique_ptr<RicSummaryCurveCalculator>(new RicSummaryCurveCalculator); m_calculator = std::unique_ptr<RicSummaryCurveCalculator>(new RicSummaryCurveCalculator);

View File

@@ -60,7 +60,7 @@ void RicWellLogFileCloseFeature::onActionTriggered(bool isChecked)
RimWellPath* parentWellPath; RimWellPath* parentWellPath;
wellLogFile->firstAncestorOrThisOfType(parentWellPath); wellLogFile->firstAncestorOrThisOfType(parentWellPath);
if (parentWellPath != nullptr) if (parentWellPath)
{ {
std::set<RimViewWindow*> referringPlots = referringWellLogPlots(wellLogFile); std::set<RimViewWindow*> referringPlots = referringWellLogPlots(wellLogFile);
parentWellPath->deleteWellLogFile(wellLogFile); parentWellPath->deleteWellLogFile(wellLogFile);
@@ -69,9 +69,10 @@ void RicWellLogFileCloseFeature::onActionTriggered(bool isChecked)
{ {
plot->loadDataAndUpdate(); plot->loadDataAndUpdate();
} }
}
parentWellPath->updateConnectedEditors(); parentWellPath->updateConnectedEditors();
} }
}
caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors();
} }

View File

@@ -64,6 +64,8 @@ bool RicWellPathViewerEventHandler::handleEvent(const RicViewerEventObject& even
const auto & partAndTriangleIndexPair = eventObject.m_partAndTriangleIndexPairs.front(); const auto & partAndTriangleIndexPair = eventObject.m_partAndTriangleIndexPairs.front();
const cvf::Part* part = partAndTriangleIndexPair.first; const cvf::Part* part = partAndTriangleIndexPair.first;
if (part)
{
const RivObjectSourceInfo* sourceInfo = dynamic_cast<const RivObjectSourceInfo*>(part->sourceInfo()); const RivObjectSourceInfo* sourceInfo = dynamic_cast<const RivObjectSourceInfo*>(part->sourceInfo());
if (sourceInfo) if (sourceInfo)
{ {
@@ -77,14 +79,16 @@ bool RicWellPathViewerEventHandler::handleEvent(const RicViewerEventObject& even
const cvf::Part* secondPickedPart = secondPair.first; const cvf::Part* secondPickedPart = secondPair.first;
if (secondPickedPart) if (secondPickedPart)
{ {
auto wellPathSourceCandidate = dynamic_cast<const RivWellPathSourceInfo*>(secondPickedPart->sourceInfo()); auto wellPathSourceCandidate =
dynamic_cast<const RivWellPathSourceInfo*>(secondPickedPart->sourceInfo());
if (wellPathSourceCandidate) if (wellPathSourceCandidate)
{ {
RimWellPath* perforationWellPath = nullptr; RimWellPath* perforationWellPath = nullptr;
objectToSelect->firstAncestorOrThisOfType(perforationWellPath); objectToSelect->firstAncestorOrThisOfType(perforationWellPath);
if (perforationWellPath == wellPathSourceCandidate->wellPath()) if (perforationWellPath == wellPathSourceCandidate->wellPath())
{ {
wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(secondPickedPart->sourceInfo()); wellPathSourceInfo =
dynamic_cast<const RivWellPathSourceInfo*>(secondPickedPart->sourceInfo());
wellPathTriangleIndex = secondPair.second; wellPathTriangleIndex = secondPair.second;
} }
} }
@@ -93,12 +97,13 @@ bool RicWellPathViewerEventHandler::handleEvent(const RicViewerEventObject& even
} }
} }
if (part && dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo())) if (dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo()))
{ {
wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo()); wellPathSourceInfo = dynamic_cast<const RivWellPathSourceInfo*>(part->sourceInfo());
wellPathTriangleIndex = partAndTriangleIndexPair.second; wellPathTriangleIndex = partAndTriangleIndexPair.second;
} }
} }
}
if (wellPathSourceInfo) if (wellPathSourceInfo)
{ {

View File

@@ -72,6 +72,7 @@ RifSummaryCaseRestartSelector::RifSummaryCaseRestartSelector()
m_showDialog = prefs->summaryRestartFilesShowImportDialog(); m_showDialog = prefs->summaryRestartFilesShowImportDialog();
m_defaultSummaryImportMode = mapReadOption(prefs->summaryImportMode()); m_defaultSummaryImportMode = mapReadOption(prefs->summaryImportMode());
m_defaultGridImportMode = mapReadOption(prefs->gridImportMode()); m_defaultGridImportMode = mapReadOption(prefs->gridImportMode());
m_ensembleOrGroupMode = false;
//m_buildGridFileList = false; //m_buildGridFileList = false;
m_gridFiles.clear(); m_gridFiles.clear();

View File

@@ -30,10 +30,12 @@ class RigFemResultAddress
{ {
public: public:
RigFemResultAddress() RigFemResultAddress()
: resultPosType(RIG_NODAL)
, fieldName("")
, componentName("")
, timeLapseBaseFrameIdx(NO_TIME_LAPSE)
, refKLayerIndex(NO_COMPACTION)
{ {
resultPosType = RIG_NODAL;
fieldName = "";
componentName = "";
} }
RigFemResultAddress(RigFemResultPosEnum resPosType, RigFemResultAddress(RigFemResultPosEnum resPosType,
@@ -41,11 +43,11 @@ public:
const std::string& aComponentName, const std::string& aComponentName,
int timeLapseBaseFrameIdx = NO_TIME_LAPSE, int timeLapseBaseFrameIdx = NO_TIME_LAPSE,
int refKLayerIndex = NO_COMPACTION) int refKLayerIndex = NO_COMPACTION)
: resultPosType(resPosType), : resultPosType(resPosType)
fieldName(aFieldName), , fieldName(aFieldName)
componentName(aComponentName), , componentName(aComponentName)
timeLapseBaseFrameIdx(timeLapseBaseFrameIdx), , timeLapseBaseFrameIdx(timeLapseBaseFrameIdx)
refKLayerIndex(refKLayerIndex) , refKLayerIndex(refKLayerIndex)
{ {
} }

View File

@@ -230,8 +230,8 @@ const QString RivWellFracturePartMgr::resultInfoText(const RimEclipseView& activ
else if (stimPlanTemplate) else if (stimPlanTemplate)
{ {
const RigFractureCell* cell = getFractureCellAtDomainCoord(domainIntersectionPoint); const RigFractureCell* cell = getFractureCellAtDomainCoord(domainIntersectionPoint);
RimStimPlanColors* stimPlanColors = activeView.fractureColors(); if (cell)
{
QString resultNameFromColors = activeView.fractureColors()->uiResultName(); QString resultNameFromColors = activeView.fractureColors()->uiResultName();
QString resultUnitFromColors = activeView.fractureColors()->unit(); QString resultUnitFromColors = activeView.fractureColors()->unit();
@@ -240,20 +240,25 @@ const QString RivWellFracturePartMgr::resultInfoText(const RimEclipseView& activ
QString resultValueText = QString("%1").arg(resultValue); QString resultValueText = QString("%1").arg(resultValue);
QString iText = cell ? QString::number(cell->getI()) : "-"; QString iText = QString::number(cell->getI());
QString jText = cell ? QString::number(cell->getJ()) : "-"; QString jText = QString::number(cell->getJ());
RimStimPlanColors* stimPlanColors = activeView.fractureColors();
if (stimPlanColors)
{
// Conductivity // Conductivity
text.append("Result value: "); text.append("Result value: ");
QString resultName = stimPlanTemplate->mapUiResultNameToFileResultName(stimPlanColors->uiResultName()); QString resultName = stimPlanTemplate->mapUiResultNameToFileResultName(stimPlanColors->uiResultName());
text.append(resultName + " "); text.append(resultName + " ");
text.append(resultValueText + "\n"); text.append(resultValueText + "\n");
}
// Cell index // Cell index
text.append("Cell Index: "); text.append("Cell Index: ");
text.append(iText + ", " + jText + "\n"); text.append(iText + ", " + jText + "\n");
} }
}
return text; return text;
} }

View File

@@ -221,7 +221,7 @@ std::set<size_t> RimFractureContainmentTools::fracturedCellsTruncatedByFaults(co
// Negative faultThrow disables test on faultThrow // Negative faultThrow disables test on faultThrow
double maximumFaultThrow = -1.0; double maximumFaultThrow = -1.0;
if (fracture && fracture->fractureTemplate()) if (fracture->fractureTemplate() && fracture->fractureTemplate()->fractureContainment())
{ {
maximumFaultThrow = fracture->fractureTemplate()->fractureContainment()->minimumFaultThrow(); maximumFaultThrow = fracture->fractureTemplate()->fractureContainment()->minimumFaultThrow();
} }

View File

@@ -90,6 +90,7 @@ RimWellLogFile::RimWellLogFile()
m_invalidDateMessage.xmlCapability()->disableIO(); m_invalidDateMessage.xmlCapability()->disableIO();
m_wellLogDataFile = nullptr; m_wellLogDataFile = nullptr;
m_lasFileHasValidDate = false;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -51,6 +51,8 @@ RimDerivedEnsembleCase::RimDerivedEnsembleCase() : m_summaryCase1(nullptr), m_su
CAF_PDM_InitObject("Summary Case",":/SummaryCase16x16.png","",""); CAF_PDM_InitObject("Summary Case",":/SummaryCase16x16.png","","");
CAF_PDM_InitFieldNoDefault(&m_summaryCase1, "SummaryCase1", "SummaryCase1", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_summaryCase1, "SummaryCase1", "SummaryCase1", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_summaryCase2, "SummaryCase2", "SummaryCase2", "", "", ""); CAF_PDM_InitFieldNoDefault(&m_summaryCase2, "SummaryCase2", "SummaryCase2", "", "", "");
m_inUse = false;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -71,7 +71,5 @@ private:
caf::PdmField<bool> m_showCurveLabels; caf::PdmField<bool> m_showCurveLabels;
caf::PdmField<cvf::Color3f> m_color; caf::PdmField<cvf::Color3f> m_color;
RimSummaryCaseCollection* m_ensemble;
}; };

View File

@@ -148,19 +148,16 @@ QString RimSummaryCurveAutoName::curveNameX(const RifEclipseSummaryAddress& summ
if (summaryCurve && summaryCurve->summaryCaseX()) if (summaryCurve && summaryCurve->summaryCaseX())
{ {
QString caseName = summaryCurve->summaryCaseX()->caseName();
bool skipSubString = nameHelper && nameHelper->isCaseInTitle(); bool skipSubString = nameHelper && nameHelper->isCaseInTitle();
if (m_caseName && !skipSubString) if (m_caseName && !skipSubString)
{ {
if (summaryCurve && summaryCurve->summaryCaseX()) QString caseName = summaryCurve->summaryCaseX()->caseName();
{
if (!text.empty()) text += ", "; if (!text.empty()) text += ", ";
text += caseName.toStdString(); text += caseName.toStdString();
} }
} }
}
return QString::fromStdString(text); return QString::fromStdString(text);
} }

View File

@@ -23,7 +23,14 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigCompletionDataGridCell::RigCompletionDataGridCell() {} RigCompletionDataGridCell::RigCompletionDataGridCell()
: m_globalCellIndex(0)
, m_lgrName("")
, m_localCellIndexI(0)
, m_localCellIndexJ(0)
, m_localCellIndexK(0)
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///

View File

@@ -20,6 +20,8 @@
#include "RigCaseCellResultsData.h" #include "RigCaseCellResultsData.h"
#include "RiaLogging.h"
#include "RigEclipseCaseData.h" #include "RigEclipseCaseData.h"
#include "RigEclipseMultiPropertyStatCalc.h" #include "RigEclipseMultiPropertyStatCalc.h"
#include "RigEclipseNativeStatCalc.h" #include "RigEclipseNativeStatCalc.h"
@@ -2321,11 +2323,15 @@ void RigCaseCellResultsData::computeMobilePV()
const std::vector<double>* multpvResults = nullptr; const std::vector<double>* multpvResults = nullptr;
porvResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "PORV", porvDataTemp); porvResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "PORV", porvDataTemp);
if (!porvResults || porvResults->empty())
{
RiaLogging::error("Assumed PORV, but not data was found.");
return;
}
swcrResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "SWCR", swcrDataTemp); swcrResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "SWCR", swcrDataTemp);
multpvResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "MULTPV", multpvDataTemp); multpvResults = RigCaseCellResultsData::getResultIndexableStaticResult(this->activeCellInfo(), this, "MULTPV", multpvDataTemp);
CVF_ASSERT(!porvResults->empty());
size_t mobPVIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName(), false); size_t mobPVIdx = this->findOrCreateScalarResultIndex(RiaDefines::STATIC_NATIVE, RiaDefines::mobilePoreVolumeName(), false);
std::vector<double> &mobPVResults = this->cellScalarResults(mobPVIdx)[0]; std::vector<double> &mobPVResults = this->cellScalarResults(mobPVIdx)[0];
@@ -2333,18 +2339,21 @@ void RigCaseCellResultsData::computeMobilePV()
// Set up output container to correct number of results // Set up output container to correct number of results
mobPVResults.resize(porvResults->size()); mobPVResults.resize(porvResults->size());
if (!(multpvResults || swcrResults)) if (multpvResults && swcrResults)
{ {
mobPVResults.assign(porvResults->begin(), porvResults->end()); for (size_t vIdx = 0; vIdx < porvResults->size(); ++vIdx)
{
mobPVResults[vIdx] = (*multpvResults)[vIdx] * (*porvResults)[vIdx] * (1.0 - (*swcrResults)[vIdx]);
} }
else if (!multpvResults) }
else if (!multpvResults && swcrResults)
{ {
for (size_t vIdx = 0; vIdx < porvResults->size(); ++vIdx) for (size_t vIdx = 0; vIdx < porvResults->size(); ++vIdx)
{ {
mobPVResults[vIdx] = (*porvResults)[vIdx] * (1.0 - (*swcrResults)[vIdx]); mobPVResults[vIdx] = (*porvResults)[vIdx] * (1.0 - (*swcrResults)[vIdx]);
} }
} }
else if (!swcrResults) else if (!swcrResults && multpvResults)
{ {
for (size_t vIdx = 0; vIdx < porvResults->size(); ++vIdx) for (size_t vIdx = 0; vIdx < porvResults->size(); ++vIdx)
{ {
@@ -2353,10 +2362,7 @@ void RigCaseCellResultsData::computeMobilePV()
} }
else else
{ {
for (size_t vIdx = 0; vIdx < porvResults->size(); ++vIdx) mobPVResults.assign(porvResults->begin(), porvResults->end());
{
mobPVResults[vIdx] = (*multpvResults)[vIdx] * (*porvResults)[vIdx] * (1.0 - (*swcrResults)[vIdx]);
}
} }
} }

View File

@@ -511,16 +511,17 @@ bool RigFlowDiagSolverInterface::ensureStaticDataObjectInstanceCreated()
if (initFileName.empty()) return false; if (initFileName.empty()) return false;
const RigEclipseCaseData* eclipseCaseData = m_eclipseCase->eclipseCaseData(); const RigEclipseCaseData* eclipseCaseData = m_eclipseCase->eclipseCaseData();
if (eclipseCaseData)
{
if (eclipseCaseData->hasFractureResults()) if (eclipseCaseData->hasFractureResults())
{ {
return false; return false;
} }
RiaEclipseUnitTools::UnitSystem caseUnitSystem = eclipseCaseData ? eclipseCaseData->unitsType() : RiaEclipseUnitTools::UNITS_UNKNOWN; RiaEclipseUnitTools::UnitSystem caseUnitSystem = eclipseCaseData->unitsType();
m_opmFlowDiagStaticData = new RigOpmFlowDiagStaticData(gridFileName.toStdString(), initFileName, caseUnitSystem); m_opmFlowDiagStaticData = new RigOpmFlowDiagStaticData(gridFileName.toStdString(), initFileName, caseUnitSystem);
} }
}
return m_opmFlowDiagStaticData.notNull() ? true : false; return m_opmFlowDiagStaticData.notNull() ? true : false;
} }

View File

@@ -66,11 +66,6 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createFromNameAndType(cons
const QString& uiResultName, const QString& uiResultName,
RiaDefines::ResultCatType resultType) RiaDefines::ResultCatType resultType)
{ {
CVF_ASSERT(gridIndex < eclipseCase->gridCount());
CVF_ASSERT(eclipseCase);
CVF_ASSERT(eclipseCase->results(porosityModel));
CVF_ASSERT(eclipseCase->activeCellInfo(porosityModel));
if (!eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel)) if (!eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel))
{ {
return nullptr; return nullptr;
@@ -148,11 +143,6 @@ cvf::ref<RigResultAccessor> RigResultAccessorFactory::createNativeFromUiResultNa
size_t timeStepIndex, size_t timeStepIndex,
const QString& uiResultName) const QString& uiResultName)
{ {
CVF_ASSERT(gridIndex < eclipseCase->gridCount());
CVF_ASSERT(eclipseCase);
CVF_ASSERT(eclipseCase->results(porosityModel));
CVF_ASSERT(eclipseCase->activeCellInfo(porosityModel));
if (!eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel)) if (!eclipseCase || !eclipseCase->results(porosityModel) || !eclipseCase->activeCellInfo(porosityModel))
{ {
return nullptr; return nullptr;

View File

@@ -44,8 +44,11 @@ const double RigStimPlanFractureDefinition::THRESHOLD_VALUE = 1e-5;
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RigStimPlanFractureDefinition::RigStimPlanFractureDefinition() : RigStimPlanFractureDefinition::RigStimPlanFractureDefinition()
m_unitSet(RiaEclipseUnitTools::UNITS_UNKNOWN), m_topPerfTvd(HUGE_VAL), m_bottomPerfTvd(HUGE_VAL) : m_unitSet(RiaEclipseUnitTools::UNITS_UNKNOWN)
, m_topPerfTvd(HUGE_VAL)
, m_bottomPerfTvd(HUGE_VAL)
, m_xMirrorMode(false)
{ {
} }

View File

@@ -77,11 +77,13 @@ RimMdiWindowGeometry RiuMdiSubWindow::windowGeometryForWidget(QWidget* widget)
{ {
RimMdiWindowGeometry geo; RimMdiWindowGeometry geo;
if (widget)
{
// Find topmost parent // Find topmost parent
QWidget* nextParent = widget->parentWidget(); QWidget* nextParent = widget->parentWidget();
QWidget* parent = nullptr; QWidget* parent = nullptr;
while(nextParent) while (nextParent)
{ {
parent = nextParent; parent = nextParent;
nextParent = nextParent->parentWidget(); nextParent = nextParent->parentWidget();
@@ -96,8 +98,6 @@ RimMdiWindowGeometry RiuMdiSubWindow::windowGeometryForWidget(QWidget* widget)
} }
} }
if (widget)
{
geo.mainWindowID = mainWinID; geo.mainWindowID = mainWinID;
geo.x = widget->pos().x(); geo.x = widget->pos().x();
geo.y = widget->pos().y(); geo.y = widget->pos().y();

View File

@@ -325,9 +325,18 @@ void RiuSelectionChangedHandler::updateResultInfo(const RiuSelectionItem* itemAd
if (selItem->type() == RiuSelectionItem::INTERSECTION_SELECTION_OBJECT) if (selItem->type() == RiuSelectionItem::INTERSECTION_SELECTION_OBJECT)
{ {
const Riu2dIntersectionSelectionItem* wrapperSelItem = dynamic_cast<Riu2dIntersectionSelectionItem*>(selItem); const Riu2dIntersectionSelectionItem* wrapperSelItem = dynamic_cast<Riu2dIntersectionSelectionItem*>(selItem);
if (wrapperSelItem)
{
intersectionView = wrapperSelItem->view(); intersectionView = wrapperSelItem->view();
if (wrapperSelItem && wrapperSelItem->eclipseSelectionItem()) selItem = wrapperSelItem->eclipseSelectionItem(); if (wrapperSelItem->eclipseSelectionItem())
else if (wrapperSelItem && wrapperSelItem->geoMechSelectionItem()) selItem = wrapperSelItem->geoMechSelectionItem(); {
selItem = wrapperSelItem->eclipseSelectionItem();
}
else if (wrapperSelItem->geoMechSelectionItem())
{
selItem = wrapperSelItem->geoMechSelectionItem();
}
}
} }
if (selItem->type() == RiuSelectionItem::ECLIPSE_SELECTION_OBJECT) if (selItem->type() == RiuSelectionItem::ECLIPSE_SELECTION_OBJECT)

View File

@@ -491,19 +491,22 @@ void RiuSummaryQwtPlot::selectClosestCurve(const QPoint& pos)
} }
} }
if(closestCurve && distMin < 20) if (closestCurve && distMin < 20)
{ {
caf::PdmObject* selectedPlotObject = m_plotDefinition->findRimPlotObjectFromQwtCurve(closestCurve); caf::PdmObject* selectedPlotObject = m_plotDefinition->findRimPlotObjectFromQwtCurve(closestCurve);
if (selectedPlotObject)
{
RimProject* proj = nullptr; RimProject* proj = nullptr;
selectedPlotObject->firstAncestorOrThisOfType(proj); selectedPlotObject->firstAncestorOrThisOfType(proj);
if(proj && selectedPlotObject) if (proj)
{ {
RiuPlotMainWindowTools::showPlotMainWindow(); RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::selectAsCurrentItem(selectedPlotObject); RiuPlotMainWindowTools::selectAsCurrentItem(selectedPlotObject);
} }
} }
}
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------