Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
50ec8ad5
Commit
50ec8ad5
authored
7 years ago
by
Pospelov, Gennady
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'upstream/release-1.11.0' into release-1.11.0
parents
651732de
450f14e8
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
GUI/coregui/Models/ModelPath.cpp
+1
-37
1 addition, 37 deletions
GUI/coregui/Models/ModelPath.cpp
GUI/coregui/Models/ModelPath.h
+0
-2
0 additions, 2 deletions
GUI/coregui/Models/ModelPath.h
GUI/coregui/Models/ParameterTreeItems.cpp
+68
-4
68 additions, 4 deletions
GUI/coregui/Models/ParameterTreeItems.cpp
with
69 additions
and
43 deletions
GUI/coregui/Models/ModelPath.cpp
+
1
−
37
View file @
50ec8ad5
...
@@ -13,11 +13,9 @@
...
@@ -13,11 +13,9 @@
// ************************************************************************** //
// ************************************************************************** //
#include
"ModelPath.h"
#include
"ModelPath.h"
#include
"InstrumentItems.h"
#include
"JobItem.h"
#include
"JobItem.h"
#include
"RectangularDetectorItem.h"
#include
"SessionModel.h"
#include
"SessionModel.h"
#include
"SphericalDetectorItem.h"
QString
ModelPath
::
getPathFromIndex
(
const
QModelIndex
&
index
)
QString
ModelPath
::
getPathFromIndex
(
const
QModelIndex
&
index
)
{
{
...
@@ -85,40 +83,6 @@ bool ModelPath::isValidItem(SessionModel* model, SessionItem* item, const QModel
...
@@ -85,40 +83,6 @@ bool ModelPath::isValidItem(SessionModel* model, SessionItem* item, const QModel
return
false
;
return
false
;
}
}
//! Returns true when we know how to translate ParameterItem link to domain name.
bool
ModelPath
::
isTranslatable
(
const
SessionItem
*
item
,
const
QString
&
par_name
)
{
Q_UNUSED
(
item
);
QStringList
non_translatable_names
{
Constants
::
DistributionSigmaFactor
};
if
(
par_name
.
contains
(
Constants
::
SphericalDetectorType
))
{
QStringList
excluded_names
{
SphericalDetectorItem
::
P_PHI_AXIS
,
SphericalDetectorItem
::
P_ALPHA_AXIS
};
for
(
auto
name
:
excluded_names
)
{
if
(
par_name
.
contains
(
name
))
return
false
;
}
}
if
(
par_name
.
contains
(
Constants
::
RectangularDetectorType
))
{
QStringList
excluded_names
{
RectangularDetectorItem
::
P_X_AXIS
,
RectangularDetectorItem
::
P_Y_AXIS
,
RectangularDetectorItem
::
P_ALIGNMENT
,
RectangularDetectorItem
::
P_NORMAL
,
RectangularDetectorItem
::
P_DIRECTION
,
RectangularDetectorItem
::
P_U0
,
RectangularDetectorItem
::
P_V0
,
RectangularDetectorItem
::
P_DBEAM_U0
,
RectangularDetectorItem
::
P_DBEAM_V0
,
RectangularDetectorItem
::
P_DISTANCE
,
};
for
(
auto
name
:
excluded_names
)
{
if
(
par_name
.
contains
(
name
))
return
false
;
}
}
for
(
auto
name
:
non_translatable_names
)
{
if
(
par_name
.
contains
(
name
))
return
false
;
}
return
true
;
}
//! Returns ancestor of given modelType for given item.
//! Returns ancestor of given modelType for given item.
//! For example, returns corresponding jobItem owning ParameterItem via ParameterContainer.
//! For example, returns corresponding jobItem owning ParameterItem via ParameterContainer.
...
...
This diff is collapsed.
Click to expand it.
GUI/coregui/Models/ModelPath.h
+
0
−
2
View file @
50ec8ad5
...
@@ -34,8 +34,6 @@ BA_CORE_API_ SessionItem* getItemFromPath(const QString& relPath, const SessionI
...
@@ -34,8 +34,6 @@ BA_CORE_API_ SessionItem* getItemFromPath(const QString& relPath, const SessionI
BA_CORE_API_
bool
isValidItem
(
SessionModel
*
model
,
SessionItem
*
item
,
const
QModelIndex
&
parent
);
BA_CORE_API_
bool
isValidItem
(
SessionModel
*
model
,
SessionItem
*
item
,
const
QModelIndex
&
parent
);
BA_CORE_API_
bool
isTranslatable
(
const
SessionItem
*
item
,
const
QString
&
par_name
);
BA_CORE_API_
const
SessionItem
*
ancestor
(
const
SessionItem
*
item
,
const
QString
&
requiredModelType
);
BA_CORE_API_
const
SessionItem
*
ancestor
(
const
SessionItem
*
item
,
const
QString
&
requiredModelType
);
BA_CORE_API_
QString
itemPathTranslation
(
const
SessionItem
&
item
,
const
SessionItem
*
topItem
=
0
);
BA_CORE_API_
QString
itemPathTranslation
(
const
SessionItem
&
item
,
const
SessionItem
*
topItem
=
0
);
...
...
This diff is collapsed.
Click to expand it.
GUI/coregui/Models/ParameterTreeItems.cpp
+
68
−
4
View file @
50ec8ad5
...
@@ -13,9 +13,17 @@
...
@@ -13,9 +13,17 @@
// ************************************************************************** //
// ************************************************************************** //
#include
"ParameterTreeItems.h"
#include
"ParameterTreeItems.h"
#include
"DistributionItems.h"
#include
"FitParameterHelper.h"
#include
"InstrumentItems.h"
#include
"ModelPath.h"
#include
"ModelPath.h"
#include
"RectangularDetectorItem.h"
#include
"SessionModel.h"
#include
"SessionModel.h"
#include
"FitParameterHelper.h"
#include
"SphericalDetectorItem.h"
namespace
{
bool
containsNames
(
const
QString
&
text
,
const
QStringList
&
names
);
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
...
@@ -77,9 +85,55 @@ void ParameterItem::restoreFromBackup()
...
@@ -77,9 +85,55 @@ void ParameterItem::restoreFromBackup()
bool
ParameterItem
::
isFittable
()
const
bool
ParameterItem
::
isFittable
()
const
{
{
const
SessionItem
*
jobItem
=
ModelPath
::
ancestor
(
this
,
Constants
::
JobItemType
);
static
const
QVector
<
QPair
<
QStringList
,
QStringList
>>
black_list
{
Q_ASSERT
(
jobItem
);
{
// global scope
return
ModelPath
::
isTranslatable
(
jobItem
,
FitParameterHelper
::
getParameterItemPath
(
this
));
{
QString
()},
{
Constants
::
DistributionSigmaFactor
}
},
{
// instrument scope
{
Constants
::
GISASInstrumentType
,
Constants
::
OffSpecInstrumentType
,
Constants
::
SpecularInstrumentType
},
{
// distribution types
Constants
::
DistributionGateType
,
Constants
::
DistributionLorentzType
,
Constants
::
DistributionGaussianType
,
Constants
::
DistributionLogNormalType
,
Constants
::
DistributionCosineType
,
Constants
::
DistributionTrapezoidType
,
// axes
SphericalDetectorItem
::
P_PHI_AXIS
,
SphericalDetectorItem
::
P_ALPHA_AXIS
,
RectangularDetectorItem
::
P_X_AXIS
,
RectangularDetectorItem
::
P_Y_AXIS
,
OffSpecInstrumentItem
::
P_ALPHA_AXIS
,
// rectangular detector positioning
RectangularDetectorItem
::
P_ALIGNMENT
,
RectangularDetectorItem
::
P_NORMAL
,
RectangularDetectorItem
::
P_DIRECTION
,
RectangularDetectorItem
::
P_U0
,
RectangularDetectorItem
::
P_V0
,
RectangularDetectorItem
::
P_DBEAM_U0
,
RectangularDetectorItem
::
P_DBEAM_V0
,
RectangularDetectorItem
::
P_DISTANCE
,
// Detector resolution
Constants
::
ResolutionFunction2DGaussianType
}
}
};
Q_ASSERT
(
ModelPath
::
ancestor
(
this
,
Constants
::
JobItemType
));
const
QString
&
par_path
=
FitParameterHelper
::
getParameterItemPath
(
this
);
for
(
const
auto
&
item
:
black_list
)
{
if
(
item
.
first
.
size
()
==
1
&&
item
.
first
[
0
].
isNull
())
{
// checking global scope
if
(
containsNames
(
par_path
,
item
.
second
))
return
false
;
}
else
{
// checking everything else
if
(
containsNames
(
par_path
,
item
.
first
)
&&
containsNames
(
par_path
,
item
.
second
))
return
false
;
}
}
return
true
;
}
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
...
@@ -91,3 +145,13 @@ ParameterContainerItem::ParameterContainerItem()
...
@@ -91,3 +145,13 @@ ParameterContainerItem::ParameterContainerItem()
registerTag
(
T_CHILDREN
,
0
,
-
1
,
QStringList
()
<<
Constants
::
ParameterLabelType
);
registerTag
(
T_CHILDREN
,
0
,
-
1
,
QStringList
()
<<
Constants
::
ParameterLabelType
);
setDefaultTag
(
T_CHILDREN
);
setDefaultTag
(
T_CHILDREN
);
}
}
namespace
{
bool
containsNames
(
const
QString
&
text
,
const
QStringList
&
names
)
{
for
(
const
auto
&
name
:
names
)
if
(
text
.
contains
(
name
))
return
true
;
return
false
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment