-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.The last set of changes allowed zooming, but now we should be able to land on the correct slice location too.
- Loading branch information
1 parent
0e8454d
commit c92bd85
Showing
28 changed files
with
367 additions
and
236 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
Code/Mantid/MantidQt/SliceViewer/inc/MantidQtSliceViewer/PeakBoundingBox.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#ifndef MANTID_SLICEVIEWER_PEAK_BOUNDING_BOX_H_ | ||
#define MANTID_SLICEVIEWER_PEAK_BOUNDING_BOX_H_ | ||
|
||
#include "MantidKernel/System.h" | ||
|
||
namespace MantidQt | ||
{ | ||
namespace SliceViewer | ||
{ | ||
/** | ||
@class DoubleParam | ||
IntToType Parameter Type. Simple mechanism for ensuring type | ||
safety when working with so many arguments of the same core type in PeakBoundingBox. | ||
*/ | ||
template<int I> | ||
class DLLExport DoubleParam | ||
{ | ||
public: | ||
explicit DoubleParam(const double& val) : value(val){} | ||
DoubleParam(const DoubleParam<I>& other) : value(other.value) {} | ||
DoubleParam<I>& operator=(const DoubleParam<I>& other){value = other.value; return *this;} | ||
double operator()() const {return value;} | ||
private: | ||
double value; | ||
enum{typeValue = I}; | ||
}; | ||
|
||
typedef DoubleParam<0> Left; | ||
typedef DoubleParam<1> Right; | ||
typedef DoubleParam<2> Top; | ||
typedef DoubleParam<3> Bottom; | ||
typedef DoubleParam<4> SlicePoint; | ||
|
||
/** A bounding box for a peak. Allows the SliceViewer to zoom to that region. | ||
@date 2013-01-09 | ||
Copyright © 2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory | ||
This file is part of Mantid. | ||
Mantid is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 3 of the License, or | ||
(at your option) any later version. | ||
Mantid is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
File change history is stored at: <https://github.com/mantidproject/mantid> | ||
Code Documentation is available at: <http://doxygen.mantidproject.org> | ||
*/ | ||
class DLLExport PeakBoundingBox | ||
{ | ||
private: | ||
|
||
Left m_left; | ||
Right m_right; | ||
Top m_top; | ||
Bottom m_bottom; | ||
|
||
/// Slice parellel to projection (z) position | ||
SlicePoint m_slicePoint; | ||
|
||
public: | ||
/// Default constructor | ||
PeakBoundingBox(); | ||
/// Constructor | ||
PeakBoundingBox(const Left& left, const Right& right, const Top& top, const Bottom& bottom, const SlicePoint& slicePoint); | ||
/// Destructor | ||
~PeakBoundingBox(); | ||
/// Copy constructor | ||
PeakBoundingBox(const PeakBoundingBox& other); | ||
/// Assignment | ||
PeakBoundingBox& operator=(const PeakBoundingBox& other); | ||
|
||
/// Get the box left edge | ||
double left() const; | ||
/// Get the box right edge | ||
double right() const; | ||
/// Get the box top edge | ||
double top() const; | ||
/// Get the box bottom edge | ||
double bottom() const; | ||
/// Get the slice point | ||
double slicePoint() const; | ||
|
||
}; | ||
} | ||
} | ||
|
||
#endif /* MANTID_SLICEVIEWER_PEAK_BOUNDING_BOX_H_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#include "MantidQtSliceViewer/PeakBoundingBox.h" | ||
#include <stdexcept> | ||
|
||
namespace MantidQt | ||
{ | ||
namespace SliceViewer | ||
{ | ||
PeakBoundingBox::PeakBoundingBox() : m_left(0), m_right(0), m_top(0), m_bottom(0), m_slicePoint(0) | ||
{ | ||
} | ||
|
||
PeakBoundingBox::PeakBoundingBox(const Left& left, const Right& right, const Top& top, const Bottom& bottom, const SlicePoint& slicePoint) : m_left(left), m_right(right), m_top(top), m_bottom(bottom), m_slicePoint(slicePoint) | ||
{ | ||
if(right() < left()) | ||
{ | ||
throw std::invalid_argument("Right < Left"); | ||
} | ||
if(top() < bottom()) | ||
{ | ||
throw std::invalid_argument("Top < Bottom"); | ||
} | ||
} | ||
|
||
PeakBoundingBox::~PeakBoundingBox() | ||
{ | ||
} | ||
|
||
PeakBoundingBox::PeakBoundingBox(const PeakBoundingBox& other) : m_left(other.m_left), m_right(other.m_right), m_top(other.m_top), m_bottom(other.m_bottom), m_slicePoint(other.m_slicePoint) | ||
{ | ||
} | ||
|
||
PeakBoundingBox& PeakBoundingBox::operator=(const PeakBoundingBox& other) | ||
{ | ||
if(&other != this) | ||
{ | ||
m_top = other.m_top; | ||
m_bottom = other.m_bottom; | ||
m_left = other.m_left; | ||
m_right = other.m_right; | ||
m_slicePoint = other.m_slicePoint; | ||
} | ||
return *this; | ||
} | ||
|
||
double PeakBoundingBox::left() const | ||
{ | ||
return m_left(); | ||
} | ||
|
||
double PeakBoundingBox::right() const | ||
{ | ||
return m_right(); | ||
} | ||
|
||
double PeakBoundingBox::top() const | ||
{ | ||
return m_top(); | ||
} | ||
|
||
double PeakBoundingBox::bottom() const | ||
{ | ||
return m_bottom(); | ||
} | ||
|
||
double PeakBoundingBox::slicePoint() const | ||
{ | ||
return m_slicePoint(); | ||
} | ||
} | ||
} |
Oops, something went wrong.