Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
733de318
Commit
733de318
authored
Sep 08, 2021
by
Kendrick, Coleman
Browse files
Fix formatting of other parts
parent
13226198
Changes
3
Hide whitespace changes
Inline
Side-by-side
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/InstrumentActor.h
View file @
733de318
...
...
@@ -63,8 +63,7 @@ public:
static
constexpr
double
INVALID_VALUE
=
std
::
numeric_limits
<
double
>::
lowest
();
/// Constructor
InstrumentActor
(
const
QString
&
wsName
,
bool
autoscaling
=
true
,
double
scaleMin
=
0.0
,
double
scaleMax
=
0.0
);
InstrumentActor
(
const
QString
&
wsName
,
bool
autoscaling
=
true
,
double
scaleMin
=
0.0
,
double
scaleMax
=
0.0
);
///< Destructor
~
InstrumentActor
();
/// Draw the instrument in 3D
...
...
@@ -162,11 +161,9 @@ public:
/// Get the integrated counts of a detector by its detector Index.
double
getIntegratedCounts
(
size_t
index
)
const
;
/// Sum the counts in detectors
void
sumDetectors
(
const
std
::
vector
<
size_t
>
&
dets
,
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
,
size_t
size
)
const
;
void
sumDetectors
(
const
std
::
vector
<
size_t
>
&
dets
,
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
,
size_t
size
)
const
;
/// Sum the counts in detectors.
void
sumDetectors
(
const
std
::
vector
<
size_t
>
&
dets
,
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
)
const
;
void
sumDetectors
(
const
std
::
vector
<
size_t
>
&
dets
,
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
)
const
;
/// Calc indexes for min and max bin values
void
getBinMinMaxIndex
(
size_t
wi
,
size_t
&
imin
,
size_t
&
imax
)
const
;
...
...
@@ -178,17 +175,12 @@ public:
/// Get the guide visibility status
bool
areGuidesShown
()
const
{
return
m_showGuides
;
}
static
void
BasisRotation
(
const
Mantid
::
Kernel
::
V3D
&
Xfrom
,
const
Mantid
::
Kernel
::
V3D
&
Yfrom
,
const
Mantid
::
Kernel
::
V3D
&
Zfrom
,
const
Mantid
::
Kernel
::
V3D
&
Xto
,
const
Mantid
::
Kernel
::
V3D
&
Yto
,
const
Mantid
::
Kernel
::
V3D
&
Zto
,
Mantid
::
Kernel
::
Quat
&
R
,
bool
out
=
false
);
static
void
BasisRotation
(
const
Mantid
::
Kernel
::
V3D
&
Xfrom
,
const
Mantid
::
Kernel
::
V3D
&
Yfrom
,
const
Mantid
::
Kernel
::
V3D
&
Zfrom
,
const
Mantid
::
Kernel
::
V3D
&
Xto
,
const
Mantid
::
Kernel
::
V3D
&
Yto
,
const
Mantid
::
Kernel
::
V3D
&
Zto
,
Mantid
::
Kernel
::
Quat
&
R
,
bool
out
=
false
);
static
void
rotateToLookAt
(
const
Mantid
::
Kernel
::
V3D
&
eye
,
const
Mantid
::
Kernel
::
V3D
&
up
,
Mantid
::
Kernel
::
Quat
&
R
);
static
void
rotateToLookAt
(
const
Mantid
::
Kernel
::
V3D
&
eye
,
const
Mantid
::
Kernel
::
V3D
&
up
,
Mantid
::
Kernel
::
Quat
&
R
);
/* Masking */
...
...
@@ -199,8 +191,7 @@ public:
std
::
string
getDefaultAxis
()
const
;
std
::
string
getDefaultView
()
const
;
std
::
string
getInstrumentName
()
const
;
std
::
vector
<
std
::
string
>
getStringParameter
(
const
std
::
string
&
name
,
bool
recursive
=
true
)
const
;
std
::
vector
<
std
::
string
>
getStringParameter
(
const
std
::
string
&
name
,
bool
recursive
=
true
)
const
;
/// Load the state of the actor from a Mantid project file.
void
loadFromProject
(
const
std
::
string
&
lines
);
/// Save the state of the actor to a Mantid project file.
...
...
@@ -219,25 +210,20 @@ signals:
private:
static
constexpr
double
TOLERANCE
=
0.00001
;
void
setUpWorkspace
(
const
std
::
shared_ptr
<
const
Mantid
::
API
::
MatrixWorkspace
>
&
sharedWorkspace
,
double
scaleMin
,
double
scaleMax
);
void
setUpWorkspace
(
const
std
::
shared_ptr
<
const
Mantid
::
API
::
MatrixWorkspace
>
&
sharedWorkspace
,
double
scaleMin
,
double
scaleMax
);
void
setupPhysicalInstrumentIfExists
();
void
resetColors
();
void
loadSettings
();
void
saveSettings
();
void
setDataMinMaxRange
(
double
vmin
,
double
vmax
);
void
setDataIntegrationRange
(
const
double
&
xmin
,
const
double
&
xmax
);
void
calculateIntegratedSpectra
(
const
Mantid
::
API
::
MatrixWorkspace
&
workspace
);
void
calculateIntegratedSpectra
(
const
Mantid
::
API
::
MatrixWorkspace
&
workspace
);
/// Sum the counts in detectors if the workspace has equal bins for all
/// spectra
void
sumDetectorsUniform
(
const
std
::
vector
<
size_t
>
&
dets
,
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
)
const
;
void
sumDetectorsUniform
(
const
std
::
vector
<
size_t
>
&
dets
,
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
)
const
;
/// Sum the counts in detectors if the workspace is ragged
void
sumDetectorsRagged
(
const
std
::
vector
<
size_t
>
&
dets
,
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
,
void
sumDetectorsRagged
(
const
std
::
vector
<
size_t
>
&
dets
,
std
::
vector
<
double
>
&
x
,
std
::
vector
<
double
>
&
y
,
size_t
size
)
const
;
/// The workspace whose data are shown
...
...
qt/widgets/instrumentview/inc/MantidQtWidgets/InstrumentView/Viewport.h
View file @
733de318
...
...
@@ -56,12 +56,10 @@ public:
/// Return the projection type.
ProjectionType
getProjectionType
()
const
;
/// Set a projection.
void
setProjection
(
double
/*l*/
,
double
/*r*/
,
double
/*b*/
,
double
/*t*/
,
double
/*nearz*/
,
double
/*farz*/
,
void
setProjection
(
double
/*l*/
,
double
/*r*/
,
double
/*b*/
,
double
/*t*/
,
double
/*nearz*/
,
double
/*farz*/
,
ProjectionType
type
=
Viewport
::
ORTHO
);
/// Set a projection.
void
setProjection
(
const
Mantid
::
Kernel
::
V3D
&
minBounds
,
const
Mantid
::
Kernel
::
V3D
&
maxBounds
,
void
setProjection
(
const
Mantid
::
Kernel
::
V3D
&
minBounds
,
const
Mantid
::
Kernel
::
V3D
&
maxBounds
,
ProjectionType
type
=
Viewport
::
ORTHO
);
void
setProjectionZPlane
(
const
Mantid
::
Kernel
::
V3D
&
minBounds
,
const
Mantid
::
Kernel
::
V3D
&
maxBounds
);
/// Apply the projection to OpenGL engine
...
...
@@ -118,8 +116,7 @@ public:
void
setTranslation
(
double
/*xval*/
,
double
/*yval*/
);
// void getProjection(double&,double&,double&,double&,double&,double&);
void
getInstantProjection
(
double
&
/*xmin*/
,
double
&
/*xmax*/
,
double
&
/*ymin*/
,
double
&
/*ymax*/
,
void
getInstantProjection
(
double
&
/*xmin*/
,
double
&
/*xmax*/
,
double
&
/*ymin*/
,
double
&
/*ymax*/
,
double
&
/*zmin*/
,
double
&
/*zmax*/
)
const
;
/// Apply the transformation to a vector
...
...
@@ -131,8 +128,7 @@ public:
protected:
/// Correct for aspect ratio
void
correctForAspectRatioAndZoom
(
double
&
xmin
,
double
&
xmax
,
double
&
ymin
,
double
&
ymax
,
double
&
zmin
,
void
correctForAspectRatioAndZoom
(
double
&
xmin
,
double
&
xmax
,
double
&
ymin
,
double
&
ymax
,
double
&
zmin
,
double
&
zmax
)
const
;
/// Project a point onto a sphere centered at rotation point
void
projectOnSphere
(
int
a
,
int
b
,
Mantid
::
Kernel
::
V3D
&
point
)
const
;
...
...
qt/widgets/instrumentview/src/Viewport.cpp
View file @
733de318
...
...
@@ -23,10 +23,9 @@ namespace MantidWidgets {
* @param glWidgetDimensions Viewport width/height in device pixels
*/
Viewport
::
Viewport
(
QSize
dimensions
)
:
m_projectionType
(
Viewport
::
ORTHO
),
m_dimensions
(
std
::
move
(
dimensions
)),
m_left
(
-
1
),
m_right
(
1
),
m_bottom
(
-
1
),
m_top
(
1
),
m_near
(
-
1
),
m_far
(
1
),
m_rotationspeed
(
180.0
/
M_PI
),
m_zoomFactor
(
1.0
),
m_xTrans
(
0.0
),
m_yTrans
(
0.0
),
m_zTrans
(
0.0
)
{
:
m_projectionType
(
Viewport
::
ORTHO
),
m_dimensions
(
std
::
move
(
dimensions
)),
m_left
(
-
1
),
m_right
(
1
),
m_bottom
(
-
1
),
m_top
(
1
),
m_near
(
-
1
),
m_far
(
1
),
m_rotationspeed
(
180.0
/
M_PI
),
m_zoomFactor
(
1.0
),
m_xTrans
(
0.0
),
m_yTrans
(
0.0
),
m_zTrans
(
0.0
)
{
m_quaternion
.
GLMatrix
(
&
m_rotationmatrix
[
0
]);
}
...
...
@@ -34,9 +33,7 @@ Viewport::Viewport(QSize dimensions)
* Resize the viewport = size of the displaying widget.
* @param dimensions Viewport width/height in device pixels
*/
void
Viewport
::
resize
(
QSize
dimensions
)
{
m_dimensions
=
std
::
move
(
dimensions
);
}
void
Viewport
::
resize
(
QSize
dimensions
)
{
m_dimensions
=
std
::
move
(
dimensions
);
}
/**
* Get the size of the viewport in logical pixels (size of the displaying
...
...
@@ -61,8 +58,7 @@ QSize Viewport::dimensions() const { return m_dimensions; }
* @param type :: Projection type: ORTHO or PERSPECTIVE. PERSPECTIVE isn't fully
*implemented
*/
void
Viewport
::
setProjection
(
double
l
,
double
r
,
double
b
,
double
t
,
double
nearz
,
double
farz
,
void
Viewport
::
setProjection
(
double
l
,
double
r
,
double
b
,
double
t
,
double
nearz
,
double
farz
,
Viewport
::
ProjectionType
type
)
{
m_projectionType
=
type
;
m_left
=
l
;
...
...
@@ -90,8 +86,7 @@ void Viewport::setProjection(double l, double r, double b, double t,
* @param type :: Projection type: ORTHO or PERSPECTIVE. PERSPECTIVE isn't fully
*implemented
*/
void
Viewport
::
setProjection
(
const
Mantid
::
Kernel
::
V3D
&
minBounds
,
const
Mantid
::
Kernel
::
V3D
&
maxBounds
,
void
Viewport
::
setProjection
(
const
Mantid
::
Kernel
::
V3D
&
minBounds
,
const
Mantid
::
Kernel
::
V3D
&
maxBounds
,
ProjectionType
type
)
{
double
radius
=
minBounds
.
norm
();
double
tmp
=
maxBounds
.
norm
();
...
...
@@ -104,8 +99,7 @@ void Viewport::setProjection(const Mantid::Kernel::V3D &minBounds,
m_zminOrig
=
m_zmin
;
m_zmaxOrig
=
m_zmax
;
setProjection
(
minBounds
.
X
(),
maxBounds
.
X
(),
minBounds
.
Y
(),
maxBounds
.
Y
(),
-
radius
,
radius
,
type
);
setProjection
(
minBounds
.
X
(),
maxBounds
.
X
(),
minBounds
.
Y
(),
maxBounds
.
Y
(),
-
radius
,
radius
,
type
);
}
/**
...
...
@@ -127,9 +121,8 @@ void Viewport::setProjectionZPlane(const Mantid::Kernel::V3D &minBounds, const M
/**
* Return XY plane bounds corrected for the aspect ratio.
*/
void
Viewport
::
correctForAspectRatioAndZoom
(
double
&
xmin
,
double
&
xmax
,
double
&
ymin
,
double
&
ymax
,
double
&
zmin
,
double
&
zmax
)
const
{
void
Viewport
::
correctForAspectRatioAndZoom
(
double
&
xmin
,
double
&
xmax
,
double
&
ymin
,
double
&
ymax
,
double
&
zmin
,
double
&
zmax
)
const
{
xmin
=
m_left
;
xmax
=
m_right
;
ymin
=
m_bottom
;
...
...
@@ -154,9 +147,7 @@ void Viewport::correctForAspectRatioAndZoom(double &xmin, double &xmax,
zmax
=
m_far
*
m_zoomFactor
;
}
Viewport
::
ProjectionType
Viewport
::
getProjectionType
()
const
{
return
m_projectionType
;
}
Viewport
::
ProjectionType
Viewport
::
getProjectionType
()
const
{
return
m_projectionType
;
}
/**
* Get the projection bounds.
...
...
@@ -167,8 +158,7 @@ Viewport::ProjectionType Viewport::getProjectionType() const {
* @param zmin :: near side of the Ortho Projection
* @param zmax :: far side of the Ortho Projection
*/
void
Viewport
::
getInstantProjection
(
double
&
xmin
,
double
&
xmax
,
double
&
ymin
,
double
&
ymax
,
double
&
zmin
,
void
Viewport
::
getInstantProjection
(
double
&
xmin
,
double
&
xmax
,
double
&
ymin
,
double
&
ymax
,
double
&
zmin
,
double
&
zmax
)
const
{
correctForAspectRatioAndZoom
(
xmin
,
xmax
,
ymin
,
ymax
,
zmin
,
zmax
);
}
...
...
@@ -208,9 +198,7 @@ void Viewport::applyProjection() const {
if
(
OpenGLError
::
hasError
(
"GLViewport::issueGL()"
))
{
OpenGLError
::
log
()
<<
"Arguments to glOrtho:
\n
"
;
OpenGLError
::
log
()
<<
xmin
<<
' '
<<
xmax
<<
'\n'
<<
ymin
<<
' '
<<
ymax
<<
'\n'
<<
zmin
<<
' '
<<
zmax
<<
"
\n\n
"
;
OpenGLError
::
log
()
<<
xmin
<<
' '
<<
xmax
<<
'\n'
<<
ymin
<<
' '
<<
ymax
<<
'\n'
<<
zmin
<<
' '
<<
zmax
<<
"
\n\n
"
;
}
}
// Reset the rendering options just in case
...
...
@@ -228,10 +216,8 @@ void Viewport::applyProjection() const {
void
Viewport
::
projectOnSphere
(
int
a
,
int
b
,
Mantid
::
Kernel
::
V3D
&
point
)
const
{
// z initiaised to zero if out of the sphere
double
z
=
0
;
auto
x
=
static_cast
<
double
>
((
2.0
*
a
-
m_dimensions
.
width
())
/
m_dimensions
.
width
());
auto
y
=
static_cast
<
double
>
((
m_dimensions
.
height
()
-
2.0
*
b
)
/
m_dimensions
.
height
());
auto
x
=
static_cast
<
double
>
((
2.0
*
a
-
m_dimensions
.
width
())
/
m_dimensions
.
width
());
auto
y
=
static_cast
<
double
>
((
m_dimensions
.
height
()
-
2.0
*
b
)
/
m_dimensions
.
height
());
double
norm
=
x
*
x
+
y
*
y
;
if
(
norm
>
1.0
)
// The point is inside the sphere
{
...
...
@@ -276,8 +262,7 @@ void Viewport::reset() {
*/
void
Viewport
::
setViewToXPositive
()
{
reset
();
Mantid
::
Kernel
::
Quat
tempy
(
Mantid
::
Kernel
::
V3D
(
0.0
,
0.0
,
1.0
),
Mantid
::
Kernel
::
V3D
(
-
1.0
,
0.0
,
0.0
));
Mantid
::
Kernel
::
Quat
tempy
(
Mantid
::
Kernel
::
V3D
(
0.0
,
0.0
,
1.0
),
Mantid
::
Kernel
::
V3D
(
-
1.0
,
0.0
,
0.0
));
m_quaternion
=
tempy
;
m_quaternion
.
GLMatrix
(
&
m_rotationmatrix
[
0
]);
adjustProjection
();
...
...
@@ -289,8 +274,7 @@ void Viewport::setViewToXPositive() {
*/
void
Viewport
::
setViewToYPositive
()
{
reset
();
Mantid
::
Kernel
::
Quat
tempy
(
Mantid
::
Kernel
::
V3D
(
0.0
,
0.0
,
1.0
),
Mantid
::
Kernel
::
V3D
(
0.0
,
-
1.0
,
0.0
));
Mantid
::
Kernel
::
Quat
tempy
(
Mantid
::
Kernel
::
V3D
(
0.0
,
0.0
,
1.0
),
Mantid
::
Kernel
::
V3D
(
0.0
,
-
1.0
,
0.0
));
m_quaternion
=
tempy
;
m_quaternion
.
GLMatrix
(
&
m_rotationmatrix
[
0
]);
adjustProjection
();
...
...
@@ -313,8 +297,7 @@ void Viewport::setViewToZPositive() {
*/
void
Viewport
::
setViewToXNegative
()
{
reset
();
Mantid
::
Kernel
::
Quat
tempy
(
Mantid
::
Kernel
::
V3D
(
0.0
,
0.0
,
1.0
),
Mantid
::
Kernel
::
V3D
(
1.0
,
0.0
,
0.0
));
Mantid
::
Kernel
::
Quat
tempy
(
Mantid
::
Kernel
::
V3D
(
0.0
,
0.0
,
1.0
),
Mantid
::
Kernel
::
V3D
(
1.0
,
0.0
,
0.0
));
m_quaternion
=
tempy
;
m_quaternion
.
GLMatrix
(
&
m_rotationmatrix
[
0
]);
adjustProjection
();
...
...
@@ -326,8 +309,7 @@ void Viewport::setViewToXNegative() {
*/
void
Viewport
::
setViewToYNegative
()
{
reset
();
Mantid
::
Kernel
::
Quat
tempy
(
Mantid
::
Kernel
::
V3D
(
0.0
,
0.0
,
1.0
),
Mantid
::
Kernel
::
V3D
(
0.0
,
1.0
,
0.0
));
Mantid
::
Kernel
::
Quat
tempy
(
Mantid
::
Kernel
::
V3D
(
0.0
,
0.0
,
1.0
),
Mantid
::
Kernel
::
V3D
(
0.0
,
1.0
,
0.0
));
m_quaternion
=
tempy
;
m_quaternion
.
GLMatrix
(
&
m_rotationmatrix
[
0
]);
adjustProjection
();
...
...
@@ -395,8 +377,7 @@ void Viewport::initZoomFrom(int a, int b) {
* @param b :: The y mouse coordinate
*/
void
Viewport
::
generateZoomTo
(
int
a
,
int
b
)
{
if
(
a
>=
m_dimensions
.
width
()
||
b
>=
m_dimensions
.
height
()
||
a
<=
0
||
b
<=
0
)
if
(
a
>=
m_dimensions
.
width
()
||
b
>=
m_dimensions
.
height
()
||
a
<=
0
||
b
<=
0
)
return
;
auto
y
=
static_cast
<
double
>
(
b
-
m_dimensions
.
height
());
if
(
y
==
0
)
...
...
@@ -445,9 +426,7 @@ void Viewport::setZoom(double zoom) {
* @param a :: The x mouse coordinate
* @param b :: The y mouse coordinate
*/
void
Viewport
::
initRotationFrom
(
int
a
,
int
b
)
{
projectOnSphere
(
a
,
b
,
m_lastpoint
);
}
void
Viewport
::
initRotationFrom
(
int
a
,
int
b
)
{
projectOnSphere
(
a
,
b
,
m_lastpoint
);
}
/**
* Generate the rotation matrix to rotate to this point.
...
...
@@ -475,9 +454,7 @@ void Viewport::generateRotationTo(int a, int b) {
* @param a :: The x mouse coordinate
* @param b :: The y mouse coordinate
*/
void
Viewport
::
initTranslateFrom
(
int
a
,
int
b
)
{
generateTranslationPoint
(
a
,
b
,
m_lastpoint
);
}
void
Viewport
::
initTranslateFrom
(
int
a
,
int
b
)
{
generateTranslationPoint
(
a
,
b
,
m_lastpoint
);
}
/**
* Generate scene translation such that a point of the last initTranslateFrom
...
...
@@ -500,15 +477,12 @@ void Viewport::generateTranslationTo(int a, int b) {
* @param b :: The y mouse coordinate
* @param point :: Return the result through this reference.
*/
void
Viewport
::
generateTranslationPoint
(
int
a
,
int
b
,
Mantid
::
Kernel
::
V3D
&
point
)
const
{
void
Viewport
::
generateTranslationPoint
(
int
a
,
int
b
,
Mantid
::
Kernel
::
V3D
&
point
)
const
{
double
x
,
y
,
z
=
0.0
;
double
xmin
,
xmax
,
ymin
,
ymax
,
zmin
,
zmax
;
correctForAspectRatioAndZoom
(
xmin
,
xmax
,
ymin
,
ymax
,
zmin
,
zmax
);
x
=
static_cast
<
double
>
(
(
xmin
+
((
xmax
-
xmin
)
*
((
double
)
a
/
(
double
)
m_dimensions
.
width
()))));
y
=
static_cast
<
double
>
((
ymin
+
((
ymax
-
ymin
)
*
(
m_dimensions
.
height
()
-
b
)
/
m_dimensions
.
height
())));
x
=
static_cast
<
double
>
((
xmin
+
((
xmax
-
xmin
)
*
((
double
)
a
/
(
double
)
m_dimensions
.
width
()))));
y
=
static_cast
<
double
>
((
ymin
+
((
ymax
-
ymin
)
*
(
m_dimensions
.
height
()
-
b
)
/
m_dimensions
.
height
())));
point
(
x
,
y
,
z
);
}
...
...
@@ -544,8 +518,7 @@ void Viewport::loadFromProject(const std::string &lines) {
setRotation
(
quat
);
#else
Q_UNUSED
(
lines
);
throw
std
::
runtime_error
(
"Viewport::loadFromProject not implemented for Qt >= 5"
);
throw
std
::
runtime_error
(
"Viewport::loadFromProject not implemented for Qt >= 5"
);
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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