Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit ff6ce7dc authored by Frédéric Larue's avatar Frédéric Larue
Browse files

Bug fixed in the hotkey F1-12 / SHIFT+F1-12 for saving / reloading view...

Bug fixed in the hotkey F1-12 / SHIFT+F1-12 for saving / reloading view parameters in the GLViewer in 3D mode.
parent c2302bbb
......@@ -1911,40 +1911,6 @@ void GLViewer::keyPressEvent( QKeyEvent *evt )
switch( evt->key() )
{
case Qt::Key_Space: centerView(); break;
case Qt::Key_F1:
case Qt::Key_F2:
case Qt::Key_F3:
case Qt::Key_F4:
case Qt::Key_F5:
case Qt::Key_F6:
case Qt::Key_F7:
case Qt::Key_F8:
case Qt::Key_F9:
case Qt::Key_F10:
case Qt::Key_F11:
case Qt::Key_F12:
{
QString filename;
filename.sprintf(".viewer_%02i.cfg", evt->key() - Qt::Key_F1 + 1 );
if( evt->modifiers() == Qt::Modifier::SHIFT )
{
std::ofstream file( filename.toStdString(), std::ios::binary );
file.write( (char*) &m_View, sizeof(RenderState) );
}
else
{
std::ifstream file( filename.toStdString(), std::ios::binary );
if( !file.bad() )
{
RenderState state;
file.read( (char*) &state, sizeof(RenderState) );
setRenderState( state );
}
}
break;
}
case Qt::Key_4:
{
QMatrix4x4 rot;
......@@ -2012,84 +1978,6 @@ void GLViewer::keyPressEvent( QKeyEvent *evt )
update();
break;
}
case Qt::Key_F1:
case Qt::Key_F2:
case Qt::Key_F3:
case Qt::Key_F4:
case Qt::Key_F5:
case Qt::Key_F6:
case Qt::Key_F7:
case Qt::Key_F8:
case Qt::Key_F9:
case Qt::Key_F10:
case Qt::Key_F11:
case Qt::Key_F12:
{
qint32 viewId = evt->key() - Qt::Key_F1;
std::ostringstream filename;
filename << ".viewer" << viewId << ".cfg";
if( evt->modifiers() & Qt::SHIFT )
{
std::ofstream file( filename.str().c_str(), std::ios::binary );
file.write( (char*) &focusPoint(), sizeof(QVector3D) );
float f = distToFocusPoint();
file.write( (char*) &f, sizeof(float) );
file.write( (char*) &viewRotationMatrix(), sizeof(QMatrix4x4) );
file.write( (char*) &m_View.lightRotationMatrix, sizeof(QMatrix4x4) );
file.write( (char*) &m_View.isWireframeEnabled, sizeof(bool) );
file.write( (char*) &m_View.isLightingEnabled, sizeof(bool) );
file.write( (char*) &m_View.isCullingEnabled, sizeof(bool) );
file.write( (char*) &m_View.isLightTrackingEnabled, sizeof(bool) );
double d = speedFactor();
file.write( (char*) &d, sizeof(double) );
d = ctrlSpeedFactor();
file.write( (char*) &d, sizeof(double) );
d = shiftSpeedFactor();
file.write( (char*) &d, sizeof(double) );
file.close();
}
else
{
std::ifstream file( filename.str().c_str(), std::ios::binary );
if( !file.is_open() )
break;
QVector3D fp;
QMatrix4x4 vRot;
bool wireframe, lighting, culling, tracking;
float dist2fp;
double spF, ctrlSpF, shftSpF;
file.read( (char*) &fp, sizeof(QVector3D) );
file.read( (char*) &dist2fp, sizeof(float) );
file.read( (char*) &vRot, sizeof(QMatrix4x4) );
file.read( (char*) &m_View.lightRotationMatrix, sizeof(QMatrix4x4) );
file.read( (char*) &wireframe, sizeof(bool) );
file.read( (char*) &lighting, sizeof(bool) );
file.read( (char*) &culling, sizeof(bool) );
file.read( (char*) &tracking, sizeof(bool) );
file.read( (char*) &spF, sizeof(double) );
file.read( (char*) &ctrlSpF, sizeof(double) );
file.read( (char*) &shftSpF, sizeof(double) );
file.close();
setFocusPoint( fp );
setDistToFocusPoint( dist2fp );
setViewRotationMatrix( vRot );
setWireframeEnabled( wireframe );
setLightingEnabled( lighting );
setCullingEnabled( culling );
setLightTrackingEnabled( tracking );
setSpeedFactor( spF );
setCtrlSpeedFactor( ctrlSpF );
setShiftSpeedFactor( shftSpF );
update();
}
break;
}
case Qt::Key_1:
{
QMatrix4x4 rot;
......@@ -2182,6 +2070,41 @@ void GLViewer::keyPressEvent( QKeyEvent *evt )
}
break;
}
case Qt::Key_F1:
case Qt::Key_F2:
case Qt::Key_F3:
case Qt::Key_F4:
case Qt::Key_F5:
case Qt::Key_F6:
case Qt::Key_F7:
case Qt::Key_F8:
case Qt::Key_F9:
case Qt::Key_F10:
case Qt::Key_F11:
case Qt::Key_F12:
{
qint32 viewId = evt->key() - Qt::Key_F1;
std::ostringstream filename;
filename << ".viewer" << viewId << ".cfg";
if( evt->modifiers() == Qt::Modifier::SHIFT )
{
std::ofstream file( filename.str(), std::ios::binary );
file.write( (char*) &m_View, sizeof(RenderState) );
}
else
{
std::ifstream file( filename.str(), std::ios::binary );
if( file.is_open() )
{
RenderState state;
file.read( (char*) &state, sizeof(RenderState) );
setRenderState( state );
}
}
break;
}
default: emit keyPressed( evt );
}
......
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