Verified Commit 4ce73fd5 authored by Tobias WEBER's avatar Tobias WEBER
Browse files

adapted to tlibs2 changes

parent bf0be92f
......@@ -42,11 +42,8 @@ namespace consts = si::constants;
#include "tlibs2/libs/algos.h"
#include "tlibs2/libs/helper.h"
//using namespace tl2;
using namespace tl2_ops;
constexpr t_real g_eps = 1e-6;
constexpr int g_prec = 6;
......@@ -535,7 +532,7 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent},
m_dlgPlot = new QDialog(this);
m_dlgPlot->setWindowTitle("Unit Cell");
m_plot = std::make_shared<GlPlot>(this);
m_plot = std::make_shared<tl2::GlPlot>(this);
m_plot->GetRenderer()->SetLight(0, tl2::create<t_vec3_gl>({ 5, 5, 5 }));
m_plot->GetRenderer()->SetLight(1, tl2::create<t_vec3_gl>({ -5, -5, -5 }));
m_plot->GetRenderer()->SetCoordMax(1.);
......@@ -563,10 +560,10 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent},
grid->addWidget(m_status3D, 2,0,1,2);
connect(m_plot.get(), &GlPlot::AfterGLInitialisation, this, &MagStructFactDlg::AfterGLInitialisation);
connect(m_plot->GetRenderer(), &GlPlotRenderer::PickerIntersection, this, &MagStructFactDlg::PickerIntersection);
connect(m_plot.get(), &GlPlot::MouseDown, this, &MagStructFactDlg::PlotMouseDown);
//connect(m_plot.get(), &GlPlot::MouseUp, this, [this](bool left, bool mid, bool right) {});
connect(m_plot.get(), &tl2::GlPlot::AfterGLInitialisation, this, &MagStructFactDlg::AfterGLInitialisation);
connect(m_plot->GetRenderer(), &tl2::GlPlotRenderer::PickerIntersection, this, &MagStructFactDlg::PickerIntersection);
connect(m_plot.get(), &tl2::GlPlot::MouseDown, this, &MagStructFactDlg::PlotMouseDown);
//connect(m_plot.get(), &tl2::GlPlot::MouseUp, this, [this](bool left, bool mid, bool right) {});
connect(comboCoordSys, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this](int val)
{
if(this->m_plot)
......@@ -595,7 +592,7 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent},
m_dlgPlotSC = new QDialog(this);
m_dlgPlotSC->setWindowTitle("Super Cell");
m_plotSC = std::make_shared<GlPlot>(this);
m_plotSC = std::make_shared<tl2::GlPlot>(this);
m_plotSC->GetRenderer()->SetLight(0, tl2::create<t_vec3_gl>({ 5, 5, 5 }));
m_plotSC->GetRenderer()->SetLight(1, tl2::create<t_vec3_gl>({ -5, -5, -5 }));
m_plotSC->GetRenderer()->SetCoordMax(1.);
......@@ -623,10 +620,10 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent},
grid->addWidget(m_status3DSC, 2,0,1,2);
connect(m_plotSC.get(), &GlPlot::AfterGLInitialisation, this, &MagStructFactDlg::AfterGLInitialisationSC);
connect(m_plotSC->GetRenderer(), &GlPlotRenderer::PickerIntersection, this, &MagStructFactDlg::PickerIntersectionSC);
//connect(m_plotSC.get(), &GlPlot::MouseDown, this, [this](bool left, bool mid, bool right) {});
//connect(m_plotSC.get(), &GlPlot::MouseUp, this, [this](bool left, bool mid, bool right) {});
connect(m_plotSC.get(), &tl2::GlPlot::AfterGLInitialisation, this, &MagStructFactDlg::AfterGLInitialisationSC);
connect(m_plotSC->GetRenderer(), &tl2::GlPlotRenderer::PickerIntersection, this, &MagStructFactDlg::PickerIntersectionSC);
//connect(m_plotSC.get(), &tl2::GlPlot::MouseDown, this, [this](bool left, bool mid, bool right) {});
//connect(m_plotSC.get(), &tl2::GlPlot::MouseUp, this, [this](bool left, bool mid, bool right) {});
connect(comboCoordSys, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this](int val)
{
if(this->m_plotSC)
......@@ -2181,7 +2178,7 @@ void MagStructFactDlg::closeEvent(QCloseEvent *evt)
int main(int argc, char** argv)
{
set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_locales();
QApplication::addLibraryPath(QString(".") + QDir::separator() + "qtplugins");
......@@ -2204,7 +2201,7 @@ int main(int argc, char** argv)
*/
bool init()
{
set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_locales();
return true;
......
......@@ -38,6 +38,12 @@ using t_vec_cplx = tl2::vec<t_cplx, std::vector>;
using t_mat = tl2::mat<t_real, std::vector>;
using t_mat_cplx = tl2::mat<t_cplx, std::vector>;
using t_real_gl = tl2::t_real_gl;
using t_vec2_gl = tl2::t_vec2_gl;
using t_vec3_gl = tl2::t_vec3_gl;
using t_vec_gl = tl2::t_vec_gl;
using t_mat_gl = tl2::t_mat_gl;
struct NuclPos
{
......@@ -66,14 +72,14 @@ protected:
// unit cell view
QDialog *m_dlgPlot = nullptr;
std::shared_ptr<GlPlot> m_plot;
std::shared_ptr<tl2::GlPlot> m_plot;
std::size_t m_sphere = 0;
std::size_t m_arrow = 0;
QLabel *m_status3D = nullptr;
// super cell view
QDialog *m_dlgPlotSC = nullptr;
std::shared_ptr<GlPlot> m_plotSC;
std::shared_ptr<tl2::GlPlot> m_plotSC;
std::size_t m_sphereSC = 0;
std::size_t m_arrowSC = 0;
QLabel *m_status3DSC = nullptr;
......
......@@ -219,7 +219,7 @@ MolDynDlg::MolDynDlg(QWidget* pParent) : QMainWindow{pParent},
// plot widget
{
m_plot = new GlPlot(this);
m_plot = new tl2::GlPlot(this);
m_plot->setSizePolicy(QSizePolicy{QSizePolicy::Expanding, QSizePolicy::Expanding});
m_plot->GetRenderer()->EnablePicker(1);
......@@ -229,12 +229,12 @@ MolDynDlg::MolDynDlg(QWidget* pParent) : QMainWindow{pParent},
m_plot->GetRenderer()->SetCamBase(tl2::create<t_mat_gl>({1,0,0,0, 0,0,1,0, 0,-1,0,-1.5, 0,0,0,1}),
tl2::create<t_vec_gl>({1,0,0,0}), tl2::create<t_vec_gl>({0,0,1,0}));
connect(m_plot, &GlPlot::AfterGLInitialisation, this, &MolDynDlg::AfterGLInitialisation);
connect(m_plot, &GlPlot::GLInitialisationFailed, this, &MolDynDlg::GLInitialisationFailed);
connect(m_plot->GetRenderer(), &GlPlotRenderer::PickerIntersection, this, &MolDynDlg::PickerIntersection);
connect(m_plot, &GlPlot::MouseDown, this, &MolDynDlg::PlotMouseDown);
connect(m_plot, &GlPlot::MouseUp, this, &MolDynDlg::PlotMouseUp);
connect(m_plot, &GlPlot::MouseClick, this, &MolDynDlg::PlotMouseClick);
connect(m_plot, &tl2::GlPlot::AfterGLInitialisation, this, &MolDynDlg::AfterGLInitialisation);
connect(m_plot, &tl2::GlPlot::GLInitialisationFailed, this, &MolDynDlg::GLInitialisationFailed);
connect(m_plot->GetRenderer(), &tl2::GlPlotRenderer::PickerIntersection, this, &MolDynDlg::PickerIntersection);
connect(m_plot, &tl2::GlPlot::MouseDown, this, &MolDynDlg::PlotMouseDown);
connect(m_plot, &tl2::GlPlot::MouseUp, this, &MolDynDlg::PlotMouseUp);
connect(m_plot, &tl2::GlPlot::MouseClick, this, &MolDynDlg::PlotMouseClick);
//this->setCentralWidget(m_plot);
pMainGrid->addWidget(m_plot, 0,0,1,9);
......@@ -1436,7 +1436,7 @@ void MolDynDlg::keyPressEvent(QKeyEvent *evt)
int main(int argc, char** argv)
{
set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 0);
tl2::set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 0);
tl2::set_locales();
QApplication::addLibraryPath(QString(".") + QDir::separator() + "qtplugins");
......
......@@ -30,6 +30,12 @@ using t_real = double;
using t_vec = tl2::vec<t_real, std::vector>;
using t_mat = tl2::mat<t_real, std::vector>;
using t_real_gl = tl2::t_real_gl;
using t_vec2_gl = tl2::t_vec2_gl;
using t_vec3_gl = tl2::t_vec3_gl;
using t_vec_gl = tl2::t_vec_gl;
using t_mat_gl = tl2::t_mat_gl;
/**
* atom indices for convex hull calculation
......@@ -110,7 +116,7 @@ protected:
QDoubleSpinBox *m_spinScale = nullptr;
QMenu *m_atomContextMenu = nullptr;
GlPlot *m_plot = nullptr;
tl2::GlPlot *m_plot = nullptr;
std::size_t m_sphere = 0;
std::vector<std::size_t> m_sphereHandles;
......
......@@ -39,6 +39,12 @@ using t_vec = tl2::vec<t_cplx, std::vector>;
using t_mat = tl2::mat<t_cplx, std::vector>;
using t_matvec = std::vector<t_mat>;
using t_real_gl = tl2::t_real_gl;
using t_vec2_gl = tl2::t_vec2_gl;
using t_vec3_gl = tl2::t_vec3_gl;
using t_vec_gl = tl2::t_vec_gl;
using t_mat_gl = tl2::t_mat_gl;
// ----------------------------------------------------------------------------
class PolDlg : public QDialog
......@@ -47,7 +53,7 @@ private:
QSettings m_sett{"takin", "pol"};
int m_prec = 6; // precision
std::shared_ptr<GlPlot> m_plot{std::make_shared<GlPlot>(this)};
std::shared_ptr<tl2::GlPlot> m_plot{std::make_shared<tl2::GlPlot>(this)};
QLabel *m_labelGlInfos[4] = { nullptr, nullptr, nullptr, nullptr };
QLineEdit* m_editNRe = new QLineEdit("0", this);
......@@ -307,11 +313,11 @@ public:
m_editPfX, m_editPfY, m_editPfZ})
connect(edit, &QLineEdit::textEdited, this, &PolDlg::CalcPol);
connect(m_plot.get(), &GlPlot::AfterGLInitialisation, this, &PolDlg::AfterGLInitialisation);
connect(m_plot->GetRenderer(), &GlPlotRenderer::PickerIntersection, this, &PolDlg::PickerIntersection);
connect(m_plot.get(), &tl2::GlPlot::AfterGLInitialisation, this, &PolDlg::AfterGLInitialisation);
connect(m_plot->GetRenderer(), &tl2::GlPlotRenderer::PickerIntersection, this, &PolDlg::PickerIntersection);
connect(m_plot.get(), &GlPlot::MouseDown, this, &PolDlg::MouseDown);
connect(m_plot.get(), &GlPlot::MouseUp, this, &PolDlg::MouseUp);
connect(m_plot.get(), &tl2::GlPlot::MouseDown, this, &PolDlg::MouseDown);
connect(m_plot.get(), &tl2::GlPlot::MouseUp, this, &PolDlg::MouseUp);
auto pGrid = new QGridLayout(plotpanel);
......@@ -529,7 +535,7 @@ public:
int main(int argc, char** argv)
{
set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_locales();
QApplication::addLibraryPath(QString(".") + QDir::separator() + "qtplugins");
......@@ -552,7 +558,7 @@ int main(int argc, char** argv)
*/
bool init()
{
set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_locales();
return true;
......
......@@ -38,7 +38,6 @@ namespace pt = boost::property_tree;
#include "tlibs2/libs/helper.h"
//using namespace tl2;
using namespace tl2_ops;
......@@ -475,7 +474,7 @@ StructFactDlg::StructFactDlg(QWidget* pParent) : QDialog{pParent},
m_dlgPlot = new QDialog(this);
m_dlgPlot->setWindowTitle("Unit Cell - 3D View");
m_plot = std::make_shared<GlPlot>(this);
m_plot = std::make_shared<tl2::GlPlot>(this);
m_plot->GetRenderer()->SetLight(0, tl2::create<t_vec3_gl>({ 5, 5, 5 }));
m_plot->GetRenderer()->SetLight(1, tl2::create<t_vec3_gl>({ -5, -5, -5 }));
m_plot->GetRenderer()->SetCoordMax(1.);
......@@ -503,10 +502,10 @@ StructFactDlg::StructFactDlg(QWidget* pParent) : QDialog{pParent},
grid->addWidget(m_status3D, 2,0,1,2);
connect(m_plot.get(), &GlPlot::AfterGLInitialisation, this, &StructFactDlg::AfterGLInitialisation);
connect(m_plot->GetRenderer(), &GlPlotRenderer::PickerIntersection, this, &StructFactDlg::PickerIntersection);
connect(m_plot.get(), &GlPlot::MouseDown, this, &StructFactDlg::PlotMouseDown);
connect(m_plot.get(), &GlPlot::MouseUp, this, &StructFactDlg::PlotMouseUp);
connect(m_plot.get(), &tl2::GlPlot::AfterGLInitialisation, this, &StructFactDlg::AfterGLInitialisation);
connect(m_plot->GetRenderer(), &tl2::GlPlotRenderer::PickerIntersection, this, &StructFactDlg::PickerIntersection);
connect(m_plot.get(), &tl2::GlPlot::MouseDown, this, &StructFactDlg::PlotMouseDown);
connect(m_plot.get(), &tl2::GlPlot::MouseUp, this, &StructFactDlg::PlotMouseUp);
connect(comboCoordSys, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this](int val)
{
if(this->m_plot)
......@@ -1946,7 +1945,7 @@ void StructFactDlg::closeEvent(QCloseEvent *evt)
int main(int argc, char** argv)
{
set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_locales();
QApplication::addLibraryPath(QString(".") + QDir::separator() + "qtplugins");
......@@ -1969,7 +1968,7 @@ int main(int argc, char** argv)
*/
bool init()
{
set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_gl_format(1, _GL_MAJ_VER, _GL_MIN_VER, 8);
tl2::set_locales();
return true;
......
......@@ -38,6 +38,12 @@ using t_vec_cplx = std::vector<t_cplx>;
using t_mat = tl2::mat<t_real, std::vector>;
using t_mat_cplx = tl2::mat<t_cplx, std::vector>;
using t_real_gl = tl2::t_real_gl;
using t_vec2_gl = tl2::t_vec2_gl;
using t_vec3_gl = tl2::t_vec3_gl;
using t_vec_gl = tl2::t_vec_gl;
using t_mat_gl = tl2::t_mat_gl;
struct NuclPos
{
......@@ -58,7 +64,7 @@ protected:
QMenuBar *m_menu = nullptr;
QDialog *m_dlgPlot = nullptr;
std::shared_ptr<GlPlot> m_plot;
std::shared_ptr<tl2::GlPlot> m_plot;
std::size_t m_sphere = 0;
QLabel *m_labelGlInfos[4] = { nullptr, nullptr, nullptr, nullptr };
QLabel *m_status3D = nullptr;
......
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