• 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
  • printing
legend.h
Go to the documentation of this file.
1 /***************************************************************************
2  legend.h - K Desktop Planetarium
3  -------------------
4  begin : Thu May 26 2011
5  copyright : (C) 2011 by Rafał Kułaga
6  email : rl.kulaga@gmail.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef LEGEND_H
19 #define LEGEND_H
20 
21 #include <QObject>
22 #include <QFont>
23 #include <QPoint>
24 #include <QColor>
25 
26 class QPaintDevice;
27 class QPointF;
28 class QSize;
29 
30 class SkyQPainter;
31 class SkyMap;
32 class ColorScheme;
33 
45 class Legend
46 {
47 public:
48 
52  enum LEGEND_TYPE
53  {
54  LT_FULL,
55  LT_SCALE_MAGNITUDES,
56  LT_SCALE_ONLY,
57  LT_MAGNITUDES_ONLY,
58  LT_SYMBOLS_ONLY,
59  };
60 
64  enum LEGEND_ORIENTATION
65  {
66  LO_HORIZONTAL,
67  LO_VERTICAL
68  };
69 
73  enum LEGEND_POSITION
74  {
75  LP_UPPER_LEFT,
76  LP_UPPER_RIGHT,
77  LP_LOWER_LEFT,
78  LP_LOWER_RIGHT,
79  LP_FLOATING
80  };
81 
87  explicit Legend(LEGEND_ORIENTATION orientation = LO_HORIZONTAL, LEGEND_POSITION pos = LP_FLOATING);
88 
93  explicit Legend( const Legend &o );
94 
98  ~Legend();
99 
104  inline LEGEND_TYPE getType() { return m_Type; }
105 
110  inline LEGEND_ORIENTATION getOrientation() { return m_Orientation; }
111 
116  inline LEGEND_POSITION getPosition() { return m_Position; }
117 
122  inline QPoint getFloatingPosition() { return m_PositionFloating; }
123 
128  inline int getSymbolSize() { return m_SymbolSize; }
129 
134  inline int getBRectWidth() { return m_BRectWidth; }
135 
140  inline int getBRectHeight() { return m_BRectHeight; }
141 
146  inline int getMaxHScalePixels() { return m_MaxHScalePixels; }
147 
152  inline int getMaxVScalePixels() { return m_MaxVScalePixels; }
153 
158  inline int getXSymbolSpacing() { return m_XSymbolSpacing; }
159 
164  inline int getYSymbolSpacing() { return m_YSymbolSpacing; }
165 
170  inline QFont getFont() { return m_Font; }
171 
176  inline QColor getBgColor() { return m_BgColor; }
177 
182  inline bool getDrawFrame() { return m_DrawFrame; }
183 
188  inline void setType(LEGEND_TYPE type) { m_Type = type; }
189 
194  inline void setOrientation(LEGEND_ORIENTATION orientation) { m_Orientation = orientation; }
195 
200  inline void setPosition(LEGEND_POSITION pos) { m_Position = pos; }
201 
206  inline void setFloatingPosition(QPoint pos) { m_PositionFloating = pos; }
207 
212  inline void setSymbolSize(int size) { m_SymbolSize = size; }
213 
218  inline void setBRectWidth(int width) { m_BRectWidth = width; }
219 
224  inline void setBRectHeight(int height) { m_BRectHeight = height; }
225 
230  inline void setMaxHScalePixels(int pixels) { m_MaxHScalePixels = pixels; }
231 
236  inline void setMaxVScalePixels(int pixels) { m_MaxVScalePixels = pixels; }
237 
242  inline void setXSymbolSpacing(int spacing) { m_XSymbolSpacing = spacing; }
243 
248  inline void setYSymbolSpacing(int spacing) { m_YSymbolSpacing = spacing; }
249 
254  inline void setFont(const QFont &font) { m_Font = font; }
255 
260  inline void setBgColor(const QColor &color) { m_BgColor = color; }
261 
266  inline void setDrawFrame(bool draw) { m_DrawFrame = draw; }
267 
272  QSize calculateSize();
273 
278  void paintLegend(QPaintDevice *pd);
279 
289  void paintLegend(SkyQPainter *painter);
290 
297  void paintLegend(QPaintDevice *pd, LEGEND_TYPE type, LEGEND_POSITION pos);
298 
310  void paintLegend(SkyQPainter *painter, LEGEND_TYPE type, LEGEND_POSITION pos);
311 
312 private:
318  void paintSymbols(QPointF pos);
319 
328  void paintSymbol(QPointF pos, int type, float e, float angle, QString label);
329 
334  void paintMagnitudes(QPointF pos);
335 
343  void paintScale(QPointF pos);
344 
349  QPoint positionToDeviceCoord(QPaintDevice *pd);
350 
351  SkyQPainter *m_Painter;
352  SkyMap *m_SkyMap;
353  bool m_DeletePainter;
354 
355  LEGEND_TYPE m_Type;
356  LEGEND_ORIENTATION m_Orientation;
357  LEGEND_POSITION m_Position;
358  QPoint m_PositionFloating;
359 
360  ColorScheme *m_cScheme;
361  QFont m_Font;
362  QColor m_BgColor;
363  bool m_DrawFrame;
364 
365  int m_SymbolSize;
366  int m_BRectWidth;
367  int m_BRectHeight;
368  int m_MaxHScalePixels;
369  int m_MaxVScalePixels;
370  int m_XSymbolSpacing;
371  int m_YSymbolSpacing;
372 };
373 
374 #endif // LEGEND_H
Legend::setBRectHeight
void setBRectHeight(int height)
Set symbol description's bounding rectangle height.
Definition: legend.h:224
Legend::LT_FULL
Definition: legend.h:54
Legend::getSymbolSize
int getSymbolSize()
Get symbol size.
Definition: legend.h:128
Legend::LP_LOWER_LEFT
Definition: legend.h:77
Legend::getDrawFrame
bool getDrawFrame()
Check if frame around legend is drawn.
Definition: legend.h:182
Legend::calculateSize
QSize calculateSize()
Calculates size of legend that will be painted using current settings.
Definition: legend.cpp:56
Legend::getType
LEGEND_TYPE getType()
Get legend type.
Definition: legend.h:104
SkyQPainter
The QPainter-based painting backend.
Definition: skyqpainter.h:32
Legend::LP_LOWER_RIGHT
Definition: legend.h:78
Legend::setFloatingPosition
void setFloatingPosition(QPoint pos)
Set floating legend position.
Definition: legend.h:206
Legend::setBgColor
void setBgColor(const QColor &color)
Set background color.
Definition: legend.h:260
Legend::getBRectWidth
int getBRectWidth()
Get symbol description's bounding rectangle width.
Definition: legend.h:134
Legend::getMaxVScalePixels
int getMaxVScalePixels()
Get maximal vertical scale size in pixels.
Definition: legend.h:152
Legend::LP_UPPER_RIGHT
Definition: legend.h:76
Legend::LEGEND_POSITION
LEGEND_POSITION
Legend position enumeration.
Definition: legend.h:73
Legend::LO_HORIZONTAL
Definition: legend.h:66
Legend::LP_UPPER_LEFT
Definition: legend.h:75
Legend::getFont
QFont getFont()
Get font.
Definition: legend.h:170
Legend::setMaxVScalePixels
void setMaxVScalePixels(int pixels)
Set maximal vertical scale size in pixels.
Definition: legend.h:236
Legend::LEGEND_TYPE
LEGEND_TYPE
Legend type enumeration.
Definition: legend.h:52
Legend::setMaxHScalePixels
void setMaxHScalePixels(int pixels)
Set maximal horizontal scale size in pixels.
Definition: legend.h:230
Legend::setType
void setType(LEGEND_TYPE type)
Set legend type.
Definition: legend.h:188
Legend::getBgColor
QColor getBgColor()
Get background color.
Definition: legend.h:176
Legend::getBRectHeight
int getBRectHeight()
Get symbol description's bounding rectangle height.
Definition: legend.h:140
ColorScheme
This class stores all of the adjustable colors in KStars, in a QMap object keyed by the names of the ...
Definition: colorscheme.h:38
Legend::LT_SCALE_MAGNITUDES
Definition: legend.h:55
Legend::~Legend
~Legend()
Destructor.
Definition: legend.cpp:48
Legend::LEGEND_ORIENTATION
LEGEND_ORIENTATION
Legend orientation enumeration.
Definition: legend.h:64
Legend::setDrawFrame
void setDrawFrame(bool draw)
Set if frame is drawn.
Definition: legend.h:266
Legend
Legend class is used for painting legends on class inheriting QPaintDevice.
Definition: legend.h:45
Legend::getOrientation
LEGEND_ORIENTATION getOrientation()
Get legend orientation.
Definition: legend.h:110
Legend::getXSymbolSpacing
int getXSymbolSpacing()
Get symbol image X spacing.
Definition: legend.h:158
Legend::setXSymbolSpacing
void setXSymbolSpacing(int spacing)
Set symbol X spacing in pixels.
Definition: legend.h:242
Legend::getFloatingPosition
QPoint getFloatingPosition()
Get position of the floating legend.
Definition: legend.h:122
Legend::LP_FLOATING
Definition: legend.h:79
SkyMap
This is the canvas on which the sky is painted.
Definition: skymap.h:72
Legend::setFont
void setFont(const QFont &font)
Set font.
Definition: legend.h:254
Legend::setPosition
void setPosition(LEGEND_POSITION pos)
Set legend position.
Definition: legend.h:200
Legend::LT_MAGNITUDES_ONLY
Definition: legend.h:57
Legend::LT_SCALE_ONLY
Definition: legend.h:56
Legend::LT_SYMBOLS_ONLY
Definition: legend.h:58
Legend::setOrientation
void setOrientation(LEGEND_ORIENTATION orientation)
Set legend orientation.
Definition: legend.h:194
Legend::paintLegend
void paintLegend(QPaintDevice *pd)
Paint legend on passed QPaintDevice at selected position.
Definition: legend.cpp:162
Legend::getPosition
LEGEND_POSITION getPosition()
Get legend position.
Definition: legend.h:116
Legend::setBRectWidth
void setBRectWidth(int width)
Set symbol description's bounding rectangle width.
Definition: legend.h:218
Legend::setYSymbolSpacing
void setYSymbolSpacing(int spacing)
Set symbol Y spacing in pixels.
Definition: legend.h:248
Legend::setSymbolSize
void setSymbolSize(int size)
Set symbol size.
Definition: legend.h:212
Legend::getMaxHScalePixels
int getMaxHScalePixels()
Get maximal horizontal scale size in pixels.
Definition: legend.h:146
Legend::LO_VERTICAL
Definition: legend.h:67
Legend::getYSymbolSpacing
int getYSymbolSpacing()
Get symbol image Y spacing.
Definition: legend.h:164
Legend::Legend
Legend(LEGEND_ORIENTATION orientation=LO_HORIZONTAL, LEGEND_POSITION pos=LP_FLOATING)
Constructor.
Definition: legend.cpp:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 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