• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • fitsviewer
fitshistogramdraw.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  fitshistogramdraw.cpp - FITS Historgram
3  ---------------
4  copyright : (C) 2006 by Jasem Mutlaq
5  email : mutlaqja@ikarustech.com
6  ***************************************************************************/
7 
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #include <cmath>
18 
19 #include "fitshistogramdraw.h"
20 #include "fitshistogram.h"
21 
22 #include <QPainter>
23 #include <QPen>
24 #include <QPainterPath>
25 #include <QMouseEvent>
26 #include <QDebug>
27 
28 histDrawArea::histDrawArea(QWidget* parent) : QFrame(parent), height_adj(10), line_height(70)
29 {
30  data = (FITSHistogram*) parent;
31 
32  setCursor(Qt::CrossCursor);
33  setMouseTracking(true);
34 
35 }
36 
37 void histDrawArea::init()
38 {
39  hist_width = maximumWidth();
40  hist_height = maximumHeight();
41 
42  //qDebug() << "constructor VALID Width: " << valid_width << " - VALID height: " << valid_height;
43  enclosedRect.setRect(0, 0, hist_width-1, hist_height);
44 
45  // upperLimitX = hist_width;
46  // lowerLimitX = 0;
47 
48  //kDebug() << "Calling construction histogram";
49 
50 }
51 
52 histDrawArea::~histDrawArea()
53 {
54 }
55 
56 void histDrawArea::paintEvent(QPaintEvent *event)
57 {
58  Q_UNUSED(event);
59 
60  QPainter painter(this);
61  QPen pen;
62 
63  int pixelWidth = floor(data->binWidth);
64  if (pixelWidth < 1)
65  pixelWidth = 1;
66 
67  pen.setWidth(pixelWidth);
68  painter.setPen(pen);
69 
70 
71  for (int i=0; i < data->histArray.size(); i++)
72  painter.drawLine(i*pixelWidth, hist_height, i*pixelWidth, hist_height - (data->histArray[i]*data->histFactor));
73 
74 
75  // Draw box
76  pen.setWidth(1);
77  painter.setPen(pen);
78 
79  painter.drawRect(enclosedRect);
80 
81 
82 
83 }
84 
85 void histDrawArea::mouseMoveEvent ( QMouseEvent * event )
86 {
87  int event_x = (int) (event->x());
88  data->updateIntenFreq(event_x);
89 }
90 
91 #include "fitshistogramdraw.moc"
histDrawArea::init
void init()
Definition: fitshistogramdraw.cpp:37
histDrawArea::histDrawArea
histDrawArea(QWidget *parent)
Definition: fitshistogramdraw.cpp:28
QWidget
histDrawArea::~histDrawArea
~histDrawArea()
Definition: fitshistogramdraw.cpp:52
fitshistogramdraw.h
FITSHistogram::updateIntenFreq
void updateIntenFreq(int x)
Definition: fitshistogram.cpp:254
fitshistogram.h
FITSHistogram::binWidth
double binWidth
Definition: fitshistogram.h:71
FITSHistogram::histFactor
double histFactor
Definition: fitshistogram.h:70
histDrawArea::paintEvent
void paintEvent(QPaintEvent *event)
Definition: fitshistogramdraw.cpp:56
FITSHistogram
Definition: fitshistogram.h:48
QFrame
histDrawArea::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
Definition: fitshistogramdraw.cpp:85
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:19 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal