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

kstars

Public Member Functions | Public Attributes | List of all members
TargetListComponent Class Reference

#include <targetlistcomponent.h>

Inheritance diagram for TargetListComponent:
Inheritance graph
[legend]

Public Member Functions

 TargetListComponent (SkyComposite *parent)
 
 TargetListComponent (SkyComposite *parent)
 
 TargetListComponent (SkyComposite *parent, QList< SkyObject * > *objectList, QPen _pen, bool(*optionDrawSymbols)(void)=0, bool(*optionDrawLabels)(void)=0)
 
 TargetListComponent (SkyComposite *parent, QList< SkyObject * > *objectList, QPen _pen, bool(*optionDrawSymbols)(void)=0, bool(*optionDrawLabels)(void)=0)
 
virtual void draw (SkyPainter *skyp)
 
virtual void draw (SkyPainter *skyp)
 
- Public Member Functions inherited from SkyComponent
 SkyComponent (SkyComposite *parent)
 
virtual ~SkyComponent ()
 
virtual void drawTrails (SkyPainter *skyp)
 
virtual void emitProgressText (const QString &message)
 
virtual SkyObject * findByName (const QString &name)
 
QHash< int, QStringList > & objectNames ()
 
QStringList & objectNames (int type)
 
virtual SkyObject * objectNearest (SkyPoint *p, double &maxrad)
 
virtual void objectsInArea (QList< SkyObject * > &list, const SkyRegion &region)
 
SkyComposite * parent ()
 
virtual bool selected ()
 
virtual void update (KSNumbers *)
 
virtual void updateMoons (KSNumbers *)
 
virtual void updatePlanets (KSNumbers *)
 

Public Attributes

bool(* drawLabels )(void)
 
bool(* drawSymbols )(void)
 
SkyObjectList * list
 
QPen pen
 

Additional Inherited Members

- Protected Member Functions inherited from SkyComponent
void removeFromNames (const SkyObject *obj)
 

Detailed Description

Highlights objects present in certain lists by drawing "target" symbols around them.

To represent lists of specific objects on the skymap (eg: A star hopping route, or a list of planned observation targets), one would typically like to draw over the skymap, a bunch of symbols highlighting the locations of these objects. This class manages drawing of such lists. Along with the list, we also associate a pen to use to represent objects from that list. Once this class is made aware of a list to plot (which is stored somewhere else), it does so when called from the SkyMapComposite. The class may be supplied with pointers to two methods that tell it whether to draw symbols / labels or not. Disabling symbol drawing is equivalent to disabling the list. If the pointers are NULL, the symbols are always drawn, but the labels are not drawn.

Note
This does not inherit from ListComponent because it is not necessary. ListComponent has extra methods like objectNearest(), which we don't want. Also, ListComponent maintains its own list, whereas this class merely holds a pointer to a list that's manipulated from elsewhere.

Definition at line 50 of file skycomponents/targetlistcomponent.h.

Constructor & Destructor Documentation

TargetListComponent::TargetListComponent ( SkyComposite *  parent)
explicit

Default constructor.

Definition at line 22 of file skycomponents/targetlistcomponent.cpp.

TargetListComponent::TargetListComponent ( SkyComposite *  parent,
QList< SkyObject * > *  objectList,
QPen  _pen,
bool(*)(void)  optionDrawSymbols = 0,
bool(*)(void)  optionDrawLabels = 0 
)

Constructor that sets up this target list.

Definition at line 28 of file skycomponents/targetlistcomponent.cpp.

TargetListComponent::TargetListComponent ( SkyComposite *  parent)
explicit

Default constructor.

TargetListComponent::TargetListComponent ( SkyComposite *  parent,
QList< SkyObject * > *  objectList,
QPen  _pen,
bool(*)(void)  optionDrawSymbols = 0,
bool(*)(void)  optionDrawLabels = 0 
)

Constructor that sets up this target list.

Member Function Documentation

void TargetListComponent::draw ( SkyPainter *  skyp)
virtual

Draw this component by iterating over the list.

This method is now implemented in SkyPainter subclasses, and hence is redundant.

Note
This method does not bother refreshing the coordinates of the objects on the list. So this must be called only after the objects are drawn in a given draw cycle.

But I'd let this method stick around for a while, before I get rid of it altogether

  • Akarsh

void TargetListComponent::drawTargetSymbol( SkyPainter *skyp, SkyObject *obj ) { SkyMap *map = SkyMap::Instance(); // FIXME: Replace with projector upon merger of Harry's code if ( ! map->checkVisibility( obj ) ) return; QPointF o = map->toScreen( obj ); // FIXME: Replace with appropriate call on the projector upon merger of Harry's code if( !drawSymbols || (*drawSymbols)() ) { if (o.x() >= 0. && o.x() <= map->width()*map->scale() && o.y() >=0. && o.y() <= map->height()*map->scale() ) { if ( Options::useAntialias() ) { float size = 20.*map->scale(); float x1 = o.x() - 0.5*size; float y1 = o.y() - 0.5*size; psky.drawArc( QRectF(x1, y1, size, size), -60*16, 120*16 ); psky.drawArc( QRectF(x1, y1, size, size), 120*16, 120*16 ); } else { int size = 20*int(map->scale()); int x1 = int(o.x()) - size/2; int y1 = int(o.y()) - size/2; psky.drawArc( QRect(x1, y1, size, size), -60*16, 120*16 ); psky.drawArc( QRect(x1, y1, size, size), 120*16, 120*16 ); } if ( drawLabels && (*drawLabels)() ) obj->drawRudeNameLabel( psky, o ); } } }

Implements SkyComponent.

Definition at line 70 of file skycomponents/targetlistcomponent.cpp.

virtual void TargetListComponent::draw ( SkyPainter *  skyp)
virtual

Draw this component by iterating over the list.

Note
This method does not bother refreshing the coordinates of the objects on the list. So this must be called only after the objects are drawn in a given draw cycle.

Implements SkyComponent.

Member Data Documentation

bool(* TargetListComponent::drawLabels)(void)

Pointer to static method that tells us whether to draw labels for this list or not.

Note
If the pointer is NULL, labels are not drawn

Definition at line 88 of file skycomponents/targetlistcomponent.h.

bool(* TargetListComponent::drawSymbols)(void)

Pointer to static method that tells us whether to draw this list or not.

Note
If the pointer is NULL, the list is drawn nevertheless

Definition at line 82 of file skycomponents/targetlistcomponent.h.

SkyObjectList * TargetListComponent::list

Definition at line 75 of file skycomponents/targetlistcomponent.h.

QPen TargetListComponent::pen

Definition at line 76 of file skycomponents/targetlistcomponent.h.


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