Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
89a714f3
Commit
89a714f3
authored
Sep 14, 2021
by
Walsh, Michael
Committed by
Whitfield, Ross
Sep 16, 2021
Browse files
filter rotation prop for only rect and ellipse
parent
68e60497
Changes
5
Hide whitespace changes
Inline
Side-by-side
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/InstrumentWidgetMaskTab.h
View file @
89a714f3
...
...
@@ -146,6 +146,7 @@ private:
void
loadMaskViewFromProject
(
const
std
::
string
&
name
);
/// Run the LoadMask algorithm to get a MaskWorkspace
std
::
shared_ptr
<
Mantid
::
API
::
MatrixWorkspace
>
loadMask
(
const
std
::
string
&
fileName
);
bool
isRotationSupported
();
protected:
/// Is it used?
...
...
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/ProjectionSurface.h
View file @
89a714f3
...
...
@@ -181,6 +181,10 @@ public:
m_maskShapes
.
setCurrentBoundingRotation
(
rotation
);
}
std
::
string
getCurrentShapeType
()
const
{
return
m_maskShapes
.
getCurrentShapeType
();
}
/// Initialize interactive shape creation.
/// @param type :: Type of the shape. For available types see code of
/// Shape2DCollection::createShape(const QString& type,int x,int y) const
...
...
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/Shape2DCollection.h
View file @
89a714f3
...
...
@@ -73,6 +73,7 @@ public:
void
setCurrentBoundingRect
(
const
RectF
&
rect
);
double
getCurrentBoundingRotation
()
const
;
void
setCurrentBoundingRotation
(
const
double
rotation
);
std
::
string
getCurrentShapeType
()
const
;
// double properties
QStringList
getCurrentDoubleNames
()
const
;
double
getCurrentDouble
(
const
QString
&
prop
)
const
;
...
...
qt/widgets/instrumentview/src/InstrumentWidgetMaskTab.cpp
View file @
89a714f3
...
...
@@ -623,12 +623,16 @@ void InstrumentWidgetMaskTab::setProperties() {
m_top
=
addDoubleProperty
(
"top"
);
m_right
=
addDoubleProperty
(
"right"
);
m_bottom
=
addDoubleProperty
(
"bottom"
);
m_rotation
=
addDoubleProperty
(
"rotation"
);
boundingRectGroup
->
addSubProperty
(
m_left
);
boundingRectGroup
->
addSubProperty
(
m_top
);
boundingRectGroup
->
addSubProperty
(
m_right
);
boundingRectGroup
->
addSubProperty
(
m_bottom
);
boundingRectGroup
->
addSubProperty
(
m_rotation
);
if
(
isRotationSupported
())
{
m_rotation
=
addDoubleProperty
(
"rotation"
);
boundingRectGroup
->
addSubProperty
(
m_rotation
);
}
// point properties
QStringList
pointProperties
=
m_instrWidget
->
getSurface
()
->
getCurrentPointNames
();
...
...
@@ -653,7 +657,8 @@ void InstrumentWidgetMaskTab::setProperties() {
}
//rotation property
m_doubleManager
->
setValue
(
m_rotation
,
m_instrWidget
->
getSurface
()
->
getCurrentBoundingRotation
());
if
(
isRotationSupported
())
m_doubleManager
->
setValue
(
m_rotation
,
m_instrWidget
->
getSurface
()
->
getCurrentBoundingRotation
());
shapeChanged
();
}
...
...
@@ -676,7 +681,9 @@ void InstrumentWidgetMaskTab::doubleChanged(QtProperty *prop) {
QRectF
rect
(
QPointF
(
x0
,
y0
),
QPointF
(
x1
,
y1
));
m_instrWidget
->
getSurface
()
->
setCurrentBoundingRect
(
RectF
(
rect
));
m_instrWidget
->
getSurface
()
->
setCurrentBoundingRotation
(
m_doubleManager
->
value
(
m_rotation
));
if
(
isRotationSupported
())
m_instrWidget
->
getSurface
()
->
setCurrentBoundingRotation
(
m_doubleManager
->
value
(
m_rotation
));
}
else
{
QString
name
=
m_doublePropertyMap
[
prop
];
...
...
@@ -1429,4 +1436,9 @@ bool InstrumentWidgetMaskTab::saveMaskViewToProject(const std::string &name, con
return
true
;
}
bool
InstrumentWidgetMaskTab
::
isRotationSupported
(){
const
auto
shapeType
=
m_instrWidget
->
getSurface
()
->
getCurrentShapeType
();
return
shapeType
==
"rectangle"
||
shapeType
==
"ellipse"
;
}
}
// namespace MantidQt::MantidWidgets
qt/widgets/instrumentview/src/Shape2DCollection.cpp
View file @
89a714f3
...
...
@@ -578,6 +578,13 @@ void Shape2DCollection::clear() {
emit
shapesDeselected
();
}
std
::
string
Shape2DCollection
::
getCurrentShapeType
()
const
{
if
(
m_currentShape
)
{
return
m_currentShape
->
type
();
}
return
"none"
;
}
QStringList
Shape2DCollection
::
getCurrentDoubleNames
()
const
{
if
(
m_currentShape
)
{
return
m_currentShape
->
getDoubleNames
();
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment