mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#3343 HoloLens Export : Add factory to create option items for views
This commit is contained in:
parent
f1dd707561
commit
08449ceb9e
@ -36,6 +36,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaOffshoreSphericalCoords.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaWeightedAverageCalculator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaWeightedAverageCalculator.inl
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaWeightedGeometricMeanCalculator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaOptionItemFactory.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
@ -72,6 +73,7 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaSCurveCalculator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaArcCurveCalculator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaJCurveCalculator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaWeightedGeometricMeanCalculator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaOptionItemFactory.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
|
49
ApplicationCode/Application/Tools/RiaOptionItemFactory.cpp
Normal file
49
ApplicationCode/Application/Tools/RiaOptionItemFactory.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 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 "RiaOptionItemFactory.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCase.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName(Rim3dView* view, QList<caf::PdmOptionItemInfo>* optionItems)
|
||||
{
|
||||
if (!view || !optionItems) return;
|
||||
|
||||
QString caseName;
|
||||
|
||||
RimCase* rimCase = nullptr;
|
||||
view->firstAncestorOrThisOfType(rimCase);
|
||||
if (rimCase)
|
||||
{
|
||||
caseName = rimCase->caseUserDescription();
|
||||
}
|
||||
else
|
||||
{
|
||||
caseName = "<Unnamed case>";
|
||||
}
|
||||
|
||||
QString displayName = caseName + " : " + view->name();
|
||||
|
||||
QIcon icon = view->uiCapability()->uiIcon();
|
||||
|
||||
optionItems->push_back(caf::PdmOptionItemInfo(displayName, view, false, icon));
|
||||
}
|
31
ApplicationCode/Application/Tools/RiaOptionItemFactory.h
Normal file
31
ApplicationCode/Application/Tools/RiaOptionItemFactory.h
Normal file
@ -0,0 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2018 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 "cafPdmUiItem.h"
|
||||
|
||||
#include <QList>
|
||||
|
||||
class Rim3dView;
|
||||
|
||||
class RiaOptionItemFactory
|
||||
{
|
||||
public:
|
||||
static void appendOptionItemFromViewNameAndCaseName(Rim3dView* view, QList<caf::PdmOptionItemInfo>* optionItems);
|
||||
};
|
@ -19,6 +19,7 @@
|
||||
#include "RicHoloLensExportToFolderUi.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaOptionItemFactory.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimGridView.h"
|
||||
@ -81,16 +82,7 @@ QList<caf::PdmOptionItemInfo> RicHoloLensExportToFolderUi::calculateValueOptions
|
||||
|
||||
for (RimGridView* v : visibleViews)
|
||||
{
|
||||
RimCase* rimCase = nullptr;
|
||||
v->firstAncestorOrThisOfType(rimCase);
|
||||
|
||||
QIcon icon;
|
||||
if (rimCase)
|
||||
{
|
||||
icon = rimCase->uiCapability()->uiIcon();
|
||||
}
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo(v->name(), v, false, icon));
|
||||
RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName(v, &options);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user