Skip to content

Commit 65e6fc9

Browse files
author
Hernan Badino
committed
Rotating drawing list in toyClockExample
--HG-- branch : notanumber.devel
1 parent f416a32 commit 65e6fc9

19 files changed

+129
-112
lines changed

.hgignore

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CMakeCache.txt
1212
cmake.check_cache
1313
out
1414
Makefile
15+
ignore
1516

1617
glob:*.vtg
1718
glob:*.vpw

CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ set (CMAKE_VERBOSE_MAKEFILE true)
1919
find_package(Qt4 REQUIRED)
2020

2121
#OpenGL
22-
find_package(GLU REQUIRED)
22+
#find_package(GLU REQUIRED)
2323
set(QT_USE_QTOPENGL true)
2424
set(QT_USE_QTXML true)
2525

@@ -158,7 +158,7 @@ add_library ( qcv SHARED ${LIBQCV_SRC}
158158
)
159159

160160
target_link_libraries(qcv ${QT_LIBRARIES}
161-
-lglut -lGL -lGLU ${OpenCV_LIBS})
161+
-lglut -lGL ${OpenCV_LIBS})
162162

163163
### Set library to be installed under lib directory
164164
install ( TARGETS qcv LIBRARY DESTINATION lib)

cinterface.h

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
#include <stdio.h>
3434
#include <iostream>
3535

