• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kstars

skymap.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           skymap.h  -  K Desktop Planetarium
00003                              -------------------
00004     begin                : Sat Feb 10 2001
00005     copyright            : (C) 2001 by Jason Harris
00006     email                : jharris@30doradus.org
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef SKYMAP_H
00019 #define SKYMAP_H
00020 
00021 #include <qtimer.h>
00022 #include <qwidget.h>
00023 
00024 #include "skypoint.h"
00025 #include "starpixmap.h"
00026 
00027 #define HOVER_INTERVAL 500 
00028 
00029 class QPainter;
00030 class QPaintDevice;
00031 class QPoint;
00032 class QPointArray;
00033 class QPixmap;
00034 
00035 class dms;
00036 class InfoBoxes;
00037 class KStars;
00038 class KStarsData;
00039 class KSPlanetBase;
00040 class KSPopupMenu;
00041 class SkyObject;
00042 class DeepSkyObject;
00043 
00059 class SkyMap : public QWidget  {
00060    Q_OBJECT
00061 public:
00066     SkyMap( KStarsData *d, QWidget *parent=0, const char *name=0);
00067 
00071     ~SkyMap();
00072 
00076     InfoBoxes* infoBoxes() const { return IBoxes; }
00077 
00080     void showFocusCoords( bool coordsOnly = false );
00081 
00084     void updateFocus();
00085 
00090     SkyPoint* focus() { return &Focus; }
00091 
00099     SkyPoint* destination() { return &Destination; }
00100 
00110     SkyPoint* focusPoint() { return &FocusPoint; }
00111 
00119     SkyPoint* oldfocus() { return &OldFocus; }
00120 
00124     void setFocus( SkyPoint *f );
00125 
00134     void setFocus( const dms &ra, const dms &dec );
00135 
00144     void setFocus(double ra, double dec);
00145 
00150     void setFocusAltAz( const dms &alt, const dms & az);
00151 
00160     void setFocusAltAz(double alt, double az);
00161 
00169     void setDestination( SkyPoint *f );
00170 
00179     void setDestination( const dms &ra, const dms &dec );
00180 
00189     void setDestination(double ra, double dec);
00190 
00195     void setDestinationAltAz( const dms &alt, const dms & az);
00196 
00205     void setDestinationAltAz(double alt, double az);
00206 
00210     void setOldFocus( SkyPoint *f ) { OldFocus.set( f->ra(), f->dec() ); }
00211 
00215     void setFocusPoint( SkyPoint *f ) { if ( f ) FocusPoint.set( f->ra(), f->dec() ); }
00216 
00224     SkyPoint* clickedPoint() { return &ClickedPoint; }
00225 
00229     void setClickedPoint( SkyPoint *f ) { ClickedPoint.set( f->ra(), f->dec() ); }
00230 
00235     SkyPoint* previousClickedPoint() { return &PreviousClickedPoint; }
00236 
00240     void setPreviousClickedPoint( SkyPoint *f ) { PreviousClickedPoint.set( f->ra(), f->dec() ); }
00241 
00248     SkyPoint* mousePoint() { return &MousePoint; }
00249 
00256     void setMousePoint( SkyPoint f ) { MousePoint.set( f.ra(), f.dec() ); }
00257 
00273     SkyObject* objectNearest( SkyPoint *p );
00274 
00282     SkyObject* clickedObject( void ) const { return ClickedObject; }
00283 
00287     void setClickedObject( SkyObject *o ) { ClickedObject = o; }
00288 
00297     SkyObject* focusObject( void ) const { return FocusObject; }
00298 
00302     void setFocusObject( SkyObject *o );
00303 
00312     SkyObject* transientObject( void ) const { return TransientObject; }
00313     
00317     void setTransientObject( SkyObject *o ) { TransientObject = o; }
00318 
00322     int starColorMode( void ) const { return starpix->mode(); }
00323 
00327     void setStarColorMode( int mode ) { starpix->setColorMode( mode ); }
00328 
00337     int starColorIntensity( void ) const { return starpix->intensity(); }
00338 
00346     void setStarColorIntensity( int value ) { starpix->setIntensity( value ); }
00347 
00362     void setMapGeometry( void );
00363 
00365     void invokeKey( int key );
00366 
00369     bool isAngleMode() const {return angularDistanceMode;}
00370 
00373     void updateAngleRuler();
00374 
00375 
00382     bool isObjectLabeled( SkyObject *o );
00383 
00386     void stopTracking();
00387 
00396     void exportSkyImage( const QPaintDevice *pd );
00397 
00398 public slots:
00401     virtual void setGeometry( int x, int y, int w, int h );
00402     
00407     virtual void setGeometry( const QRect &r );
00408 
00414     void forceUpdate( bool now=false );
00415 
00419     void forceUpdateNow() { forceUpdate( true ); }
00420 
00436     dms refract( const dms *alt, bool findApparent );
00437 
00442     void slewFocus( void );
00443 
00454     void slotCenter( void );
00455 
00459     void slotDSS( void );
00460 
00464     void slotDSS2( void );
00465 
00470     void slotInfo( int id );
00471 
00476     void slotImage( int id );
00477 
00480     void slotDetail( void );
00481 
00485     void slotAddObjectLabel( void );
00486 
00490     void slotRemoveObjectLabel( void );
00491 
00498     void slotAddPlanetTrail( void );
00499     
00505     void slotRemovePlanetTrail( void );
00506 
00510     void addLink( void );
00511 
00515     void slotClockSlewing();
00516 
00520     void slotBeginAngularDistance(void);
00521 
00528     void slotEndAngularDistance(void);
00529 
00532     void slotCancelAngularDistance(void);
00533 
00534 signals:
00541     void destinationChanged();
00542     
00546     void linkAdded();
00547 
00548 protected:
00550     virtual void paintEvent( QPaintEvent *e );
00551 
00565     virtual void keyPressEvent( QKeyEvent *e );
00566 
00569     virtual void keyReleaseEvent( QKeyEvent *e );
00570 
00578     virtual void mousePressEvent( QMouseEvent *e );
00579 
00581     virtual void mouseReleaseEvent( QMouseEvent *e );
00582 
00584     virtual void mouseDoubleClickEvent( QMouseEvent *e );
00585 
00596     virtual void mouseMoveEvent( QMouseEvent *e );
00597 
00599     virtual void wheelEvent( QWheelEvent *e );
00600 
00605     virtual void resizeEvent( QResizeEvent * );
00606 
00607 private slots:
00612     void slotTransientTimeout();
00613 
00623     void slotTransientLabel();
00624 
00626     void setMouseMoveCursor();
00627 
00628 private:
00629 // Drawing functions.  Each takes a QPainter reference and a scaling factor as arguments.
00630 // The QPainter is usually the Sky pixmap, but it can also be the Export-to-Image pixmap, or the 
00631 // Printer device.  The scaling factors are 1.0 by default (for screen images).  The scale factor
00632 // is used to resize the image to fit the page when printing or exporting to a file.
00633 
00638     void drawMilkyWay( QPainter& psky, double scale = 1.0 );
00639     
00644     void drawCoordinateGrid( QPainter& psky, double scale = 1.0 );
00645     
00650     void drawEquator( QPainter& psky, double scale = 1.0 );
00651     
00656     void drawEcliptic( QPainter& psky, double scale = 1.0 );
00657     
00663     void drawHorizon( QPainter& psky, double scale = 1.0 );
00668     void drawConstellationLines( QPainter& psky, double scale = 1.0 );
00669     
00674     void drawConstellationBoundaries( QPainter& psky, double scale = 1.0 );
00675     
00680     void drawConstellationNames( QPainter& psky, double scale = 1.0 );
00681     
00686     void drawStars( QPainter& psky, double scale = 1.0 );
00687     
00695     void drawDeepSkyObjects( QPainter& psky, double scale = 1.0 );
00696     
00705     void drawDeepSkyCatalog( QPainter& psky, QPtrList<DeepSkyObject>& catalog, QColor& color, bool drawObject, bool drawImage, double scale = 1.0 );
00706     
00715     void drawPlanetTrail( QPainter& psky, KSPlanetBase *ksp, double scale = 1.0 );
00716     
00722     void drawSolarSystem( QPainter& psky, bool drawPlanets, double scale = 1.0 );
00723     
00730     void drawAttachedLabels( QPainter &psky, double scale = 1.0 );
00731     
00742     void drawNameLabel( QPainter &psky, SkyObject *obj, int x, int y, double scale );
00743 
00757     void drawPlanet(QPainter &psky, KSPlanetBase *p, QColor c,
00758             double zoommin, int resize_mult = 1, double scale = 1.0 );
00759     
00769     void drawOverlays( QPixmap *pm );
00770     
00776     void drawBoxes( QPainter &p );
00777     
00783     void drawTelescopeSymbols(QPainter &psky);
00784     
00789     void drawObservingList( QPainter &psky, double scale = 1.0 );
00790 
00795     void drawZoomBox( QPainter &psky);
00796     
00803     void drawTransientLabel( QPainter &psky );
00804 
00810     void drawAngleRuler( QPainter &psky );
00811 
00812 
00821     QPoint getXY( SkyPoint *o, bool Horiz, bool doRefraction=true, double scale = 1.0 );
00822 
00832     SkyPoint dXdYToRaDec( double dx, double dy, bool Horiz, dms *LST, const dms *lat, bool doRefraction=true );
00833 
00838     float fov();
00839 
00879     bool checkVisibility( SkyPoint *p, float fov, double XMax );
00880 
00892     void fadeTransientLabel() { TransientTimer.start( TransientTimeout ); }
00893 
00901     double findPA( SkyObject *o, int x, int y, double scale=1.0 );
00902 
00905     void setDefaultMouseCursor();
00906 
00909     void setZoomMouseCursor();
00910 
00917     bool unusablePoint (double dx, double dy);
00918 
00919     bool mouseButtonDown, midMouseButtonDown;
00920     bool mouseMoveCursor;  // true if mouseMoveEvent; needed by setMouseMoveCursor
00921     bool slewing, clockSlewing;
00922     bool computeSkymap;  //if false only old pixmap will repainted with bitBlt(), this saves a lot of cpu usage
00923     bool angularDistanceMode;
00924     int idSolInfo, idMessHST, idMoonInfo, idMoonImages, idMessInfo, idNGCHST;
00925     int scrollCount;
00926     double Range;
00927     double RefractCorr1[184], RefractCorr2[184];
00928     double y0;
00929 
00930     //data for checkVisibility
00931     bool isPoleVisible;
00932     int guidemax;
00933     float guideFOV;
00934     double XRange, Ymax;
00935     double guideXRange;
00936 
00937     QString sURL;
00938     
00939     KStars *ksw;
00940     KStarsData *data;
00941     KSPopupMenu *pmenu;
00942     QPixmap *sky, *sky2;
00943     InfoBoxes  *IBoxes;
00944     SkyPoint  Focus, OldFocus, ClickedPoint, FocusPoint, MousePoint, Destination, PreviousClickedPoint;
00945     SkyObject *ClickedObject, *FocusObject, *TransientObject;
00946     StarPixmap *starpix;    // the pixmap of the stars
00947 
00948     QPointArray *pts;   // needed in paintEvent() so it should not every event call reallocated (save time)
00949     SkyPoint *sp;           // see line above
00950 
00951     QPoint beginRulerPoint, endRulerPoint;  // used in angle mode
00952     QRect ZoomRect; //The manual-focus circle.
00953 
00954     //data for transient object labels
00955     QTimer TransientTimer, HoverTimer;
00956     QColor TransientColor;
00957     unsigned int TransientTimeout;
00958 };
00959 
00960 #endif

kstars

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

API Reference

Skip menu "API Reference"
  • keduca
  • kstars
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal