From 4d14acdc2d23ab22f9cd30850f9c1090d065c84d Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Wed, 24 Jan 2007 10:53:04 +0000
Subject: [PATCH] added gui for OCC healing

---
 Common/DefaultOptions.h |  6 +++---
 Common/Options.cpp      | 17 ++++++++++++++++-
 Fltk/Callbacks.cpp      |  7 +++++--
 Fltk/GUI.cpp            | 27 ++++++++++++++++++++++-----
 4 files changed, 46 insertions(+), 11 deletions(-)

diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h
index 44be2ace24..2dc828e0da 100644
--- a/Common/DefaultOptions.h
+++ b/Common/DefaultOptions.h
@@ -801,11 +801,11 @@ StringXNumber GeometryOptions_Number[] = {
     "Display size of normal vectors (in pixels)" }, 
 
   { F|O, "OCCFixSmallEdges" , opt_geometry_occ_fix_small_edges , 1. , 
-    "Fix small edges in OpenCascade models" },
+    "Fix small edges in STEP, IGES and BRep models" },
   { F|O, "OCCFixSmallFaces" , opt_geometry_occ_fix_small_faces , 1. , 
-    "Fix small faces in OpenCascade models" },
+    "Fix small faces in STEP, IGES and BRep models" },
   { F|O, "OCCSewFaces" , opt_geometry_occ_sew_faces , 0. , 
-    "Sew faces in OpenCascade models" },
+    "Sew faces in STEP, IGES and BRep models" },
   { F|O, "OldCircle" , opt_geometry_old_circle , 0. , 
     "Use old circle description (compatibility option for old Gmsh geometries)" },
   { F|O, "OldNewReg" , opt_geometry_old_newreg , 1. , 
diff --git a/Common/Options.cpp b/Common/Options.cpp
index 62b3ba82b9..e6c70adf00 100644
--- a/Common/Options.cpp
+++ b/Common/Options.cpp
@@ -1,4 +1,4 @@
-// $Id: Options.cpp,v 1.331 2007-01-23 08:01:07 geuzaine Exp $
+// $Id: Options.cpp,v 1.332 2007-01-24 10:53:04 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -3993,6 +3993,11 @@ double opt_geometry_occ_fix_small_edges(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
     CTX.geom.occ_fix_small_edges = val ? 1 : 0;
+#if defined(HAVE_FLTK)
+  if(WID && (action & GMSH_GUI)) {
+    WID->geo_butt[11]->value(CTX.geom.occ_fix_small_edges);
+  }
+#endif
   return CTX.geom.occ_fix_small_edges;
 }
 
@@ -4000,6 +4005,11 @@ double opt_geometry_occ_fix_small_faces(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
     CTX.geom.occ_fix_small_faces = val ? 1 : 0;
+#if defined(HAVE_FLTK)
+  if(WID && (action & GMSH_GUI)) {
+    WID->geo_butt[12]->value(CTX.geom.occ_fix_small_faces);
+  }
+#endif
   return CTX.geom.occ_fix_small_faces;
 }
 
@@ -4007,6 +4017,11 @@ double opt_geometry_occ_sew_faces(OPT_ARGS_NUM)
 {
   if(action & GMSH_SET)
     CTX.geom.occ_sew_faces = val ? 1 : 0;
+#if defined(HAVE_FLTK)
+  if(WID && (action & GMSH_GUI)) {
+    WID->geo_butt[13]->value(CTX.geom.occ_sew_faces);
+  }
+#endif
   return CTX.geom.occ_sew_faces;
 }
 
