kstars
SkyMap Class Reference
This is the canvas on which the sky is painted. More...
#include <skymap.h>

Detailed Description
This is the canvas on which the sky is painted.It's the main widget for KStars. Contains SkyPoint members for the map's Focus (current central position), Destination (requested central position), FocusPoint (next queued position to be focused), MousePoint (position of mouse cursor), and ClickedPoint (position of last mouse click). Also contains the InfoBoxes for on-screen data display.
SkyMap handles most user interaction events (both mouse and keyboard).
Canvas widget for displaying the sky bitmap; also handles user interaction events.
- Version:
- 1.0
Definition at line 59 of file skymap.h.
Constructor & Destructor Documentation
SkyMap::SkyMap | ( | KStarsData * | d, | |
QWidget * | parent = 0 , |
|||
const char * | name = 0 | |||
) |
Constructor.
Read stored settings from KConfig object (focus position, zoom factor, sky color, etc.). Run initPopupMenus().
Definition at line 54 of file skymap.cpp.
SkyMap::~SkyMap | ( | ) |
Member Function Documentation
void SkyMap::addLink | ( | void | ) | [slot] |
Popup menu function: Add a custom Image or Information URL.
Opens the AddLinkDialog window.
Definition at line 1321 of file skymap.cpp.
SkyObject* SkyMap::clickedObject | ( | void | ) | const [inline] |
Retrieve the object nearest to a mouse click event.
If the user clicks on the sky map, a pointer to the nearest SkyObject is stored in the private member ClickedObject. This function returns the ClickedObject pointer, or NULL if there is no CLickedObject.
- Returns:
- a pointer to the object nearest to a user mouse click.
SkyPoint* SkyMap::clickedPoint | ( | ) | [inline] |
Retrieve the ClickedPoint position.
When the user clicks on a point in the sky map, the sky coordinates of the mouse cursor are stored in the private member ClickedPoint. This function retrieves a pointer to ClickedPoint.
- Returns:
- a pointer to ClickedPoint, the sky coordinates where the user clicked.
SkyPoint* SkyMap::destination | ( | ) | [inline] |
void SkyMap::destinationChanged | ( | ) | [signal] |
Emitted by setDestination(), and connected to slewFocus().
Whenever the Destination point is changed, slewFocus() will iteratively step the Focus toward Destination until it is reached.
void SkyMap::exportSkyImage | ( | const QPaintDevice * | pd | ) |
Draw the current Sky map to a pixmap which is to be printed or exported to a file.
Each of the draw functions is called, with a value for the Scale parameter computed to fit the geometry of the QPaintDevice.
- Parameters:
-
pd pointer to the QPaintDevice on which to draw.
- See also:
- KStars::slotExportImage()
KStars::slotPrint()
Definition at line 1851 of file skymapdraw.cpp.
SkyPoint* SkyMap::focus | ( | ) | [inline] |
SkyObject* SkyMap::focusObject | ( | void | ) | const [inline] |
Retrieve the object which is centered in the sky map.
If the user centers the sky map on an object (by double-clicking or using the Find Object dialog), a pointer to the "focused" object is stored in the private member FocusObject. This function returns a pointer to the FocusObject, or NULL if there is not FocusObject.
- Returns:
- a pointer to the object at the center of the sky map.
SkyPoint* SkyMap::focusPoint | ( | ) | [inline] |
retrieve the FocusPoint position.
The FocusPoint stores the position on the sky that is to be focused next. This is not exactly the same as the Destination point, because when the Destination is set, it will begin slewing immediately.
- Returns:
- a pointer to the sky point which is to be focused next.
void SkyMap::forceUpdate | ( | bool | now = false |
) | [slot] |
Recalculates the positions of objects in the sky, and then repaints the sky map.
If the positions don't need to be recalculated, use update() instead of forceUpdate(). This saves a lot of CPU time.
- Parameters:
-
now if true, paintEvent() is run immediately. Otherwise, it is added to the event queue
Definition at line 1170 of file skymap.cpp.
void SkyMap::forceUpdateNow | ( | ) | [inline, slot] |
InfoBoxes* SkyMap::infoBoxes | ( | void | ) | const [inline] |
void SkyMap::invokeKey | ( | int | key | ) |
Call keyPressEvent, as if the key given as an argument had been pressed.
Definition at line 973 of file skymap.cpp.
bool SkyMap::isAngleMode | ( | ) | const [inline] |
bool SkyMap::isObjectLabeled | ( | SkyObject * | o | ) |
- Returns:
- true if the object currently has a user label attached.
- Note:
- this function only checks for a label explicitly added to the object with the right-click popup menu; other kinds of labels are not detected by this function.
- Parameters:
-
o pointer to the sky object to be tested for a User label.
Definition at line 695 of file skymap.cpp.
void SkyMap::keyPressEvent | ( | QKeyEvent * | e | ) | [protected, virtual] |
Process keystrokes:.
- arrow keys Slew the map
- +/- keys Zoom in and out
- N/E/S/W keys Go to the cardinal points on the Horizon
- Z Go to the Zenith
- Space Toggle between Horizontal and Equatorial coordinate systems
- 0-9 Go to a major Solar System body (0=Sun; 1-9 are the major planets, except 3=Moon)
- [ Place starting point for measuring an angular distance
- ] End point for Angular Distance; display measurement.
- Escape Cancel Angular measurement
- ,/< Step backward one time step
- ./> Step forward one time step
Reimplemented from QWidget.
Definition at line 55 of file skymapevents.cpp.
void SkyMap::keyReleaseEvent | ( | QKeyEvent * | e | ) | [protected, virtual] |
When keyRelease is triggered, just set the "slewing" flag to false, and update the display (to draw objects that are hidden when slewing==true).
Reimplemented from QWidget.
Definition at line 412 of file skymapevents.cpp.
void SkyMap::linkAdded | ( | ) | [signal] |
Emitted by SkyMap::addLink().
This Signal is used to inform the Details Dialog that it needs to update its lists of URL links.
void SkyMap::mouseDoubleClickEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
Center SkyMap at double-clicked location.
Reimplemented from QWidget.
Definition at line 707 of file skymapevents.cpp.
void SkyMap::mouseMoveEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
This function does several different things depending on the state of the program:.
- If Angle-measurement mode is active, update the end-ruler point to the mouse cursor, and continue this function.
- If we are dragging an InfoBox, simply redraw the screen and return.
- If we are defining a ZoomBox, update the ZoomBox rectangle, redraw the screen, and return.
- If dragging the mouse in the map, update focus such that RA, Dec under the mouse cursor remains constant.
- If just moving the mouse, simply update the curso coordinates in the status bar.
Reimplemented from QWidget.
Definition at line 432 of file skymapevents.cpp.
SkyPoint* SkyMap::mousePoint | ( | ) | [inline] |
Retrieve a pointer to MousePoint, the sky coordinates of the mouse cursor.
When the user moves the mouse in the sky map, the sky coordinates of the mouse cursor are continually stored in MousePoint by the function mouseMoveEvent().
- Returns:
- a pointer to MousePoint, the current sky coordinates of the mouse cursor.
void SkyMap::mousePressEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
Determine RA, Dec coordinates of clicked location.
Find the SkyObject which is nearest to the clicked location.
If left-clicked: Set set mouseButtonDown==true, slewing==true; display nearest object name in status bar. If right-clicked: display popup menu appropriate for nearest object.
Reimplemented from QWidget.
Definition at line 630 of file skymapevents.cpp.
void SkyMap::mouseReleaseEvent | ( | QMouseEvent * | e | ) | [protected, virtual] |
set mouseButtonDown==false, slewing==false
Reimplemented from QWidget.
Definition at line 579 of file skymapevents.cpp.
Attempt to find a named object near the SkyPoint argument.
There is a object-type preference order for selecting among nearby objects: objects of a less-preferred type will be selected only if they are twice as close to the SkyPoint as the nearest object of a more-preferred type. The order (from most to least preferred) is: Solar System, custom object, Messier, NGC, IC, stars. If no named object was found within the zoom-dependent maximum search radius of about 4 pixels, then the function returns a NULL pointer.
- Note:
- This code used to be in mousePressEvent(), but now we need it in slotTransientLabel() and other parts of the code as well.
- Parameters:
-
p pointer to the skypoint around which to search for an object.
- Returns:
- a pointer to the nearest named object to point p, or NULL if no object was found.
Definition at line 193 of file skymap.cpp.
SkyPoint* SkyMap::oldfocus | ( | ) | [inline] |
void SkyMap::paintEvent | ( | QPaintEvent * | e | ) | [protected, virtual] |
Draw the Sky, and all objects in it.
Reimplemented from QWidget.
Definition at line 724 of file skymapevents.cpp.
SkyPoint* SkyMap::previousClickedPoint | ( | ) | [inline] |
Estimate the effect of atmospheric refraction on object positions.
Refraction affects only the Altitude angle of objects. Also, the correction should not be applied to the horizon, which is not beyond the atmosphere.
To estimate refraction, we use a simple analytic equation. To save time, we store values of the correction for 0.5-degree Altitude intervals. Individual objects are then simply assigned the nearest stored value. The precaclulated values are stored in the RefractCorr1 and RefractCorr2 arrays, and these are initialized in the SkyMap constructor.
There are two cases: the true altitude is known, and the apparent altitude is needed; or the apparent altitude is known and the true altitude is needed.
- Parameters:
-
alt The input altitude findApparent if TRUE, then alt is the true altitude, and we'll find the apparent alt.
- Returns:
- the corrected altitude, as a dms object.
Definition at line 1144 of file skymap.cpp.
void SkyMap::resizeEvent | ( | QResizeEvent * | ) | [protected, virtual] |
If the skymap will be resized, the sky must be new computed.
So this function calls explicitly new computing of the skymap. It also repositions the InfoBoxes, if they are anchored to a window edge.
Reimplemented from QWidget.
Definition at line 42 of file skymapevents.cpp.
void SkyMap::setClickedObject | ( | SkyObject * | o | ) | [inline] |
void SkyMap::setClickedPoint | ( | SkyPoint * | f | ) | [inline] |
void SkyMap::setDestination | ( | double | ra, | |
double | dec | |||
) |
sets the destination point of the sky map, using ra/dec coordinates
- Note:
- This function behaves essentially like the above function. It differs only in the data types of its arguments.
- Parameters:
-
ra the new right ascension dec the new declination
Definition at line 815 of file skymap.cpp.
sets the destination point of the skymap, using ra/dec coordinates.
- Note:
- This function behaves essentially like the above function. It differs only in the data types of its arguments.
- Parameters:
-
ra the new right ascension dec the new declination
Definition at line 809 of file skymap.cpp.
void SkyMap::setDestination | ( | SkyPoint * | f | ) |
sets the destination point of the sky map.
- Note:
- setDestination() emits the destinationChanged() SIGNAL, which triggers the SLOT function SkyMap::slewFocus(). This function iteratively steps the Focus point toward Destination, repainting the sky at each step (if Options::useAnimatedSlewing()==true).
- Parameters:
-
f a pointer to the SkyPoint the map should slew to
Definition at line 803 of file skymap.cpp.
void SkyMap::setDestinationAltAz | ( | double | alt, | |
double | az | |||
) |
sets the destination point of the sky map, using its alt/az coordinates.
- Note:
- This function behaves essentially like the above function. It differs only in the data types of its arguments.
- Parameters:
-
alt the new altitude az the new azimuth
Definition at line 828 of file skymap.cpp.
sets the destination point of the sky map, using its alt/az coordinates.
- Parameters:
-
alt the new altitude az the new azimuth
Definition at line 821 of file skymap.cpp.
void SkyMap::setFocus | ( | double | ra, | |
double | dec | |||
) |
sets the focus point of the sky map, using ra/dec coordinates
- Note:
- This function behaves essentially like the above function. It differs only in the data types of its arguments.
- Parameters:
-
ra the new right ascension dec the new declination
Definition at line 777 of file skymap.cpp.
sets the focus point of the skymap, using ra/dec coordinates
- Note:
- This function behaves essentially like the above function. It differs only in the data types of its arguments.
- Parameters:
-
ra the new right ascension dec the new declination
Definition at line 773 of file skymap.cpp.
void SkyMap::setFocus | ( | SkyPoint * | f | ) |
sets the central focus point of the sky map.
- Parameters:
-
f a pointer to the SkyPoint the map should be centered on
Definition at line 769 of file skymap.cpp.
void SkyMap::setFocusAltAz | ( | double | alt, | |
double | az | |||
) |
sets the central focus point of the sky map, using alt/az coordinates
- Note:
- This function behaves essentially like the above function. It differs only in the data types of its arguments.
- Parameters:
-
alt the new altitude az the new azimuth
Definition at line 786 of file skymap.cpp.
sets the focus point of the sky map, using its alt/az coordinates
- Parameters:
-
alt the new altitude az the new azimuth
Definition at line 782 of file skymap.cpp.
void SkyMap::setFocusObject | ( | SkyObject * | o | ) |
Set the FocusObject pointer to the argument.
- Parameters:
-
o pointer to the SkyObject to be assigned as the FocusObject
Definition at line 483 of file skymap.cpp.
void SkyMap::setFocusPoint | ( | SkyPoint * | f | ) | [inline] |
void SkyMap::setGeometry | ( | const QRect & | r | ) | [virtual, slot] |
This overloaded function is used internally to resize the Sky pixmap to match the window size.
This function behaves essentially like the above function. It differs only in the data types *of its arguments.
Reimplemented from QWidget.
Definition at line 164 of file skymap.cpp.
void SkyMap::setGeometry | ( | int | x, | |
int | y, | |||
int | w, | |||
int | h | |||
) | [virtual, slot] |
This overloaded function is used internally to resize the Sky pixmap to match the window size.
Reimplemented from QWidget.
Definition at line 158 of file skymap.cpp.
void SkyMap::setMapGeometry | ( | void | ) |
set up variables for the checkVisibility function.
checkVisibility() uses some variables to assist it in determining whether points are on-screen or not. The values of these variables do not depend on which object is being tested, so we save a lot of time by bringing the code which sets their values outside of checkVisibility() (which must be run for each and every SkyPoint). setMapGeometry() is called once in paintEvent(). The variables set by setMapGeometry are:
- isPoleVisible TRUE if a coordinate Pole is on-screen
- XMax the horizontal center-to-edge angular distance
- guideXMax a version of XMax used for guide lines (same as XMax at low zoom; 2x XMAX otherwise)
- guideFOV similar to guideXMax, but for the vertical direction.
- See also:
- SkyMap::checkVisibility()
Definition at line 1903 of file skymapdraw.cpp.
void SkyMap::setMousePoint | ( | SkyPoint | f | ) | [inline] |
Set the MousePoint to the skypoint given as an argument.
- Note:
- In this function, the argument is a SkyPoint, not a pointer to a SkyPoint. This is because setMousePoint always uses the function dXdYToRaDec() for the argument, and this function returns by value.
- Parameters:
-
f the new MousePoint (typically the output of dXdYToRaDec()).
void SkyMap::setOldFocus | ( | SkyPoint * | f | ) | [inline] |
void SkyMap::setPreviousClickedPoint | ( | SkyPoint * | f | ) | [inline] |
void SkyMap::setStarColorIntensity | ( | int | value | ) | [inline] |
Sets the color-intensity value for stars.
When using the "realistic colors" mode for stars, stars are rendered as white circles with a colored border. The "color intensity" setting modulates the relative thickness of this colored border, so it effectively adjusts the color-saturation level for star images.
void SkyMap::setStarColorMode | ( | int | mode | ) | [inline] |
void SkyMap::setTransientObject | ( | SkyObject * | o | ) | [inline] |
void SkyMap::showFocusCoords | ( | bool | coordsOnly = false |
) |
void SkyMap::slewFocus | ( | void | ) | [slot] |
Step the Focus point toward the Destination point.
Do this iteratively, redrawing the Sky Map after each step, until the Focus point is within 1 step of the Destination point. For the final step, snap directly to Destination, and redraw the map.
Definition at line 880 of file skymap.cpp.
void SkyMap::slotAddObjectLabel | ( | void | ) | [slot] |
Add ClickedObject to KStarsData::ObjLabelList, which stores pointers to SkyObjects which have User Labels attached.
Definition at line 715 of file skymap.cpp.
void SkyMap::slotAddPlanetTrail | ( | void | ) | [slot] |
Add a Planet Trail to ClickedObject.
- Note:
- Trails are added simply by calling KSPlanetBase::addToTrail() to add the first point. as long as the trail is not empty, new points will be automatically appended to it.
if ClickedObject is not a Solar System body, this function does nothing.
- See also:
- KSPlanetBase::addToTrail()
Definition at line 730 of file skymap.cpp.
void SkyMap::slotBeginAngularDistance | ( | void | ) | [slot] |
Enables the angular distance measuring mode.
It saves the first position of the ruler in a SkyPoint. It makes difference between having clicked on the skymap and not having done so
Definition at line 656 of file skymap.cpp.
void SkyMap::slotCancelAngularDistance | ( | void | ) | [slot] |
Disables the angular distance measuring mode.
Nothing is printed in the status bar
Definition at line 681 of file skymap.cpp.
void SkyMap::slotCenter | ( | void | ) | [slot] |
Center the display at the point ClickedPoint.
The essential part of the function is to simply set the Destination point, which will emit the destinationChanged() SIGNAL, which triggers the slewFocus() SLOT. Additionally, this function performs some bookkeeping tasks, such updating whether we are tracking the new object/position, adding a Planet Trail if required, etc.
- See also:
- destinationChanged()
Definition at line 492 of file skymap.cpp.
void SkyMap::slotClockSlewing | ( | ) | [slot] |
Checks whether the timestep exceeds a threshold value.
If so, sets ClockSlewing=true and sets the SimClock to ManualMode.
Definition at line 748 of file skymap.cpp.
void SkyMap::slotDetail | ( | void | ) | [slot] |
Popup menu function: Show the Detailed Information window for ClickedObject.
Definition at line 738 of file skymap.cpp.
void SkyMap::slotDSS | ( | void | ) | [slot] |
Popup menu function: Display 1st-Generation DSS image with the Image Viewer.
- Note:
- the URL is generated using the coordinates of ClickedPoint.
Definition at line 565 of file skymap.cpp.
void SkyMap::slotDSS2 | ( | void | ) | [slot] |
Popup menu function: Display 2nd-Generation DSS image with the Image Viewer.
- Note:
- the URL is generated using the coordinates of ClickedPoint.
Definition at line 606 of file skymap.cpp.
void SkyMap::slotEndAngularDistance | ( | void | ) | [slot] |
Computes the angular distance, prints the result in the status bar and disables the angular distance measuring mode If the user has clicked on the map the status bar shows the name of the clicked object plus the angular distance.
If the user did not clicked on the map, just pressed ], only the angular distance is printed
Definition at line 663 of file skymap.cpp.
void SkyMap::slotImage | ( | int | id | ) | [slot] |
Popup menu function: Show image of ClickedObject (only available for some objects).
- Parameters:
-
id the popup-menu ID entry of the selected image
Definition at line 685 of file skymap.cpp.
void SkyMap::slotInfo | ( | int | id | ) | [slot] |
Popup menu function: Show webpage about ClickedObject (only available for some objects).
- Parameters:
-
id the popup-menu ID entry of the selected information page
Definition at line 648 of file skymap.cpp.
void SkyMap::slotRemoveObjectLabel | ( | void | ) | [slot] |
Remove ClickedObject from KStarsData::ObjLabelList, which stores pointers to SkyObjects which have User Labels attached.
Definition at line 703 of file skymap.cpp.
void SkyMap::slotRemovePlanetTrail | ( | void | ) | [slot] |
Remove the PlanetTrail from ClickedObject.
- Note:
- The Trail is removed by simply calling KSPlanetBase::clearTrail(). As long as the trail is empty, no new points will be automatically appended.
- See also:
- KSPlanetBase::clearTrail()
Definition at line 722 of file skymap.cpp.
int SkyMap::starColorIntensity | ( | void | ) | const [inline] |
Retrieve the color-intensity value for stars.
When using the "realistic colors" mode for stars, stars are rendered as white circles with a colored border. The "color intensity" setting modulates the relative thickness of this colored border, so it effectively adjusts the color-saturation level for star images.
- Returns:
- the current setting of the color intensity setting for stars.
int SkyMap::starColorMode | ( | void | ) | const [inline] |
void SkyMap::stopTracking | ( | ) |
Convenience function for shutting off tracking mode.
Just calls KStars::slotTrack().
Definition at line 408 of file skymapevents.cpp.
SkyObject* SkyMap::transientObject | ( | void | ) | const [inline] |
Retrieve the object nearest to the point at which the mouse has hovered.
When the mouse hovers near an object, it is set as the TransientObject (so named because a transient name label will be attached to it). This function returns a pointer to the current TransientObject, or NULL if no TransientObject is set.
- Returns:
- pointer to the SkyObject nearest to the mouse hover position.
- See also:
- SkyMap::slotTransientLabel()
void SkyMap::updateAngleRuler | ( | ) |
void SkyMap::updateFocus | ( | ) |
void SkyMap::wheelEvent | ( | QWheelEvent * | e | ) | [protected, virtual] |
Zoom in and out with the mouse wheel.
Reimplemented from QWidget.
Definition at line 574 of file skymapevents.cpp.
The documentation for this class was generated from the following files: