Skip to content
Snippets Groups Projects
Commit c99b077a authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

Fix small bug for multi-timestep strings in views

parent 8848d77a
No related branches found
No related tags found
No related merge requests found
// $Id: Graph2D.cpp,v 1.20 2002-10-12 19:41:13 geuzaine Exp $
// $Id: Graph2D.cpp,v 1.21 2002-10-19 18:56:12 geuzaine Exp $
//
// Copyright (C) 1997 - 2002 C. Geuzaine, J.-F. Remacle
//
......@@ -390,18 +390,18 @@ void Draw_Graph2D(void){
}
}
// 2D text strings
// Text strings
// T2(x,y,style){"str","str",...};
// T2D : x,y,style,index,x,y,style,index,...
// T2C : string\0,string\0,string\0,string\0,...
// Parser format: T2(x,y,style){"str","str",...};
// T2D list of double : x,y,style,index,x,y,style,index,...
// T2C list of chars : string\0,string\0,string\0,string\0,...
// T3(x,y,z,style){"str","str",...};
// T3D : x,y,z,style,index,x,y,z,style,index,...
// T3C : string\0,string\0,string\0,string\0,...
// Parser format: T3(x,y,z,style){"str","str",...};
// T3D list of double: x,y,z,style,index,x,y,z,style,index,...
// T3C list of chars: string\0,string\0,string\0,string\0,...
void Draw_Text2D3D(int dim, int timestep, int nb, List_T *td, List_T *tc){
int j,k,l,nbd,index,stop;
int j,k,l,nbd,index,nbchar;
char *c;
double *d1, *d2, style, x, y, z;
......@@ -409,6 +409,19 @@ void Draw_Text2D3D(int dim, int timestep, int nb, List_T *td, List_T *tc){
else if(dim==3) nbd=5;
else return;
#if 0 //debug
if(nb){
for(j=0; j<List_Nbr(tc); j++){
c = (char*)List_Pointer(tc, j);
if(*c == '\0')
printf("|");
else
printf("%c", *c);
}
printf("\n");
}
#endif
for(j=0; j<nb; j++){
d1 = (double*)List_Pointer(td, j*nbd);
d2 = (double*)List_Pointer_Test(td, (j+1)*nbd);
......@@ -420,8 +433,8 @@ void Draw_Text2D3D(int dim, int timestep, int nb, List_T *td, List_T *tc){
z = 0.;
style = d1[2];
index = (int)d1[3];
if(d2) stop=(int)d2[3];
else stop=List_Nbr(tc)-index;
if(d2) nbchar=(int)d2[3]-index;
else nbchar=List_Nbr(tc)-index;
}
else{
x = d1[0];
......@@ -429,16 +442,16 @@ void Draw_Text2D3D(int dim, int timestep, int nb, List_T *td, List_T *tc){
z = d1[2];
style = d1[3];
index = (int)d1[4];
if(d2) stop=(int)d2[4];
else stop=List_Nbr(tc)-index;
if(d2) nbchar=(int)d2[4]-index;
else nbchar=List_Nbr(tc)-index;
}
glRasterPos3d(x,y,z);
c = (char*)List_Pointer(tc, index);
k=l=0;
while(k<stop && l!=timestep){
while(k<nbchar && l!=timestep){
if(c[k++]=='\0') l++;
}
if(k<stop && l==timestep)
if(k<nbchar && l==timestep)
Draw_String(&c[k]);
else
Draw_String(c);
......
......@@ -52,7 +52,7 @@ View[2].AutoPosition = 0;
View[2].PositionX = 85;
View[2].PositionY = 50;
View[2].Width = 200;
View[2].Height = 150;
View[2].Height = 130;
View[3].Type = 3;
View[3].RangeType = 2;
......
......@@ -103,4 +103,9 @@ SP(0.05,0.3,0){0,0,0,0,0};
};
View "e" {
SP(0.05,0.2,0){1939799.2,-3879808.7,1939891.9,1939888.6,-3880387.9};
T2(10,-12,0){"File created on Fri Oct 18 23:50:20 2002"};
T2(220,-12,0){"First time step", "Second time step", "Third time step",
"Fourth time step", "Last time step!"};
T3(0.1,0,0,0){"This is a 3D string, defined in model coordinates"};
T3(0.1,0.3,0,0){"Test 1","Test 2","Test 3","Test 4","Test 5","Test 6","Test 7"};
};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment