#692 SSIhub: add Sub Items On/Off/Toggle to well list

This commit is contained in:
Magne Sjaastad 2019-06-17 09:11:38 +02:00
parent bdcc7c53f7
commit 03c1311d58
21 changed files with 112 additions and 307 deletions

View File

@ -66,7 +66,6 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/ResultStatisticsCache
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel
${CMAKE_CURRENT_SOURCE_DIR}/ReservoirDataModel/Completions
${CMAKE_CURRENT_SOURCE_DIR}/WellPathImportSsihub
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/OdbReader
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/GeoMechDataModel
${CMAKE_CURRENT_SOURCE_DIR}/GeoMech/GeoMechVisualization
@ -151,6 +150,7 @@ list( APPEND REFERENCED_CMAKE_FILES
Commands/OctaveScriptCommands/CMakeLists_files.cmake
Commands/OperationsUsingObjReferences/CMakeLists_files.cmake
Commands/SummaryPlotCommands/CMakeLists_files.cmake
Commands/SsiHubImportCommands/CMakeLists_files.cmake
Commands/ToggleCommands/CMakeLists_files.cmake
Commands/ViewLink/CMakeLists_files.cmake
Commands/WellLogCommands/CMakeLists_files.cmake
@ -189,11 +189,9 @@ list( APPEND CPP_SOURCES
# Sub-directory projects
#############################################################################
add_subdirectory(WellPathImportSsihub)
add_subdirectory(ResultStatisticsCache)
set( RI_LIBRARIES
WellPathImportSsihub
ResultStatisticsCache
)

View File

@ -0,0 +1,32 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportSsihubFeature.h
${CMAKE_CURRENT_LIST_DIR}/RimOilFieldEntry.h
${CMAKE_CURRENT_LIST_DIR}/RimOilRegionEntry.h
${CMAKE_CURRENT_LIST_DIR}/RimWellPathImport.h
${CMAKE_CURRENT_LIST_DIR}/RimWellsEntry.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.h
)
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportSsihubFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RimOilFieldEntry.cpp
${CMAKE_CURRENT_LIST_DIR}/RimOilRegionEntry.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellPathImport.cpp
${CMAKE_CURRENT_LIST_DIR}/RimWellsEntry.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.cpp
)
list(APPEND CODE_HEADER_FILES
${SOURCE_GROUP_HEADER_FILES}
)
list(APPEND CODE_SOURCE_FILES
${SOURCE_GROUP_SOURCE_FILES}
)
list(APPEND QT_MOC_HEADERS
${CMAKE_CURRENT_LIST_DIR}/RiuWellImportWizard.h
)
source_group( "CommandFeature\\SsiHub" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake )

View File

@ -117,12 +117,12 @@ void RimOilFieldEntry::updateEnabledState()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathEntry* RimOilFieldEntry::find(const QString& name, RimWellPathEntry::WellTypeEnum wellPathType)
RimWellPathEntry* RimOilFieldEntry::find(const QString& entryName, RimWellPathEntry::WellTypeEnum wellPathType)
{
for (size_t i = 0; i < wells.size(); i++)
{
RimWellPathEntry* wellPathEntry = wells[i];
if (wellPathEntry->name == name && wellPathEntry->wellPathType == wellPathType)
if (wellPathEntry->name == entryName && wellPathEntry->wellPathType == wellPathType)
{
return wellPathEntry;
}

View File

@ -146,7 +146,7 @@ void RimWellPathImport::updateRegions(const QStringList& regionStrings, const QS
if (!oilFieldEntry)
{
RimOilFieldEntry* oilFieldEntry = new RimOilFieldEntry;
oilFieldEntry = new RimOilFieldEntry;
oilFieldEntry->name = fieldStrings[i];
oilFieldEntry->edmId = edmIds[i];

View File

@ -18,12 +18,15 @@
#include "RiuWellImportWizard.h"
#include "RiaFeatureCommandContext.h"
#include "RifJsonEncodeDecode.h"
#include "RimOilFieldEntry.h"
#include "RimOilRegionEntry.h"
#include "RimWellPathImport.h"
#include "cafCmdFeatureMenuBuilder.h"
#include "cafPdmDocument.h"
#include "cafPdmObject.h"
#include "cafPdmObjectGroup.h"
@ -36,6 +39,8 @@
#include <QObject>
#include <QSslConfiguration>
#include <QSslSocket>
#include <QMenu>
#if QT_VERSION >= 0x050000
#include <QtWidgets>
#else
@ -45,6 +50,8 @@
#include <algorithm>
CAF_PDM_XML_ABSTRACT_SOURCE_INIT(ObjectGroupWithHeaders, "ObjectGroupWithHeaders"); // Do not use. Abstract class
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@ -859,6 +866,15 @@ WellSelectionPage::WellSelectionPage(RimWellPathImport* wellPathImport, QWidget*
layout->addWidget(label);
m_wellSelectionTreeView = new caf::PdmUiTreeView(this);
m_wellSelectionTreeView->treeView()->setContextMenuPolicy(Qt::CustomContextMenu);
m_wellSelectionTreeView->enableSelectionManagerUpdating(true);
m_wellSelectionTreeView->treeView()->setSelectionMode(QAbstractItemView::ExtendedSelection);
connect(m_wellSelectionTreeView->treeView(),
SIGNAL(customContextMenuRequested(const QPoint&)),
SLOT(customMenuRequested(const QPoint&)));
layout->addWidget(m_wellSelectionTreeView);
m_wellPathImportObject = wellPathImport;
@ -1009,6 +1025,38 @@ void WellSelectionPage::selectedWellPathEntries(std::vector<DownloadEntity>& dow
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void WellSelectionPage::customMenuRequested(const QPoint& pos)
{
QMenu menu;
RiaFeatureCommandContextHelper helper(m_wellSelectionTreeView);
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicToggleItemsOnFeature";
menuBuilder << "RicToggleItemsOffFeature";
menuBuilder << "RicToggleItemsFeature";
menuBuilder << "RicToggleItemsOnOthersOffFeature";
menuBuilder.appendToMenu(&menu);
// Qt doc: QAbstractScrollArea and its subclasses that map the context menu event to coordinates of the viewport().
// Since we might get this signal from different treeViews, we need to map the position accordingly.
QObject* senderObj = this->sender();
QTreeView* treeView = dynamic_cast<QTreeView*>(senderObj);
if (treeView)
{
QPoint globalPos = treeView->viewport()->mapToGlobal(pos);
menu.exec(globalPos);
}
}
//--------------------------------------------------------------------------------------------------
///

View File

@ -21,7 +21,6 @@
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafPdmObjectGroup.h"
#include <QItemSelection>
#include <QNetworkAccessManager>
@ -85,12 +84,34 @@ private:
//--------------------------------------------------------------------------------------------------
/// Container class used to define column headers
//--------------------------------------------------------------------------------------------------
class ObjectGroupWithHeaders : public caf::PdmObjectCollection
class ObjectGroupWithHeaders : public caf::PdmObject
{
CAF_PDM_HEADER_INIT;
public:
ObjectGroupWithHeaders() {};
ObjectGroupWithHeaders()
{
CAF_PDM_InitFieldNoDefault(&objects, "PdmObjects", "", "", "", "");
CAF_PDM_InitField(&m_isChecked, "IsChecked", true, "Active", "", "", "");
m_isChecked.uiCapability()->setUiHidden(true);
};
void defineObjectEditorAttribute(QString uiConfigName, caf::PdmUiEditorAttribute * attribute) override;
public:
caf::PdmChildArrayField<PdmObjectHandle*> objects;
protected:
caf::PdmFieldHandle* objectToggleField() override
{
return &m_isChecked;
}
protected:
caf::PdmField<bool> m_isChecked;
};
//--------------------------------------------------------------------------------------------------
@ -137,6 +158,9 @@ public:
private:
void sortObjectsByDescription(caf::PdmObjectCollection* objects);
private slots:
void customMenuRequested(const QPoint& pos);
private:
ObjectGroupWithHeaders* m_regionsWithVisibleWells;
RimWellPathImport* m_wellPathImportObject;

View File

@ -2,7 +2,6 @@
set (SOURCE_GROUP_HEADER_FILES
${CMAKE_CURRENT_LIST_DIR}/RicWellPathDeleteFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportFileFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportSsihubFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewEditableWellPathFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicShowWellPlanFeature.h
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathListTargetFeature.h
@ -29,7 +28,6 @@ ${CMAKE_CURRENT_LIST_DIR}/PointTangentManipulator/RicPolylineTarget3dEditor.h
set (SOURCE_GROUP_SOURCE_FILES
${CMAKE_CURRENT_LIST_DIR}/RicWellPathDeleteFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportFileFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicWellPathsImportSsihubFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewEditableWellPathFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicShowWellPlanFeature.cpp
${CMAKE_CURRENT_LIST_DIR}/RicNewWellPathListTargetFeature.cpp

View File

@ -76,7 +76,7 @@
#include "RimWellLogPlotCollection.h"
#include "RimWellPath.h"
#include "RimWellPathCollection.h"
#include "RimWellPathImport.h"
#include "SsiHubImportCommands/RimWellPathImport.h"
#include "RiuPlotMainWindow.h"
#include "RiuMainWindow.h"

View File

@ -843,14 +843,9 @@ void RiuMainWindow::refreshViewActions()
//--------------------------------------------------------------------------------------------------
void RiuMainWindow::slotRefreshFileActions()
{
RiaApplication* app = RiaApplication::instance();
bool projectFileExists = caf::Utils::fileExists(app->project()->fileName());
caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance();
CVF_ASSERT(cmdFeatureMgr);
cmdFeatureMgr->action("RicWellPathsImportSsihubFeature")->setEnabled(projectFileExists);
QStringList commandIdList;
commandIdList << "RicExportEclipseInputGridFeature";
commandIdList << "RicSaveEclipseInputVisibleCellsFeature";
@ -858,7 +853,6 @@ void RiuMainWindow::slotRefreshFileActions()
commandIdList << "RicExportCompletionsForVisibleWellPathsFeature";
commandIdList << "RicExportVisibleWellPathsFeature";
cmdFeatureMgr->refreshStates(commandIdList);
}
//--------------------------------------------------------------------------------------------------

View File

@ -1,49 +0,0 @@
cmake_minimum_required (VERSION 2.8.12)
project (WellPathImportSsihub)
# These headers need to go through Qt's MOC compiler
set( MOC_HEADER_FILES
RiuWellImportWizard.h
)
if (RESINSIGHT_BUILD_WITH_QT5)
find_package(Qt5 COMPONENTS REQUIRED Core Network)
set(QT_LIBRARIES Qt5::Core Qt5::Network)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
else()
find_package(Qt4 COMPONENTS QtCore QtNetwork REQUIRED)
include(${QT_USE_FILE})
qt4_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES})
endif(RESINSIGHT_BUILD_WITH_QT5)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../FileInterface
)
add_library( ${PROJECT_NAME}
RimWellPathImport.h
RimWellPathImport.cpp
RimOilRegionEntry.h
RimOilRegionEntry.cpp
RimOilFieldEntry.h
RimOilFieldEntry.cpp
RimWellsEntry.h
RimWellsEntry.cpp
RiuWellImportWizard.h
RiuWellImportWizard.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../FileInterface/RifJsonEncodeDecode.cpp
${MOC_SOURCE_FILES}
${FORM_FILES_CPP}
${HEADER_FILES}
)
target_link_libraries ( ${PROJECT_NAME}
cafUserInterface cafPdmCvf CommonCode ${QT_LIBRARIES}
)
source_group("" FILES ${PROJECT_FILES})

View File

@ -1,106 +0,0 @@
cmake_minimum_required (VERSION 2.8)
project ( WellPathImportSsihubTestApp )
find_package(Qt5 CONFIG COMPONENTS Core)
if (Qt5Core_FOUND)
message(STATUS "Found Qt5")
find_package(Qt5 CONFIG REQUIRED Core Gui OpenGl Network Script ScriptTools Widgets)
else()
set (QT_COMPONENTS_REQUIRED QtCore QtGui QtMain QtOpenGl QtNetwork QtScript QtScriptTools)
find_package(Qt4 COMPONENTS ${QT_COMPONENTS_REQUIRED} REQUIRED)
include(${QT_USE_FILE})
if (QT4_FOUND)
message(STATUS "Found Qt4")
endif(QT4_FOUND)
endif(Qt5Core_FOUND)
# Open GL
find_package( OpenGL )
add_subdirectory(../WellPathImportSsihub "${CMAKE_CURRENT_BINARY_DIR}/WellPathImportSsihub")
add_subdirectory(../../Fwk/AppFwk/cafProjectDataModel "${CMAKE_CURRENT_BINARY_DIR}/cafProjectDataModel")
add_subdirectory(../../Fwk/AppFwk/cafUserInterface "${CMAKE_CURRENT_BINARY_DIR}/cafUserInterface")
#add_subdirectory(../../cafTests/cafTestApplication "${CMAKE_CURRENT_BINARY_DIR}/cafTestApplication")
include_directories(
${WellPathImportSsihub_SOURCE_DIR}
${WellPathImportSsihub_SOURCE_DIR}/../../Fwk/AppFwk/cafProjectDataModel
${WellPathImportSsihub_SOURCE_DIR}/../../Fwk/AppFwk/cafUserInterface
)
# Qt MOC
set ( QT_MOC_HEADERS
)
if (Qt5Core_FOUND)
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES} )
else()
qt4_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES} )
endif()
# Resource file
set( QRC_FILES
)
# Runs RCC on specified files
if (Qt5Core_FOUND)
qt5_add_resources( QRC_FILES_CPP
${QRC_FILES}
)
else()
qt4_add_resources( QRC_FILES_CPP
${QRC_FILES}
)
endif()
# add the executable
add_executable ( ${PROJECT_NAME}
main.cpp
TestTools.cpp
TestTools.h
${MOC_SOURCE_FILES}
${QRC_FILES_CPP}
)
if (Qt5Core_FOUND)
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::OpenGl Qt5::Network Qt5::Script Qt5::ScriptTools Qt5::Widgets)
endif()
target_link_libraries ( ${PROJECT_NAME}
cafProjectDataModel
cafUserInterface
WellPathImportSsihub
${QT_LIBRARIES}
)
# Copy Qt Dlls
if (Qt5Core_FOUND)
foreach (qtlib ${QT_LIBRARIES})
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}> $<TARGET_FILE_DIR:${PROJECT_NAME}>
)
endforeach(qtlib)
# Copy Qt Dlls
else()
# Copy Qt Dlls
if (MSVC)
foreach (qtlib ${QT_COMPONENTS_REQUIRED})
# Debug
execute_process(COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}d4.dll ${CMAKE_BINARY_DIR}/Debug/${qtlib}d4.dll)
# Release
execute_process(COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}4.dll ${CMAKE_BINARY_DIR}/Release/${qtlib}4.dll)
endforeach( qtlib )
endif(MSVC)
endif(Qt5Core_FOUND)

