TarzaNN
TarzaNN neural network simulator
C:/Users/albertlr/projects/TarzaNN/TarzaNN/UI_Layer.h
Go to the documentation of this file.
00001 /****************************************************************************
00002  **
00003  ** Copyright C 2002-2012 Laboratory for Active and Attentive Vision (LAAV), Department of Computer Science and Engineering, York University, Toronto, ON, Canada.
00004  ** All rights reserved.
00005  **
00006  ** This file is part of the TarzaNN Neural Network Simulator.
00007  **
00008  ** This file may be distributed and/or modified under the terms of the
00009  ** GNU General Public License version 2 as published by the Free Software
00010  ** Foundation and appearing in the file LICENSE.GPL included in the
00011  ** packaging of this file.
00012  **
00013  ** See http://www.tarzann.org/gpl/ for GPL licensing information.
00014  **
00015  ** Contact info@tarzann.org if any conditions of this licensing are
00016  ** not clear to you.
00017  **
00018  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00019  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00020  **
00021  ****************************************************************************/
00022 
00023 #ifndef UI_LAYER_H_INCLUDED
00024 #define UI_LAYER_H_INCLUDED
00025 
00026 
00027 #include "UI_Widget.h"
00028 #include "Observer.h"
00029 #include <QList>
00030 
00031 class Layer;
00032 class QLabel;
00033 
00034 class UI_Layer : public UI_Widget, public Observer
00035 {
00036         Q_OBJECT
00037 
00038 public:
00039         UI_Layer(Layer *layer, QWidget* parent, const char* name=0, Qt::WFlags fl=0 );
00040         ~UI_Layer(void);
00041 
00042         virtual void updateNN(Observer* sourceFP, bool functional);
00043 
00044         virtual void resizeEvent( QResizeEvent *e );
00045         virtual void paintEvent( QPaintEvent *e );
00046 
00047 protected:
00048         void DrawArrow(QPainter *painter, float x_center, float y_center, int length, int distance_from_center, float angle);
00049         void Init();
00050         void Destroy();
00051         void DrawLayer();
00052         void UpdateLabels();
00053         int Pos(int speed, int dir);
00054         void GetLengthAndOffset(float &length, int &offset);
00055         QTransform GetTransform(float x_center, float y_center, int length, int distance_from_center, float angle, float y_squeeze = 1);
00056         float ConvertDirToDeg(int dirs, int dir);
00057 protected:
00058         Layer *_layer;
00059         QPolygonF _arrow;
00060         QList<QLabel*> _fpLabels;
00061         int _numberDirections;
00062         int _numberSpeeds;
00063         int _numberGradients;
00064 
00065         const float _arrow_Width;
00066         const float _arrow_Length;
00067 };
00068 
00069 #endif //UI_LAYER_H_INCLUDED
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines