Commit a0195239 authored by saeed's avatar saeed

bug is fixed

parent 0a71c517
......@@ -193,6 +193,7 @@ static void drawonscreen_expose(struct Vis *vis,struct dsp_field *dspf, struct o
ximage = XCreateImage(vis->dsp, vis->visual, 24, ZPixmap, 0, dspf->image32, vis->w, vis->h, 32, 0);
XPutImage(vis->dsp, pixmap, vis->gc, ximage, 0, 0, 0, 0, vis->w, vis->h);
XSetForeground(vis->dsp, vis->gc, stn_color);
printf("%d obsp->npy \n",obsp->npy);
for (int i=0; i< obsp->npy;++i){
if (obsp->iindex[i] != -1 && obsp->jindex[i] != -1){
struct Index index = map(obsp->iindex[i], obsp->jindex[i], vis->w, vis->h, NX, NY);
......@@ -522,9 +523,9 @@ static int handle_keyboard(struct Vis *vis, struct Vis *vis1,XEvent *e, struct o
obsp->icur--;
odbinfo_set.icur--;
printf("%d down icur \n",stn_set.icur);
if (stn_set.icur < 0) stn_set.icur = 0;
if (obsp->icur < 0) obsp->icur = 0;
if (odbinfo_set.icur < 0) odbinfo_set.icur = 0;
if (stn_set.icur < 0) stn_set.icur = stn_set.nt -1;
if (obsp->icur < 0) obsp->icur = obsp->nt -1;
if (odbinfo_set.icur < 0) odbinfo_set.icur = odbinfo_set.nt -1;
drawonscreen_changeodb(vis,e,obsp,scdim);
odbinfo_onotherwindow(vis1, &odbinfo_set);
}
......
......@@ -256,20 +256,22 @@ static struct obs_set fill_obs_set(float *lonm, float *latm, int nx, int ny){
result.obs[k] = (struct obs *)malloc(sizeof(struct obs));
result.obs[k]->iindex = (int *)malloc(sizeof(int) * stn_set.stns[k]->ns);
result.obs[k]->jindex = (int *)malloc(sizeof(int) *stn_set.stns[k]->ns);
result.obs[k]->npy = stn_set.stns[k]->ns;
result.obs[k]->npx = stn_set.stns[k]->ns;
int im = -1;
for (int i=0; i < stn_set.stns[k]->ns;++i){
im = -1;
for(int j=0; j < ny;++j){
if (stn_set.stns[k]->lat >= latm[j]) im = j;
if ((stn_set.stns[k] + i)->lat >= latm[j]) im = j;
}
result.obs[k]->jindex[i] = im;
}
for (int i=0; i <stn_set.stns[k]->ns;++i){
im = -1;
for(int j=0; j < nx;++j){
if (stn_set.stns[k]->lon >= lonm[j]) im = j;
if ((stn_set.stns[k] +i)->lon >= lonm[j]) im = j;
}
result.obs[k]->iindex[i] = im;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment