mirror of
https://github.com/eddyem/apogee_control.git
synced 2026-02-01 04:45:06 +03:00
fix bug with relative coordinates shown in preview window
This commit is contained in:
parent
c601c6ac10
commit
f5ba8ad63e
@ -78,7 +78,8 @@ if(NOT DEFINED NOIMAGEVIEW)
|
||||
endif()
|
||||
if(IMAGEVIEW_FOUND)
|
||||
message("Found OpenGL. Will use ${IMLIB} to show data")
|
||||
target_link_libraries(${PROJ} ${${PROJ}_LIBRARIES} -lm ${IMLIB})
|
||||
find_package(X11 REQUIRED)
|
||||
target_link_libraries(${PROJ} ${X11_LIBRARIES} ${${PROJ}_LIBRARIES} -lm ${IMLIB})
|
||||
add_definitions(-DIMAGEVIEW)
|
||||
else()
|
||||
message("Will compile without image view module")
|
||||
|
||||
@ -93,12 +93,14 @@ static char buf[1024];
|
||||
char *time_asc(double t){
|
||||
int h, m;
|
||||
double s;
|
||||
char *str = "";
|
||||
h = (int)(t/3600.);
|
||||
if(t < 0.){ t = -t; str = "-";}
|
||||
m = (int)((t - (double)h*3600.)/60.);
|
||||
s = t - (double)h*3600. - (double)m*60.;
|
||||
h %= 24;
|
||||
if(s>59) s=59;
|
||||
sprintf(buf, "%dh:%02dm:%04.1fs", h,m,s);
|
||||
sprintf(buf, "%s%dh:%02dm:%04.1fs", str, h,m,s);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
@ -440,6 +440,8 @@ void calc_coords(float x, float y, double *alpha, double *delta){
|
||||
if(!wcs_rdy){*alpha = 5e6; *delta = 5e6; return; }
|
||||
ra = crval1 + dx * CD[0][0] + dy * CD[0][1];
|
||||
dec = crval2 + dx * CD[1][0] + dy * CD[1][1];
|
||||
DBG("ra=%g, dec=%g", ra,dec);
|
||||
if(alpha) *alpha = ra * 3600.; // hrsec
|
||||
if(delta) *delta = dec * 3600.; // arcsec
|
||||
DBG("ra=%g, dec=%g", *alpha, *delta);
|
||||
}
|
||||
|
||||
@ -29,8 +29,9 @@ aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} IMSOURCES)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(OpenGL)
|
||||
find_package(GLUT)
|
||||
find_package(X11)
|
||||
|
||||
if(NOT GLUT_FOUND OR NOT OPENGL_FOUND)
|
||||
if(NOT GLUT_FOUND OR NOT OPENGL_FOUND OR NOT X11_FOUND)
|
||||
message("GLUT library not found, image view won't be available")
|
||||
else()
|
||||
# exe file
|
||||
@ -145,6 +146,6 @@ endif(NOT DEFINED STANDALONE)
|
||||
target_link_libraries(${IMLIB} ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} -lm -lpthread)
|
||||
include_directories(${${IMLIB}_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR} ..)
|
||||
link_directories(${${IMLIB}_LIBRARY_DIRS})
|
||||
endif(NOT GLUT_FOUND OR NOT OPENGL_FOUND)
|
||||
endif(NOT GLUT_FOUND OR NOT OPENGL_FOUND OR NOT X11_FOUND)
|
||||
|
||||
|
||||
|
||||
@ -94,7 +94,10 @@ void mousePressed(_U_ int key, _U_ int state, _U_ int x, _U_ int y){
|
||||
if(RA > 4e6){
|
||||
printf("\n");
|
||||
WARNX(_("Give WCS parameters, at least ROT0, CRPIX1 and CRPIX2"));
|
||||
}else printf(", ra = %s, dec=%s\n", angle_asc(RA), time_asc(D));
|
||||
}else{
|
||||
printf(", ra = %s", angle_asc(RA));
|
||||
printf(", dec=%s\n", time_asc(D));
|
||||
}
|
||||
if(key == GLUT_MIDDLE_BUTTON) movingwin = 1;
|
||||
if(key == 3){ // wheel UP
|
||||
if(mod == 0) win->y += 10.*win->zoom; // nothing pressed - scroll up
|
||||
|
||||
@ -196,7 +196,7 @@ void check4running(){
|
||||
file = open(path, O_RDONLY);
|
||||
if(file == -1) return 0;
|
||||
do{
|
||||
read(file, &byte, 1);
|
||||
if(read(file, &byte, 1) != 1) break;
|
||||
if (byte != '/') *pp++ = byte;
|
||||
else pp = name;
|
||||
}
|
||||
@ -218,13 +218,14 @@ void check4running(){
|
||||
self = getpid(); // self PID
|
||||
if(stat(pidfilename, &s_buf) == 0){ // PID file exists
|
||||
pidfile = fopen(pidfilename, "r");
|
||||
fscanf(pidfile, "%d", &run); // get PID of (possibly) running process
|
||||
fclose(pidfile);
|
||||
if(readname(name, run) && strncmp(name, myname, 255) == 0){
|
||||
if(1 == fscanf(pidfile, "%d", &run)){ // get PID of (possibly) running process
|
||||
if(readname(name, run) && strncmp(name, myname, 255) == 0){
|
||||
// "ïÂÎÁÒÕÖÅÎ ÒÁÂÏÔÁÀÝÉÊ ÐÒÏÃÅÓÓ (pid=%d), ×ÙÈÏÄ.\n"
|
||||
ERR(_("\nFound running process (pid=%d), exit.\n"), run);
|
||||
exit(7);
|
||||
}
|
||||
}
|
||||
fclose(pidfile);
|
||||
}
|
||||
// there's no PID file or it's old
|
||||
readname(myname, self); // self name
|
||||
|
||||
2
usage.c
2
usage.c
@ -248,7 +248,7 @@ void usage(char *fmt, ...){
|
||||
// "выбрать диапазон для считывания"
|
||||
_("select clip region"));
|
||||
// ONLY LONG
|
||||
printf("\t\t--fakeimg\t\t\t%s\n",
|
||||
printf("\t\t--fakeimg\t\t%s\n",
|
||||
// "Тест окна OpenGL без получения изображения"
|
||||
_("Test OpenGL window (without image exposure)"));
|
||||
printf("\t\t--flipX\t\t\t%s\n",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user