rock_widget_collection  0.1
Public Member Functions | List of all members
ImageViewOldGL Class Reference

#include <ImageViewOldGL.h>

Inherits QGLWidget.

Inherited by RangeViewGL, and SonarViewGL.

Public Member Functions

 ImageViewOldGL (ImageViewOld &parent)
 
virtual ~ImageViewOldGL ()
 
void setGLViewPoint (int display_width=0, int display_height=0)
 
void setAspectRatio (bool value)
 

Detailed Description

Deprecated:
This class is deprecated and will no longer be maintained. You should use the new ImageView widget.

Definition at line 24 of file ImageViewOldGL.h.

Constructor & Destructor Documentation

ImageViewOldGL::ImageViewOldGL ( ImageViewOld parent)

Definition at line 11 of file ImageViewOldGL.cc.

11  :
12  QGLWidget(&parent),
13  image_view(parent)
14 {
15 }
ImageViewOldGL::~ImageViewOldGL ( )
virtual

Definition at line 17 of file ImageViewOldGL.cc.

18 {
19 }

Member Function Documentation

void ImageViewOldGL::setAspectRatio ( bool  value)
inline

Definition at line 37 of file ImageViewOldGL.h.

37 {aspect_ratio = value;};
void ImageViewOldGL::setGLViewPoint ( int  display_width = 0,
int  display_height = 0 
)

Definition at line 34 of file ImageViewOldGL.cc.

35 {
36  if(!display_width || !display_height)
37  {
38  display_width = width();
39  display_height = height();
40  }
41 
42  float x =1;
43  float y =1;
44 
45  if (image_view.image.width() && image_view.image.height())
46  {
47  x = ((float)display_width)/ image_view.image.width();
48  y = ((float)display_height)/ image_view.image.height();
49  }
50 
51  int x_offset = 0;
52  int y_offset = 0;
53  if(aspect_ratio)
54  {
55  if(x < y)
56  {
57  y_offset = -0.5f*(display_height-x*image_view.image.height());
58  y = x;
59  }
60  else
61  {
62  x_offset = 0.5f*(display_width-y*image_view.image.width());
63  x = y;
64  }
65  }
66  glPixelZoom(x,-y);
67  glMatrixMode(GL_PROJECTION);
68  glLoadIdentity();
69  glOrtho(0, display_width, 0, display_height, 0, 1);
70  glMatrixMode(GL_MODELVIEW);
71  glLoadIdentity();
72  glViewport(0,0, display_width, display_height);
73  glRasterPos2i(x_offset,display_height+y_offset);
74 
75  // target.setRect(x_offset,y_offset,display_width-x_offset,display_width-y_offset);
76  // source.setRect(0,0,image->width(),image->height());
77 }

The documentation for this class was generated from the following files: