1 /**
2  * @brief PFS library - additional utilities
3  *
4  * This file is a part of PFSTOOLS package.
5  * ----------------------------------------------------------------------
6  * Copyright (C) 2006 Radoslaw Mantiuk
7  *
8  *  This library is free software; you can redistribute it and/or
9  *  modify it under the terms of the GNU Lesser General Public
10  *  License as published by the Free Software Foundation; either
11  *  version 2.1 of the License, or (at your option) any later version.
12  *
13  *  This library is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  *  Lesser General Public License for more details.
17  *
18  *  You should have received a copy of the GNU Lesser General Public
19  *  License along with this library; if not, write to the Free Software
20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21  * ----------------------------------------------------------------------
22  *
23  * @author Radoslaw Mantiuk, <radoslaw.mantiuk@gmail.com>
24  *
25  */
26 
27 #include <stdio.h>
28 #include <string.h>
29 
30 #include "glenv.h"
31 #include "winstat.h"
32 
33 
WinStat()34 WinStat::WinStat() : RMGLWin() {
35 
36 	colR = -1;
37 	colG = -1;
38 	colB = -1;
39 	frameNo = -1;
40 	channel = "";
41 	rawPosX = -1;
42 	bZoom = true;
43 }
44 
45 
~WinStat()46 WinStat::~WinStat() {
47 
48 }
49 
redraw(void)50 void WinStat::redraw(void) {
51 
52 	if( RMGLWin::redrawStart())
53 		return;
54 
55 	char ss[200];
56 	glColor3f( 0.0f, 0.0f, 0.0f);
57 
58 	glRasterPos2f( 5.0f, 29.0f);
59 
60 	if( frameNo != -1) {
61 		sprintf( ss, "Frame: %d", frameNo);
62 		for (int i = 0; i < (int) strlen(ss); i++)
63 			glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, ss[i]);
64 	}
65 
66 	//sprintf( ss, "Max freq: %.0f  %s", lumMax, mappingMode);
67 
68 	char szoom[10];
69 	if( bZoom == true)
70 		strcpy( szoom, "ZOOM");
71 	else
72 		strcpy( szoom, "PAN");
73 
74 	sprintf( ss, "  %s  %s   %s", mappingMode, channel, szoom);
75 	for (int i = 0; i < (int) strlen(ss); i++)
76 		glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, ss[i]);
77 
78 	glRasterPos2f( 5.0f, 17.0f);
79 	if( colR >= 0) {
80 		sprintf( ss, "screen: %d,%d : %d,%d,%d", pixelX, pixelY, colR, colG, colB);
81 		for (int i = 0; i < (int) strlen(ss); i++)
82 			glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, ss[i]);
83 	}
84 
85 	glRasterPos2f( 5.0f, 5.0f);
86 	if( rawPosX >=0) {
87 		sprintf( ss, "data: %d,%d : %.6f,%.6f,%.6f", rawPosX, rawPosY, rawX, rawY, rawZ);
88 		for (int i = 0; i < (int) strlen(ss); i++)
89 			glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, ss[i]);
90 	}
91 
92 
93 	RMGLWin::redrawEnd();
94 }
95 
setPixelData(int x,int y,int r,int g,int b)96 void WinStat::setPixelData( int x, int y, int r, int g, int b) {
97 
98 	pixelX = x;
99 	pixelY = y;
100 	colR = r;
101 	colB = b;
102 	colG = g;
103 }
104 
setMaxFreq(float val)105 void WinStat::setMaxFreq(float val) {
106 	lumMax = val;
107 }
108 
setMapping(const char * sval)109 void WinStat::setMapping(const char* sval) {
110 	mappingMode = sval;
111 }
112 
setFrameNo(int no)113 void WinStat::setFrameNo(int no) {
114 	frameNo = no;
115 }
116 
setChannel(const char * ch)117 void WinStat::setChannel(const char* ch) {
118 	channel = ch;
119 }
120 
setRawData(int x,int y,float X,float Y,float Z)121 void WinStat::setRawData( int x, int y, float X, float Y, float Z) {
122 
123 	rawPosX = x;
124 	rawPosY = y;
125 	rawX = X;
126 	rawY = Y;
127 	rawZ = Z;
128 }
129 
setBZoom(bool bb)130 void WinStat::setBZoom(bool bb) {
131 	bZoom = bb;
132 }
133 
134 
135 
136