diff --git a/Common/Context.h b/Common/Context.h index da82dddd232e0133ec062fc3db7d83aebe6ae3c5..7933a761dc2ae866d22daab443ee3b8378ae53d8 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -103,7 +103,7 @@ public : 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 + int axes, axes_auto_position, axes_tics[3],axes_mikado; // large axes double axes_position[6]; char axes_label[3][256], axes_format[3][256]; int threads, threads_lock; // threads?, lock (should be a mutex...) diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 7bfec2f839e37b159db2be520ab9dd89349d9536..d12f23bda8cd97fad3535d635f199eb6a1a708a5 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -15,8 +15,7 @@ // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 -// USA. +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA. // // Please report all bugs and problems to <gmsh@geuz.org>. @@ -449,6 +448,8 @@ StringXNumber GeneralOptions_Number[] = { "Relative radius of arrow stem" }, { F|O, "Axes" , opt_general_axes , 0. , "Axes (0=none, 1=simple axes, 2=box, 3=full grid, 4=open grid, 5=ruler)" }, + { F|O, "AxesMikado" , opt_general_axes_mikado , 0. , + "Mikado axes style" }, { F|O, "AxesAutoPosition" , opt_general_axes_auto_position , 1. , "Position the axes automatically" }, { F|O, "AxesMaxX" , opt_general_axes_xmax , 1. , @@ -1158,6 +1159,8 @@ StringXNumber ViewOptions_Number[] = { "Position the scale or 2D plot automatically" }, { F|O, "Axes" , opt_view_axes , 0 , "Axes (0=none, 1=simple axes, 2=box, 3=full grid, 4=open grid, 5=ruler)" }, + { F|O, "AxesMikado" , opt_view_axes_mikado , 0. , + "Mikado axes style" }, { F|O, "AxesAutoPosition" , opt_view_axes_auto_position , 1. , "Position the axes automatically" }, { F|O, "AxesMaxX" , opt_view_axes_xmax , 1. , diff --git a/Common/Options.cpp b/Common/Options.cpp index 63dc290b8c1404663d934fc311d8cf07e4fea921..90ea3c502e0837e5db9bf7e46299c8a3522f06e4 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.372 2008-01-08 12:05:45 geuzaine Exp $ +// $Id: Options.cpp,v 1.373 2008-01-11 13:56:21 remacle Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -2933,6 +2933,19 @@ double opt_general_axes(OPT_ARGS_NUM) return CTX.axes; } +double opt_general_axes_mikado(OPT_ARGS_NUM){ + if(action & GMSH_SET) { + CTX.axes_mikado = (int)val; + } +/*#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)) { + WID->view_butt[25]->value(opt->AxesAutoPosition); + activate_cb(NULL, (void*)"view_axes_auto_3d"); + } +#endif*/ + return CTX.axes_mikado; +} + double opt_general_axes_auto_position(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -6060,6 +6073,20 @@ double opt_view_axes(OPT_ARGS_NUM) return opt->Axes; } +double opt_view_axes_mikado(OPT_ARGS_NUM){ + GET_VIEW(0.); + if(action & GMSH_SET) { + opt->AxesMikado = (int)val; + } +/*#if defined(HAVE_FLTK) + if(_gui_action_valid(action, num)) { + WID->view_butt[25]->value(opt->AxesAutoPosition); + activate_cb(NULL, (void*)"view_axes_auto_3d"); + } +#endif*/ + return opt->AxesMikado; +} + double opt_view_axes_auto_position(OPT_ARGS_NUM) { GET_VIEW(0.); diff --git a/Common/Options.h b/Common/Options.h index f4daf5710669d8196974e901183ea268ae634d7a..0de824f8824e442cfcf6c6121e21a48aa7343fdb 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -305,6 +305,7 @@ double opt_general_ymax(OPT_ARGS_NUM); double opt_general_zmin(OPT_ARGS_NUM); double opt_general_zmax(OPT_ARGS_NUM); double opt_general_axes(OPT_ARGS_NUM); +double opt_general_axes_mikado(OPT_ARGS_NUM); double opt_general_axes_auto_position(OPT_ARGS_NUM); double opt_general_axes_xmin(OPT_ARGS_NUM); double opt_general_axes_xmax(OPT_ARGS_NUM); @@ -594,6 +595,7 @@ double opt_view_gen_raise_factor(OPT_ARGS_NUM); double opt_view_use_gen_raise(OPT_ARGS_NUM); double opt_view_type(OPT_ARGS_NUM); double opt_view_axes(OPT_ARGS_NUM); +double opt_view_axes_mikado(OPT_ARGS_NUM); double opt_view_axes_auto_position(OPT_ARGS_NUM); double opt_view_axes_tics0(OPT_ARGS_NUM); double opt_view_axes_tics1(OPT_ARGS_NUM); diff --git a/Graphics/Draw.h b/Graphics/Draw.h index ba6c7cf7bdd521b10d000ad7b967ecf4bfb4d064..0affcced4d789f59a0b4580d20f1985eaccd53b9 100644 --- a/Graphics/Draw.h +++ b/Graphics/Draw.h @@ -71,9 +71,9 @@ void Draw_PlaneInBoundingBox(double xmin, double ymin, double zmin, double a, double b, double c, double d, int shade=0); void Draw_SmallAxes(); void Draw_Axes(int mode, int tics[3], char format[3][256], char label[3][256], - double bbox[6]); + double bbox[6],int mikado); void Draw_Axes(int mode, int tics[3], char format[3][256], char label[3][256], - SBoundingBox3d &bbox); + SBoundingBox3d &bbox,int mikado); #endif diff --git a/Graphics/Entity.cpp b/Graphics/Entity.cpp index 3dac1cfa8200656e58971420f10648da7894bb4c..184bb88e9cdd6dde41cf75347fa6d95f12caaa84 100644 --- a/Graphics/Entity.cpp +++ b/Graphics/Entity.cpp @@ -1,4 +1,4 @@ -// $Id: Entity.cpp,v 1.78 2007-09-18 16:26:02 geuzaine Exp $ +// $Id: Entity.cpp,v 1.79 2008-01-11 13:56:22 remacle Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -621,7 +621,7 @@ void Draw_SmallAxes() } int Draw_Tics(int comp, int n, char *format, char *label, - double p1[3], double p2[3], double perp[3]) + double p1[3], double p2[3], double perp[3],int mikado) { // draws n tic marks (in direction perp) and labels along the line p1->p2 @@ -664,7 +664,7 @@ int Draw_Tics(int comp, int n, char *format, char *label, glVertex3d(q[0], q[1], q[2]); glEnd(); - if(i < n-1){ + if(i < n-1 && !mikado){ for(int j = 1; j < 10; j++){ double dd = d + j * step/10.; double pp[3] = { p1[0]+t[0]*dd, p1[1]+t[1]*dd, p1[2]+t[2]*dd }; @@ -738,16 +738,39 @@ void Draw_GridStipple(int n1, int n2, double p1[3], double p2[3], double p3[3]) } void Draw_Axes(int mode, int tics[3], char format[3][256], char label[3][256], - SBoundingBox3d &bb) + SBoundingBox3d &bb, int mikado) { double bbox[6] = {bb.min().x(), bb.max().x(), bb.min().y(), bb.max().y(), bb.min().z(), bb.max().z()}; - Draw_Axes(mode, tics, format, label, bbox); + Draw_Axes(mode, tics, format, label, bbox, mikado); +} + +void Draw_Axe(double xmin,double ymin, double zmin,double xmax,double ymax,double zmax,int nticks,int mikado){ + if(mikado){ + nticks=(nticks-1)*mikado; + if(nticks<1)nticks=1; + double dd[3]={(xmax-xmin)/nticks,(ymax-ymin)/nticks,(zmax-zmin)/nticks}; + double axe_color[4]; + glGetDoublev(GL_CURRENT_COLOR,axe_color); + for(int i=1;i<=nticks;i++){ + if(i%2)glColor4dv(axe_color); + else glColor3f(1,1,1); + double cx[2]={xmin+(i-1)*dd[0],xmin+i*dd[0]}; + double cy[2]={ymin+(i-1)*dd[1],ymin+i*dd[1]}; + double cz[2]={zmin+(i-1)*dd[2],zmin+i*dd[2]}; + Draw_Cylinder(3.5,cx,cy,cz,1); + } + glColor4dv(axe_color); + }else{ + glBegin(GL_LINES); + glVertex3d(xmin,ymin,zmin); glVertex3d(xmax,ymax,zmax); + glEnd(); + } } void Draw_Axes(int mode, int tics[3], char format[3][256], char label[3][256], - double bb[6]) + double bb[6], int mikado) { // mode 0: nothing // 1: axes @@ -765,9 +788,6 @@ void Draw_Axes(int mode, int tics[3], char format[3][256], char label[3][256], double orig[3] = {xmin, ymin, zmin}; if(mode == 5){ // draw ruler from xyz_min to xyz_max - glBegin(GL_LINES); - glVertex3d(xmin, ymin, zmin); glVertex3d(xmax, ymax, zmax); - glEnd(); double end[3] = {xmax, ymax, zmax}; double dir[3] = {xmax-xmin, ymax-ymin, zmax-zmin}; double perp[3]; @@ -778,42 +798,42 @@ void Draw_Axes(int mode, int tics[3], char format[3][256], char label[3][256], else{ perp[0] = 0.; perp[1] = dir[2]; perp[2] = -dir[1]; } - Draw_Tics(-1, tics[0], format[0], label[0], orig, end, perp); + Draw_Tics(-1, tics[0], format[0], label[0], orig, end, perp,mikado); + Draw_Axe(xmin,ymin,zmin,xmax,ymax,zmax,tics[0],mikado); return; } - - glBegin(GL_LINES); - // 3 axes - glVertex3d(xmin, ymin, zmin); glVertex3d(xmax, ymin, zmin); - glVertex3d(xmin, ymin, zmin); glVertex3d(xmin, ymax, zmin); - glVertex3d(xmin, ymin, zmin); glVertex3d(xmin, ymin, zmax); - // open box - if(mode > 1){ - glVertex3d(xmin, ymax, zmin); glVertex3d(xmax, ymax, zmin); - glVertex3d(xmax, ymin, zmin); glVertex3d(xmax, ymax, zmin); - glVertex3d(xmin, ymin, zmax); glVertex3d(xmax, ymin, zmax); - glVertex3d(xmax, ymin, zmin); glVertex3d(xmax, ymin, zmax); - glVertex3d(xmin, ymin, zmax); glVertex3d(xmin, ymax, zmax); - glVertex3d(xmin, ymax, zmin); glVertex3d(xmin, ymax, zmax); - } - // closed box - if(mode == 2 || mode == 3){ - glVertex3d(xmax, ymax, zmax); glVertex3d(xmin, ymax, zmax); - glVertex3d(xmax, ymax, zmax); glVertex3d(xmax, ymin, zmax); - glVertex3d(xmax, ymax, zmax); glVertex3d(xmax, ymax, zmin); - } - glEnd(); - double xx[3] = {xmax, ymin, zmin}; double yy[3] = {xmin, ymax, zmin}; double zz[3] = {xmin, ymin, zmax}; double dxm[3] = {0., (ymin != ymax) ? -1. : 0., (zmin != zmax) ? -1. : 0.}; double dym[3] = {(xmin != xmax) ? -1. : 0., 0., (zmin != zmax) ? -1. : 0.}; double dzm[3] = {(xmin != xmax) ? -1. : 0., (ymin != ymax) ? -1. : 0., 0.}; + + + int nx = (xmin != xmax) ? Draw_Tics(0, tics[0], format[0], label[0], orig, xx, dxm,mikado) : 0; + int ny = (ymin != ymax) ? Draw_Tics(1, tics[1], format[1], label[1], orig, yy, dym, mikado) : 0; + int nz = (zmin != zmax) ? Draw_Tics(2, tics[2], format[2], label[2], orig, zz, dzm,mikado) : 0; + + Draw_Axe(xmin, ymin, zmin, xmax, ymin, zmin, nx, mikado); + Draw_Axe(xmin, ymin, zmin, xmin, ymax, zmin, ny, mikado); + Draw_Axe(xmin, ymin, zmin, xmin, ymin, zmax, nz, mikado); + + // open box + if(mode > 1){ + Draw_Axe(xmin, ymax, zmin, xmax, ymax, zmin, nx, mikado); + Draw_Axe(xmax, ymin, zmin, xmax, ymax, zmin, ny, mikado); + Draw_Axe(xmax, ymin, zmin, xmax, ymin, zmax, nz, mikado); + Draw_Axe(xmin, ymin, zmax, xmax, ymin, zmax, nx, mikado); + Draw_Axe(xmin, ymin, zmax, xmin, ymax, zmax, ny, mikado); + Draw_Axe(xmin, ymax, zmin, xmin, ymax, zmax, nz, mikado); + } - int nx = (xmin != xmax) ? Draw_Tics(0, tics[0], format[0], label[0], orig, xx, dxm) : 0; - int ny = (ymin != ymax) ? Draw_Tics(1, tics[1], format[1], label[1], orig, yy, dym) : 0; - int nz = (zmin != zmax) ? Draw_Tics(2, tics[2], format[2], label[2], orig, zz, dzm) : 0; + // closed box + if(mode == 2 || mode == 3){ + Draw_Axe(xmin, ymax, zmax, xmax, ymax, zmax, nx, mikado); + Draw_Axe(xmax, ymin, zmax, xmax, ymax, zmax, ny, mikado); + Draw_Axe(xmax, ymax, zmin, xmax, ymax, zmax, nz, mikado); + } if(mode > 2){ Draw_GridStipple(nx, ny, orig, xx, yy); diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index c3861658842e60dc3c9b18b62d68c9577dc3c33b..c81c42b1c2e842ba8813adaeac178f6c1a65043c 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.142 2007-11-21 16:45:20 geuzaine Exp $ +// $Id: Geom.cpp,v 1.143 2008-01-11 13:56:22 remacle Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -546,12 +546,12 @@ void Draw_Geom() gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor); if(!CTX.axes_auto_position){ Draw_Axes(CTX.axes, CTX.axes_tics, CTX.axes_format, CTX.axes_label, - CTX.axes_position); + CTX.axes_position,CTX.axes_mikado); } 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); + Draw_Axes(CTX.axes, CTX.axes_tics, CTX.axes_format, CTX.axes_label, bb,CTX.axes_mikado); } } diff --git a/Graphics/Post.cpp b/Graphics/Post.cpp index 71af2094b828cceae32b1cffebbf6272cf9ef122..e226e954a2750fd644a4ee9ba91298ed1b521bb7 100644 --- a/Graphics/Post.cpp +++ b/Graphics/Post.cpp @@ -1,4 +1,4 @@ -// $Id: Post.cpp,v 1.144 2008-01-10 14:56:54 remacle Exp $ +// $Id: Post.cpp,v 1.145 2008-01-11 13:56:22 remacle Exp $ // // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // @@ -1366,10 +1366,10 @@ class drawPView { gl2psLineWidth(CTX.line_width * CTX.print.eps_line_width_factor); if(!opt->AxesAutoPosition) Draw_Axes(opt->Axes, opt->AxesTics, opt->AxesFormat, opt->AxesLabel, - opt->AxesPosition); + opt->AxesPosition,opt->AxesMikado); else if(!opt->TmpBBox.empty()) Draw_Axes(opt->Axes, opt->AxesTics, opt->AxesFormat, opt->AxesLabel, - opt->TmpBBox); + opt->TmpBBox,opt->AxesMikado); } } diff --git a/Post/PViewOptions.h b/Post/PViewOptions.h index e7b9d948c445b32de2ceac4da35c26d233830cfc..f585a915c6155fccadb3ea2cbf43efc0288bc666 100644 --- a/Post/PViewOptions.h +++ b/Post/PViewOptions.h @@ -65,7 +65,7 @@ class PViewOptions { int Type; int Position[2], Size[2], AutoPosition; char Format[256]; - int Axes, AxesAutoPosition, AxesTics[3]; + int Axes, AxesAutoPosition,AxesMikado, AxesTics[3]; char AxesFormat[3][256], AxesLabel[3][256]; double AxesPosition[6]; double CustomMin, CustomMax, TmpMin, TmpMax, ExternalMin, ExternalMax;