Commit 26cacb9d authored by Luis Penaranda's avatar Luis Penaranda

unhide option to control phi_max automatically

parent f3d6df06
...@@ -37,7 +37,7 @@ OpenGLCanvas::OpenGLCanvas(QWidget *parent) : ...@@ -37,7 +37,7 @@ OpenGLCanvas::OpenGLCanvas(QWidget *parent) :
scale = 1.0f; scale = 1.0f;
center_lambda = 0.f; center_lambda = 0.f;
center_phi = 0.f; center_phi = 0.f;
fov_scale_relation = "Square Root"; fov_scale_relation = "Naive";
visualization = "Perspective"; visualization = "Perspective";
auto_fov_max=false; auto_fov_max=false;
...@@ -83,17 +83,15 @@ void OpenGLCanvas::change_fov(double f){ ...@@ -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){ void OpenGLCanvas::change_fov(int new_fov){
if(new_fov<=360&&new_fov>=1) if(new_fov<=360&&new_fov>=1){
change_fov((double)new_fov); change_fov((double)new_fov);
if(auto_fov_max){ if(auto_fov_max)
if(new_fov<60) change_fov_max(compute_auto_fov_max(new_fov));
change_fov_max(60);
else
if(new_fov>180)
change_fov_max(1);
else
change_fov_max(90-new_fov/2);
} }
} }
...@@ -543,6 +541,16 @@ void OpenGLCanvas::define_triangle_indices(unsigned int * indices, int m, int n) ...@@ -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){ void OpenGLCanvas::resizeGL(int w, int h){
if(w>h) if(w>h)
...@@ -666,15 +674,8 @@ void OpenGLCanvas::wheelEvent(QWheelEvent *event){ ...@@ -666,15 +674,8 @@ void OpenGLCanvas::wheelEvent(QWheelEvent *event){
}else{ }else{
int new_fov=fov+event->delta()/30; int new_fov=fov+event->delta()/30;
change_fov((double)new_fov); change_fov((double)new_fov);
if(auto_fov_max){ if(auto_fov_max)
if(new_fov<60) change_fov_max(compute_auto_fov_max(new_fov));
change_fov_max(60);
else
if(new_fov>180)
change_fov_max(1);
else
change_fov_max(90-new_fov/2);
}
} }
} }
} }
......
...@@ -32,6 +32,9 @@ protected: ...@@ -32,6 +32,9 @@ protected:
float calculate_extent(float fov_rads); float calculate_extent(float fov_rads);
void define_triangle_indices(unsigned int * indices, int m, int n); void define_triangle_indices(unsigned int * indices, int m, int n);
private:
int compute_auto_fov_max(int);
char *textFileRead(char *fn); char *textFileRead(char *fn);
void setShaders(); void setShaders();
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
...@@ -44,6 +47,7 @@ signals: ...@@ -44,6 +47,7 @@ signals:
void max_fov_changed(int new_max_fov); void max_fov_changed(int new_max_fov);
public slots: public slots:
void automaxbutton(bool);
void change_fov(double f); void change_fov(double f);
void change_fov(int new_fov); void change_fov(int new_fov);
void change_fov_max(int new_fov_max); void change_fov_max(int new_fov_max);
......
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
<string notr="true">Panoramic</string> <string notr="true">Panoramic</string>
</property> </property>
<property name="windowIcon"> <property name="windowIcon">
<iconset theme="view-fullscreen"/> <iconset theme="view-fullscreen">
<normaloff/>
</iconset>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="2" column="1" colspan="2"> <item row="2" column="1" colspan="2">
...@@ -24,7 +26,7 @@ ...@@ -24,7 +26,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="14" column="1" colspan="2"> <item row="15" column="1" colspan="2">
<widget class="QPushButton" name="reCenter"> <widget class="QPushButton" name="reCenter">
<property name="text"> <property name="text">
<string>Re-center</string> <string>Re-center</string>
...@@ -38,7 +40,7 @@ ...@@ -38,7 +40,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0" rowspan="17"> <item row="0" column="0" rowspan="18">
<widget class="OpenGLCanvas" name="GLCanvas" native="true"> <widget class="OpenGLCanvas" name="GLCanvas" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
...@@ -54,13 +56,6 @@ ...@@ -54,13 +56,6 @@
</property> </property>
</widget> </widget>
</item> </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"> <item row="1" column="1" colspan="2">
<widget class="QComboBox" name="comboBox"> <widget class="QComboBox" name="comboBox">
<property name="editable"> <property name="editable">
...@@ -71,12 +66,12 @@ ...@@ -71,12 +66,12 @@
</property> </property>
<item> <item>
<property name="text"> <property name="text">
<string>Square Root</string> <string>Naive</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Naive</string> <string>Square Root</string>
</property> </property>
</item> </item>
<item> <item>
...@@ -101,7 +96,7 @@ ...@@ -101,7 +96,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="13" column="1" alignment="Qt::AlignHCenter"> <item row="14" column="1" alignment="Qt::AlignHCenter">
<widget class="QSlider" name="changefovmax"> <widget class="QSlider" name="changefovmax">
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
...@@ -123,33 +118,14 @@ ...@@ -123,33 +118,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1" colspan="2"> <item row="16" 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">
<widget class="QPushButton" name="chooseFile"> <widget class="QPushButton" name="chooseFile">
<property name="text"> <property name="text">
<string>Input Image</string> <string>Input Image</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="1" alignment="Qt::AlignHCenter"> <item row="13" column="1" alignment="Qt::AlignHCenter">
<widget class="QLCDNumber" name="fovmaxled"> <widget class="QLCDNumber" name="fovmaxled">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
...@@ -159,14 +135,14 @@ ...@@ -159,14 +135,14 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="16" column="1" colspan="2"> <item row="17" column="1" colspan="2">
<widget class="QPushButton" name="pushButton"> <widget class="QPushButton" name="pushButton">
<property name="text"> <property name="text">
<string>Close</string> <string>Close</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="13" column="2" alignment="Qt::AlignHCenter"> <item row="14" column="2" alignment="Qt::AlignHCenter">
<widget class="QSlider" name="changefov"> <widget class="QSlider" name="changefov">
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
...@@ -182,7 +158,7 @@ ...@@ -182,7 +158,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="12" column="2" alignment="Qt::AlignHCenter"> <item row="13" column="2" alignment="Qt::AlignHCenter">
<widget class="QLCDNumber" name="fovled"> <widget class="QLCDNumber" name="fovled">
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::NoFrame</enum> <enum>QFrame::NoFrame</enum>
...@@ -192,13 +168,55 @@ ...@@ -192,13 +168,55 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="11" column="2" alignment="Qt::AlignHCenter"> <item row="12" column="2" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>FOV</string> <string>FOV</string>
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
...@@ -221,6 +239,7 @@ ...@@ -221,6 +239,7 @@
<slot>change_fov_max(int)</slot> <slot>change_fov_max(int)</slot>
<slot>change_fov(int)</slot> <slot>change_fov(int)</slot>
<slot>re_center()</slot> <slot>re_center()</slot>
<slot>automaxbutton(bool)</slot>
</slots> </slots>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
...@@ -233,8 +252,8 @@ ...@@ -233,8 +252,8 @@
<slot>close()</slot> <slot>close()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>596</x> <x>640</x>
<y>409</y> <y>490</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>629</x> <x>629</x>
...@@ -269,8 +288,8 @@ ...@@ -269,8 +288,8 @@
<y>106</y> <y>106</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>496</x> <x>492</x>
<y>123</y> <y>132</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
...@@ -281,8 +300,8 @@ ...@@ -281,8 +300,8 @@
<slot>change_input_image()</slot> <slot>change_input_image()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>566</x> <x>640</x>
<y>258</y> <y>457</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>247</x> <x>247</x>
...@@ -329,8 +348,8 @@ ...@@ -329,8 +348,8 @@
<slot>re_center()</slot> <slot>re_center()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>569</x> <x>640</x>
<y>444</y> <y>424</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>250</x> <x>250</x>
...@@ -345,8 +364,8 @@ ...@@ -345,8 +364,8 @@
<slot>change_fov_max(int)</slot> <slot>change_fov_max(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>512</x> <x>546</x>
<y>363</y> <y>391</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>250</x> <x>250</x>
...@@ -381,8 +400,8 @@ ...@@ -381,8 +400,8 @@
<y>245</y> <y>245</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>606</x> <x>629</x>
<y>380</y> <y>236</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
...@@ -397,8 +416,8 @@ ...@@ -397,8 +416,8 @@
<y>248</y> <y>248</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>532</x> <x>555</x>
<y>380</y> <y>236</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
...@@ -413,8 +432,8 @@ ...@@ -413,8 +432,8 @@
<y>249</y> <y>249</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>606</x> <x>629</x>
<y>197</y> <y>236</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
...@@ -429,8 +448,24 @@ ...@@ -429,8 +448,24 @@
<y>249</y> <y>249</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>532</x> <x>555</x>
<y>197</y> <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> </hint>
</hints> </hints>
</connection> </connection>
......
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