Commit 26cacb9d by Luis Penaranda

unhide option to control phi_max automatically

1 parent f3d6df06
......@@ -37,7 +37,7 @@ OpenGLCanvas::OpenGLCanvas(QWidget *parent) :
scale = 1.0f;
center_lambda = 0.f;
center_phi = 0.f;
fov_scale_relation = "Square Root";
fov_scale_relation = "Naive";
visualization = "Perspective";
auto_fov_max=false;
......@@ -83,17 +83,15 @@ void OpenGLCanvas::change_fov(double f){
}
void OpenGLCanvas::automaxbutton(bool autovalue){
auto_fov_max=autovalue;
}
void OpenGLCanvas::change_fov(int new_fov){
if(new_fov<=360&&new_fov>=1)
change_fov((double)new_fov);
if(auto_fov_max){
if(new_fov<60)
change_fov_max(60);
else
if(new_fov>180)
change_fov_max(1);
else
change_fov_max(90-new_fov/2);
if(new_fov<=360&&new_fov>=1){
change_fov((double)new_fov);
if(auto_fov_max)
change_fov_max(compute_auto_fov_max(new_fov));
}
}
......@@ -543,6 +541,16 @@ void OpenGLCanvas::define_triangle_indices(unsigned int * indices, int m, int n)
}
// This function computes a new value of the maximum fov and must be called
// when the fov is changed and the auto setting is enabled.
int OpenGLCanvas::compute_auto_fov_max(int new_fov){
if(new_fov<60)
return 60;
if(new_fov>180)
return 1;
//if(new_fov>60)
return (90-new_fov/2);
}
void OpenGLCanvas::resizeGL(int w, int h){
if(w>h)
......@@ -666,15 +674,8 @@ void OpenGLCanvas::wheelEvent(QWheelEvent *event){
}else{
int new_fov=fov+event->delta()/30;
change_fov((double)new_fov);
if(auto_fov_max){
if(new_fov<60)
change_fov_max(60);
else
if(new_fov>180)
change_fov_max(1);
else
change_fov_max(90-new_fov/2);
}
if(auto_fov_max)
change_fov_max(compute_auto_fov_max(new_fov));
}
}
}
......
......@@ -32,6 +32,9 @@ protected:
float calculate_extent(float fov_rads);
void define_triangle_indices(unsigned int * indices, int m, int n);
private:
int compute_auto_fov_max(int);
char *textFileRead(char *fn);
void setShaders();
void mousePressEvent(QMouseEvent *event);
......@@ -44,6 +47,7 @@ signals:
void max_fov_changed(int new_max_fov);
public slots:
void automaxbutton(bool);
void change_fov(double f);
void change_fov(int new_fov);
void change_fov_max(int new_fov_max);
......
......@@ -14,7 +14,9 @@
<string notr="true">Panoramic</string>
</property>
<property name="windowIcon">
<iconset theme="view-fullscreen"/>
<iconset theme="view-fullscreen">
<normaloff/>
</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="1" colspan="2">
......@@ -24,7 +26,7 @@
</property>
</widget>
</item>
<item row="14" column="1" colspan="2">
<item row="15" column="1" colspan="2">
<widget class="QPushButton" name="reCenter">
<property name="text">
<string>Re-center</string>
......@@ -38,7 +40,7 @@
</property>
</widget>
</item>
<item row="0" column="0" rowspan="17">
<item row="0" column="0" rowspan="18">
<widget class="OpenGLCanvas" name="GLCanvas" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
......@@ -54,13 +56,6 @@
</property>
</widget>
</item>
<item row="11" column="1" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_5">
<property name="text">
<string>FOV max</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="comboBox">
<property name="editable">
......@@ -71,12 +66,12 @@
</property>
<item>
<property name="text">
<string>Square Root</string>
<string>Naive</string>
</property>
</item>
<item>
<property name="text">
<string>Naive</string>
<string>Square Root</string>
</property>
</item>
<item>
......@@ -101,7 +96,7 @@
</item>
</widget>
</item>
<item row="13" column="1" alignment="Qt::AlignHCenter">
<item row="14" column="1" alignment="Qt::AlignHCenter">
<widget class="QSlider" name="changefovmax">
<property name="minimum">
<number>1</number>
......@@ -123,33 +118,14 @@
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="comboBox_2">
<item>
<property name="text">
<string>Perspective</string>
</property>
</item>
<item>
<property name="text">
<string>3D Sphere</string>
</property>
</item>
<item>
<property name="text">
<string>Equi-Rectangular</string>
</property>
</item>
</widget>
</item>
<item row="15" column="1" colspan="2">
<item row="16" column="1" colspan="2">
<widget class="QPushButton" name="chooseFile">
<property name="text">
<string>Input Image</string>
</property>
</widget>
</item>
<item row="12" column="1" alignment="Qt::AlignHCenter">
<item row="13" column="1" alignment="Qt::AlignHCenter">
<widget class="QLCDNumber" name="fovmaxled">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
......@@ -159,14 +135,14 @@
</property>
</widget>
</item>
<item row="16" column="1" colspan="2">
<item row="17" column="1" colspan="2">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item row="13" column="2" alignment="Qt::AlignHCenter">
<item row="14" column="2" alignment="Qt::AlignHCenter">
<widget class="QSlider" name="changefov">
<property name="minimum">
<number>1</number>
......@@ -182,7 +158,7 @@
</property>
</widget>
</item>
<item row="12" column="2" alignment="Qt::AlignHCenter">
<item row="13" column="2" alignment="Qt::AlignHCenter">
<widget class="QLCDNumber" name="fovled">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
......@@ -192,13 +168,55 @@
</property>
</widget>
</item>
<item row="11" column="2" alignment="Qt::AlignHCenter">
<item row="12" column="2" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_6">
<property name="text">
<string>FOV</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="comboBox_2">
<item>
<property name="text">
<string>Perspective</string>
</property>
</item>
<item>
<property name="text">
<string>3D Sphere</string>
</property>
</item>
<item>
<property name="text">
<string>Equi-Rectangular</string>
</property>
</item>
</widget>
</item>
<item row="12" column="1">
<widget class="QLabel" name="label_5">
<property name="text">
<string>FOV max</string>
</property>
</widget>
</item>
<item row="11" column="1" colspan="2">
<widget class="QCheckBox" name="automax">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Auto FOV max</string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
......@@ -221,6 +239,7 @@
<slot>change_fov_max(int)</slot>
<slot>change_fov(int)</slot>
<slot>re_center()</slot>
<slot>automaxbutton(bool)</slot>
</slots>
</customwidget>
</customwidgets>
......@@ -233,8 +252,8 @@
<slot>close()</slot>
<hints>
<hint type="sourcelabel">
<x>596</x>
<y>409</y>
<x>640</x>
<y>490</y>
</hint>
<hint type="destinationlabel">
<x>629</x>
......@@ -269,8 +288,8 @@
<y>106</y>
</hint>
<hint type="destinationlabel">
<x>496</x>
<y>123</y>
<x>492</x>
<y>132</y>
</hint>
</hints>
</connection>
......@@ -281,8 +300,8 @@
<slot>change_input_image()</slot>
<hints>
<hint type="sourcelabel">
<x>566</x>
<y>258</y>
<x>640</x>
<y>457</y>
</hint>
<hint type="destinationlabel">
<x>247</x>
......@@ -329,8 +348,8 @@
<slot>re_center()</slot>
<hints>
<hint type="sourcelabel">
<x>569</x>
<y>444</y>
<x>640</x>
<y>424</y>
</hint>
<hint type="destinationlabel">
<x>250</x>
......@@ -345,8 +364,8 @@
<slot>change_fov_max(int)</slot>
<hints>
<hint type="sourcelabel">
<x>512</x>
<y>363</y>
<x>546</x>
<y>391</y>
</hint>
<hint type="destinationlabel">
<x>250</x>
......@@ -381,8 +400,8 @@
<y>245</y>
</hint>
<hint type="destinationlabel">
<x>606</x>
<y>380</y>
<x>629</x>
<y>236</y>
</hint>
</hints>
</connection>
......@@ -397,8 +416,8 @@
<y>248</y>
</hint>
<hint type="destinationlabel">
<x>532</x>
<y>380</y>
<x>555</x>
<y>236</y>
</hint>
</hints>
</connection>
......@@ -413,8 +432,8 @@
<y>249</y>
</hint>
<hint type="destinationlabel">
<x>606</x>
<y>197</y>
<x>629</x>
<y>236</y>
</hint>
</hints>
</connection>
......@@ -429,8 +448,24 @@
<y>249</y>
</hint>
<hint type="destinationlabel">
<x>532</x>
<y>197</y>
<x>555</x>
<y>236</y>
</hint>
</hints>
</connection>
<connection>
<sender>automax</sender>
<signal>toggled(bool)</signal>
<receiver>GLCanvas</receiver>
<slot>automaxbutton(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>504</x>
<y>174</y>
</hint>
<hint type="destinationlabel">
<x>454</x>
<y>172</y>
</hint>
</hints>
</connection>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!