diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 7db86242896d88f1f6c7555046cf3907cfe28c47..abda78087d311868a364374685affe042a5ca682 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -1063,8 +1063,6 @@ StringXNumber ViewOptions_Number[] = { "Threshold angle below which normals are not smoothed" }, { F|O, "ArrowHeadRadius" , opt_view_arrow_head_radius , 0.12 , "Relative radius of arrow head" }, - { F|O, "ArrowLocation" , opt_view_arrow_location , DRAW_POST_LOCATE_COG , - "Arrow location (1=center of gravity, 2=node)" }, { F|O, "ArrowSize" , opt_view_arrow_size , 60. , "Display size of arrows (in pixels)" }, { F|O, "ArrowSizeProportional" , opt_view_arrow_size_proportional , 1. , @@ -1164,6 +1162,8 @@ StringXNumber ViewOptions_Number[] = { "Generalized raise amplification factor" }, { F|O, "GeneralizedRaiseView" , opt_view_gen_raise_view , -1. , "Index of the view used for generalized raise (-1=self)" }, + { F|O, "GlyphLocation" , opt_view_glyph_location , DRAW_POST_LOCATE_COG , + "Glyph (arrow, number, etc.) location (1=center of gravity, 2=node)" }, // for backward compatibility: { F, "Grid" , opt_view_axes , 0 , "Grid mode (this option is deprecated: use View.Axes instead)" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index cac496a4d3403112c625ca874f03896b993e6298..0e8042323351174afcded781d679480339cf7b36 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.239 2005-04-04 19:17:31 geuzaine Exp $ +// $Id: Options.cpp,v 1.240 2005-04-06 16:30:51 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -6102,15 +6102,15 @@ double opt_view_vector_type(OPT_ARGS_NUM) return v->VectorType; } -double opt_view_arrow_location(OPT_ARGS_NUM) +double opt_view_glyph_location(OPT_ARGS_NUM) { GET_VIEW(0.); if(action & GMSH_SET) { - v->ArrowLocation = (int)val; + v->GlyphLocation = (int)val; } #if defined(HAVE_FLTK) if(_gui_action_valid(action, num)) { - switch (v->ArrowLocation) { + switch (v->GlyphLocation) { case DRAW_POST_LOCATE_VERTEX: WID->view_choice[3]->value(1); break; @@ -6121,7 +6121,7 @@ double opt_view_arrow_location(OPT_ARGS_NUM) } } #endif - return v->ArrowLocation; + return v->GlyphLocation; } double opt_view_point_size(OPT_ARGS_NUM) diff --git a/Common/Options.h b/Common/Options.h index 7082294d846cb124d1a0f76497872645f73e57aa..99abd3809afa4c56956233912f4d378278977419 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -591,7 +591,7 @@ double opt_view_scale_type(OPT_ARGS_NUM); double opt_view_tensor_type(OPT_ARGS_NUM); double opt_view_range_type(OPT_ARGS_NUM); double opt_view_vector_type(OPT_ARGS_NUM); -double opt_view_arrow_location(OPT_ARGS_NUM); +double opt_view_glyph_location(OPT_ARGS_NUM); double opt_view_point_size(OPT_ARGS_NUM); double opt_view_line_width(OPT_ARGS_NUM); double opt_view_point_type(OPT_ARGS_NUM); diff --git a/Common/Views.cpp b/Common/Views.cpp index 26c986c6dadc6b9f34851e0406c89b3198fddb2a..b93498eb993edeb9590ca25ff434f8bd2f15e43c 100644 --- a/Common/Views.cpp +++ b/Common/Views.cpp @@ -1,4 +1,4 @@ -// $Id: Views.cpp,v 1.172 2005-04-05 05:56:48 geuzaine Exp $ +// $Id: Views.cpp,v 1.173 2005-04-06 16:30:52 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -651,7 +651,7 @@ void CopyViewOptions(Post_View * src, Post_View * dest) dest->ScaleType = src->ScaleType; dest->RangeType = src->RangeType; dest->VectorType = src->VectorType; - dest->ArrowLocation = src->ArrowLocation; + dest->GlyphLocation = src->GlyphLocation; dest->TensorType = src->TensorType; dest->TimeStep = src->TimeStep; dest->PointSize = src->PointSize; diff --git a/Common/Views.h b/Common/Views.h index dfcfec547f22a859e9f89ab9994211c0ed8864ab..cf608c46512787f0f23e32c8698104f66579d518 100644 --- a/Common/Views.h +++ b/Common/Views.h @@ -89,7 +89,7 @@ class Post_View{ int SaturateValues, FakeTransparency; int ShowElement, ShowTime, ShowScale; int ScaleType, RangeType; - int VectorType, TensorType, ArrowLocation; + int VectorType, TensorType, GlyphLocation; int TimeStep; int DrawStrings; int DrawPoints, DrawLines, DrawTriangles, DrawQuadrangles; @@ -171,7 +171,7 @@ class Post_View{ #define DRAW_POST_ARROW3D 4 #define DRAW_POST_DISPLACEMENT 5 -// ArrowLocation +// GlyphLocation #define DRAW_POST_LOCATE_COG 1 #define DRAW_POST_LOCATE_VERTEX 2 diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 6b6758751be810399a634b8937b5222d5a6c29a3..5d3b1af4ea63353c4a155638ced78c7e0123e353 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.350 2005-04-01 15:48:14 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.351 2005-04-06 16:30:52 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -3514,7 +3514,7 @@ void view_options_ok_cb(CALLBACK_ARGS) double point_type = opt_view_point_type(current, GMSH_GET, 0); double line_type = opt_view_line_type(current, GMSH_GET, 0); double vector_type = opt_view_vector_type(current, GMSH_GET, 0); - double arrow_location = opt_view_arrow_location(current, GMSH_GET, 0); + double glyph_location = opt_view_glyph_location(current, GMSH_GET, 0); //double tensor_type = opt_view_tensor_type(current, GMSH_GET, 0); double range_type = opt_view_range_type(current, GMSH_GET, 0); double axes = opt_view_axes(current, GMSH_GET, 0); @@ -3696,8 +3696,8 @@ void view_options_ok_cb(CALLBACK_ARGS) val = DRAW_POST_LOCATE_VERTEX; break; } - if(force || (val != arrow_location)) - opt_view_arrow_location(i, GMSH_SET, val); + if(force || (val != glyph_location)) + opt_view_glyph_location(i, GMSH_SET, val); // switch (WID->view_choice[4]->value()) { // case 0: diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index a2015ecebc085c7b557ba731e88ee8bc5cc144df..dbe765eee363181d970e6fda38d39b45da6c9175 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.436 2005-03-26 04:09:15 geuzaine Exp $ +// $Id: GUI.cpp,v 1.437 2005-04-06 16:30:52 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -2919,7 +2919,7 @@ void GUI::create_option_window() view_value[62]->align(FL_ALIGN_RIGHT); { - view_vector = new Fl_Group(L + 2 * WB, 2 * WB + 6 * BH, width - 2 * WB, 5 * BH, 0); + view_vector = new Fl_Group(L + 2 * WB, 2 * WB + 6 * BH, width - 2 * WB, 4 * BH, 0); static Fl_Menu_Item menu_vectype[] = { {"Line", 0, 0, 0}, @@ -2957,15 +2957,6 @@ void GUI::create_option_window() view_choice[10]->align(FL_ALIGN_RIGHT); view_choice[10]->add("Self"); - static Fl_Menu_Item menu_vecloc[] = { - {"Cell centered", 0, 0, 0}, - {"Vertex centered", 0, 0, 0}, - {0} - }; - view_choice[3] = new Fl_Choice(L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Arrow location"); - view_choice[3]->menu(menu_vecloc); - view_choice[3]->align(FL_ALIGN_RIGHT); - //static Fl_Menu_Item menu_tensor[] = { //{"Von-Mises", 0, 0, 0}, //{"Eigenvectors", 0, 0, 0}, //not implemented yet @@ -2976,6 +2967,15 @@ void GUI::create_option_window() //view_choice[4]->align(FL_ALIGN_RIGHT); view_vector->end(); + + static Fl_Menu_Item menu_vecloc[] = { + {"Barycenter", 0, 0, 0}, + {"Vertex", 0, 0, 0}, + {0} + }; + view_choice[3] = new Fl_Choice(L + 2 * WB, 2 * WB + 10 * BH, IW, BH, "Glyph location"); + view_choice[3]->menu(menu_vecloc); + view_choice[3]->align(FL_ALIGN_RIGHT); } o->end(); @@ -3229,7 +3229,7 @@ void GUI::update_view_window(int num) view_value[63]->maximum(val3); opt_view_external_view(num, GMSH_GUI, 0); - opt_view_arrow_location(num, GMSH_GUI, 0); + opt_view_glyph_location(num, GMSH_GUI, 0); //opt_view_tensor_type(num, GMSH_GUI, 0); opt_view_fake_transparency(num, GMSH_GUI, 0); diff --git a/Graphics/PostElement.cpp b/Graphics/PostElement.cpp index b152d619599969fef57d17ce1d2ee55a21f6fb6d..32d9a656bd7c5d899857af0d3d0301c3a1d51979 100644 --- a/Graphics/PostElement.cpp +++ b/Graphics/PostElement.cpp @@ -1,4 +1,4 @@ -// $Id: PostElement.cpp,v 1.63 2005-03-14 21:19:32 geuzaine Exp $ +// $Id: PostElement.cpp,v 1.64 2005-04-06 16:30:52 geuzaine Exp $ // // Copyright (C) 1997-2005 C. Geuzaine, J.-F. Remacle // @@ -276,12 +276,24 @@ void Draw_ScalarLine(Post_View * View, int preproNormals, } if(View->IntervalsType == DRAW_POST_NUMERIC) { - d = (Val[0] + Val[1]) / 2.; - if(d >= ValMin && d <= ValMax) { - PaletteContinuous(View, ValMin, ValMax, d); - sprintf(Num, View->Format, d); - glRasterPos3d((X[0] + X[1]) / 2., (Y[0] + Y[1]) / 2., (Z[0] + Z[1]) / 2.); - Draw_String(Num); + if(View->GlyphLocation == DRAW_POST_LOCATE_COG){ + d = (Val[0] + Val[1]) / 2.; + if(d >= ValMin && d <= ValMax) { + PaletteContinuous(View, ValMin, ValMax, d); + sprintf(Num, View->Format, d); + glRasterPos3d((X[0] + X[1]) / 2., (Y[0] + Y[1]) / 2., (Z[0] + Z[1]) / 2.); + Draw_String(Num); + } + } + else{ + for(int i = 0; i < 2; i++){ + if(Val[i] >= ValMin && Val[i] <= ValMax) { + PaletteContinuous(View, ValMin, ValMax, Val[i]); + sprintf(Num, View->Format, Val[i]); + glRasterPos3d(X[i], Y[i], Z[i]); + Draw_String(Num); + } + } } } @@ -388,14 +400,26 @@ void Draw_ScalarTriangle(Post_View * View, int preproNormals, } if(!preproNormals && View->IntervalsType == DRAW_POST_NUMERIC) { - d = (Val[0] + Val[1] + Val[2]) / 3.; - if(d >= ValMin && d <= ValMax) { - PaletteContinuous(View, ValMin, ValMax, d); - sprintf(Num, View->Format, d); - glRasterPos3d((X[0] + X[1] + X[2]) / 3., - (Y[0] + Y[1] + Y[2]) / 3., - (Z[0] + Z[1] + Z[2]) / 3.); - Draw_String(Num); + if(View->GlyphLocation == DRAW_POST_LOCATE_COG){ + d = (Val[0] + Val[1] + Val[2]) / 3.; + if(d >= ValMin && d <= ValMax) { + PaletteContinuous(View, ValMin, ValMax, d); + sprintf(Num, View->Format, d); + glRasterPos3d((X[0] + X[1] + X[2]) / 3., + (Y[0] + Y[1] + Y[2]) / 3., + (Z[0] + Z[1] + Z[2]) / 3.); + Draw_String(Num); + } + } + else{ + for(int i = 0; i < 3; i++){ + if(Val[i] >= ValMin && Val[i] <= ValMax) { + PaletteContinuous(View, ValMin, ValMax, Val[i]); + sprintf(Num, View->Format, Val[i]); + glRasterPos3d(X[i], Y[i], Z[i]); + Draw_String(Num); + } + } } } @@ -598,14 +622,26 @@ void Draw_ScalarTetrahedron(Post_View * View, int preproNormals, Draw_ElementBoundary(POST_TETRAHEDRON, View, X, Y, Z); if(!preproNormals && View->IntervalsType == DRAW_POST_NUMERIC) { - d = 0.25 * (Val[0] + Val[1] + Val[2] + Val[3]); - if(d >= ValMin && d <= ValMax) { - PaletteContinuous(View, ValMin, ValMax, d); - sprintf(Num, View->Format, d); - glRasterPos3d(0.25 * (X[0] + X[1] + X[2] + X[3]), - 0.25 * (Y[0] + Y[1] + Y[2] + Y[3]), - 0.25 * (Z[0] + Z[1] + Z[2] + Z[3])); - Draw_String(Num); + if(View->GlyphLocation == DRAW_POST_LOCATE_COG){ + d = 0.25 * (Val[0] + Val[1] + Val[2] + Val[3]); + if(d >= ValMin && d <= ValMax) { + PaletteContinuous(View, ValMin, ValMax, d); + sprintf(Num, View->Format, d); + glRasterPos3d(0.25 * (X[0] + X[1] + X[2] + X[3]), + 0.25 * (Y[0] + Y[1] + Y[2] + Y[3]), + 0.25 * (Z[0] + Z[1] + Z[2] + Z[3])); + Draw_String(Num); + } + } + else{ + for(int i = 0; i < 4; i++){ + if(Val[i] >= ValMin && Val[i] <= ValMax) { + PaletteContinuous(View, ValMin, ValMax, Val[i]); + sprintf(Num, View->Format, Val[i]); + glRasterPos3d(X[i], Y[i], Z[i]); + Draw_String(Num); + } + } } } else if(!View->TriVertexArray || (View->TriVertexArray && View->TriVertexArray->fill)){ @@ -994,9 +1030,7 @@ void Draw_VectorElement(int type, Post_View * View, int preproNormals, Draw_ElementBoundary(type, View, X, Y, Z); double xc = 0., yc = 0., zc = 0.; - if(View->Normals || View->Tangents || - View->IntervalsType == DRAW_POST_NUMERIC || - View->ArrowLocation == DRAW_POST_LOCATE_COG){ + if(View->Normals || View->Tangents || View->GlyphLocation == DRAW_POST_LOCATE_COG){ for(int k = 0; k < nbnod; k++) { xc += X[k]; yc += Y[k]; @@ -1031,8 +1065,7 @@ void Draw_VectorElement(int type, Post_View * View, int preproNormals, xc, yc, zc, t[0], t[1], t[2], View->Light); } - if(View->ArrowLocation == DRAW_POST_LOCATE_COG || - View->IntervalsType == DRAW_POST_NUMERIC) { + if(View->GlyphLocation == DRAW_POST_LOCATE_COG) { double dd = 0., ext_dd = 0., dx = 0., dy = 0., dz = 0.; for(int k = 0; k < nbnod; k++) { dx += Val[k][0]; @@ -1058,9 +1091,12 @@ void Draw_VectorElement(int type, Post_View * View, int preproNormals, PaletteDiscrete(View, View->NbIso, View->GIFV(ext_min, ext_max, View->NbIso, ext_dd)); if(View->IntervalsType == DRAW_POST_NUMERIC) { - char Num[100]; + char Num[100], Numx[100], Numy[100], Numz[100]; glRasterPos3d(xc, yc, zc); - sprintf(Num, View->Format, ext_dd); + sprintf(Numx, View->Format, dx); + sprintf(Numy, View->Format, dy); + sprintf(Numz, View->Format, dz); + sprintf(Num, "(%s,%s,%s)", Numx, Numy, Numz); Draw_String(Num); } else { @@ -1090,22 +1126,33 @@ void Draw_VectorElement(int type, Post_View * View, int preproNormals, else PaletteDiscrete(View, View->NbIso, View->GIFV(ext_min, ext_max, View->NbIso, ext_norm[k])); - double fact = CTX.pixel_equiv_x / CTX.s[0] * View->ArrowSize / - (View->ArrowSizeProportional ? ValMax : norm[k]); - if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin > 0) { - Val[k][0] /= norm[k]; - Val[k][1] /= norm[k]; - Val[k][2] /= norm[k]; - norm[k] = log10(norm[k] / ValMin); - Val[k][0] *= norm[k]; - Val[k][1] *= norm[k]; - Val[k][2] *= norm[k]; - } - Draw_Vector(View->VectorType, View->IntervalsType != DRAW_POST_ISO, - View->ArrowRelHeadRadius, View->ArrowRelStemLength, - View->ArrowRelStemRadius, X[k], Y[k], Z[k], - fact * Val[k][0], fact * Val[k][1], fact * Val[k][2], - View->Light); + if(View->IntervalsType == DRAW_POST_NUMERIC) { + char Num[100], Numx[100], Numy[100], Numz[100]; + glRasterPos3d(X[k], Y[k], Z[k]); + sprintf(Numx, View->Format, Val[k][0]); + sprintf(Numy, View->Format, Val[k][1]); + sprintf(Numz, View->Format, Val[k][2]); + sprintf(Num, "(%s,%s,%s)", Numx, Numy, Numz); + Draw_String(Num); + } + else{ + double fact = CTX.pixel_equiv_x / CTX.s[0] * View->ArrowSize / + (View->ArrowSizeProportional ? ValMax : norm[k]); + if(View->ScaleType == DRAW_POST_LOGARITHMIC && ValMin > 0) { + Val[k][0] /= norm[k]; + Val[k][1] /= norm[k]; + Val[k][2] /= norm[k]; + norm[k] = log10(norm[k] / ValMin); + Val[k][0] *= norm[k]; + Val[k][1] *= norm[k]; + Val[k][2] *= norm[k]; + } + Draw_Vector(View->VectorType, View->IntervalsType != DRAW_POST_ISO, + View->ArrowRelHeadRadius, View->ArrowRelStemLength, + View->ArrowRelStemRadius, X[k], Y[k], Z[k], + fact * Val[k][0], fact * Val[k][1], fact * Val[k][2], + View->Light); + } } } } diff --git a/doc/VERSIONS b/doc/VERSIONS index 2f8883cb8f86a94d72ba22d880b506e0643c4c17..454c962f379582fb42c52489415be4f28b95ca30 100644 --- a/doc/VERSIONS +++ b/doc/VERSIONS @@ -1,10 +1,10 @@ -$Id: VERSIONS,v 1.324 2005-04-04 18:19:49 geuzaine Exp $ +$Id: VERSIONS,v 1.325 2005-04-06 16:30:52 geuzaine Exp $ New since 1.60: added support for second order (curved) elements in post-processor; new version (1.4) of post-processing file formats; new stippling options for 2D plots; removed limit on allowed number of files on command line; all "Combine" operations are now available in -the parser; +the parser; changed View.ArrowLocation into View.GlyphLocation; New in 1.60: added support for discrete curves; new Window menu on Mac OS X; generalized all octree-based plugins (CutGrid, StreamLines,