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

kstars

Public Types | Public Member Functions | List of all members
Legend Class Reference

#include <legend.h>

Public Types

enum  LEGEND_ORIENTATION { LO_HORIZONTAL, LO_VERTICAL }
 
enum  LEGEND_POSITION {
  LP_UPPER_LEFT, LP_UPPER_RIGHT, LP_LOWER_LEFT, LP_LOWER_RIGHT,
  LP_FLOATING
}
 
enum  LEGEND_TYPE {
  LT_FULL, LT_SCALE_MAGNITUDES, LT_SCALE_ONLY, LT_MAGNITUDES_ONLY,
  LT_SYMBOLS_ONLY
}
 

Public Member Functions

 Legend (LEGEND_ORIENTATION orientation=LO_HORIZONTAL, LEGEND_POSITION pos=LP_FLOATING)
 
 Legend (const Legend &o)
 
 ~Legend ()
 
QSize calculateSize ()
 
QColor getBgColor ()
 
int getBRectHeight ()
 
int getBRectWidth ()
 
bool getDrawFrame ()
 
QPoint getFloatingPosition ()
 
QFont getFont ()
 
int getMaxHScalePixels ()
 
int getMaxVScalePixels ()
 
LEGEND_ORIENTATION getOrientation ()
 
LEGEND_POSITION getPosition ()
 
int getSymbolSize ()
 
LEGEND_TYPE getType ()
 
int getXSymbolSpacing ()
 
int getYSymbolSpacing ()
 
void paintLegend (QPaintDevice *pd)
 
void paintLegend (SkyQPainter *painter)
 
void paintLegend (QPaintDevice *pd, LEGEND_TYPE type, LEGEND_POSITION pos)
 
void paintLegend (SkyQPainter *painter, LEGEND_TYPE type, LEGEND_POSITION pos)
 
void setBgColor (const QColor &color)
 
void setBRectHeight (int height)
 
void setBRectWidth (int width)
 
void setDrawFrame (bool draw)
 
void setFloatingPosition (QPoint pos)
 
void setFont (const QFont &font)
 
void setMaxHScalePixels (int pixels)
 
void setMaxVScalePixels (int pixels)
 
void setOrientation (LEGEND_ORIENTATION orientation)
 
void setPosition (LEGEND_POSITION pos)
 
void setSymbolSize (int size)
 
void setType (LEGEND_TYPE type)
 
void setXSymbolSpacing (int spacing)
 
void setYSymbolSpacing (int spacing)
 

Detailed Description

Legend class is used for painting legends on class inheriting QPaintDevice.

Its methods enable changing settings of legend such as legend type (scale only/full legend), symbol size, sizes for symbol description's bounding rectangles, symbol spacing etc. Typical use of this class would be to create instance of Legend class, set all properties using appropriate methods and paint it by calling paintLegend() method, passing QPaintDevice or QPainter subclass (useful eg. with QSvgGenerator class, which can't be painted by two QPainter classes).

Author
Rafał Kułaga

Definition at line 45 of file legend.h.

Member Enumeration Documentation

enum Legend::LEGEND_ORIENTATION

Legend orientation enumeration.

Enumerator
LO_HORIZONTAL 
LO_VERTICAL 

Definition at line 64 of file legend.h.

enum Legend::LEGEND_POSITION

Legend position enumeration.

Enumerator
LP_UPPER_LEFT 
LP_UPPER_RIGHT 
LP_LOWER_LEFT 
LP_LOWER_RIGHT 
LP_FLOATING 

Definition at line 73 of file legend.h.

enum Legend::LEGEND_TYPE

Legend type enumeration.

Enumerator
LT_FULL 
LT_SCALE_MAGNITUDES 
LT_SCALE_ONLY 
LT_MAGNITUDES_ONLY 
LT_SYMBOLS_ONLY 

Definition at line 52 of file legend.h.

Constructor & Destructor Documentation

Legend::Legend ( LEGEND_ORIENTATION  orientation = LO_HORIZONTAL,
LEGEND_POSITION  pos = LP_FLOATING 
)
explicit

Constructor.

Parameters
orientationLegend orientation.
posLegend position.

Definition at line 38 of file legend.cpp.

Legend::Legend ( const Legend &  o)
explicit

copy constructor

Note
This class needs to be explicitly copied because of the m_Painter pointer

Definition at line 578 of file legend.cpp.

Legend::~Legend ( )

Destructor.

Definition at line 48 of file legend.cpp.

Member Function Documentation

QSize Legend::calculateSize ( )

Calculates size of legend that will be painted using current settings.

Returns
Size of legend.

Definition at line 56 of file legend.cpp.

QColor Legend::getBgColor ( )
inline

Get background color.

Returns
Current background color.

Definition at line 176 of file legend.h.

int Legend::getBRectHeight ( )
inline

Get symbol description's bounding rectangle height.

Returns
Current bounding rectangle height.

Definition at line 140 of file legend.h.

int Legend::getBRectWidth ( )
inline

Get symbol description's bounding rectangle width.

Returns
Current bounding rectangle width.

Definition at line 134 of file legend.h.

bool Legend::getDrawFrame ( )
inline

Check if frame around legend is drawn.

Returns
True if frame is drawn.

Definition at line 182 of file legend.h.

QPoint Legend::getFloatingPosition ( )
inline

Get position of the floating legend.

Returns
Current position of the floating legend.

Definition at line 122 of file legend.h.

QFont Legend::getFont ( )
inline

Get font.

Returns
Current font.

Definition at line 170 of file legend.h.

int Legend::getMaxHScalePixels ( )
inline

Get maximal horizontal scale size in pixels.

Returns
Current maximal horizontal scale size in pixels.

