diff --git a/Common/Context.h b/Common/Context.h index 7fdf57ce184c856b2aa17ac3233549fd03baf066..d3f233660640e2f9a37b031ff3d529bfbcdb5033 100644 --- a/Common/Context.h +++ b/Common/Context.h @@ -75,7 +75,9 @@ struct contextGeometryOptions { double occScaling; int copyMeshingMethod, copyDisplayAttributes, exactExtrusion; int matchGeomAndMesh; - int hideCompounds, orientedPhysicals; + int hideCompounds, orientedPhysicals, doubleClickedEntityTag; + std::string doubleClickedPointCommand, doubleClickedLineCommand; + std::string doubleClickedSurfaceCommand, doubleClickedVolumeCommand; }; class CTX { @@ -247,8 +249,8 @@ class CTX { int smooth, animCycle, animStep, combineTime, combineRemoveOrig; int fileFormat, plugins, forceNodeData, forceElementData; double animDelay; - std::string graphPointCommand; - double graphPointX, graphPointY; + std::string doubleClickedGraphPointCommand; + double doubleClickedGraphPointX, doubleClickedGraphPointY; }post; // solver options struct{ diff --git a/Common/DefaultOptions.h b/Common/DefaultOptions.h index 7e2273b512660e42f191c56a6e72bb6a374545e1..091c3dea6ff0916779863b7bb73e7913c2fbe171 100644 --- a/Common/DefaultOptions.h +++ b/Common/DefaultOptions.h @@ -130,6 +130,15 @@ StringXString GeneralOptions_String[] = { } ; StringXString GeometryOptions_String[] = { + { F|O, "DoubleClickedPointCommand" , opt_geometry_double_clicked_point_command, "" , + "Command parsed when double-clicking on a point" }, + { F|O, "DoubleClickedLineCommand" , opt_geometry_double_clicked_line_command, "" , + "Command parsed when double-clicking on a line" }, + { F|O, "DoubleClickedSurfaceCommand" , opt_geometry_double_clicked_surface_command, "" , + "Command parsed when double-clicking on a surface" }, + { F|O, "DoubleClickedVolumeCommand" , opt_geometry_double_clicked_volume_command, "" , + "Command parsed when double-clicking on a volume" }, + { 0, 0 , 0 , "" , 0 } } ; @@ -221,17 +230,19 @@ StringXString SolverOptions_String[] = { } ; StringXString PostProcessingOptions_String[] = { - { F|O, "GraphPointCommand" , opt_post_graph_point_command, "" , + { F|O, "DoubleClickedGraphPointCommand" , opt_post_double_clicked_graph_point_command, "" , "Command parsed when double-clicking on a graph data point " "(e.g. Merge Sprintf('file_%g.pos', PostProcessing.GraphPointX);)" }, + { F|O, "GraphPointCommand" , opt_post_double_clicked_graph_point_command, "" , + "Synonym for `DoubleClickedGraphPointCommand'" }, + { 0, 0 , 0 , "" , 0 } } ; StringXString ViewOptions_String[] = { { F|O, "Attributes" , opt_view_attributes , "" , "Optional string attributes" }, - { F|O, "AxesFormatX" , opt_view_axes_format0 , "%.3g" , "Number format for X-axis (in standard C form)" }, { F|O, "AxesFormatY" , opt_view_axes_format1 , "%.3g" , @@ -245,6 +256,9 @@ StringXString ViewOptions_String[] = { { F|O, "AxesLabelZ" , opt_view_axes_label2 , "" , "Z-axis label" }, + { F|O, "DoubleClickedCommand" , opt_view_double_clicked_command , "" , + "Command parsed when double-clicking on the view" }, + { F, "FileName" , opt_view_filename , "" , "Default post-processing view file name" }, { F|O, "Format" , opt_view_format , "%.3g" , @@ -768,7 +782,8 @@ StringXNumber GeneralOptions_Number[] = { StringXNumber GeometryOptions_Number[] = { { F|O, "AutoCoherence" , opt_geometry_auto_coherence , 1. , - "Should all duplicate entities be automatically removed? (if ==2, also remove degenerate entities)" }, + "Should all duplicate entities be automatically removed? (If AutoCoherence == 2, " + "also remove degenerate entities)" }, { F, "Clip" , opt_geometry_clip , 0., "Enable clipping planes? (Plane[i]=2^i, i=0,...,5)" }, @@ -777,6 +792,9 @@ StringXNumber GeometryOptions_Number[] = { { F|O, "CopyDisplayAttributes" , opt_geometry_copy_display_attributes, 0. , "Copy display attributes (visibiliy, color) when duplicating geometrical entities?" }, + { F, "DoubleClickedEntityTag" , opt_geometry_double_clicked_entity_tag, 0. , + "Tag of last double-clicked geometrical entity" }, + { F|O, "ExactExtrusion" , opt_geometry_exact_extrusion, 1. , "Use exact extrusion formula in interpolations (set to 0 to allow " "geometrical transformations of extruded entities)" }, @@ -1278,6 +1296,11 @@ StringXNumber PostProcessingOptions_Number[] = { { F|O, "CombineRemoveOriginal" , opt_post_combine_remove_orig , 1. , "Remove original views after a Combine operation" }, + { F, "DoubleClickedGraphPointX" , opt_post_double_clicked_graph_point_x , 0. , + "Abscissa of last double-clicked graph point" }, + { F, "DoubleClickedGraphPointY" , opt_post_double_clicked_graph_point_y , 0. , + "Ordinate of last double-clicked graph point" }, + { F|O, "ForceElementData" , opt_post_force_element_data , 0. , "Try to force saving datasets as ElementData" }, { F|O, "ForceNodeData" , opt_post_force_node_data , 0. , @@ -1287,10 +1310,10 @@ StringXNumber PostProcessingOptions_Number[] = { "view, 2=parsed view, 3=STL triangulation, 4=raw text, 5=Gmsh mesh, 6=MED file, " "10=automatic)" }, - { F|O, "GraphPointX" , opt_post_graph_point_x , 0. , - "Abscissa of last selected graph point" }, - { F|O, "GraphPointY" , opt_post_graph_point_y , 0. , - "Ordinate of last selected graph point" }, + { F, "GraphPointX" , opt_post_double_clicked_graph_point_x , 0. , + "Synonym for `DoubleClickedGraphPointX'" }, + { F, "GraphPointY" , opt_post_double_clicked_graph_point_y , 0. , + "Synonym for `DoubleClickedGraphPointY'" }, { F|O, "HorizontalScales" , opt_post_horizontal_scales , 1. , "Display value scales horizontally" }, diff --git a/Common/Options.cpp b/Common/Options.cpp index 05253ea7518f5c4254a6aa52314f957ff9c0b3bb..6aad58d4397812fbf946833f9fdffac915d915e5 100644 --- a/Common/Options.cpp +++ b/Common/Options.cpp @@ -1335,6 +1335,34 @@ std::string opt_general_graphics_font_engine(OPT_ARGS_STR) return CTX::instance()->glFontEngine; } +std::string opt_geometry_double_clicked_point_command(OPT_ARGS_STR) +{ + if(action & GMSH_SET) + CTX::instance()->geom.doubleClickedPointCommand = val; + return CTX::instance()->geom.doubleClickedPointCommand; +} + +std::string opt_geometry_double_clicked_line_command(OPT_ARGS_STR) +{ + if(action & GMSH_SET) + CTX::instance()->geom.doubleClickedLineCommand = val; + return CTX::instance()->geom.doubleClickedLineCommand; +} + +std::string opt_geometry_double_clicked_surface_command(OPT_ARGS_STR) +{ + if(action & GMSH_SET) + CTX::instance()->geom.doubleClickedSurfaceCommand = val; + return CTX::instance()->geom.doubleClickedSurfaceCommand; +} + +std::string opt_geometry_double_clicked_volume_command(OPT_ARGS_STR) +{ + if(action & GMSH_SET) + CTX::instance()->geom.doubleClickedVolumeCommand = val; + return CTX::instance()->geom.doubleClickedVolumeCommand; +} + std::string opt_solver_socket_name(OPT_ARGS_STR) { if(action & GMSH_SET) @@ -1545,11 +1573,11 @@ std::string opt_solver_octave_interpreter(OPT_ARGS_STR) return CTX::instance()->solver.octaveInterpreter; } -std::string opt_post_graph_point_command(OPT_ARGS_STR) +std::string opt_post_double_clicked_graph_point_command(OPT_ARGS_STR) { if(action & GMSH_SET) - CTX::instance()->post.graphPointCommand = val; - return CTX::instance()->post.graphPointCommand; + CTX::instance()->post.doubleClickedGraphPointCommand = val; + return CTX::instance()->post.doubleClickedGraphPointCommand; } #if defined(HAVE_FLTK) @@ -1610,6 +1638,19 @@ std::string opt_view_format(OPT_ARGS_STR) #endif } +std::string opt_view_double_clicked_command(OPT_ARGS_STR) +{ +#if defined(HAVE_POST) + GET_VIEWo(""); + if(action & GMSH_SET) { + opt->doubleClickedCommand = val; + } + return opt->doubleClickedCommand; +#else + return ""; +#endif +} + std::string opt_view_filename(OPT_ARGS_STR) { #if defined(HAVE_POST) @@ -4735,6 +4776,13 @@ double opt_geometry_copy_display_attributes(OPT_ARGS_NUM) return CTX::instance()->geom.copyDisplayAttributes; } +double opt_geometry_double_clicked_entity_tag(OPT_ARGS_NUM) +{ + if(action & GMSH_SET) + CTX::instance()->geom.doubleClickedEntityTag = (int)val; + return CTX::instance()->geom.doubleClickedEntityTag; +} + double opt_geometry_exact_extrusion(OPT_ARGS_NUM) { if(action & GMSH_SET) @@ -6523,18 +6571,18 @@ double opt_post_force_element_data(OPT_ARGS_NUM) return CTX::instance()->post.forceElementData; } -double opt_post_graph_point_x(OPT_ARGS_NUM) +double opt_post_double_clicked_graph_point_x(OPT_ARGS_NUM) { if(action & GMSH_SET) - CTX::instance()->post.graphPointX = val; - return CTX::instance()->post.graphPointX; + CTX::instance()->post.doubleClickedGraphPointX = val; + return CTX::instance()->post.doubleClickedGraphPointX; } -double opt_post_graph_point_y(OPT_ARGS_NUM) +double opt_post_double_clicked_graph_point_y(OPT_ARGS_NUM) { if(action & GMSH_SET) - CTX::instance()->post.graphPointY = val; - return CTX::instance()->post.graphPointY; + CTX::instance()->post.doubleClickedGraphPointY = val; + return CTX::instance()->post.doubleClickedGraphPointY; } double opt_view_nb_timestep(OPT_ARGS_NUM) diff --git a/Common/Options.h b/Common/Options.h index f5d175c128b2afb7824901a971ca285f687432b6..f0cbc83e6ec21d6691fd16c01ee6519012c87786 100644 --- a/Common/Options.h +++ b/Common/Options.h @@ -58,6 +58,10 @@ std::string opt_general_gui_theme(OPT_ARGS_STR); std::string opt_general_graphics_font(OPT_ARGS_STR); std::string opt_general_graphics_font_title(OPT_ARGS_STR); std::string opt_general_graphics_font_engine(OPT_ARGS_STR); +std::string opt_geometry_double_clicked_point_command(OPT_ARGS_STR); +std::string opt_geometry_double_clicked_line_command(OPT_ARGS_STR); +std::string opt_geometry_double_clicked_surface_command(OPT_ARGS_STR); +std::string opt_geometry_double_clicked_volume_command(OPT_ARGS_STR); std::string opt_solver_socket_name(OPT_ARGS_STR); std::string opt_solver_name(OPT_ARGS_STR); std::string opt_solver_name0(OPT_ARGS_STR); @@ -94,10 +98,11 @@ std::string opt_solver_remote_login8(OPT_ARGS_STR); std::string opt_solver_remote_login9(OPT_ARGS_STR); std::string opt_solver_octave_interpreter(OPT_ARGS_STR); std::string opt_solver_python_interpreter(OPT_ARGS_STR); -std::string opt_post_graph_point_command(OPT_ARGS_STR); +std::string opt_post_double_clicked_graph_point_command(OPT_ARGS_STR); std::string opt_view_name(OPT_ARGS_STR); std::string opt_view_format(OPT_ARGS_STR); std::string opt_view_filename(OPT_ARGS_STR); +std::string opt_view_double_clicked_command(OPT_ARGS_STR); std::string opt_view_axes_label0(OPT_ARGS_STR); std::string opt_view_axes_label1(OPT_ARGS_STR); std::string opt_view_axes_label2(OPT_ARGS_STR); @@ -380,6 +385,7 @@ double opt_geometry_snap2(OPT_ARGS_NUM); double opt_geometry_clip(OPT_ARGS_NUM); double opt_geometry_copy_meshing_method(OPT_ARGS_NUM); double opt_geometry_copy_display_attributes(OPT_ARGS_NUM); +double opt_geometry_double_clicked_entity_tag(OPT_ARGS_NUM); double opt_geometry_exact_extrusion(OPT_ARGS_NUM); double opt_geometry_match_geom_and_mesh(OPT_ARGS_NUM); double opt_mesh_label_sampling(OPT_ARGS_NUM); @@ -543,8 +549,8 @@ double opt_post_nb_views(OPT_ARGS_NUM); double opt_post_file_format(OPT_ARGS_NUM); double opt_post_force_node_data(OPT_ARGS_NUM); double opt_post_force_element_data(OPT_ARGS_NUM); -double opt_post_graph_point_x(OPT_ARGS_NUM); -double opt_post_graph_point_y(OPT_ARGS_NUM); +double opt_post_double_clicked_graph_point_x(OPT_ARGS_NUM); +double opt_post_double_clicked_graph_point_y(OPT_ARGS_NUM); double opt_view_nb_timestep(OPT_ARGS_NUM); double opt_view_nb_non_empty_timestep(OPT_ARGS_NUM); double opt_view_timestep(OPT_ARGS_NUM); diff --git a/Fltk/FlGui.cpp b/Fltk/FlGui.cpp index d68a0669948ba1bef7a2096c6385c042808f72c5..89992cf7894ff144a32e00626f94c95c48dffc33 100644 --- a/Fltk/FlGui.cpp +++ b/Fltk/FlGui.cpp @@ -979,7 +979,7 @@ char FlGui::selectEntity(int type) { return getCurrentOpenglWindow()->selectEntity (type, selectedVertices, selectedEdges, selectedFaces, selectedRegions, - selectedElements, selectedPoints); + selectedElements, selectedPoints, selectedViews); } void FlGui::setStatus(const std::string &msg, bool opengl) diff --git a/Fltk/FlGui.h b/Fltk/FlGui.h index 31ac2ad35d5ce5dae8179500228de1c7077b6f1f..9ac35b56d0bb75499b3ebd91955c9ed763c7e7f8 100644 --- a/Fltk/FlGui.h +++ b/Fltk/FlGui.h @@ -40,6 +40,7 @@ class GEdge; class GFace; class GRegion; class MElement; +class PView; class FlGui{ private: @@ -54,6 +55,7 @@ class FlGui{ std::vector<GRegion*> selectedRegions; std::vector<MElement*> selectedElements; std::vector<SPoint2> selectedPoints; + std::vector<PView*> selectedViews; public: std::vector<graphicWindow*> graph; optionWindow *options; diff --git a/Fltk/onelabGroup.cpp b/Fltk/onelabGroup.cpp index 5a4f9d7afb667915323a1216ed6e387aa025787d..2afed172b353dc68823289b2f3385ad2583720a1 100644 --- a/Fltk/onelabGroup.cpp +++ b/Fltk/onelabGroup.cpp @@ -1411,4 +1411,3 @@ void flgui_wait_cb(double time) { FlGui::instance()->wait(time); } - diff --git a/Fltk/openglWindow.cpp b/Fltk/openglWindow.cpp index c2dd08933d0cee983407323350729b1fd689d5bb..45f3ae9e83755876595be747632ca1dc479ac464 100644 --- a/Fltk/openglWindow.cpp +++ b/Fltk/openglWindow.cpp @@ -15,6 +15,8 @@ #include "GmshMessage.h" #include "GModel.h" #include "MElement.h" +#include "PView.h" +#include "PViewOptions.h" #include "Numeric.h" #include "FlGui.h" #include "OpenFile.h" @@ -353,13 +355,32 @@ int openglWindow::handle(int event) std::vector<GRegion*> regions; std::vector<MElement*> elements; std::vector<SPoint2> points; + std::vector<PView*> views; _select(ENT_ALL, false, false, Fl::event_x(), Fl::event_y(), 5, 5, - vertices, edges, faces, regions, elements, points); - if(points.size()){ // double-click on graph point - CTX::instance()->post.graphPointX = points[0].x(); - CTX::instance()->post.graphPointY = points[0].y(); - if(CTX::instance()->post.graphPointCommand.size()) - ParseString(CTX::instance()->post.graphPointCommand, true); + vertices, edges, faces, regions, elements, points, views); + if(vertices.size() && CTX::instance()->geom.doubleClickedPointCommand.size()){ + CTX::instance()->geom.doubleClickedEntityTag = vertices[0]->tag(); + ParseString(CTX::instance()->geom.doubleClickedPointCommand, true); + } + else if(edges.size() && CTX::instance()->geom.doubleClickedLineCommand.size()){ + CTX::instance()->geom.doubleClickedEntityTag = edges[0]->tag(); + ParseString(CTX::instance()->geom.doubleClickedLineCommand, true); + } + else if(faces.size() && CTX::instance()->geom.doubleClickedSurfaceCommand.size()){ + CTX::instance()->geom.doubleClickedEntityTag = faces[0]->tag(); + ParseString(CTX::instance()->geom.doubleClickedSurfaceCommand, true); + } + else if(regions.size() && CTX::instance()->geom.doubleClickedVolumeCommand.size()){ + CTX::instance()->geom.doubleClickedEntityTag = regions[0]->tag(); + ParseString(CTX::instance()->geom.doubleClickedVolumeCommand, true); + } + else if(views.size() && views[0]->getOptions()->doubleClickedCommand.size()){ + ParseString(views[0]->getOptions()->doubleClickedCommand, true); + } + else if(points.size() && CTX::instance()->post.doubleClickedGraphPointCommand.size()){ + CTX::instance()->post.doubleClickedGraphPointX = points[0].x(); + CTX::instance()->post.doubleClickedGraphPointY = points[0].y(); + ParseString(CTX::instance()->post.doubleClickedGraphPointCommand, true); } else{ // popup quick access menu status_options_cb(0, (void*)"quick_access"); @@ -629,9 +650,10 @@ int openglWindow::handle(int event) std::vector<GRegion*> regions; std::vector<MElement*> elements; std::vector<SPoint2> points; + std::vector<PView*> views; bool res = _select(_selection, false, CTX::instance()->mouseHoverMeshes, (int)_curr.win[0], (int)_curr.win[1], 5, 5, - vertices, edges, faces, regions, elements, points); + vertices, edges, faces, regions, elements, points, views); if((_selection == ENT_ALL && res) || (_selection == ENT_POINT && vertices.size()) || (_selection == ENT_LINE && edges.size()) || @@ -640,25 +662,42 @@ int openglWindow::handle(int event) cursor(FL_CURSOR_CROSS, FL_BLACK, FL_WHITE); else cursor(FL_CURSOR_DEFAULT, FL_BLACK, FL_WHITE); - GEntity *ge = 0; - if(vertices.size()) ge = vertices[0]; - else if(edges.size()) ge = edges[0]; - else if(faces.size()) ge = faces[0]; - else if(regions.size()) ge = regions[0]; - MElement *me = elements.size() ? elements[0] : 0; - std::string text; - if(ge) text += ge->getInfoString(); - if(me) text += me->getInfoString(); - if(points.size()){ + std::string text, cmd; + if(vertices.size()){ + text = vertices[0]->getInfoString(); + cmd = CTX::instance()->geom.doubleClickedPointCommand; + } + else if(edges.size()){ + text = edges[0]->getInfoString(); + cmd = CTX::instance()->geom.doubleClickedLineCommand; + } + else if(faces.size()){ + text = faces[0]->getInfoString(); + cmd = CTX::instance()->geom.doubleClickedSurfaceCommand; + } + else if(regions.size()){ + text = regions[0]->getInfoString(); + cmd = CTX::instance()->geom.doubleClickedVolumeCommand; + } + else if(elements.size()){ + text = elements[0]->getInfoString(); + } + else if(points.size()){ char tmp[256]; sprintf(tmp, "Point (%g, %g)", points[0].x(), points[0].y()); - text += tmp; - if(CTX::instance()->post.graphPointCommand.size()){ - text += std::string(" - Double-click to execute\n\n"); - std::string cmd = CTX::instance()->post.graphPointCommand; - std::replace(cmd.begin(), cmd.end(), '\r', ' '); - text += cmd; - } + text = tmp; + cmd = CTX::instance()->post.doubleClickedGraphPointCommand; + } + else if(views.size()){ + char tmp[256]; + sprintf(tmp, "View[%d]", views[0]->getIndex()); + text = tmp; + cmd = views[0]->getOptions()->doubleClickedCommand; + } + if(cmd.size()){ + text += std::string(" - Double-click to execute\n\n"); + std::replace(cmd.begin(), cmd.end(), '\r', ' '); + text += cmd; } if(CTX::instance()->tooltips) drawTooltip(text); @@ -699,7 +738,8 @@ bool openglWindow::_select(int type, bool multiple, bool mesh, std::vector<GFace*> &faces, std::vector<GRegion*> ®ions, std::vector<MElement*> &elements, - std::vector<SPoint2> &points) + std::vector<SPoint2> &points, + std::vector<PView*> &views) { // same lock as in draw() to prevent firing up a GL_SELECT rendering pass // while a GL_RENDER pass is happening (due to the asynchronus nature of @@ -709,7 +749,7 @@ bool openglWindow::_select(int type, bool multiple, bool mesh, make_current(); bool ret = _ctx->select(type, multiple, mesh, x, y, w, h, vertices, edges, faces, regions, elements, - points); + points, views); _lock = false; return ret; } @@ -720,7 +760,8 @@ char openglWindow::selectEntity(int type, std::vector<GFace*> &faces, std::vector<GRegion*> ®ions, std::vector<MElement*> &elements, - std::vector<SPoint2> &points) + std::vector<SPoint2> &points, + std::vector<PView*> &views) { // force keyboard focus in GL window take_focus(); @@ -771,7 +812,7 @@ char openglWindow::selectEntity(int type, else if(_select(_selection, multi, true, _trySelectionXYWH[0], _trySelectionXYWH[1], _trySelectionXYWH[2], _trySelectionXYWH[3], vertices, edges, faces, - regions, elements, points)){ + regions, elements, points, views)){ _selection = ENT_NONE; selectionMode = false; if(add) diff --git a/Fltk/openglWindow.h b/Fltk/openglWindow.h index d159a9717cde77da9849522a18d1f526ed4d8e86..fe83a52079eb92837f6f2ce8377ebdf6e4c3cad5 100644 --- a/Fltk/openglWindow.h +++ b/Fltk/openglWindow.h @@ -35,7 +35,8 @@ class openglWindow : public Fl_Gl_Window { bool _select(int type, bool multiple, bool mesh, int x, int y, int w, int h, std::vector<GVertex*> &vertices, std::vector<GEdge*> &edges, std::vector<GFace*> &faces, std::vector<GRegion*> ®ions, - std::vector<MElement*> &elements, std::vector<SPoint2> &points); + std::vector<MElement*> &elements, std::vector<SPoint2> &points, + std::vector<PView*> &views); protected: void draw(); int handle(int); @@ -53,15 +54,14 @@ class openglWindow : public Fl_Gl_Window { char selectEntity(int type, std::vector<GVertex*> &vertices, std::vector<GEdge*> &edges, std::vector<GFace*> &faces, std::vector<GRegion*> ®ions, - std::vector<MElement*> &elements, std::vector<SPoint2> &points); + std::vector<MElement*> &elements, std::vector<SPoint2> &points, + std::vector<PView*> &views); static openglWindow *getLastHandled(){ return _lastHandled; } static void setLastHandled(openglWindow *w){ _lastHandled = w; } void drawTooltip(const std::string &text); - /// double frequency; void moveWithGamepad(); Navigator *Nautilus; }; #endif - diff --git a/Graphics/drawContext.cpp b/Graphics/drawContext.cpp index c6734f577fbed8c6511027ccf32ed95ac9fdc639..f3915f836154b95b3d31dd2b4fd69c9d385ce6d0 100644 --- a/Graphics/drawContext.cpp +++ b/Graphics/drawContext.cpp @@ -848,21 +848,24 @@ bool drawContext::select(int type, bool multiple, bool mesh, std::vector<GFace*> &faces, std::vector<GRegion*> ®ions, std::vector<MElement*> &elements, - std::vector<SPoint2> &points) + std::vector<SPoint2> &points, + std::vector<PView*> &views) { vertices.clear(); edges.clear(); faces.clear(); regions.clear(); elements.clear(); + points.clear(); + views.clear(); // in our case the selection buffer size is equal to between 5 and 7 times the // maximum number of possible hits GModel *m = GModel::current(); int eles = (mesh && CTX::instance()->pickElements) ? 4 * m->getNumMeshElements() : 0; - int views = PView::list.size() * 100; + int nviews = PView::list.size() * 100; int size = 7 * (m->getNumVertices() + m->getNumEdges() + m->getNumFaces() + - m->getNumRegions() + eles) + views; + m->getNumRegions() + eles) + nviews; if(!size) return false; // the model is empty, don't bother! // allocate selection buffer @@ -881,6 +884,7 @@ bool drawContext::select(int type, bool multiple, bool mesh, initPosition(); drawGeom(); if(mesh) drawMesh(); + drawPost(); drawGraph2d(true); // 2d stuff @@ -1030,12 +1034,20 @@ bool drawContext::select(int type, bool multiple, bool mesh, if(!multiple) return true; } break; + case 5: + { + int tag = hits[i].ient; + if(tag >= 0 && tag < PView::list.size()) + views.push_back(PView::list[tag]); + if(!multiple) return true; + } + break; } } } - if(vertices.size() || edges.size() || faces.size() || - regions.size() || elements.size() || points.size()) + if(vertices.size() || edges.size() || faces.size() || regions.size() || + elements.size() || points.size() || views.size()) return true; return false; } diff --git a/Graphics/drawContext.h b/Graphics/drawContext.h index d641f5df7061eada14df8718f7c8aa230ec4f9ff..80b0ec88f36918119ca1cedc5af8483f6475ab94 100644 --- a/Graphics/drawContext.h +++ b/Graphics/drawContext.h @@ -34,6 +34,7 @@ class GEdge; class GFace; class GRegion; class MElement; +class PView; class openglWindow; class drawTransform { @@ -197,7 +198,8 @@ class drawContext { bool select(int type, bool multiple, bool mesh, int x, int y, int w, int h, std::vector<GVertex*> &vertices, std::vector<GEdge*> &edges, std::vector<GFace*> &faces, std::vector<GRegion*> ®ions, - std::vector<MElement*> &elements, std::vector<SPoint2> &points); + std::vector<MElement*> &elements, std::vector<SPoint2> &points, + std::vector<PView*> &views); int fix2dCoordinates(double *x, double *y); void draw3d(); void draw2d(); diff --git a/Graphics/drawPost.cpp b/Graphics/drawPost.cpp index c436eac7736c8e9339f1e36174ffae8d491b77aa..3678dddee965bfaad12aadfcf657b7161b1ab159 100644 --- a/Graphics/drawPost.cpp +++ b/Graphics/drawPost.cpp @@ -409,6 +409,11 @@ class drawPView { if(!opt->visible || opt->type != PViewOptions::Plot3D) return; if(!_ctx->isVisible(p)) return; + if(_ctx->render_mode == drawContext::GMSH_SELECT){ + glPushName(5); + glPushName(p->getIndex()); + } + glPointSize((float)opt->pointSize); gl2psPointSize((float)(opt->pointSize * CTX::instance()->print.epsPointSizeFactor)); @@ -513,6 +518,12 @@ class drawPView { for(int i = 0; i < 6; i++) glDisable((GLenum)(GL_CLIP_PLANE0 + i)); + + if(_ctx->render_mode == drawContext::GMSH_SELECT){ + glPopName(); + glPopName(); + } + } }; diff --git a/Post/PViewOptions.h b/Post/PViewOptions.h index be251b03fc1f22409b2df22477e436602d1503c0..74e7b76d00fa4abb7bacf9b860ab6b3f4d3a686d 100644 --- a/Post/PViewOptions.h +++ b/Post/PViewOptions.h @@ -99,7 +99,7 @@ class PViewOptions { int clip; // status of clip planes (bit array) int forceNumComponents, componentMap[9]; int sampling; - std::string attributes; + std::string attributes, doubleClickedCommand; struct{ unsigned int point, line, triangle, quadrangle; unsigned int tetrahedron, hexahedron, prism, pyramid; diff --git a/doc/VERSIONS.txt b/doc/VERSIONS.txt index 91bfd0783e0b187c5d40309a98a8d867cc74b779..6457914ca8b2b4c3c2867d61a0a5a1eb78e69982 100644 --- a/doc/VERSIONS.txt +++ b/doc/VERSIONS.txt @@ -1,6 +1,8 @@ 2.9.4: new Get/SetNumber and Get/SetString for direct access to ONELAB variables; new Physical specification with both label and numeric id; improved -visibility browser navigation; code cleanups. +visibility browser navigation; geometrical entities and post-processing views +can now react to double-clicks, via new generic DoubleClick options; code +cleanups. 2.9.3 (April 18, 2015): updated versions of PETSc/SLEPc and OpenCASCADE/OCE libraries used in official binary builds; new Find() command; miscellaneous code diff --git a/doc/texinfo/opt_geometry.texi b/doc/texinfo/opt_geometry.texi index 2a5fa0f138bb354266ce86a0977a4fcd0e5d814c..b21042474dc78a4547db22255a7d08471ea70c00 100644 --- a/doc/texinfo/opt_geometry.texi +++ b/doc/texinfo/opt_geometry.texi @@ -4,8 +4,28 @@ @c @ftable @code +@item Geometry.DoubleClickedPointCommand +Command parsed when double-clicking on a point@* +Default value: @code{""}@* +Saved in: @code{General.OptionsFileName} + +@item Geometry.DoubleClickedLineCommand +Command parsed when double-clicking on a line@* +Default value: @code{""}@* +Saved in: @code{General.OptionsFileName} + +@item Geometry.DoubleClickedSurfaceCommand +Command parsed when double-clicking on a surface@* +Default value: @code{""}@* +Saved in: @code{General.OptionsFileName} + +@item Geometry.DoubleClickedVolumeCommand +Command parsed when double-clicking on a volume@* +Default value: @code{""}@* +Saved in: @code{General.OptionsFileName} + @item Geometry.AutoCoherence -Should all duplicate entities be automatically removed? (if ==2, also remove degenerate entities)@* +Should all duplicate entities be automatically removed? (If AutoCoherence == 2, also remove degenerate entities)@* Default value: @code{1}@* Saved in: @code{General.OptionsFileName} @@ -24,6 +44,11 @@ Copy display attributes (visibiliy, color) when duplicating geometrical entities Default value: @code{0}@* Saved in: @code{General.OptionsFileName} +@item Geometry.DoubleClickedEntityTag +Tag of last double-clicked geometrical entity@* +Default value: @code{0}@* +Saved in: @code{-} + @item Geometry.ExactExtrusion Use exact extrusion formula in interpolations (set to 0 to allow geometrical transformations of extruded entities)@* Default value: @code{1}@* diff --git a/doc/texinfo/opt_plugin.texi b/doc/texinfo/opt_plugin.texi index 496a66ff76b3f5cd37942b36753f67f10c105bf2..ec7a7727572adb61a8aac4f475534614882dde08 100644 --- a/doc/texinfo/opt_plugin.texi +++ b/doc/texinfo/opt_plugin.texi @@ -479,9 +479,10 @@ Default value: @code{-1} @item Plugin(HarmonicToTime) Plugin(HarmonicToTime) takes the values in the time steps `RealPart' and `ImaginaryPart' of the view `View', and creates a new view containing@* @* -`View'[`RealPart'] * cos(p) - `View'[`ImaginaryPart'] * sin(p)@* +`View'[`RealPart'] * cos(p) +- `View'[`ImaginaryPart'] * sin(p)@* @* with p = 2*Pi*k/`NumSteps', k = 0, ..., `NumSteps'-1.@* +The + or - sign is controlled by `TimeSign'.@* @* If `View' < 0, the plugin is run on the current view.@* @* @@ -494,6 +495,8 @@ Default value: @code{0} Default value: @code{1} @item NumSteps Default value: @code{20} +@item TimeSign +Default value: @code{-1} @item View Default value: @code{-1} @end table diff --git a/doc/texinfo/opt_post.texi b/doc/texinfo/opt_post.texi index 7c9649dd362e5e252584b9d5e3cdce37701cdf72..c83d821de15b153785a3095b438e0cfc5a02fde6 100644 --- a/doc/texinfo/opt_post.texi +++ b/doc/texinfo/opt_post.texi @@ -4,11 +4,16 @@ @c @ftable @code -@item PostProcessing.GraphPointCommand +@item PostProcessing.DoubleClickedGraphPointCommand Command parsed when double-clicking on a graph data point (e.g. Merge Sprintf('file_%g.pos', PostProcessing.GraphPointX);)@* Default value: @code{""}@* Saved in: @code{General.OptionsFileName} +@item PostProcessing.GraphPointCommand +Synonym for `DoubleClickedGraphPointCommand'@* +Default value: @code{""}@* +Saved in: @code{General.OptionsFileName} + @item PostProcessing.AnimationDelay Delay (in seconds) between frames in automatic animation mode@* Default value: @code{0.1}@* @@ -29,6 +34,21 @@ Remove original views after a Combine operation@* Default value: @code{1}@* Saved in: @code{General.OptionsFileName} +@item PostProcessing.DoubleClickedGraphPointX +Abscissa of last double-clicked graph point@* +Default value: @code{0}@* +Saved in: @code{-} + +@item PostProcessing.DoubleClickedGraphPointY +Ordinate of last double-clicked graph point@* +Default value: @code{0}@* +Saved in: @code{-} + +@item PostProcessing.ForceElementData +Try to force saving datasets as ElementData@* +Default value: @code{0}@* +Saved in: @code{General.OptionsFileName} + @item PostProcessing.ForceNodeData Try to force saving datasets as NodeData@* Default value: @code{0}@* @@ -40,14 +60,14 @@ Default value: @code{10}@* Saved in: @code{General.OptionsFileName} @item PostProcessing.GraphPointX -Abscissa of last selected graph point@* +Synonym for `DoubleClickedGraphPointX'@* Default value: @code{0}@* -Saved in: @code{General.OptionsFileName} +Saved in: @code{-} @item PostProcessing.GraphPointY -Ordinate of last selected graph point@* +Synonym for `DoubleClickedGraphPointY'@* Default value: @code{0}@* -Saved in: @code{General.OptionsFileName} +Saved in: @code{-} @item PostProcessing.HorizontalScales Display value scales horizontally@* diff --git a/doc/texinfo/opt_view.texi b/doc/texinfo/opt_view.texi index 81abcc4408a77b26e83a2f7011665229882f9a46..320c88e6070c36e7e314f922c0088e32ee544b1f 100644 --- a/doc/texinfo/opt_view.texi +++ b/doc/texinfo/opt_view.texi @@ -39,6 +39,11 @@ Z-axis label@* Default value: @code{""}@* Saved in: @code{General.OptionsFileName} +@item View.DoubleClickedCommand +Command parsed when double-clicking on the view@* +Default value: @code{""}@* +Saved in: @code{General.OptionsFileName} + @item View.FileName Default post-processing view file name@* Default value: @code{""}@*