diff --git a/Common/Context.h b/Common/Context.h index a79fb84706fb00c6374a0174ec1d8606a95edeee..5d0c21d7297d31e73451aea83744b1c2e06260af 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -91,8 +91,8 @@ public : int db; // double buffer? int ortho; // orthogonal projection? - int draw_bbox; // always draw the bounding boxes? - int fast_redraw; // only draw the bbox when rotating/panning the model? + int draw_bbox, draw_rotation_center; // draw the bounding boxes and the rot center? + int fast_redraw; // draw simplified model during user interaction int small_axes, small_axes_size, small_axes_pos[2]; // small axes int axes, axes_auto_position, axes_tics[3]; // large axes double axes_position[6]; diff --git a/Common/Options.cpp b/Common/Options.cpp index f0d0082164d1e7793772c64780ff16947119334f..2c1fcd26a482ecebdcee3791e9bf542a93b9a889 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.307 2006-08-27 16:14:46 geuzaine Exp $ +// $Id: Options.cpp,v 1.308 2006-08-27 23:10:35 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -133,6 +133,7 @@ void Init_Options(int num) CTX.polygon_offset = 0; CTX.printing = 0; CTX.mesh_timer[0] = CTX.mesh_timer[1] = CTX.mesh_timer[2] = 0.; + CTX.draw_rotation_center = 0; CTX.mesh.draw = 1; CTX.post.draw = 1; CTX.post.list = NULL; diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 4197ec044bc83f4921a823429adc33f3cc237327..cdc4db20fc889035031f9597703e7d5bfa495fca 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.454 2006-08-27 16:14:46 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.455 2006-08-27 23:10:35 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -958,7 +958,10 @@ void general_options_ok_cb(CALLBACK_ARGS) } if(data){ char *name = (char*)data; - if(!strcmp(name, "light_value")){ + if(!strcmp(name, "rotation_center_coord")){ + CTX.draw_rotation_center = 1; + } + else if(!strcmp(name, "light_value")){ double x, y, z; x = WID->gen_value[2]->value(); y = WID->gen_value[3]->value(); @@ -1049,6 +1052,7 @@ void general_options_ok_cb(CALLBACK_ARGS) CTX.post.draw = CTX.mesh.draw = 0; Draw(); CTX.post.draw = CTX.mesh.draw = 1; + CTX.draw_rotation_center = 0; } void general_arrow_param_cb(CALLBACK_ARGS) diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 27eeb22910d88c67a564278d8041904135e3957a..bb1a9206228c6a5ec115637d8cf57f09c4bfc59d 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.544 2006-08-27 16:14:46 geuzaine Exp $ +// $Id: GUI.cpp,v 1.545 2006-08-27 23:10:35 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -1757,12 +1757,12 @@ void GUI::create_option_window() gen_push_butt[0]->callback(general_options_rotation_center_select_cb); gen_value[8] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 8 * BH, IW / 3, BH); - gen_value[8]->callback(general_options_ok_cb); + gen_value[8]->callback(general_options_ok_cb, (void*)"rotation_center_coord"); gen_value[9] = new Fl_Value_Input(L + 2 * WB + IW / 3, 2 * WB + 8 * BH, IW / 3, BH); - gen_value[9]->callback(general_options_ok_cb); + gen_value[9]->callback(general_options_ok_cb, (void*)"rotation_center_coord"); gen_value[10] = new Fl_Value_Input(L + 2 * WB + 2 * IW / 3, 2 * WB + 8 * BH, IW / 3, BH, "Rotation center"); gen_value[10]->align(FL_ALIGN_RIGHT); - gen_value[10]->callback(general_options_ok_cb); + gen_value[10]->callback(general_options_ok_cb, (void*)"rotation_center_coord"); o->end(); } diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp index 5d0380b5e1d78c8c9325a2218ae92cbf78c4067a..f60576457716924b625d90d97a24c7757f6ca725 100644 --- a/Fltk/Opengl_Window.cpp +++ b/Fltk/Opengl_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl_Window.cpp,v 1.69 2006-08-25 23:52:56 geuzaine Exp $ +// $Id: Opengl_Window.cpp,v 1.70 2006-08-27 23:10:36 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -273,6 +273,7 @@ int Opengl_Window::handle(int event) case FL_RELEASE: curr.set(); + CTX.draw_rotation_center = 0; if(!LassoMode) { CTX.mesh.draw = 1; CTX.post.draw = 1; @@ -318,6 +319,7 @@ int Opengl_Window::handle(int event) CTX.t[1] += (curr.wnr[1] - click.wnr[1]); CTX.t[2] = 0.; } + CTX.draw_rotation_center = 1; if(CTX.fast_redraw) { CTX.mesh.draw = 0; CTX.post.draw = 0; diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index 8ecd1c2fe8f5ae27afcbbbfa7ebd7069ecdd7877..132bc03122e8d538120289810d539aeec8110832 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.117 2006-08-20 14:12:40 geuzaine Exp $ +// $Id: Geom.cpp,v 1.118 2006-08-27 23:10:36 geuzaine Exp $ // // Copyright (C) 1997-2006 C. Geuzaine, J.-F. Remacle // @@ -445,16 +445,24 @@ void Draw_Geom() glColor4ubv((GLubyte *) & CTX.color.axes); glLineWidth(CTX.line_width); gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor); - if(!CTX.axes_auto_position){ + if(CTX.axes_auto_position){ + double bb[6] = {CTX.min[0], CTX.max[0], CTX.min[1], + CTX.max[1], CTX.min[2], CTX.max[2]}; + Draw_Axes(CTX.axes, CTX.axes_tics, CTX.axes_format, CTX.axes_label, bb); + } + else{ Draw_Axes(CTX.axes, CTX.axes_tics, CTX.axes_format, CTX.axes_label, CTX.axes_position); } - else if(geometryExists){ - double bb[6] = {CTX.min[0], CTX.max[0], - CTX.min[1], CTX.max[1], - CTX.min[2], CTX.max[2]}; - Draw_Axes(CTX.axes, CTX.axes_tics, CTX.axes_format, CTX.axes_label, bb); - } } -} + if(CTX.draw_rotation_center){ + glColor4ubv((GLubyte *) & CTX.color.fg); + if(CTX.rotation_center_cg) + Draw_Sphere(5, CTX.cg[0], CTX.cg[1], CTX.cg[2], CTX.geom.light); + else + Draw_Sphere(5, CTX.rotation_center[0], CTX.rotation_center[1], + CTX.rotation_center[2], CTX.geom.light); + } + +} diff --git a/doc/TODO b/doc/TODO index bd5eba5ef2e13a4110e9e7ed33932079e61acacf..4107a08864b298aa1eb0b02071c36022f43a2e8d 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,4 +1,9 @@ -$Id: TODO,v 1.17 2006-08-26 22:30:06 geuzaine Exp $ +$Id: TODO,v 1.18 2006-08-27 23:10:36 geuzaine Exp $ + +******************************************************************** + +should implement a better algo to determine which axes to draw +(cf. mathematica or qwt3dplot) ********************************************************************