Commit f8b9e0ad authored by Walsh, Michael's avatar Walsh, Michael Committed by Whitfield, Ross
Browse files

filter rotation prop for only rect and ellipse

parent 4f02c58f
......@@ -150,8 +150,8 @@ private:
/// Load masks applied to the view but not to the workspace
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);
std::shared_ptr<Mantid::API::MatrixWorkspace> loadMask(const std::string &fileName);
bool isRotationSupported();
protected:
/// Is it used?
......
......@@ -185,6 +185,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
......
......@@ -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;
......
......@@ -690,12 +690,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 =
......@@ -722,7 +726,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();
}
......@@ -751,7 +756,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];
......@@ -1555,5 +1562,11 @@ bool InstrumentWidgetMaskTab::saveMaskViewToProject(
return true;
}
bool InstrumentWidgetMaskTab::isRotationSupported(){
const auto shapeType = m_instrWidget->getSurface()->getCurrentShapeType();
return shapeType == "rectangle" || shapeType == "ellipse";
}
} // namespace MantidWidgets
} // namespace MantidQt
......@@ -588,6 +588,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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment