Changeset 13432
- Timestamp:
- May 18, 2007, 7:24:04 AM (19 years ago)
- Location:
- branches/kapa-mods-2007-05/Ohana/src
- Files:
-
- 2 added
- 48 edited
-
kapa2/Makefile (modified) (2 diffs)
-
kapa2/include/prototypes.h (modified) (1 diff)
-
kapa2/include/structures.h (modified) (2 diffs)
-
kapa2/src/CSaveOverlay.c (modified) (3 diffs)
-
kapa2/src/CheckPipe.c (modified) (3 diffs)
-
kapa2/src/EraseOverlay.c (modified) (1 diff)
-
kapa2/src/Image.c (modified) (2 diffs)
-
kapa2/src/LoadObject.c (modified) (6 diffs)
-
kapa2/src/LoadOverlay.c (modified) (3 diffs)
-
kapa2/src/LoadTickmarks.c (modified) (2 diffs)
-
kapa2/src/PSOverlay.c (modified) (1 diff)
-
kapa2/src/PaintOverlay.c (modified) (1 diff)
-
kapa2/src/PaintTickmarks.c (modified) (1 diff)
-
kapa2/src/SaveOverlay.c (modified) (3 diffs)
-
kapa2/src/Sections.c (modified) (2 diffs)
-
kapa2/src/SetGraphStyle.c (added)
-
kapa2/src/SetImageSize.c (modified) (1 diff)
-
kapa2/src/SetToolbox.c (added)
-
kapa2/src/bDrawOverlay.c (modified) (2 diffs)
-
libkapa/include/kapa.h (modified) (2 diffs)
-
libkapa/src/KapaWindow.c (modified) (4 diffs)
-
libkapa/src/KiiOverlay.c (modified) (2 diffs)
-
opihi/cmd.astro/cgrid.c (modified) (3 diffs)
-
opihi/cmd.astro/cplot.c (modified) (3 diffs)
-
opihi/cmd.astro/czplot.c (modified) (4 diffs)
-
opihi/cmd.astro/region.c (modified) (1 diff)
-
opihi/cmd.data/dot.c (modified) (2 diffs)
-
opihi/cmd.data/grid.c (modified) (2 diffs)
-
opihi/cmd.data/line.c (modified) (2 diffs)
-
opihi/cmd.data/plot.c (modified) (3 diffs)
-
opihi/cmd.data/section.c (modified) (4 diffs)
-
opihi/cmd.data/style.c (modified) (2 diffs)
-
opihi/cmd.data/zplot.c (modified) (3 diffs)
-
opihi/dvo/dmt.c (modified) (2 diffs)
-
opihi/dvo/images.c (modified) (4 diffs)
-
opihi/dvo/imbox.c (modified) (3 diffs)
-
opihi/dvo/imdense.c (modified) (3 diffs)
-
opihi/dvo/imstats.c (modified) (3 diffs)
-
opihi/dvo/lcurve.c (modified) (1 diff)
-
opihi/dvo/paverage.c (modified) (5 diffs)
-
opihi/dvo/pcat.c (modified) (3 diffs)
-
opihi/dvo/pmeasure.c (modified) (5 diffs)
-
opihi/dvo/procks.c (modified) (4 diffs)
-
opihi/dvo/showtile.c (modified) (3 diffs)
-
opihi/dvo/simage.c (modified) (2 diffs)
-
opihi/dvo/skycat.c (modified) (4 diffs)
-
opihi/include/display.h (modified) (2 diffs)
-
opihi/lib.data/PlotVectors.c (modified) (1 diff)
-
opihi/lib.data/graphtools.c (modified) (2 diffs)
-
opihi/lib.data/open_kapa.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/kapa-mods-2007-05/Ohana/src/kapa2/Makefile
r13405 r13432 49 49 $(SRC)/Graphs.$(ARCH).o $(SRC)/SetGraphSize.$(ARCH).o \ 50 50 $(SRC)/Resize.$(ARCH).o $(SRC)/ErasePlots.$(ARCH).o \ 51 $(SRC)/EraseImage.$(ARCH).o \51 $(SRC)/EraseImage.$(ARCH).o $(SRC)/SetToolbox.$(ARCH).o \ 52 52 $(SRC)/EraseCurrentPlot.$(ARCH).o $(SRC)/EraseSections.$(ARCH).o \ 53 53 $(SRC)/SetSection.$(ARCH).o $(SRC)/DefineSection.$(ARCH).o \ … … 65 65 $(SRC)/CreatePicture.$(ARCH).o $(SRC)/CreateColorbar.$(ARCH).o \ 66 66 $(SRC)/MakeColormap.$(ARCH).o $(SRC)/SetColormap.$(ARCH).o \ 67 $(SRC)/PaintOverlay.$(ARCH).o $(SRC)/ PaintTickmarks.$(ARCH).o\67 $(SRC)/PaintOverlay.$(ARCH).o $(SRC)/SetGraphStyle.$(ARCH).o \ 68 68 $(SRC)/LoadOverlay.$(ARCH).o $(SRC)/EraseOverlay.$(ARCH).o \ 69 $(SRC)/ LoadTickmarks.$(ARCH).o $(SRC)/SaveOverlay.$(ARCH).o \69 $(SRC)/SaveOverlay.$(ARCH).o \ 70 70 $(SRC)/CSaveOverlay.$(ARCH).o $(SRC)/EraseOverlay.$(ARCH).o \ 71 71 $(SRC)/CheckVisual.$(ARCH).o $(SRC)/CursorOps.$(ARCH).o \ -
branches/kapa-mods-2007-05/Ohana/src/kapa2/include/prototypes.h
r13404 r13432 63 63 int EraseSections PROTO((void)); 64 64 int EraseImage PROTO((void)); 65 int SetGraphStyle PROTO((int sock)); 66 int GetGraphStyle PROTO((int sock)); 65 67 66 68 int LoadVectorData PROTO((int sock, KapaGraphWidget *graph, int N, char *type)); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/include/structures.h
r13401 r13432 95 95 int Nobjects; 96 96 unsigned long color; 97 Object*objects;97 KiiOverlay *objects; 98 98 } Overlay; 99 99 … … 116 116 Axis axis[4]; /* coordinate axes */ 117 117 Label label[8]; /* fixed axis labels */ 118 Graphdata style; /* current graph style */ 118 119 119 120 Gobjects *objects; /* graphic objects */ -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CSaveOverlay.c
r13344 r13432 3 3 int CSaveOverlay (int sock) { 4 4 5 char filename[256] ;5 char filename[256], *type; 6 6 int i, N; 7 7 double ra, dec, ra1, dec1, x1, y1, dra, ddec; … … 23 23 24 24 for (i = 0; i < image[0].overlay[N].Nobjects; i++) { 25 if ( !strcmp (image[0].overlay[N].objects[i].type, "LINE")) {25 if (image[0].overlay[N].objects[i].type == KII_OVERLAY_LINE) { 26 26 XY_to_RD (&ra, &dec, image[0].overlay[N].objects[i].x, image[0].overlay[N].objects[i].y, &image[0].coords); 27 27 x1 = image[0].overlay[N].objects[i].x + image[0].overlay[N].objects[i].dx; … … 41 41 dra = cos (dec*RAD_DEG) * fabs (ra1 - ra); 42 42 } 43 fprintf (f, "%s %lf %lf %lf %lf\n", image[0].overlay[N].objects[i].type, ra, dec, dra, ddec); 43 type = KiiOverlayTypeByNumber (image[0].overlay[N].objects[i].type); 44 if (type == NULL) continue; 45 fprintf (f, "%s %lf %lf %lf %lf\n", type, ra, dec, dra, ddec); 44 46 } 45 47 fclose (f); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/CheckPipe.c
r13409 r13432 119 119 } 120 120 121 if (!strcmp (word, " LIMS")) {121 if (!strcmp (word, "GLIM")) { 122 122 GetLimits (sock); 123 123 KiiSendCommand (sock, 4, "DONE"); … … 127 127 if (!strcmp (word, "SLIM")) { 128 128 status = SetLimits (sock); 129 KiiSendCommand (sock, 4, "DONE"); 130 FINISHED (TRUE); 131 } 132 133 if (!strcmp (word, "GSTY")) { 134 GetGraphStyle (sock); 135 KiiSendCommand (sock, 4, "DONE"); 136 FINISHED (TRUE); 137 } 138 139 if (!strcmp (word, "SSTY")) { 140 status = SetGraphStyle (sock); 141 KiiSendCommand (sock, 4, "DONE"); 142 FINISHED (TRUE); 143 } 144 145 if (!strcmp (word, "TOOL")) { 146 status = SetToolbox (sock); 129 147 KiiSendCommand (sock, 4, "DONE"); 130 148 FINISHED (TRUE); … … 208 226 } 209 227 210 /* this is not currently used?211 tickmarks were equivalent to the overlays, but fixed wrt the window.212 this functionality is probably supplanted by the graph213 if (!strcmp (word, "TICK")) {214 status = LoadTickmarks (sock);215 KiiSendCommand (sock, 4, "DONE");216 FINISHED (status);217 }218 */219 220 228 if (!strcmp (word, "SAVE")) { 221 229 status = SaveOverlay (sock); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/EraseOverlay.c
r13344 r13432 17 17 18 18 if (N > NOVERLAYS) { 19 REALLOCATE (image[0].tickmarks.objects, Object, 1);19 REALLOCATE (image[0].tickmarks.objects, KiiOverlay, 1); 20 20 image[0].tickmarks.Nobjects = 0; 21 21 } else { 22 22 for (i = 0; i < image[0].overlay[N].Nobjects; i++) { 23 if ( !strcmp (image[0].overlay[N].objects[i].type, "TEXT")) {23 if (image[0].overlay[N].objects[i].type == KII_OVERLAY_TEXT) { 24 24 free (image[0].overlay[N].objects[i].text); 25 25 } 26 26 } 27 REALLOCATE (image[0].overlay[N].objects, Object, 1);27 REALLOCATE (image[0].overlay[N].objects, KiiOverlay, 1); 28 28 image[0].overlay[N].Nobjects = 0; 29 29 image[0].overlay[N].active = FALSE; -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Image.c
r13401 r13432 21 21 image[0].start = 0; 22 22 image[0].slope = 1; 23 image[0].location = 4; 23 24 24 25 image[0].coords.Npolyterms = 0; 25 26 for (i = 0; i < NOVERLAYS; i++) { 26 27 image[0].overlay[i].Nobjects = 0; 27 ALLOCATE (image[0].overlay[i].objects, Object, 1); /* allocate so later free will not crash! */28 ALLOCATE (image[0].overlay[i].objects, KiiOverlay, 1); /* allocate so later free will not crash! */ 28 29 image[0].overlay[i].active = FALSE; 29 30 image[0].overlay[i].color = graphic[0].overlay_color[i]; … … 111 112 } 112 113 } 113 # if (0)114 PaintTickmarks (graphic, image);115 # endif116 114 117 115 if (image[0].location) { -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadObject.c
r13409 r13432 106 106 int LoadVectorData (int sock, KapaGraphWidget *graph, int N, char *type) { 107 107 108 int Npts, Ninpts, status, Ntry;108 int i, Npts, Ninpts, status, Ntry; 109 109 int bytes_left; 110 char *b uff, type_send[16];111 int Npts_send, Nbytes_send ;112 113 buff = NULL;110 char *byte, *buffer, type_send[16], tmp; 111 int Npts_send, Nbytes_send, swap_client, swap_host; 112 113 buffer = NULL; 114 114 Npts = graph[0].objects[N].Npts; 115 115 116 116 KiiWaitAnswer (sock, "PLOB"); 117 KiiScanMessage (sock, "%s %d %d ", type_send, &Npts_send, &Nbytes_send);117 KiiScanMessage (sock, "%s %d %d %d", type_send, &Npts_send, &Nbytes_send, &swap_client); 118 118 if (strcmp (type, type_send)) { 119 119 fprintf (stderr, "Kapa Communication error: unexpected data type %s vs %s\n", type_send, type); … … 129 129 if (!strcmp (type, "x")) { 130 130 ALLOCATE (graph[0].objects[N].x, float, MAX (1, Npts)); 131 buff = (char *) graph[0].objects[N].x;131 buffer = (char *) graph[0].objects[N].x; 132 132 } 133 133 if (!strcmp (type, "y")) { 134 134 ALLOCATE (graph[0].objects[N].y, float, MAX (1, Npts)); 135 buff = (char *) graph[0].objects[N].y;135 buffer = (char *) graph[0].objects[N].y; 136 136 } 137 137 if (!strcmp (type, "z")) { 138 138 ALLOCATE (graph[0].objects[N].z, float, MAX (1, Npts)); 139 buff = (char *) graph[0].objects[N].z;139 buffer = (char *) graph[0].objects[N].z; 140 140 } 141 141 if (!strcmp (type, "dxm")) { 142 142 ALLOCATE (graph[0].objects[N].dxm, float, MAX (1, Npts)); 143 buff = (char *) graph[0].objects[N].dxm;143 buffer = (char *) graph[0].objects[N].dxm; 144 144 } 145 145 if (!strcmp (type, "dxp")) { 146 146 ALLOCATE (graph[0].objects[N].dxp, float, MAX (1, Npts)); 147 buff = (char *) graph[0].objects[N].dxp;147 buffer = (char *) graph[0].objects[N].dxp; 148 148 } 149 149 if (!strcmp (type, "dym")) { 150 150 ALLOCATE (graph[0].objects[N].dym, float, MAX (1, Npts)); 151 buff = (char *) graph[0].objects[N].dym;151 buffer = (char *) graph[0].objects[N].dym; 152 152 } 153 153 if (!strcmp (type, "dyp")) { 154 154 ALLOCATE (graph[0].objects[N].dyp, float, MAX (1, Npts)); 155 buff = (char *) graph[0].objects[N].dyp;155 buffer = (char *) graph[0].objects[N].dyp; 156 156 } 157 157 … … 160 160 fcntl (sock, F_SETFL, O_NONBLOCK); 161 161 162 // read the vector data as raw binary in client machine byte order (floats) 162 163 Ntry = 0; 163 164 if (DEBUG) fprintf (stderr, "starting vector load\n"); 164 165 Ninpts = 0; 166 byte = buffer; 165 167 while (bytes_left > 0) { 166 status = read (sock, b uff, bytes_left);168 status = read (sock, byte, bytes_left); 167 169 if (DEBUG) fprintf (stderr, "status: %d, %d\n", status, bytes_left); 168 170 if (status == 0) { /* No more pipe */ … … 173 175 Ninpts += status; 174 176 bytes_left -= status; 175 b uff = (char *)(buff+ status);177 byte = (char *)(byte + status); 176 178 Ntry = 0; 177 179 continue; … … 192 194 KiiSendCommand (sock, 4, "DONE"); 193 195 196 # ifdef BYTE_SWAP 197 swap_host = 1; 198 # else 199 swap_host = 0; 200 # endif 201 202 // if host and client have opposite swap parities, word swap the incoming data 203 // SWAP_WORD is strangely defined... it takes the number of the start byte in a 204 // buffer called 'byte' 205 if ((swap_host && !swap_client) || (!swap_host && swap_client)) { 206 byte = buffer; 207 for (i = 0; i < Nbytes_send; i+=4) { 208 SWAP_WORD (i); 209 } 210 } 211 194 212 if (Ninpts != Npts*sizeof(float)) { 195 213 fprintf (stderr, "error: expected %d bytes, but got only %d\n", Ninpts, (unsigned int)(Npts*sizeof(float))); … … 212 230 if (object[0].dyp != (float *) NULL) free (object[0].dyp); 213 231 } 214 -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadOverlay.c
r13409 r13432 1 1 # include "Ximage.h" 2 2 3 // XXX this is a very inefficient method to send the data: binary would be better4 3 int LoadOverlay (int sock) { 5 4 6 char word[17], type[16], string[128]; 7 char *buffer, *buff; 8 double x, y, dx, dy; 9 int Nin, bytes, status; 10 int i, N, NOBJECTS, Nobjects, Nstart; 5 int i, j, Ntotal, Nbytes, Nread, Nfound, Ntext, Nobjects, overnum; 6 int Noverlay, NOVERLAY, Ntextdata; 7 char *textdata, *buffer, *p, *q; 11 8 Section *section; 12 9 KapaImageWidget *image; 13 10 Graphic *graphic; 11 KiiOverlayBase *overlay; 14 12 15 13 graphic = GetGraphic (); … … 19 17 SetSectionSizes (section); 20 18 } 21 image = section->image;19 image = section->image; 22 20 23 ALLOCATE (buffer, char, 65536); /* space for 512 lines of 128 bytes */ 24 bzero (buffer, 65536); 21 KiiScanMessage (sock, "%d %d %d %d", &overnum, &Noverlay, &Ntext, &Ntextdata); 25 22 26 KiiScanCommand (sock, 16, "%*s %d", &N);27 Nstart = image[0].overlay[N].Nobjects;23 // XXX need to validate overnum 24 if ((overnum < 0) || (overnum >= NOVERLAYS)) overnum = 0; 28 25 29 while (1) { 30 KiiScanCommand (sock, 16, "%s %d", word, &Nin); 31 if (!strcmp (word, "DONE")) break; 32 if (strcmp (word, "NLINES")) abort(); 26 // read the overlay data as binary 27 Ntotal = 0; 28 Nbytes = Noverlay*sizeof(KiiOverlayBase); 29 fcntl (sock, F_SETFL, O_NONBLOCK); 30 ALLOCATE (overlay, KiiOverlayBase, Noverlay); 31 buffer = (char *) overlay; 32 while (Nbytes > 0) { 33 Nread = read (sock, &buffer[Ntotal], Nbytes); 34 // fprintf (stderr, "read: %d of %d remaining, %d so far, %d expected\n", Nread, Nbytes, Ntotal, Noverlay*sizeof(KiiOverlayBase)); 35 if (Nread == 0) { /* No more pipe */ 36 fprintf (stderr, "error: pipe closed\n"); 37 free (overlay); 38 fcntl (sock, F_SETFL, !O_NONBLOCK); 39 return (FALSE); 40 } 41 if (Nread != -1) { /* pipe has data */ 42 Nbytes -= Nread; 43 Ntotal += Nread; 44 } 45 } 46 fcntl (sock, F_SETFL, !O_NONBLOCK); 47 KiiSendCommand (sock, 4, "DONE"); 33 48 34 buff = buffer; 35 bytes = 128*Nin; 49 // read the textdata as binary 50 Ntotal = 0; 51 Nbytes = Ntextdata; 52 fcntl (sock, F_SETFL, O_NONBLOCK); 53 ALLOCATE (textdata, char, Ntextdata); 54 while (Nbytes > 0) { 55 Nread = read (sock, &textdata[Ntotal], Nbytes); 56 if (Nread == 0) { /* No more pipe */ 57 fprintf (stderr, "error: pipe closed\n"); 58 free (textdata); 59 free (overlay); 60 fcntl (sock, F_SETFL, !O_NONBLOCK); 61 return (FALSE); 62 } 63 if (Nread != -1) { /* pipe has data */ 64 Nbytes -= Nread; 65 Ntotal += Nread; 66 } 67 } 68 fcntl (sock, F_SETFL, !O_NONBLOCK); 69 KiiSendCommand (sock, 4, "DONE"); 36 70 37 /* accept data from the socket until we have all of the bytes */ 38 fcntl (sock, F_SETFL, O_NONBLOCK); 39 while (bytes > 0) { 40 status = read (sock, buff, bytes); 41 if (status == 0) { /* No more pipe */ 42 fprintf (stderr, "error: pipe closed\n"); 43 free (buffer); 44 fcntl (sock, F_SETFL, !O_NONBLOCK); 45 return (FALSE); 46 } 47 if (status != -1) { /* pipe has data */ 48 bytes -= status; 49 buff = (char *)(buff + status); 50 } 51 } 52 fcntl (sock, F_SETFL, !O_NONBLOCK); 71 // add new overlay objects to existing data 72 Nobjects = image[0].overlay[overnum].Nobjects + Noverlay; 73 REALLOCATE (image[0].overlay[overnum].objects, KiiOverlay, Nobjects); 53 74 54 /* parse buffer data */ 55 NOBJECTS = image[0].overlay[N].Nobjects + Nin; 56 Nobjects = image[0].overlay[N].Nobjects; 57 REALLOCATE (image[0].overlay[N].objects, Object, NOBJECTS); 58 for (i = 0; i < Nin; i++) { 59 sscanf (&buffer[i*128], "%s %lf %lf %lf %lf\n", type, &x, &y, &dx, &dy); 60 61 if (strcasecmp (type, "TEXT") && strcasecmp (type, "LINE") && strcasecmp (type, "BOX") && strcasecmp (type, "CIRCLE")) { /* skip */ 62 fprintf (stderr, "don't know %s, skipping\n", type); 63 continue; 64 } 65 66 if (!strcasecmp (type, "TEXT")) { /* end of objects */ 67 sscanf (&buffer[i*128], "%s %lf %lf %s\n", type, &x, &y, string); 68 } 69 70 strcpy (image[0].overlay[N].objects[Nobjects].type, type); 71 image[0].overlay[N].objects[Nobjects].x = x; 72 image[0].overlay[N].objects[Nobjects].y = y; 73 if (!strcmp (type, "TEXT")) { 74 image[0].overlay[N].objects[Nobjects].dx = 0; 75 image[0].overlay[N].objects[Nobjects].dy = 0; 76 image[0].overlay[N].objects[Nobjects].text = strcreate (string); 77 } else { 78 image[0].overlay[N].objects[Nobjects].dx = dx; 79 image[0].overlay[N].objects[Nobjects].dy = dy; 80 } 81 Nobjects++; 82 } 83 REALLOCATE (image[0].overlay[N].objects, Object, MAX(Nobjects, 1)); 84 image[0].overlay[N].Nobjects = Nobjects; 75 j = image[0].overlay[overnum].Nobjects; 76 for (i = 0; i < Noverlay; i++, j++) { 77 image[0].overlay[overnum].objects[j].x = overlay[i].x; 78 image[0].overlay[overnum].objects[j].y = overlay[i].y; 79 image[0].overlay[overnum].objects[j].dx = overlay[i].dx; 80 image[0].overlay[overnum].objects[j].dy = overlay[i].dy; 81 image[0].overlay[overnum].objects[j].type = overlay[i].type; 82 image[0].overlay[overnum].objects[j].text = NULL; 85 83 } 86 84 87 /* cleanup */ 88 free (buffer); 89 REALLOCATE (image[0].overlay[N].objects, Object, MAX (1, image[0].overlay[N].Nobjects)); 90 image[0].overlay[N].active = TRUE; 85 // parse the text data : text lines are separated by '\n', one per text entry 86 p = textdata; 87 Nfound = 0; 88 for (i = 0; i < Noverlay; i++) { 89 if (overlay[i].type != KII_OVERLAY_TEXT) continue; 90 if (Nfound >= Ntext) { 91 fprintf (stderr, "inconsistent number of text lines\n"); 92 break; 93 } 94 if (! *p) { 95 fprintf (stderr, "inconsistent number of text lines\n"); 96 break; 97 } 98 q = strchr (p, '\n'); 99 if (q == NULL) { 100 fprintf (stderr, "inconsistent text line\n"); 101 break; 102 } 103 j = image[0].overlay[overnum].Nobjects + i; 104 image[0].overlay[overnum].objects[j].text = strncreate (p, q-p); 105 p = q + 1; 106 Nfound ++; 107 } 108 if (Nfound != Ntext) { 109 fprintf (stderr, "read %d text lines, expected %d\n", Nfound, Ntext); 110 } 111 112 free (textdata); 113 free (overlay); 114 115 image[0].overlay[overnum].Nobjects = Nobjects; 116 image[0].overlay[overnum].active = TRUE; 91 117 92 118 if (USE_XWINDOW) { … … 96 122 } 97 123 } 98 PaintTickmarks (graphic, image);99 124 XFlush (graphic[0].display); 100 125 } -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/LoadTickmarks.c
r13409 r13432 18 18 Nobjects = image[0].tickmarks.Nobjects; 19 19 NOBJECTS = Nobjects + 100; 20 REALLOCATE (image[0].tickmarks.objects, Object, NOBJECTS);20 REALLOCATE (image[0].tickmarks.objects, KiiOverlay, NOBJECTS); 21 21 22 22 done = FALSE; … … 54 54 if (Nobjects >= NOBJECTS) { 55 55 NOBJECTS = Nobjects + 100; 56 REALLOCATE (image[0].tickmarks.objects, Object, NOBJECTS);56 REALLOCATE (image[0].tickmarks.objects, KiiOverlay, NOBJECTS); 57 57 } 58 58 59 59 } 60 60 61 REALLOCATE (image[0].tickmarks.objects, Object, MAX(Nobjects, 1));61 REALLOCATE (image[0].tickmarks.objects, KiiOverlay, MAX(Nobjects, 1)); 62 62 image[0].tickmarks.Nobjects = Nobjects; 63 63 -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PSOverlay.c
r13331 r13432 31 31 dY = (image[0].overlay[N].objects[i].dy)/expand; 32 32 33 if (!strcmp (image[0].overlay[N].objects[i].type, "LINE")) { 34 if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) || 35 ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) { 36 continue; 37 } 38 fprintf (f, " %6.1f %6.1f %6.1f %6.1f L\n", X + extra, Y + extra, (X+dX + extra), (Y-dY + extra)); 39 continue; 33 switch (image[0].overlay[N].objects[i].type) { 34 case KII_OVERLAY_LINE: 35 if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) || 36 ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) { 37 break; 38 } 39 fprintf (f, " %6.1f %6.1f %6.1f %6.1f L\n", X + extra, Y + extra, (X+dX + extra), (Y-dY + extra)); 40 break; 41 case KII_OVERLAY_TEXT: 42 if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) || 43 ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) { 44 break; 45 } 46 fprintf (f, "(%s) %6.1f %6.1f T\n", image[0].overlay[N].objects[i].text, X + extra, Y + extra); 47 break; 48 case KII_OVERLAY_BOX: 49 if (((X - 0.5*dX < Xmin) && (X + 0.5*dX < Xmin)) || ((X - 0.5*dX > Xmax) && (X + 0.5*dX > Xmax)) || 50 ((Y - 0.5*dY < Ymin) && (Y + 0.5*dY < Ymin)) || ((Y - 0.5*dY > Ymax) && (Y + 0.5*dY > Ymax))) { 51 break; 52 } 53 fprintf (f, " %6.1f %6.1f %6.1f %6.1f B\n", (dX + 2*extra), (dY + 2*extra), (X - 0.5*dX - extra), (Y - 0.5*dY - extra)); 54 break; 55 case KII_OVERLAY_CIRCLE: 56 if (((X - dX < Xmin) && (X + dX < Xmin)) || ((X - dX > Xmax) && (X + dX > Xmax)) || 57 ((Y - dY < Ymin) && (Y + dY < Ymin)) || ((Y - dY > Ymax) && (Y + dY > Ymax))) { 58 break; 59 } 60 fprintf (f, " %6.1f %6.1f %6.1f C\n", X, Y, fabs(dX + extra)); 61 break; 62 default: 63 fprintf (stderr, "skipping unknown object\n"); 64 break; 40 65 } 41 if (!strcmp (image[0].overlay[N].objects[i].type, "TEXT")) {42 if (((X < Xmin) && (X + dX < Xmin)) || ((X > Xmax) && (X + dX > Xmax)) ||43 ((Y < Ymin) && (Y + dY < Ymin)) || ((Y > Ymax) && (Y + dY > Ymax))) {44 continue;45 }46 fprintf (f, "(%s) %6.1f %6.1f T\n", image[0].overlay[N].objects[i].text, X + extra, Y + extra);47 continue;48 }49 if (!strcmp (image[0].overlay[N].objects[i].type, "BOX")) {50 if (((X - 0.5*dX < Xmin) && (X + 0.5*dX < Xmin)) || ((X - 0.5*dX > Xmax) && (X + 0.5*dX > Xmax)) ||51 ((Y - 0.5*dY < Ymin) && (Y + 0.5*dY < Ymin)) || ((Y - 0.5*dY > Ymax) && (Y + 0.5*dY > Ymax))) {52 continue;53 }54 fprintf (f, " %6.1f %6.1f %6.1f %6.1f B\n", (dX + 2*extra), (dY + 2*extra), (X - 0.5*dX - extra), (Y - 0.5*dY - extra));55 continue;56 }57 if (!strcmp (image[0].overlay[N].objects[i].type, "CIRCLE")) {58 if (((X - dX < Xmin) && (X + dX < Xmin)) || ((X - dX > Xmax) && (X + dX > Xmax)) ||59 ((Y - dY < Ymin) && (Y + dY < Ymin)) || ((Y - dY > Ymax) && (Y + dY > Ymax))) {60 continue;61 }62 fprintf (f, " %6.1f %6.1f %6.1f C\n", X, Y, fabs(dX + extra));63 continue;64 }65 fprintf (stderr, "don't know %s, skipping\n", image[0].overlay[N].objects[i].type);66 66 } 67 68 67 } -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PaintOverlay.c
r13320 r13432 41 41 for a BOX (x, y) is the center, (dx, dy) is the width */ 42 42 43 if (!strcasecmp (image[0].overlay[N].objects[i].type, "LINE")) { 44 XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY)); 45 continue; 43 switch (image[0].overlay[N].objects[i].type) { 44 case KII_OVERLAY_LINE: 45 XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY)); 46 break; 47 case KII_OVERLAY_TEXT: 48 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].overlay[N].objects[i].text, strlen(image[0].overlay[N].objects[i].text)); 49 break; 50 case KII_OVERLAY_BOX: 51 dx = MAX (abs(dX),2) / 2; 52 dy = MAX (abs(dY),2) / 2; 53 XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy); 54 break; 55 case KII_OVERLAY_CIRCLE: 56 dx = MAX (abs(dX),2); 57 dy = MAX (abs(dY),2); 58 XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy, 0, 23040); 59 break; 60 default: 61 fprintf (stderr, "skipping unknown object\n"); 62 break; 46 63 } 47 if (!strcasecmp (image[0].overlay[N].objects[i].type, "TEXT")) {48 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].overlay[N].objects[i].text, strlen(image[0].overlay[N].objects[i].text));49 continue;50 }51 if (!strcasecmp (image[0].overlay[N].objects[i].type, "BOX")) {52 dx = MAX (abs(dX),2) / 2;53 dy = MAX (abs(dY),2) / 2;54 XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy);55 continue;56 }57 if (!strcasecmp (image[0].overlay[N].objects[i].type, "CIRCLE")) {58 dx = MAX (abs(dX),2);59 dy = MAX (abs(dY),2);60 XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, (X - dx), (Y - dy), 2*dx, 2*dy, 0, 23040);61 continue;62 }63 fprintf (stderr, "don't know %s, skipping (PO)\n", image[0].overlay[N].objects[i].type);64 64 } 65 65 -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/PaintTickmarks.c
r13320 r13432 22 22 dY = image[0].tickmarks.objects[i].dy * Yrange; 23 23 24 if (!strcmp (image[0].tickmarks.objects[i].type, "LINE")) { 25 XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY)); 26 continue; 24 switch (image[0].overlay[0].objects[i].type) { 25 case KII_OVERLAY_LINE: 26 XDrawLine (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, (X+dX), (Y+dY)); 27 break; 28 case KII_OVERLAY_TEXT: 29 if (image[0].tickmarks.objects[i].dy == 0) { 30 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back); 31 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-11, 6*strlen(image[0].tickmarks.objects[i].text), 11); 32 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore); 33 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text)); 34 } 35 if (image[0].tickmarks.objects[i].dy == 90) { 36 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back); 37 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-6*strlen(image[0].tickmarks.objects[i].text), 11, 6*strlen(image[0].tickmarks.objects[i].text)); 38 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore); 39 /* XDrawRotString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text)); */ 40 } 41 break; 42 case KII_OVERLAY_BOX: 43 XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (int)(X - 0.5*dX), (int)(Y - 0.5*dY), abs(dX), abs(dY)); 44 break; 45 case KII_OVERLAY_CIRCLE: 46 XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, X - dX, Y - dY, abs(2*dX), abs(2*dY), 0, 23040); 47 break; 48 default: 49 fprintf (stderr, "skipping unknown object\n"); 50 break; 27 51 } 28 if (!strcmp (image[0].tickmarks.objects[i].type, "TEXT")) {29 if (image[0].tickmarks.objects[i].dy == 0) {30 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back);31 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-11, 6*strlen(image[0].tickmarks.objects[i].text), 11);32 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore);33 XDrawString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text));34 }35 if (image[0].tickmarks.objects[i].dy == 90) {36 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].back);37 XFillRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y-6*strlen(image[0].tickmarks.objects[i].text), 11, 6*strlen(image[0].tickmarks.objects[i].text));38 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore);39 /* XDrawRotString (graphic[0].display, graphic[0].window, graphic[0].gc, X, Y, image[0].tickmarks.objects[i].text, strlen(image[0].tickmarks.objects[i].text)); */40 }41 continue;42 }43 if (!strcmp (image[0].tickmarks.objects[i].type, "BOX")) {44 XDrawRectangle (graphic[0].display, graphic[0].window, graphic[0].gc, (int)(X - 0.5*dX), (int)(Y - 0.5*dY), abs(dX), abs(dY));45 continue;46 }47 if (!strcmp (image[0].tickmarks.objects[i].type, "CIRCLE")) {48 XDrawArc (graphic[0].display, graphic[0].window, graphic[0].gc, X - dX, Y - dY, abs(2*dX), abs(2*dY), 0, 23040);49 continue;50 }51 fprintf (stderr, "don't know %s, skipping (PO)\n", image[0].tickmarks.objects[i].type);52 52 } 53 54 53 XSetForeground (graphic[0].display, graphic[0].gc, graphic[0].fore); 55 56 54 } -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SaveOverlay.c
r13344 r13432 4 4 5 5 int i, N; 6 char filename[256] ;6 char filename[256], *type; 7 7 FILE *f; 8 8 Section *section; … … 22 22 23 23 for (i = 0; i < image[0].overlay[N].Nobjects; i++) { 24 type = KiiOverlayTypeByNumber (image[0].overlay[N].objects[i].type); 25 if (type == NULL) continue; 24 26 fprintf (f, "%s %lf %lf %lf %lf\n", 25 image[0].overlay[N].objects[i].type,27 type, 26 28 image[0].overlay[N].objects[i].x, 27 29 image[0].overlay[N].objects[i].y, … … 32 34 return (TRUE); 33 35 } 36 37 /* this is asymmetric with LoadOverlay.c. In that case, the client reads the file and sends 38 * the overlay objects to kapa. In this case, kapa writes the file directly... 39 */ -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/Sections.c
r13405 r13432 176 176 tmpSection = sections[N]; 177 177 sections[N] = sections[N+1]; 178 sections[N ] = tmpSection;178 sections[N+1] = tmpSection; 179 179 Refresh (1); 180 180 return (TRUE); … … 186 186 tmpSection = sections[N]; 187 187 sections[N] = sections[N-1]; 188 sections[N ] = tmpSection;188 sections[N-1] = tmpSection; 189 189 Refresh (1); 190 190 return (TRUE); -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/SetImageSize.c
r13401 r13432 25 25 dX = graphic[0].dx * section[0].dx; 26 26 dY = graphic[0].dy * section[0].dy; 27 28 // XXX make this user-setable29 image[0].location = 0;30 27 31 28 switch (image[0].location) { -
branches/kapa-mods-2007-05/Ohana/src/kapa2/src/bDrawOverlay.c
r13320 r13432 24 24 } 25 25 /* 26 X = 0.5*image[0].matrix.Naxis[0] - expand*((int)(0.5*image[0].picture.dx + 0.5) - 0.0) - image[0].X;27 Y = 0.5*image[0].matrix.Naxis[1] - expand*((int)(0.5*image[0].picture.dy + 0.5) - 0.0) - image[0].Y;28 X0 = (image[0].X + 1 - (int)(0.5*image[0].matrix.Naxis[0] + 0.5) - X + (int)X)/expand + image[0].picture.x + 0.5*image[0].picture.dx;29 Y0 = (image[0].Y + 1 - (int)(0.5*image[0].matrix.Naxis[1] + 0.5) - Y + (int)Y)/expand + image[0].picture.y + 0.5*image[0].picture.dy;26 X = 0.5*image[0].matrix.Naxis[0] - expand*((int)(0.5*image[0].picture.dx + 0.5) - 0.0) - image[0].X; 27 Y = 0.5*image[0].matrix.Naxis[1] - expand*((int)(0.5*image[0].picture.dy + 0.5) - 0.0) - image[0].Y; 28 X0 = (image[0].X + 1 - (int)(0.5*image[0].matrix.Naxis[0] + 0.5) - X + (int)X)/expand + image[0].picture.x + 0.5*image[0].picture.dx; 29 Y0 = (image[0].Y + 1 - (int)(0.5*image[0].matrix.Naxis[1] + 0.5) - Y + (int)Y)/expand + image[0].picture.y + 0.5*image[0].picture.dy; 30 30 */ 31 31 … … 62 62 for a BOX (x, y) is the center, (dx, dy) is the width */ 63 63 64 if (!strcasecmp (image[0].overlay[N].objects[i].type, "LINE")) { 65 bDrawLine (X, Y, (X+dX), (Y+dY)); 66 continue; 64 switch (image[0].overlay[N].objects[i].type) { 65 case KII_OVERLAY_LINE: 66 bDrawLine (X, Y, (X+dX), (Y+dY)); 67 break; 68 case KII_OVERLAY_TEXT: 69 bDrawRotText (X, Y, image[0].overlay[N].objects[i].text, 8, 0.0); 70 break; 71 case KII_OVERLAY_BOX: 72 dx = MAX (abs(dX),2) / 2; 73 dy = MAX (abs(dY),2) / 2; 74 bDrawRectOpen ((X-dx), (Y-dy), (X+dx), (Y+dy)); 75 // bDrawRectOpen ((X-dx), (Y-dy), (X), (Y)); 76 break; 77 case KII_OVERLAY_CIRCLE: 78 dx = MAX (abs(dX),2); 79 dy = MAX (abs(dY),2); 80 bDrawArc (X, Y, dx, dy, 0, 360); 81 break; 82 default: 83 fprintf (stderr, "skipping unknown object\n"); 84 break; 67 85 } 68 if (!strcasecmp (image[0].overlay[N].objects[i].type, "TEXT")) {69 bDrawRotText (X, Y, image[0].overlay[N].objects[i].text, 8, 0.0);70 continue;71 }72 if (!strcasecmp (image[0].overlay[N].objects[i].type, "BOX")) {73 dx = MAX (abs(dX),2) / 2;74 dy = MAX (abs(dY),2) / 2;75 bDrawRectOpen ((X-dx), (Y-dy), (X+dx), (Y+dy));76 // bDrawRectOpen ((X-dx), (Y-dy), (X), (Y));77 continue;78 }79 if (!strcasecmp (image[0].overlay[N].objects[i].type, "CIRCLE")) {80 dx = MAX (abs(dX),2);81 dy = MAX (abs(dY),2);82 bDrawArc (X, Y, dx, dy, 0, 360);83 continue;84 }85 fprintf (stderr, "don't know %s, skipping (PO)\n", image[0].overlay[N].objects[i].type);86 86 } 87 87 -
branches/kapa-mods-2007-05/Ohana/src/libkapa/include/kapa.h
r13409 r13432 29 29 int logflux; 30 30 } KiiDisplayMode; 31 32 typedef struct { 33 float x; 34 float y; 35 float dx; 36 float dy; 37 int type; 38 } KiiOverlayBase; 31 39 32 40 typedef struct { … … 156 164 int KapaGetSection (int fd, char *name); 157 165 int KapaMoveSection (int fd, char *name, char *direction); 166 int KapaSetGraphStyle (int fd, Graphdata *graphmode); 167 int KapaGetGraphStyle (int fd, Graphdata *graphmode); 158 168 159 169 /* KapaColors */ -
branches/kapa-mods-2007-05/Ohana/src/libkapa/src/KapaWindow.c
r13409 r13432 53 53 54 54 KiiSendCommand (fd, 4, "ERSI"); 55 KiiWaitAnswer (fd, "DONE"); 56 return (TRUE); 57 } 58 59 int KapaSetToolbox (int fd, int location) { 60 61 KiiSendCommand (fd, 4, "TOOL"); 62 KiiSendMessage (fd, "%d", location); 55 63 KiiWaitAnswer (fd, "DONE"); 56 64 return (TRUE); … … 101 109 } 102 110 111 int KapaSetGraphStyle (int fd, Graphdata *graphmode) { 112 113 /* tell kapa to look for the incoming image */ 114 KiiSendCommand (fd, 4, "SSTY"); 115 116 /* send Xgraph the plot details */ 117 KiiSendMessage (fd, "%8d %d %d %d %d %d %f %f", 118 graphmode[0].style, 119 graphmode[0].ptype, graphmode[0].ltype, 120 graphmode[0].etype, graphmode[0].ebar, graphmode[0].color, 121 graphmode[0].lweight, graphmode[0].size); 122 KiiSendMessage (fd, "%g %g %g %g", 123 graphmode[0].xmin, graphmode[0].xmax, 124 graphmode[0].ymin, graphmode[0].ymax); 125 KiiWaitAnswer (fd, "DONE"); 126 return (TRUE); 127 } 128 129 int KapaGetGraphStyle (int fd, Graphdata *graphmode) { 130 131 /* tell kapa to look for the incoming image */ 132 KiiSendCommand (fd, 4, "GSTY"); 133 134 /* send Xgraph the plot details */ 135 KiiScanMessage (fd, "%d %d %d %d %d %d %lf %lf", 136 &graphmode[0].style, 137 &graphmode[0].ptype, &graphmode[0].ltype, 138 &graphmode[0].etype, &graphmode[0].ebar, &graphmode[0].color, 139 &graphmode[0].lweight, &graphmode[0].size); 140 KiiScanMessage (fd, "%lf %lf %lf %lf", 141 &graphmode[0].xmin, &graphmode[0].xmax, 142 &graphmode[0].ymin, &graphmode[0].ymax); 143 KiiWaitAnswer (fd, "DONE"); 144 return (TRUE); 145 } 146 103 147 int KapaPlotVector (int fd, int Npts, float *values, char *type) { 104 148 105 149 int Nbytes; 150 int swap; 151 152 # ifdef BYTE_SWAP 153 swap = 1; 154 # else 155 swap = 0; 156 # endif 106 157 107 158 Nbytes = Npts * sizeof (float); … … 118 169 valid: 119 170 KiiSendCommand (fd, 4, "PLOB"); 120 KiiSendMessage (fd, "%s %d %d", type, Npts, Nbytes); 121 // XXX send the byte-swap as well... 171 KiiSendMessage (fd, "%s %d %d %d", type, Npts, Nbytes, swap); 122 172 123 173 write (fd, values, Nbytes); … … 164 214 int KapaGetLimits (int fd, float *dx, float *dy) { 165 215 166 KiiSendCommand (fd, 4, " LIMS");216 KiiSendCommand (fd, 4, "GLIM"); 167 217 KiiScanMessage (fd, "%lf %lf", dx, dy); 168 218 KiiWaitAnswer (fd, "DONE"); -
branches/kapa-mods-2007-05/Ohana/src/libkapa/src/KiiOverlay.c
r13409 r13432 50 50 } 51 51 52 int KiiLoadOverlay (int fd, KiiOverlay *overlay, int Noverlay, char *overname) {52 int KiiLoadOverlayOld (int fd, KiiOverlay *overlay, int Noverlay, char *overname) { 53 53 54 54 int i, n, Nline; … … 93 93 } 94 94 95 int KiiLoadOverlay (int fd, KiiOverlay *overlay, int Noverlay, char *overname) { 96 97 int i, overnum, Ntextdata, NTEXTDATA, Ntext, Nchar; 98 char *textdata; 99 KiiOverlayBase *buffer; 100 101 Ntext = 0; 102 KiiSelectOverlay (overname, &overnum); 103 104 Ntextdata = 0; 105 NTEXTDATA = 1024; 106 ALLOCATE (textdata, char, 1024); 107 108 // we send the position information as a binary block 109 ALLOCATE (buffer, KiiOverlayBase, Noverlay); 110 for (i = 0; i < Noverlay; i++) { 111 buffer[i].x = overlay[i].x; 112 buffer[i].y = overlay[i].y; 113 buffer[i].dx = overlay[i].dx; 114 buffer[i].dy = overlay[i].dy; 115 buffer[i].type = overlay[i].type; 116 if (buffer[i].type == KII_OVERLAY_TEXT) { 117 Ntext ++; 118 Nchar = strlen(overlay[i].text) + 1; 119 if (Ntextdata + Nchar >= NTEXTDATA) { 120 NTEXTDATA += 1024; 121 REALLOCATE (textdata, char, NTEXTDATA); 122 } 123 sprintf (&textdata[Ntextdata], "%s\n", overlay[i].text); 124 Ntextdata += Nchar; 125 } 126 } 127 128 KiiSendCommand (fd, 4, "LOAD"); 129 KiiSendMessage (fd, "%d %d %d %d", overnum, Noverlay, Ntext, Ntextdata); 130 131 // we could break this into segments if we want to trap an interrupt, but why bother? 132 Nchar = write (fd, buffer, Noverlay*sizeof(KiiOverlayBase)); 133 fprintf (stderr, "sent %d of %d bytes\n", Nchar, Noverlay*sizeof(KiiOverlayBase)); 134 KiiWaitAnswer (fd, "DONE"); 135 136 write (fd, textdata, Ntextdata); 137 KiiWaitAnswer (fd, "DONE"); 138 139 free (buffer); 140 free (textdata); 141 142 KiiWaitAnswer (fd, "DONE"); 143 return (TRUE); 144 } 145 95 146 int KiiEraseOverlay (int fd, char *overname) { 96 147 -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/cgrid.c
r13409 r13432 14 14 double x, y; 15 15 Vector Xvec, Yvec; 16 int NorthPole, SouthPole, N, OnPic, LOnPic, status, NELEMENTS, First;16 int kapa, NorthPole, SouthPole, N, OnPic, LOnPic, status, NELEMENTS, First; 17 17 Graphdata graphmode; 18 18 19 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;19 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 20 20 21 21 if (argc != 1) { … … 23 23 return (FALSE); 24 24 } 25 SetGraph (graphmode);26 25 27 26 /* are we plotting one of the poles? */ … … 392 391 graphmode.ptype = 100; /* connect a pair */ 393 392 graphmode.etype = 0; 394 PrepPlotting (N, &graphmode); 395 PlotVector (N, Xvec.elements, "x"); 396 PlotVector (N, Yvec.elements, "y"); 393 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 397 394 398 395 free (Xvec.elements); -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/cplot.c
r13409 r13432 3 3 int cplot (int argc, char **argv) { 4 4 5 int i, Npts, status;5 int i, kapa, Npts, status; 6 6 float *x, *y, *r, *d, Rmin, Rmax; 7 7 Vector Xvec, Yvec, *xvec, *yvec; 8 8 Graphdata graphmode; 9 9 10 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;10 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 11 11 12 12 if (argc != 3) { … … 14 14 return (FALSE); 15 15 } 16 SetGraph (graphmode);17 16 18 17 Rmin = graphmode.coords.crval1 - 182.0; … … 67 66 68 67 graphmode.etype = 0; 69 PrepPlotting (Npts, &graphmode); 70 PlotVector (Npts, Xvec.elements, "x"); 71 PlotVector (Npts, Yvec.elements, "y"); 68 PlotVectorPair (kapa, Npts, Xvec.elements, Yvec.elements, &graphmode); 72 69 73 70 free (Xvec.elements); -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/czplot.c
r13409 r13432 3 3 int czplot (int argc, char **argv) { 4 4 5 int i, Npts;5 int i, kapa, Npts; 6 6 double min, range, Rmin, Rmax; 7 7 float *in, *out, *r, *d, *x, *y; … … 9 9 Graphdata graphmode; 10 10 11 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;11 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 12 12 13 13 if (argc != 6) { … … 15 15 return (FALSE); 16 16 } 17 SetGraph (graphmode);18 17 19 18 min = atof(argv[4]); … … 59 58 graphmode.etype = 0; 60 59 Npts = Xvec.Nelements; 61 PrepPlotting (Npts, &graphmode); 62 63 PlotVector (Npts, Xvec.elements, "x"); 64 PlotVector (Npts, Yvec.elements, "y"); 65 PlotVector (Npts, Zvec.elements, "z"); 60 PlotVectorTriplet (kapa, Npts, Xvec.elements, Yvec.elements, Zvec.elements, &graphmode); 66 61 67 62 free (Xvec.elements); -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.astro/region.c
r13404 r13432 114 114 KapaSendLabel (kapa, string, 2); 115 115 116 SetGraph (graphmode); 116 // XXX is this the right thing to be doing? 117 SetGraph (&graphmode); 117 118 return (TRUE); 118 119 } -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/dot.c
r13409 r13432 3 3 int dot (int argc, char **argv) { 4 4 5 int kapa; 5 6 Graphdata graphmode; 6 7 float x, y; 7 8 8 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;9 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 9 10 10 11 if (argc != 3) { … … 15 16 y = atof(argv[2]); 16 17 17 /* set plotting options (these are sticky) */18 SetGraph (graphmode);19 20 18 /* set point style and errorbar mode (these are NOT sticky) */ 21 19 graphmode.style = 2; 22 20 graphmode.etype = 0; 23 21 24 if (!PrepPlotting (1, &graphmode)) return (FALSE); 25 26 PlotVector (1, &x, "x"); 27 PlotVector (1, &y, "y"); 22 if (!KapaPrepPlot (kapa, 1, &graphmode)) return (FALSE); 23 KapaPlotVector (kapa, 1, &x, "x"); 24 KapaPlotVector (kapa, 1, &y, "y"); 28 25 29 26 return (TRUE); -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/grid.c
r13409 r13432 3 3 int grid (int argc, char **argv) { 4 4 5 int j, N, MinorTick, MajorTick;5 int j, kapa, N, MinorTick, MajorTick; 6 6 Vector Xvec, Yvec; 7 7 double range, lrange, factor, mantis, fmantis, power, major, minor, first, next; 8 8 Graphdata graphmode; 9 9 10 if (!style_args (&graphmode, &argc, argv, NULL)) return (FALSE);10 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 11 11 12 12 MajorTick = TRUE; … … 193 193 graphmode.ptype = 100; /* connect a pair */ 194 194 graphmode.etype = 0; 195 PrepPlotting (N, &graphmode); 196 PlotVector (N, Xvec.elements, "x"); 197 PlotVector (N, Yvec.elements, "y"); 195 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 198 196 199 197 free (Xvec.elements); -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/line.c
r13409 r13432 3 3 int line (int argc, char **argv) { 4 4 5 int kapa; 5 6 Graphdata graphmode; 6 7 float x[2], y[2]; 7 8 8 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;9 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 9 10 10 11 if (argc != 6) { … … 17 18 y[1] = atof(argv[5]); 18 19 19 SetGraph (graphmode);20 21 20 /* set point style and errorbar mode (these are NOT sticky) */ 22 21 graphmode.style = 0; 23 22 graphmode.etype = 0; 24 23 25 if (!PrepPlotting (2, &graphmode)) return (FALSE); 26 27 PlotVector (2, x, "x"); 28 PlotVector (2, y, "y"); 24 if (!KapaPrepPlot (kapa, 2, &graphmode)) return (FALSE); 25 KapaPlotVector (kapa, 2, x, "x"); 26 KapaPlotVector (kapa, 2, y, "y"); 29 27 30 28 return (TRUE); 31 32 29 } -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/plot.c
r13409 r13432 3 3 int plot (int argc, char **argv) { 4 4 5 int N, Npts;5 int kapa, N, Npts; 6 6 Graphdata graphmode; 7 7 Vector *xvec, *yvec, *dxmvec, *dxpvec, *dymvec, *dypvec; 8 8 9 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;9 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 10 10 11 11 /* decide on error bars */ … … 36 36 return (FALSE); 37 37 } 38 SetGraph (graphmode);39 38 40 39 /* set errorbar mode (these are NOT sticky) */ … … 57 56 if (Npts == 0) return (TRUE); 58 57 59 if (! PrepPlotting (Npts, &graphmode)) return (FALSE);58 if (!KapaPrepPlot (kapa, Npts, &graphmode)) return (FALSE); 60 59 61 PlotVector (Npts, xvec[0].elements, "x");62 PlotVector (Npts, yvec[0].elements, "y");60 KapaPlotVector (kapa, Npts, xvec[0].elements, "x"); 61 KapaPlotVector (kapa, Npts, yvec[0].elements, "y"); 63 62 if (graphmode.etype & 0x01) { 64 PlotVector (Npts, dymvec[0].elements, "dym");65 PlotVector (Npts, dypvec[0].elements, "dyp");63 KapaPlotVector (kapa, Npts, dymvec[0].elements, "dym"); 64 KapaPlotVector (kapa, Npts, dypvec[0].elements, "dyp"); 66 65 } 67 66 if (graphmode.etype & 0x02) { 68 PlotVector (Npts, dxmvec[0].elements, "dxm");69 PlotVector (Npts, dxpvec[0].elements, "dxp");67 KapaPlotVector (kapa, Npts, dxmvec[0].elements, "dxm"); 68 KapaPlotVector (kapa, Npts, dxpvec[0].elements, "dxp"); 70 69 } 71 72 70 return (TRUE); 73 74 71 } -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/section.c
r13404 r13432 1 1 # include "data.h" 2 2 3 enum {NONE, LIST, UP, DOWN, TOP, BOTTOM };3 enum {NONE, LIST, UP, DOWN, TOP, BOTTOM, TOOL}; 4 4 5 5 int section (int argc, char **argv) { 6 6 7 int N, action; 8 int kapa; 9 char *name; 7 int N, action, kapa; 8 char *name, *location; 10 9 Graphdata graphmode; 11 10 KapaSection section; … … 13 12 action = NONE; 14 13 if ((N = get_argument (argc, argv, "-list"))) { 14 action = LIST; 15 15 remove_argument (N, &argc, argv); 16 action = LIST;17 16 } 18 17 if ((N = get_argument (argc, argv, "-up"))) { 18 action = UP; 19 19 remove_argument (N, &argc, argv); 20 action = UP;21 20 } 22 21 if ((N = get_argument (argc, argv, "-down"))) { 22 action = DOWN; 23 23 remove_argument (N, &argc, argv); 24 action = DOWN;25 24 } 26 25 if ((N = get_argument (argc, argv, "-top"))) { 26 action = TOP; 27 27 remove_argument (N, &argc, argv); 28 action = TOP;29 28 } 30 29 if ((N = get_argument (argc, argv, "-bottom"))) { 30 action = BOTTOM; 31 31 remove_argument (N, &argc, argv); 32 action = BOTTOM; 32 } 33 if ((N = get_argument (argc, argv, "-imtool"))) { 34 action = TOOL; 35 remove_argument (N, &argc, argv); 36 location = argv[N]; 37 remove_argument (N, &argc, argv); 33 38 } 34 39 … … 43 48 44 49 /* list sections */ 45 if ( argc == 1) {50 if ((argc == 1) && (action == NONE)) { 46 51 KapaGetSection (kapa, "*"); 47 52 gprint (GP_ERR, "USAGE: section name [x y dx dy]\n"); … … 69 74 KapaMoveSection (kapa, argv[1], "bottom"); 70 75 break; 76 77 case TOOL: 78 if (!strcmp(location, "-x")) { 79 KapaSetToolbox (kapa, 1); 80 break; 81 } 82 if (!strcmp(location, "+x")) { 83 KapaSetToolbox (kapa, 3); 84 break; 85 } 86 if (!strcmp(location, "-y")) { 87 KapaSetToolbox (kapa, 2); 88 break; 89 } 90 if (!strcmp(location, "+y")) { 91 KapaSetToolbox (kapa, 4); 92 break; 93 } 94 if (!strcmp(location, "none")) { 95 KapaSetToolbox (kapa, 0); 96 break; 97 } 98 gprint (GP_ERR, "unknown toolbox location %s\n", location); 99 gprint (GP_ERR, "valid values: -x, +x, -y, +y, none\n"); 100 return (FALSE); 71 101 72 102 case LIST: -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/style.c
r13391 r13432 3 3 int style (int argc, char **argv) { 4 4 5 int kapa; 5 6 Graphdata graphmode; 6 7 7 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;8 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 8 9 9 10 if (argc > 1) { … … 11 12 return (FALSE); 12 13 } 13 SetGraph (graphmode);14 KapaSetGraphStyle (kapa, &graphmode); 14 15 15 16 return (TRUE); -
branches/kapa-mods-2007-05/Ohana/src/opihi/cmd.data/zplot.c
r13409 r13432 3 3 int zplot (int argc, char **argv) { 4 4 5 int i, N, Npts;5 int i, kapa, N, Npts; 6 6 float *in, *out; 7 7 double min, range; … … 9 9 Vector *xvec, *yvec, *zvec, Zvec; 10 10 11 if (!style_args (&graphmode, &argc, argv, NULL)) return (FALSE);11 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 12 12 13 13 if (argc != 6) { … … 45 45 graphmode.etype = 0; /* no errorbars */ 46 46 Npts = xvec[0].Nelements; 47 PrepPlotting (Npts, &graphmode); 48 49 PlotVector (Npts, xvec[0].elements, "x"); 50 PlotVector (Npts, yvec[0].elements, "y"); 51 PlotVector (Npts, Zvec.elements, "z"); 47 PlotVectorTriplet (kapa, Npts, xvec[0].elements, yvec[0].elements, Zvec.elements, &graphmode); 52 48 53 49 free (Zvec.elements); -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/dmt.c
r13409 r13432 40 40 // XXX this needs to be fixed: how to access different graphs at once? 41 41 gprint (GP_ERR, "ERROR: this function is currently disabled\n"); 42 if (!GetGraphData (&graphsky, NULL, NULL)) return (FALSE); 42 return (FALSE); 43 if (!GetGraphData (&graphsky, &kapa, NULL)) return (FALSE); 43 44 if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE); 44 45 … … 143 144 } else { 144 145 graphmode.style = 2; /* set style to points */ 145 PrepPlotting (N, &graphmode); 146 147 PlotVector (N, Xvec.elements, "x"); 148 PlotVector (N, Yvec.elements, "y"); 146 PlotVector (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 149 147 150 148 free (Xvec.elements); -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/images.c
r13409 r13432 14 14 int WITH_MOSAIC, SOLO_MOSAIC, HIDDEN; 15 15 time_t tzero, tend; 16 int N, NPTS, n, npts, Npts ;16 int N, NPTS, n, npts, Npts, kapa; 17 17 Vector Xvec, Yvec; 18 18 double r[8], d[8], x[8], y[8], Rmin, Rmax, Rmid, trange, Radius; … … 22 22 int typehash; 23 23 24 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;24 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 25 25 26 26 WITH_MOSAIC = FALSE; … … 101 101 return (FALSE); 102 102 } 103 SetGraph (graphmode);104 103 105 104 /* it is not an error for the database not to have any images */ … … 282 281 graphmode.ptype = 100; /* connect pairs of points */ 283 282 graphmode.etype = 0; 284 PrepPlotting (N, &graphmode); 285 PlotVector (N, Xvec.elements, "x"); 286 PlotVector (N, Yvec.elements, "y"); 283 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 287 284 } 288 285 -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/imbox.c
r13409 r13432 3 3 int imbox (int argc, char **argv) { 4 4 5 int j, Nskip, status, InPic, flipped;5 int j, kapa, Nskip, status, InPic, flipped; 6 6 Vector Xvec, Yvec; 7 7 double r, d, x[4], y[4], Rmin, Rmax, Rmid; … … 12 12 FILE *f; 13 13 14 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;14 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 15 15 16 16 if (argc != 2) { … … 76 76 graphmode.ptype = 100; /* connect pairs of points */ 77 77 graphmode.etype = 0; 78 PrepPlotting (8, &graphmode); 79 PlotVector (8, Xvec.elements, "x"); 80 PlotVector (8, Yvec.elements, "y"); 78 PlotVectorPair (kapa, 8, Xvec.elements, Yvec.elements, &graphmode); 81 79 } 82 80 skip: -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/imdense.c
r13409 r13432 5 5 6 6 long A, B; 7 int i, N, Nimage, status, NPTS;7 int i, kapa, N, Nimage, status, NPTS; 8 8 double r, d, x, y, Rmin, Rmax; 9 9 Vector Xvec, Yvec; … … 11 11 Graphdata graphmode; 12 12 13 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;13 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 14 14 15 15 /* need options to list only images in region and only images in a time range */ … … 62 62 graphmode.style = 2; /* points */ 63 63 graphmode.etype = 0; 64 PrepPlotting (N, &graphmode); 65 PlotVector (N, Xvec.elements, "x"); 66 PlotVector (N, Yvec.elements, "y"); 64 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 67 65 } 68 66 -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/imstats.c
r13409 r13432 3 3 int imstats (int argc, char **argv) { 4 4 5 int i, Nimage, N;5 int i, kapa, Nimage, N; 6 6 int Mcal, AutoLimits; 7 7 double r, d; … … 10 10 Graphdata graphmode; 11 11 12 if (!style_args (&graphmode, &argc, argv, NULL)) return (FALSE);12 if (!style_args (&graphmode, &argc, argv, &kapa)) return (FALSE); 13 13 14 14 Mcal = TRUE; … … 54 54 graphmode.style = 2; 55 55 graphmode.etype = 0; 56 PrepPlotting (Nimage, &graphmode); 57 PlotVector (Nimage, Xvec.elements, "x"); 58 PlotVector (Nimage, Yvec.elements, "y"); 56 PlotVectorPair (kapa, Nimage, Xvec.elements, Yvec.elements, &graphmode); 59 57 60 58 free (Xvec.elements); -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/lcurve.c
r13409 r13432 154 154 graphmode.etype = 0; 155 155 156 PrepPlotting (N, &graphmode);157 PlotVector (N, Xvec.elements, "x");158 PlotVector (N, Yvec.elements, "y");156 KapaPrepPlot (kapa, N, &graphmode); 157 KapaPlotVector (kapa, N, Xvec.elements, "x"); 158 KapaPlotVector (kapa, N, Yvec.elements, "y"); 159 159 if (ErrorBars) { 160 PlotVector (N, dYvec.elements, "x");161 PlotVector (N, dYvec.elements, "y");160 KapaPlotVector (kapa, N, dYvec.elements, "dym"); 161 KapaPlotVector (kapa, N, dYvec.elements, "dyp"); 162 162 } 163 163 -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/paverage.c
r13391 r13432 5 5 6 6 FILE *f; 7 int i, j, Narg, Npts, NPTS, status, VERBOSE;7 int i, j, kapa, Narg, Npts, NPTS, status, VERBOSE; 8 8 int Nsecfilt, Nsec; 9 9 double Mz, Mr, mag; … … 23 23 Nsecfilt = GetPhotcodeNsecfilt (); 24 24 25 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;25 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 26 26 27 27 f = (FILE *) NULL; … … 82 82 return (FALSE); 83 83 } 84 SetGraph (graphmode);85 84 graphmode.style = 2; /* set style to points */ 86 85 graphmode.size = -1; /* point size determined by Zvec */ … … 141 140 } 142 141 if (Npts > NCHUNK) { 143 PlotVectorTriplet ( Npts, Xvec, Yvec, Zvec, &graphmode);142 PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode); 144 143 Npts = 0; 145 144 } … … 147 146 dvo_catalog_free (&catalog); 148 147 } 149 if (Npts > 0) PlotVectorTriplet ( Npts, Xvec, Yvec, Zvec, &graphmode);148 if (Npts > 0) PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode); 150 149 151 150 free (Xvec); -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/pcat.c
r13409 r13432 6 6 7 7 double Radius; 8 int i, j, N, Nregions, ShowAll, NPTS, Npts, leftside;8 int i, j, kapa, N, Nregions, ShowAll, NPTS, Npts, leftside; 9 9 RegionFile *regions; 10 10 char filename[128]; … … 33 33 return (FALSE); 34 34 } 35 if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE);35 if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE); 36 36 37 37 Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax)); … … 83 83 graphmode.ptype = 100; /* connect pairs of points */ 84 84 graphmode.etype = 0; 85 PrepPlotting (Npts, &graphmode); 86 PlotVector (Npts, Xvec.elements, "x"); 87 PlotVector (Npts, Yvec.elements, "y"); 85 PlotVectorPair (kapa, Npts, Xvec.elements, Yvec.elements, &graphmode); 88 86 } 89 87 -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/pmeasure.c
r13391 r13432 5 5 6 6 FILE *f; 7 int i, j, k, m, Narg, Npts, NPTS, status, VERBOSE;7 int i, j, k, m, kapa, Narg, Npts, NPTS, status, VERBOSE; 8 8 double Mz, Mr, mag; 9 9 double Radius, Rmin, Rmax, R, D; … … 19 19 20 20 if (!InitPhotcodes ()) return (FALSE); 21 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;21 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 22 22 23 23 f = (FILE *) NULL; … … 75 75 return (FALSE); 76 76 } 77 SetGraph (graphmode);78 77 graphmode.style = 2; /* set style to points */ 79 78 graphmode.size = -1; /* point size determined by Zvec */ … … 144 143 } 145 144 if (Npts > NCHUNK) { 146 PlotVectorTriplet ( Npts, Xvec, Yvec, Zvec, &graphmode);145 PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode); 147 146 Npts = 0; 148 147 } … … 151 150 dvo_catalog_free (&catalog); 152 151 } 153 if (Npts > 0) PlotVectorTriplet ( Npts, Xvec, Yvec, Zvec, &graphmode);152 if (Npts > 0) PlotVectorTriplet (kapa, Npts, Xvec, Yvec, Zvec, &graphmode); 154 153 155 154 free (Xvec); -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/procks.c
r13409 r13432 16 16 FILE *f; 17 17 Vector Xvec, Yvec; 18 int i, j, N, NROCKS;18 int kapa, i, j, N, NROCKS; 19 19 int N0, N1, SpeedClip, Reload; 20 20 unsigned int t0, t1; … … 25 25 26 26 VarConfig ("ROCK_CATALOG", "%s", rockcat); 27 if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE);27 if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE); 28 28 29 29 f = (FILE *) NULL; … … 113 113 graphmode.style = 2; /* set style to points */ 114 114 graphmode.etype = 0; /* no errorbars */ 115 PrepPlotting (N, &graphmode); 116 117 PlotVector (N, Xvec.elements, "x"); 118 PlotVector (N, Yvec.elements, "y"); 115 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 119 116 120 117 /* now plot vectors between two extrema */ … … 146 143 graphmode.ptype = 100; /* connect pairs */ 147 144 graphmode.etype = 0; /* no errorbars */ 148 PrepPlotting (N, &graphmode); 149 150 PlotVector (N, Xvec.elements, "x"); 151 PlotVector (N, Yvec.elements, "y"); 145 146 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 152 147 153 148 free (Xvec.elements); -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/showtile.c
r13409 r13432 5 5 int showtile (int argc, char **argv) { 6 6 7 int Nd, N, NPTS, status, i, InPic;7 int kapa, Nd, N, NPTS, status, i, InPic; 8 8 Graphdata graphmode; 9 9 Coords coords; … … 13 13 14 14 /* show tile pattern in viewed region */ 15 if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE);15 if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE); 16 16 17 17 if (argc != 1) { … … 86 86 graphmode.ptype = 100; /* connect pairs of points */ 87 87 graphmode.etype = 0; 88 PrepPlotting (N, &graphmode); 89 PlotVector (N, Xvec.elements, "x"); 90 PlotVector (N, Yvec.elements, "y"); 88 PlotVectorPair (kapa, N, Xvec.elements, Yvec.elements, &graphmode); 91 89 } 92 90 -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/simage.c
r13409 r13432 12 12 Header header; 13 13 Coords coords; 14 int i, j, Nstars, nstars, Nbytes, nbytes, Npts, N;14 int i, j, kapa, Nstars, nstars, Nbytes, nbytes, Npts, N; 15 15 Graphdata graphmode; 16 16 17 if (!GetGraph (&graphmode, NULL, NULL)) return (FALSE);17 if (!GetGraph (&graphmode, &kapa, NULL)) return (FALSE); 18 18 19 19 zero = 17.0; … … 154 154 graphmode.etype = 0; 155 155 Npts = Xvec.Nelements; 156 PrepPlotting (Npts, &graphmode);157 156 158 PlotVector (Npts, Xvec.elements, "x"); 159 PlotVector (Npts, Yvec.elements, "y"); 160 PlotVector (Npts, Zvec.elements, "z"); 157 PlotVectorTriplet (kapa, Npts, Xvec.elements, Yvec.elements, Zvec.elements, &graphmode); 161 158 162 159 free (Xvec.elements); -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/skycat.c
r13409 r13432 6 6 7 7 double Radius; 8 int i, j, N, Nregions, ShowAll, NPTS, Npts, leftside, Depth, VERBOSE;8 int i, j, N, Nregions, kapa, ShowAll, NPTS, Npts, leftside, Depth, VERBOSE; 9 9 struct stat filestat; 10 10 Vector Xvec, Yvec; … … 32 32 } 33 33 34 if (!style_args (&graphmode, &argc, argv, NULL)) return FALSE;34 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 35 35 36 36 if (argc != 1) { … … 38 38 return (FALSE); 39 39 } 40 SetGraph (graphmode);41 40 42 41 Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax)); … … 97 96 graphmode.ptype = 100; /* connect pairs of points */ 98 97 graphmode.etype = 0; 99 PrepPlotting (Npts, &graphmode); 100 PlotVector (Npts, Xvec.elements, "x"); 101 PlotVector (Npts, Yvec.elements, "y"); 98 PlotVectorPair (kapa, Npts, Xvec.elements, Yvec.elements, &graphmode); 102 99 } 103 100 -
branches/kapa-mods-2007-05/Ohana/src/opihi/include/display.h
r13409 r13432 7 7 /*** plotting functions ***/ 8 8 int GetCurrentDevice PROTO((void)); 9 int PrepPlotting PROTO((int Npts, Graphdata *graphmode)); 10 int PlotVector PROTO((int Npts, float *values, char *type)); 11 int PlotVectorTriplet PROTO((int N, float *xValues, float *yValues, float *zValues, Graphdata *graphmode)); 9 int PlotVectorPair PROTO((int kapa, int Npts, float *xValues, float *yValues, Graphdata *graphmode)); 10 int PlotVectorTriplet PROTO((int kapa, int Npts, float *xValues, float *yValues, float *zValues, Graphdata *graphmode)); 12 11 int GetGraphData PROTO((Graphdata *data, int *kapa, char *name)); 13 12 int GetGraph PROTO((Graphdata *data, int *kapa, char *name)); … … 16 15 int close_graph PROTO((int N)); 17 16 void QuitGraph PROTO((void)); 18 void SetGraph PROTO((Graphdata data));17 void SetGraph PROTO((Graphdata *data)); 19 18 void XGraphDead PROTO((int input)); 20 19 int GetColor PROTO((char *name)); -
branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/PlotVectors.c
r13409 r13432 1 1 # include "display.h" 2 2 3 static int kapa; 3 int PlotVectorPair (int kapa, int Npts, float *xValues, float *yValues, Graphdata *graphmode) { 4 4 5 int PrepPlotting (int Npts, Graphdata *graphmode) {6 7 if (!GetGraph (NULL, &kapa, NULL)) return (FALSE);8 5 KapaPrepPlot (kapa, Npts, graphmode); 9 return (TRUE); 10 } 11 12 int PlotVector (int Npts, float *values, char *type) { 13 14 KapaPlotVector (kapa, Npts, values, type); 15 return (TRUE); 16 } 17 18 int PlotVectorPair (int N, float *xValues, float *yValues, Graphdata *graphmode) { 19 20 PrepPlotting (N, graphmode); 21 PlotVector (N, xValues, "x"); 22 PlotVector (N, yValues, "y"); 6 KapaPlotVector (kapa, Npts, xValues, "x"); 7 KapaPlotVector (kapa, Npts, yValues, "y"); 23 8 24 9 return (TRUE); 25 10 } 26 11 27 int PlotVectorTriplet (int N, float *xValues, float *yValues, float *zValues, Graphdata *graphmode) {12 int PlotVectorTriplet (int kapa, int Npts, float *xValues, float *yValues, float *zValues, Graphdata *graphmode) { 28 13 29 PrepPlotting (N, graphmode);30 PlotVector (N, xValues, "x");31 PlotVector (N, yValues, "y");32 PlotVector (N, zValues, "z");14 KapaPrepPlot (kapa, Npts, graphmode); 15 KapaPlotVector (kapa, Npts, xValues, "x"); 16 KapaPlotVector (kapa, Npts, yValues, "y"); 17 KapaPlotVector (kapa, Npts, zValues, "z"); 33 18 34 19 return (TRUE); 35 20 } 36 37 /* we don't use GetGraph in PlotVector because it flushes the connection */38 /* PlotVector currently operates on the static identified socket39 rather than the currently active socket -- must be preceeded by PrepPlotting */ -
branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/graphtools.c
r7680 r13432 33 33 graphmode[0].ymax = maxY + 0.05*range; 34 34 } 35 SetGraph (graphmode [0]);35 SetGraph (graphmode); 36 36 37 37 set_variable ("XMIN", graphmode[0].xmin); … … 73 73 graphmode[0].ymax = maxY + 0.05*range; 74 74 } 75 SetGraph (graphmode [0]);75 SetGraph (graphmode); 76 76 77 77 set_variable ("XMIN", graphmode[0].xmin); -
branches/kapa-mods-2007-05/Ohana/src/opihi/lib.data/open_kapa.c
r13394 r13432 180 180 } 181 181 182 if (data != NULL) *data = graphdata;182 if (data != NULL) KapaGetGraphStyle (Socket[Active], data); 183 183 if (fd != NULL) *fd = Socket[Active]; 184 184 … … 206 206 207 207 if (fd != NULL) *fd = Socket[entry]; 208 if (data != NULL) *data = graphdata;208 if (data != NULL) KapaGetGraphStyle (Socket[entry], data); 209 209 return (TRUE); 210 210 } 211 211 212 212 /* assign given values to current Xgraph */ 213 void SetGraph (Graphdata data) { 214 graphdata = data; 213 void SetGraph (Graphdata *data) { 214 if (Active < 0) { 215 gprint (GP_ERR, "no active kapa window\n"); 216 return (FALSE); 217 } 218 if (Socket[Active] == -1) { 219 gprint (GP_ERR, "no active kapa window\n"); 220 return (FALSE); 221 } 222 KapaSetGraphStyle (Socket[Active], data); 215 223 } 216 224
Note:
See TracChangeset
for help on using the changeset viewer.
