arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

SliceView.cpp

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     6-20-03
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2003 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 
00019 ///SliceView.cpp
00020 ///  simianUI
00021 
00022 #include "SliceView.h"
00023 #include <qwmatrix.h>
00024 #include <iostream>
00025 
00026 using namespace std;
00027 
00028 //////////////////////////////////////////////////////////////////////////
00029 /// construction
00030 //////////////////////////////////////////////////////////////////////////
00031 
00032 SliceView::SliceView(QCanvas *canvas, QWidget *parent, const char *name, WFlags f)
00033 : QCanvasView(canvas, parent,name,f), _zoom(1), _pos(gutz::vec2f_zero)
00034 {
00035    
00036 }
00037 
00038 //////////////////////////////////////////////////////////////////////////
00039 /// destruction
00040 //////////////////////////////////////////////////////////////////////////
00041 
00042 SliceView::~SliceView()
00043 {
00044 
00045 }
00046 
00047 gutz::vec2f SliceView::getAspect() const
00048 {
00049    if(width() < height())
00050       return gutz::vec2f(1, height()/float(width()));
00051    return gutz::vec2f(width()/float(height()), 1);
00052 }
00053 
00054 
00055 //////////////////////////////////////////////////////////////////////////
00056 //////////////////////////////////////////////////////////////////////////
00057 /// protected members
00058 //////////////////////////////////////////////////////////////////////////
00059 //////////////////////////////////////////////////////////////////////////
00060 
00061 //////////////////////////////////////////////////////////////////////////
00062 /// mouse press event
00063 //////////////////////////////////////////////////////////////////////////
00064 void SliceView::contentsMousePressEvent(QMouseEvent *me)
00065 {
00066    QPoint p = inverseWorldMatrix().map(me->pos());
00067    pickPosChanged(p.x(), p.y());
00068 }
00069 
00070 //////////////////////////////////////////////////////////////////////////
00071 /// mouse press event
00072 //////////////////////////////////////////////////////////////////////////
00073 void SliceView::contentsMouseMoveEvent(QMouseEvent *me)
00074 {
00075    QPoint p = inverseWorldMatrix().map(me->pos());
00076    pickPosChanged(p.x(), p.y());
00077 }
00078 
00079 

Send questions, comments, and bug reports to:
jmk