12 #include <QRadioButton> 13 #include <QButtonGroup> 44 : QGLWidget(QGLFormat(QGL::DoubleBuffer |
48 QGL::setPreferredPaintEngine(QPaintEngine::OpenGL);
143 logButton =
new QRadioButton(
"Log",
this);
171 unsigned short utf16Array;
173 QString degreeSymbol(QString::fromUtf16(&utf16Array, 1));
174 QString zerostr(
"0" + degreeSymbol);
178 QString minus90str(
"+90" + degreeSymbol);
182 QString plus90str(
"-90"+degreeSymbol);
234 connect(
logButton, SIGNAL(toggled(
bool)),
269 for (
int j=0;j<9;j++)
274 for (
int i=0;
i<1440;
i++)
276 for (
int j=0;j<6;j++)
292 for (
int i=0;
i<9;
i++)
293 for (
int j=0;j<3;j++)
343 if (!checked)
return;
353 float min, max, median;
357 if (finite(
fData[ii]))
359 min = max =
fData[ii];
366 if (ii==ACTUAL_NUM_PIXELS)
372 vector<double> medianVec;
373 medianVec.resize(ACTUAL_NUM_PIXELS);
374 auto it = medianVec.begin();
399 sort(medianVec.begin(), medianVec.begin()+numSamples);
403 rms = sqrt((rms/numSamples) - (mean * mean));
406 auto jt = medianVec.begin();
407 for (
int i=0;
i<(numSamples/2)-1;
i++)
414 if (numSamples%2==0){
419 str <<
"Min: " << min << endl <<
" Max: " << max <<
" Mean: " << mean <<
" RMS: " << rms <<
" Median: " << median;
436 int textSize = (int)(
height()*14/600);
438 qglColor(QColor(255,223,127));
439 float shiftx = 0.01f;
440 float shifty = 0.01f;
456 glPushAttrib(GL_POLYGON_BIT);
457 glShadeModel(GL_SMOOTH);
466 glColor3f(
rr[0],
gg[0],
bb[0]);
467 glVertex2f(oneX, oneY);
468 glVertex2f(twoX, oneY);
469 glColor3f(
rr[1],
gg[1],
bb[1]);
470 glVertex2f(twoX, twoY);
471 glVertex2f(oneX, twoY);
473 glVertex2f(oneX, twoY);
474 glVertex2f(twoX, twoY);
475 glColor3f(
rr[2],
gg[2],
bb[2]);
476 glVertex2f(twoX, threeY);
477 glVertex2f(oneX, threeY);
479 glVertex2f(oneX, threeY);
480 glVertex2f(twoX, threeY);
481 glColor3f(
rr[3],
gg[3],
bb[3]);
482 glVertex2f(twoX, fourY);
483 glVertex2f(oneX, fourY);
485 glVertex2f(oneX, fourY);
486 glVertex2f(twoX, fourY);
487 glColor3f(
rr[4],
gg[4],
bb[4]);
488 glVertex2f(twoX, fiveY);
489 glVertex2f(oneX, fiveY);
493 glVertex2f(zeroX, fiveY);
494 glVertex2f(oneX, fiveY);
495 glVertex2f(oneX, zeroY);
496 glVertex2f(zeroX, zeroY);
498 glVertex2f(zeroX, -fiveY);
499 glVertex2f(oneX, -fiveY);
500 glVertex2f(oneX, -zeroY);
501 glVertex2f(zeroX, -zeroY);
503 glTranslatef(0,0,0.1f);
506 glColor3f(0.f,0.f,0.f);
509 for (
int i=1;
i<10;
i++)
514 value = (float)(
i)/10.f;
516 glVertex2f(oneX, yy);
517 glVertex2f(twoX, yy);
525 if (!checked)
return;
534 if (!checked)
return;
535 ss[0] = 0;
ss[1] = 0.25f;
ss[2] = 0.5f;
ss[3] = 0.75f;
ss[4] = 1.0f;
536 rr[0] = 0;
rr[1] = 0;
rr[2] = 0;
rr[3] = 1.0f;
rr[4] = 1;
537 gg[0] = 0;
gg[1] = 1;
gg[2] = 1;
gg[3] = 1;
gg[4] = 0;
538 bb[0] = 0.5f;
bb[1] = 1;
bb[2] = 0;
bb[3] = 0;
bb[4] = 0;
554 if (!checked)
return;
555 ss[0] = 0.f;
ss[1] = 0.25f;
ss[2] = 0.5f;
ss[3] = 0.75f;
ss[4] = 1.0f;
556 rr[0] = 0.f;
rr[1] = 0.35f;
rr[2] = 0.85f;
rr[3] = 1.0f;
rr[4] = 1.f;
557 gg[0] = 0.f;
gg[1] = 0.10f;
gg[2] = 0.20f;
gg[3] = 0.73f;
gg[4] = 1.f;
558 bb[0] = 0.f;
bb[1] = 0.03f;
bb[2] = 0.06f;
bb[3] = 0.00f;
bb[4] = 1.f;
574 if (!checked)
return;
575 ss[0] = 0;
ss[1] = 0.25f;
ss[2] = 0.5f;
ss[3] = 0.75f;
ss[4] = 1.0f;
576 rr[0] = 0;
rr[1] = 0.25f;
rr[2] = 0.5f;
rr[3] = 0.75f;
rr[4] = 1.0f;
577 gg[0] = 0;
gg[1] = 0.25f;
gg[2] = 0.5f;
gg[3] = 0.75f;
gg[4] = 1.0f;
578 bb[0] = 0;
bb[1] = 0.25f;
bb[2] = 0.5f;
bb[3] = 0.75f;
bb[4] = 1.0f;
594 if (!checked)
return;
595 ss[0] = 0;
ss[1] = 0.25f;
ss[2] = 0.5f;
ss[3] = 0.75f;
ss[4] = 1.0f;
596 rr[0] = 0.15;
rr[1] = 0.5;
rr[2] = 1.f;
rr[3] = 0.0f;
rr[4] = 1.f;
597 gg[0] = 0.15;
gg[1] = 0.5;
gg[2] = 1.f;
gg[3] = 0.5f;
gg[4] = 0.5f;
598 bb[0] = 0.15;
bb[1] = 0.5;
bb[2] = 1;
bb[3] = 1.f;
bb[4] = 0.f;
620 if (!checked)
return;
628 if (!checked)
return;
636 if (!checked)
return;
645 qglClearColor(QColor(212,208,200));
646 glShadeModel(GL_FLAT);
647 glEnable(GL_DEPTH_TEST);
648 glDisable(GL_CULL_FACE);
658 glViewport(0, 0, cWidth, cHeight);
659 glMatrixMode(GL_PROJECTION);
661 GLfloat windowRatio = (float)cWidth/(
float)cHeight;
664 windowRatio = 1.0f/windowRatio;
677 glMatrixMode(GL_MODELVIEW);
684 glClear(GL_COLOR_BUFFER_BIT);
687 glTranslatef(0,-0.44,0);
688 glScalef(1.5, 1.5, 1.5);
752 glColor3f(0.5,0.5,0.5);
760 while (
ss[index] < color)
763 float weight0 = (color-
ss[index]) / (
ss[index+1]-
ss[index]);
764 float weight1 = 1.0f-weight0;
783 glColor3f(0.0f,0.0f,0.0f);
797 glColor3f(0.5f, 0.5f, 0.3f);
812 const int MaxSize = 512;
818 glGetIntegerv(GL_VIEWPORT, viewport);
819 glSelectBuffer(MaxSize, buffer);
820 glRenderMode(GL_SELECT);
825 glMatrixMode(GL_PROJECTION);
828 GLfloat windowRatio = GLfloat(width()) / GLfloat(
height());
829 gluPickMatrix(GLdouble(cPos.x()), GLdouble(viewport[3] - cPos.y()),
834 windowRatio = 1.0f/windowRatio;
842 glMatrixMode(GL_MODELVIEW);
844 glMatrixMode(GL_PROJECTION);
851 if (!glRenderMode(GL_RENDER))
881 glBegin(GL_LINE_LOOP);
897 float squaredDistance = 0;
898 for (
int i=0;
i<currentPixel;
i++)
974 fromSide = toSide + 3;
1013 GLfloat backupCoords[4];
1049 for (
int j=0;j<6;j++)
1051 for (
int k=0;k<2;k++)
1068 for (
int k=0;k<2;k++)
1077 for (
int j=0;j<6;j++)
1079 for (
int k=0;k<2;k++)
1098 vector<edge>::iterator it;
1099 bool erased =
false;
1104 for (
int j=0;j<9;j++)
1108 for (
int k=0;k<6;k++)
1117 const int idx = i*9+j;
QRadioButton * minus90RotationButton
QButtonGroup * colorGroup
void toggleInterfaceDisplay()
GLfloat highlightedPatchesCoulour[3]
virtual void mousePressEvent(QMouseEvent *event)
GLfloat highlightedPixelsCoulour[3]
virtual void resizeGL(int width, int height)
QRadioButton * linearButton
void linearScalePlease(bool)
structure for storing edges of hexagons (for blurry display)
GLfloat pixelContourColour[3]
void setTitle(const std::string &title)
virtual void drawPatches()
int64_t second
offset of this column in the tile, from the start of the heap area
QRadioButton * glowingPaletteButton
structure for storing neighbors of pixels. For camera position calculation and blurry display ...
static GLfloat verticesList[NPIX *6][2]
void zeroRotationPlease(bool)
void glowingPalettePlease(bool)
static PixelsNeighbors neighbors[MAX_NUM_PIXELS]
GLfloat patchesCoulour[3]
void greyScalePalettePlease(bool)
virtual void buildPatchesIndices()
int64_t first
Size of this column in the tile.
static int verticesIndices[NPIX][6]
void calculatePixelsCoords()
BasicGlCamera(QWidget *parent=0)
QRadioButton * zeroRotationButton
void SetAutoRefresh(bool on)
std::vector< double > fData
GLfloat tooLowValueCoulour[3]
void regularPalettePlease(bool)
virtual void mouseDoubleClickEvent(QMouseEvent *event)
GLfloat pixelsColor[NPIX][3]
void updateNeighbors(int currentPixel)
void signalUpdateCamera()
virtual void UpdateText()
virtual void initializeGL()
#define ACTUAL_NUM_PIXELS
QButtonGroup * scaleGroup
static int pixelsPatch[NPIX]
void assignPixelMap(const PixelMap &)
static std::vector< edge > patchesIndices[160]
void drawHexagon(int index, bool solid)
void logScalePlease(bool)
virtual void setPatchColor(int id, float color[3])
virtual int PixelAtPosition(const QPoint &pos)
void prettyPalettePlease(bool)
QLabel * colorPaletteLabel
virtual void drawCamera(bool alsoWire)
QRadioButton * regularPaletteButton
virtual void mouseMoveEvent(QMouseEvent *event)
static GLfloat pixelsCoords[MAX_NUM_PIXELS][3]
virtual void DrawCameraText()
QButtonGroup * rotationGroup
void setAutoscaleLowerLimit(float)
void colorPaletteHasChanged()
static PixelMap fPixelMap
void minus90RotationPlease(bool)
GLfloat tooHighValueCoulour[3]
QRadioButton * prettyPaletteButton
static int hardwareMapping[NPIX]
QRadioButton * greyScalePaletteButton
void plus90RotationPlease(bool)
QRadioButton * plus90Rotationbutton
static int softwareMapping[NPIX]
void setUnits(const std::string &units)
void skipPixels(int start, int howMany)