From aaf53c20c3e04fb5d7daf87a5c7ccc1d33fda57c Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 10 Feb 2010 18:19:19 +0000 Subject: [PATCH] better rotation center picking --- Fltk/optionWindow.cpp | 19 ++++++++++++++----- Fltk/solverWindow.h | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Fltk/optionWindow.cpp b/Fltk/optionWindow.cpp index 89b89070a0..c509d3ee8a 100644 --- a/Fltk/optionWindow.cpp +++ b/Fltk/optionWindow.cpp @@ -168,7 +168,11 @@ static void general_options_color_scheme_cb(Fl_Widget *w, void *data) static void general_options_rotation_center_select_cb(Fl_Widget *w, void *data) { - Msg::StatusBar(3, false, "Select entity\n[Press 'q' to abort]"); + Msg::StatusBar(3, false, "Select entity or element\n[Press 'q' to abort]"); + + CTX::instance()->pickElements = 1; + CTX::instance()->mesh.changed = ENT_ALL; + drawContext::global()->draw(); char ib = FlGui::instance()->selectEntity(ENT_ALL); if(ib == 'l') { SPoint3 pc(0., 0., 0.); @@ -176,20 +180,20 @@ static void general_options_rotation_center_select_cb(Fl_Widget *w, void *data) pc.setPosition(FlGui::instance()->selectedVertices[0]->x(), FlGui::instance()->selectedVertices[0]->y(), FlGui::instance()->selectedVertices[0]->z()); + else if(FlGui::instance()->selectedElements.size()) + pc = FlGui::instance()->selectedElements[0]->barycenter(); else if(FlGui::instance()->selectedEdges.size()) pc = FlGui::instance()->selectedEdges[0]->bounds().center(); else if(FlGui::instance()->selectedFaces.size()) pc = FlGui::instance()->selectedFaces[0]->bounds().center(); else if(FlGui::instance()->selectedRegions.size()) pc = FlGui::instance()->selectedRegions[0]->bounds().center(); - else if(FlGui::instance()->selectedElements.size()) - pc = FlGui::instance()->selectedElements[0]->barycenter(); - opt_general_rotation_center_cg - (0, GMSH_SET, FlGui::instance()->options->general.butt[15]->value()); opt_general_rotation_center0(0, GMSH_SET|GMSH_GUI, pc.x()); opt_general_rotation_center1(0, GMSH_SET|GMSH_GUI, pc.y()); opt_general_rotation_center2(0, GMSH_SET|GMSH_GUI, pc.z()); } + CTX::instance()->pickElements = 0; + CTX::instance()->mesh.changed = ENT_ALL; GModel::current()->setSelection(0); drawContext::global()->draw(); Msg::StatusBar(3, false, ""); @@ -213,6 +217,11 @@ static void general_options_ok_cb(Fl_Widget *w, void *data) if(!strcmp(name, "rotation_center_coord")){ CTX::instance()->drawRotationCenter = 1; } + else if(!strcmp(name, "rotation_center")){ + // pre-fill with cg + for(int i = 0; i < 3; i++) + o->general.value[8 + i]->value(CTX::instance()->cg[i]); + } else if(!strcmp(name, "light_value")){ double x, y, z; x = o->general.value[2]->value(); diff --git a/Fltk/solverWindow.h b/Fltk/solverWindow.h index 38a0d444bf..17334edd1c 100644 --- a/Fltk/solverWindow.h +++ b/Fltk/solverWindow.h @@ -1,4 +1,4 @@ - // Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle +// Gmsh - Copyright (C) 1997-2009 C. Geuzaine, J.-F. Remacle // // See the LICENSE.txt file for license information. Please report all // bugs and problems to <gmsh@geuz.org>. -- GitLab