diff --git a/Fltk/Callbacks.cpp b/Fltk/Callbacks.cpp
index 3cee5aa787..872bdf898e 100644
--- a/Fltk/Callbacks.cpp
+++ b/Fltk/Callbacks.cpp
@@ -1,4 +1,4 @@
-// $Id: Callbacks.cpp,v 1.506 2007-01-22 16:31:42 geuzaine Exp $
+// $Id: Callbacks.cpp,v 1.507 2007-01-24 10:53:04 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -1006,8 +1006,11 @@ void geometry_options_ok_cb(CALLBACK_ARGS)
   opt_geometry_surfaces_num(0, GMSH_SET, WID->geo_butt[6]->value());
   opt_geometry_volumes_num(0, GMSH_SET, WID->geo_butt[7]->value());
   opt_geometry_auto_coherence(0, GMSH_SET, WID->geo_butt[8]->value());
-  opt_geometry_highlight_orphans(0, GMSH_SET, WID->geo_butt[10]->value());
   opt_geometry_light(0, GMSH_SET, WID->geo_butt[9]->value());
+  opt_geometry_highlight_orphans(0, GMSH_SET, WID->geo_butt[10]->value());
+  opt_geometry_occ_fix_small_edges(0, GMSH_SET, WID->geo_butt[11]->value());
+  opt_geometry_occ_fix_small_faces(0, GMSH_SET, WID->geo_butt[12]->value());
+  opt_geometry_occ_sew_faces(0, GMSH_SET, WID->geo_butt[13]->value());
 
   opt_geometry_normals(0, GMSH_SET, WID->geo_value[0]->value());
   opt_geometry_tangents(0, GMSH_SET, WID->geo_value[1]->value());
diff --git a/Fltk/GUI.cpp b/Fltk/GUI.cpp
index 4062120690..6ed6dc40fa 100644
--- a/Fltk/GUI.cpp
+++ b/Fltk/GUI.cpp
@@ -1,4 +1,4 @@
-// $Id: GUI.cpp,v 1.593 2007-01-22 16:31:42 geuzaine Exp $
+// $Id: GUI.cpp,v 1.594 2007-01-24 10:53:04 geuzaine Exp $
 //
 // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
 //
@@ -2084,14 +2084,31 @@ void GUI::create_option_window()
       Fl_Group *o = new Fl_Group(L + WB, WB + BH, width - 2 * WB, height - 2 * WB - BH, "General");
       o->hide();
 
-      geo_butt[8] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 1 * BH, BW, BH, "Remove duplicate entities automatically");
+      geo_value[2] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 1 * BH, IW, BH, "Geometrical tolerance");
+      geo_value[2]->align(FL_ALIGN_RIGHT);
+      geo_value[2]->callback(geometry_options_ok_cb);
+
+      geo_butt[8] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 2 * BH, BW, BH, "Remove duplicate entities in GEO models");
       geo_butt[8]->type(FL_TOGGLE_BUTTON);
       geo_butt[8]->callback(geometry_options_ok_cb);
 
-      geo_value[2] = new Fl_Value_Input(L + 2 * WB, 2 * WB + 2 * BH, IW, BH, "Geometrical tolerance");
-      geo_value[2]->align(FL_ALIGN_RIGHT);
-      geo_value[2]->callback(geometry_options_ok_cb);
+      geo_butt[11] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 3 * BH, BW, BH, "Remove small edges in STEP, IGES and BRep models");
+      geo_butt[11]->type(FL_TOGGLE_BUTTON);
+      geo_butt[11]->callback(geometry_options_ok_cb);
+
+      geo_butt[12] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 4 * BH, BW, BH, "Remove small faces in STEP, IGES and BRep models");
+      geo_butt[12]->type(FL_TOGGLE_BUTTON);
+      geo_butt[12]->callback(geometry_options_ok_cb);
 
+      geo_butt[13] = new Fl_Check_Button(L + 2 * WB, 2 * WB + 5 * BH, BW, BH, "Sew faces in STEP, IGES and BRep models");
+      geo_butt[13]->type(FL_TOGGLE_BUTTON);
+      geo_butt[13]->callback(geometry_options_ok_cb);
+
+#if !defined(HAVE_OCC)
+      geo_butt[11]->deactivate();
+      geo_butt[12]->deactivate();
+      geo_butt[13]->deactivate();
+#endif
       o->end();
     }
     {
-- 
GitLab