36+
#include <cv.h>
37+
#include <highgui.h>
38+
3639
namespace QCV
3740
{
3841
CDisplayWidget * g_disp_p = NULL;

colors.h

+1-50
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,6 @@ namespace QCV
7070
{
7171
}
7272

73-
SRgba( cv::Vec3b f_other )
74-
{
75-
r = f_other[2];
76-
g = f_other[1];
77-
b = f_other[0];
78-
a = 0;
79-
}
80-
8173
SRgba( cv::Vec4b f_other )
8274
{
8375
r = f_other[2];
@@ -86,11 +78,6 @@ namespace QCV
8678
a = f_other[3];
8779
}
8880

89-
operator cv::Vec3b ()
90-
{
91-
return cv::Vec3b(b,g,r);
92-
}
93-
9481
operator cv::Vec4b ()
9582
{
9683
return cv::Vec4b(b,g,r,a);
@@ -176,13 +163,6 @@ namespace QCV
176163
b = f_other[0];
177164
}
178165

179-
SRgb( cv::Vec4b f_other )
180-
{
181-
r = f_other[2];
182-
g = f_other[1];
183-
b = f_other[0];
184-
}
185-
186166
SRgb ( SRgba other )
187167
{
188168
r = other.r;
@@ -201,12 +181,7 @@ namespace QCV
201181
operator cv::Vec3b ()
202182
{
203183
return cv::Vec3b(b,g,r);
204-
}
205-
206-
operator cv::Vec4b ()
207-
{
208-
return cv::Vec4b(b,g,r,0);
209-
}
184+
}
210185

211186
bool operator == ( const SRgb & other ) const
212187
{
@@ -302,13 +277,6 @@ namespace QCV
302277
v = f_other[0];
303278
}
304279

305-
SHsv( cv::Vec4b f_other )
306-
{
307-
h = f_other[2];
308-
s = f_other[1];
309-
v = f_other[0];
310-
}
311-
312280
const SHsv& operator = ( const SHsv & other )
313281
{
314282
h = other.h;
@@ -326,11 +294,6 @@ namespace QCV
326294
{
327295
return cv::Vec3b(v,s,h);
328296
}
329-
330-
operator cv::Vec4b ()
331-
{
332-
return cv::Vec4b(v,s,h,0);
333-
}
334297

335298
void set ( const float f_h_f,
336299
const float f_s_f,
@@ -384,13 +347,6 @@ namespace QCV
384347
l = f_other[0];
385348
}
386349

387-
SHsl( cv::Vec4b f_other )
388-
{
389-
h = f_other[2];
390-
s = f_other[1];
391-
l = f_other[0];
392-
}
393-
394350
const SHsl& operator = ( const SHsl & other )
395351
{
396352
h = other.h;
@@ -403,11 +359,6 @@ namespace QCV
403359
{
404360
return cv::Vec3b(l,s,h);
405361
}
406-
407-
operator cv::Vec4b ()
408-
{
409-
return cv::Vec4b(l,s,h,0);
410-
}
411362

412363
bool operator == ( const SHsl & other ) const
413364
{

display.cpp

+22-17
Original file line numberDiff line numberDiff line change
@@ -587,33 +587,38 @@ void CDisplay::displayScreens ( CDisplayOpNode * const f_parent_p,
587587

588588
glTranslatef( pos.x * m_screenSize.width,
589589
pos.y * m_screenSize.height,
590-
0.0 );
591-
590+
0.0 );
591+
592592
glScalef( list_p -> getScaleX(),
593-
list_p -> getScaleY(),
594-
1.0);
593+
list_p -> getScaleY(),
594+
1.0f );
595595

596596
glTranslatef( list_p -> getOffsetX(),
597597
list_p -> getOffsetY(),
598-
0.0 );
599-
598+
0.0f );
599+
600600
if (fabs(list_p->getRotation()) > 1.e-4)
601601
{
602-
glTranslatef( m_screenSize.width/2,
603-
m_screenSize.height/2,
604-
0.0 );
602+
glTranslatef( m_screenSize.width/2.f,
603+
m_screenSize.height/2.f,
604+
0.0f );
605+
605606
glRotated( list_p -> getRotation(), 0, 0, 1. );
606607

607-
glTranslatef( -m_screenSize.height/2,
608-
-m_screenSize.width/2,
609-
0.0 );
608+
glTranslatef( -m_screenSize.width/2.f,
609+
-m_screenSize.height/2.f,
610+
0.0f );
611+
612+
// float scale_f = m_screenSize.width/(float)m_screenSize.height;
613+
// if (scale_f > 1.f) scale_f = 1./scale_f;
610614

611-
float scale_f = m_screenSize.width/(float)m_screenSize.height;
612-
if (scale_f > 1.f) scale_f = 1./scale_f;
615+
// glScalef( scale_f,
616+
// scale_f,
617+
// 0.0 );
613618

614-
glScalef( scale_f,
615-
scale_f,
616-
0.0 );
619+
// glTranslatef( m_screenSize.width/4*scale_f,
620+
// m_screenSize.height/4*scale_f,
621+
// 0.0 );
617622
}
618623

619624
list_p -> show();

drawingList.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -792,3 +792,15 @@ CDrawingList::getScreenSize ( ) const
792792
{
793793
return m_screenSize;
794794
}
795+
796+
unsigned int
797+
CDrawingList::getScreenWidth ( ) const
798+
{
799+
return m_screenSize.width;
800+
}
801+
802+
unsigned int
803+
CDrawingList::getScreenHeight ( ) const
804+
{
805+
return m_screenSize.height;
806+
}

drawingList.h

+6-3
Original file line numberDiff line numberDiff line change
@@ -350,10 +350,13 @@ namespace QCV
350350
virtual bool setRotation( double f_angle_d ) { m_rotAngle_d = f_angle_d; return true; }
351351
virtual double getRotation( ) const { return m_rotAngle_d; }
352352

353-
bool setScreenSize ( const S2D<unsigned int> f_size );
353+
virtual bool setScreenSize ( const S2D<unsigned int> f_size );
354354

355-
S2D<unsigned int>
356-
getScreenSize ( ) const;
355+
virtual S2D<unsigned int>
356+
getScreenSize ( ) const;
357+
358+
virtual unsigned int getScreenWidth ( ) const;
359+
virtual unsigned int getScreenHeight ( ) const;
357360

358361
//// Actions
359362
public:

examples/anaglyphStereo/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ find_package(Qt4 REQUIRED)
2020

2121
#OpenCV
2222
find_package ( OpenCV REQUIRED )
23-
message ( STATUS ${OpenCV_LIBS} )
2423

2524
#OpenGL
26-
find_package(GLU REQUIRED)
25+
#find_package(GLU REQUIRED)
2726

2827
#Qcv
2928
set (QCV_LIB qcv )

examples/anaglyphStereo/anaglyphStereo.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
#include "../cinterface.h"
2525
#include "../clock.h"
2626

27-
#include <cv.h>
28-
#include <highgui.h>
29-
3027
using namespace QCV;
3128

3229
bool callBackKeyboard ( CKeyEvent *f_kevent_p );

examples/checkStereoPair/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ find_package(Qt4 REQUIRED)
1818

1919
#OpenCV
2020
find_package ( OpenCV REQUIRED )
21-
message ( STATUS ${OpenCV_LIBS} )
2221

2322
#OpenGL
24-
find_package(GLU REQUIRED)
23+
#find_package(GLU REQUIRED)
2524

2625
#Qcv
2726
set (QCV_LIB qcv )

examples/checkStereoPair/checkStereoPair.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323

2424
#include "../cinterface.h"
2525

26-
#include <cv.h>
27-
#include <highgui.h>
28-
2926
using namespace QCV;
3027

3128
bool callBackMouse ( CMouseEvent *f_mevent_p );

examples/helloWorld/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,9 @@ find_package(Qt4 REQUIRED)
1818

1919
#OpenCV
2020
find_package ( OpenCV REQUIRED )
21-
message ( STATUS ${OpenCV_LIBS} )
2221

2322
#OpenGL
24-
find_package(GLU REQUIRED)
23+
#find_package(GLU REQUIRED)
2524

2625
#Qcv
2726
set (QCV_LIB qcv )

examples/helloWorld/helloWorld.cpp

+1-4
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323

2424
#include "../cinterface.h"
2525

26-
#include <cv.h>
27-
#include <highgui.h>
28-
2926
using namespace QCV;
3027

3128
int main(int f_argc_i, char *f_argv_p[])
@@ -45,7 +42,7 @@ int main(int f_argc_i, char *f_argv_p[])
4542
CDrawingList *list_p = getDrawingList ( "My Hello World Label" );
4643

4744
/// Set line color. By default is black
48-
list_p -> setLineColor ( SRgb (255, 255, 255) );
45+
list_p -> setLineColor ( cv::Vec3b (255, 255, 255) );
4946

5047
/// Add some text.
5148
list_p->addText ( "Hello World!", 100, 200, 64, false );

examples/imgPlayer/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ find_package(Qt4 REQUIRED)
2020

2121
#OpenCV
2222
find_package ( OpenCV REQUIRED )
23-
message ( STATUS ${OpenCV_LIBS} )
2423

2524
#OpenGL
26-
find_package(GLU REQUIRED)
25+
#find_package(GLU REQUIRED)
2726

2827
#Qcv
2928
set (QCV_LIB qcv )

examples/imgPlayer/imgPlayer.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
#include <QApplication>
2323

2424
#include "../cinterface.h"
25-
#include "../clock.h"
26-
27-
#include <cv.h>
28-
#include <highgui.h>
2925

3026
using namespace QCV;
3127

examples/sobelExample/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ find_package(Qt4 REQUIRED)
2020

2121
#OpenCV
2222
find_package ( OpenCV REQUIRED )
23-
message ( STATUS ${OpenCV_LIBS} )
2423

2524
#OpenGL
26-
find_package(GLU REQUIRED)
25+
#find_package(GLU REQUIRED)
2726

2827
#Qcv
2928
set (QCV_LIB qcv )

examples/sobelExample/sobelExample.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@
2323

2424
#include "../cinterface.h"
2525

26-
#include <cv.h>
27-
#include <highgui.h>
28-
2926
using namespace QCV;
3027

3128
bool callBackKeyboard ( CKeyEvent *f_kevent_p );

examples/toyClockExample/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ find_package(Qt4 REQUIRED)
2020
find_package ( OpenCV REQUIRED )
2121

2222
#OpenGL
23-
find_package(GLU REQUIRED)
23+
#find_package(GLU REQUIRED)
2424

2525
#Qcv
2626
set (QCV_LIB qcv )

0 commit comments

Comments
 (0)