Changeset 29938 for trunk/Ohana/src/kapa2/src/DefineSection.c
- Timestamp:
- Dec 5, 2010, 10:04:42 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/kapa2/src/DefineSection.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/kapa2/src/DefineSection.c
r27790 r29938 40 40 return (TRUE); 41 41 } 42 43 // define the section, but do not create a graph or image 44 int DefineSectionByImage (int sock) { 45 46 int N, bg; 47 char name[128]; 48 double x, y, dx, dy; 49 int dXm, dXp, dYm, dYp; 50 double x0, y0, x1, y1, expand; 51 Section *section; 52 Graphic *graphic; 53 KapaImageWidget *image; 54 55 KiiScanMessage (sock, "%s %lf %lf %d", name, &x, &y, &bg); 56 57 N = GetSectionByName (name); 58 section = GetSectionByNumber (N); 59 image = section->image; 60 if (!image) { 61 fprintf (stderr, "no image to define section\n"); 62 return (TRUE); 63 } 64 SetActiveSectionByNumber (N); 65 66 graphic = GetGraphic (); 67 68 GetGraphBoundary (section, &x0, &y0, &x1, &y1, &dXm, &dXp, &dYm, &dYp); 69 70 expand = 1.0; 71 if (image[0].picture.expand > 0) { 72 expand = image[0].picture.expand; 73 } 74 if (image[0].picture.expand < 0) { 75 expand = 1.0 / fabs((double)image[0].picture.expand); 76 } 77 78 // pixel dimensions of the imaging region + boundary 79 dx = image[0].image[0].matrix.Naxis[0]*expand + x1; 80 dy = image[0].image[0].matrix.Naxis[1]*expand + y1; 81 82 section[0].x = x; 83 section[0].y = y; 84 section[0].bg = bg; 85 section[0].dx = dx / graphic[0].dx; 86 section[0].dy = dy / graphic[0].dy; 87 88 // if (section[0].x != x) MoveSection = TRUE; 89 // if (section[0].y != y) MoveSection = TRUE; 90 // if (section[0].dx != dx) MoveSection = TRUE; 91 // if (section[0].dy != dy) MoveSection = TRUE; 92 93 SetSectionSizes (section); 94 Refresh (); 95 96 return (TRUE); 97 }
Note:
See TracChangeset
for help on using the changeset viewer.
