Changeset 10866
- Timestamp:
- Jan 1, 2007, 11:03:41 AM (19 years ago)
- Location:
- trunk/psModules/src/extras
- Files:
-
- 2 edited
-
pmKapaPlots.c (modified) (6 diffs)
-
pmKapaPlots.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/extras/pmKapaPlots.c
r10849 r10866 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $10 * @date $Date: 200 6-12-29 18:29:12$9 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-01-01 21:03:41 $ 11 11 * 12 12 * Copyright 2006 Institute for Astronomy, University of Hawaii … … 22 22 // the top portion of this file defines plotting functions which use kapa for plotting. 23 23 // if kapa is not available, these functions are defined in the bottom portion as stubs 24 // which perform NOP and return false (XXX should this be true??)24 // which perform NOP and return false (XXX should this be 'true' ??) 25 25 26 26 # if (HAVE_KAPA) 27 # include <kapa.h>28 27 29 28 // XXX not thread safe (perhaps not needed) 30 29 // to make this thread safe, we could check the thread ID and tie to it 31 30 static int kapa_fd = -1; 31 32 32 int pmKapaOpen (bool showWindow) 33 33 { … … 56 56 } 57 57 58 bool pmKapaPlotVectorPair_AutoLimits_OpenGraph (int kapa, Graphdata *graphdata, psVector *xVec, psVector *yVec) 59 { 60 61 // set limits based on data values 62 graphdata->xmin = FLT_MAX; 63 graphdata->xmax = FLT_MIN; 64 graphdata->ymin = FLT_MAX; 65 graphdata->ymax = FLT_MIN; 66 for (int i = 0; i < xVec->n; i++) { 67 graphdata->xmin = PS_MIN (graphdata->xmin, xVec->data.F32[i]); 68 graphdata->xmax = PS_MAX (graphdata->xmax, xVec->data.F32[i]); 69 graphdata->ymin = PS_MIN (graphdata->ymin, yVec->data.F32[i]); 70 graphdata->ymax = PS_MAX (graphdata->ymax, yVec->data.F32[i]); 71 } 72 // add 5% to range 73 float range; 74 75 range = graphdata->xmax - graphdata->xmin; 76 graphdata->xmax += 0.05*range; 77 graphdata->xmin -= 0.05*range; 78 79 range = graphdata->ymax - graphdata->ymin; 80 graphdata->ymax += 0.05*range; 81 graphdata->ymin -= 0.05*range; 82 83 KapaSetLimits (kapa, graphdata); 84 KapaSetFont (kapa, "helvetica", 14); 85 KapaBox (kapa, graphdata); 86 87 KapaPrepPlot (kapa, xVec->n, graphdata); 88 KapaPlotVector (kapa, xVec->n, xVec->data.F32); 89 KapaPlotVector (kapa, yVec->n, yVec->data.F32); 90 return true; 91 } 92 58 93 bool pmKapaPlotVectorPair (psVector *xVec, psVector *yVec) 59 94 { … … 71 106 72 107 KapaInitGraph (&graphdata); 73 KapaClear (kapa, FALSE);108 KapaClear (kapa, TRUE); 74 109 75 110 // set limits based on data values … … 111 146 112 147 # else 148 # include "pmKapaPlots.h" 113 149 114 150 int pmKapaOpen () … … 127 163 } 128 164 165 bool pmKapaPlotVectorPair_AutoLimits_OpenGraph (int kapa, void *graphdata, psVector *xVec, psVector *yVec) 166 { 167 return false; 168 } 169 129 170 # endif -
trunk/psModules/src/extras/pmKapaPlots.h
r10849 r10866 7 7 * @author EAM, IfA 8 8 * 9 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $10 * @date $Date: 200 6-12-29 18:29:12$9 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 10 * @date $Date: 2007-01-01 21:03:41 $ 11 11 * 12 12 * Copyright 2006 Institute for Astronomy, University of Hawaii … … 21 21 bool pmKapaPlotVectorPair (psVector *xVec, psVector *yVec); 22 22 23 # if (HAVE_KAPA) 24 # include <kapa.h> 25 26 // yes, this is an absurd name... 27 bool pmKapaPlotVectorPair_AutoLimits_OpenGraph (int kapa, Graphdata *graphdata, psVector *xVec, psVector *yVec); 28 # else 29 30 bool pmKapaPlotVectorPair_AutoLimits_OpenGraph (int kapa, void *graphdata, psVector *xVec, psVector *yVec); 31 # endif 32 23 33 #endif // PM_KAPA_PLOTS_H
Note:
See TracChangeset
for help on using the changeset viewer.
