mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge branch 'dev' of https://github.com/OPM/ResInsight.git
This commit is contained in:
commit
39ff269e5f
@ -19,12 +19,26 @@
|
||||
#include "RicExportMultipleSnapshotsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RicSnapshotViewToClipboardFeature.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimCellRangeFilter.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimMultiSnapshotDefinition.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimView.h"
|
||||
|
||||
#include "RiuExportMultipleSnapshotsWidget.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafCmdExecCommandManager.h"
|
||||
#include "cafFrameAnimationControl.h"
|
||||
#include "cafUtils.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicExportMultipleSnapshotsFeature, "RicExportMultipleSnapshotsFeature");
|
||||
@ -66,3 +80,109 @@ void RicExportMultipleSnapshotsFeature::setupActionLook(QAction* actionToSetup)
|
||||
//actionToSetup->setIcon(QIcon(":/Save.png"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportMultipleSnapshotsFeature::exportMultipleSnapshots(const QString& folder, RimProject* project)
|
||||
{
|
||||
if (!project) return;
|
||||
|
||||
QDir snapshotPath(folder);
|
||||
if (!snapshotPath.exists())
|
||||
{
|
||||
if (!snapshotPath.mkpath(".")) return;
|
||||
}
|
||||
|
||||
RimView* activeView = nullptr;
|
||||
|
||||
QStringList timeSteps;
|
||||
QString timeStepString;
|
||||
QString rangeFilterString;
|
||||
|
||||
for (RimMultiSnapshotDefinition* msd : project->multiSnapshotDefinitions())
|
||||
{
|
||||
RimView* rimView = msd->viewObject();
|
||||
{
|
||||
if (rimView && rimView->viewer())
|
||||
{
|
||||
RimCase* rimCase = rimView->ownerCase();
|
||||
if (!rimCase) continue;
|
||||
|
||||
timeSteps = rimCase->timeStepStrings();
|
||||
|
||||
RiuViewer* viewer = rimView->viewer();
|
||||
int initialFramIndex = viewer->currentFrameIndex();
|
||||
|
||||
for (int i = msd->timeStepStart(); i <= msd->timeStepEnd(); i++)
|
||||
{
|
||||
QString timeStepIndexString = QString("%1").arg(i, 2, 10, QLatin1Char('0'));
|
||||
|
||||
timeStepString = timeStepIndexString + "_" + timeSteps[i].replace(".", "-");
|
||||
|
||||
viewer->setCurrentFrame(i);
|
||||
viewer->animationControl()->setCurrentFrameOnly(i);
|
||||
|
||||
if (msd->sliceDirection == RimMultiSnapshotDefinition::NO_RANGEFILTER)
|
||||
{
|
||||
QString fileName = rimCase->caseUserDescription() + "_" + rimView->name() + "_" + timeStepString;
|
||||
fileName.replace(" ", "-");
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName(folder, fileName, ".png");
|
||||
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, rimView);
|
||||
}
|
||||
else
|
||||
{
|
||||
RimCellRangeFilter* rangeFilter = new RimCellRangeFilter;
|
||||
rimView->rangeFilterCollection()->rangeFilters.push_back(rangeFilter);
|
||||
|
||||
bool rangeFilterInitState = rimView->rangeFilterCollection()->isActive();
|
||||
rimView->rangeFilterCollection()->isActive = true;
|
||||
|
||||
for (int i = msd->startSliceIndex(); i <= msd->endSliceIndex(); i++)
|
||||
{
|
||||
rangeFilterString = msd->sliceDirection().text() + "-" + QString::number(i);
|
||||
QString fileName = rimCase->caseUserDescription() + "_" + rimView->name() + "_" + timeStepString + "_" + rangeFilterString;
|
||||
fileName.replace(" ", "-");
|
||||
|
||||
rangeFilter->setDefaultValues();
|
||||
if (msd->sliceDirection == RimMultiSnapshotDefinition::RANGEFILTER_I)
|
||||
{
|
||||
rangeFilter->cellCountI = 1;
|
||||
rangeFilter->startIndexI = i;
|
||||
}
|
||||
else if (msd->sliceDirection == RimMultiSnapshotDefinition::RANGEFILTER_J)
|
||||
{
|
||||
rangeFilter->cellCountJ = 1;
|
||||
rangeFilter->startIndexJ = i;
|
||||
}
|
||||
else if (msd->sliceDirection == RimMultiSnapshotDefinition::RANGEFILTER_K)
|
||||
{
|
||||
rangeFilter->cellCountK = 1;
|
||||
rangeFilter->startIndexK = i;
|
||||
}
|
||||
|
||||
rimView->rangeFilterCollection()->updateDisplayModeNotifyManagedViews(rangeFilter);
|
||||
// Make sure the redraw is processed
|
||||
QCoreApplication::instance()->processEvents();
|
||||
|
||||
QString absoluteFileName = caf::Utils::constructFullFileName(folder, fileName, ".png");
|
||||
RicSnapshotViewToFileFeature::saveSnapshotAs(absoluteFileName, rimView);
|
||||
}
|
||||
|
||||
rimView->rangeFilterCollection()->rangeFilters.removeChildObject(rangeFilter);
|
||||
delete rangeFilter;
|
||||
|
||||
rimView->rangeFilterCollection()->isActive = rangeFilterInitState;
|
||||
rimView->scheduleCreateDisplayModelAndRedraw();
|
||||
QCoreApplication::instance()->processEvents();
|
||||
}
|
||||
}
|
||||
|
||||
viewer->setCurrentFrame(initialFramIndex);
|
||||
viewer->animationControl()->setCurrentFrameOnly(initialFramIndex);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
class RimProject;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@ -32,5 +33,8 @@ protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
public:
|
||||
static void exportMultipleSnapshots(const QString& folder, RimProject* project);
|
||||
};
|
||||
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "RigLasFileExporter.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
|
||||
#include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
@ -39,7 +41,7 @@ CAF_CMD_SOURCE_INIT(RicExportToLasFileFeature, "RicExportToLasFileFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicExportToLasFileFeature::isCommandEnabled()
|
||||
{
|
||||
return selectedWellLogCurves().size() > 0;
|
||||
return RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves().size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -47,7 +49,7 @@ bool RicExportToLasFileFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicExportToLasFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellLogCurve*> curves = selectedWellLogCurves();
|
||||
std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves();
|
||||
if (curves.size() == 0) return;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
@ -103,39 +105,3 @@ void RicExportToLasFileFeature::setupActionLook(QAction* actionToSetup)
|
||||
actionToSetup->setText("Export To LAS Files...");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogCurve*> RicExportToLasFileFeature::selectedWellLogCurves() const
|
||||
{
|
||||
std::set<RimWellLogCurve*> curveSet;
|
||||
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems(selectedItems);
|
||||
|
||||
for (auto selectedItem : selectedItems)
|
||||
{
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(selectedItem);
|
||||
if (objHandle)
|
||||
{
|
||||
std::vector<RimWellLogCurve*> childCurves;
|
||||
objHandle->descendantsIncludingThisOfType(childCurves);
|
||||
|
||||
for (auto curve : childCurves)
|
||||
{
|
||||
curveSet.insert(curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellLogCurve*> allCurves;
|
||||
for (auto curve : curveSet)
|
||||
{
|
||||
allCurves.push_back(curve);
|
||||
}
|
||||
|
||||
return allCurves;
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,5 @@ protected:
|
||||
virtual bool isCommandEnabled();
|
||||
virtual void onActionTriggered( bool isChecked );
|
||||
virtual void setupActionLook( QAction* actionToSetup );
|
||||
|
||||
private:
|
||||
std::vector<RimWellLogCurve*> selectedWellLogCurves() const;
|
||||
};
|
||||
|
||||
|
@ -18,6 +18,8 @@ ${CEE_CURRENT_LIST_DIR}RicWellLogPlotTrackFeatureImpl.h
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteWellLogCurveFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteWellLogTrackFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteWellLogPlotFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.h
|
||||
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -34,6 +36,8 @@ ${CEE_CURRENT_LIST_DIR}RicWellLogPlotTrackFeatureImpl.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteWellLogCurveFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteWellLogTrackFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicPasteWellLogPlotFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeature.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RicChangeDataSourceFeatureUi.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
@ -0,0 +1,98 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 Statoil ASA
|
||||
//
|
||||
// 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 "RicChangeDataSourceFeature.h"
|
||||
|
||||
#include "RicChangeDataSourceFeatureUi.h"
|
||||
#include "RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimWellLogCurve.h"
|
||||
#include "RimWellLogExtractionCurve.h"
|
||||
#include "RimWellPath.h"
|
||||
|
||||
#include "cafPdmUiPropertyViewDialog.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicChangeDataSourceFeature, "RicChangeDataSourceFeature");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicChangeDataSourceFeature::isCommandEnabled()
|
||||
{
|
||||
std::vector<RimWellLogExtractionCurve*> extrCurves = extractionCurves();
|
||||
|
||||
return extrCurves.size() > 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicChangeDataSourceFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
std::vector<RimWellLogExtractionCurve*> extrCurves = extractionCurves();
|
||||
if (extrCurves.size() == 0) return;
|
||||
|
||||
RicChangeDataSourceFeatureUi featureUi;
|
||||
featureUi.wellPathToApply = extrCurves[0]->wellPath();
|
||||
featureUi.caseToApply = extrCurves[0]->rimCase();
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(nullptr, &featureUi, "Change Data Source for Selected Curves", "");
|
||||
propertyDialog.resize(QSize(500, 200));
|
||||
if (propertyDialog.exec() == QDialog::Accepted)
|
||||
{
|
||||
for (RimWellLogExtractionCurve* extractionCurve : extrCurves)
|
||||
{
|
||||
extractionCurve->setWellPath(featureUi.wellPathToApply);
|
||||
extractionCurve->setCase(featureUi.caseToApply);
|
||||
|
||||
extractionCurve->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicChangeDataSourceFeature::setupActionLook(QAction* actionToSetup)
|
||||
{
|
||||
actionToSetup->setText("Change Data Source");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogExtractionCurve*> RicChangeDataSourceFeature::extractionCurves()
|
||||
{
|
||||
std::vector<RimWellLogExtractionCurve*> extrCurves;
|
||||
|
||||
std::vector<RimWellLogCurve*> curves = RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves();
|
||||
|
||||
for (RimWellLogCurve* c : curves)
|
||||
{
|
||||
if (dynamic_cast<RimWellLogExtractionCurve*>(c))
|
||||
{
|
||||
extrCurves.push_back(dynamic_cast<RimWellLogExtractionCurve*>(c));
|
||||
}
|
||||
}
|
||||
|
||||
return extrCurves;
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 Statoil ASA
|
||||
//
|
||||
// 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"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class RimWellLogExtractionCurve;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicChangeDataSourceFeature : public caf::CmdFeature
|
||||
{
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
protected:
|
||||
virtual bool isCommandEnabled() override;
|
||||
virtual void onActionTriggered( bool isChecked ) override;
|
||||
virtual void setupActionLook(QAction* actionToSetup) override;
|
||||
|
||||
private:
|
||||
static std::vector<RimWellLogExtractionCurve*> extractionCurves();
|
||||
};
|
@ -0,0 +1,87 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 Statoil ASA
|
||||
//
|
||||
// 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 "RicChangeDataSourceFeatureUi.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimOilField.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimWellPath.h"
|
||||
#include "RimWellPathCollection.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicChangeDataSourceFeatureUi, "ChangeDataSourceFeatureUi");
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicChangeDataSourceFeatureUi::RicChangeDataSourceFeatureUi()
|
||||
{
|
||||
CAF_PDM_InitObject("Change Data Source", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&wellPathToApply, "CurveWellPath", "Well Path", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&caseToApply, "CurveCase", "Case", "", "", "");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QList<caf::PdmOptionItemInfo> RicChangeDataSourceFeatureUi::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly)
|
||||
{
|
||||
QList<caf::PdmOptionItemInfo> optionList;
|
||||
|
||||
if (fieldNeedingOptions == &caseToApply)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases(cases);
|
||||
|
||||
for (RimCase* c : cases)
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c));
|
||||
}
|
||||
}
|
||||
else if (fieldNeedingOptions == &wellPathToApply)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
if (proj->activeOilField()->wellPathCollection())
|
||||
{
|
||||
for (RimWellPath* wellPath : proj->activeOilField()->wellPathCollection()->wellPaths)
|
||||
{
|
||||
optionList.push_back(caf::PdmOptionItemInfo(wellPath->name(), wellPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return optionList;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicChangeDataSourceFeatureUi::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Apply the following for all selected curves");
|
||||
|
||||
group->add(&caseToApply);
|
||||
group->add(&wellPathToApply);
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2016 Statoil ASA
|
||||
//
|
||||
// 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 "cafPdmPtrField.h"
|
||||
#include "cafPdmUiOrdering.h"
|
||||
|
||||
class RimCase;
|
||||
class RimWellPath;
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicChangeDataSourceFeatureUi : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RicChangeDataSourceFeatureUi();
|
||||
|
||||
caf::PdmPtrField<RimCase*> caseToApply;
|
||||
caf::PdmPtrField<RimWellPath*> wellPathToApply;
|
||||
|
||||
protected:
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override;
|
||||
};
|
@ -19,6 +19,10 @@
|
||||
|
||||
#include "RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RimWellLogCurve.h"
|
||||
|
||||
#include "cafSelectionManager.h"
|
||||
|
||||
#include <QColor>
|
||||
|
||||
static const int RI_LOGPLOT_CURVECOLORSCOUNT = 15;
|
||||
@ -52,3 +56,39 @@ cvf::Color3f RicWellLogPlotCurveFeatureImpl::curveColorFromTable()
|
||||
cvf::Color3f cvfColor(color.redF(), color.greenF(), color.blueF());
|
||||
return cvfColor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<RimWellLogCurve*> RicWellLogPlotCurveFeatureImpl::selectedWellLogCurves()
|
||||
{
|
||||
std::set<RimWellLogCurve*> curveSet;
|
||||
|
||||
{
|
||||
std::vector<caf::PdmUiItem*> selectedItems;
|
||||
caf::SelectionManager::instance()->selectedItems(selectedItems);
|
||||
|
||||
for (caf::PdmUiItem* selectedItem : selectedItems)
|
||||
{
|
||||
caf::PdmObjectHandle* objHandle = dynamic_cast<caf::PdmObjectHandle*>(selectedItem);
|
||||
if (objHandle)
|
||||
{
|
||||
std::vector<RimWellLogCurve*> childCurves;
|
||||
objHandle->descendantsIncludingThisOfType(childCurves);
|
||||
|
||||
for (RimWellLogCurve* curve : childCurves)
|
||||
{
|
||||
curveSet.insert(curve);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<RimWellLogCurve*> allCurves;
|
||||
for (RimWellLogCurve* curve : curveSet)
|
||||
{
|
||||
allCurves.push_back(curve);
|
||||
}
|
||||
|
||||
return allCurves;
|
||||
}
|
||||
|
@ -21,12 +21,14 @@
|
||||
|
||||
#include "cafPdmFieldCvfColor.h"
|
||||
|
||||
class RimWellLogCurve;
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
//==================================================================================================
|
||||
class RicWellLogPlotCurveFeatureImpl
|
||||
{
|
||||
|
||||
public:
|
||||
static cvf::Color3f curveColorFromTable();
|
||||
static std::vector<RimWellLogCurve*> selectedWellLogCurves();
|
||||
};
|
||||
|
@ -282,7 +282,7 @@ bool RifEclipseInputFileTools::readDataFromKeyword(ecl_kw_type* eclipseKeywordDa
|
||||
|
||||
bool mathingItemCount = false;
|
||||
{
|
||||
int itemCount = ecl_kw_get_size(eclipseKeywordData);
|
||||
size_t itemCount = static_cast<size_t>(ecl_kw_get_size(eclipseKeywordData));
|
||||
if (itemCount == caseData->mainGrid()->cellCount())
|
||||
{
|
||||
mathingItemCount = true;
|
||||
|
@ -287,16 +287,13 @@ float RigFemPart::characteristicElementSize()
|
||||
{
|
||||
if (m_characteristicElementSize != std::numeric_limits<float>::infinity()) return m_characteristicElementSize;
|
||||
|
||||
// take 100 elements
|
||||
float elmIdxJump = elementCount() / 100.0f;
|
||||
int elmIdxIncrement = elmIdxJump < 1 ? 1: (int) elmIdxJump;
|
||||
int elmsToAverageCount = 0;
|
||||
float sumMaxEdgeLength = 0;
|
||||
for (int elmIdx = 0; elmIdx < elementCount(); elmIdx += elmIdxIncrement)
|
||||
for (int elmIdx = 0; elmIdx < elementCount(); elmIdx++)
|
||||
{
|
||||
RigElementType eType = this->elementType(elmIdx);
|
||||
|
||||
if (eType == HEX8 || eType == HEX8P)
|
||||
if (eType == HEX8P)
|
||||
{
|
||||
const int* elmentConn = this->connectivities(elmIdx);
|
||||
cvf::Vec3f nodePos0 = this->nodes().coordinates[elmentConn[0]];
|
||||
|
@ -393,6 +393,7 @@ QStringList RimContextCommandBuilder::commandsFromSelection()
|
||||
{
|
||||
commandIds << "RicCopyReferencesToClipboardFeature";
|
||||
commandIds << "RicExportToLasFileFeature";
|
||||
commandIds << "RicChangeDataSourceFeature";
|
||||
}
|
||||
else if (dynamic_cast<RimWellLogPlotCollection*>(uiItem))
|
||||
{
|
||||
|
@ -19,7 +19,11 @@
|
||||
#include "RimMultiSnapshotDefinition.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimCellRangeFilterCollection.h"
|
||||
#include "RimProject.h"
|
||||
#include "RimView.h"
|
||||
|
||||
@ -33,6 +37,7 @@ namespace caf
|
||||
addItem(RimMultiSnapshotDefinition::RANGEFILTER_I, "I", "i-direction");
|
||||
addItem(RimMultiSnapshotDefinition::RANGEFILTER_J, "J", "j-direction");
|
||||
addItem(RimMultiSnapshotDefinition::RANGEFILTER_K, "K", "k-direction");
|
||||
addItem(RimMultiSnapshotDefinition::NO_RANGEFILTER, "None", "None");
|
||||
|
||||
setDefault(RimMultiSnapshotDefinition::RANGEFILTER_K);
|
||||
}
|
||||
@ -48,16 +53,15 @@ RimMultiSnapshotDefinition::RimMultiSnapshotDefinition()
|
||||
//CAF_PDM_InitObject("MultiSnapshotDefinition", ":/Well.png", "", "");
|
||||
CAF_PDM_InitObject("MultiSnapshotDefinition", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&caseObject, "Case", "Case", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&viewObject, "View", "View", "", "", "");
|
||||
CAF_PDM_InitField(&timeStepStart, "TimeStepStart", 0, "Timestep Start", "", "", "");
|
||||
CAF_PDM_InitField(&timeStepEnd, "TimeStepEnd", 0, "Timestep End", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(RANGEFILTER_K), "Range Filter direction", "", "", "");
|
||||
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 0, "RangeFilter Start", "", "", "");
|
||||
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 0, "RangeFilter End", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&sliceDirection, "SnapShotDirection", caf::AppEnum<SnapShotDirectionEnum>(NO_RANGEFILTER), "Range Filter direction", "", "", "");
|
||||
CAF_PDM_InitField(&startSliceIndex, "RangeFilterStart", 1, "RangeFilter Start", "", "", "");
|
||||
CAF_PDM_InitField(&endSliceIndex, "RangeFilterEnd", 1, "RangeFilter End", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&additionalCases, "AdditionalCases", "Additional Cases", "", "", "");
|
||||
}
|
||||
|
||||
|
||||
@ -77,41 +81,50 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
|
||||
if (fieldNeedingOptions == &caseObject && proj)
|
||||
if (fieldNeedingOptions == &viewObject)
|
||||
{
|
||||
std::vector<RimView*> views;
|
||||
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases(cases);
|
||||
|
||||
for (RimCase* c : cases)
|
||||
for (RimCase* rimCase : cases)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(c))));
|
||||
}
|
||||
|
||||
//options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(nullptr))));
|
||||
}
|
||||
else if (fieldNeedingOptions == &viewObject)
|
||||
{
|
||||
if (caseObject())
|
||||
{
|
||||
std::vector<RimView*> views = caseObject()->views();
|
||||
for (RimView* view : views)
|
||||
for (RimView* rimView : rimCase->views())
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(view->name(), QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(view))));
|
||||
views.push_back(rimView);
|
||||
}
|
||||
}
|
||||
|
||||
//options.push_back(caf::PdmOptionItemInfo("All", QVariant::fromValue(caf::PdmPointer<caf::PdmObjectHandle>(nullptr))));
|
||||
for (RimView* view : views)
|
||||
{
|
||||
QString caseAndView = view->ownerCase()->caseUserDescription() + " - " + view->name();
|
||||
options.push_back(caf::PdmOptionItemInfo(caseAndView, view));
|
||||
}
|
||||
options.push_back(caf::PdmOptionItemInfo("-- All views --", nullptr));
|
||||
}
|
||||
else if (fieldNeedingOptions == &timeStepEnd)
|
||||
{
|
||||
getTimeStepStrings(options);
|
||||
|
||||
}
|
||||
else if (fieldNeedingOptions == &timeStepStart)
|
||||
{
|
||||
getTimeStepStrings(options);
|
||||
}
|
||||
else if (fieldNeedingOptions == &additionalCases)
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases(cases);
|
||||
|
||||
for (RimCase* rimCase : cases)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(rimCase->caseUserDescription(), rimCase));
|
||||
}
|
||||
|
||||
if (useOptionsOnly) *useOptionsOnly = true;
|
||||
}
|
||||
|
||||
return options;
|
||||
}
|
||||
@ -121,13 +134,72 @@ QList<caf::PdmOptionItemInfo> RimMultiSnapshotDefinition::calculateValueOptions(
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiSnapshotDefinition::getTimeStepStrings(QList<caf::PdmOptionItemInfo> &options)
|
||||
{
|
||||
if (!caseObject()) return;
|
||||
|
||||
QStringList timeSteps = caseObject()->timeStepStrings();
|
||||
QStringList timeSteps;
|
||||
|
||||
timeSteps = viewObject->ownerCase()->timeStepStrings();
|
||||
|
||||
for (int i = 0; i < timeSteps.size(); i++)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(timeSteps[i], i));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimMultiSnapshotDefinition::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
|
||||
if (changedField == &sliceDirection)
|
||||
{
|
||||
const cvf::StructGridInterface* mainGrid = nullptr;
|
||||
RigActiveCellInfo* actCellInfo = nullptr;
|
||||
|
||||
if (viewObject())
|
||||
{
|
||||
mainGrid = viewObject()->rangeFilterCollection()->gridByIndex(0);
|
||||
actCellInfo = viewObject()->rangeFilterCollection()->activeCellInfo();
|
||||
}
|
||||
|
||||
if (mainGrid && actCellInfo)
|
||||
{
|
||||
cvf::Vec3st min, max;
|
||||
actCellInfo->IJKBoundingBox(min, max);
|
||||
|
||||
// Adjust to Eclipse indexing
|
||||
min.x() = min.x() + 1;
|
||||
min.y() = min.y() + 1;
|
||||
min.z() = min.z() + 1;
|
||||
|
||||
max.x() = max.x() + 1;
|
||||
max.y() = max.y() + 1;
|
||||
max.z() = max.z() + 1;
|
||||
|
||||
int maxInt = 0;
|
||||
int minInt = 0;
|
||||
|
||||
if (newValue == RimMultiSnapshotDefinition::RANGEFILTER_I)
|
||||
{
|
||||
maxInt = static_cast<int>(max.x());
|
||||
minInt = static_cast<int>(min.x());
|
||||
}
|
||||
else if (newValue == RimMultiSnapshotDefinition::RANGEFILTER_J)
|
||||
{
|
||||
maxInt = static_cast<int>(max.y());
|
||||
minInt = static_cast<int>(min.y());
|
||||
}
|
||||
else if (newValue == RimMultiSnapshotDefinition::RANGEFILTER_K)
|
||||
{
|
||||
maxInt = static_cast<int>(max.z());
|
||||
minInt = static_cast<int>(min.z());
|
||||
}
|
||||
|
||||
startSliceIndex = minInt;
|
||||
endSliceIndex = maxInt;
|
||||
|
||||
}
|
||||
|
||||
startSliceIndex.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,10 +18,11 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafPdmPtrArrayField.h"
|
||||
|
||||
class RimCase;
|
||||
class RimView;
|
||||
@ -37,7 +38,6 @@ public:
|
||||
RimMultiSnapshotDefinition();
|
||||
virtual ~RimMultiSnapshotDefinition();
|
||||
|
||||
caf::PdmPtrField<RimCase*> caseObject;
|
||||
caf::PdmPtrField<RimView*> viewObject;
|
||||
|
||||
caf::PdmField<int> timeStepStart;
|
||||
@ -47,16 +47,20 @@ public:
|
||||
{
|
||||
RANGEFILTER_I,
|
||||
RANGEFILTER_J,
|
||||
RANGEFILTER_K
|
||||
RANGEFILTER_K,
|
||||
NO_RANGEFILTER
|
||||
};
|
||||
|
||||
caf::PdmField< caf::AppEnum< SnapShotDirectionEnum > > sliceDirection;
|
||||
caf::PdmField<int> startSliceIndex;
|
||||
caf::PdmField<int> endSliceIndex;
|
||||
|
||||
caf::PdmPtrArrayField<RimCase*> additionalCases;
|
||||
|
||||
|
||||
virtual QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override;
|
||||
|
||||
void getTimeStepStrings(QList<caf::PdmOptionItemInfo> &options);
|
||||
|
||||
|
||||
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override;
|
||||
};
|
||||
|
@ -67,6 +67,7 @@ RimViewController::RimViewController(void)
|
||||
m_managedView.uiCapability()->setUiTreeChildrenHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera", "", "", "");
|
||||
CAF_PDM_InitField(&m_showCursor, "ShowCursor", true, " Show Cursor", "", "", "");
|
||||
CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", "");
|
||||
CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Result", "", "", "");
|
||||
CAF_PDM_InitField(&m_syncLegendDefinitions, "SyncLegendDefinitions", true, " Legend Definition", "", "", "");
|
||||
@ -174,6 +175,13 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|
||||
{
|
||||
updateTimeStepLink();
|
||||
}
|
||||
else if (changedField == &m_showCursor)
|
||||
{
|
||||
if (!m_showCursor && m_managedView && m_managedView->viewer())
|
||||
{
|
||||
m_managedView->viewer()->setCursorPosition(cvf::Vec3d::UNDEFINED);
|
||||
}
|
||||
}
|
||||
else if (changedField == &m_syncCellResult)
|
||||
{
|
||||
updateResultColorsControl();
|
||||
@ -223,7 +231,7 @@ void RimViewController::fieldChangedByUi(const caf::PdmFieldHandle* changedField
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimEclipseView* RimViewController::managedEclipseView()
|
||||
RimEclipseView* RimViewController::managedEclipseView() const
|
||||
{
|
||||
RimView* rimView = m_managedView;
|
||||
|
||||
@ -233,7 +241,7 @@ RimEclipseView* RimViewController::managedEclipseView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGeoMechView* RimViewController::managedGeoView()
|
||||
RimGeoMechView* RimViewController::managedGeoView() const
|
||||
{
|
||||
RimView* rimView = m_managedView;
|
||||
|
||||
@ -418,13 +426,23 @@ void RimViewController::updateOptionSensitivity()
|
||||
this->m_syncRangeFilters = false;
|
||||
}
|
||||
|
||||
if (m_syncCamera)
|
||||
{
|
||||
this->m_showCursor.uiCapability()->setUiReadOnly(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_showCursor.uiCapability()->setUiReadOnly(true);
|
||||
this->m_showCursor = false;
|
||||
}
|
||||
|
||||
m_syncVisibleCells.uiCapability()->setUiReadOnly(!this->isMasterAndDepViewDifferentType());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimView* RimViewController::managedView()
|
||||
RimView* RimViewController::managedView() const
|
||||
{
|
||||
return m_managedView;
|
||||
}
|
||||
@ -455,6 +473,7 @@ void RimViewController::defineUiOrdering(QString uiConfigName, caf::PdmUiOrderin
|
||||
caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup("Link Options");
|
||||
|
||||
scriptGroup->add(&m_syncCamera);
|
||||
scriptGroup->add(&m_showCursor);
|
||||
scriptGroup->add(&m_syncTimeStep);
|
||||
scriptGroup->add(&m_syncCellResult);
|
||||
scriptGroup->add(&m_syncLegendDefinitions);
|
||||
@ -530,7 +549,7 @@ void RimViewController::updateLegendDefinitions()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimViewLinker* RimViewController::ownerViewLinker()
|
||||
RimViewLinker* RimViewController::ownerViewLinker() const
|
||||
{
|
||||
RimViewLinker* viewLinker = NULL;
|
||||
this->firstAncestorOrThisOfType(viewLinker);
|
||||
@ -609,7 +628,7 @@ const RigCaseToCaseCellMapper* RimViewController::cellMapper()
|
||||
}
|
||||
else if (masterFemPart && dependEclGrid)
|
||||
{
|
||||
m_caseToCaseCellMapper = new RigCaseToCaseCellMapper(masterFemPart, dependEclGrid);
|
||||
m_caseToCaseCellMapper = new RigCaseToCaseCellMapper(masterFemPart, dependEclGrid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -619,7 +638,7 @@ const RigCaseToCaseCellMapper* RimViewController::cellMapper()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimView* RimViewController::masterView()
|
||||
RimView* RimViewController::masterView() const
|
||||
{
|
||||
return ownerViewLinker()->masterView();
|
||||
}
|
||||
@ -627,7 +646,7 @@ RimView* RimViewController::masterView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isMasterAndDepViewDifferentType()
|
||||
bool RimViewController::isMasterAndDepViewDifferentType() const
|
||||
{
|
||||
RimEclipseView* eclipseMasterView = dynamic_cast<RimEclipseView*>(masterView());
|
||||
RimGeoMechView* geoMasterView = dynamic_cast<RimGeoMechView*>(masterView());
|
||||
@ -648,7 +667,7 @@ bool RimViewController::isMasterAndDepViewDifferentType()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewController::scheduleCreateDisplayModelAndRedrawForDependentView()
|
||||
void RimViewController::scheduleCreateDisplayModelAndRedrawForDependentView() const
|
||||
{
|
||||
if (!this->isActive()) return;
|
||||
|
||||
@ -668,7 +687,7 @@ void RimViewController::scheduleCreateDisplayModelAndRedrawForDependentView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewController::scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType)
|
||||
void RimViewController::scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType) const
|
||||
{
|
||||
if (!this->isActive()) return;
|
||||
|
||||
@ -693,7 +712,7 @@ void RimViewController::scheduleGeometryRegenForDepViews(RivCellSetEnum geometry
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isActive()
|
||||
bool RimViewController::isActive() const
|
||||
{
|
||||
return ownerViewLinker()->isActive() && this->m_isActive();
|
||||
}
|
||||
@ -701,7 +720,7 @@ bool RimViewController::isActive()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isCameraLinked()
|
||||
bool RimViewController::isCameraLinked() const
|
||||
{
|
||||
if (ownerViewLinker()->isActive() && this->m_isActive())
|
||||
{
|
||||
@ -716,7 +735,15 @@ bool RimViewController::isCameraLinked()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isTimeStepLinked()
|
||||
bool RimViewController::showCursor() const
|
||||
{
|
||||
return m_showCursor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isTimeStepLinked() const
|
||||
{
|
||||
if (ownerViewLinker()->isActive() && this->m_isActive())
|
||||
{
|
||||
@ -731,7 +758,7 @@ bool RimViewController::isTimeStepLinked()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isResultColorControlled()
|
||||
bool RimViewController::isResultColorControlled() const
|
||||
{
|
||||
if (ownerViewLinker()->isActive() && this->m_isActive())
|
||||
{
|
||||
@ -746,7 +773,7 @@ bool RimViewController::isResultColorControlled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isLegendDefinitionsControlled()
|
||||
bool RimViewController::isLegendDefinitionsControlled() const
|
||||
{
|
||||
if (ownerViewLinker()->isActive() && this->m_isActive())
|
||||
{
|
||||
@ -761,7 +788,7 @@ bool RimViewController::isLegendDefinitionsControlled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isVisibleCellsOveridden()
|
||||
bool RimViewController::isVisibleCellsOveridden() const
|
||||
{
|
||||
if (isMasterAndDepViewDifferentType())
|
||||
{
|
||||
@ -783,7 +810,7 @@ bool RimViewController::isVisibleCellsOveridden()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isRangeFilterControlPossible()
|
||||
bool RimViewController::isRangeFilterControlPossible() const
|
||||
{
|
||||
return true;
|
||||
#if 0
|
||||
@ -817,7 +844,7 @@ bool RimViewController::isRangeFilterControlPossible()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isRangeFilterMappingApliccable()
|
||||
bool RimViewController::isRangeFilterMappingApliccable() const
|
||||
{
|
||||
if (!isMasterAndDepViewDifferentType()) return false;
|
||||
|
||||
@ -850,7 +877,7 @@ bool RimViewController::isRangeFilterMappingApliccable()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isRangeFiltersControlled()
|
||||
bool RimViewController::isRangeFiltersControlled() const
|
||||
{
|
||||
if (!isRangeFilterControlPossible()) return false;
|
||||
|
||||
@ -866,7 +893,7 @@ bool RimViewController::isRangeFiltersControlled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isPropertyFilterControlPossible()
|
||||
bool RimViewController::isPropertyFilterControlPossible() const
|
||||
{
|
||||
// The cases need to be the same
|
||||
RimGeoMechView* geomView = dynamic_cast<RimGeoMechView*>(masterView());
|
||||
@ -898,7 +925,7 @@ bool RimViewController::isPropertyFilterControlPossible()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewController::isPropertyFilterOveridden()
|
||||
bool RimViewController::isPropertyFilterOveridden() const
|
||||
{
|
||||
if (!isPropertyFilterControlPossible()) return false;
|
||||
|
||||
|
@ -47,28 +47,29 @@ public:
|
||||
RimViewController(void);
|
||||
virtual ~RimViewController(void);
|
||||
|
||||
bool isActive();
|
||||
bool isActive() const;
|
||||
|
||||
RimView* managedView();
|
||||
RimView* managedView() const;
|
||||
void setManagedView(RimView* view);
|
||||
|
||||
RimView* masterView();
|
||||
RimViewLinker* ownerViewLinker();
|
||||
RimView* masterView() const;
|
||||
RimViewLinker* ownerViewLinker() const;
|
||||
|
||||
const RigCaseToCaseCellMapper* cellMapper();
|
||||
|
||||
bool isCameraLinked();
|
||||
bool isTimeStepLinked();
|
||||
bool isCameraLinked() const;
|
||||
bool showCursor() const;
|
||||
bool isTimeStepLinked() const;
|
||||
|
||||
bool isResultColorControlled();
|
||||
bool isLegendDefinitionsControlled();
|
||||
bool isRangeFiltersControlled();
|
||||
bool isResultColorControlled() const;
|
||||
bool isLegendDefinitionsControlled() const;
|
||||
bool isRangeFiltersControlled() const;
|
||||
|
||||
bool isVisibleCellsOveridden();
|
||||
bool isPropertyFilterOveridden();
|
||||
bool isVisibleCellsOveridden() const;
|
||||
bool isPropertyFilterOveridden() const;
|
||||
|
||||
void scheduleCreateDisplayModelAndRedrawForDependentView();
|
||||
void scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType);
|
||||
void scheduleCreateDisplayModelAndRedrawForDependentView() const;
|
||||
void scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType) const;
|
||||
void updateOverrides();
|
||||
void updateOptionSensitivity();
|
||||
void removeOverrides();
|
||||
@ -93,24 +94,27 @@ private:
|
||||
void updateResultColorsControl();
|
||||
void updateLegendDefinitions();
|
||||
|
||||
bool isMasterAndDepViewDifferentType();
|
||||
bool isRangeFilterControlPossible();
|
||||
bool isPropertyFilterControlPossible();
|
||||
bool isRangeFilterMappingApliccable();
|
||||
bool isMasterAndDepViewDifferentType() const;
|
||||
bool isRangeFilterControlPossible() const;
|
||||
bool isPropertyFilterControlPossible() const;
|
||||
bool isRangeFilterMappingApliccable() const;
|
||||
|
||||
RimEclipseView* managedEclipseView();
|
||||
RimGeoMechView* managedGeoView();
|
||||
RimEclipseView* managedEclipseView() const;
|
||||
RimGeoMechView* managedGeoView() const;
|
||||
|
||||
static void removeOverrides(RimView* view);
|
||||
|
||||
static bool askUserToRestoreOriginalRangeFilterCollection(const QString& viewName);
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_name;
|
||||
caf::PdmPtrField<RimView*> m_managedView;
|
||||
|
||||
caf::PdmField<bool> m_isActive;
|
||||
caf::PdmField<bool> m_syncCamera;
|
||||
caf::PdmField<bool> m_showCursor;
|
||||
caf::PdmField<bool> m_syncTimeStep;
|
||||
|
||||
|
||||
// Overridden properties
|
||||
caf::PdmField<bool> m_syncCellResult;
|
||||
caf::PdmField<bool> m_syncLegendDefinitions;
|
||||
|
@ -245,7 +245,7 @@ void RimViewLinker::removeOverrides()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::allViewsForCameraSync(RimView* source, std::vector<RimView*>& views)
|
||||
void RimViewLinker::allViewsForCameraSync(const RimView* source, std::vector<RimView*>& views) const
|
||||
{
|
||||
if (!isActive()) return;
|
||||
|
||||
@ -320,7 +320,7 @@ void RimViewLinker::setMasterView(RimView* view)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimView* RimViewLinker::masterView()
|
||||
RimView* RimViewLinker::masterView() const
|
||||
{
|
||||
return m_masterView;
|
||||
}
|
||||
@ -328,7 +328,7 @@ RimView* RimViewLinker::masterView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::allViews(std::vector<RimView*>& views)
|
||||
void RimViewLinker::allViews(std::vector<RimView*>& views) const
|
||||
{
|
||||
views.push_back(m_masterView());
|
||||
|
||||
@ -380,7 +380,7 @@ void RimViewLinker::updateScaleZ(RimView* sourceView, double scaleZ)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimViewLinker::isActive()
|
||||
bool RimViewLinker::isActive() const
|
||||
{
|
||||
RimViewLinkerCollection* viewLinkerCollection = NULL;
|
||||
this->firstAncestorOrThisOfType(viewLinkerCollection);
|
||||
@ -480,6 +480,40 @@ void RimViewLinker::findNameAndIconFromView(QString* name, QIcon* icon, RimView*
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::updateCursorPosition(const RimView* sourceView, const cvf::Vec3d& domainCoord)
|
||||
{
|
||||
RimViewController* sourceViewLink = sourceView->viewController();
|
||||
if (sourceViewLink && !sourceViewLink->showCursor())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<RimView*> viewsToUpdate;
|
||||
allViewsForCameraSync(sourceView, viewsToUpdate);
|
||||
|
||||
for (RimView* destinationView : viewsToUpdate)
|
||||
{
|
||||
if (destinationView == sourceView) continue;
|
||||
|
||||
if (destinationView != m_masterView)
|
||||
{
|
||||
RimViewController* viewLink = destinationView->viewController();
|
||||
if (!viewLink) continue;
|
||||
|
||||
if (!viewLink->showCursor()) continue;
|
||||
}
|
||||
|
||||
RiuViewer* destinationViewer = destinationView->viewer();
|
||||
if (destinationViewer)
|
||||
{
|
||||
destinationViewer->setCursorPosition(domainCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -624,18 +658,16 @@ void RimViewLinker::addDependentView(RimView* view)
|
||||
this->m_viewControllers.push_back(viewContr);
|
||||
|
||||
viewContr->setManagedView(view);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimViewLinker::addViewControllers(caf::PdmUiTreeOrdering& uiTreeOrdering)
|
||||
void RimViewLinker::addViewControllers(caf::PdmUiTreeOrdering& uiTreeOrdering) const
|
||||
{
|
||||
for (size_t j = 0; j < m_viewControllers.size(); j++)
|
||||
{
|
||||
uiTreeOrdering.add(m_viewControllers()[j]);
|
||||
uiTreeOrdering.add(m_viewControllers[j]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,9 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
|
||||
#include "cvfBase.h"
|
||||
#include "cvfVector3.h"
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class BoundingBox;
|
||||
@ -50,10 +53,10 @@ public:
|
||||
RimViewLinker(void);
|
||||
virtual ~RimViewLinker(void);
|
||||
|
||||
bool isActive();
|
||||
bool isActive() const;
|
||||
|
||||
void setMasterView(RimView* view);
|
||||
RimView* masterView();
|
||||
RimView* masterView() const;
|
||||
|
||||
void addDependentView(RimView* view);
|
||||
void updateDependentViews();
|
||||
@ -73,15 +76,17 @@ public:
|
||||
void scheduleGeometryRegenForDepViews(RivCellSetEnum geometryType);
|
||||
void scheduleCreateDisplayModelAndRedrawForDependentViews();
|
||||
|
||||
void allViews(std::vector<RimView*>& views);
|
||||
void allViews(std::vector<RimView*>& views) const;
|
||||
|
||||
void updateUiNameAndIcon();
|
||||
|
||||
void addViewControllers(caf::PdmUiTreeOrdering& uiTreeOrdering);
|
||||
void addViewControllers(caf::PdmUiTreeOrdering& uiTreeOrdering) const;
|
||||
|
||||
static void applyIconEnabledState(caf::PdmObject* obj, const QIcon& icon, bool disable);
|
||||
static void findNameAndIconFromView(QString* name, QIcon* icon, RimView* view);
|
||||
|
||||
void updateCursorPosition(const RimView* sourceView, const cvf::Vec3d& domainCoord);
|
||||
|
||||
public:
|
||||
static QString displayNameForView(RimView* view);
|
||||
|
||||
@ -90,7 +95,7 @@ protected:
|
||||
virtual void initAfterRead();
|
||||
|
||||
private:
|
||||
void allViewsForCameraSync(RimView* source, std::vector<RimView*>& views);
|
||||
void allViewsForCameraSync(const RimView* source, std::vector<RimView*>& views) const;
|
||||
|
||||
void removeOverrides();
|
||||
|
||||
|
@ -113,6 +113,30 @@ void RimWellLogExtractionCurve::setWellPath(RimWellPath* wellPath)
|
||||
m_wellPath = wellPath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimWellPath* RimWellLogExtractionCurve::wellPath() const
|
||||
{
|
||||
return m_wellPath;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogExtractionCurve::setCase(RimCase* rimCase)
|
||||
{
|
||||
m_case = rimCase;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCase* RimWellLogExtractionCurve::rimCase() const
|
||||
{
|
||||
return m_case;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -41,8 +41,12 @@ public:
|
||||
RimWellLogExtractionCurve();
|
||||
virtual ~RimWellLogExtractionCurve();
|
||||
|
||||
|
||||
void setWellPath(RimWellPath* wellPath);
|
||||
RimWellPath* wellPath() const;
|
||||
|
||||
void setCase(RimCase* rimCase);
|
||||
RimCase* rimCase() const;
|
||||
|
||||
void setPropertiesFromView(RimView* view);
|
||||
|
||||
virtual QString wellName() const;
|
||||
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include "RicExportMultipleSnapshotsFeature.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimMultiSnapshotDefinition.h"
|
||||
#include "RimProject.h"
|
||||
@ -40,13 +42,14 @@
|
||||
#include <QTableView>
|
||||
#include <QToolButton>
|
||||
#include <QWidget>
|
||||
#include <QHeaderView>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuExportMultipleSnapshotsWidget::RiuExportMultipleSnapshotsWidget(QWidget* parent, RimProject* project)
|
||||
: QDialog(parent),
|
||||
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
m_rimProject(project)
|
||||
{
|
||||
setWindowTitle("Export Multiple Snapshots");
|
||||
@ -66,6 +69,9 @@ RiuExportMultipleSnapshotsWidget::RiuExportMultipleSnapshotsWidget(QWidget* pare
|
||||
|
||||
m_pdmTableView->setListField(&(project->multiSnapshotDefinitions()));
|
||||
|
||||
QHeaderView* verticalHeader = m_pdmTableView->tableView()->verticalHeader();
|
||||
verticalHeader->setResizeMode(QHeaderView::Interactive);
|
||||
|
||||
// Set active child array to be able to use generic delete
|
||||
caf::SelectionManager::instance()->setActiveChildArrayFieldHandle(&(project->multiSnapshotDefinitions()));
|
||||
|
||||
@ -80,13 +86,13 @@ RiuExportMultipleSnapshotsWidget::RiuExportMultipleSnapshotsWidget(QWidget* pare
|
||||
// Save images in snapshot catalog relative to project directory
|
||||
QString snapshotFolderName = RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("snapshots");
|
||||
|
||||
m_lineEdit = new QLineEdit(snapshotFolderName);
|
||||
m_exportFolderLineEdit = new QLineEdit(snapshotFolderName);
|
||||
|
||||
QToolButton* button = new QToolButton;
|
||||
button->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Preferred));
|
||||
button->setText(QLatin1String("..."));
|
||||
|
||||
layout->addWidget(m_lineEdit);
|
||||
layout->addWidget(m_exportFolderLineEdit);
|
||||
layout->addWidget(button);
|
||||
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(folderSelectionClicked()));
|
||||
@ -143,7 +149,6 @@ void RiuExportMultipleSnapshotsWidget::customMenuRequested(QPoint pos)
|
||||
menu.exec(globalPos);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -156,32 +161,29 @@ void RiuExportMultipleSnapshotsWidget::deleteAllSnapshotItems()
|
||||
m_rimProject->multiSnapshotDefinitions.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuExportMultipleSnapshotsWidget::exportSnapshots()
|
||||
{
|
||||
// TODO: wire up call of static method
|
||||
// RicExportMultipleSnapshotsFeature::staticMethod()
|
||||
RicExportMultipleSnapshotsFeature::exportMultipleSnapshots(m_exportFolderLineEdit->text(), m_rimProject);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuExportMultipleSnapshotsWidget::folderSelectionClicked()
|
||||
{
|
||||
QString defaultPath = m_lineEdit->text();
|
||||
QString defaultPath = m_exportFolderLineEdit->text();
|
||||
|
||||
QString directoryPath = QFileDialog::getExistingDirectory(m_lineEdit,
|
||||
QString directoryPath = QFileDialog::getExistingDirectory(m_exportFolderLineEdit,
|
||||
tr("Get existing directory"),
|
||||
defaultPath,
|
||||
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||
|
||||
if (!directoryPath.isEmpty())
|
||||
{
|
||||
m_lineEdit->setText(directoryPath);
|
||||
m_exportFolderLineEdit->setText(directoryPath);
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,54 +196,38 @@ void RiuExportMultipleSnapshotsWidget::addSnapshotItem()
|
||||
|
||||
RimMultiSnapshotDefinition* multiSnapshot = new RimMultiSnapshotDefinition();
|
||||
|
||||
|
||||
//Getting default value from last entered line:
|
||||
if (m_rimProject->multiSnapshotDefinitions.size() > 0)
|
||||
{
|
||||
//Getting default value from last entered line:
|
||||
RimMultiSnapshotDefinition* other = m_rimProject->multiSnapshotDefinitions[m_rimProject->multiSnapshotDefinitions.size() - 1];
|
||||
|
||||
multiSnapshot->caseObject = other->caseObject();
|
||||
multiSnapshot->viewObject = other->viewObject();
|
||||
multiSnapshot->timeStepStart = other->timeStepStart();
|
||||
multiSnapshot->timeStepEnd = other->timeStepEnd();
|
||||
|
||||
|
||||
// Variant using copy based on xml string
|
||||
// QString copyOfOriginalObject = other->writeObjectToXmlString();
|
||||
// multiSnapshot->readObjectFromXmlString(copyOfOriginalObject, caf::PdmDefaultObjectFactory::instance());
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
std::vector<RimCase*> cases;
|
||||
proj->allCases(cases);
|
||||
RimCase* CaseExample = nullptr;
|
||||
RimView* ViewExample = nullptr;
|
||||
|
||||
if (cases.size() > 0)
|
||||
{
|
||||
CaseExample = cases.at(0);
|
||||
multiSnapshot->caseObject = CaseExample;
|
||||
RimCase* caseExample = cases.at(0);
|
||||
|
||||
std::vector<RimView*> viewExamples;
|
||||
viewExamples = CaseExample->views();
|
||||
viewExamples = caseExample->views();
|
||||
|
||||
if (viewExamples.size() > 0)
|
||||
{
|
||||
ViewExample = viewExamples.at(0);
|
||||
multiSnapshot->viewObject = ViewExample;
|
||||
RimView* viewExample = viewExamples.at(0);
|
||||
multiSnapshot->viewObject = viewExample;
|
||||
multiSnapshot->timeStepStart = viewExample->currentTimeStep();
|
||||
multiSnapshot->timeStepEnd = viewExample->currentTimeStep();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
m_rimProject->multiSnapshotDefinitions.push_back(multiSnapshot);
|
||||
m_rimProject->multiSnapshotDefinitions.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
|
@ -47,5 +47,5 @@ private slots:
|
||||
private:
|
||||
RimProject* m_rimProject;
|
||||
caf::PdmUiTableView* m_pdmTableView;
|
||||
QLineEdit* m_lineEdit;
|
||||
QLineEdit* m_exportFolderLineEdit;
|
||||
};
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "cafCategoryLegend.h"
|
||||
#include "cafCeetronPlusNavigation.h"
|
||||
#include "cafDisplayCoordTransform.h"
|
||||
#include "cafEffectGenerator.h"
|
||||
#include "cafFrameAnimationControl.h"
|
||||
|
||||
@ -170,8 +171,9 @@ RiuViewer::RiuViewer(const QGLFormat& format, QWidget* parent)
|
||||
setContextMenuPolicy(Qt::PreventContextMenu);
|
||||
|
||||
m_gridBoxGenerator = new RivGridBoxGenerator;
|
||||
}
|
||||
|
||||
m_cursorPositionDomainCoords = cvf::Vec3d::UNDEFINED;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
@ -408,6 +410,29 @@ void RiuViewer::paintOverlayItems(QPainter* painter)
|
||||
m_versionInfoLabel->render(painter, pos);
|
||||
yPos += size.height() + margin;
|
||||
}
|
||||
|
||||
if (!m_cursorPositionDomainCoords.isUndefined())
|
||||
{
|
||||
if (mainCamera())
|
||||
{
|
||||
cvf::ref<caf::DisplayCoordTransform> trans = m_rimView->displayCoordTransform();
|
||||
|
||||
cvf::Vec3d displayCoord = trans->transformToDisplayCoord(m_cursorPositionDomainCoords);
|
||||
|
||||
cvf::Vec3d screenCoords;
|
||||
if (mainCamera()->project(displayCoord, &screenCoords))
|
||||
{
|
||||
int translatedMousePosY = height() - screenCoords.y();
|
||||
QPoint centerPos(screenCoords.x(), translatedMousePosY);
|
||||
|
||||
// Draw a cross hair marker
|
||||
int markerHalfLength = 6;
|
||||
|
||||
painter->drawLine(centerPos.x(), centerPos.y() - markerHalfLength, centerPos.x(), centerPos.y() + markerHalfLength);
|
||||
painter->drawLine(centerPos.x() - markerHalfLength, centerPos.y(), centerPos.x() + markerHalfLength, centerPos.y());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -658,6 +683,54 @@ void RiuViewer::resizeGL(int width, int height)
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::mouseMoveEvent(QMouseEvent* mouseEvent)
|
||||
{
|
||||
if (m_rimView)
|
||||
{
|
||||
RimViewLinker* viewLinker = m_rimView->assosiatedViewLinker();
|
||||
if (viewLinker)
|
||||
{
|
||||
int translatedMousePosX = mouseEvent->pos().x();
|
||||
int translatedMousePosY = height() - mouseEvent->pos().y();
|
||||
|
||||
cvf::Vec3d displayCoord(0, 0, 0);
|
||||
if (mainCamera()->unproject(cvf::Vec3d(static_cast<double>(translatedMousePosX), static_cast<double>(translatedMousePosY), 0), &displayCoord))
|
||||
{
|
||||
if (m_cursorPositionDomainCoords != cvf::Vec3d::UNDEFINED)
|
||||
{
|
||||
// Reset the extra cursor if the view currently is receiving mouse cursor events
|
||||
// Set undefined and redraw to remove the previously displayed cursor
|
||||
m_cursorPositionDomainCoords = cvf::Vec3d::UNDEFINED;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
cvf::ref<caf::DisplayCoordTransform> trans = m_rimView->displayCoordTransform();
|
||||
cvf::Vec3d domainCoord = trans->transformToDomainCoord(displayCoord);
|
||||
|
||||
viewLinker->updateCursorPosition(m_rimView, domainCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
caf::Viewer::mouseMoveEvent(mouseEvent);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::leaveEvent(QEvent *)
|
||||
{
|
||||
if (m_rimView && m_rimView->assosiatedViewLinker())
|
||||
{
|
||||
RimViewLinker* viewLinker = m_rimView->assosiatedViewLinker();
|
||||
viewLinker->updateCursorPosition(m_rimView, cvf::Vec3d::UNDEFINED);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -755,6 +828,19 @@ void RiuViewer::updateParallelProjectionSettings(RiuViewer* sourceViewer)
|
||||
this->updateParallelProjectionCameraPosFromPointOfInterestMove(poi);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuViewer::setCursorPosition(const cvf::Vec3d& domainCoord)
|
||||
{
|
||||
if (m_cursorPositionDomainCoords != domainCoord)
|
||||
{
|
||||
m_cursorPositionDomainCoords = domainCoord;
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -96,6 +96,8 @@ public:
|
||||
|
||||
void updateParallelProjectionSettings(RiuViewer* sourceViewer);
|
||||
|
||||
void setCursorPosition(const cvf::Vec3d& domainCoord);
|
||||
|
||||
public slots:
|
||||
virtual void slotSetCurrentFrame(int frameIndex);
|
||||
virtual void slotEndAnimation();
|
||||
@ -103,6 +105,8 @@ public slots:
|
||||
protected:
|
||||
virtual void optimizeClippingPlanes();
|
||||
virtual void resizeGL(int width, int height);
|
||||
virtual void mouseMoveEvent(QMouseEvent* e) override;
|
||||
virtual void leaveEvent(QEvent *) override;
|
||||
|
||||
private:
|
||||
void updateTextAndTickMarkColorForOverlayItems();
|
||||
@ -140,5 +144,7 @@ private:
|
||||
RiuViewerCommands* m_viewerCommands;
|
||||
|
||||
RivGridBoxGenerator* m_gridBoxGenerator;
|
||||
|
||||
cvf::Vec3d m_cursorPositionDomainCoords;
|
||||
};
|
||||
|
||||
|
@ -70,6 +70,7 @@ CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiListEditor, std::vector<int>);
|
||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiListEditor, std::vector<unsigned int>);
|
||||
CAF_PDM_UI_REGISTER_DEFAULT_FIELD_EDITOR(PdmUiListEditor, std::vector<float>);
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -259,32 +260,7 @@ void PdmUiDefaultObjectEditor::recursiveSetupFieldsAndGroups(const std::vector<P
|
||||
|
||||
if (it == m_fieldViews.end())
|
||||
{
|
||||
// If editor type is specified, find in factory
|
||||
if ( !uiItems[i]->uiEditorTypeName(uiConfigName).isEmpty() )
|
||||
{
|
||||
fieldEditor = caf::Factory<PdmUiFieldEditorHandle, QString>::instance()->create(field->uiEditorTypeName(uiConfigName));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find the default field editor
|
||||
|
||||
QString editorTypeName = qStringTypeName(*(field->fieldHandle()));
|
||||
|
||||
// Handle a single value field with valueOptions: Make a combobox
|
||||
|
||||
if (field->toUiBasedQVariant().type() != QVariant::List)
|
||||
{
|
||||
bool useOptionsOnly = true;
|
||||
QList<PdmOptionItemInfo> options = field->valueOptions( &useOptionsOnly);
|
||||
|
||||
if (!options.empty())
|
||||
{
|
||||
editorTypeName = caf::PdmUiComboBoxEditor::uiEditorTypeName();
|
||||
}
|
||||
}
|
||||
|
||||
fieldEditor = caf::Factory<PdmUiFieldEditorHandle, QString>::instance()->create(editorTypeName);
|
||||
}
|
||||
fieldEditor = PdmUiFieldEditorHelper::fieldEditorForField(field, uiConfigName);
|
||||
|
||||
if (fieldEditor)
|
||||
{
|
||||
@ -428,5 +404,48 @@ void PdmUiDefaultObjectEditor::recursiveVerifyUniqueNames(const std::vector<PdmU
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmUiFieldEditorHandle* PdmUiFieldEditorHelper::fieldEditorForField(PdmUiFieldHandle* field, const QString& uiConfigName)
|
||||
{
|
||||
caf::PdmUiFieldEditorHandle* fieldEditor = NULL;
|
||||
|
||||
// If editor type is specified, find in factory
|
||||
if (!field->uiEditorTypeName(uiConfigName).isEmpty())
|
||||
{
|
||||
fieldEditor = caf::Factory<PdmUiFieldEditorHandle, QString>::instance()->create(field->uiEditorTypeName(uiConfigName));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find the default field editor
|
||||
QString fieldTypeName = qStringTypeName(*(field->fieldHandle()));
|
||||
|
||||
if (fieldTypeName.indexOf("PdmPtrField") != -1)
|
||||
{
|
||||
fieldTypeName = caf::PdmUiComboBoxEditor::uiEditorTypeName();
|
||||
}
|
||||
else if (fieldTypeName.indexOf("PdmPtrArrayField") != -1)
|
||||
{
|
||||
fieldTypeName = caf::PdmUiListEditor::uiEditorTypeName();
|
||||
}
|
||||
else if (field->toUiBasedQVariant().type() != QVariant::List)
|
||||
{
|
||||
// Handle a single value field with valueOptions: Make a combobox
|
||||
|
||||
bool useOptionsOnly = true;
|
||||
QList<PdmOptionItemInfo> options = field->valueOptions(&useOptionsOnly);
|
||||
|
||||
if (!options.empty())
|
||||
{
|
||||
fieldTypeName = caf::PdmUiComboBoxEditor::uiEditorTypeName();
|
||||
}
|
||||
}
|
||||
|
||||
fieldEditor = caf::Factory<PdmUiFieldEditorHandle, QString>::instance()->create(fieldTypeName);
|
||||
}
|
||||
|
||||
return fieldEditor;
|
||||
}
|
||||
|
||||
} // end namespace caf
|
||||
|
@ -53,6 +53,14 @@ namespace caf
|
||||
class PdmUiFieldEditorHandle;
|
||||
class PdmUiItem;
|
||||
|
||||
|
||||
class PdmUiFieldEditorHelper
|
||||
{
|
||||
public:
|
||||
static PdmUiFieldEditorHandle* fieldEditorForField(PdmUiFieldHandle* fieldHandle, const QString& uiConfigName);
|
||||
};
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
/// The default editor for PdmObjects. Manages the field editors in a gridlayout vertically
|
||||
//==================================================================================================
|
||||
|
@ -118,7 +118,9 @@ PdmUiTableViewEditor::~PdmUiTableViewEditor()
|
||||
QWidget* PdmUiTableViewEditor::createWidget(QWidget* parent)
|
||||
{
|
||||
m_mainWidget = new QWidget(parent);
|
||||
m_layout = new QVBoxLayout();
|
||||
|
||||
m_layout = new QVBoxLayout();
|
||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||
m_mainWidget->setLayout(m_layout);
|
||||
|
||||
m_tableModelPdm = new PdmUiTableViewModel(m_mainWidget);
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmUiComboBoxEditor.h"
|
||||
#include "cafPdmUiCommandSystemProxy.h"
|
||||
#include "cafPdmUiDefaultObjectEditor.h"
|
||||
#include "cafPdmUiLineEditor.h"
|
||||
#include "cafPdmUiTableItemEditor.h"
|
||||
#include "cafSelectionManager.h"
|
||||
@ -118,6 +119,10 @@ QVariant PdmUiTableViewModel::headerData(int section, Qt::Orientation orientatio
|
||||
return uiFieldHandle->uiName(m_currentConfigName);
|
||||
}
|
||||
}
|
||||
else if (orientation == Qt::Vertical)
|
||||
{
|
||||
return section;
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
@ -187,6 +192,30 @@ QVariant PdmUiTableViewModel::data(const QModelIndex &index, int role /*= Qt::Di
|
||||
if (role == Qt::DisplayRole || role == Qt::EditRole)
|
||||
{
|
||||
PdmFieldHandle* fieldHandle = getField(index);
|
||||
if (dynamic_cast<PdmPtrArrayFieldHandle*>(fieldHandle))
|
||||
{
|
||||
PdmPtrArrayFieldHandle* ptrArrayFieldHandle = dynamic_cast<PdmPtrArrayFieldHandle*>(fieldHandle);
|
||||
|
||||
QString displayText;
|
||||
|
||||
for (size_t i = 0; i < ptrArrayFieldHandle->size(); i++)
|
||||
{
|
||||
PdmObjectHandle* objHandle = ptrArrayFieldHandle->at(i);
|
||||
if (objHandle && objHandle->uiCapability())
|
||||
{
|
||||
PdmUiObjectHandle* uiObjHandle = objHandle->uiCapability();
|
||||
if (!displayText.isEmpty()) displayText += ", ";
|
||||
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = uiObjHandle->userDescriptionField()->uiCapability();
|
||||
if (uiFieldHandle)
|
||||
{
|
||||
displayText += uiFieldHandle->uiValue().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return displayText;
|
||||
}
|
||||
PdmUiFieldHandle* uiFieldHandle = fieldHandle->uiCapability();
|
||||
if (uiFieldHandle)
|
||||
{
|
||||
@ -317,32 +346,7 @@ void PdmUiTableViewModel::setPdmData(PdmChildArrayFieldHandle* listField, const
|
||||
|
||||
if (it == m_fieldEditors.end())
|
||||
{
|
||||
// If editor type is specified, find in factory
|
||||
if ( !uiItems[i]->uiEditorTypeName(configName).isEmpty() )
|
||||
{
|
||||
fieldEditor = Factory<PdmUiFieldEditorHandle, QString>::instance()->create(field->uiEditorTypeName(configName));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Find the default field editor
|
||||
|
||||
QString editorTypeName = qStringTypeName(*(field->fieldHandle()));
|
||||
|
||||
// Handle a single value field with valueOptions: Make a combobox
|
||||
|
||||
if (field->uiValue().type() != QVariant::List)
|
||||
{
|
||||
bool useOptionsOnly = true;
|
||||
QList<PdmOptionItemInfo> options = field->valueOptions( &useOptionsOnly);
|
||||
|
||||
if (!options.empty())
|
||||
{
|
||||
editorTypeName = PdmUiComboBoxEditor::uiEditorTypeName();
|
||||
}
|
||||
}
|
||||
|
||||
fieldEditor = Factory<PdmUiFieldEditorHandle, QString>::instance()->create(editorTypeName);
|
||||
}
|
||||
fieldEditor = PdmUiFieldEditorHelper::fieldEditorForField(field, configName);
|
||||
|
||||
if (fieldEditor)
|
||||
{
|
||||
|
@ -82,8 +82,6 @@ public:
|
||||
|
||||
void selectedUiItems(std::vector<PdmUiItem*>& objects);
|
||||
|
||||
PdmUiFieldEditorHandle* getEditor(const QModelIndex &index);
|
||||
QWidget* getEditorWidgetAndTransferOwnership(QWidget* parent, const QModelIndex &index);
|
||||
void notifyDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight);
|
||||
|
||||
bool isRepresentingBoolean(const QModelIndex &index) const;
|
||||
@ -92,6 +90,10 @@ private:
|
||||
int getFieldIndex(PdmFieldHandle* field) const;
|
||||
void recreateTableItemEditors();
|
||||
|
||||
friend class PdmUiTableViewDelegate;
|
||||
QWidget* getEditorWidgetAndTransferOwnership(QWidget* parent, const QModelIndex &index);
|
||||
PdmUiFieldEditorHandle* getEditor(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
PdmChildArrayFieldHandle* m_pdmList;
|
||||
QString m_currentConfigName;
|
||||
|
Loading…
Reference in New Issue
Block a user