Definition at line 146 of file legend.h.

int Legend::getMaxVScalePixels ( )
inline

Get maximal vertical scale size in pixels.

Current maximal vertical scale size in pixels.

Definition at line 152 of file legend.h.

LEGEND_ORIENTATION Legend::getOrientation ( )
inline

Get legend orientation.

Returns
Current legend orientation value.

Definition at line 110 of file legend.h.

LEGEND_POSITION Legend::getPosition ( )
inline

Get legend position.

Returns
Current legend position value.

Definition at line 116 of file legend.h.

int Legend::getSymbolSize ( )
inline

Get symbol size.

Returns
Current symbol size value.

Definition at line 128 of file legend.h.

LEGEND_TYPE Legend::getType ( )
inline

Get legend type.

Returns
Current legend type value.

Definition at line 104 of file legend.h.

int Legend::getXSymbolSpacing ( )
inline

Get symbol image X spacing.

Returns
Current symbol image X spacing.

Definition at line 158 of file legend.h.

int Legend::getYSymbolSpacing ( )
inline

Get symbol image Y spacing.

Returns
Current symbol image Y spacing.

Definition at line 164 of file legend.h.

void Legend::paintLegend ( QPaintDevice *  pd)

Paint legend on passed QPaintDevice at selected position.

Parameters
pdQPaintDevice on which legend will be painted.

Definition at line 162 of file legend.cpp.

void Legend::paintLegend ( SkyQPainter *  painter)

Paint legend using passed SkyQPainter.

This method is used to enable painting on QPaintDevice subclasses that can't be painted by multiple QPainter subclasses (e.g. QSvgGenerator).

Parameters
painterthat will be used to paint legend.
Note
Passed SkyQPainter should be already set up to paint at specific QPaintDevice subclass and should be initialized by its begin() method. After legend is painted, SkyQPainter instance will not be finished, so it's necessary to call end() method manually.

Definition at line 178 of file legend.cpp.

void Legend::paintLegend ( QPaintDevice *  pd,
LEGEND_TYPE  type,
LEGEND_POSITION  pos 
)

Paint legend on passed QPaintDevice at selected position.

Parameters
pdQPaintDevice on which legend will be painted.
posLEGEND_POSITION enum value.
scaleOnlyshould legend be painted scale-only?

Definition at line 311 of file legend.cpp.

void Legend::paintLegend ( SkyQPainter *  painter,
LEGEND_TYPE  type,
LEGEND_POSITION  pos 
)

Paint legend using passed SkyQPainter.

This method is used to enable painting on QPaintDevice subclasses that can't be painted by multiple QPainter subclasses (eg. QSvgGenerator).

Parameters
painterthat will be used to paint legend.
posLEGEND_POSITION enum value.
scaleOnlyshould legend be painted scale-only?
Note
Passed SkyQPainter should be already set up to paint at specific QPaintDevice subclass and should be initialized by its begin() method. After legend is painted, SkyQPainter instance will not be finished, so it's necessary to call end() method manually.

Definition at line 325 of file legend.cpp.

void Legend::setBgColor ( const QColor &  color)
inline

Set background color.

Parameters
colorNew background color.

Definition at line 260 of file legend.h.

void Legend::setBRectHeight ( int  height)
inline

Set symbol description's bounding rectangle height.

Parameters
heightNew bounding rectangle height.

Definition at line 224 of file legend.h.

void Legend::setBRectWidth ( int  width)
inline

Set symbol description's bounding rectangle width.

Parameters
widthNew bounding rectangle width.

Definition at line 218 of file legend.h.

void Legend::setDrawFrame ( bool  draw)
inline

Set if frame is drawn.

Parameters
drawTrue if frame should be drawn.

Definition at line 266 of file legend.h.

void Legend::setFloatingPosition ( QPoint  pos)
inline

Set floating legend position.

Parameters
posNew floating legend position.

Definition at line 206 of file legend.h.

void Legend::setFont ( const QFont &  font)
inline

Set font.

Parameters
fontNew font.

Definition at line 254 of file legend.h.

void Legend::setMaxHScalePixels ( int  pixels)
inline

Set maximal horizontal scale size in pixels.

Parameters
pixelsNew maximal horizontal scale size in pixels.

Definition at line 230 of file legend.h.

void Legend::setMaxVScalePixels ( int  pixels)
inline

Set maximal vertical scale size in pixels.

Parameters
pixelsNew maximal vertical scale size in pixels.

Definition at line 236 of file legend.h.

void Legend::setOrientation ( LEGEND_ORIENTATION  orientation)
inline

Set legend orientation.

Parameters
orientationNew legend orientation.

Definition at line 194 of file legend.h.

void Legend::setPosition ( LEGEND_POSITION  pos)
inline

Set legend position.

Parameters
posNew legend position enumeration value.

Definition at line 200 of file legend.h.

void Legend::setSymbolSize ( int  size)
inline

Set symbol size.

Parameters
sizeNew symbol size.

Definition at line 212 of file legend.h.

void Legend::setType ( LEGEND_TYPE  type)
inline

Set legend type.

Parameters
typeNew legend type.

Definition at line 188 of file legend.h.

void Legend::setXSymbolSpacing ( int  spacing)
inline

Set symbol X spacing in pixels.

Parameters
spacingNew symbol X spacing in pixels.

Definition at line 242 of file legend.h.

void Legend::setYSymbolSpacing ( int  spacing)
inline

Set symbol Y spacing in pixels.

Parameters
spacingNew symbol Y spacing in pixels.

Definition at line 248 of file legend.h.


The documentation for this class was generated from the following files:
  • legend.h
  • legend.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:22 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