• 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
  • skycomponents
skylabeler.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  skylabeler.cpp - K Desktop Planetarium
3  -------------------
4  begin : 2007-07-10
5  copyright : (C) 2007 by James B. Bowlin
6  email : bowlin@mindspring.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 #include "skylabeler.h"
19 
20 #include <cstdio>
21 
22 #include <QPainter>
23 #include <QPixmap>
24 
25 #include "Options.h"
26 #include "kstarsdata.h" // MINZOOM
27 #include "skymap.h"
28 #include "projections/projector.h"
29 
30 //---------------------------------------------------------------------------//
31 // A Little data container class
32 //---------------------------------------------------------------------------//
33 
34 typedef struct LabelRun
35 {
36  LabelRun(int s, int e) : start(s), end(e) {}
37  int start;
38  int end;
39 
40 } LabelRun;
41 
42 
43 //----- Now for the main event ----------------------------------------------//
44 
45 //----- Static Methods ------------------------------------------------------//
46 
47 
48 SkyLabeler* SkyLabeler::pinstance = 0;
49 SkyLabeler* SkyLabeler::Instance( )
50 {
51  if ( ! pinstance ) pinstance = new SkyLabeler();
52  return pinstance;
53 }
54 
55 
56 void SkyLabeler::setZoomFont()
57 {
58  QFont font( m_p.font() );
59  int deltaSize = 0;
60  if ( Options::zoomFactor() < 2.0 * MINZOOM )
61  deltaSize = 2;
62  else if ( Options::zoomFactor() < 10.0 * MINZOOM )
63  deltaSize = 1;
64 
65  if ( deltaSize ) {
66  font.setPointSize( font.pointSize() - deltaSize );
67  m_p.setFont( font );
68  }
69 }
70 
71 double SkyLabeler::ZoomOffset()
72 {
73  double offset = dms::PI * Options::zoomFactor()/10800.0/3600.0;
74  return 4.0 + offset * 0.5;
75 }
76 
77 //----- Constructor ---------------------------------------------------------//
78 
79 SkyLabeler::SkyLabeler() :
80  m_maxY(0),
81  m_size(0),
82  m_fontMetrics( QFont() ),
83  m_picture(-1),
84  labelList( NUM_LABEL_TYPES ),
85  m_proj(0)
86 {
87  m_errors = 0;
88  m_minDeltaX = 30; // when to merge two adjacent regions
89  m_marks = m_hits = m_misses = m_elements = 0;
90 }
91 
92 
93 SkyLabeler::~SkyLabeler()
94 {
95  for (int y = 0; y < screenRows.size(); y++ ) {
96  LabelRow* row = screenRows[y];
97  for ( int i = 0; i < row->size(); i++) {
98  delete row->at(i);
99  }
100  delete row;
101  }
102 }
103 
104 bool SkyLabeler::drawGuideLabel( QPointF& o, const QString& text, double angle )
105 {
106  // Create bounding rectangle by rotating the (height x width) rectangle
107  qreal h = m_fontMetrics.height();
108  qreal w = m_fontMetrics.width( text );
109  qreal s = sin( angle * dms::PI / 180.0 );
110  qreal c = cos( angle * dms::PI / 180.0 );
111 
112  qreal w2 = w / 2.0;
113 
114  qreal top, bot, left, right;
115 
116  // These numbers really do depend on the sign of the angle like this
117  if ( angle >= 0.0 ) {
118  top = o.y() - s * w2;
119  bot = o.y() + c * h + s * w2;
120  left = o.x() - c * w2 - s * h;
121  right = o.x() + c * w2;
122  }
123  else {
124  top = o.y() + s * w2;
125  bot = o.y() + c * h - s * w2;
126  left = o.x() - c * w2;
127  right = o.x() + c * w2 - s * h;
128  }
129 
130  // return false if label would overlap existing label
131  if ( ! markRegion( left, right, top, bot) )
132  return false;
133 
134  // for debugging the bounding rectangle:
135  //psky.drawLine( QPointF( left, top ), QPointF( right, top ) );
136  //psky.drawLine( QPointF( right, top ), QPointF( right, bot ) );
137  //psky.drawLine( QPointF( right, bot ), QPointF( left, bot ) );
138  //psky.drawLine( QPointF( left, bot ), QPointF( left, top ) );
139 
140  // otherwise draw the label and return true
141  m_p.save();
142  m_p.translate( o );
143 
144  m_p.rotate( angle ); //rotate the coordinate system
145  m_p.drawText( QPointF( -w2, h ), text );
146  m_p.restore(); //reset coordinate system
147 
148  return true;
149 }
150 
151 bool SkyLabeler::drawNameLabel(SkyObject* obj, const QPointF& _p)
152 {
153  QString sLabel = obj->labelString();
154 
155  double offset = obj->labelOffset();
156  QPointF p( _p.x()+offset, _p.y()+offset );
157 
158  if ( !markText( p, sLabel ) ) {
159  return false;
160  } else {
161  m_p.drawText( p, sLabel );
162  return true;
163  }
164 }
165 
166 
167 void SkyLabeler::setFont( const QFont& font )
168 {
169  m_p.setFont( font );
170  m_fontMetrics = QFontMetrics( font );
171 }
172 
173 void SkyLabeler::setPen(const QPen& pen)
174 {
175  m_p.setPen(pen);
176 }
177 
178 void SkyLabeler::shrinkFont( int delta )
179 {
180  QFont font( m_p.font() );
181  font.setPointSize( font.pointSize() - delta );
182  setFont( font );
183 }
184 
185 void SkyLabeler::useStdFont()
186 {
187  setFont( m_stdFont );
188 }
189 
190 void SkyLabeler::resetFont()
191 {
192  setFont( m_skyFont );
193 }
194 
195 void SkyLabeler::getMargins( const QString& text, float *left,
196  float *right, float *top, float *bot )
197 {
198  float height = m_fontMetrics.height();
199  float width = m_fontMetrics.width( text );
200  float sideMargin = m_fontMetrics.width("MM") + width / 2.0;
201 
202  // Create the margins within which it is okay to draw the label
203  *right = m_p.window().width() - sideMargin;
204  *left = sideMargin;
205  *top = height;
206  *bot = m_p.window().height() - 2.0 * height;
207 }
208 
209 void SkyLabeler::reset( SkyMap* skyMap )
210 {
211  // ----- Set up Projector ---
212  m_proj = skyMap->projector();
213  // ----- Set up Painter -----
214  if( m_p.isActive() )
215  m_p.end();
216  m_picture = QPicture();
217  m_p.begin(&m_picture);
218  //This works around BUG 10496 in Qt
219  m_p.drawPoint( 0, 0 );
220  m_p.drawPoint( skyMap->width() + 1, skyMap->height() + 1);
221  // ----- Set up Zoom Dependent Font -----
222 
223  m_stdFont = QFont( m_p.font() );
224  setZoomFont();
225  m_skyFont = m_p.font();
226  m_fontMetrics = QFontMetrics( m_skyFont );
227  m_minDeltaX = (int) m_fontMetrics.width("MMMMM");
228 
229  // ----- Set up Zoom Dependent Offset -----
230  m_offset = SkyLabeler::ZoomOffset();
231 
232  // ----- Prepare Virtual Screen -----
233  m_yScale = (m_fontMetrics.height() + 1.0);
234 
235  int maxY = int( skyMap->height() / m_yScale );
236  if ( maxY < 1 ) maxY = 1; // prevents a crash below?
237 
238  int m_maxX = skyMap->width();
239  m_size = (maxY + 1) * m_maxX;
240 
241  // Resize if needed:
242  if ( maxY > m_maxY ) {
243  screenRows.resize( m_maxY );
244  for ( int y = m_maxY; y <= maxY; y++) {
245  screenRows.append( new LabelRow() );
246  }
247  //printf("resize: %d -> %d, size:%d\n", m_maxY, maxY, screenRows.size());
248  }
249 
250  // Clear all pre-existing rows as needed
251 
252  int minMaxY = (maxY < m_maxY) ? maxY : m_maxY;
253 
254  for (int y = 0; y <= minMaxY; y++) {
255  LabelRow* row = screenRows[y];
256  for ( int i = 0; i < row->size(); i++) {
257  delete row->at(i);
258  }
259  row->clear();
260  }
261 
262  // never decrease m_maxY:
263  if ( m_maxY < maxY ) m_maxY = maxY;
264 
265  // reset the counters
266  m_marks = m_hits = m_misses = m_elements = 0;
267 
268  //----- Clear out labelList -----
269  for (int i = 0; i < labelList.size(); i++) {
270  labelList[ i ].clear();
271  }
272 }
273 
274 void SkyLabeler::draw(QPainter& p)
275 {
276  //FIXME: need a better soln. Apparently starting a painter
277  //clears the picture.
278  // But it's not like that's something that should be in the docs, right?
279  // No, that's definitely better to leave to people to figure out on their own.
280  if( m_p.isActive() ) { m_p.end(); }
281  m_picture.play(&p); //can't replay while it's being painted on
282  //this is also undocumented btw.
283  //m_p.begin(&m_picture);
284 }
285 
286 // We use Run Length Encoding to hold the information instead of an array of
287 // chars. This is both faster and smaller but the code is more complicated.
288 //
289 // This code is easy to break and hard to fix.
290 
291 bool SkyLabeler::markText( const QPointF& p, const QString& text )
292 {
293 
294  qreal maxX = p.x() + m_fontMetrics.width( text );
295  qreal minY = p.y() - m_fontMetrics.height();
296  return markRegion( p.x(), maxX, p.y(), minY );
297 }
298 
299 bool SkyLabeler::markRegion( qreal left, qreal right, qreal top, qreal bot )
300 {
301  if ( m_maxY < 1 ) {
302  if ( ! m_errors++ )
303  kDebug() << QString("Someone forgot to reset the SkyLabeler!");
304  return true;
305  }
306 
307  // setup x coordinates of rectangular region
308  int minX = int( left );
309  int maxX = int( right );
310  if (maxX < minX) {
311  maxX = minX;
312  minX = int( right );
313  }
314 
315  // setup y coordinates
316  int maxY = int( bot / m_yScale );
317  int minY = int( top / m_yScale );
318 
319  if ( maxY < 0 ) maxY = 0;
320  if ( maxY > m_maxY ) maxY = m_maxY;
321  if ( minY < 0 ) minY = 0;
322  if ( minY > m_maxY ) minY = m_maxY;
323 
324  if ( maxY < minY ) {
325  int temp = maxY;
326  maxY = minY;
327  minY = temp;
328  }
329 
330  // check to see if we overlap any existing label
331  // We must check all rows before we start marking
332  for (int y = minY; y <= maxY; y++ ) {
333  LabelRow* row = screenRows[ y ];
334  int i;
335  for ( i = 0; i < row->size(); i++) {
336  if ( row->at( i )->end < minX ) continue; // skip past these
337  if ( row->at( i )->start > maxX ) break;
338  m_misses++;
339  return false;
340  }
341  }
342 
343  m_hits++;
344  m_marks += (maxX - minX + 1) * (maxY - minY + 1);
345 
346  // Okay, there was no overlap so let's insert the current rectangle into
347  // screenRows.
348 
349  for ( int y = minY; y <= maxY; y++ ) {
350  LabelRow* row = screenRows[ y ];
351 
352  // Simplest case: an empty row
353  if ( row->size() < 1 ) {
354  row->append( new LabelRun( minX, maxX ) );
355  m_elements++;
356  continue;
357  }
358 
359  // Find out our place in the universe (or row).
360  // H'mm. Maybe we could cache these numbers above.
361  int i;
362  for ( i = 0; i < row->size(); i++ ) {
363  if ( row->at(i)->end >= minX ) break;
364  }
365 
366  // i now points to first label PAST ours
367 
368  // if we are first, append or merge at start of list
369  if ( i == 0 ) {
370  if ( row->at(0)->start - maxX < m_minDeltaX ) {
371  row->at(0)->start = minX;
372  }
373  else {
374  row->insert( 0, new LabelRun(minX, maxX) );
375  m_elements++;
376  }
377  continue;
378  }
379 
380  // if we are past the last label, merge or append at end
381  else if ( i == row->size() ) {
382  if ( minX - row->at(i-1)->end < m_minDeltaX ) {
383  row->at(i-1)->end = maxX;
384  }
385  else {
386  row->append( new LabelRun(minX, maxX) );
387  m_elements++;
388  }
389  continue;
390  }
391 
392  // if we got here, we must insert or merge the new label
393  // between [i-1] and [i]
394 
395  bool mergeHead = ( minX - row->at(i-1)->end < m_minDeltaX );
396  bool mergeTail = ( row->at(i)->start - maxX < m_minDeltaX );
397 
398  // double merge => combine all 3 into one
399  if ( mergeHead && mergeTail ) {
400  row->at(i-1)->end = row->at(i)->end;
401  delete row->at( i );
402  row->removeAt( i );
403  m_elements--;
404  }
405 
406  // Merge label with [i-1]
407  else if ( mergeHead ) {
408  row->at(i-1)->end = maxX;
409  }
410 
411  // Merge label with [i]
412  else if ( mergeTail ) {
413  row->at(i)->start = minX;
414  }
415 
416  // insert between the two
417  else {
418  row->insert( i, new LabelRun( minX, maxX) );
419  m_elements++;
420  }
421  }
422 
423  return true;
424 }
425 
426 
427 void SkyLabeler::addLabel( SkyObject *obj, SkyLabeler::label_t type )
428 {
429  bool visible = false;
430  QPointF p = m_proj->toScreen(obj, true, &visible);
431  if ( !visible || !m_proj->onScreen(p) || obj->translatedName().isEmpty() ) return;
432  labelList[ (int)type ].append( SkyLabel( p, obj ) );
433 }
434 
435 void SkyLabeler::drawQueuedLabels()
436 {
437  KStarsData* data = KStarsData::Instance();
438 
439  resetFont();
440  m_p.setPen( QColor( data->colorScheme()->colorNamed( "PNameColor" ) ) );
441  drawQueuedLabelsType( PLANET_LABEL );
442 
443  if ( labelList[ SATURN_MOON_LABEL ].size() > 0 ) {
444  shrinkFont( 2 );
445  drawQueuedLabelsType( SATURN_MOON_LABEL );
446  resetFont();
447  }
448 
449  if ( labelList[ JUPITER_MOON_LABEL ].size() > 0 ) {
450  shrinkFont( 2 );
451  drawQueuedLabelsType( JUPITER_MOON_LABEL );
452  resetFont();
453  }
454 
455  drawQueuedLabelsType( ASTEROID_LABEL );
456  drawQueuedLabelsType( COMET_LABEL );
457 
458 
459  LabelList list = labelList[ RUDE_LABEL ];
460  for ( int i = 0; i < list.size(); i ++ ) {
461  drawRudeNameLabel( list.at(i).obj, list.at(i).o );
462  }
463 
464 }
465 
466 void SkyLabeler::drawQueuedLabelsType( SkyLabeler::label_t type )
467 {
468  LabelList list = labelList[ type ];
469  for ( int i = 0; i < list.size(); i ++ ) {
470  drawNameLabel( list.at(i).obj, list.at(i).o );
471  }
472 }
473 
474 //Rude name labels don't check for collisions with other labels,
475 //these get drawn no matter what. Transient labels are rude labels.
476 //To mitigate confusion from possibly "underlapping" labels, paint a
477 //semi-transparent background.
478 void SkyLabeler::drawRudeNameLabel( SkyObject *obj, const QPointF &p )
479 {
480  QString sLabel = obj->labelString();
481  double offset = obj->labelOffset();
482  QRectF rect = m_p.fontMetrics().boundingRect( sLabel );
483  rect.moveTo( p.x()+offset, p.y()+offset );
484 
485  //Interestingly, the fontMetric boundingRect isn't where you might think...
486  //We need to tweak rect to get the BG rectangle rect2
487  QRectF rect2 = rect;
488  rect2.moveTop( rect.top() - 0.6*rect.height() );
489  rect2.setHeight( 0.8*rect.height() );
490 
491  //FIXME: Implement label background options
492  QColor color( KStarsData::Instance()->colorScheme()->colorNamed( "SkyColor" ) );
493  color.setAlpha( m_p.pen().color().alpha() ); //same transparency for the text and the background
494  m_p.fillRect( rect2, QBrush( color ) );
495  m_p.drawText( rect.topLeft(), sLabel );
496 }
497 
498 
499 //----- Diagnostic and information routines -----
500 
501 float SkyLabeler::fillRatio()
502 {
503  if ( m_size == 0 ) return 0.0;
504  return 100.0 * float(m_marks) / float(m_size);
505 }
506 
507 float SkyLabeler::hitRatio()
508 {
509  if (m_hits == 0 ) return 0.0;
510  return 100.0 * float(m_hits) / ( float(m_hits + m_misses) );
511 }
512 
513 void SkyLabeler::printInfo()
514 {
515  printf("SkyLabeler:\n");
516  printf(" fillRatio=%.1f%%\n", fillRatio() );
517  printf(" hits=%d misses=%d ratio=%.1f%%\n", m_hits, m_misses, hitRatio());
518  printf(" yScale=%.1f maxY=%d\n", m_yScale, m_maxY );
519 
520  printf(" screenRows=%d elements=%d virtualSize=%.1f Kbytes\n",
521  screenRows.size(), m_elements, float(m_size) / 1024.0 );
522 
523  return;
524 
525  static const char *labelName[NUM_LABEL_TYPES];
526 
527  labelName[ STAR_LABEL ] = "Star";
528  labelName[ ASTEROID_LABEL ] = "Asteroid";
529  labelName[ COMET_LABEL ] = "Comet";
530  labelName[ PLANET_LABEL ] = "Planet";
531  labelName[ JUPITER_MOON_LABEL ] = "Jupiter Moon";
532  labelName[ SATURN_MOON_LABEL ] = "Saturn Moon";
533  labelName[ DEEP_SKY_LABEL ] = "Deep Sky Object";
534  labelName[ CONSTEL_NAME_LABEL ] = "Constellation Name";
535 
536  for ( int i = 0; i < NUM_LABEL_TYPES; i++ ) {
537  printf(" %20ss: %d\n", labelName[ i ], labelList[ i ].size() );
538  }
539 
540  // Check for errors in the data structure
541  for (int y = 0; y <= m_maxY; y++) {
542  LabelRow* row = screenRows[y];
543  int size = row->size();
544  if ( size < 2 ) continue;
545 
546  bool error = false;
547  for (int i = 1; i < size; i++) {
548  if ( row->at(i-1)->end > row->at(i)->start ) error = true;
549  }
550  if ( ! error ) continue;
551 
552  printf("ERROR: %3d: ", y );
553  for (int i=0; i < row->size(); i++) {
554  printf("(%d, %d) ", row->at(i)->start, row->at(i)->end );
555  }
556  printf("\n");
557  }
558 }
SkyLabeler::SkyLabeler
SkyLabeler()
Definition: skylabeler.cpp:79
Projector::onScreen
bool onScreen(const QPointF &p) const
Check whether the projected point is on-screen.
Definition: projector.cpp:98
SkyLabeler::RUDE_LABEL
Definition: skylabeler.h:129
KStarsData
KStarsData is the backbone of KStars.
Definition: kstarsdata.h:66
SkyLabeler::setZoomFont
void setZoomFont()
adjusts the font in psky to be smaller if we are zoomed out.
Definition: skylabeler.cpp:56
SkyLabeler::CONSTEL_NAME_LABEL
Definition: skylabeler.h:127
SkyObject::translatedName
QString translatedName() const
Definition: skyobject.h:129
SkyLabeler::printInfo
void printInfo()
diagnostic, prints some brief statistics to the console.
Definition: skylabeler.cpp:513
KStarsData::colorScheme
ColorScheme * colorScheme()
Definition: kstarsdata.h:149
SkyLabeler::drawRudeNameLabel
void drawRudeNameLabel(SkyObject *obj, const QPointF &_p)
draw the object's name label on the map, without checking for overlap with other labels.
Definition: skylabeler.cpp:478
SkyLabeler::STAR_LABEL
Definition: skylabeler.h:120
KStarsData::Instance
static KStarsData * Instance()
Definition: kstarsdata.h:92
ColorScheme::colorNamed
QColor colorNamed(const QString &name) const
Retrieve a color by name.
Definition: colorscheme.cpp:97
SkyLabeler::fillRatio
float fillRatio()
diagnostic.
Definition: skylabeler.cpp:501
SkyLabeler::setFont
void setFont(const QFont &font)
tells the labeler the font you will be using so it can figure out the height and width of the labels...
Definition: skylabeler.cpp:167
SkyLabeler::label_t
label_t
Definition: skylabeler.h:119
SkyLabeler::getMargins
void getMargins(const QString &text, float *left, float *right, float *top, float *bot)
sets four margins for help in keeping labels entirely on the screen.
Definition: skylabeler.cpp:195
SkyLabeler::COMET_LABEL
Definition: skylabeler.h:122
SkyLabeler::SATURN_MOON_LABEL
Definition: skylabeler.h:125
SkyLabeler::JUPITER_MOON_LABEL
Definition: skylabeler.h:124
SkyLabeler::markRegion
bool markRegion(qreal left, qreal right, qreal top, qreal bot)
Works just like markText() above but for an arbitrary rectangular region bounded by top...
Definition: skylabeler.cpp:299
SkyLabeler::ZoomOffset
static double ZoomOffset()
returns the zoom dependent label offset.
Definition: skylabeler.cpp:71
SkyLabeler::Instance
static SkyLabeler * Instance()
Definition: skylabeler.cpp:49
SkyObject::labelString
virtual QString labelString() const
Definition: skyobject.cpp:470
Projector::toScreen
QPointF toScreen(const SkyPoint *o, bool oRefract=true, bool *onVisibleHemisphere=0) const
This is exactly the same as toScreenVec but it returns a QPointF.
Definition: projector.cpp:93
SkyLabeler::hitRatio
float hitRatio()
diagnostic, the number of times mark() returned true divided by the total number of times mark was ca...
Definition: skylabeler.cpp:507
SkyLabeler::useStdFont
void useStdFont()
sets the font in SkyLabeler and in psky to the font psky had originally when reset() was called...
Definition: skylabeler.cpp:185
MINZOOM
#define MINZOOM
Definition: kstarsdata.h:38
SkyLabeler::~SkyLabeler
~SkyLabeler()
Definition: skylabeler.cpp:93
SkyLabeler::reset
void reset(SkyMap *skyMap)
clears the virtual screen (if needed) and resizes the virtual screen (if needed) to match skyMap...
Definition: skylabeler.cpp:209
skymap.h
SkyLabeler::markText
bool markText(const QPointF &p, const QString &text)
tells the labeler the location and text of a label you want to draw.
Definition: skylabeler.cpp:291
SkyLabeler::DEEP_SKY_LABEL
Definition: skylabeler.h:126
SkyObject::labelOffset
virtual double labelOffset() const
Definition: skyobject.cpp:474
SkyLabeler::drawQueuedLabelsType
void drawQueuedLabelsType(SkyLabeler::label_t type)
a convenience routine that draws all the labels from a single buffer.
Definition: skylabeler.cpp:466
LabelRow
QList< LabelRun * > LabelRow
Definition: skylabeler.h:34
SkyLabeler::PLANET_LABEL
Definition: skylabeler.h:123
SkyLabel
Definition: skylabel.h:28
SkyLabeler::drawGuideLabel
bool drawGuideLabel(QPointF &o, const QString &text, double angle)
Tries to draw the text at the position and angle specified.
Definition: skylabeler.cpp:104
SkyLabeler::shrinkFont
void shrinkFont(int delta)
decreases the size of the font in psky and in the SkyLabeler by the delta points. ...
Definition: skylabeler.cpp:178
Options.h
PI
#define PI
Definition: satellite.cpp:43
Options::zoomFactor
static double zoomFactor()
Get Zoom Factor, in pixels per radian.
Definition: Options.h:2531
SkyMap
This is the canvas on which the sky is painted.
Definition: skymap.h:72
projector.h
SkyLabeler::drawQueuedLabels
void drawQueuedLabels()
draws the labels stored in all the buffers.
Definition: skylabeler.cpp:435
SkyLabeler::setPen
void setPen(const QPen &pen)
sets the pen used for drawing labels on the sky.
Definition: skylabeler.cpp:173
SkyLabeler::drawNameLabel
bool drawNameLabel(SkyObject *obj, const QPointF &_p)
Tries to draw a label for an object.
Definition: skylabeler.cpp:151
SkyLabeler::resetFont
void resetFont()
sets the font in SkyLabeler and in psky back to the zoom dependent value that was set in reset()...
Definition: skylabeler.cpp:190
kstarsdata.h
skylabeler.h
SkyLabeler::addLabel
void addLabel(SkyObject *obj, label_t type)
queues the label in the "type" buffer for later drawing.
Definition: skylabeler.cpp:427
SkyLabeler
The purpose of this class is to prevent labels from overlapping.
Definition: skylabeler.h:112
SkyLabeler::draw
void draw(QPainter &p)
Draws labels using the given painter.
Definition: skylabeler.cpp:274
SkyLabeler::ASTEROID_LABEL
Definition: skylabeler.h:121
SkyObject
Provides all necessary information about an object in the sky: its coordinates, name(s), type, magnitude, and QStringLists of URLs for images and webpages regarding the object.
Definition: skyobject.h:46
SkyMap::projector
const Projector * projector() const
Get the current projector.
Definition: skymap.h:264
SkyLabeler::NUM_LABEL_TYPES
Rude labels block other labels FIXME: find a better solution.
Definition: skylabeler.h:130
QList
LabelRun
struct LabelRun LabelRun
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