Changeset 5846 for trunk/Ohana/src/opihi/cmd.data/vload.c
- Timestamp:
- Dec 27, 2005, 5:06:32 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/cmd.data/vload.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.data/vload.c
r5702 r5846 1 1 # include "data.h" 2 3 # define NPTYPE 34 static char ptype[NPTYPE][8] = {"BOX", "LINE", "CIRCLE"};5 2 6 3 int vload (int argc, char **argv) { 7 4 8 int i, N, n, Nline;9 int Ximage, Nimage ;5 int i, N, Noverlay; 6 int Ximage, Nimage, type; 10 7 double dx, dy, size; 11 char *buffer, *type;8 KiiOverlay *overlay; 12 9 Vector *vecx, *vecy; 13 10 … … 20 17 if (!GetImage (&Ximage, &Nimage)) return (FALSE); 21 18 22 type = ptype[0];19 type = KII_OVERLAY_BOX; 23 20 if ((N = get_argument (argc, argv, "-type"))) { 24 21 remove_argument (N, &argc, argv); 25 for (i = 0; i < NPTYPE; i++) { 26 if (!strcasecmp (argv[N], ptype[i])) { 27 type = ptype[i]; 28 break; 29 } 30 } 31 if (i == NPTYPE) { 22 type = KiiOverlayTypeByName (argv[N]); 23 remove_argument (N, &argc, argv); 24 if (!type) { 32 25 fprintf (stderr, "unknown Kii point type %s\n", argv[N]); 33 26 return (FALSE); 34 27 } 35 remove_argument (N, &argc, argv);36 28 } 37 29 … … 48 40 } 49 41 50 if (!SelectOverlay (argv[1], &n)) return (FALSE); 42 if (type == KII_OVERLAY_CIRCLE) { 43 dx = dy = size / 2; 44 } else { 45 dx = dy = size; 46 } 51 47 52 48 if ((vecx = SelectVector (argv[2], OLDVECTOR, TRUE)) == NULL) return (FALSE); … … 57 53 } 58 54 59 ALLOCATE (buffer, char, 65536); /* space for 512 lines of 128 bytes */ 60 bzero (buffer, 65536); 61 Nline = 0; 55 Noverlay = vecx[0].Nelements; 56 ALLOCATE (overlay, KiiOverlay, Noverlay); 62 57 63 SendGraphCommand (Ximage, 4, "LOAD"); 64 SendGraphCommand (Ximage, 16, "OVER %9d ", n); 65 66 if (type == ptype[2]) { 67 dx = dy = size / 2; 68 } else { 69 dx = dy = size; 70 } 71 for (i = 0; i < vecx[0].Nelements; i++) { 72 snprintf (&buffer[Nline*128], 128, "%15s %20.10f %20.10f %20.10f %20.10f ", type, 73 vecx[0].elements[i]+0.5, vecy[0].elements[i]+0.5, dx, dy); 74 Nline ++; 75 if (Nline == 512) { 76 SendGraphCommand (Ximage, 16, "NLINES %7d ", Nline); 77 write (Ximage, buffer, Nline*128); 78 bzero (buffer, 65536); 79 Nline = 0; 80 } 58 for (i = 0; i < Noverlay; i++) { 59 overlay[i].type = type; 60 overlay[i].text = NULL; 61 overlay[i].x = vecx[0].elements[i]+0.5; 62 overlay[i].y = vecy[0].elements[i]+0.5; 63 overlay[i].dx = dx; 64 overlay[i].dy = dy; 81 65 } 82 66 83 SendGraphCommand (Ximage, 16, "NLINES %7d ", Nline); 84 write (Ximage, buffer, Nline*128); 85 SendGraphCommand (Ximage, 16, "DONE"); 86 87 free (buffer); 67 KiiLoadOverlay (Ximage, overlay, Noverlay, argv[1]); 68 free (overlay); 88 69 return (TRUE); 89 70 }
Note:
See TracChangeset
for help on using the changeset viewer.
