IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38465


Ignore:
Timestamp:
Jun 12, 2015, 10:28:02 PM (11 years ago)
Author:
eugene
Message:

merge changes from EAM branch ipp-20150419

Location:
trunk/Ohana/src/kapa2
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/kapa2/include/prototypes.h

    r33650 r38465  
    8383int           SetChannel          PROTO((int sock));
    8484int           SetColormapFromPipe PROTO((int sock));
     85int           SetNanColorFromPipe PROTO((int sock));
    8586
    8687int           LoadVectorData      PROTO((int sock, KapaGraphWidget *graph, int N, char *type));
  • trunk/Ohana/src/kapa2/include/structures.h

    r37807 r38465  
    3535  unsigned long *color;      // graph plotting colors
    3636  int            Ncolors;
     37  char          *colormapName;
    3738
    3839  unsigned long *pixels;      // image pixel colors
  • trunk/Ohana/src/kapa2/src/CheckPipe.c

    r36833 r38465  
    316316  }
    317317
     318  if (!strcmp (word, "CNAN")) {
     319    status = SetNanColorFromPipe (sock);
     320    KiiSendCommand (sock, 4, "DONE");
     321    FINISHED (status);
     322  }
     323
    318324  if (!strcmp (word, "SAVE")) {
    319325    status = SaveOverlay (sock);
  • trunk/Ohana/src/kapa2/src/InterpretKeys.c

    r38153 r38465  
    102102      UpdateStatusBox (graphic, image, X, Y, 0.0, 1); \
    103103      Remap (graphic, image); \
     104      Refresh (); \
    104105      break;
    105106
  • trunk/Ohana/src/kapa2/src/SetChannel.c

    r37807 r38465  
    5757    // image = section->image;
    5858    SetColorScale (graphic, section->image);
    59     if (!USE_XWINDOW) return (TRUE);
     59    if (!USE_XWINDOW) return TRUE;
    6060    Remap (graphic, section->image);
    6161  }
     
    6666  return (TRUE);
    6767}
     68
     69int SetNanColorFromPipe (int sock) {
     70
     71  int i, red_value, green_value, blue_value;
     72  KiiScanMessage (sock, "%d %d %d", &red_value, &green_value, &blue_value);
     73
     74  NAN_RED   = red_value;
     75  NAN_GREEN = green_value;
     76  NAN_BLUE  = blue_value;
     77
     78  // use graphic->colormapName saved value
     79  SetColormap (NULL);
     80
     81  if (!USE_XWINDOW) return (TRUE);
     82 
     83  Graphic *graphic = GetGraphic ();
     84
     85  int NeedRefresh = FALSE;
     86  int Nsection = GetNumberOfSections ();
     87  for (i = 0; i < Nsection; i++) {
     88    Section *section = GetSectionByNumber (i);
     89    if (section->image) {
     90      NeedRefresh = TRUE;
     91      SetColorScale (graphic, section->image);
     92      Remap (graphic, section->image);
     93    }
     94  }
     95  if (NeedRefresh) {
     96    Refresh ();
     97    XFlush (graphic[0].display);
     98  }
     99
     100  return (TRUE);
     101}
  • trunk/Ohana/src/kapa2/src/SetColormap.c

    r38153 r38465  
    1616// display of) an image, we simply remap the lit pixels (in Remap32.c, etc).
    1717
    18 int SetColormap (char *name) {
     18int SetColormap (char *inName) {
    1919
    2020  int i, red, blue, green;
     
    2424  graphic = GetGraphic();
    2525
     26  if (!inName && !graphic->colormapName) abort();
     27
     28  if (inName) {
     29    if (graphic->colormapName) free (graphic->colormapName);
     30    graphic->colormapName = strcreate (inName);
     31  }
     32
    2633  int NANValue = graphic[0].Npixels - 1;
    2734  int MaxValue = graphic[0].Npixels - 1;
     
    2936  // the "fullcolor" colormap is uniquely defined for each image;
    3037  // defer to the 'SetColorScale' step
    31   if (!strcasecmp (name, "fullcolor")) {
     38  if (!strcasecmp (graphic->colormapName, "fullcolor")) {
    3239    graphic[0].ColorScaleMode = KAPA_SCALE_3D_FULL;
    3340    if (SetColorCubeHistogram ()) return TRUE;
     
    4451
    4552  // very simple color model: evenly spaced cube
    46   if (!strcasecmp (name, "ruffcolor")) {
     53  if (!strcasecmp (graphic->colormapName, "ruffcolor")) {
    4754      graphic[0].nRed  = pow (graphic[0].Npixels, 0.333);
    4855      graphic[0].nBlue = pow (graphic[0].Npixels, 0.333);
     
    7986
    8087  /* greyscale */
    81   if ((!strcasecmp (name, "grayscale")) || (!strcasecmp (name, "greyscale"))) {
     88  if ((!strcasecmp (graphic->colormapName, "grayscale")) || (!strcasecmp (graphic->colormapName, "greyscale"))) {
    8289    for (i = 0; i < MaxValue; i++) { 
    8390      SETVALUE (graphic[0].cmap[i].red,   0xffff - i*scale, 0, 0xffff);
     
    8996  }
    9097  /* -grayscale */
    91   if ((!strcasecmp (name, "-grayscale")) || (!strcasecmp (name, "-greyscale"))) {
     98  if ((!strcasecmp (graphic->colormapName, "-grayscale")) || (!strcasecmp (graphic->colormapName, "-greyscale"))) {
    9299    for (i = 0; i < MaxValue; i++) { 
    93100      SETVALUE (graphic[0].cmap[i].red,   i*scale, 0, 0xffff);
     
    99106  }
    100107  /* heat */
    101   if (!strcasecmp (name, "Heat")) {
     108  if (!strcasecmp (graphic->colormapName, "Heat")) {
    102109    greenRef = 0.25*MaxValue*scale*2.0;
    103110    blueRef  = 0.50*MaxValue*scale*2.0;
     
    129136  }
    130137  /* rainbow */
    131   if (!strcasecmp (name, "Rainbow")) {
     138  if (!strcasecmp (graphic->colormapName, "Rainbow")) {
    132139    redRef   = 0.25*MaxValue*scale*4.0;
    133140    greenRef = 0.50*MaxValue*scale*4.0;
     
    167174  }
    168175  /* anuenue */
    169   if (!strcasecmp (name, "anuenue")) {
     176  if (!strcasecmp (graphic->colormapName, "anuenue")) {
    170177    redRef   = 0.25*MaxValue*scale*4.0; // value at 0.0
    171178    greenRef = 0.50*MaxValue*scale*4.0;
     
    207214
    208215  /* anuenue */
    209   if (!strncmp (name, "file:", 5)) {
    210     FILE *f = fopen (&name[5], "r");
     216  if (!strncmp (graphic->colormapName, "file:", 5)) {
     217    FILE *f = fopen (&graphic->colormapName[5], "r");
    211218    if (!f) {
    212       fprintf (stderr, "failed to open colormap file %s\n", &name[5]);
     219      fprintf (stderr, "failed to open colormap file %s\n", &graphic->colormapName[5]);
    213220      return FALSE;
    214221    }
  • trunk/Ohana/src/kapa2/src/SetGraphSize.c

    r34088 r38465  
    2121  double X0 = graphic[0].dx * section[0].x  + x0;
    2222  double Y0 = graphic[0].dy * section[0].y  + y0;
    23   double dX = graphic[0].dx * section[0].dx - x1;
    24   double dY = graphic[0].dy * section[0].dy - y1;
     23  double dX = MAX(graphic[0].dx * section[0].dx - x1, 1);
     24  double dY = MAX(graphic[0].dy * section[0].dy - y1, 1);
    2525
    2626  /* define locations of coordinate axes */
  • trunk/Ohana/src/kapa2/src/SetImageSize.c

    r29539 r38465  
    306306        image[0].picture.x = Xs + PAD1;
    307307        image[0].picture.y = Ys + 2*PAD1 + COLORPAD;
    308         image[0].picture.dx = dX - 3*PAD1 - 1 - ZOOM_X;
    309         image[0].picture.dy = dY - 3*PAD1 - 1 - COLORPAD;
     308        image[0].picture.dx = MAX(dX - 3*PAD1 - 1 - ZOOM_X, 1);
     309        image[0].picture.dy = MAX(dY - 3*PAD1 - 1 - COLORPAD, 1);
    310310      }
    311311
  • trunk/Ohana/src/kapa2/src/SetUpGraphic.c

    r32695 r38465  
    4242  CheckColors (graphic, argc, argv);
    4343
     44  graphic->colormapName = NULL;
     45
    4446  icon.width = icon_width;
    4547  icon.height = icon_height;
  • trunk/Ohana/src/kapa2/src/bDrawIt.c

    r33650 r38465  
    2323      section = GetSectionByNumber (i);
    2424      bDrawImage (buffer, section->image, graphic);
     25      for (i = 0; section->image && (i < NOVERLAYS); i++) {
     26        if (section->image->overlay[i].active) bDrawOverlay (buffer, section->image, i);
     27      }
    2528      bDrawGraph (buffer, section->graph);
    2629  }
Note: See TracChangeset for help on using the changeset viewer.