Verified Commit 643c34ea authored by Tobias WEBER's avatar Tobias WEBER
Browse files

cleanups

parent 781672c2
...@@ -18,8 +18,9 @@ set(CMAKE_AUTOUIC TRUE) ...@@ -18,8 +18,9 @@ set(CMAKE_AUTOUIC TRUE)
set(CMAKE_AUTOMOC TRUE) set(CMAKE_AUTOMOC TRUE)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
add_definitions(-std=c++20) add_compile_options(-std=c++20)
add_definitions(${Boost_CXX_FLAGS}) add_compile_options(${Boost_CXX_FLAGS})
add_compile_options(-Wall -Wextra)
include_directories("${PROJECT_SOURCE_DIR}" "${Boost_INCLUDE_DIRS}/.." "../..") include_directories("${PROJECT_SOURCE_DIR}" "${Boost_INCLUDE_DIRS}/.." "../..")
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <string> #include <string>
#include <optional>
#include "libs/glplot.h" #include "libs/glplot.h"
#include "libs/math20.h" #include "libs/math20.h"
...@@ -75,8 +76,8 @@ private: ...@@ -75,8 +76,8 @@ private:
bool m_3dobjsReady = false; bool m_3dobjsReady = false;
bool m_mouseDown[3] = {false, false, false}; bool m_mouseDown[3] = {false, false, false};
long m_curPickedObj = -1; std::optional<std::size_t> m_curPickedObj{};
long m_curDraggedObj = -1; std::optional<std::size_t> m_curDraggedObj{};
protected: protected:
...@@ -172,19 +173,20 @@ protected slots: ...@@ -172,19 +173,20 @@ protected slots:
*/ */
void PickerIntersection(const t_vec3_gl* pos, std::size_t objIdx, const t_vec3_gl* posSphere) void PickerIntersection(const t_vec3_gl* pos, std::size_t objIdx, const t_vec3_gl* posSphere)
{ {
m_curPickedObj = -1; m_curPickedObj.reset();
if(pos) if(pos)
{ // object selected? { // object selected?
m_curPickedObj = long(objIdx); m_curPickedObj = objIdx;
if(objIdx == m_arrow_pi) m_labelStatus->setText("P_i"); if(objIdx == m_arrow_pi) m_labelStatus->setText("P_i");
else if(objIdx == m_arrow_pf) m_labelStatus->setText("P_f"); else if(objIdx == m_arrow_pf) m_labelStatus->setText("P_f");
else if(objIdx == m_arrow_M_Re) m_labelStatus->setText("Re{M_perp}"); else if(objIdx == m_arrow_M_Re) m_labelStatus->setText("Re{M_perp}");
else if(objIdx == m_arrow_M_Im) m_labelStatus->setText("Im{M_perp}"); else if(objIdx == m_arrow_M_Im) m_labelStatus->setText("Im{M_perp}");
else m_curPickedObj = -1; else m_curPickedObj.reset();
} }
if(m_curPickedObj >= 0) if(m_curPickedObj)
{ {
setCursor(Qt::CrossCursor); setCursor(Qt::CrossCursor);
} }
...@@ -195,26 +197,26 @@ protected slots: ...@@ -195,26 +197,26 @@ protected slots:
} }
if(posSphere && m_mouseDown[0]) if(posSphere && m_mouseDown[0] && m_curDraggedObj)
{ // picker intersecting unit sphere and mouse dragged? { // picker intersecting unit sphere and mouse dragged?
t_vec3_gl posSph = *posSphere; t_vec3_gl posSph = *posSphere;
if(m_curDraggedObj == m_arrow_pi) if(*m_curDraggedObj == m_arrow_pi)
{ {
m_editPiX->setText(QVariant(posSph[0]).toString()); m_editPiX->setText(QVariant(posSph[0]).toString());
m_editPiY->setText(QVariant(posSph[1]).toString()); m_editPiY->setText(QVariant(posSph[1]).toString());
m_editPiZ->setText(QVariant(posSph[2]).toString()); m_editPiZ->setText(QVariant(posSph[2]).toString());
CalcPol(); CalcPol();
} }
else if(m_curDraggedObj == m_arrow_M_Re) else if(*m_curDraggedObj == m_arrow_M_Re)
{ {
m_editMPerpReX->setText(QVariant(posSph[0]).toString()); m_editMPerpReX->setText(QVariant(posSph[0]).toString());
m_editMPerpReY->setText(QVariant(posSph[1]).toString()); m_editMPerpReY->setText(QVariant(posSph[1]).toString());
m_editMPerpReZ->setText(QVariant(posSph[2]).toString()); m_editMPerpReZ->setText(QVariant(posSph[2]).toString());
CalcPol(); CalcPol();
} }
else if(m_curDraggedObj == m_arrow_M_Im) else if(*m_curDraggedObj == m_arrow_M_Im)
{ {
m_editMPerpImX->setText(QVariant(posSph[0]).toString()); m_editMPerpImX->setText(QVariant(posSph[0]).toString());
m_editMPerpImY->setText(QVariant(posSph[1]).toString()); m_editMPerpImY->setText(QVariant(posSph[1]).toString());
...@@ -236,10 +238,12 @@ protected slots: ...@@ -236,10 +238,12 @@ protected slots:
if(m_mouseDown[0]) if(m_mouseDown[0])
{ {
m_curDraggedObj = m_curPickedObj; if((m_curDraggedObj = m_curPickedObj))
auto lenVec = GetArrowLen(m_curDraggedObj); {
if(lenVec > 0.) auto lenVec = GetArrowLen(*m_curDraggedObj);
m_plot->GetImpl()->SetPickerSphereRadius(lenVec); if(lenVec > 0.)
m_plot->GetImpl()->SetPickerSphereRadius(lenVec);
}
} }
} }
...@@ -254,7 +258,7 @@ protected slots: ...@@ -254,7 +258,7 @@ protected slots:
if(right) m_mouseDown[2] = false; if(right) m_mouseDown[2] = false;
if(!m_mouseDown[0]) if(!m_mouseDown[0])
m_curDraggedObj = -1; m_curDraggedObj.reset();
} }
......
...@@ -23,9 +23,9 @@ add_compile_options(-Wall -Wextra) ...@@ -23,9 +23,9 @@ add_compile_options(-Wall -Wextra)
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Boost # Boost
add_definitions(-DBOOST_SYSTEM_NO_DEPRECATED) add_compile_options(-DBOOST_SYSTEM_NO_DEPRECATED)
find_package(Boost REQUIRED COMPONENTS system filesystem iostreams REQUIRED) find_package(Boost REQUIRED COMPONENTS system filesystem iostreams REQUIRED)
add_definitions(${Boost_CXX_FLAGS}) add_compile_options(${Boost_CXX_FLAGS})
# Qt # Qt
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport) find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport)
...@@ -99,10 +99,10 @@ add_executable(takin_scanbrowser ...@@ -99,10 +99,10 @@ add_executable(takin_scanbrowser
# ../../ext/qcp/qcustomplot.cpp ../../ext/qcp/qcustomplot.h # ../../ext/qcp/qcustomplot.cpp ../../ext/qcp/qcustomplot.h
) )
qt5_use_modules(takin_scanbrowser Core Gui Widgets OpenGL)
target_link_libraries(takin_scanbrowser target_link_libraries(takin_scanbrowser
${Boost_LIBRARIES} ${Boost_LIBRARIES}
Core Gui Widgets PrintSupport
${QCP_LIBRARIES} ${QCP_LIBRARIES}
${Minuit2_LIBRARIES} Threads::Threads OpenMP::OpenMP_CXX ${Minuit2_LIBRARIES} Threads::Threads OpenMP::OpenMP_CXX
-ldl -ldl
......
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