From 62a93020766afb2675d2bb4b4b4446ab7da83103 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 17 May 2004 17:40:03 +0000 Subject: [PATCH] removed unused geom.highlight option + small cleanup of the selection code --- Common/CommandLine.cpp | 13 +-- Common/Context.h | 1 - Common/DefaultOptions.h | 23 ----- Common/Options.cpp | 49 +--------- Common/Options.h | 5 - Fltk/Callbacks.cpp | 10 +- Fltk/GUI.cpp | 3 +- Fltk/Main.cpp | 3 +- Fltk/Opengl.cpp | 9 +- Fltk/Opengl_Window.cpp | 4 +- Graphics/Draw.cpp | 42 +++----- Graphics/Draw.h | 3 +- Graphics/Geom.cpp | 211 ++++++++++++++++------------------------ 13 files changed, 114 insertions(+), 262 deletions(-) diff --git a/Common/CommandLine.cpp b/Common/CommandLine.cpp index ee8dcf4715..595024b467 100644 --- a/Common/CommandLine.cpp +++ b/Common/CommandLine.cpp @@ -1,4 +1,4 @@ -// $Id: CommandLine.cpp,v 1.37 2004-05-15 08:24:07 geuzaine Exp $ +// $Id: CommandLine.cpp,v 1.38 2004-05-17 17:40:02 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -522,16 +522,6 @@ void Get_Options(int argc, char *argv[], int *nbfiles) CTX.overlay = 1; i++; } - else if(!strcmp(argv[i] + 1, "nooverlay") || - !strcmp(argv[i] + 1, "noov")) { - CTX.overlay = CTX.geom.highlight = 0; - i++; - } - else if(!strcmp(argv[i] + 1, "hh")) { - CTX.overlay = 0; - CTX.geom.highlight = 1; - i++; - } else if(!strcmp(argv[i] + 1, "perspective") || !strcmp(argv[i] + 1, "p")) { CTX.ortho = 0; @@ -555,7 +545,6 @@ void Get_Options(int argc, char *argv[], int *nbfiles) } else if(!strcmp(argv[i] + 1, "nodb")) { CTX.db = 0; - CTX.geom.highlight = 0; i++; } else if(!strcmp(argv[i] + 1, "dl")) { diff --git a/Common/Context.h b/Common/Context.h index b1367bee8b..0f4893e5cb 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -144,7 +144,6 @@ public : double point_size, line_width, point_sel_size, line_sel_width; int point_type, line_type; // flat or 3D int light; - int highlight; int level, old_circle, circle_points, circle_warning; int extrude_spline_points, old_newreg; double normals, tangents; diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index f5ddb6f582..a88f0148df 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -642,9 +642,6 @@ StringXNumber GeometryOptions_Number[] = { { F|O, "ExtrudeSplinePoints" , opt_geometry_extrude_spline_points, 5. , "Number of control points for splines created during extrusion" }, - { F|O, "Highlight" , opt_geometry_highlight , 0. , - "Not used" }, - { F|O, "Light" , opt_geometry_light , 1. , "Enable lighting for the geometry" }, { F|O, "Lines" , opt_geometry_lines , 1. , @@ -1149,26 +1146,6 @@ StringXColor GeometryOptions_Color[] = { PACK_COLOR(255, 0, 0, 255), PACK_COLOR(0, 0, 0, 255), "Selected geometry volume color" }, - { F|O, "PointsHighlight" , opt_geometry_color_points_highlight , - PACK_COLOR(0, 255, 0, 255), - PACK_COLOR(0, 255, 0, 255), - PACK_COLOR(0, 0, 0, 255), - "Highlighted geometry point color" }, - { F|O, "LinesHighlight" , opt_geometry_color_lines_highlight , - PACK_COLOR(0, 0, 255, 255), - PACK_COLOR(0, 0, 255, 255), - PACK_COLOR(0, 0, 0, 255), - "Highlighted geometry curve color" }, - { F|O, "SurfacesHighlight" , opt_geometry_color_surfaces_highlight , - PACK_COLOR(128, 128, 128, 255), - PACK_COLOR(128, 128, 128, 255), - PACK_COLOR(0, 0, 0, 255), - "Highlighted geometry surface color" }, - { F|O, "VolumesHighlight" , opt_geometry_color_volumes_highlight , - PACK_COLOR(128, 128, 128, 255), - PACK_COLOR(128, 128, 128, 255), - PACK_COLOR(0, 0, 0, 255), - "Highlighted geometry volume color" }, { F|O, "Tangents" , opt_geometry_color_tangents , PACK_COLOR(255, 255, 0, 255), PACK_COLOR(255, 255, 0, 255), diff --git a/Common/Options.cpp b/Common/Options.cpp index dc9024be2a..87ead30e5d 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1,4 +1,4 @@ -// $Id: Options.cpp,v 1.153 2004-05-15 09:19:53 geuzaine Exp $ +// $Id: Options.cpp,v 1.154 2004-05-17 17:40:02 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -3022,13 +3022,6 @@ double opt_geometry_light(OPT_ARGS_NUM) return CTX.geom.light; } -double opt_geometry_highlight(OPT_ARGS_NUM) -{ - if(action & GMSH_SET) - CTX.geom.highlight = (int)val; - return CTX.geom.highlight; -} - double opt_geometry_old_circle(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -5094,48 +5087,12 @@ unsigned int opt_geometry_color_volumes_select(OPT_ARGS_COL) #endif return CTX.color.geom.volume_sel; } -unsigned int opt_geometry_color_points_highlight(OPT_ARGS_COL) -{ - if(action & GMSH_SET) - CTX.color.geom.point_hlt = val; -#if defined(HAVE_FLTK) - CCC(CTX.color.geom.point_hlt, WID->geo_col[8]); -#endif - return CTX.color.geom.point_hlt; -} -unsigned int opt_geometry_color_lines_highlight(OPT_ARGS_COL) -{ - if(action & GMSH_SET) - CTX.color.geom.line_hlt = val; -#if defined(HAVE_FLTK) - CCC(CTX.color.geom.line_hlt, WID->geo_col[9]); -#endif - return CTX.color.geom.line_hlt; -} -unsigned int opt_geometry_color_surfaces_highlight(OPT_ARGS_COL) -{ - if(action & GMSH_SET) - CTX.color.geom.surface_hlt = val; -#if defined(HAVE_FLTK) - CCC(CTX.color.geom.surface_hlt, WID->geo_col[10]); -#endif - return CTX.color.geom.surface_hlt; -} -unsigned int opt_geometry_color_volumes_highlight(OPT_ARGS_COL) -{ - if(action & GMSH_SET) - CTX.color.geom.volume_hlt = val; -#if defined(HAVE_FLTK) - CCC(CTX.color.geom.volume_hlt, WID->geo_col[11]); -#endif - return CTX.color.geom.volume_hlt; -} unsigned int opt_geometry_color_tangents(OPT_ARGS_COL) { if(action & GMSH_SET) CTX.color.geom.tangents = val; #if defined(HAVE_FLTK) - CCC(CTX.color.geom.tangents, WID->geo_col[12]); + CCC(CTX.color.geom.tangents, WID->geo_col[8]); #endif return CTX.color.geom.tangents; } @@ -5144,7 +5101,7 @@ unsigned int opt_geometry_color_normals(OPT_ARGS_COL) if(action & GMSH_SET) CTX.color.geom.normals = val; #if defined(HAVE_FLTK) - CCC(CTX.color.geom.normals, WID->geo_col[13]); + CCC(CTX.color.geom.normals, WID->geo_col[9]); #endif return CTX.color.geom.normals; } diff --git a/Common/Options.h b/Common/Options.h index 02dc8b17a7..d4421709d5 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -326,7 +326,6 @@ double opt_geometry_line_width(OPT_ARGS_NUM); double opt_geometry_line_sel_width(OPT_ARGS_NUM); double opt_geometry_line_type(OPT_ARGS_NUM); double opt_geometry_light(OPT_ARGS_NUM); -double opt_geometry_highlight(OPT_ARGS_NUM); double opt_geometry_old_circle(OPT_ARGS_NUM); double opt_geometry_old_newreg(OPT_ARGS_NUM); double opt_geometry_circle_points(OPT_ARGS_NUM); @@ -508,10 +507,6 @@ unsigned int opt_geometry_color_points_select(OPT_ARGS_COL); unsigned int opt_geometry_color_lines_select(OPT_ARGS_COL); unsigned int opt_geometry_color_surfaces_select(OPT_ARGS_COL); unsigned int opt_geometry_color_volumes_select(OPT_ARGS_COL); -unsigned int opt_geometry_color_points_highlight(OPT_ARGS_COL); -unsigned int opt_geometry_color_lines_highlight(OPT_ARGS_COL); -unsigned int opt_geometry_color_surfaces_highlight(OPT_ARGS_COL); -unsigned int opt_geometry_color_volumes_highlight(OPT_ARGS_COL); unsigned int opt_geometry_color_tangents(OPT_ARGS_COL); unsigned int opt_geometry_color_normals(OPT_ARGS_COL); unsigned int opt_mesh_color_points(OPT_ARGS_COL); diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp index 8ad0ea0da3..b9a6fa6266 100644 --- a/Fltk/Callbacks.cpp +++ b/Fltk/Callbacks.cpp @@ -1,4 +1,4 @@ -// $Id: Callbacks.cpp,v 1.230 2004-05-15 08:35:32 geuzaine Exp $ +// $Id: Callbacks.cpp,v 1.231 2004-05-17 17:40:02 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -225,9 +225,6 @@ int SetGlobalShortcut(int event) int SelectContour(int type, int num, List_T * Liste1) { int k = 0, ip, i; - List_T *Liste2; - - Liste2 = List_Create(1, 1, sizeof(int)); if(!List_Nbr(Liste1)) { switch (type) { @@ -240,7 +237,7 @@ int SelectContour(int type, int num, List_T * Liste1) } } else { - List_Reset(Liste2); + List_T *Liste2 = List_Create(1, 1, sizeof(int)); for(i = 0; i < List_Nbr(Liste1); i++) List_Add(Liste2, List_Pointer(Liste1, i)); List_Reset(Liste1); @@ -252,6 +249,7 @@ int SelectContour(int type, int num, List_T * Liste1) k = allfaceslinked(num, Liste1, Liste2); break; } + List_Delete(Liste2); } for(i = 0; i < List_Nbr(Liste1); i++) { @@ -266,8 +264,6 @@ int SelectContour(int type, int num, List_T * Liste1) } } - Draw(); //added July 18 2001 to overcome missing refreshes... Is this OK ? - List_Delete(Liste2); return k; } diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp index 5b289ba6a3..bea4ca686e 100644 --- a/Fltk/GUI.cpp +++ b/Fltk/GUI.cpp @@ -1,4 +1,4 @@ -// $Id: GUI.cpp,v 1.297 2004-05-15 08:07:20 geuzaine Exp $ +// $Id: GUI.cpp,v 1.298 2004-05-17 17:40:02 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -1319,6 +1319,7 @@ void GUI::make_overlay_current() void GUI::redraw_opengl() { g_opengl_window->redraw(); + //glFlush(); } // Draw the opengl overlay window diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index a291e39314..68207d998b 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.67 2004-05-15 08:18:24 geuzaine Exp $ +// $Id: Main.cpp,v 1.68 2004-05-17 17:40:03 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -106,7 +106,6 @@ int main(int argc, char *argv[]) // This does not work with FLTK right now... CTX.overlay = 0; - CTX.geom.highlight = 0; // Always print info on terminal for non-interactive execution diff --git a/Fltk/Opengl.cpp b/Fltk/Opengl.cpp index 08f4faaac5..96bfa8c68e 100644 --- a/Fltk/Opengl.cpp +++ b/Fltk/Opengl.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl.cpp,v 1.35 2004-04-24 02:13:07 geuzaine Exp $ +// $Id: Opengl.cpp,v 1.36 2004-05-17 17:40:03 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -48,6 +48,11 @@ void InitOpengl(void) Orthogonalize(0, 0); } +void SetOpenglContext(void) +{ + WID->make_opengl_current(); +} + void InitOverlay(void) { WID->make_overlay_current(); @@ -151,9 +156,7 @@ int SelectEntity(int type, Vertex ** v, Curve ** c, Surface ** s) Process_SelectionBuffer(Fl::event_x(), Fl::event_y(), &hits, ii, jj); Filter_SelectionBuffer(hits, ii, jj, v, c, s, &M); if(check_type(type, *v, *c, *s)) { - BeginHighlight(); HighlightEntity(*v, *c, *s, 1); - EndHighlight(1); WID->selection = 0; return (1); } diff --git a/Fltk/Opengl_Window.cpp b/Fltk/Opengl_Window.cpp index 2173303e91..81d8cdf95a 100644 --- a/Fltk/Opengl_Window.cpp +++ b/Fltk/Opengl_Window.cpp @@ -1,4 +1,4 @@ -// $Id: Opengl_Window.cpp,v 1.33 2004-02-20 17:57:59 geuzaine Exp $ +// $Id: Opengl_Window.cpp,v 1.34 2004-05-17 17:40:03 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -365,9 +365,7 @@ int Opengl_Window::handle(int event) WID->g_window->cursor(FL_CURSOR_CROSS, FL_BLACK, FL_WHITE); else WID->g_window->cursor(FL_CURSOR_DEFAULT, FL_BLACK, FL_WHITE); - BeginHighlight(); HighlightEntity(v, c, s, 0); - EndHighlight(0); } } diff --git a/Graphics/Draw.cpp b/Graphics/Draw.cpp index 0433b46c94..f9e903c638 100644 --- a/Graphics/Draw.cpp +++ b/Graphics/Draw.cpp @@ -1,4 +1,4 @@ -// $Id: Draw.cpp,v 1.51 2004-05-14 16:47:30 geuzaine Exp $ +// $Id: Draw.cpp,v 1.52 2004-05-17 17:40:03 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -22,6 +22,7 @@ #include "Gmsh.h" #include "GmshUI.h" #include "Geo.h" +#include "CAD.h" #include "Mesh.h" #include "Draw.h" #include "Context.h" @@ -202,7 +203,6 @@ void InitPosition(void) void Process_SelectionBuffer(int x, int y, int *n, GLuint * ii, GLuint * jj) { GLuint selectBuf[SELECTION_BUFFER_SIZE]; - GLint i, j, hits, names, *ptr; glSelectBuffer(SELECTION_BUFFER_SIZE, selectBuf); @@ -217,20 +217,20 @@ void Process_SelectionBuffer(int x, int y, int *n, GLuint * ii, GLuint * jj) Draw_Mesh(&M); glPopMatrix(); - hits = glRenderMode(GL_RENDER); + GLint hits = glRenderMode(GL_RENDER); CTX.render_mode = GMSH_RENDER; if(hits < 0) return; // Selection Buffer Overflow - ptr = (GLint *) selectBuf; + GLint *ptr = (GLint *) selectBuf; - for(i = 0; i < hits; i++) { - names = *ptr; + for(int i = 0; i < hits; i++) { + GLint names = *ptr; ptr++; ptr++; ptr++; - for(j = 0; j < names; j++) { + for(int j = 0; j < names; j++) { if(j == 0) ii[i] = *ptr; else if(j == 1) @@ -245,40 +245,24 @@ void Filter_SelectionBuffer(int n, GLuint * typ, GLuint * ient, Vertex ** thev, Curve ** thec, Surface ** thes, Mesh * m) { + GLuint typmin = 4; - Vertex *v = NULL, V; - Curve *c = NULL, C; - Surface *s = NULL, S; - - int i; - GLuint typmin; - - typmin = 4; - for(i = 0; i < n; i++) { + for(int i = 0; i < n; i++) { if(typ[i] < typmin) typmin = typ[i]; } - for(i = 0; i < n; i++) { + for(int i = 0; i < n; i++) { if(typ[i] == typmin) { switch (typ[i]) { case 0: - v = &V; - v->Num = ient[i]; - if(Tree_Query(m->Points, &v)) - *thev = v; + *thev = FindPoint(ient[i], m); break; case 1: - c = &C; - c->Num = ient[i]; - if(Tree_Query(m->Curves, &c)) - *thec = c; + *thec = FindCurve(ient[i], m); break; case 2: - s = &S; - s->Num = ient[i]; - if(Tree_Query(m->Surfaces, &s)) - *thes = s; + *thes = FindSurface(ient[i], m); break; } } diff --git a/Graphics/Draw.h b/Graphics/Draw.h index f316541886..fc7e1d3e41 100644 --- a/Graphics/Draw.h +++ b/Graphics/Draw.h @@ -37,6 +37,7 @@ void InitPosition(void); void Orthogonalize(int x, int y); void ClearOpengl(void); +void SetOpenglContext(void); void set_r(int i, double val); void set_t(int i, double val); @@ -49,8 +50,6 @@ void ColorSwitch(int i); int SelectEntity(int type, Vertex **v, Curve **c, Surface **s); void ZeroHighlight(Mesh *m); -void BeginHighlight(void); -void EndHighlight(int permanent); void HighlightEntity(Vertex *v,Curve *c, Surface *s, int permanent); void HighlightEntityNum(int v, int c, int s, int permanant); diff --git a/Graphics/Geom.cpp b/Graphics/Geom.cpp index 636d23fe79..64ec374a5d 100644 --- a/Graphics/Geom.cpp +++ b/Graphics/Geom.cpp @@ -1,4 +1,4 @@ -// $Id: Geom.cpp,v 1.54 2004-04-20 18:55:36 geuzaine Exp $ +// $Id: Geom.cpp,v 1.55 2004-05-17 17:40:03 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -23,6 +23,7 @@ #include "GmshUI.h" #include "Numeric.h" #include "Geo.h" +#include "CAD.h" #include "Mesh.h" #include "Utils.h" #include "Draw.h" @@ -36,8 +37,6 @@ extern Mesh *THEM; // Points -static int Highlighted = 0; - void Draw_GeoPoint(void *a, void *b) { Vertex *v; @@ -58,11 +57,6 @@ void Draw_GeoPoint(void *a, void *b) gl2psPointSize(CTX.geom.point_sel_size * CTX.print.eps_point_size_factor); glColor4ubv((GLubyte *) & CTX.color.geom.point_sel); } - else if(Highlighted) { - glPointSize(CTX.geom.point_sel_size); - gl2psPointSize(CTX.geom.point_sel_size * CTX.print.eps_point_size_factor); - glColor4ubv((GLubyte *) & CTX.color.geom.point_hlt); - } else { glPointSize(CTX.geom.point_size); gl2psPointSize(CTX.geom.point_size * CTX.print.eps_point_size_factor); @@ -71,7 +65,7 @@ void Draw_GeoPoint(void *a, void *b) if(CTX.geom.points) { if(CTX.geom.point_type) { - if(v->Frozen || Highlighted) + if(v->Frozen) Draw_Sphere(CTX.geom.point_sel_size, v->Pos.X, v->Pos.Y, v->Pos.Z, CTX.geom.light); else @@ -124,11 +118,6 @@ void Draw_Curve(void *a, void *b) gl2psLineWidth(CTX.geom.line_sel_width * CTX.print.eps_line_width_factor); glColor4ubv((GLubyte *) & CTX.color.geom.line_sel); } - else if(Highlighted) { - glLineWidth(CTX.geom.line_sel_width); - gl2psLineWidth(CTX.geom.line_sel_width * CTX.print.eps_line_width_factor); - glColor4ubv((GLubyte *) & CTX.color.geom.line_hlt); - } else { glLineWidth(CTX.geom.line_width); gl2psLineWidth(CTX.geom.line_width * CTX.print.eps_line_width_factor); @@ -575,12 +564,6 @@ void Draw_Surface(void *a, void *b) CTX.print.eps_line_width_factor); glColor4ubv((GLubyte *) & CTX.color.geom.surface_sel); } - else if(Highlighted) { - glLineWidth(CTX.geom.line_sel_width); - gl2psLineWidth(CTX.geom.line_sel_width * - CTX.print.eps_line_width_factor); - glColor4ubv((GLubyte *) & CTX.color.geom.surface_hlt); - } else { glLineWidth(CTX.geom.line_width); gl2psLineWidth(CTX.geom.line_width * CTX.print.eps_line_width_factor); @@ -675,141 +658,113 @@ void Draw_Geom(Mesh * m) DrawVolumes(m); } -void ZeroCurve(void *a, void *b) -{ - Curve *c; - c = *(Curve **) a; - c->ipar[3] = 0; -} - -void ZeroPoint(void *a, void *b) -{ - Vertex *v; - v = *(Vertex **) a; - v->Frozen = 0; -} - -void ZeroSurface(void *a, void *b) -{ - Surface *s; - s = *(Surface **) a; - s->ipar[4] = 0; -} - -void ZeroHighlight(Mesh * m) -{ - Tree_Action(m->Points, ZeroPoint); - Tree_Action(m->Curves, ZeroCurve); - Tree_Action(m->Surfaces, ZeroSurface); -} - // Highlight routines -void BeginHighlight(void) -{ - if(CTX.geom.highlight) { - if(CTX.overlay) - InitOverlay(); - else - InitOpengl(); - Highlighted = 1; - glPushMatrix(); - InitPosition(); - } -} - - -void EndHighlight(int permanent) -{ - Highlighted = 0; - if(permanent) - Draw(); - else { - if(CTX.geom.highlight) { - glPopMatrix(); - } - } -} - void HighlightEntity(Vertex * v, Curve * c, Surface * s, int permanent) { Curve *cc; char Message[256], temp[256]; int i, nbg; + if(permanent){ + // we want to draw incrementally (in between to "Draw()" calls): + // we need to make sure that the opengl context is set correctly + SetOpenglContext(); + } + if(v) { - if(permanent) + if(permanent){ v->Frozen = 1; - if(CTX.geom.highlight) - Draw_GeoPoint(&v, NULL); - Msg(STATUS1N, "Point %d {%.5g,%.5g,%.5g} (%.5g)", v->Num, v->Pos.X, - v->Pos.Y, v->Pos.Z, v->lc); + Draw_GeoPoint(&v,NULL); + } + else{ + Msg(STATUS1N, "Point %d {%.5g,%.5g,%.5g} (%.5g)", v->Num, v->Pos.X, + v->Pos.Y, v->Pos.Z, v->lc); + } } else if(c) { - if(permanent) + if(permanent){ c->ipar[3] = 1; - if(CTX.geom.highlight) - Draw_Curve(&c, NULL); - Msg(STATUS1N, "Curve %d {%d->%d}", c->Num, c->beg->Num, c->end->Num); + Draw_Curve(&c,NULL); + } + else{ + Msg(STATUS1N, "Curve %d {%d->%d}", c->Num, c->beg->Num, c->end->Num); + } } else if(s) { - if(permanent && s->ipar[4] == 1) - return; - if(permanent) + if(permanent){ s->ipar[4] = 1; - if(CTX.geom.highlight) - Draw_Surface(&s, NULL); - sprintf(Message, "Surface %d {", s->Num); - - nbg = List_Nbr(s->Generatrices); - - if(nbg < 10) { - for(i = 0; i < nbg; i++) { - List_Read(s->Generatrices, i, &cc); - if(!i) - sprintf(temp, "%d", cc->Num); - else - sprintf(temp, ",%d", cc->Num); - strcat(Message, temp); - } + Draw_Surface(&s,NULL); } - else { - strcat(Message, "..."); + else{ + sprintf(Message, "Surface %d {", s->Num); + nbg = List_Nbr(s->Generatrices); + if(nbg < 10) { + for(i = 0; i < nbg; i++) { + List_Read(s->Generatrices, i, &cc); + if(!i) + sprintf(temp, "%d", cc->Num); + else + sprintf(temp, ",%d", cc->Num); + strcat(Message, temp); + } + } + else { + strcat(Message, "..."); + } + strcat(Message, "}"); + Msg(STATUS1N, Message); } - strcat(Message, "}"); - Msg(STATUS1N, Message); } - else { - Msg(STATUS1N, " "); + else{ + if(!permanent) + Msg(STATUS1N, " "); } - glFlush(); } - -void HighlightEntityNum(int v, int c, int s, int permanant) +void HighlightEntityNum(int v, int c, int s, int permanent) { - Vertex *pv, V; - Curve *pc, C; - Surface *ps, S; if(v) { - pv = &V; - pv->Num = v; - if(Tree_Query(THEM->Vertices, &pv)) { - HighlightEntity(pv, NULL, NULL, permanant); - } + Vertex *pv = FindPoint(v, THEM); + if(pv) + HighlightEntity(pv, NULL, NULL, permanent); } if(c) { - pc = &C; - pc->Num = c; - if(Tree_Query(THEM->Curves, &pc)) { - HighlightEntity(NULL, pc, NULL, permanant); - } + Curve *pc = FindCurve(c, THEM); + if(pc) + HighlightEntity(NULL, pc, NULL, permanent); } if(s) { - ps = &S; - ps->Num = s; - if(Tree_Query(THEM->Surfaces, &ps)) { - HighlightEntity(NULL, NULL, ps, permanant); - } + Surface *ps = FindSurface(s, THEM); + if(ps) + HighlightEntity(NULL, NULL, ps, permanent); } } + +void ZeroPoint(void *a, void *b) +{ + Vertex *v; + v = *(Vertex **) a; + v->Frozen = 0; +} + +void ZeroCurve(void *a, void *b) +{ + Curve *c; + c = *(Curve **) a; + c->ipar[3] = 0; +} + +void ZeroSurface(void *a, void *b) +{ + Surface *s; + s = *(Surface **) a; + s->ipar[4] = 0; +} + +void ZeroHighlight(Mesh * m) +{ + Tree_Action(m->Points, ZeroPoint); + Tree_Action(m->Curves, ZeroCurve); + Tree_Action(m->Surfaces, ZeroSurface); +} -- GitLab