diff --git a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp index a1a4b0340e4f5cc2030d810646c8b1639cc9299c..2e62f51ee9824e2f5e136ab416946ab0615aef36 100644 --- a/Framework/Crystal/src/IntegratePeakTimeSlices.cpp +++ b/Framework/Crystal/src/IntegratePeakTimeSlices.cpp @@ -697,8 +697,7 @@ bool IntegratePeakTimeSlices::getNeighborPixIDs( return true; ; - boost::shared_ptr<Geometry::Detector> det = - boost::dynamic_pointer_cast<Geometry::Detector>(comp); + auto det = boost::dynamic_pointer_cast<Geometry::Detector>(comp); if (det) { V3D pos = det->getPos() - Center; @@ -711,7 +710,7 @@ bool IntegratePeakTimeSlices::getNeighborPixIDs( return true; } - boost::shared_ptr<const Geometry::ICompAssembly> Assembly = + auto Assembly = boost::dynamic_pointer_cast<const Geometry::ICompAssembly>(comp); if (!Assembly) diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/GridDetector.h b/Framework/Geometry/inc/MantidGeometry/Instrument/GridDetector.h index de9d67803cb1ad57cc9de18da6b11f08c4c4bbb2..00918ad088ba9621025a54be9fd3f2f28e5ea41a 100644 --- a/Framework/Geometry/inc/MantidGeometry/Instrument/GridDetector.h +++ b/Framework/Geometry/inc/MantidGeometry/Instrument/GridDetector.h @@ -24,7 +24,7 @@ class ComponentVisitor; * @author Lamar Moore, ISIS * @date 2018-Jul-24 -Copyright © 2007-8 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge +Copyright © 2018 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. @@ -53,8 +53,6 @@ class MANTID_GEOMETRY_DLL GridDetector : public CompAssembly, public: /// String description of the type of component std::string type() const override { return "GridDetector"; } - //! Empty constructor - GridDetector(); //! Constructor with a name and parent reference GridDetector(const std::string &name, IComponent *reference = nullptr); @@ -79,7 +77,7 @@ public: const int z) const; detid_t getDetectorIDAtXYZ(const int x, const int y, const int z) const; - std::tuple<int, int, int> getXYZForDetectorID(const int detectorID) const; + std::tuple<int, int, int> getXYZForDetectorID(const detid_t detectorID) const; int xpixels() const; int ypixels() const; @@ -108,16 +106,15 @@ public: Kernel::V3D getRelativePosAtXYZ(int x, int y, int z) const; /// minimum detector id - int minDetectorID(); + detid_t minDetectorID(); /// maximum detector id - int maxDetectorID(); + detid_t maxDetectorID(); boost::shared_ptr<const IComponent> getComponentByName(const std::string &cname, int nlevels = 0) const override; // This should inherit the getBoundingBox implementation from CompAssembly - // but - // the multiple inheritance seems to confuse it so we'll explicityly tell it - // that here + // but the multiple inheritance seems to confuse it so we'll explicityly tell + // it that here using CompAssembly::getBoundingBox; void testIntersectionWithChildren( @@ -214,9 +211,9 @@ private: /// Pointer to the shape of the pixels in this detector array. boost::shared_ptr<IObject> m_shape; /// minimum detector id - int m_minDetId; + detid_t m_minDetId; /// maximum detector id - int m_maxDetId; + detid_t m_maxDetId; /// IDs start here int m_idstart; diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/GridDetectorPixel.h b/Framework/Geometry/inc/MantidGeometry/Instrument/GridDetectorPixel.h index 16c65e031926380a7ead346af9cfac1b8e70fa49..938856d468fb9f65a9c84be2bc0b47103f2125ee 100644 --- a/Framework/Geometry/inc/MantidGeometry/Instrument/GridDetectorPixel.h +++ b/Framework/Geometry/inc/MantidGeometry/Instrument/GridDetectorPixel.h @@ -19,9 +19,9 @@ that is one pixel inside a GridDetector. The position of the pixel is calculated on the fly from the row/column/plane of the pixel and the size of the parent (which is parametrized). -@date 2011-11-22 +@date 2018-09-28 -Copyright © 2011 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge +Copyright © 2018 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. diff --git a/Framework/Geometry/src/Instrument/GridDetector.cpp b/Framework/Geometry/src/Instrument/GridDetector.cpp index d5c282abd55e1a93bfa08a61cf97b5a6098079a5..a4d84cbdf80103a874ed812a7d29ee9a0d9cd7f4 100644 --- a/Framework/Geometry/src/Instrument/GridDetector.cpp +++ b/Framework/Geometry/src/Instrument/GridDetector.cpp @@ -24,16 +24,6 @@ namespace Geometry { using Kernel::Matrix; using Kernel::V3D; -/** Empty constructor - */ -GridDetector::GridDetector() - : CompAssembly(), IObjComponent(nullptr), m_gridBase(nullptr), - m_minDetId(0), m_maxDetId(0) { - - init(); - setGeometryHandler(new GeometryHandler(this)); -} - /** Constructor for a parametrized GridDetector * @param base: the base (un-parametrized) GridDetector * @param map: pointer to the ParameterMap @@ -63,9 +53,7 @@ GridDetector::GridDetector(const std::string &n, IComponent *reference) } bool GridDetector::compareName(const std::string &proposedMatch) { - static const boost::regex exp("GridDetector|gridDetector|" - "griddetector|grid_detector"); - + static const boost::regex exp("grid_?detector", boost::regex::icase); return boost::regex_match(proposedMatch, exp); } @@ -234,7 +222,7 @@ std::tuple<int, int, int> getXYZFillFirstX(const GridDetector *me, int col, * @return tuple of (x,y,z) */ std::tuple<int, int, int> -GridDetector::getXYZForDetectorID(const int detectorID) const { +GridDetector::getXYZForDetectorID(const detid_t detectorID) const { const GridDetector *me = this; if (m_map) me = this->m_gridBase; @@ -642,7 +630,7 @@ void GridDetector::initialize(boost::shared_ptr<IObject> shape, int xpixels, /** Returns the minimum detector id * @return minimum detector id */ -int GridDetector::minDetectorID() { +detid_t GridDetector::minDetectorID() { if (m_map) return m_gridBase->m_minDetId; return m_minDetId; @@ -652,7 +640,7 @@ int GridDetector::minDetectorID() { /** Returns the maximum detector id * @return maximum detector id */ -int GridDetector::maxDetectorID() { +detid_t GridDetector::maxDetectorID() { if (m_map) return m_gridBase->m_maxDetId; return m_maxDetId; @@ -844,11 +832,8 @@ void GridDetector::getBoundingBox(BoundingBox &assemblyBox) const { * nothing. */ void GridDetector::draw() const { - // std::cout << "GridDetector::draw() called for " << this->getName() - // << "\n"; if (Handle() == nullptr) return; - // Render the ObjComponent and then render the object Handle()->render(); } @@ -856,9 +841,7 @@ void GridDetector::draw() const { * Draws the Object */ void GridDetector::drawObject() const { - // std::cout << "GridDetector::drawObject() called for " << - // this->getName() << "\n"; - // if(shape!=NULL) shape->draw(); + draw(); } /** @@ -866,12 +849,8 @@ void GridDetector::drawObject() const { * before rendering. */ void GridDetector::initDraw() const { - // std::cout << "GridDetector::initDraw() called for " << - // this->getName() << "\n"; if (Handle() == nullptr) return; - // Render the ObjComponent and then render the object - // if(shape!=NULL) shape->initDraw(); Handle()->initialize(); } diff --git a/Framework/Geometry/src/Instrument/InstrumentVisitor.cpp b/Framework/Geometry/src/Instrument/InstrumentVisitor.cpp index 09ba7f1afe88ebbd70abeec126ddc59b2fe99737..a636a65bf62a87243c5ad07565ed6071e40f18c8 100644 --- a/Framework/Geometry/src/Instrument/InstrumentVisitor.cpp +++ b/Framework/Geometry/src/Instrument/InstrumentVisitor.cpp @@ -258,7 +258,7 @@ size_t InstrumentVisitor::registerGenericObjComponent( } /** - * Register a structured bank + * Register a rectangular bank * @param bank : Rectangular Detector * @return index assigned */ @@ -270,7 +270,7 @@ size_t InstrumentVisitor::registerRectangularBank(const ICompAssembly &bank) { } /** - * Register a structured bank + * Register a grid bank * @param bank : Grid Detector * @return index assigned */ diff --git a/Framework/Geometry/src/Instrument/RectangularDetector.cpp b/Framework/Geometry/src/Instrument/RectangularDetector.cpp index bab6da7027eb294df869eebb02c28dc20f0cc957..b0d1e2e1c81cb72907bcf39bd66270f6447f5891 100644 --- a/Framework/Geometry/src/Instrument/RectangularDetector.cpp +++ b/Framework/Geometry/src/Instrument/RectangularDetector.cpp @@ -39,9 +39,6 @@ namespace Geometry { using Kernel::Matrix; using Kernel::V3D; -/** Empty constructor - */ -RectangularDetector::RectangularDetector() : GridDetector() { init(); } /** Constructor for a parametrized RectangularDetector * @param base: the base (un-parametrized) RectangularDetector diff --git a/Framework/Geometry/test/GridDetectorTest.h b/Framework/Geometry/test/GridDetectorTest.h index 7b168471bf11e4d2a160085fbf2cceb8efe9e8c0..2807556c5896e596c2381bcf11a100b0262610ee 100644 --- a/Framework/Geometry/test/GridDetectorTest.h +++ b/Framework/Geometry/test/GridDetectorTest.h @@ -18,19 +18,6 @@ using Mantid::Kernel::V3D; class GridDetectorTest : public CxxTest::TestSuite { public: - void testEmptyConstructor() { - GridDetector q; - TS_ASSERT_EQUALS(q.nelements(), 0); - TS_ASSERT_THROWS(q[0], std::runtime_error); - - TS_ASSERT_EQUALS(q.getName(), ""); - TS_ASSERT(!q.getParent()); - TS_ASSERT_EQUALS(q.getRelativePos(), V3D(0, 0, 0)); - TS_ASSERT_EQUALS(q.getRelativeRot(), Quat(1, 0, 0, 0)); - // as there is no parent GetPos should equal getRelativePos - TS_ASSERT_EQUALS(q.getRelativePos(), q.getPos()); - } - void testNameValueConstructor() { GridDetector q("Name"); TS_ASSERT_EQUALS(q.nelements(), 0); diff --git a/Framework/Geometry/test/RectangularDetectorTest.h b/Framework/Geometry/test/RectangularDetectorTest.h index a77e6c211607be9fe36a41252e396b041b71c02c..99f64e0056d2eb2ee7feb4f50a4079922c27fc82 100644 --- a/Framework/Geometry/test/RectangularDetectorTest.h +++ b/Framework/Geometry/test/RectangularDetectorTest.h @@ -18,19 +18,6 @@ using Mantid::Kernel::V3D; class RectangularDetectorTest : public CxxTest::TestSuite { public: - void testEmptyConstructor() { - RectangularDetector q; - TS_ASSERT_EQUALS(q.nelements(), 0); - TS_ASSERT_THROWS(q[0], std::runtime_error); - - TS_ASSERT_EQUALS(q.getName(), ""); - TS_ASSERT(!q.getParent()); - TS_ASSERT_EQUALS(q.getRelativePos(), V3D(0, 0, 0)); - TS_ASSERT_EQUALS(q.getRelativeRot(), Quat(1, 0, 0, 0)); - // as there is no parent GetPos should equal getRelativePos - TS_ASSERT_EQUALS(q.getRelativePos(), q.getPos()); - } - void testNameValueConstructor() { RectangularDetector q("Name"); TS_ASSERT_EQUALS(q.nelements(), 0); diff --git a/qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/InstrumentWidgetRenderTab.h b/qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/InstrumentWidgetRenderTab.h index 8b5c092e28b29b6b6bfe1a50f97350147dc45d8b..fea224503c64665de86090a9db87dc7f02b467f4 100644 --- a/qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/InstrumentWidgetRenderTab.h +++ b/qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/InstrumentWidgetRenderTab.h @@ -16,7 +16,7 @@ class QActionGroup; class QMenu; class QLineEdit; class QSlider; -class QSpinBox; +class QLabel; class QVBoxLayout; class QHBoxLayout; @@ -131,7 +131,7 @@ private: // members QCheckBox *m_layerCheck; QSlider *m_layerSlide; - QSpinBox *m_layerSpin; + QLabel *m_layerDisplay; bool m_usingLayerStore; diff --git a/qt/widgets/instrumentview/src/InstrumentWidgetRenderTab.cpp b/qt/widgets/instrumentview/src/InstrumentWidgetRenderTab.cpp index 2f8c3ae377073419332121e80a003dac3838b3da..9585352708ec358eeea576a1de33a7167733c88f 100644 --- a/qt/widgets/instrumentview/src/InstrumentWidgetRenderTab.cpp +++ b/qt/widgets/instrumentview/src/InstrumentWidgetRenderTab.cpp @@ -17,7 +17,6 @@ #include <QPushButton> #include <QSettings> #include <QSignalMapper> -#include <QSpinBox> #include <QToolTip> #include <QVBoxLayout> @@ -262,13 +261,12 @@ void InstrumentWidgetRenderTab::setupGridBankMenu(QVBoxLayout *parentLayout) { m_layerSlide = new QSlider(Qt::Orientation::Horizontal, this); m_layerCheck = new QCheckBox("Show Single Layer", this); - m_layerSpin = new QSpinBox(this); + m_layerDisplay = new QLabel("0", this); m_layerSlide->setRange(0, static_cast<int>(actor.getNumberOfGridLayers() - 1)); - m_layerSpin->setRange(0, m_layerSlide->maximum()); - m_layerSpin->setReadOnly(true); m_layerSlide->setSingleStep(1); + m_layerSlide->setPageStep(1); m_layerSlide->setSliderPosition(0); m_layerSlide->setEnabled(false); m_layerCheck->setChecked(false); @@ -277,12 +275,10 @@ void InstrumentWidgetRenderTab::setupGridBankMenu(QVBoxLayout *parentLayout) { SLOT(toggleLayerDisplay(bool))); connect(m_layerSlide, SIGNAL(valueChanged(int)), this, SLOT(setVisibleLayer(int))); - connect(m_layerSlide, SIGNAL(valueChanged(int)), m_layerSpin, - SLOT(setValue(int))); QHBoxLayout *voxelControlsLayout = new QHBoxLayout(); voxelControlsLayout->addWidget(m_layerCheck); voxelControlsLayout->addWidget(m_layerSlide); - voxelControlsLayout->addWidget(m_layerSpin); + voxelControlsLayout->addWidget(m_layerDisplay); parentLayout->addLayout(voxelControlsLayout); m_usingLayerStore = false; @@ -374,6 +370,7 @@ void InstrumentWidgetRenderTab::toggleLayerDisplay(bool on) { m_layerSlide->setEnabled(on); auto value = m_layerSlide->value(); actor.setGridLayer(on, value); + m_layerDisplay->setNum(value); emit rescaleColorMap(); } @@ -383,7 +380,7 @@ void InstrumentWidgetRenderTab::setVisibleLayer(int layer) { actor.setGridLayer(true, layer); const auto &renderer = actor.getInstrumentRenderer(); auto surfaceType = m_instrWidget->getSurfaceType(); - + m_layerDisplay->setNum(layer); // If in an unwrapped view the surface needs to be redrawn if (renderer.isUsingLayers() && surfaceType != InstrumentWidget::SurfaceType::FULL3D)