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

No commit message

No commit message
parent f1746313
No related branches found
No related tags found
No related merge requests found
...@@ -707,13 +707,13 @@ int drawContext::drawTics(drawContext *ctx, int comp, double n, std::string &for ...@@ -707,13 +707,13 @@ int drawContext::drawTics(drawContext *ctx, int comp, double n, std::string &for
char tmp[256]; char tmp[256];
// reduce number of vertical tics if not zoomed enough // reduce number of vertical tics if not zoomed enough
double ww = _width/(_right-_left)*_scale[0]; double ww = _width/(_right-_left)*_scale[0];
double hh = _height/(_top-_bottom)*_scale[0]; double hh = _height/(_top-_bottom)*_scale[0];
if(hh < 10 && comp == 1){ if(hh < 10 && comp == 1){
n = 2; n = 2;
} }
// draw n tics // draw n tics
double step = l / (double)(n - 1); double step = l / (double)(n - 1);
double value_step = value_l / (double)(n - 1); double value_step = value_l / (double)(n - 1);
...@@ -729,6 +729,17 @@ int drawContext::drawTics(drawContext *ctx, int comp, double n, std::string &for ...@@ -729,6 +729,17 @@ int drawContext::drawTics(drawContext *ctx, int comp, double n, std::string &for
value_p1[1] + value_t[1] * value_d, value_p1[1] + value_t[1] * value_d,
value_p1[2] + value_t[2] * value_d}; value_p1[2] + value_t[2] * value_d};
// draw tic labels
if(comp < 0) // display the length value (ruler-mode, starting at 0)
sprintf(tmp, format.c_str(), value_d);
else // display the coordinate value
sprintf(tmp, format.c_str(), value_p[comp]);
if(strlen(tmp)){
drawString lbl(tmp, 15 * _fontFactor);
lbl.draw(r[0], r[1], r[2], ww, hh);
}
GLfloat lines[] = { GLfloat lines[] = {
(float)p[0], (float)p[1], (float)p[2], (float)p[0], (float)p[1], (float)p[2],
(float)q[0], (float)q[1], (float)q[2] (float)q[0], (float)q[1], (float)q[2]
...@@ -744,17 +755,6 @@ int drawContext::drawTics(drawContext *ctx, int comp, double n, std::string &for ...@@ -744,17 +755,6 @@ int drawContext::drawTics(drawContext *ctx, int comp, double n, std::string &for
glDrawArrays(GL_LINES, 0, 2); glDrawArrays(GL_LINES, 0, 2);
glDisableClientState(GL_VERTEX_ARRAY); glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY); glDisableClientState(GL_COLOR_ARRAY);
// draw tic labels
if(comp < 0) // display the length value (ruler-mode, starting at 0)
sprintf(tmp, format.c_str(), value_d);
else // display the coordinate value
sprintf(tmp, format.c_str(), value_p[comp]);
if(strlen(tmp)){
drawString lbl(tmp, 15 * _fontFactor);
lbl.draw(r[0], r[1], r[2], ww, hh);
}
} }
return n; return n;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment