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
71a293c9
Commit
71a293c9
authored
Sep 14, 2021
by
Walsh, Michael
Committed by
Whitfield, Ross
Sep 16, 2021
Browse files
added rotation prop to 2DShape, gui saves to this prop
parent
acc70b26
Changes
5
Hide whitespace changes
Inline
Side-by-side
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/ProjectionSurface.h
View file @
71a293c9
...
...
@@ -167,6 +167,20 @@ public:
/// This method resizes the shape to fit into the new rectangle.
void
setCurrentBoundingRect
(
const
RectF
&
rect
)
{
m_maskShapes
.
setCurrentBoundingRect
(
rect
);
}
/// Return bounding rotation of the currently selected shape in the "original"
/// coord system.
/// It doesn't depend on the zooming of the surface
double
getCurrentBoundingRotation
()
const
{
return
m_maskShapes
.
getCurrentBoundingRotation
();
}
/// Set new bounding rect of the currently selected shape in the "original"
/// coord system.
/// This method resizes the shape to fit into the new rectangle.
void
setCurrentBoundingRotation
(
const
double
rotation
)
{
m_maskShapes
.
setCurrentBoundingRotation
(
rotation
);
}
/// 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/Shape2D.h
View file @
71a293c9
...
...
@@ -87,6 +87,10 @@ public:
virtual
void
adjustBoundingRect
(
double
dx1
,
double
dy1
,
double
dx2
,
double
dy2
);
/// Set new bounding rect.
virtual
void
setBoundingRect
(
const
RectF
&
rect
);
/// Return the bounding rotation of the shape.
virtual
double
getBoundingRotation
()
const
{
return
m_boundingRotation
;
}
/// Set new bounding rotation
virtual
void
setBoundingRotation
(
const
double
rotation
)
{
m_boundingRotation
=
rotation
;
};
/// will the shape be selected if clicked at a point? By default return false.
virtual
bool
selectAt
(
const
QPointF
&
/*unused*/
)
const
{
return
false
;
}
/// is a point inside the shape (closed line)? By default return false.
...
...
@@ -175,6 +179,7 @@ protected:
static
const
size_t
NCommonCP
;
static
const
qreal
sizeCP
;
RectF
m_boundingRect
;
double
m_boundingRotation
=
0.0
;
QColor
m_color
;
QColor
m_fill_color
;
bool
m_scalable
;
///< shape can be scaled when zoomed
...
...
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/Shape2DCollection.h
View file @
71a293c9
...
...
@@ -71,6 +71,8 @@ public:
RectF
getCurrentBoundingRect
()
const
;
void
setCurrentBoundingRect
(
const
RectF
&
rect
);
double
getCurrentBoundingRotation
()
const
;
void
setCurrentBoundingRotation
(
const
double
rotation
);
// double properties
QStringList
getCurrentDoubleNames
()
const
;
double
getCurrentDouble
(
const
QString
&
prop
)
const
;
...
...
qt/widgets/instrumentview/src/InstrumentWidgetMaskTab.cpp
View file @
71a293c9
...
...
@@ -652,6 +652,9 @@ void InstrumentWidgetMaskTab::setProperties() {
m_doublePropertyMap
[
prop
]
=
name
;
}
//rotation property
m_doubleManager
->
setValue
(
m_rotation
,
m_instrWidget
->
getSurface
()
->
getCurrentBoundingRotation
());
shapeChanged
();
}
...
...
@@ -673,6 +676,7 @@ 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
));
}
else
{
QString
name
=
m_doublePropertyMap
[
prop
];
...
...
qt/widgets/instrumentview/src/Shape2DCollection.cpp
View file @
71a293c9
...
...
@@ -634,6 +634,20 @@ void Shape2DCollection::setCurrentBoundingRect(const RectF &rect) {
}
}
double
Shape2DCollection
::
getCurrentBoundingRotation
()
const
{
if
(
m_currentShape
)
{
return
m_currentShape
->
getBoundingRotation
();
}
return
0.0
;
}
void
Shape2DCollection
::
setCurrentBoundingRotation
(
const
double
rotation
)
{
if
(
m_currentShape
)
{
m_currentShape
->
setBoundingRotation
(
rotation
);
emit
shapeChanged
();
}
}
bool
Shape2DCollection
::
isMasked
(
double
x
,
double
y
)
const
{
QPointF
p
(
x
,
y
);
foreach
(
Shape2D
*
shape
,
m_shapes
)
{
...
...
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