Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
KStars
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
31
Issues
31
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Education
KStars
Commits
e1ecb213
Commit
e1ecb213
authored
Oct 30, 2016
by
Jasem Mutlaq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix manual focus dialog calculating wrong sky point based on bogus epoch
parent
cd598e8a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
44 deletions
+65
-44
kstars/dialogs/focusdialog.cpp
kstars/dialogs/focusdialog.cpp
+23
-15
kstars/dialogs/focusdialog.h
kstars/dialogs/focusdialog.h
+3
-4
kstars/kstarsactions.cpp
kstars/kstarsactions.cpp
+28
-21
kstars/time/kstarsdatetime.cpp
kstars/time/kstarsdatetime.cpp
+11
-4
No files found.
kstars/dialogs/focusdialog.cpp
View file @
e1ecb213
...
...
@@ -32,14 +32,14 @@ FocusDialogUI::FocusDialogUI( QWidget *parent ) : QFrame( parent ) {
setupUi
(
this
);
}
FocusDialog
::
FocusDialog
(
KStars
*
_ks
)
:
QDialog
(
_ks
),
ks
(
_ks
)
FocusDialog
::
FocusDialog
()
:
QDialog
(
KStars
::
Instance
()
)
{
#ifdef Q_OS_OSX
setWindowFlags
(
Qt
::
Tool
|
Qt
::
WindowStaysOnTopHint
);
#endif
//initialize point to the current focus position
Point
=
*
ks
->
map
()
->
focus
();
Point
=
SkyMap
::
Instance
()
->
focus
();
UsedAltAz
=
false
;
//assume RA/Dec by default
...
...
@@ -75,26 +75,33 @@ FocusDialog::FocusDialog( KStars *_ks )
FocusDialog
::~
FocusDialog
(){
}
void
FocusDialog
::
checkLineEdits
()
{
void
FocusDialog
::
checkLineEdits
()
{
bool
raOk
(
false
),
decOk
(
false
),
azOk
(
false
),
altOk
(
false
);
fd
->
raBox
->
createDms
(
false
,
&
raOk
);
fd
->
decBox
->
createDms
(
true
,
&
decOk
);
fd
->
azBox
->
createDms
(
true
,
&
azOk
);
fd
->
altBox
->
createDms
(
true
,
&
altOk
);
if
(
(
raOk
&&
decOk
)
||
(
azOk
&&
altOk
)
)
okB
->
setEnabled
(
true
);
okB
->
setEnabled
(
true
);
else
okB
->
setEnabled
(
false
);
}
void
FocusDialog
::
validatePoint
()
{
void
FocusDialog
::
validatePoint
()
{
bool
raOk
(
false
),
decOk
(
false
),
azOk
(
false
),
altOk
(
false
);
dms
ra
(
fd
->
raBox
->
createDms
(
false
,
&
raOk
)
);
//false means expressed in hours
//false means expressed in hours
dms
ra
(
fd
->
raBox
->
createDms
(
false
,
&
raOk
)
);
dms
dec
(
fd
->
decBox
->
createDms
(
true
,
&
decOk
)
);
QString
message
;
if
(
raOk
&&
decOk
)
{
if
(
raOk
&&
decOk
)
{
//make sure values are in valid range
if
(
ra
.
Hours
()
<
0.0
||
ra
.
Hours
()
>
24.0
)
message
=
i18n
(
"The Right Ascension value must be between 0.0 and 24.0."
);
...
...
@@ -105,12 +112,13 @@ void FocusDialog::validatePoint() {
return
;
}
Point
.
set
(
ra
,
dec
);
bool
ok
;
// Ignored. FIXME: Make a version of KStarsDateTime::stringToEpoch that doesn't mandate the ok arg
Point
->
set
(
ra
,
dec
);
bool
ok
;
double
epoch0
=
KStarsDateTime
::
stringToEpoch
(
fd
->
epochBox
->
text
(),
ok
);
long
double
jd0
=
KStarsDateTime
::
epochToJd
(
epoch0
);
Point
.
apparentCoord
(
jd0
,
ks
->
data
()
->
ut
().
djd
()
);
Point
.
EquatorialToHorizontal
(
ks
->
data
()
->
lst
(),
ks
->
data
()
->
geo
()
->
lat
()
);
Point
->
apparentCoord
(
jd0
,
KStarsData
::
Instance
()
->
ut
().
djd
()
);
Point
->
EquatorialToHorizontal
(
KStarsData
::
Instance
()
->
lst
(),
KStarsData
::
Instance
()
->
geo
()
->
lat
()
);
QDialog
::
accept
();
}
else
{
...
...
@@ -128,9 +136,9 @@ void FocusDialog::validatePoint() {
return
;
}
Point
.
setAz
(
az
);
Point
.
setAlt
(
alt
);
Point
.
HorizontalToEquatorial
(
ks
->
data
()
->
lst
(),
ks
->
data
()
->
geo
()
->
lat
()
);
Point
->
setAz
(
az
);
Point
->
setAlt
(
alt
);
Point
->
HorizontalToEquatorial
(
KStarsData
::
Instance
()
->
lst
(),
KStarsData
::
Instance
()
->
geo
()
->
lat
()
);
UsedAltAz
=
true
;
...
...
kstars/dialogs/focusdialog.h
View file @
e1ecb213
...
...
@@ -41,13 +41,13 @@ class FocusDialog : public QDialog {
Q_OBJECT
public:
/**Constructor. */
explicit
FocusDialog
(
KStars
*
_ks
);
explicit
FocusDialog
();
/**Destructor (empty). */
~
FocusDialog
();
/** @return pointer to the SkyPoint described by the entered RA, Dec */
inline
SkyPoint
&
point
()
{
return
Point
;
}
inline
SkyPoint
*
point
()
{
return
Point
;
}
/** @return suggested size of focus window. */
QSize
sizeHint
()
const
;
...
...
@@ -70,8 +70,7 @@ public slots:
void
validatePoint
();
private:
KStars
*
ks
;
SkyPoint
Point
;
SkyPoint
*
Point
;
FocusDialogUI
*
fd
;
bool
UsedAltAz
;
QPushButton
*
okB
;
...
...
kstars/kstarsactions.cpp
View file @
e1ecb213
...
...
@@ -1123,29 +1123,31 @@ void KStars::slotTrack() {
}
void
KStars
::
slotManualFocus
()
{
QPointer
<
FocusDialog
>
focusDialog
=
new
FocusDialog
(
this
);
// = new FocusDialog( this
);
QPointer
<
FocusDialog
>
focusDialog
=
new
FocusDialog
();
if
(
Options
::
useAltAz
()
)
focusDialog
->
activateAzAltPage
();
if
(
focusDialog
->
exec
()
==
QDialog
::
Accepted
)
{
//DEBUG
qDebug
()
<<
"focusDialog point: "
<<
&
focusDialog
;
if
(
focusDialog
->
exec
()
==
QDialog
::
Accepted
)
{
//If the requested position is very near the pole, we need to point first
//to an intermediate location just below the pole in order to get the longitudinal
//position (RA/Az) right.
double
realAlt
(
focusDialog
->
point
().
alt
().
Degrees
()
);
double
realDec
(
focusDialog
->
point
().
dec
().
Degrees
()
);
if
(
Options
::
useAltAz
()
&&
realAlt
>
89.0
)
{
focusDialog
->
point
().
setAlt
(
89.0
);
focusDialog
->
point
().
HorizontalToEquatorial
(
data
()
->
lst
(),
data
()
->
geo
()
->
lat
()
);
double
realAlt
(
focusDialog
->
point
()
->
alt
().
Degrees
()
);
double
realDec
(
focusDialog
->
point
()
->
dec
().
Degrees
()
);
if
(
Options
::
useAltAz
()
&&
realAlt
>
89.0
)
{
focusDialog
->
point
()
->
setAlt
(
89.0
);
focusDialog
->
point
()
->
HorizontalToEquatorial
(
data
()
->
lst
(),
data
()
->
geo
()
->
lat
()
);
}
if
(
!
Options
::
useAltAz
()
&&
realDec
>
89.0
)
{
focusDialog
->
point
().
setDec
(
89.0
);
focusDialog
->
point
().
EquatorialToHorizontal
(
data
()
->
lst
(),
data
()
->
geo
()
->
lat
()
);
if
(
!
Options
::
useAltAz
()
&&
realDec
>
89.0
)
{
focusDialog
->
point
()
->
setDec
(
89.0
);
focusDialog
->
point
()
->
EquatorialToHorizontal
(
data
()
->
lst
(),
data
()
->
geo
()
->
lat
()
);
}
map
()
->
setClickedPoint
(
&
focusDialog
->
point
()
);
if
(
Options
::
isTracking
()
)
slotTrack
();
map
()
->
setClickedPoint
(
focusDialog
->
point
()
);
if
(
Options
::
isTracking
()
)
slotTrack
();
map
()
->
slotCenter
();
...
...
@@ -1157,15 +1159,20 @@ void KStars::slotManualFocus() {
//Also, if the requested position was within 1 degree of the coordinate pole, this will
//automatically correct the final pointing from the intermediate offset position to the final position
data
()
->
setSnapNextFocus
();
if
(
Options
::
useAltAz
()
)
{
map
()
->
setDestinationAltAz
(
focusDialog
->
point
().
alt
(),
focusDialog
->
point
().
az
()
);
}
else
{
map
()
->
setDestination
(
focusDialog
->
point
().
ra
(),
focusDialog
->
point
().
dec
()
);
if
(
Options
::
useAltAz
()
)
{
map
()
->
setDestinationAltAz
(
focusDialog
->
point
()
->
alt
(),
focusDialog
->
point
()
->
az
()
);
}
else
{
map
()
->
setDestination
(
focusDialog
->
point
()
->
ra
(),
focusDialog
->
point
()
->
dec
()
);
}
//Now, if the requested point was near a pole, we need to reset the Alt/Dec of the focus.
if
(
Options
::
useAltAz
()
&&
realAlt
>
89.0
)
map
()
->
focus
()
->
setAlt
(
realAlt
);
if
(
!
Options
::
useAltAz
()
&&
realDec
>
89.0
)
map
()
->
focus
()
->
setDec
(
realAlt
);
if
(
Options
::
useAltAz
()
&&
realAlt
>
89.0
)
map
()
->
focus
()
->
setAlt
(
realAlt
);
if
(
!
Options
::
useAltAz
()
&&
realDec
>
89.0
)
map
()
->
focus
()
->
setDec
(
realAlt
);
//Don't track if we set Alt/Az coordinates. This way, Alt/Az remain constant.
if
(
focusDialog
->
usedAltAz
()
)
...
...
kstars/time/kstarsdatetime.cpp
View file @
e1ecb213
...
...
@@ -263,17 +263,24 @@ double KStarsDateTime::jdToEpoch(long double jd, KStarsDateTime::EpochType type)
}
double
KStarsDateTime
::
stringToEpoch
(
const
QString
&
eName
,
bool
&
ok
)
{
double
epoch
;
double
KStarsDateTime
::
stringToEpoch
(
const
QString
&
eName
,
bool
&
ok
)
{
double
epoch
=
J2000
;
ok
=
false
;
if
(
eName
.
isEmpty
()
)
// By default, assume J2000
return
J2000
;
return
epoch
;
if
(
eName
.
startsWith
(
'J'
)
)
epoch
=
eName
.
mid
(
1
).
toDouble
(
&
ok
);
else
if
(
eName
.
startsWith
(
'B'
)
)
{
else
if
(
eName
.
startsWith
(
'B'
)
)
{
epoch
=
eName
.
mid
(
1
).
toDouble
(
&
ok
);
epoch
=
jdToEpoch
(
epochToJd
(
epoch
,
BESSELIAN
),
JULIAN
);
// Convert Besselian epoch to Julian epoch
}
// Assume it's Julian
else
epoch
=
eName
.
toDouble
(
&
ok
);
return
epoch
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment