Mantid
Loading...
Searching...
No Matches
SlicingAlgorithmDialog.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9//----------------------
10// Includes
11//----------------------
12#include "DllOption.h"
13#include "MantidAPI/Algorithm.h"
17#include "ui_SlicingAlgorithmDialog.h"
18
19namespace MantidQt {
20namespace MantidWidgets {
21
22using PropertyDimensionMap = QMap<QString, QString>;
23
24/*
25Class SlicingAlgorithmDialog
26Abstract SlicingAlgorithm Dialog geared for MD Slicing type algorithms
27
28This custom dialog provides two advantages over the default custom generated
29one.
30
311) It dynamically creates dimension input controls based on the nature of the
32input MD workspace
332) It pre-populates those dimension input controls based on existing values.
34
35*/
37 Q_OBJECT
38public:
40 SlicingAlgorithmDialog(QWidget *parent = nullptr);
41
43 ~SlicingAlgorithmDialog() override;
44
45protected:
47 Ui::SlicingAlgorithmDialog ui;
48
50 void commonSliceMDSetup(const bool /*isSliceMD*/);
51
53 void buildDimensionInputs(const bool bForceForget = false);
54
55protected slots:
56
57 void onWorkspaceChanged();
58
59 void onAxisAlignedChanged(bool /*unused*/);
60
61 void onBrowse();
62
63 void onMaxFromInput(bool /*unused*/);
64
65 void onRebuildDimensions();
66
67 void onCalculateChanged(bool checked);
68
69private:
70 enum History { Remember, Forget };
71
72 enum HistoryChanged { HasChanged, HasNotChanged };
73
75 void initLayout() override;
76
78 bool doAxisAligned() const;
79
81 QString getCurrentInputWorkspaceName() const;
82
84 QString getHistoricalInputWorkspaceName() const;
85
87 QString getCurrentOutputWorkspaceName() const;
88
90 void makeDimensionInputs(const QString &propertyPrefix, QLayout *owningLayout,
91 QString (*format)(const Mantid::Geometry::IMDDimension_const_sptr &), History history);
92
94 History useHistory(const HistoryChanged &criticalChange, const bool bForceForget);
95
97 void cleanLayoutOfDimensions(QLayout *layout);
98
100 void clearExistingDimensions();
101
103 HistoryChanged hasDimensionHistoryChanged() const;
104
106 virtual void customiseInitLayout() = 0;
107
109 void loadSettings();
110
112 void saveSettings();
113
115 bool doAutoFillDimensions() const;
116};
117
118/*
119Class SliceMDDialog
120Concrete SlicingAlgorithm Dialog geared for SliceMD
121*/
123 Q_OBJECT
124public:
125 SliceMDDialog(QWidget *parent = nullptr) : SlicingAlgorithmDialog(parent) {}
126
127 ~SliceMDDialog() override = default;
128
129 void customiseInitLayout() override;
130};
131
132/*
133Class BinMDDialog
134Concrete BinMDDialog Dialog geared for BinMD
135*/
137 Q_OBJECT
138public:
139 BinMDDialog(QWidget *parent = nullptr) : SlicingAlgorithmDialog(parent) {}
140 ~BinMDDialog() override = default;
141 void customiseInitLayout() override;
142};
143} // namespace MantidWidgets
144} // namespace MantidQt
#define EXPORT_OPT_MANTIDQT_COMMON
Definition: DllOption.h:15
std::vector< history_type > history
history information
This class should be the basis for all customised algorithm dialogs.
virtual void customiseInitLayout()=0
Give base classes the opportunity to do any custom overriding.
QMap< QString, QString > PropertyDimensionMap
The AlgorithmProgressDialogPresenter keeps track of the running algorithms and displays a progress ba...
std::shared_ptr< const IMDDimension > IMDDimension_const_sptr
Shared Pointer to const IMDDimension.
Definition: IMDDimension.h:101