View File

@ -1,52 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "TestTools.h"
#include "RimWellPathImport.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPathImport* TestTools::createMockObject()
{
RimWellPathImport* wellPathImport = new RimWellPathImport;
RimOilRegionEntry* regionA = new RimOilRegionEntry;
regionA->name = "Region A";
RimOilFieldEntry* fieldA = new RimOilFieldEntry;
fieldA->name = "test a";
fieldA->edmId = "edm1";
RimOilFieldEntry* fieldB = new RimOilFieldEntry;
fieldB->name = "test b";
fieldB->edmId = "edm b";
regionA->fields.push_back(fieldA);
wellPathImport->regions.push_back(regionA);
RimOilRegionEntry* regionB = new RimOilRegionEntry;
regionB->name = "Region B";
wellPathImport->regions.push_back(regionB);
wellPathImport->utmFilterMode = RimWellPathImport::UTM_FILTER_PROJECT;
return wellPathImport;
}

View File

@ -1,82 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QApplication>
#include <QDir>
#include "TestTools.h"
#include "RiuWellImportWizard.h"
#include "RimWellPathImport.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QString destinationFolder("c:/tmp/resinsight_ws");
QString wsAddress("http://127.0.0.1:5000");
int north = 7500000;
int south = 7000000;
int east = 401000;
int west = 400000;
RimWellPathImport* wellPathImportObject = TestTools::createMockObject();
wellPathImportObject->north = north;
wellPathImportObject->south = south;
wellPathImportObject->east = east;
wellPathImportObject->west = west;
QString username("admin");
QString password("resinsight");
RiuWellImportWizard wizard(wsAddress, destinationFolder, wellPathImportObject);
wizard.setCredentials(username, password);
wizard.show();
return app.exec();
}