IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 19, 2014, 2:57:33 PM (12 years ago)
Author:
eugene
Message:

do not fail if the EQUINOX or EPOCH are not numeric; if there is no active graph, use the image for pixel coords

Location:
branches/eam_branches/ps2-tc3-20130727/Ohana/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ps2-tc3-20130727/Ohana/src/kapa2/src/InterpretKeys.c

    r25757 r37401  
    5050    Z = -1;
    5151
    52     if (graph) {
     52    int haveGraph = graph && graph->haveGraph;
     53    if (haveGraph) {
    5354      X = (event[0].x - graph[0].axis[0].fx)*(graph[0].axis[0].max - graph[0].axis[0].min)/graph[0].axis[0].dfx + graph[0].axis[0].min;
    5455      Y = (event[0].y - graph[0].axis[1].fy)*(graph[0].axis[1].max - graph[0].axis[1].min)/graph[0].axis[1].dfy + graph[0].axis[1].min;
    5556      XY_to_RD (&R, &D, X, Y, &graph[0].data.coords);
    5657    }
    57     if (image && !graph) {
     58    if (image && !haveGraph) {
    5859      if (event[0].x < image[0].picture.x) goto skip_cursor;
    5960      if (event[0].y < image[0].picture.y) goto skip_cursor;
  • branches/eam_branches/ps2-tc3-20130727/Ohana/src/libdvo/src/coordops.c

    r36680 r37401  
    595595
    596596  if (status) {
    597     if (!gfits_scan (header, "EQUINOX", "%lf", 1, &equinox)) {
    598       if (!gfits_scan (header, "EPOCH", "%lf", 1, &equinox)) {
    599         equinox = 2000.0;
     597    char equinoxString[80];
     598    int haveEquinox = gfits_scan (header, "EQUINOX", "%s", 1, equinoxString);
     599    if (haveEquinox) {
     600      // is the string a valid number (it is bad to interpret an error message as year 0.0)
     601      char *endptr;
     602      equinox = strtod (equinoxString, &endptr);
     603      if (endptr == equinoxString) haveEquinox = FALSE;
     604    }
     605    if (!haveEquinox) {
     606      haveEquinox = gfits_scan (header, "EPOCH", "%s", 1, equinoxString);
     607      if (haveEquinox) {
     608        // is the string a valid number (it is bad to interpret an error message as year 0.0)
     609        char *endptr;
     610        equinox = strtod (equinoxString, &endptr);
     611        if (endptr == equinoxString) haveEquinox = FALSE;
    600612      }
     613    }
     614    if (!haveEquinox) {
     615      equinox = 2000.0;
    601616    }
    602617    if (fabs (equinox - 2000.0) > 0.1) {
Note: See TracChangeset for help on using the changeset viewer.