From: vsr Date: Thu, 13 Dec 2012 13:53:34 +0000 (+0000) Subject: Merge from V6_main 13/12/2012 X-Git-Tag: V7_1_0_pre X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6b02c4b9784848b0a660e0e54f88447af8433c50;p=modules%2Fhexablock.git Merge from V6_main 13/12/2012 --- diff --git a/configure.ac b/configure.ac index 92f9cb9..df6650c 100755 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ SHORT_VERSION=`echo $VERSION | awk -F. '{printf("%d.%d",$1,$2)}'` AC_SUBST(SHORT_VERSION) XVERSION=`echo $VERSION | awk -F. '{printf("0x%02x%02x%02x",$1,$2,$3)}'` AC_SUBST(XVERSION) -VERSION_DEV=0 +VERSION_DEV=1 AC_SUBST(VERSION_DEV) # set up MODULE_NAME variable for dynamic construction of directories (resources, etc.) diff --git a/doc/Makefile.am b/doc/Makefile.am index 1510520..5a286a6 100755 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -95,6 +95,7 @@ RSTFILES= \ general.rst \ gui.rst \ gui_asso_quad_to_geom.rst \ + gui_asso_vertex_to_geom.rst \ gui_blocks_for_cyl_pipe.rst \ gui_component.rst \ gui_cut_hexa.rst \ @@ -112,6 +113,7 @@ RSTFILES= \ gui_mesh.rst \ gui_modify_elmts.rst \ gui_modify_symmetry.rst \ + gui_association.rst \ gui_pipe.rst \ gui_prism_join_quad.rst \ gui_propag.rst \ @@ -119,7 +121,7 @@ RSTFILES= \ gui_quad_revolution.rst \ gui_remove.rst \ gui_replace_hexa.rst \ - gui_hemisphere.rst \ + gui_hemisphere.rst \ gui_vector.rst \ gui_vertex.rst \ index.rst \ @@ -132,20 +134,26 @@ RSTFILES= \ python.rst \ tui.rst \ tui_asso_quad_to_geom.rst \ + tui_asso_vertex_to_geom.rst \ tui_blocks_for_cyl_pipe.rst \ tui_cartgrid.rst \ tui_component.rst \ tui_cut_hexa.rst \ + tui_make_symmetry.rst \ + tui_perform_symmetry.rst \ tui_cylgrid.rst \ tui_cyl.rst \ tui_disc_elmts.rst \ + tui_quad_revolution.rst \ tui_discret_law.rst \ + tui_association.rst \ tui_document.rst \ tui_edge.rst \ tui_elements.rst \ tui_groups.rst \ tui_hexahedron.rst \ tui_make_elmts.rst \ + tui_hemisphere_rind.rst \ tui_merge_elmts.rst \ tui_mesh.rst \ tui_modify_elmts.rst \ @@ -154,6 +162,7 @@ RSTFILES= \ tui_propag.rst \ tui_quadrangle.rst \ tui_remove.rst \ + tui_replace_hexa.rst \ tui_sphergrid.rst \ tui_vector.rst \ tui_vertex.rst diff --git a/doc/_static/EX2.PNG b/doc/_static/EX2.PNG deleted file mode 100644 index ef5e1c8..0000000 Binary files a/doc/_static/EX2.PNG and /dev/null differ diff --git a/doc/_static/EX3.PNG b/doc/_static/EX3.PNG deleted file mode 100644 index 27a87bf..0000000 Binary files a/doc/_static/EX3.PNG and /dev/null differ diff --git a/doc/_static/EX4.PNG b/doc/_static/EX4.PNG deleted file mode 100644 index 7006bf2..0000000 Binary files a/doc/_static/EX4.PNG and /dev/null differ diff --git a/doc/_static/EX5.PNG b/doc/_static/EX5.PNG deleted file mode 100644 index 8d43543..0000000 Binary files a/doc/_static/EX5.PNG and /dev/null differ diff --git a/doc/_static/EX6.PNG b/doc/_static/EX6.PNG deleted file mode 100644 index 33370aa..0000000 Binary files a/doc/_static/EX6.PNG and /dev/null differ diff --git a/doc/_static/EX7.PNG b/doc/_static/EX7.PNG deleted file mode 100644 index 5a904c6..0000000 Binary files a/doc/_static/EX7.PNG and /dev/null differ diff --git a/doc/_static/HEXAHEDRON.PNG b/doc/_static/HEXAHEDRON.PNG deleted file mode 100644 index b2e15de..0000000 Binary files a/doc/_static/HEXAHEDRON.PNG and /dev/null differ diff --git a/doc/_static/Sans titre.PNG b/doc/_static/Sans titre.PNG deleted file mode 100644 index 7bcdf6b..0000000 Binary files a/doc/_static/Sans titre.PNG and /dev/null differ diff --git a/doc/_static/_gui_add_group.png b/doc/_static/_gui_add_group.png new file mode 100644 index 0000000..a1c5879 Binary files /dev/null and b/doc/_static/_gui_add_group.png differ diff --git a/doc/_static/after_replace_hexa.png b/doc/_static/after_replace_hexa.png new file mode 100644 index 0000000..3d9663b Binary files /dev/null and b/doc/_static/after_replace_hexa.png differ diff --git a/doc/_static/association.PNG b/doc/_static/association.PNG deleted file mode 100644 index 8a972bf..0000000 Binary files a/doc/_static/association.PNG and /dev/null differ diff --git a/doc/_static/association2.PNG b/doc/_static/association2.PNG deleted file mode 100644 index b0ffe5e..0000000 Binary files a/doc/_static/association2.PNG and /dev/null differ diff --git a/doc/_static/association2.png b/doc/_static/association2.png new file mode 100644 index 0000000..b0ffe5e Binary files /dev/null and b/doc/_static/association2.png differ diff --git a/doc/_static/before_quadrevolution.png b/doc/_static/before_quadrevolution.png index 5a826d1..63a6b90 100644 Binary files a/doc/_static/before_quadrevolution.png and b/doc/_static/before_quadrevolution.png differ diff --git a/doc/_static/before_replace_hexa.png b/doc/_static/before_replace_hexa.png new file mode 100644 index 0000000..d31797e Binary files /dev/null and b/doc/_static/before_replace_hexa.png differ diff --git a/doc/_static/before_replacehexa.png b/doc/_static/before_replacehexa.png index 8d28465..c070fa1 100644 Binary files a/doc/_static/before_replacehexa.png and b/doc/_static/before_replacehexa.png differ diff --git a/doc/_static/bielle.PNG b/doc/_static/bielle.PNG deleted file mode 100644 index 77d5abd..0000000 Binary files a/doc/_static/bielle.PNG and /dev/null differ diff --git a/doc/_static/bielle.png b/doc/_static/bielle.png new file mode 100644 index 0000000..77d5abd Binary files /dev/null and b/doc/_static/bielle.png differ diff --git a/doc/_static/bielle_mesh.png b/doc/_static/bielle_mesh.png index 1add94c..efaacb4 100644 Binary files a/doc/_static/bielle_mesh.png and b/doc/_static/bielle_mesh.png differ diff --git a/doc/_static/bride.PNG b/doc/_static/bride.PNG deleted file mode 100644 index a15e141..0000000 Binary files a/doc/_static/bride.PNG and /dev/null differ diff --git a/doc/_static/bride.png b/doc/_static/bride.png new file mode 100644 index 0000000..a15e141 Binary files /dev/null and b/doc/_static/bride.png differ diff --git a/doc/_static/bride_geom.png b/doc/_static/bride_geom.png index 3226009..d2ae218 100644 Binary files a/doc/_static/bride_geom.png and b/doc/_static/bride_geom.png differ diff --git a/doc/_static/bride_model1.png b/doc/_static/bride_model1.png index fb9d540..b145c44 100644 Binary files a/doc/_static/bride_model1.png and b/doc/_static/bride_model1.png differ diff --git a/doc/_static/bride_model2.png b/doc/_static/bride_model2.png index 6c70938..c939b7b 100644 Binary files a/doc/_static/bride_model2.png and b/doc/_static/bride_model2.png differ diff --git a/doc/_static/cad_bielle.PNG b/doc/_static/cad_bielle.PNG deleted file mode 100644 index 6a74452..0000000 Binary files a/doc/_static/cad_bielle.PNG and /dev/null differ diff --git a/doc/_static/cad_bielle.png b/doc/_static/cad_bielle.png new file mode 100644 index 0000000..6a74452 Binary files /dev/null and b/doc/_static/cad_bielle.png differ diff --git a/doc/_static/cartesian.png b/doc/_static/cartesian.png new file mode 100644 index 0000000..2ab6c5b Binary files /dev/null and b/doc/_static/cartesian.png differ diff --git a/doc/_static/cartesian_grid.png b/doc/_static/cartesian_grid.png new file mode 100644 index 0000000..351c69b Binary files /dev/null and b/doc/_static/cartesian_grid.png differ diff --git a/doc/_static/cartgrid1.PNG b/doc/_static/cartgrid1.PNG deleted file mode 100644 index 23333c6..0000000 Binary files a/doc/_static/cartgrid1.PNG and /dev/null differ diff --git a/doc/_static/cartgrid2.PNG b/doc/_static/cartgrid2.PNG deleted file mode 100644 index cfcabfd..0000000 Binary files a/doc/_static/cartgrid2.PNG and /dev/null differ diff --git a/doc/_static/cartgrid3.png b/doc/_static/cartgrid3.png index 6b68bf6..a907dc9 100644 Binary files a/doc/_static/cartgrid3.png and b/doc/_static/cartgrid3.png differ diff --git a/doc/_static/cone_mesh.png b/doc/_static/cone_mesh.png new file mode 100644 index 0000000..a03b1e9 Binary files /dev/null and b/doc/_static/cone_mesh.png differ diff --git a/doc/_static/cut.png b/doc/_static/cut.png index 40abf2b..f6c7b66 100644 Binary files a/doc/_static/cut.png and b/doc/_static/cut.png differ diff --git a/doc/_static/cut_hexa.png b/doc/_static/cut_hexa.png new file mode 100644 index 0000000..0a1c662 Binary files /dev/null and b/doc/_static/cut_hexa.png differ diff --git a/doc/_static/cyl_grid1.PNG b/doc/_static/cyl_grid1.PNG deleted file mode 100644 index 59f4c2f..0000000 Binary files a/doc/_static/cyl_grid1.PNG and /dev/null differ diff --git a/doc/_static/cyl_grid1.png b/doc/_static/cyl_grid1.png new file mode 100644 index 0000000..59f4c2f Binary files /dev/null and b/doc/_static/cyl_grid1.png differ diff --git a/doc/_static/cyl_grid2.PNG b/doc/_static/cyl_grid2.PNG deleted file mode 100644 index 3acae07..0000000 Binary files a/doc/_static/cyl_grid2.PNG and /dev/null differ diff --git a/doc/_static/cyl_grid2.png b/doc/_static/cyl_grid2.png new file mode 100644 index 0000000..3acae07 Binary files /dev/null and b/doc/_static/cyl_grid2.png differ diff --git a/doc/_static/cyl_grid3.PNG b/doc/_static/cyl_grid3.PNG deleted file mode 100644 index 6bcbb9b..0000000 Binary files a/doc/_static/cyl_grid3.PNG and /dev/null differ diff --git a/doc/_static/cyl_grid3.png b/doc/_static/cyl_grid3.png new file mode 100644 index 0000000..6bcbb9b Binary files /dev/null and b/doc/_static/cyl_grid3.png differ diff --git a/doc/_static/cylgrid.PNG b/doc/_static/cylgrid.PNG deleted file mode 100644 index d5994d1..0000000 Binary files a/doc/_static/cylgrid.PNG and /dev/null differ diff --git a/doc/_static/cylgrid1.PNG b/doc/_static/cylgrid1.PNG deleted file mode 100644 index d18191b..0000000 Binary files a/doc/_static/cylgrid1.PNG and /dev/null differ diff --git a/doc/_static/cylgrid1.png b/doc/_static/cylgrid1.png index dea67bc..3547fd1 100644 Binary files a/doc/_static/cylgrid1.png and b/doc/_static/cylgrid1.png differ diff --git a/doc/_static/cylgrid2.PNG b/doc/_static/cylgrid2.PNG deleted file mode 100644 index 63ae08a..0000000 Binary files a/doc/_static/cylgrid2.PNG and /dev/null differ diff --git a/doc/_static/cylgrid2.png b/doc/_static/cylgrid2.png index bd4ffa2..f308cd9 100644 Binary files a/doc/_static/cylgrid2.png and b/doc/_static/cylgrid2.png differ diff --git a/doc/_static/cylgrid22.png b/doc/_static/cylgrid22.png new file mode 100644 index 0000000..63ae08a Binary files /dev/null and b/doc/_static/cylgrid22.png differ diff --git a/doc/_static/cylgrid3.png b/doc/_static/cylgrid3.png index 56e284d..c6147d5 100644 Binary files a/doc/_static/cylgrid3.png and b/doc/_static/cylgrid3.png differ diff --git a/doc/_static/cylgrid4.png b/doc/_static/cylgrid4.png index afd9d39..8cc5cc5 100644 Binary files a/doc/_static/cylgrid4.png and b/doc/_static/cylgrid4.png differ diff --git a/doc/_static/cylgrid5.png b/doc/_static/cylgrid5.png index 7b04914..8b33b07 100644 Binary files a/doc/_static/cylgrid5.png and b/doc/_static/cylgrid5.png differ diff --git a/doc/_static/cylgrid6.png b/doc/_static/cylgrid6.png index d9e8b99..bd9c96a 100644 Binary files a/doc/_static/cylgrid6.png and b/doc/_static/cylgrid6.png differ diff --git a/doc/_static/cylgrids.png b/doc/_static/cylgrids.png index c928af7..0af81aa 100644 Binary files a/doc/_static/cylgrids.png and b/doc/_static/cylgrids.png differ diff --git a/doc/_static/cylinder.png b/doc/_static/cylinder.png index 3af88d8..96eac5c 100644 Binary files a/doc/_static/cylinder.png and b/doc/_static/cylinder.png differ diff --git a/doc/_static/cylindrical_grids.png b/doc/_static/cylindrical_grids.png new file mode 100644 index 0000000..fdb2f64 Binary files /dev/null and b/doc/_static/cylindrical_grids.png differ diff --git a/doc/_static/db_cylgrid.PNG b/doc/_static/db_cylgrid.PNG deleted file mode 100644 index 3b765be..0000000 Binary files a/doc/_static/db_cylgrid.PNG and /dev/null differ diff --git a/doc/_static/db_sph_grid.PNG b/doc/_static/db_sph_grid.PNG deleted file mode 100644 index f903f8e..0000000 Binary files a/doc/_static/db_sph_grid.PNG and /dev/null differ diff --git a/doc/_static/decoupe.png b/doc/_static/decoupe.png index 5ca74e0..8d8819d 100644 Binary files a/doc/_static/decoupe.png and b/doc/_static/decoupe.png differ diff --git a/doc/_static/dialogbox.PNG b/doc/_static/dialogbox.PNG deleted file mode 100644 index 3e7edd5..0000000 Binary files a/doc/_static/dialogbox.PNG and /dev/null differ diff --git a/doc/_static/dialogbox2.PNG b/doc/_static/dialogbox2.PNG deleted file mode 100644 index f1f6788..0000000 Binary files a/doc/_static/dialogbox2.PNG and /dev/null differ diff --git a/doc/_static/dialogbox_cartgrid.PNG b/doc/_static/dialogbox_cartgrid.PNG deleted file mode 100644 index 29e9dfd..0000000 Binary files a/doc/_static/dialogbox_cartgrid.PNG and /dev/null differ diff --git a/doc/_static/dialogbox_cylgrid.PNG b/doc/_static/dialogbox_cylgrid.PNG deleted file mode 100644 index 2b4524a..0000000 Binary files a/doc/_static/dialogbox_cylgrid.PNG and /dev/null differ diff --git a/doc/_static/dialogbox_discreti.PNG b/doc/_static/dialogbox_discreti.PNG deleted file mode 100644 index 6324dee..0000000 Binary files a/doc/_static/dialogbox_discreti.PNG and /dev/null differ diff --git a/doc/_static/dialogbox_law.PNG b/doc/_static/dialogbox_law.PNG deleted file mode 100644 index 887af45..0000000 Binary files a/doc/_static/dialogbox_law.PNG and /dev/null differ diff --git a/doc/_static/dialogbox_remove.PNG b/doc/_static/dialogbox_remove.PNG deleted file mode 100644 index 7063cfb..0000000 Binary files a/doc/_static/dialogbox_remove.PNG and /dev/null differ diff --git a/doc/_static/dialogbox_remove.png b/doc/_static/dialogbox_remove.png index 1da505a..15607c1 100644 Binary files a/doc/_static/dialogbox_remove.png and b/doc/_static/dialogbox_remove.png differ diff --git a/doc/_static/disco_quad.png b/doc/_static/disco_quad.png index c96851e..ed6fc4b 100644 Binary files a/doc/_static/disco_quad.png and b/doc/_static/disco_quad.png differ diff --git a/doc/_static/ex1.PNG b/doc/_static/ex1.PNG deleted file mode 100644 index b512db5..0000000 Binary files a/doc/_static/ex1.PNG and /dev/null differ diff --git a/doc/_static/ex1.png b/doc/_static/ex1.png new file mode 100644 index 0000000..d6c20f3 Binary files /dev/null and b/doc/_static/ex1.png differ diff --git a/doc/_static/ex2.png b/doc/_static/ex2.png new file mode 100644 index 0000000..ef5e1c8 Binary files /dev/null and b/doc/_static/ex2.png differ diff --git a/doc/_static/grid.png b/doc/_static/grid.png new file mode 100644 index 0000000..998f02a Binary files /dev/null and b/doc/_static/grid.png differ diff --git a/doc/_static/grid_for_revolution.png b/doc/_static/grid_for_revolution.png new file mode 100644 index 0000000..b56d0a9 Binary files /dev/null and b/doc/_static/grid_for_revolution.png differ diff --git a/doc/_static/gui_add_group.png b/doc/_static/gui_add_group.png index a7896ac..a1c5879 100644 Binary files a/doc/_static/gui_add_group.png and b/doc/_static/gui_add_group.png differ diff --git a/doc/_static/gui_add_law.png b/doc/_static/gui_add_law.png index 80c9d82..eb30b1c 100644 Binary files a/doc/_static/gui_add_law.png and b/doc/_static/gui_add_law.png differ diff --git a/doc/_static/gui_ass_edge.png b/doc/_static/gui_ass_edge.png index 10fa6e5..88c3679 100644 Binary files a/doc/_static/gui_ass_edge.png and b/doc/_static/gui_ass_edge.png differ diff --git a/doc/_static/gui_ass_edges.png b/doc/_static/gui_ass_edges.png new file mode 100644 index 0000000..3b4bd93 Binary files /dev/null and b/doc/_static/gui_ass_edges.png differ diff --git a/doc/_static/gui_ass_quad.png b/doc/_static/gui_ass_quad.png index dd39c00..c9362d1 100644 Binary files a/doc/_static/gui_ass_quad.png and b/doc/_static/gui_ass_quad.png differ diff --git a/doc/_static/gui_cut_hexa.png b/doc/_static/gui_cut_hexa.png index a47b1d5..e47b3f3 100644 Binary files a/doc/_static/gui_cut_hexa.png and b/doc/_static/gui_cut_hexa.png differ diff --git a/doc/_static/gui_cylinder.png b/doc/_static/gui_cylinder.png index 2d73ec4..e363dfd 100644 Binary files a/doc/_static/gui_cylinder.png and b/doc/_static/gui_cylinder.png differ diff --git a/doc/_static/gui_disco_edge.png b/doc/_static/gui_disco_edge.png index 6368cd7..5013c53 100644 Binary files a/doc/_static/gui_disco_edge.png and b/doc/_static/gui_disco_edge.png differ diff --git a/doc/_static/gui_disco_edges.png b/doc/_static/gui_disco_edges.png new file mode 100644 index 0000000..ed476c3 Binary files /dev/null and b/doc/_static/gui_disco_edges.png differ diff --git a/doc/_static/gui_disco_quad.png b/doc/_static/gui_disco_quad.png index 978f7bb..1172977 100644 Binary files a/doc/_static/gui_disco_quad.png and b/doc/_static/gui_disco_quad.png differ diff --git a/doc/_static/gui_disco_vertex.png b/doc/_static/gui_disco_vertex.png index 37961f9..8828c92 100644 Binary files a/doc/_static/gui_disco_vertex.png and b/doc/_static/gui_disco_vertex.png differ diff --git a/doc/_static/gui_edge2.png b/doc/_static/gui_edge2.png index 727f8d3..c74252e 100644 Binary files a/doc/_static/gui_edge2.png and b/doc/_static/gui_edge2.png differ diff --git a/doc/_static/gui_edge_vertices.png b/doc/_static/gui_edge_vertices.png index e45c58b..320e405 100644 Binary files a/doc/_static/gui_edge_vertices.png and b/doc/_static/gui_edge_vertices.png differ diff --git a/doc/_static/gui_hemispherical.png b/doc/_static/gui_hemispherical.png index cfa9a52..cf04973 100644 Binary files a/doc/_static/gui_hemispherical.png and b/doc/_static/gui_hemispherical.png differ diff --git a/doc/_static/gui_hexa_quads.png b/doc/_static/gui_hexa_quads.png index f51d29a..fa1c629 100644 Binary files a/doc/_static/gui_hexa_quads.png and b/doc/_static/gui_hexa_quads.png differ diff --git a/doc/_static/gui_hexa_vertices.png b/doc/_static/gui_hexa_vertices.png index 6c7fe78..795e1ab 100644 Binary files a/doc/_static/gui_hexa_vertices.png and b/doc/_static/gui_hexa_vertices.png differ diff --git a/doc/_static/gui_join_quads.png b/doc/_static/gui_join_quads.png index b81cf11..66411a5 100644 Binary files a/doc/_static/gui_join_quads.png and b/doc/_static/gui_join_quads.png differ diff --git a/doc/_static/gui_make_cart_grid.png b/doc/_static/gui_make_cart_grid.png index 38d04c8..f401965 100644 Binary files a/doc/_static/gui_make_cart_grid.png and b/doc/_static/gui_make_cart_grid.png differ diff --git a/doc/_static/gui_make_cyl_grid.png b/doc/_static/gui_make_cyl_grid.png index 01e7111..745ea05 100644 Binary files a/doc/_static/gui_make_cyl_grid.png and b/doc/_static/gui_make_cyl_grid.png differ diff --git a/doc/_static/gui_make_cyl_grid_irregular.png b/doc/_static/gui_make_cyl_grid_irregular.png index bcc3025..97c66d4 100644 Binary files a/doc/_static/gui_make_cyl_grid_irregular.png and b/doc/_static/gui_make_cyl_grid_irregular.png differ diff --git a/doc/_static/gui_make_cylinder.png b/doc/_static/gui_make_cylinder.png index ef5e261..6e4d043 100644 Binary files a/doc/_static/gui_make_cylinder.png and b/doc/_static/gui_make_cylinder.png differ diff --git a/doc/_static/gui_make_cylinders.png b/doc/_static/gui_make_cylinders.png index 3c573e6..11c8317 100644 Binary files a/doc/_static/gui_make_cylinders.png and b/doc/_static/gui_make_cylinders.png differ diff --git a/doc/_static/gui_make_line_symmetry.png b/doc/_static/gui_make_line_symmetry.png index 614d75f..0897e06 100644 Binary files a/doc/_static/gui_make_line_symmetry.png and b/doc/_static/gui_make_line_symmetry.png differ diff --git a/doc/_static/gui_make_pipe.png b/doc/_static/gui_make_pipe.png index dbcd99a..2676693 100644 Binary files a/doc/_static/gui_make_pipe.png and b/doc/_static/gui_make_pipe.png differ diff --git a/doc/_static/gui_make_pipes.png b/doc/_static/gui_make_pipes.png index ea23eae..95dd406 100644 Binary files a/doc/_static/gui_make_pipes.png and b/doc/_static/gui_make_pipes.png differ diff --git a/doc/_static/gui_make_plan_symmetry.png b/doc/_static/gui_make_plan_symmetry.png index a45eeae..dcbca69 100644 Binary files a/doc/_static/gui_make_plan_symmetry.png and b/doc/_static/gui_make_plan_symmetry.png differ diff --git a/doc/_static/gui_make_point_symmetry.png b/doc/_static/gui_make_point_symmetry.png index 2082e7c..cb32147 100644 Binary files a/doc/_static/gui_make_point_symmetry.png and b/doc/_static/gui_make_point_symmetry.png differ diff --git a/doc/_static/gui_make_spher_grid.png b/doc/_static/gui_make_spher_grid.png index b24ba0d..38fabf1 100644 Binary files a/doc/_static/gui_make_spher_grid.png and b/doc/_static/gui_make_spher_grid.png differ diff --git a/doc/_static/gui_make_transfo_rotation.png b/doc/_static/gui_make_transfo_rotation.png index b95d522..354b676 100644 Binary files a/doc/_static/gui_make_transfo_rotation.png and b/doc/_static/gui_make_transfo_rotation.png differ diff --git a/doc/_static/gui_make_transfo_scale.png b/doc/_static/gui_make_transfo_scale.png index 22fb949..bfeafef 100644 Binary files a/doc/_static/gui_make_transfo_scale.png and b/doc/_static/gui_make_transfo_scale.png differ diff --git a/doc/_static/gui_make_transfo_translation.png b/doc/_static/gui_make_transfo_translation.png index 32d717f..4cdf387 100644 Binary files a/doc/_static/gui_make_transfo_translation.png and b/doc/_static/gui_make_transfo_translation.png differ diff --git a/doc/_static/gui_merge_edges.png b/doc/_static/gui_merge_edges.png index eb0c4f2..bb0cde7 100644 Binary files a/doc/_static/gui_merge_edges.png and b/doc/_static/gui_merge_edges.png differ diff --git a/doc/_static/gui_merge_quads.png b/doc/_static/gui_merge_quads.png index caf75e9..6a41f0a 100644 Binary files a/doc/_static/gui_merge_quads.png and b/doc/_static/gui_merge_quads.png differ diff --git a/doc/_static/gui_merge_vertices.png b/doc/_static/gui_merge_vertices.png index 064af3e..2d3f9ad 100644 Binary files a/doc/_static/gui_merge_vertices.png and b/doc/_static/gui_merge_vertices.png differ diff --git a/doc/_static/gui_mesh.png b/doc/_static/gui_mesh.png index b091a76..7e10951 100644 Binary files a/doc/_static/gui_mesh.png and b/doc/_static/gui_mesh.png differ diff --git a/doc/_static/gui_modify_line_symmetry.png b/doc/_static/gui_modify_line_symmetry.png index c0fe01b..0897e06 100644 Binary files a/doc/_static/gui_modify_line_symmetry.png and b/doc/_static/gui_modify_line_symmetry.png differ diff --git a/doc/_static/gui_modify_plan_symmetry.png b/doc/_static/gui_modify_plan_symmetry.png index 06ff5bd..dcbca69 100644 Binary files a/doc/_static/gui_modify_plan_symmetry.png and b/doc/_static/gui_modify_plan_symmetry.png differ diff --git a/doc/_static/gui_modify_point_symmetry.png b/doc/_static/gui_modify_point_symmetry.png index bfc3a16..41373f5 100644 Binary files a/doc/_static/gui_modify_point_symmetry.png and b/doc/_static/gui_modify_point_symmetry.png differ diff --git a/doc/_static/gui_modify_transfo_rotation.png b/doc/_static/gui_modify_transfo_rotation.png index 9a0927c..a7d466d 100644 Binary files a/doc/_static/gui_modify_transfo_rotation.png and b/doc/_static/gui_modify_transfo_rotation.png differ diff --git a/doc/_static/gui_modify_transfo_scale.png b/doc/_static/gui_modify_transfo_scale.png index 3bbdf75..3ce6a73 100644 Binary files a/doc/_static/gui_modify_transfo_scale.png and b/doc/_static/gui_modify_transfo_scale.png differ diff --git a/doc/_static/gui_modify_transfo_translation.png b/doc/_static/gui_modify_transfo_translation.png index d503cef..7df8b13 100644 Binary files a/doc/_static/gui_modify_transfo_translation.png and b/doc/_static/gui_modify_transfo_translation.png differ diff --git a/doc/_static/gui_new_document.png b/doc/_static/gui_new_document.png index a64bfea..647aec2 100644 Binary files a/doc/_static/gui_new_document.png and b/doc/_static/gui_new_document.png differ diff --git a/doc/_static/gui_parthemispherical.png b/doc/_static/gui_parthemispherical.png index 3346eb8..052d7a1 100644 Binary files a/doc/_static/gui_parthemispherical.png and b/doc/_static/gui_parthemispherical.png differ diff --git a/doc/_static/gui_partrind.png b/doc/_static/gui_partrind.png index b2ec679..b6a0345 100644 Binary files a/doc/_static/gui_partrind.png and b/doc/_static/gui_partrind.png differ diff --git a/doc/_static/gui_pipe.png b/doc/_static/gui_pipe.png index 77ec2fa..8ce9b94 100644 Binary files a/doc/_static/gui_pipe.png and b/doc/_static/gui_pipe.png differ diff --git a/doc/_static/gui_prism_quads.png b/doc/_static/gui_prism_quads.png index c355851..9d774bc 100644 Binary files a/doc/_static/gui_prism_quads.png and b/doc/_static/gui_prism_quads.png differ diff --git a/doc/_static/gui_prism_quads_irregular.png b/doc/_static/gui_prism_quads_irregular.png new file mode 100644 index 0000000..8e00032 Binary files /dev/null and b/doc/_static/gui_prism_quads_irregular.png differ diff --git a/doc/_static/gui_propagation.png b/doc/_static/gui_propagation.png new file mode 100644 index 0000000..208205a Binary files /dev/null and b/doc/_static/gui_propagation.png differ diff --git a/doc/_static/gui_quad_edges.png b/doc/_static/gui_quad_edges.png index 473dae7..57dd154 100644 Binary files a/doc/_static/gui_quad_edges.png and b/doc/_static/gui_quad_edges.png differ diff --git a/doc/_static/gui_quad_vertices.png b/doc/_static/gui_quad_vertices.png index 56bc167..7325437 100644 Binary files a/doc/_static/gui_quad_vertices.png and b/doc/_static/gui_quad_vertices.png differ diff --git a/doc/_static/gui_quadrevolution.png b/doc/_static/gui_quadrevolution.png index bfe4639..8e60a8e 100644 Binary files a/doc/_static/gui_quadrevolution.png and b/doc/_static/gui_quadrevolution.png differ diff --git a/doc/_static/gui_replacehexa.png b/doc/_static/gui_replacehexa.png index 139cc54..4c134a6 100644 Binary files a/doc/_static/gui_replacehexa.png and b/doc/_static/gui_replacehexa.png differ diff --git a/doc/_static/gui_rind.png b/doc/_static/gui_rind.png index 94dee49..b9cb5f1 100644 Binary files a/doc/_static/gui_rind.png and b/doc/_static/gui_rind.png differ diff --git a/doc/_static/gui_vector1.png b/doc/_static/gui_vector1.png index 827a9d4..44d5f96 100644 Binary files a/doc/_static/gui_vector1.png and b/doc/_static/gui_vector1.png differ diff --git a/doc/_static/gui_vector2.png b/doc/_static/gui_vector2.png index 6c66550..5e7dde3 100644 Binary files a/doc/_static/gui_vector2.png and b/doc/_static/gui_vector2.png differ diff --git a/doc/_static/gui_vertex.png b/doc/_static/gui_vertex.png index 3846af1..4f011e8 100644 Binary files a/doc/_static/gui_vertex.png and b/doc/_static/gui_vertex.png differ diff --git a/doc/_static/gui_vertex_assoc_coordinates.png b/doc/_static/gui_vertex_assoc_coordinates.png new file mode 100644 index 0000000..75d0ab6 Binary files /dev/null and b/doc/_static/gui_vertex_assoc_coordinates.png differ diff --git a/doc/_static/gui_vertex_assoc_on_edge_byCoords.png b/doc/_static/gui_vertex_assoc_on_edge_byCoords.png new file mode 100644 index 0000000..1412bed Binary files /dev/null and b/doc/_static/gui_vertex_assoc_on_edge_byCoords.png differ diff --git a/doc/_static/gui_vertex_assoc_on_edge_byLength.png b/doc/_static/gui_vertex_assoc_on_edge_byLength.png new file mode 100644 index 0000000..eecb427 Binary files /dev/null and b/doc/_static/gui_vertex_assoc_on_edge_byLength.png differ diff --git a/doc/_static/gui_vertex_assoc_on_edge_byParam.png b/doc/_static/gui_vertex_assoc_on_edge_byParam.png new file mode 100644 index 0000000..fb2603f Binary files /dev/null and b/doc/_static/gui_vertex_assoc_on_edge_byParam.png differ diff --git a/doc/_static/gui_vertex_assoc_on_face_byCoords.png b/doc/_static/gui_vertex_assoc_on_face_byCoords.png new file mode 100644 index 0000000..b17967e Binary files /dev/null and b/doc/_static/gui_vertex_assoc_on_face_byCoords.png differ diff --git a/doc/_static/gui_vertex_assoc_on_face_byParam.png b/doc/_static/gui_vertex_assoc_on_face_byParam.png new file mode 100644 index 0000000..617020c Binary files /dev/null and b/doc/_static/gui_vertex_assoc_on_face_byParam.png differ diff --git a/doc/_static/gui_vertex_assoc_on_geom_point.png b/doc/_static/gui_vertex_assoc_on_geom_point.png new file mode 100644 index 0000000..cbe74dc Binary files /dev/null and b/doc/_static/gui_vertex_assoc_on_geom_point.png differ diff --git a/doc/_static/gui_vertex_assoc_on_lines_intersection.png b/doc/_static/gui_vertex_assoc_on_lines_intersection.png new file mode 100644 index 0000000..8c79b85 Binary files /dev/null and b/doc/_static/gui_vertex_assoc_on_lines_intersection.png differ diff --git a/doc/_static/hemispherical_grid.png b/doc/_static/hemispherical_grid.png new file mode 100644 index 0000000..f70b836 Binary files /dev/null and b/doc/_static/hemispherical_grid.png differ diff --git a/doc/_static/hemisphericalgrid.png b/doc/_static/hemisphericalgrid.png index c640993..7dd5846 100644 Binary files a/doc/_static/hemisphericalgrid.png and b/doc/_static/hemisphericalgrid.png differ diff --git a/doc/_static/hexahedron.png b/doc/_static/hexahedron.png new file mode 100644 index 0000000..b2e15de Binary files /dev/null and b/doc/_static/hexahedron.png differ diff --git a/doc/_static/interactive.PNG b/doc/_static/interactive.PNG deleted file mode 100644 index fecd3c4..0000000 Binary files a/doc/_static/interactive.PNG and /dev/null differ diff --git a/doc/_static/interactive.png b/doc/_static/interactive.png index 0aa0816..c7906c0 100644 Binary files a/doc/_static/interactive.png and b/doc/_static/interactive.png differ diff --git a/doc/_static/interactive2.png b/doc/_static/interactive2.png new file mode 100644 index 0000000..fecd3c4 Binary files /dev/null and b/doc/_static/interactive2.png differ diff --git a/doc/_static/intersec_cyl.PNG b/doc/_static/intersec_cyl.PNG deleted file mode 100644 index b10e085..0000000 Binary files a/doc/_static/intersec_cyl.PNG and /dev/null differ diff --git a/doc/_static/intersec_cyl.png b/doc/_static/intersec_cyl.png new file mode 100644 index 0000000..b10e085 Binary files /dev/null and b/doc/_static/intersec_cyl.png differ diff --git a/doc/_static/irregular_cylindrical.png b/doc/_static/irregular_cylindrical.png new file mode 100644 index 0000000..f9a3d95 Binary files /dev/null and b/doc/_static/irregular_cylindrical.png differ diff --git a/doc/_static/irregular_prism.png b/doc/_static/irregular_prism.png new file mode 100644 index 0000000..d67f9fd Binary files /dev/null and b/doc/_static/irregular_prism.png differ diff --git a/doc/_static/join.png b/doc/_static/join.png index eeb4ba1..8b47ddb 100644 Binary files a/doc/_static/join.png and b/doc/_static/join.png differ diff --git a/doc/_static/make_cylinder.png b/doc/_static/make_cylinder.png new file mode 100644 index 0000000..3073b97 Binary files /dev/null and b/doc/_static/make_cylinder.png differ diff --git a/doc/_static/make_cylinders.png b/doc/_static/make_cylinders.png new file mode 100644 index 0000000..4227b7d Binary files /dev/null and b/doc/_static/make_cylinders.png differ diff --git a/doc/_static/make_line_symmetry.png b/doc/_static/make_line_symmetry.png new file mode 100644 index 0000000..d5e6545 Binary files /dev/null and b/doc/_static/make_line_symmetry.png differ diff --git a/doc/_static/make_pipe.png b/doc/_static/make_pipe.png new file mode 100644 index 0000000..c0e9ad7 Binary files /dev/null and b/doc/_static/make_pipe.png differ diff --git a/doc/_static/make_pipes.png b/doc/_static/make_pipes.png new file mode 100644 index 0000000..3256288 Binary files /dev/null and b/doc/_static/make_pipes.png differ diff --git a/doc/_static/make_plan_symmetry.png b/doc/_static/make_plan_symmetry.png new file mode 100644 index 0000000..86baeaf Binary files /dev/null and b/doc/_static/make_plan_symmetry.png differ diff --git a/doc/_static/make_point_symmetry.png b/doc/_static/make_point_symmetry.png new file mode 100644 index 0000000..23a0564 Binary files /dev/null and b/doc/_static/make_point_symmetry.png differ diff --git a/doc/_static/make_rotation.png b/doc/_static/make_rotation.png new file mode 100644 index 0000000..d1cb96d Binary files /dev/null and b/doc/_static/make_rotation.png differ diff --git a/doc/_static/make_scale.png b/doc/_static/make_scale.png new file mode 100644 index 0000000..5e5995e Binary files /dev/null and b/doc/_static/make_scale.png differ diff --git a/doc/_static/make_sym_line.png b/doc/_static/make_sym_line.png new file mode 100644 index 0000000..727088a Binary files /dev/null and b/doc/_static/make_sym_line.png differ diff --git a/doc/_static/make_sym_plane.png b/doc/_static/make_sym_plane.png new file mode 100644 index 0000000..58b8994 Binary files /dev/null and b/doc/_static/make_sym_plane.png differ diff --git a/doc/_static/make_sym_point.png b/doc/_static/make_sym_point.png new file mode 100644 index 0000000..494de95 Binary files /dev/null and b/doc/_static/make_sym_point.png differ diff --git a/doc/_static/make_translation.png b/doc/_static/make_translation.png new file mode 100644 index 0000000..bc4c40e Binary files /dev/null and b/doc/_static/make_translation.png differ diff --git a/doc/_static/meshing1.PNG b/doc/_static/meshing1.PNG deleted file mode 100644 index d2ac18d..0000000 Binary files a/doc/_static/meshing1.PNG and /dev/null differ diff --git a/doc/_static/meshing1.png b/doc/_static/meshing1.png new file mode 100644 index 0000000..d2ac18d Binary files /dev/null and b/doc/_static/meshing1.png differ diff --git a/doc/_static/meshing2.PNG b/doc/_static/meshing2.PNG deleted file mode 100644 index 70fb219..0000000 Binary files a/doc/_static/meshing2.PNG and /dev/null differ diff --git a/doc/_static/meshing2.png b/doc/_static/meshing2.png new file mode 100644 index 0000000..70fb219 Binary files /dev/null and b/doc/_static/meshing2.png differ diff --git a/doc/_static/meshing3.PNG b/doc/_static/meshing3.PNG deleted file mode 100644 index adb149e..0000000 Binary files a/doc/_static/meshing3.PNG and /dev/null differ diff --git a/doc/_static/meshing3.png b/doc/_static/meshing3.png new file mode 100644 index 0000000..adb149e Binary files /dev/null and b/doc/_static/meshing3.png differ diff --git a/doc/_static/no_cut.png b/doc/_static/no_cut.png index de2f4b8..e83d720 100644 Binary files a/doc/_static/no_cut.png and b/doc/_static/no_cut.png differ diff --git a/doc/_static/no_decoupe.png b/doc/_static/no_decoupe.png index 6cfe10e..6887802 100644 Binary files a/doc/_static/no_decoupe.png and b/doc/_static/no_decoupe.png differ diff --git a/doc/_static/non_cut_hexa.png b/doc/_static/non_cut_hexa.png new file mode 100644 index 0000000..c814327 Binary files /dev/null and b/doc/_static/non_cut_hexa.png differ diff --git a/doc/_static/parthemisphericalgrid.png b/doc/_static/parthemisphericalgrid.png index 20036ac..ab8b385 100644 Binary files a/doc/_static/parthemisphericalgrid.png and b/doc/_static/parthemisphericalgrid.png differ diff --git a/doc/_static/partial_hemispherical_grid.png b/doc/_static/partial_hemispherical_grid.png new file mode 100644 index 0000000..3ac6d09 Binary files /dev/null and b/doc/_static/partial_hemispherical_grid.png differ diff --git a/doc/_static/partial_rind_grid.png b/doc/_static/partial_rind_grid.png new file mode 100644 index 0000000..8769af2 Binary files /dev/null and b/doc/_static/partial_rind_grid.png differ diff --git a/doc/_static/partrindgrid.png b/doc/_static/partrindgrid.png index b90c791..75a511a 100644 Binary files a/doc/_static/partrindgrid.png and b/doc/_static/partrindgrid.png differ diff --git a/doc/_static/pipe.png b/doc/_static/pipe.png index c3193f1..feeec36 100644 Binary files a/doc/_static/pipe.png and b/doc/_static/pipe.png differ diff --git a/doc/_static/point_sym_before.png b/doc/_static/point_sym_before.png index dec83d0..d87d3a4 100644 Binary files a/doc/_static/point_sym_before.png and b/doc/_static/point_sym_before.png differ diff --git a/doc/_static/prisme.png b/doc/_static/prisme.png index 3a089ad..5912363 100644 Binary files a/doc/_static/prisme.png and b/doc/_static/prisme.png differ diff --git a/doc/_static/prisme_gui.png b/doc/_static/prisme_gui.png index 68ea36f..9ab7920 100644 Binary files a/doc/_static/prisme_gui.png and b/doc/_static/prisme_gui.png differ diff --git a/doc/_static/prisme_gui2.png b/doc/_static/prisme_gui2.png new file mode 100644 index 0000000..8ba49f1 Binary files /dev/null and b/doc/_static/prisme_gui2.png differ diff --git a/doc/_static/quad_revolution.png b/doc/_static/quad_revolution.png new file mode 100644 index 0000000..a6ace94 Binary files /dev/null and b/doc/_static/quad_revolution.png differ diff --git a/doc/_static/quadrevolution.png b/doc/_static/quadrevolution.png index d3baf1d..39d20e0 100644 Binary files a/doc/_static/quadrevolution.png and b/doc/_static/quadrevolution.png differ diff --git a/doc/_static/remove1.PNG b/doc/_static/remove1.PNG deleted file mode 100644 index b1ad51d..0000000 Binary files a/doc/_static/remove1.PNG and /dev/null differ diff --git a/doc/_static/remove2.PNG b/doc/_static/remove2.PNG deleted file mode 100644 index eb59e9e..0000000 Binary files a/doc/_static/remove2.PNG and /dev/null differ diff --git a/doc/_static/remove3.PNG b/doc/_static/remove3.PNG deleted file mode 100644 index 8aa94b3..0000000 Binary files a/doc/_static/remove3.PNG and /dev/null differ diff --git a/doc/_static/remove3.png b/doc/_static/remove3.png index c2e0e0d..557b34e 100644 Binary files a/doc/_static/remove3.png and b/doc/_static/remove3.png differ diff --git a/doc/_static/remove33.png b/doc/_static/remove33.png new file mode 100644 index 0000000..8aa94b3 Binary files /dev/null and b/doc/_static/remove33.png differ diff --git a/doc/_static/remove_assoc.png b/doc/_static/remove_assoc.png new file mode 100644 index 0000000..594af6b Binary files /dev/null and b/doc/_static/remove_assoc.png differ diff --git a/doc/_static/remove_assocs.png b/doc/_static/remove_assocs.png new file mode 100644 index 0000000..cb7cb4b Binary files /dev/null and b/doc/_static/remove_assocs.png differ diff --git a/doc/_static/replacehexa.png b/doc/_static/replacehexa.png index b846b7e..4d1e289 100644 Binary files a/doc/_static/replacehexa.png and b/doc/_static/replacehexa.png differ diff --git a/doc/_static/rind_grid.png b/doc/_static/rind_grid.png new file mode 100644 index 0000000..a1eb836 Binary files /dev/null and b/doc/_static/rind_grid.png differ diff --git a/doc/_static/rindgrid.png b/doc/_static/rindgrid.png index 356976e..04cf598 100644 Binary files a/doc/_static/rindgrid.png and b/doc/_static/rindgrid.png differ diff --git a/doc/_static/show_assocs.png b/doc/_static/show_assocs.png new file mode 100644 index 0000000..2c2345d Binary files /dev/null and b/doc/_static/show_assocs.png differ diff --git a/doc/_static/sph_grid.PNG b/doc/_static/sph_grid.PNG deleted file mode 100644 index de084b2..0000000 Binary files a/doc/_static/sph_grid.PNG and /dev/null differ diff --git a/doc/_static/sph_grid.png b/doc/_static/sph_grid.png index 5051da2..9c96145 100644 Binary files a/doc/_static/sph_grid.png and b/doc/_static/sph_grid.png differ diff --git a/doc/_static/sph_grid2.PNG b/doc/_static/sph_grid2.PNG deleted file mode 100644 index 5232aad..0000000 Binary files a/doc/_static/sph_grid2.PNG and /dev/null differ diff --git a/doc/_static/sph_grid_for_make_sym_examle.png b/doc/_static/sph_grid_for_make_sym_examle.png new file mode 100644 index 0000000..f9eeaf6 Binary files /dev/null and b/doc/_static/sph_grid_for_make_sym_examle.png differ diff --git a/doc/_static/spherical_grid.png b/doc/_static/spherical_grid.png new file mode 100644 index 0000000..42fdf54 Binary files /dev/null and b/doc/_static/spherical_grid.png differ diff --git a/doc/_static/transfo0.png b/doc/_static/transfo0.png index b7a7beb..3197afc 100644 Binary files a/doc/_static/transfo0.png and b/doc/_static/transfo0.png differ diff --git a/doc/_static/transfo_rotation.png b/doc/_static/transfo_rotation.png index dba5d1c..095f237 100644 Binary files a/doc/_static/transfo_rotation.png and b/doc/_static/transfo_rotation.png differ diff --git a/doc/_static/transfo_scale.png b/doc/_static/transfo_scale.png index 0c0182d..673664f 100644 Binary files a/doc/_static/transfo_scale.png and b/doc/_static/transfo_scale.png differ diff --git a/doc/_static/transfo_translation.png b/doc/_static/transfo_translation.png index 5e83959..b2260ea 100644 Binary files a/doc/_static/transfo_translation.png and b/doc/_static/transfo_translation.png differ diff --git a/doc/_static/tuyau_courbe.PNG b/doc/_static/tuyau_courbe.PNG deleted file mode 100644 index 4c17200..0000000 Binary files a/doc/_static/tuyau_courbe.PNG and /dev/null differ diff --git a/doc/_static/tuyau_courbe.png b/doc/_static/tuyau_courbe.png new file mode 100644 index 0000000..4c17200 Binary files /dev/null and b/doc/_static/tuyau_courbe.png differ diff --git a/doc/_static/verif_png b/doc/_static/verif_png new file mode 100755 index 0000000..652ede7 --- /dev/null +++ b/doc/_static/verif_png @@ -0,0 +1,8 @@ + +for fic in *.PNG + do + radical=`echo "$fic" | cut -d. -f1` + if ( [ -f "$radical".png ] ) then + echo " *** ARRRG : $radical.png et $radical.PNG" + fi + done diff --git a/doc/annexe.rst b/doc/annexe.rst index 646e23a..9595431 100644 --- a/doc/annexe.rst +++ b/doc/annexe.rst @@ -2,15 +2,15 @@ .. _annexe: -====== +======================================================= Appendix: naming rule to find elements in an hexahedron -====== +======================================================= Definition of an hexahedron =========================== -.. image:: _static/HEXAHEDRON.PNG +.. image:: _static/hexahedron.png :align: center diff --git a/doc/block_method.rst b/doc/block_method.rst index de20512..2b6bc58 100644 --- a/doc/block_method.rst +++ b/doc/block_method.rst @@ -2,73 +2,87 @@ .. _blockmethod: -=============================== -Principle: the method by blocks -=============================== - -Principle -========= - -The principle of the method by block is to decompose the geometry to -be meshed into a set of hexahedra related per face. The initial -geometry is divided into a new geometry which has the property to be a -set solids. All these solids are hexahedra with shared faces. Once -cutting is complete, the mesh is easy to obtain. - -The method by blocks consists in: +======================= +Build a model of blocks +======================= -- finding a compound of blocks, -- this compound of blocks has to be equivalent to the initial geometry to mesh. +What is a model of blocks ? +=========================== +A block (or a hexahedron) is a volume defined by: + - 8 vertices + - 12 edges + - 6 quadrangular faces -A block is a volume defined by: +A model of blocks is a set of blocks. -- 8 vertices -- 12 edges - - *straight line*, *curve* -- 6 quadrangular faces - - *planar face*, *3D face* - -A compound of blocks is a volume that for each face is: - -- either a free face (in one block) -- or a face shared between 2 blocks +And for each quadrangle of a model of blocks, this quadrangle is: + - or a free face + - or a face shared between 2 blocks +How to find a model of blocks ? +=============================== +In this version of HEXABLOCK component, the user must find himself the model of blocks that is adapted for his geometry. + .. _modelbloc: -Create a model of blocks -======================== +How to create a model of blocks ? +================================= + +When the user find the model of blocks necessary for his geometry to be meshed with hexahedra, +HEXABLOCK component has a lot of tool to build this model of blocks: -A model of block is a compound of blocks based on a topological -definition. The model of blocks construction can be build by using the -two following methods: +- basic functions: + - create one hexahedron + - create a hexahedra with 2, 3, 4 or 5 quadrangles + - remove hexahedra -1. Construct and associate blocks (hexahedra) - - the main operations for creating blocks are: - - Basics: create, remove,transform - - construct hexahedra grids: cartesian, cylindrical, spherical +- grid building: + - cartesian grid + - cylindrical grid + - spherical grid - - blocks association operations: - - merge, cut, disconnect hexahedra - - prism, join quadrangles - - merge two quadrangles of two blocks - - merge two edges - - merge two vertices - - disconnect two vertices - - create hexahedra between two existing quadrangles - -2. Construct hexahedra via predefined models: - - cylinder - - pipe - - two intersected cylinders - - two intersected pipes +- predefined model of blocks: + - for cylinder + - for pipe + - for two intersected cylinders + - for two intersected pipes + - for hemisphere + - for ring + +- powerfull functions: + - prism quadrangles + - join quadrangles + - make hexahedra by revolution of quadrangles + - cut an edge to slice hexahedra + - replace an hexadron by a pattern + +- by transformation: + - translation + - rotation + - scale + +- by symetry: + - with a point + - with a line + - with a plane + +- by merging: + - of two vertices + - of two edges + - of two quadrangles + +- by disconnection: + - of two vertices + - of two edges + - of two quadrangles Example of simple model of blocks ================================= -.. image:: _static/ex1.PNG +.. image:: _static/ex1.png :align: center .. centered:: - 2 blocks linked by 1 face + An exemple of a model with 12 blocks diff --git a/doc/cad.rst b/doc/cad.rst index f0390a2..dbfa14b 100644 --- a/doc/cad.rst +++ b/doc/cad.rst @@ -2,34 +2,21 @@ .. _cad: -======= -The CAD -======= +============================================= +Import or build a geometry without constraint +============================================= +A main feature of HEXABLOCK is to define a geometry without constraint for hexahedral meshing. +The user has two ways to define the geometry for meshing: -The geometry to mesh is defined by a set of independent shapes, these -shapes are external references to the GEOM module of SALOME. The -shapes of this set can be faces and/or solids. In HexaBlock module you -can: +- import a geometry from a STEP, IGES or BREP file, -- use a geometry defined in GEOM module -- import geometrical objects from BREP, IGES, STEP files. +- build a geometry with GEOM component. -The TUI script to import geometrical objects from a BREP file is:: +The following pictures show different geometries for exemples: - import os - import GEOM - import SALOMEDS - import hexablock - - # Example of import from STEP - # get a path of the STEP file containing the CAD - STEP_PATH = os.path.expandvars("$HEXABLOCK_ROOT_DIR/bin/salome/crank.stp") - -The following images depict different CADs for the construction of models: - -.. image:: _static/cad_bielle.PNG +.. image:: _static/cad_bielle.png :align: center .. centered:: @@ -38,20 +25,20 @@ The following images depict different CADs for the construction of models: (see :ref:`intropython`) -.. image:: _static/bride.PNG +.. image:: _static/bride.png :align: center .. centered:: Bridle -.. image:: _static/intersec_cyl.PNG +.. image:: _static/intersec_cyl.png :align: center .. centered:: Intersection of cylinders -.. image:: _static/tuyau_courbe.PNG +.. image:: _static/tuyau_courbe.png :align: center .. centered:: diff --git a/doc/creategrids.rst b/doc/creategrids.rst index aac43b0..e0bb58f 100644 --- a/doc/creategrids.rst +++ b/doc/creategrids.rst @@ -6,7 +6,7 @@ Create grids ============ -To create a **Grid** in the **Main Menu** select **Model -> Make Grid**. +To create a **Grid** in the **Main Menu** select **Model -> Construction -> Make Grid**. Three kinds of grid can be created: @@ -65,8 +65,8 @@ The following data are required: - Cylinder - center: coordinates of the cylinder base center (select a vertex). + - axis: direction vector of the cylinder (select a vector). - base: base vector of the cylinder (select a vector). - - height: vertical vector of the cylinder (select a vector). - Grid - radius: size and number of elements from the center. @@ -82,26 +82,7 @@ Elements size of the grid can be irregular (differents sizes). Select the adequa .. centered:: Dialogue Box for a Cylindrical grid (irregular size) - - -The result is an array of hexahedra which are arranged along the -radial axis first, then the angular axis, then according to the layers -and then possibly hexahedra filling the central part. - -The filling of the central part of the cylinder is made​ according to the two following cases: - -.. image:: _static/cyl_grid2.PNG - :align: center - -.. centered:: - Filling of the central part of the cylinder in the case the number of angular elements is odd na = 5. - -.. image:: _static/cyl_grid1.PNG - :align: center - -.. centered:: - Filling of the central part of the cylinder in the case the number of angular elements is even na = 4. - + The result: @@ -146,7 +127,7 @@ To create a spherical grid, select radio button **Spherical**: The following data are required: - the center (vertex) of the central hexahedron, -- the vector corresponding to the diametrically opposite vertex to the initial vertex, +- the radius of the internal hexahedron - the number of embedded hexahedra (nb), - the coefficient of growth (k). diff --git a/doc/full_example_bridle.rst b/doc/full_example_bridle.rst index 705a3c6..670cc9d 100644 --- a/doc/full_example_bridle.rst +++ b/doc/full_example_bridle.rst @@ -7,108 +7,15 @@ Example generated from HexaBlock ################################# -.. image:: _static/bride.PNG +.. image:: _static/bride.png :align: center .. centered:: Bridle -:: - - - # -*- coding: latin-1 -*- - - import os - import GEOM - import geompy - import smesh - import hexablock - import math - import SALOMEDS - - STEP_PATH = os.path.expandvars("$HEXA_ROOT_DIR/bin/salome/crank.stp") - - - doc = hexablock.addDocument() - OPT_QUAD_IK = 1 - OPT_FIRST = 2 - - # ======================================================== merge_quads - def merge_quads (doc, quart, demi, ni1, nj1, ni2, nj2, option=0): - - prems = option == OPT_QUAD_IK - quad_ik = option == OPT_FIRST - - if quad_ik: - orig = quart.getQuadIK (ni1, nj1, k1) - else: - orig = quart.getQuadJK (ni1, nj1, k1) - - dest = demi .getQuadJK (ni2, nj2, k1) - - v1 = dest.getVertex (quad_ik); - v3 = dest.getVertex (1-quad_ik); - - v2 = orig.getVertex (0); - v4 = orig.getVertex (1); - - doc.mergeQuads (dest, orig, v1, v2, v3, v4) - - #================================================================================= Begin - orig1 = doc.addVertex (0,0,0) - orig2 = doc.addVertex (6,0,0) - - dz = doc.addVector (0,0,1) - dx = doc.addVector (1,0,0) - - dim_z = 5 - drd = 0.5 - drq = 2*drd - dl = 1 - nrq = 8 - nrd = 3 - naq = 4 - nad = 8 - k0 = 0 - k1 = 1 - - quart = doc.makeCylindrical (orig1,dx,dz,drq, 45, dl, nrq, naq, dim_z, True) - for nk in range(dim_z-2): - ## Elagage du quart (de brie) - for nj in range(naq): - ideb = 2 - if nk == dim_z-1: - ideb = 1 - for nj in range(naq): - for ni in range(nrq-ideb): - doc.removeHexa(quart.getHexaIJK(ni+ideb, nj, nk+2)) - - ## La semelle - for nj in range(naq): - for ni in range(nrq-2): - doc.removeHexa(quart.getHexaIJK(ni+2, nj, k0)) - - ## Le demi - demi = doc.makeCylindrical(orig2, dx, dz, drd, 180, dl, nrd, nad, dim_z, True) - - for nk in range(dim_z-2): - for nj in range(nad): - ni0 = max(nrd-nk, 0) - for ni in range(nrd-ni0): - doc.removeHexa(demi.getHexaIJK(ni+ni0, nj, nk+2)) - - jmax = nrq-1 - for nj in range(2): - for ni in range(jmax-3): - doc.removeHexa(quart.getHexaIJK (ni+3, nj, k1)) - - ###merge_quads (doc, quart, demi, 7, 0, nrd, 0, OPT_FIRST); - ###rge_quads (doc, quart, demi, 7, 1, nrd, 1); - - #______________________________________________________________ - - ### mesh = smesh.HexaBlocks(doc) - mesh = hexablock.mesh("bride:hexas", doc) +.. literalinclude:: cas_test_python/bride.py + :linenos: + diff --git a/doc/general.rst b/doc/general.rst index 6f00cc0..bf80298 100644 --- a/doc/general.rst +++ b/doc/general.rst @@ -6,77 +6,42 @@ Introduction to HEXABLOCK ######################### -.. Within the SALOME framework, a CAD module (GEOM) and a meshing - module (SMESH) are developed. This tools enable the construction - of hexahedrical meshes by means of a CAD cutting in blocks (the - method of blocks) topologically equivalent to hexahedra. Once this - cutting performed, the mesh construction is easy, but the method of - blocks can be touchy if the piece to mesh is complex. +With SALOME framework, a CAD component (GEOM) and a meshing component (SMESH) are developed. +These tools enable to construct hexahedral meshes: -Goals -===== +- by means of a CAD cutting in blocks topologically equivalent to hexahedra with GEOM component, -The HexaBlock module is designed to help users to build hexahedrical meshes -via the method by blocks. The two fundamental choices are: +- and generate a hexahedral mesh with SMESH component. -- To execute the method by blocks where the user has to determine the needed blocks. -- To simplify all other tasks to obtain the mesh (in particular by - using directly the geometry to mesh). +The HEXABLOCK component of SALOME is designed to help users to build hexahedral meshes: -Solution -======== +- with also the block method, -Finding a compound of blocks is in charge of users. - -HexaBlock enables to define a mesh with hexahedra in five stages: +- but without modify the geometry. -- Load and create a geometry without constraint. -- Search a compound of blocks (mental working). -- Create a model of blocks: +Like other SALOME components, HEXABLOCK can also be used in two ways: - - Logic realization of this division with operations on blocks. - - Regardless of the geometry to be meshed in terms of shape and placement. +- by using Graphic User Interface, -- Associate this model of blocks to the geometry: +- by writing Python Script. - - Associate all the vertices of the model to the geometry. - - If necessary, associate edges of the model to the geometry. - - If necessary, associate quads of the model to the geometry. - -- Generate the mesh: - - - Create discretization laws. - - Discretize the edges. - - Define mesh groups. - - Setting the mesh generation. - -Two ways of working are possible: - -- *Graphic User Interface* -- *Python Scripting* - - -Presentation of the stages -========================== - -- The construction of the real CAD (see :ref:`cad`). - -- The creation of a model of blocks (see :ref:`blockmethod`). - -- The association of this model of blocks to the geometry (see :ref:`assomodelgeo`). - -- The mesh generation (see :ref:`generatemesh`). +Stages to obtain hexahedral mesh +================================ +HEXABLOCK component enables to define a mesh with hexahedra in 5 stages: .. toctree:: - :maxdepth: 3 + :maxdepth: 1 cad.rst block_method.rst intro_association.rst intro_groups.rst intro_mesh.rst + +.. toctree:: + :maxdepth: 1 + intro_python.rst annexe.rst - diff --git a/doc/gui_asso_quad_to_geom.rst b/doc/gui_asso_quad_to_geom.rst index dab7886..105bc00 100644 --- a/doc/gui_asso_quad_to_geom.rst +++ b/doc/gui_asso_quad_to_geom.rst @@ -24,11 +24,11 @@ proceeds in three stages: .. _guiassovertex: -Associate to a vertex of the geometry -===================================== +Vertex Association +================== To associate a vertex of the model of blocks to a vertex of the geometry in -the **Main Menu** select **Model -> Make Vertex association** +the **Main Menu** select **Association -> Make Vertex association** **Arguments:** @@ -37,32 +37,66 @@ the **Main Menu** select **Model -> Make Vertex association** The dialogue box to associate to a vertex of the geometry is: -.. image:: _static/gui_ass_vertex.png +.. image:: _static/gui_vertex_assoc_coordinates.png :align: center .. centered:: Associate to a Vertex of the Geometry + +see: :ref:`guiassovertex2` + +see: :ref:`tuiassovertex2` .. _guiassoedge: -Associate to edge or lines of the geometry -========================================== +Edge(s) Association +=================== To associate edge(s) of the model of blocks to line(s) of the geometry in -the **Main Menu** select **Model -> Make Edge Association** +the **Main Menu** select **Association -> Make Edge Association** + +.. _guiassooneedge: + +One edge +-------- + +Only one edge of the model is associated. + +**Arguments:** + +- one edge of the model of blocks, +- one line of the geometry, +- Start: starting point on the line, +- End: ending point on the line. + +The dialogue box to associate one edge or wire of the geometry is: + +.. image:: _static/gui_ass_edge.png + :align: center + +.. centered:: + Associate an Edge or Wire of the Geometry +.. _guiassoedges: + +Line +---- + +One or several edges and vertices of the model are associated. + **Arguments:** - starting vertex (only if "closed line" is selected), - one or several edges of the model of blocks, - one or several lines of the geometry, - choose to associate a closed line or an opened line, +- choose to associte a closed line with inversion (only if "closed line" is selected), - Start: starting point on the line, - End: ending point on the line. The dialogue box to associate to edges or wires of the geometry is: -.. image:: _static/gui_ass_edge.png +.. image:: _static/gui_ass_edges.png :align: center .. centered:: @@ -70,11 +104,11 @@ The dialogue box to associate to edges or wires of the geometry is: .. _guiassoface: -Associate to a face of the geometry -=================================== +Quadrangle Association +====================== To associate a quadrangle of the model of blocks to a face of the geometry in -the **Main Menu** select **Model -> Make Quadrangle association** +the **Main Menu** select **Association -> Make Quadrangle association** **Arguments:** @@ -90,4 +124,18 @@ The dialogue box to associate to a face or a shell of the geometry is: Associate to a Face or a Shell of the Geometry +Note +---- + +Face association (implicite or explicite) is not necessary for: + +- planar faces, +- cylindrical faces, +- conical faces. + +Only edges association (implicite) on segments or arcs of cirle is necessary. + +This case is illustrated by an example :ref:`here `. + + TUI command: :ref:`tuiassoquadtogeom` diff --git a/doc/gui_asso_vertex_to_geom.rst b/doc/gui_asso_vertex_to_geom.rst new file mode 100644 index 0000000..9957a2c --- /dev/null +++ b/doc/gui_asso_vertex_to_geom.rst @@ -0,0 +1,207 @@ +:tocdepth: 3 + +.. _guiassovertex2: + +======================================== +GUI: Definition of point of the geometry +======================================== + +To make a vertex association you need to define the Geom Point you want to associate +your vertex to. + +There are five algorithms to create a Point in the 3D space in Geom. +Each time the Result of the operation will be a GEOM_Object (vertex). + + +.. _guiassovertexcoords: + +By coordinates +============== + +Firstly, we can define a point by setting its X, Y and Z Coordinates. + +**Arguments:** + +- Name of the vertex of the model +- Name of the resulting point +- X, Y and Z coordinates of the point + +The dialogue box to associate a vertex to a point defined by its coordinates is: + +.. image:: _static/gui_vertex_assoc_coordinates.png + :align: center + +.. centered:: + Point defined by its coordinates + + +.. _guiassovertexref: + +By a reference +============== + +Secondly, we can define a point by a Reference to another point and the shift of the coordinates of the new point regarding the coordinates of the old one. + +**Arguments:** + +- Name of the vertex of the model +- Name of the resulting point +- 1 reference point +- 3 coordinates defining the position of this point regarding the reference one + +The dialogue box to associate a vertex to a point defined by a reference is: + +.. image:: _static/gui_vertex_assoc_on_geom_point.png + :align: center + +.. centered:: + Point defined by reference to a point of the geometry and a translation + + +.. _guiassovertexedgeparam: + +By an Edge and a Parameter +========================== + +Thirdly, we can define a point by an Edge and a Parameter indicating its position on the Edge, ranging from 0.0 to 1.0. For example, 0.5 means that the point is located in the middle of the edge. + +**Arguments:** + +- Name of the vertex of the model +- Name of the resulting point +- 1 edge +- 1 Parameter defining the position of the point on the given edge + + +The dialogue box to associate a vertex to a point of the geometry defined by an edge and parameter: + +.. image:: _static/gui_vertex_assoc_on_edge_byParam.png + :align: center + +.. centered:: + Point defined by an edge and a parameter + + +.. _guiassovertexedgelength: + +By an Edge and a Length +======================= + +Alternatively, it is possible to define a point by an Edge and a Length. +The Length defines the position of the point on the given edge. +It can exceed the length of the edge or be negative. +In this case the edge is extrapolated along its curve (except for bezier and b-spline curves). +The Start Point defines the direction for the length calculation (if not defined, the first vertex of Edge is used, else the vertex of Edge closest to StartPoint is used). + +**Arguments:** + +- Name of the vertex of the model +- Name of the resulting point +- 1 edge +- 1 Point +- 1 Length + +The dialogue box to associate a vertex to a point of the geometry defined by an edge and a length: + +.. image:: _static/gui_vertex_assoc_on_edge_byLength.png + :align: center + +.. centered:: + Point defined by an edge and a length + + +.. _guiassovertexedgecoords: + +By an Edge and Coordinates +========================== + +It is also possible to define 3D coordinates of the point projected on the given edge to produce the resulting point. + +**Arguments:** + +- Name of the vertex of the model +- Name of the resulting point +- 3 coordinate values of the projected point +- 1 edge + +The dialogue box to associate a vertex to a point of the geometry defined by an edge and coordinates: + +.. image:: _static/gui_vertex_assoc_on_edge_byCoords.png + :align: center + +.. centered:: + Point defined by an edge and 3 coordinates + + +.. _guiassovertexlineintersect: + +By intersection of two Lines or Wires +===================================== + +Fourthly, we can define a point(s) by intersection of two Lines or Wires (or a Wire and a Line). +If they intersect only once, a point will be created. If there are several intersections, a compound of points will be created. +The type of the selected object (Line or Wire) can be changed in the popup menu, after clicking the corresponding selection button. (see the picture below) + +**Arguments:** + +- Name ot he vertex of the model +- Name of the resulting point +- 2 1D objects (Line or Wire) + +The dialogue box to associate a vertex to a point of the geometry defined by the intersection of two lines or wires is: + +.. image:: _static/gui_vertex_assoc_on_lines_intersection.png + :align: center + +.. centered:: + Point defined by the intersection of two lines or wires + + +.. _guiassovertexpointonfaceparams: + +By a face and two parameters +============================ + +Finally, we can define a point by a Face and Two Parameters: U and V indicating its position on the Face, ranging from 0.0 to 1.0. +For example, (0.5; 0.5) means that the point is located in the middle of the face. + +**Arguments:** + +- Name of the vertex of the model +- Name of the resulting point +- 1 face +- 2 Parameters defining the position of the point on the given face + +The dialogue box to associate a vertex to a point on a face using U and V parameters is: + +.. image:: _static/gui_vertex_assoc_on_face_byParam.png + :align: center + +.. centered:: + Point defined by a face and two parameters + + +.. _guiassovertexpointonfacecoords: + +By a face and coordinates +========================= + +Alternatively, it is possible to define 3D coordinates of the point projected on the given face. + +**Arguments:** + +- Name of the vertex of the model +- Name of the resulting point +- 3 coordinate values to project point on the given face +- 1 face + +The dialogue box to associate a vertex to a point on a face using coordinates is: + +.. image:: _static/gui_vertex_assoc_on_face_byCoords.png + :align: center + +.. centered:: + Point defined by a face and 3 coordinates + + +GUI: :ref:`guiassovertex` diff --git a/doc/gui_association.rst b/doc/gui_association.rst new file mode 100644 index 0000000..bb61403 --- /dev/null +++ b/doc/gui_association.rst @@ -0,0 +1,53 @@ +:tocdepth: 3 + +.. _guiassocs: + +============ +Associations +============ + + +.. _guishowassocs: + +Show associations +================= + +To show all associations of a given type (only vertex, edge and hexahedron can be associated), +right click on the tree of the type in the data tree and click on the menu "Show associations". + +The contextual menu shown when you right-click looks like this: + +.. image:: _static/show_assocs.png + :align: center + +.. centered:: + Show associations + +.. _guiremoveassocs: + +Remove all associations +======================= + +Just like "Show associations" but select the menu "Remove all associations". + +.. image:: _static/remove_assocs.png + :align: center + +.. centered:: + Remove all associations + +.. _guiremoveassoc: + +Remove an element's association(s) +================================== + +Right-click on the element in the data tree and select the menu "Remove association(s)". + +.. image:: _static/remove_assoc.png + :align: center + +.. centered:: + Remove an element's associations + + +TUI command: :ref:`tuiassocs` \ No newline at end of file diff --git a/doc/gui_blocks_for_cyl_pipe.rst b/doc/gui_blocks_for_cyl_pipe.rst index 0c767c5..a4d3f6e 100644 --- a/doc/gui_blocks_for_cyl_pipe.rst +++ b/doc/gui_blocks_for_cyl_pipe.rst @@ -12,15 +12,15 @@ Make blocks for a cylinder and a pipe Make Cylinder ============= -To make a **Cylinder** in the **Main Menu** select **Model -> Make Cylinder**. +To make a **Cylinder** in the **Main Menu** select **Model -> Construction -> Make Cylinder**. To make a cylinder, the following data are required: - Cylinder: a cylinder. - Vector: a vector on the base of the cylinder to start hexahedra. -- nr: the number of blocks on radial. -- na: the number of angular section. -- nl: the number of blocks along the axis of the cylinder. +- n (radial) : the number of blocks on radial. +- n (angular): the number of angular section. +- n (length) : the number of blocks along the axis of the cylinder. The dialogue box to make a cylinder is: @@ -42,12 +42,15 @@ The result of this action is: .. centered:: Cylinder +TUI command: :ref:`tuimakecylinder` + + .. _makecylinders: Make Cylinders ============== -To make **two cylinders in T shape** in the **Main Menu** select **Model -> Make Cylinders** +To make **two cylinders in T shape** in the **Main Menu** select **Model -> Construction -> Make Cylinders** You can make **Cylinders** through **Cylinder1** and **Cylinder2**. @@ -63,20 +66,23 @@ The dialogue box to make cylinders is: The result is an array of hexahedral. +TUI command: :ref:`tuimakecylinders` + + .. _makepipe: Make Pipe ========= -To make a **Pipe** in the **Main Menu** select **Model -> Make Pipe**. +To make a **Pipe** in the **Main Menu** select **Model -> Construction -> Make Pipe**. To make a pipe, the following data are required: - Pipe: a pipe. - Vector: a vector on the base of the pipe to start hexahedra. -- nr: the number of blocks on radial. -- na: the number of angular section. -- nl: the number of blocks along the axis of the pipe. +- n (radial) : the number of blocks on radial. +- n (angular): the number of angular section. +- n (length) : the number of blocks along the axis of the pipe. The dialogue box to make a pipe is: @@ -97,13 +103,15 @@ The result of this action is: .. centered:: Pipe +TUI command: :ref:`tuimakepipe` + .. _makepipes: Make Pipes ========== -To make **two intersect pipes** in the **Main Menu** select **Model -> Make Pipes**. +To make **two intersect pipes** in the **Main Menu** select **Model -> Construction -> Make Pipes**. You can make **Pipes** through **Pipe1** and **Pipe2**. @@ -121,4 +129,5 @@ The result is an array of hexahedra where we first find hexahedra of the first pipe and the second pipe. Each pipe range hexahedra following first radial layers and angular layers, and finally the axial layers. -TUI command: :ref:`tuiblockscylinderpipe` +TUI command: :ref:`tuimakepipes` + diff --git a/doc/gui_cut_hexa.rst b/doc/gui_cut_hexa.rst index d717ce4..faaa04f 100644 --- a/doc/gui_cut_hexa.rst +++ b/doc/gui_cut_hexa.rst @@ -10,7 +10,7 @@ Cut hexahedra This method allows to cut in two (or more) a series of hexahedra using a series of edges propagation. -To cut an hexahedra in the **Main Menu** select **Model -> Cut Hexahedra**. +To cut an hexahedra in the **Main Menu** select **Model -> Operation -> Cut Hexahedra**. **Arguments:** an edge and the number of cuts (nb). diff --git a/doc/gui_cyl.rst b/doc/gui_cyl.rst index 777af35..65bfdcd 100644 --- a/doc/gui_cyl.rst +++ b/doc/gui_cyl.rst @@ -7,7 +7,10 @@ Cylinder ======== -To create a **Cylinder** in the **Main Menu** select **Model -> Add Cylinder**. +To create a **Cylinder** in the **Main Menu** select **Model -> Construction -> Add Cylinder**. + +There is no construction of blocks. +Cylinder is an intermediate object built in order to make the dialog boxes of blocks construction more concise. **Arguments:** a vertex, a vector, a radius and a height. diff --git a/doc/gui_disc_elmts.rst b/doc/gui_disc_elmts.rst index 6b01583..f3d8d3a 100644 --- a/doc/gui_disc_elmts.rst +++ b/doc/gui_disc_elmts.rst @@ -6,7 +6,7 @@ Disconnect elements =================== -To disconnect elements in the **Main Menu** select **Model -> Disconnect**. +To disconnect elements in the **Main Menu** select **Model -> Operation -> Disconnect**. .. _guidiscoquad: @@ -15,7 +15,7 @@ Disconnect a quadrangle **Arguments:** -- q: the quadrangle to disconnect. +- quad: the quadrangle to disconnect. - from hexa: the hexahedron to disconnect the quadrangle from. The dialogue box to disconnect a quadrangle is: @@ -35,6 +35,25 @@ Example: .. centered:: Disconnect a Quadrangle +.. _guidiscoedges: + +Disconnect edges +================== + +**Arguments:** + +- edges: the edges to disconnect. +- hexas: the hexahedrons to disconnect the edges from. + + +The dialogue box to disconnect edges is: + + +.. image:: _static/gui_disco_edges.png + :align: center + +.. centered:: + Disconnect Edges .. _guidiscoedge: @@ -43,7 +62,7 @@ Disconnect an edge **Arguments:** -- e: the edge to disconnect. +- edge: the edge to disconnect. - from hexa: the hexahedron to disconnect the edge from. @@ -63,7 +82,7 @@ Disconnect a vertex **Arguments:** -- v: the vertex to disconnect. +- vertex: the vertex to disconnect. - from hexa: the hexahedron to disconnect the vertex from. diff --git a/doc/gui_discret_law.rst b/doc/gui_discret_law.rst index a708358..2132eb5 100644 --- a/doc/gui_discret_law.rst +++ b/doc/gui_discret_law.rst @@ -35,15 +35,7 @@ The dialogue box to create a law is: Remove law ========== -To remove a discretization law in the **Main Menu** select **Mesh -> Remove Law**. - - -.. image:: _static/gui_remove_law.png - :align: center - -.. centered:: - Remove law - +To remove a group from the model, in the **Mesh Tab's Tree View** select the Law you want to remove then click on **Mesh -> Remove Law** in the main menu. TUI command: :ref:`tuidiscretelaw` diff --git a/doc/gui_edge.rst b/doc/gui_edge.rst index fd2d4f8..ea9c211 100644 --- a/doc/gui_edge.rst +++ b/doc/gui_edge.rst @@ -7,7 +7,7 @@ Edge ==== -To create an **Edge** in the **Main Menu** select **Model -> Add Edge**. +To create an **Edge** in the **Main Menu** select **Model -> Construction -> Add Edge**. There are two algorithms to create an **Edge**. @@ -34,7 +34,7 @@ The dialogue box to create an edge from a vertex and a vector is: :align: center .. centered:: - Add Edge from vertices + Add Edge from a vertex and a vector TUI command: :ref:`tuiedge` diff --git a/doc/gui_groups.rst b/doc/gui_groups.rst index f132723..f8115b0 100644 --- a/doc/gui_groups.rst +++ b/doc/gui_groups.rst @@ -35,14 +35,7 @@ To define groups on the model in the **Main Menu** select **Groups -> Add Group* Remove group ============ -To remove a group from the model in the **Main Menu** select **Groups -> Remove Group**. - - -.. image:: _static/gui_remove_group.png - :align: center - -.. centered:: - Remove group +To remove a group from the model, in the **Groups Tab's Tree View** select the group you want to remove then click on **Groups -> Remove Group** in the main menu. TUI command: :ref:`tuigroups` diff --git a/doc/gui_hemisphere.rst b/doc/gui_hemisphere.rst index 373b994..0cedecd 100644 --- a/doc/gui_hemisphere.rst +++ b/doc/gui_hemisphere.rst @@ -7,7 +7,7 @@ Create HemiSpherical Grid ========================= -To create an **HemiSpherical Grid** in the **Main Menu** select **Model -> Make Hemisphere**. +To create an **HemiSpherical Grid** in the **Main Menu** select **Model -> Construction -> Make Hemisphere**. .. image:: _static/gui_hemispherical.png :align: center @@ -18,9 +18,6 @@ To create an **HemiSpherical Grid** in the **Main Menu** select **Model -> Make The following data are required: -- Result Name - - name: name of the grid created (**optional**). - - Sphere - center: center coordinates of the sphere (select a vertex). - external radius: radius size of the sphere. @@ -28,22 +25,20 @@ The following data are required: - Hole - axis(z): axes of the hole (select a vector). - Note: This parameter also defines the *vector* parameter on *Cross section* and therefore is automatically filled. - radius: radius size of the hole. - Cross section - point: coordinates of a point on the surface of the cross section (select a vertex). - vector: normal vector to the surface of the cross section (select a vector). - Note: This parameter also defines the *axis(z)* parameter on *Hole* and therefore is automatically filled. - Radial section - start : a vector defining the start of the radial section (select a vector). - angle : fill this field to customize the section (value in degree, **optional**). - Grid - - radius: number of hexahedra from the center of the sphere. - - angle: number of hexahedra along the perimeter of the sphere. - - height: number of hexahedra on the height of the sphere. + - n (radial) : number of hexahedra from the center of the sphere. + - n (anglular): number of hexahedra along the perimeter of the sphere. + - n (height) : number of hexahedra on the height of the sphere. From this dialog box, four kinds of grid can be created: @@ -74,16 +69,9 @@ TUI command: :ref:`tuihemisphericalgrid` Partial HemiSpherical Grid ========================== -To create a partial hemispherical grid: On *Radial section* check the *partial* check box and fill in the *angle* parameter. - -.. image:: _static/gui_parthemispherical.png - :align: center - -.. centered:: - Make a partial hemispherical grid +To create a partial hemispherical grid: On *Radial section* check the *partial* check box and fill in the *angle* parameter. -The result: .. image:: _static/parthemisphericalgrid.png :align: center @@ -99,16 +87,9 @@ TUI command: :ref:`tuiparthemisphericalgrid` Rind Grid ========== -To create a rind grid: On *Sphere* check the *rind* check box and fill in the *internal radius* parameter. - -.. image:: _static/gui_rind.png - :align: center - -.. centered:: - Make a rind grid +To create a rind grid: On *Sphere* check the *rind* check box and fill in the *internal radius* parameter. -The result: .. image:: _static/rindgrid.png :align: center @@ -120,23 +101,15 @@ TUI command: :ref:`tuirindgrid` - .. _guipartrindgrid: Partial Rind Grid ================= + To create a partial rind grid: in addition to the *internal radius* parameter (see :ref:`guirindgrid`), on *Radial section* check the *partial* check box and fill in the *angle* parameter. -.. image:: _static/gui_partrind.png - :align: center - -.. centered:: - Make a partial rind grid - - -The result: .. image:: _static/partrindgrid.png :align: center diff --git a/doc/gui_hexahedron.rst b/doc/gui_hexahedron.rst index 381cccf..a3fc03f 100644 --- a/doc/gui_hexahedron.rst +++ b/doc/gui_hexahedron.rst @@ -6,7 +6,7 @@ Hexahedron ========== -To create an **Hexahedron** in the **Main Menu** select **Model -> Add Hexahedron**. +To create an **Hexahedron** in the **Main Menu** select **Model -> Construction -> Add Hexahedron**. There are two methods to create an **Hexahedron**. diff --git a/doc/gui_make_elmts.rst b/doc/gui_make_elmts.rst index 4626559..d114f1e 100644 --- a/doc/gui_make_elmts.rst +++ b/doc/gui_make_elmts.rst @@ -7,7 +7,7 @@ Make elements by transforming elements ====================================== To make elements by transforming elements in the **Main Menu** select -**Model -> Make transformation**. +**Model -> Operation -> Make transformation**. .. _guimaketranslation: @@ -81,8 +81,8 @@ Make elements by rotation **Arguments:** - elements, -- vector direction, - vertex, +- vector direction, - angle. diff --git a/doc/gui_make_symmetry.rst b/doc/gui_make_symmetry.rst index cc36b99..c803c7d 100644 --- a/doc/gui_make_symmetry.rst +++ b/doc/gui_make_symmetry.rst @@ -7,7 +7,7 @@ Make elements by symmetry ========================= To make elements by symmetry elements in the **Main Menu** select -**Model -> Make symmetry**. +**Model -> Operation -> Make symmetry**. .. _guimakepoint: @@ -28,7 +28,25 @@ The dialogue box to make elements by point symmetry is: .. centered:: Make Elements by point symmetry + +Example +------- +.. image:: _static/sph_grid_for_make_sym_examle.png + :align: center + +.. centered:: + Spherical grid + +A point symmetry on the *Spherical grid* gives the following result: + +.. image:: _static/make_point_symmetry.png + :align: center + +.. centered:: + Point symmetry on *Spherical grid* + + .. _guimakeline: Make elements by line symmetry @@ -48,10 +66,22 @@ The dialogue box to make elements by line symmetry is: .. centered:: Make Elements by Line Symmetry +Example +------- + +A line symmetry on the *Spherical grid* gives the following result: + +.. image:: _static/make_line_symmetry.png + :align: center + +.. centered:: + Line symmetry on *Spherical grid* + + .. _guimakeplan: -Make elements by plan symmetry -============================== +Make elements by plane symmetry +=============================== **Arguments:** @@ -59,11 +89,25 @@ Make elements by plan symmetry - vertex, - vector. -The dialogue box to make elements by plan symmetry is: +The dialogue box to make elements by plane symmetry is: .. image:: _static/gui_make_plan_symmetry.png :align: center .. centered:: - Make Elements by Plan Symmetry + Make Elements by Plane Symmetry + + +Example +------- + +A plane symmetry on the *Spherical grid* gives the following result: + +.. image:: _static/make_plan_symmetry.png + :align: center +.. centered:: + Plane symmetry on *Spherical grid* + + +TUI command: :ref:`tuimakesymmetry` diff --git a/doc/gui_merge_elmts.rst b/doc/gui_merge_elmts.rst index b3660cc..fbf752f 100644 --- a/doc/gui_merge_elmts.rst +++ b/doc/gui_merge_elmts.rst @@ -6,7 +6,7 @@ Merge elements ============== -To merge elements in the **Main Menu** select **Model -> Merge**. +To merge elements in the **Main Menu** select **Model -> Operation -> Merge**. .. _guimergequads: @@ -15,11 +15,12 @@ Merge two quadrangles **Arguments:** -- 2 quadrangles (q1 and q2), -- 4 vertices (v1, v2, v3, v4). +- 2 quadrangles (quad 1 and quad 2), +- 4 vertices (vertex 1a, vertex 2a, vertex 1b, vertex 2b). -v1: vertex of the quadrangle *q1* to merge with the vertex *v2* of the quadrangle *q2*. -v3: vertex of the quadrangle *q1* to merge with the vertex *v4* of the quadrangle *q2*. +vertex 1a: vertex of the quadrangle *quad 1* to merge with the vertex *vertex 2a* of the quadrangle *quad 2*. + +vertex 1b: vertex of the quadrangle *quad 1* to merge with the vertex *vertex 2b* of the quadrangle *quad 2*. The dialogue box to merge two quadrangles is: @@ -38,10 +39,10 @@ Merge two edges **Arguments:** -- 2 edges (e1 and e2), -- 2 vertices (v1 and v2). +- 2 edges (edge 1 and edge 2), +- 2 vertices (vertex 1 and vertex 2). -v1: vertex of the edge *e1* to merge with the vertex *v2* of the edge *e2*. +vertex 1: vertex of the edge *edge 1* to merge with the vertex *vertex 2* of the edge *edge 2*. The dialogue box to merge two edges is: @@ -56,7 +57,7 @@ The dialogue box to merge two edges is: Merge two vertices ================== -**Arguments:** 2 vertices (v1 and v2). +**Arguments:** 2 vertices (vertex 1 and vertex 2). The dialogue box to merge two vertices is: diff --git a/doc/gui_modify_elmts.rst b/doc/gui_modify_elmts.rst index 74b645f..0c56a81 100644 --- a/doc/gui_modify_elmts.rst +++ b/doc/gui_modify_elmts.rst @@ -8,7 +8,7 @@ Modify elements by transforming elements ======================================== To modify elements by transforming elements in the **Main Menu** select -**Model -> Perform transformation**. +**Model -> Operation -> Perform transformation**. .. _guimodifytranslation: @@ -56,8 +56,8 @@ Modify elements by rotation **Arguments:** - elements, -- vector direction, - vertex, +- vector direction, - angle. diff --git a/doc/gui_modify_symmetry.rst b/doc/gui_modify_symmetry.rst index 08eb543..f88b0f6 100644 --- a/doc/gui_modify_symmetry.rst +++ b/doc/gui_modify_symmetry.rst @@ -7,7 +7,7 @@ Modify elements by symmetry =========================== -To modify elements by symmetry elements in the **Main Menu** select **Model -> Perform Symmetry**. +To modify elements by symmetry elements in the **Main Menu** select **Model -> Operation -> Perform Symmetry**. .. _guimodifypoint: @@ -48,8 +48,8 @@ The dialogue box to modify elements by line symmetry is: .. _guimodifyplan: -Modify elements by plan symmetry -================================ +Modify elements by plane symmetry +================================= **Arguments:** @@ -57,12 +57,13 @@ Modify elements by plan symmetry - vertex, - vector. -The dialogue box to modify elements by plan symmetry is: +The dialogue box to modify elements by plane symmetry is: .. image:: _static/gui_modify_plan_symmetry.png :align: center .. centered:: - Modify Elements by Plan Symmetry + Modify Elements by Plane Symmetry +TUI command: :ref:`tuimodifysymmetry` diff --git a/doc/gui_pipe.rst b/doc/gui_pipe.rst index 117dde0..77bf538 100644 --- a/doc/gui_pipe.rst +++ b/doc/gui_pipe.rst @@ -7,9 +7,12 @@ Pipe ==== -To create a **Pipe** in the **Main Menu** select **Model -> Add Pipe**. +To create a **Pipe** in the **Main Menu** select **Model -> Construction -> Add Pipe**. -**Arguments:** a vertex (base), a vector (direction), internal and external radius, and a height (h). +There is no construction of blocks. +Pipe is an intermediate object built in order to make the dialog boxes of blocks construction more concise. + +**Arguments:** a vertex (base), a vector (direction), internal and external radius, and a height. The dialogue box for the creation of a pipe is: diff --git a/doc/gui_prism_join_quad.rst b/doc/gui_prism_join_quad.rst index cbd8112..e03f7bd 100644 --- a/doc/gui_prism_join_quad.rst +++ b/doc/gui_prism_join_quad.rst @@ -13,11 +13,18 @@ Prism and join quadrangles Prism Quadrangles ================= -To prism from quadrangles in the **Main Menu** select **Model -> Prism Quadrangles**. +To prism from quadrangles in the **Main Menu** select **Model -> Operation -> Prism Quadrangles**. From a list of quadrangles, a set of hexahedra is created. -**Arguments:** list of quadrangles, a vector (direction) and the number of layers. +Regular +------- + +**Arguments:** + +- a list of quadrangles +- a vector (direction) +- the number of layers The dialogue box to prism from quadrangles is: @@ -37,7 +44,37 @@ Example: .. centered:: Prism Quads + + +Irregular +--------- + +**Arguments:** + +- a list of quadrangles +- a vector (direction) +- a list of heights (a height for each layer - ascending) +The dialogue box to prism from quadrangles irregular mode is: + + +.. image:: _static/gui_prism_quads_irregular.png + :align: center + +.. centered:: + Prism From Quadrangles (Irregular mode) + + + +Example: + +.. image:: _static/prisme_gui2.png + :align: center + +.. centered:: + Irregular Prism Quads + +TUI command: :ref:`tuiprismquad` .. _joinquad: @@ -45,7 +82,7 @@ Example: Join Quadrangles ================ -To join quadrangles in the **Main Menu** select **Model -> Join Quadrangles**. +To join quadrangles in the **Main Menu** select **Model -> Operation -> Join Quadrangles**. .. image:: _static/gui_join_quads.png :align: center @@ -58,8 +95,8 @@ The following data are required: - From - Quadrangles: the set of quadrangles to be joined and from which hexahedra will be created. - - Point a: a vertex belonging to the set of quadrangles. - - Point b: a vertex belonging to the set of quadrangles. + - Point a: a vertex belonging to the first quadrangle of the set of quadrangles. + - Point b: a vertex, consecutive to previous Point a, belonging to the first quadrangle. - To - Quadrangle: a quadrangle from the set of targeted quadrangles. @@ -70,4 +107,5 @@ The following data are required: - size: number of layers of hexahedra issued from the operation. -TUI command: :ref:`tuiprismjoinquad` +TUI command: :ref:`tuijoinquad` + diff --git a/doc/gui_propag.rst b/doc/gui_propag.rst index e09a01f..059101d 100644 --- a/doc/gui_propag.rst +++ b/doc/gui_propag.rst @@ -6,16 +6,20 @@ Discretize on the propagation edges =================================== -To define a propagation in the **Main Menu** select **Mesh -> Set Propagation**. +To define a law for a propagation or a list of propagations in the **Main Menu** select **Mesh -> Set Propagation**. -**Arguments:** a law and a direction. +**Arguments:** -The dialogue box for creating a propagation is: + - a List of propagations + - a Law + - direction (way) + +The dialogue box for setting a law for a propagation or a list of propagations is: .. image:: _static/gui_propagation.png :align: center .. centered:: - Propagation + Setting propagations' law TUI command: :ref:`tuipropag` diff --git a/doc/gui_quad_revolution.rst b/doc/gui_quad_revolution.rst index a762107..f227b38 100644 --- a/doc/gui_quad_revolution.rst +++ b/doc/gui_quad_revolution.rst @@ -7,7 +7,7 @@ Quad revolution =============== -To make a **Quad revolution** in the **Main Menu** select **Model -> Quad Revolution**. +To make a **Quad revolution** in the **Main Menu** select **Model -> Operation -> Quad Revolution**. .. image:: _static/gui_quadrevolution.png :align: center @@ -19,14 +19,10 @@ To make a **Quad revolution** in the **Main Menu** select **Model -> Quad Revolu The following data are required: -- Result Name - - name: name of the elements created (**optional**). - -- Arguments - - Quads: a set of quadrangles from which hexahedrons will be created (select quads). - - Center: center of rotation (select a vertex). - - Axis: axis of rotation (select a vector). - - Angles: a set of angle (in degrees). Specify the rotation's angle at each step of it. + - Quads: a set of quadrangles from which hexahedrons will be created (select quads). + - Center: center of rotation (select a vertex). + - Axis: axis of rotation (select a vector). + - Angles: a set of angle (in degrees). Specify the rotation's angle at each step of it. Here is an example where the selected quadrangles are highlighted: @@ -36,7 +32,7 @@ Here is an example where the selected quadrangles are highlighted: .. centered:: Quad selection - + The result: diff --git a/doc/gui_quadrangle.rst b/doc/gui_quadrangle.rst index db2c6b7..dde5eec 100644 --- a/doc/gui_quadrangle.rst +++ b/doc/gui_quadrangle.rst @@ -7,7 +7,7 @@ Quadrangle ========== -To create a **Quadrangle** in the **Main Menu** select **Model -> Add Quadrangle**. +To create a **Quadrangle** in the **Main Menu** select **Model -> Construction -> Add Quadrangle**. There are two algorithms to create a **Quadrangle**. diff --git a/doc/gui_remove.rst b/doc/gui_remove.rst index 07ad5a7..d8d7ffc 100644 --- a/doc/gui_remove.rst +++ b/doc/gui_remove.rst @@ -7,7 +7,7 @@ Remove hexahedra ================ -To remove an **Hexahedron** in the **Main Menu** select **Model -> Remove hexahedra**. +To remove an **Hexahedron** in the **Main Menu** select **Model -> Operation -> Remove hexahedra**. **Arguments:** 1 hexahedron and a flag to indicate if connected hexahedra should be removed or not. diff --git a/doc/gui_replace_hexa.rst b/doc/gui_replace_hexa.rst index b5e1c7f..c9a6fc9 100644 --- a/doc/gui_replace_hexa.rst +++ b/doc/gui_replace_hexa.rst @@ -6,7 +6,7 @@ Replace hexahedron ================== -To **Replace an hexahedron** in the **Main Menu** select **Model -> Replace Hexahedron**. +To **Replace an hexahedron** in the **Main Menu** select **Model -> Operation -> Replace Hexahedron**. .. image:: _static/gui_replacehexa.png :align: center @@ -17,9 +17,6 @@ To **Replace an hexahedron** in the **Main Menu** select **Model -> Replace Hexa The following data are required: -- Result Name - - name : name of the elements created (**optional**). - - Quad(s) source - Quad's source: the set of quads to be extruded (select quads). - s1, s2, s3: vertices from the set of quads. (select vertices). diff --git a/doc/gui_vector.rst b/doc/gui_vector.rst index d965362..e27336f 100644 --- a/doc/gui_vector.rst +++ b/doc/gui_vector.rst @@ -6,7 +6,10 @@ Vector ====== -To create a **Vector** in the **Main Menu** select **Model -> Add vector**. +To create a **Vector** in the **Main Menu** select **Model -> Construction -> Add vector**. + +There is no construction of blocks. +Vector is an intermediate object built in order to make the dialog boxes of blocks construction more concise. There are two methods to create a **Vector**. diff --git a/doc/gui_vertex.rst b/doc/gui_vertex.rst index 2f66ec4..30f8878 100644 --- a/doc/gui_vertex.rst +++ b/doc/gui_vertex.rst @@ -6,7 +6,7 @@ Vertex ======== -To create a **Vertex** in the **Main Menu** select **Model -> Add vertex**. +To create a **Vertex** in the **Main Menu** select **Model -> Construction -> Add vertex**. The vertex is defined by settings its x, y and z **Coordinates**. diff --git a/doc/interactive.rst b/doc/interactive.rst index a0fc1fa..7465d67 100644 --- a/doc/interactive.rst +++ b/doc/interactive.rst @@ -66,7 +66,9 @@ It provides the toolset allowing to: gui_make_symmetry.rst gui_modify_elmts.rst gui_modify_symmetry.rst + gui_association.rst gui_asso_quad_to_geom.rst + gui_asso_vertex_to_geom.rst gui_groups.rst gui_discret_law.rst gui_propag.rst diff --git a/doc/intro_association.rst b/doc/intro_association.rst index f37aecf..931bac3 100644 --- a/doc/intro_association.rst +++ b/doc/intro_association.rst @@ -2,9 +2,9 @@ .. _assomodelgeo: -========================================== -Associate a model of blocks to a geometry -========================================== +================================================ +Associate this model of blocks with the geometry +================================================ Associate the model to the geometry means that the geometry to mesh is "raw" for this application. In other words, there will be no @@ -28,7 +28,7 @@ of the model to the geometry, an alternative way exists: the first two steps above can be replaced by a new stage called association by lines (see :ref:`assolines`). -.. image:: _static/association2.PNG +.. image:: _static/association2.png :align: center .. centered:: @@ -66,8 +66,7 @@ For each vertex, the association is made in three steps: - Choose a vertex of the model to associate. - Choose the way of associating among the 4 possibilities described above. -- Specify the point on the geometry, the process depends on the - previous choice: +- Specify the point on the geometry, the process depends on the previous choice: - case of an existing vertex: selection and highlight on the vertices of the geometry solely - case of a point taken on an edge of the geometry: selection @@ -90,8 +89,7 @@ applies four different algorithms in the following order: - the first algorithm determines a wire between the two vertices by taking the shortest way. -- if that wire does not exist, then another wire is build in the - following manner: +- if that wire does not exist, then another wire is build in the following manner: - compute the normals to the two vertices, - compute the mean normal of the two previous normals, - build the plan passing through the two vertices and this @@ -115,10 +113,8 @@ Associate the quadrangles This step is optional. The model quadrangles association is automatic. The three cases are processed: -- all the geometric faces exist then the nodes are computed on these - faces, -- the faces do exist but some pieces are missing because of the new - edges or vertices, in that case two strategies are deployed: +- all the geometric faces exist then the nodes are computed on these faces, +- the faces do exist but some pieces are missing because of the new edges or vertices, in that case two strategies are deployed: - automatic construction of the missing faces from the contour lines, - or association of new faces build in the geometry, - there are no associated faces to the quadrangle of the model: diff --git a/doc/intro_groups.rst b/doc/intro_groups.rst index f523f2f..1171f3f 100644 --- a/doc/intro_groups.rst +++ b/doc/intro_groups.rst @@ -2,9 +2,9 @@ .. _intro_groups: -==================================== -Define groups on the model of blocks -==================================== +======================================== +Define the groups on the model of blocks +======================================== A group is characterized by the three following components: diff --git a/doc/intro_mesh.rst b/doc/intro_mesh.rst index 5c84a8b..0d4dc45 100644 --- a/doc/intro_mesh.rst +++ b/doc/intro_mesh.rst @@ -2,9 +2,9 @@ .. _mesh: -====================== -Meshing with Hexahedra -====================== +============================ +Generate the hexahedral mesh +============================ The main stages to mesh with HexaBlock are: @@ -79,7 +79,7 @@ The groups are defined on the model of blocks and the main types of groups are: - groups of edges - groups of nodes -.. image:: _static/EX2.PNG +.. image:: _static/ex2.png :align: center .. centered:: @@ -139,20 +139,20 @@ Examples Linear approximation of the discretization of faces ''''''''''''''''''''''''''''''''''''''''''''''''''''' -.. image:: _static/meshing1.PNG +.. image:: _static/meshing1.png :align: center Geometric face and meshing by approximation '''''''''''''''''''''''''''''''''''''''''''' -.. image:: _static/meshing2.PNG +.. image:: _static/meshing2.png :align: center Geometric face and meshing by approximation and projection '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' -.. image:: _static/meshing3.PNG +.. image:: _static/meshing3.png :align: center diff --git a/doc/intro_python.rst b/doc/intro_python.rst index 259d73d..ea39330 100644 --- a/doc/intro_python.rst +++ b/doc/intro_python.rst @@ -6,7 +6,7 @@ Example: Python script for a connecting rod =========================================== -.. image:: _static/cad_bielle.PNG +.. image:: _static/cad_bielle.png :align: center .. centered:: @@ -30,299 +30,167 @@ Model creation :: - import os - import geompy - import hexablock - import math + import math - STEP_PATH = os.path.expandvars("$HEXABLOCK_ROOT_DIR/bin/salome/crank.stp") + import geompy + import hexablock - #============================= - # CREATION DOCUMENT - #============================= - doc = hexablock.addDocument() + doc = hexablock.addDocument("bielle") - #============================= - # MODEL CREATION - #============================= + # ------------------------------------- Build 2 cylindrical grids - # For the connecting rod, two cylindrical grids have to be build and - # the quadrangles have to be prismed between these wo grids + centre_pb = doc.addVertex(0, 0, 0) + centre_gb = doc.addVertex(7, 0, 0) - #============================= - # PARAMETRES - #============================= + angle_px = math.pi / 3 + vecteur_px = doc.addVector(math.cos(angle_px), math.sin(angle_px), 0) + vecteur_gx = doc.addVector(1, 0, 0) - R = 0.095168291790720005 + vecteur_z = doc.addVector(0, 0, 1) - r_pte = R - r_pte_t = R/2.0 + grille_p = doc.makeCylindrical(centre_pb, vecteur_px, vecteur_z, 1, 360, 1, 1, 3, 1, False) + grille_g = doc.makeCylindrical(centre_gb, vecteur_gx, vecteur_z, 1, 360, 1, 1, 3, 1, False) - xpetit = 0.0 - xgrand = 1.35739 + 0.1595 - longueur = (xgrand - xpetit)/2.0 - hauteur = 0.019999999553*2 + # ------------------------------------- Join the grids - dr_pte = R - da_pte = 360 - dl_pte = hauteur + quad_p = grille_p.getQuadJK(1, 2, 0) + quad_g = grille_g.getQuadJK(1, 1, 0) + + point_p1 = grille_p.getVertexIJK(1, 0, 0) + point_p2 = grille_p.getVertexIJK(1, 2, 0) - nr_pte = 1 - na_pte = 6 - nl_pte = 1 + point_g1 = grille_g.getVertexIJK(1, 1, 0) + point_g2 = grille_g.getVertexIJK(1, 2, 0) - #============================= - # Vectors Creation - #============================= + prisme = doc.joinQuad(quad_p, quad_g, point_p1, point_g1, + point_p2, point_g2, 3) - dx = doc.addVector(longueur, 0, 0) - dy = doc.addVector(0, longueur, 0) - dz = doc.addVector(0, 0, longueur) - #================================================= - # Creation of cylindrical grid centers - #================================================= +Go back to :ref:`menu` + +.. _recover: - c_pte = doc.addVertex(xpetit, 0, 0) - c_grd = doc.addVertex(2*longueur, 0, 0) - dx_prime = doc.addVectorVertices(c_pte, c_grd) +Recovering edges and faces from geometry before the association +=============================================================== + +:: - #================================================= - # small cylindrical grid creation - #================================================= + bielle = geompy.ImportSTEP("bielle.stp") - grille_cyl_pte = doc.makeCylindrical(c_pte, dx, dz, dr_pte, da_pte, dl_pte, nr_pte, na_pte, nl_pte, False) - #================================= - # Small cylindrical grid creation - #================================= + sommets = geompy.SubShapeAllSortedCentres(bielle, geompy.ShapeType["VERTEX"]) - grille_cyl_grd = doc.makeTranslation(grille_cyl_pte, dx_prime) + sommets_petit = [ 6, 8, 7, 9 ] + sommets_grand = [ 10, 12, 11, 13 ] - #================================== - # Joining the two cylindrical grids - #================================== + aretes = geompy.SubShapeAllSortedCentres(bielle, geompy.ShapeType["EDGE"]) - mod_x1 = grille_cyl_pte.getVertexIJK(1, 0, 1) - mod_x2 = grille_cyl_pte.getVertexIJK(1, 1, 0) - mod_x3 = grille_cyl_pte.getVertexIJK(1, 5, 0) - mod_x4 = grille_cyl_pte.getVertexIJK(1, 0, 0) - quad_11 = doc.findQuad(mod_x1, mod_x2) - quad_12 = doc.findQuad(mod_x1, mod_x3) + aretes_petit = [ 7, 9, 8, 10 ] + aretes_grand = [ 19, 21, 20, 22 ] - mod_y1 = grille_cyl_grd.getVertexIJK(1, 3, 1) - mod_y2 = grille_cyl_grd.getVertexIJK(1, 2, 0) - mod_y3 = grille_cyl_grd.getVertexIJK(1, 4, 0) - mod_y4 = grille_cyl_grd.getVertexIJK(1, 3, 0) + ga_pbcd = aretes[ 0] + ga_pbe = aretes[ 2] - quad_21 = doc.findQuad(mod_y1, mod_y2) - quad_22 = doc.findQuad(mod_y1, mod_y3) + ga_phcd = aretes[ 1] + ga_phe = aretes[ 3] + + ga_gbcd = aretes[27] + ga_gbe = aretes[25] - model_biell_fin = doc.joinQuads([quad_11, quad_12], quad_21, mod_x1, mod_y1, mod_x4, mod_y4, 1) + ga_ghcd = aretes[28] + ga_ghe = aretes[26] Go back to :ref:`menu` -.. _recover: +.. _assoc: -Recovering edges and faces before the association -================================================= +Association of the model to the geometry +======================================== :: - bielle_geom = geompy.ImportFile(STEP_PATH, "STEP") - doc.setShape(bielle_geom) - geompy.addToStudy(bielle_geom, "bielle_geom") - all_edges_bielle = geompy.SubShapeAllSorted(bielle_geom, geompy.ShapeType["EDGE"]) + doc.setShape(bielle) + # ---------------------------- Clean implicit associations of the model + doc.clearAssociation() - # dictionnaire des edges de la géométrie : - # key = nom, value = indice dans all_edges_bielle - dic_edge_names = {"edge_ray_pte_b": 0, "edge_ray_pte_h": 1, - "edge_trou_pte_b": 2, "edge_trou_pte_h" :3, - "edge_arr_pte_g_b": 7, "edge_arr_pte_g_h": 8, - "edge_arr_pte_d_b": 9, "edge_arr_pte_d_h": 10, - "edge_arr_grd_g_b": 19, "edge_arr_grd_g_h": 20, - "edge_arr_grd_d_b": 21, "edge_arr_grd_d_h": 22, - "edge_trou_grd_b": 25, "edge_trou_grd_h": 26, - "edge_ray_grd_b": 27, "edge_ray_grd_h": 28, - "edge_long_g_b": 13, "edge_long_g_h": 14, - "edge_long_d_b": 15, "edge_long_d_h": 16 - } + # -------------------------- Procedure who associates external circles + def cercle(grille, k, ge, p): + ms = grille.getVertexIJK(0, 0, k) + ma1 = grille.getEdgeJ(0, 2, k) + ma2 = grille.getEdgeJ(0, 1, k) + ma3 = grille.getEdgeJ(0, 0, k) - all_faces_bielle = geompy.SubShapeAllSorted(bielle_geom, geompy.ShapeType["FACE"]) - # dictionnaire des faces de la geometrie : - # key = nom, value = indice dans all_faces_bielle - dic_face_names = {"face_ray_pte": 0, "face_trou_pte": 1, "face_pte_g": 2, - "face_pte_d": 3, "face_long_g": 4, "face_long_d": 5, - "face_bas": 6, "face_haut": 7, "face_grd_g": 8, - "face_grd_d": 9, "face_trou_grd": 10, - "face_ray_grd": 11 - } + doc.associateClosedLine(ms, ma1, [ ma2, ma3 ], ge, p, False, []) + cercle(grille_p, 0, ga_pbe, 5.0/6) + cercle(grille_p, 1, ga_phe, 5.0/6) + + cercle(grille_g, 0, ga_gbe, 0) + cercle(grille_g, 1, ga_ghe, 0) + # ------------------- Procedure who associates external decentered lines + def arc(grille, i1, i2, k, ge): + ma1 = grille.getEdgeJ(1, i1, k) + ma2 = grille.getEdgeJ(1, i2, k) + + doc.associateOpenedLine(ma1, [ ma2 ], ge, 0, [], 1) + arc(grille_p, 1, 0, 0, ga_pbcd) + arc(grille_p, 1, 0, 1, ga_phcd) -Go back to :ref:`menu` - -.. _assoc: + arc(grille_g, 0, 2, 0, ga_gbcd) + arc(grille_g, 0, 2, 1, ga_ghcd) -Association of the model to the geometry -======================================== -:: + # ---------------------- Associate archs vertices with connection circles - dico_haut_bas = {"h": 1, "b": 0} + hm = prisme.getHexa(1) + for i in xrange(0, 4): + vm = hm.getVertex(i) + ga = sommets[ sommets_petit[i] ] + vm.setAssociation(ga) - # 1. lignes internes (trou) haut/bas du petit cylindre - # ==================================================== - for z in dico_haut_bas.iteritems(): + hm = prisme.getHexa(2) + for i in xrange(0, 4): + vm = hm.getVertex(i) + ga = sommets[ sommets_grand[i] ] + vm.setAssociation(ga) - mod_line = [grille_cyl_pte.getEdgeJ(0, j, z[1]) for j in range(5)] - mod_start = grille_cyl_pte.getEdgeJ(0, 5, z[1]) - mod_first = mod_start.getVertex(1) + # ---------------------- Associate connection circles - # geometrie : 1 seule ligne - edge_hole_in = all_edges_bielle[dic_edge_names["edge_trou_pte_"+z[0]]] - geo_start = edge_hole_in - par_start = 0.0 - geo_line = [] + hm = prisme.getHexa(0) + for i in xrange(0, 4): + em = hm.getEdge(i+8) + ga = aretes[ aretes_petit[i] ] + em.addAssociation(ga, 0, 1) - # association : - ier = doc.associateClosedLine(mod_first, mod_start, mod_line, - geo_start, par_start, geo_line) - + hm = prisme.getHexa(2) + for i in xrange(0, 4): + em = hm.getEdge(i+8) + ga = aretes[ aretes_grand[i] ] + em.addAssociation(ga, 0, 1) - # 2. lignes internes (trou) haut/bas du grand cylindre - # ===================================================== - for z in dico_haut_bas.iteritems(): - - mod_start = grille_cyl_grd.getEdgeJ(0, 5, z[1]) - mod_first = mod_start.getVertex(1) - mod_line = [grille_cyl_grd.getEdgeJ(0, j, z[1]) for j in range (5)] - - # geometrie : 1 seule ligne - edge_hole_in = all_edges_bielle[dic_edge_names["edge_trou_grd_"+z[0]]] - geo_start = edge_hole_in - par_start = 0.0 - geo_line = [] - - # association : - ier = doc.associateClosedLine(mod_first, mod_start, mod_line, - geo_start, par_start, geo_line) - - - # 3. lignes externes haut/bas du petit cylindre - # ============================================= - for z in dico_haut_bas.iteritems(): - - # modele de blocs : - mod_start = grille_cyl_pte.getEdgeJ(1, 1, z[1]) - # table des edges : - mod_line = [grille_cyl_pte.getEdgeJ(1, j, z[1]) for j in [2, 3, 4]] - - # geometrie : - # les edges de la geometrie correspondant sont, dans l'ordre (par - # exemple pour le haut) : - # edge_arr_pte_d_h, edge_ray_pte_h, edge_arr_pte_g_h - geo_start = all_edges_bielle[dic_edge_names["edge_arr_pte_d_"+z[0]]] - - geo_line = [] - geo_line.append(all_edges_bielle[dic_edge_names["edge_ray_pte_"+z[0]]]) - geo_line.append(all_edges_bielle[dic_edge_names["edge_arr_pte_g_"+z[0]]]) - - # association : - # la première est la dernière ligne sont orientées "dans le - # mauvais sens" => on fournit cette info : - par_start = 0.0 - par_end = 1.0 - ier = doc.associateOpenedLine(mod_start, mod_line, - geo_start, par_start, geo_line, par_end) - - - ## # 4. lignes externes haut/bas du grand cylindre - ## # ============================================= - for z in dico_haut_bas.iteritems(): - - # modele de blocs : - mod_start = grille_cyl_grd.getEdgeJ(1, 4, z[1]) - # table des edges : - mod_line = [grille_cyl_grd.getEdgeJ(1, j, z[1]) for j in [5, 0, 1]] - - # geometrie : - # les edges de la geometrie correspondant sont, dans l'ordre (par - # exemple pour le haut) : - # edge_arr_grd_g_h, edge_ray_grd_h, edge_arr_grd_d_h - geo_start = all_edges_bielle[dic_edge_names["edge_arr_grd_g_"+z[0]]] - - geo_line = [] - geo_line.append(all_edges_bielle[dic_edge_names["edge_ray_grd_"+z[0]]]) - geo_line.append(all_edges_bielle[dic_edge_names["edge_arr_grd_d_"+z[0]]]) - - # association : - # la première est la dernière ligne sont orientées "dans le - # mauvais sens" => on fournit cette info : - par_start = 0.0 - par_end = 1.0 - ier = doc.associateOpenedLine(mod_start, mod_line, - geo_start, par_start, geo_line, par_end) - - # 6. association des 4 points restants (x1, x4, y1, y4) : - # ======================================================= - - # NB: - # h = top (haut) - # b = bottom (bas) - # g = big (grand) - # p = small (petit) - # t = hole (trou) - - face_haut = all_faces_bielle[dic_face_names["face_haut"]] - - edge_haut_droite = geompy.GetEdgesByLength(face_haut, 0.136, 0.137) - edge_haut_gauche = geompy.GetEdgesByLength(face_haut, 0.131, 0.132) - - # 1. grand cylindre : - y_h_g = geompy.MakeVertexOnSurface(face_haut, 1, 0.5) - u_h_g = geompy.MakeVertexOnCurve(edge_haut_droite, 1) - w_h_g = geompy.MakeVertexOnCurve(edge_haut_gauche, 0) - edge_v_grd = geompy.MakeLineTwoPnt(u_h_g, w_h_g) - - geo_y1 = geompy.MakeVertexOnCurve(edge_v_grd, 0.5) - geo_y4 = geompy.MakeVertexWithRef(geo_y1, 0.0, 0.0, -hauteur) - - # vertex cote grande grille cylindrique : - mod_y1.setAssociation(geo_y1) - mod_y4.setAssociation(geo_y4) - - # 2. petit cylindre : - # REM : le modele grand cylindre a ete cree par translation / au petit - # cylindre. - v_h_p = geompy.MakeVertexOnSurface(face_haut, 0, 0.5) - x_h_p = geompy.MakeVertexOnCurve(edge_haut_droite, 0) - z_h_p = geompy.MakeVertexOnCurve(edge_haut_gauche, 1) - edge_v_pte = geompy.MakeLineTwoPnt(x_h_p, z_h_p) - - geo_x1 = geompy.MakeVertexOnCurve(edge_v_pte, 0.5) - geo_x4 = geompy.MakeVertexWithRef(geo_x1, 0.0, 0.0, -hauteur) - - # vertex cote petite grille cylindrique : - mod_x1.setAssociation(geo_x1) - mod_x4.setAssociation(geo_x4) - - # 7. association des faces : - quad1 = grille_cyl_pte.getQuadJK(1, 1, 0) - quad1.addAssociation(all_faces_bielle[dic_face_names["face_pte_d"]]) - quad2 = grille_cyl_pte.getQuadJK(1, 4, 0) - quad2.addAssociation(all_faces_bielle[dic_face_names["face_pte_g"]]) - quad3 = grille_cyl_grd.getQuadJK(1, 1, 0) - quad3.addAssociation(all_faces_bielle[dic_face_names["face_grd_d"]]) - quad4 = grille_cyl_grd.getQuadJK(1, 4, 0) - quad4.addAssociation(all_faces_bielle[dic_face_names["face_grd_g"]]) + # --------------------- Round implicit cylindrical associations + for h, i, ech in [ [0, 0, 0.95], [0, 1, 0.95], [2, 2, 0.85], [2, 3, 0.85] ]: + hm = prisme.getHexa(h) + em = hm.getEdge(i) + va = em.getVertex(0).getAssociation() + vb = em.getVertex(1).getAssociation() + vax, vay, vaz = geompy.PointCoordinates(va) + vbx, vby, vbz = geompy.PointCoordinates(vb) + vmx = ( vax + vbx ) / 2.0 * ech + vmy = ( vay + vby ) / 2.0 + vmz = ( vaz + vbz ) / 2.0 + vm = geompy.MakeVertex(vmx, vmy, vmz) + eg = geompy.MakeArc(va, vm, vb) + em.clearAssociation() + em.addAssociation(eg, 0, 1) Go back to :ref:`menu` @@ -333,42 +201,74 @@ Definition of elements groups for the mesh :: - # We define 3 groups + # -------------------------- # Define 5 faces groups + + groupe_petit = doc.addQuadGroup("Petit") + groupe_grand = doc.addQuadGroup("Grand") + groupe_bas = doc.addQuadGroup("Bas") + groupe_haut = doc.addQuadGroup("Haut") + groupe_contour = doc.addQuadGroup("Contour") - # groupe d edges (arretes) - edge_grp = doc.addEdgeGroup("Edge_grp") - for i in range(doc.countEdge()): - edge_grp.addElement(doc.getEdge(i)) + # -------------------------- Define little and big cylinder groups - # groupe de quads (faces) - quad_grp = doc.addQuadGroup("Quad_grp") - for i in range(doc.countQuad()): - quad_grp.addElement(doc.getQuad(i)) + for i in xrange(3): + groupe_petit.addElement( grille_p.getQuadJK(0, i, 0) ) + groupe_grand.addElement( grille_g.getQuadJK(0, i, 0) ) - # groupe d hexas (solids) - hexa_grp = doc.addHexaGroup("Hexa_grp") - for i in range(doc.countHexa()): - hexa_grp.addElement(doc.getHexa(i)) + # -------------------------- Define bottum and up groups + + for i in xrange(3): + groupe_bas.addElement( grille_p.getQuadIJ(0, i, 0) ) + groupe_bas.addElement( grille_g.getQuadIJ(0, i, 0) ) + + groupe_haut.addElement( grille_p.getQuadIJ(0, i, 1) ) + groupe_haut.addElement( grille_g.getQuadIJ(0, i, 1) ) + + for i in xrange(3): + h = prisme.getHexa(i) + + groupe_bas.addElement( h.getQuad(2) ) + groupe_haut.addElement( h.getQuad(3) ) + + # -------------------------- Define border group + + for i in xrange(2): + groupe_contour.addElement( grille_p.getQuadJK(1, i, 0) ) + + for i in [0, 2]: + groupe_contour.addElement( grille_g.getQuadJK(1, i, 0) ) + + for i in xrange(3): + h = prisme.getHexa(i) + + groupe_contour.addElement( h.getQuad(4) ) + groupe_contour.addElement( h.getQuad(5) ) + + # -------------------------- Define 3 groups of volumes + + groupe_petit = doc.addHexaGroup("Petit") + groupe_grand = doc.addHexaGroup("Grand") + groupe_prisme = doc.addHexaGroup("Prisme") + + for i in xrange(3): + groupe_petit.addElement( grille_p.getHexa(i) ) + groupe_grand.addElement( grille_g.getHexa(i) ) + + for i in xrange(3): + groupe_prisme.addElement( prisme.getHexa(i) ) - # groupe de noeuds de vertex pour tout le modele - vertex_nod_grp = doc.addVertexNodeGroup("Vertex_Nod_Grp") - for i in range(doc.countVertex()): - vertex_nod_grp.addElement(doc.getVertex(i)) Go back to :ref:`menu` .. _lawdisc: -Definition of a law discretization -================================== +Definition of a law discretization laws : +======================================== :: - law = doc.addLaw("Uniform", 4) + hexablock.addLaws(doc, 0.003, True) - for j in range(doc.countPropagation()): - propa = doc.getPropagation(j) - propa.setLaw(law) # apply discretization law on the model and generate the mesh Go back to :ref:`menu` @@ -380,11 +280,6 @@ Mesh generation :: - print " --- HEXAHEDRICAL MESH --- " - mesh_hexas = hexablock.mesh("Bielle:hexas", doc) - - print "Number of hexahedra:", mesh_hexas.NbHexas() - print "Number of quadrangles:", mesh_hexas.NbQuadrangles() - print "Number of segments:", mesh_hexas.NbEdges() - print "Number of nodes:", mesh_hexas.NbNodes() - + blocs = hexablock.mesh(doc) + ## .. and show statistics + muv, mue, muq, muh = hexablock.dump(doc, blocs) diff --git a/doc/mesh.rst b/doc/mesh.rst index d6e18bf..93a81b2 100644 --- a/doc/mesh.rst +++ b/doc/mesh.rst @@ -117,20 +117,20 @@ Examples Linear approximation of the discretization of faces ''''''''''''''''''''''''''''''''''''''''''''''''''''' -.. image:: _static/meshing1.PNG +.. image:: _static/meshing1.png :align: center Geometric face and meshing by approximation '''''''''''''''''''''''''''''''''''''''''''' -.. image:: _static/meshing2.PNG +.. image:: _static/meshing2.png :align: center Geometric face and meshing by approximation and projection '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' -.. image:: _static/meshing3.PNG +.. image:: _static/meshing3.png :align: center diff --git a/doc/pyplots/test_cut.py b/doc/pyplots/test_cut.py index 412ab00..54643ea 100644 --- a/doc/pyplots/test_cut.py +++ b/doc/pyplots/test_cut.py @@ -41,13 +41,13 @@ arete = grid.getEdgeK(0, 0, 0) ## doc.dump() file_name = os.path.join(os.environ['TMP'], 'no_decoupe.vtk') -doc.saveVtk(file_name) +#### doc.saveVtk(file_name) doc.cut(arete, 1) # doc.dump() file_name = os.path.join(os.environ['TMP'], 'decoupe.vtk') -doc.saveVtk(file_name) +#### doc.saveVtk(file_name) print "...test cut hexaedra OK" diff --git a/doc/pyplots/test_disconnect.py b/doc/pyplots/test_disconnect.py index 172cd6a..38e89b6 100644 --- a/doc/pyplots/test_disconnect.py +++ b/doc/pyplots/test_disconnect.py @@ -68,12 +68,12 @@ edge.setScalar(5) vertex.setScalar(5) file_name = os.path.join(os.environ['TMP'], 'disconnect1.vtk') -doc.saveVtk(file_name) +#### doc.saveVtk(file_name) doc.disconnectQuad(hexa1, quad) file_name = os.path.join(os.environ['TMP'], 'disconnect2.vtk') -doc.saveVtk(file_name) +#### doc.saveVtk(file_name) print "...test disconnect elements OK" diff --git a/doc/pyplots/test_join_quads.py b/doc/pyplots/test_join_quads.py index 3e397f1..79bc1a3 100644 --- a/doc/pyplots/test_join_quads.py +++ b/doc/pyplots/test_join_quads.py @@ -74,6 +74,6 @@ for nh in range(height): file_name = os.path.join(os.environ['TMP'], 'joint.vtk') -elts.saveVtk(file_name) +#### elts.saveVtk(file_name) print "...test join OK" diff --git a/doc/pyplots/test_make_cart_grid.py b/doc/pyplots/test_make_cart_grid.py index b0bfb3f..daca858 100644 --- a/doc/pyplots/test_make_cart_grid.py +++ b/doc/pyplots/test_make_cart_grid.py @@ -45,6 +45,6 @@ nk = 8 grid = doc.makeCartesian(orig, dx, dy, dz, ni, nj, nk) file_name = os.path.join(os.environ['TMP'], 'grille_cartesienne.vtk') -grid.saveVtk(file_name) +#### grid.saveVtk(file_name) print "...test grille cartesienne OK" diff --git a/doc/pyplots/test_make_cyl_grid.py b/doc/pyplots/test_make_cyl_grid.py index 942efeb..fde7d71 100644 --- a/doc/pyplots/test_make_cyl_grid.py +++ b/doc/pyplots/test_make_cyl_grid.py @@ -57,7 +57,7 @@ for i in range(2): c2.getHexa(base2 + i).setScalar(5) file_name = os.path.join(os.environ['TMP'], 'grilles_cylindriques.vtk') -doc.saveVtk(file_name) +#### doc.saveVtk(file_name) print "...test grille cylindrique OK" diff --git a/doc/pyplots/test_make_cylinder.py b/doc/pyplots/test_make_cylinder.py index ed7e86b..aed65c6 100644 --- a/doc/pyplots/test_make_cylinder.py +++ b/doc/pyplots/test_make_cylinder.py @@ -45,6 +45,6 @@ nl = height elts = doc.makeCylinder(cyl, vb, nr, na, nl) file_name = os.path.join(os.environ['TMP'], 'cylindre.vtk') -elts.saveVtk(file_name) +#### elts.saveVtk(file_name) print "...test cylindre OK" diff --git a/doc/pyplots/test_make_elmts_transform.py b/doc/pyplots/test_make_elmts_transform.py index 3b18eff..f3f75d0 100644 --- a/doc/pyplots/test_make_elmts_transform.py +++ b/doc/pyplots/test_make_elmts_transform.py @@ -39,18 +39,18 @@ grid = doc.makeCartesian1(orig, dirVr, size_x, size_y, size_z, 0, 0, orig.setScalar(2) file_name = os.path.join(os.environ['TMP'], 'transfo0.vtk') -doc.saveVtk(file_name) +#### doc.saveVtk(file_name) devant = doc.addVector(5, 0, 0) grid2 = doc.makeTranslation(grid, devant) file_name = os.path.join(os.environ['TMP'], 'transfo_translation.vtk') -doc.saveVtk(file_name) +#### doc.saveVtk(file_name) grid4 = doc.makeRotation(grid2, orig, dirVr, 45) file_name = os.path.join(os.environ['TMP'], 'transfo_rotation.vtk') -doc.saveVtk(file_name) +#### doc.saveVtk(file_name) print "...test make elements by transforming elements OK" diff --git a/doc/pyplots/test_make_pipe.py b/doc/pyplots/test_make_pipe.py index 7679546..ed44ec8 100644 --- a/doc/pyplots/test_make_pipe.py +++ b/doc/pyplots/test_make_pipe.py @@ -46,6 +46,6 @@ nl = 5 elts = doc.makePipe(pi, vb, nr, na, nl) file_name = os.path.join(os.environ['TMP'], 'pipe.vtk') -elts.saveVtk(file_name) +#### elts.saveVtk(file_name) print "...test pipe OK" diff --git a/doc/pyplots/test_make_spher_grid.py b/doc/pyplots/test_make_spher_grid.py index da5f256..009af72 100644 --- a/doc/pyplots/test_make_spher_grid.py +++ b/doc/pyplots/test_make_spher_grid.py @@ -45,6 +45,6 @@ grid = doc.makeSpherical(orig, direction, n, k) file_name = os.path.join(os.environ['TMP'], 'grille_spherique.vtk') -grid.saveVtk(file_name) +#### grid.saveVtk(file_name) print "...test grille spherique OK" diff --git a/doc/pyplots/test_prism_quads.py b/doc/pyplots/test_prism_quads.py index 4366fea..6e23d85 100644 --- a/doc/pyplots/test_prism_quads.py +++ b/doc/pyplots/test_prism_quads.py @@ -51,6 +51,6 @@ vec = doc.addVector(1, 1, 1) elts = doc.prismQuads(liste, vec, 5) file_name = os.path.join(os.environ['TMP'], 'prisme.vtk') -elts.saveVtk(file_name) +#### elts.saveVtk(file_name) print "...test prism OK" diff --git a/doc/pyplots/test_propagation.py b/doc/pyplots/test_propagation.py index 0e6cb33..e5b6b00 100644 --- a/doc/pyplots/test_propagation.py +++ b/doc/pyplots/test_propagation.py @@ -54,7 +54,7 @@ for nro in range(doc.countPropagation()): file_name = os.path.join(os.environ['TMP'], 'propagation.vtk') -doc.saveVtk(file_name) +#### doc.saveVtk(file_name) print "...test propagation OK" diff --git a/doc/python.rst b/doc/python.rst index c7c6fd2..de7d99b 100644 --- a/doc/python.rst +++ b/doc/python.rst @@ -13,6 +13,7 @@ By the links below you can find sample scripts for all operations provided by He tui_component.rst tui_document.rst + tui_elements.rst tui_vertex.rst tui_edge.rst tui_quadrangle.rst @@ -24,14 +25,19 @@ By the links below you can find sample scripts for all operations provided by He tui_cartgrid.rst tui_cylgrid.rst tui_sphergrid.rst + tui_hemisphere_rind.rst tui_remove.rst tui_cut_hexa.rst tui_prism_join_quad.rst tui_merge_elmts.rst tui_disc_elmts.rst tui_make_elmts.rst + tui_make_symmetry.rst tui_modify_elmts.rst + tui_quad_revolution.rst + tui_association.rst tui_asso_quad_to_geom.rst + tui_asso_vertex_to_geom.rst tui_groups.rst tui_discret_law.rst tui_propag.rst diff --git a/doc/test_doc/cut_hexa/cut_hexa.py b/doc/test_doc/cut_hexa/cut_hexa.py new file mode 100644 index 0000000..bf69e94 --- /dev/null +++ b/doc/test_doc/cut_hexa/cut_hexa.py @@ -0,0 +1,21 @@ +####### Test for Cut Hexa ############### + +import hexablock + + +doc = hexablock.addDocument("default") + +size_x = 2 +size_y = 1 +size_z = 1 + +orig = doc.addVertex(0, 0, 0) +dirVr = doc.addVector(1, 1, 1) +grid = doc.makeCartesian1(orig, dirVr, size_x, size_y, size_z, 0, 0, 0) + +##### doc.saveVtk ("hexa.vtk") + +arete = grid.getEdgeK(0, 0, 0) +doc.cut(arete, 1) + +##### doc.saveVtk ("cut_hexa.vtk") diff --git a/doc/test_doc/cylinder_pipe/make_cylinder.py b/doc/test_doc/cylinder_pipe/make_cylinder.py new file mode 100644 index 0000000..ffe4cf3 --- /dev/null +++ b/doc/test_doc/cylinder_pipe/make_cylinder.py @@ -0,0 +1,22 @@ + +####### Make Cylinder Test ########## + +import hexablock + + +doc = hexablock.addDocument ("default") + +base = doc.addVertex(0, 0, 0) +direction = doc.addVector(0, 0, 1) +radius = 4 +height = 5 + +cyl = doc.addCylinder(base, direction, radius, height) + +vb = doc.addVector(1, 0, 0) +nr = radius +na = 9 +nl = height +elts = doc.makeCylinder(cyl, vb, nr, na, nl) + +##### doc.saveVtk ("make_cylinder.vtk") diff --git a/doc/test_doc/cylinder_pipe/make_cylinders.py b/doc/test_doc/cylinder_pipe/make_cylinders.py new file mode 100644 index 0000000..99b531b --- /dev/null +++ b/doc/test_doc/cylinder_pipe/make_cylinders.py @@ -0,0 +1,23 @@ + +####### Make Cylinders Test ########## + +import hexablock + + +doc = hexablock.addDocument ("default") + +ori1 = doc.addVertex ( 0, 0, 0) +ori2 = doc.addVertex (-5, 0, 5) +vz = doc.addVector ( 0, 0, 1) +vx = doc.addVector ( 1 ,0, 0) + +nr1 = 2 +nl1 = 10 +nr2 = 1 +nl2 = 10 + +cyl1 = doc.addCylinder (ori1, vz, nr1, nl1) +cyl2 = doc.addCylinder (ori2, vx, nr2, nl2) +elts = doc.makeCylinders (cyl1, cyl2) + +##### doc.saveVtk ("make_cylinders.vtk") diff --git a/doc/test_doc/cylinder_pipe/make_pipe.py b/doc/test_doc/cylinder_pipe/make_pipe.py new file mode 100644 index 0000000..fe6567e --- /dev/null +++ b/doc/test_doc/cylinder_pipe/make_pipe.py @@ -0,0 +1,23 @@ + +####### Make Pipe Test ########## + +import hexablock + +doc = hexablock.addDocument ("default") + +orig = doc.addVertex(50, 0, 0) +vz = doc.addVector(0, 0, 1) +int_radius = 3 +ext_radius = 4 +height = 5 + +pipe = doc.addPipe(orig, vz, int_radius, ext_radius, height) + +vb = doc.addVector(1, 0, 0) +nr = 4 +na = 9 +nl = 5 + +elts = doc.makePipe(pipe, vb, nr, na, nl) + +##### doc.saveVtk ("make_pipe.vtk") diff --git a/doc/test_doc/cylinder_pipe/make_pipes.py b/doc/test_doc/cylinder_pipe/make_pipes.py new file mode 100644 index 0000000..5a1b72b --- /dev/null +++ b/doc/test_doc/cylinder_pipe/make_pipes.py @@ -0,0 +1,25 @@ + +####### Make Pipes Test ########## + +import hexablock + + +doc = hexablock.addDocument ("default") + +ori1 = doc.addVertex ( 0, 0, 0) +ori2 = doc.addVertex (-5, 0, 5) +vz = doc.addVector ( 0, 0, 1) +vx = doc.addVector ( 1 ,0, 0) + +nr1 = 2 +ni1 = 1 +nl1 = 10 +nr2 = 1 +ni2 = 0.5 +nl2 = 10 + +pipe1 = doc.addPipe (ori1, vz, ni1, nr1, nl1) +pipe2 = doc.addPipe (ori2, vx, ni2, nr2, nl2) +elts = doc.makePipes (pipe1, pipe2) + +##### doc.saveVtk ("make_pipes.vtk") diff --git a/doc/test_doc/edge/edge.py b/doc/test_doc/edge/edge.py new file mode 100644 index 0000000..2271436 --- /dev/null +++ b/doc/test_doc/edge/edge.py @@ -0,0 +1,5 @@ +used_edges = [] + +for i in xrange( doc.countUsedEdge() ): + edge_i = doc.getUsedEdge(i) + used_edges.append(edge_i) diff --git a/doc/test_doc/grid/cartesian_grid.py b/doc/test_doc/grid/cartesian_grid.py new file mode 100644 index 0000000..3b1d829 --- /dev/null +++ b/doc/test_doc/grid/cartesian_grid.py @@ -0,0 +1,20 @@ +####### Test Cartesian Grid ################# + +import hexablock + + +doc = hexablock.addDocument ("default") + +orig = doc.addVertex(0, 0, 0) + +dx = doc.addVector(1, 0, 0) +dy = doc.addVector(0, 1, 0) +dz = doc.addVector(0, 0, 1) + +ni = 15 +nj = 12 +nk = 8 + +grid = doc.makeCartesian(orig, dx, dy, dz, ni, nj, nk) + +##### doc.saveVtk ("cartesian_grid.vtk") diff --git a/doc/test_doc/grid/cylindrical_grid.py b/doc/test_doc/grid/cylindrical_grid.py new file mode 100644 index 0000000..8dd9606 --- /dev/null +++ b/doc/test_doc/grid/cylindrical_grid.py @@ -0,0 +1,30 @@ +####### Test Regular Cylindrical Grid ################# + +import hexablock + + +doc = hexablock.addDocument ("default") + +orig1 = doc.addVertex(0, 0, 0) +orig2 = doc.addVertex(10, 0, 0) +orig3 = doc.addVertex(0, 10, 0) +orig4 = doc.addVertex(10, 10, 0) +orig5 = doc.addVertex(0, 20, 0) +orig6 = doc.addVertex(10, 20, 0) + +vz = doc.addVector(0, 0, 1) +vx = doc.addVector(1, 0, 0) + +dr = 1 +dl = 1 +nr = 2 +nl = 3 + +c1 = doc.makeCylindrical(orig1, vx, vz, dr, 360, dl, nr, 4, nl, True) +c2 = doc.makeCylindrical(orig2, vx, vz, dr, 360, dl, nr, 8, nl, True) +c3 = doc.makeCylindrical(orig3, vx, vz, dr, 270, dl, nr, 8, nl, True) +c4 = doc.makeCylindrical(orig4, vx, vz, dr, 270, dl, nr, 7, nl, True) +c5 = doc.makeCylindrical(orig5, vx, vz, dr, 360, dl, nr, 5, nl, True) +c6 = doc.makeCylindrical(orig6, vx, vz, dr, 360, dl, nr, 6, nl, True) + +##### doc.saveVtk ("cylindrical.vtk") diff --git a/doc/test_doc/grid/irregular_cylindrical.py b/doc/test_doc/grid/irregular_cylindrical.py new file mode 100644 index 0000000..f93302a --- /dev/null +++ b/doc/test_doc/grid/irregular_cylindrical.py @@ -0,0 +1,26 @@ + +####### Make Irregular Cylindrical Test ########## + +import hexablock + + +doc = hexablock.addDocument ("cyl:hexas") + +orig = doc.addVertex (0, 0, 0) +vz = doc.addVector (0, 0, 1) +vx = doc.addVector (1 ,0, 0) + + +tdr = [ 1, 1, 1, 1 ] +tda = [ 45, 45, 45, 45, 45, 45, 45, 45 ] +tdl = [ 1, 1, 1 ] + +tdr = [ 1, 2, 0.5 ] +tda = [ 30, 30, 30, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 30, 30, 30, 10, 10, 10, 10, 10, 10, 10, 10, 10 ] +tdl = [ 1, 2, 3 ] + + +c1 = doc.makeCylindricals (orig, vx,vz, tdr, tda, tdl, False) + +##### doc.saveVtk ("cylindricals.vtk") diff --git a/doc/test_doc/grid/spherical_grid.py b/doc/test_doc/grid/spherical_grid.py new file mode 100644 index 0000000..67aee3e --- /dev/null +++ b/doc/test_doc/grid/spherical_grid.py @@ -0,0 +1,15 @@ +####### Test for spherical grid ########### + +import hexablock + + +doc = hexablock.addDocument ("default") + +orig = doc.addVertex(0, 0, 0) +radius = 5 +n = 2 +k = 1 + +grid = doc.makeSpherical(orig, radius, n, k) + +##### doc.saveVtk ("spherical_grid.vtk") diff --git a/doc/test_doc/grid/spherical_grid2.py b/doc/test_doc/grid/spherical_grid2.py new file mode 100644 index 0000000..8434803 --- /dev/null +++ b/doc/test_doc/grid/spherical_grid2.py @@ -0,0 +1,20 @@ + + +import hexablock + +doc = hexablock.addDocument ("default") + +orig = doc.addVertex(0, 0, 0) + +direction = doc.addVector(1, 1, 1) + +dx = doc.addVector(1, 0, 0) +dy = doc.addVector(0, 1, 0) +dz = doc.addVector(0, 0, 1) + +n = 2 +k = 0.8 + +grid = doc.makeSpherical(orig, dx, dy, dz, n, k) + +##### doc.saveVtk ("spherical_grid2.vtk") diff --git a/doc/test_doc/hemispherical_rind/hemispherical_grid.py b/doc/test_doc/hemispherical_rind/hemispherical_grid.py new file mode 100644 index 0000000..c57e74b --- /dev/null +++ b/doc/test_doc/hemispherical_rind/hemispherical_grid.py @@ -0,0 +1,28 @@ + +####### Hemispherical Grid Test ########## + +import hexablock + + +# ======================================================= test_sphere +def test_sphere () : + + doc = hexablock.addDocument ("default") + + center = doc.addVertex (0,0,0) + radius = 8 + orig = doc.addVertex (0,0,0) + vz = doc.addVector (0,0,1) + vx = doc.addVector (1,0,0) + radhole = 1 + nrad = 3 + nang = 16 + nhaut = 8 + + doc.makeSphere (center, vx, vz, radius, radhole, orig, nrad, nang, nhaut) + doc.saveVtk ("hemispherical.vtk") + return doc + +# ================================================================= Test +doc = test_sphere () + diff --git a/doc/test_doc/hemispherical_rind/partial_hemispherical_grid.py b/doc/test_doc/hemispherical_rind/partial_hemispherical_grid.py new file mode 100644 index 0000000..14a9bce --- /dev/null +++ b/doc/test_doc/hemispherical_rind/partial_hemispherical_grid.py @@ -0,0 +1,30 @@ + +####### Partial Hemispherical Grid Test ########## + +import hexablock + + +# ======================================================= test_part_sphere +def test_part_sphere () : + + doc = hexablock.addDocument ("default") + + center = doc.addVertex (0,0,0) + radius = 8 + orig = doc.addVertex (0,0,-4) + vz = doc.addVector (0,0,1) + vx = doc.addVector (1,0,0) + angle = 90 + radhole = 1 + nrad = 3 + nang = 4 + nhaut = 8 + + doc.makePartSphere (center, vx, vz, radius, radhole, orig, angle, + nrad, nang, nhaut) + ##### doc.saveVtk ("partial_hemispherical.vtk") + return doc + +# ================================================================= Test +doc = test_part_sphere () + diff --git a/doc/test_doc/hemispherical_rind/partial_rind_grid.py b/doc/test_doc/hemispherical_rind/partial_rind_grid.py new file mode 100644 index 0000000..804564f --- /dev/null +++ b/doc/test_doc/hemispherical_rind/partial_rind_grid.py @@ -0,0 +1,30 @@ + +####### Partial Rind Grid Test ########## + +import hexablock + + +# ======================================================= test_part_rind +def test_part_rind () : + + doc = hexablock.addDocument ("default") + + center = doc.addVertex (0,0,0) + radius = 8 + radint = 7 + orig = doc.addVertex (0,0,0) + vz = doc.addVector (0,0,1) + vx = doc.addVector (1,0,0) + angle = 90 + radhole = 1 + nrad = 3 + nang = 14 + nhaut = 8 + + doc.makePartRind (center, vx, vz, radius, radint, radhole, orig, angle, + nrad, nang, nhaut) + ##### doc.saveVtk ("part_rind.vtk") + return doc + +# ================================================================= Begin +doc = test_part_rind () diff --git a/doc/test_doc/hemispherical_rind/rind_grid.py b/doc/test_doc/hemispherical_rind/rind_grid.py new file mode 100644 index 0000000..e01eaa9 --- /dev/null +++ b/doc/test_doc/hemispherical_rind/rind_grid.py @@ -0,0 +1,29 @@ + +####### Rind Grid Test ########## + +import hexablock + + +# ======================================================= test_rind +def test_rind () : + + doc = hexablock.addDocument ("default") + + center = doc.addVertex (0,0,0) + radius = 8 + radint = 7 + orig = doc.addVertex (0,0,0) + vz = doc.addVector (0,0,1) + vx = doc.addVector (1,0,0) + radhole = 1 + nrad = 3 + nang = 16 + nhaut = 8 + + doc.makeRind (center, vx, vz, radius, radint, radhole, orig, + nrad, nang, nhaut) + ##### doc.saveVtk ("rind.vtk") + return doc + +# ================================================================= Test +doc = test_rind () diff --git a/doc/test_doc/hexa/hexa.py b/doc/test_doc/hexa/hexa.py new file mode 100644 index 0000000..80e8dfd --- /dev/null +++ b/doc/test_doc/hexa/hexa.py @@ -0,0 +1,5 @@ +used_hexas = [] + +for i in xrange( doc.countUsedHexa() ): + hexa_i = doc.getUsedHexa(i) + used_hexas.append(hexa_i) diff --git a/doc/test_doc/make_symmetry/make_sym_line.py b/doc/test_doc/make_symmetry/make_sym_line.py new file mode 100644 index 0000000..249058b --- /dev/null +++ b/doc/test_doc/make_symmetry/make_sym_line.py @@ -0,0 +1,40 @@ +######## Make Symmetry Line ######## + +import hexablock + + +# ======================================================= make_grid +def make_grid (doc) : + + ori = doc.addVertex ( 0, 0, 0) + vz = doc.addVector ( 0, 0, 1) + vx = doc.addVector ( 1 ,0, 0) + + dr = 1 + da = 360 + dl = 1 + + nr = 1 + na = 6 + nl = 1 + grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False) + ##### doc .saveVtk ("cyl_grid.vtk") + return grid + + +# ======================================================= test_sym_line +def test_sym_line () : + + doc = hexablock.addDocument ("default") + grid = make_grid (doc) + + orig = grid.getVertex(3) + dir = doc.addVector (0, 0, 1); + grid2 = doc.makeSymmetryLine (grid, orig, dir) + + ##### doc .saveVtk ("sym_line.vtk") + return doc + + +# ================================================================= Begin +doc = test_sym_line () diff --git a/doc/test_doc/make_symmetry/make_sym_plane.py b/doc/test_doc/make_symmetry/make_sym_plane.py new file mode 100644 index 0000000..a8a40a6 --- /dev/null +++ b/doc/test_doc/make_symmetry/make_sym_plane.py @@ -0,0 +1,39 @@ +######## Make Symmetry Plane ######## + +import hexablock + + +# ======================================================= make_grid +def make_grid (doc) : + + ori = doc.addVertex ( 0, 0, 0) + vz = doc.addVector ( 0, 0, 1) + vx = doc.addVector ( 1 ,0, 0) + + dr = 1 + da = 360 + dl = 1 + + nr = 1 + na = 6 + nl = 1 + grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False) + ##### doc .saveVtk ("cyl_grid.vtk") + return grid + + +# ======================================================= test_sym_plane +def test_sym_plane () : + + doc = hexablock.addDocument ("default") + grid = make_grid (doc) + + orig = grid.getVertex(3) + dir = doc.addVector (0, 1, 0); + grid2 = doc.makeSymmetryPlane (grid, orig, dir) + + ##### doc .saveVtk ("sym_plane.vtk") + return doc + +# ================================================================= Begin +doc = test_sym_plane () diff --git a/doc/test_doc/make_symmetry/make_sym_point.py b/doc/test_doc/make_symmetry/make_sym_point.py new file mode 100644 index 0000000..54e6300 --- /dev/null +++ b/doc/test_doc/make_symmetry/make_sym_point.py @@ -0,0 +1,40 @@ +######## Make Symmetry Point ######## + +import hexablock + + +# ======================================================= make_grid +def make_grid (doc) : + + ori = doc.addVertex ( 0, 0, 0) + vz = doc.addVector ( 0, 0, 1) + vx = doc.addVector ( 1 ,0, 0) + + dr = 1 + da = 360 + dl = 1 + + nr = 1 + na = 6 + nl = 1 + grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False) + ##### doc .saveVtk ("cyl_grid.vtk") + return grid + + +# ======================================================= test_sym_point +def test_sym_point () : + + doc = hexablock.addDocument ("default") + grid = make_grid (doc) + + orig = grid.getVertex(3) + grid2 = doc.makeSymmetryPoint (grid, orig) + + ##### doc .saveVtk ("sym_point.vtk") + return doc + + +# ================================================================= Begin +doc = test_sym_point () + diff --git a/doc/test_doc/make_transformation/make_rotation.py b/doc/test_doc/make_transformation/make_rotation.py new file mode 100644 index 0000000..b1454d2 --- /dev/null +++ b/doc/test_doc/make_transformation/make_rotation.py @@ -0,0 +1,20 @@ +####### Test make rotation ############### + +import hexablock + +doc = hexablock.addDocument("default") + +size_x = 1 +size_y = 1 +size_z = 2 + +orig = doc.addVertex(0, 0, 0) +dirVr = doc.addVector(1, 1, 1) + +grid = doc.makeCartesian1(orig, dirVr, size_x, size_y, size_z, 0, 0, 0) +##### grid.saveVtk ("initial.vtk") + +orig.setScalar(2) +grid1 = doc.makeRotation(grid, orig, dirVr, 60) + +##### grid1.saveVtk ("rotation.vtk") diff --git a/doc/test_doc/make_transformation/make_scale.py b/doc/test_doc/make_transformation/make_scale.py new file mode 100644 index 0000000..b359923 --- /dev/null +++ b/doc/test_doc/make_transformation/make_scale.py @@ -0,0 +1,24 @@ +####### Test make scale ############### + +import hexablock + + +doc = hexablock.addDocument ("default") +ori = doc.addVertex ( 0, 0, 0) +vz = doc.addVector ( 0, 0, 1) +vx = doc.addVector ( 1 ,0, 0) + +dr = 1 +da = 360 +dl = 1 + +nr = 1 +na = 6 +nl = 1 + +grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False) + +dest = doc.addVertex (15, 0, 0) +grid2 = doc.makeScale (grid, dest, 0.5) + +##### doc .saveVtk ("make_scale.vtk") diff --git a/doc/test_doc/make_transformation/make_translation.py b/doc/test_doc/make_transformation/make_translation.py new file mode 100644 index 0000000..89edd7e --- /dev/null +++ b/doc/test_doc/make_transformation/make_translation.py @@ -0,0 +1,21 @@ +####### Test make translation ############### + +import hexablock + +doc = hexablock.addDocument("default") + +size_x = 1 +size_y = 1 +size_z = 2 + +orig = doc.addVertex(0, 0, 0) +dirVr = doc.addVector(1, 1, 1) + +grid = doc.makeCartesian1(orig, dirVr, size_x, size_y, size_z, 0, 0, 0) + +##### doc.saveVtk ("cartesian.vtk") + +devant = doc.addVector(5, 0, 0) +grid1 = doc.makeTranslation(grid, devant) + +##### doc.saveVtk ("translation.vtk") diff --git a/doc/test_doc/prism_quad_join/join_quads.py b/doc/test_doc/prism_quad_join/join_quads.py new file mode 100644 index 0000000..fff637a --- /dev/null +++ b/doc/test_doc/prism_quad_join/join_quads.py @@ -0,0 +1,39 @@ +####### Test for Join Quad ############### + +import hexablock + +doc = hexablock.addDocument("default") + +orig1 = doc.addVertex(0, 0, 0) +dx = doc.addVector(1, 0, 0) +dy = doc.addVector(0, 1, 0) +dz = doc.addVector(0, 0, 1) + +dimx = 11 +dimy = 11 +dimz = 2 +grid1 = doc.makeCartesian(orig1, dx, dy, dz, dimx, dimy, dimz) + +orig2 = doc.addVertex(dimx/2.0, 0, 8) +grid2 = doc.makeCylindrical(orig2, dx, dy, 1, 180, 1, dimz, dimy, + dimx, False) + +mx = dimx/2 +my = dimy/2 +prems = grid1.getQuadIJ(mx, my, dimz) +cible = grid2.getQuadJK(dimz, mx, my) + +v1 = prems.getVertex(0) +v3 = prems.getVertex(1) +v2 = cible.getVertex(1) +v4 = cible.getVertex(2) + +liste = [prems] +liste.extend([grid1.getQuadIJ(nx, my, dimz) for nx in range(dimx) if nx != mx]) +liste.extend([grid1.getQuadIJ(mx, ny, dimz) for ny in range(dimy) if ny != my]) + +height = 5 + +elts = doc.joinQuads(liste, cible, v1, v2, v3, v4, height) + +##### elts.saveVtk ("join_quads.vtk") diff --git a/doc/test_doc/prism_quad_join/prism_quads.py b/doc/test_doc/prism_quad_join/prism_quads.py new file mode 100644 index 0000000..0bbd9bf --- /dev/null +++ b/doc/test_doc/prism_quad_join/prism_quads.py @@ -0,0 +1,29 @@ +####### Test for Prism Quad ############### + +import hexablock + + +doc = hexablock.addDocument("default") + +orig = doc.addVertex(0, 0, 0) +dx = doc.addVector(1, 0, 0) +dy = doc.addVector(0, 1, 0) +dz = doc.addVector(0, 0, 1) + +dimx = 11 +dimy = 11 +dimz = 2 +grid = doc.makeCartesian(orig, dx, dy, dz, dimx, dimy, dimz) + +mx = dimx/2 +my = dimy/2 +prems = grid.getQuadIJ(mx, my, dimz) + +liste = [prems] +liste.extend([grid.getQuadIJ(nx, my, dimz) for nx in range(dimx) if nx != mx]) +liste.extend([grid.getQuadIJ(mx, ny, dimz) for ny in range(dimy) if ny != my]) + +vec = doc.addVector(1, 1, 1) +elts = doc.prismQuads(liste, vec, 5) + +##### elts.saveVtk ("prism_quad.vtk") diff --git a/doc/test_doc/prism_quad_join/prism_quads_vec.py b/doc/test_doc/prism_quad_join/prism_quads_vec.py new file mode 100644 index 0000000..361e8fd --- /dev/null +++ b/doc/test_doc/prism_quad_join/prism_quads_vec.py @@ -0,0 +1,32 @@ +####### Test prismQuadsVec ############### + +import hexablock + +doc = hexablock.addDocument("prism_vec") + +ori = doc.addVertex ( 0, 0, 0) +vx = doc.addVector ( 1 ,0, 0) +vz = doc.addVector ( 0, 0, 1) + +dr = 1 +da = 360 +dl = 1 + +nr = 1 +na = 6 +nl = 1 + +grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False) + +liste = [ ] +for nx in range (nr) : + for ny in range (na) : + cell = grid.getQuadIJ (nx, ny, nl) + liste.append (cell); + +axis = doc.addVector (1, 1, 1); +hauteurs = [1, 3, 7, 15] + +elts = doc.prismQuadsVec (liste, axis, hauteurs, 0) + +##### elts.saveVtk("prism_quads_vec.vtk") diff --git a/doc/test_doc/quad/quad.py b/doc/test_doc/quad/quad.py new file mode 100644 index 0000000..5b715ea --- /dev/null +++ b/doc/test_doc/quad/quad.py @@ -0,0 +1,5 @@ +used_quads = [] + +for i in xrange( doc.countUsedQuad() ): + quad_i = doc.getUsedQuad(i) + used_quads.append(quad_i) diff --git a/doc/test_doc/quad_revolution/make_grid.py b/doc/test_doc/quad_revolution/make_grid.py new file mode 100644 index 0000000..23e5e91 --- /dev/null +++ b/doc/test_doc/quad_revolution/make_grid.py @@ -0,0 +1,25 @@ +#### Make a grid and get its quads ##### + +import hexablock + +doc = hexablock.addDocument ("default") + +ori = doc.addVertex ( 0, 0, 0) +vx = doc.addVector ( 1 ,0, 0) +vz = doc.addVector ( 0, 0, 1) + +dr = 1 +da = 360 +dl = 1 + +grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False) + +nr = 1 +na = 6 +nl = 1 + +liste = [ ] +for nx in range (nr) : + for ny in range (na) : + cell = grid.getQuadIJ (nx, ny, nl) + liste.append (cell); diff --git a/doc/test_doc/quad_revolution/revolution.py b/doc/test_doc/quad_revolution/revolution.py new file mode 100644 index 0000000..df34386 --- /dev/null +++ b/doc/test_doc/quad_revolution/revolution.py @@ -0,0 +1,65 @@ + +#### Quad Revolution Test ##### + +import hexablock +import os + + +# ================================================================= save_schema +class FileVtk : + def __init__ (self, doc, radical): + self.document = doc + self.count = 0 + self.radical = radical + + def save (self) : + """ + Save the model in a vtk file + """ + self.count += 1 + file_name = os.path.join(self.radical + str(self.count) + '.vtk') + ##### self.document.saveVtk(file_name) + +# ======================================================= make_grid +def make_grid (doc, nr, na, nl) : + + ori = doc.addVertex ( 0, 0, 0) + vx = doc.addVector ( 1 ,0, 0) + vz = doc.addVector ( 0, 0, 1) + + dr = 1 + da = 360 + dl = 1 + + grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False) + return grid + + +# ========================================================== test_revolution +def test_revolution () : + doc = hexablock.addDocument ("default") + vtk = FileVtk (doc, "Revolution"); + nr = 1 + na = 6 + nl = 1 + grid = make_grid (doc, nr, na, nl) + vtk.save () + + liste = [ ] + for nx in range (nr) : + for ny in range (na) : + cell = grid.getQuadIJ (nx, ny, nl) + liste.append (cell); + + center = doc.addVertex (0, -10, 0); + axis = doc.addVector (1, 0, 0); + angles = [5, 10, 15, 20, 30, 20, 15, 10, 5 ] + + vtk.save () + bloc = doc.revolutionQuads (liste, center, axis, angles); + vtk.save () + return doc + +# ================================================================= Test +doc = test_revolution () + diff --git a/doc/test_doc/replace_hexa/replace_hexa.py b/doc/test_doc/replace_hexa/replace_hexa.py new file mode 100644 index 0000000..3861196 --- /dev/null +++ b/doc/test_doc/replace_hexa/replace_hexa.py @@ -0,0 +1,66 @@ +####### Test replace hexa ############### + +import hexablock + +doc = hexablock.addDocument ("default") + + +# Hexa : Grid construction + +orig = doc.addVertex ( 0, 0, 0) +vx = doc.addVector ( 1 ,0, 0) +vy = doc.addVector ( 0, 1, 0) +vz = doc.addVector ( 0, 0, 1) + +size_x = 3 +size_y = 3 +size_z = 3 + +grid = doc.makeCartesian (orig, vx, vy, vz, size_x, size_y, size_z) + +c1 = grid.getVertexIJK (1, 2, size_z) +c2 = grid.getVertexIJK (1, 1, size_z) +c3 = grid.getVertexIJK (2, 1, size_z) + + +# Hexa : Hexa construction + +pa1 = doc.addVertex (-1, -1, 0) +pb1 = doc.addVertex ( 1, -1, 0) +pc1 = doc.addVertex ( 1, 1, 0) +pd1 = doc.addVertex (-1, 1, 0) + +pa2 = doc.addVertex (-2, -2, 0) +pb2 = doc.addVertex ( 2, -2, 0) +pc2 = doc.addVertex ( 2, 2, 0) +pd2 = doc.addVertex (-2, 2, 0) + +edab1 = doc.addEdge (pa1, pb1) +edbc1 = doc.addEdge (pb1, pc1) +edcd1 = doc.addEdge (pc1, pd1) +edda1 = doc.addEdge (pd1, pa1) + +edab2 = doc.addEdge (pa2, pb2) +edbc2 = doc.addEdge (pb2, pc2) +edcd2 = doc.addEdge (pc2, pd2) +edda2 = doc.addEdge (pd2, pa2) + +edaa = doc.addEdge (pa1, pa2) +edbb = doc.addEdge (pb1, pb2) +edcc = doc.addEdge (pc1, pc2) +eddd = doc.addEdge (pd1, pd2) + +qpattern = [] +qpattern.append (doc.addQuad (edab1, edbc1, edcd1, edda1)) +qpattern.append (doc.addQuad (edab1, edbb, edab2, edaa)) +qpattern.append (doc.addQuad (edbc1, edcc, edbc2, edbb)) +qpattern.append (doc.addQuad (edcd1, eddd, edcd2, edcc)) +qpattern.append (doc.addQuad (edda1, edaa, edda2, eddd)) + +##### doc.saveVtk ("replace0.vtk") + +# Hexa replacement (on the grid) +doc.replace (qpattern, pd2,c1, pa2,c2, pb2,c3) + +##### doc.saveVtk ("replace1.vtk") + diff --git a/doc/test_doc/test_cone/test_cone.py b/doc/test_doc/test_cone/test_cone.py new file mode 100644 index 0000000..1662a46 --- /dev/null +++ b/doc/test_doc/test_cone/test_cone.py @@ -0,0 +1,50 @@ + +import hexablock + + + +doc = hexablock.addDocument ("test_cone") + +orig = doc.addVertex (0, 0, 0) +ori2 = doc.addVertex (0, 0, 10) +vz = doc.addVector (0, 0, 1) +vx = doc.addVector (1 ,0, 0) + +rad1 = 2.0 +rad2 = 1.0 +height = 5.0 +angle = 270.0 +hollow = False + +nr = 2 +na = 8 +nl = 1 + +c1 = doc.makeCylindrical (orig, vx,vz, rad1, angle, height, nr,na,nl, hollow) +c2 = doc.makeCylindrical (ori2, vx,vz, rad2, angle, height, nr,na,nl, hollow) + +vh0 = c2.getVertexIJK (0, 0, 0) +vh1 = c2.getVertexIJK (1, 0, 0) + +vb0 = c1.getVertexIJK (0, 0, nl) +vb1 = c1.getVertexIJK (1, 0, nl) + +qcible = c2.getQuadIJ (0, 0, 0) +qliste = [] +for ni in range (nr) : + for nj in range (na) : + quad = c1.getQuadIJ (ni, nj, nl) + qliste.append (quad) + +## Join quads to make a cone between the 2 cylinders +doc.joinQuads (qliste, qcible, vb0, vh0, vb1, vh1, 1) + +### -------------------- Mesh +law = doc.addLaw ("Uniform", 4) + +for np in range(doc.countPropagation()): + propa = doc.getPropagation (np) + propa.setLaw (law) + +mesh_hexas = hexablock.mesh(doc) + diff --git a/doc/test_doc/update_tests.sh b/doc/test_doc/update_tests.sh new file mode 100755 index 0000000..b8906f3 --- /dev/null +++ b/doc/test_doc/update_tests.sh @@ -0,0 +1,30 @@ +#!/bin/sh +# Comm : Update python procedures + +start=`dirname $0` +target=`cd $start/../../src/TEST_PY/documentation ; pwd` +start=`cd $start ; pwd` + +cd $start +for rep in * + do + if ( [ -d $start/$rep ] ) then + mkdir -p $target/$rep + for fic in $rep/*.py + do + if ( [ ! -f $target/$fic ] ) then + echo " ____________________________ Add File : $fic" + cp $fic $target/$rep/ + else + diff=`diff -q $fic $target/$rep/` + if ( [ "$diff" ] ) then + echo " ---------------------------- Update : $fic" + cp $fic $target/$rep/ + else + echo " . . . . . . . . . . . Identical files : $fic" + fi + fi + done + fi + done + diff --git a/doc/test_doc/vertex/vertex.py b/doc/test_doc/vertex/vertex.py new file mode 100644 index 0000000..80f3701 --- /dev/null +++ b/doc/test_doc/vertex/vertex.py @@ -0,0 +1,5 @@ +used_vertices = [] + +for i in xrange( doc.countUsedVertex() ): + vertex_i = doc.getUsedVertex(i) + used_vertices.append(vertex_i) diff --git a/doc/tui_asso_quad_to_geom.rst b/doc/tui_asso_quad_to_geom.rst index 1473ed9..0760d5a 100644 --- a/doc/tui_asso_quad_to_geom.rst +++ b/doc/tui_asso_quad_to_geom.rst @@ -74,4 +74,38 @@ Associate a closed line:: l = doc.associateClosedLine(mfirst, mstart, mline, gstart, pstart, gline) +.. _tuiassocfacenote: + +Note for face association +========================= + +Face association (implicite or explicite) is not necessary for: + +- planar faces, +- cylindrical faces, +- conical faces. + +Only edges association (implicite) on segments or arcs of cirle is necessary. + +The following example show a model of block on which there isn't faces association but only +implicite edges association on arcs of circle. + + +Example +------- + +.. literalinclude:: test_doc/test_cone/test_cone.py + :linenos: + + +Result +------ + +.. image:: _static/cone_mesh.png + :align: center + +.. centered:: + Cone mesh + + GUI command: :ref:`guiassoquadtogeom` diff --git a/doc/tui_asso_vertex_to_geom.rst b/doc/tui_asso_vertex_to_geom.rst new file mode 100644 index 0000000..dcaad5e --- /dev/null +++ b/doc/tui_asso_vertex_to_geom.rst @@ -0,0 +1,45 @@ +:tocdepth: 3 + +.. _tuiassovertex2: + +======================================== +TUI: Definition of point of the geometry +======================================== + +Firt you need to define the Geom point you want to associate your vertex to. + + +Define a point by its coordinates:: + + geom_object_vertex = geompy.MakeVertex(X, Y, Z) + +Define a point by reference:: + + geom_object_vertex = geompy.MakeVertexWithRef(Reference, X,Y,Z) + +Define a point by an Edge and a Parameter:: + + geom_object_vertex = geompy.MakeVertexOnCurve(Edge,Parameter) + +Define a point by an Edge and a Length:: + + geom_object_vertex = geompy.MakeVertexOnCurveByLength(Edge,Length,StartPoint=None) + +Define a point by an Edge and Coordinates:: + + geom_object_vertex = geompy.MakeVertexOnCurveByCoord(Edge,X,Y,Z) + +Define a point by intersection of two Lines or Wires (or a Wire and a Line):: + + geom_object_vertex = geompy.MakePointOnLinesIntersection(myLine1,myWire1) + +Define a point by its position (U-V parameters) on a face:: + + geom_object_vertex = geompy.MakeVertexOnSurface(myFace,myUParameter,myVParameter) + +Define a point by its position (Coordinates) on a face:: + + geom_object_vertex = geompy.MakeVertexOnSurface(myFace,X,Y,Z) + + +GUI: :ref:`guiassovertex` diff --git a/doc/tui_association.rst b/doc/tui_association.rst new file mode 100644 index 0000000..1191b92 --- /dev/null +++ b/doc/tui_association.rst @@ -0,0 +1,21 @@ +:tocdepth: 3 + +.. _tuiassocs: + +============ +Associations +============ + +To remove an element's association(s):: + + em.clearAssociation() + +**em** can be a document: + + *clearAssociation()* remove all associations of the elements in the document. + +**em** can be a vertex, an edge, a quad or a set of elements: + + in this case, *clearAssociation()* remove all associations of the given type. + +GUI command: :ref:`guiassocs` \ No newline at end of file diff --git a/doc/tui_blocks_for_cyl_pipe.rst b/doc/tui_blocks_for_cyl_pipe.rst index 3df400b..c419a81 100644 --- a/doc/tui_blocks_for_cyl_pipe.rst +++ b/doc/tui_blocks_for_cyl_pipe.rst @@ -7,14 +7,16 @@ Make blocks for a cylinder and a pipe ===================================== +.. _tuimakecylinder: + Make blocks for a cylinder ========================== -:: +.. code-block:: python - elts = doc.makeCylinder(cyl, vb, nr, na, nl) + elts = doc.makeCylinder(cyl, vb, nr, na, nl) -cyl: cylinder +cyl: cylinder built using *addCylinder()* function (:ref:`tuicylinder`) vb: vector on the base of the cylinder to start hexahedra. @@ -24,95 +26,119 @@ na: number of angular section. nl: number of blocks along the axis of the cylinder. +Operations on *elts*: :ref:`tuielements2` + The result is an array of hexahedra ranked first by following the radial direction and the angular direction, then according to the layers in the cylinder axis. -Example -------- - -:: - - import hexablock - doc = hexablock.addDocument() - - base = doc.addVertex(0, 0, 0) - direction = doc.addVector(0, 0, 1) - radius = 4 - height = 5 +Example of cylinder construction +-------------------------------- - cyl = doc.addCylinder(base, direction, radius, height) +.. literalinclude:: test_doc/cylinder_pipe/make_cylinder.py + :linenos: - vb = doc.addVector(1, 0, 0) - nr = radius - na = 9 - nl = height - elts = doc.makeCylinder(cyl, vb, nr, na, nl) -.. image:: _static/cylinder.png +.. image:: _static/make_cylinder.png :align: center .. centered:: Cylinder + +.. _tuimakecylinders: + Make blocks for cylinders ========================= -:: +.. code-block:: python + + elts = doc.makeCylinders (cylinder1, cylinder2) + +Operations on *elts*: :ref:`tuielements2` + +Construction of an element from 2 cylinders: - elts = doc.makeCylinders(cyl1, cyl2) +.. literalinclude:: test_doc/cylinder_pipe/make_cylinders.py + :linenos: + +.. image:: _static/make_cylinders.png + :align: center + +.. centered:: + Element from 2 cylinders + The result is an array of hexahedral. +.. _tuimakepipe: + Make blocks for a pipe ====================== -:: +.. code-block:: python elts = doc.makePipe(pi, vb, nr, na, nl) +pi: pipe built using *addPipe()* function (:ref:`tuipipe`) + +vb: vector on the base of the pipe to start hexahedra. + +nr: number of blocks on radial. + +na: number of angular section. + +nl: number of blocks along the axis of the pipe. + +Operations on *elts*: :ref:`tuielements2` + The result is an array of hexahedral arranged in layers following the first radial and angular layers, and finally the axial layers. -Example -------- - -:: - import hexablock - doc = hexablock.addDocument() +Example of pipe construction +---------------------------- - orig = doc.addVertex(50, 0, 0) - vz = doc.addVector(0, 0, 1) - int_radius = 3 - ext_radius = 4 - height = 5 - pi = doc.addPipe(orig, vz, int_radius, ext_radius, height) +.. literalinclude:: test_doc/cylinder_pipe/make_pipe.py + :linenos: - vb = doc.addVector(1, 0, 0) - nr = 4 - na = 9 - nl = 5 - elts = doc.makePipe(pi, vb, nr, na, nl) -.. image:: _static/pipe.png +.. image:: _static/make_pipe.png :align: center .. centered:: Pipe +.. _tuimakepipes: + Make blocks for pipes ===================== -:: +.. code-block:: python + + elts = doc.makePipes (pipe1, pipe2) - elts = doc.makePipes(p1, p2) +Operations on *elts*: :ref:`tuielements2` + +Construction of an element from 2 pipes: + + +.. literalinclude:: test_doc/cylinder_pipe/make_pipes.py + :linenos: + + +.. image:: _static/make_pipes.png + :align: center + +.. centered:: + Element from 2 pipes The result is an array of hexahedra where we first find hexahedra of the first pipe and the second pipe. Each pipe range hexahedra following first radial layers and angular layers, and finally the axial layers. +Operations on *elts*: :ref:`tuielements2` GUI command: :ref:`guiblockscylinderpipe` diff --git a/doc/tui_cartgrid.rst b/doc/tui_cartgrid.rst index 3e7e4fa..e1640a3 100644 --- a/doc/tui_cartgrid.rst +++ b/doc/tui_cartgrid.rst @@ -10,126 +10,35 @@ Make cartesian grids To add a cartesian grid to the model, the following data are required: - the vertex of the initial hexahedron: *pt* -- the vectors corresponding to the diametrically opposite vertices to the initial vertex: *vx, vy, vz* +- the vector corresponding to the diametrically opposite vertex to the initial vertex: *vx, vy, vz* - the number of repetition of this hexahedra along the three axes: *ni, nj, nk* Make a Cartesian grid:: elts = doc.makeCartesian(pt, vx, vy, vz, ni, nj, nk) -or:: +or: + - the vertex of the initial hexahedron: *pt* + - the vector corresponding to the diametrically opposite vertex to the initial vertex + - the coordinates of the vector *vec1* on x, y and z: *px, py, pz* + - the number of repetition of this hexahedra along the three axes: *mx, my, mz* - elts = doc.makeCartesian1(pt, vec1, px, py, pz, mx, my, mz) - - -Access to the number of elements of the grid:: - - vn = elts.countVertex() - en = elts.countEdge() - qn = elts.countQuad() - hn = elts.countHexa() - -Access to all elements of the grid:: - - vi = elts.getVertex(i) - ej = elts.getEdge(j) - qk = elts.getQuad(k) - hl = elts.getHexa(l) - -Specialized access to all vertices of the grid:: - - ve_xyz = elts.getVertexIJK(i, j, k) - - with: - 0 <= i < ni+1 - 0 <= j < nj+1 - 0 <= k < nk+1 - -Specialized access to all edges // vx axis of the grid:: - - ed_a = elts.getEdgeI(i, j, k) - - with: - 0 <= i < ni - 0 <= j < nj+1 - 0 <= k < nk+1 - -Specialized access to all edges // vy axis of the grid:: - - ed_b = elts.getEdgeJ(i, j, k) - - with: - 0 <= i < ni+1 - 0 <= j < nj - 0 <= k < nk+1 +.. code-block:: python -Specialized access to all edges // vz axis of the grid:: - - ed_c = elts.getEdgeK(i, j, k) - - with: - 0 <= i < ni+1 - 0 <= j < nj+1 - 0 <= k < nk - -Specialized access to all quadrangles // on plane vx, vy:: - - qu_a = elts.getQuadIJ(i, j, k) - - with: - 0 <= i < ni - 0 <= j < nj - 0 <= k < nk+1 - -Specialized access to all quadrangles // on plane vx, vz:: - - qu_b = elts.getQuadIK(i, j, k) - - with: - 0 <= i < ni - 0 <= j < nj+1 - 0 <= k < nk - -Specialized access to all quadrangles // on plane vy, vz:: - - qu_c = elts.getQuadJK(i, j, k) - - with: - 0 <= i < ni+1 - 0 <= j < nj - 0 <= k < nk + elts = doc.makeCartesian1(pt, vec1, px, py, pz, mx, my, mz) -Specialized access to all hexahedra of the grid:: +Operations on *elts*: :ref:`tuielements2` - he_xyz = elts.getHexaIJK(i, j, k) - - with: - 0 <= i < ni - 0 <= j < nj - 0 <= k < nk Example ------- -:: - - import hexablock - doc = hexablock.addDocument() - - orig = doc.addVertex(0, 0, 0) - - dx = doc.addVector(1, 0, 0) - dy = doc.addVector(0, 1, 0) - dz = doc.addVector(0, 0, 1) - - ni = 15 - nj = 12 - nk = 8 - grid = doc.makeCartesian(orig, dx, dy, dz, ni, nj, nk) +.. literalinclude:: test_doc/grid/cartesian_grid.py + :linenos: -.. image:: _static/cartgrid3.png +.. image:: _static/cartesian_grid.png :align: center .. centered:: diff --git a/doc/tui_component.rst b/doc/tui_component.rst index 2e14385..d35241d 100644 --- a/doc/tui_component.rst +++ b/doc/tui_component.rst @@ -16,7 +16,7 @@ Add a new empty document in the session:: doc = hexablock.addDocument(name) -Add a new document loaded from a "xml" file:: +Add a new document loaded from a *xml* file:: doc2 = hexablock.loadDocument(filename) @@ -24,13 +24,25 @@ Get the number of opened document in the session:: nd = hexablock.countDocument() -Get the document number "i":: +Get the document number *i*:: doc_i = hexablock.getDocument(i) - + Remove a document in the session:: hexablock.removeDocument(doc_i) + +Set the current study:: + + hexablock.SetCurrentStudy(theStudy) + +Get a document from the current study:: + + doc = hexablock.getFromStudy(doc_entry) + +Add a document in the current study:: + + hexablock.addToStudy(doc) A tool to dump a model of block:: diff --git a/doc/tui_cut_hexa.rst b/doc/tui_cut_hexa.rst index 508a0f3..cd943e7 100644 --- a/doc/tui_cut_hexa.rst +++ b/doc/tui_cut_hexa.rst @@ -11,27 +11,30 @@ Cut hexahedra from the model of blocks:: elts = doc.cut(an_edge, nb_of_cuts) +Operations on *elts*: :ref:`tuielements2` + This method enables to cut in two (or more) a series of hexahedra using a series of edges propagation. Example ------- -:: - - import hexablock - doc = hexablock.addDocument() +.. literalinclude:: test_doc/cut_hexa/cut_hexa.py + :linenos: - size_x = 2 - size_y = 1 - size_z = 1 - orig = doc.addVertex(0, 0, 0) - dirVr = doc.addVector(1, 1, 1) +.. image:: _static/non_cut_hexa.png + :align: center - grid = doc.makeCartesian1(orig, dirVr, size_x, size_y, size_z, 0, 0, 0) - arete = grid.getEdgeK(0, 0, 0) +.. centered:: + Initial hexa + + +.. image:: _static/cut_hexa.png + :align: center - doc.cut(arete, 1) +.. centered:: + Cut hexa + GUI command: :ref:`guicuthexa` diff --git a/doc/tui_cyl.rst b/doc/tui_cyl.rst index 245777d..18476b3 100644 --- a/doc/tui_cyl.rst +++ b/doc/tui_cyl.rst @@ -30,5 +30,6 @@ Access to the cylinders of the document:: nc = doc.countCylinder() cylk = doc.getCylinder(ind) +More operations: *Cylinder* inherits :ref:`Element `. GUI command: :ref:`guicylinder` diff --git a/doc/tui_cylgrid.rst b/doc/tui_cylgrid.rst index 0b68dc8..8ef362f 100644 --- a/doc/tui_cylgrid.rst +++ b/doc/tui_cylgrid.rst @@ -7,7 +7,7 @@ Make cylindrical grids ====================== -To add a cylindrical grid, the following data are required: +To add a regular cylindrical grid, the following data are required: - the coordinates (vertex) of the cylinder base center: *pt* - the vectors defining the axis and the direction of the cylinder: *vex, vez* @@ -15,10 +15,23 @@ To add a cylindrical grid, the following data are required: - the radial, angular and axial elements number: *nr, na, nl* - to fill or not the central part of hexahedra: *fill* -Make a cylindrical grid:: +To add an irregular cylindrical grid, the following data are required: + +- the coordinates (vertex) of the cylinder base center: *pt* +- the vectors defining the axis and the direction of the cylinder: *vex, vez* +- the radial, angular and axial sizes: *dr (a list of radius), da (a list of angles), dl (a list of heights)* +- to fill or not the central part of hexahedra: *fill* + +Make a regular cylindrical grid:: elts = doc.makeCylindrical(pt, vex, vez, dr, da, dl, nr, na, nl, fill) +Make an irregular cylindrical grid:: + + elts = doc.makeCylindricals (pt, vex, vez, dr, da, dl, False) + +Operations on *elts*: :ref:`tuielements2` + The result is an array of hexahedra which are arranged along the radial axis first, then the angular axis, then according to the layers @@ -27,55 +40,48 @@ and then possibly hexahedra filling the central part. The filling the central part of the cylinder is made ​accordingly to the two following cases: -.. image:: _static/cyl_grid2.PNG +.. image:: _static/cyl_grid2.png :align: center .. centered:: Filling of the central part of the cylinder in the case the number of angular elements is odd na = 5. -.. image:: _static/cyl_grid1.PNG +.. image:: _static/cyl_grid1.png :align: center .. centered:: Filling of the central part of the cylinder in the case the number of angular elements is even na = 4. -Example -------- -Filling rule is illustrated by different case-tests:: +Example (regular mode) +---------------------- - import hexablock - doc = hexablock.addDocument() +Filling rule is illustrated by different case-tests: - orig1 = doc.addVertex(0, 0, 0) - orig2 = doc.addVertex(10, 0, 0) - orig3 = doc.addVertex(0, 10, 0) - orig4 = doc.addVertex(10, 10, 0) - orig5 = doc.addVertex(0, 20, 0) - orig6 = doc.addVertex(10, 20, 0) - vz = doc.addVector(0, 0, 1) - vx = doc.addVector(1, 0, 0) +.. literalinclude:: test_doc/grid/cylindrical_grid.py + :linenos: - dr = 1 - dl = 1 - nr = 2 - nl = 3 - c1 = doc.makeCylindrical(orig1, vx, vz, dr, 360, dl, nr, 4, nl, True) - c2 = doc.makeCylindrical(orig2, vx, vz, dr, 360, dl, nr, 8, nl, True) - c3 = doc.makeCylindrical(orig3, vx, vz, dr, 270, dl, nr, 8, nl, True) - c4 = doc.makeCylindrical(orig4, vx, vz, dr, 270, dl, nr, 7, nl, True) - c5 = doc.makeCylindrical(orig5, vx, vz, dr, 360, dl, nr, 5, nl, True) - c6 = doc.makeCylindrical(orig6, vx, vz, dr, 360, dl, nr, 6, nl, True) +.. image:: _static/cylindrical_grids.png + :align: center +.. centered:: + Cylindrical Grids (regular) -.. image:: _static/cylgrids.png - :align: center +Example (irregular mode) +------------------------ -.. centered:: - Cylindrical Grids +.. literalinclude:: test_doc/grid/irregular_cylindrical.py + :linenos: +.. image:: _static/irregular_cylindrical.png + :align: center + +.. centered:: + Irregular cylindrical grid + + GUI command: :ref:`guicylgrid` diff --git a/doc/tui_disc_elmts.rst b/doc/tui_disc_elmts.rst index f66c40a..60a7ae9 100644 --- a/doc/tui_disc_elmts.rst +++ b/doc/tui_disc_elmts.rst @@ -8,14 +8,20 @@ Disconnect elements Disconnect a quadrangle:: - elts = doc.disconnectQuad(hexa, qua) + elts = doc.disconnectQuad(hexa, quad) Disconnect an edge:: - elts = doc.disconnectEdge(hexa, edg) + elts = doc.disconnectEdge(hexa, edge) + +Disconnect edges:: + + elts = doc.disconnectEdges(hexas, edges) Disconnect a vertex:: elts = doc.disconnectVertex(hexa, ver) +Operations on *elts*... :ref:`tuielements2` + GUI command: :ref:`guidisconnectelements` diff --git a/doc/tui_discret_law.rst b/doc/tui_discret_law.rst index 71393e7..4ced775 100644 --- a/doc/tui_discret_law.rst +++ b/doc/tui_discret_law.rst @@ -9,6 +9,10 @@ Define a law of discretization Add a new law of discretization in the document:: law_1 = doc.addLaw(name, nb_nodes) + +Add laws on propagations based on min or max segment length:: + + hexablock.addLaws(doc, lg, lgmax) Get the number of the law in the document:: diff --git a/doc/tui_document.rst b/doc/tui_document.rst index 493772f..500596f 100644 --- a/doc/tui_document.rst +++ b/doc/tui_document.rst @@ -29,6 +29,26 @@ Set the tolerance need to find element:: Get the tolerance:: tol = doc.getTolerance() + +Set Debug level (long):: + + doc.setLevel(debug_level) +Removes elements of type Quad Edge or Vertex not belonging to an Hexa:: + doc.purge() + +Associate a shape to the document:: + + doc.setShape(shape) + +Gets the shape associated to the document:: + + doc.getShape() + +Gets the Brep associated to the document:: + + doc.getBrep() + + GUI command: :ref:`guidocument` diff --git a/doc/tui_edge.rst b/doc/tui_edge.rst index bf6193e..1132bea 100644 --- a/doc/tui_edge.rst +++ b/doc/tui_edge.rst @@ -9,10 +9,14 @@ Edges Manage the edges of the document. -Add an edge in the document:: +Add an edge, defined by two vertices, in the document:: edge_12 = doc.addEdge(vertex_1, vertex_2) +Add an edge, defined by one vertex and one vector, in the document:: + + edge_12 = doc.addEdgeVector(vertex, vector) + Get the number of all edges in the document:: sum_a = doc.countEdge() @@ -20,6 +24,10 @@ Get the number of all edges in the document:: Get the number of edges used only in the model of blocks:: sum_u = doc.countUsedEdge() + +Get the edges used by the model of blocks + +.. literalinclude:: test_doc/edge/edge.py Get an edge of the document:: @@ -34,5 +42,6 @@ Find an edge in the document:: edge_f = doc.findEdge(vertex_1, vertex_2) +More operations: *Edge* inherits :ref:`Element `. GUI command: :ref:`guiedge` diff --git a/doc/tui_elements.rst b/doc/tui_elements.rst index c05b111..02bc995 100644 --- a/doc/tui_elements.rst +++ b/doc/tui_elements.rst @@ -7,26 +7,207 @@ Elements ======== -Add an empty set of elements:: +You must be careful with the signification of the word "element", when it is used with singular or plural form : - elts = doc.addElements() + - The class "Element" is a basic class. The classes Vertex, Edge, Quad an Hexa inherit from the Element Class. This class is used to call common function like getName(), setName() ... -Add an element in a set of elements:: + - The class "Elements" (plural) represents a set of Elements (vertices, edges, quads an hexaedras). This class is used to implements grids or result of ome complex operations (join, prism, ...) - elts.addElement(element) -Remove an element in a set of elements:: +.. _tuielement: - elts.removeElement(element) +Element +======= -Remove all elements in a set of elements:: - elts.clearElement() +Set a name of an element:: -Access to the elements of the document:: + elt.setName(name) + +Get a name of an element:: + + elt.getName() + +Print the name of an element:: + + elt.printName() + +Dump an element:: + + elt.dump() + + +.. _tuielements2: + +Elements +======== + +Remove a set of elements from a document:: + + doc.removeElements(elts) + +Number of vertices in a set of elements:: + + nb_vertices = elts.countVertex() + +Number of edges in a set of elements:: + + nb_edges = elts.countEdge() + +Number of quads in a set of elements:: + + nb_quads = elts.countQuad() + +Number of hexahedrons in a set of elements:: + + nb_hexas = elts.countHexa() + +Get the vertex number *i*:: + + vertex_i = elts.getVertex(i) + +Get the edge number *i*:: + + edge_i = elts.getEdge(i) + +Get the quad number *i*:: + + quad_i = elts.getQuad(i) + +Get the hexahedron number *i*:: + + hexa_i = elts.getHexa(i) + +Specialized access to all vertices of a set of elements:: + + ve_xyz = elts.getVertexIJK(i, j, k) + +with: + 0 <= i < ni+1, 0 <= j < nj+1, 0 <= k < nk+1 + +Specialized access to all edges // Vx axis:: + + ed_a = elts.getEdgeI(i, j, k) + +with: + 0 <= i < ni, 0 <= j < nj+1, 0 <= k < nk+1 + +Specialized access to all edges // Vy axis:: + + ed_b = elts.getEdgeJ(i, j, k) + +with: + 0 <= i < ni+1, 0 <= j < nj, 0 <= k < nk+1 + +Specialized access to all edges // Vz axis:: + + ed_c = elts.getEdgeK(i, j, k) + +with: + 0 <= i < ni+1, 0 <= j < nj+1, 0 <= k < nk + +Specialized access to all quadrangles // on plane Vx, Vy:: + + qu_a = elts.getQuadIJ(i, j, k) + +with: + 0 <= i < ni, 0 <= j < nj, 0 <= k < nk+1 + +Specialized access to all quadrangles // on plane Vx, Vz:: + + qu_b = elts.getQuadIK(i, j, k) + +with: + 0 <= i < ni, 0 <= j < nj+1, 0 <= k < nk + +Specialized access to all quadrangles // on plane Vy, Vz:: + + qu_c = elts.getQuadJK(i, j, k) + +with: + 0 <= i < ni+1, 0 <= j < nj, 0 <= k < nk + +Specialized access to all hexahedra:: + + he_xyz = elts.getHexaIJK(i, j, k) + +with: + 0 <= i < ni, 0 <= j < nj, 0 <= k < nk + + +.. _tuicrosselements: + + +Cross Elements +============== + +*CrossElements* inherits *Elements*. So you have all *Elements* functions available to *CrossElements*, +plus the following functions: + + +*part* argument specifies the block of the *cross elements* where to search the vertex, the edge, the quad or the hexa. + +Specialized access to all vertices of a set of elements:: + + ve_xyz = elts.getVertexIJK(part, i, j, k) + +with: + 0 <= i < ni+1, 0 <= j < nj+1, 0 <= k < nk+1 + + +Specialized access to all edges // Vx axis:: + + ed_a = elts.getEdgeI(part, i, j, k) + +with: + 0 <= i < ni, 0 <= j < nj+1, 0 <= k < nk+1 + + +Specialized access to all edges // Vy axis:: + + ed_b = elts.getEdgeJ(part, i, j, k) + +with: + 0 <= i < ni+1, 0 <= j < nj, 0 <= k < nk+1 + + +Specialized access to all edges // Vz axis:: + + ed_c = elts.getEdgeK(part, i, j, k) + +with: + 0 <= i < ni+1, 0 <= j < nj+1, 0 <= k < nk + + +Specialized access to all quadrangles // on plane Vx, Vy:: + + qu_a = elts.getQuadIJ(part, i, j, k) + +with: + 0 <= i < ni, 0 <= j < nj, 0 <= k < nk+1 + + +Specialized access to all quadrangles // on plane Vx, Vz:: + + qu_b = elts.getQuadIK(part, i, j, k) + +with: + 0 <= i < ni, 0 <= j < nj+1, 0 <= k < nk + + +Specialized access to all quadrangles // on plane Vy, Vz:: + + qu_c = elts.getQuadJK(part, i, j, k) + +with: + 0 <= i < ni+1, 0 <= j < nj, 0 <= k < nk + + +Specialized access to all hexahedra:: + + he_xyz = elts.getHexaIJK(part, i, j, k) - nel = doc.countElements() - elts = doc.getElements(index) +with: + 0 <= i < ni, 0 <= j < nj, 0 <= k < nk -GUI command: :ref:`guielements` diff --git a/doc/tui_hemisphere_rind.rst b/doc/tui_hemisphere_rind.rst new file mode 100644 index 0000000..dd9c318 --- /dev/null +++ b/doc/tui_hemisphere_rind.rst @@ -0,0 +1,165 @@ +:tocdepth: 3 + +.. _tuihemisphere: + +======================= +Hemisphere Construction +======================= + +.. _tuihemisphericalgrid: + +Hemispherical Grid +================== + +To create an hemispherical grid in textual mode, you need the following arguments: + +- center : center coordinates of the sphere +- vx : normal vector to the surface of the cross section +- vz : axes of the hole +- radius : radius size of the sphere +- radhole: radius size of the hole +- orig : coordinates of a point on the surface of the cross section +- nrad : number of hexahedra from the center of the sphere +- nang : number of hexahedra along the perimeter of the sphere +- nhaut : number of hexahedra on the height of the sphere + +:: + + elts = doc.makeSphere (center, vx, vz, radius, radhole, orig, nrad, nang, nhaut) + +Operations on *elts*: :ref:`tuielements2` + + +Code Sample +----------- + +.. literalinclude:: test_doc/hemispherical_rind/hemispherical_grid.py + :emphasize-lines: 22 + :linenos: + +Result +------ + +.. image:: _static/hemispherical_grid.png + :align: center + + +.. _tuiparthemisphericalgrid: + +Partial Hemispherical Grid +========================== + +To create a partial hemispherical grid in textual mode, you need the following parameters: + +- center : center coordinates of the sphere +- vx : normal vector to the surface of the cross section +- vz : axes of the hole +- radius : radius size of the sphere +- radhole: radius size of the hole +- orig : coordinates of a point on the surface of the cross section +- angle : fill this field to customize the section (value in degree) +- nrad : number of hexahedra from the center of the sphere +- nang : number of hexahedra along the perimeter of the sphere +- nhaut : number of hexahedra on the height of the sphere + +:: + + elts = doc.makePartSphere (center, vx, vz, radius, radhole, orig, angle, nrad, nang, nhaut) + +Operations on *elts*: :ref:`tuielements2` + + +Code Sample +----------- + +.. literalinclude:: test_doc/hemispherical_rind/partial_hemispherical_grid.py + :emphasize-lines: 23,24 + :linenos: + +Result +------ + +.. image:: _static/partial_hemispherical_grid.png + :align: center + + +.. _tuirindgrid: + +Rind Grid +========= + +To create a rind grid in textual mode, you need the following arguments: + +- center : center coordinates of the sphere +- vx : normal vector to the surface of the cross section +- vz : axes of the hole +- radius : radius size of the sphere +- internal radius: fill this field to create rind +- radhole: radius size of the hole +- orig : coordinates of a point on the surface of the cross section +- nrad : number of hexahedra from the center of the sphere +- nang : number of hexahedra along the perimeter of the sphere +- nhaut : number of hexahedra on the height of the sphere + +:: + + elts = doc.makeRind (center, vx, vz, radius, radint, radhole, orig, nrad, nang, nhaut) + +Operations on *elts*: :ref:`tuielements2` + + +Code Sample +----------- + +.. literalinclude:: test_doc/hemispherical_rind/rind_grid.py + :emphasize-lines: 23,24 + :linenos: + +Result +------ + +.. image:: _static/rind_grid.png + :align: center + + +.. _tuipartrindgrid: + +Partial Rind Grid +================= + +To create a partial rind grid in textual mode, you need the following arguments: + +- center : center coordinates of the sphere +- vx : normal vector to the surface of the cross section +- vz : axes of the hole +- radius : radius size of the sphere +- radint : fill this field to create rind +- radhole: radius size of the hole +- orig : coordinates of a point on the surface of the cross section +- angle : fill this field to customize the section (value in degree) +- nrad : number of hexahedra from the center of the sphere +- nang : number of hexahedra along the perimeter of the sphere +- nhaut : number of hexahedra on the height of the sphere + +:: + + elts = doc.makePartRind (center, vx, vz, radius, radint, radhole, orig, angle, nrad, nang, nhaut) + +Operations on *elts*: :ref:`tuielements2` + + +Code Sample +----------- + +.. literalinclude:: test_doc/hemispherical_rind/partial_rind_grid.py + :emphasize-lines: 24,25 + :linenos: + +Result +------ + +.. image:: _static/partial_rind_grid.png + :align: center + + +GUI command: :ref:`guihemisphere` diff --git a/doc/tui_hexahedron.rst b/doc/tui_hexahedron.rst index e9e4210..67b3f54 100644 --- a/doc/tui_hexahedron.rst +++ b/doc/tui_hexahedron.rst @@ -24,5 +24,47 @@ Get the number of all hexahedra of the document:: Get an hexahedron of the document:: hexa_i = doc.getHexa(i) + +Get a vertex of an hexahedron:: + + vertex_i = hexa_i.getVertex(i) + +Get an edge of an hexahedron:: + + edge_i = hexa_i.getEdge(i) + +Get a quad of an hexahedron:: + + quad_i = hexa_i.getQuad(i) + +Get the number of used hexahedrons in the model of blocks:: + + nb_used_hexa = doc.countUsedHexa() + +Get the hexahedrons used by the model of blocks + +.. literalinclude:: test_doc/hexa/hexa.py + +Find an hexahedron in the document:: + + hexa = doc.findHexa(vertex_1, vertex_2) + +Add an hexahedron with 5 quads:: + + doc.addHexa5Quads (qa, qc, qd, qe, qf) + +Add an hexahedron with 4 quads:: + + doc.addHexa4Quads (qa, qd, qe, qf) + +Add an hexahedron with 3 quads:: + + doc.addHexa3Quads (qa, qd, qe) + +Add an hexahedron with 2 quads:: + + doc.addHexa2Quads (qa, qb) + +More operations: *Hexa* inherits :ref:`Element `. GUI command: :ref:`guihexahedron` diff --git a/doc/tui_make_elmts.rst b/doc/tui_make_elmts.rst index d12c812..014b36a 100644 --- a/doc/tui_make_elmts.rst +++ b/doc/tui_make_elmts.rst @@ -8,35 +8,64 @@ Make elements by transforming elements Rotate and translate for any kind of elements:: - elts = doc.makeTranslation(element, vec) - elts = doc.makeRotation(element, ver, vec, angle) + elts = doc.makeTranslation(elements, vec) + elts = doc.makeRotation(elements, ver, vec, angle) + elts = doc.makeScale (elements, destination_point, k) and "element" could be Vertex, Edge, Quadrangle, Hexahedeon, Vector, Cylinder, Pipe and Elements and the result "elts" is always an object of type "Elements". +Operations on *elts*: :ref:`tuielements2` + + Example -------- +======= + +Translation +----------- + +.. literalinclude:: test_doc/make_transformation/make_translation.py + :linenos: + + +.. image:: _static/make_translation.png + :align: center + +.. centered:: + Translation + + +Rotation +-------- -:: +.. literalinclude:: test_doc/make_transformation/make_rotation.py + :linenos: - import hexablock - doc = hexablock.addDocument() +.. image:: _static/cartesian.png + :align: center - size_x = 1 - size_y = 1 - size_z = 2 +.. centered:: + Initial - orig = doc.addVertex(0, 0, 0) - dirVr = doc.addVector(1, 1, 1) - grid = doc.makeCartesian1(orig, dirVr, size_x, size_y, size_z, 0, 0, 0) - orig.setScalar(2) +.. image:: _static/make_rotation.png + :align: center - devant = doc.addVector(5, 0, 0) - grid2 = doc.makeTranslation(grid, devant) +.. centered:: + Rotation + +Scale +----- - grid4 = doc.makeRotation(grid2, orig, dirVr, 45) +.. literalinclude:: test_doc/make_transformation/make_scale.py + :linenos: +.. image:: _static/make_scale.png + :align: center +.. centered:: + Scaling + + GUI command: :ref:`guimakeelements` diff --git a/doc/tui_make_symmetry.rst b/doc/tui_make_symmetry.rst new file mode 100644 index 0000000..8876463 --- /dev/null +++ b/doc/tui_make_symmetry.rst @@ -0,0 +1,131 @@ +:tocdepth: 3 + + +.. _tuimakesymmetry: + +============= +Make Symmetry +============= + +There are three differents ways to make the symmetry of an element: + +- Symmetry by point +- Symmetry by line +- Symmetry by plane + +.. _guimakesympoint: + +Symmetry by point +================= + +To make the symmetry of an element by point, you need to define: + +- the element +- the symmetry center + +:: + + elts = doc.makeSymmetryPoint (grid, orig) + +Operations on *elts*: :ref:`tuielements2` + +Here is an example where we make the symmetry of a grid: + + +Example +------- + +.. literalinclude:: test_doc/make_symmetry/make_sym_point.py + :emphasize-lines: 32 + :linenos: + +Result +------ + +.. image:: _static/grid.png + :align: center + +.. centered:: + Initial + + +.. image:: _static/make_sym_point.png + :align: center + +.. centered:: + Symmetry of a grid by point + +.. _guimakesymline: + +Symmetry by line +================ + +To make the symmetry of an element by line, you need to define: + +- the element +- a point and a direction to define the line of symmetry + +:: + + elts = doc.makeSymmetryLine (grid, orig, dir) + +Operations on *elts*: :ref:`tuielements2` + + +Example +------- + +Code +---- + +.. literalinclude:: test_doc/make_symmetry/make_sym_line.py + :emphasize-lines: 33 + :linenos: + +Result +------ + +.. image:: _static/make_sym_line.png + :align: center + +.. centered:: + Symmetry of a grid by line + +.. _guimakeplane: + +Symmetry by plane +================= + +To make the symmetry of an element by plane, you need to define: + +- the element +- a point and a direction to define the plane of symmetry + +:: + + elts = doc.makeSymmetryPlane (grid, orig, dir) + +Operations on *elts*: :ref:`tuielements2` + + +Example +------- + +Code +---- + +.. literalinclude:: test_doc/make_symmetry/make_sym_plane.py + :emphasize-lines: 33 + :linenos: + +Result +------ + +.. image:: _static/make_sym_plane.png + :align: center + +.. centered:: + Symmetry of a grid by plane + + +GUI command: :ref:`guimakesymmetry` diff --git a/doc/tui_merge_elmts.rst b/doc/tui_merge_elmts.rst index 673df23..e3a34f8 100644 --- a/doc/tui_merge_elmts.rst +++ b/doc/tui_merge_elmts.rst @@ -18,6 +18,7 @@ where: va1 : vertex of the quadrangle qa to merge with the vertex vb1 of the quadrangle qb. + va2 : vertex of the quadrangle qa to merge with the vertex vb2 of the quadrangle qb. diff --git a/doc/tui_modify_elmts.rst b/doc/tui_modify_elmts.rst index 8092cd9..5457749 100644 --- a/doc/tui_modify_elmts.rst +++ b/doc/tui_modify_elmts.rst @@ -11,5 +11,9 @@ Translate and Rotate for any kind of elements:: doc.performTranslation(elements, vec) doc.performRotation(elements, ver, vec, angle) + doc.performScale (elements, destination_point, k) + +Operations on *elts*: :ref:`tuielements2` + GUI command: :ref:`guimodifyelements` diff --git a/doc/tui_perform_symmetry.rst b/doc/tui_perform_symmetry.rst new file mode 100644 index 0000000..8bd0169 --- /dev/null +++ b/doc/tui_perform_symmetry.rst @@ -0,0 +1,16 @@ +:tocdepth: 3 + +.. _tuimodifysymmetry: + + +=========================== +Modify elements by symmetry +=========================== + +Symmetry modification can be done by *point*, *line* and *plane*:: + + doc.performSymmetryPoint (elements, origin) + doc.performSymmetryLine (elements, origin, direction) + doc.performSymmetryPlane (elements, origin, direction) + +GUI command: :ref:`guimodifysymmetry` \ No newline at end of file diff --git a/doc/tui_pipe.rst b/doc/tui_pipe.rst index 30b231b..3b22101 100644 --- a/doc/tui_pipe.rst +++ b/doc/tui_pipe.rst @@ -14,6 +14,7 @@ To add a pipe, the following data have to be mentioned: - the inner radius - the outer radius + Add a pipe in the document:: p = doc.addPipe(base, direction, int_radius, ext_radius, height) @@ -31,6 +32,7 @@ Access to the pipes of the document:: np = doc.countPipe() pik = doc.getPipe(index) +More operations: *Pipe* inherits :ref:`Element `. GUI command: :ref:`guipipe` diff --git a/doc/tui_prism_join_quad.rst b/doc/tui_prism_join_quad.rst index 07b3e24..104aded 100644 --- a/doc/tui_prism_join_quad.rst +++ b/doc/tui_prism_join_quad.rst @@ -13,57 +13,61 @@ There are two different methods to build hexahedra from quadrangles: - prism from quadrangles - join two sets of quadrangles + +.. _tuiprismquad: + Prism from a quadrangle or quadrangles ====================================== -:: +Make a regular prism:: elts = doc.prismQuad(quad, vec, nb) - elts = doc.prismQuads([ q1, q2, q3 ], vec, nb) + elts = doc.prismQuads(quads_list, vec, nb) + + +Make an irregular prism:: + + elts = doc.prismQuadsVec (quads_list, axis, heights, opt) + +Operations on *elts*: :ref:`tuielements2` + From a list of quadrangles, a set of hexahedra is created. Given the arbitrary nature of the start list, we can not provide additional information on the order of the intermediate elements (vertices, edges, quads) that contains the container-like Elements. -Example -------- -:: +Example (regular mode) +---------------------- - import hexablock - doc = hexablock.addDocument() +.. literalinclude:: test_doc/prism_quad_join/prism_quads.py + :linenos: - orig = doc.addVertex(0, 0, 0) - dx = doc.addVector(1, 0, 0) - dy = doc.addVector(0, 1, 0) - dz = doc.addVector(0, 0, 1) +.. image:: _static/prisme.png + :align: center - dimx = 11 - dimy = 11 - dimz = 2 - grid = doc.makeCartesian(orig, dx, dy, dz, dimx, dimy, dimz) +.. centered:: + Regular Prism Quads - mx = dimx/2 - my = dimy/2 - prems = grid.getQuadIJ(mx, my, dimz) - liste = [prems] - liste.extend([grid.getQuadIJ(nx, my, dimz) for nx in range(dimx) if nx != mx]) - liste.extend([grid.getQuadIJ(mx, ny, dimz) for ny in range(dimy) if ny != my]) +Example (regular mode) +---------------------- - vec = doc.addVector(1, 1, 1) - elts = doc.prismQuads(liste, vec, 5) +.. literalinclude:: test_doc/prism_quad_join/prism_quads_vec.py + :linenos: -.. image:: _static/prisme.png +.. image:: _static/irregular_prism.png :align: center .. centered:: - Prism Quads + Irregular Prism Quads +.. _tuijoinquad: + Join 2 sets of quadrangles ========================== @@ -73,45 +77,14 @@ Join 2 sets of quadrangles elts = doc.joinQuads([ qa1, qa2 ], qb, va1, vb1, va2, vb2, nb) -Example -------- - -:: - - import hexablock - doc = hexablock.addDocument() - - orig1 = doc.addVertex(0, 0, 0) - dx = doc.addVector(1, 0, 0) - dy = doc.addVector(0, 1, 0) - dz = doc.addVector(0, 0, 1) +Operations on *elts*: :ref:`tuielements2` - dimx = 11 - dimy = 11 - dimz = 2 - grid1 = doc.makeCartesian(orig1, dx, dy, dz, dimx, dimy, dimz) - orig2 = doc.addVertex(dimx/2.0, 0, 8) - grid2 = doc.makeCylindrical(orig2, dx, dy, 1, 180, 1, dimz, dimy, - dimx, False) - - mx = dimx/2 - my = dimy/2 - prems = grid1.getQuadIJ(mx, my, dimz) - cible = grid2.getQuadJK(dimz, mx, my) - - v1 = prems.getVertex(0) - v3 = prems.getVertex(1) - v2 = cible.getVertex(1) - v4 = cible.getVertex(2) - - liste = [prems] - liste.extend([grid1.getQuadIJ(nx, my, dimz) for nx in range(dimx) if nx != mx]) - liste.extend([grid1.getQuadIJ(mx, ny, dimz) for ny in range(dimy) if ny != my]) - - height = 5 +Example +------- - elts = doc.joinQuads(liste, cible, v1, v2, v3, v4, height) +.. literalinclude:: test_doc/prism_quad_join/join_quads.py + :linenos: .. image:: _static/join.png diff --git a/doc/tui_propag.rst b/doc/tui_propag.rst index effc2ac..a4d4255 100644 --- a/doc/tui_propag.rst +++ b/doc/tui_propag.rst @@ -36,12 +36,4 @@ Set the way where the law is applied on the propagation:: propa.setWay(bo) -Example -------- - -:: - - import hexablock - doc = hexablock.addDocument() - GUI command: :ref:`guipropag` diff --git a/doc/tui_quad_revolution.rst b/doc/tui_quad_revolution.rst new file mode 100644 index 0000000..789c9da --- /dev/null +++ b/doc/tui_quad_revolution.rst @@ -0,0 +1,68 @@ +:tocdepth: 3 + + +.. _tuiquadrevolution: + + +=============== +Quad Revolution +=============== + +To make quad revolution you need: + +- a set of quadrangles you want to make a revolution on + +.. literalinclude:: test_doc/quad_revolution/make_grid.py + :lines: 3- + :linenos: + +- center of rotation:: + + center = doc.addVertex (0, -10, 0) + +- axis of rotation (a vector):: + + axis = doc.addVector (1, 0, 0) + +- Specify the rotation’s angle at each step (a list of angles in degrees):: + + angles = [5, 10, 15, 20, 30, 20, 15, 10, 5 ] + +Then you can make you can make your quad revolution this way:: + + elts = doc.revolutionQuads (liste, center, axis, angles) + +Operations on *elts*: :ref:`tuielements2` + + +Complete Example +================ + + +Snippet Code +------------ + +.. literalinclude:: test_doc/quad_revolution/revolution.py + :emphasize-lines: 59 + :linenos: + + +The result +---------- + +.. image:: _static/grid_for_revolution.png + :align: center + +.. centered:: + Initial + + +.. image:: _static/quad_revolution.png + :align: center + +.. centered:: + Quad Revolution + + +GUI command: :ref:`guiquadrevolution` + diff --git a/doc/tui_quadrangle.rst b/doc/tui_quadrangle.rst index bf802eb..d70d881 100644 --- a/doc/tui_quadrangle.rst +++ b/doc/tui_quadrangle.rst @@ -23,6 +23,11 @@ Get the number of all quadrangles of the document:: Get the number of used quadrangles in the model of blocks:: sum_u = doc.countUsedQuad() + +Get the quads used by the model of blocks + +.. literalinclude:: test_doc/quad/quad.py + Get a quadrangle of the document:: @@ -40,4 +45,6 @@ Find a quadrangle in the document:: quad_f = doc.findQuad(vertex_1, vertex_2) +More operations: *Quad* inherits :ref:`Element `. + GUI command: :ref:`guiquadrangles` diff --git a/doc/tui_remove.rst b/doc/tui_remove.rst index fd4c7dd..fd4121a 100644 --- a/doc/tui_remove.rst +++ b/doc/tui_remove.rst @@ -16,7 +16,7 @@ Remove all hexahedra connected of the model of blocks:: doc.removeConnectedHexa(hexa) -.. image:: _static/remove3.PNG +.. image:: _static/remove33.png :align: center diff --git a/doc/tui_replace_hexa.rst b/doc/tui_replace_hexa.rst new file mode 100644 index 0000000..7cb7ac7 --- /dev/null +++ b/doc/tui_replace_hexa.rst @@ -0,0 +1,42 @@ +:tocdepth: 3 + + +.. _tuireplacehexa: + +================== +Replace Hexahedron +================== + +The following example explain how to replace hexa in script mode. +For parameters description see the gui documentation of replace hexa. + +:: + + elts = doc.replace (qpattern, pd2,c1, pa2,c2, pb2,c3) + +Operations on *elts*: :ref:`tuielements2` + + +Complete example +---------------- + +.. literalinclude:: test_doc/replace_hexa/replace_hexa.py + :linenos: + +Result +------ + +.. image:: _static/before_replace_hexa.png + :align: center + +.. centered:: + Before hexa replacement + + +.. image:: _static/after_replace_hexa.png + :align: center + +.. centered:: + After hexa replacement + +GUI command: :ref:`guireplacehexa` \ No newline at end of file diff --git a/doc/tui_sphergrid.rst b/doc/tui_sphergrid.rst index 93b02f6..5d32b15 100644 --- a/doc/tui_sphergrid.rst +++ b/doc/tui_sphergrid.rst @@ -10,16 +10,18 @@ Make spherical grids To add a spherical grid, the following data are required: -- the center (vertex) of the central hexahedron: *pt* -- the vector corresponding to the diametrically opposite vertex to the - initial vertex: *dv* +- the center (vertex) of the central hexahedron: *c* +- the radius of the internal hexahedron: *r* - the number of embedded hexahedra: *n* - the coefficient of growth:*k* Make a spherical grid:: - elts = doc.makeSpherical(pt, dv, n, k) + elts = doc.makeSpherical(c, r, n, k) + +Operations on *elts*: :ref:`tuielements2` + The result is an array of hexahedra starting with the central and other hexahedral are arranged layer by layer from the center. Each @@ -30,23 +32,8 @@ the X axis, then 2 for the Y axis and 2 for the Z axis. Example ------- -:: - - import hexablock - doc = hexablock.addDocument() - - orig = doc.addVertex(0, 0, 0) - - direction = doc.addVector(1, 1, 1) - - dx = doc.addVector(1, 0, 0) - dy = doc.addVector(0, 1, 0) - dz = doc.addVector(0, 0, 1) - - n = 2 - k = 0.8 - - grid = doc.makeSpherical(orig, direction, n, k) +.. literalinclude:: test_doc/grid/spherical_grid.py + :linenos: GUI command: :ref:`guisphergrid` diff --git a/doc/tui_vector.rst b/doc/tui_vector.rst index 100df94..d8328b6 100644 --- a/doc/tui_vector.rst +++ b/doc/tui_vector.rst @@ -24,5 +24,15 @@ Get the number of vector in the document:: Get a vector of the document:: vector_i = doc.getVector(i) + +Get the norm of a vector:: + + norm = vector_i.getNorm() + +Get the angle on X:: + + angle = vector_i.getAngleX() + +More operations: *Vector* inherits :ref:`Element `. GUI command: :ref:`guivector` diff --git a/doc/tui_vertex.rst b/doc/tui_vertex.rst index ad4a3ef..260976b 100644 --- a/doc/tui_vertex.rst +++ b/doc/tui_vertex.rst @@ -20,6 +20,10 @@ Get the number of all vertices of the document:: Get the number of vertices used only by the model of blocks:: sum_u = doc.countUsedVertex() + +Get the vertices used by the model of blocks + +.. literalinclude:: test_doc/vertex/vertex.py Get a vertex of the document:: @@ -41,5 +45,6 @@ Find a vertex in the document (with a tolerance):: vertex_f = doc.findVertex(x, y, z) +More operations: *Vertex* inherits :ref:`Element `. GUI command: :ref:`guivertex` diff --git a/doc/tuto_sphinx_hexablock.odt b/doc/tuto_sphinx_hexablock.odt new file mode 100644 index 0000000..dd6412a Binary files /dev/null and b/doc/tuto_sphinx_hexablock.odt differ diff --git a/doc/tuto_sphinx_hexablock.pdf b/doc/tuto_sphinx_hexablock.pdf new file mode 100644 index 0000000..7d4cc0e Binary files /dev/null and b/doc/tuto_sphinx_hexablock.pdf differ diff --git a/idl/BiCylinder.idl b/idl/BiCylinder.idl new file mode 100755 index 0000000..6a4ade2 --- /dev/null +++ b/idl/BiCylinder.idl @@ -0,0 +1,63 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef __BiCylinder__ +#define __BiCylinder__ +/*! + \defgroup EXAMPLES SALOME EXAMPLES components + */ +#include "SALOME_Exception.idl" +#include "SALOME_GenericObj.idl" + +#include "Element.idl" +#include "Vertex.idl" +#include "Edge.idl" +#include "Quad.idl" +#include "Hexa.idl" +#include "Cylinder.idl" + +/*! \ingroup EXAMPLES +*/ +module HEXABLOCK_ORB +{ + + interface BiCylinder: Element + { + Hexa getHexaIJK(in long part, in long nx, in long ny, in long nz) + raises (SALOME::SALOME_Exception); + Quad getQuadIJ(in long part, in long nx, in long ny, in long nz) + raises (SALOME::SALOME_Exception); + Quad getQuadJK(in long part, in long nx, in long ny, in long nz) + raises (SALOME::SALOME_Exception); + Quad getQuadIK(in long part, in long nx, in long ny, in long nz) + raises (SALOME::SALOME_Exception); + Edge getEdgeI(in long part, in long nx, in long ny, in long nz) + raises (SALOME::SALOME_Exception); + Edge getEdgeJ(in long part, in long nx, in long ny, in long nz) + raises (SALOME::SALOME_Exception); + Edge getEdgeK(in long part, in long nx, in long ny, in long nz) + raises (SALOME::SALOME_Exception); + Vertex getVertexIJK(in long part, in long nx, in long ny, in long nz) + raises (SALOME::SALOME_Exception); + + long saveVtk( in string fname );//CS_NOT_SPEC + }; + +}; + +#endif diff --git a/idl/CrossElements.idl b/idl/CrossElements.idl index e9a17bc..acd33dd 100755 --- a/idl/CrossElements.idl +++ b/idl/CrossElements.idl @@ -48,9 +48,6 @@ module HEXABLOCK_ORB Edge getEdgeK(in long part, in long nx, in long ny, in long nz) raises (SALOME::SALOME_Exception); Vertex getVertexIJK(in long part, in long nx, in long ny, in long nz) raises (SALOME::SALOME_Exception); - // Tutaux en T (like castles in scotland) - long crossCylinders (in Cylinder cyl1, in Cylinder cyl2) raises (SALOME::SALOME_Exception); - long saveVtk( in string fname );//CS_NOT_SPEC }; diff --git a/idl/Document.idl b/idl/Document.idl index ae3eed6..15d1f3b 100755 --- a/idl/Document.idl +++ b/idl/Document.idl @@ -31,7 +31,7 @@ /*! \ingroup EXAMPLES -This package contains the interface HEXABLOCK_ORB used +This package contains the interface HEXABLOCK_ORB used for %HEXABLOCK component as an example in %SALOME application. */ module HEXABLOCK_ORB @@ -51,8 +51,13 @@ module HEXABLOCK_ORB interface Group; interface Propagation; - typedef sequence Quads; - typedef sequence RealVector; + interface NewShape; + + typedef sequence Quads; + typedef sequence IntVector; + typedef sequence RealVector; + typedef sequence NewShapes; + typedef GEOM::GEOM_Object Shape; typedef sequence Shapes; @@ -62,7 +67,7 @@ module HEXABLOCK_ORB raises (SALOME::SALOME_Exception); void dump() - raises (SALOME::SALOME_Exception); + raises (SALOME::SALOME_Exception); //CS_NOT_SPEC /*! */ string getName() @@ -102,11 +107,14 @@ module HEXABLOCK_ORB /*! - Arêtes + Aretes */ Edge addEdge( in Vertex v0, in Vertex v1 ) raises (SALOME::SALOME_Exception); + Edge addEdgeVector ( in Vertex v0, in Vector w1 ) + raises (SALOME::SALOME_Exception); + long countEdge() raises (SALOME::SALOME_Exception); @@ -138,7 +146,7 @@ module HEXABLOCK_ORB /*! - Hexaèdre + Hexaedre */ Hexa addHexa( in Quad q0, in Quad q1, in Quad q2, in Quad q3, in Quad q4, in Quad q5 ) raises (SALOME::SALOME_Exception); @@ -182,7 +190,7 @@ module HEXABLOCK_ORB long countCylinder() raises (SALOME::SALOME_Exception); - + Cylinder getCylinder( in long i ) raises (SALOME::SALOME_Exception); @@ -191,13 +199,13 @@ module HEXABLOCK_ORB Pipe */ Pipe addPipe( in Vertex base, in Vector direction, - in double int_radius, in double ext_radius, + in double int_radius, in double ext_radius, in double height ) raises (SALOME::SALOME_Exception); long countPipe() raises (SALOME::SALOME_Exception); - + Pipe getPipe( in long i ) raises (SALOME::SALOME_Exception); @@ -212,14 +220,14 @@ module HEXABLOCK_ORB raises (SALOME::SALOME_Exception); /*! - Grille cartésiennes + Grille cartesiennes */ - Elements makeCartesian( in Vertex pt, + Elements makeCartesian( in Vertex pt, in Vector vx, in Vector vy, in Vector vz, in long nx, in long ny, in long nz) raises (SALOME::SALOME_Exception); - Elements makeCartesian1( in Vertex v, + Elements makeCartesian1( in Vertex v, in Vector v1, in long px, in long py, in long pz, in long mx, in long my, in long mz ) @@ -245,24 +253,24 @@ module HEXABLOCK_ORB raises (SALOME::SALOME_Exception); /*! - Grille sphérique + Grille spherique */ Elements makeSpherical( in Vertex pt, in double rayon, in long n, in double k ) - raises (SALOME::SALOME_Exception); //CS_TO_DEL + raises (SALOME::SALOME_Exception); /*! - Cylindre découpé en blocs + Cylindre decoupe en blocs */ // Elements makeCylinder( in Cylinder cyl, in long nr, in long na, in long nl ) // raises (SALOME::SALOME_Exception);//CS_TODO Elements makeCylinder( in Cylinder cyl, in Vector vr, in long nr, in long na, in long nl ) raises (SALOME::SALOME_Exception);//CS_NEW CS_NOT_SPEC - + /*! Tuyau decoupe en blocs @@ -274,12 +282,12 @@ module HEXABLOCK_ORB 2 Cylindres en T decoupes en blocs */ CrossElements makeCylinders( in Cylinder c1, in Cylinder c2 ) - raises (SALOME::SALOME_Exception);//CS_NEW CS_NOT_SPEC + raises (SALOME::SALOME_Exception); /*! 2 Tuyau decoupe en intersection decoupees en blocs */ - Elements makePipes( in Pipe p1, in Pipe p2 ) + CrossElements makePipes( in Pipe p1, in Pipe p2 ) raises (SALOME::SALOME_Exception); /*! @@ -291,7 +299,7 @@ module HEXABLOCK_ORB Elements prismQuads( in Quads qds, in Vector v, in long nb ) raises (SALOME::SALOME_Exception); - Elements prismQuadsVec (in Quads qds, in Vector v, in RealVector thaut, + Elements prismQuadsVec (in Quads qds, in Vector v, in RealVector thaut, in long opt ) raises (SALOME::SALOME_Exception); @@ -309,41 +317,41 @@ module HEXABLOCK_ORB raises (SALOME::SALOME_Exception); // HexaBlock V3 - Elements revolutionQuads( in Quads qds, in Vertex ori, in Vector dir, + Elements revolutionQuads( in Quads qds, in Vertex ori, in Vector dir, in RealVector angles) - raises (SALOME::SALOME_Exception); + raises (SALOME::SALOME_Exception); Elements replace( in Quads qds, in Vertex p1, in Vertex c1, in Vertex p2, in Vertex c2, in Vertex p3, in Vertex c3) - raises (SALOME::SALOME_Exception); + raises (SALOME::SALOME_Exception); - Elements makeSphere (in Vertex center, in Vector vx, in Vector vz, + Elements makeSphere (in Vertex center, in Vector vx, in Vector vz, in double radius, in double radhole, - in Vertex plorig, + in Vertex plorig, in long nrad, in long nang, in long nhaut) - raises (SALOME::SALOME_Exception); + raises (SALOME::SALOME_Exception); - Elements makePartSphere (in Vertex center, in Vector vx, in Vector vz, + Elements makePartSphere (in Vertex center, in Vector vx, in Vector vz, in double radius, in double radhole, in Vertex plorig, in double angle, in long nrad, in long nang, in long nhaut) - raises (SALOME::SALOME_Exception); + raises (SALOME::SALOME_Exception); - Elements makeRind (in Vertex center, in Vector vx, in Vector vz, + Elements makeRind (in Vertex center, in Vector vx, in Vector vz, in double radext, in double radint, in double radhole, - in Vertex plorig, + in Vertex plorig, in long nrad, in long nang, in long nhaut) - raises (SALOME::SALOME_Exception); + raises (SALOME::SALOME_Exception); - Elements makePartRind (in Vertex center, in Vector vx, in Vector vz, + Elements makePartRind (in Vertex center, in Vector vx, in Vector vz, in double radext, in double radint, in double radhole, in Vertex plorig, in double angle, in long nrad, in long nang, in long nhaut) - raises (SALOME::SALOME_Exception); -// -// + raises (SALOME::SALOME_Exception); +// +// // /*! -// Fusionner 2 éléments de même nature //CS_NOT_SPEC +// Fusionner 2 elements de meme nature //CS_NOT_SPEC // */ // Elements mergeQuads( in Quad qa, in Quad qb, @@ -356,7 +364,7 @@ module HEXABLOCK_ORB in Vertex va2, in Vertex vb2 ) raises (SALOME::SALOME_Exception);//CS_NOT_SPEC //CS_NEW -// +// // Elements mergeEdges( in Edge e1, in Edge e2, // in Vertex v1, in Vertex v2 ) // raises (SALOME::SALOME_Exception); @@ -374,7 +382,7 @@ module HEXABLOCK_ORB /*! Deconnecter des elements du modele */ - Elements disconnectQuad( in Hexa h, in Quad q ) + Elements disconnectQuad( in Hexa h, in Quad q ) raises (SALOME::SALOME_Exception); Elements disconnectEdge( in Hexa h, in Edge e ) @@ -387,7 +395,7 @@ module HEXABLOCK_ORB raises (SALOME::SALOME_Exception); /*! - Couper des hexaèdres du modèle + Couper des hexaedres du modele */ Elements cut( in Edge e, in long nb_of_cuts ) raises (SALOME::SALOME_Exception); @@ -399,8 +407,8 @@ module HEXABLOCK_ORB // raises (SALOME::SALOME_Exception); Elements makeTranslation( in Elements l, in Vector vec ) raises (SALOME::SALOME_Exception); -// -// +// +// Elements makeRotation (in Elements l, in Vertex ver, in Vector vec, in double angle) raises (SALOME::SALOME_Exception); Elements makeScale (in Elements e, in Vertex ver, in double k ) @@ -411,7 +419,7 @@ module HEXABLOCK_ORB Elements makeSymmetryLine (in Elements e, in Vertex ver, in Vector vec) raises (SALOME::SALOME_Exception); - + Elements makeSymmetryPlane (in Elements e, in Vertex ver, in Vector vec) raises (SALOME::SALOME_Exception); @@ -423,10 +431,10 @@ module HEXABLOCK_ORB void performTranslation(in Elements l, in Vector vec) raises (SALOME::SALOME_Exception); -// +// void performRotation(in Elements l, in Vertex ver, in Vector vec, in double angle) raises (SALOME::SALOME_Exception); -// +// void performScale(in Elements e, in Vertex ver, in double k) raises (SALOME::SALOME_Exception); @@ -438,15 +446,15 @@ module HEXABLOCK_ORB void performSymmetryPlane(in Elements e, in Vertex ver, in Vector vec) raises (SALOME::SALOME_Exception); -// +// // /*! // -------- // MAILLAGE // -------- // */ -// +// // /*! -// Créer, éditer et supprimer un groupe +// Creer, editer et supprimer un groupe // */ // HexaGroup addHexaGroup( in string name ) Group addHexaGroup( in string name ) @@ -491,7 +499,7 @@ module HEXABLOCK_ORB /*! - Définir une loi de discrétisation + Definir une loi de discretisation */ Law addLaw( in string name, in long nb_nodes ) raises (SALOME::SALOME_Exception); @@ -510,7 +518,7 @@ module HEXABLOCK_ORB /*! - Discretization defined on the model of blocks + Discretization defined on the model of blocks */ long countPropagation() raises (SALOME::SALOME_Exception); @@ -524,22 +532,7 @@ module HEXABLOCK_ORB /*! Association on lines */ - long associateOpenedLine (in Edge mstart, in Edges mline, in Shape gstart, - in double pstart, in Shapes gline, in double pend) - raises (SALOME::SALOME_Exception); - - long associateClosedLine (in Vertex mfirst, in Edge mstart, in Edges mline, - in Shape gstart, in double pstart, in boolean inv, - in Shapes gline) - raises (SALOME::SALOME_Exception); - - void setShape (in GEOM::GEOM_Object geom_object_vertex ) - raises (SALOME::SALOME_Exception); - - GEOM::GEOM_Object getShape () - raises (SALOME::SALOME_Exception); - string getBrep () - raises (SALOME::SALOME_Exception); +// Shape // Ajouts 05/09/20011 @@ -561,7 +554,7 @@ module HEXABLOCK_ORB Hexa getUsedHexa( in long i ) raises (SALOME::SALOME_Exception); - Hexa addHexa5Quads (in Quad q1, in Quad q2, in Quad q3, in Quad q4, + Hexa addHexa5Quads (in Quad q1, in Quad q2, in Quad q3, in Quad q4, in Quad q5) raises (SALOME::SALOME_Exception); Hexa addHexa4Quads ( in Quad q1, in Quad q2, in Quad q3, in Quad q4) raises (SALOME::SALOME_Exception); @@ -571,12 +564,43 @@ module HEXABLOCK_ORB raises (SALOME::SALOME_Exception); boolean removeQuad( in Quad q ) - raises (SALOME::SALOME_Exception); + raises (SALOME::SALOME_Exception);//CS_NOT_SPEC boolean removeElements( in Elements b ) raises (SALOME::SALOME_Exception); void clearAssociation () raises (SALOME::SALOME_Exception); + + // Hexa 5 + + NewShape addShape (in GEOM::GEOM_Object geometry, in string name) + raises (SALOME::SALOME_Exception); + + NewShape getShape (in long nro) raises (SALOME::SALOME_Exception); + + long countShape () + raises (SALOME::SALOME_Exception); + + long associateOpenedLine (in Edges mlines, + in Shapes glines, in IntVector subids, + in double pstart, in double pend) + raises (SALOME::SALOME_Exception); + + long associateClosedLine (in Vertex mfirst, in Edges mlines, + in Shapes glines, in IntVector subids, + in double pstart, in boolean inv) + raises (SALOME::SALOME_Exception); + /*! + 2 Cylindres en T decoupes en blocs (Hexa5) + */ + Elements makeBiCylinder ( in Cylinder c1, in Cylinder c2 ) + raises (SALOME::SALOME_Exception); + + /*! + 2 Tuyau decoupe en intersection decoupees en blocs (Hexa5) + */ + Elements makeBiPipe ( in Pipe p1, in Pipe p2 ) + raises (SALOME::SALOME_Exception); }; }; diff --git a/idl/Edge.idl b/idl/Edge.idl index 6b2ef6c..e38bbae 100755 --- a/idl/Edge.idl +++ b/idl/Edge.idl @@ -32,7 +32,7 @@ /*! \ingroup EXAMPLES -This package contains the interface HEXABLOCK_ORB used +This package contains the interface HEXABLOCK_ORB used for %HEXABLOCK component as an example in %SALOME application. */ module HEXABLOCK_ORB @@ -52,37 +52,18 @@ module HEXABLOCK_ORB Vertex getVertex( in long n ) raises (SALOME::SALOME_Exception); boolean getWay() raises (SALOME::SALOME_Exception); - long addAssociation (in GEOM::GEOM_Object geom_object_1D, in double debut, in double val ) //CS_NOT_SPEC - raises (SALOME::SALOME_Exception); - - void clearAssociation ( ) + void clearAssociation ( ) raises (SALOME::SALOME_Exception); -// sequence getAssociations() //CS_NOT_SPEC - EdgeAssociations getAssociations() //CS_NOT_SPEC CS_WARNING: not working when reloading a document - raises (SALOME::SALOME_Exception); - -// void addAssociation( in GEOM::GEOM_Object geom_object_1D, in double debut, in double val ) -// raises (SALOME::SALOME_Exception); -// GEOM_Objects getAssociations() raises (SALOME::SALOME_Exception); - -// GEOM_Objects GEOM::GEOM_Object getAssociation() -// raises (SALOME::SALOME_Exception); - -// void removeAssociation() -// raises (SALOME::SALOME_Exception); - - void setColor (in double val) - raises (SALOME::SALOME_Exception); - - void setScalar( in double val ) //CS_NOT_SPEC --> To delete - raises (SALOME::SALOME_Exception); + void setColor (in double val) + raises (SALOME::SALOME_Exception); + long addAssociation (in NewShape geom, in long subid, in double debut, + in double fin ) + raises (SALOME::SALOME_Exception); }; typedef sequence Edges; - - }; #endif diff --git a/idl/Element.idl b/idl/Element.idl index beeba4d..4aa5701 100755 --- a/idl/Element.idl +++ b/idl/Element.idl @@ -30,8 +30,8 @@ module HEXABLOCK_ORB { interface Element : SALOME::GenericObj { - void dump () raises (SALOME::SALOME_Exception); - void printName () raises (SALOME::SALOME_Exception); + void dump () raises (SALOME::SALOME_Exception);//CS_NOT_SPEC + void printName () raises (SALOME::SALOME_Exception);//CS_NOT_SPEC string getName () raises (SALOME::SALOME_Exception); void setName (in string name) raises (SALOME::SALOME_Exception); }; diff --git a/idl/Elements.idl b/idl/Elements.idl index 94e1078..7536f45 100755 --- a/idl/Elements.idl +++ b/idl/Elements.idl @@ -130,7 +130,7 @@ module HEXABLOCK_ORB Quad getQuad( in long n ) raises (SALOME::SALOME_Exception); Hexa getHexa( in long n ) raises (SALOME::SALOME_Exception); - long findVertex( in Vertex p ) raises (SALOME::SALOME_Exception); + long findVertex( in Vertex p ) raises (SALOME::SALOME_Exception);//CS_NOT_SPEC Vertex getVertexIJK( in long x, in long y, in long z) raises (SALOME::SALOME_Exception); @@ -158,7 +158,7 @@ module HEXABLOCK_ORB // Edge getEdge1( in EnumCoord dir, in long nx, in long ny, in long nz) raises (SALOME::SALOME_Exception); //CS_NOT_SPEC long saveVtk( in string fname ) - raises (SALOME::SALOME_Exception); + raises (SALOME::SALOME_Exception);//CS_NOT_SPEC void clearAssociation () raises (SALOME::SALOME_Exception); diff --git a/idl/HEXABLOCK_Gen.idl b/idl/HEXABLOCK_Gen.idl index d3b4789..aeff422 100755 --- a/idl/HEXABLOCK_Gen.idl +++ b/idl/HEXABLOCK_Gen.idl @@ -42,7 +42,6 @@ module HEXABLOCK_ORB /*! Donne le nombre de documents ouverts en session. */ - void test() raises (SALOME::SALOME_Exception); long countDocument() raises (SALOME::SALOME_Exception); @@ -55,6 +54,9 @@ module HEXABLOCK_ORB Document addDocument(in string name) raises (SALOME::SALOME_Exception); + Document findDocument(in string name) + raises (SALOME::SALOME_Exception); + Document loadDocument(in string xmlFilename) raises (SALOME::SALOME_Exception); @@ -63,6 +65,11 @@ module HEXABLOCK_ORB */ void SetCurrentStudy( in SALOMEDS::Study theStudy ); + long addDocInStudy (in Document doc) + raises (SALOME::SALOME_Exception); + + void test() raises (SALOME::SALOME_Exception); + }; }; diff --git a/idl/Hexa.idl b/idl/Hexa.idl index bbd8452..ae514dc 100755 --- a/idl/Hexa.idl +++ b/idl/Hexa.idl @@ -43,7 +43,7 @@ module HEXABLOCK_ORB Edge getEdge( in long n ) raises(SALOME::SALOME_Exception); Vertex getVertex( in long n ) raises(SALOME::SALOME_Exception); - void setColor (in double value) + void setColor (in double value)//CS_NOT_SPEC raises (SALOME::SALOME_Exception); void setScalar( in double val ) //CS_NOT_SPEC --> To delete diff --git a/idl/Makefile.am b/idl/Makefile.am index b12ae93..3f3bdf3 100755 --- a/idl/Makefile.am +++ b/idl/Makefile.am @@ -26,6 +26,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am BASEIDL_FILES = \ Element.idl\ + NewShape.idl\ Vertex.idl\ Edge.idl\ Quad.idl\ @@ -62,6 +63,8 @@ nodist_libSalomeIDLHEXABLOCK_la_SOURCES = \ EdgeDynSK.cc\ QuadSK.cc\ QuadDynSK.cc\ + NewShapeSK.cc\ + NewShapeDynSK.cc\ HexaSK.cc\ HexaDynSK.cc\ VectorSK.cc\ @@ -93,6 +96,7 @@ LawDynSK.cc: LawSK.cc ElementsDynSK.cc: ElementsSK.cc CrossElementsDynSK.cc: CrossElementsSK.cc QuadDynSK.cc: QuadSK.cc +NewShapeDynSK.cc: NewShapeSK.cc VectorDynSK.cc: VectorSK.cc CylinderDynSK.cc: CylinderSK.cc GroupDynSK.cc: GroupSK.cc @@ -146,7 +150,7 @@ IDLPYFLAGS = \ @IDLPYFLAGS@ \ -I$(KERNEL_ROOT_DIR)/idl/salome \ -I$(GEOM_ROOT_DIR)/idl/salome - + # potential problem on parallel make on the following - multiple outputs @@ -191,4 +195,4 @@ mostlyclean-local: -include .depidl -# -I$(GEOM_ROOT_DIR)/include/salome \ No newline at end of file +# -I$(GEOM_ROOT_DIR)/include/salome diff --git a/idl/NewShape.idl b/idl/NewShape.idl new file mode 100755 index 0000000..82d0f3f --- /dev/null +++ b/idl/NewShape.idl @@ -0,0 +1,55 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef __NewShape_idl_ +#define __NewShape_idl_ +/*! + \defgroup EXAMPLES SALOME EXAMPLES components + */ +#include "SALOME_Exception.idl" +#include "SALOME_GenericObj.idl" + +// #include "GEOM_Gen.idl" +#include "Element.idl" + +/*! \ingroup EXAMPLES + +This package contains the interface HEXABLOCK_ORB used +for %HEXABLOCK component as an example in %SALOME application. +*/ +module HEXABLOCK_ORB +{ + interface NewShape : Element + { + long countVertex () raises (SALOME::SALOME_Exception); + long countEdge () raises (SALOME::SALOME_Exception); + long countFace () raises (SALOME::SALOME_Exception); + + + long getVertex (in long nro) raises (SALOME::SALOME_Exception); + long getEdge (in long nro) raises (SALOME::SALOME_Exception); + long getFace (in long nro) raises (SALOME::SALOME_Exception); + + + string getNameVertex (in long nro) raises (SALOME::SALOME_Exception); + string getNameEdge (in long nro) raises (SALOME::SALOME_Exception); + string getNameFace (in long nro) raises (SALOME::SALOME_Exception); + }; +}; + +#endif diff --git a/idl/Quad.idl b/idl/Quad.idl index b182cd2..ef2e42c 100755 --- a/idl/Quad.idl +++ b/idl/Quad.idl @@ -32,7 +32,7 @@ /*! \ingroup EXAMPLES -This package contains the interface HEXABLOCK_ORB used +This package contains the interface HEXABLOCK_ORB used for %HEXABLOCK component as an example in %SALOME application. */ module HEXABLOCK_ORB @@ -45,25 +45,13 @@ module HEXABLOCK_ORB Vertex getVertex( in long n ) raises (SALOME::SALOME_Exception); -// void addAssociation( in GEOM::GEOM_Object geom_object_2D ) -// raises (SALOME::SALOME_Exception); -// -// GEOM_Objects getAssociations() -// raises (SALOME::SALOME_Exception); - - void clearAssociation ( ) - raises (SALOME::SALOME_Exception); - - long addAssociation( in GEOM::GEOM_Object geom_object_2D ) //CS_NOT_SPEC + void clearAssociation ( ) raises (SALOME::SALOME_Exception); - GEOM::ListOfGO getAssociations() //CS_NOT_SPEC CS_WARNING: not working when reloading a document - raises (SALOME::SALOME_Exception); -// -// void removeAssociation() -// raises (SALOME::SALOME_Exception); + long addAssociation (in NewShape geom, in long subid) // + raises (SALOME::SALOME_Exception); - void setColor (in double value) + void setColor (in double value)//CS_NOT_SPEC raises (SALOME::SALOME_Exception); void setScalar( in double val ) //CS_NOT_SPEC --> To delete diff --git a/idl/Vertex.idl b/idl/Vertex.idl index b1ee130..b8f81d6 100755 --- a/idl/Vertex.idl +++ b/idl/Vertex.idl @@ -28,15 +28,15 @@ #include "Element.idl" - /*! \ingroup EXAMPLES -This package contains the interface HEXABLOCK_ORB used -for %HEXABLOCK component +This package contains the interface HEXABLOCK_ORB used +for %HEXABLOCK component */ module HEXABLOCK_ORB { + interface NewShape; interface Vertex : Element { double getX() raises (SALOME::SALOME_Exception); @@ -47,20 +47,19 @@ module HEXABLOCK_ORB void setY( in double y ) raises (SALOME::SALOME_Exception); void setZ( in double z ) raises (SALOME::SALOME_Exception); - void setAssociation( in GEOM::GEOM_Object geom_object_vertex ) - raises (SALOME::SALOME_Exception); - - GEOM::GEOM_Object getAssociation() - raises (SALOME::SALOME_Exception); - void clearAssociation() raises (SALOME::SALOME_Exception); void setColor (in double value) raises (SALOME::SALOME_Exception); - void setScalar( in double val ) //CS_NOT_SPEC --> To delete - raises (SALOME::SALOME_Exception); + long setAssociation ( in NewShape geom, in long subid) + raises (SALOME::SALOME_Exception); + + double getAssoX () raises (SALOME::SALOME_Exception); + double getAssoY () raises (SALOME::SALOME_Exception); + double getAssoZ () raises (SALOME::SALOME_Exception); + }; diff --git a/src/HEXABLOCK/Hex.cxx b/src/HEXABLOCK/Hex.cxx index 08a672d..bcd5cbb 100755 --- a/src/HEXABLOCK/Hex.cxx +++ b/src/HEXABLOCK/Hex.cxx @@ -21,15 +21,20 @@ // #include "Hex.hxx" +#include "HexEltBase.hxx" #include "HexDocument.hxx" +#include "HexGlobale.hxx" #include BEGIN_NAMESPACE_HEXA +Hex* Hex::first_instance = NULL; + // ======================================================== Constructeur Hex::Hex () { setlocale (LC_NUMERIC, "C"); + glob = Globale::getInstance (); } // ======================================================== Destructeur Hex::~Hex () @@ -56,6 +61,10 @@ Document* Hex::getDocument (int nro) // ======================================================== removeDocument void Hex::removeDocument (Document* doc) { + bool actif = glob->dump.start ("hexablock", "removeDocument"); + if (actif) + glob->dump << doc; + int nbre = liste_documents.size(); for (int nd=0 ; nddump.close (actif); return; } } // Pas trouve dans la liste. On detruit quand meme + glob->dump.close (actif); delete doc; } // ======================================================== addDocument Document* Hex::addDocument (cpchar nomdoc) { - Document* doc = new Document (nomdoc); + bool actif = glob->dump.start ("hexablock", "addDocument"); + if (actif) + glob->dump << nomdoc; + + string name; + makeName (nomdoc, name); + Document* doc = new Document (name.c_str(), this); + liste_documents.push_back (doc); + + glob->dump.close (actif, doc); return doc; } // ======================================================== loadDocument -Document* Hex::loadDocument (const char* filename) +Document* Hex::loadDocument (cpchar filename) { - Document* doc = addDocument ("xxxx"); + bool actif = glob->dump.start ("hexablock", "loadDocument"); + if (actif) + glob->dump << filename; + + Document* doc = addDocument ("default"); doc->loadXml (filename); + + glob->dump.close (actif, doc); return doc; } +// ======================================================== loadAllDocs +int Hex::loadAllDocs (cpchar stream) +{ + int posit = 0; + int car = ' '; + int nbdocs = 0; + + while ( (car=stream[posit++]) != '>') + if (car>='0' && car <='9') + nbdocs = 10*nbdocs + car - '0'; + + for (int nro = 0; nrosetXml (stream, posit); + } + + PutData (posit); + return HOK; +} +// ======================================================== saveAllDocs +int Hex::saveAllDocs (cpchar filename) +{ + FILE* fic = fopen (filename, "w"); + if (fic==NULL) + return HERR; + + int nbdocs = countDocument (); + fprintf (fic, "<%d>", nbdocs); + + for (int nro = 0; nroappendXml (fic); + } + + fclose (fic); + return HOK; +} +// ======================================================== findDocument +Document* Hex::findDocument (cpchar name) +{ + int nbdocs = liste_documents.size(); + for (int nro = 0; nrogetName ())) + return doc; + } + return NULL; +} +// ======================================================== makeName +void Hex::makeName (cpchar radical, string& name) +{ + char cnum [8]; + int numero = 0; + while (true) + { + name = radical; + if (numero>0) + { + sprintf (cnum, "_%d", numero); + name += cnum; + } + numero ++; + if (findDocument (name)==NULL) + return; + } +} +// ======================================================== lockDump +void Hex::lockDump () +{ + glob->dump.lock (); +} +// ======================================================== restoreDump +void Hex::restoreDump () +{ + glob->dump.restore (DumpActif); +} +// ====================================================== getInstance +Hex* Hex::getInstance () +{ + if (first_instance==NULL) + first_instance = new Hex (); + + return first_instance; +} END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/Hex.hxx b/src/HEXABLOCK/Hex.hxx index 2035a03..da255db 100755 --- a/src/HEXABLOCK/Hex.hxx +++ b/src/HEXABLOCK/Hex.hxx @@ -17,7 +17,8 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com // #ifndef __HEX_H @@ -30,19 +31,34 @@ BEGIN_NAMESPACE_HEXA class Hex { public: + static Hex* getInstance (); + int countDocument (); Document* getDocument (int nro); void removeDocument (Document* doc); - Document* addDocument (const char* name="default"); - Document* loadDocument (const char* name); + Document* addDocument (cpchar name="default"); + Document* loadDocument (cpchar name); + Document* findDocument (cpchar name); + Document* findDocument (const string& name) + { return findDocument (name.c_str()) ; } + + int loadAllDocs (cpchar flow); + int saveAllDocs (cpchar filename); + void makeName (cpchar radical, string& name); + void lockDump(); + void restoreDump(); + +// private: // Constructeur + destructeur Hex (); ~Hex (); private: + static Hex* first_instance; vector liste_documents; + Globale* glob; }; END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexAssoEdge.cxx b/src/HEXABLOCK/HexAssoEdge.cxx new file mode 100755 index 0000000..6dec1f1 --- /dev/null +++ b/src/HEXABLOCK/HexAssoEdge.cxx @@ -0,0 +1,130 @@ +// +// C++ : Implementation des associations d'edges +// +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com + +#include "HexAssoEdge.hxx" +#include "HexXmlWriter.hxx" + +#include +#include + +#include + +BEGIN_NAMESPACE_HEXA + +// static bool db = on_debug (); +// static const double TolAsso = 1e-2; // Tolerance pour les associations + +// ========================================================= Constructeur +AssoEdge::AssoEdge (EdgeShape* shape, double deb, double fin) +{ + arc_line = shape; + arc_para1 = std::min (deb, fin); + arc_para2 = std::max (deb, fin); + + arc_line->getPoint (arc_para1, arc_start); + arc_line->getPoint (arc_para2, arc_end); + + // arc_curve = arc_line->getCurve (); Provisoire en attendant modif plugin + arc_curve = arc_line->makeCurve (); + arc_reverse = false; +} +// ========================================================= onExtremity +int AssoEdge::onExtremity (double* point) +{ + if (EdgeShape::samePoints (point, arc_start)) + return V_AMONT; + else if (EdgeShape::samePoints (point, arc_end)) + return V_AVAL; + else + return NOTHING; +} +// ========================================================= onExtremity +int AssoEdge::onExtremity (AssoEdge* other, int& ext_other) +{ + ext_other = NOTHING; + if (other==NULL) + return NOTHING; + + int rep = onExtremity (other->arc_start); + if (rep != NOTHING) + { + ext_other = V_AMONT; + } + else + { + rep = onExtremity (other->arc_end); + if (rep != NOTHING) + ext_other = V_AVAL; + } + + return rep; +} +// ========================================================= length +double AssoEdge::length () +{ + double longueur = (arc_para2-arc_para1)*arc_line->getLength (); + return longueur; +} +// ========================================================= getUstart +double AssoEdge::getUstart () +{ + BRepAdaptor_Curve* curve = arc_line->getCurve () ; + double len = arc_line->getLength (); + + GCPnts_AbscissaPoint discret_start (*curve, len*arc_para1, + curve->FirstParameter() ); + double ustart = discret_start.Parameter(); + return ustart; +} +// ========================================================= saveXml +void AssoEdge::saveXml (XmlWriter* xml) +{ + char interval [80]; + sprintf (interval, "%g %g", arc_para1, arc_para2); + + arc_line->callXml (xml); + xml->addAttribute ("interval", interval); + xml->closeMark (); +} +// ========================================================= setStart +void AssoEdge::setStart (double param) +{ + arc_para1 = param; + arc_line->getPoint (arc_para1, arc_start); +} +// ========================================================= setEnd +void AssoEdge::setEnd (double param) +{ + arc_para2 = param; + arc_line->getPoint (arc_para2, arc_end); +} +// ----------------------------------------------------------------------- +// ========================================================= dump +void AssoEdge::dump () +{ + cout << " AssoEddge = " << arc_line->getName() + << " (" << arc_para1 << ", " << arc_para2 << ")" << endl; + + PutCoord (arc_start); + PutCoord (arc_end); +} +END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexAssoEdge.hxx b/src/HEXABLOCK/HexAssoEdge.hxx new file mode 100644 index 0000000..b14107c --- /dev/null +++ b/src/HEXABLOCK/HexAssoEdge.hxx @@ -0,0 +1,51 @@ + +// class : Gestion des formes associees (Hexa 5) + +#ifndef __ASSO_EDGE_H_ +#define __ASSO_EDGE_H_ + +#include "HexEdgeShape.hxx" + +#ifndef NO_CASCADE +#include +#include +#endif + +BEGIN_NAMESPACE_HEXA + +class AssoEdge +{ +public : + AssoEdge (EdgeShape* shape, double deb, double fin); + + EdgeShape* getEdgeShape() { return arc_line; } + BRepAdaptor_Curve* getCurve () { return arc_curve; } + double getStart () { return arc_para1; } + double getEnd () { return arc_para2; } + double length (); + double getUstart (); // for Mesh Plugin + + + const double* getOrigin () { return arc_start; } + const double* getExtrem () { return arc_end; } + + int onExtremity (AssoEdge* other, int& ext_other); + int onExtremity (double* point); + + virtual void dump (); + void saveXml (XmlWriter* xml); + + void setStart (double param); + void setEnd (double param); + +private : + bool maj_extrem; + double arc_para1, arc_para2; + EdgeShape* arc_line; + + bool arc_reverse; + Real3 arc_start, arc_end; + BRepAdaptor_Curve* arc_curve; // Duplication a cause du plugin BP +}; +END_NAMESPACE_HEXA +#endif diff --git a/src/HEXABLOCK/HexBiCylinder.cxx b/src/HEXABLOCK/HexBiCylinder.cxx new file mode 100755 index 0000000..a79f990 --- /dev/null +++ b/src/HEXABLOCK/HexBiCylinder.cxx @@ -0,0 +1,809 @@ + +// C++ : Gestion des cylindres croises + +// Copyright (C) 2009-2011 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com + +#include "HexBiCylinder.hxx" + +#include "HexDocument.hxx" +#include "HexVector.hxx" +#include "HexVertex.hxx" +#include "HexHexa.hxx" +#include "HexEdge.hxx" + +#include "HexGlobale.hxx" +#include "HexCylinder.hxx" + +static bool db = false; + +BEGIN_NAMESPACE_HEXA + +static const double cos45 = cos (M_PI/4); + + +void geom_define_line (string& brep); +void geom_asso_point (double angle, Vertex* node); + +void geom_create_circle (double* milieu, double rayon, double* normale, + double* base, string& brep); +int geom_create_cylcyl (double* borig, double* bnorm, double* bbase, + double bray, double bhaut, + double* sorig, double* snorm, double* sbase, + double sray, double shaut); +int geom_asso_cylcyl (Edge* edge); + +// ====================================================== Constructeur +BiCylinder::BiCylinder (Document* doc) + : Elements (doc) +{ + cyl_fill = false; + cross_cyl1 = NULL; + cross_cyl1 = NULL; + cross_cyl2 = NULL; + grid_type = GR_BICYL; + at_right = at_left = true; + + tab_hexa.push_back (NULL); + tab_quad.push_back (NULL); + tab_edge.push_back (NULL); + tab_vertex.push_back (NULL); + nbr_vertex = nbr_edges = nbr_quads = nbr_hexas = 1; +} +// ====================================================== getHexaIJK +Hexa* BiCylinder::getHexaIJK (int cyl, int nx, int ny, int nz) +{ + int key = getKey (cyl, nx, ny, nz); + int nro = map_hexa [key]; + return tab_hexa [nro]; +} +// ====================================================== getQuadIJ +Quad* BiCylinder::getQuadIJ (int cyl, int nx, int ny, int nz) +{ + int key = getKey (cyl, dir_z, nx, ny, nz); + int nro = map_quad [key]; + return tab_quad [nro]; +} +// ====================================================== getQuadJK +Quad* BiCylinder::getQuadJK (int cyl, int nx, int ny, int nz) +{ + int key = getKey (cyl, dir_x, nx, ny, nz); + int nro = map_quad [key]; + return tab_quad [nro]; +} +// ====================================================== getQuadIK +Quad* BiCylinder::getQuadIK (int cyl, int nx, int ny, int nz) +{ + int key = getKey (cyl, dir_y, nx, ny, nz); + int nro = map_quad [key]; + return tab_quad [nro]; +} +// ====================================================== getEdgeI +Edge* BiCylinder::getEdgeI (int cyl, int nx, int ny, int nz) +{ + int key = getKey (cyl, dir_x, nx, ny, nz); + int nro = map_edge [key]; + return tab_edge [nro]; +} +// ====================================================== getEdgeJ +Edge* BiCylinder::getEdgeJ (int cyl, int nx, int ny, int nz) +{ + int key = getKey (cyl, dir_y, nx, ny, nz); + int nro = map_edge [key]; + return tab_edge [nro]; +} +// ====================================================== getEdgeK +Edge* BiCylinder::getEdgeK (int cyl, int nx, int ny, int nz) +{ + int key = getKey (cyl, dir_z, nx, ny, nz); + int nro = map_edge [key]; + return tab_edge [nro]; +} +// ====================================================== getVertexIJK +Vertex* BiCylinder::getVertexIJK (int cyl, int nx, int ny, int nz) +{ + int key = getKey (cyl, nx, ny, nz); + int nro = map_vertex [key]; + if (db) + { + printf ("getVertexIJK (%d, %d,%d,%d) = V%d = ", cyl, nx, ny, nz, nro); + if (tab_vertex[nro] == NULL) + printf ("NULL\n"); + else + printf ("%s = (%g, %g, %g)\n", tab_vertex[nro]->getName(), + tab_vertex[nro]->getX(), tab_vertex[nro]->getY(), + tab_vertex[nro]->getZ()); + } + return tab_vertex [nro]; +} +// ------------------------------------------------------------------------ +// ====================================================== addVertex +Vertex* BiCylinder::addVertex (double px, double py, double pz, int cyl, + int nx, int ny, int nz) +{ + Vertex* node = el_root->addVertex (px, py, pz); + int key = getKey (cyl, nx, ny, nz); + tab_vertex.push_back (node); + map_vertex [key] = nbr_vertex; + + if (db) + { + printf (" tab_vertex [%d, %d,%d,%d] = V%d = ", cyl, nx, ny, nz, + nbr_vertex); + if (node == NULL) + printf ("NULL\n"); + else + printf ("%s = (%g, %g, %g)\n", node->getName(), node->getX(), + node->getY(), node->getZ()); + } + nbr_vertex ++; + return node; +} +// ====================================================== addEdge +Edge* BiCylinder::addEdge (Vertex* v1, Vertex* v2, int cyl, int dir, int nx, + int ny, int nz) +{ + int key = getKey (cyl, dir, nx, ny, nz); + int nro = map_edge [key]; + if (nro>0) + { + if (db) + { + Edge* edge = tab_edge [nro]; + + printf ("pres_edge [%d,%d, %d,%d,%d] = E%d = ", cyl, dir, nx, ny, nz, + nbr_edges); + printf ("%s ((%s, %s)) = (%s,%s)\n", edge->getName(), + edge->getVertex(0)->getName(), edge->getVertex(1)->getName(), + v1->getName(), v2->getName()); + if (NOT edge->definedBy (v1,v2)) + printf (" **** Incoherence !!\n"); + } + return tab_edge [nro]; + } + + if (v1==NULL || v2==NULL) + return NULL; + + Edge* edge = findEdge (v1, v2); + if (edge==NULL) + edge = newEdge (v1, v2); + + map_edge [key] = nbr_edges; + tab_edge.push_back (edge); + + if (db) + { + printf (" tab_edge [%d,%d, %d,%d,%d] = E%d = ", cyl, dir, nx, ny, nz, + nbr_edges); + if (edge == NULL) + printf ("NULL\n"); + else + printf ("%s = (%s, %s)\n", edge->getName(), + edge->getVertex(0)->getName(), + edge->getVertex(1)->getName()); + } + nbr_edges ++; + return edge; +} +// ====================================================== addQuad +Quad* BiCylinder::addQuad (Edge* e1, Edge* e2, Edge* e3, Edge* e4, int cyl, + int dir, int nx, int ny, int nz) +{ + int key = getKey (cyl, dir, nx, ny, nz); + int nro = map_quad [key]; + if (nro>0) + return tab_quad [nro]; + + Quad* quad = newQuad (e1, e2, e3, e4); + map_quad [key] = nbr_quads; + tab_quad.push_back (quad); + + if (db) + { + printf (" tab_quad [%d,%d, %d,%d,%d] = Q%d = ", cyl, dir, nx, ny, nz, + nbr_quads); + if (quad == NULL) + printf ("NULL\n"); + else + printf ("%s = (%s, %s, %s, %s)\n", quad->getName(), + quad->getEdge(0)->getName(), quad->getEdge(1)->getName(), + quad->getEdge(2)->getName(), quad->getEdge(3)->getName()); + } + nbr_quads ++; + return quad; +} +// ====================================================== addHexa +Hexa* BiCylinder::addHexa (Quad* q1, Quad* q2, Quad* q3, Quad* q4, Quad* q5, + Quad* q6, int cyl, int nx, int ny, int nz) +{ + int key = getKey (cyl, nx, ny, nz); + int nro = map_hexa [key]; + if (nro>0) + { + printf (" tab_hexa [%d, %d,%d,%d] = H%d est deja la\n ", + cyl, nx, ny, nz, nbr_hexas); + return tab_hexa [nro]; + } + + Hexa* hexa = newHexa (q1, q2, q3, q4, q5, q6); + map_hexa [key] = nbr_hexas; + tab_hexa.push_back (hexa); + + if (db) + { + printf (" tab_hexa [%d, %d,%d,%d] = H%d = ", cyl, nx, ny, nz, nbr_hexas); + if (hexa == NULL) + printf ("NULL\n"); + else + printf ("%s = (%s, %s, %s, %s, %s, %s)\n", hexa->getName(), + hexa->getQuad(0)->getName(), hexa->getQuad(1)->getName(), + hexa->getQuad(2)->getName(), hexa->getQuad(3)->getName(), + hexa->getQuad(4)->getName(), hexa->getQuad(5)->getName()); + } + nbr_hexas ++; + return hexa; +} +// ------------------------------------------------------------------------ +// ====================================================== findVertex +Vertex* BiCylinder::findVertex (double px, double py, double pz, + int nx, int ny, int nz) +{ + for (it_map=map_vertex.begin() ; it_map!=map_vertex.end() ; ++it_map) + { + int nro = it_map->second; + Vertex* elt = tab_vertex[nro]; + if (elt != NULL && elt->definedBy (px, py, pz)) + { + int key = getKey (CylBig, nx, ny, nz); + map_vertex [key] = nro; + if (db) + printf ("findVertex [Big,%d,%d,%d] = V%d = '%d' = %s\n", + nx, ny, nz, nro, it_map->first, + tab_vertex[nro]->getName()); + return elt; + } + } + printf ("**** Recherche du vertex (%g, %g, %g)\n", px, py, pz); + fatal_error ("HexBiCylinder : Vertex non trouve"); + return NULL; +} +// ====================================================== findEdge +Edge* BiCylinder::findEdge (Vertex* v1, Vertex* v2) +{ + int nbedges = tab_edge.size(); + for (int nro = 0 ; nrodefinedBy (v1, v2)) + return elt; + } + return NULL; +} +// ====================================================== findEdge +Edge* BiCylinder::findEdge (Vertex* v1, Vertex* v2, int dir, int nx, + int ny, int nz) +{ + for (it_map=map_edge.begin() ; it_map!=map_edge.end() ; ++it_map) + { + int nro = it_map->second; + Edge* elt = tab_edge[nro]; + if (elt != NULL && elt->definedBy (v1, v2)) + { + int key = getKey (CylBig, dir, nx, ny, nz); + map_edge [key] = nro; + if (db) + printf ("findEdge [%d, %d,%d,%d] = E%d = '%d' = %s\n", + dir, nx, ny, nz, nro, it_map->first, + elt->getName()); + return elt; + } + } + fatal_error ("HexBiCylinder : Edge non trouve"); + return NULL; +} +// ====================================================== findQuad +Quad* BiCylinder::findQuad (Vertex* v1, Vertex* v2, + int dir, int nx, int ny, int nz) +{ + for (it_map=map_quad.begin() ; it_map!=map_quad.end() ; ++it_map) + { + int nro = it_map->second; + Quad* elt = tab_quad[nro]; + if (elt != NULL && elt->definedBy (v1, v2)) + { + int key = getKey (CylBig, dir, nx, ny, nz); + map_quad [key] = nro; + if (db) + printf ("findQuad [%d, %d,%d,%d] = E%d = '%d' = %s\n", + dir, nx, ny, nz, nro, it_map->first, + elt->getName()); + return elt; + } + } + fatal_error ("HexBiCylinder : Quad non trouve"); + return NULL; +} +// ====================================================== findQuad +Quad* BiCylinder::findQuad (Edge* e1, Edge* e2, int dir, int nx, int ny, int nz) +{ + for (it_map=map_quad.begin() ; it_map!=map_quad.end() ; ++it_map) + { + int nro = it_map->second; + Quad* elt = tab_quad[nro]; + if (elt != NULL && elt->definedBy (e1, e2)) + { + int key = getKey (CylBig, dir, nx, ny, nz); + map_quad [key] = nro; + if (db) + printf ("findQuad [%d, %d,%d,%d] = E%d = '%d' = %s\n", + dir, nx, ny, nz, nro, it_map->first, elt->getName()); + return elt; + } + } + fatal_error ("HexBiCylinder : Quad non trouve"); + return NULL; +} +// ====================================================== findHexa +Hexa* BiCylinder::findHexa (Quad* q1, Quad* q2, int nx, int ny, int nz) +{ + for (it_map=map_hexa.begin() ; it_map!=map_hexa.end() ; ++it_map) + { + int nro = it_map->second; + Hexa* elt = tab_hexa[nro]; + if (elt != NULL && elt->definedBy (q1, q2)) + { + int key = getKey (CylBig, nx, ny, nz); + map_hexa [key] = nro; + if (db) + printf ("findHexa [%d,%d,%d] = H%d = '%d'\n", + nx, ny, nz, nro, it_map->first); + return elt; + } + } + fatal_error ("HexBiCylinder : Hexa non trouve"); + return NULL; +} +// ====================================================== crossCylinders +int BiCylinder::crossCylinders (Cylinder* lun, Cylinder* lautre) +{ + if (lun->getRadius() < lautre->getRadius()) + { + cross_cyl1 = lun; + cross_cyl2 = lautre; + } + else + { + cross_cyl1 = lautre; + cross_cyl2 = lun; + } + + int ier = cross_cyl2->interCylinder (cross_cyl1, at_left, at_right, + cross_center); + if (ier != HOK) + return ier; + + cyl_fill = false; + cross_rayext [CylSmall] = cross_cyl1->getRadius (); + cross_rayext [CylBig] = cross_cyl2->getRadius (); + cross_rayint [CylSmall] = cross_rayext [CylSmall] / 2; + cross_rayint [CylBig ] = cross_rayext [CylBig ] / 2; + cross_hauteur [CylSmall] = cross_cyl1->getHeight (); + cross_hauteur [CylBig] = cross_cyl2->getHeight (); + + createLittleCyl (); + createBigCyl (); + adjustLittleSlice (1, 1); + adjustLittleSlice (0, 2); + adjustLittleSlice (0, 3); + adjustLittleSlice (1, 4); + + Vector* iprim = new Vector (cross_cyl1->getDirection()); + Vector* kprim = new Vector (cross_cyl2->getDirection()); + Vector* jprim = new Vector (kprim); + + iprim->renormer (); + kprim->renormer (); + jprim->vectoriel (kprim, iprim); + + // transfoVertices (cross_center, iprim, jprim, kprim); + + // Real3 snorm, bnorm; + // iprim->getCoord (snorm); + // kprim->getCoord (bnorm); + + Real3 bnorm = {0, 0, 1}; + Real3 snorm = {1, 0, 0}; + assoCylinders (snorm, bnorm); + +/********************************************* + if (at_left) + { + assoIntersection (NxExt, 1, snorm, bnorm); + if (grid_type == GR_BIPIPE) + { + assoIntersection (NxInt, 2, snorm, bnorm); + } + } + + if (at_right) + { + assoIntersection (NxExt, NbrSlices1-1, snorm, bnorm); + if (grid_type == GR_BIPIPE) + { + assoIntersection (NxInt, NbrSlices1-2, snorm, bnorm); + } + } + + ******************************************* */ + assoResiduelle (); + return HOK; +} +// ====================================================== createLittleCyl +void BiCylinder::createLittleCyl () +{ + Real3 base; + Vertex* vbase = cross_cyl1->getBase(); + + Real lg = cross_hauteur[CylSmall]; + Real h1 = calc_distance (cross_center, vbase->getPoint (base)); + Real h2 = cross_rayext[CylBig]*cos45; + Real h3 = (cross_rayext[CylBig] - cross_rayint[CylBig])*cos45; + + double t_haut [NbrVslices] = { -h1, -h2, -h2+h3, h2-h3, h2, lg-h1 }; + + for (int nk=0; nkgetBase(); + Real lg = cross_hauteur[cyl]; + Real rext = cross_rayext [cyl]; + Real rint = cross_rayint [cyl]; + Real h1 = calc_distance (cross_center, vbase->getPoint (base)); + Real h2 = rext * cos45; + Real h3 = lg - h1; + Real dh = (rext - rint)*cos45; + + addSlice (CylBig, 0, 0, -h1, rint); + addSlice (CylBig, 1, 0, -h1, rext); + addSlice (CylBig, 0, 1, -h2+dh, rint, true); + addSlice (CylBig, 1, 1, -h2, rext, true); + addSlice (CylBig, 0, 2, h2-dh, rint, true); + addSlice (CylBig, 1, 2, h2, rext, true); + addSlice (CylBig, 0, 3, h3, rint); + addSlice (CylBig, 1, 3, h3, rext); + + // A B C D + fillSlice (CylBig, 0,0, 0,1, 1,1, 1,0); + fillSlice (CylBig, 0,2, 0,3, 1,3, 1,2); +} +// ====================================================== adjustLittleSlice +void BiCylinder::adjustLittleSlice (int ni, int nk) +{ + Vertex* node = getVertexIJK (CylSmall, ni, 0, nk); + if (node==NULL) + return; + + double grayon2 = cross_rayext[CylBig] * cross_rayext[CylBig]; + double prayon = cross_rayext[CylSmall]; + if (ni==0) + { + grayon2 = cross_rayint[CylBig] * cross_rayint[CylBig]; + prayon = cross_rayint[CylSmall]; + } + + for (int nj=0; njgetX(); + if (qx>=0) node->setX ( px); + else node->setX (-px); + node->setY (py); + node->setZ (pz); + } +} +// ====================================================== addSlice +void BiCylinder::addSlice (int cyl, int ni, int nk, double hauteur, + double rayon, bool find) +{ + for (int nj=0 ; nj K + + ***************************************************************** */ +void BiCylinder::fillSlice (int cyl, int nia, int nka, int nib, int nkb, + int nic, int nkc, int nid, int nkd, + bool meddle) +{ + for (int nj0=0; nj0=NbrCotes) nj1=0; + Vertex* vace = getVertexIJK (cyl, nia, nj0, nka); + Vertex* vacf = getVertexIJK (cyl, nib, nj0, nkb); + Vertex* vadf = getVertexIJK (cyl, nic, nj0, nkc); + Vertex* vade = getVertexIJK (cyl, nid, nj0, nkd); + + Vertex* vbce = getVertexIJK (cyl, nia, nj1, nka); + Vertex* vbcf = getVertexIJK (cyl, nib, nj1, nkb); + Vertex* vbdf = getVertexIJK (cyl, nic, nj1, nkc); + Vertex* vbde = getVertexIJK (cyl, nid, nj1, nkd); + +/* ******************* + PutName (vace); + PutName (vacf); + PutName (vadf); + PutName (vade); + PutName (vbce); + PutName (vbcf); + PutName (vbdf); + PutName (vbde); + ******************* */ + + Edge* eac = addEdge (vace, vacf, cyl, dir_z, nia, nj0, nka); + Edge* ead = addEdge (vade, vadf, cyl, dir_z, nid, nj0, nkd); + Edge* eae = addEdge (vace, vade, cyl, dir_x, nia, nj0, nka); + Edge* eaf = addEdge (vacf, vadf, cyl, dir_x, nib, nj0, nkb); + + Edge* ebc = addEdge (vbce, vbcf, cyl, dir_z, nia, nj1, nka); + Edge* ebd = addEdge (vbde, vbdf, cyl, dir_z, nid, nj1, nkd); + Edge* ebe = addEdge (vbce, vbde, cyl, dir_x, nia, nj1, nka); + Edge* ebf = addEdge (vbcf, vbdf, cyl, dir_x, nib, nj1, nkb); + + Edge* ece = addEdge (vace, vbce, cyl, dir_y, nia, nj0, nka); + Edge* ecf = addEdge (vacf, vbcf, cyl, dir_y, nib, nj0, nkb); + Edge* edf = addEdge (vadf, vbdf, cyl, dir_y, nic, nj0, nkc); + Edge* ede = addEdge (vade, vbde, cyl, dir_y, nid, nj0, nkd); + + Quad* qa = addQuad (eac, eaf, ead, eae, cyl, dir_y, nia , nj0, nka); + Quad* qb = addQuad (ebc, ebf, ebd, ebe, cyl, dir_y, nia , nj1, nka); + Quad* qc = addQuad (eac, ecf, ebc, ece, cyl, dir_x, nia , nj0, nka); + Quad* qd = addQuad (ead, edf, ebd, ede, cyl, dir_x, nid , nj0, nkd); + Quad* qe = addQuad (eae, ede, ebe, ece, cyl, dir_z, nia , nj0, nka); + Quad* qf = addQuad (eaf, edf, ebf, ecf, cyl, dir_z, nib , nj0, nkb); + + addHexa (qa, qb, qc, qd, qe, qf, cyl, nia, nj0, nka); + } +} +// ====================================================== assoCylinders +void BiCylinder::assoCylinders (double* snormal, double* gnormal) +{ + assoSlice (CylSmall, 0, 0, snormal); + assoSlice (CylSmall, 1, 0, snormal); + assoSlice (CylSmall, 0, 5, snormal); + assoSlice (CylSmall, 1, 5, snormal); + + for (int nk=0 ; nk<4 ; nk++) + for (int ni=0 ; ni<2 ; ni++) + assoSlice (CylBig, ni, nk, gnormal); + + assoIntersection (1, 1, snormal, gnormal); + assoIntersection (0, 2, snormal, gnormal); + assoIntersection (0, 3, snormal, gnormal); + assoIntersection (1, 4, snormal, gnormal); + +} +// ====================================================== assoSlice +void BiCylinder::assoSlice (int cyl, int nx, int nzs, double* normal) +{ + Real3 center, pnt1, pnt2, vbase; + string brep; + int ny0 = 0; + int nyd = NbrCotes/2; + + Vertex* v0 = getVertexIJK (cyl, nx, ny0 , nzs); + Vertex* vd = getVertexIJK (cyl, nx, nyd , nzs); + + if (vd==NULL || v0==NULL) + return; + + v0->getPoint (pnt1); + vd->getPoint (pnt2); + + double rayon = 0; + for (int nro=0 ; nro (%s,%s)\n", edge->getName(), + edge->getVertex(0)->getName(), edge->getVertex(1)->getName(), + node0->getName(), node1->getName()); + + // Shape* shape = new Shape (brep); + + // shape->setBounds (ny*Alpha, (ny+1)*Alpha); + // edge ->addAssociation (shape); + + geom_asso_point ( ny *Theta*rayon, node0); + geom_asso_point ((ny+1)*Theta*rayon, node1); +} +// ===================================================== assoIntersection +int BiCylinder::assoIntersection (int nxs, int nzs, double* snorm, + double* bnorm) +{ + Real3 X_center = {0, 0, 0}; // provisoire, a la place de cross_center + Real3 pse, psw, sorig, sbase; + Real3 pbe, pbw, borig, bbase; + string brep; + int ny0 = 0; + int nyd = NbrCotes/2; + int MiddleSlice1 = 3; + + int nz = nzs < MiddleSlice1 ? 0 : 5; + + getVertexIJK (CylSmall, nxs, ny0 , nz)->getPoint (pse); + getVertexIJK (CylSmall, nxs, nyd , nz)->getPoint (psw); + getVertexIJK (CylBig, nxs, ny0 , 0) ->getPoint (pbe); + getVertexIJK (CylBig, nxs, nyd , 0) ->getPoint (pbw); + + double srayon = calc_distance (pse, psw)/2; + double brayon = calc_distance (pbe, pbw)/2; + + calc_milieu (psw, pse, sorig); + calc_milieu (pbw, pbe, borig); + calc_vecteur (psw, pse, sbase); + calc_vecteur (pbw, pbe, bbase); + + double shaut = calc_distance (X_center, sorig); + double bhaut = calc_distance (X_center, borig)*2; + double* orig = nzs < MiddleSlice1 ? sorig : X_center; // Pb orientation + + if (db) + { + PutCoord (borig); + PutCoord (sorig); + PutCoord (orig); + PutData (nz); + PutData (srayon); + PutData (brayon); + } + + int ier = geom_create_cylcyl (borig, bnorm, bbase, brayon, bhaut, + orig, snorm, sbase, srayon, shaut); + if (ier != HOK) + return ier; + + for (int ny=0 ; nyclearAssociation (); + } + + for (int ny=0 ; nyaddVertex ( 0,0,0); + Vertex* ori2 = docu->addVertex (-5,0,5); + Vector* vz = docu->addVector ( 0,0,1); + Vector* vx = docu->addVector ( 1,0,0); + + double r1 = 2*sqrt (2.0); + double r2 = 3*sqrt (2.0); + double l2 = 10; + double l1 = 10; + + Cylinder* cyl1 = docu->addCylinder (ori1, vz, r1, l1); + Cylinder* cyl2 = docu->addCylinder (ori2, vx, r2, l2); + + BiCylinder* grid = new BiCylinder (docu); + grid->crossCylinders (cyl1, cyl2); + return grid; +} +END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexBiCylinder.hxx b/src/HEXABLOCK/HexBiCylinder.hxx new file mode 100755 index 0000000..b26e221 --- /dev/null +++ b/src/HEXABLOCK/HexBiCylinder.hxx @@ -0,0 +1,115 @@ + +// Class : Gestion des tutaux en T (like castles in scotland) + +// Copyright (C) 2009-2011 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com +// +#ifndef __BI_CYLINDER_H_ +#define __BI_CYLINDER_H_ + +#include "HexElements.hxx" +#include + +BEGIN_NAMESPACE_HEXA + +class BiCylinder : public Elements +{ +public: + virtual int countHexa () { return nbr_hexas ; } + virtual int countQuad () { return nbr_quads ; } + virtual int countEdge () { return nbr_edges ; } + virtual int countVertex () { return nbr_vertex ; } + +public: + BiCylinder (Document* doc); + + virtual ~BiCylinder () {} + + Hexa* getHexaIJK (int part, int nx, int ny, int nz); + Quad* getQuadIJ (int part, int nx, int ny, int nz); + Quad* getQuadJK (int part, int nx, int ny, int nz); + Quad* getQuadIK (int part, int nx, int ny, int nz); + Edge* getEdgeI (int part, int nx, int ny, int nz); + Edge* getEdgeJ (int part, int nx, int ny, int nz); + Edge* getEdgeK (int part, int nx, int ny, int nz); + Vertex* getVertexIJK (int part, int nx, int ny, int nz); + + // Tutaux en T (like castles in scotland) + int crossCylinders (Cylinder* cyl1, Cylinder* cyl2); + +private : + + enum { NbrSlices=5, NbrVslices=NbrSlices+1, NbrCotes=4 }; + + void createLittleCyl (); + void createBigCyl (); + void adjustLittleSlice (int nx, int nzs); + + Vertex* addVertex (double px, double py, double pz, + int cyl, int ni, int nj, int nk); + Edge* addEdge (Vertex* v1, Vertex* v2, + int cyl, int dir, int nx, int ny, int nz); + Quad* addQuad (Edge* e1, Edge* e2, Edge* e3, Edge* e4, + int cyl, int dir, int nx, int ny, int nz); + Hexa* addHexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe, Quad* qf, + int cyl, int nx, int ny, int nz); + + Vertex* findVertex (double px, double py, double pz, int ni, int nj, int nk); + Edge* findEdge (Vertex* v1, Vertex* v2, int dir, int nx, int ny, int nz); + Quad* findQuad (Vertex* v1, Vertex* v2, int dir, int nx, int ny, int nz); + Quad* findQuad (Edge* e1, Edge* e2, int dir, int nx, int ny, int nz); + Hexa* findHexa (Quad* qa, Quad* qb, int nx, int ny, int nz); + + Edge* findEdge (Vertex* v1, Vertex* v2); + Quad* findQuad (Edge* e1, Edge* e2); + + void assoCylinder (int cyl, double* normal); + void assoCylinders (double* snormal, double* gnormal); + void assoSlice (int cyl, int nx, int nzs, double* norm); + void assoArc (int cyl, int nx, int ny, int nz, string& brep, double ray); + int assoIntersection (int nx, int nzlice, double* snorm, double* bnorm); + + + void addSlice (int cyl, int i, int k, double h, double r, bool find=false); + void fillSlice (int cyl, int nia, int nka, int nib, int nkb, int nic, + int nkc, int nid, int nkd, bool med=false); + void fillSmallCyl (); + + double getAngle (int nj) { return (2*((nj)%4)+1)*M_PI/4; } + int getKey (int cyl, int ni, int nj, int nk) + { return 1000*(cyl+1) + 100*ni + 10*nj + nk; } + int getKey (int cyl, int dd, int ni, int nj, int nk) + { return 10000*(cyl+1) + 1000*dd + 100*ni + 10*nj + nk; } +private : + Cylinder* cross_cyl1; // Petit + Cylinder* cross_cyl2; // gros + Real3 cross_center; + + map map_vertex, map_edge, map_quad, map_hexa; + map :: iterator it_map; + + int nbr_hexas1, nbr_quads1, nbr_edges1, nbr_vertex1; + double cross_rayext [V_TWO]; + double cross_rayint [V_TWO]; + double cross_hauteur [V_TWO]; + + bool at_right, at_left; +}; +END_NAMESPACE_HEXA +#endif diff --git a/src/HEXABLOCK/HexBiCylinderShape.cxx b/src/HEXABLOCK/HexBiCylinderShape.cxx new file mode 100755 index 0000000..7b857c4 --- /dev/null +++ b/src/HEXABLOCK/HexBiCylinderShape.cxx @@ -0,0 +1,241 @@ +// +// CC++ : Interface Cascade de la classe Elements +// +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com +// +//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 + +#include "HexBiCylinderShape.hxx" + +#include "HexDocument.hxx" +#include "HexNewShape.hxx" +#include "HexEdgeShape.hxx" + +#include "HexVertex.hxx" +#include "HexEdge.hxx" + +#ifndef NO_CASCADE + // Cylindre +#include +#include +#include +#include + +BEGIN_NAMESPACE_HEXA + +static bool db = false; +int BiCylinderShape::nbr_intersections = 0; + +// ====================================================== Constructeur +BiCylinderShape::BiCylinderShape (Document* doc) +{ + bi_docu = doc; + bi_shape = NULL; + no_inter = true; +} +// ====================================================== defineCyls +int BiCylinderShape::defineCyls (double* borig, double* bnorm, double* bbase, + double brayon, double bhaut, + double* sorig, double* snorm, double* sbase, + double srayon, double shaut) +{ + // --------------------------- Preparation + gp_Pnt gpb_orig (borig [dir_x], borig [dir_y], borig [dir_z]); + gp_Vec gpb_norm (bnorm [dir_x], bnorm [dir_y], bnorm [dir_z]); + gp_Vec gpb_vx (bbase [dir_x], bbase [dir_y], bbase [dir_z]); + gp_Ax2 gpb_axes (gpb_orig, gpb_norm, gpb_vx); +// gp_Ax2 gp_axes (gp_center, gp_norm, gp_vx); + + BRepPrimAPI_MakeCylinder make_bcyl (gpb_axes, brayon, bhaut); + make_bcyl.Build(); + + gp_Pnt gps_orig (sorig [dir_x], sorig [dir_y], sorig [dir_z]); + gp_Vec gps_vx (sbase [dir_x], sbase [dir_y], sbase [dir_z]); + gp_Vec gps_norm (snorm [dir_x], snorm [dir_y], snorm [dir_z]); + gp_Ax2 gps_axes (gps_orig, gps_norm, gpb_vx); + + BRepPrimAPI_MakeCylinder make_scyl (gps_axes, srayon, shaut); + make_scyl.Build(); + + if (NOT make_bcyl.IsDone()) + { + printf ("defineCyls : Can' build big cylinder\n"); + return HERR; + } + else if (NOT make_scyl.IsDone()) + { + printf ("defineCyls : Can' build small cylinder\n"); + return HERR; + } + // --------------------------- Intersection + + TopoDS_Shape cyl_big = make_bcyl.Shape(); + TopoDS_Shape cyl_small = make_scyl.Shape(); + + BRepAlgoAPI_Section make_inter (cyl_big, cyl_small, false); + make_inter.Approximation (true); + make_inter.Build(); + + if (NOT make_inter.IsDone()) + { + printf ("defineCyls : No intersection\n"); + return HERR; + } + + TopoDS_Shape cyl_inter = make_inter.Shape(); + // geom_make_brep (cyl_inter, brep); + + // --------------------------- Recuperation + char name [16]; + nbr_intersections ++; + sprintf (name, "inter_cyl%d", nbr_intersections); + bi_shape = bi_docu->addShape (name, SH_INTER); + bi_shape->setShape (cyl_inter, SH_INTER); + bi_shape->saveBrep (); // PROVISOIRE + + return HOK; +} +// ====================================================== anaVertex +// === Trouve le(s) ligne(s) contenant ce vertex et le(s) parametre(s) +int BiCylinderShape::anaVertex (Vertex* node, int* tline, double* tpara) +{ + Real3 point; + node->getPoint (point); + int nbsol = 0; + int nblines = bi_shape->countEdge (); + + for (int nl=0 ; nlgetEdgeShape (nl); + double param = line->getParam (point); + if (db) cout << " ... getParam " << node->getName() + << ", point=(" << point[0] << ", " << point[1] + << ", " << point[2] + << "), nl=" << nl << ", param=" << param << endl; + if (param>=0) + { + if (nbsol>=2) + return nbsol; + + tline [nbsol] = nl; + tpara [nbsol] = param; + nbsol ++; + } + } + + if (nbsol==1) + { + if (tpara[0]<=Epsil) + { + nbsol ++; + tpara[1] = 1.0; + tline[1] = tline[0]-1; + if (tline[1] <0) tline[1] = nblines-1; + } + else if (tpara[0]>=UnEpsil) + { + nbsol ++; + tpara[1] = 0; + tline[1] = tline[0]+1; + if (tline[1] >= nblines) tline[1] = 0; + } + } + + return nbsol; +} +// ====================================================== associate +// ==== On suppose une orientation correcte +int BiCylinderShape::associate (Edge* edge) +{ + + double tparam1 [V_TWO], tparam2 [V_TWO]; + int tline1 [V_TWO], tline2 [V_TWO]; + int sol1 = anaVertex (edge->getVertex(V_AMONT), tline1, tparam1); + int sol2 = anaVertex (edge->getVertex(V_AVAL), tline2, tparam2); + + if (sol1==0 || sol2==0) + return HERR; + + edge->clearAssociation (); + // Ligne commune ? + for (int ns1=0 ; ns1getEdgeShape (nlig); + double param1 = tparam1 [ns1]; + double param2 = tparam2 [ns2]; + if (param1 >= 1.0-Epsil && param1 <= 1.0+Epsil) + param1 = 0.0; + if (param2 >= -Epsil && param2 <= Epsil) + param2 = 1.0; + if (param1 < param2) + { + associate (edge, line, param1, param2, V_TWO); + } + else + // Le debut de la ligne (fermee) est entre les 2 vertex) + { + associate (edge, line, param1, 1, V_AMONT); + associate (edge, line, 0, param2, V_AVAL); + } + return HOK; + } + } + } + + + EdgeShape* line1 = bi_shape->getEdgeShape (tline1[0]); + EdgeShape* line2 = bi_shape->getEdgeShape (tline2[0]); + + associate (edge, line1, tparam1[0], 1, V_AMONT); + associate (edge, line2, 0, tparam2[0], V_AVAL); + return HOK; +} +// ====================================================== associate +// ==== On suppose une orientation correcte +int BiCylinderShape::associate (Edge* edge, EdgeShape* line, double para1, + double para2, int extrem) +{ + edge->addAssociation (line, para1, para2); + + return HOK; // PROVISOIRE + Real3 point; + Vertex* vertex; + + if (extrem != V_AVAL) + { + line->getPoint (para1, point); + vertex = edge->getVertex (V_AMONT); + vertex->setAssociation (point); + } + + if (extrem != V_AMONT) + { + line->getPoint (para2, point); + vertex = edge->getVertex (V_AVAL); + vertex->setAssociation (point); + } +} +END_NAMESPACE_HEXA +#endif diff --git a/src/HEXABLOCK/HexBiCylinderShape.hxx b/src/HEXABLOCK/HexBiCylinderShape.hxx new file mode 100755 index 0000000..c46d28c --- /dev/null +++ b/src/HEXABLOCK/HexBiCylinderShape.hxx @@ -0,0 +1,58 @@ +// +// CC++ : Representation Cascade d'un bi-cylindre +// +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef __BI_CYLINDER_SHAPE_HXX_ +#define __BI_CYLINDER_SHAPE_HXX_ + +#include "HexGlobale.hxx" + +#ifndef NO_CASCADE + +BEGIN_NAMESPACE_HEXA + +class BiCylinderShape +{ +public : + BiCylinderShape (Document* doc); + ~BiCylinderShape () { } + + NewShape* getShape() { return bi_shape; } + + int defineCyls (double* borig, double* bnorm, double* bbase, + double brayon, double bhaut, + double* sorig, double* snorm, double* sbase, + double srayon, double shaut); + int associate (Edge* edge); + int associate (Edge* edge, EdgeShape* line, double p1, double p2, int extr); + +private : + int anaVertex (Vertex* node, int* tline, double* tpara); + +private : + static int nbr_intersections; + Document* bi_docu; + NewShape* bi_shape; + bool no_inter; +}; +END_NAMESPACE_HEXA +#endif +#endif diff --git a/src/HEXABLOCK/HexCloner.cxx b/src/HEXABLOCK/HexCloner.cxx index 31edc5a..3d5473e 100755 --- a/src/HEXABLOCK/HexCloner.cxx +++ b/src/HEXABLOCK/HexCloner.cxx @@ -28,7 +28,9 @@ #include "HexVertex.hxx" #include "HexElements.hxx" -#include "HexShape.hxx" +#include "HexVertexShape.hxx" +#include "HexEdgeShape.hxx" +#include "HexFaceShape.hxx" BEGIN_NAMESPACE_HEXA @@ -44,30 +46,20 @@ Cloner::Cloner (Matrix* mat) // ============================================================== clonerVertex Vertex* Cloner::clonerVertex (Vertex* orig) { - if (orig == NULL) - return orig; - - Vertex* copie = clone_vertex [orig]; - if (copie != NULL) - return copie; + if (orig == NULL) + return orig; - copie = new Vertex (orig); - matrice -> perform (copie); - clone_vertex [orig] = copie; + Vertex* copie = clone_vertex [orig]; + if (copie != NULL) + return copie; - Shape* tshape = copie->getAssociation (); - Shape* shape = orig ->getAssociation (); - if (tshape != NULL || shape == NULL) - return copie; + copie = new Vertex (orig); + matrice -> perform (copie); + clone_vertex [orig] = copie; - string brep = shape->getBrep(); - string trep; - transfo_brep (brep, matrice, trep); - tshape = new Shape (trep); - copie ->setAssociation (tshape); if (db) { - printf ( " --- Cloner::Asso (%s) -> asso (%s)\n", orig ->getName (), + printf ( " --- Cloner::Asso (%s) -> asso (%s)\n", orig ->getName (), copie->getName ()); } return copie; @@ -96,10 +88,11 @@ Edge* Cloner::clonerEdge (Edge* orig) orig ->printName ("\n"); } - const Shapes & new_asso = copie->getAssociations (); - int nbass = new_asso.size(); - if (nbass!=0) - return copie; +/*********************** + // const Shapes & new_asso = copie->getAssociations (); TODO New Shape + // int nbass = new_asso.size(); + // if (nbass!=0) + // return copie; const Shapes & tab_asso = orig->getAssociations (); nbass = tab_asso.size(); @@ -110,17 +103,17 @@ Edge* Cloner::clonerEdge (Edge* orig) string trep; transfo_brep (brep, matrice, trep); Shape* tshape = new Shape (trep); - tshape->setBounds (shape->debut, shape->fin); + tshape->setBounds (shape->getStart(), shape->getEnd()); copie ->addAssociation (tshape); if (db) { - printf ( " --- Cloner::Asso (%s) -> asso (%s)\n", orig ->getName (), + printf ( " --- Cloner::Asso (%s) -> asso (%s)\n", orig ->getName (), copie->getName ()); geom_dump_asso (orig ); geom_dump_asso (copie); } } - +***************************************************/ return copie; } // ============================================================== clonerQuad @@ -135,18 +128,18 @@ Quad* Cloner::clonerQuad (Quad* orig) copie = new Quad (orig); - for (int nro=0 ; nroq_edge [nro] = clonerEdge (orig->q_edge [nro]); - for (int nro=0 ; nroq_vertex [nro] = clonerVertex (orig->q_vertex [nro]); copie->majReferences (); clone_quad [orig] = copie; - +/******************************************************************* const Shapes & new_asso = copie->getAssociations (); int nbass = new_asso.size(); - if (nbass!=0) + if (nbass!=0) return copie; const Shapes & tab_asso = orig->getAssociations (); @@ -160,10 +153,11 @@ Quad* Cloner::clonerQuad (Quad* orig) Shape* tshape = new Shape (trep); copie ->addAssociation (tshape); if (db) - printf ( " --- Asso (%s) -> asso (%s)\n", orig ->getName (), + printf ( " --- Asso (%s) -> asso (%s)\n", orig ->getName (), copie->getName ()); } +***************************************************/ return copie; } // ============================================================== clonerHexa @@ -180,10 +174,10 @@ Hexa* Cloner::clonerHexa (Hexa* orig) for (int nro=0 ; nroh_quad [nro] = clonerQuad (orig->h_quad [nro]); - for (int nro=0 ; nroh_edge [nro] = clonerEdge (orig->h_edge [nro]); - for (int nro=0 ; nroh_vertex [nro] = clonerVertex (orig->h_vertex [nro]); copie->majReferences (); diff --git a/src/HEXABLOCK/HexCrossElements.cxx b/src/HEXABLOCK/HexCrossElements.cxx index e1b8204..6b46a77 100755 --- a/src/HEXABLOCK/HexCrossElements.cxx +++ b/src/HEXABLOCK/HexCrossElements.cxx @@ -17,8 +17,8 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com #include "HexCrossElements.hxx" @@ -30,7 +30,8 @@ #include "HexGlobale.hxx" #include "HexCylinder.hxx" -#include "HexShape.hxx" +#include "HexOldShape.hxx" +#include "HexNewShape.hxx" #include @@ -40,14 +41,8 @@ static const double UnSur2pi = DEMI/M_PI; BEGIN_NAMESPACE_HEXA -void geom_create_circle (double* milieu, double rayon, double* normale, - double* base, string& brep); - -void geom_define_line (string& brep); -void geom_asso_point (double angle, Vertex* node); - // ====================================================== Constructeur -CrossElements::CrossElements (Document* doc, EnumGrid type) +CrossElements::CrossElements (Document* doc, EnumGrid type) : Elements (doc) { cross_cyl1 = NULL; @@ -55,9 +50,10 @@ CrossElements::CrossElements (Document* doc, EnumGrid type) cross_cyl2 = NULL; cross_center = NULL; grid_type = type; - angle_inter [CylSmall] = angle_inter [CylBig] = 0; + angle_intermed = angle_inter [CylSmall] = angle_inter [CylBig] = 0; at_right = at_left = true; is_filled = false; + grid_geom = NULL; } // ====================================================== resize void CrossElements::resize () @@ -75,7 +71,7 @@ void CrossElements::resize () nbr_vertex1 = size_vx*size_vy* size_v1z; nbr_quads1 = nbr_vertex1*DIM3; nbr_edges1 = nbr_quads1; - nbr_hexas1 = size_hx * size_hy * size_h1z; + nbr_hexas1 = size_hx * size_hy * size_h1z; nbr_vertex = nbr_vertex1 + size_vx * size_vy * size_v1z; nbr_quads = nbr_vertex*DIM3; @@ -95,10 +91,10 @@ void CrossElements::resize () // ====================================================== indHexa int CrossElements::indHexa (int cyl, int nx, int ny, int nz) { - if (cyl<0 || cyl>1) + if (cyl<0 || cyl>1) return NOTHING; - if ( nx < 0 || nx >= size_hx || ny < 0 || ny >= size_hy - || nz < 0 || nz >= size_hz[cyl]) return NOTHING; + if ( nx < 0 || nx >= size_hx || ny < 0 || ny >= size_hy + || nz < 0 || nz >= size_hz[cyl]) return NOTHING; int nro = cyl*nbr_hexas1 + nx + size_hx*ny + size_hx*size_hy*nz; return nro; @@ -106,12 +102,12 @@ int CrossElements::indHexa (int cyl, int nx, int ny, int nz) // ====================================================== indQuad int CrossElements::indQuad (int cyl, int dd, int nx, int ny, int nz) { - if (cyl<0 || cyl>1 || dd <0 || dd >= DIM3) + if (cyl<0 || cyl>1 || dd <0 || dd >= DIM3) return NOTHING; - if ( nx < 0 || nx >= size_vx || ny < 0 || ny >= size_vy - || nz < 0 || nz >= size_vz[cyl]) return NOTHING; + if ( nx < 0 || nx >= size_vx || ny < 0 || ny >= size_vy + || nz < 0 || nz >= size_vz[cyl]) return NOTHING; - int nro = cyl*nbr_quads1 + nx + size_vx*ny + size_vx*size_vy*nz + int nro = cyl*nbr_quads1 + nx + size_vx*ny + size_vx*size_vy*nz + size_vx*size_vy*size_vz[cyl]*dd; return nro; } @@ -123,10 +119,10 @@ int CrossElements::indEdge (int cyl, int dd, int nx, int ny, int nz) // ====================================================== indVertex int CrossElements::indVertex (int cyl, int nx, int ny, int nz) { - if (cyl<0 || cyl>1) + if (cyl<0 || cyl>1) return NOTHING; - if ( nx < 0 || nx >= size_vx || ny < 0 || ny >= size_vy - || nz < 0 || nz >= size_vz[cyl]) + if ( nx < 0 || nx >= size_vx || ny < 0 || ny >= size_vy + || nz < 0 || nz >= size_vz[cyl]) return NOTHING; int nro = cyl*nbr_vertex1 + nx + size_vx*ny + size_vx*size_vy*nz; @@ -139,7 +135,7 @@ Hexa* CrossElements::getHexaIJK (int cyl, int nx, int ny, int nz) int nro = indHexa (cyl, nx, ny, nz); if (nro >= 0 && tab_hexa[nro]!= NULL && tab_hexa[nro]->isHere ()) - return tab_hexa [nro]; + return tab_hexa [nro]; else return NULL; } @@ -150,7 +146,7 @@ Quad* CrossElements::getQuadIJ (int cyl, int nx, int ny, int nz) if (nro<0) return NULL; - return tab_quad [nro]; + return tab_quad [nro]; } // ====================================================== getQuadJK Quad* CrossElements::getQuadJK (int cyl, int nx, int ny, int nz) @@ -158,7 +154,7 @@ Quad* CrossElements::getQuadJK (int cyl, int nx, int ny, int nz) int nro = indQuad (cyl, dir_x, nx, ny, nz); if (nro<0) return NULL; - return tab_quad [nro]; + return tab_quad [nro]; } // ====================================================== getQuadIK Quad* CrossElements::getQuadIK (int cyl, int nx, int ny, int nz) @@ -166,7 +162,7 @@ Quad* CrossElements::getQuadIK (int cyl, int nx, int ny, int nz) int nro = indQuad (cyl, dir_y, nx, ny, nz); if (nro<0) return NULL; - return tab_quad [nro]; + return tab_quad [nro]; } // ====================================================== getEdgeI Edge* CrossElements::getEdgeI (int cyl, int nx, int ny, int nz) @@ -174,7 +170,7 @@ Edge* CrossElements::getEdgeI (int cyl, int nx, int ny, int nz) int nro = indEdge (cyl, dir_x, nx, ny, nz); if (nro<0) return NULL; - return tab_edge [nro]; + return tab_edge [nro]; } // ====================================================== getEdgeJ Edge* CrossElements::getEdgeJ (int cyl, int nx, int ny, int nz) @@ -182,7 +178,7 @@ Edge* CrossElements::getEdgeJ (int cyl, int nx, int ny, int nz) int nro = indEdge (cyl, dir_y, nx, ny, nz); if (nro<0) return NULL; - return tab_edge [nro]; + return tab_edge [nro]; } // ====================================================== getEdgeK Edge* CrossElements::getEdgeK (int cyl, int nx, int ny, int nz) @@ -190,7 +186,7 @@ Edge* CrossElements::getEdgeK (int cyl, int nx, int ny, int nz) int nro = indEdge (cyl, dir_z, nx, ny, nz); if (nro<0) return NULL; - return tab_edge [nro]; + return tab_edge [nro]; } // ====================================================== getVertexIJK Vertex* CrossElements::getVertexIJK (int cyl, int nx, int ny, int nz) @@ -198,7 +194,7 @@ Vertex* CrossElements::getVertexIJK (int cyl, int nx, int ny, int nz) int nro = indVertex (cyl, nx, ny, nz); if (nro<0) return NULL; - return tab_vertex [nro]; + return tab_vertex [nro]; } // ------------------------------------------------------------------------ // ====================================================== setHexa @@ -212,7 +208,7 @@ void CrossElements::setHexa (Hexa* elt, int cyl, int nx, int ny, int nz) } int nro = indHexa (cyl, nx, ny, nz); - if (nro<0) + if (nro<0) return; tab_hexa [nro] = elt; } @@ -227,7 +223,7 @@ void CrossElements::setQuad (Quad* elt, int cyl, int dd, int nx, int ny, int nz) } int nro = indQuad (cyl, dd, nx, ny, nz); - if (nro<0) + if (nro<0) return; tab_quad [nro] = elt; } @@ -242,7 +238,7 @@ void CrossElements::setEdge (Edge* elt, int cyl, int dd, int nx, int ny, int nz) } int nro = indEdge (cyl, dd, nx, ny, nz); - if (nro<0) + if (nro<0) return; tab_edge [nro] = elt; } @@ -257,7 +253,7 @@ void CrossElements::setVertex (Vertex* elt, int cyl, int nx, int ny, int nz) } int nro = indVertex (cyl, nx, ny, nz); - if (nro<0) + if (nro<0) return; tab_vertex [nro] = elt; } @@ -265,11 +261,11 @@ void CrossElements::setVertex (Vertex* elt, int cyl, int nx, int ny, int nz) inline bool isequals (double v1, double v2) { const double eps = 0.01; - bool equals = v1 <= v2 + eps && v1 >= v2 - eps; + bool equals = v1 <= v2 + eps && v1 >= v2 - eps; return equals; } // ====================================================== setVertex (2) -void CrossElements::setVertex (int cyl, int nx, int ny, int nz, double px, +void CrossElements::setVertex (int cyl, int nx, int ny, int nz, double px, double py, double pz) { if (isequals (px, 0) && isequals (py, -1.5) && isequals (pz, 5)) @@ -277,7 +273,7 @@ void CrossElements::setVertex (int cyl, int nx, int ny, int nz, double px, cyl, nx,ny,nz, px,py,pz); int nro = indVertex (cyl, nx, ny, nz); - if (nro<0) + if (nro<0) return; else if (tab_vertex[nro] != NULL) { @@ -288,12 +284,12 @@ void CrossElements::setVertex (int cyl, int nx, int ny, int nz, double px, printf (" ************ ATTENTION ****************\n"); printf (" Creation d'un vertex : Cyl%d [%d,%d,%d] = (%g,%g,%g)\n", cyl, nx,ny,nz, px,py,pz); - printf (" Indice %d deja occupe par le vertex (%g,%g,%g)\n", nro, + printf (" Indice %d deja occupe par le vertex (%g,%g,%g)\n", nro, node->getX(), node->getY(), node->getZ()); return; } - + int trouve = findVertex (px, py, pz); if (trouve>=0) { @@ -307,11 +303,11 @@ void CrossElements::setVertex (int cyl, int nx, int ny, int nz, double px, setVertex (node, cyl, nx, ny, nz); } // ====================================================== copyEdge -void CrossElements::copyEdge (int d1, int i1, int j1, int k1, int d2, int i2, +void CrossElements::copyEdge (int d1, int i1, int j1, int k1, int d2, int i2, int j2, int k2) { Edge* edge = NULL; - switch (d1) + switch (d1) { case dir_x : edge = getEdgeI (CylSmall, i1, j1, k1); break; @@ -324,11 +320,11 @@ void CrossElements::copyEdge (int d1, int i1, int j1, int k1, int d2, int i2, setEdge (edge, CylBig, d2, i2, j2, k2); } // ====================================================== copyQuad -void CrossElements::copyQuad (int d1, int i1, int j1, int k1, int d2, int i2, +void CrossElements::copyQuad (int d1, int i1, int j1, int k1, int d2, int i2, int j2, int k2) { Quad* quad = NULL; - switch (d1) + switch (d1) { case dir_x : quad = getQuadJK (CylSmall, i1, j1, k1); break; @@ -341,18 +337,18 @@ void CrossElements::copyQuad (int d1, int i1, int j1, int k1, int d2, int i2, setQuad (quad, CylBig, d2, i2, j2, k2); } // ====================================================== addEdge -Edge* CrossElements::addEdge (Vertex* v1, Vertex* v2, int cyl, int dir, +Edge* CrossElements::addEdge (Vertex* v1, Vertex* v2, int cyl, int dir, int nx, int ny, int nz) { Edge* edge = NULL; if (v1==NULL || v2==NULL) return NULL; - else if (cyl==CylBig) + else if (cyl==CylBig) { edge = findEdge1 (v1, v2); /* ************************************************ - if (edge != NULL) + if (edge != NULL) { printf (" Edge (%d, %d,%d,%d) trouve = ", dir, nx, ny, nz); edge->printName ("\n"); @@ -360,7 +356,7 @@ Edge* CrossElements::addEdge (Vertex* v1, Vertex* v2, int cyl, int dir, ************************************************ */ } - if (edge == NULL) + if (edge == NULL) edge = newEdge (v1, v2); setEdge (edge, cyl, dir, nx, ny, nz); @@ -389,10 +385,10 @@ Hexa* CrossElements::addHexa (Quad* q1, Quad* q2, Quad* q3, Quad* q4, Quad* q5, ************************** */ Hexa* hexa = NULL; - if (cyl==CylBig) + if (cyl==CylBig) hexa = findHexa1 (q1, q2); - if (hexa == NULL) + if (hexa == NULL) hexa = newHexa (q1, q2, q3, q4, q5, q6); else if (db) { @@ -404,14 +400,14 @@ Hexa* CrossElements::addHexa (Quad* q1, Quad* q2, Quad* q3, Quad* q4, Quad* q5, return hexa; } // ====================================================== addQuad -Quad* CrossElements::addQuad (Edge* e1, Edge* e2, Edge* e3, Edge* e4, int cyl, +Quad* CrossElements::addQuad (Edge* e1, Edge* e2, Edge* e3, Edge* e4, int cyl, int dir, int nx, int ny, int nz) { Quad* quad = NULL; - if (cyl==CylBig) + if (cyl==CylBig) quad = findQuad1 (e1, e3); - if (quad == NULL) + if (quad == NULL) quad = newQuad (e1, e2, e3, e4); else if (db) { @@ -482,7 +478,7 @@ void CrossElements::fillGrid (int cyl, int deb, int fin) Edge* e3 = getEdgeI (cyl, nx, ny1, nz); Edge* e4 = getEdgeJ (cyl, nx, ny, nz); - addQuad (e1, e2, e3, e4, cyl, dir_z, nx, ny, nz); + addQuad (e1, e2, e3, e4, cyl, dir_z, nx, ny, nz); } if (nz>0) @@ -499,7 +495,7 @@ void CrossElements::fillGrid (int cyl, int deb, int fin) Edge* e2 = getEdgeI (cyl, nx, ny, nz); Edge* e3 = getEdgeK (cyl, nx, ny, nz-1); - addQuad (e0, edge, e2, e3, cyl, dir_y, nx, ny, nz-1); + addQuad (e0, edge, e2, e3, cyl, dir_y, nx, ny, nz-1); } // Cloisons exterieures *** for (int ny=0 ; nygetPoint (pnt1); - v_n->getPoint (pnt2); + v_s->getPoint (pnt1); + v_n->getPoint (pnt2); double rayon = calc_distance (pnt1, pnt2)/2; - for (int nro=0 ; nroaddCircle (center, rayon, normal, base); for (int ny=0 ; nysetBounds (angle1*UnSur2pi, angle2*UnSur2pi); - edge ->addAssociation (shape); - - Vertex* node = getVertexIJK (cyl, nx, ny, nz); - geom_asso_point (angle1*rayon, node); + grid_geom->addAssociation (edge, subid, angle1*UnSur2pi, angle2*UnSur2pi); - int ny1 = ny+1; - if (ny1>=S_MAXI) - ny1 = 0; + // Assurer avec les vertex + int ny2 = ny>=S_MAXI-1 ? 0 : ny+1; + Vertex* node1 = getVertexIJK (cyl, nx, ny, nz); + Vertex* node2 = getVertexIJK (cyl, nx, ny2, nz); - node = getVertexIJK (cyl, nx, ny1, nz); - geom_asso_point (angle2*rayon, node); + grid_geom->addAssociation (node1, subid, angle1*UnSur2pi); + grid_geom->addAssociation (node2, subid, angle2*UnSur2pi); +} +// ====================================================== getAngleInter +// ==== Angle intersection intermediaire +double CrossElements::getAngleInter (int cyl, int nz) +{ + if (cyl==CylBig && (nz==1 || nz==3)) + return angle_intermed; + else + return angle_inter[cyl]; } // ====================================================== getAngle -double CrossElements::getAngle (int cyl, int nj) +double CrossElements::getAngle (int cyl, int nj, int nz) { switch (nj) { @@ -795,7 +794,7 @@ void CrossElements::addVertex (int cyl, int ni, int nj, int nk, double px, rayon = cross_rayon [cyl][ni]; double theta = getAngle (cyl, nj); - if (cyl==CylSmall) + if (cyl==CylSmall) setVertex (cyl, ni, nj, nk, px, rayon*cos(theta), rayon*sin(theta)); else setVertex (cyl, ni, nj, nk, rayon*cos(theta), rayon*sin(theta), px); diff --git a/src/HEXABLOCK/HexCrossElements.hxx b/src/HEXABLOCK/HexCrossElements.hxx index 07d31ea..46c8525 100755 --- a/src/HEXABLOCK/HexCrossElements.hxx +++ b/src/HEXABLOCK/HexCrossElements.hxx @@ -33,7 +33,7 @@ enum { MiddleSlice1=NbrSlices1/2}; enum { Cyl1=CylSmall, Cyl2=CylBig }; enum { NO_CYL=-1, NO_PIPE=0, IS_HERE=1 }; -class CrossElements : public Elements +class CrossElements : public Elements { public: virtual int countHexa () { return nbr_hexas ; } @@ -62,7 +62,7 @@ public: void dumpHexas (); private : - + void resize (); void fillGrid (int cyl, int deb=-1, int fin=-1); void fillCenter (int cyl, int deb, int fin); @@ -73,7 +73,7 @@ private : void copyEdge (int d1, int i, int j, int k, int d2, int i2, int j2, int k2); void copyQuad (int d1, int i, int j, int k, int d2, int i2, int j2, int k2); - void setVertex (int cyl, int nx, int ny, int nz, double px, double py, + void setVertex (int cyl, int nx, int ny, int nz, double px, double py, double pz); void setVertex (Vertex* vv, int cyl, int nx, int ny, int nz); @@ -81,9 +81,9 @@ private : void setQuad (Quad* quad, int cyl, int dir, int nx, int ny, int nz); void setHexa (Hexa* cell, int cyl, int nx, int ny, int nz); - Edge* addEdge (Vertex* v1, Vertex* v2, int cyl, int dir, int nx, + Edge* addEdge (Vertex* v1, Vertex* v2, int cyl, int dir, int nx, int ny, int nz); - Quad* addQuad (Edge* e1, Edge* e2, Edge* e3, Edge* e4, int cyl, int dir, + Quad* addQuad (Edge* e1, Edge* e2, Edge* e3, Edge* e4, int cyl, int dir, int nx, int ny, int nz); Hexa* addHexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe, Quad* qf, int cyl, int nx, int ny, int nz); @@ -99,12 +99,15 @@ private : void assoCylinder (int cyl, double* normal); void assoSlice (int cyl, double* base, double* norm, int nx, int zlice); - void assoArc (int cyl, int nx, int ny, int nz, string& brep, double ray); + void assoArc (int cyl, int nx, int ny, int nz, int subid); + void assoArcMid (double mid[], int nx, int ny, int nz, double ray, int subid); void assoBigMiddle (double* base, double* normal, int nzlice); int assoIntersection (int nx, int nzlice, double* snorm, double* bnorm); + void adjustAsso (int nx, int ny, int nz, int sens); - double getAngle (int cyl, int ny); + double getAngle (int cyl, int ny, int nz=0); + double getAngleInter (int cyl, int nz); void addSlice (int cyl, int ni, int nk, double px, double rayon=-1); void addVertex (int cyl, int ni, int nj, int nk, double px, double rayon); void majIntersection (); @@ -123,12 +126,14 @@ private : int size_vz[BiCyl], size_hz[BiCyl]; int nbr_hexas1, nbr_quads1, nbr_edges1, nbr_vertex1; - double angle_inter [BiCyl]; + double angle_inter [BiCyl]; + double angle_intermed; double cross_rayon [BiCyl][SizeRay]; double big_hauteur [size_v2z]; bool at_right, at_left; int cyl_right, cyl_left; + NewShape* grid_geom; }; END_NAMESPACE_HEXA #endif diff --git a/src/HEXABLOCK/HexCrossElements_build.cxx b/src/HEXABLOCK/HexCrossElements_build.cxx index 709ec72..e866a94 100755 --- a/src/HEXABLOCK/HexCrossElements_build.cxx +++ b/src/HEXABLOCK/HexCrossElements_build.cxx @@ -30,7 +30,10 @@ #include "HexGlobale.hxx" #include "HexCylinder.hxx" -#include "HexShape.hxx" +#include "HexNewShape.hxx" +#include "HexBiCylinderShape.hxx" +#include "HexAssoEdge.hxx" +#include "HexEdgeShape.hxx" static bool db = false; @@ -38,20 +41,9 @@ BEGIN_NAMESPACE_HEXA static const int MaxLevel = 7; static const double epaiss2 = 0.5; -static const double UnSur2pi = DEMI/M_PI; +static const double UnSur2pi = DEMI/M_PI; -double calcul_centre (Vertex* orig, Vertex* inter); - -void geom_define_line (string& brep); -void geom_asso_point (double angle, Vertex* node); - -void geom_create_circle (double* milieu, double rayon, double* normale, - double* base, string& brep); -int geom_create_cylcyl (double* borig, double* bnorm, double* bbase, - double bray, double bhaut, - double* sorig, double* snorm, double* sbase, - double sray, double shaut); -int geom_asso_cylcyl (Edge* edge); +double calcul_centre (Vertex* orig, Vertex* inter); // ====================================================== createBigCyl void CrossElements::createBigCyl () @@ -95,7 +87,7 @@ void CrossElements::createBigCyl () //------------------------------- Reprise des vertex du cylindre 1 //------------------------------- Centre - if (grid_type != GR_BIPIPE) + if (grid_type != GR_BIPIPE) copyVertex (NxExt, S_S, 3, iv0, 0, k1); //------------------------------- Creation Vertex Nord-Sud @@ -106,7 +98,7 @@ void CrossElements::createBigCyl () setVertex (CylBig, NxInt, S_N, nk, xi1, yi1, big_hauteur[nk]); setVertex (CylBig, NxInt, S_S, nk, xi2, yi2, big_hauteur[nk]); } - + //------------------------------- Face k1 externe : copyVertex (NxExt, S_S, 5, NxExt, S_E, k1); @@ -165,7 +157,7 @@ void CrossElements::createBigCyl () // ------------------------------------------------------------ //------------------------------- Centre - if (grid_type != GR_BIPIPE) + if (grid_type != GR_BIPIPE) copyVertex (NxExt, S_N, 3, iv0, 0, k3); //------------------------------- Face k3 externe : @@ -192,7 +184,7 @@ void CrossElements::createBigCyl () //------------------------------- Remplissage - if (grid_type == GR_BIPIPE) + if (grid_type == GR_BIPIPE) { for (int nj=0; njgetHeight () -c1 }; - double rm = ( cross_rayon [CylSmall][NxExt] - + cross_rayon [CylSmall][NxInt]) / 2; + double rm = ( cross_rayon [CylSmall][NxExt] + + cross_rayon [CylSmall][NxInt]) / 2; double rc = cross_rayon [CylBig] [NxInt]; - double t_rayext [MaxLevel] = { -1, -1, rm, rc, rm, -1, -1 }; + double t_rayext [MaxLevel] = { -1, -1, rm, rc, rm, -1, -1 }; /* ******************************************************************* int nkdeb = at_left ? 0 : size_v1z/2; @@ -257,8 +249,8 @@ void CrossElements::createLittleCyl () for (int nk = nkdeb ; nkinterCylinder (cross_cyl1, at_left, at_right); if (cross_center==NULL) + { + setError (HERR); return HERR; + } if (at_left) cyl_left = IS_HERE; else if (grid_type == GR_BIPIPE) cyl_left = NO_PIPE; @@ -302,7 +297,7 @@ int CrossElements::crossCylinders (Cylinder* lun, Cylinder* lautre, bool fill) double cross_igray1 = cross_gray1 * epaiss2; double cross_igray2 = cross_gray2 * epaiss2; - if (db) + if (db) { HexDisplay (cross_gray1); HexDisplay (cross_gray2); @@ -311,7 +306,8 @@ int CrossElements::crossCylinders (Cylinder* lun, Cylinder* lautre, bool fill) } angle_inter [CylSmall] = M_PI/6; - angle_inter [CylBig] = asin (cross_gray1/cross_gray2); + angle_inter [CylBig] = asin (cross_gray1/cross_gray2); + angle_intermed = angle_inter [CylBig]; cross_rayon [CylSmall] [0] = cross_rayon [CylBig] [0] = 0; @@ -323,22 +319,42 @@ int CrossElements::crossCylinders (Cylinder* lun, Cylinder* lautre, bool fill) createLittleCyl (); createBigCyl (); + Vertex* node = NULL; + double h1=0, h3=0, dx=1 , dy=1; if (cyl_left!=NO_PIPE) { adjustLittleSlice (NxExt, 1, NxExt); adjustLittleSlice (NxInt, 1, NxExt); - if (grid_type == GR_BIPIPE) + if (grid_type == GR_BIPIPE) adjustLittleSlice (NxInt, 2, NxInt); + dx = getVertexIJK (CylBig, NxExt, S_NW, 1)->getX(); + dy = getVertexIJK (CylBig, NxExt, S_NW, 1)->getY(); + h1 = getVertexIJK (CylBig, NxExt, S_NW, 1)->getZ(); + h3 = getVertexIJK (CylBig, NxExt, S_NW, 3)->getZ(); } if (cyl_right!=NO_PIPE) { adjustLittleSlice (NxExt, 5, NxExt); adjustLittleSlice (NxInt, 5, NxExt); - if (grid_type == GR_BIPIPE) + if (grid_type == GR_BIPIPE) adjustLittleSlice (NxInt, 4, NxInt); + dx = -getVertexIJK (CylBig, NxExt, S_NE, 1)->getX(); + dy = getVertexIJK (CylBig, NxExt, S_NE, 1)->getY(); + h1 = getVertexIJK (CylBig, NxExt, S_NE, 1)->getZ(); + h3 = getVertexIJK (CylBig, NxExt, S_NE, 3)->getZ(); } + for (int ny=0 ; nysetZ(h1); + getVertexIJK (CylBig, NxExt, ny, 3)->setZ(h3); + } + } + + angle_intermed = atan (dy/dx); Vector* iprim = new Vector (cross_cyl1->getDirection()); Vector* kprim = new Vector (cross_cyl2->getDirection()); Vector* jprim = new Vector (kprim); @@ -352,28 +368,52 @@ int CrossElements::crossCylinders (Cylinder* lun, Cylinder* lautre, bool fill) Real3 snorm, bnorm; iprim->getCoord (snorm); kprim->getCoord (bnorm); + + char name [12]; + sprintf (name, "grid_%02d", el_id); + grid_geom = el_root->addShape (name, SH_INTER); + grid_geom -> openShape(); assoCylinder (CylSmall, snorm); assoCylinder (CylBig, bnorm); + grid_geom -> closeShape(); if (cyl_left == IS_HERE) - { + { assoIntersection (NxExt, 1, snorm, bnorm); - if (grid_type == GR_BIPIPE) - { + if (grid_type == GR_BIPIPE) + { assoIntersection (NxInt, 2, snorm, bnorm); } } if (cyl_right == IS_HERE) - { + { assoIntersection (NxExt, NbrSlices1-1, snorm, bnorm); - if (grid_type == GR_BIPIPE) - { + if (grid_type == GR_BIPIPE) + { assoIntersection (NxInt, NbrSlices1-2, snorm, bnorm); } } - assoResiduelle (); + if (cyl_left == IS_HERE) + { + adjustAsso (NxExt, S_N, 1, V_AVAL); + adjustAsso (NxExt, S_SW, 1, V_AMONT); + + adjustAsso (NxExt, S_N, 3, V_AVAL); + adjustAsso (NxExt, S_SW, 3, V_AMONT); + } + + if (cyl_right == IS_HERE) + { + adjustAsso (NxExt, S_NE, 1, V_AMONT); + adjustAsso (NxExt, S_S, 1, V_AVAL); + + adjustAsso (NxExt, S_NE, 3, V_AMONT); + adjustAsso (NxExt, S_S, 3, V_AVAL); + } + + // assoResiduelle (); return HOK; } // ====================================================== copyVertex @@ -391,26 +431,26 @@ void CrossElements::copyVertex (int i1, int j1, int k1, int i2, int j2, int k2) addVertex (CylBig, i2, j2, k2, hauteur, rayon); } -// ===================================================== assoCylinder +// ===================================================== assoCylinder void CrossElements::assoCylinder (int cyl, double* normal) { Real3 base, vec1, center, east, west, nordest; int nk = 0; - if (cyl==CylSmall && cyl_left == NO_PIPE) + if (cyl==CylSmall && cyl_left == NO_PIPE) nk = size_hz[cyl]; Vertex* v_e = getVertexIJK (cyl, NxExt, S_E , nk); Vertex* v_ne = getVertexIJK (cyl, NxExt, S_NE, nk); Vertex* v_w = getVertexIJK (cyl, NxExt, S_W , nk); - v_e->getPoint (east); - v_w->getPoint (west); + v_e->getPoint (east); + v_w->getPoint (west); calc_vecteur (west, east, base); - for (int nro=0 ; nrogetPoint (nordest); + v_ne->getPoint (nordest); calc_vecteur (center, nordest, vec1); double ps = prod_scalaire (base, vec1); @@ -421,7 +461,7 @@ void CrossElements::assoCylinder (int cyl, double* normal) if (cyl==CylBig || at_left) { assoSlice (cyl, base, normal, NxExt, 0); - if (grid_type == GR_BIPIPE) + if (grid_type == GR_BIPIPE) { assoSlice (cyl, base, normal, NxInt, 0); assoSlice (cyl, base, normal, NxInt, 1); @@ -431,7 +471,7 @@ void CrossElements::assoCylinder (int cyl, double* normal) if (cyl==CylBig || cyl_right == IS_HERE) { assoSlice (cyl, base, normal, NxExt, size_hz[cyl]); - if (grid_type == GR_BIPIPE) + if (grid_type == GR_BIPIPE) { assoSlice (cyl, base, normal, NxInt, size_hz[cyl]); assoSlice (cyl, base, normal, NxInt, size_hz[cyl]-1); @@ -442,18 +482,17 @@ void CrossElements::assoCylinder (int cyl, double* normal) for (int nz=1 ; nz<=3 ; nz++) assoBigMiddle (base, normal, nz); } -// ===================================================== assoBigMiddle +// ===================================================== assoBigMiddle void CrossElements::assoBigMiddle (double* base, double* normal, int nzs) { Real3 center, pnt1, pnt2; - string brep; int nx = NxExt; Vertex* v_n = getVertexIJK (CylBig, nx, S_N , nzs); Vertex* v_s = getVertexIJK (CylBig, nx, S_S , nzs); - v_s->getPoint (pnt1); - v_n->getPoint (pnt2); + v_s->getPoint (pnt1); + v_n->getPoint (pnt2); double rayon = calc_distance (pnt1, pnt2)/2; double alpha = angle_inter [CylBig]; @@ -463,29 +502,28 @@ void CrossElements::assoBigMiddle (double* base, double* normal, int nzs) alpha = asin (h1/cross_rayon[CylBig][NxExt]); } - for (int nro=0 ; nroaddCircle (center, rayon, normal, base); if (cyl_right == NO_PIPE) { - assoArc (CylBig, NxExt, S_SE, nzs, brep, rayon); - assoArc (CylBig, NxExt, S_E, nzs, brep, rayon); + assoArc (CylBig, NxExt, S_SE, nzs, subid); + assoArc (CylBig, NxExt, S_E, nzs, subid); } - assoArc (CylBig, NxExt, S_NE, nzs, brep, rayon); - assoArc (CylBig, NxExt, S_N , nzs, brep, rayon); + assoArc (CylBig, NxExt, S_NE, nzs, subid); + assoArc (CylBig, NxExt, S_N , nzs, subid); if (cyl_left == NO_PIPE) { - assoArc (CylBig, NxExt, S_NW, nzs, brep, rayon); - assoArc (CylBig, NxExt, S_W , nzs, brep, rayon); + assoArc (CylBig, NxExt, S_NW, nzs, subid); + assoArc (CylBig, NxExt, S_W , nzs, subid); } - assoArc (CylBig, NxExt, S_SW, nzs, brep, rayon); - assoArc (CylBig, NxExt, S_S , nzs, brep, rayon); + assoArc (CylBig, NxExt, S_SW, nzs, subid); + assoArc (CylBig, NxExt, S_S , nzs, subid); } // ====================================================== adjustLittleSlice void CrossElements::adjustLittleSlice (int ni, int nk, int nibig) @@ -496,7 +534,7 @@ void CrossElements::adjustLittleSlice (int ni, int nk, int nibig) double grayon2 = cross_rayon[CylBig][nibig] * cross_rayon[CylBig][nibig]; double prayon = cross_rayon[CylSmall][ni]; - + for (int nj=0; njsetZ (pz); } } -// ===================================================== assoIntersection -int CrossElements::assoIntersection (int nxs, int nzs, double* snorm, +// ===================================================== assoIntersection +int CrossElements::assoIntersection (int nxs, int nzs, double* snorm, double* bnorm) { Real3 center; Real3 pse, psw, sorig, sbase; Real3 pbe, pbw, borig, bbase; - string brep; cross_center->getPoint (center); int nz = nzs < MiddleSlice1 ? 0 : NbrSlices1; @@ -541,8 +578,9 @@ int CrossElements::assoIntersection (int nxs, int nzs, double* snorm, double bhaut = calc_distance (center, borig)*2; double* orig = nzs < MiddleSlice1 ? sorig : center; // Pb orientation - int ier = geom_create_cylcyl (borig, bnorm, bbase, brayon, bhaut, - orig, snorm, sbase, srayon, shaut); + BiCylinderShape bicyl_shape (el_root); + int ier = bicyl_shape.defineCyls (borig, bnorm, bbase, brayon, bhaut, + orig, snorm, sbase, srayon, shaut); if (ier != HOK) return ier; @@ -550,15 +588,40 @@ int CrossElements::assoIntersection (int nxs, int nzs, double* snorm, { Vertex* node = getVertexIJK (CylSmall, nxs, ny, nzs); if (node!=NULL) - node->clearAssociation (); + node->clearAssociation (); } for (int ny=S_E ; ny<=S_SE ; ny++) { Edge* edge = getEdgeJ (CylSmall, nxs, ny, nzs); - geom_asso_cylcyl (edge); + bicyl_shape.associate (edge); } return HOK; } +// ===================================================== adjustAsso +void CrossElements::adjustAsso (int nx, int ny, int nz, int sens) +{ + Edge* edge = getEdgeJ (CylBig, nx, ny, nz); + if (edge==NULL) + return; + + Real3 point; + Vertex* vertex = edge->getVertex (sens); + AssoEdge* asso = edge->getAssociation (0); + if (asso==NULL) + return; + + vertex->getPoint (point); + + EdgeShape* line = asso->getEdgeShape (); + double param = line->getParam (point); + + if (param<0) + return; + if (sens==V_AMONT) + asso->setStart (param); + else + asso->setEnd (param); +} END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexCylinder.cxx b/src/HEXABLOCK/HexCylinder.cxx index 95c9e11..9addce8 100644 --- a/src/HEXABLOCK/HexCylinder.cxx +++ b/src/HEXABLOCK/HexCylinder.cxx @@ -23,6 +23,7 @@ #include "HexVertex.hxx" #include "HexVector.hxx" #include "HexXmlWriter.hxx" +#include "HexDocument.hxx" #include @@ -58,7 +59,6 @@ Cylinder::Cylinder(Vertex* b, Vector* v, double r, double h) if (c_radius <= tol || c_height <= tol || norme <= tol) setError (); } - } // ======================================================== rdiffers bool rdiffers (double v1, double v2) diff --git a/src/HEXABLOCK/HexDocument.cxx b/src/HEXABLOCK/HexDocument.cxx index ee4514e..0805102 100755 --- a/src/HEXABLOCK/HexDocument.cxx +++ b/src/HEXABLOCK/HexDocument.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ +// See http://www.salome-platform.org/ // or email : webmaster.salome@opencascade.com #include "HexDocument.hxx" @@ -30,6 +30,7 @@ #include "HexElements.hxx" #include "HexCrossElements.hxx" +#include "HexBiCylinder.hxx" #include "HexVector.hxx" #include "HexCylinder.hxx" @@ -43,35 +44,50 @@ #include "HexXmlTree.hxx" #include "HexGlobale.hxx" #include "HexGroup.hxx" +#include "Hex.hxx" +#include "HexNewShape.hxx" BEGIN_NAMESPACE_HEXA +int Document::doc_number = 0; + // ======================================================== Constructeur -Document::Document (cpchar name) +Document::Document (cpchar name, Hex* dad) { - glob = Globale::getInstance (); + el_name = name; + hex_parent = dad; + glob = Globale::getInstance (); + el_root = this; doc_db = 0; nbr_errors = 0; doc_modified = true; doc_saved = false; - doc_name = name; doc_tolerance = 1e-6; nbr_laws = 0; nbr_propagations = 0; maj_propagation = true; doc_xml = NULL; - doc_shape = NULL; - defaultLaw = addLaw ("DefaultLaw", 0); - nbr_used_hexas = nbr_used_quads = nbr_used_edges = nbr_used_vertex = 0; for (EnumElt type = EL_NONE ; type < EL_MAXI ; type=(EnumElt) (type+1)) { - doc_first_elt [type] = doc_last_elt [type] = new EltBase (); + doc_first_elt [type] = doc_last_elt [type] = new EltBase (); doc_nbr_elt [type] = 0; } + + if (doc_number == 0) + strcpy (doc_ident, "doc"); + else + sprintf (doc_ident, "doc%02d", doc_number); + doc_number++; + + DumpLock; + defaultLaw = addLaw ("DefaultLaw", 0); + DumpRestore; + + addCloud (); } // ======================================================== Destructeur Document::~Document () @@ -82,7 +98,7 @@ Document::~Document () { // printf ("____________________________ Type=%d\n", type); EltBase* next = NULL; - for (EltBase* elt=doc_first_elt [type] ; elt != NULL ; elt=next) + for (EltBase* elt=doc_first_elt [type] ; elt != NULL ; elt=next) { next = elt->next(); delete elt; @@ -92,159 +108,249 @@ Document::~Document () // ======================================================== addVector Vector* Document::addVector (double dx, double dy, double dz) { - Vector* pv = new Vector (this, dx, dy, dz); + DumpStart ("addVector", dx << dy << dz); + Vector* pv = new Vector (this, dx, dy, dz); doc_vector.push_back (pv); + + DumpReturn (pv); return pv; } // ======================================================== addVectorVertices Vector* Document::addVectorVertices (Vertex* va, Vertex* vb) { + DumpStart ("addVectorVertices", va << vb); + Vector* pv = addVector (vb->getX () - va->getX (), vb->getY () - va->getY (), vb->getZ () - va->getZ ()); + + DumpReturn (pv); return pv; } // ======================================================== addVertex Vertex* Document::addVertex (double x, double y, double z) { + DumpStart ("addVertex", x << y << z); + Vertex* pv = new Vertex (this, x, y, z); + DumpReturn (pv); return pv; } // ======================================================== addEdge Edge* Document::addEdge (Vertex* va, Vertex* vb) { - if (va==NULL || vb==NULL) + DumpStart ("addEdge", va << vb ); + + if (va==NULL || vb==NULL) return NULL; Edge* arete = new Edge (va, vb); + DumpReturn (arete); return arete; } -// ======================================================== addEdge (bis) -Edge* Document::addEdge (Vertex* va, Vector* vec) +// ======================================================== addEdgeVector +Edge* Document::addEdgeVector (Vertex* va, Vector* vec) { - Vertex* vb = addVertex (va->getX () + vec->getDx(), - va->getY () + vec->getDy(), + DumpStart ("addEdgeVector", va << vec ); + + Vertex* vb = addVertex (va->getX () + vec->getDx(), + va->getY () + vec->getDy(), va->getZ () + vec->getDz()); Edge* arete = addEdge (va, vb); + DumpReturn (arete); return arete; } // ======================================================== addQuadVertices Quad* Document::addQuadVertices (Vertex* va, Vertex* vb, Vertex* vc, Vertex* vd) { + DumpStart ("addQuadVertices", va << vb << vc << vd ); + Quad* face = new Quad (va, vb, vc, vd); + DumpReturn (face); return face; } // ======================================================== addQuad Quad* Document::addQuad (Edge* ea, Edge* eb, Edge* ec, Edge* ed) { + DumpStart ("addQuad", ea << eb << ec << ed ); + Quad* face = new Quad (ea, eb, ec, ed); + DumpReturn (face); return face; } // ======================================================== addHexaVertices Hexa* Document::addHexaVertices (Vertex* va, Vertex* vb, Vertex* vc, Vertex* vd, Vertex* ve, Vertex* vf, Vertex* vg, Vertex* vh) { + DumpStart ("addHexaVertices", va << vb << vc << vd << ve << vf << vg << vh); + Hexa* pave = new Hexa (va, vb, vc, vd, ve, vf, vg, vh); + DumpReturn (pave); return pave; } // ======================================================== addHexa -Hexa* Document::addHexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe, +Hexa* Document::addHexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe, Quad* qf) { + DumpStart ("addHexa", qa << qb << qc << qd << qe << qf ); + Hexa* pave = new Hexa (qa, qb, qc, qd, qe, qf); + DumpReturn (pave); return pave; } // ======================================================== addCylinder Cylinder* Document::addCylinder (Vertex* b, Vector* d, double r, double h) { + DumpStart ("addCylinder", b << d << r << h); + Cylinder* cyl = new Cylinder (b, d, r, h); doc_cylinder.push_back (cyl); + + DumpReturn (cyl); return cyl; } // ======================================================== addPipe Pipe* Document::addPipe (Vertex* b, Vector* d, double ri, double re, double h) { + DumpStart ("addPipe", b << d << ri << re << h); + Pipe* tuyau = new Pipe (b, d, ri, re, h); doc_pipe.push_back (tuyau); + + DumpReturn (tuyau); return tuyau; } // ======================================================== makeCartesian -Elements* Document::makeCartesian (Vertex* v, Vector* dir, +Elements* Document::makeCartesian (Vertex* v, Vector* dir, int px, int py, int pz, int mx, int my, int mz) { - Vector* v1 = new Vector (this, dir->getDx(), 0, 0); - Vector* v2 = new Vector (this, 0, dir->getDy(), 0); - Vector* v3 = new Vector (this, 0,0, dir->getDz()); + DumpStart ("makeCartesianDiag", v << dir << px << py << pz << mx << my << mz); + + Vector* v1 = new Vector (this, dir->getDx(), 0, 0); + Vector* v2 = new Vector (this, 0, dir->getDy(), 0); + Vector* v3 = new Vector (this, 0,0, dir->getDz()); Elements* grille = new Elements (this); grille->makeCartesianGrid (v, v1, v2, v3, px, py, pz, mx, my, mz); + + DumpReturn (grille); return grille; } // ======================================================== makeCartesian -Elements* Document::makeCartesian (Vertex* v, Vector* v1, Vector* v2, +Elements* Document::makeCartesian (Vertex* v, Vector* v1, Vector* v2, + Vector* v3, int px, int py, int pz) +{ + DumpStart ("makeCartesian", v << v1 << v2 << v3 << px << py << pz); + + Elements* grille = new Elements (this); + grille->makeCartesianGrid (v, v1, v2, v3, px, py, pz); + + DumpReturn (grille); + return grille; +} +// ======================================================== makeCartesian1 +Elements* Document::makeCartesian1 (Vertex* v, Vector* v1, Vector* v2, Vector* v3, int px, int py, int pz, int mx, int my, int mz) { + DumpStart ("makeCartesian1", v << v1 << v2 << v3 << px << py << pz + << mx << my << mz); + Elements* grille = new Elements (this); grille->makeCartesianGrid (v, v1, v2, v3, px, py, pz, mx, my, mz); + + DumpReturn (grille); return grille; } // ======================================================== makeSpherical Elements* Document::makeSpherical (Vertex* c, double rayon, int nb, double k) { + DumpStart ("makeSpherical", c << rayon << nb << k ); + Elements* grille = new Elements (this); grille->makeSphericalGrid (c, rayon, nb, k); + + DumpReturn (grille); return grille; } // ======================================================== makeCylindrical -Elements* Document::makeCylindrical (Vertex* c, Vector* b, Vector* h, +Elements* Document::makeCylindrical (Vertex* c, Vector* b, Vector* h, double dr, double da, double dl, int nr, int na, int nl, bool fill) { + DumpStart ("makeCylindrical", c << b << h << dr << da << dl << nr << na + << nl << fill); + Elements* grille = new Elements (this); grille->makeCylindricalGrid (c, b, h, dr, da, dl, nr, na, nl, fill); + + DumpReturn (grille); return grille; } // ======================================================== makeSphere -Elements* Document::makeSphere (Vertex* center, Vector* vx, Vector* vz, - double radius, double radhole, Vertex* plorig, +Elements* Document::makeSphere (Vertex* center, Vector* vx, Vector* vz, + double radius, double radhole, Vertex* plorig, int nrad, int nang, int nhaut) { + DumpStart ("makeSphere", center << vx << vz << radius << radhole << plorig + << nrad << nang << nhaut); + Elements* grille = new Elements (this); double radint = (radhole + radius)*DEMI; - grille->makeRind (GR_HEMISPHERIC, center, vx, vz, radius, radint, radhole, + grille->makeRind (GR_HEMISPHERIC, center, vx, vz, radius, radint, radhole, plorig, 360.0, nrad, nang, nhaut); + + DumpReturn (grille); return grille; } // ======================================================== makePartSphere -Elements* Document::makePartSphere (Vertex* center, Vector* vx, Vector* vz, +Elements* Document::makePartSphere (Vertex* center, Vector* vx, Vector* vz, double radius, double radhole, Vertex* plorig, double angle, int nrad, int nang, int nhaut) { + DumpStart ("makePartSphere", center << vx << vz + << radius << radhole + << plorig << angle + << nrad << nang << nhaut); + Elements* grille = new Elements (this); double radint = (radhole + radius)*DEMI; - grille->makeRind (GR_PART_SPHERIC, center, vx, vz, radius, radint, radhole, + grille->makeRind (GR_PART_SPHERIC, center, vx, vz, radius, radint, radhole, plorig, angle, nrad, nang, nhaut); + + DumpReturn (grille); return grille; } -// ======================================================== makeRind -Elements* Document::makeRind (Vertex* center, Vector* vx, Vector* vz, +// ======================================================== makeRind +Elements* Document::makeRind (Vertex* center, Vector* vx, Vector* vz, double radext, double radint, double radhole, Vertex* plorig, int nrad, int nang, int nhaut) { + DumpStart ("makeRind", center << vx << vz + << radext << radint << radhole + << plorig << nrad << nang << nhaut); + Elements* grille = new Elements (this); - grille->makeRind (GR_RIND, center, vx, vz, radext, radint, radhole, + grille->makeRind (GR_RIND, center, vx, vz, radext, radint, radhole, plorig, 360.0, nrad, nang, nhaut); + + DumpReturn (grille); return grille; } // ======================================================== makePartRind -Elements* Document::makePartRind (Vertex* center, Vector* vx, Vector* vz, +Elements* Document::makePartRind (Vertex* center, Vector* vx, Vector* vz, double radext, double radint, double radhole, Vertex* plorig, double angle, int nrad, int nang, int nhaut) { + DumpStart ("makePartRind", center << vx << vz + << radext << radint << radhole + << plorig << angle << nrad << nang << nhaut); + Elements* grille = new Elements (this); - grille->makeRind (GR_PART_RIND, center, vx, vz, radext, radint, radhole, + grille->makeRind (GR_PART_RIND, center, vx, vz, radext, radint, radhole, plorig, angle, nrad, nang, nhaut); + + DumpReturn (grille); return grille; } // ======================================================== findVertex @@ -261,8 +367,8 @@ Vertex* Document::findVertex (double vx, double vy, double vz) elt = elt->next()) { if (elt->isHere()) - { - Vertex* node = static_cast (elt); + { + Vertex* node = static_cast (elt); if (node->isin (xmin, xmax, ymin, ymax, zmin, zmax)) return node; } @@ -275,7 +381,7 @@ Edge* Document::findEdge (Vertex* v1, Vertex* v2) for (EltBase* elt = doc_first_elt[EL_EDGE]->next (); elt!=NULL; elt = elt->next()) { - Edge* candidat = static_cast (elt); + Edge* candidat = static_cast (elt); if (candidat->definedBy (v1, v2)) return candidat; } @@ -287,7 +393,7 @@ Quad* Document::findQuad (Vertex* v1, Vertex* v2) for (EltBase* elt = doc_first_elt[EL_QUAD]->next (); elt!=NULL; elt = elt->next()) { - Quad* candidat = static_cast (elt); + Quad* candidat = static_cast (elt); if (candidat->definedBy (v1, v2)) return candidat; } @@ -299,13 +405,12 @@ Hexa* Document::findHexa (Vertex* v1, Vertex* v2) for (EltBase* elt = doc_first_elt[EL_HEXA]->next (); elt!=NULL; elt = elt->next()) { - Hexa* candidat = static_cast (elt); + Hexa* candidat = static_cast (elt); if (candidat->definedBy (v1, v2)) return candidat; } return NULL; } - // ======================================================== findElement EltBase* Document::findElement (EnumElt type, int ident) { @@ -320,7 +425,7 @@ EltBase* Document::findElement (EnumElt type, int ident) // ======================================================== findVertex Vertex* Document::findVertex (int ident) { - Vertex* node = static_cast (findElement (EL_VERTEX, ident)); + Vertex* node = static_cast (findElement (EL_VERTEX, ident)); return node; } @@ -334,29 +439,34 @@ int index_tv (Vertex* table[], Vertex* elt) return NOTHING; } // ======================================================== mergeQuads -int Document::mergeQuads (Quad* dest, Quad* orig, Vertex* v1, Vertex* v2, +int Document::mergeQuads (Quad* dest, Quad* orig, Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4) { + DumpStart ("mergeQuads", dest << orig << v1 << v2 << v3 << v4); + update (); if (dest==orig) { printf (" *** Quads identiques dans mergeQuads\n"); + DumpEnd; return HERR; } else if (dest==NULL || dest->isDeleted()) { printf (" *** Quad nro 1 incorrect dans mergeQuads \n"); + DumpEnd; return HERR; } else if (orig==NULL || orig->isDeleted() ) { printf (" *** Quad nro 2 incorrect dans mergeQuads \n"); + DumpEnd; return HERR; } int nbcomm = 0; - for (int nro=0 ; nroindexVertex (dest->getVertex(nro)); if (norig != NOTHING) @@ -370,7 +480,7 @@ int Document::mergeQuads (Quad* dest, Quad* orig, Vertex* v1, Vertex* v2, printf (" (%s,", dest->getName (nom)); printf (" %s)\n", orig->getName (nom)); } - printf (" +++ quad1[%d] = quad2[%d] = %s\n", nro, norig, + printf (" +++ quad1[%d] = quad2[%d] = %s\n", nro, norig, uv->getName (nom)); } } @@ -379,20 +489,23 @@ int Document::mergeQuads (Quad* dest, Quad* orig, Vertex* v1, Vertex* v2, { printf (" +++ Les vertex passes en arguments sont ignores\n"); int ier = closeQuads (dest, orig); + DumpEnd; return ier; } else if (nbcomm != 0) { printf (" *** _____________________ mergeQuads refuse: \n"); printf (" il y a %d sommet(s) sont commun(s)\n", nbcomm); + DumpEnd; return HERR; } - if ( v1 ==NULL || v1 ->isDeleted() || v2 ==NULL || v2 ->isDeleted() - || v3 ==NULL || v3 ->isDeleted() || v4 ==NULL || v4 ->isDeleted()) + if ( v1 ==NULL || v1 ->isDeleted() || v2 ==NULL || v2 ->isDeleted() + || v3 ==NULL || v3 ->isDeleted() || v4 ==NULL || v4 ->isDeleted()) { printf (" *** _____________________ mergeQuads refuse: \n"); printf (" un sommet est incorrect\n"); + DumpEnd; return HERR; } @@ -413,8 +526,16 @@ int Document::mergeQuads (Quad* dest, Quad* orig, Vertex* v1, Vertex* v2, int ier1 = dest->ordoVertex (v1, v3, tv1); int ier2 = orig->ordoVertex (v2, v4, tv2); - if (ier1 != HOK) return ier1; - else if (ier2 != HOK) return ier2; + if (ier1 != HOK) + { + DumpEnd; + return ier1; + } + else if (ier2 != HOK) + { + DumpEnd; + return ier2; + } for (int nro=0 ; nrofindEdge (tv2[na], tv2[nb]); if (te2[nro]==NULL) + { + DumpEnd; return HERR; + } } if (debug()) @@ -453,53 +580,61 @@ int Document::mergeQuads (Quad* dest, Quad* orig, Vertex* v1, Vertex* v2, } replaceQuad (orig, dest); - for (int nro=0 ; nrogetName(nom)); + DumpEnd; return HERR; } else if (dest==NULL || dest->isDeleted()) { printf (" *** Quad nro 1 incorrect dans closeQuads \n"); + DumpEnd; return HERR; } else if (orig==NULL || orig->isDeleted() ) { printf (" *** Quad nro 2 incorrect dans closeQuads \n"); + DumpEnd; return HERR; } Edge* edc = NULL; - for (int nro=0 ; nroindexEdge (dest->getEdge(nro)); if (norig != NOTHING) { - if (edc != NULL) + if (edc != NULL) { printf (" *** Plus d'une arete commune dans closeQuads"); printf (" (%s,", dest->getName (nom)); printf (" %s)\n", orig->getName (nom)); + DumpEnd; return HERR; } edc = dest->getEdge (nro); - printf (" +++ quad1[%d] = quad2[%d] = %s\n", nro, norig, + printf (" +++ quad1[%d] = quad2[%d] = %s\n", nro, norig, edc->getName (nom)); } } @@ -512,8 +647,16 @@ int Document::closeQuads (Quad* dest, Quad* orig) int ier1 = dest->ordoVertex (va, vb, tv1); int ier2 = orig->ordoVertex (va, vb, tv2); - if (ier1 != HOK) return ier1; - else if (ier2 != HOK) return ier2; + if (ier1 != HOK) + { + DumpEnd; + return ier1; + } + else if (ier2 != HOK) + { + DumpEnd; + return ier2; + } for (int nro=0 ; nrofindEdge (tv2[na], tv2[nb]); if (te2[nro]==NULL) + { + DumpEnd; return HERR; + } } if (debug()) @@ -552,59 +701,88 @@ int Document::closeQuads (Quad* dest, Quad* orig) } replaceQuad (orig, dest); - for (int nro=0 ; nroisDeleted() || e2==NULL || e2->isDeleted()) + DumpStart ("mergeEdges", e1 << e2 << v1 << v2); + + if (e1==NULL || e1->isDeleted() || e2==NULL || e2->isDeleted()) + { + DumpEnd; return HERR; + } - for (int nro=0 ; nroindex (e2->getVertex(nro))!= NOTHING) + { + DumpEnd; return HERR+nro+1; + } Vertex *tv1 [V_TWO], *tv2 [V_TWO]; int ier1 = e1->anaMerge (v1, tv1); int ier2 = e2->anaMerge (v2, tv2); - if (ier1 != HOK) return ier1; - else if (ier2 != HOK) return ier2; + if (ier1 != HOK) + { + DumpEnd; + return ier1; + } + else if (ier2 != HOK) + { + DumpEnd; + return ier2; + } replaceEdge (e2, e1); - for (int nro=0 ; nroisDeleted() + DumpStart ("mergeVertices", v1 << v2); + + if (v1==v2 || v1==NULL || v1->isDeleted() || v2==NULL || v2->isDeleted()) + { + DumpEnd; return HERR; + } replaceVertex (v2, v1); maj_connection = false; + DumpEnd; return HOK; } // ======================================================== replaceVertex void Document::replaceVertex (Vertex* old, Vertex* par) { - if (old==par) + DumpStart ("replaceVertex", old << par); + if (BadElement(old) || BadElement(par) || old==par) + { + DumpEnd; return; + } - par->replaceAssociation (old); + // par->replaceAssociation (old); TODO for (int type=EL_EDGE ; type <= EL_HEXA ; type++) { @@ -614,14 +792,19 @@ void Document::replaceVertex (Vertex* old, Vertex* par) elt->replaceVertex (old, par); } old->suppress (); + DumpEnd; } // ======================================================== replaceEdge void Document::replaceEdge (Edge* old, Edge* par) { - if (old==par) + DumpStart ("replaceEdge", old << par); + if (BadElement(old) || BadElement(par) || old==par) + { + DumpEnd; return; + } - par->replaceAssociation (old); + // par->replaceAssociation (old); TODO for (int type=EL_QUAD ; type <= EL_HEXA ; type++) { @@ -630,15 +813,21 @@ void Document::replaceEdge (Edge* old, Edge* par) if (elt->isHere ()) elt->replaceEdge (old, par); } + old->suppress (); + DumpEnd; } // ======================================================== replaceQuad void Document::replaceQuad (Quad* old, Quad* par) { - if (old==par) + DumpStart ("replaceQuad", old << par); + if (BadElement(old) || BadElement(par) || old==par) + { + DumpEnd; return; + } - par->replaceAssociation (old); + // par->replaceAssociation (old); TODO for (EltBase* elt = doc_first_elt[EL_HEXA]->next (); elt!=NULL; elt = elt->next()) @@ -650,80 +839,97 @@ void Document::replaceQuad (Quad* old, Quad* par) old->suppress (); } // ======================================================== prismQuad -Elements* Document::prismQuad (Quad* start, Vector* dir, int nb) +Elements* Document::prismQuad (Quad* qstart, Vector* dir, int nb) { + DumpStart ("prismQuad", qstart << dir << nb); + Quads tstart; - tstart.push_back (start); + tstart.push_back (qstart); update (); Elements* prisme = prismQuads (tstart, dir, nb); - return prisme; + + DumpReturn (prisme); + return prisme; } // ======================================================== prismQuads Elements* Document::prismQuads (Quads& tstart, Vector* dir, int nb) { + DumpStart ("prismQuads", tstart << dir << nb); + Elements* prisme = new Elements (this); - if (nb<=0) return prisme; prisme->prismQuads (tstart, dir, nb); + + DumpReturn (prisme); return prisme; } // ======================================================== prismQuadsVec Elements* Document::prismQuadsVec (Quads& tstart, Vector* dir, RealVector& tlen, int crit) { + DumpStart ("prismQuadVec", tstart << dir << tlen << crit); Elements* prisme = new Elements (this); if (tlen.size()<=0) return prisme; prisme->prismQuadsVec (tstart, dir, tlen, crit); + + DumpReturn (prisme); return prisme; } // ======================================================== joinQuads -Elements* Document::joinQuads (Quads& start, Quad* dest, Vertex* v1, - Vertex* v2, Vertex* v3, Vertex* v4, int nb) +Elements* Document::joinQuads (Quads& tstart, Quad* dest, Vertex* v1, + Vertex* v2, Vertex* v3, Vertex* v4, int nb) { + DumpStart ("joinQuads", tstart << dest << v1 << v2 << v3 << v4 << nb); update (); Elements* joint = new Elements (this); if (nb<=0) return joint; - int ier = joint->joinQuads (start, nb, v1, v2, v3, v4, dest); + int ier = joint->joinQuads (tstart, nb, v1, v2, v3, v4, dest); if (ier !=HOK) printf ("\n ****\n **** Error in joinQuad(s)\n ****\n"); + + DumpReturn (joint); return joint; } // ======================================================== joinQuad -Elements* Document::joinQuad (Quad* start, Quad* dest, Vertex* v1, +Elements* Document::joinQuad (Quad* qstart, Quad* dest, Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4, int nb) { + DumpStart ("joinQuad", qstart << dest << v1 << v2 << v3 << v4 << nb); + Quads tstart; - tstart.push_back (start); + tstart.push_back (qstart); Elements* joint = joinQuads (tstart, dest, v1, v2, v3, v4, nb); + + DumpReturn (joint); return joint; } // ========================================================== getHexa -Hexa* Document::getHexa (int nro) +Hexa* Document::getHexa (int nro) { return static_cast (getElement (EL_HEXA, nro)); } // ========================================================== getQuad -Quad* Document::getQuad (int nro) +Quad* Document::getQuad (int nro) { return static_cast (getElement (EL_QUAD, nro)); } // ========================================================== getEdge -Edge* Document::getEdge (int nro) -{ +Edge* Document::getEdge (int nro) +{ return static_cast (getElement (EL_EDGE, nro)); } // ========================================================== getVertex -Vertex* Document::getVertex (int nro) -{ - return static_cast (getElement (EL_VERTEX, nro)); +Vertex* Document::getVertex (int nro) +{ + return static_cast (getElement (EL_VERTEX, nro)); } // ========================================================== countElement int Document::countElement (EnumElt type) -{ +{ int compteur = 0; for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL; elt = elt->next()) @@ -733,8 +939,8 @@ int Document::countElement (EnumElt type) return compteur; } // ========================================================== getElement -EltBase* Document::getElement (EnumElt type, int nro) -{ +EltBase* Document::getElement (EnumElt type, int nro) +{ int compteur = 0; for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL; elt = elt->next()) @@ -750,20 +956,23 @@ EltBase* Document::getElement (EnumElt type, int nro) } // ========================================================= addLaw Law* Document::addLaw (const char* name, int nbnodes) -{ - Law* loi = new Law (name, nbnodes); - return addLaw (loi); +{ + DumpStart ("addLaw", name << nbnodes); + Law* loi = new Law (this, name, nbnodes); + addLaw (loi); + DumpReturn (loi); + return loi; } // ========================================================= addLaw Law* Document::addLaw (Law* loi) -{ +{ doc_laws.push_back (loi); nbr_laws ++; return loi; } // ========================================================= GetLaw Law* Document::getLaw (int nro) -{ +{ if (nro <0 || nro>= nbr_laws) return NULL; @@ -771,8 +980,8 @@ Law* Document::getLaw (int nro) } // ========================================================= FindLaw Law* Document::findLaw (const char* name) -{ - std::string nom = name; +{ + string nom = name; for (int nro=0 ; nrogetName() == nom) return doc_laws [nro]; @@ -781,29 +990,29 @@ Law* Document::findLaw (const char* name) } // ========================================================= removeLaw int Document::removeLaw (Law* loi) -{ +{ for (int nro=1 ; nrogetLaw() == loi ) - doc_propagation [nl]->setLaw(defaultLaw); - } + if ( doc_propagation [nl]->getLaw() == loi ) + doc_propagation [nl]->setLaw(defaultLaw); + } - delete doc_laws [nro]; - doc_laws.erase (doc_laws.begin()+nro); - nbr_laws= doc_laws.size(); - return HOK; - } + delete doc_laws [nro]; + doc_laws.erase (doc_laws.begin()+nro); + nbr_laws = doc_laws.size(); + return HOK; + } return HERR; } // ========================================================= majPropagation void Document::majPropagation () -{ +{ + DumpLock; majReferences (); update (); // if (purge_elements) @@ -839,15 +1048,16 @@ void Document::majPropagation () Edge* arete = cell->getEdge(ne); if (arete->getPropag()<0) { - Propagation* prop = new Propagation (); + Propagation* prop = new Propagation (); doc_propagation.push_back (prop); arete->propager (prop, nbr_propagations); nbr_propagations ++; - prop->majLaw(); + prop->majLaw(); } } } } + DumpRestore; } // ======================================================== countPropagation int Document::countPropagation () @@ -871,7 +1081,7 @@ Propagation* Document::getPropagation (int nro) // ======================================================== findPropagation Propagation* Document::findPropagation (Edge* arete) { - if (arete==NULL) + if (arete==NULL) return NULL; if (maj_propagation) @@ -882,13 +1092,13 @@ Propagation* Document::findPropagation (Edge* arete) // ======================================================== disconnectQuad Elements* Document::disconnectQuad (Hexa* cell, Quad* element) { - if (cell==NULL || element==NULL) + if (cell==NULL || element==NULL) return NULL; update (); Elements* crees = cell->disconnectQuad (element); - if (crees!=NULL) + if (crees!=NULL) majReferences (); return crees; @@ -896,7 +1106,7 @@ Elements* Document::disconnectQuad (Hexa* cell, Quad* element) // ======================================================== disconnectEdge Elements* Document::disconnectEdge (Hexa* cell, Edge* element) { - if (cell==NULL || element==NULL) + if (cell==NULL || element==NULL) return NULL; update (); @@ -909,13 +1119,13 @@ Elements* Document::disconnectEdge (Hexa* cell, Edge* element) // ======================================================== disconnectVertex Elements* Document::disconnectVertex (Hexa* cell, Vertex* element) { - if (cell==NULL || element==NULL) + if (cell==NULL || element==NULL) return NULL; update (); Elements* crees = cell->disconnectVertex (element); - if (crees!=NULL) + if (crees!=NULL) majReferences (); return crees; } @@ -936,18 +1146,18 @@ Elements* Document::cut (Edge* edge, int nbcuts) return t_hexas; } // ======================================================== addGroup -Group* Document::addGroup (cpchar name, EnumGroup kind) +Group* Document::addGroup (cpchar name, EnumGroup kind) { Group* grp = new Group (name, kind); doc_group.push_back (grp); return grp; } // ======================================================== findGroup -Group* Document::findGroup (cpchar name) +Group* Document::findGroup (cpchar name) { int nbre = doc_group.size(); - for (int ng=0 ; nggetName(), name)) return doc_group [ng]; @@ -957,7 +1167,7 @@ Group* Document::findGroup (cpchar name) int Document::removeGroup (Group* grp) { int nbre = doc_group.size(); - for (int ng=0 ; ngmakeCylinder (cyl, base, nr, na, nl); + + DumpReturn (grille); return grille; } // ======================================================== makeCylinders CrossElements* Document::makeCylinders (Cylinder* cyl1, Cylinder* cyl2) { + DumpStart ("makeCylinders", cyl1 << cyl2 ); + CrossElements* grille = new CrossElements (this, GR_BICYL); grille->crossCylinders (cyl1, cyl2, true); + + DumpReturn (grille); return grille; } // ======================================================== makePipe Elements* Document::makePipe (Pipe* pipe, Vector* bx, int nr, int na, int nl) { + DumpStart ("makePipe", + pipe << bx << nr << na << nl); + Elements* grille = new Elements (this); grille->makePipe (pipe, bx, nr, na, nr); + + DumpReturn (grille); return grille; } // ======================================================== makePipes CrossElements* Document::makePipes (Pipe* pipe1, Pipe* pipe2) { + DumpStart ("makePipes", + pipe1 << pipe2); + CrossElements* grille = new CrossElements (this, GR_BIPIPE); grille->crossCylinders (pipe1, pipe2, false); + + DumpReturn (grille); return grille; } // ======================================================== setName -int Document::setName (const char* name) +int Document::setName (cpchar prefix) { - doc_name = name ; + if (Cestvide (prefix) || el_name==prefix) + return HERR; + + string name = prefix; + if (hex_parent != NULL) + hex_parent->makeName (prefix, name); + + el_name = name; return HOK ; } - // ======================================================== setLevel #ifdef NO_CASCADE @@ -1020,7 +1255,15 @@ void set_debug_asso (bool boule); void Document::setLevel (int niv) { if (niv == 747) - clearAssociation (); + checkAssociations (); + else if (niv == 748) + { + int nbshapes = countShape (); + for (int nsh=0 ; nsh < nbshapes ; nsh++) + { + doc_tab_shape[nsh]->saveBrep(); + } + } else if (niv == 777) set_special_option (true); else if (niv == 778) @@ -1035,6 +1278,7 @@ void Document::setLevel (int niv) set_debug_asso (niv>0); } } +#if 0 // ======================================================== getAssoVertices void Document::getAssoVertices (Vertices& tabelt) { @@ -1042,7 +1286,7 @@ void Document::getAssoVertices (Vertices& tabelt) for (EltBase* elt = doc_first_elt[EL_VERTEX]->next (); elt!=NULL; elt = elt->next()) if (elt->isHere() && elt->getAssociation()!=NULL) - tabelt.push_back (static_cast (elt)); + tabelt.push_back (static_cast (elt)); } // ======================================================== getAssoEdges void Document::getAssoEdges (Edges& tabelt) @@ -1051,11 +1295,113 @@ void Document::getAssoEdges (Edges& tabelt) for (EltBase* elt = doc_first_elt[EL_EDGE]->next (); elt!=NULL; elt = elt->next()) if (elt->isHere()) - { - Edge* edge = static_cast (elt); + { + Edge* edge = static_cast (elt); int nbass = edge->getAssociations().size(); if (nbass>0) tabelt.push_back (edge); } } +#endif +// ======================================================== makeVarName +char* Document::makeVarName (char* name) +{ + strcpy (name, doc_ident); + return doc_ident ; +} +// ======================================================== isEmpty +bool Document::isEmpty () +{ + int nombre = countVertex () + countVector () + + countCylinder() + countPipe(); + return nombre <= 0 && countLaw () <= 1; +} +// ======================================================== getNextName +cpchar Document::getNextName (EnumElt type, string& buff) +{ + char name [8]; + EltBase::makeName (type, doc_nbr_elt [type], name); + + buff = name; + return buff.c_str(); +} + +// ======================================================== getNextName +string Document::getNextName (EnumElt type) +{ + char name [8]; + EltBase::makeName (type, doc_nbr_elt [type], name); + + return string(name); +} + +// ======================================================== lockDump +void Document::lockDump () +{ + glob->dump.lock (); +} +// ======================================================== restoreDump +void Document::restoreDump () +{ + glob->dump.restore (DumpActif); +} +// ======================================================== getGroup +Group* Document::getGroup (int nro) +{ + int size = doc_group.size(); + if (nro>=0 && nro=0 && nro=0 && nro=0 && nrocrossCylinders (cyl1, cyl2); + + DumpReturn (grille); + return grille; +} +// ======================================================== makeBiPipe +BiCylinder* Document::makeBiPipe (Pipe* pipe1, Pipe* pipe2) +{ + DumpStart ("makeBiPipe", pipe1 << pipe2); + + BiCylinder* grille = new BiCylinder (this); + grille->crossCylinders (pipe1, pipe2); + + DumpReturn (grille); + return grille; +} END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexDocument.hxx b/src/HEXABLOCK/HexDocument.hxx index 5ec47bd..219e393 100755 --- a/src/HEXABLOCK/HexDocument.hxx +++ b/src/HEXABLOCK/HexDocument.hxx @@ -23,19 +23,23 @@ #ifndef __DOCUMENT_H_ #define __DOCUMENT_H_ -#include "hexa_base.hxx" +#include "HexEltBase.hxx" BEGIN_NAMESPACE_HEXA -class Document +class NewShape; + +class Document : public EltBase { // Fonctions utilisateur public : // Fonctions globales - const char* getName () { return doc_name.c_str() ; } - bool isSaved () { return doc_saved ; } + bool isSaved () { return doc_saved ; } int setName (const char* name); - int save (const char* ficxml); + + int save (const char* ficxml); // Genere le xml dans un seul fichier + int appendXml (pfile fstudy); // Genere le xml dans un fichier ouvert + cpchar getXml (); // Genere le xml et rend un flux int getLevel () { return doc_db ; } void setLevel (int niv); @@ -52,25 +56,30 @@ public : // Creation d'elements Vertex* addVertex (double x=0.0, double y=0.0, double z=0.0); - Edge* addEdge (Vertex* va, Vertex* vb); - Edge* addEdge (Vertex* va, Vector* vec); + Edge* addEdge (Vertex* va, Vertex* vb); + Edge* addEdgeVector (Vertex* va, Vector* vec); + + Edge* addEdge (Vertex* va, Vector* vec) // A supprimer + { return addEdgeVector (va, vec) ; } // (comptibilite) Quad* addQuadVertices (Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4); Quad* addQuad (Edge* v1, Edge* v2, Edge* v3, Edge* v4); - Hexa* addHexaVertices (Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4, + Hexa* addHexaVertices (Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4, Vertex* v5, Vertex* v6, Vertex* v7, Vertex* v8); Hexa* addHexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe, Quad* qf); Vector* addVector (double dx=0.0, double dy=0.0, double dz=0.0); Vector* addVectorVertices (Vertex* va, Vertex* vb); - Elements* makeCartesian (Vertex* v, Vector* v1, - int px, int py, int pz, int mx=0, int my=0, int mz=0); - Elements* makeCartesian (Vertex* v, Vector* v1, Vector* v2, Vector* v3, + Elements* makeCartesian (Vertex* v, Vector* v1, int px, int py, int pz, int mx=0, int my=0, int mz=0); + Elements* makeCartesian (Vertex* v, Vector* v1, Vector* v2, Vector* v3, + int px, int py, int pz); + Elements* makeCartesian1 (Vertex* v, Vector* v1, Vector* v2, Vector* v3, + int px, int py, int pz, int mx, int my, int mz); - Elements* makeCylindrical (Vertex* c, Vector* b, Vector* h, double dr, + Elements* makeCylindrical (Vertex* c, Vector* b, Vector* h, double dr, double da, double dl, int nr, int na, int nl, bool fill=false); // Obsolete @@ -81,9 +90,9 @@ public : Elements* prismQuads (Quads& start, Vector* dv, int nb); Elements* prismQuadsVec (Quads& start, Vector* dv, RealVector& th, int k=0); - Elements* joinQuad (Quad* start, Quad* dest, Vertex* v1, Vertex* v2, + Elements* joinQuad (Quad* start, Quad* dest, Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4, int nb); - Elements* joinQuads (Quads& start, Quad* dest, Vertex* v1, Vertex* v2, + Elements* joinQuads (Quads& start, Quad* dest, Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4, int nb); Cylinder* addCylinder (Vertex* b, Vector* d, double r, double h); @@ -94,6 +103,9 @@ public : Elements* makePipe (Pipe* pip, Vector* vx, int nr, int na, int nl); CrossElements* makePipes (Pipe* pipe1, Pipe* pipe2); + BiCylinder* makeBiCylinder (Cylinder* cyl1, Cylinder* cyl2); + BiCylinder* makeBiPipe (Pipe* pipe1, Pipe* pipe2); + int removeHexa (Hexa* maille); int removeQuad (Quad* maille); int removeConnectedHexa (Hexa* maille); @@ -108,13 +120,13 @@ public : int mergeVertices (Vertex* v1, Vertex* v2); int mergeEdges (Edge* e1, Edge* e2, Vertex* v1, Vertex* v2); - int mergeQuads (Quad* q1, Quad* q2, Vertex* v1, Vertex* v2, + int mergeQuads (Quad* q1, Quad* q2, Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4); int closeQuads (Quad* q1, Quad* q2); Elements* makeTranslation (Elements* elts, Vector* trans); Elements* makeScale (Elements* elts, Vertex* ver, double k); - Elements* makeRotation (Elements* elts, Vertex* ver, Vector* vec, + Elements* makeRotation (Elements* elts, Vertex* ver, Vector* vec, double angle); Elements* makeSymmetryPoint (Elements* elts, Vertex* ver); Elements* makeSymmetryLine (Elements* elts, Vertex* ver, Vector* vec); @@ -138,7 +150,7 @@ public : Elements* cut (Edge* edge, int nbcuts); Group* addGroup (cpchar name, EnumGroup kind); - Group* getGroup (int nro) { return doc_group [nro]; } + Group* getGroup (int nro); Group* findGroup (cpchar name); int removeGroup (Group* grp); int countGroup () { return (int) doc_group.size(); } @@ -162,19 +174,11 @@ public : int countCylinder () { return doc_cylinder.size(); } int countPipe () { return doc_pipe.size(); } - Vector* getVector (int nro) { return doc_vector [nro]; } - Cylinder* getCylinder (int nro) { return doc_cylinder [nro]; } - Pipe* getPipe (int nro) { return doc_pipe [nro]; } + Vector* getVector (int nro); + Cylinder* getCylinder (int nro); + Pipe* getPipe (int nro); void purge (); - int associateOpenedLine (Edge* mstart, Edges& mline, Shape* gstart, - double pstart, Shapes& gline, double pend); - int associateClosedLine (Vertex* mfirst, Edge* mstart, Edges& mline, - Shape* gstart, double pstart, bool inv, - Shapes& gline); - - void setShape (Shape* forme) { doc_shape = forme ; } - Shape* getShape () { return doc_shape ; } // --------------------------------------------------- Evols Hexa3 @@ -195,34 +199,34 @@ public : Hexa* addHexa4Quads (Quad* q1, Quad* q2, Quad* q3, Quad* q4); Hexa* addHexa5Quads (Quad* q1, Quad* q2, Quad* q3, Quad* q4, Quad* q5); - Elements* revolutionQuads (Quads& start, Vertex* center, Vector* axis, + Elements* revolutionQuads (Quads& start, Vertex* center, Vector* axis, RealVector &angles); - Elements* makeSphere (Vertex* center, Vector* vx, Vector* vz, + Elements* makeSphere (Vertex* center, Vector* vx, Vector* vz, double radius, double radhole, - Vertex* plorig, + Vertex* plorig, int nrad, int nang, int nhaut); - Elements* makePartSphere (Vertex* center, Vector* vx, Vector* vz, + Elements* makePartSphere (Vertex* center, Vector* vx, Vector* vz, double radius, double radhole, Vertex* plorig, double angle, int nrad, int nang, int nhaut); - Elements* makeRind (Vertex* center, Vector* vx, Vector* vz, + Elements* makeRind (Vertex* center, Vector* vx, Vector* vz, double radext, double radint, double radhole, - Vertex* plorig, + Vertex* plorig, int nrad, int nang, int nhaut); - Elements* makePartRind (Vertex* center, Vector* vx, Vector* vz, + Elements* makePartRind (Vertex* center, Vector* vx, Vector* vz, double radext, double radint, double radhole, Vertex* plorig, double angle, int nrad, int nang, int nhaut); - Elements* replace (Quads& pattern, Vertex* p1, Vertex* c1, + Elements* replace (Quads& pattern, Vertex* p1, Vertex* c1, Vertex* p2, Vertex* c2, Vertex* p3, Vertex* c3); - Elements* makeCylindricals (Vertex* c, Vector* b, Vector* h, - RealVector& tdr, RealVector& tda, RealVector& tdh, + Elements* makeCylindricals (Vertex* c, Vector* b, Vector* h, + RealVector& tdr, RealVector& tda, RealVector& tdh, bool fill=false); // --------------------------------------------------- Evols Hexa4' @@ -233,22 +237,51 @@ public : void getAssoEdges (Edges& tabelt); void getAssoVertices (Vertices& tabelt); + // --------------------------------------------------- Evols Hexa5 + + NewShape* getCloud () { return doc_cloud ; } + NewShape* addShape (TopoDS_Shape& forme, const char* name); + NewShape* addShape (const char* name, EnumShape type); + NewShape* getShape (int nro); + NewShape* findShape (rcstring name); + int countShape () { return doc_tab_shape.size() ; } + + int associateOpenedLine (Edges& mline, NewShapes& gline, IntVector& tabid, + double pstart, double pend); + + int associateClosedLine (Vertex* mfirst, Edges& mline, + NewShapes& gline, IntVector& tabid, + double pstart, bool inv); + + int associateLine (Vertex* mfirst, Edges& mline, + NewShapes& gline, IntVector& tabid, + double pstart, double pend, bool inv); + + int clearAssociation (EnumElt type); + void clearAssoVertices (); + void clearAssoEdges (); + void clearAssoQuads (); + + int checkAssociations (); + public: - Document (cpchar name); + Document (cpchar name, Hex* dad=NULL); ~Document (); int loadXml (cpchar name); int setXml (cpchar flux); - cpchar getXml (); + int setXml (cpchar flux, int& position); EltBase* getFirstEltBase (EnumElt type) { return doc_first_elt [type]; } EltBase* getLastEltBase (EnumElt type) { return doc_last_elt [type]; } + int getNbrElt (EnumElt type) { return doc_nbr_elt [type]; } void setDeprecated (int level=1); void dump (); void markAll (int marque, int type=-1); - int saveVtk (cpchar nomfic); - int saveVtk (cpchar radical, int &nro); + int saveVtk0 (cpchar nomfic); + int saveVtk (cpchar nomfic); + int saveVtk (cpchar radical, int &nro); void putError (cpchar mess, cpchar info1=NULL, cpchar info2=NULL); void nputError (cpchar mess, int info1, cpchar info2=NULL); @@ -261,11 +294,20 @@ public: void reorderFaces (); void reorderQuads (); + // --------------------------------------------------- Evols Hexa5 + cpchar getNextName (EnumElt type, string& name); + string getNextName (EnumElt type); + + virtual char* makeVarName (char* name); + void lockDump(); + void restoreDump(); + bool isEmpty (); + public: Globale* glob; private : - int genXml (cpchar filename); + int genXml (); int parseXml (XmlTree& xml); void replaceVertex (Vertex* v1, Vertex* v2); @@ -279,12 +321,6 @@ private : void renumeroter (); Elements* clonerElements (Elements* table, Matrix* matrice); - int associateCascade (Edges& mline, int msens[], Shape* gstart, - Shapes& gline, double pstart, double pend, bool clos, - bool inv); - int associateLine (Vertex* mfirst, Edge* mstart, Edges& mline, - Shape* gstart, double pstart, Shapes& gline, double pend, - bool inv=false); // --------------------------------------------------- Evols Hexa3 Hexa* addHexaQuadsAB (AnaQuads& strquads); @@ -294,22 +330,31 @@ private : Hexa* addHexaQuadsABCD (AnaQuads& strquads); Hexa* addHexaQuadsACDE (AnaQuads& strquads); - Shape* parseShape (XmlTree* node); - EltBase* findElement (EnumElt type, int ident); + // --------------------------------------------------- Evols Hexa5 + void addCloud (); + int sortShapes (NewShapes& tshapes, IntVector& subid, + bool closed, bool inv, double pstart, double pend, + EdgeShapes& glines, IntVector& sens, double& lgtotale); + int sortEdges (Vertex* vfirst, Edges& mline, Edges& edges, IntVector& sens); + + void parseShapes (XmlTree& root); + void parseAssociation (XmlTree* root, Quad* elt); + void parseAssociation (XmlTree* root, Edge* elt); + void parseAssociation (XmlTree* root, Vertex* elt); + SubShape* parseSubShape (XmlTree* root); private : friend class EltBase; - bool doc_modified; - bool count_modified; - bool doc_saved; + bool doc_modified; + bool count_modified; + bool doc_saved; bool maj_connection; bool purge_elements; int doc_db; int nbr_errors; - std::string doc_name; EltBase* doc_first_elt [EL_MAXI]; EltBase* doc_last_elt [EL_MAXI]; int doc_nbr_elt [EL_MAXI]; @@ -328,12 +373,10 @@ private : std::vector doc_vector; std::vector doc_cylinder; std::vector doc_pipe; - XmlWriter* doc_xml; + XmlWriter* doc_xml; // --------------------------------------------------- HexaBlock v3 - Shape* doc_shape; - std::vector doc_used_hexas; std::vector doc_used_quads; std::vector doc_used_edges; @@ -343,6 +386,15 @@ private : int nbr_used_quads; int nbr_used_edges; int nbr_used_vertex; + + // --------------------------------------------------- HexaBlock v5 + + static int doc_number; + char doc_ident [8]; + Hex* hex_parent; + + NewShape* doc_cloud; // Nuage de points du doc; + std::vector doc_tab_shape; }; // ========================================================= saveVtk (avec nro) inline int Document::saveVtk (cpchar radical, int &nro) @@ -361,13 +413,13 @@ inline int Document::saveVtk (cpchar radical, int &nro) inline void Document::setDeprecated (int level) { switch (level) - { + { // En cas de destruction : parents invalides case 2 : maj_connection = true; purge_elements = true; // creation + destruction : propagations a revoir case 1 : maj_propagation = true; - // Par defaut : + // Par defaut : default: doc_modified = true; count_modified = true; } diff --git a/src/HEXABLOCK/HexDocument_Xml.cxx b/src/HEXABLOCK/HexDocument_Xml.cxx index 66700f7..e8e7522 100755 --- a/src/HEXABLOCK/HexDocument_Xml.cxx +++ b/src/HEXABLOCK/HexDocument_Xml.cxx @@ -23,12 +23,11 @@ #include // Pour basename #include // Pour atoi et atof -#include "HexEltBase.hxx" +#include "Hex.hxx" #include "HexVertex.hxx" #include "HexEdge.hxx" #include "HexQuad.hxx" #include "HexHexa.hxx" -#include "HexShape.hxx" #include "HexElements.hxx" @@ -41,6 +40,11 @@ #include "HexLaw.hxx" #include "HexGroup.hxx" +#include "HexNewShape.hxx" +#include "HexVertexShape.hxx" +#include "HexEdgeShape.hxx" +#include "HexFaceShape.hxx" + #include "HexXmlWriter.hxx" #include "HexXmlTree.hxx" @@ -70,7 +74,7 @@ int parseName (XmlTree* node, const string& nom, EltBase* elt) int nroid = 0; for (int nc=1 ; ncsetId (nroid); const string& name = node->findValue ("name"); @@ -112,7 +116,7 @@ int Document::loadXml (cpchar ficname) { XmlTree xml(""); string filename = ficname; - doc_name = basename ((pchar)ficname); + el_name = basename ((pchar)ficname); static const int NbExt = 3; static cpchar t_ext [NbExt] = { ".xml", ".XML", ".Xml" }; @@ -120,17 +124,17 @@ int Document::loadXml (cpchar ficname) bool noext = true; for (int nx = 0; nx < NbExt && noext ; nx++) { - ici = doc_name.rfind (t_ext[nx]); - noext = ici < 0 || ici > doc_name.size(); + ici = el_name.rfind (t_ext[nx]); + noext = ici < 0 || ici > el_name.size(); } if (noext) - filename += ".xml"; + filename += ".xml"; else - doc_name.erase (ici, 4); + el_name.erase (ici, 4); int ier = xml.parseFile (filename); - if (ier!=HOK) + if (ier!=HOK) return ier; ier = parseXml (xml); @@ -139,29 +143,24 @@ int Document::loadXml (cpchar ficname) // ======================================================== setXml int Document::setXml (cpchar flux) { - XmlTree xml(""); - xml.parseFlow (flux); - - int ier = parseXml (xml); - if (ier==HOK) - doc_saved = true; + int posit = 0; + int ier = setXml (flux, posit); return ier; } -// ======================================================== parseShape -Shape* Document::parseShape (XmlTree* node) +// ======================================================== setXml +int Document::setXml (cpchar flux, int& posit) { - const string& ident = node->findValue ("ident"); - const string& inter = node->findValue ("interval"); - const string& brep = node->findValue ("brep"); + XmlTree xml(""); - double pdeb, pfin; - get_coords (inter, pdeb, pfin); - - Shape* shape = new Shape (brep); - shape->setBounds (pdeb, pfin); - shape->setName (ident); + int ier = xml.parseStream (flux, posit); + if (ier!=HOK) + return ier; - return shape; + ier = parseXml (xml); + if (ier==HOK) + doc_saved = true; + + return ier; } // ======================================================== parseXml int Document::parseXml (XmlTree& xml) @@ -175,31 +174,42 @@ int Document::parseXml (XmlTree& xml) map t_vector; vector tname; + const string& version = xml.findValue ("version"); + if (version == "") + { + cout << " **** Format du fichier XML perime" + << endl; + return HERR; + } const string& name = xml.findValue ("name"); - if (name != "") - doc_name = name; + if (name != el_name) + setName (name.c_str()); + + parseShapes (xml); XmlTree* rubrique = xml.findChild ("ListVertices"); int nbrelts = rubrique->getNbrChildren (); + Vertex* vertex = NULL; for (int nro=0 ; nro < nbrelts ; nro++) { XmlTree* node = rubrique->getChild (nro); + const string& type = node->getName(); double px, py, pz; - const string& nom = node->findValue ("id"); - const string& coords = node->findValue ("coord"); - const string& brep = node->findValue ("shape"); - get_coords (coords, px, py, pz); + if (type=="Vertex") + { + const string& nom = node->findValue ("id"); + const string& coords = node->findValue ("coord"); + get_coords (coords, px, py, pz); - Vertex* vertex = addVertex (px, py, pz); - parseName (node, nom, vertex); - Shape* shape = NULL; - if (brep != "" ) + vertex = addVertex (px, py, pz); + parseName (node, nom, vertex); + t_vertex [nom] = vertex; + } + else if (type=="Asso") { - shape = new Shape (brep); - vertex->setAssociation (shape); + parseAssociation (node, vertex); } - t_vertex [nom] = vertex; } rubrique = xml.findChild ("ListEdges"); @@ -219,10 +229,9 @@ int Document::parseXml (XmlTree& xml) t_edge [nom] = edge; parseName (node, nom, edge); } - else if (type=="Shape" && edge!=NULL) + else if (type=="Asso") { - Shape* shape = parseShape (node); - edge->addAssociation (shape); + parseAssociation (node, edge); } } @@ -245,10 +254,9 @@ int Document::parseXml (XmlTree& xml) t_quad [nom] = quad; parseName (node, nom, quad); } - else if (type=="Shape" && quad!=NULL) + else if (type=="Asso") { - Shape* shape = parseShape (node); - quad->addAssociation (shape); + parseAssociation (node, quad); } } @@ -315,7 +323,7 @@ int Document::parseXml (XmlTree& xml) const string& nmedge = node->findValue ("edge"); const string& nmlaw = node->findValue ("law"); // const string& nmway = node->findValue ("way"); - + edge = t_edge [nmedge]; Law* law = findLaw (nmlaw.c_str()); // bool way = nmway == "true"; @@ -328,7 +336,7 @@ int Document::parseXml (XmlTree& xml) { rubrique = pipe ? xml.findChild ("ListPipes") : xml.findChild ("ListCylinders"); - + nbrelts = rubrique == NULL ? 0 : rubrique->getNbrChildren (); for (int nro=0 ; nro < nbrelts ; nro++) @@ -338,7 +346,7 @@ int Document::parseXml (XmlTree& xml) const string& cdir = node->findValue ("c_dir" ); const string& cradius = node->findValue ("c_radius"); const string& cheight = node->findValue ("c_height"); - + Vertex* base = t_vertex [cbase]; Vector* dir = t_vector [cdir]; double radius = atof (cradius.c_str()); @@ -376,7 +384,7 @@ int Document::parseXml (XmlTree& xml) { node = ndgroup ->getChild (nelt); const string& id = node->findValue ("id"); - switch (type) + switch (type) { case EL_HEXA : groupe->addElement (t_hexa [id]); break; @@ -387,8 +395,8 @@ int Document::parseXml (XmlTree& xml) case EL_VERTEX : default : groupe->addElement (t_vertex [id]); break; - } - } + } + } } @@ -397,21 +405,44 @@ int Document::parseXml (XmlTree& xml) // ======================================================== save int Document::save (const char* ficxml) { - int ier = genXml (ficxml); + if (doc_xml==NULL) + doc_xml = new XmlWriter (); + + int ier = doc_xml->setFileName (ficxml); + if (ier != HOK) + return ier; + + ier = genXml (); + return ier; +} +// ======================================================== appendXml +int Document::appendXml (pfile fstudy) +{ + if (doc_xml==NULL) + doc_xml = new XmlWriter (); + + doc_xml->setFile (fstudy); + + int ier = genXml (); return ier; } // ======================================================== getXml cpchar Document::getXml () { - int ier = genXml (NULL); + if (doc_xml==NULL) + doc_xml = new XmlWriter (); + + doc_xml->setStream (); + int ier = genXml (); if (ier!=HOK) return NULL; return doc_xml->getXml (); } // ======================================================== genXml -int Document::genXml (cpchar filename) +int Document::genXml () { + const int HexVersion = 1; // -- 1) Raz numerotation precedente markAll (NO_COUNTED); if (maj_propagation) @@ -420,12 +451,13 @@ int Document::genXml (cpchar filename) if (doc_xml==NULL) doc_xml = new XmlWriter (); - doc_xml->openXml (filename); + doc_xml->startXml (); doc_xml->openMark ("Document"); - doc_xml->addAttribute ("name", doc_name); + doc_xml->addAttribute ("name", el_name); + doc_xml->addAttribute ("version", HexVersion); doc_xml->endMark (); - cpchar balise [] = {"ListXXXX", + cpchar balise [] = {"ListXXXX", "ListVertices", "ListEdges", "ListQuads", "ListHexas", "ListVectors", "ListXXXX" }; @@ -467,6 +499,12 @@ int Document::genXml (cpchar filename) doc_xml->addMark ("ListGroups"); for (int nro=0 ; nrosaveXml (doc_xml); + doc_xml->closeMark (true); + + nombre = countShape (); + doc_xml->addMark ("ListShapes"); + for (int nro=0 ; nrosaveXml (doc_xml); doc_xml->closeMark (); doc_xml->closeMark (); @@ -490,7 +528,7 @@ void Document::markAll (int marque, int type) } } // ====================================================== saveVtk -int Document::saveVtk (cpchar nomfic) +int Document::saveVtk0 (cpchar nomfic) { // -- 1) Raz numerotation precedente markAll (NO_COUNTED, EL_VERTEX); @@ -564,6 +602,86 @@ int Document::saveVtk (cpchar nomfic) fclose (vtk); return HOK; } + +// ====================================================== saveVtk +// ==== Nouvelle formule +int Document::saveVtk (cpchar nomfic) +{ + int nbnodes = doc_nbr_elt [EL_VERTEX]; + int nbcells = countHexa (); + + pfile vtk = fopen (nomfic, "w"); + if (vtk==NULL) + { + cout << " ****" << endl; + cout << " **** Document::saveVtk : " << endl; + cout << " **** Can't open file " << endl; + cout << " ****" << endl; + + } + fprintf (vtk, "# vtk DataFile Version 3.1\n"); + fprintf (vtk, "%s \n", nomfic); + fprintf (vtk, "ASCII\n"); + fprintf (vtk, "DATASET UNSTRUCTURED_GRID\n"); + fprintf (vtk, "POINTS %d float\n", nbnodes); + + // -- 1) Les noeuds + Real3 koord; + static const double minvtk = 1e-30; +#define Koord(p) koord[p]-minvtk ? 0 : koord[p] + + int last_nro = 0; + for (EltBase* elt = doc_first_elt[EL_VERTEX]->next (); elt!=NULL; + elt = elt->next()) + { + Vertex* node = static_cast (elt); + if (node->isHere()) + { + int nro = node->getId (); + for (int np = last_nro ; np < nro ; np++) + fprintf (vtk, "0 0 0\n"); + + node->getPoint (koord); + fprintf (vtk, "%g %g %g\n", Koord(dir_x), Koord(dir_y), Koord(dir_z)); + last_nro = nro+1; + } + } + + for (int np = last_nro ; np < nbnodes ; np++) + fprintf (vtk, "0 0 0\n"); + + // -- 2) Les hexas + + fprintf (vtk, "CELLS %d %d\n", nbcells, nbcells*(HV_MAXI+1)); + + for (EltBase* elt = doc_first_elt[EL_HEXA]->next (); elt!=NULL; + elt = elt->next()) + { + Hexa* cell = static_cast (elt); + if (cell!=NULL && cell->isHere()) + cell->printHexaVtk (vtk); + } + + fprintf (vtk, "CELL_TYPES %d\n", nbcells); + for (int nro=0 ; nronext (); elt!=NULL; + elt = elt->next()) + { + Hexa* cell = static_cast (elt); + if (cell!=NULL && cell->isHere()) + cell->colorNodes (vtk); + } +*********************************/ + fclose (vtk); + return HOK; +} // ====================================================== purge void Document::purge () { @@ -647,7 +765,7 @@ void Document::majReferences () // ======================================================== dump void Document::dump () { - cpchar nom_type [] = { "Elments non classes", + cpchar nom_type [] = { "Elments non classes", "Sommets", "Aretes", "Faces", "Hexaedres", "Elements detruits" }; for (int type=EL_VERTEX ; type <= EL_HEXA ; type++) @@ -689,4 +807,92 @@ void Document::hputError (cpchar mess, EltBase* e1, EltBase* e2) putError (mess, name1, name2); } +// ======================================================== parseSubShape +SubShape* Document::parseSubShape (XmlTree* node) +{ + const string& name = node->findValue ("shape"); + int subid = node->findInteger ("subid"); + NewShape* shape = findShape (name); + if (shape==NULL) + return NULL; + + SubShape* sub_shape = shape->findSubShape (subid); + return sub_shape; +} +// ======================================================== parseAssociation (v) +void Document::parseAssociation (XmlTree* node, Vertex* vertex) +{ + SubShape* shape = parseSubShape (node); + if (shape==NULL || vertex==NULL) + return; + + if (shape->getDim()!=0) + return; + VertexShape* vshape = static_cast (shape); + vertex->setAssociation (vshape); +} +// ======================================================== parseAssociation (e) +void Document::parseAssociation (XmlTree* node, Edge* edge) +{ + SubShape* shape = parseSubShape (node); + if (shape==NULL || edge==NULL) + return; + + if (shape->getDim()!=1) + return; + + const string& inter = node->findValue ("interval"); + double pdeb, pfin; + get_coords (inter, pdeb, pfin); + + EdgeShape* line = static_cast (shape); + edge->addAssociation (line, pdeb, pfin); +} +// ======================================================== parseAssociation (q) +void Document::parseAssociation (XmlTree* node, Quad* quad) +{ + SubShape* shape = parseSubShape (node); + if (shape==NULL || quad==NULL) + return; + + if (shape->getDim()!=2) + return; + FaceShape* face = static_cast (shape); + quad->addAssociation (face); +} +// ======================================================== parseShapes +void Document::parseShapes (XmlTree& root) +{ + XmlTree* rubrique = root.findChild ("ListShapes"); + int nbrelts = rubrique->getNbrChildren (); + + for (int nro=0 ; nro < nbrelts ; nro++) + { + XmlTree* node = rubrique->getChild (nro); + const string& type = node->getName(); + if (type=="Shape") + { + const string& nom = node->findValue ("id" ); + int orig = node->findInteger ("type"); + const string& brep = node->findValue ("brep"); + NewShape* shape = new NewShape (this, (EnumShape)orig); + + parseName (node, nom, shape); + shape->setBrep (brep); + doc_tab_shape.push_back (shape); + } + else if (type=="Cloud") + { + int nbvert = node->getNbrChildren (); + for (int nv=0 ; nv < nbvert ; nv++) + { + Real3 point; + XmlTree* sommet = node->getChild (nv); + const string& coords = sommet->findValue ("coord"); + get_coords (coords, point[dir_x], point[dir_y], point[dir_z]); + doc_cloud->addPoint (point); + } + } + } +} END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexDocument_asso.cxx b/src/HEXABLOCK/HexDocument_asso.cxx index 23acae5..197c61b 100755 --- a/src/HEXABLOCK/HexDocument_asso.cxx +++ b/src/HEXABLOCK/HexDocument_asso.cxx @@ -1,5 +1,5 @@ -// C++ : Associatiosn dans le document +// C++ : Associations dans le document // Copyright (C) 2009-2012 CEA/DEN, EDF R&D // @@ -17,31 +17,201 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com // #include "HexDocument.hxx" #include "HexEdge.hxx" +#include "HexQuad.hxx" #include "HexDiagnostics.hxx" - +#include "HexNewShape.hxx" +#include "HexEdgeShape.hxx" BEGIN_NAMESPACE_HEXA -static bool db = false; +static bool db = on_debug (); // == getenv ("HEXA_DB") > 0 + + +int vertexInLine (Vertex* vfirst, Edges& mline, vector &tsens); +// ====================================================== vertexInLine +int vertexInLine (Vertex* vfirst, Edges& mline, vector &tsens) +{ + int nbseg = mline.size (); + + for (int ned = 0 ; nedgetVertex (ns) == vfirst) + { + tsens [ned] = ns; + return ned; + } + } + } + + return NOTHING; +} +// ====================================================== clearAssociation +void Document::clearAssociation () +{ + clearAssoVertices (); + clearAssoEdges (); + clearAssoQuads (); +} +// ====================================================== clearAssociation (t) +int Document::clearAssociation (EnumElt type) +{ + switch (type) + { + case EL_VERTEX : + clearAssoVertices (); + break; + case EL_EDGE : + clearAssoEdges (); + break; + case EL_QUAD : + clearAssoQuads (); + break; + default : return HERR; + } + + return HOK; +} +// ====================================================== clearAssoVertices +void Document::clearAssoVertices () +{ + for (EltBase* elt = doc_first_elt[EL_VERTEX]->next (); elt!=NULL; + elt = elt->next()) + { + Vertex* elem = static_cast (elt); + if (elem->isValid ()) + elem->clearAssociation (); + } +} +// ====================================================== clearAssoEdges +void Document::clearAssoEdges () +{ + for (EltBase* elt = doc_first_elt[EL_EDGE]->next (); elt!=NULL; + elt = elt->next()) + { + Edge* elem = static_cast (elt); + if (elem->isValid ()) + elem->clearAssociation (); + } +} +// ====================================================== clearAssoQuads +void Document::clearAssoQuads () +{ + for (EltBase* elt = doc_first_elt[EL_VERTEX]->next (); elt!=NULL; + elt = elt->next()) + { + Quad* elem = static_cast (elt); + if (elem->isValid ()) + elem->clearAssociation (); + } +} +// ====================================================== addShape (1) +NewShape* Document::addShape (TopoDS_Shape& topo, cpchar name) +{ + NewShape* shape = new NewShape (this); + doc_tab_shape.push_back (shape); + + shape->setName (name); + shape->setShape (topo); + return shape; +} +// ====================================================== addShape (2) +NewShape* Document::addShape (cpchar name, EnumShape type) +{ + NewShape* shape = new NewShape (this, type); + doc_tab_shape.push_back (shape); + + shape->setName (name); + return shape; +} +// ====================================================== addCloud +void Document::addCloud () +{ + doc_cloud = new NewShape (this, SH_CLOUD); + doc_cloud->setName ("cloud"); -int vertexInLine (Vertex* mfirst, Edges& mline, vector &tsens); -int associateShapes (Edges& mline, int msens[], Shape* gstart, Shapes& gline, - double pstart, double pend, bool closed, bool inv=false); + doc_tab_shape.push_back (doc_cloud); +} +// ====================================================== getShape +NewShape* Document::getShape (int nro) +{ + int nbre = doc_tab_shape.size (); + if (nro < 0 || nro >= nbre) + return NULL; + + return doc_tab_shape [nro]; +} +// ====================================================== findShape +NewShape* Document::findShape (rcstring nom) +{ + int nbre = doc_tab_shape.size (); + for (int nro=0 ; nrogetName()) + return doc_tab_shape [nro]; +} +// ====================================================== find_line +EdgeShape* find_line (EdgeShapes& gline, double* point, int& sens) +{ + int nbseg = gline.size (); + + for (int ned = 0 ; nedonExtremity (point); + if (sens >=0) + { + gline [ned] = NULL; + return edge; + } + } + } + return NULL; +} +// ====================================================== find_edge +Edge* find_edge (Edges& mline, Vertex* vfirst, int& sens) +{ + int nbseg = mline.size (); + for (int ned = 0 ; nedindex (vfirst); + if (sens >=0) + { + mline [ned] = NULL; + return edge; + } + } + } + return NULL; +} // ====================================================== associateOpenedLine -int Document::associateOpenedLine (Edge* mstart, Edges& mline, Shape* gstart, - double pstart, Shapes& gline, double pend) +int Document::associateOpenedLine (Edges& mline, NewShapes& gline, + IntVector& tabid, + double pstart, double pend) { - int ier = associateLine (NULL, mstart, mline, gstart, pstart, gline, pend); + cout << "_________________________________ Asso Open Line" + << " ed=" << mline.size() + << " sh=" << tabid.size() + << endl; + int ier = associateLine (NULL, mline, gline, tabid, pstart, pend, false); return ier; } // ====================================================== associateClosedLine -int Document::associateClosedLine (Vertex* vfirst, Edge* mstart, Edges& mline, - Shape* gstart, double pstart, bool inv, Shapes& gline) +int Document::associateClosedLine (Vertex* vfirst, Edges& mline, + NewShapes& gline, IntVector& tabid, + double pstart, bool inv) { if (vfirst == NULL) { @@ -49,55 +219,151 @@ int Document::associateClosedLine (Vertex* vfirst, Edge* mstart, Edges& mline, return HERR; } - int ier = associateLine (vfirst, mstart, mline, gstart, pstart, gline, - 1.0, inv); + cout << "_________________________________ Asso Closed Line" + << " first=" << vfirst->getName() + << " ed=" << mline.size() + << " sh=" << tabid.size() + << " inv=" << inv + << endl; + int ier = associateLine (vfirst, mline, gline, tabid, pstart, 1.0, inv); + PutData (ier); return ier; } -// ====================================================== associateClosedLine -int Document::associateLine (Vertex* vfirst, Edge* mstart, Edges& mline, - Shape* gstart, double pstart, Shapes& gline, double pend, - bool inv) +// ====================================================== associateLine +int Document::associateLine (Vertex* vfirst, Edges& mline, + NewShapes& tshapes, IntVector& subid, + double pstart, double pend, bool inv) { - db = on_debug (); - char buffer [16], cnum [8]; - int nbseg = mline.size (); - bool closed = vfirst != NULL; + EdgeShapes glines; + Edges tedges; + IntVector gsens, tsens; + double lgtotale; - if (mstart == NULL) - { - putError (W_ASSO_LINE4); - return HERR; - } - // Contour ferme : - // Le vertex de depart n'appartient pas a l'edge de depart - int istart = mstart->index (vfirst); - if (closed && istart == NOTHING) + bool closed = vfirst!=NULL; + int ier = sortShapes (tshapes, subid, closed, inv, pstart, pend, + glines, gsens, lgtotale); + if (ier != HOK) + return ier; + + ier = sortEdges (vfirst, mline, tedges, tsens); + if (ier != HOK) + return ier; + + int nbedges = tedges.size(); + int nblines = glines.size(); + + EdgeShape* gstart = glines [0]; + EdgeShape* gend = glines [nblines-1]; + bool boucle = closed && nblines==1; + + double abstart = inv ? (1-pstart) : pstart; + if (NOT closed) { - putError (W_ASSO_LINE2, vfirst->getName (buffer)); - return HERR; + bool rev = gsens [nblines-1]!=0; + double abend = rev ? pend : (1-pend); + lgtotale = lgtotale - abstart * gstart->getLength() + - abend * gend ->getLength(); } + // 1er point + Real3 point; + gstart->getPoint (pstart, point); + int vsid = doc_cloud->addPoint (point); + Vertex* node = tedges[0]->getVertex (tsens[0]); + node->setAssociation (doc_cloud, vsid); - if (db) - { - PutName (vfirst); - printf (" . : "); - mstart->printName (" = ("); - mstart->getVertex(V_AMONT)->printName (", "); - mstart->getVertex(V_AVAL) ->printName (")\n"); + double lgedge = lgtotale/nbedges; + double smin = 0; + double smax = gstart->getLength()*(1-abstart); + double emax = lgedge; + double pdeb = pstart; + double ablast = 0; + double tol = 1e-2; - for (int nro=0 ; nrogetLength (); + + double abscisse = std::min (emax, smax); + double decal = (abscisse-ablast) / lgshape; + if (grev) { - printf (" %2d : ", nro); - mline[nro]->printName(" = ("); - mline[nro]->getVertex(V_AMONT)->printName(", "); - mline[nro]->getVertex(V_AVAL )->printName(")\n"); + pfin = pdeb - decal; + if (pfin < 0.0) pfin = 0; } - } + else + { + pfin = pdeb + decal; + if (pfin > 1.0) pfin = 1; + } + + edge->addAssociation (shape, pdeb, pfin); + if (vassoc) + { + shape->getPoint (pfin, point); + vsid = doc_cloud->addPoint (point); + node = edge ->getVertex (1-tsens[ned]); - for (int ns = 0 ; ns < nbseg ; ns++) + node->setAssociation (doc_cloud, vsid); + } + ablast = abscisse; + pdeb = pfin; + // On incremente les edges + if (av_edge) + { + ned ++; + emax += lgedge; + } + // On incremente les shapes + if (av_shape) + { + pdeb = 0; + if (boucle) + { + smin = smax; + smax = shape->getLength (); + } + else + { + nsh ++; + if (nshgetLength(); + } + } + } + } + + return HOK; +} +// ====================================================== sortShapes +int Document::sortShapes (NewShapes& tshapes, IntVector& subid, bool closed, + bool inv, double pstart, double pend, + EdgeShapes& glines, IntVector& gsens, double& lgtotale) +{ + char cnum [8]; + int nblines = subid.size (); + int nombre = tshapes.size (); + + if (nblines==0 || nombre==0) + return HERR; + + if (nombre != 1 && nombre != nblines) + return HERR; + + for (int ns = 0 ; ns < nombre ; ns++) { - if (mline[ns] == NULL) + if (tshapes[ns] == NULL) { sprintf (cnum, "%d", ns); putError (W_ASSO_LINE5, cnum); @@ -105,137 +371,152 @@ int Document::associateLine (Vertex* vfirst, Edge* mstart, Edges& mline, } } - vector tab_sens (nbseg, V_TWO); - int sens = V_AMONT; - int nedge = NOTHING; - Vertex* pnode = mstart->getVertex (sens); + NewShape* geom = tshapes [0]; + EdgeShapes buf_lines; + glines.clear (); + gsens .clear (); + for (int ns = 0 ; ns < nblines ; ns++) + { + if (nombre > 1) + geom = tshapes [ns]; + EdgeShape* shape = geom->findEdge (subid[ns]); + if (shape==NULL) + { + sprintf (cnum, "%d", ns); + putError (W_ASSO_LINE5, cnum); + return HERR; + } + buf_lines.push_back (shape); + } + + Real3 pnext; + EdgeShape* gnext = buf_lines[0]; + buf_lines[0] = NULL; + int reste = nblines - 1; + int rev = inv; - if (nbseg==0) - { - nedge = 0; - } - else if (NOT closed) - { - pnode = mstart->getVertex (sens); - nedge = vertexInLine (pnode, mline, tab_sens); - if (nedge == NOTHING) - { - sens = V_AVAL; - pnode = mstart->getVertex (sens); - nedge = vertexInLine (pnode, mline, tab_sens); - } - } - // Closed : on recherche ou se trouve le 2e vertex de mstart - else - { - sens = 1-istart; - pnode = mstart->getVertex (sens); - nedge = vertexInLine (pnode, mline, tab_sens); - } + lgtotale = gnext->getLength(); + glines.push_back (gnext); + gsens .push_back (inv); - HexDisplay (nbseg); + for (int nro = 0 ; nro < reste ; nro++) + { + double param = 1-rev; + gnext->getPoint (param, pnext); + gnext = find_line (buf_lines, pnext, rev); + if (gnext == NULL) + return HERR; + lgtotale += gnext->getLength(); + glines.push_back (gnext); + gsens .push_back (rev); + } - if (nedge == NOTHING) + if (closed) { - putError (W_ASSO_LINE, mstart->getName (buffer)); - return HERR; + EdgeShape* gfirst = glines[0]; + gfirst->getPoint (1-inv, pnext); + int ext = gnext->onExtremity (pnext); + if (ext<0) + return HERR; } + return HOK; +} +// ====================================================== sortEdges +int Document::sortEdges (Vertex* vfirst, Edges& mline, Edges& tab_edge, + IntVector& tab_sens) +{ + char cnum [8]; + bool closed = vfirst!=NULL; + + int nbedges = mline.size (); + if (nbedges==0) + return HERR; - Edges les_edges; - vector les_orig; - les_edges.push_back (mstart); - les_orig .push_back (1-sens); - HexDisplay (nedge); - cout << " ........................................ Marque 1" << endl; - if (nbseg>0) + Edge* mstart = mline[0]; // Coherence ancienne version + // Contour ferme : + // Le vertex de depart n'appartient pas a l'edge de depart + int istart = mstart->index (vfirst); + if (closed && istart == NOTHING) { - les_edges.push_back (mline[nedge]); - les_orig. push_back (tab_sens[nedge]); + putError (W_ASSO_LINE2, vfirst->getName()); + return HERR; } - cout << " ........................................ Marque 2" << endl; - if (db) - printf (" mstart [%d] = mline[%d][%d] = %s\n", sens, nedge, - tab_sens [nedge], pnode->getName(buffer)); - - cout << " ........................................ Marque 3" << endl; - for (int ns = 1 ; ns < nbseg ; ns++) + tab_edge.clear(); + tab_sens.clear(); + Edges buf_edge; + for (int nro = 0 ; nro < nbedges ; nro++) { - Vertex* pnode = mline[nedge]->getVertex (1-tab_sens [nedge]); - int nro = vertexInLine (pnode, mline, tab_sens); - if (nro == NOTHING) + Edge* edge = mline[nro]; + if (edge == NULL) { - sprintf (cnum, "%d", nedge); - putError (W_ASSO_LINE2, cnum, mline[nedge]->getName (buffer)); + sprintf (cnum, "%d", nro); + putError (W_ASSO_LINE5, cnum); return HERR; } - if (db) - printf (" mline[%d][%d] = mline[%d][%d] = %s\n", nedge, - 1-tab_sens [nedge], nro, tab_sens [nro], pnode->getName(buffer)); - nedge = nro; - les_edges.push_back (mline [nedge]); - les_orig. push_back (tab_sens [nedge]); + buf_edge.push_back (edge); } - /******************** - if (db) - { - printf (" ... gstart = 0x%x, pstart=%g\n", gstart, pstart); - for (int ns = 0 ; ns < gline.size() ; ns++) - { - printf (" ... gline[%d] = 0x%x\n", ns, gline[ns]); - } - } - **************************/ - + Vertex* vnext = NULL; + Edge* enext = mstart; + int sens = istart; + int reste = nbedges - 1; + tab_edge.push_back (mstart); + buf_edge[0] = NULL; + if (closed) { - Vertex* tete = les_edges [0] ->getVertex (les_orig[0]); - Vertex* queue = les_edges [nbseg]->getVertex (1-les_orig[nbseg]); - if (tete != queue) + tab_sens.push_back (istart); + } + else + { + istart = V_AMONT; + vnext = mstart->getVertex (1-istart); + enext = find_edge (buf_edge, vnext, sens); + if (enext==NULL) { - HexDump (tete); - HexDump (queue); - HexDump (les_edges [0]); - HexDump (les_edges [nbseg]); - putError (W_ASSO_LINE6); - return HERR; + istart = 1-istart; + vnext = mstart->getVertex (1-istart); + enext = find_edge (buf_edge, vnext, sens); } + if (enext==NULL) + return HERR; + tab_sens.push_back (istart); + tab_edge.push_back (enext); + tab_sens.push_back (sens); + reste--; } - - int ier = associateShapes (les_edges, &les_orig[0], gstart, gline, pstart, - pend, closed, inv); - return ier; -} -// ====================================================== vertexInLine -int vertexInLine (Vertex* mfirst, Edges& mline, vector &tsens) -{ - int nbseg = mline.size (); - for (int ned = 0 ; nedgetVertex (ns) == mfirst) - { - tsens [ned] = ns; - return ned; - } - } + vnext = enext->getVertex (1 - sens); + enext = find_edge (buf_edge, vnext, sens); + if (enext == NULL) + return HERR; + tab_edge.push_back (enext); + tab_sens.push_back (sens); } - - return NOTHING; + + istart = tab_edge [nbedges-1]->index (vfirst); + if (closed && istart == NOTHING) + { + putError (W_ASSO_LINE2, vfirst->getName()); + return HERR; + } + + return HOK; } -// ====================================================== vertexInLine -void Document::clearAssociation () +// ====================================================== checkAssociations +int Document::checkAssociations () { - for (int nat=EL_VERTEX ; nat<=EL_QUAD ; nat++) + int nombre = countUsedEdge(); + for (int ned=0 ; nednext (); elt!=NULL; - elt = elt->next()) - clear_association (elt); + Edge* edge = getUsedEdge (ned); + int ier = edge->checkAssociation (); + // if (ier != HOK) return ier; } -} + return HOK; +} END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexDocument_quads.cxx b/src/HEXABLOCK/HexDocument_quads.cxx index 18a4caf..54979c1 100755 --- a/src/HEXABLOCK/HexDocument_quads.cxx +++ b/src/HEXABLOCK/HexDocument_quads.cxx @@ -48,7 +48,7 @@ static bool db = false; Document* Document::copyDocument () { string nom = "CopyOf_"; - nom += doc_name; + nom += el_name; Document* clone = new Document (nom.c_str()); @@ -786,20 +786,21 @@ bool only_in_hexas (Hexas& thexas, Quad* quad) // ========================================================= only_in_hexas bool only_in_hexas (Hexas& thexas, Edge* edge) { + return false; int nbp = edge->getNbrParents(); for (int nq=0 ; nq getParent (nq); if (NOT only_in_hexas (thexas, quad)) { - cout << " ... inMoreHexas " << edge->getName() << endl; + cout << " ... inMoreHexas " << edge->makeDefinition() << endl; return false; } } - cout << " ... only_in_hexas " << edge->getName() << endl; + cout << " ... only_in_hexas " << edge->makeDefinition() << endl; return true; } -// ========================================================= only_in_hexas +// ========================================================= replace_vertex void replace_vertex (Hexas& thexas, Vertex* node, Vertex* par) { int nbh = thexas.size(); diff --git a/src/HEXABLOCK/HexDocument_skin.cxx b/src/HEXABLOCK/HexDocument_skin.cxx new file mode 100755 index 0000000..e896e80 --- /dev/null +++ b/src/HEXABLOCK/HexDocument_skin.cxx @@ -0,0 +1,109 @@ + +// C++ : Reordonnancement des faces + +#include "HexDocument.hxx" + +#include "HexVertex.hxx" +#include "HexEdge.hxx" +#include "HexQuad.hxx" +#include "HexHexa.hxx" + +#include + +BEGIN_NAMESPACE_HEXA +// ---------------------------------------------------------------------- +struct OrientedQuad + { + Quad* quad; + Vertex* v1; + Vertex* v2; + }; + +void propagateOrientation (queue &queue_quads, Quad* orig); +void makeSkin (Quad* orig); + +// ========================================================= reorderFaces +// ==== Ordonner les faces externes +void Document::reorderQuads () +{ + majReferences (); + EltBase* elt = NULL; + + for (elt = doc_first_elt[EL_QUAD]->next (); elt!=NULL; elt = elt->next()) + if (elt!=NULL && elt->isHere()) + { + Quad* quad = static_cast (elt); + if (quad->getNbrParents()==1) quad->setOrientation (Q_UNDEFINED); + else quad->setOrientation (Q_INSIDE); + } + + for (elt = doc_first_elt[EL_HEXA]->next (); elt!=NULL; elt = elt->next()) + if (elt!=NULL && elt->isHere()) + { + Hexa* hexa = static_cast (elt); + for (int nq=0; nqgetQuad (nq); + if (quad->getOrientation()==Q_UNDEFINED) + makeSkin (quad); + } + } +} +// ========================================================= makeSkin +void makeSkin (Quad* orig) +{ + OrientedQuad triplet; + queue queue_quads; + + orig->setOrientation(); // Q_DIRECT=1, Q_INVERSE=2 + propagateOrientation (queue_quads, orig); + + while (NOT queue_quads.empty ()) + { + triplet = queue_quads.front (); + queue_quads.pop (); + int n1 = triplet.quad->indexVertex (triplet.v1); + int n2 = triplet.quad->indexVertex (triplet.v2); + int sens = Q_WAITING; + if (n2 == (n1+1) MODULO QUAD4) + sens = Q_DIRECT; + else if (n1 == (n2+1) MODULO QUAD4) + sens = Q_INVERSE; + else + printf (" **************** Orientation face impossible\n"); + + triplet.quad->setOrientation (sens); + propagateOrientation (queue_quads, triplet.quad); + } +} +// ==================================================== propagateOrientation +void propagateOrientation (queue &queue_quads, Quad* orig) +{ + OrientedQuad triplet; + // Q_DIRECT : le sens des vertex est l'exterieur + int sens = orig->getOrientation(); // Q_DIRECT=1, Q_INVERSE=2 + + for (int ned=0; nedgetVertex ( ned ); + triplet.v2 = orig->getVertex ((ned+1) MODULO QUAD4); + if (sens==Q_DIRECT) + { + Vertex* v3 = triplet.v1; + triplet.v1 = triplet.v2; + triplet.v2 = v3; + } + Edge* edge = orig->getEdge (ned); + int nbp = edge->getNbrParents (); + for (int np=0; npgetParent (np); + if (triplet.quad->getOrientation ()==Q_UNDEFINED) + { + triplet.quad->setOrientation (Q_WAITING); + queue_quads.push (triplet); + } + } + } +} +END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexDocument_trans.cxx b/src/HEXABLOCK/HexDocument_trans.cxx index f63b5f1..fe532f0 100755 --- a/src/HEXABLOCK/HexDocument_trans.cxx +++ b/src/HEXABLOCK/HexDocument_trans.cxx @@ -88,6 +88,7 @@ int Document::performSymmetryPlane (Elements* elts, Vertex* ver, Vector* vec) int ier = elts->transform (&matrice); return ier; } + // ==================================================== performSymmetryLine int Document::performSymmetryLine (Elements* elts, Vertex* ver, Vector* vec) { @@ -243,8 +244,6 @@ void Document::dumpPropagation () void Document::reorderFaces () { majReferences (); - Real3 cg, orig, pi, pj, vi, vj, vk; - for (EltBase* elt = doc_first_elt[EL_QUAD]->next (); elt!=NULL; elt = elt->next()) { diff --git a/src/HEXABLOCK/HexDumpStudy.cxx b/src/HEXABLOCK/HexDumpStudy.cxx new file mode 100755 index 0000000..81ec47c --- /dev/null +++ b/src/HEXABLOCK/HexDumpStudy.cxx @@ -0,0 +1,298 @@ + +// C++ : Dump python + +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include "HexDumpStudy.hxx" +#include "HexEltBase.hxx" +#include "HexDocument.hxx" + +BEGIN_NAMESPACE_HEXA + +enum {EL_REAL=EL_NONE}; + +static cpchar + tab_name [EL_MAXI] = {"TReals", "TNodes", "TEdges", "TQuads", "THexas", + "TxxxA", "TxxxB", "TxxxC", "TxxxD", "TxxxE", "TxxxF" }; + +// =================================================== Constructeur +DumpStudy::DumpStudy () +{ + map_name [NULL] = "None"; + is_open = NOT DumpActif; + nbr_nulls = 0; + fic_dump = stdout; + + for (int nc=0 ; ncmakeVarName (name); + } + + declareVectors (); + right_part += ")"; + fprintf (fic_dump, "%s = %s\n", name, right_part.c_str()); +} +// =================================================== close +void DumpStudy::close (bool reactive) +{ + if (reactive) + is_open = false; + else + return; + + declareVectors (); + right_part += ")"; + fprintf (fic_dump, "%s\n", right_part.c_str()); +} +// =================================================== lock +bool DumpStudy::lock () +{ + if (is_open) + return false; + + is_open = true; + return is_open; +} +// =================================================== restore +void DumpStudy::restore (bool reactive) +{ + if (reactive) + is_open = false; +} +// ------------------------------------------------------------- +// ------------ Private +// ------------ For members only +// ------------------------------------------------------------- +// =================================================== addArgument +void DumpStudy::addArgument (cpchar arg) +{ + nbr_args ++; + if (nbr_args>1) + right_part += ", "; + + right_part += arg; +} +// =================================================== addArgVector +void DumpStudy::addArgVector (EnumElt type, TabElts& table) +{ + char name [20]; + sprintf (name, "%s%d", tab_name[type], ++tab_count[type]); + + addVector (name); + + int lg = table.size (); + + for (int nv=0 ; nv :: iterator iter = map_name.find (elt); + if (iter != map_name.end()) + name = iter->second.c_str(); + else + name = "Unknown"; + + return name; +} +END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexDumpStudy.hxx b/src/HEXABLOCK/HexDumpStudy.hxx new file mode 100755 index 0000000..96cb664 --- /dev/null +++ b/src/HEXABLOCK/HexDumpStudy.hxx @@ -0,0 +1,87 @@ + +// Class : Ecriture d'un dump python + +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com + +#ifndef __DUMP_STUDY_H_ +#define __DUMP_STUDY_H_ + +#include "hexa_base.hxx" +#include + +BEGIN_NAMESPACE_HEXA + + +#define DumpStart(p,args) bool actif=el_root->glob->dump.start(this, p); if (actif) el_root->glob->dump << args +#define DumpEnd el_root->glob->dump.close (actif) +#define DumpReturn(v) el_root->glob->dump.close (actif,v) + +#define DumpLock bool actif=el_root->glob->dump.lock () +#define DumpRestore el_root->glob->dump.restore (actif) + +class DumpStudy +{ +public : + DumpStudy (); + + DumpStudy& operator << (int val); + DumpStudy& operator << (double val); + DumpStudy& operator << (cpchar val); + DumpStudy& operator << (EltBase* elt); + DumpStudy& operator << (Edges& elt); + DumpStudy& operator << (Quads& elt); + DumpStudy& operator << (Hexas& elt); + DumpStudy& operator << (RealVector& elt); + + bool start (EltBase* obj, cpchar method); + bool start (cpchar obj, cpchar method); + void close (bool reactive); + void close (bool reactive, EltBase* retour); + + bool lock (); + void restore (bool reactive); + +private : + cpchar findName (EltBase* elt); + void addArgVector (EnumElt type, TabElts& table); + void addArgument (cpchar arg); + void addArgument (string& arg) { addArgument (arg.c_str()) ; } + void declareVectors (); + void addVector (cpchar name); + void majVector (cpchar value); + void closeVector (); + +private : + std::map map_name; + std::vector tab_declar; + + int tab_count [EL_MAXI]; + string curr_vector; + int nbr_values; + + FILE* fic_dump; + string this_name; + string right_part; + bool is_open; + int nbr_nulls; + int nbr_args; +}; +END_NAMESPACE_HEXA +#endif diff --git a/src/HEXABLOCK/HexEdge.cxx b/src/HEXABLOCK/HexEdge.cxx index 7579acf..b276196 100755 --- a/src/HEXABLOCK/HexEdge.cxx +++ b/src/HEXABLOCK/HexEdge.cxx @@ -17,7 +17,8 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com // #include "HexEdge.hxx" #include "HexVertex.hxx" @@ -25,19 +26,22 @@ #include "HexPropagation.hxx" #include "HexXmlWriter.hxx" -#include "HexShape.hxx" +#include "HexNewShape.hxx" +#include "HexAssoEdge.hxx" static int niveau = 0; BEGIN_NAMESPACE_HEXA +static bool db = on_debug(); + void geom_dump_asso (Edge* edge); // ======================================================== Constructeur Edge::Edge (Vertex* va, Vertex* vb) : EltBase (va->dad(), EL_EDGE) { - e_vertex [V_AMONT] = va; + e_vertex [V_AMONT] = va; e_vertex [V_AVAL ] = vb; e_propag = NOTHING; @@ -88,12 +92,12 @@ int Edge::anaMerge (Vertex* orig, Vertex* tv1[]) tv1 [1] = e_vertex[V_AVAL]; else if (orig == e_vertex [V_AVAL]) tv1 [1] = e_vertex[V_AMONT]; - else + else return HERR; return HOK; } -// ========================================================= propager +// ========================================================= propager void Edge::propager (Propagation* prop, int groupe, int sens) { setPropag (groupe, sens>0); @@ -123,12 +127,12 @@ void Edge::propager (Propagation* prop, int groupe, int sens) } niveau --; } -// ========================================================= getParent +// ========================================================= getParent Quad* Edge::getParent (int nro) { return static_cast (getFather (nro)); } -// ========================================================= saveXml +// ========================================================= saveXml void Edge::saveXml (XmlWriter* xml) { char buffer[12]; @@ -139,21 +143,21 @@ void Edge::saveXml (XmlWriter* xml) xml->openMark ("Edge"); xml->addAttribute ("id", getName (buffer)); xml->addAttribute ("vertices", vertices); - if (el_name!=buffer) + if (el_name!=buffer) xml->addAttribute ("name", el_name); xml->closeMark (); int nbass = tab_assoc.size(); for (int nro=0 ; nrosaveXml (xml); + tab_assoc[nro]->saveXml (xml); } // ======================================================== replaceVertex void Edge::replaceVertex (Vertex* old, Vertex* par) { for (int nro=0 ; nrogetName(); + definition += ","; + definition += e_vertex [V_AVAL]->getName(); + definition += ")"; + + return definition; +} // ========================================================== addAssociation -int Edge::addAssociation (Shape* forme) +int Edge::addAssociation (EdgeShape* gline, double deb, double fin) { - if (forme == NULL) + if (gline == NULL) + return HERR; + + gline->addAssociation (this); + AssoEdge* asso = new AssoEdge (gline, deb, fin); + tab_assoc.push_back (asso); + + if (db) + { + cout << " Edge " << el_name + << " = (" << e_vertex[V_AMONT]->getName() + << " , " << e_vertex[V_AVAL ]->getName() + << ") addAssociation " << gline->getName () + << " (" << deb << ", " << fin << ")" + << endl; + PutCoord (asso->getOrigin ()); + PutCoord (asso->getExtrem ()); + } + is_associated = true; + return HOK; +} +// ========================================================== addAssociation +int Edge::addAssociation (NewShape* geom, int subid, double deb, double fin) +{ + if (geom == NULL) { if (el_root->debug ()) cout << " Edge " << el_name << " addAssociation of NULL ignored" @@ -228,17 +269,107 @@ int Edge::addAssociation (Shape* forme) return HERR; } - tab_assoc.push_back (forme); - if (el_root->debug (2)) - cout << " Edge " << el_name << " addAssociation" << endl; + EdgeShape* gline = geom->findEdge (subid); + int ier = addAssociation (gline, deb, fin); + return ier; +} +// ========================================================== clearAssociation +void Edge::clearAssociation () +{ + int nombre = tab_assoc.size (); + for (int nro=0 ; nro= tab_assoc.size()) + return NULL; + + return tab_assoc [nro]; } -END_NAMESPACE_HEXA +// ========================================================== checkAssociation +int Edge::checkAssociation () +{ + int nombre = tab_assoc.size(); + if (nombre==0) + return HOK; + Real3 ver_assoc [V_TWO]; + int arc [V_TWO], sens [V_TWO]; + for (int nro=0 ; nrogetAssoCoord (ver_assoc[nro]); + } + + int ier = HOK; + for (int nass=0 ; nassonExtremity (ver_assoc[nro]); + if (rep != NOTHING) + { + if (arc[nro] != NOTHING) + { + if (ier==HOK) cout << endl; + cout << " Association Edge " << el_name + << " : Le vertex " << e_vertex[nro]->getName() + << " : Le vertex " << e_vertex[nro]->getName() + << " Touche les lignes " << arc [nro] + << " et " << nass << endl; + ier = 112; + } + arc [nro] = nass; + sens [nro] = rep; + } + } + } + + for (int nro=0 ; nrogetName() + << " , " << e_vertex[V_AVAL ]->getName() + << ")" << endl; + + for (int nv=0 ; nv<2 ; ++nv) + { + Vertex* node = e_vertex[nv]; + cout << node->getName() << " = (" << node->getX() + << ", " << node->getY() << ", " << node->getZ() + << ") -> "<< ver_assoc [nv][0] << ", " << ver_assoc [nv][1] + << ", " << ver_assoc [nv][2] << ")" << endl; + } + + for (int nass=0 ; nassdump (); + } + + return ier; +} +END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexEdge.hxx b/src/HEXABLOCK/HexEdge.hxx index 56ee018..8b095e4 100755 --- a/src/HEXABLOCK/HexEdge.hxx +++ b/src/HEXABLOCK/HexEdge.hxx @@ -36,10 +36,7 @@ public: public: virtual void saveXml (XmlWriter* xml); virtual void replaceVertex (Vertex* old, Vertex* nouveau); - virtual void clearAssociation () { tab_assoc.clear() ; } - virtual void setAssociation (Shape* forme); - virtual bool isAssociated () { return tab_assoc.size() > 0 ; } - virtual int addAssociation (Shape* forme); + virtual void clearAssociation (); Edge (Vertex* va, Vertex* vb); Edge (Edge* other); @@ -74,11 +71,21 @@ public: void setScalar (double valeur); void setColor (double valeur) { setScalar (valeur) ; } - const Shapes & getAssociations () { return tab_assoc ; } + const Shapes & getAssociations () { return tab_shapes ; } virtual void duplicate (); - Edge* getClone () { return e_clone ; } + Edge* getClone () { return e_clone ; } double* getVector (double vecteur[]); + string makeDefinition (); + + virtual int addAssociation (Shape* forme) {return HOK;} // Perime Hexa5 + virtual void setAssociation (Shape* forme) {} // Perime Hexa5 + + int addAssociation (NewShape* geom, int subid, double deb, double fin); + int addAssociation (EdgeShape* gline, double deb, double fin); + int checkAssociation (); + int countAssociation () { return tab_assoc.size () ; } + AssoEdge* getAssociation (int nro); private: friend class Cloner; @@ -88,7 +95,8 @@ private: bool e_way; // Sens de propagation Law* e_law; // Le soleil brille, brille, brille - Shapes tab_assoc; + Shapes tab_shapes; + AssoEdges tab_assoc; }; // ----------------------------------------------- Inlining @@ -173,7 +181,8 @@ inline void Edge::duplicate () e_clone = new Edge (GetClone (e_vertex [V_AMONT]), GetClone (e_vertex [V_AVAL ])); - e_clone->tab_assoc = tab_assoc; + e_clone->tab_shapes = tab_shapes; + e_clone->tab_assoc = tab_assoc; } // =============================================================== getVector inline double* Edge::getVector (double vecteur[]) diff --git a/src/HEXABLOCK/HexEdgeShape.cxx b/src/HEXABLOCK/HexEdgeShape.cxx new file mode 100755 index 0000000..f0cf986 --- /dev/null +++ b/src/HEXABLOCK/HexEdgeShape.cxx @@ -0,0 +1,223 @@ + +// C++ : Gestion des soous-shapes + +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com +// +//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 + +#include "HexEdgeShape.hxx" + +#ifndef NO_CASCADE + +#include +#include +#include + +#include +#include + +#include + +#include + +BEGIN_NAMESPACE_HEXA + +static bool db = on_debug (); // == getenv ("HEXA_DB") > 0 + +// ====================================================== Constructeur +EdgeShape::EdgeShape (NewShape* dad, int id) + : SubShape (dad, id, 1) +{ + maj_curve = true; + lin_curve = NULL; + lin_length = 0; + lin_start [dir_x] = lin_start [dir_y] = lin_start [dir_z] = 0; + lin_end [dir_x] = lin_end [dir_y] = lin_end [dir_z] = 0; + par_mini = 0; + par_maxi = 0; +} +// ====================================================== getCurve +BRepAdaptor_Curve* EdgeShape::getCurve () +{ + if (maj_curve) + updateCurve (); + + return lin_curve; +} +// ====================================================== makeCurve +BRepAdaptor_Curve* EdgeShape::makeCurve () +{ + if (maj_shape) + updateShape (); + + TopoDS_Edge geo_line = TopoDS::Edge (geo_shape); + BRepAdaptor_Curve* curve = new BRepAdaptor_Curve (geo_line); + return curve; +} +// ====================================================== getCoords +void EdgeShape::getCoords (double* pstart, double* pend) +{ + if (maj_curve) + updateCurve (); + + for (int nc=0 ; nc 1.01) + { + point [dir_x] = point [dir_y] = point [dir_z] = 0; + return HERR; + } + else if (param < 0.01) + param = 0; + else if (param > 0.99) + param = 1; + + if (maj_curve) + updateCurve (); + + GCPnts_AbscissaPoint s1 (*lin_curve, param*lin_length, + lin_curve->FirstParameter()); + + double para1 = s1.Parameter (); + gp_Pnt gpnt = lin_curve->Value (para1); + + point [dir_x] = gpnt.X(); + point [dir_y] = gpnt.Y(); + point [dir_z] = gpnt.Z(); + return HOK; +} +// ========================================================= samePoints +bool EdgeShape::samePoints (double* point1, double* point2) +{ + const double Epsilon2 = 1e-4; + bool rep = same_coords (point1, point2, Epsilon2); + return rep; +} +// ========================================================= onExtremity +int EdgeShape::onExtremity (double* point) +{ + if (maj_curve) + updateCurve (); + + if (samePoints (point, lin_start)) + return V_AMONT; + else if (samePoints (point, lin_end)) + return V_AVAL; + else + return NOTHING; +} +// ========================================================= getParam +double EdgeShape::getParam (double* coord) +{ + if (maj_curve) + updateCurve (); + + if (samePoints (coord, lin_start)) + return 0.0; + else if (samePoints (coord, lin_end)) + return 1.0; + + double umin = 0, umax = 0; + gp_Pnt gpoint (coord[dir_x], coord[dir_y], coord[dir_z]); + + TopoDS_Edge geo_line = TopoDS::Edge (geo_shape); + Handle(Geom_Curve) handle = BRep_Tool::Curve (geo_line, umin, umax); + + GeomAPI_ProjectPointOnCurve projector (gpoint, handle); + if ( projector.NbPoints() == 0 ) + return -1.0; + + double gparam = projector.LowerDistanceParameter(); + if (gparam par_maxi) + return -1.0; + + gp_Pnt rpoint = lin_curve->Value (gparam); + Real3 rcoord = { rpoint.X(), rpoint.Y(), rpoint.Z() }; + + if (NOT samePoints (coord, rcoord)) + return -1.0; + + GeomAdaptor_Curve adapt_curve (handle); + double abscis = GCPnts_AbscissaPoint::Length (adapt_curve, umin, gparam); + double hparam = abscis/lin_length; + + // gparam = (gparam-par_mini) / (par_maxi-par_mini); + return hparam; +} +// ====================================================== getAssociation +Edge* EdgeShape::getAssociation (int nro) +{ + if (nro>0 && nroFirstParameter()); + GCPnts_AbscissaPoint s2(*lin_curve, lin_length, lin_curve->FirstParameter()); + + par_mini = s1.Parameter (); + par_maxi = s2.Parameter (); + // Extremites + getPoint (0, lin_start); + getPoint (1, lin_end); +} +END_NAMESPACE_HEXA +#endif diff --git a/src/HEXABLOCK/HexEdgeShape.hxx b/src/HEXABLOCK/HexEdgeShape.hxx new file mode 100644 index 0000000..e68c38a --- /dev/null +++ b/src/HEXABLOCK/HexEdgeShape.hxx @@ -0,0 +1,44 @@ + +// class : Gestion des Sous-shapes categorie Edge + +#ifndef __LIBE_SHAPE_H_ +#define __LIBE_SHAPE_H_ + +#include "HexSubShape.hxx" + +BEGIN_NAMESPACE_HEXA + +class EdgeShape : public SubShape +{ +public : + EdgeShape (NewShape* dad, int id); + + void addAssociation (Edge* elt); + int countAssociation () { return tab_assoc.size(); } + Edge* getAssociation (int nro); + + BRepAdaptor_Curve* getCurve (); + BRepAdaptor_Curve* makeCurve (); + void getCoords (double pstart[], double pend[]); + int getPoint (double param, double point[]); + double getParam (double point[]); + double getLength (); + int onExtremity (double point[]); + + static bool samePoints (double point1[], double point2[]); + + // void saveXml (XmlWriter* xml); +private : + void updateCurve (); + +private : + BRepAdaptor_Curve* lin_curve; + Real3 lin_start; + Real3 lin_end; + double lin_length, par_mini, par_maxi; + + bool maj_curve; + Edges tab_assoc; +}; +END_NAMESPACE_HEXA +#endif diff --git a/src/HEXABLOCK/HexElements.cxx b/src/HEXABLOCK/HexElements.cxx index 730771f..8879c56 100755 --- a/src/HEXABLOCK/HexElements.cxx +++ b/src/HEXABLOCK/HexElements.cxx @@ -36,7 +36,7 @@ static bool db=false; BEGIN_NAMESPACE_HEXA // ====================================================== Constructeur -Elements::Elements (Document* doc) : EltBase (doc) +Elements::Elements (Document* doc) : EltBase (doc, EL_GRID) { glob = Globale::getInstance (); @@ -56,7 +56,8 @@ Elements::Elements (Document* doc) : EltBase (doc) prism_vec = false; } // ====================================================== Constructeur -Elements::Elements (Document* doc, int nx, int ny, int nz) : EltBase (doc) +Elements::Elements (Document* doc, int nx, int ny, int nz) + : EltBase (doc, EL_GRID) { glob = Globale::getInstance (); @@ -132,7 +133,7 @@ void Elements::resize (EnumGrid type, int nx, int ny, int nz, int nplus) return; case GR_JOINT : - nbr_orig = std::max (nx, 1); + nbr_orig = std::max (nx, 1); gr_hauteur = std::max (ny, 1); size_hx = nbr_orig; size_hy = 1; @@ -147,7 +148,7 @@ void Elements::resize (EnumGrid type, int nx, int ny, int nz, int nplus) case GR_REPLACE : nbr_orig = std::max (nx, 1); // nb quads du pattern - gr_hauteur = ny + 1; // Hauteur des hexas + gr_hauteur = ny + 1; // Hauteur des hexas pat_nbvertex = std::max (nz, 1); // nb vertex du pattern pat_nbedges = std::max (nplus, 1); // nb edges du pattern size_hx = nbr_orig; @@ -191,7 +192,7 @@ void Elements::resize (EnumGrid type, int nx, int ny, int nz, int nplus) } // ====================================================== makeCartesianGrid -int Elements::makeCartesianGrid (Vertex* orig, Vector* v1, Vector* v2, +int Elements::makeCartesianGrid (Vertex* orig, Vector* v1, Vector* v2, Vector* v3, int px, int py, int pz, int mx, int my, int mz) { if (BadElement (orig) || BadElement(v1) || BadElement(v2) || BadElement(v3) @@ -211,11 +212,11 @@ int Elements::makeCartesianGrid (Vertex* orig, Vector* v1, Vector* v2, return HOK; } // ====================================================== makeCylindricalGrid -int Elements::makeCylindricalGrid (Vertex* c, Vector* b, Vector* h, +int Elements::makeCylindricalGrid (Vertex* c, Vector* b, Vector* h, double dr, double da, double dl, int nr, int na, int nl, bool fill) { if (BadElement (c) || BadElement(b) || BadElement(h) - || nr<=0 || na<=0 || nl <= 0 || dr < Epsil || da < Epsil || dl < Epsil + || nr<=0 || na<=0 || nl <= 0 || dr < Epsil || da < Epsil || dl < Epsil || b->getNorm () <= Epsil || h->getNorm () <= Epsil) { setError (); @@ -231,8 +232,8 @@ int Elements::makeCylindricalGrid (Vertex* c, Vector* b, Vector* h, // ====================================================== makeSphericalGrid int Elements::makeSphericalGrid (Vertex* c, Vector* dv, int nb, double k) { - if (BadElement (c) || BadElement(dv) - || nb<=0 || k < Epsil + if (BadElement (c) || BadElement(dv) + || nb<=0 || k < Epsil || dv->getDx()<=Epsil || dv->getDy()<=Epsil || dv->getDz()<=Epsil) { setError (); @@ -251,7 +252,7 @@ int Elements::makeSphericalGrid (Vertex* c, Vector* dv, int nb, double k) double dy = glob->CoordVertex (nro, dir_y) * dv->getDy(); double dz = glob->CoordVertex (nro, dir_z) * dv->getDz(); - i_node [nro] = el_root->addVertex (c->getX ()+dx, c->getY ()+dy, + i_node [nro] = el_root->addVertex (c->getX ()+dx, c->getY ()+dy, c->getZ ()+dz); } @@ -264,20 +265,20 @@ int Elements::makeSphericalGrid (Vertex* c, Vector* dv, int nb, double k) if (db) { char nm0[8], nm1 [8], nm2 [8]; - printf (" %2d : %s = %s = [%s, %s] = [%d,%d] = [%s,%s]\n", nro, - glob->namofHexaEdge(nro), i_edge[nro]->getName(nm0), + printf (" %2d : %s = %s = [%s, %s] = [%d,%d] = [%s,%s]\n", nro, + glob->namofHexaEdge(nro), i_edge[nro]->getName(nm0), glob->namofHexaVertex(v1), glob->namofHexaVertex(v2), v1, v2, i_node[v1]->getName(nm1), i_node[v2]->getName(nm2)); } } - + for (int nro=0 ; nroQuadEdge (nro, E_A)], - i_edge[glob->QuadEdge (nro, E_B)], - i_edge[glob->QuadEdge (nro, E_C)], + i_quad[nro] = newQuad (i_edge[glob->QuadEdge (nro, E_A)], + i_edge[glob->QuadEdge (nro, E_B)], + i_edge[glob->QuadEdge (nro, E_C)], i_edge[glob->QuadEdge (nro, E_D)]); - tab_hexa.push_back (newHexa (i_quad[Q_A], i_quad[Q_B], i_quad[Q_C], + tab_hexa.push_back (newHexa (i_quad[Q_A], i_quad[Q_B], i_quad[Q_C], i_quad[Q_D], i_quad[Q_E], i_quad[Q_F])); double lambda = 1; double dcell = 1; @@ -288,11 +289,11 @@ int Elements::makeSphericalGrid (Vertex* c, Vector* dv, int nb, double k) lambda += dcell; addStrate (i_quad, i_edge, i_node, c, lambda/lambda0); } - + return HOK; } // ====================================================== addStrate -int Elements::addStrate (Quad* i_quad[], Edge* i_edge[], Vertex* i_node[], +int Elements::addStrate (Quad* i_quad[], Edge* i_edge[], Vertex* i_node[], Vertex* center, double lambda) { Vertex* e_node [HV_MAXI]; // Les noeuds de l'hexa englobant @@ -322,7 +323,7 @@ int Elements::addStrate (Quad* i_quad[], Edge* i_edge[], Vertex* i_node[], int nv0 = glob->EdgeVertex (nro, V_AMONT); int nv1 = glob->EdgeVertex (nro, V_AVAL ); e_edge[nro] = newEdge (e_node [nv0], e_node [nv1]); - d_quad[nro] = newQuad (i_edge [nro], d_edge [nv0], + d_quad[nro] = newQuad (i_edge [nro], d_edge [nv0], e_edge [nro], d_edge [nv1]); } // Les faces exterieures @@ -335,9 +336,9 @@ int Elements::addStrate (Quad* i_quad[], Edge* i_edge[], Vertex* i_node[], int ne2 = glob->QuadEdge (nro, E_C); int ne3 = glob->QuadEdge (nro, E_D); - e_quad[nro] = newQuad (e_edge[ne0], e_edge[ne1], + e_quad[nro] = newQuad (e_edge[ne0], e_edge[ne1], e_edge[ne2], e_edge[ne3]); - strate = newHexa (i_quad[nro], e_quad[nro], d_quad[ne0], + strate = newHexa (i_quad[nro], e_quad[nro], d_quad[ne0], d_quad[ne2], d_quad[ne1], d_quad[ne3]); tab_hexa.push_back (strate); } @@ -409,7 +410,7 @@ int Elements::saveVtk (cpchar nomfic) // ====================================================== newEdge Edge* Elements::newEdge (Vertex* v1, Vertex* v2) { - if (v1==NULL || v2==NULL) + if (v1==NULL || v2==NULL) return NULL; Edge* elt = new Edge (v1, v2); @@ -425,7 +426,7 @@ Quad* Elements::newQuad (Edge* e1, Edge* e2, Edge* e3, Edge* e4) return elt; } // ====================================================== newHexa -Hexa* Elements::newHexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, +Hexa* Elements::newHexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe, Quad* qf) { if (qa==NULL || qb==NULL || qc==NULL|| qd==NULL || qe==NULL|| qf==NULL) @@ -435,7 +436,7 @@ Hexa* Elements::newHexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, return elt; } // ====================================================== joinQuads -int Elements::joinQuads (Quads& orig, int nb, Vertex* v1, Vertex* v2, +int Elements::joinQuads (Quads& orig, int nb, Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4, Quad* cible) { resize (GR_JOINT, orig.size(), nb); @@ -443,7 +444,7 @@ int Elements::joinQuads (Quads& orig, int nb, Vertex* v1, Vertex* v2, el_root->markAll (IS_NONE); db = on_debug(); // db = el_root->debug (); - + gr_hauteur = nb; nbr_orig = orig.size(); @@ -462,7 +463,7 @@ int Elements::joinQuads (Quads& orig, int nb, Vertex* v1, Vertex* v2, { printf ("\n"); printf (" *** joinQuads : donnees incorrectes\n"); - printf (" *** le %deme quadrangle de depart n'est pas une " + printf (" *** le %deme quadrangle de depart n'est pas une " "face externe\n", nro); face->dump (); setError (); @@ -527,20 +528,20 @@ int Elements::coupler (int nquad, Quad* dest, StrOrient* orient) int n12 = orig->indexVertex (orient->v12); int n21 = dest->indexVertex (orient->v21); int n22 = dest->indexVertex (orient->v22); - + // ---------------- Les 4 sommets initiaux - Vertex* vorig[QUAD4] = { orient->v11, orient->v12, + Vertex* vorig[QUAD4] = { orient->v11, orient->v12, orig->getVertex((n11+2) MODULO QUAD4), orig->getVertex((n12+2) MODULO QUAD4) }; - Vertex* vdest[QUAD4] = { orient->v21, orient->v22, + Vertex* vdest[QUAD4] = { orient->v21, orient->v22, dest->getVertex((n21+2) MODULO QUAD4), dest->getVertex((n22+2) MODULO QUAD4) }; if (db) { printf ("Quad nro %d : ", nquad); - orig->printName (" est couple avec "); - dest->printName ("\n"); + orig->printName (" est couple avec "); + dest->printName ("\n"); printf ("Orientation : ("); for (int ii=0 ; iigetName()); printf (")\n"); @@ -576,15 +577,15 @@ int Elements::coupler (int nquad, Quad* dest, StrOrient* orient) Vertex* ndp = nd; if (nh == gr_hauteur-1) nd = nd2 ; - else - nd = el_root->addVertex (px0 + nh1*dx, py0 + nh1*dy, + else + nd = el_root->addVertex (px0 + nh1*dx, py0 + nh1*dy, pz0 + nh1*dz); int nv = indVertex (nquad, ns, nh); tab_vertex [nv] = nd; tab_edge [nv] = el_root->addEdge (ndp, nd); if (db) - printf (" Edge vertical nro %d = %s = (%s, %s)\n", nv, - tab_edge[nv]->getName(), + printf (" Edge vertical nro %d = %s = (%s, %s)\n", nv, + tab_edge[nv]->getName(), ndp->getName(), nd->getName()); } } @@ -625,7 +626,7 @@ int Elements::coupler (int nquad, Quad* dest, StrOrient* orient) eb = tab_edge [nvb]; if (nh==gr_hauteur-1) ea = dest->findEdge (vdest[ns], vdest[next]); - else + else ea = el_root->addEdge (tab_vertex [nva], tab_vertex [nvb]); propagateAssociation (ec, ea, eb); @@ -660,7 +661,7 @@ int Elements::coupler (int nquad, Quad* dest, StrOrient* orient) if (nh == gr_hauteur-1) fb = dest; else - fb = newQuad (tab_edge [nroEdgeH (nquad, E_A, nh)], + fb = newQuad (tab_edge [nroEdgeH (nquad, E_A, nh)], tab_edge [nroEdgeH (nquad, E_B, nh)], tab_edge [nroEdgeH (nquad, E_C, nh)], tab_edge [nroEdgeH (nquad, E_D, nh)]); @@ -677,7 +678,7 @@ int Elements::coupler (int nquad, Quad* dest, StrOrient* orient) return HOK; } // ====================================================== makeCartesianNodes -int Elements::makeCartesianNodes (Vertex* orig, Vector* v1, Vector* v2, +int Elements::makeCartesianNodes (Vertex* orig, Vector* v1, Vector* v2, Vector* v3, int px, int py, int pz, int mx, int my, int mz) { double dx = v1->getDx() + v2->getDx() + v3->getDx(); @@ -696,7 +697,7 @@ int Elements::makeCartesianNodes (Vertex* orig, Vector* v1, Vector* v2, { Vertex* node = orig; if (nx!=mx || ny!=my || nz!=mz) - node = el_root->addVertex (px0 + nx*dx, py0 + ny*dy, + node = el_root->addVertex (px0 + nx*dx, py0 + ny*dy, pz0 + nz*dz); setVertex (node, nx, ny, nz); nbre++; @@ -704,11 +705,11 @@ int Elements::makeCartesianNodes (Vertex* orig, Vector* v1, Vector* v2, return HOK; } // ====================================================== makeCylindricalNodes -int Elements::makeCylindricalNodes (Vertex* orig, Vector* base, Vector* haut, +int Elements::makeCylindricalNodes (Vertex* orig, Vector* base, Vector* haut, double dr, double da, double dl, int nr, int na, int nl, bool fill) { int ier = makeBasicCylinder (dr, da, dl, nr, na, nl, fill); - if (ier!=HOK) + if (ier!=HOK) return ier; transfoVertices (orig, base, haut); @@ -722,19 +723,19 @@ void Elements::transfoVertices (Vertex* orig, Vector* base, Vector* haut) Vector* kprim = new Vector (haut); int ier = kprim->renormer (); - if (ier!=HOK) + if (ier!=HOK) return; jprim->vectoriel (kprim, base); ier = jprim->renormer (); - if (ier!=HOK) + if (ier!=HOK) return; iprim->vectoriel (jprim, kprim); transfoVertices (orig, iprim, jprim, kprim); } // ====================================================== transfoVertices -void Elements::transfoVertices (Vertex* orig, Vector* iprim, Vector* jprim, +void Elements::transfoVertices (Vertex* orig, Vector* iprim, Vector* jprim, Vector* kprim) { double matrice[DIM3][DIM3]={{iprim->getDx(),jprim->getDx(),kprim->getDx()}, @@ -748,7 +749,7 @@ void Elements::transfoVertices (Vertex* orig, Vector* iprim, Vector* jprim, int nbre = tab_vertex.size (); for (int nro=0 ; nrosetMark (NO_USED); } @@ -763,7 +764,7 @@ void Elements::transfoVertices (Vertex* orig, Vector* iprim, Vector* jprim, for (int ni=0 ; nisetCoord (result[dir_x], result[dir_y], result[dir_z]); node->setMark (IS_USED); } @@ -821,7 +822,7 @@ int Elements::cutHexas (const Edges& t_edges, int nbcuts) Edge* arete = t_edges [nro]; v_amont [nro] = arete->getAmont (); v_aval [nro] = arete->getAval (); - if (db) + if (db) { printf (" %3d : Edge = (", nro); v_amont[nro]->printName (", "); @@ -842,14 +843,14 @@ int Elements::cutHexas (const Edges& t_edges, int nbcuts) for (int nh=0 ; nhgetParent (nh); - if (hexa->getMark () != IS_USED) + if (hexa->getMark () != IS_USED) { hexa->setMark (IS_USED); int namont = hexa->getBase (v_amont[nro], arete); int naval = glob->getOpposedQuad (namont); q_amont.push_back (hexa->getQuad (namont)); q_aval .push_back (hexa->getQuad (naval )); - + if (db) { printf (" %3d : Quad = ", nbfaces); @@ -869,7 +870,7 @@ int Elements::cutHexas (const Edges& t_edges, int nbcuts) nbr_vertex = nbnodes*(nbcuts+2); int nbpiliers = nbnodes*(nbcuts+1); // aretes verticales int nbpoutres = nbcells*(nbcuts+2)*QUAD4; // aretes horizontales - nbr_edges = nbpoutres; + nbr_edges = nbpoutres; nbr_quads = nbcells*(nbcuts+1)*QUAD4; // faces Verticales nbr_hexas = nbcells*(nbcuts+1); @@ -897,8 +898,8 @@ int Elements::cutHexas (const Edges& t_edges, int nbcuts) for (int nc=0; ncaddVertex (ndamont->getX() + nc1*dx, - ndamont->getY() + nc1*dy, + Vertex* nd1 = el_root->addVertex (ndamont->getX() + nc1*dx, + ndamont->getY() + nc1*dy, ndamont->getZ() + nc1*dz); tab_vertex [nc1*nbnodes + ned] = nd1; tab_pilier [nc *nbnodes + ned] = newEdge (nd0, nd1); @@ -930,9 +931,9 @@ int Elements::cutHexas (const Edges& t_edges, int nbcuts) { tab_edge [nc*sizelig + nmur] = tab_edge [nc*sizelig + nmur0]; tab_quad [nc*sizelig + nmur] = tab_quad [nc *sizelig + nmur0]; - if (db) + if (db) { - printf (" %2d : %d quad_vertical [%02d] =", nro, ns, + printf (" %2d : %d quad_vertical [%02d] =", nro, ns, nc*sizelig + nmur); printf (" quad_vertical [%02d]\n", nc*sizelig + nmur0); } @@ -963,7 +964,7 @@ int Elements::cutHexas (const Edges& t_edges, int nbcuts) { v1 = vis_a_vis [vs1]; v2 = vis_a_vis [vs2]; - ed2 = toit->findEdge (v1, v2); + ed2 = toit->findEdge (v1, v2); } tab_edge [nc1*sizelig + nmur] = ed2; @@ -971,9 +972,9 @@ int Elements::cutHexas (const Edges& t_edges, int nbcuts) tab_pilier [nc*nbnodes + nd1], ed2, tab_pilier [nc*nbnodes + nd2]); ed0 = ed2; - if (db) + if (db) { - printf (" %2d : %d quad_vertical [%02d] = ", nro, ns, + printf (" %2d : %d quad_vertical [%02d] = ", nro, ns, nc*sizelig + nmur); PrintName (tab_quad [nc *sizelig + nmur]); printf ("\n"); @@ -984,7 +985,7 @@ int Elements::cutHexas (const Edges& t_edges, int nbcuts) } // ------------------- Les faces horizontales // ------------------- Les hexas - // Rappel : sizelig = nbcells*QUAD4 + // Rappel : sizelig = nbcells*QUAD4 for (int nro=0; nro& table) { int nbelts = table.size(); for (int nro=0 ; nroisValid()) + elt->clearAssociation (); + } } // ====================================================== clear_associations void clear_associations (std::vector& table) { int nbelts = table.size(); for (int nro=0 ; nroisValid()) + elt->clearAssociation (); + } } // ====================================================== clear_associations void clear_associations (std::vector& table) { int nbelts = table.size(); for (int nro=0 ; nroisValid()) + elt->clearAssociation (); + } } // ====================================================== clearAssociation void Elements::clearAssociation () { -// clear_associations (tab_hexa); clear_associations (tab_quad); clear_associations (tab_edge); clear_associations (tab_vertex); - // clear_associations (tab_orig); clear_associations (ker_hquad); clear_associations (ker_vquad); clear_associations (ker_hedge); clear_associations (ker_vedge); - -/* *********************************************** - nbelts = tab_hexa.size(); - for (int nro=0 ; nroisValid()) - elt->clearAssociation (); - } - *********************************************** */ } // ============================================================ findVertex int Elements::findVertex (double vx, double vy, double vz) diff --git a/src/HEXABLOCK/HexElements.hxx b/src/HEXABLOCK/HexElements.hxx index e34d88d..b3fd2ca 100755 --- a/src/HEXABLOCK/HexElements.hxx +++ b/src/HEXABLOCK/HexElements.hxx @@ -29,7 +29,7 @@ BEGIN_NAMESPACE_HEXA -class Elements : public EltBase +class Elements : public EltBase { public: virtual Hexa* getHexa (int nro); @@ -78,22 +78,22 @@ public: void addVertex (Vertex* element); int transform (Matrix* matrice); - int saveVtk (cpchar nomfic); - int saveVtk (cpchar nomfic, int& nro); + int saveVtk (cpchar nomfic); + int saveVtk (cpchar nomfic, int& nro); - int makeCartesianGrid (Vertex* orig, Vector* v1, Vector* v2, Vector* v3, + int makeCartesianGrid (Vertex* orig, Vector* v1, Vector* v2, Vector* v3, int px, int py, int pz, int mx=0, int my=0, int mz=0); int makeCylinder (Cylinder* cyl, Vector* base, int nr, int na, int nl); int makePipe (Cylinder* cyl, Vector* base, int nr, int na, int nl); - int makeCylindricalGrid (Vertex* c, Vector* b, Vector* h, + int makeCylindricalGrid (Vertex* c, Vector* b, Vector* h, double dr, double da, double dl, int nr, int na, int nl, bool fill); int makeSphericalGrid (Vertex* v, Vector* dv, int nb, double k=1); // perime int makeSphericalGrid (Vertex* v, double rayon, int nb, double k=1); - int joinQuads (Quads& q0, int nb, Vertex* v1, Vertex* v2, Vertex* v3, + int joinQuads (Quads& q0, int nb, Vertex* v1, Vertex* v2, Vertex* v3, Vertex* v4, Quad* dest); int coupler (int nro, Quad* other, StrOrient* orient); @@ -115,45 +115,45 @@ public: int nroVertex (int nsommet, int nquad, int nh); - // Evols Hexa3 + // Evols Hexa3 int getCylPoint (int nr, int na, int nh, double& px, double& py, double& pz); - int revolutionQuads (Quads& start, Vertex* center, Vector* axis, + int revolutionQuads (Quads& start, Vertex* center, Vector* axis, RealVector &angles); - int makeRind (EnumGrid type, Vertex* center, Vector* vx, Vector* vz, + int makeRind (EnumGrid type, Vertex* center, Vector* vx, Vector* vz, double rext, double rint, double radhole, Vertex* plorig, double angle, int nrad, int nang, int nhaut); - static int controlRind (EnumGrid type, Vertex* cx, Vector* vx, Vector* vz, + static int controlRind (EnumGrid type, Vertex* cx, Vector* vx, Vector* vz, double rext, double rint, double radhole, - Vertex* plorig, double angle, - int nrad, int nang, int nhaut, + Vertex* plorig, double angle, + int nrad, int nang, int nhaut, double &phi0, double &phi1); - int makeCylindricalGrid (Vertex* c, Vector* b, Vector* h, - RealVector& tdr, RealVector& tda, RealVector& tdh, + int makeCylindricalGrid (Vertex* c, Vector* b, Vector* h, + RealVector& tdr, RealVector& tda, RealVector& tdh, bool fill=false); - int replaceHexas (Quads& pattern, Vertex* p1, Vertex* c1, + int replaceHexas (Quads& pattern, Vertex* p1, Vertex* c1, Vertex* p2, Vertex* c2, Vertex* p3, Vertex* c3); int replaceHexa (int nh, Pattern* pat, Hexa* hexa); int replaceQuad (int nh, Pattern* pat, Quad* quad, Vertex* tvert[]); int extrudeQuad (Pattern* pat); - void repVertex (int nh, int nro, Vertex* node); - void repEdgeH (int nh, int nro, Edge* node); - void repEdgeV (int nh, int nro, Edge* node); - void repQuadH (int nh, int nro, Quad* node); - void repQuadV (int nh, int nro, Quad* node); + void repVertex (int nh, int nro, Vertex* node); + void repEdgeH (int nh, int nro, Edge* node); + void repEdgeV (int nh, int nro, Edge* node); + void repQuadH (int nh, int nro, Quad* node); + void repQuadV (int nh, int nro, Quad* node); Vertex* repVertex (int nh, int nro, double px, double py, double pz); Edge* repEdgeV (int nh, int nro, Vertex* v1, Vertex*v2); Edge* repEdgeH (int nh, int nro, Vertex* v1, Vertex*v2); Quad* repQuadH (int nh, int nro, Edge* ea, Edge* eb, Edge* ec, Edge* ed); Quad* repQuadV (int nh, int nro, Edge* ea, Edge* eb, Edge* ec, Edge* ed); - Hexa* repHexa (int nh, int nro, Quad* qa, Quad* qb, Quad* qc, + Hexa* repHexa (int nh, int nro, Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe, Quad* qf); Vertex* repVertex (int nh, int nro); @@ -171,27 +171,28 @@ public: void moveDisco (Hexa* hexa); protected : - // Evols Hexa3 + // Evols Hexa3 void cutAssociation (Shapes& tshapes, Edges& tedges, bool exist=true); void assoCylinder (Vertex* center, Vector* vz, double rayon); void assoCylinders (Vertex* center, Vector* vz, double ray, RealVector& ta); - void assoRind (double* center, double* vx, int nx); + void assoRind (double* center, double* vx, int nx, NewShape* geom); + void assoSphere (Vertex* center, Edge* t_edge[], Quad* t_quad[]); - void assoCircle (double* center, Edge* ed1, Edge* ed2); + void assoCircle (double* center, Edge* ed1, Edge* ed2, NewShape* geom); void assoResiduelle (); - int makeBasicCylinder (RealVector& tdr, RealVector& tda, RealVector& tdh, + int makeBasicCylinder (RealVector& tdr, RealVector& tda, RealVector& tdh, bool fill=false); int propagateAssociation (Edge* orig, Edge* dest, Edge* dir1); int prismAssociation (Edge* orig, Edge* dest, int nh, Edge* dir); - // Evols Hexa4 + // Evols Hexa4 void updateMatrix (int hauteur); void endPrism (); protected : - + int fillGrid (); void fillCenter (); void fillCenter4 (); @@ -211,16 +212,16 @@ protected : void resize (EnumGrid type, int nx, int ny=0, int nz=0, int nplus=0); - int makeCartesianNodes (Vertex* orig, Vector* v1, Vector* v2, Vector* v3, + int makeCartesianNodes (Vertex* orig, Vector* v1, Vector* v2, Vector* v3, int px, int py, int pz, int mx=0, int my=0, int mz=0); - int makeCylindricalNodes (Vertex* c, Vector* b, Vector* h, + int makeCylindricalNodes (Vertex* c, Vector* b, Vector* h, double dr, double da, double dl, int nr, int na, int nl, bool fill); - int makeBasicCylinder (double dr, double da, double dl, int nr, int na, + int makeBasicCylinder (double dr, double da, double dl, int nr, int na, int nl, bool fill); - int addStrate (Quad* i_quad[], Edge* i_edge[], Vertex* i_node[], + int addStrate (Quad* i_quad[], Edge* i_edge[], Vertex* i_node[], Vertex* center, double lambda); int indVertex (int nsommet, int nquad, int nh); @@ -229,7 +230,7 @@ protected : int nroEdgeH (int nsommet, int nquad, int nh); int nroHexa (int nquad, int nh); - void copyVertex (Elements* other, int px, int py, int pz, + void copyVertex (Elements* other, int px, int py, int pz, int nx, int ny, int nz); void completerGrille (double hauteur); @@ -269,7 +270,7 @@ protected : RealVector gen_values; // Angle pour la revolution Matrix gen_matrix; // Evols Hexa4 - bool prism_vec ; + bool prism_vec ; Real3 prism_dir; // EnumGrid grid_type; // deja la @@ -277,7 +278,7 @@ protected : double cyl_length; double cyl_radhole, cyl_radext, cyl_radint; double cyl_dtheta; // angle = na*dtheta - double cyl_phi0, cyl_dphi; // angle = phi0 + nh*dphi; + double cyl_phi0, cyl_dphi; // angle = phi0 + nh*dphi; int pat_nbedges; int pat_nbvertex; @@ -288,7 +289,7 @@ protected : }; // =================================================== getStrate inline Hexa* Elements::getStrate (int couche, EnumHQuad nroface) -{ +{ Hexa* cell = NULL; int nro = couche <= 0 ? 0 : (couche-1)*HQ_MAXI + nroface + 1; @@ -297,16 +298,16 @@ inline Hexa* Elements::getStrate (int couche, EnumHQuad nroface) else cell = tab_hexa [nro]; - return cell; + return cell; } // ============================================================ setHexa -inline void Elements::setHexa (Hexa* elt, int nro) +inline void Elements::setHexa (Hexa* elt, int nro) { if (nro >=0 && nro < nbr_hexas) tab_hexa [nro] = elt; } // ============================================================ setQuad -inline void Elements::setQuad (Quad* elt, int nro) +inline void Elements::setQuad (Quad* elt, int nro) { if (nro >=0 && nro < nbr_quads) tab_quad [nro] = elt; @@ -331,19 +332,19 @@ inline Hexa* Elements::getHexa (int nro) Hexa* elt = NULL; int nombre=tab_hexa.size(); // if (nro >=0 && nro < nbr_hexas && el_status == HOK Abu 2010/05/06 - if (nro >=0 && nro < nombre && el_status == HOK + if (nro >=0 && nro < nombre && el_status == HOK && tab_hexa [nro] != NULL && tab_hexa [nro]->isValid()) - elt = tab_hexa [nro]; + elt = tab_hexa [nro]; return elt; } // ============================================================ getQuad -inline Quad* Elements::getQuad (int nro) +inline Quad* Elements::getQuad (int nro) { Quad* elt = NULL; - if (nro >=0 && nro < nbr_quads && el_status == HOK + if (nro >=0 && nro < nbr_quads && el_status == HOK && tab_quad [nro] != NULL && tab_quad [nro]->isValid()) - elt = tab_quad [nro]; + elt = tab_quad [nro]; return elt; } @@ -351,9 +352,9 @@ inline Quad* Elements::getQuad (int nro) inline Edge* Elements::getEdge (int nro) { Edge* elt = NULL; - if (nro >=0 && nro < nbr_edges && el_status == HOK + if (nro >=0 && nro < nbr_edges && el_status == HOK && tab_edge [nro] != NULL && tab_edge [nro]->isValid()) - elt = tab_edge [nro]; + elt = tab_edge [nro]; return elt; } @@ -361,9 +362,9 @@ inline Edge* Elements::getEdge (int nro) inline Vertex* Elements::getVertex (int nro) { Vertex* elt = NULL; - if (nro >=0 && nro < nbr_vertex && el_status == HOK + if (nro >=0 && nro < nbr_vertex && el_status == HOK && tab_vertex [nro] != NULL && tab_vertex [nro]->isValid()) - elt = tab_vertex [nro]; + elt = tab_vertex [nro]; return elt; } diff --git a/src/HEXABLOCK/HexElements_asso.cxx b/src/HEXABLOCK/HexElements_asso.cxx index f561573..1fc055d 100755 --- a/src/HEXABLOCK/HexElements_asso.cxx +++ b/src/HEXABLOCK/HexElements_asso.cxx @@ -22,6 +22,7 @@ #include "HexElements.hxx" #include "HexEdge.hxx" +#include "HexDocument.hxx" #ifndef NO_CASCADE #include "HexKasBiCylinder.hxx" @@ -49,9 +50,9 @@ // HEXABLOCK includes #include "HexVertex.hxx" -#include "HexShape.hxx" +#include "HexOldShape.hxx" #include "HexDiagnostics.hxx" - // Cercles + // Cercles #include #include @@ -88,11 +89,11 @@ void Elements::cutAssociation (Shapes& tshapes, Edges& tedges, bool exist) char foo[18]; int nbedges = tedges.size(); int nbshapes = tshapes.size (); - if (nbshapes==0) + if (nbshapes==0) return; std::vector tab_gline (nbshapes); - + Vertex* prems = tedges [0] -> getVertex (V_AMONT); Vertex* derns = tedges [nbedges-1] -> getVertex (V_AVAL); @@ -107,13 +108,13 @@ void Elements::cutAssociation (Shapes& tshapes, Edges& tedges, bool exist) el_root->putError (W_ASSO_CUT1, prems->getName (foo)); return; } - else if (pnt_last.isBad ()) + else if (pnt_last.isBad ()) { el_root->putError (W_ASSO_CUT2, derns->getName (foo)); return; } } - // ----------- Define + longueur totale + // ----------- Define + longueur totale double longueur = 0; for (int ns = 0 ; nsputError (W_ASSO_CUT3, derns->getName (foo)); @@ -172,11 +173,11 @@ void Elements::cutAssociation (Shapes& tshapes, Edges& tedges, bool exist) double delta = longueur / nbedges; for (int ned = 0 ; nedgetAssociation() != NULL) return; - + Real3 koord = { node->getX(), node->getY(), node->getZ() }; KasPoint asso_point ; asso_point.definePoint (koord); asso_point.associate (node); } -// ====================================================== geom_create_circle -void geom_create_circle (double* milieu, double rayon, double* normale, +// ====================================================== geom_create_circle +void geom_create_circle (double* milieu, double rayon, double* normale, double* base, string& brep) { db = on_debug (); - if (db) printf ("geom_create_circle c=(%g,%g,%g), r=%g\n", + if (db) printf ("geom_create_circle c=(%g,%g,%g), r=%g\n", milieu[0], milieu[1], milieu[2], rayon); if (db) printf (" -------- base=(%g,%g,%g)\n", base[0], base[1], base[2]); - if (db) printf (" -------- norm=(%g,%g,%g)\n", normale[0], normale[1], + if (db) printf (" -------- norm=(%g,%g,%g)\n", normale[0], normale[1], normale[2]); gp_Pnt gp_center (milieu [dir_x], milieu [dir_y], milieu [dir_z]); @@ -250,12 +251,12 @@ void geom_create_circle (double* milieu, double rayon, double* normale, geom_curve.FirstParameter()); double u1 = s1.Parameter (); gp_Pnt point = geom_curve.Value (u1); - if (db) + if (db) printf ( " ..... pnt%d = (%g, %g, %g)\n", pk, point.X(), point.Y(), point.Z()); } } -// ====================================================== geom_create_sphere +// ====================================================== geom_create_sphere void geom_create_sphere (double* milieu, double radius, string& brep) { gp_Pnt gp_center (milieu [dir_x], milieu [dir_y], milieu [dir_z]); @@ -266,7 +267,7 @@ void geom_create_sphere (double* milieu, double radius, string& brep) make_sphere.Build(); ostringstream stream_shape; - TopoDS_Shape geom_sphere = make_sphere.Face(); + TopoDS_Shape geom_sphere = make_sphere.Face(); BRepTools::Write (geom_sphere, stream_shape); brep = stream_shape.str(); } @@ -286,20 +287,20 @@ void geom_dump_asso (Edge* edge) edge->printName(" = ("); edge->getVertex (V_AMONT)-> printName (", "); edge->getVertex (V_AVAL) -> printName (")\n"); - + KasPoint asso_point; for (int nro=0 ; nrogetVertex (nro); vertex->printName (""); - printf (" = (%g, %g, %g)", vertex->getX(), vertex->getY(), + printf (" = (%g, %g, %g)", vertex->getX(), vertex->getY(), vertex->getZ()); int ier = asso_point.definePoint (vertex); if (ier==HOK) { double* coord = asso_point.getCoord(); - printf (", pnt_asso = (%g, %g, %g)", coord[dir_x], coord[dir_y], + printf (", pnt_asso = (%g, %g, %g)", coord[dir_x], coord[dir_y], coord[dir_z]); } printf ("\n"); @@ -322,9 +323,9 @@ void geom_dump_asso (Edge* edge) double* fin = asso_line.getEnd (); double lg = asso_line.getLength (); printf (" Longueur = %g\n", lg); - printf (" Debut = %g = (%g, %g, %g)\n", shape->debut, + printf (" Debut = %g = (%g, %g, %g)\n", shape->getStart(), deb[0], deb[1], deb[2]); - printf (" Fin = %g = (%g, %g, %g)\n", shape->fin, + printf (" Fin = %g = (%g, %g, %g)\n", shape->getEnd(), fin[0], fin[1], fin[2]); } } @@ -341,7 +342,7 @@ void translate_brep (string& brep, double dir[], string& trep) transfo.SetTranslation (vecteur); istringstream stream_brep (brep); BRepTools::Read (orig, stream_brep, builder); - + TopLoc_Location loc_orig = orig.Location(); gp_Trsf trans_orig = loc_orig.Transformation(); TopLoc_Location loc_result (transfo * trans_orig); @@ -360,12 +361,12 @@ void transfo_brep (string& brep, Matrix* matrice, string& trep) double a11,a12,a13,a14, a21,a22,a23,a24, a31,a32,a33,a34; matrice->getCoeff (a11,a12,a13,a14, a21,a22,a23,a24, a31,a32,a33,a34); - transfo.SetValues (a11,a12,a13,a14, a21,a22,a23,a24, a31,a32,a33,a34, + transfo.SetValues (a11,a12,a13,a14, a21,a22,a23,a24, a31,a32,a33,a34, Epsil2, Epsil2); istringstream stream_brep (brep); BRepTools::Read (shape_orig, stream_brep, builder); - + BRepBuilderAPI_Transform brep_transfo (shape_orig, transfo, Standard_True); TopoDS_Shape result = brep_transfo.Shape(); @@ -381,11 +382,11 @@ void clear_associations (Edge* edge) edge->getVertex(V_AVAL )->clearAssociation(); } // ====================================================== associateShapes -int associateShapes (Edges& mline, int msens[], Shape* gstart, Shapes& gline, +int associateShapes (Edges& mline, int msens[], Shape* gstart, Shapes& gline, double pstart, double pend, bool closed, bool inv) { db = on_debug (); - if (db) + if (db) { cout << "____________________________________________" << " associateShapes" << endl; @@ -397,9 +398,9 @@ int associateShapes (Edges& mline, int msens[], Shape* gstart, Shapes& gline, } int nbshapes = gline.size (); - int nblines = nbshapes + 1; + int nblines = nbshapes + 1; - vector buff_line (nblines); // car nblines != 0 + vector buff_line (nblines); // car nblines != 0 vector geom_line (nblines); // -------- Bufferisation des shapes @@ -414,12 +415,12 @@ int associateShapes (Edges& mline, int msens[], Shape* gstart, Shapes& gline, if (closed) { if (pstart > UnEpsil) - { + { inv = true; pstart = 0; } else if (pstart < Epsil) - { + { inv = false; } } @@ -461,7 +462,7 @@ int associateShapes (Edges& mline, int msens[], Shape* gstart, Shapes& gline, sdepart = V_AMONT; pfin0 = pend; } - else + else { sdepart = V_AVAL; pfin0 = pend; @@ -507,7 +508,7 @@ int associateShapes (Edges& mline, int msens[], Shape* gstart, Shapes& gline, int ntlines = geom_line.size(); int nbedges = mline.size (); - if (db) + if (db) cout << "==============================================================" << endl; // -------- Menage @@ -535,24 +536,38 @@ void set_debug_asso (bool boule) if (db) printf (" ... Traces actives dans HexAssoElements_asso.cxx\n"); } +// ====================================================== clean_brep +void clean_brep (string& brep) +{ + TopoDS_Shape shape; + BRep_Builder builder; + istringstream stream_brep (brep); + + BRepTools::Read (shape, stream_brep, builder); + BRepTools::Clean (shape); + + ostringstream stream_shape; + BRepTools::Write (shape, stream_shape); + brep = stream_shape.str(); +} END_NAMESPACE_HEXA - + // ------------------------------------------------------------------------ #else // #ifndef NO_CASCADE // ------------------------------------------------------------------------ BEGIN_NAMESPACE_HEXA -// ====================================================== geom_create_circle -void geom_create_circle (double* milieu, double rayon, double* normale, +// ====================================================== geom_create_circle +void geom_create_circle (double* milieu, double rayon, double* normale, double* base, string& brep) { char buffer [80]; - sprintf (buffer, "(Cercle c=(%g,%g,%g), r=%g", + sprintf (buffer, "(Cercle c=(%g,%g,%g), r=%g", milieu[0], milieu[1], milieu[2], rayon); brep = buffer; } -// ====================================================== geom_create_sphere +// ====================================================== geom_create_sphere void geom_create_sphere (double* milieu, double radius, string& brep) { } @@ -614,5 +629,9 @@ int geom_asso_cylcyl (Edge* edge) { return HOK; } +// ====================================================== clean_brep +void clean_brep (string& brep) +{ +} END_NAMESPACE_HEXA #endif diff --git a/src/HEXABLOCK/HexElements_bis.cxx b/src/HEXABLOCK/HexElements_bis.cxx index 77658c3..ceb671e 100755 --- a/src/HEXABLOCK/HexElements_bis.cxx +++ b/src/HEXABLOCK/HexElements_bis.cxx @@ -30,14 +30,14 @@ #include "HexGlobale.hxx" #include "HexCylinder.hxx" -#include "HexShape.hxx" +#include "HexOldShape.hxx" #include BEGIN_NAMESPACE_HEXA void geom_dump_asso (Edge* edge); -void geom_create_circle (double* milieu, double rayon, double* normale, +void geom_create_circle (double* milieu, double rayon, double* normale, double* base, string& brep); // ====================================================== getHexaIJK @@ -50,9 +50,11 @@ Hexa* Elements::getHexaIJK (int nx, int ny, int nz) else if (grid_nocart) return NULL; - int nro = nx + size_hx*ny + size_hx*size_hy*nz; + int nro = nx + size_hx*ny + size_hx*size_hy*nz; - return tab_hexa [nro]; + DumpStart ("getHexaIJK", nx << ny << nz); + DumpReturn (tab_hexa [nro]); + return tab_hexa [nro]; } // ====================================================== getQuadIJ Quad* Elements::getQuadIJ (int nx, int ny, int nz) @@ -64,9 +66,12 @@ Quad* Elements::getQuadIJ (int nx, int ny, int nz) else if (grid_nocart) return NULL; - int nro = nx + size_qx*ny + size_qx*size_qy*nz + int nro = nx + size_qx*ny + size_qx*size_qy*nz + size_qx*size_qy*size_qz*dir_z; - return tab_quad [nro]; + + DumpStart ("getQuadIJ", nx << ny << nz); + DumpReturn (tab_quad [nro]); + return tab_quad [nro]; } // ====================================================== getQuadJK Quad* Elements::getQuadJK (int nx, int ny, int nz) @@ -80,7 +85,9 @@ Quad* Elements::getQuadJK (int nx, int ny, int nz) int nro = nx + size_qx*ny + size_qx*size_qy*nz; // + dir_x*... - return tab_quad [nro]; + DumpStart ("getQuadJK", nx << ny << nz); + DumpReturn (tab_quad [nro]); + return tab_quad [nro]; } // ====================================================== getQuadIK Quad* Elements::getQuadIK (int nx, int ny, int nz) @@ -94,7 +101,9 @@ Quad* Elements::getQuadIK (int nx, int ny, int nz) int nro = nx + size_qx*ny + size_qx*size_qy*nz + size_qx*size_qy*size_qz; - return tab_quad [nro]; + DumpStart ("getQuadIK", nx << ny << nz); + DumpReturn (tab_quad [nro]); + return tab_quad [nro]; } // ====================================================== getEdgeI Edge* Elements::getEdgeI (int nx, int ny, int nz) @@ -108,7 +117,9 @@ Edge* Elements::getEdgeI (int nx, int ny, int nz) int nro = nx + size_ex*ny + size_ex*size_ey*nz; - return tab_edge [nro]; + DumpStart ("getEdgeI", nx << ny << nz); + DumpReturn (tab_edge [nro]); + return tab_edge [nro]; } // ====================================================== getEdgeJ Edge* Elements::getEdgeJ (int nx, int ny, int nz) @@ -122,7 +133,9 @@ Edge* Elements::getEdgeJ (int nx, int ny, int nz) int nro = nx + size_ex*ny + size_ex*size_ey*nz + size_ex*size_ey*size_ez; - return tab_edge [nro]; + DumpStart ("getEdgeJ", nx << ny << nz); + DumpReturn (tab_edge [nro]); + return tab_edge [nro]; } // ====================================================== getEdgeK Edge* Elements::getEdgeK (int nx, int ny, int nz) @@ -134,9 +147,12 @@ Edge* Elements::getEdgeK (int nx, int ny, int nz) else if (grid_nocart) return NULL; - int nro = nx + size_ex*ny + size_ex*size_ey*nz + int nro = nx + size_ex*ny + size_ex*size_ey*nz + size_ex*size_ey*size_ez*dir_z; - return tab_edge [nro]; + + DumpStart ("getEdgeK", nx << ny << nz); + DumpReturn (tab_edge [nro]); + return tab_edge [nro]; } // ====================================================== getVertexIJK Vertex* Elements::getVertexIJK (int nx, int ny, int nz) @@ -148,25 +164,27 @@ Vertex* Elements::getVertexIJK (int nx, int ny, int nz) else if (grid_nocart) return NULL; - int nro = nx + size_vx*ny + size_vx*size_vy*nz; + int nro = nx + size_vx*ny + size_vx*size_vy*nz; - return tab_vertex [nro]; + DumpStart ("getVertexIJK", nx << ny << nz); + DumpReturn (tab_vertex [nro]); + return tab_vertex [nro]; } // ====================================================== setVertex void Elements::setVertex (Vertex* elt, int nx, int ny, int nz) { - if ( nx < 0 || nx >= size_vx || ny < 0 || ny >= size_vy - || nz < 0 || nz >= size_vz) return; + if ( nx < 0 || nx >= size_vx || ny < 0 || ny >= size_vy + || nz < 0 || nz >= size_vz) return; int nro = nx + size_vx*ny + size_vx*size_vy*nz; tab_vertex [nro] = elt; } // ====================================================== setVertex (2) -void Elements::setVertex (int nx, int ny, int nz, double px, double py, +void Elements::setVertex (int nx, int ny, int nz, double px, double py, double pz) { - if ( nx < 0 || nx >= size_vx || ny < 0 || ny >= size_vy - || nz < 0 || nz >= size_vz) return; + if ( nx < 0 || nx >= size_vx || ny < 0 || ny >= size_vy + || nz < 0 || nz >= size_vz) return; Vertex* node = el_root->addVertex (px, py, pz); setVertex (node, nx, ny, nz); @@ -179,7 +197,7 @@ void Elements::setEdge (Edge* elt, EnumCoord dir, int nx, int ny, int nz) return; int nro = nx + size_ex*ny + size_ex*size_ey*nz + size_ex*size_ey*size_ez*dir; - tab_edge [nro] = elt; + tab_edge [nro] = elt; } // ====================================================== setQuad void Elements::setQuad (Quad* elt, EnumCoord dir, int nx, int ny, int nz) @@ -189,13 +207,13 @@ void Elements::setQuad (Quad* elt, EnumCoord dir, int nx, int ny, int nz) return; int nro = nx + size_ex*ny + size_ex*size_ey*nz + size_ex*size_ey*size_ez*dir; - tab_quad [nro] = elt; + tab_quad [nro] = elt; } // ====================================================== setHexa void Elements::setHexa (Hexa* elt, int nx, int ny, int nz) { - if ( nx < 0 || nx >= size_hx || ny < 0 || ny >= size_hy - || nz < 0 || nz >= size_hz) return; + if ( nx < 0 || nx >= size_hx || ny < 0 || ny >= size_hy + || nz < 0 || nz >= size_hz) return; int nro = nx + size_hx*ny + size_hx*size_hy*nz; tab_hexa [nro] = elt; @@ -223,10 +241,10 @@ int Elements::makeCylinder (Cylinder* cyl, Vector* vx, int nr, int na, int nl) Vector* dir = cyl->getDirection (); double ray = cyl->getRadius (); double haut = cyl->getHeight (); - + resize (GR_CYLINDRIC, nr, na, nl); cyl_closed = true; - makeCylindricalNodes (orig, vx, dir, ray/(nr+1), 360, haut/nl, + makeCylindricalNodes (orig, vx, dir, ray/(nr+1), 360, haut/nl, nr, na, nl, true); fillGrid (); assoCylinder (orig, dir, 360); @@ -246,7 +264,7 @@ int Elements::makePipe (Cylinder* cyl, Vector* vx, int nr, int na, int nl) Vector* dir = cyl->getDirection (); double ray = cyl->getRadius (); double haut = cyl->getHeight (); - + resize (GR_CYLINDRIC, nr, na, nl); cyl_closed = true; makeCylindricalNodes (orig, vx, dir, ray, 360, haut, nr, na, nl, false); @@ -254,7 +272,7 @@ int Elements::makePipe (Cylinder* cyl, Vector* vx, int nr, int na, int nl) assoCylinder (orig, dir, 360); return HOK; } -// +// // ---------------------------------------- prism Quads // // ====================================================== prismQuads @@ -293,7 +311,7 @@ int Elements::prismQuads (Quads& tstart, Vector* dir, int nbiter) return HOK; } // ====================================================== prismQuadsVec -int Elements::prismQuadsVec (Quads& tstart, Vector* dir, RealVector& tlen, +int Elements::prismQuadsVec (Quads& tstart, Vector* dir, RealVector& tlen, int mode) { int nbiter = tlen.size(); @@ -403,7 +421,7 @@ int Elements::prismHexas (int nro, Quad* qbase, int hauteur) Real3 ph, hm; for (int dd=dir_x; dd<=dir_z ; dd++) { - ph [dd] = centre [dd] + oh*vk[dd]; + ph [dd] = centre [dd] + oh*vk[dd]; hm [dd] = point [dd] - ph[dd]; rayon += hm[dd] * hm[dd]; } @@ -431,7 +449,7 @@ int Elements::prismHexas (int nro, Quad* qbase, int hauteur) if (revo_lution) { double alpha = beta; - beta = alpha + gen_values[nh]; + beta = alpha + gen_values[nh]; Shape* shape = new Shape (c_rep); shape->setBounds (alpha/360, beta/360); pilier->addAssociation (shape); @@ -460,7 +478,7 @@ int Elements::prismHexas (int nro, Quad* qbase, int hauteur) for (int nh=0 ; nh #include diff --git a/src/HEXABLOCK/HexElements_ter.cxx b/src/HEXABLOCK/HexElements_ter.cxx index cf1a35e..23f5e9c 100755 --- a/src/HEXABLOCK/HexElements_ter.cxx +++ b/src/HEXABLOCK/HexElements_ter.cxx @@ -1,4 +1,3 @@ - // C++ : Table d'hexaedres (Evol Versions 3) // Copyright (C) 2009-2012 CEA/DEN, EDF R&D @@ -22,31 +21,29 @@ #include "HexElements.hxx" +#include "HexDocument.hxx" #include "HexVector.hxx" #include "HexVertex.hxx" #include "HexEdge.hxx" #include "HexHexa.hxx" #include "HexMatrix.hxx" -#include "HexShape.hxx" #include "HexGlobale.hxx" +#include "HexNewShape.hxx" +#include "HexEdgeShape.hxx" + #include BEGIN_NAMESPACE_HEXA -void geom_create_circle (double* milieu, double rayon, double* normale, - double* base, string& brep); -void geom_create_sphere (double* milieu, double radius, string& brep); - void translate_brep (string& brep, double vdir[], string& trep); void transfo_brep (string& brep, Matrix* matrice, string& trep); -void geom_asso_point (Vertex* node); static bool db=false; // ====================================================== makeRind -int Elements::makeRind (EnumGrid type, Vertex* center, Vector* vx, Vector* vz, - double radext, double radint, double radhole, +int Elements::makeRind (EnumGrid type, Vertex* center, Vector* vx, Vector* vz, + double radext, double radint, double radhole, Vertex* plorig, double angle, int nr, int na, int nl) { double phi1; @@ -77,7 +74,7 @@ int Elements::makeRind (EnumGrid type, Vertex* center, Vector* vx, Vector* vz, Vertex* node = el_root->addVertex (px, py, pz); setVertex (node, nx, ny, nz); } - if (cyl_closed) + if (cyl_closed) for (int nx=0 ; nx= rext) + if (rint >= rext) return HERR; - if (rhole > rint) + if (rhole > rint) return HERR; double nvx = vx->getNorm(); double nvz = vz->getNorm(); - if (nvx < Epsil1 || nvz < Epsil1) + if (nvx < Epsil1 || nvz < Epsil1) return HERR; double alpha = asin (rhole/rext); double beta = -M_PI*DEMI; - if (type==GR_HEMISPHERIC || type==GR_PART_SPHERIC) + if (type==GR_HEMISPHERIC || type==GR_PART_SPHERIC) alpha = 2*alpha; if (px!=NULL) @@ -167,17 +164,17 @@ int Elements::controlRind (EnumGrid type, Vertex* cx, Vector* vx, Vector* vz, double oh = ((px->getX() - cx->getX()) * vz->getDx() + (px->getY() - cx->getY()) * vz->getDy() + (px->getZ() - cx->getZ()) * vz->getDz()) / nvz; - if (oh > rext) + if (oh > rext) return HERR; - else if (oh > -rext) + else if (oh > -rext) beta = asin (oh/rext); } phi0 = std::max (alpha - M_PI*DEMI, beta); phi1 = M_PI*DEMI - alpha; - return HOK; + return HOK; } -// ====================================================== getHexas +// ====================================================== getHexas int Elements::getHexas (Hexas& liste) { liste.clear (); @@ -189,16 +186,21 @@ int Elements::getHexas (Hexas& liste) } return HOK; } -// ====================================================== assoCylinder +// ====================================================== assoCylinder void Elements::assoCylinder (Vertex* ori, Vector* normal, double angle) { RealVector tangles; assoCylinders (ori, normal, angle, tangles); } -// ====================================================== assoCylinders -void Elements::assoCylinders (Vertex* ori, Vector* normal, double angle, +// ====================================================== assoCylinders +void Elements::assoCylinders (Vertex* ori, Vector* normal, double angle, RealVector& t_angles) { + char name [12]; + sprintf (name, "grid_%02d", el_id); + NewShape* geom = el_root->addShape (name, SH_CYLINDER); + geom -> openShape(); + int na = t_angles.size(); bool regul = na == 0; double alpha = angle/size_hy; @@ -211,9 +213,9 @@ void Elements::assoCylinders (Vertex* ori, Vector* normal, double angle, { for (int nx=0 ; nxgetX() - ori->getX(), - pm->getY() - ori->getY(), + Vertex* pm = getVertexIJK (nx, 0, nz); + Real3 om = { pm->getX() - ori->getX(), + pm->getY() - ori->getY(), pm->getZ() - ori->getZ() }; double oh = prod_scalaire (om, vk); @@ -221,28 +223,28 @@ void Elements::assoCylinders (Vertex* ori, Vector* normal, double angle, Real3 ph, hm; for (int dd=dir_x; dd<=dir_z ; dd++) { - ph [dd] = ori->getCoord(dd) + oh*vk[dd]; + ph [dd] = ori->getCoord(dd) + oh*vk[dd]; hm [dd] = pm ->getCoord(dd) - ph[dd]; rayon += hm[dd] * hm[dd]; } rayon = sqrt (rayon); - geom_create_circle (ph, rayon, vk, hm, brep); + int subid = geom->addCircle (ph, rayon, vk, hm); double pmax = 0; for (int ny=0 ; ny setBounds (pmin, pmax); - edge->addAssociation (shape); + geom->addAssociation (edge, subid, pmin, pmax); + // Shape* shape = new Shape (brep); + // shape-> setBounds (pmin, pmax); + // edge->addAssociation (shape); } } } - // Association automatique des vertex non associes -> bph // Traitement des faces spheriques @@ -253,75 +255,62 @@ void Elements::assoCylinders (Vertex* ori, Vector* normal, double angle, { case GR_HEMISPHERIC : // Pour l'exterieur case GR_PART_SPHERIC : - assoRind (po, vi, size_vx-1); + assoRind (po, vi, size_vx-1, geom); break; case GR_PART_RIND : // Exterieur + interieur case GR_RIND : - assoRind (po, vi, 0); - assoRind (po, vi, size_vx-1); + assoRind (po, vi, 0, geom); + assoRind (po, vi, size_vx-1, geom); break; default : break; } - assoResiduelle (); // Association des sommets residuels + // assoResiduelle (); // Association des sommets residuels + geom->closeShape (); } -// ====================================================== assoRind +// ====================================================== assoRind // Association des meridiennes // Creation sphere geometrique + association faces -void Elements::assoRind (double* ori, double* vi, int nx) +void Elements::assoRind (double* ori, double* vi, int nx, NewShape* geom) { Real3 vk; - Edges contour; - string c_brep, s_brep; - Shape shape (c_brep); - Shapes t_shape; - t_shape.push_back (&shape); - - double radius = nx==0 ? cyl_radint : cyl_radext; - double paramin = (cyl_phi0 + M_PI/2) / (2*M_PI); - double paramax = paramin + size_hz*cyl_dphi/(2*M_PI); - - paramin = std::max (paramin, 0.0); - paramax = std::min (paramax, 1.0); - geom_create_sphere (ori, radius, s_brep); + double radius = nx==0 ? cyl_radint : cyl_radext; + double paramin = std::max ((cyl_phi0 + M_PI/2) / (2*M_PI), 0.0); + int sphid = geom->addSphere (ori, radius); int nz1 = size_vz/2; int nb_secteurs = cyl_closed ? size_vy-1 : size_vy; for (int ny=0 ; nygetX(), pm->getY(), pm->getZ() }; prod_vectoriel (vi, vj, vk); double rayon = cyl_radint + nx*(cyl_radext-cyl_radint)/size_hx; - geom_create_circle (ori, rayon, vk, vi, c_brep); - shape.setBrep (c_brep); - shape.setBounds (paramin, paramax); - contour.clear (); + int subid = geom->addCircle (ori, rayon, vk, vi); + double pmax = paramin; for (int nz=0 ; nzaddAssociation (sshape); - } + Edge* edge = getEdgeK (nx, ny, nz); + double pmin = pmax; + pmax = pmin + cyl_dphi/(2*M_PI); + geom->addAssociation (edge, subid, pmin, pmax); + geom->addAssociation (quad, sphid); } - cutAssociation (t_shape, contour, false); } } -// ====================================================== assoCircle +// ====================================================== assoCircle // ==== utilise pour les spheres carrees -void Elements::assoCircle (double* center, Edge* ed1, Edge* ed2) +void Elements::assoCircle (double* center, Edge* ed1, Edge* ed2, NewShape* geom) { Real3 oa, ob, normal; Real3 pta, ptb, ptc, ptd; string brep; // Les 2 edges dont les petits cotes d'un rectangle de rapport L/l=sqrt(2) -// Soit le cercle circonscrit a ce rectangle. +// Soit le cercle circonscrit a ce rectangle. // * la largeur est balayee par l'angle alpha // * la longueur par l'angle beta = pi -alpha @@ -342,46 +331,48 @@ void Elements::assoCircle (double* center, Edge* ed1, Edge* ed2) calc_vecteur (center, pta, oa); calc_vecteur (center, ptb, ob); prod_vectoriel (oa, ob, normal); - double rayon = calc_norme (oa); - geom_create_circle (center, rayon, normal, oa, brep); + double rayon = calc_norme (oa); + int subid = geom->addCircle (center, rayon, normal, oa); - Shape* asso1 = new Shape (brep); - Shape* asso2 = new Shape (brep); + // Shape* asso1 = new Shape (brep); + // Shape* asso2 = new Shape (brep); const double alpha = atan (sqrt(2)/2)/M_PI; // angle proche de 70.528 degres - asso1->setBounds (0, alpha); - asso2->setBounds (0.5, alpha + 0.5); + // asso1->setBounds (0, alpha); + // asso2->setBounds (0.5, alpha + 0.5); - ed1->addAssociation (asso1); - ed2->addAssociation (asso2); + geom->addAssociation (ed1, subid, 0.0, alpha); + geom->addAssociation (ed2, subid, 0.5, alpha+0.5); } -// ====================================================== assoSphere +// ====================================================== assoSphere void Elements::assoSphere (Vertex* ori, Edge* t_edge[], Quad* t_quad[]) { + char name [12]; + sprintf (name, "grid_%02d", el_id); + NewShape* geom = el_root->addShape (name, SH_SPHERE); + geom -> openShape (); + Real3 center, sommet; ori->getPoint(center); - assoCircle (center, t_edge [E_AC], t_edge [E_BD]); - assoCircle (center, t_edge [E_AD], t_edge [E_BC]); - assoCircle (center, t_edge [E_AE], t_edge [E_BF]); - assoCircle (center, t_edge [E_AF], t_edge [E_BE]); - assoCircle (center, t_edge [E_CE], t_edge [E_DF]); - assoCircle (center, t_edge [E_CF], t_edge [E_DE]); + assoCircle (center, t_edge [E_AC], t_edge [E_BD], geom); + assoCircle (center, t_edge [E_AD], t_edge [E_BC], geom); + assoCircle (center, t_edge [E_AE], t_edge [E_BF], geom); + assoCircle (center, t_edge [E_AF], t_edge [E_BE], geom); + assoCircle (center, t_edge [E_CE], t_edge [E_DF], geom); + assoCircle (center, t_edge [E_CF], t_edge [E_DE], geom); t_edge[E_AC]->getVertex(V_AMONT)->getPoint (sommet); double radius = calc_distance (center, sommet);; - string brep; - geom_create_sphere (center, radius, brep); + int sphid = geom -> addSphere (center, radius); + geom->closeShape(); for (int nf=0 ; nf < HQ_MAXI ; nf++) - { - Shape* shape = new Shape (brep); - t_quad [nf]->addAssociation (shape); - } + t_quad[nf]->addAssociation (geom, sphid); - assoResiduelle (); // Association des sommets residuels + // assoResiduelle (); // Association des sommets residuels } // ====================================================== makeSphericalGrid int Elements::makeSphericalGrid (Vertex* c, double rayon, int nb, double k) @@ -404,7 +395,7 @@ int Elements::makeSphericalGrid (Vertex* c, double rayon, int nb, double k) double dy = glob->CoordVertex (nro, dir_y) * rayon; double dz = glob->CoordVertex (nro, dir_z) * rayon; - i_node [nro] = el_root->addVertex (c->getX ()+dx, c->getY ()+dy, + i_node [nro] = el_root->addVertex (c->getX ()+dx, c->getY ()+dy, c->getZ ()+dz); } @@ -417,20 +408,20 @@ int Elements::makeSphericalGrid (Vertex* c, double rayon, int nb, double k) if (db) { char nm0[8], nm1 [8], nm2 [8]; - printf (" %2d : %s = %s = [%s, %s] = [%d,%d] = [%s,%s]\n", nro, - glob->namofHexaEdge(nro), i_edge[nro]->getName(nm0), + printf (" %2d : %s = %s = [%s, %s] = [%d,%d] = [%s,%s]\n", nro, + glob->namofHexaEdge(nro), i_edge[nro]->getName(nm0), glob->namofHexaVertex(v1), glob->namofHexaVertex(v2), v1, v2, i_node[v1]->getName(nm1), i_node[v2]->getName(nm2)); } } - + for (int nro=0 ; nroQuadEdge (nro, E_A)], - i_edge[glob->QuadEdge (nro, E_B)], - i_edge[glob->QuadEdge (nro, E_C)], + i_quad[nro] = newQuad (i_edge[glob->QuadEdge (nro, E_A)], + i_edge[glob->QuadEdge (nro, E_B)], + i_edge[glob->QuadEdge (nro, E_C)], i_edge[glob->QuadEdge (nro, E_D)]); - tab_hexa.push_back (newHexa (i_quad[Q_A], i_quad[Q_B], i_quad[Q_C], + tab_hexa.push_back (newHexa (i_quad[Q_A], i_quad[Q_B], i_quad[Q_C], i_quad[Q_D], i_quad[Q_E], i_quad[Q_F])); double lambda = 1; double dcell = 1; @@ -441,13 +432,15 @@ int Elements::makeSphericalGrid (Vertex* c, double rayon, int nb, double k) lambda += dcell; addStrate (i_quad, i_edge, i_node, c, lambda/lambda0); } - + assoSphere (c, i_edge, i_quad); return HOK; } // ==================================================== propagateAssociation int Elements::propagateAssociation (Edge* orig, Edge* dest, Edge* dir) { + return HERR; +#if 0 if (revo_lution || orig==NULL || dest==NULL || dir==NULL) return HERR; @@ -482,9 +475,9 @@ int Elements::propagateAssociation (Edge* orig, Edge* dest, Edge* dir) { string brep = shape->getBrep(); translate_brep (brep, vdir1, trep); - Shape* tshape = new Shape (trep); - tshape->setBounds (shape->debut, shape->fin); - dest->addAssociation (tshape); + // Shape* tshape = new Shape (trep); + // tshape->setBounds (shape->getStart(), shape->getEnd()); + // dest->addAssociation (tshape); } } } @@ -497,8 +490,8 @@ int Elements::propagateAssociation (Edge* orig, Edge* dest, Edge* dir) { string brep = shape->getBrep(); translate_brep (brep, vdir, trep); - Shape* tshape = new Shape (trep); - vd1->setAssociation (tshape); + // Shape* tshape = new Shape (trep); + // vd1->setAssociation (tshape); } vo1 = vo2; vd1 = vd2; @@ -506,15 +499,18 @@ int Elements::propagateAssociation (Edge* orig, Edge* dest, Edge* dir) } return HOK; +#endif } // ==================================================== prismAssociation int Elements::prismAssociation (Edge* orig, Edge* dest, int nh, Edge* dir) { + return HERR; +#if 0 if (orig==NULL || dest==NULL || dir==NULL) return HERR; updateMatrix (nh); - + const Shapes& tab_shapes = orig->getAssociations (); const Shapes& tab_dest = dest->getAssociations (); int nbdest = tab_dest.size(); @@ -532,7 +528,7 @@ int Elements::prismAssociation (Edge* orig, Edge* dest, int nh, Edge* dir) vo1->getPoint (porig); vd1->getPoint (pdest); calc_vecteur (porig, pdest, vdir); - + if (on_edge) { for (int nro=0 ; nrogetBrep(); // translate_brep (brep, vdir, trep); transfo_brep (brep, &gen_matrix, trep); - Shape* tshape = new Shape (trep); - tshape->setBounds (shape->debut, shape->fin); - dest->addAssociation (tshape); + // Shape* tshape = new Shape (trep); + // tshape->setBounds (shape->getStart(), shape->getEnd()); + // dest->addAssociation (tshape); } } } @@ -558,22 +554,23 @@ int Elements::prismAssociation (Edge* orig, Edge* dest, int nh, Edge* dir) string brep = shape->getBrep(); // translate_brep (brep, vdir, trep); transfo_brep (brep, &gen_matrix, trep); - Shape* tshape = new Shape (trep); - vd1->setAssociation (tshape); + // Shape* tshape = new Shape (trep); + // vd1->setAssociation (tshape); } vo1 = orig->opposedVertex (vo1); vd1 = dest->opposedVertex (vd1); } return HOK; +#endif } // ====================================================== assoResiduelle void Elements::assoResiduelle () { - int nbre = tab_vertex.size(); - for (int nv=0 ; nvisHere()) - elt->remove (); - } + elt->remove (); + } } // =================================================== suppress void EltBase::suppress () @@ -98,62 +98,32 @@ void EltBase::suppress () el_root->setDeprecated (2); el_type = EL_REMOVED; } -// ========================================================= replaceAssociation -void EltBase::replaceAssociation (EltBase* orig) -{ - if ( orig == NULL || orig->el_assoc == NULL - || orig == this || orig->el_assoc == el_assoc) - return; - - if (el_assoc==NULL) - el_assoc = orig->el_assoc; - else - el_root->hputError (W_REPL_ASSOC, this, orig); -} -// ========================================================= copyAssociation -void EltBase::copyAssociation (EltBase* orig) -{ - if ( orig == NULL || orig->el_assoc == NULL - || orig == this || orig->el_assoc == el_assoc) - return; - - el_assoc = orig->el_assoc; - el_root->hputError (W_DISCO_ASSOC, orig); -} -// ========================================================= getName +// ========================================================= getName cpchar EltBase::getName () { return el_name.c_str() ; } -// ========================================================= getName +// ========================================================= getName char* EltBase::getName (pchar buffer) +{ + return makeName (el_type, el_id, buffer); +} +// ========================================================= makeName +char* EltBase::makeName (int type, int id, char* name) { // EL_NONE, EL_VERTEX, EL_EDGE, EL_QUAD, EL_HEXA, EL_REMOVED - sprintf (buffer, "%c%04d", ABR_TYPES[el_type], el_id); - return buffer; + sprintf (name, "%c%04d", ABR_TYPES[type], id); + return name; } -// ========================================================= printName + +// ========================================================= printName void EltBase::printName (cpchar sep) { char nom[12]; printf ("%s%s", getName(nom), sep); } -// ========================================================= setAssociation -void EltBase::setAssociation (Shape* forme) -{ - el_assoc = forme; - - if (el_root->debug (2)) - cout << " Vertex " << el_name << " : setAssociation" << endl; -} -// ========================================================= addAssociation -int EltBase::addAssociation (Shape* forme) -{ - setAssociation (forme); - return HOK; -} -// ========================================================= dumpRef +// ========================================================= dumpRef void EltBase::dumpRef () { int nbp = el_parent.size(); @@ -164,11 +134,11 @@ void EltBase::dumpRef () printf ("\n"); } - for (int nro=0 ; nroisHere ()) { - if (prems) + if (prems) printf ("\t isin "); prems = false; el_parent[nro]->printName(", "); @@ -177,14 +147,7 @@ void EltBase::dumpRef () printf ("\n"); } -// ========================================================= addAssociation -bool EltBase::canBeAssociated () -{ - bool rep = isValid() && isHere() - && (el_type==EL_VERTEX || el_type==EL_EDGE || el_type==EL_QUAD); - return rep; -} -// ========================================================= addAssociation +// ========================================================= setId void EltBase::setId (int ln) { char buffer [16]; @@ -194,9 +157,22 @@ void EltBase::setId (int ln) int maxid = std::max (el_root->doc_nbr_elt[el_type], ln+1); el_root->doc_nbr_elt[el_type] = maxid; - if (defname) + if (defname) el_name = getName (buffer); } - +// ========================================================= makeVarName +char* EltBase::makeVarName (char* nom) +{ + static cpchar PREFIX[] = {"Undef", "Node", "Edge", "Quad", "Hexa", + "Vect", "Grid", "Cyl", "Pipe", "Group", "Law", + "Xxxx", "Xxxx", "Xxxx" }; + sprintf (nom, "%s%d", PREFIX[el_type], el_id); + return nom; +} +// ========================================================= debug +bool EltBase::debug (int niv) +{ + return el_root != NULL && el_root->getLevel() > niv ; +} END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexEltBase.hxx b/src/HEXABLOCK/HexEltBase.hxx index dadda0c..87bde12 100755 --- a/src/HEXABLOCK/HexEltBase.hxx +++ b/src/HEXABLOCK/HexEltBase.hxx @@ -1,5 +1,5 @@ -// Class : Element de base des Vertex/Edge/Quad, etc... +// Class : Element de base des Vertex/Edge/Quad, etc... // Copyright (C) 2009-2012 CEA/DEN, EDF R&D // @@ -24,7 +24,6 @@ #define __ELT_BASE_H #include "hexa_base.hxx" -#include "HexDocument.hxx" #include #define HexDump(x) {printf(#x " = "); if (x) x->dump(); else printf("NULL\n");} @@ -33,18 +32,12 @@ #define GetClone(elt) ((elt)==NULL ? NULL : elt->getClone()) #define BadElement(elt) (elt)==NULL || (elt)->isBad() -#define ABR_TYPES "xveqhwgcp????" BEGIN_NAMESPACE_HEXA -class EltBase +class EltBase { public : - virtual Hexa* getHexa (int nro) { return NULL; } - virtual Quad* getQuad (int nro) { return NULL; } - virtual Edge* getEdge (int nro) { return NULL; } - virtual Vertex* getVertex (int nro) { return NULL; } - virtual int countHexa () { return 0; } virtual int countQuad () { return 0; } virtual int countEdge () { return 0; } @@ -55,21 +48,16 @@ public : virtual bool isValid () { return el_status==HOK; } virtual bool isBad () { return el_status!=HOK; } - virtual void setAssociation (Shape* forme); - virtual int addAssociation (Shape* forme); - virtual void clearAssociation () { el_assoc = NULL ; } virtual void duplicate () {} - virtual Shape* getAssociation () { return el_assoc ; } - virtual bool isAssociated () { return el_assoc != NULL ; } + virtual void clearAssociation () {} - void copyAssociation (EltBase* orig); - void replaceAssociation (EltBase* orig); - bool canBeAssociated (); + // void copyAssociation (EltBase* orig); + // void replaceAssociation (EltBase* orig); public : - virtual void replaceEdge (Edge* old, Edge* nouveau) + virtual void replaceEdge (Edge* old, Edge* nouveau) { printf ("rep-edge\n") ; } - virtual void replaceVertex (Vertex* old, Vertex* nouveau) + virtual void replaceVertex (Vertex* old, Vertex* nouveau) { printf ("rep-vertex\n") ; } EltBase (Document* doc, EnumElt type=EL_NONE); @@ -81,6 +69,9 @@ public : virtual void dump (); virtual void saveXml (XmlWriter* xml) {} virtual void majReferences () { } + virtual char* makeVarName (char* nom); + + static char* makeName (int type, int id, char* name); EltBase* next () { return el_next; } void setNext (EltBase* suivant) { el_next = suivant; } @@ -90,14 +81,14 @@ public : EnumElt getType () { return el_type; } bool isHere () { return el_type!=EL_REMOVED; } bool isDeleted () { return el_type==EL_REMOVED; } - - // On s'occupe des parents + + // On s'occupe des parents void razReferences () { el_parent.clear() ; } void addParent (EltBase* dad) { if (dad) el_parent.push_back(dad) ; } int getNbrParents () { return el_parent.size() ; } bool hasParents (); - EltBase* getFather (int nro); + EltBase* getFather (int nro); int getMark () { return el_mark; } void setMark (int ln) { el_mark = ln ; } @@ -109,52 +100,47 @@ public : void setName (const string& nom) { el_name = nom ; } void setName (cpchar nom) { el_name = nom ; } - bool debug (int niv=0) { return el_root->getLevel() > niv ; } + bool debug (int niv=0); + bool isAssociated () { return is_associated ; } protected : EnumElt el_type; EltBase* el_next; int el_id; Document* el_root; - Shape* el_assoc; string el_name; int el_status; int el_mark; + bool is_associated; std::vector el_parent; }; // ========================================================= dump inline void EltBase::dump () { printf ("Elt%d Nro=%04d", el_type, el_id); - dumpRef() ; + dumpRef() ; } -// ========================================================= getFather +// ========================================================= getFather inline EltBase* EltBase::getFather (int nro) { EltBase* elt = NULL; - if (nro >= 0 && nro < (int) el_parent.size() && isHere() + if (nro >= 0 && nro < (int) el_parent.size() && isHere() && el_parent[nro]->isHere()) elt = el_parent[nro]; return elt; } -// ========================================================= hasParents +// ========================================================= hasParents inline bool EltBase::hasParents () { int nbp = el_parent.size(); - for (int nro=0 ; nroisHere()) return true; return false; } -// ========================================================= clear_association -inline void clear_association (EltBase* elt) -{ - if (elt != NULL && elt->isHere() && elt->isValid()) - elt -> clearAssociation (); -} END_NAMESPACE_HEXA #endif diff --git a/src/HEXABLOCK/HexFaceShape.cxx b/src/HEXABLOCK/HexFaceShape.cxx new file mode 100755 index 0000000..4260770 --- /dev/null +++ b/src/HEXABLOCK/HexFaceShape.cxx @@ -0,0 +1,54 @@ + +// C++ : Gestion des soous-shapes + +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com +// + +#include "HexFaceShape.hxx" + +#ifndef NO_CASCADE + + +BEGIN_NAMESPACE_HEXA + +static bool db = on_debug (); // == getenv ("HEXA_DB") > 0 + +// ====================================================== Constructeur +FaceShape::FaceShape (NewShape* dad, int id) + : SubShape (dad, id, 2) +{ +} +// ========================================================== addAssociation +void FaceShape::addAssociation (Quad* quad) +{ + tab_assoc.push_back (quad); + is_associated = true; +} +// ====================================================== getAssociation +Quad* FaceShape::getAssociation (int nro) +{ + if (nro>0 && nro= 0; } - cpchar getArg (int nro) { return nro>=nbr_args ? NULL : tab_args[nro]; } + cpchar getArg (int nro) { return nro>=nbr_args ? NULL : tab_args[nro]; } + +public : + DumpStudy dump; private : Globale (); // Constructeur prive @@ -87,6 +93,7 @@ private : private : int nbr_args; cpchar* tab_args; + bool dump_study; int coord_vertex [HV_MAXI] [DIM3]; EnumHVertex edge_vertex [HE_MAXI] [V_TWO]; diff --git a/src/HEXABLOCK/HexGroup.cxx b/src/HEXABLOCK/HexGroup.cxx index 3c3afc9..1333f26 100755 --- a/src/HEXABLOCK/HexGroup.cxx +++ b/src/HEXABLOCK/HexGroup.cxx @@ -44,7 +44,7 @@ Group::Group (cpchar nom, EnumGroup grp) else { char buffer [16]; sprintf (buffer, "g%04d", grp_id); - grp_name = std::string(buffer); + grp_name = std::string(buffer); } grp_kind = grp; @@ -128,6 +128,14 @@ void Group::saveXml (XmlWriter* xml) } xml->closeMark (); } + +// ========================================================= getNextName +char* Group::getNextName (pchar buffer) +{ + sprintf (buffer, "g%04d", last_grp_id); + return buffer; +} + // ======================================================== getKind EnumGroup Group::getKind (cpchar kind) { diff --git a/src/HEXABLOCK/HexGroup.hxx b/src/HEXABLOCK/HexGroup.hxx index 10e0e71..e75315b 100755 --- a/src/HEXABLOCK/HexGroup.hxx +++ b/src/HEXABLOCK/HexGroup.hxx @@ -35,6 +35,7 @@ public : void setName (cpchar nom) { grp_name = nom ; } cpchar getName () { return grp_name.c_str () ; } + char* getNextName (pchar buffer); EnumGroup getKind () { return grp_kind ; } int addElement (EltBase* elt); int removeElement (EltBase* elt); diff --git a/src/HEXABLOCK/HexHexa.cxx b/src/HEXABLOCK/HexHexa.cxx index 66d7242..d6cd095 100755 --- a/src/HEXABLOCK/HexHexa.cxx +++ b/src/HEXABLOCK/HexHexa.cxx @@ -339,6 +339,23 @@ void Hexa::printHexa (pfile vtk) fprintf (vtk, "\n"); } +// ======================================================= printHexaVtk +void Hexa::printHexaVtk (pfile vtk) +{ + fprintf (vtk, "%d", HV_MAXI); + + fprintf (vtk, " %d", h_vertex[V_ACE]->getId ()); + fprintf (vtk, " %d", h_vertex[V_ACF]->getId ()); + fprintf (vtk, " %d", h_vertex[V_ADF]->getId ()); + fprintf (vtk, " %d", h_vertex[V_ADE]->getId ()); + + fprintf (vtk, " %d", h_vertex[V_BCE]->getId ()); + fprintf (vtk, " %d", h_vertex[V_BCF]->getId ()); + fprintf (vtk, " %d", h_vertex[V_BDF]->getId ()); + fprintf (vtk, " %d", h_vertex[V_BDE]->getId ()); + + fprintf (vtk, "\n"); +} // ======================================================== hasFreEdges bool Hexa::hasFreeEdges () { diff --git a/src/HEXABLOCK/HexHexa.hxx b/src/HEXABLOCK/HexHexa.hxx index b1d2d05..91c18b5 100755 --- a/src/HEXABLOCK/HexHexa.hxx +++ b/src/HEXABLOCK/HexHexa.hxx @@ -80,6 +80,7 @@ public: void moveNodes (Matrix* matrice); // transfo controlee ds un ensemble void transform (Matrix* matrice); // transfo indivituelle void printHexa (pfile vtk); // Impression de la cellule + void printHexaVtk (pfile vtk); // Impression de la cellule virtual void majReferences(); // M.A.J relation "utilise par" bool hasFreeEdges (); diff --git a/src/HEXABLOCK/HexKasBiCylinder.cxx b/src/HEXABLOCK/HexKasBiCylinder.cxx index 1312b4b..52c61e8 100755 --- a/src/HEXABLOCK/HexKasBiCylinder.cxx +++ b/src/HEXABLOCK/HexKasBiCylinder.cxx @@ -48,9 +48,9 @@ // HEXABLOCK includes #include "HexVertex.hxx" #include "HexEdge.hxx" -#include "HexShape.hxx" +#include "HexOldShape.hxx" #include "HexDiagnostics.hxx" - // Cercles + // Cercles #include #include @@ -84,7 +84,7 @@ void KasBiCylinder::purge () no_inter = true; inter_line.clear (); } -// ====================================================== defineCyls +// ====================================================== defineCyls int KasBiCylinder::defineCyls (double* borig, double* bnorm, double* bbase, double brayon, double bhaut, double* sorig, double* snorm, double* sbase, @@ -165,9 +165,11 @@ int KasBiCylinder::defineCyls (double* borig, double* bnorm, double* bbase, // TopoDS_Edge ligne = explo.Current(); explo.Next (); - cout << "____________________________________ Ligne suivante" << endl; + if (db) + cout << "____________________________________ Ligne suivante" + << endl; geom_make_brep (ligne, crep); - if (db) + if (db) { cout << "---- save_brep inter" << nbrep+1 << ".brep" << endl; save_brep ("inter", crep, nbrep); @@ -184,7 +186,7 @@ int KasBiCylinder::defineCyls (double* borig, double* bnorm, double* bbase, // === Trouve le(s) ligne(s) contenant ce vertex et le(s) parametre(s) int KasBiCylinder::anaVertex (Vertex* node, int* tline, double* tpara) { - Real3 point; + Real3 point; node->getPoint (point); int nbsol = 0; int nblines = inter_line.size(); @@ -194,10 +196,10 @@ int KasBiCylinder::anaVertex (Vertex* node, int* tline, double* tpara) double param = inter_line[nl]->findParam (point); if (param>=0) { - if (db) - cout << " ... findParam " << node->getName() - << ", point=(" << point[0] << ", " << point[1] - << ", " << point[2] + if (db) + cout << " ... findParam " << node->getName() + << ", point=(" << point[0] << ", " << point[1] + << ", " << point[2] << "), nl=" << nl << ", param=" << param << endl; if (nbsol>=2) return nbsol; @@ -241,7 +243,7 @@ int KasBiCylinder::associate (Edge* edge) if (sol1==0 || sol2==0) return HERR; - // Ligne commune ? + // Ligne commune ? for (int ns1=0 ; ns1assoEdge (edge, 0.0, param2, V_AVAL); } return HOK; - } + } } } - + inter_line[tline1[0]]->assoEdge (edge, tparam1[0], 1.0, V_AMONT); inter_line[tline2[0]]->assoEdge (edge, 0, tparam2[0], V_AVAL); return HOK; @@ -285,10 +287,11 @@ int geom_create_cylcyl (double* borig, double* bnorm, double* bbase, // ====================================================== geom_asso_cylcyl int geom_asso_cylcyl (Edge* edge) { - cout << " ___________________________________ geom_asso_cylcyl " - << edge->getName () << " = (" << edge->getVertex(0)->getName () - << "," << edge->getVertex(1)->getName () - << ")" << endl; + if (db) + cout << " ___________________________________ geom_asso_cylcyl " + << edge->getName () << " = (" << edge->getVertex(0)->getName () + << "," << edge->getVertex(1)->getName () + << ")" << endl; int ier = current_bicyl.associate (edge); return ier; diff --git a/src/HEXABLOCK/HexKasLine.cxx b/src/HEXABLOCK/HexKasLine.cxx index 815d9b8..c371fd3 100755 --- a/src/HEXABLOCK/HexKasLine.cxx +++ b/src/HEXABLOCK/HexKasLine.cxx @@ -48,14 +48,14 @@ // HEXABLOCK includes #include "HexVertex.hxx" #include "HexEdge.hxx" -#include "HexShape.hxx" +#include "HexOldShape.hxx" #include "HexDiagnostics.hxx" #include BEGIN_NAMESPACE_HEXA -static bool db = false; +static bool db = on_debug (); static const double TolAsso = 1e-2; // Tolerance pour les associations void arrondir (double &val); @@ -63,7 +63,6 @@ void arrondir (double &val); // ======================================================= Constructeur KasLine::KasLine () { - db = on_debug (); lig_brep = ""; lig_debut = 0; lig_fin = 1; @@ -91,24 +90,24 @@ KasLine::~KasLine () delete geom_curve; } // ========================================================= defineLine -// === Creation de la quincaillerie associee a une shape +// === Creation de la quincaillerie associee a une shape void KasLine::defineLine (Shape* asso, double deb, double fin) { - lig_brep = asso->getBrep (); - lig_ident = asso->getName (); - lig_ior = asso->getIor (); + lig_brep = asso->getBrep (); + lig_ident = asso->getIdent (); + lig_ior = asso->getIor (); if (fin<0.0) { - lig_debut = asso->debut; - lig_fin = asso->fin; + lig_debut = asso->getStart();; + lig_fin = asso->getEnd();; } else if (deb >= UnEpsil) { lig_debut = fin; lig_fin = deb ; } - else + else { lig_debut = deb; lig_fin = fin; @@ -135,9 +134,9 @@ void KasLine::defineLine (Shape* asso, double deb, double fin) geom_length = geom_total_length * fabs (lig_fin-lig_debut); // Extremites - GCPnts_AbscissaPoint s1 (*geom_curve, geom_total_length*lig_debut, + GCPnts_AbscissaPoint s1 (*geom_curve, geom_total_length*lig_debut, geom_curve->FirstParameter()); - GCPnts_AbscissaPoint s2 (*geom_curve, geom_total_length*lig_fin, + GCPnts_AbscissaPoint s2 (*geom_curve, geom_total_length*lig_fin, geom_curve->FirstParameter()); par_mini = s1.Parameter (); @@ -146,7 +145,7 @@ void KasLine::defineLine (Shape* asso, double deb, double fin) end_gpoint = geom_curve->Value (par_maxi); majCoord (); - if (db) + if (db) { Echo (" ____________________________________ KasLine::defineLine"); HexDisplay (deb); @@ -165,7 +164,7 @@ void KasLine::defineLine (Shape* asso, double deb, double fin) // ========================================================= assoPoint void KasLine::assoPoint (double abscis, Vertex* node) { - GCPnts_AbscissaPoint s1 (*geom_curve, abscis, + GCPnts_AbscissaPoint s1 (*geom_curve, abscis, geom_curve->FirstParameter()); double gparam = s1.Parameter (); gp_Pnt pnt_asso = geom_curve->Value (gparam); @@ -182,7 +181,7 @@ void KasLine::assoPoint (double abscis, Vertex* node) car= ' '; printf (" ... assoPoint%c: v=%s (%g,%g,%g), p=%g", car, node->getName(), node->getX(), node->getY(), node->getZ(), abscis); - + printf (" -> (%g,%g,%g)\n", coord[dir_x], coord[dir_y], coord[dir_z]); } } @@ -192,7 +191,7 @@ void KasLine::associate (Edge* edge, double sm1, double sm2, int vorig) if (sm2 < start_absc) return; if (sm1 > end_absc) return; - Vertex* segment[V_TWO] = { edge->getVertex (vorig), + Vertex* segment[V_TWO] = { edge->getVertex (vorig), edge->getVertex (1-vorig) }; double vpara1 = lig_debut + (sm1-start_absc)/geom_total_length; @@ -216,8 +215,8 @@ void KasLine::associate (Edge* edge, double sm1, double sm2, int vorig) cout << " ligpara = [ " << lig_debut << ", " << lig_fin << " ]" << endl; cout << " absc = [ " << start_absc << ", " << end_absc << " ]\n" ; - cout << " Edge = " << edge->getName() << - " = [ " << segment[0]->getName() << ", " + cout << " Edge = " << edge->getName() << + " = [ " << segment[0]->getName() << ", " << "," << segment[1]->getName() << endl; cout << " smx = [ " << sm1 << ", " << sm2 << " ]" << endl; cout << " vparam = [ " << vpara1 << ", " << vpara2 << " ]" << endl; @@ -234,7 +233,7 @@ void KasLine::associate (Edge* edge, double sm1, double sm2, int vorig) lpara1, lpara2); } - // ---------------Association du vertex + // ---------------Association du vertex double hparam = geom_inverse ? vpara2 : vpara1; double smx = sm1; double absc1 = start_absc - TolAsso*geom_total_length; @@ -250,7 +249,7 @@ void KasLine::associate (Edge* edge, double sm1, double sm2, int vorig) // ..... Coordonnees du point double abscis = geom_total_length*hparam; - GCPnts_AbscissaPoint s1 (*geom_curve, abscis, + GCPnts_AbscissaPoint s1 (*geom_curve, abscis, geom_curve->FirstParameter()); double gparam = s1.Parameter (); gp_Pnt pnt_asso = geom_curve->Value (gparam); @@ -262,7 +261,7 @@ void KasLine::associate (Edge* edge, double sm1, double sm2, int vorig) if (db) { double* ass = gpoint.getCoord(); - printf (" Asso Point %s (%g,%g,%g) -> (%g,%g,%g) p=%g s=%g\n", + printf (" Asso Point %s (%g,%g,%g) -> (%g,%g,%g) p=%g s=%g\n", node->getName(), node->getX(), node->getY(), node->getZ(), ass[dir_x], ass[dir_y], ass[dir_z], hparam, smx); } @@ -270,7 +269,7 @@ void KasLine::associate (Edge* edge, double sm1, double sm2, int vorig) else if (db) { double abscis = geom_total_length*hparam; - GCPnts_AbscissaPoint s1 (*geom_curve, abscis, + GCPnts_AbscissaPoint s1 (*geom_curve, abscis, geom_curve->FirstParameter()); double gparam = s1.Parameter (); gp_Pnt pnt_asso = geom_curve->Value (gparam); @@ -280,14 +279,14 @@ void KasLine::associate (Edge* edge, double sm1, double sm2, int vorig) gpoint.definePoint (pnt_asso); double* ass = gpoint.getCoord(); // gpoint.associate (node); - printf (" Asso Point %s (%g,%g,%g) -> (%g,%g,%g) p=%g s=%g\n", + printf (" Asso Point %s (%g,%g,%g) -> (%g,%g,%g) p=%g s=%g\n", node->getName(), node->getX(), node->getY(), node->getZ(), ass[dir_x], ass[dir_y], ass[dir_z], hparam, smx); gpoint.definePoint (node); ass = gpoint.getCoord(); - printf (" ignore car deja associe a (%g,%g, %g)\n", + printf (" ignore car deja associe a (%g,%g, %g)\n", ass[dir_x], ass[dir_y], ass[dir_z]); } } @@ -299,17 +298,17 @@ void KasLine::associate (Edge* edge, double sm1, double sm2, int vorig) void KasLine::assoEdge (Edge* edge, double para1, double para2, int vass) { Shape* shape = new Shape (lig_brep); - shape->setName (lig_ident); + shape->setIdent (lig_ident); shape->setIor (lig_ior); shape->setBounds (para1, para2); edge ->addAssociation (shape); - if (db) printf (" ... Asso Edge %s -> (%g,%g)\n", + if (db) printf (" ... Asso Edge %s -> (%g,%g)\n", edge->getName(), para1, para2); double lg = geom_total_length; - switch (vass) + switch (vass) { case V_AMONT : assoPoint (para1*lg, edge->getVertex (V_AMONT)); @@ -353,13 +352,15 @@ void KasLine::inverser () { lig_fin = lig_debut; lig_debut = 0; - cout << " ... inverser : fin = debut = " << lig_fin << endl; + if (db) + cout << " ... inverser : fin = debut = " << lig_fin << endl; } else if (lig_fin > Epsil && lig_fin < UnEpsil) { lig_debut = lig_fin; lig_fin = 1; - cout << " ... inverser : debut = fin = " << lig_debut << endl; + if (db) + cout << " ... inverser : debut = fin = " << lig_debut << endl; } geom_inverse = NOT geom_inverse; @@ -377,7 +378,7 @@ void KasLine::setRank (int nro, int sens, double& abscisse) if (db) { - cout << "KasLine::setRank : nro = " << nro << " sens=" << sens + cout << "KasLine::setRank : nro = " << nro << " sens=" << sens << " = (" << start_absc << ", " << end_absc << ")" << endl; } } @@ -406,11 +407,11 @@ double KasLine::findParam (double* coord) double gparam = projector.LowerDistanceParameter(); if (gparam par_maxi) { - // cout << " Rejet : " << gparam << " not in (" << par_mini + // cout << " Rejet : " << gparam << " not in (" << par_mini // << ", " << par_maxi << ")" << endl; return -1.0; } - + gp_Pnt rpoint = geom_curve->Value (gparam); if (NOT same_coords (gpoint, rpoint)) { @@ -422,8 +423,8 @@ double KasLine::findParam (double* coord) GeomAdaptor_Curve adapt_curve (handle); double abscis = GCPnts_AbscissaPoint::Length (adapt_curve, umin, gparam); double hparam = abscis/geom_total_length; - - // gparam = (gparam-par_mini) / (par_maxi-par_mini); + + // gparam = (gparam-par_mini) / (par_maxi-par_mini); return hparam; } // ========================================================= arrondir diff --git a/src/HEXABLOCK/HexKasPoint.cxx b/src/HEXABLOCK/HexKasPoint.cxx index 3668cf9..7736e93 100755 --- a/src/HEXABLOCK/HexKasPoint.cxx +++ b/src/HEXABLOCK/HexKasPoint.cxx @@ -22,7 +22,7 @@ #include "HexKasPoint.hxx" #include "HexVertex.hxx" -#include "HexShape.hxx" +#include "HexOldShape.hxx" #ifndef NO_CASCADE @@ -58,6 +58,8 @@ void KasPoint::razPoint () // ======================================================= definePoint (vertex) int KasPoint::definePoint (Vertex* node) { + return HERR; +#if 0 razPoint (); if (node==NULL) @@ -66,7 +68,7 @@ int KasPoint::definePoint (Vertex* node) Shape* asso = node->getAssociation(); if (asso==NULL) return HERR; - + b_rep = asso->getBrep (); TopoDS_Shape topo; @@ -81,10 +83,11 @@ int KasPoint::definePoint (Vertex* node) g_vertex = TopoDS::Vertex (topo); g_point = BRep_Tool::Pnt( g_vertex ); - g_coord [dir_x] = g_point.X(); - g_coord [dir_y] = g_point.Y(); - g_coord [dir_z] = g_point.Z(); + g_coord [dir_x] = g_point.X(); + g_coord [dir_y] = g_point.Y(); + g_coord [dir_z] = g_point.Z(); return HOK; +#endif } // ======================================================= definePoint (xyz) void KasPoint::definePoint (Real3 coord) @@ -120,6 +123,7 @@ void KasPoint::definePoint (gp_Pnt& gpoint) // ======================================================= associate void KasPoint::associate (Vertex* node) { +/**************** if (db) cout << " ++ KasPoint::associate " << endl; if (db) PutName (node); if (node==NULL) @@ -127,6 +131,8 @@ void KasPoint::associate (Vertex* node) Shape* vshape = new Shape (b_rep); node->setAssociation (vshape); + +*********************/ } END_NAMESPACE_HEXA #endif diff --git a/src/HEXABLOCK/HexKas_functions.cxx b/src/HEXABLOCK/HexKas_functions.cxx index f6eeedd..683c59f 100755 --- a/src/HEXABLOCK/HexKas_functions.cxx +++ b/src/HEXABLOCK/HexKas_functions.cxx @@ -17,19 +17,29 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com // +#include "HexKas_functions.hxx" + #ifndef NO_CASCADE -#include "HexKas_functions.hxx" +#include +#include +#include + +#include +#include + +#include BEGIN_NAMESPACE_HEXA // ====================================================== same_coords bool same_coords (gp_Pnt& pa, gp_Pnt& pb, double epsilon) { - double d2 = carre (pb.X()-pa.X()) + carre (pb.Y()-pa.Y()) + double d2 = carre (pb.X()-pa.X()) + carre (pb.Y()-pa.Y()) + carre (pb.Z()-pa.Z()) ; return d2 < epsilon; } @@ -47,12 +57,54 @@ void save_brep (cpchar nom, string brep, int& compteur) fprintf (fic, "%s\n", brep.c_str()); fclose (fic); } -// ====================================================== geom_make_brep +// ====================================================== geom_make_brep void geom_make_brep (TopoDS_Shape& shape, string& brep) { ostringstream stream_shape; BRepTools::Write (shape, stream_shape); brep = stream_shape.str(); } +// ====================================================== geom_brep2shape (F) +TopoDS_Shape geom_brep2shape (rcstring brep) +{ + TopoDS_Shape topo; + istringstream streamBrep(brep); + BRep_Builder aBuilder; + BRepTools::Read (topo, streamBrep, aBuilder); + return topo; +} +// ====================================================== geom_brep2shape +int geom_brep2shape (rcstring brep, TopoDS_Shape& shape) +{ + istringstream streamBrep(brep); + BRep_Builder aBuilder; + BRepTools::Read (shape, streamBrep, aBuilder); + return HOK; +} +// ====================================================== geom_brep2point +int geom_brep2point (rcstring brep, double& px, double& py, double& pz) +{ + TopoDS_Shape topo; + geom_brep2shape (brep, topo); + + if (topo.ShapeType() != TopAbs_VERTEX) + return HERR; + + TopoDS_Vertex g_vertex = TopoDS::Vertex (topo); + gp_Pnt g_point = BRep_Tool::Pnt( g_vertex ); + + px = g_point.X(); + py = g_point.Y(); + pz = g_point.Z(); + return HOK; +} +END_NAMESPACE_HEXA + +#else // *************************************************** NO_CASCADE + +BEGIN_NAMESPACE_HEXA +int geom_brep2point (rcstring b, double& x, double& y, double& z) {return HOK;} +int geom_brep2shape (rcstring brep, TopoDS_Shape& shape) {return HOK ; } +TopoDS_Shape geom_brep2shape (rcstring brep) {return O ; } END_NAMESPACE_HEXA #endif diff --git a/src/HEXABLOCK/HexKas_functions.hxx b/src/HEXABLOCK/HexKas_functions.hxx index 42213b8..42bb1f0 100755 --- a/src/HEXABLOCK/HexKas_functions.hxx +++ b/src/HEXABLOCK/HexKas_functions.hxx @@ -23,15 +23,10 @@ #ifndef _KAS_FUNCTIONS_HXX #define _KAS_FUNCTIONS_HXX -#ifndef NO_CASCADE +class gp_Pnt; #include "HexGlobale.hxx" -#include -#include -#include -#include - BEGIN_NAMESPACE_HEXA int geom_create_cylcyl (double* borig, double* bnorm, double* bbase, @@ -42,9 +37,13 @@ int geom_asso_cylcyl (Edge* edge); bool same_coords (gp_Pnt& pa, gp_Pnt& pb, double epsil2=1e-6); void save_brep (cpchar nom, string brep, int& nro); -void geom_make_brep (TopoDS_Shape& shape, string& brep); +void clean_brep (string& brep); + +void geom_make_brep (TopoDS_Shape& shape, string& brep); +int geom_brep2point (rcstring brep, double& px, double& py, double& pz); +int geom_brep2shape (rcstring brep, TopoDS_Shape& shape); + +TopoDS_Shape geom_brep2shape (rcstring brep); END_NAMESPACE_HEXA #endif -#else // NO_CASCADE -#endif // NO_CASCADE diff --git a/src/HEXABLOCK/HexLaw.cxx b/src/HEXABLOCK/HexLaw.cxx index b163739..c4db230 100644 --- a/src/HEXABLOCK/HexLaw.cxx +++ b/src/HEXABLOCK/HexLaw.cxx @@ -25,7 +25,7 @@ BEGIN_NAMESPACE_HEXA int Law::last_law_id = 0; // ================================================== Constructeur -Law::Law (cpchar name, int nbnodes) +Law::Law (Document* dad, cpchar name, int nbnodes) : EltBase (dad, EL_LAW) { nbr_nodes = nbnodes; law_id = last_law_id++; @@ -37,14 +37,15 @@ Law::Law (cpchar name, int nbnodes) if (!_nom.empty()) law_name = _nom; else { - char buffer [16]; - sprintf (buffer, "l%04d", law_id); - law_name = std::string(buffer); + char buffer [16]; + sprintf (buffer, "l%04d", law_id); + law_name = std::string(buffer); } law_type = Uniform; law_coefficient = 0.0; } + // ================================================== Constructeur 2 Law::Law (Law* other) { @@ -52,6 +53,14 @@ Law::Law (Law* other) law_name = other->law_name ; law_type = other->law_type ; law_coefficient = other->law_coefficient; + el_root = other->el_root; +} + +// ========================================================= getNextName +char* Law::getNextName (pchar buffer) +{ + sprintf (buffer, "l%04d", last_law_id); + return buffer; } END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexLaw.hxx b/src/HEXABLOCK/HexLaw.hxx index 19f7105..6ade5fa 100755 --- a/src/HEXABLOCK/HexLaw.hxx +++ b/src/HEXABLOCK/HexLaw.hxx @@ -22,14 +22,16 @@ #ifndef __LAW_H_ #define __LAW_H_ +#include "HexEltBase.hxx" #include "HexXmlWriter.hxx" BEGIN_NAMESPACE_HEXA -class Law +class Law : public EltBase { public: const char* getName () { return law_name.c_str() ; } + char* getNextName (pchar buffer); int getNodes () { return nbr_nodes ; } double getCoefficient () { return law_coefficient ; } KindLaw getKind () { return law_type ; } @@ -40,7 +42,7 @@ public: void setKind (cpchar type); int setName (cpchar nom); - Law (cpchar name, int nbnodes); + Law (Document* dad, cpchar name, int nbnodes); Law (Law* other); void saveXml (XmlWriter* xml); diff --git a/src/HEXABLOCK/HexNewShape.cxx b/src/HEXABLOCK/HexNewShape.cxx new file mode 100755 index 0000000..38f89ca --- /dev/null +++ b/src/HEXABLOCK/HexNewShape.cxx @@ -0,0 +1,560 @@ + +// C++ : Gestion des Shapes (Hexa v5) + +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com + +#include "HexNewShape.hxx" +#include "HexSubShape.hxx" +#include "HexVertexShape.hxx" +#include "HexEdgeShape.hxx" +#include "HexFaceShape.hxx" + +#include "HexQuad.hxx" +#include "HexEdge.hxx" + +#include "HexKas_functions.hxx" + +#include "HexXmlWriter.hxx" +#include "HexXmlTree.hxx" + +#ifndef NO_CASCADE +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + + +#include +#include +#include +#include +#include + + +BEGIN_NAMESPACE_HEXA + +static bool db = on_debug (); // == getenv ("HEXA_DB") > 0 +static bool db0 = true; + +// ====================================================== Constructeur +NewShape::NewShape (Document* dad, EnumShape type) + : EltBase (dad, EL_SHAPE) +{ + sh_origin = type; + brep_defined = shape_defined = false; + + sh_level = sh_indice = 0; + sh_face_max = sh_edge_max = sh_vertex_max = 0; + + curr_subid = 2; +} +// ====================================================== setShape +void NewShape::setShape (const TopoDS_Shape& shape, EnumShape type) +{ + sh_origin = type; + geo_shape = shape; + geo_brep = ""; + + shape_defined = true; + brep_defined = false; + + map_shape .Clear (); + tab_face .clear (); + tab_edge .clear (); + tab_vertex.clear (); + + sh_level = sh_indice = 0; + sh_face_max = sh_edge_max = sh_vertex_max = 0; + + if (db) + cout << " ------------------- setShape " << el_name << endl; + parseShape (geo_shape); +} +// ====================================================== setBrep +void NewShape::setBrep (rcstring brep) +{ + geo_brep = brep; + brep_defined = true; + updateShape (); +} +// ====================================================== getGeoShape +const TopoDS_Shape& NewShape::getGeoShape (int id) +{ + const TopoDS_Shape& shape = map_shape.FindKey (id); + return shape; +} +// ====================================================== getShape +const TopoDS_Shape& NewShape::getShape () +{ + return geo_shape; +} +// ====================================================== openShape +void NewShape::openShape () +{ + geo_builder.MakeCompound (geo_compound); + curr_subid = 2; + + asso_edge.clear (); + asso_pmin.clear (); + asso_pmax.clear (); + asso_edid.clear (); + asso_quad.clear (); + asso_quid.clear (); +} +// ====================================================== addCircle +int NewShape::addCircle (double* milieu, double rayon, double* normale, + double* base) +{ + gp_Pnt gp_center (milieu [dir_x], milieu [dir_y], milieu [dir_z]); + gp_Vec gp_vx (base [dir_x], base [dir_y], base [dir_z]); + gp_Vec gp_norm (normale[dir_x], normale[dir_y], normale[dir_z]); + + gp_Ax2 gp_axes (gp_center, gp_norm, gp_vx); + gp_Circ gp_circ (gp_axes, rayon); + + TopoDS_Edge geom_circ = BRepBuilderAPI_MakeEdge(gp_circ).Edge(); + geo_builder.Add (geo_compound, geom_circ); + + if (db) + cout << " .... AddCircle subid " << curr_subid << " : rayon=" << rayon + << " centre = " << milieu[dir_x] << "," << milieu[dir_y] + << "," << milieu[dir_z] + << " norm = " << normale[dir_x] << "," << normale[dir_y] + << "," << normale[dir_z] + << endl; + + int subid = curr_subid; + curr_subid += 2; + return subid; +} +// ====================================================== addSphere +int NewShape::addSphere (double* milieu, double radius) +{ + gp_Pnt gp_center (milieu [dir_x], milieu [dir_y], milieu [dir_z]); + gp_Ax2 gp_axis (gp_center, gp_Dir(0,0,1), gp_Dir(1,0,0)); + + BRepPrimAPI_MakeSphere make_sphere (gp_axis, radius); + make_sphere.Build(); + TopoDS_Shape geom_sphere = make_sphere.Face(); + geo_builder.Add (geo_compound, geom_sphere); + + if (db) + cout << " .... AddSphere subid " << curr_subid << " : rayon=" << radius + << " centre = " << milieu[dir_x] << "," << milieu[dir_y] + << "," << milieu[dir_z] << endl; + + int subid = curr_subid; + curr_subid += 7; + return subid; +} +// ====================================================== addAssociation +void NewShape::addAssociation (Vertex* vertex, int subid, double param) +{ + if (vertex==NULL) + return; + + asso_vertex.push_back (vertex); + asso_param .push_back (param); + asso_vxid .push_back (subid); +} +// ====================================================== addAssociation +void NewShape::addAssociation (Edge* edge, int subid, double pmin, double pmax) +{ + if (edge==NULL) + return; + + asso_edge.push_back (edge); + asso_pmin.push_back (pmin); + asso_pmax.push_back (pmax); + asso_edid.push_back (subid); +} +// ====================================================== addAssociation +void NewShape::addAssociation (Quad* quad, int subid) +{ + if (quad==NULL) + return; + + asso_quad.push_back (quad); + asso_quid.push_back (subid); +} +// ====================================================== closeShape +void NewShape::closeShape () +{ + geo_shape = geo_compound; + shape_defined = true; + if (db) + cout << " ------------------- closeShape " << el_name << endl; + parseShape (geo_shape); + + int nombre = asso_edge.size (); + for (int nro = 0 ; nro < nombre ; ++nro) + asso_edge[nro]->addAssociation (this, asso_edid[nro], asso_pmin[nro], + asso_pmax[nro]); + nombre = asso_quad.size (); + for (int nro = 0 ; nro < nombre ; ++nro) + asso_quad[nro]->addAssociation (this, asso_quid[nro]); + + Real3 point; + nombre = asso_vertex.size (); + for (int nro = 0 ; nro < nombre ; ++nro) + { + EdgeShape* line = findEdge (asso_vxid[nro]); + Vertex* vertex = asso_vertex[nro]; + if (line!=NULL && vertex!=NULL && NOT vertex->isAssociated()) + { + line->getPoint (asso_param[nro], point); + asso_vertex[nro]->setAssociation (point); + } + } + +} +//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +// ====================================================== findVertex +VertexShape* NewShape::findVertex (int shid) +{ + int nbre = tab_vertex.size (); + for (int nro=0 ; nro < nbre ; nro++) + { + VertexShape* shape = tab_vertex [nro]; + if (shape->getIdent() == shid) + return shape; + } + return NULL; +} +// ====================================================== findEdge +EdgeShape* NewShape::findEdge (int shid) +{ + int nbre = tab_edge.size (); + for (int nro=0 ; nro < nbre ; nro++) + { + EdgeShape* shape = tab_edge [nro]; + if (shape->getIdent() == shid) + return shape; + } + return NULL; +} +// ====================================================== findFace +FaceShape* NewShape::findFace (int shid) +{ + int nbre = tab_face.size (); + for (int nro=0 ; nro < nbre ; nro++) + { + FaceShape* shape = tab_face [nro]; + if (shape->getIdent() == shid) + return shape; + } + return NULL; +} +// ====================================================== findSubShape +SubShape* NewShape::findSubShape (int shid) +{ + SubShape* shape = findEdge (shid); + if (shape==NULL) + shape = findVertex (shid); + if (shape==NULL) + shape = findFace (shid); + + return shape; +} +// ====================================================== getVertex +int NewShape::getVertex (int nro) +{ + if (nro <0 || nro >= tab_vertex.size()) + return 0; + + SubShape* shape = tab_vertex [nro]; + return shape->getIdent() ; +} +// ====================================================== getEdge +int NewShape::getEdge (int nro) +{ + if (nro <0 || nro >= tab_edge.size()) + return 0; + + SubShape* shape = tab_edge [nro]; + return shape->getIdent() ; +} +// ====================================================== getFace +int NewShape::getFace (int nro) +{ + if (nro <0 || nro >= tab_face.size()) + return 0; + + SubShape* shape = tab_face [nro]; + return shape->getIdent() ; +} + +// ====================================================== getNameVertex +cpchar NewShape::getNameVertex (int nro) +{ + if (nro <0 || nro >= tab_vertex.size()) + return "?"; + + SubShape* shape = tab_vertex [nro]; + return shape->getName() ; +} +// ====================================================== getNameEdge +cpchar NewShape::getNameEdge (int nro) +{ + if (nro <0 || nro >= tab_edge.size()) + return "?"; + + SubShape* shape = tab_edge [nro]; + return shape->getName() ; +} +// ====================================================== getNameFace +cpchar NewShape::getNameFace (int nro) +{ + if (nro <0 || nro >= tab_face.size()) + return "?"; + + SubShape* shape = tab_face [nro]; + return shape->getName() ; +} +// ====================================================== getFaceShape +FaceShape* NewShape::getFaceShape (int nro) +{ + if (nro <0 || nro >= tab_face.size()) + return 0; + + FaceShape* shape = tab_face [nro]; + return shape; +} +// ====================================================== getEdgeShape +EdgeShape* NewShape::getEdgeShape (int nro) +{ + if (nro <0 || nro >= tab_edge.size()) + return 0; + + EdgeShape* shape = tab_edge [nro]; + return shape; +} +// ====================================================== getVertexShape +VertexShape* NewShape::getVertexShape (int nro) +{ + if (nro <0 || nro >= tab_vertex.size()) + return 0; + + VertexShape* shape = tab_vertex [nro]; + return shape; +} +// ====================================================== addPoint +int NewShape::addPoint (double* point) +{ + char suffix [32]; + int subid = tab_vertex.size() + 1; + + sprintf (suffix, ":vertex%02d", subid); + string name = el_name + suffix; + + VertexShape* sub_shape = new VertexShape (this, subid, point); + sub_shape->setName (name); + tab_vertex.push_back (sub_shape); + return subid; +} +// ===================================================== saveBrep +int NewShape::saveBrep () +{ + string filename = el_name + ".brep"; + + int ier = updateBrep (); + if (ier != HOK) + return ier; + + pfile fic = fopen (filename.c_str(), "w"); + if (fic==NULL) + return HERR; + + fprintf (fic, "%s\n", geo_brep.c_str()); + fclose (fic); +} +// ====================================================== saveXml +void NewShape::saveXml (XmlWriter* xml) +{ + if (sh_origin==SH_CLOUD) + { + int nbre = tab_vertex.size(); + xml->addMark ("Cloud"); + for (int nro=0 ; nrosaveXml (xml); + xml->closeMark (); + return; + } + + char buffer [32]; + int ya1brep = updateBrep (); + + xml->openMark ("Shape"); + xml->addAttribute ("id", getName (buffer)); + xml->addAttribute ("type", sh_origin); + if (el_name!=buffer) + xml->addAttribute ("name", el_name); + + if (ya1brep == HOK) + { + clean_brep (geo_brep); + xml->addAttribute ("brep", geo_brep.c_str()); + } + xml->closeMark (); +} +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// ===================================================== parseShape +void NewShape::parseShape (const TopoDS_Shape& shape) +{ + push_level (); + addSubShape (shape); + + TopoDS_Iterator iter (shape); + for (; iter.More(); iter.Next()) + { + TopoDS_Shape sub_shape = iter.Value(); + parseShape (sub_shape); + } + + pop_level (); +} +// ===================================================== addSubShape +void NewShape::addSubShape (const TopoDS_Shape& shape) +{ + char chnum [32]; + string name; + sh_indice ++; + + int subid = map_shape.Add (shape); + int type = shape.ShapeType(); + + switch (type) + { + case TopAbs_FACE : + sprintf (chnum, ":face_%02d", subid); + name = el_name + chnum; + if (subid > sh_face_max) + { + FaceShape* sub_shape = new FaceShape (this, subid); + sub_shape->setName (name); + tab_face.push_back (sub_shape); + sh_face_max = subid; + } + break; + case TopAbs_EDGE : + sprintf (chnum, ":edge_%02d", subid); + name = el_name + chnum; + if (subid > sh_edge_max) + { + EdgeShape* sub_shape = new EdgeShape (this, subid); + sub_shape->setName (name); + tab_edge.push_back (sub_shape); + sh_edge_max = subid; + } + break; + case TopAbs_VERTEX : + sprintf (chnum, ":vertex_%02d", subid); + name = el_name + chnum; + if (subid > sh_vertex_max) + { + VertexShape* sub_shape = new VertexShape (this, subid); + sub_shape->setName (name); + tab_vertex.push_back (sub_shape); + sh_vertex_max = subid; + } + break; + default : ; + sprintf (chnum, "type=%d, subid=%02d", type, subid); + name = chnum; + } + + if (db0) + { + sprintf (chnum, "%4d : ", sh_indice); + cout << chnum; + for (int nro=1; nro +#include +#include +#include +#endif + +BEGIN_NAMESPACE_HEXA + +class NewShape : public EltBase +{ +public : // for TUI + virtual int countVertex () { return tab_vertex.size (); } + virtual int countEdge () { return tab_edge.size (); } + virtual int countFace () { return tab_face.size (); } + + int getVertex (int nro); + int getEdge (int nro); + int getFace (int nro); + + cpchar getNameVertex (int nro); + cpchar getNameEdge (int nro); + cpchar getNameFace (int nro); + + const string& getBrep (); + const TopoDS_Shape& getShape (); + +public : // for GUI + EnumShape getOrigin () { return sh_origin ; } + VertexShape* getVertexShape (int nro); + EdgeShape* getEdgeShape (int nro); + FaceShape* getFaceShape (int nro); + +public : // for Others + NewShape (Document* dad, EnumShape type=SH_NONE); + void setShape (const TopoDS_Shape& shape, EnumShape type=SH_IMPORT); + void setBrep (rcstring brep); + int addPoint (double* coord); + void addAssociation (Vertex* elt, int subid, double param); + void addAssociation (Edge* elt, int subid, double pmin, double pmax); + void addAssociation (Quad* elt, int subid); + + VertexShape* findVertex (int subid); + EdgeShape* findEdge (int subid); + FaceShape* findFace (int subid); + + SubShape* findSubShape (int subid); + + const TopoDS_Shape& getGeoShape (int subid); + + int saveBrep (); + void saveXml (XmlWriter* xml); + + void openShape (); + int addCircle (double* center, double rad, double* norm, double* base); + int addSphere (double* center, double radius); + void closeShape(); + +private : + int updateShape (); + int updateBrep (); + // ---------------------------- Parcours + void parseShape (const TopoDS_Shape& shape); + void push_level () { sh_level ++ ; } + void pop_level () { sh_level -- ; } + void addSubShape (const TopoDS_Shape& shape); + +private : // ________________________________________________________ + TopoDS_Shape geo_shape; + + EnumShape sh_origin; + string geo_brep; + bool brep_defined, shape_defined; + + TopTools_IndexedMapOfShape map_shape; + std::vector tab_face; + std::vector tab_edge; + std::vector tab_vertex; + + // Pour Construire les shapes internes + int curr_subid; + TopoDS_Compound geo_compound; + BRep_Builder geo_builder; + + std::vector asso_vertex; + Quads asso_quad; + Edges asso_edge; + RealVector asso_pmin, asso_pmax, asso_param; + IntVector asso_edid, asso_quid, asso_vxid; + // Pour le parsing + int sh_level; + int sh_indice; + int sh_face_max; + int sh_edge_max; + int sh_vertex_max; +}; +END_NAMESPACE_HEXA +#endif diff --git a/src/HEXABLOCK/HexOldShape.hxx b/src/HEXABLOCK/HexOldShape.hxx new file mode 100755 index 0000000..109632a --- /dev/null +++ b/src/HEXABLOCK/HexOldShape.hxx @@ -0,0 +1,25 @@ + +// class : Gestion des formes associees + +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef __OLD_SHAPE_H_ +#define __OLD_SHAPE_H_ +#include "HexShape.hxx" +#endif diff --git a/src/HEXABLOCK/HexPipe.cxx b/src/HEXABLOCK/HexPipe.cxx index dbe0755..5b60f6b 100755 --- a/src/HEXABLOCK/HexPipe.cxx +++ b/src/HEXABLOCK/HexPipe.cxx @@ -20,6 +20,8 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "HexPipe.hxx" + +#include "HexDocument.hxx" #include "HexVertex.hxx" #include "HexVector.hxx" #include "HexXmlWriter.hxx" diff --git a/src/HEXABLOCK/HexQuad.cxx b/src/HEXABLOCK/HexQuad.cxx index a075aa0..e5ab815 100755 --- a/src/HEXABLOCK/HexQuad.cxx +++ b/src/HEXABLOCK/HexQuad.cxx @@ -24,12 +24,16 @@ #include "HexDocument.hxx" #include "HexHexa.hxx" #include "HexElements.hxx" +#include "HexGlobale.hxx" #include "HexXmlWriter.hxx" -#include "HexShape.hxx" +#include "HexNewShape.hxx" +#include "HexFaceShape.hxx" BEGIN_NAMESPACE_HEXA +bool db = false; + // ======================================================== Constructeur Quad::Quad (Vertex* va, Vertex* vb, Vertex* vc, Vertex* vd) : EltBase (va->dad(), EL_QUAD) @@ -43,7 +47,7 @@ Quad::Quad (Vertex* va, Vertex* vb, Vertex* vc, Vertex* vd) for (int nro=0 ; nro inter (q_edge[prec]); if (nc>=0) node = q_edge[nro]->getVertex (nc); - else + else setError (888); } q_vertex [prec] = node; @@ -96,7 +100,7 @@ Quad::Quad (Edge* ea, Edge* eb, Edge* ec, Edge* ed) dump (); printf (" +++++++++++++++++++++++++++++++++++++++++++ \n"); // el_root->dump (); - for (int ned=0; neddumpPlus (); } @@ -111,7 +115,7 @@ Quad::Quad (Edge* ea, Edge* eb, Edge* ec, Edge* ed) majReferences (); } -// ======================================================== Constructeur bis +// ======================================================== Constructeur ter Quad::Quad (Quad* other) : EltBase (other->dad(), EL_QUAD) { @@ -123,13 +127,35 @@ Quad::Quad (Quad* other) q_orientation = Q_UNDEFINED; q_clone = NULL; } -// ========================================================= majReferences +// ============================================================ getEdge +Edge* Quad::getEdge (int nro) +{ + Edge* elt = NULL; + if (nro >=0 && nro < QUAD4 && el_status == HOK && q_edge [nro]->isValid()) + elt = q_edge [nro]; + + DumpStart ("getEdge", nro); + DumpReturn (elt); + return elt; +} +// ============================================================ getVertex +Vertex* Quad::getVertex (int nro) +{ + Vertex* elt = NULL; + if (nro >=0 && nro < QUAD4 && el_status == HOK && q_vertex [nro]->isValid()) + elt = q_vertex [nro]; + + DumpStart ("getVertex", nro); + DumpReturn (elt); + return elt; +} +// ========================================================= majReferences void Quad::majReferences () { for (int nro=0 ; nro addParent (this); } -// ========================================================= getParent +// ========================================================= getParent Hexa* Quad::getParent (int nro) { return static_cast (getFather (nro)); @@ -148,7 +174,7 @@ int Quad::anaMerge (Vertex* v1, Vertex* v2, Vertex* tv1[], Edge* te1[]) int nsp1 = (orig+1) MODULO QUAD4; int nsm1 = (orig+QUAD4-1) MODULO QUAD4; - if (q_vertex [nsp1] == v2) + if (q_vertex [nsp1] == v2) { for (int nro=0 ; nro < QUAD4 ; nro++) { @@ -156,7 +182,7 @@ int Quad::anaMerge (Vertex* v1, Vertex* v2, Vertex* tv1[], Edge* te1[]) te1 [nro] = q_edge [(orig+nro) MODULO QUAD4]; } } - else if (q_vertex [nsm1] == v2) + else if (q_vertex [nsm1] == v2) { for (int nro=0 ; nro < QUAD4 ; nro++) { @@ -164,7 +190,7 @@ int Quad::anaMerge (Vertex* v1, Vertex* v2, Vertex* tv1[], Edge* te1[]) te1 [nro] = q_edge [(orig+QUAD4-nro) MODULO QUAD4]; } } - else + else return 588; return HOK; @@ -183,17 +209,17 @@ int Quad::ordoVertex (Vertex* v1, Vertex* v2, Vertex* tv1[]) int nsp1 = (orig+1) MODULO QUAD4; int nsm1 = (orig+QUAD4-1) MODULO QUAD4; - if (q_vertex [nsp1] == v2) + if (q_vertex [nsp1] == v2) { for (int nro=0 ; nro < QUAD4 ; nro++) tv1 [nro] = q_vertex [(orig+nro) MODULO QUAD4]; } - else if (q_vertex [nsm1] == v2) + else if (q_vertex [nsm1] == v2) { for (int nro=0 ; nro < QUAD4 ; nro++) tv1 [nro] = q_vertex [(orig+QUAD4-nro) MODULO QUAD4]; } - else + else return 588; return HOK; @@ -224,8 +250,8 @@ Quad* Quad::getBrother (StrOrient* orient) break; case OR_RIGHT : n21 = n22 + sens; break; - case OR_FRONT : n21 += 2; - n22 += 2; + case OR_FRONT : n21 += 2; + n22 += 2; break; default : ; } @@ -262,7 +288,7 @@ Quad* Quad::getBrother (StrOrient* orient) // ======================================================== coupler int Quad::coupler (Quad* other, StrOrient* orient, Elements* table) { - if (other==NULL) + if (other==NULL) return HERR; Hexa* hexa = other->getParent(0); @@ -274,8 +300,8 @@ int Quad::coupler (Quad* other, StrOrient* orient, Elements* table) for (int ned = 0 ; ned < QUAD4 ; ned++) { - Edge* arete = q_edge[ned]; - int nbfreres = arete ->getNbrParents (); + Edge* arete = q_edge[ned]; + int nbfreres = arete ->getNbrParents (); for (int nq = 0 ; nq < nbfreres ; nq++) { Quad* next = arete->getParent (nq); @@ -283,8 +309,8 @@ int Quad::coupler (Quad* other, StrOrient* orient, Elements* table) { StrOrient new_ori (orient); new_ori.dir = OR_FRONT; - Vertex* va = arete->getVertex (V_AMONT); - Vertex* vb = arete->getVertex (V_AVAL); + Vertex* va = arete->getVertex (V_AMONT); + Vertex* vb = arete->getVertex (V_AVAL); // On voit si un point de repere est conserve if (va == orient->v11) @@ -371,6 +397,7 @@ Edge* Quad::getOpposEdge (Edge* start, int& sens) } // TODO : traiter l'erreur cout << " ... Probleme dans Quad::getOpposedEdge :" << endl; + HexDisplay (el_name); PutName (start); PutName (vaprim); PutName (vbprim); @@ -398,21 +425,21 @@ void Quad::saveXml (XmlWriter* xml) xml->openMark ("Quad"); xml->addAttribute ("id", getName (buffer)); xml->addAttribute ("edges", edges); - if (el_name!=buffer) + if (el_name!=buffer) xml->addAttribute ("name", el_name); xml->closeMark (); int nbass = tab_assoc.size(); for (int nro=0 ; nrosaveXml (xml); + tab_assoc[nro]->saveXml (xml); } // ======================================================== replaceEdge void Quad::replaceEdge (Edge* old, Edge* par) { for (int nro=0 ; nro ZEROR ? Q_DIRECT : Q_INVERSE; - printf (" %s = %s\n", el_name.c_str(), t_ori [ q_orientation ]); + if (db) + printf (" %s = %s\n", el_name.c_str(), t_ori [ q_orientation ]); return q_orientation; } -// ========================================================== setAssociation -void Quad::setAssociation (Shape* forme) +// ========================================================== clearAssociation +void Quad::clearAssociation () { - clearAssociation (); - addAssociation (forme); + tab_assoc.clear (); + is_associated = false; } -END_NAMESPACE_HEXA +// ========================================================== addAssociation +int Quad::addAssociation (NewShape* geom, int subid) +{ + if (geom == NULL) + return HERR; + + FaceShape* face = geom->findFace (subid); + int ier = addAssociation (face); + + return ier; +} +// ========================================================== addAssociation +int Quad::addAssociation (FaceShape* face) +{ + if (face == NULL) + return HERR; + face->addAssociation (this); + tab_assoc.push_back (face); + is_associated = true; + return HOK; +} +// ========================================================== getAssociation +FaceShape* Quad::getAssociation (int nro) +{ + if (nro < 0 || nro >= tab_assoc.size()) + return NULL; + + return tab_assoc [nro]; +} +END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexQuad.hxx b/src/HEXABLOCK/HexQuad.hxx index 812c034..2d694fb 100755 --- a/src/HEXABLOCK/HexQuad.hxx +++ b/src/HEXABLOCK/HexQuad.hxx @@ -48,9 +48,9 @@ public: virtual Edge* getEdge (int nro); virtual Vertex* getVertex (int nro); - virtual int countEdge () { return QUAD4; } - virtual int countVertex () { return QUAD4; } - + virtual int countEdge () { return QUAD4; } + virtual int countVertex () { return QUAD4; } + public: Quad (Vertex* va, Vertex* vb, Vertex* vc, Vertex* vd); Quad (Edge* ea, Edge* eb, Edge* ec, Edge* ed); @@ -89,66 +89,46 @@ public: virtual void replaceEdge (Edge* old, Edge* nouveau); virtual void replaceVertex (Vertex* old, Vertex* nouveau); - virtual void setAssociation (Shape* forme); - virtual int addAssociation (Shape* forme); - virtual void clearAssociation () { tab_assoc.clear() ; } - virtual bool isAssociated () { return tab_assoc.size() > 0 ; } + virtual void setAssociation (Shape* forme) {} // PERIME + virtual int addAssociation (Shape* forme) {return HOK ; } // PERIME + + virtual void clearAssociation (); - const Shapes& getAssociations () { return tab_assoc ; } + // const Shapes& getAssociations () { return tab_shapes ; } virtual void duplicate (); Quad* getClone () { return q_clone ; } - Edge* getOpposEdge (Edge* arete); // Version simplifiee - Edge* getPerpendicular (Edge* arete, Vertex* node); + Edge* getOpposEdge (Edge* arete); // Version simplifiee + Edge* getPerpendicular (Edge* arete, Vertex* node); int getOrientation () { return q_orientation; } int setOrientation (); void setOrientation (int ori); + // Hexa5 + int addAssociation (NewShape* forme, int subid); + int addAssociation (FaceShape* forme); + int countAssociation () { return tab_assoc.size () ; } + FaceShape* getAssociation (int nro); private: friend class Cloner; Quad* getBrother (StrOrient* orient); - + private: Edge* q_edge [QUAD4]; Vertex* q_vertex [QUAD4]; Quad* q_clone; - int q_orientation; + int q_orientation; - Shapes tab_assoc; + FaceShapes tab_assoc; }; // ----------------------------------------------- Inlining -// ========================================================== addAssociation -inline int Quad::addAssociation (Shape* forme) -{ - if (forme != NULL) - tab_assoc.push_back (forme); - return HOK; -} -// ============================================================ getEdge -inline Edge* Quad::getEdge (int nro) -{ - Edge* elt = NULL; - if (nro >=0 && nro < QUAD4 && el_status == HOK && q_edge [nro]->isValid()) - elt = q_edge [nro]; - - return elt; -} -// ============================================================ getVertex -inline Vertex* Quad::getVertex (int nro) -{ - Vertex* elt = NULL; - if (nro >=0 && nro < QUAD4 && el_status == HOK && q_vertex [nro]->isValid()) - elt = q_vertex [nro]; - - return elt; -} // ======================================================== commonEdge inline Edge* Quad::commonEdge (Quad* other) { - for (int ne1=0 ; ne1q_edge [ne2]) return q_edge [ne1]; @@ -158,8 +138,8 @@ inline Edge* Quad::commonEdge (Quad* other) // ======================================================== Inter inline int Quad::inter (Quad* other, int& nother) { - for (int ne1=0 ; ne1q_edge [ne2]) { nother = ne2; @@ -204,7 +184,7 @@ inline Edge* Quad::findEdge (Vertex* v1, Vertex* v2) inline int Quad::indexVertex (Vertex* elt) { for (int n1=0 ; n1< QUAD4 ; n1++) - if (elt == q_vertex[n1]) + if (elt == q_vertex[n1]) return n1; return NOTHING; @@ -213,7 +193,7 @@ inline int Quad::indexVertex (Vertex* elt) inline int Quad::indexEdge (Edge* elt) { for (int n1=0 ; n1< QUAD4 ; n1++) - if (elt == q_edge[n1]) + if (elt == q_edge[n1]) return n1; return NOTHING; @@ -228,11 +208,11 @@ inline void Quad::setScalar (double val) inline void Quad::duplicate () { q_orientation = Q_UNDEFINED; - q_clone = new Quad (GetClone (q_edge [E_A]), - GetClone (q_edge [E_B]), - GetClone (q_edge [E_C]), + q_clone = new Quad (GetClone (q_edge [E_A]), + GetClone (q_edge [E_B]), + GetClone (q_edge [E_C]), GetClone (q_edge [E_D])); - q_clone->tab_assoc = tab_assoc; + q_clone->tab_assoc = tab_assoc; } END_NAMESPACE_HEXA #endif diff --git a/src/HEXABLOCK/HexShape.cxx b/src/HEXABLOCK/HexShape.cxx index 7527cee..0c3b5da 100755 --- a/src/HEXABLOCK/HexShape.cxx +++ b/src/HEXABLOCK/HexShape.cxx @@ -20,7 +20,7 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#include "HexShape.hxx" +#include "HexOldShape.hxx" #include "HexXmlWriter.hxx" BEGIN_NAMESPACE_HEXA @@ -33,12 +33,15 @@ Shape::Shape (string brep) fin = 1; ident = ""; } +void clean_brep (string& brep); // ====================================================== saveXml void Shape::saveXml (XmlWriter* xml) { char interval [80]; sprintf (interval, "%g %g", debut, fin); + clean_brep (b_rep); // Test Abu + xml->openMark ("Shape"); xml->addAttribute ("interval", interval); xml->addAttribute ("ident", ident.c_str()); diff --git a/src/HEXABLOCK/HexShape.hxx b/src/HEXABLOCK/HexShape.hxx index 7d46322..1cfaf02 100755 --- a/src/HEXABLOCK/HexShape.hxx +++ b/src/HEXABLOCK/HexShape.hxx @@ -32,7 +32,7 @@ class Shape public : Shape (string brep); string getBrep () { return b_rep; } - string getName () { return ident; } + string getIdent () { return ident; } string getIor () { return ior; } double getStart () { return debut; } @@ -40,7 +40,7 @@ public : void getBounds (double& pdeb, double& pfin) { pdeb=debut ; pfin = fin; } void setBrep (string brep) { b_rep = brep; } - void setName (string name) { ident = name; } + void setIdent (string name) { ident = name; } void setIor (string val) { ior = val; } void setBounds (double pdeb, double pfin) { debut = pdeb ; fin = pfin; } @@ -49,13 +49,12 @@ public : void saveXml (XmlWriter* xml); -public : +private : double debut; double fin; string ident; string ior; -private : std::string b_rep; }; END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexSubShape.cxx b/src/HEXABLOCK/HexSubShape.cxx new file mode 100755 index 0000000..16c1ce5 --- /dev/null +++ b/src/HEXABLOCK/HexSubShape.cxx @@ -0,0 +1,83 @@ + +// C++ : Gestion des soous-shapes + +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com +// + +#include "HexSubShape.hxx" +#include "HexNewShape.hxx" +#include "HexXmlWriter.hxx" + +#ifndef NO_CASCADE + +#include +#include +#include + +BEGIN_NAMESPACE_HEXA + +static bool db = on_debug (); // == getenv ("HEXA_DB") > 0 + +// ====================================================== Constructeur +SubShape::SubShape (NewShape* dad, int id, int dim) + : EltBase (dad->dad(), EL_SUBSHAPE) +{ + ss_parent = dad; + sub_ident = id; + sub_dim = dim; + maj_brep = maj_shape = true; +} +// ====================================================== updateShape +const TopoDS_Shape& SubShape::getShape () +{ + if (maj_shape) + updateShape (); + return geo_shape; +} +// ====================================================== getParentName +cpchar SubShape::getParentName () const +{ + if (ss_parent==NULL) + return ""; + + return ss_parent->getName(); +} +// ========================================================= saveXml +void SubShape::saveXml (XmlWriter* xml) +{ + callXml (xml); + xml->closeMark (); +} +// ========================================================= callXml +void SubShape::callXml (XmlWriter* xml) +{ + xml->openMark ("Asso"); + xml->addAttribute ("shape", getParentName()); + xml->addAttribute ("subid", getIdent()); +} +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// ====================================================== updateShape +void SubShape::updateShape () +{ + maj_shape = false; + geo_shape = ss_parent->getGeoShape (sub_ident); +} +END_NAMESPACE_HEXA +#endif diff --git a/src/HEXABLOCK/HexSubShape.hxx b/src/HEXABLOCK/HexSubShape.hxx new file mode 100644 index 0000000..032046d --- /dev/null +++ b/src/HEXABLOCK/HexSubShape.hxx @@ -0,0 +1,46 @@ + +// class : Gestion des formes associees (Hexa 5) + +#ifndef __SUB_SHAPE_H_ +#define __SUB_SHAPE_H_ + + + +#include "HexEltBase.hxx" + +#ifndef NO_CASCADE +#include +#endif + +BEGIN_NAMESPACE_HEXA + +class SubShape : public EltBase +{ +public : + SubShape (NewShape* dad, int id, int dim); + NewShape* getParentShape() const { return ss_parent; } + cpchar getParentName () const; + int getIdent () { return sub_ident ; } + int getDim () { return sub_dim ; } + + const string& getBrep (); + const TopoDS_Shape& getShape (); + + void saveXml (XmlWriter* xml); + void callXml (XmlWriter* xml); + +protected : + void updateShape (); + void updateBrep (); + +protected : + NewShape* ss_parent; + int sub_ident; + int sub_dim; // 0 = point, 1 = arete, 2 = face; + + TopoDS_Shape geo_shape; + string geo_brep; + bool maj_brep, maj_shape; +}; +END_NAMESPACE_HEXA +#endif diff --git a/src/HEXABLOCK/HexVertex.cxx b/src/HEXABLOCK/HexVertex.cxx index 0c6bee6..8226f8b 100755 --- a/src/HEXABLOCK/HexVertex.cxx +++ b/src/HEXABLOCK/HexVertex.cxx @@ -25,10 +25,16 @@ #include "HexVector.hxx" #include "HexXmlWriter.hxx" -#include "HexShape.hxx" +#include "HexDocument.hxx" +#include "HexOldShape.hxx" +#include "HexNewShape.hxx" +#include "HexVertexShape.hxx" +#include "HexKas_functions.hxx" BEGIN_NAMESPACE_HEXA +static bool db = on_debug (); // == getenv ("HEXA_DB") > 0 + // ====================================================== Constructeur Vertex::Vertex (Document* doc, double x, double y, double z) : EltBase (doc, EL_VERTEX) @@ -37,38 +43,47 @@ Vertex::Vertex (Document* doc, double x, double y, double z) gc_y = v_y = y; gc_z = v_z = z; + v_shape = NULL; v_scalar = 0; v_clone = NULL; } -// ========================================================= getParent +// ========================================================= getParent Edge* Vertex::getParent (int nro) { return static_cast (getFather (nro)); } -// ========================================================= saveXml +// ========================================================= saveXml void Vertex::saveXml (XmlWriter* xml) { char buffer[12], coord[80]; - sprintf (coord, "%g %g %g", v_x,v_y,v_z); + sprintf (coord, "%g %g %g", v_x, v_y, v_z); xml->openMark ("Vertex"); xml->addAttribute ("id", getName (buffer)); xml->addAttribute ("coord", coord); - if (el_name!=buffer) + if (el_name!=buffer) xml->addAttribute ("name", el_name); - if (el_assoc!=NULL) - xml->addAttribute ("shape", el_assoc->getBrep().c_str()); xml->closeMark (); + + if (v_shape != NULL) + { + sprintf (coord, "%g %g %g", gc_x, gc_y, gc_z); + v_shape->callXml (xml); + xml->addAttribute ("coord", coord); + xml->closeMark (); + } + +// if (el_assoc!=NULL) xml->addAttribute ("shape", el_assoc->getBrep().c_str()); } -// ========================================================= translate +// ========================================================= translate void Vertex::translate (Vector* vecteur, double fact) { v_x += fact*vecteur->getDx (); v_y += fact*vecteur->getDy (); v_z += fact*vecteur->getDz (); } -// ========================================================= createMiddle +// ========================================================= createMiddle Vertex* Vertex::createMiddle (Vertex* left, Vertex* right) { Vertex* milieu = new Vertex (left); @@ -79,4 +94,77 @@ Vertex* Vertex::createMiddle (Vertex* left, Vertex* right) return milieu; } +// ========================================================= setAssociation +int Vertex::setAssociation (VertexShape* forme) +{ + if (forme==NULL) + return HERR; + + forme->addAssociation (this); + forme->getCoords (gc_x, gc_y, gc_z); + v_shape = forme; + + if (db) cout << " Vertex " << el_name + << " setAssociation-> " << forme->getName () + << " = (" << gc_x << ", " << gc_y << ", " << gc_z << ") \n" ; + + is_associated = true; + return HOK; +} +// ========================================================= setAssociation +int Vertex::setAssociation (NewShape* geom, int subid) +{ + if (geom==NULL) + return HERR; + + VertexShape* shape = geom->findVertex (subid); + if (shape==NULL) + return HERR; + + int ier = setAssociation (shape); + return ier; +} +// ========================================================= setAssociation +int Vertex::setAssociation (double* point) +{ + NewShape* cloud = el_root->getCloud(); + + int subid = cloud->addPoint (point); + int ier = setAssociation (cloud, subid); + return ier; +} +// ========================================================= setAssociation +int Vertex::setAssociation (double px, double py, double pz) +{ + Real3 point = { px, py, pz }; + int ier = setAssociation (point); + return ier; +} +// ========================================================= clearAssociation +void Vertex::clearAssociation () +{ + v_shape = NULL; + is_associated = false; +} +// ========================================================= getAssoCoord +void Vertex::getAssoCoord (double &px, double &py, double &pz) +{ + if (is_associated) + { + px = gc_x; + py = gc_y; + pz = gc_z; + } + else + { + px = v_x; + py = v_y; + pz = v_z; + } +} +// ========================================================= getAssoCoord +void Vertex::getAssoCoord (double* point) +{ + getAssoCoord (point[dir_x], point[dir_y], point[dir_z]); +} END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/HexVertex.hxx b/src/HEXABLOCK/HexVertex.hxx index 6cd017f..612ee57 100755 --- a/src/HEXABLOCK/HexVertex.hxx +++ b/src/HEXABLOCK/HexVertex.hxx @@ -1,5 +1,5 @@ -// Class : Gestion des sommets +// Class : Gestion des sommets // Copyright (C) 2009-2012 CEA/DEN, EDF R&D // @@ -27,7 +27,7 @@ BEGIN_NAMESPACE_HEXA -class Vertex : public EltBase +class Vertex : public EltBase { public : double getX() { return v_x; } @@ -42,12 +42,27 @@ public : void setX (double v) { v_x = v ; } void setY (double v) { v_y = v ; } void setZ (double v) { v_z = v ; } - - void assoCoord (double x, double y, double z); - void assoCoord (double* pnt); + + virtual void setAssociation (Shape* forme) {} // PERIME + // Hexa5 + int setAssociation (NewShape* geom, int subid); + int setAssociation (VertexShape* forme); + int setAssociation (double* point); + int setAssociation (double px, double py, double pz); + void clearAssociation (); + + VertexShape* getAssoVertex () { return v_shape ;} + VertexShape* getAssociation () { return v_shape ;} + + void getAssoCoord (double &x, double &y, double &z); + void getAssoCoord (double* point); + + double getAssoX () { return is_associated ? gc_x : v_x ; } + double getAssoY () { return is_associated ? gc_y : v_y ; } + double getAssoZ () { return is_associated ? gc_z : v_z ; } public : - Vertex (Document* prev, double x=0.0, double y=0.0, double z=0.0); + Vertex (Document* prev, double x=0.0, double y=0.0, double z=0.0); Vertex (Document* cible, Vertex* other); Vertex (Vertex* other); virtual ~Vertex () {} @@ -60,9 +75,11 @@ public : double* getPoint (double point[]); void setCoord (double x, double y, double z); - bool isin (double xmin, double xmax, double ymin, double ymax, + void setCoord (double point[]) { setCoord (point[0], point[1], point[2]); } + + bool isin (double xmin, double xmax, double ymin, double ymax, double zmin, double zmax); - Edge* getParent (int nro); + Edge* getParent (int nro); Vertex* makeSymetric (Vertex* other); void translate (Vector* vecteur, double fact=1.0); void replace (Vertex* old); @@ -81,9 +98,9 @@ private : double v_scalar; Vertex* v_clone; double gc_x, gc_y, gc_z; - bool gc_ass; + VertexShape* v_shape; }; -// ========================================================= Constructeur bis +// ========================================================= Constructeur bis inline Vertex::Vertex (Vertex* other) : EltBase (other->dad(), EL_VERTEX) { @@ -93,35 +110,33 @@ inline Vertex::Vertex (Vertex* other) v_y = other->v_y; v_z = other->v_z; v_scalar = other->v_scalar; - gc_ass = other->gc_ass; gc_x = other->gc_x; gc_y = other->gc_y; gc_z = other->gc_z; } - else + else { v_x = v_y = v_z = 0; gc_x = gc_y = gc_z = 0; v_scalar = 0; - gc_ass = false; } } // ===================================================== getCoord -inline double Vertex::getCoord (int dir) +inline double Vertex::getCoord (int dir) { double val = 0; switch (dir) { - case dir_x : val = v_x; + case dir_x : val = v_x; break; - case dir_y : val = v_y; + case dir_y : val = v_y; break; - case dir_z : val = v_z; + case dir_z : val = v_z; break; } return val; } -// ========================================================= dump +// ========================================================= dump inline void Vertex::dump () { printName (" = "); @@ -134,28 +149,15 @@ inline void Vertex::dump () printf ("(%g, %g, %g)", v_x,v_y,v_z); dumpRef (); } -// ========================================================= setCoord +// ========================================================= setCoord inline void Vertex::setCoord (double x, double y, double z) { v_x = x; v_y = y; v_z = z; } -// ========================================================= assoCoord -inline void Vertex::assoCoord (double* coord) -{ - assoCoord (coord[dir_x], coord[dir_y], coord[dir_z]); -} -// ========================================================= assoCoord -inline void Vertex::assoCoord (double x, double y, double z) -{ - gc_ass = true; - gc_x = x; - gc_y = y; - gc_z = z; -} -// ========================================================= isin -inline bool Vertex::isin (double xmin, double xmax, double ymin, double ymax, +// ========================================================= isin +inline bool Vertex::isin (double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) { bool rep = v_x >= xmin && v_x <= xmax @@ -171,13 +173,13 @@ inline double* Vertex::getPoint (double point[]) point [dir_z] = v_z; return point; } -// ========================================================= duplicate +// ========================================================= duplicate inline void Vertex::duplicate (Document* cible) { v_clone = new Vertex (cible, v_x, v_y, v_z); v_clone->v_scalar = v_scalar; } -// ========================================================= duplicate +// ========================================================= duplicate inline bool Vertex::definedBy (double px, double py, double pz, double eps2) { double dist2 = carre (v_x-px) + carre (v_y-py) + carre (v_z-pz); diff --git a/src/HEXABLOCK/HexVertexShape.cxx b/src/HEXABLOCK/HexVertexShape.cxx new file mode 100755 index 0000000..f484e67 --- /dev/null +++ b/src/HEXABLOCK/HexVertexShape.cxx @@ -0,0 +1,115 @@ + +// C++ : Gestion des soous-shapes + +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com +// + +#include "HexVertexShape.hxx" +#include "HexXmlWriter.hxx" + +#ifndef NO_CASCADE + +#include +#include +#include +#include +#include +#include + +BEGIN_NAMESPACE_HEXA + +// static bool db = on_debug (); // == getenv ("HEXA_DB") > 0 + +// ====================================================== Constructeur +VertexShape::VertexShape (NewShape* dad, int id) + : SubShape (dad, id, 0) +{ + free_point = false; + maj_coords = true; + ss_coord[dir_x] = ss_coord[dir_y] = ss_coord[dir_z] = 0; + + // Les coordonnées + updateCoords (); +} +// ====================================================== Constructeur bis* +VertexShape::VertexShape (NewShape* dad, int id, double* point) + : SubShape (dad, id, 0) +{ + free_point = true; + maj_coords = false; + maj_shape = false; + for (int nc=dir_x ; nc<=dir_z ; ++nc) + ss_coord[nc] = point[nc]; +} +// ====================================================== updateCoords +void VertexShape::updateCoords () +{ + if (free_point) + return; + if (maj_shape) + updateShape (); + + maj_coords = false; + TopoDS_Vertex gver = TopoDS::Vertex (geo_shape); + gp_Pnt gpoint = BRep_Tool::Pnt (gver); + + ss_coord [dir_x] = gpoint.X(); + ss_coord [dir_y] = gpoint.Y(); + ss_coord [dir_z] = gpoint.Z(); +} +// ====================================================== getCoords +void VertexShape::getCoords (double& px, double& py, double& pz) +{ + if (maj_coords) + updateCoords (); + + px = ss_coord[dir_x]; + py = ss_coord[dir_y]; + pz = ss_coord[dir_z]; +} +// ====================================================== addAssociation +void VertexShape::addAssociation (Vertex* elt) +{ + tab_assoc.push_back (elt); + is_associated = true ; +} +// ====================================================== getAssociation +Vertex* VertexShape::getAssociation (int nro) +{ + if (nro>0 && nroopenMark ("Vertex"); + xml->addAttribute ("subid", sub_ident); + xml->addAttribute ("coord", coord); + xml->closeMark (); +} +END_NAMESPACE_HEXA +#endif diff --git a/src/HEXABLOCK/HexVertexShape.hxx b/src/HEXABLOCK/HexVertexShape.hxx new file mode 100644 index 0000000..4a384d2 --- /dev/null +++ b/src/HEXABLOCK/HexVertexShape.hxx @@ -0,0 +1,34 @@ + +// class : Gestion des Sous-shapes categorie Vertex + +#ifndef __NODE_SHAPE_H_ +#define __NODE_SHAPE_H_ + +#include "HexSubShape.hxx" + +BEGIN_NAMESPACE_HEXA + +class VertexShape : public SubShape +{ +public : + VertexShape (NewShape* dad, int id); + VertexShape (NewShape* dad, int id, double* point); + + void addAssociation (Vertex* elt); + int countAssociation () { return tab_assoc.size(); } + Vertex* getAssociation (int nro); + + void getCoords (double& px, double& py, double& pz); + void saveXml (XmlWriter* xml); + +private : + void updateCoords (); + +private : + Real3 ss_coord; // Pour les vertex + bool maj_coords; + bool free_point; + vector tab_assoc; +}; +END_NAMESPACE_HEXA +#endif diff --git a/src/HEXABLOCK/HexXmlTree.cxx b/src/HEXABLOCK/HexXmlTree.cxx index 99995dd..08c429e 100755 --- a/src/HEXABLOCK/HexXmlTree.cxx +++ b/src/HEXABLOCK/HexXmlTree.cxx @@ -26,7 +26,7 @@ BEGIN_NAMESPACE_HEXA enum { HEND_FILE = -2, HEND_LINE = -1, CRLF = 13 }; -// ====================================================== Constructeur +// ====================================================== Constructeur XmlTree::XmlTree (const string& nom, XmlTree* dad) { item_name = nom; @@ -79,6 +79,23 @@ const string& XmlTree::findValue (const string& nom) } return item_vide; } +// ====================================================== findInteger +int XmlTree::findInteger (const string& nom) +{ + int val = 0; + const string chnum = findValue (nom); + if (chnum==item_vide) + return val; + + int lg = chnum.size(); + for (int nc=0 ; nc= '0' && car <= '9') + val = 10*val + car - '0'; + } + return val; +} // ====================================================== parseFile int XmlTree::parseFile (const string& ficnom) { @@ -93,7 +110,7 @@ int XmlTree::parseFile (const string& ficnom) xml_file = fopen (ficnom.c_str(), "r"); if (xml_file==NULL) { - cout << " **** Fichier XML '" << ficnom << "' inaccessible" + cout << " **** Fichier XML '" << ficnom << "' inaccessible" << endl; return HERR; } @@ -101,18 +118,19 @@ int XmlTree::parseFile (const string& ficnom) int ier = parseXml (); return ier; } -// ====================================================== parseFlow -int XmlTree::parseFlow (cpchar flux) +// ====================================================== parseStream +int XmlTree::parseStream (cpchar flux, int& posit) { fic_buffer = ""; len_buffer = 0; nro_ligne = 0; fic_pos = 1988; - xml_flow = flux; - pos_flow = 0; + xml_flow = flux; + pos_flow = posit; - int ier = parseXml (); + int ier = parseXml (); + posit = pos_flow; return ier; } // ====================================================== parseXml @@ -128,11 +146,11 @@ int XmlTree::parseXml () string nom, valeur, foo; while ((item_lu=readItem (nom)) != M_NONE) { - switch (item_lu) + switch (item_lu) { case M_BEGIN : item_lu = getItem (nom, M_IDENT); - if (etat==M_PREMS) + if (etat==M_PREMS) setName (nom); else node = node -> addChild (nom); @@ -140,21 +158,23 @@ int XmlTree::parseXml () break; case M_END : - if (etat != M_BALISE_OUVERTE) + if (etat != M_BALISE_OUVERTE) putError (" balise ouverte"); etat = M_NEUTRE; break; case M_BEGIN_CLOSE : - if (etat == M_BALISE_OUVERTE) + if (etat == M_BALISE_OUVERTE) putError (" balise ouverte"); getItem (nom, M_IDENT); getItem (foo, M_END); node = node -> getParent (); + if (node==NULL) + return HOK; break; case M_CLOSE : - if (etat != M_BALISE_OUVERTE) + if (etat != M_BALISE_OUVERTE) putError (" balise deja fermee"); node = node -> getParent (); etat = M_NEUTRE; @@ -187,7 +207,7 @@ EnumItem XmlTree::getItem (string& value, EnumItem waited) { EnumItem item = readItem (value); - if (item == waited) + if (item == waited) return item; putError ("Erreur de sequence"); return item; @@ -202,7 +222,7 @@ EnumItem XmlTree::readItem (string& value) if (fic_pos>=len_buffer) { int ier=readLine (); - if (ier==HEND_FILE) + if (ier==HEND_FILE) return M_NONE; } else @@ -232,17 +252,17 @@ EnumItem XmlTree::readItem (string& value) } else if (car=='<') { - if (ncar=='/') + if (ncar=='/') { fic_pos++; return M_BEGIN_CLOSE; } - else if (ncar=='?') + else if (ncar=='?') { fic_pos++; return M_PROLOG; } - else if (ncar=='!') + else if (ncar=='!') { fic_pos++; return M_COMMENT; @@ -288,7 +308,7 @@ int XmlTree::goTo (cpchar ouca) pos = 0; else if (pos 0) @@ -357,7 +377,7 @@ int XmlTree::readLine () xml_ended = true; ier = HOK; } - else + else { xml_ended = true; ier = HEND_FILE; @@ -369,7 +389,7 @@ int XmlTree::readLine () void XmlTree::putError (cpchar mess) { printf (" ***** Erreur : %s\n", mess); - printf (" +++ Derniere ligne lue : nro %d, %deme caractere\n", + printf (" +++ Derniere ligne lue : nro %d, %deme caractere\n", nro_ligne, fic_pos); printf ("%s\n", fic_buffer.c_str()); // exit (102); @@ -401,8 +421,8 @@ void XmlTree::dump (int niveau) for (int nc=0 ; nc 0) - { - string sext = &nomfic[pext]; - set_minus (sext); - suff = sext != ".xml"; - } - string fname = nomfic; - if (suff) - fname += ".xml"; - xml_file = fopen (fname.c_str(), "w"); - if (xml_file==NULL) - { - xml_file = stdout; - return HERR; - } + xml_file = stdout; + xml_mode = InaStream; + return HERR; } + return HOK; +} +// ========================================================= setFileName +int XmlWriter::setFileName (cpchar nomfic) +{ + xml_mode = InaFile; + xml_file = stdout; + on_file = true; + + bool suff = true; + int pext = strlen (nomfic) - 4; + if (pext > 0) + { + string sext = &nomfic[pext]; + set_minus (sext); + suff = sext != ".xml"; + } + + string fname = nomfic; + if (suff) + fname += ".xml"; + + xml_file = fopen (fname.c_str(), "w"); + if (xml_file==NULL) + { + xml_file = stdout; + return HERR; + } + + return HOK; +} +// ========================================================= startXml +int XmlWriter::startXml () +{ + xml_level = 0; + xml_pos = 0; + xml_buffer = ""; + ecrire (""); return HOK; } @@ -74,10 +105,11 @@ void XmlWriter::closeXml () while (NOT pile_mark.empty()) closeMark (); - if (xml_file!=stdout) + if (xml_mode == InaFile && xml_file!=stdout) + { fclose (xml_file); - - xml_file = stdout; + xml_file = stdout; + } } // ========================================================= addMark void XmlWriter::addMark (cpchar balise, bool jump) diff --git a/src/HEXABLOCK/HexXmlWriter.hxx b/src/HEXABLOCK/HexXmlWriter.hxx index f75bc5a..0d4cdae 100755 --- a/src/HEXABLOCK/HexXmlWriter.hxx +++ b/src/HEXABLOCK/HexXmlWriter.hxx @@ -34,8 +34,10 @@ public : XmlWriter (); ~XmlWriter () { closeXml () ; } - int openXml (string& nom) { return openXml (nom.c_str()); } - int openXml (cpchar nom=NULL); + int setFileName (cpchar filename); // Un seul xml par fichier + int setFile (pfile afile); // Plusieurs xml par fichier + int setStream (); // Sauvegarde par flux + int startXml (); void closeXml (); cpchar getXml () { return xml_buffer.c_str(); } @@ -57,7 +59,9 @@ private : void addMot (cpchar mot); private : + enum {InaFile, InaStudy, InaStream} xml_mode; enum {xml_decal=3, xml_size=80}; + pfile xml_file; int xml_level; int xml_pos; diff --git a/src/HEXABLOCK/Makefile.am b/src/HEXABLOCK/Makefile.am index 3d1c5b9..1039744 100755 --- a/src/HEXABLOCK/Makefile.am +++ b/src/HEXABLOCK/Makefile.am @@ -24,8 +24,8 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am # Files to be installed # =============================================================== # -# -# header files +# +# header files salomeinclude_HEADERS = \ HexGroup.hxx \ HexCylinder.hxx \ @@ -48,8 +48,18 @@ salomeinclude_HEADERS = \ Hex.hxx \ HexPipe.hxx \ HexShape.hxx \ + HexOldShape.hxx \ + HexNewShape.hxx \ + HexSubShape.hxx \ + HexVertexShape.hxx \ + HexEdgeShape.hxx \ + HexFaceShape.hxx \ + HexBiCylinderShape.hxx \ + HexAssoEdge.hxx \ HexXmlTree.hxx \ HexCrossElements.hxx \ + HexBiCylinder.hxx \ + HexDumpStudy.hxx \ HexAnaQuads.hxx \ HexKasPoint.hxx \ HexKasLine.hxx \ @@ -85,13 +95,22 @@ dist_libHEXABLOCKimpl_la_SOURCES = \ HexPipe.cxx \ HexLaw.cxx \ HexShape.cxx \ + HexNewShape.cxx \ + HexSubShape.cxx \ HexDocument_trans.cxx \ + HexVertexShape.cxx \ + HexEdgeShape.cxx \ + HexFaceShape.cxx \ + HexBiCylinderShape.cxx \ + HexAssoEdge.cxx \ HexDocument_Xml.cxx \ HexDocument.cxx \ HexXmlTree.cxx \ HexXmlWriter.cxx \ + HexDumpStudy.cxx \ HexCrossElements.cxx \ HexCrossElements_build.cxx \ + HexBiCylinder.cxx \ Hex.cxx \ HexDocument_asso.cxx \ HexDocument_quads.cxx \ @@ -102,7 +121,7 @@ dist_libHEXABLOCKimpl_la_SOURCES = \ # libHEXABLOCKimpl_la_CPPFLAGS = \ # -I$(top_builddir)/salome_adm/unix -# +# # libHEXABLOCKimpl_la_LDFLAGS = \ # -lOpUtil diff --git a/src/HEXABLOCK/hexa_base.hxx b/src/HEXABLOCK/hexa_base.hxx index 20e0cd0..76ff3f6 100755 --- a/src/HEXABLOCK/hexa_base.hxx +++ b/src/HEXABLOCK/hexa_base.hxx @@ -17,9 +17,12 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com // +#define DumpActif false + #ifndef _HEXA_BASE_H_ #define _HEXA_BASE_H_ @@ -37,16 +40,16 @@ typedef FILE* pfile; #define Cestnonvide(c1) c1[0] // Pour rendre les operateurs plus visibles -#define NOT ! +#define NOT ! #define XOR ^ #define MODULO % #define INOT ` // #define IOR | #define IAND & - // Chaines de bits + // Chaines de bits #define DeuxPuissance(n) (1 << (n)) - // Codes retour d'une fonction + // Codes retour d'une fonction #define HOK 0 // Code retour=0 : deroulement correct #define HERR 1 // Code retour>0 = numero d'erreur, 1 par defaut #define NOTHING -1 // Code retour fonction de recherche d'un index @@ -70,6 +73,8 @@ typedef FILE* pfile; // Conventions C++ #include #include + +typedef const std::string& rcstring; // Impressions de mise au point #include using namespace std; @@ -84,15 +89,15 @@ using namespace std; // #define Destroy(obj) { delete obj ; obj=NULL ; } // #define Deltable(table) { delete [] table ; table=NULL ; } -// ---------------------------------- Definitions propres a HEXA +// ---------------------------------- Definitions propres a HEXA #define HEXA_NS Hex #define BEGIN_NAMESPACE_HEXA namespace Hex { #define END_NAMESPACE_HEXA } /* ----------------------------------------------------- - // ---- Numerotation des faces (%x) - + // ---- Numerotation des faces (%x) + 6=bed +----bd-----+ bdf=7 /| /| be | B bf | @@ -106,23 +111,41 @@ using namespace std; | ae A | af | / |/ |/ |/ 0=ace +----ac-----+ acf=1 +-----> x - + * ----------------------------------------------------- */ //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 + +#ifndef NO_CASCADE +class TopoDS_Shape; +#else +typedef int TopoDS_Shape; +typedef int TopTools_IndexedMapOfShape; +#endif + +class BRepAdaptor_Curve; + BEGIN_NAMESPACE_HEXA enum EnumCoord { dir_x, dir_y, dir_z, DIM3 }; -enum EnumElt { EL_NONE, EL_VERTEX, EL_EDGE, EL_QUAD, EL_HEXA, EL_VECTOR, - EL_GRID, EL_CYLINDER, EL_PIPE, EL_REMOVED, EL_MAXI }; +enum EnumElt { EL_NONE, EL_VERTEX, EL_EDGE, EL_QUAD, EL_HEXA, EL_VECTOR, + EL_GRID, EL_CYLINDER, EL_PIPE, EL_GROUP, EL_LAW, + EL_SHAPE, EL_SUBSHAPE, + EL_REMOVED, EL_MAXI }; -enum EnumGroup { HexaCell, QuadCell, EdgeCell, +const cpchar ABR_TYPES = "xveqhwtcpglsu???"; + +enum EnumGroup { HexaCell, QuadCell, EdgeCell, HexaNode, QuadNode, EdgeNode, VertexNode}; + // Origine des shapes +enum EnumShape { SH_NONE, SH_IMPORT, SH_CYLINDER, SH_INTER, SH_SPHERE, + SH_CLOUD }; + // Modes de remplissage des grilles cylindriques enum EnumCyl { CYL_NOFILL, CYL_CL4, CYL_CL6, CYL_CLOSED, CYL_PEER, CYL_ODD}; -enum EnumGrid { GR_NONE, GR_CARTESIAN, GR_CYLINDRIC, GR_SPHERIC, GR_JOINT, - GR_BICYL, GR_BIPIPE, GR_REPLACE, +enum EnumGrid { GR_NONE, GR_CARTESIAN, GR_CYLINDRIC, GR_SPHERIC, GR_JOINT, + GR_BICYL, GR_BIPIPE, GR_REPLACE, GR_HEMISPHERIC, GR_RIND, GR_PART_SPHERIC, GR_PART_RIND }; // Sommets de la decomposition canonique du bicylindre // 0 1 2 3 4 5 6 7 8 @@ -140,17 +163,18 @@ enum EnumQuad { E_A, E_B, E_C, E_D, QUAD4 }; // z=0 z=1 y=0 y=1 x=0 x=1 enum EnumHQuad {Q_A, Q_B, Q_C, Q_D, Q_E, Q_F, HQ_MAXI}; -enum EnumHEdge {E_AC, E_AD, E_BC, E_BD, +enum EnumHEdge {E_AC, E_AD, E_BC, E_BD, E_AE, E_AF, E_BE, E_BF, E_CE, E_CF, E_DE, E_DF, HE_MAXI }; -enum EnumHVertex {V_ACE, V_ACF, V_ADE, V_ADF, V_BCE, V_BCF, V_BDE, V_BDF, +enum EnumHVertex {V_ACE, V_ACF, V_ADE, V_ADF, V_BCE, V_BCF, V_BDE, V_BDF, HV_MAXI }; enum EnumQDirection {Q_INSIDE, Q_DIRECT, Q_INVERSE, Q_UNDEFINED, Q_WAITING }; enum { CylSmall=0, CylBig=1, NxInt=1, NxExt=2 }; +class Hex; class Document; class EltBase; @@ -173,9 +197,9 @@ class Elements; class GridElements; class SphericalGrid; class CrossElements; +class BiCylinder; struct StrOrient; -class Shape; class Globale; class Propagation; class Law; @@ -184,11 +208,29 @@ class Group; class AnaQuads; class Pattern; +class Shape; +class SubShape; +class VertexShape; +class EdgeShape; +class FaceShape; +class AssoEdge; +class NewShape; // 1) Shape -> OldShape, 2) NewShape->Shape +typedef Shape OldShape; + typedef std::vector Hexas; typedef std::vector Quads; typedef std::vector Edges; typedef std::vector Shapes; -typedef std::vector RealVector; +typedef std::vector NewShapes; +typedef std::vector SubShapes; +typedef std::vector AssoEdges; +typedef std::vector FaceShapes; +typedef std::vector EdgeShapes; + +typedef std::vector TabElts; +typedef std::vector RealVector; +typedef std::vector IntVector; +typedef std::vector TabText; typedef double Real; typedef double Real3 [DIM3]; @@ -211,14 +253,19 @@ int normer_vecteur (double v1[]); double carre (double val); bool same_coords (double* pa, double* pb, double epsilon=1e-6); -bool on_debug(); -int niv_debug(); +bool on_debug(); // == getenv ("HEXA_DB") > 0 +bool in_test (); // == getenv ("HEXA_TEST") > 0 +int niv_debug(); // Implemente prochainement void set_minus (string& chaine); bool special_option (); void set_special_option (bool opt); +int sizeof_file (cpchar filename); +char* read_file (cpchar filename, int& size); +cpchar get_time (string& buffer); + const double Epsil = 1e-6; const double UnEpsil = 0.999999; const double Epsil2 = 1e-12; diff --git a/src/HEXABLOCK/hexa_utils.cxx b/src/HEXABLOCK/hexa_utils.cxx index e08dc25..6b5e337 100755 --- a/src/HEXABLOCK/hexa_utils.cxx +++ b/src/HEXABLOCK/hexa_utils.cxx @@ -24,24 +24,43 @@ #include #include +#include #include BEGIN_NAMESPACE_HEXA -static int debug_level = NOTHING; -// ========================================================= prod_scalaire -bool on_debug () +// ========================================================= niv_debug +int niv_debug () { + static int debug_level = NOTHING; if (debug_level == NOTHING) { cpchar rep = getenv ("HEXA_DB"); if (rep!=NULL) debug_level = atoi (rep); - debug_level = std::max (debug_level, 0); + debug_level = std::max (debug_level, 0); } - return debug_level > 0; - + return debug_level; +} +// ========================================================= on_debug +bool on_debug () +{ + return niv_debug () > 0; +} +// ========================================================= in_test +bool in_test () +{ + static int test_level = NOTHING; + if (test_level == NOTHING) + { + cpchar rep = getenv ("HEXA_TEST"); + if (rep!=NULL) + test_level = atoi (rep); + test_level = std::max (test_level, 0); + } + return test_level > 0; + } // ======================================================== set_minus void set_minus (string& chaine) @@ -58,24 +77,24 @@ pchar get_temp_name (cpchar format, pchar nomfic) { nro ++; sprintf (nomfic, format, nro); - + struct stat buffer; int rep = stat (nomfic, &buffer); - if (rep<0) + if (rep<0) return nomfic; } } // ========================================================= prod_scalaire double prod_scalaire (double v1[], double v2[]) { - double prod = v1[dir_x]*v2[dir_x] + v1[dir_y]*v2[dir_y] + double prod = v1[dir_x]*v2[dir_x] + v1[dir_y]*v2[dir_y] + v1[dir_z]*v2[dir_z]; return prod; } // ========================================================= calc_norme double calc_norme (double vect[]) { - double norme = vect[dir_x]*vect[dir_x] + vect[dir_y]*vect[dir_y] + double norme = vect[dir_x]*vect[dir_x] + vect[dir_y]*vect[dir_y] + vect[dir_z]*vect[dir_z]; return sqrt (norme); } @@ -103,7 +122,7 @@ void calc_milieu (double pta[], double ptb[], double milieu[]) int normer_vecteur (double vect[]) { double dn = calc_norme (vect); - if (dn < 1e-30) + if (dn < 1e-30) return HERR; vect [dir_x] /= dn; @@ -126,19 +145,19 @@ double carre (double val) return val*val; } // ====================================================== same_coords -bool same_coords (double* pa, double* pb, double epsilon) +bool same_coords (double* pa, double* pb, double epsilon2) { - double d2 = carre (pb[dir_x]-pa[dir_x]) + carre (pb[dir_y]-pa[dir_y]) - + carre (pb[dir_z]-pa[dir_z]); - return d2 < epsilon; + double d2 = carre (pb[dir_x]-pa[dir_x]) + carre (pb[dir_y]-pa[dir_y]) + + carre (pb[dir_z]-pa[dir_z]); + return d2 < epsilon2; } // ========================================================= prod_mixte double prod_mixte (double vi[], double vj[], double vk[]) { double pmixte = 0; - for (int nc=0 ; nc 0; } @@ -179,4 +198,57 @@ void set_special_option (bool opt) { current_option = opt ? 1 : 0; } +// ====================================================== sizeof_file +int sizeof_file (cpchar filename) +{ + struct stat status; + + int ier = stat (filename, &status); + if (ier == HOK) + return status.st_size; + else + return NOTHING; +} +// ====================================================== read_file +char* read_file (cpchar filename, int& size) +{ + size = 0; + + struct stat status; + int ier = stat (filename, &status); + if (ier != HOK) + return NULL; + + FILE* fic = fopen (filename, "r"); + if (fic == NULL) + return NULL; + + int lgalloc = status.st_size; + char* buffer = (char*) malloc (lgalloc+1); + if (buffer == NULL) + return NULL; + + for (int car = fgetc (fic) ; car!=EOF && sizetm_year, temps->tm_mon+1, temps->tm_mday, + temps->tm_hour, temps->tm_min, temps->tm_sec); + + buffer = quand; + return buffer.c_str(); +} END_NAMESPACE_HEXA diff --git a/src/HEXABLOCK/test_brep.cxx b/src/HEXABLOCK/test_brep.cxx new file mode 100755 index 0000000..397dae8 --- /dev/null +++ b/src/HEXABLOCK/test_brep.cxx @@ -0,0 +1,163 @@ + +// C++ : Extraction des brep d'un fichier XML + +// Copyright (C) 2009-2011 CEA/DEN, EDF R&D and My Apple +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com + + +#include "HexXmlTree.hxx" + +using namespace Hex; + +void parse_brep (XmlTree& xml); + +// ======================================================== test_brep +int test_brep (int nbargs, cpchar tabargs[]) +{ + + XmlTree xml(""); + string filename = "restore"; + if (nbargs>1) + filename = tabargs [1]; + + static const int NbExt = 3; + static cpchar t_ext [NbExt] = { ".xml", ".XML", ".Xml" }; + size_t ici = 0; + bool noext = true; + for (int nx = 0; nx < NbExt && noext ; nx++) + { + ici = filename.rfind (t_ext[nx]); + noext = ici < 0 || ici > filename.size(); + } + + if (noext) + filename += ".xml"; + + int ier = xml.parseFile (filename); + if (ier!=HOK) + return ier; + + parse_brep (xml); + return HOK; +} +// ======================================================== get_names +void get_names (const string& chaine, vector& table) +{ + table.clear (); + int lg = chaine.size(); + string mot = ""; + bool encours = false; + + for (int nc=0 ; ncgetNbrChildren (); + + string nom, brep, filename; + XmlTree* node = NULL; + vector tname; + + for (int nro=0 ; nro < nbrelts ; nro++) + { + node = rubrique->getChild (nro); + nom = node->findValue ("id"); + brep = node->findValue ("shape"); + if (NOT brep.empty ()) + save_file_brep (nom, brep); + } + + rubrique = xml.findChild ("ListEdges"); + nbrelts = rubrique->getNbrChildren (); + + for (int nro=0 ; nro < nbrelts ; nro++) + { + node = rubrique->getChild (nro); + const string& type = node->getName(); + if (type=="Edge") + { + nom = node->findValue ("id"); + const string& vertices = node->findValue ("vertices"); + get_names (vertices, tname); + } + else if (type=="Shape") + { + brep = node->findValue ("brep"); + save_file_brep (nom, brep); + } + } + + rubrique = xml.findChild ("ListQuads"); + nbrelts = rubrique->getNbrChildren (); + + for (int nro=0 ; nro < nbrelts ; nro++) + { + node = rubrique->getChild (nro); + const string& type = node->getName(); + if (type=="Quad") + { + nom = node->findValue ("id"); + const string& edges = node->findValue ("edges"); + get_names (edges, tname); + } + else if (type=="Shape") + { + brep = node->findValue ("brep"); + save_file_brep (nom, brep); + } + } +} diff --git a/src/HEXABLOCK/test_hexa1.cxx b/src/HEXABLOCK/test_hexa1.cxx new file mode 100755 index 0000000..61af7bb --- /dev/null +++ b/src/HEXABLOCK/test_hexa1.cxx @@ -0,0 +1,1969 @@ + +// C++ : Tests unitaires + +// Copyright (C) 2009-2011 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com + +#include "test_unit.hxx" + +#include "Hex.hxx" +#include "HexDocument.hxx" +#include "HexElements.hxx" +#include "HexCrossElements.hxx" + +#include "HexHexa.hxx" +#include "HexQuad.hxx" +#include "HexEdge.hxx" +#include "HexVertex.hxx" + +#include "HexPropagation.hxx" +#include "HexOldShape.hxx" +#include "HexLaw.hxx" +#include "HexMatrix.hxx" +#include "HexCramer.hxx" +#include "HexGroup.hxx" + + +#include + +static int nbr_vtk = 0; +static cpchar case_name = "hexa"; +static Hex::Document* docu = NULL; + +// ======================================================== print_propagations +void print_propagations (Hex::Document* doc) +{ + int nb = doc->countPropagation (); + HexDisplay (nb); + for (int nro=0 ; nrogetPropagation (nro); + const Hex::Edges& table = prop->getEdges (); + printf (" ____________________________________ Prop nro %d\n", nro); + for (int ned=0 ; ned<(int)table.size() ; ned++) + { + bool way = table [ned]->getWay (); + Hex::Edge* edge = table [ned]; + Hex::Vertex* v0 = edge->getVertex (0); + Hex::Vertex* v1 = edge->getVertex (1); + + if (way) + { + printf (" ("); + v0->printName (", "); + v1->printName (")\n"); + } + else + { + v1->printName (", "); + v0->printName (")\n"); + printf (" ("); + } + } + } +} +// ======================================================== save_vtk +void save_vtk () +{ + if (docu==NULL) + return; + + docu->saveVtk (case_name, nbr_vtk); +} +// ======================================================== remove_hexa +void remove_hexa (Hex::Hexa* hexa) +{ + if (hexa==NULL) + return; + + hexa->remove(); + + if (docu==NULL) + return; + + docu->saveVtk (case_name, nbr_vtk); +} +// ======================================================== test_sphere +int test_sphere (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + Hex::Vertex* orig = doc->addVertex (0,0,0); + + int ncouches = 2; + double k = 1; + double rayon = 1; + Hex::Elements* sphere = doc->makeSpherical (orig, rayon, ncouches, k); + + if (ncouches>0) + { + for (int nc=0 ; nc <= ncouches ; nc++) + { + Hex::Hexa* cell = sphere->getStrate (nc, Hex::Q_A); + if (nc==0) + cell->dumpFull(); + cell->remove (); + // sphere->getStrate (nc, Hex::Q_A)->remove (); + // sphere->getStrate (nc, Hex::Q_B)->remove (); + } + } + + sphere->saveVtk ("sphere.vtk"); + return HOK; +} +// ======================================================== test_cartesi1 +int test_cartesi1 () +{ + const int size_x = 15; + const int size_y = 12; + const int size_z = 8; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + Hex::Vertex* orig = doc->addVertex (0,0,0); + + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + + // print_propagations (doc); + + for (int nz=0; nzgetHexaIJK (nx, ny, nz); + cell->remove (); + } + + doc->setLevel (1); + print_propagations (doc); + grid->saveVtk ("grid_cart.vtk"); + + // doc->dump (); + return HOK; +} +// ======================================================== afficher +#define Afficher(elt) afficher (#elt, elt) +int afficher (cpchar nom, Hex::EltBase* elt) +{ + if (elt==NULL) + { + printf (" .... %s = 0x0\n", nom); + return HOK; + } + + printf (" .... %s = 0x%08lx = %03d\n", nom, (unsigned long) elt, elt->getId()); + return HOK; +} +// ======================================================== test_find +int test_find () +{ + const int size_x = 2; + const int size_y = 2; + const int size_z = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + + grid->saveVtk ("mini1.vtk"); + doc->dump (); + + Hex::Vertex *v00, *v02, *v06, *v08, *v10, *v22, *v26; + + Afficher ( v00 = doc->findVertex (0, 0, 0)); + Afficher ( v02 = doc->findVertex (1, 1, 0)); + Afficher ( v06 = doc->findVertex (1, 1, 1)); + Afficher ( v08 = doc->findVertex (2, 1, 0)); + Afficher ( v10 = doc->findVertex (2, 1, 1)); + Afficher ( v22 = doc->findVertex (2, 1, 2)); + Afficher ( v26 = doc->findVertex (2, 2, 2)); + + printf ("\n"); + + Afficher (doc->findEdge (v06, v10)); + Afficher (doc->findEdge (v10, v06)); + printf ("\n"); + + Afficher (doc->findQuad (v02, v10)); + Afficher (doc->findQuad (v06, v08)); + Afficher (doc->findQuad (v02, v06)); + + printf ("\n"); + Afficher (doc->findHexa (v00, v06)); + Afficher (doc->findHexa (v06, v26)); + Afficher (doc->findHexa (v26, v06)); + + return HOK; +} +// ======================================================== test_joint +int test_joint (int nbargs, cpchar tabargs[]) +{ + const int dimx = 11; + const int dimy = 11; + const int dimz = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig1 = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + + Hex::Elements* grid1 = doc->makeCartesian (orig1, dir, dimx,dimy,dimz); + + Hex::Vertex* orig2 = doc->addVertex (dimx/2.0,0,8); + Hex::Vector* vectj = doc->addVector (0,1,0); + Hex::Vector* vecti = doc->addVector (1,0,0); + Hex::Elements* grid2 = doc->makeCylindrical (orig2, vecti, vectj, + 1, 180, 1, dimz,dimy,dimx); + + int mx = dimx/2; + int my = dimy/2; + Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); + Hex::Quad* cible = grid2->getQuadJK (dimz, mx, my); + + Hex::Vertex* v1 = prems->getVertex (0); + Hex::Vertex* v3 = prems->getVertex (1); + + Hex::Vertex* v2 = cible->getVertex (1); + Hex::Vertex* v4 = cible->getVertex (2); + + // v1->setScalar (3); + // v2->setScalar (3); + // v3->setScalar (6); + // v4->setScalar (6); + + Hex::Quads liste; + + liste.push_back (prems); + for (int nx=0; nxgetQuadIJ (nx, my, dimz)); + + for (int ny=0; nygetQuadIJ (mx, ny, dimz)); + + doc->saveVtk ("joint1.vtk"); + const int hauteur = 5; + Hex::Elements* joint = doc->joinQuads(liste, cible, v1,v2,v3,v4, hauteur); + // for (int nh=0 ; nhgetHexa(nh)->setScalar (5); + + int nbr_joint_vertex = joint->countVertex (); + int nbr_surf_vertex = nbr_joint_vertex/(hauteur+1); + + HexDisplay (nbr_joint_vertex); + HexDisplay (nbr_surf_vertex); + + int indice0 = joint->findVertex (v1); + HexDisplay (indice0); + + for (int nh=0 ; nhgetVertex(nh)->setScalar (5); + + for (int nh=0 ; nh<=hauteur ; nh++) + joint->getVertex(nh*nbr_surf_vertex)->setScalar (3); + + doc->saveVtk ("joint2.vtk"); + return HOK; +} +// ======================================================== test_prism +int test_prism (int nbargs, cpchar tabargs[]) +{ + const int dimx = 11; + const int dimy = 11; + const int dimz = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig1 = doc->addVertex ( 0,0,0); + Hex::Vector* dir1 = doc->addVector ( 1,1,1); + Hex::Vector* dir2 = doc->addVector ( 1,1,-1); + + Hex::Elements* grid1 = doc->makeCartesian (orig1, dir1, dimx,dimy,dimz); + + int mx = dimx/2; + int my = dimy/2; + Hex::Quads liste1, liste2; + + liste1.push_back (grid1->getQuadIJ (mx, my, dimz)); + liste2.push_back (grid1->getQuadIJ (mx, my, 0)); + for (int nx=0; nxgetQuadIJ (nx, my, dimz)); + liste2.push_back (grid1->getQuadIJ (nx, my, 0)); + } + + for (int ny=0; nygetQuadIJ (mx, ny, dimz)); + liste2.push_back (grid1->getQuadIJ (mx, ny, 0)); + } + + Hex::RealVector tlen; + double dh = 2; + for (int nro=0; nro<5; nro++) + { + dh = 2*dh + 1; + tlen.push_back (dh); + } + + const int nbiter = 5; + doc->saveVtk ("prisme1.vtk"); + Hex::Elements* prisme2 = doc->prismQuads (liste2, dir2, nbiter); + doc->saveVtk ("prisme2.vtk"); + + Hex::Elements* prisme1 = doc->prismQuadsVec (liste1, dir1, tlen, 0); + + PutData (liste1.size()); + PutData (tlen.size()); + PutData (prisme1->countHexa()); + PutData (prisme1->countQuad()); + PutData (prisme1->countEdge()); + PutData (prisme1->countVertex()); + + for (int nro=0 ; nro getHexa (nbiter+nro); + cell->setScalar (5); + } + + doc->saveVtk ("prisme3.vtk"); + return HOK; +} +// ======================================================== test_revolution9 +int test_revolution9 (int nbargs, cpchar tabargs[]) +{ + const int dimx = 11; + const int dimy = 11; + const int dimz = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig1 = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + + Hex::Elements* grid1 = doc->makeCartesian (orig1, dir, dimx,dimy,dimz); + + int mx = dimx/2; + int my = dimy/2; + Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); + Hex::Quads liste; + + liste.push_back (prems); + prems -> setScalar (5); + for (int nx=0; nxgetQuadIJ (nx, my, dimz); + liste.push_back (cell); + cell -> setScalar (5); + } + + for (int ny=0; nygetQuadIJ (mx, ny, dimz); + liste.push_back (cell); + cell -> setScalar (5); + } + + Hex::Vertex* center = doc->addVertex (0, -10, 0); + Hex::Vector* axis = doc->addVector (1, 0, 0); + Hex::RealVector angles; + + Hex::Vector* dir1 = doc->addVector (10,0.3,0.3); + Hex::Elements* grid2 = doc->makeCartesian (center, dir1, 1,1,1); + Hex::Hexa* cell = grid2->getHexaIJK (0,0,0); + cell->setScalar (5); + + doc->saveVtk ("revolution1.vtk"); + + double alpha = 5; + int niter = 5; + double coeff = 1.5; + for (int na=0 ; narevolutionQuads (liste, center, axis, angles); + if (bloc != NULL) + doc->saveVtk ("revolution2.vtk"); + + return HOK; +} +// ======================================================== test_revolution +int test_revolution (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* ori = doc->addVertex (0,0,0); + Hex::Vector* vx = doc->addVector (1,0,0); + Hex::Vector* vz = doc->addVector (0,0,1); + + int dr = 1; + int da = 360; + int dl = 1; + + int nr = 1; + int na = 6; + int nl = 1; + + Hex::Elements* grid = doc->makeCylindrical (ori, vx,vz, dr,da,dl, + nr,na,nl, false); + + Hex::Quads liste; + for (int nx=0; nxgetQuadIJ (nx, ny, nl); + liste.push_back (cell); + cell -> setScalar (5); + } + + Hex::Vertex* center = doc->addVertex (0, -10, 0); + Hex::Vector* axis = doc->addVector (1, 0, 0); + Hex::RealVector angles; + + Hex::Vector* dir1 = doc->addVector (10,0.3,0.3); + Hex::Elements* grid2 = doc->makeCartesian (center, dir1, 1,1,1); + Hex::Hexa* cell = grid2->getHexaIJK (0,0,0); + cell->setScalar (5); + + doc->saveVtk ("revolution1.vtk"); + + double alpha = 5; + int niter = 5; + double coeff = 1.5; + for (int na=0 ; narevolutionQuads (liste, center, axis, angles); + if (bloc != NULL) + doc->saveVtk ("revolution2.vtk"); + + return HOK; +} +// ======================================================== test_coude +int test_coude (int nbargs, cpchar tabargs[]) +{ +#if 0 + const int dimx = 11; + const int dimy = 11; + const int dimz = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vector* vx = doc->addVector (1,0,0); + Hex::Vector* vz = doc->addVector (0,0,1); + + // grid1 = doc->makeCartesian (orig1, dir, dimx,dimy,dimz); + double dr = 1; + int dl = 5; + int nr = 4; + int na = 8; + + Hex::Elements* grid1 = doc->makeCylindrical (orig1, vx,vz,dr,360, dl, + nr, 10, nl, false); + int mx = dimx/2; + int my = dimy/2; + Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); + Hex::Quads liste; + + liste.push_back (prems); + prems -> setScalar (5); + for (int nx=0; nxgetQuadIJ (nx, my, dimz); + liste.push_back (cell); + cell -> setScalar (5); + } + + for (int ny=0; nygetQuadIJ (mx, ny, dimz); + liste.push_back (cell); + cell -> setScalar (5); + } + + + Hex::Vertex* center = doc->addVertex (0, -10, 0); + Hex::Vector* axis = doc->addVector (1, 0, 0); + Hex::RealVector angles; + + Hex::Vector* dir1 = doc->addVector (10,0.3,0.3); + Hex::Elements* grid2 = doc->makeCartesian (center, dir1, 1,1,1); + Hex::Hexa* cell = grid2->getHexaIJK (0,0,0); + cell->setScalar (5); + + doc->saveVtk ("revolution1.vtk"); + + double alpha = 5; + int niter = 5; + double coeff = 1.5; + for (int na=0 ; narevolutionQuads (liste, center, axis, angles); + if (bloc != NULL) + doc->saveVtk ("revolution2.vtk"); +#endif + return HOK; +} +// ======================================================== test_count +int test_count (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig1 = doc->addVertex ( 0, 0,0); + Hex::Vector* vx = doc->addVector (1,0,0); + Hex::Vector* vz = doc->addVector (0,0,1); + + double dr = 1; + double dl = 1; + int nr = 2; + int nl = 3; + + Hex::Elements* c1; + + c1 = doc->makeCylindrical (orig1, vx,vz,dr, 360, dl,nr, 10, nl, false); + + HexDisplay (doc->countVertex ()); + HexDisplay (doc->countUsedVertex ()); + doc ->saveVtk ("hexa1.vtk"); + + return HOK; +} +// ======================================================== test_decoupage +int test_decoupage (int nbargs, cpchar tabargs[]) +{ + const int size_x = 2; + const int size_y = 1; + const int size_z = 1; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + + Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + Hex::Edge* arete = grid->getEdgeK (0, 0, 0); + + // doc ->dump (); + int nvtk=0; + doc ->saveVtk ("decoupe", nvtk); +/* Hex::Elements* grid2 = */ doc->cut (arete, 1); + + /// doc ->dump (); + doc ->saveVtk ("decoupe", nvtk); + + return HOK; +} +// ======================================================== test_gen_xml +int test_gen_xml (int nbargs, cpchar tabargs[]) +{ + const int size_x = 2; + const int size_y = 2; + const int size_z = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + + Hex::Hexa* cell = grid->getHexa (0); + Hex::Quad* face = cell->getQuad (0); + Hex::Edge* arete = cell->getEdge (0); + Hex::Vertex* noeud = cell->getVertex (0); + + // Hex::Shape* shape1 = new Hex::Shape("riri"); + // Hex::Shape* shape2 = new Hex::Shape("fifi"); + // Hex::Shape* shape3 = new Hex::Shape("loulou"); + + // noeud->setAssociation (shape1); + // arete->setAssociation (shape2); + // face ->setAssociation (shape3); + + Hex::Law* law1 = doc->addLaw("loi1", 1); + Hex::Law* law2 = doc->addLaw("loi2", 2); + Hex::Law* law3 = doc->addLaw("loi3", 3); + + law1->setKind (Hex::Uniform); + law2->setKind (Hex::Arithmetic); + law3->setKind (Hex::Geometric); + + Hex::Propagation* prop1 = doc->getPropagation (0); + Hex::Propagation* prop2 = doc->getPropagation (1); + Hex::Propagation* prop3 = doc->getPropagation (2); + + prop1->setLaw (law1); + prop2->setLaw (law2); + prop3->setLaw (law3); + + prop1->setWay (true); + prop2->setWay (false); + prop3->setWay (true); + + doc ->saveVtk ("mini.vtk"); + doc ->save ("Essai"); + + return HOK; +} +// ======================================================== test_string_xml +int test_string_xml (int nbargs, cpchar tabargs[]) +{ + const int size_x = 2; + const int size_y = 2; + const int size_z = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + + Hex::Hexa* cell = grid->getHexa (0); + Hex::Quad* face = cell->getQuad (0); + Hex::Edge* arete = cell->getEdge (0); + Hex::Vertex* noeud = cell->getVertex (0); + + // Hex::Shape* shape1 = new Hex::Shape("riri"); + // Hex::Shape* shape2 = new Hex::Shape("fifi"); + // Hex::Shape* shape3 = new Hex::Shape("loulou"); + + // noeud->setAssociation (shape1); + // arete->setAssociation (shape2); + // face ->setAssociation (shape3); + + Hex::Law* law1 = doc->addLaw("loi1", 1); + Hex::Law* law2 = doc->addLaw("loi2", 2); + Hex::Law* law3 = doc->addLaw("loi3", 3); + + law1->setKind (Hex::Uniform); + law2->setKind (Hex::Arithmetic); + law3->setKind (Hex::Geometric); + + Hex::Propagation* prop1 = doc->getPropagation (0); + Hex::Propagation* prop2 = doc->getPropagation (1); + Hex::Propagation* prop3 = doc->getPropagation (2); + + prop1->setLaw (law1); + prop2->setLaw (law2); + prop3->setLaw (law3); + + prop1->setWay (true); + prop2->setWay (false); + prop3->setWay (true); + + doc ->saveVtk ("mini.vtk"); + doc ->save ("Essai"); + + cpchar flux = doc ->getXml (); + Hex::Document* docbis = mon_ex.addDocument (); + docbis->setXml (flux); + docbis->saveVtk ("clone.vtk"); + + return HOK; +} +// ======================================================== test_relecture +int test_relecture (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + cpchar nomdoc = "Essai"; + if (nbargs>1) + nomdoc = tabargs[1]; + Hex::Document* doc = mon_ex.loadDocument (nomdoc); + +/********************* + Hex::Vertex* v4 = doc->findVertex (80.0, 0.0, 0.0); + Hex::Vertex* v5 = doc->findVertex (80.0, 0.0, 40.0); + Hex::Edge* e4 = doc->findEdge (v4, v5); + + HexDump (v4); + HexDump (v5); + HexDump (e4); + + e4->setScalar (5); +***********************/ + + doc ->dump (); + doc ->saveVtk ("restore.vtk"); + doc ->save ("restore"); + + // doc ->reorderFaces (); + // doc ->dump (); + + // Hex::Elements* grid2 = doc->cut (e4, 2); + return HOK; +} +// ======================================================== test_clone +int test_clone () +{ + const int size_x = 2; + const int size_y = 2; + const int size_z = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + + Hex::Vector* bond = doc->addVector (0, 0, 7); + Hex::Elements* grid2 = doc->makeTranslation (grid, bond); + + doc ->saveVtk ("clonage.vtk"); + doc ->dump(); + + HexDump (grid2->getHexa (1)); + HexDump (grid2->getHexaIJK (1,1,1)); + HexDump (grid2->getVertexIJK (1,1,1)); + + return HOK; +} +// ======================================================== test_separ +int test_separ () +{ + const int size_x = 2; + const int size_y = 2; + const int size_z = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + // Hex::Elements* grid = + doc->makeCartesian (orig, dir, size_x,size_y,size_z); + + doc ->saveVtk ("separ.vtk"); + doc ->dump(); + + return HOK; +} +// ======================================================== test_shperical +int test_spherical (int nbargs, const char* tabargs[]) +{ + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + double rayon = 1; + int nbr = 3; + + Hex::Elements* grid = doc->makeSpherical (orig, rayon, nbr); + + int nbhexas = grid->countHexa (); + HexDisplay (nbhexas); + for (int nro=0 ; nrogetHexa(nro)->remove(); + HexDisplay (doc->countHexa ()); + doc->saveVtk ("shperical.vtk"); + // doc->dump (); + + return HOK; +} +// ================================================== test_grille_cyl +int test_grille_cyl (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig1 = doc->addVertex ( 0, 0,0); + Hex::Vertex* orig2 = doc->addVertex (10, 0,0); + + Hex::Vertex* orig3 = doc->addVertex ( 0,10,0); + Hex::Vertex* orig4 = doc->addVertex (10,10,0); + + Hex::Vertex* orig5 = doc->addVertex ( 0,20,0); + Hex::Vertex* orig6 = doc->addVertex (10,20,0); + + Hex::Vector* vz = doc->addVector (0,0,1); + Hex::Vector* vx = doc->addVector (1,0,0); + + double dr = 1; + double dl = 1; + int nr = 2; + int nl = 3; + + Hex::Elements *c1, *c2, *c3, *c4, *c5, *c6; + + c1 = doc->makeCylindrical (orig1, vx,vz,dr, 360, dl,nr, 4, nl, true); + c2 = doc->makeCylindrical (orig2, vx,vz,dr, 360, dl,nr, 8, nl, true); + c3 = doc->makeCylindrical (orig3, vx,vz,dr, 270, dl,nr, 8, nl, true); + c4 = doc->makeCylindrical (orig4, vx,vz,dr, 270, dl,nr, 7, nl, true); + c5 = doc->makeCylindrical (orig5, vx,vz,dr, 360, dl,nr, 5, nl, true); + c6 = doc->makeCylindrical (orig6, vx,vz,dr, 360, dl,nr, 6, nl, true); + + int base2 = nr*nl*8; + c2->getHexa(base2 + 0)->setScalar (5); + c2->getHexa(base2 + 1)->setScalar (5); + c2->getHexa(base2 + 2)->setScalar (5); + + doc->saveVtk ("cylindres.vtk"); + // doc->dump (); + + return HOK; +} +// ================================================== test_asso_line +int test_asso_line (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig1 = doc->addVertex ( 0, 0,0); + + Hex::Vector* vz = doc->addVector (0,0,1); + Hex::Vector* vx = doc->addVector (1,0,0); + + double dr = 1; + double dl = 1; + int nr = 2; + int nl = 3; + int ntheta = 8; + + Hex::Elements *c1 = NULL; + + c1 = doc->makeCylindrical (orig1, vx,vz,dr, 360, dl,nr, ntheta, nl, true); + + Hex::Edges m_line; + Hex::Edge* m_start = c1->getEdgeJ (nr, 1, 0); + + for (int na=2 ; nagetEdgeJ (nr, na, 0); + arete->setScalar (5); + m_line.push_back (arete); + } + + // m_line.push_back (c1->getEdgeJ (nr, 0, 2)); + // m_line.push_back (NULL); + Hex::Shape* gstart = NULL; + Hex::Shapes gline; + double pstart = 0 , pend = 0; + + int ier = doc-> associateOpenedLine (m_start, m_line, + gstart, pstart, gline, pend); + HexDisplay (ier); + doc->saveVtk ("asso_line.vtk"); + + m_line.push_back (c1->getEdgeJ (nr, 0, 0)); + Hex::Vertex* m_first = m_start->getVertex (Hex::V_AMONT); + ier = doc-> associateClosedLine (m_first, m_start, m_line, + gstart, pstart, false, gline); + HexDisplay (ier); + // doc->dump (); + + return HOK; +} +// ===================================================== test_cylindrical +int test_cylindrical (int nbargs, cpchar tabargs[]) +{ + cpchar fic_vtk = "cylindre"; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0, 0, 0); + Hex::Vector* vx = doc->addVector (1, 0, 0); + Hex::Vector* vz = doc->addVector (0, 0, 1); + + double dr = 1; + double da = 360; + double dl = 1; + + int nr = 1; + int na = 8; + int nl = 2; + + if (nbargs>1) + { + na = atoi (tabargs[1]); + HexDisplay (na); + if (na <= 2) + na = 8; + } + + if (nbargs>2) + { + da = atof (tabargs[2]); + HexDisplay (da); + } + + // Hex::Cylinder* cyl = doc->addCylinder (orig, vz, nr, nl); + // Hex::Elements* grid = doc->makeCylinder (cyl, vx, nr, na, nl); + doc->makeCylindrical (orig,vx, vz, dr,da,dl, nr,na, nl, true); + doc ->saveVtk (fic_vtk, na); + return HOK; +} +// ===================================================== test_cylinder +int test_cylinder (int nbargs, cpchar tabargs[]) +{ + int nvtk = 1; + cpchar fic_vtk = "cylindre"; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0, 0, 0); + Hex::Vector* vx = doc->addVector (1, 0, 0); + Hex::Vector* vz = doc->addVector (0, 0, 1); + + double rayon = 10; + double hauteur = 6; + + int nr = 2; + int na = 8; + int nl = 5; + + Hex::Cylinder* cyl = doc->addCylinder (orig, vz, rayon, hauteur); + doc->makeCylinder (cyl, vx, nr, na, nl); + doc ->saveVtk (fic_vtk, nvtk); + return HOK; +} +// ===================================================== test_xml_cylinder +int test_xml_cylinder (int nbargs, cpchar tabargs[]) +{ + int nvtk = 0; + cpchar fic_vtk = "cylindre"; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig1 = doc->addVertex (0, 0,0); + Hex::Vertex* orig2 = doc->addVertex (50,0,0); + Hex::Vector* vz = doc->addVector (0,0,1); + Hex::Vector* vx = doc->addVector (1,0,0); + + vx->setName ("vx"); + vz->setName ("vz"); + orig1->setName ("orig1"); + orig2->setName ("orig2"); + + int nr = 4; + int nri = 3; + int nre = nr; + int na = 9; + int nl = 5; + + Hex::Cylinder* cyl = doc->addCylinder (orig1, vz, nr, nl); + Hex::Pipe* pipe = doc->addPipe (orig2, vz, nri, nre, nl); + + Hex::Elements* grid = doc->makeCylinder (cyl, vx, nr, na, nl); + doc ->saveVtk (fic_vtk, nvtk); + + Hex::Group* groupe = doc->addGroup ("GroupeAMA", Hex::HexaCell); + groupe->addElement (grid->getHexaIJK (0,0,0)); + groupe->addElement (grid->getHexaIJK (1,0,0)); + groupe->addElement (grid->getHexaIJK (0,1,0)); + groupe->addElement (grid->getHexaIJK (1,1,0)); + groupe->addElement (grid->getHexaIJK (2,1,0)); + + grid->getHexaIJK (0,0,0)->setName ("Hexa0"); + grid->getQuadIJ (0,0,0)->setName ("QuadIJ0"); + grid->getEdgeK (0,0,0)->setName ("EdgeK0"); + + doc->makePipe (pipe, vx, nr, na, nl); + doc ->saveVtk (fic_vtk, nvtk); + doc->save ("cylindre"); + + return HOK; +} +// ===================================================== test_pipe +int test_pipe (int nbargs, cpchar tabargs[]) +{ + int nvtk = 0; + cpchar fic_vtk = "cylindre"; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig1 = doc->addVertex (0, 0,0); + Hex::Vector* vx = doc->addVector (1,0,0); + Hex::Vector* vy = doc->addVector (0,1,0); + + int nr = 1; + int nri = 1; + int nre = 2; + int na = 2; + int nl = 1; + + Hex::Pipe* pipe = doc->addPipe (orig1, vx, nri, nre, nl); + doc->makePipe (pipe, vy, nr, na, nl); + doc ->saveVtk (fic_vtk, nvtk); + + return HOK; +} +// ======================================================== del_hexa +void del_hexa (Hex::CrossElements* gr, int cyl, int ni, int nj, int nk, int dr) +{ + Hex::Hexa* hexa = gr->getHexaIJK (cyl, ni, nj, nk); + if (hexa!=NULL) + { + hexa->remove (); + if (dr>1) + save_vtk (); + } +} +// ======================================================== del_tranche +int del_tranche (Hex::CrossElements* grid, int cyl, int ni, int nk, int dr=1) +{ + for (int nj = 0 ; nj < 8 ; nj++) + del_hexa (grid, cyl, ni, nj, nk, dr); + + if (dr==1) + save_vtk (); + printf ("del_tranche (g=%d, i=%d, k=%d) : fic = %d\n", + cyl, ni, nk, nbr_vtk-1); + return nbr_vtk; +} +// ======================================================== test_joint2 +int test_joint2 (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + docu = mon_ex.addDocument (); + case_name = "pb_joint"; + + Hex::Vector* vx = docu->addVector (1, 0, 0); + Hex::Vector* vz = docu->addVector (0, 0, 1); + Hex::Vertex* hori = docu->addVertex (0, 0, 0); + + double da = 360; + double dr = 2; + double dl = 1; + int nr = 1; + int na = 8; + int nl = 1; + bool fill = true; + + Hex::Elements *bgrid=NULL, *hgrid=NULL; + + hgrid = docu->makeCylindrical (hori, vx,vz, dr,da,dl, nr,na,nl, fill); + docu->dump (); + save_vtk (); + + Hex::Vertex* bori = docu->addVertex (0, 0, -5); + bgrid = docu->makeCylindrical (bori, vx,vz, dr,da,dl, nr,na,nl, fill); + save_vtk (); + + Hex::Quads qsource, qdest; + printf (" Source = "); + for (int ny=0 ; ny< na ; ny++) + { + Hex::Quad* quad = hgrid->getQuadIJ (0, ny, 0); + PrintName (quad); + qsource.push_back (quad); + } + printf ("\n "); + for (int ny=0 ; ny<4 ; ny++) + { + Hex::Quad* quad = hgrid->getKerHQuad (ny); + PrintName (quad); + qsource.push_back (quad); + } + printf ("\n"); + + + printf (" Cible = "); + for (int ny=0 ; ny< na ; ny++) + { + Hex::Quad* quad = bgrid->getQuadIJ (0, ny, 1); + PrintName (quad); + qdest.push_back (quad); + } + printf ("\n "); + for (int ny=0 ; ny<4 ; ny++) + { + Hex::Quad* quad = bgrid->getKerHQuad (ny+4); + PrintName (quad); + qdest.push_back (quad); + } + printf ("\n"); + docu ->setLevel (1); + Hex::Quad* cible = bgrid->getQuadIJ (0, 1, 1); + Hex::Vertex* vc1 = bgrid->getVertexIJK (0, 1, 1); + Hex::Vertex* vc2 = bgrid->getVertexIJK (1, 1, 1); + + Hex::Vertex* vs1 = hgrid->getVertexIJK (0, 0, 0); + Hex::Vertex* vs2 = hgrid->getVertexIJK (1, 0, 0); + + docu->joinQuads (qsource, cible, vs1, vc1, vs2, vc2, 1); + save_vtk (); + + return HOK; +} +// ======================================================== test_croix +int test_croix (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + docu = mon_ex.addDocument (); + + Hex::Vertex* ori1 = docu->addVertex ( 100,0,0); + Hex::Vertex* ori2 = docu->addVertex (-5,0,5); + Hex::Vector* vz = docu->addVector ( 0,0,1); + Hex::Vector* vx = docu->addVector ( 1,0,0); + + double r1 = 2; + double r2 = 3; + double l1 = 5; + double l2 = 10; + + Hex::Cylinder* cyl1 = docu->addCylinder (ori1, vz, r1, l1); + Hex::Cylinder* cyl2 = docu->addCylinder (ori2, vx, r2, l2); + Hex::CrossElements* grid = docu->makeCylinders (cyl1, cyl2); + + case_name = "croix"; + save_vtk (); + PutData ((BadElement (grid))); + + + Hex::Edge* pipo = docu->addEdge (ori1, ori1); + PutData (pipo->isValid()); + PutData ((BadElement (pipo))); + return HOK; + + del_tranche (grid, 0, 1, 0); + del_tranche (grid, 0, 1, 5); + + del_tranche (grid, 1, 1, 0); + del_tranche (grid, 1, 1, 3); + + del_tranche (grid, 1, 0, 0); + del_tranche (grid, 1, 0, 3); + // Le trognon + del_tranche (grid, 0, 0, 0); + del_tranche (grid, 0, 0, 5); + del_tranche (grid, 0, 0, 1); + del_tranche (grid, 0, 0, 2); + del_tranche (grid, 0, 0, 3); + del_tranche (grid, 0, 0, 4); + // Partie critique + + del_tranche (grid, 1, 1, 1, 2); + + del_tranche (grid, 0, 1, 1, 2); + del_tranche (grid, 0, 1, 4, 2); + del_tranche (grid, 0, 1, 3, 2); + del_tranche (grid, 0, 1, 2, 2); + + del_tranche (grid, 1, 1, 2, 2); + return HOK; +} +// ======================================================== test_pipes +int test_pipes (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* ori1 = doc->addVertex ( 0,0,0); + Hex::Vertex* ori2 = doc->addVertex (-5,0,5); + Hex::Vector* vz = doc->addVector ( 0,0,1); + Hex::Vector* vx = doc->addVector ( 1,0,0); + +// double h1 = 5, ri1 = 1, re1 = 2; + double h1 = 10, ri1 = 1, re1 = 2; + double h2 = 10, ri2 = 2, re2 = 3; + + Hex::Pipe* pipe1 = doc->addPipe (ori1, vz, ri1, re1, h1); + Hex::Pipe* pipe2 = doc->addPipe (ori2, vx, ri2, re2, h2); + Hex::CrossElements* grid = doc->makePipes (pipe1, pipe2); + + case_name = "pipe"; + docu = doc; + save_vtk (); + + del_tranche (grid, 0, 1, 0); + del_tranche (grid, 0, 1, 5); + + del_tranche (grid, 1, 1, 0); + del_tranche (grid, 1, 1, 3); + // Partie critique + + del_tranche (grid, 1, 1, 1, 2); + + del_tranche (grid, 0, 1, 1, 2); + del_tranche (grid, 0, 1, 4, 2); + del_tranche (grid, 0, 1, 3, 2); + del_tranche (grid, 0, 1, 2, 2); + + del_tranche (grid, 1, 1, 2, 2); + /* *************************************************** + + int nbz [2] = { 8, 4 }; + int ni = 1; + for (int cyl = 0 ; cyl < 2 ; cyl++) + for (int nk = 0 ; nk < nbz[cyl] ; nk++) + for (int nj = 0 ; nj < 4 ; nj++) + { + int jj = nj; + if (cyl==0) jj = (jj+6) MODULO 8 ; + Hex::Hexa* hexa = grid->getHexaIJK (cyl, ni, jj, nk); + if (hexa!=NULL) + { + hexa->remove (); + doc->saveVtk (case_name, nbr_vtk); + } + } + *************************************************** */ + return HOK; +} +// ======================================================== test_lorraine +int test_lorraine(int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* ori1 = doc->addVertex ( 0,0,0); + Hex::Vertex* ori2 = doc->addVertex (-5,0,5); + Hex::Vertex* ori3 = doc->addVertex ( 0,0,12); + Hex::Vertex* ori4 = doc->addVertex (-5,0,17); + + Hex::Vector* vz = doc->addVector ( 0,0,1); + Hex::Vector* vx = doc->addVector ( 1,0,0); + + int nl1 = 10; + int nl2 = 10; + + double rsmall = 1; + double rmoy = 2; + double rbig = 3; + + Hex::Cylinder* cyl1 = doc->addCylinder (ori1, vz, rmoy, nl1); + Hex::Cylinder* cyl2 = doc->addCylinder (ori2, vx, rsmall, nl2); + + Hex::Cylinder* cyl3 = doc->addCylinder (ori3, vz, rmoy, nl1); + Hex::Cylinder* cyl4 = doc->addCylinder (ori4, vx, rbig, nl2); + + Hex::CrossElements* grid1 = doc->makeCylinders (cyl1, cyl2); + Hex::CrossElements* grid2 = doc->makeCylinders (cyl4, cyl3); + +#define Imprimer(x) printf (#x " = ") ; if (x) x->dump() ; else printf ("NULL\n") + const int nx_int = 0; + const int nx_ext = 1; + + // vc2 = grid1->getVertexIJK (Hex::CylBig, 0,0,0); + // vc3 = grid2->getVertexIJK (Hex::CylSmall, 0,0,0); + // Cyl i j k + Hex::Quad* qb = grid1-> getQuadIJ (Hex::CylBig, nx_ext, Hex::S_E, 4); + Hex::Quad* qh = grid2-> getQuadIJ (Hex::CylSmall, nx_ext, Hex::S_N, 0); + + Hex::Vertex* vb0 = qb->getVertex (3); + Hex::Vertex* vb1 = qb->getVertex (2); + Hex::Vertex* vh0 = qh->getVertex (0); + Hex::Vertex* vh1 = qh->getVertex (1); + + vb0 = grid1->getVertexIJK (Hex::CylBig, 2, Hex::S_E, 4); // cible + vb1 = grid1->getVertexIJK (Hex::CylBig, 2, Hex::S_NE, 4); + vh0 = grid2->getVertexIJK (Hex::CylSmall, 2, Hex::S_N, 0); // depart + vh1 = grid2->getVertexIJK (Hex::CylSmall, 2, Hex::S_NW, 0); + + Imprimer (vh0); + Imprimer (vh1); + Imprimer (vb0); + Imprimer (vb1); + + // qb->remove (); + // qh->remove (); + Hex::Quads hliste; + + hliste.push_back (qh); + for (int ny=1; nygetQuadIJ (Hex::CylSmall, nx_ext, ns, 0)); + } + + for (int ny=0; ny<4 ; ny++) + hliste.push_back (grid2->getQuadIJ (Hex::CylSmall, nx_int, ny, 0)); + + int hauteur = 3; + doc->joinQuads (hliste, qb, vh0, vb0, vh1, vb1, hauteur); + doc->saveVtk ("lorraine.vtk"); + + // doc->dump (); + return HOK; +} +// ======================================================== test_disconnect2 +// === Disconnect Edge seul +int test_disconnect2 (int nbargs, cpchar tabargs[]) +{ + const int size_x = 2; + const int size_y = 2; + const int size_z = 1; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig2 = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid2 = doc->makeCartesian (orig2, dir, size_x,size_y,size_z); + + doc->dump (); + + int nvtk = 0; + doc->setLevel (1); + Hex::Matrix matrice; + Hex::Vector* ecart = doc->addVector (0.5,0.5,0); + matrice.defTranslation (ecart); + + Hex::Hexa* hexa2 = grid2->getHexaIJK (1,1,0); + Hex::Edge* edge = grid2->getEdgeK (1,2,0); + + hexa2->setScalar (2); + edge->setScalar (5); + + doc->saveVtk ("test_disco", nvtk); + + doc->setLevel (4); + + Hex::Elements* disco_edges = doc->disconnectEdge (hexa2, edge); + HexDisplay (disco_edges->countVertex()); + HexDisplay (disco_edges->countEdge()); + HexDisplay (disco_edges->countQuad()); + HexDisplay (disco_edges->countHexa()); + + // hexa2->transform (&matrice); + /********************************** + for (int ns=0; nscountVertex(); ns++) + { + Hex::Vertex* sommet = disco_edges->getVertex(ns); + sommet->setX (sommet->getX()+0.5); + sommet->setY (sommet->getY()+0.5); + } + ********************************* */ + + doc->saveVtk ("test_disco", nvtk); + doc->save ("test_disco"); + doc->dump (); + hexa2->dumpFull (); + + doc->setLevel (4); + return HOK; +} +// ======================================================== test_disconnect4 +// === Disconnect Edges +int test_disconnect4 (int nbargs, cpchar tabargs[]) +{ + const int size_x = 1; + const int size_y = 2; + const int size_z = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig2 = doc->addVertex (0,0,0); + Hex::Vector* vx = doc->addVector (1,0,0); + Hex::Vector* vy = doc->addVector (0,1,0); + Hex::Vector* vz = doc->addVector (0,0,1); + Hex::Elements* grid2 = doc->makeCartesian (orig2, vx,vy,vz, size_x,size_y,size_z); + + int nvtk = 0; + doc->setLevel (1); + + Hex::Hexas t_hexas; + Hex::Edges t_edges; + for (int nk=0 ; nk< size_z; nk++) + { + Hex::Hexa* hexa2 = grid2->getHexaIJK (0,0,nk); + Hex::Edge* edge = grid2->getEdgeK (0,1,nk); + + hexa2->setScalar (2); + edge->setScalar (5); + t_hexas.push_back (hexa2); + t_edges.push_back (edge); + + doc->setLevel (4); + } + + doc->dump (); + doc->saveVtk ("test_disco", nvtk); + /* Hex::Elements* disco_edges = */ doc->disconnectEdges (t_hexas, t_edges); + doc->saveVtk ("test_disco", nvtk); + doc->dump (); + // hexa2->dumpFull (); + + doc->setLevel (4); + return HOK; +} +// ======================================================== test_disconnect +// ==== Disconnect Quad +int test_disconnect1 (int nbargs, cpchar tabargs[]) +{ + const int size_x = 2; + const int size_y = 2; + const int size_z = 1; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig1 = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid1 = doc->makeCartesian (orig1, dir, size_x,size_y,size_z); + + int nvtk = 0; + doc->setLevel (1); + Hex::Matrix matrice; + Hex::Vector* ecart = doc->addVector (0.5,0.5,0); + matrice.defTranslation (ecart); + + Hex::Hexa* hexa1 = grid1->getHexaIJK (1,1,0); + Hex::Quad* quad = grid1->getQuadJK (1,1,0); + + quad->setScalar (5); + + doc->saveVtk ("test_disco", nvtk); + doc->disconnectQuad (hexa1, quad); + // hexa1 ->transform (&matrice); + doc->saveVtk ("test_disco", nvtk); + + // doc->dumpPropagation (); + // doc->dump (); + + doc->save ("disco_all"); + return HOK; +} +// ======================================================== test_disconnect3 +// ==== disconnectVertex +int test_disconnect3 (int nbargs, cpchar tabargs[]) +{ + const int size_x = 2; + const int size_y = 2; + const int size_z = 1; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig1 = doc->addVertex (0,0,0); + + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid1 = doc->makeCartesian (orig1, dir, size_x,size_y,size_z); + + int nvtk = 0; + doc->setLevel (1); + Hex::Matrix matrice; + Hex::Vector* ecart = doc->addVector (0.5,0.5,0); + matrice.defTranslation (ecart); + + Hex::Hexa* hexa1 = grid1->getHexaIJK (1,1,0); + Hex::Vertex* vertex = grid1->getVertexIJK (1,1,1); + + vertex->setScalar (5); + + doc->saveVtk ("test_disco", nvtk); + + doc->disconnectVertex (hexa1, vertex); + // hexa1->transform (&matrice); + doc->saveVtk ("test_disco", nvtk); + + // doc->dumpPropagation (); + // doc->dump (); + + doc->save ("disco_all"); + return HOK; +} +// ======================================================== contraction +void contraction (Hex::Hexa* hexa, Hex::Elements* grid) +{ + return; + Hex::Real3 cg = { 0, 0, 0 }; + + for (int nro=0; nrogetVertex(nro)->getX()/Hex::HV_MAXI; + cg [1] += hexa->getVertex(nro)->getY()/Hex::HV_MAXI; + cg [2] += hexa->getVertex(nro)->getZ()/Hex::HV_MAXI; + } + + int nbvertex = grid->countVertex(); + const double coeff = 0.5; + for (int nro=0; nrogetVertex(nro); + Hex::Real3 pold = { pv->getX(), pv->getY(), pv->getZ() }; + Hex::Real3 pnew; + for (int dd=0; dd<3 ; dd++) + pnew [dd] = cg[dd] + coeff * (pold[dd]-cg[dd]); + + pv->setX (pnew[0]); + pv->setY (pnew[1]); + pv->setZ (pnew[2]); + } +} +// ======================================================== test_disconnect +// ==== Les 3 disconnect +int test_disconnect (int nbargs, cpchar tabargs[]) +{ + const int size_x = 2; + const int size_y = 2; + const int size_z = 1; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig1 = doc->addVertex (0,0,0); + Hex::Vertex* orig2 = doc->addVertex (4,0,0); + Hex::Vertex* orig3 = doc->addVertex (8,0,0); + + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid1 = doc->makeCartesian (orig1, dir, size_x,size_y,size_z); + Hex::Elements* grid2 = doc->makeCartesian (orig2, dir, size_x,size_y,size_z); + Hex::Elements* grid3 = doc->makeCartesian (orig3, dir, size_x,size_y,size_z); + + int nvtk = 0; + doc->setLevel (1); + Hex::Matrix matrice; + Hex::Vector* ecart = doc->addVector (0.5,0.5,0); + matrice.defTranslation (ecart); + + Hex::Hexa* hexa1 = grid1->getHexaIJK (1,1,0); + Hex::Hexa* hexa2 = grid2->getHexaIJK (1,1,0); + Hex::Hexa* hexa3 = grid3->getHexaIJK (1,1,0); + + Hex::Quad* quad = grid1->getQuadJK (1,1,0); + Hex::Edge* edge = grid2->getEdgeK (1,2,0); + Hex::Vertex* vertex = grid3->getVertexIJK (1,1,1); + + quad->setScalar (5); + edge->setScalar (5); + vertex->setScalar (5); + + doc->saveVtk ("test_disco", nvtk); + doc->disconnectQuad (hexa1, quad); + doc->saveVtk ("test_disco", nvtk); + + doc->disconnectEdge (hexa2, edge); + doc->saveVtk ("test_disco", nvtk); + + doc->disconnectVertex (hexa3, vertex); + doc->saveVtk ("test_disco", nvtk); + + // doc->dumpPropagation (); + // doc->dump (); + + doc->save ("disco_all"); + return HOK; +} +// ======================================================== test_propagation +int test_propagation () +{ + const int size_x = 2; + const int size_y = 1; + const int size_z = 1; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + // Hex::Elements* grid = + doc->makeCartesian (orig, dir, size_x,size_y,size_z); + + int nb = doc->countPropagation (); + for (int nro=0 ; nrogetPropagation (nro); + const Hex::Edges& table = prop->getEdges (); + printf (" ____________________________________ Prop nro %d\n", nro); + for (int ned=0 ; ned<(int)table.size() ; ned++) + { + bool way = table [ned]->getWay (); + + if (way) + { + printf (" ("); + table [ned]->getVertex (0)->printName (", "); + table [ned]->getVertex (1)->printName (")\n"); + } + else + { + printf (" ("); + table [ned]->getVertex (1)->printName (", "); + table [ned]->getVertex (0)->printName (")\n"); + } + } + } + + doc->dump (); + doc->saveVtk ("test_propagation.vtk"); + doc->save ("test_propagation"); + + return HOK; +} +// ======================================================== test_move +int test_move () +{ + const int size_x = 1; + const int size_y = 1; + const int size_z = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + + Hex::Vector* enhaut = doc->addVector (0, 0, 5); + Hex::Vector* devant = doc->addVector (5, 0, 0); + // Hex::Vector* agauche = doc->addVector (0, 5, 0); + + Hex::Matrix matrice; + matrice.defTranslation (enhaut); + + Hex::Hexa* cube = grid->getHexa (1); + Hex::Quad* dessous = cube->getQuad (Hex::Q_A); + dessous->dump(); + + Hex::Elements* grid2 = doc->makeTranslation (grid, devant); + /* Hex::Elements* grid3 = doc->makeTranslation (grid, agauche); */ + Hex::Hexa* cube2 = grid2->getHexa (1); + + doc ->saveVtk ("move0.vtk"); + + cube ->disconnectQuad (dessous); + cube ->transform (&matrice); + cube2->transform (&matrice); + + doc ->saveVtk ("move1.vtk"); + doc ->dump(); + + return HOK; +} +// ======================================================== test_transfo2 +int test_transfo2 (int nbargs, cpchar tabargs[]) +{ + const int size_x = 1; + const int size_y = 1; + const int size_z = 2; + + int nvtk = 0; + cpchar fic_vtk = "transfo"; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + doc ->setLevel (1); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x, size_y, + size_z); + if (grid==NULL) + return HERR; + + orig->setScalar(2); + + doc ->saveVtk (fic_vtk, nvtk); + + Hex::Vector* devant = doc->addVector (5, 0, 0); + + Hex::Elements* grid2 = doc->makeTranslation (grid, devant); + if (grid2==NULL) + return HERR; + doc ->saveVtk (fic_vtk, nvtk); + + Hex::Elements* grid3 = doc->makeScale (grid2, orig, 2); + if (grid3==NULL) + return HERR; + doc ->saveVtk (fic_vtk, nvtk); + + Hex::Elements* grid4 = doc->makeRotation (grid2, orig, dir, 45); + if (grid4==NULL) + return HERR; + doc ->saveVtk (fic_vtk, nvtk); + + Hex::Elements* grid5 = doc->makeSymmetryPoint (grid4, orig); + if (grid5==NULL) + return HERR; + + doc ->saveVtk (fic_vtk, nvtk); + + Hex::Vector* dir1 = doc->addVector (1,0,0); + Hex::Elements* grid6 = doc->makeSymmetryLine (grid4, orig, dir1); + if (grid6==NULL) + return HERR; + + grid4->getHexa(0)->getVertex(0)->setScalar(3); + grid6->getHexa(0)->getVertex(0)->setScalar(3); + doc ->saveVtk (fic_vtk, nvtk); + + grid4->getHexa(0)->getVertex(0)->setScalar(0); + grid6->getHexa(0)->getVertex(0)->setScalar(0); + + Hex::Elements* grid7 = doc->makeSymmetryLine (grid2, orig, dir1); + if (grid7==NULL) + return HERR; + + grid2->getHexa(0)->getVertex(0)->setScalar(4); + grid7->getHexa(0)->getVertex(0)->setScalar(4); + doc ->saveVtk (fic_vtk, nvtk); + + grid2->getHexa(0)->getVertex(0)->setScalar(0); + grid7->getHexa(0)->getVertex(0)->setScalar(0); + + Hex::Elements* grid8 = doc->makeSymmetryPlane (grid2, orig, dir1); + if (grid8==NULL) + return HERR; + + grid2->getHexa(0)->getVertex(0)->setScalar(4); + grid8->getHexa(0)->getVertex(0)->setScalar(4); + doc ->saveVtk (fic_vtk, nvtk); + grid2->getHexa(0)->getVertex(0)->setScalar(0); + grid8->getHexa(0)->getVertex(0)->setScalar(0); + + Hex::Elements* grid9 = doc->makeSymmetryPlane (grid3, orig, dir); + if (grid9==NULL) + return HERR; + + grid3->getHexa(0)->getVertex(0)->setScalar(4); + grid9->getHexa(0)->getVertex(0)->setScalar(4); + doc ->saveVtk (fic_vtk, nvtk); + + grid9->getHexa(0)->removeConnected (); + doc ->saveVtk (fic_vtk, nvtk); + + return HOK; +} +// ======================================================== test_transfo +int test_transfo (int nbargs, cpchar tabargs[]) +{ + int nvtk = 0; + cpchar fic_vtk = "transfo"; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + doc ->setLevel (1); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vector* vx = doc->addVector (1,0,0); + Hex::Vector* vz = doc->addVector (0,0,1); + double dr = 1; + double da = 360; + double dl = 1; + int nr = 3; + int na = 8; + int nl = 3; + Hex::Elements* grid = doc->makeCylindrical (orig, vx,vz, dr, da, dl, + nr, na, nl, false); + if (grid==NULL) + return HERR; + + doc ->saveVtk (fic_vtk, nvtk); + Hex::Vector* devant = doc->addVector (10, 0, 0); + + Hex::Elements* grid2 = doc->makeTranslation (grid, devant); + if (grid2==NULL) + return HERR; + doc ->saveVtk (fic_vtk, nvtk); + + return HOK; +} +// ======================================================== test_copy_document +int test_copy_document (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.loadDocument ("Essai"); + doc ->saveVtk ("restore1.vtk"); + + Hex::Document* clone = doc->copyDocument(); + clone->saveVtk ("restore2.vtk"); + + return HOK; +} +// ======================================================== test_remove +int test_remove () +{ + const int size_x = 2; + const int size_y = 2; + const int size_z = 2; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0,0,0); + Hex::Vertex* orig1 = doc->addVertex (6,0,0); + Hex::Vector* dir = doc->addVector (1,1,1); + Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); + doc->makeCartesian (orig1, dir, 1,1,1); + doc->saveVtk ("removeConn1.vtk"); + + Echo ("--------- Avant destruction"); + HexDisplay (doc->countVertex ()); + HexDisplay (doc->countEdge ()); + HexDisplay (doc->countQuad ()); + HexDisplay (doc->countHexa ()); + HexDisplay (doc->countUsedVertex ()); + HexDisplay (doc->countUsedEdge ()); + HexDisplay (doc->countUsedQuad ()); + HexDisplay (doc->countUsedHexa ()); + + + doc->removeConnectedHexa (grid->getHexaIJK (0,0,0)); + + Echo ("--------- Apres destruction"); + HexDisplay (doc->countVertex ()); + HexDisplay (doc->countEdge ()); + HexDisplay (doc->countQuad ()); + HexDisplay (doc->countHexa ()); + + HexDisplay (doc->countUsedVertex ()); + HexDisplay (doc->countUsedEdge ()); + HexDisplay (doc->countUsedQuad ()); + HexDisplay (doc->countUsedHexa ()); + doc->saveVtk ("removeConn2.vtk"); + + return HOK; +} +// ================================================== init_vec +void init_vec (Hex::RealVector& tab, double n0=0, double n1=0, double n2=0, + double n3=0, double n4=0, double n5=0, double n6=0, + double n7=0, double n8=0, double n9=0, double n10=0, + double n11=0, double n12=0, double n13=0, double n14=0, + double n15=0, double n16=0) +{ + if (n0>0.0) tab.push_back (n0); + if (n1>0.0) tab.push_back (n1); + if (n2>0.0) tab.push_back (n2); + if (n3>0.0) tab.push_back (n3); + if (n4>0.0) tab.push_back (n4); + if (n5>0.0) tab.push_back (n5); + if (n6>0.0) tab.push_back (n6); + if (n7>0.0) tab.push_back (n7); + if (n8>0.0) tab.push_back (n8); + if (n9>0.0) tab.push_back (n9); + + if (n10>0.0) tab.push_back (n10); + if (n11>0.0) tab.push_back (n11); + if (n12>0.0) tab.push_back (n12); + if (n13>0.0) tab.push_back (n13); + if (n14>0.0) tab.push_back (n14); + if (n15>0.0) tab.push_back (n15); + if (n16>0.0) tab.push_back (n16); +} +// ================================================== test_cylindricals +int test_cylindricals (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0, 0, 0); + Hex::Vector* vz = doc->addVector (0, 0, 1); + Hex::Vector* vx = doc->addVector (1 ,0, 0); + + Hex::RealVector tdr, tda, tdl; + + /****************** + init_vec (tdr, 2, 1, 0.5); + init_vec (tda, 40, 35, 30, 25, 20, 15, 10, 5, + 5, 10, 15, 20, 25, 30, 35, 40); + init_vec (tdl, 1, 2, 3 ); + + init_vec (tdr, 1, 1, 1, 1); + init_vec (tda, 45,45, 45,45, 45,45, 45,45 ); + init_vec (tdl, 1, 1, 1 ); + + ****************** */ + + + init_vec (tdr, 1, 2, 1, 2); + init_vec (tda, 20, 20, 20 ); + init_vec (tdl, 1 ); + + Hex::Elements* grid=doc->makeCylindricals (orig, vx,vz, tdr,tda,tdl, false); + + doc->saveVtk ("cylindricals.vtk"); + doc->dump(); + grid->clearAssociation(); + doc->clearAssociation(); + return HOK; +} +// ======================================================== test_edge +int test_edge (int nbargs, cpchar tabargs[]) +{ + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (); + + Hex::Vertex* orig = doc->addVertex (0, 0, 0); + Hex::Vector* vx = doc->addVector (1 ,0, 0); + doc->addEdge (orig, vx); + + HexDisplay (doc->countVertex()); + HexDisplay (doc->countEdge()); + doc->dump (); + return HOK; +} +// ======================================================== test_hexa +int test_hexa (int nbargs, cpchar tabargs[]) +{ + int ier = 0; + Hex::Hex mon_ex; + Hex::Document* doc1 = mon_ex.loadDocument ("bielle_triang"); + Hex::Document* doc2 = mon_ex.loadDocument ("bielle_triang"); + PutData (doc1->getName ()); + PutData (doc2->getName ()); + return ier; + + + goto_workspace (); + ier = test_cylindricals (nbargs, tabargs); + ier = test_transfo (nbargs, tabargs); + free_workspace (); + + return ier; +} diff --git a/src/HEXABLOCK/test_hexa5.cxx b/src/HEXABLOCK/test_hexa5.cxx new file mode 100644 index 0000000..f7637cf --- /dev/null +++ b/src/HEXABLOCK/test_hexa5.cxx @@ -0,0 +1,182 @@ + +// C++ : Tests unitaires sur les creations h'hexaedres + +// Copyright (C) 2009-2011 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com +// +#include "Hex.hxx" + +#include + +#include "HexDocument.hxx" +#include "HexElements.hxx" +#include "HexCrossElements.hxx" + +#include "HexHexa.hxx" +#include "HexQuad.hxx" +#include "HexEdge.hxx" +#include "HexVertex.hxx" + +#include "HexCramer.hxx" + +// ======================================================== test_hexa_quads_5 +int test_replace5 (int nbargs, cpchar tabargs[]) +{ + const int size_x = 4; + const int size_y = 4; + const int size_z = 2; + + double lgcell = 3; + double cray = lgcell*size_x/2; + double decal = lgcell/sqrt (2.0); + + int nvtk = 0; + cpchar son_nom = "replace5"; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (son_nom); + + Hex::Vertex* ori1 = doc->addVertex (-cray, -cray, 0); + Hex::Vector* vx = doc->addVector (3,0,0); + Hex::Vector* vy = doc->addVector (0,3,0); + Hex::Vector* vz = doc->addVector (0,0,1); + + Hex::Elements* grid1 = doc->makeCartesian (ori1, vx, vy, vz, + size_x,size_y,size_z); + doc->saveVtk (son_nom, nvtk); + +/************************ + for (int nz=0 ; nzgetHexaIJK (nx,ny,nz)->remove (); + + doc->saveVtk (son_nom, nvtk); +********************/ + + for (int nz=0 ; nz<=size_z ; ++nz) + { + grid1->getVertexIJK (1, 1, nz)->setX (-decal); + grid1->getVertexIJK (1, 1, nz)->setY (-decal); + + grid1->getVertexIJK (1, 3, nz)->setX (-decal); + grid1->getVertexIJK (1, 3, nz)->setY ( decal); + + grid1->getVertexIJK (3, 1, nz)->setX ( decal); + grid1->getVertexIJK (3, 1, nz)->setY (-decal); + + grid1->getVertexIJK (3, 3, nz)->setX ( decal); + grid1->getVertexIJK (3, 3, nz)->setY ( decal); + } + + doc->saveVtk (son_nom, nvtk); + + Hex::Vertex* ori0 = doc->addVertex (0,-10,0); + Hex::Vertex* ori2 = doc->addVertex (0,0,0); + const double dr = 1; + const double da = 360; + const double dl = 1; + const int nr = 2; + const int na = 8; + const int nl = 3; + + + Hex::Elements* grid0 = doc->makeCylindrical (ori0, vx, vz, + dr, da, dl, nr, na, 1, false); + + doc->saveVtk (son_nom, nvtk); + + Hex::Elements* grid2 = doc->makeCylindrical (ori2, vx, vz, + dr, da, dl, nr, na, nl, false); + + doc->saveVtk (son_nom, nvtk); + grid0->remove (); + doc->saveVtk (son_nom, nvtk); + return HOK; +} +// ======================================================== test_get +int test_get (int nbargs, cpchar tabargs[]) +{ + const int size_x = 2; + const int size_y = 2; + const int size_z = 2; + + int nvtk = 0; + cpchar son_nom = "test_get"; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (son_nom); + + Hex::Vertex* ori1 = doc->addVertex (0,0,0); + Hex::Vector* vx = doc->addVector (1,0,0); + Hex::Vector* vy = doc->addVector (0,1,0); + Hex::Vector* vz = doc->addVector (0,0,1); + + Hex::Elements* grid = doc->makeCartesian (ori1, vx, vy, vz, + size_x,size_y,size_z); + doc->saveVtk (son_nom, nvtk); + grid->getVertexIJK (2, 1, 1)->setColor (4); + doc->saveVtk (son_nom, nvtk); + + grid->getVertexIJK (2, 1, 1)->setColor (0); + grid->getEdgeK (1, 0, 1)->setColor (4); + doc->saveVtk (son_nom, nvtk); + + grid->getEdgeK (1, 0, 1)->setColor (0); + grid->getQuadIJ (1, 0, 2)->setColor (4); + doc->saveVtk (son_nom, nvtk); + + grid->getHexaIJK (1, 0, 1)->setColor (4); + doc->saveVtk (son_nom, nvtk); + doc->saveVtk (son_nom, nvtk); + doc->saveVtk (son_nom, nvtk); + doc->saveVtk (son_nom, nvtk); + doc->saveVtk (son_nom, nvtk); + doc->saveVtk (son_nom, nvtk); + doc->saveVtk (son_nom, nvtk); + doc->saveVtk (son_nom, nvtk); + +} +// ======================================================== test_dump +int test_dump (int nbargs, cpchar tabargs[]) +{ + const int size_x = 4; + const int size_y = 4; + const int size_z = 2; + + double lgcell = 3; + double cray = lgcell*size_x/2; + double decal = lgcell/sqrt (2.0); + + int nvtk = 0; + cpchar son_nom = "test_dump"; + + Hex::Hex mon_ex; + Hex::Document* doc = mon_ex.addDocument (son_nom); + + Hex::Vertex* ori1 = doc->addVertex (-cray, -cray, 0); + Hex::Vector* vx = doc->addVector (3,0,0); + Hex::Vector* vy = doc->addVector (0,3,0); + Hex::Vector* vz = doc->addVector (0,0,1); + + Hex::Elements* grid1 = doc->makeCartesian (ori1, vx, vy, vz, + size_x,size_y,size_z); + doc->saveVtk (son_nom, nvtk); + return HOK; +} diff --git a/src/HEXABLOCK/test_tools.cxx b/src/HEXABLOCK/test_tools.cxx new file mode 100755 index 0000000..1b6c61f --- /dev/null +++ b/src/HEXABLOCK/test_tools.cxx @@ -0,0 +1,59 @@ + +// C++ : Outils communs aux tests unitaires + +// Copyright (C) 2009-2011 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com + + +#include "test_unit.hxx" + +#include +#include +#include + +static int nbr_vtk = 0; +static cpchar case_name = "hexa"; +static Hex::Document* docu = NULL; + +static string workspace = "/tmp/test_hexablock"; + +// ======================================================== call_system +void call_system (const string& command) +{ + system (command.c_str()); +} +// ======================================================== goto_workspace +void goto_workspace () +{ + string rmdir = "rm -rf "; + string mkdir = "mkdir -p "; + + call_system (rmdir + workspace); + call_system (mkdir + workspace); + + chdir (workspace.c_str()); +} +// ======================================================== free_workspace +void free_workspace () +{ + string chmod = "chmod 777 "; + + call_system (chmod + workspace); + call_system (chmod + workspace + "/*"); +} diff --git a/src/HEXABLOCK/test_unit.hxx b/src/HEXABLOCK/test_unit.hxx new file mode 100644 index 0000000..33f4a0b --- /dev/null +++ b/src/HEXABLOCK/test_unit.hxx @@ -0,0 +1,77 @@ + +// Copyright (C) 2009-2011 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ +// or email : webmaster.salome@opencascade.com +// + +#ifndef _TEST_UNIT_H_ +#define _TEST_UNIT_H_ + +#include "hexa_base.hxx" + +void goto_workspace (); +void free_workspace (); + +int test_sphere (int nbargs, cpchar tabargs[]); +int test_joint (int nbargs, cpchar tabargs[]); +int test_prism (int nbargs, cpchar tabargs[]); +int test_revolution9 (int nbargs, cpchar tabargs[]); +int test_revolution (int nbargs, cpchar tabargs[]); +int test_coude (int nbargs, cpchar tabargs[]); +int test_count (int nbargs, cpchar tabargs[]); +int test_decoupage (int nbargs, cpchar tabargs[]); +int test_gen_xml (int nbargs, cpchar tabargs[]); +int test_string_xml (int nbargs, cpchar tabargs[]); +int test_relecture (int nbargs, cpchar tabargs[]); +int test_spherical (int nbargs, const char* tabargs[]); +int test_grille_cyl (int nbargs, cpchar tabargs[]); +int test_asso_line (int nbargs, cpchar tabargs[]); +int test_cylindrical (int nbargs, cpchar tabargs[]); +int test_cylinder (int nbargs, cpchar tabargs[]); +int test_xml_cylinder (int nbargs, cpchar tabargs[]); +int test_pipe (int nbargs, cpchar tabargs[]); +int test_joint2 (int nbargs, cpchar tabargs[]); +int test_croix (int nbargs, cpchar tabargs[]); +int test_pipes (int nbargs, cpchar tabargs[]); +int test_lorraine(int nbargs, cpchar tabargs[]); +int test_disconnect2 (int nbargs, cpchar tabargs[]); +int test_disconnect4 (int nbargs, cpchar tabargs[]); +int test_disconnect1 (int nbargs, cpchar tabargs[]); +int test_disconnect3 (int nbargs, cpchar tabargs[]); +int test_disconnect (int nbargs, cpchar tabargs[]); +int test_transfo2 (int nbargs, cpchar tabargs[]); +int test_transfo (int nbargs, cpchar tabargs[]); +int test_copy_document (int nbargs, cpchar tabargs[]); +int test_cylindricals (int nbargs, cpchar tabargs[]); +int test_hexa (int nbargs, cpchar tabargs[]); + // Dans test_quads +int test_hexa_quads_5 (int nbargs, cpchar tabargs[]); +int test_hexa_quads_ab (int nbargs, cpchar tabargs[]); +int test_hexa_quads_ac (int nbargs, cpchar tabargs[]); +int test_hexa_quads_ace (int nbargs, cpchar tabargs[]); +int test_hexa_quads_acd (int nbargs, cpchar tabargs[]); +int test_hexa_quads_abcd (int nbargs, cpchar tabargs[]); +int test_hexa_quads_abce (int nbargs, cpchar tabargs[]); +int test_cramer (int nbargs, cpchar tabargs[]); +int test_hexa_quads_ac1 (int nbargs, cpchar tabargs[]); +int test_asso_grid (int nbargs, cpchar tabargs[]); +int test_piquage (int nbargs, cpchar tabargs[]); +int test_replace (int nbargs, cpchar tabargs[]); +int test_hemispheres (int nbargs, cpchar tabargs[]); +int test_quads (int nbargs, cpchar tabargs[]); +#endif diff --git a/src/HEXABLOCKGUI/AddShapeDialog_QTD.ui b/src/HEXABLOCKGUI/AddShapeDialog_QTD.ui new file mode 100644 index 0000000..a5f3229 --- /dev/null +++ b/src/HEXABLOCKGUI/AddShapeDialog_QTD.ui @@ -0,0 +1,49 @@ + + + AddShapeDialog + + + + 0 + 0 + 242 + 72 + + + + + 0 + 0 + + + + Dialog + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Geometry: + + + + + + + + + + + + + + diff --git a/src/HEXABLOCKGUI/CutEdge_QTD.ui b/src/HEXABLOCKGUI/CutEdge_QTD.ui index dc68957..50569c5 100644 --- a/src/HEXABLOCKGUI/CutEdge_QTD.ui +++ b/src/HEXABLOCKGUI/CutEdge_QTD.ui @@ -79,6 +79,9 @@ 0 + + 1 + 1000000 diff --git a/src/HEXABLOCKGUI/Disconnect_QTD.ui b/src/HEXABLOCKGUI/Disconnect_QTD.ui index 0711c29..b5f82fe 100644 --- a/src/HEXABLOCKGUI/Disconnect_QTD.ui +++ b/src/HEXABLOCKGUI/Disconnect_QTD.ui @@ -6,12 +6,12 @@ 0 0 - 270 - 556 + 229 + 269 - + 0 0 @@ -21,420 +21,452 @@ - - + + true - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 50 - - - - Disconnect - - - - QLayout::SetDefaultConstraint + + + + 0 + -318 + 234 + 556 + - - - - - 0 - 0 - - - - Vertex - - - true - - - - - - - - 0 - 0 - - - - Edge - - - - - - - - 0 - 0 - - - - Edges - - - - - - - Quad - - - - - - - - - - - 0 - 0 - - - - Arguments - - - - - - - 0 - 0 - - - - - 16777215 - 64 - - - - - - - vertex - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - from hexa : - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 64 - - - - - - - edge - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - from hexa : - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 64 - - - - - QLayout::SetDefaultConstraint + + + + + true + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 50 + + + + Disconnect + + + + QLayout::SetDefaultConstraint + + + + + + 0 + 0 + + + + Vertex + + + true + + + + + + + + 0 + 0 + + + + Edge + + + + + + + + 0 + 0 + + + + Edges + + + + + + + Quad + + + + + + + + + + + 0 + 0 + + + + Arguments + + + + + + + 0 + 0 + + + + + 16777215 + 64 + + + + + + + vertex + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + from hexa : + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 64 + + + + + + + edge + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + from hexa : + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 64 + + + + + QLayout::SetDefaultConstraint + + + QFormLayout::AllNonFixedFieldsGrow + + + + + quad + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + from hexa : + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Disconnect Edges + + + + + + + 0 + 0 + + + + + 16777215 + 70 + + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + From Hexa(s) + + + + + + + 0 + 0 + + + + + 16777215 + 70 + + + + + + + + + + + + + + + + + Qt::Vertical - - QFormLayout::AllNonFixedFieldsGrow + + + 20 + 40 + - - - - quad - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - from hexa : - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Disconnect Edges - - - - - - - 0 - 0 - - - - - 16777215 - 70 - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - From Hexa(s) - - - - - - - 0 - 0 - - - - - 16777215 - 70 - - - - - - - - - - - + + + + diff --git a/src/HEXABLOCKGUI/EdgeAssoc_QTD.ui b/src/HEXABLOCKGUI/EdgeAssoc_QTD.ui index 50d4589..ad1d19c 100644 --- a/src/HEXABLOCKGUI/EdgeAssoc_QTD.ui +++ b/src/HEXABLOCKGUI/EdgeAssoc_QTD.ui @@ -49,7 +49,7 @@ 0 0 223 - 620 + 618 @@ -120,30 +120,16 @@ Vertex - - - - - - - First : - - - - - - - - 0 - 0 - - - - false - - - - + + + + + First: + + + + + @@ -308,6 +294,13 @@ + + + + End : + + + @@ -321,13 +314,6 @@ - - - - End : - - - @@ -339,9 +325,6 @@ 0.010000000000000 - - 1.000000000000000 - @@ -372,6 +355,20 @@ + + scrollArea + single_rb + multiple_rb + single_edge_le + single_line_le + pstart_spb + pend_spb + first_vex_le + edges_lw + lines_lw + close_cb + inverse_cb + @@ -390,22 +387,6 @@ - - close_cb - toggled(bool) - pend_spb - setDisabled(bool) - - - 196 - 495 - - - 120 - 581 - - - close_cb toggled(bool) @@ -694,5 +675,21 @@ + + close_cb + toggled(bool) + pend_spb + setDisabled(bool) + + + 81 + 489 + + + 142 + 569 + + + diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx index 4032e1b..8e6be3a 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.cxx @@ -50,6 +50,10 @@ #include #include +#include +#include +#include +#include @@ -57,6 +61,7 @@ #include #include +#include // SALOME KERNEL includes @@ -68,7 +73,6 @@ -#include #include #include #include @@ -85,6 +89,7 @@ #include +#include #include @@ -96,12 +101,16 @@ #include "HEXABLOCKGUI_Export.hxx" #include "HEXABLOCKGUI_Trace.hxx" #include "HEXABLOCKGUI_Resource.hxx" +#include "GEOMBase.h" // #include "HEXABLOCKGUI_DataModel.hxx" -#include "HEXABLOCKGUI_DocumentGraphicView.hxx" + #include "HEXABLOCKGUI_DocumentModel.hxx" #include "HEXABLOCKGUI_DocumentSelectionModel.hxx" #include "HEXABLOCKGUI_DocumentDelegate.hxx" #include "HEXABLOCKGUI_DocumentPanel.hxx" +#include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" +#include "HEXABLOCKGUI_OccGraphicView.hxx" +#include "HEXABLOCKGUI_GraphicViewsHandler.hxx" #include @@ -111,122 +120,121 @@ #include "HEXABLOCK.hxx" #include "HexDocument_impl.hxx" +#include "Hex.hxx" #define DW_MINIMUM_WIDTH 50 #define DWINPUT_MINIMUM_HEIGHT 50 -#define DWINPUT_MINIMUM_WIDTH 255 +#define DWINPUT_MINIMUM_WIDTH 50//255 using namespace std; using namespace HEXABLOCK::GUI; int HEXABLOCKGUI::_oldStudyId = -1; +//bool jepeux = false; HEXABLOCK_ORB::HEXABLOCK_Gen_var HEXABLOCKGUI::_hexaEngine = HEXABLOCK_ORB::HEXABLOCK_Gen::_nil(); // SMESH::SMESH_Gen_var HEXABLOCKGUI::_smeshEngine = SMESH::SMESH_Gen::_nil(); -GEOM::GEOM_Gen_var HEXABLOCKGUI::_geomEngine = GEOM::GEOM_Gen::_nil(); + GEOM::GEOM_Gen_var HEXABLOCKGUI::_geomEngine = GEOM::GEOM_Gen::_nil(); // std::map HEXABLOCKGUI::svtkViews; // std::map HEXABLOCKGUI::svtkViews; // std::map HEXABLOCKGUI::salomeViews; -// HEXABLOCK::GUI::DocumentModel *HEXABLOCKGUI::_currentModel = NULL; +// HEXABLOCK::GUI::DocumentModel *HEXABLOCKGUI::getCurrentModel() = NULL; -SVTK_ViewWindow* HEXABLOCKGUI::currentVtkView = NULL; -OCCViewer_ViewWindow* HEXABLOCKGUI::currentOccView = NULL; -bool HEXABLOCKGUI::assocInProgress = false; +VtkDocumentGraphicView* HEXABLOCKGUI::currentDocGView = NULL; +OccGraphicView* HEXABLOCKGUI::currentOccGView = NULL; +MyGEOMBase_Helper* HEXABLOCKGUI::geomBaseHelper = NULL; +bool HEXABLOCKGUI::assocInProgress = false; +SalomeApp_Application* HEXABLOCKGUI::myApplication = NULL; +GEOMGUI_OCCSelector* HEXABLOCKGUI::currentOccSelector = NULL; HEXABLOCKGUI::HEXABLOCKGUI() : - SalomeApp_Module( "HEXABLOCK" ), // default name - LightApp_Module( "HEXABLOCK" ), - _menuId(190), - _dwPattern(0), - _dwAssociation(0), - _dwGroups(0), - _dwMesh(0), - _dwObjectBrowser(0), - _dwInputPanel(0), - _currentModel(0), - _patternDataModel(0), - _patternBuilderModel(0), - _patternDataTreeView(0), - _patternBuilderTreeView(0), - _associationTreeView(0), - _groupsTreeView(0), - _meshTreeView(0), - _currentGraphicView(0), - _treeViewDelegate(0), - _patternDataSelectionModel(0), - _patternBuilderSelectionModel(0), - _meshSelectionModel(0), - _groupsSelectionModel(0), -// _documentCnt(0), - _isSaved( false ), - moduleActivatedOnce(false), - vtkViewManager(0),//, - occViewManager(0), -// _selectFromTree( false ) - _vertexDiag(0), - _edgeDiag(0), - _quadDiag(0), - _hexaDiag(0), - _vectorDiag(0), - _cylinderDiag(0), - _pipeDiag(0), - _makeGridDiag(0), - _makeCylinderDiag(0), - _makePipeDiag(0), - _makeCylindersDiag(0), - _makePipesDiag(0), - _removeHexaDiag(0), - _prismQuadDiag(0), - _joinQuadDiag(0), - _mergeDiag(0), - _disconnectDiag(0), - _cutEdgeDiag(0), - _makeTransformationDiag(0), - _makeSymmetryDiag(0), - _performTransformationDiag(0), - _performSymmetryDiag(0), - _vertexAssocDiag(0), - _edgeAssocDiag(0), - _quadAssocDiag(0), - _groupDiag(0), - _lawDiag(0), - _propagationDiag(0), - _computeMeshDiag(0), - _replaceHexaDiag(0), - _quadRevolutionDiag(0), - _makeHemiSphereDiag(0), - currentDialog(NULL) -{ - DEBTRACE("HEXABLOCKGUI::HEXABLOCKGUI"); -// _studyContextMap.clear(); + SalomeApp_Module( "HEXABLOCK" ), // default name + LightApp_Module( "HEXABLOCK" ), + _menuId(190), + _dwPattern(0), + _dwAssociation(0), + _dwGroups(0), + _dwMesh(0), + _dwObjectBrowser(0), + _dwInputPanel(0), + _patternDataTreeView(0), + _patternBuilderTreeView(0), + _patternGeomTreeView(0), + _associationTreeView(0), + _groupsTreeView(0), + _meshTreeView(0), + _treeViewDelegate(0), + _isSaved( false ), + moduleActivatedOnce(false), + _vertexDiag(0), + _edgeDiag(0), + _quadDiag(0), + _hexaDiag(0), + _vectorDiag(0), + _cylinderDiag(0), + _pipeDiag(0), + _makeGridDiag(0), + _makeCylinderDiag(0), + _makePipeDiag(0), + _makeCylindersDiag(0), + _makePipesDiag(0), + _removeHexaDiag(0), + _prismQuadDiag(0), + _joinQuadDiag(0), + _mergeDiag(0), + _disconnectDiag(0), + _cutEdgeDiag(0), + _makeTransformationDiag(0), + _makeSymmetryDiag(0), + _performTransformationDiag(0), + _performSymmetryDiag(0), + _vertexAssocDiag(0), + _edgeAssocDiag(0), + _quadAssocDiag(0), + _groupDiag(0), + _lawDiag(0), + _propagationDiag(0), + _computeMeshDiag(0), + _replaceHexaDiag(0), + _quadRevolutionDiag(0), + _makeHemiSphereDiag(0), + _modelInfoDiag(NULL), + _addShapeDiag(NULL), + currentDialog(NULL) +{ + DEBTRACE("HEXABLOCKGUI::HEXABLOCKGUI"); + // _studyContextMap.clear(); + graphicViewsHandler = new GraphicViewsHandler(); + loadDocLastPath = new QDir(); + saveDocLastPath = new QDir(); } HEXABLOCKGUI::~HEXABLOCKGUI() { -// if ( getApp() ) -// disconnect( getApp(), SIGNAL(studyClosed()), _genericGui, SLOT (onCleanOnExit())); + // if ( getApp() ) + // disconnect( getApp(), SIGNAL(studyClosed()), _genericGui, SLOT (onCleanOnExit())); } SalomeApp_Study* HEXABLOCKGUI::activeStudy() { - SUIT_Application* app = SUIT_Session::session()->activeApplication(); - if( app ) - return dynamic_cast( app->activeStudy() ); - else - return NULL; + SUIT_Application* app = SUIT_Session::session()->activeApplication(); + if( app ) + return dynamic_cast( app->activeStudy() ); + else + return NULL; } // Gets an reference to the module's engine HEXABLOCK_ORB::HEXABLOCK_Gen_ptr HEXABLOCKGUI::InitHEXABLOCKGen( SalomeApp_Application* app ) { - Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer", "HEXABLOCK" ); - HEXABLOCK_ORB::HEXABLOCK_Gen_ptr clr = HEXABLOCK_ORB::HEXABLOCK_Gen::_narrow(comp); - ASSERT(!CORBA::is_nil(clr)); - return clr; + Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer", "HEXABLOCK" ); + HEXABLOCK_ORB::HEXABLOCK_Gen_ptr clr = HEXABLOCK_ORB::HEXABLOCK_Gen::_narrow(comp); + ASSERT(!CORBA::is_nil(clr)); + return clr; } // // Gets an reference to SMESH's engine CS_TO_DELETE @@ -241,285 +249,326 @@ HEXABLOCK_ORB::HEXABLOCK_Gen_ptr HEXABLOCKGUI::InitHEXABLOCKGen( SalomeApp_Appli // // // Gets an reference to GEOM's engine CS_TO_DELETE GEOM::GEOM_Gen_ptr HEXABLOCKGUI::InitGEOMGen( SalomeApp_Application* app, - const std::string& container ) + const std::string& container ) { - Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( container.c_str(), "GEOM" ); - MESSAGE("INITINITINITINIT comp : " << comp); - GEOM::GEOM_Gen_ptr clr = GEOM::GEOM_Gen::_narrow(comp); - MESSAGE("INITINITINITINIT clr 1: " << clr); - ASSERT(!CORBA::is_nil(clr)); - return clr; + Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( container.c_str(), "GEOM" ); + GEOM::GEOM_Gen_ptr clr = GEOM::GEOM_Gen::_narrow(comp); + ASSERT(!CORBA::is_nil(clr)); + return clr; } void HEXABLOCKGUI::initialize( CAM_Application* app ) { - DEBTRACE("HEXABLOCKGUI::initialize"); - SalomeApp_Module::initialize( app ); - - _hexaEngine = InitHEXABLOCKGen( dynamic_cast( app ) ); - _geomEngine = InitGEOMGen( dynamic_cast( app ) ); - MESSAGE("INITINITINITINIT clr 2: " << _geomEngine); + DEBTRACE("HEXABLOCKGUI::initialize"); + SalomeApp_Module::initialize( app ); - QWidget* aParent = application()->desktop(); - DEBTRACE(app << " " << application() << " " << application()->desktop() << " " << aParent); + _hexaEngine = InitHEXABLOCKGen( dynamic_cast( app ) ); + _geomEngine = InitGEOMGen( dynamic_cast( app ) ); - SUIT_ResourceMgr* aResourceMgr = app->resourceMgr(); - setResource(aResourceMgr); + DEBTRACE(app << " " << application() << " " << application()->desktop() << " " << aParent); -// if ( app && app->desktop() ){ -// connect( app->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), -// this, SLOT(onWindowActivated( SUIT_ViewWindow* )) ); -// connect( getApp()->objectBrowser()->treeView(),SIGNAL( clicked(const QModelIndex&) ), -// this, SLOT( onObjectBrowserClick(const QModelIndex&) ) ); -// // connect( getApp(), SIGNAL(studyClosed()), _genericGui,SLOT (onCleanOnExit())); -// } + SUIT_ResourceMgr* aResourceMgr = app->resourceMgr(); + setResource(aResourceMgr); -// // TEST -// QGraphicsScene* scene = new QGraphicsScene; -// scene->addText("Hello, philou!"); -// QGraphicsView* view = new QGraphicsView(scene); -// view->show(); -// app->desktop()->setCentralWidget(view); -// // TEST + createAndFillDockWidget(); + createActions(); + createMenus(); + createTools(); + studyActivated(); + // add component to study +// if (createSComponent()) updateObjBrowser() +// createSComponent(); - createAndFillDockWidget(); - createActions(); - createMenus(); - createTools(); - studyActivated(); - // add component to study - if (createSComponent()) updateObjBrowser(); + if (_dwInputPanel != NULL) + geomBaseHelper = new MyGEOMBase_Helper(dynamic_cast(_dwInputPanel->parent())); } void HEXABLOCKGUI::viewManagers( QStringList& list ) const { - DEBTRACE("HEXABLOCKGUI::viewManagers"); - MESSAGE("HEXABLOCKGUI::viewManagers"); -// foreach (const QString &str, list) -// MESSAGE("HEXABLOCKGUI::viewManagers"<createOccWindow(), + application()->desktop()); + currentOccGView->getViewWindow()->installEventFilter(this); + } + else if (currentOccGView->getViewWindow() == NULL) + { + currentOccGView->setViewWindow(graphicViewsHandler->createOccWindow()); + currentOccGView->getViewWindow()->installEventFilter(this); + } + + + //Init VTK + if (currentDocGView == NULL) + newDocument(); + else if (currentDocGView->getViewWindow() == NULL) + { + currentDocGView->setViewWindow(graphicViewsHandler->createVtkWindow()); + currentDocGView->getViewWindow()->installEventFilter(this); + } + } bool HEXABLOCKGUI::activateModule( SUIT_Study* theStudy ) { - DEBTRACE("HEXABLOCKGUI::activateModule"); - bool bOk = SalomeApp_Module::activateModule( theStudy ); - if ( !bOk ) return false; + DEBTRACE("HEXABLOCKGUI::activateModule"); -// setMenuShown( true ); -// setToolShown( true ); - if ( _currentModel == 0 ) - initialMenus(); - else - showAllMenus(); + /*HexaBlock can be launched in only one application*/ + if (myApplication == NULL) + //remember the first application + myApplication = dynamic_cast( SUIT_Session::session()->activeApplication() ); -// showDockWidgets(false); - showDockWidgets(true); - if (_dwInputPanel) _dwInputPanel->close(); - -// // import Python module that manages HEXABLOCK plugins (need to be here because SalomePyQt API uses active module) -// PyGILState_STATE gstate = PyGILState_Ensure(); -// PyObject* pluginsmanager=PyImport_ImportModule((char*)"salome_pluginsmanager"); -// if(pluginsmanager==NULL) -// PyErr_Print(); -// else -// { -// PyObject* result=PyObject_CallMethod( pluginsmanager, (char*)"initialize", (char*)"isss",1,"hexablock","HEXABLOCK","Plugins"); -// if(result==NULL) -// PyErr_Print(); -// Py_XDECREF(result); -// } -// PyGILState_Release(gstate); -// // end of HEXABLOCK plugins loading + //application verification: if it's not the one known by HexaBlock, + //leave without activating + SalomeApp_Application* currentApplication = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if (myApplication != currentApplication) return false; + + bool bOk = SalomeApp_Module::activateModule( theStudy ); + if ( !bOk ) return false; + + // setMenuShown( true ); + // setToolShown( true ); + // showDockWidgets(false); + showDockWidgets(true); connect( getApp()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), - this, SLOT(onWindowActivated( SUIT_ViewWindow* )) ); + this, SLOT(onWindowActivated( SUIT_ViewWindow* )), Qt::UniqueConnection ); connect( getApp()->objectBrowser()->treeView(),SIGNAL( clicked(const QModelIndex&) ), - this, SLOT( onObjectBrowserClick(const QModelIndex&) ) ); -// connect( getApp(), SIGNAL(studyClosed()), _genericGui,SLOT (onCleanOnExit())); + this, SLOT( onObjectBrowserClick(const QModelIndex&) ), Qt::UniqueConnection ); + // connect( getApp(), SIGNAL(studyClosed()), _genericGui,SLOT (onCleanOnExit())); + + LightApp_SelectionMgr* sm = getApp()->selectionMgr(); + + SUIT_ViewManager* vm; + ViewManagerList OCCViewManagers, VTKViewManagers; + + application()->viewManagers( OCCViewer_Viewer::Type(), OCCViewManagers ); + QListIterator itOCC( OCCViewManagers ); + while ( itOCC.hasNext() && (vm = itOCC.next()) ) + myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) ); + + application()->viewManagers( SVTK_Viewer::Type(), VTKViewManagers ); + QListIterator itVTK( VTKViewManagers ); + while ( itVTK.hasNext() && (vm = itVTK.next()) ) + myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast( vm->getViewModel() ), sm ) ); + + //NPAL 19674 + SALOME_ListIO selected; + sm->selectedObjects( selected ); + sm->clearSelected(); + + // disable OCC selectors + getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); + QListIterator itOCCSel( myOCCSelectors ); + while ( itOCCSel.hasNext() ) + if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() ) + sr->setEnabled(true); + + // disable VTK selectors + getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() ); + QListIterator itVTKSel( myVTKSelectors ); + while ( itVTKSel.hasNext() ) + if ( LightApp_VTKSelector* sr = itVTKSel.next() ) + sr->setEnabled(true); + + sm->setSelectedObjects( selected, true ); //NPAL 19674 + + //connect close signal to vtk view manager + vm = getApp()->getViewManager(SVTK_Viewer::Type(), false); + if (vm != NULL) + { + connect( vm, SIGNAL( tryCloseView( SUIT_ViewWindow * ) ), + this, SLOT( onWindowClosed(SUIT_ViewWindow *) ), Qt::UniqueConnection ); + } + //connect close signal to occ view manager + vm = getApp()->getViewManager(OCCViewer_Viewer::Type(), false); + if (vm != NULL) + { + connect( vm, SIGNAL( tryCloseView( SUIT_ViewWindow * ) ), + this, SLOT( onWindowClosed(SUIT_ViewWindow *) ), Qt::UniqueConnection ); + } -// vtkViewManager = getApp()->getViewManager(SVTK_Viewer::Type(), true); //create the view manager if it doesn't exist - LightApp_SelectionMgr* sm = getApp()->selectionMgr(); + _hexaEngine->SetCurrentStudy(SALOMEDS::Study::_nil()); + if ( SalomeApp_Study* s = dynamic_cast( theStudy )) + if ( _PTR(Study) aStudy = s->studyDS()) { + //define _CAST(Class, shared_ptr_Obj) dynamic_cast(shared_ptr_Obj.get()) + _hexaEngine->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() ); + updateObjBrowser(); // objects can be removed + } - SUIT_ViewManager* vm; - ViewManagerList OCCViewManagers, VTKViewManagers; + if (currentOccGView != NULL && currentOccGView->getViewWindow() != NULL) + currentOccGView->getViewWindow()->installEventFilter(this); - application()->viewManagers( OCCViewer_Viewer::Type(), OCCViewManagers ); - QListIterator itOCC( OCCViewManagers ); - while ( itOCC.hasNext() && (vm = itOCC.next()) ) - myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) ); - application()->viewManagers( SVTK_Viewer::Type(), VTKViewManagers ); - QListIterator itVTK( VTKViewManagers ); - while ( itVTK.hasNext() && (vm = itVTK.next()) ) - myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast( vm->getViewModel() ), sm ) ); + if (currentDocGView != NULL) + { + switchModel(currentDocGView); + showAllMenus(); - //NPAL 19674 - SALOME_ListIO selected; - sm->selectedObjects( selected ); - sm->clearSelected(); + if (currentDocGView->getViewWindow() != NULL) + currentDocGView->getViewWindow()->installEventFilter(this); + } + else + initialMenus(); + + return bOk; +} - // disable OCC selectors - getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); - QListIterator itOCCSel( myOCCSelectors ); - while ( itOCCSel.hasNext() ) - if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() ) - sr->setEnabled(true); - // disable VTK selectors - getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() ); - QListIterator itVTKSel( myVTKSelectors ); - while ( itVTKSel.hasNext() ) - if ( LightApp_VTKSelector* sr = itVTKSel.next() ) - sr->setEnabled(true); +bool HEXABLOCKGUI::deactivateModule( SUIT_Study* theStudy ) +{ + disconnect( getApp()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), + this, SLOT(onWindowActivated( SUIT_ViewWindow* )) ); + disconnect( getApp()->objectBrowser()->treeView(),SIGNAL( clicked(const QModelIndex&) ), + this, SLOT( onObjectBrowserClick(const QModelIndex&) ) ); + // connect( getApp(), SIGNAL(studyClosed()), _genericGui,SLOT (onCleanOnExit())); - sm->setSelectedObjects( selected, true ); //NPAL 19674 + if ( currentDocGView != NULL && currentDocGView->getViewWindow() != NULL ) + //default selectionMode in VTKView + currentDocGView->getViewWindow()->SetSelectionMode( ActorSelection ); - _hexaEngine->SetCurrentStudy(SALOMEDS::Study::_nil()); - if ( SalomeApp_Study* s = dynamic_cast( theStudy )) - if ( _PTR(Study) aStudy = s->studyDS()) { - //define _CAST(Class, shared_ptr_Obj) dynamic_cast(shared_ptr_Obj.get()) - _hexaEngine->SetCurrentStudy( _CAST(Study,aStudy)->GetStudy() ); - updateObjBrowser(); // objects can be removed + if (currentOccGView != NULL && currentOccGView->getViewWindow() != NULL) + { + //defaut selectionMode in OccView + getApp()->selectionMgr()->clearSelected(); + geomBaseHelper->globalSelection(currentOccGView->getViewWindow()); +// geomBaseHelper->localSelection(GEOM::GEOM_Object::_nil(), TopAbs_SHAPE); + if (currentOccGView != NULL) + geomBaseHelper->localSelection(currentOccGView->getViewWindow(), TopAbs_SHAPE); } - if (vtkViewManager==NULL || !vtkViewManager->getViewsCount()) newDocument(); - if (_currentGraphicView != NULL) - _currentGraphicView->get_SUIT_ViewWindow()->setFocus(); - - return bOk; -} + qDeleteAll(myOCCSelectors); + myOCCSelectors.clear(); + getApp()->selectionMgr()->setEnabled( true, OCCViewer_Viewer::Type() ); + qDeleteAll(myVTKSelectors); + myVTKSelectors.clear(); + getApp()->selectionMgr()->setEnabled( true, SVTK_Viewer::Type() ); + bool bOk = SalomeApp_Module::deactivateModule( theStudy ); -bool HEXABLOCKGUI::deactivateModule( SUIT_Study* theStudy ) -{ - MESSAGE("HEXABLOCKGUI::deactivateModule"); + //Must be done for all views later + if (currentOccGView != NULL && currentOccGView->getViewWindow() != NULL) + currentOccGView->getViewWindow()->removeEventFilter(this); - setMenuShown( false ); - setToolShown( false ); - if (_dwInputPanel) _dwInputPanel->close(); - showDockWidgets( false ); -// QtGuiContext *context = QtGuiContext::getQtCurrent(); -// _studyContextMap[theStudy->id()] = context; -// DEBTRACE("_studyContextMap[theStudy] " << theStudy << " " << context); + if (currentDocGView != NULL && currentDocGView->getViewWindow() != NULL) + currentDocGView->getViewWindow()->removeEventFilter(this); - disconnect( getApp()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ), - this, SLOT(onWindowActivated( SUIT_ViewWindow* )) ); - disconnect( getApp()->objectBrowser()->treeView(),SIGNAL( clicked(const QModelIndex&) ), - this, SLOT( onObjectBrowserClick(const QModelIndex&) ) ); -// connect( getApp(), SIGNAL(studyClosed()), _genericGui,SLOT (onCleanOnExit())); + //switch off current document graphic view + switchOffGraphicView(currentDocGView); + //...and hide menus + setMenuShown( false ); + setToolShown( false ); + showDockWidgets( false ); + if (_dwInputPanel) _dwInputPanel->close(); - if ( HEXABLOCKGUI::currentVtkView ){ - HEXABLOCKGUI::currentVtkView->SetSelectionMode( ActorSelection ); //default selectionMode in VTKView - } + //hide the current document actor + hideActor(); - if (HEXABLOCKGUI::currentOccView != NULL) - { - getApp()->selectionMgr()->clearSelected(); - //defaut selectionMode in OccView - if (currentDialog != NULL) - { - currentDialog->globalSelection(); - currentDialog->localSelection(GEOM::GEOM_Object::_nil(), TopAbs_SHAPE); - } - } + return bOk; +} +QString HEXABLOCKGUI::addInStudy(QString& fileName) +{ + QString objStudyEntry; -// if ( _patternDataSelectionModel ){ -// delete _patternDataSelectionModel; -// _patternDataSelectionModel = NULL; -// } -// if ( _patternBuilderSelectionModel ){ -// delete _patternBuilderSelectionModel; -// _patternBuilderSelectionModel = NULL; -// } + if ( !fileName.isEmpty() ) { - qDeleteAll(myOCCSelectors); - myOCCSelectors.clear(); - getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); + SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication()); + SalomeApp_Study* appStudy = app ? dynamic_cast( app->activeStudy() ) : NULL; + if(!appStudy) return objStudyEntry; - qDeleteAll(myVTKSelectors); - myVTKSelectors.clear(); - getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() ); + _PTR(Study) aStudy = appStudy->studyDS(); + SALOMEDS::Study_var aDSStudy = GeometryGUI::ClientStudyToStudy( aStudy ); - return SalomeApp_Module::deactivateModule( theStudy ); + GEOM::GEOM_IInsertOperations_var aInsOp = _geomEngine->GetIInsertOperations( aStudy->StudyId() ); + GEOM::GEOM_Object_var anObj = aInsOp->ImportFile(fileName.toStdString().c_str(), "BREP"); + if ( !anObj->_is_nil() && aInsOp->IsDone() ) + { + QStringList sList = fileName.split("."); + SALOMEDS::SObject_var aSO = _geomEngine->PublishInStudy( aDSStudy, + SALOMEDS::SObject::_nil(), + anObj, + sList[0].toStdString().c_str() ); + objStudyEntry = aSO->GetID(); + } + } + return objStudyEntry; } - bool HEXABLOCKGUI::renameAllowed( const QString& entry) const { -// MESSAGE("HEXABLOCKGUI::renameAllowed"); - SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - SalomeApp_Study* appStudy = app ? dynamic_cast( app->activeStudy() ) : 0; - SalomeApp_DataObject* obj = appStudy ? dynamic_cast(appStudy->findObjectByEntry(entry)) : 0; + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + SalomeApp_Study* appStudy = app ? dynamic_cast( app->activeStudy() ) : 0; + SalomeApp_DataObject* obj = appStudy ? dynamic_cast(appStudy->findObjectByEntry(entry)) : 0; - bool res = app && appStudy && obj && !appStudy->isComponent(entry) && !obj->isReference(); - return (app && appStudy && obj && !appStudy->isComponent(entry) && !obj->isReference()); + return (app && appStudy && obj && !appStudy->isComponent(entry) && !obj->isReference()); } bool HEXABLOCKGUI::renameObject( const QString& entry, const QString& name) { - MESSAGE("HEXABLOCKGUI::renameObject"); -// bool appRes = SalomeApp_Module::renameObject(entry,name); -// MESSAGE("appRes"<( SUIT_Session::session()->activeApplication()); - SalomeApp_Study* appStudy = app ? dynamic_cast( app->activeStudy() ) : 0; - - if(!appStudy) - return result; - - _PTR(Study) aStudy = appStudy->studyDS(); - if(!aStudy) - return result; - - _PTR(SObject) obj ( aStudy->FindObjectID(qPrintable(entry)) ); - _PTR(GenericAttribute) anAttr; - if ( obj ){ - if ( obj->FindAttribute(anAttr, "AttributeName") ){ - _PTR(AttributeName) aName (anAttr); -// GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj)); -// -// HEXABLOCK_Gen_i::Document_var aDoc = HEXABLOCK_Gen_i::Document::_narrow( theIOR ); -// if (!CORBA::is_nil(aDoc)) { - aName->SetValue( name.toLatin1().data() ); // rename the SObject -// aDoc->setName( name.toLatin1().data() ); // Rename the corresponding GEOM_Object - _currentModel->setName( name/*.toLatin1().data()*/ ); -// _currentGraphicView->setWindowTitle( _currentModel->getName() ); - result = true; + bool result = false; + SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication()); + SalomeApp_Study* appStudy = app ? dynamic_cast( app->activeStudy() ) : 0; + + if(!appStudy) + return result; + + _PTR(Study) aStudy = appStudy->studyDS(); + + if(!aStudy) + return result;; + + _PTR(SObject) obj ( aStudy->FindObjectID(qPrintable(entry)) ); + _PTR(GenericAttribute) anAttr; + if ( obj ){ + if ( obj->FindAttribute(anAttr, "AttributeName") ){ + _PTR(AttributeName) aName (anAttr); + // GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(obj)); + // + // HEXABLOCK_Gen_i::Document_var aDoc = HEXABLOCK_Gen_i::Document::_narrow( theIOR ); + // if (!CORBA::is_nil(aDoc)) { +// aName->SetValue( name.toLatin1().data() ); // rename the SObject + // aDoc->setName( name.toLatin1().data() ); // Rename the corresponding GEOM_Object + DocumentModel* currentModel = getCurrentModel(); + if (currentModel == NULL) return result; + currentModel->setName( name/*.toLatin1().data()*/ ); + aName->SetValue( getCurrentModel()->getName().toLatin1().data() ); + // _currentGraphicView->setWindowTitle( getCurrentModel()->getName() ); + result = true; + } } - } - return result; + return result; } // --- Default windows void HEXABLOCKGUI::windows( QMap& theMap ) const { - DEBTRACE("HEXABLOCKGUI::windows"); - theMap.clear(); - theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea ); - theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); + DEBTRACE("HEXABLOCKGUI::windows"); + theMap.clear(); + theMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea ); + theMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); } -// LightApp_Displayer* HEXABLOCKGUI::displayer() -// { -// DEBTRACE("HEXABLOCKGUI::displayer"); -// return _currentGraphicView; -// } - // QString HEXABLOCKGUI::engineIOR() const // { @@ -530,133 +579,297 @@ void HEXABLOCKGUI::windows( QMap& theMap ) const QString HEXABLOCKGUI::engineIOR() const { - DEBTRACE("HEXABLOCKGUI::engineIOR"); - CORBA::ORB_var anORB = getApp()->orb(); - CORBA::String_var anIOR = anORB->object_to_string(_hexaEngine); - return QString( anIOR.in() ); + DEBTRACE("HEXABLOCKGUI::engineIOR"); + CORBA::ORB_var anORB = getApp()->orb(); + CORBA::String_var anIOR = anORB->object_to_string(_hexaEngine); + return QString( anIOR.in() ); } - -void HEXABLOCKGUI::onObjectBrowserClick(const QModelIndex& index) +VtkDocumentGraphicView* HEXABLOCKGUI::getDocument(SalomeApp_DataObject* studyObject) { - DEBTRACE("HEXABLOCKGUI::onObjectBrowserClick"); - // we want to switch automatically to the right view windows - QWidget *viewWindow = NULL; + if (docs.count(studyObject->entry()) == 0) + { + //Object's document not acquired yet + VtkDocumentGraphicView* dgview; + HEXA_NS::Hex* directory = HEXA_NS::Hex::getInstance(); + if (directory == NULL) + return NULL; //No working director found + + //------------------ Load the document ----------------- + HEXA_NS::Document* document = directory->findDocument(studyObject->name().toStdString()); + if (document == NULL) return NULL; //No document found + + DocumentModel* docModel = new DocumentModel(document, studyObject->entry(), this ); + if (!docModel) { + MESSAGE("Doc model creation failed!"); + return NULL; + } + dgview = graphicViewsHandler->createDocumentGraphicView( + docModel, + NULL/*viewWindow*/, + application()->desktop() ); + if (dgview == NULL) return NULL; + + //update the data tree +// dgview->loadDocument(); + docs[studyObject->entry()] = dgview; + } - //first, find entry of item selected - QString itemEntry; - DataObjectList dol = getApp()->objectBrowser()->getSelected(); - if (dol.isEmpty()) return; - SalomeApp_DataObject* item = dynamic_cast(dol[0]); - if (!item) return; - itemEntry = item->entry(); + return docs[studyObject->entry()]; +} -// DEBTRACE("HEXABLOCKGUI::onClick index.data() => "< "<name(). => "<name().toStdString()); -// DEBTRACE("HEXABLOCKGUI::onClick itemEntry =>"<setFocus(); - _currentGraphicView->update(); //CS_TEST -// _selectFromTree = false; -// if (getApp()->activeModule()->moduleName().compare("HEXABLOCK") != 0) -// getApp()->activateModule("HEXABLOCK"); -} +void HEXABLOCKGUI::onObjectBrowserClick(const QModelIndex& index) +{ + DEBTRACE("HEXABLOCKGUI::onObjectBrowserClick"); + // we want to switch automatically to the right view windows +// QWidget *viewWindow = NULL; + + //first, find selected item + QString itemEntry; + DataObjectList dol = getApp()->objectBrowser()->getSelected(); + if (dol.isEmpty()) return; + SalomeApp_DataObject* item = dynamic_cast(dol[0]); + if (!item || item->parent()->name().compare(tr("HEXABLOCK")) != 0) return; + VtkDocumentGraphicView* docGView = getDocument(item); + if (docGView == NULL) + { +// currentDocGView = NULL; + return; + } + //Init OCC if necessary + if (currentOccGView == NULL) + { + currentOccGView = new OccGraphicView(graphicViewsHandler->createOccWindow(), + application()->desktop()); + currentOccGView->getViewWindow()->installEventFilter(this); + } + else if (currentOccGView->getViewWindow() == NULL) + { + currentOccGView->setViewWindow(graphicViewsHandler->createOccWindow()); + currentOccGView->getViewWindow()->installEventFilter(this); + } + //Init the vtk view if necessary + if (docGView->getViewWindow() == NULL) + { + if (currentDocGView == NULL || currentDocGView->getViewWindow() == NULL) + { + docGView->setViewWindow(graphicViewsHandler->createVtkWindow()); + docGView->getViewWindow()->installEventFilter(this); + } + else + docGView->setViewWindow(currentDocGView->getViewWindow()); + + if (docGView->getDocumentActor() == NULL) docGView->update(); + } +// setOpen (const QModelIndex &theObject, const bool theOpen=true) +// updateTree (SUIT_DataObject *=0, const bool=true) + //update the current document + switchModel(docGView); + +} void HEXABLOCKGUI::onWindowActivated( SUIT_ViewWindow* svw) { - DEBTRACE("HEXABLOCKGUI::onWindowActivated"); - MESSAGE("HEXABLOCKGUI::onWindowActivated"); - OCCViewer_ViewWindow* anOccVw = dynamic_cast(svw); + DEBTRACE("HEXABLOCKGUI::onWindowActivated"); +// OCCViewer_ViewWindow* anOccVw = dynamic_cast(svw); - if ( anOccVw != NULL) - { - currentOccView->installEventFilter(this); - if (anOccVw != currentOccView) - currentOccView = anOccVw; - } + //update the current occ view +// if (anOccVw != NULL) +// currentOccGView->getViewWindow() = anOccVw; - // we want to switch automatically to the right model - // only VTK view - SVTK_ViewWindow* viewWindow = dynamic_cast(svw); - if (!viewWindow) return; + //set event filter for the occ view +// if (currentOccGView != NULL && currentOccGView->getViewWindow() != NULL) +// currentOccGView->getViewWindow()->installEventFilter(this); - if (getApp()->activeModule() && getApp()->activeModule()->moduleName().compare("HEXABLOCK") != 0) //CS_TODO? - getApp()->activateModule("HEXABLOCK"); + // we want to switch automatically to the right model + // only VTK view +// SVTK_ViewWindow* viewWindow = dynamic_cast(svw); +// if (viewWindow == NULL) return; +// +// if (getApp()->activeModule() && getApp()->activeModule()->moduleName().compare("HEXABLOCK") != 0) //CS_TODO? +// getApp()->activateModule("HEXABLOCK"); - if (viewWindow != currentVtkView) - { - switchModel( viewWindow ); - currentVtkView = viewWindow; - } + //update the current model and the current vtk view +// switchModel( viewWindow ); } void HEXABLOCKGUI::onWindowClosed( SUIT_ViewWindow* svw) { - DEBTRACE("HEXABLOCKGUI::onWindowClosed"); + DEBTRACE("HEXABLOCKGUI::onWindowClosed"); + + + //Decharger le model correspondant (VTK) + SVTK_ViewWindow* window = dynamic_cast(svw); + if (window != NULL) + { + + //VTK clean close + if (currentDocGView != NULL && currentDocGView->getViewWindow() == window) + { //HexaBlock Vtk Window has been closed + + if (currentDialog != NULL) currentDialog->close(); + if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); + if (currentDocGView != NULL) + currentDocGView->setViewWindow(NULL); + + initialMenus(); + return; + } + + //SAVE DOCUMENT + /*VtkDocumentGraphicView* dgview = graphicViewsHandler->getDocumentGraphicView(window); + if (dgview == NULL) return; //The window has no document to close + + //Save the document? (Ask only if the document is not empty + int answerCode = SUIT_MessageBox::question( + 0, + tr("Close"), + tr("Save the document ?"), + SUIT_MessageBox::Yes | SUIT_MessageBox::Cancel, + SUIT_MessageBox::Cancel); + if ( answerCode == SUIT_MessageBox::Cancel) return; //abort closing + else if (answerCode == SUIT_MessageBox::Yes) + saveDocument(); //Save the document + */ +// switchOffGraphicView(window); //disconnect all connected signals +// currentVtkView = NULL; +// graphicViewsHandler->closeDocumentGraphicView(window); + + //create a new one (empty document) +// newDocument(); +// currentVtkView->setWindowTitle(tr("HEXABLOCK") + " : " + currentVtkView->windowTitle()); + } + + //OCC clean close + if (currentOccGView != NULL && svw == currentOccGView->getViewWindow()) + { + if (_vertexAssocDiag != NULL) _vertexAssocDiag->clear(); + if (_edgeAssocDiag != NULL) _edgeAssocDiag->clear(); + if (_quadAssocDiag != NULL) _quadAssocDiag->clear(); + if (currentDialog != NULL) currentDialog->close(); + if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); + + currentOccGView->getViewWindow()->removeEventFilter(this); + currentOccGView->setViewWindow(NULL); + } } void HEXABLOCKGUI::onViewManagerAdded( SUIT_ViewManager* vm) { - DEBTRACE("HEXABLOCKGUI::onViewManagerAdded"); - if ( vm && vm->getType() == OCCViewer_Viewer::Type() ) - { -// qDebug( "connect" ); -// // connect( vm, SIGNAL( keyPress ( SUIT_ViewWindow*, QKeyEvent* ) ), -// // this, SLOT( OnKeyPress( SUIT_ViewWindow*, QKeyEvent* ) ) ); -// // connect( vm, SIGNAL( mousePress( SUIT_ViewWindow*, QMouseEvent* ) ), -// // this, SLOT( OnMousePress( SUIT_ViewWindow*, QMouseEvent* ) ) ); -// connect( vm, SIGNAL( mouseMove ( SUIT_ViewWindow*, QMouseEvent* ) ), -// this, SLOT( OnMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) ); -// LightApp_SelectionMgr* sm = getApp()->selectionMgr(); -// myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) ); -// -// // disable OCC selectors -// getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); -// QListIterator itOCCSel( myOCCSelectors ); -// while ( itOCCSel.hasNext() ) -// if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() ){ -// sr->setEnabled(true); -// std::cout<<"HEXABLOCKGUI::onViewManagerAdded sr"<getType() == OCCViewer_Viewer::Type() ) + { + LightApp_SelectionMgr* sm = getApp()->selectionMgr(); + myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) ); + + // disable OCC selectors + getApp()->selectionMgr()->setEnabled( false, OCCViewer_Viewer::Type() ); + QListIterator itOCCSel( myOCCSelectors ); + while ( itOCCSel.hasNext() ) + if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() ) + sr->setEnabled(true); + } + else if ( vm->getType() == SVTK_Viewer::Type() ) + { + LightApp_SelectionMgr* sm = getApp()->selectionMgr(); + myVTKSelectors.append( new LightApp_VTKSelector( dynamic_cast( vm->getViewModel() ), sm ) ); + + // disable VTK selectors + getApp()->selectionMgr()->setEnabled( false, SVTK_Viewer::Type() ); + QListIterator itVTKSel( myVTKSelectors ); + while ( itVTKSel.hasNext() ) + if ( LightApp_VTKSelector* sr = itVTKSel.next() ) + sr->setEnabled(true); + } } void HEXABLOCKGUI::onViewManagerRemoved( SUIT_ViewManager* vm) { - DEBTRACE("HEXABLOCKGUI::::onViewManagerRemoved"); + DEBTRACE("HEXABLOCKGUI::::onViewManagerRemoved"); + + SUIT_ViewModel* viewer = vm->getViewModel(); + if (vm != NULL && vm->getType() == SVTK_Viewer::Type()) + { + //VTK View Manager removed + if (getApp()->activeModule()->moduleName().compare("HEXABLOCK") == 0) + { + //Process only if it's our view manager + SUIT_ViewManager* myVm = NULL; + if (currentDocGView != NULL && currentDocGView->getViewWindow() != NULL) + myVm = currentDocGView->getViewWindow()->getViewManager(); + + if (myVm == vm) + { + //close opened dialog + if (currentDialog != NULL) currentDialog->close(); + if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); + + initialMenus(); + } + } + + //remove its selector + QListIterator itVTKSel( myVTKSelectors ); + while ( itVTKSel.hasNext() ) + if ( LightApp_VTKSelector* sr = itVTKSel.next() ) + if ( sr->viewer() == viewer ) + { + delete myVTKSelectors.takeAt( myVTKSelectors.indexOf( sr ) ); + break; + } + return; + } + + //OCC + if ( vm && vm->getType() == OCCViewer_Viewer::Type() ) + { + //OCC View removed: remove its selector + QListIterator itOCCSel( myOCCSelectors ); + while ( itOCCSel.hasNext() ) + if ( GEOMGUI_OCCSelector* sr = itOCCSel.next() ) + if ( sr->viewer() == viewer ) + { + delete myOCCSelectors.takeAt( myOCCSelectors.indexOf( sr ) ); + break; + } + } } void HEXABLOCKGUI::onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ) { - QModelIndexList l = selected.indexes(); - if ( l.count() == 0 ) return; - if ( !l[0].isValid() ) return; - - QTreeView* theTree = NULL; - if ( sender() == _patternDataSelectionModel ){ - theTree = _patternDataTreeView; - } else if ( sender() == _patternBuilderSelectionModel ){ - theTree = _patternBuilderTreeView; - } else if ( sender() == _groupsSelectionModel ){ - theTree = _groupsTreeView; - } else if ( sender() == _meshSelectionModel ){ - theTree = _meshTreeView; - } - if ( theTree ){ - theTree->scrollTo ( l[0] ); - } + QModelIndexList l = selected.indexes(); + if ( l.count() == 0 ) return; + if ( !l[0].isValid() ) return; + VtkDocumentGraphicView* currentGraphicView = getCurrentVtkGraphicView(); + if ( currentGraphicView == NULL) return; + + QTreeView* theTree = NULL; + if ( sender() == currentGraphicView->getPatternDataSelectionModel() ){ + theTree = _patternDataTreeView; + } else if ( sender() == currentGraphicView->getPatternBuilderSelectionModel() ){ + theTree = _patternBuilderTreeView; + } else if ( sender() == currentGraphicView->getPatternGeomSelectionModel() ) { + theTree = _patternGeomTreeView; + } + else if ( sender() == currentGraphicView->getGroupsSelectionModel() ){ + theTree = _groupsTreeView; + } else if ( sender() == currentGraphicView->getMeshSelectionModel() ){ + theTree = _meshTreeView; + } + if ( theTree ){ + theTree->scrollTo ( l[0] ); + } } // void HEXABLOCKGUI::onTryClose(bool &isClosed, QxScene_ViewWindow* window) //CS_TODO @@ -674,38 +887,38 @@ void HEXABLOCKGUI::onSelectionChanged( const QItemSelection & selected, const QI bool HEXABLOCKGUI::createSComponent() //addComponent { - DEBTRACE("HEXABLOCKGUI::createSComponent"); - // --- Find or create "HEXABLOCK" SComponent in the study - - _PTR(Study) aStudy = (( SalomeApp_Study* )(getApp()->activeStudy()))->studyDS(); - _PTR(StudyBuilder) aBuilder (aStudy->NewBuilder()); - _PTR(GenericAttribute) anAttr; - _PTR(AttributeName) aName; - - _PTR(SComponent) aComponent = aStudy->FindComponent("HEXABLOCK"); - if ( !aComponent ){ - aComponent = aBuilder->NewComponent("HEXABLOCK"); - anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributeName"); - aName = _PTR(AttributeName) (anAttr); - aName->SetValue(getApp()->moduleTitle("HEXABLOCK").toStdString()); - - anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap"); - _PTR(AttributePixMap) aPixmap(anAttr); - aPixmap->SetPixMap("share/salome/resources/hexablock/ModuleHexablock.png"); - - aBuilder->DefineComponentInstance(aComponent, engineIOR().toStdString()); - DEBTRACE("HEXABLOCKGUI::createSComponent engineIOR=>"<DefineComponentInstance(aComponent, getApp()->defaultEngineIOR().toStdString()); -// DEBTRACE("HEXABLOCKGUI::createSComponent defaultEngineIOR=>"<defaultEngineIOR().toStdString()); - -// SalomeApp_DataModel::synchronize( aComponent, HEXABLOCKGUI::activeStudy() ); - return true; - } - return false; + DEBTRACE("HEXABLOCKGUI::createSComponent"); + // --- Find or create (if not done yet) "HEXABLOCK" SComponent in the study + + _PTR(Study) aStudy = (( SalomeApp_Study* )(getApp()->activeStudy()))->studyDS(); + _PTR(StudyBuilder) aBuilder (aStudy->NewBuilder()); + _PTR(GenericAttribute) anAttr; + _PTR(AttributeName) aName; + _PTR(AttributeGraphic) aGraphic; + + _PTR(SComponent) aComponent = aStudy->FindComponent("HEXABLOCK"); + if ( !aComponent ){ //Create hexablock component if there's not one yet + aComponent = aBuilder->NewComponent("HEXABLOCK"); + anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributeName"); + aName = _PTR(AttributeName) (anAttr); + aName->SetValue(getApp()->moduleTitle("HEXABLOCK").toStdString()); + + anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap"); + _PTR(AttributePixMap) aPixmap(anAttr); + // aPixmap->SetPixMap("share/salome/resources/hexablock/ModuleHexablock.png"); + aPixmap->SetPixMap(tr("ICO_MODULE_HEXABLOCK_SMALL").toStdString()); + + aBuilder->DefineComponentInstance(aComponent, engineIOR().toStdString()); + DEBTRACE("HEXABLOCKGUI::createSComponent engineIOR=>"<DefineComponentInstance(aComponent, getApp()->defaultEngineIOR().toStdString()); + // DEBTRACE("HEXABLOCKGUI::createSComponent defaultEngineIOR=>"<defaultEngineIOR().toStdString()); + + // SalomeApp_DataModel::synchronize( aComponent, HEXABLOCKGUI::activeStudy() ); + return true; + } + return false; } - - // bool HEXABLOCKGUI::isSelectionCompatible() // { // DEBTRACE("HEXABLOCKGUI::isSelectionCompatible"); @@ -726,1715 +939,2024 @@ bool HEXABLOCKGUI::createSComponent() //addComponent void HEXABLOCKGUI::setResource(SUIT_ResourceMgr* r) { - DEBTRACE("HEXABLOCKGUI::setResource"); - _myresource = new HEXABLOCKGUI_Resource(r); - _myresource->preferencesChanged(); + DEBTRACE("HEXABLOCKGUI::setResource"); + _myresource = new HEXABLOCKGUI_Resource(r); + _myresource->preferencesChanged(); } void HEXABLOCKGUI::createPreferences() { - DEBTRACE("HEXABLOCKGUI::createPreferences"); - _myresource->createPreferences(this); + DEBTRACE("HEXABLOCKGUI::createPreferences"); + _myresource->createPreferences(this); } void HEXABLOCKGUI::preferencesChanged( const QString& sect, const QString& name ) { - DEBTRACE("HEXABLOCKGUI::preferencesChanged"); - _myresource->preferencesChanged(sect, name); - if(name=="userCatalog") + DEBTRACE("HEXABLOCKGUI::preferencesChanged"); + _myresource->preferencesChanged(sect, name); + if(name=="userCatalog") { -// _genericGui->getCatalogWidget()->addCatalogFromFile(Resource::userCatalog.toStdString()); + // _genericGui->getCatalogWidget()->addCatalogFromFile(Resource::userCatalog.toStdString()); } } void HEXABLOCKGUI::studyActivated() //CS_TODO { - int newStudyId = getApp()->activeStudy()->id(); - DEBTRACE("HEXABLOCKGUI::studyActivated " << _oldStudyId << " " << newStudyId); + int newStudyId = getApp()->activeStudy()->id(); + DEBTRACE("HEXABLOCKGUI::studyActivated " << _oldStudyId << " " << newStudyId); - if (_oldStudyId != -1) - { -// _studyContextMap[_oldStudyId] = QtGuiContext::getQtCurrent(); -// if (_studyContextMap.count(newStudyId)) -// { -// DEBTRACE("switch to valid context " << QtGuiContext::getQtCurrent() << " " << _studyContextMap[newStudyId]); -// QtGuiContext::setQtCurrent(_studyContextMap[newStudyId]); -// } -// else -// { -// DEBTRACE("no switch to null context"); -// } - } - _oldStudyId = newStudyId; + if (_oldStudyId != -1) + { + // _studyContextMap[_oldStudyId] = QtGuiContext::getQtCurrent(); + // if (_studyContextMap.count(newStudyId)) + // { + // DEBTRACE("switch to valid context " << QtGuiContext::getQtCurrent() << " " << _studyContextMap[newStudyId]); + // QtGuiContext::setQtCurrent(_studyContextMap[newStudyId]); + // } + // else + // { + // DEBTRACE("no switch to null context"); + // } + } + _oldStudyId = newStudyId; } void HEXABLOCKGUI::treeContextMenu(const QPoint& aPosition) { - QModelIndex currentIndex = _patternDataTreeView->currentIndex(); - QVariant currentAssocVariant; - QString currentAssocEntry; - - currentAssocVariant = currentIndex.data( HEXA_ASSOC_ENTRY_ROLE ); - currentAssocEntry = currentIndex.data( HEXA_ASSOC_ENTRY_ROLE ).toString(); - if ( currentAssocVariant.isValid() && !currentAssocEntry.isEmpty() ){ - // _currentModel->allowEdition(); - QMenu menu( _patternDataTreeView ); - //Remove association - QAction *clearAct = menu.addAction( "Remove association(s)" ); - connect( clearAct, SIGNAL(triggered()), this, SLOT(clearAssociations()) ); - menu.exec( _patternDataTreeView->mapToGlobal( aPosition) ); - } - else { + QModelIndex currentIndex = _patternDataTreeView->currentIndex(); + QVariant currentAssocVariant; + QString currentAssocEntry; + + currentAssocVariant = currentIndex.data( HEXA_ASSOC_ENTRY_ROLE ); + currentAssocEntry = currentIndex.data( HEXA_ASSOC_ENTRY_ROLE ).toString(); + if ( currentAssocVariant.isValid() && !currentAssocEntry.isEmpty() ){ + // getCurrentModel()->allowEdition(); + QMenu menu( _patternDataTreeView ); + //Remove association + QAction *clearAct = menu.addAction( "Remove association(s)" ); + connect( clearAct, SIGNAL(triggered()), this, SLOT(clearAssociations()), Qt::UniqueConnection ); + menu.exec( _patternDataTreeView->mapToGlobal( aPosition) ); + } + else { - QStandardItem *item = _patternDataModel->itemFromIndex ( currentIndex ); + VtkDocumentGraphicView* currentVtkGraphicView = getCurrentVtkGraphicView(); + if (currentVtkGraphicView == NULL) return; + QStandardItem *item = currentVtkGraphicView->getPatternDataModel()->itemFromIndex(currentIndex); - //We don't do anything for single items - if ( item->type() == VERTEXITEM || item->type() == EDGEITEM || - item->type() == QUADITEM || item->type() == HEXAITEM) - return; + //We don't do anything for single items + if ( item->type() == VERTEXITEM || item->type() == EDGEITEM || + item->type() == QUADITEM || item->type() == HEXAITEM) + return; - //No associations for HEXA - QVariant treeVariant = currentIndex.data( HEXA_TREE_ROLE ); - if ( !treeVariant.isValid() ) return; - int eltType = treeVariant.toInt(); - if (eltType == HEXA_DIR_TREE) return; - QMenu menu( _patternDataTreeView ); + //No associations for HEXA + QVariant treeVariant = currentIndex.data( HEXA_TREE_ROLE ); + if ( !treeVariant.isValid() ) return; + int eltType = treeVariant.toInt(); + if (eltType == HEXA_DIR_TREE) return; + QMenu menu( _patternDataTreeView ); - //Show association(s) - QAction *showAssocAct = menu.addAction( "Show associations" ); - connect( showAssocAct, SIGNAL(triggered()), this, SLOT(showAssociations()) ); + //Show association(s) + QAction *showAssocAct = menu.addAction( "Show associations" ); + connect( showAssocAct, SIGNAL(triggered()), this, SLOT(showAssociations()), Qt::UniqueConnection ); - //Clear all associations - QAction *clearAllAssocAct = menu.addAction( "Remove all associations" ); - connect( clearAllAssocAct, SIGNAL(triggered()), this, SLOT(clearAllAssociations()) ); + //Clear all associations + QAction *clearAllAssocAct = menu.addAction( "Remove all associations" ); + connect( clearAllAssocAct, SIGNAL(triggered()), this, SLOT(clearAllAssociations()), Qt::UniqueConnection ); - menu.exec( _patternDataTreeView->mapToGlobal( aPosition) ); - } + menu.exec( _patternDataTreeView->mapToGlobal( aPosition) ); + } } void HEXABLOCKGUI::createAndFillDockWidget() { - QMainWindow *aParent = application()->desktop(); - - // Create dock widget (3 dock) - - //1) *********** user input panel ( contain user's edit dialog box ) - _dwInputPanel = new QDockWidget(aParent); -// QLayout* inputLayout = new QVBoxLayout(aParent); -// _dwInputPanel->setLayout(inputLayout); -// _dwInputPanel->setWindowFlags(Qt::FramelessWindowHint); -// _dwInputPanel->setWindowFlags(Qt::WindowTitleHint); - _dwInputPanel->setVisible(false); - _dwInputPanel->setWindowTitle("Input Panel"); -// _dwInputPanel->setMinimumHeight(DWINPUT_MINIMUM_HEIGHT); - _dwInputPanel->setMinimumWidth(DWINPUT_MINIMUM_WIDTH); // --- force a minimum until display - _dwInputPanel->raise(); - -// _stacked = new QStackedWidget(_dwInputPanel); -// _dwInputPanel->setWidget(_stacked); - - _treeViewDelegate = new DocumentDelegate(_dwInputPanel); - - //2) ************* document data ( Pattern, Association, Mesh ) in treeview representation - // Pattern - _dwPattern = new QDockWidget(aParent); - // _dwPattern->installEventFilter(this); - _dwPattern->setVisible(false); - _dwPattern->setWindowTitle("Model"); - _dwPattern->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display - - QFrame* patternFrame = new QFrame(_dwPattern); - patternFrame->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - QVBoxLayout* patternLayout = new QVBoxLayout(patternFrame); - patternLayout->setSizeConstraint(QLayout::SetMaximumSize); - QSplitter *splitter = new QSplitter(Qt::Vertical,patternFrame); - _patternDataTreeView = new QTreeView(patternFrame);//_dwPattern); - _patternBuilderTreeView = new QTreeView(patternFrame); - splitter->addWidget(_patternDataTreeView); - splitter->addWidget(_patternBuilderTreeView); - patternLayout->addWidget(splitter); -// _patternDataTreeView->setMinimumHeight(DW_MINIMUM_WIDTH); - - _patternDataTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers/*QAbstractItemView::DoubleClicked*/); - _patternDataTreeView->setSelectionMode(QAbstractItemView::SingleSelection/*QAbstractItemView::MultiSelection*/);//);//QAbstractItemView::DoubleClicked, QAbstractItemView::SelectedClicked) - _patternDataTreeView->setItemDelegate(_treeViewDelegate); - - - _patternBuilderTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); - _patternBuilderTreeView->setItemDelegate(_treeViewDelegate); - _dwPattern->setWidget(patternFrame); - patternFrame->show(); - //_dwPattern->raise(); - - // Groups - _dwGroups = new QDockWidget(aParent); -// _dwGroups->installEventFilter(this); - - _dwGroups->setVisible(false); - _dwGroups->setWindowTitle("Groups"); - _dwGroups->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display - _groupsTreeView = new QTreeView(_dwGroups); -// _associationTreeView->setMinimumHeight(DW_MINIMUM_WIDTH); - _groupsTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); - _groupsTreeView->setItemDelegate(_treeViewDelegate); - _dwGroups->setWidget(_groupsTreeView); - _groupsTreeView->show(); - - // Mesh - _dwMesh = new QDockWidget(aParent); -// _dwMesh->installEventFilter(this); - _dwMesh->setVisible(false); - _dwMesh->setWindowTitle("Mesh"); - _dwMesh->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display - _meshTreeView = new QTreeView(_dwMesh); - // _meshTreeView->setMinimumHeight(DW_MINIMUM_WIDTH); - _meshTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); - _meshTreeView->setSelectionMode(QAbstractItemView::SingleSelection); - _meshTreeView->setItemDelegate(_treeViewDelegate); - _dwMesh->setWidget(_meshTreeView); - _meshTreeView->show(); - // _dwMesh->raise(); - - - - //3) ************* documents ( salome objectbrowser ) - QDockWidget *_dwObjectBrowser = 0; - QWidget* wid = getApp()->objectBrowser()->treeView(); - // QWidget *wid = application()->objectBrowser()->treeView(); - QWidget *w = wid->parentWidget(); - while ( w && !_dwObjectBrowser ) { - _dwObjectBrowser = ::qobject_cast( w ); - w = w->parentWidget(); - } -// _dwObjectBrowser->installEventFilter(this); -// _dwObjectBrowser->setVisible(false); - _dwObjectBrowser->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display - _dwObjectBrowser->setWindowTitle("Study"); - - - // dock widget position - // aParent->addDockWidget(Qt::LeftDockWidgetArea, _dwPattern); - // aParent->addDockWidget(Qt::RightDockWidgetArea, _dwInputPanel); - // aParent->addDockWidget( Qt::LeftDockWidgetArea, _dwPattern ); - aParent->addDockWidget( Qt::LeftDockWidgetArea, _dwObjectBrowser ); - aParent->addDockWidget( Qt::LeftDockWidgetArea, _dwInputPanel ); - - aParent->tabifyDockWidget( _dwObjectBrowser, _dwPattern ); -// aParent->tabifyDockWidget( _dwPattern, /*_dwAssociation ); -// aParent->tabifyDockWidget( _dwAssociation, */_dwGroups ); - aParent->tabifyDockWidget( _dwPattern, _dwGroups ); - aParent->tabifyDockWidget( _dwGroups, _dwMesh ); + QMainWindow *aParent = application()->desktop(); + + // Create dock widget (3 dock) + + //1) *********** user input panel ( contain user's edit dialog box ) + _dwInputPanel = new QDockWidget(aParent); + // QLayout* inputLayout = new QVBoxLayout(aParent); + // _dwInputPanel->setLayout(inputLayout); + // _dwInputPanel->setWindowFlags(Qt::FramelessWindowHint); + // _dwInputPanel->setWindowFlags(Qt::WindowTitleHint); + _dwInputPanel->setVisible(false); + _dwInputPanel->setWindowTitle("Input Panel"); + // _dwInputPanel->setMinimumHeight(DWINPUT_MINIMUM_HEIGHT); + _dwInputPanel->setMinimumWidth(DWINPUT_MINIMUM_WIDTH); // --- force a minimum until display +// _dwInputPanel->raise(); + + // _stacked = new QStackedWidget(_dwInputPanel); + // _dwInputPanel->setWidget(_stacked); + + _treeViewDelegate = new DocumentDelegate(_dwInputPanel); + + //2) ************* document data ( Pattern, Association, Mesh ) in treeview representation + // Pattern + _dwPattern = new QDockWidget(aParent); + // _dwPattern->installEventFilter(this); + _dwPattern->setVisible(false); + _dwPattern->setWindowTitle("Model"); + _dwPattern->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display + + QFrame* patternFrame = new QFrame(_dwPattern); + patternFrame->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); + QVBoxLayout* patternLayout = new QVBoxLayout(patternFrame); + patternLayout->setSizeConstraint(QLayout::SetMaximumSize); + QSplitter *splitter = new QSplitter(Qt::Vertical,patternFrame); + _patternDataTreeView = new QTreeView(patternFrame);//_dwPattern); + _patternBuilderTreeView = new QTreeView(patternFrame); + _patternGeomTreeView = new QTreeView(patternFrame); + splitter->addWidget(_patternDataTreeView); + splitter->addWidget(_patternBuilderTreeView); + splitter->addWidget(_patternGeomTreeView); + patternLayout->addWidget(splitter); + // _patternDataTreeView->setMinimumHeight(DW_MINIMUM_WIDTH); + + _patternDataTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers/*QAbstractItemView::DoubleClicked*/); + _patternDataTreeView->setSelectionMode(QAbstractItemView::SingleSelection/*QAbstractItemView::MultiSelection*/);//);//QAbstractItemView::DoubleClicked, QAbstractItemView::SelectedClicked) + _patternDataTreeView->setItemDelegate(_treeViewDelegate); + + + _patternBuilderTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); + _patternBuilderTreeView->setItemDelegate(_treeViewDelegate); + + _patternGeomTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); + _patternGeomTreeView->setSelectionMode(QAbstractItemView::SingleSelection/*QAbstractItemView::MultiSelection*/); + + _dwPattern->setWidget(patternFrame); + patternFrame->show(); + //_dwPattern->raise(); + + // Groups + _dwGroups = new QDockWidget(aParent); + // _dwGroups->installEventFilter(this); + + _dwGroups->setVisible(false); + _dwGroups->setWindowTitle("Groups"); + _dwGroups->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display + _groupsTreeView = new QTreeView(_dwGroups); + // _associationTreeView->setMinimumHeight(DW_MINIMUM_WIDTH); + _groupsTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); + _groupsTreeView->setItemDelegate(_treeViewDelegate); + _dwGroups->setWidget(_groupsTreeView); + _groupsTreeView->show(); + + // Mesh + _dwMesh = new QDockWidget(aParent); + // _dwMesh->installEventFilter(this); + _dwMesh->setVisible(false); + _dwMesh->setWindowTitle("Mesh"); + _dwMesh->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display + _meshTreeView = new QTreeView(_dwMesh); + // _meshTreeView->setMinimumHeight(DW_MINIMUM_WIDTH); + _meshTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); + _meshTreeView->setSelectionMode(QAbstractItemView::SingleSelection); + _meshTreeView->setItemDelegate(_treeViewDelegate); + _dwMesh->setWidget(_meshTreeView); + _meshTreeView->show(); + // _dwMesh->raise(); + + + + //3) ************* documents ( salome objectbrowser ) + QDockWidget *_dwObjectBrowser = 0; + QWidget* wid = getApp()->objectBrowser()->treeView(); + // QWidget *wid = application()->objectBrowser()->treeView(); + QWidget *w = wid->parentWidget(); + while ( w && !_dwObjectBrowser ) { + _dwObjectBrowser = ::qobject_cast( w ); + w = w->parentWidget(); + } + // _dwObjectBrowser->installEventFilter(this); + // _dwObjectBrowser->setVisible(false); + _dwObjectBrowser->setMinimumWidth(DW_MINIMUM_WIDTH); // --- force a minimum until display + _dwObjectBrowser->setWindowTitle("Study"); + + + // dock widget position + // aParent->addDockWidget(Qt::LeftDockWidgetArea, _dwPattern); + // aParent->addDockWidget(Qt::RightDockWidgetArea, _dwInputPanel); + // aParent->addDockWidget( Qt::LeftDockWidgetArea, _dwPattern ); + aParent->addDockWidget( Qt::LeftDockWidgetArea, _dwObjectBrowser ); + aParent->addDockWidget( Qt::LeftDockWidgetArea, _dwInputPanel ); + + aParent->tabifyDockWidget( _dwObjectBrowser, _dwPattern ); + // aParent->tabifyDockWidget( _dwPattern, /*_dwAssociation ); + // aParent->tabifyDockWidget( _dwAssociation, */_dwGroups ); + aParent->tabifyDockWidget( _dwPattern, _dwGroups ); + aParent->tabifyDockWidget( _dwGroups, _dwMesh ); #if QT_VERSION >= 0x040500 - aParent->setTabPosition(Qt::AllDockWidgetAreas, Resource::tabPanelsUp? QTabWidget::North: QTabWidget::South); + aParent->setTabPosition(Qt::AllDockWidgetAreas, Resource::tabPanelsUp? QTabWidget::North: QTabWidget::South); #endif -// connect( _dwPattern, SIGNAL( visibilityChanged(bool) ), this, SLOT( showPatternMenus(bool) ) ); -// // connect( _dwAssociation, SIGNAL( visibilityChanged(bool) ), this, SLOT( showAssociationMenus(bool) ) ); -// connect( _dwGroups, SIGNAL( visibilityChanged(bool) ), this, SLOT( showGroupsMenus(bool) ) ); -// connect( _dwMesh, SIGNAL( visibilityChanged(bool) ), this, SLOT( showMeshMenus(bool) ) ); + // connect( _dwPattern, SIGNAL( visibilityChanged(bool) ), this, SLOT( showPatternMenus(bool) ) ); + // // connect( _dwAssociation, SIGNAL( visibilityChanged(bool) ), this, SLOT( showAssociationMenus(bool) ) ); + // connect( _dwGroups, SIGNAL( visibilityChanged(bool) ), this, SLOT( showGroupsMenus(bool) ) ); + // connect( _dwMesh, SIGNAL( visibilityChanged(bool) ), this, SLOT( showMeshMenus(bool) ) ); - // popup menu on data tree view - _patternDataTreeView->setContextMenuPolicy(Qt::CustomContextMenu); - connect(_patternDataTreeView, - SIGNAL(customContextMenuRequested(const QPoint &)), - this, - SLOT(treeContextMenu(const QPoint &))); + // popup menu on data tree view + _patternDataTreeView->setContextMenuPolicy(Qt::CustomContextMenu); + connect(_patternDataTreeView, + SIGNAL(customContextMenuRequested(const QPoint &)), + this, + SLOT(treeContextMenu(const QPoint &)), Qt::UniqueConnection); } void HEXABLOCKGUI::createActions() { - QMainWindow *aParent = application()->desktop(); - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - - // Document - _newAct = createAction(_menuId++, - tr("Create a new document"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_NEW_DOCUMENT")), - tr("New Document"), - tr("Create a new document"), - 0, aParent, false, this, SLOT(newDocument())); - _newAct->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_N ); // --- QKeySequence::New ambiguous in SALOME - - _importAct = createAction(_menuId++, - tr("Load a document"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_LOAD_DOCUMENT")), - tr("Load Document"), - tr("Load a document"), - 0, aParent, false, this, SLOT(loadDocument())); - _importAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O); // --- QKeySequence::Open ambiguous in SALOME - - _saveAct = createAction(_menuId++, - tr("Save the document"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_SAVE_DOCUMENT")), - tr("Save Document"), - tr("Save the document"), - 0, aParent, false, this, SLOT(saveDocument())); - -// _testAct = createAction(_menuId++, tr("Test"), resMgr->loadPixmap("HEXABLOCK", tr("ICON_TEST")), -// tr("Test"), tr("New test"), -// 0, aParent, false, this, SLOT(test_association())); - - // Pattern Data creation - _addVertex = createAction(_menuId++, - tr("Create a vertex"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_VERTEX")), - tr("Add Vertex"), - tr("Create a new vertex"), - 0, aParent, false, this, SLOT(addVertex())); - - _addEdge = createAction(_menuId++, - tr("Create an edge"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_EDGE")), - tr("Add Edge"), - tr("Create a new edge"), - 0, aParent, false, this, SLOT(addEdge())); - - _addQuad = createAction(_menuId++, - tr("Create a quadrangle"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_QUAD")), - tr("Add Quadrangle"), - tr("Create a new quadrangle"), - 0, aParent, false, this, SLOT(addQuad())); - - _addHexa = createAction(_menuId++, - tr("Create an hexahedron"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_HEXA")), - tr("Add Hexahedron"), - tr("Create a new hexahedron"), - 0, aParent, false, this, SLOT(addHexa())); - - // Builder Data creation - _addVector = createAction(_menuId++, - tr("Create a vector"), - resMgr->loadPixmap( "HEXABLOCK", tr("ICON_ADD_VECTOR")), - tr("Add Vector"), - tr("Create a new vector"), - 0, aParent, false, this, SLOT(addVector())); - - _addCylinder = createAction(_menuId++, - tr("Create a cylinder"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_CYLINDER")), - tr("Add Cylinder"), - tr("Create a new cylinder"), - 0, aParent, false, this, SLOT(addCylinder())); - - _addPipe = createAction(_menuId++, - tr("Create a pipe"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_PIPE")), - tr("Add Pipe"), - tr("Create a new pipe"), - 0, aParent, false, this, SLOT(addPipe())); - - _makeGrid = createAction(_menuId++, - tr("Make a grid"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_GRID")), - tr("Make Grid"), - tr("Make a grid"), - 0, aParent, false, this, SLOT(makeGrid())); - - _makeCylinder = createAction(_menuId++, - tr("Make a cylinder"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_CYLINDER")), - tr("Make Cylinder"), - tr("Make a cylinder"), - 0, aParent, false, this, SLOT(makeCylinder())); - - _makePipe = createAction(_menuId++, - tr("Make a pipe"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_PIPE")), - tr("Make Pipe"), - tr("Make a pipe"), - 0, aParent, false, this, SLOT(makePipe())); - - _makeCylinders = createAction(_menuId++, - tr("Make cylinders"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_CYLINDERS")), - tr("Make Cylinders"), - tr("Make cylinders"), - 0, aParent, false, this, SLOT(makeCylinders())); - - _makePipes = createAction(_menuId++, - tr("Make pipes"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_PIPES")), - tr("Make Pipes"), - tr("Make pipes"), - 0, aParent, false, this, SLOT(makePipes())); - -// // _makeRind = createAction( _menuId++, tr("Make rind"), resMgr->loadPixmap( "HEXABLOCK", tr("ICON_MAKE_RIND")), -// // tr("Make rind"), tr("Make rind"), -// // 0, aParent, false, this, SLOT(makeRind())); - - _makeHemiSphere = createAction(_menuId++, - tr("Make an hemisphere"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_HEMISPHERE")), - tr("Make Hemisphere"), - tr("Make an hemisphere"), - 0, aParent, false, this, SLOT(makeHemiSphere())); - - // Pattern Data edition - _removeHexa = createAction(_menuId++, - tr("Remove hexahedra"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_REMOVE_HEXA")), - tr("Remove Hexahedra"), - tr("Remove hexahedra"), - 0, aParent, false, this, SLOT(removeHexa())); - - _prismQuad = createAction(_menuId++, - tr("Prism quadrangles"), - resMgr->loadPixmap( "HEXABLOCK", tr("ICON_PRISM_QUAD")), - tr("Prism Quadrangles"), - tr("Prism quadrangles"), - 0, aParent, false, this, SLOT(prismQuad())); - - _joinQuad = createAction(_menuId++, - tr("Join quadrangles"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_JOIN_QUAD")), - tr("Join Quadrangles"), - tr("Join quadrangles with hexahedra"), - 0, aParent, false, this, SLOT(joinQuad())); - - _merge = createAction(_menuId++, - tr("Merge"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_MERGE")), - tr("Merge"), - tr("Merge"), - 0, aParent, false, this, SLOT(merge())); - - _disconnect = createAction(_menuId++, - tr("Disconnect"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_DISCONNECT")), - tr("Disconnect"), - tr("Disconnect edges, vertexes or quadrangles"), - 0, aParent, false, this, SLOT(disconnectElts())); - - _cutEdge = createAction(_menuId++, - tr("Cut edge"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_CUT_EDGE")), - tr("Cut Edge"), - tr("Cut edge"), - 0, aParent, false, this, SLOT(cutEdge())); - - _makeTransformation = createAction(_menuId++, - tr("Make transformation"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_TRANSFORMATION")), - tr("Make Transformation"), - tr("Make transformation"), - 0, aParent, false, this, SLOT(makeTransformation())); - - _makeSymmetry = createAction(_menuId++, - tr("Make symmetry"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_SYMMETRY")), - tr("Make Symmetry"), - tr("Make symmetry"), - 0, aParent, false, this, SLOT(makeSymmetry())); - - _performTransformation = createAction(_menuId++, - tr("Perform transformation"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_PERFORM_TRANSFORMATION")), - tr("Perform Transformation"), - tr("Perform transformation"), - 0, aParent, false, this, SLOT(performTransformation())); - - _performSymmetry = createAction(_menuId++, - tr("Perform symmetry"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_PERFORM_SYMMETRY")), - tr("Perform Symmetry"), - tr("Perform symmetry"), - 0, aParent, false, this, SLOT(performSymmetry())); - - _replaceHexa = createAction(_menuId++, - tr("Replace hexahedron"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_REPLACE_HEXA")), - tr("Replace Hexahedron"), - tr("Replace hexahedron"), - 0, aParent, false, this, SLOT(replaceHexa())); - - _quadRevolution = createAction(_menuId++, - tr("Quad revolution"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_QUAD_REVOLUTION")), - tr("Quad Revolution"), - tr("Quad revolution"), - 0, aParent, false, this, SLOT(quadRevolution())); - - // Association - _assocVertex = createAction(_menuId++, - tr("Make vertex association"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_VERTEX_ASSOCIATION")), - tr("Make Vertex association"), - tr("Make vertex association"), - 0, aParent, false, this, SLOT(assocVertex())); - - _assocEdge = createAction(_menuId++, - tr("Make edge association"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_EDGE_ASSOCIATION")), - tr("Make Edge Association"), - tr("Make edge association"), - 0, aParent, false, this, SLOT(assocEdge())); - - _assocQuad = createAction(_menuId++, - tr("Make quadrangle association"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_QUAD_ASSOCIATION")), - tr("Make Quadrangle Association"), - tr("Make quadrangle association"), - 0, aParent, false, this, SLOT(assocQuad())); - - // Group - _addGroup = createAction(_menuId++, - tr("Add a group"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_GROUP")), - tr("Add Group"), - tr("Add a group"), - 0, aParent, false, this, SLOT(addGroup())); - - _removeGroup = createAction(_menuId++, - tr("Remove a group"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_REMOVE_GROUP")), - tr("Remove Group"), - tr("Remove a group"), - 0, aParent, false, this, SLOT(removeGroup())); - - // Mesh - _addLaw = createAction(_menuId++, - tr("Add a law"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_LAW")), - tr("Add Law"), - tr("Add a law"), - 0, aParent, false, this, SLOT(addLaw())); - - _removeLaw = createAction(_menuId++, - tr("Remove a law"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_REMOVE_LAW")), - tr("Remove Law"), - tr("Remove a law"), - 0, aParent, false, this, SLOT(removeLaw())); - - _setPropagation = createAction(_menuId++, - tr("Set propagation"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_SET_PROPAGATION")), - tr("Set Propagation"), - tr("Set propagation"), - 0, aParent, false, this, SLOT(setPropagation())); - - _computeMesh = createAction(_menuId++, - tr("Compute mesh"), - resMgr->loadPixmap("HEXABLOCK", tr("ICON_COMPUTE_MESH")), - tr("Compute Mesh"), - tr("Compute mesh"), - 0, aParent, false, this, SLOT(computeMesh())); - - - // _newAct->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_N ); // --- QKeySequence::New ambiguous in SALOME - // QAction* createAction(const int id, - // const QString& toolTip, - // const QIcon& icon, - // const QString& menu, - // const QString& status, - // const int shortCut, - // QObject* parent =0, - // bool checkable = false, - // QObject* receiver =0, - // const char* member =0); + QMainWindow *aParent = application()->desktop(); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + + // Document + _newAct = createAction(_menuId++, + tr("Create a new document"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_NEW_DOCUMENT")), + tr("New Document"), + tr("Create a new document"), + 0, aParent, false, this, SLOT(newDocument())); + _newAct->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_N ); // --- QKeySequence::New ambiguous in SALOME + + _importAct = createAction(_menuId++, + tr("Load a document"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_LOAD_DOCUMENT")), + tr("Load Document"), + tr("Load a document"), + 0, aParent, false, this, SLOT(loadDocument())); + _importAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O); // --- QKeySequence::Open ambiguous in SALOME + + _saveAct = createAction(_menuId++, + tr("Save the document"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_SAVE_DOCUMENT")), + tr("Save Document"), + tr("Save the document"), + 0, aParent, false, this, SLOT(saveDocument())); + + // _testAct = createAction(_menuId++, tr("Test"), resMgr->loadPixmap("HEXABLOCK", tr("ICON_TEST")), + // tr("Test"), tr("New test"), + // 0, aParent, false, this, SLOT(test_association())); + + // Pattern Data creation + _addVertex = createAction(_menuId++, + tr("Create a vertex"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_VERTEX")), + tr("Add Vertex"), + tr("Create a new vertex"), + 0, aParent, false, this, SLOT(addVertex())); + + _addEdge = createAction(_menuId++, + tr("Create an edge"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_EDGE")), + tr("Add Edge"), + tr("Create a new edge"), + 0, aParent, false, this, SLOT(addEdge())); + + _addQuad = createAction(_menuId++, + tr("Create a quadrangle"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_QUAD")), + tr("Add Quadrangle"), + tr("Create a new quadrangle"), + 0, aParent, false, this, SLOT(addQuad())); + + _addHexa = createAction(_menuId++, + tr("Create an hexahedron"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_HEXA")), + tr("Add Hexahedron"), + tr("Create a new hexahedron"), + 0, aParent, false, this, SLOT(addHexa())); + + // Builder Data creation + _addVector = createAction(_menuId++, + tr("Create a vector"), + resMgr->loadPixmap( "HEXABLOCK", tr("ICON_ADD_VECTOR")), + tr("Add Vector"), + tr("Create a new vector"), + 0, aParent, false, this, SLOT(addVector())); + + _addCylinder = createAction(_menuId++, + tr("Create a cylinder"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_CYLINDER")), + tr("Add Cylinder"), + tr("Create a new cylinder"), + 0, aParent, false, this, SLOT(addCylinder())); + + _addPipe = createAction(_menuId++, + tr("Create a pipe"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_PIPE")), + tr("Add Pipe"), + tr("Create a new pipe"), + 0, aParent, false, this, SLOT(addPipe())); + + _makeGrid = createAction(_menuId++, + tr("Make a grid"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_GRID")), + tr("Make Grid"), + tr("Make a grid"), + 0, aParent, false, this, SLOT(makeGrid())); + + _makeCylinder = createAction(_menuId++, + tr("Make a cylinder"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_CYLINDER")), + tr("Make Cylinder"), + tr("Make a cylinder"), + 0, aParent, false, this, SLOT(makeCylinder())); + + _makePipe = createAction(_menuId++, + tr("Make a pipe"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_PIPE")), + tr("Make Pipe"), + tr("Make a pipe"), + 0, aParent, false, this, SLOT(makePipe())); + + _makeCylinders = createAction(_menuId++, + tr("Make cylinders"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_CYLINDERS")), + tr("Make Cylinders"), + tr("Make cylinders"), + 0, aParent, false, this, SLOT(makeCylinders())); + + _makePipes = createAction(_menuId++, + tr("Make pipes"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_PIPES")), + tr("Make Pipes"), + tr("Make pipes"), + 0, aParent, false, this, SLOT(makePipes())); + + // // _makeRind = createAction( _menuId++, tr("Make rind"), resMgr->loadPixmap( "HEXABLOCK", tr("ICON_MAKE_RIND")), + // // tr("Make rind"), tr("Make rind"), + // // 0, aParent, false, this, SLOT(makeRind())); + + _makeHemiSphere = createAction(_menuId++, + tr("Make an hemisphere"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_HEMISPHERE")), + tr("Make Hemisphere"), + tr("Make an hemisphere"), + 0, aParent, false, this, SLOT(makeHemiSphere())); + + // Pattern Data edition + _removeHexa = createAction(_menuId++, + tr("Remove hexahedra"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_REMOVE_HEXA")), + tr("Remove Hexahedra"), + tr("Remove hexahedra"), + 0, aParent, false, this, SLOT(removeHexa())); + + _prismQuad = createAction(_menuId++, + tr("Prism quadrangles"), + resMgr->loadPixmap( "HEXABLOCK", tr("ICON_PRISM_QUAD")), + tr("Prism Quadrangles"), + tr("Prism quadrangles"), + 0, aParent, false, this, SLOT(prismQuad())); + + _joinQuad = createAction(_menuId++, + tr("Join quadrangles"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_JOIN_QUAD")), + tr("Join Quadrangles"), + tr("Join quadrangles with hexahedra"), + 0, aParent, false, this, SLOT(joinQuad())); + + _merge = createAction(_menuId++, + tr("Merge"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_MERGE")), + tr("Merge"), + tr("Merge"), + 0, aParent, false, this, SLOT(merge())); + + _disconnect = createAction(_menuId++, + tr("Disconnect"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_DISCONNECT")), + tr("Disconnect"), + tr("Disconnect edges, vertexes or quadrangles"), + 0, aParent, false, this, SLOT(disconnectElts())); + + _cutEdge = createAction(_menuId++, + tr("Cut edge"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_CUT_EDGE")), + tr("Cut Edge"), + tr("Cut edge"), + 0, aParent, false, this, SLOT(cutEdge())); + + _makeTransformation = createAction(_menuId++, + tr("Make transformation"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_TRANSFORMATION")), + tr("Make Transformation"), + tr("Make transformation"), + 0, aParent, false, this, SLOT(makeTransformation())); + + _makeSymmetry = createAction(_menuId++, + tr("Make symmetry"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_MAKE_SYMMETRY")), + tr("Make Symmetry"), + tr("Make symmetry"), + 0, aParent, false, this, SLOT(makeSymmetry())); + + _performTransformation = createAction(_menuId++, + tr("Perform transformation"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_PERFORM_TRANSFORMATION")), + tr("Perform Transformation"), + tr("Perform transformation"), + 0, aParent, false, this, SLOT(performTransformation())); + + _performSymmetry = createAction(_menuId++, + tr("Perform symmetry"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_PERFORM_SYMMETRY")), + tr("Perform Symmetry"), + tr("Perform symmetry"), + 0, aParent, false, this, SLOT(performSymmetry())); + + _replaceHexa = createAction(_menuId++, + tr("Replace hexahedron"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_REPLACE_HEXA")), + tr("Replace Hexahedron"), + tr("Replace hexahedron"), + 0, aParent, false, this, SLOT(replaceHexa())); + + _quadRevolution = createAction(_menuId++, + tr("Quad revolution"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_QUAD_REVOLUTION")), + tr("Quad Revolution"), + tr("Quad revolution"), + 0, aParent, false, this, SLOT(quadRevolution())); + + // Association + _assocVertex = createAction(_menuId++, + tr("Make vertex association"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_VERTEX_ASSOCIATION")), + tr("Make Vertex association"), + tr("Make vertex association"), + 0, aParent, false, this, SLOT(assocVertex())); + + _assocEdge = createAction(_menuId++, + tr("Make edge association"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_EDGE_ASSOCIATION")), + tr("Make Edge Association"), + tr("Make edge association"), + 0, aParent, false, this, SLOT(assocEdge())); + + _assocQuad = createAction(_menuId++, + tr("Make quadrangle association"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_QUAD_ASSOCIATION")), + tr("Make Quadrangle Association"), + tr("Make quadrangle association"), + 0, aParent, false, this, SLOT(assocQuad())); + + // Group + _addGroup = createAction(_menuId++, + tr("Add a group"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_GROUP")), + tr("Add Group"), + tr("Add a group"), + 0, aParent, false, this, SLOT(addGroup())); + + _removeGroup = createAction(_menuId++, + tr("Remove a group"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_REMOVE_GROUP")), + tr("Remove Group"), + tr("Remove a group"), + 0, aParent, false, this, SLOT(removeGroup())); + + // Mesh + _addLaw = createAction(_menuId++, + tr("Add a law"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_ADD_LAW")), + tr("Add Law"), + tr("Add a law"), + 0, aParent, false, this, SLOT(addLaw())); + + _removeLaw = createAction(_menuId++, + tr("Remove a law"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_REMOVE_LAW")), + tr("Remove Law"), + tr("Remove a law"), + 0, aParent, false, this, SLOT(removeLaw())); + + _setPropagation = createAction(_menuId++, + tr("Set propagation"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_SET_PROPAGATION")), + tr("Set Propagation"), + tr("Set propagation"), + 0, aParent, false, this, SLOT(setPropagation())); + + _computeMesh = createAction(_menuId++, + tr("Compute mesh"), + resMgr->loadPixmap("HEXABLOCK", tr("ICON_COMPUTE_MESH")), + tr("Compute Mesh"), + tr("Compute mesh"), + 0, aParent, false, this, SLOT(computeMesh())); + + QPixmap pix; + _showModelInfoAct = createAction(_menuId++, + tr("Show Model Info"), + QIcon(pix), + tr("MODEL_INFO"),//TODO: must be added in translation file + tr("MODEL_INFO"), + 0, aParent, false, this, SLOT(showModelInfo())); + + _addShapeAct = createAction(_menuId++, + tr("Add Shape"), + QIcon(pix), + tr("ADD_SHAPE"),//TODO: must be added in translation file + tr("ADD_SHAPE"), + 0, aParent, false, this, SLOT(addShape())); + + //Show actor +// _showAct = createAction(_menuId++, +// tr("Show"), +// QIcon(pix), +// tr("Show"), +// tr("Show the actor"), +// 0, aParent, false, this, SLOT(showActor())); + //Hide actor +// _hideAct = createAction(_menuId++, +// tr("Hide"), +// QIcon(pix), +// tr("Hide"), +// tr("Hide the actor"), +// 0, aParent, false, this, SLOT(hideActor())); + + //Show only +// _showOnlyAct = createAction(_menuId++, +// tr("Show Only"), +// QIcon(pix), +// tr("Show Only"), +// tr("Show only this actor"), +// 0, aParent, false, this, SLOT(showOnlyActor())); + + + // _newAct->setShortcut( Qt::CTRL + Qt::SHIFT + Qt::Key_N ); // --- QKeySequence::New ambiguous in SALOME + // QAction* createAction(const int id, + // const QString& toolTip, + // const QIcon& icon, + // const QString& menu, + // const QString& status, + // const int shortCut, + // QObject* parent =0, + // bool checkable = false, + // QObject* receiver =0, + // const char* member =0); } void HEXABLOCKGUI::createMenus() { - int aMenuId, subMenuId; - aMenuId = createMenu( tr("MEN_FILE"), -1, -1 ); - createMenu( separator(), aMenuId, -1, 10 ); - aMenuId = createMenu( tr("HEXABLOCK"), aMenuId, -1, 10 ); - createMenu( _newAct, aMenuId ); - createMenu( _importAct, aMenuId ); - createMenu( _saveAct, aMenuId ); -// createMenu( _testAct, aMenuId ); - -// aMenuId = createMenu( tr( "HEXABLOCK" ), -1, -1, 30 ); - aMenuId = createMenu( tr( "Document" ), -1, -1, 30 ); - createMenu( _newAct, aMenuId );//, 10 - createMenu( _importAct, aMenuId ); - createMenu( _saveAct, aMenuId ); -// createMenu( _testAct, aMenuId ); - - aMenuId = createMenu( tr("Model"), -1, -1, 30 ); - subMenuId = createMenu( tr( "Construction" ), aMenuId, -1 ); - createMenu( _addVertex, subMenuId ); - createMenu( _addEdge, subMenuId ); - createMenu( _addQuad, subMenuId ); - createMenu( _addHexa, subMenuId ); - //createMenu( separator(), aMenuId); - - // Pattern Builder - createMenu( _addVector, subMenuId ); - createMenu( _addCylinder, subMenuId ); - createMenu( _addPipe, subMenuId ); - //createMenu( separator(), aMenuId); - createMenu( _makeGrid, subMenuId ); //Cartesian, Cylindrical, Spherical - createMenu( _makeCylinder, subMenuId ); - createMenu( _makePipe, subMenuId ); - createMenu( _makeCylinders,subMenuId ); - createMenu( _makePipes, subMenuId ); -// createMenu( _makeRind, aMenuId ); - createMenu( _makeHemiSphere,subMenuId ); - //createMenu( separator(), aMenuId); - - // Pattern Data Edition - subMenuId = createMenu( tr( "Operation" ), aMenuId, -1 ); - createMenu( _removeHexa, subMenuId ); - createMenu( _prismQuad, subMenuId ); - createMenu( _joinQuad, subMenuId ); - createMenu( _merge, subMenuId );// createMenu( _mergeVertices, aMenuId ); // createMenu( _mergeEdges, aMenuId ); - createMenu( _disconnect, subMenuId ); - createMenu( _cutEdge, subMenuId ); - createMenu( _makeTransformation, subMenuId ); // createMenu( _makeTranslation, aMenuId ); - createMenu( _makeSymmetry, subMenuId ); - createMenu( _performTransformation, subMenuId ); - createMenu( _performSymmetry, subMenuId ); - createMenu( _replaceHexa, subMenuId ); - createMenu( _quadRevolution, subMenuId ); - - // Association - aMenuId = createMenu( tr("Association"), -1, -1, 30 ); - createMenu( _assocVertex, aMenuId ); - createMenu( _assocEdge, aMenuId ); - createMenu( _assocQuad, aMenuId ); - - // Group - aMenuId = createMenu( tr("Groups"), -1, -1, 30 ); - createMenu( _addGroup, aMenuId ); - createMenu( _removeGroup, aMenuId ); //CS_TODO - - // Law - aMenuId = createMenu( tr("Mesh "), -1, -1, 30 ); - createMenu( _addLaw, aMenuId ); - createMenu( _removeLaw, aMenuId ); - createMenu( _setPropagation, aMenuId ); - createMenu( _computeMesh, aMenuId ); + int aMenuId, subMenuId; + aMenuId = createMenu( tr("MEN_FILE"), -1, -1 ); + createMenu( separator(), aMenuId, -1, 10 ); + aMenuId = createMenu( tr("HEXABLOCK"), aMenuId, -1, 10 ); + createMenu( _newAct, aMenuId ); + createMenu( _importAct, aMenuId ); + createMenu( _saveAct, aMenuId ); + // createMenu( _testAct, aMenuId ); + + // aMenuId = createMenu( tr( "HEXABLOCK" ), -1, -1, 30 ); + aMenuId = createMenu( tr( "Document" ), -1, -1, 30 ); + createMenu( _newAct, aMenuId );//, 10 + createMenu( _importAct, aMenuId ); + createMenu( _saveAct, aMenuId ); + // createMenu( _testAct, aMenuId ); + + aMenuId = createMenu( tr("Model"), -1, -1, 30 ); + subMenuId = createMenu( tr( "Construction" ), aMenuId, -1 ); + createMenu( _addVertex, subMenuId ); + createMenu( _addEdge, subMenuId ); + createMenu( _addQuad, subMenuId ); + createMenu( _addHexa, subMenuId ); + createMenu( separator(), subMenuId ); + + // Pattern Builder + createMenu( _addVector, subMenuId ); + createMenu( _addCylinder, subMenuId ); + createMenu( _addPipe, subMenuId ); + createMenu( separator(), subMenuId); + createMenu( _makeGrid, subMenuId ); //Cartesian, Cylindrical, Spherical + createMenu( _makeHemiSphere,subMenuId ); + createMenu( separator(), subMenuId); + createMenu( _makeCylinder, subMenuId ); + createMenu( _makePipe, subMenuId ); + createMenu( _makeCylinders,subMenuId ); + createMenu( _makePipes, subMenuId ); + // createMenu( _makeRind, aMenuId ); + + // Pattern Data Edition + subMenuId = createMenu( tr( "Operation" ), aMenuId, -1 ); + createMenu( _removeHexa, subMenuId ); + createMenu( _prismQuad, subMenuId ); + createMenu( _joinQuad, subMenuId ); + createMenu( _merge, subMenuId );// createMenu( _mergeVertices, aMenuId ); // createMenu( _mergeEdges, aMenuId ); + createMenu( _disconnect, subMenuId ); + createMenu( _cutEdge, subMenuId ); + createMenu( _makeTransformation, subMenuId ); // createMenu( _makeTranslation, aMenuId ); + createMenu( _makeSymmetry, subMenuId ); + createMenu( _performTransformation, subMenuId ); + createMenu( _performSymmetry, subMenuId ); + createMenu( _replaceHexa, subMenuId ); + createMenu( _quadRevolution, subMenuId ); + + // Association + aMenuId = createMenu( tr("Association"), -1, -1, 30 ); + createMenu( _assocVertex, aMenuId ); + createMenu( _assocEdge, aMenuId ); + createMenu( _assocQuad, aMenuId ); + + // Group + aMenuId = createMenu( tr("Groups"), -1, -1, 30 ); + createMenu( _addGroup, aMenuId ); + createMenu( _removeGroup, aMenuId ); //CS_TODO + + // Law + aMenuId = createMenu( tr("Mesh "), -1, -1, 30 ); + createMenu( _addLaw, aMenuId ); + createMenu( _removeLaw, aMenuId ); + createMenu( _setPropagation, aMenuId ); + createMenu( _computeMesh, aMenuId ); + + //show model infomation menu + QString aRule = "$component={'HEXABLOCK'}"; + popupMgr()->insert( _showModelInfoAct, -1, -1 ); // link the model information action to context menu + popupMgr()->setRule( _showModelInfoAct, aRule); + + //associate shape to a document menu + popupMgr()->insert( _addShapeAct, -1, -1 ); + popupMgr()->setRule( _addShapeAct, aRule ); + + //------------------------------------------------- + // Display / Erase + //------------------------------------------------- + // QString lc = "$"; // VSR : instead of QtxPopupSelection::defEquality(); + // QString dc = "selcount"; // VSR : instead of QtxPopupSelection::defSelCountParam() + // QString isNotEmpty("numberOfNodes <> 0"); + // QString aClient = QString( "%1client in {%2}" ).arg( lc ).arg( "'VTKViewer'" ); + // QString aType = QString( "%1type in {%2}" ).arg( lc ); + //// aType = aType.arg( mesh_part ); + // + // aClient = "($client in {'VTKViewer' 'ObjectBrowser'})"; + // QString anActiveVTK = QString("activeView = '%1'").arg(SVTK_Viewer::Type()); + // QString aSelCount = QString( "%1 > 0" ).arg( dc ); + +// popupMgr()->insert( separator(), -1, -1 ); +// QString aRule = "$component={'HEXABLOCK'}";/* and ( type='(" + aClient + " and " + +// aType + " and " + aSelCount + " and " + anActiveVTK + " and " + isNotEmpty + " %1 ) )";*/ +// // MESSAGE("aClient = " << aClient.toStdString()); +// // MESSAGE("aType = " << aType.toStdString()); +// // MESSAGE("aSelCount = " << aSelCount.toStdString()); +// // MESSAGE("anActiveVTK = " << anActiveVTK.toStdString()); +// // MESSAGE("isNotEmpty = " << isNotEmpty.toStdString()); +// // MESSAGE("aRule = " << aRule.toStdString()); +// popupMgr()->insert( _showAct, -1, -1 ); // DISPLAY +// popupMgr()->setRule( _showAct, aRule.arg( "and (not isVisible)" ), QtxPopupMgr::VisibleRule ); +// +// popupMgr()->insert( _hideAct, -1, -1 ); // ERASE +// popupMgr()->setRule( _hideAct, aRule.arg( "and isVisible" ), QtxPopupMgr::VisibleRule ); +// +// popupMgr()->insert( _showOnlyAct, -1, -1 ); // DISPLAY_ONLY +// popupMgr()->setRule(_showOnlyAct, aRule.arg( "" ), QtxPopupMgr::VisibleRule ); +// +// popupMgr()->insert( separator(), -1, -1 ); + } void HEXABLOCKGUI::createTools() { - int aToolId; - - aToolId = createTool ( tr( "HexaBlock Toolbar" ) ); - createTool( _newAct, aToolId ); - createTool( _importAct, aToolId ); - createTool( _saveAct, aToolId ); -// createTool( _testAct, aToolId ); - //createTool( separator(), aToolId ); - - // Pattern Data - aToolId = createTool ( tr( "Construction" ) ); - createTool( _addVertex, aToolId ); - createTool( _addEdge, aToolId ); - createTool( _addQuad, aToolId ); - createTool( _addHexa, aToolId ); - //createTool( separator(), aToolId ); - - // Pattern Builder - createTool( _addVector, aToolId ); - createTool( _addCylinder, aToolId ); - createTool( _addPipe, aToolId ); - //createTool( separator(), aToolId ); - - createTool( _makeGrid, aToolId ); - createTool( _makeCylinder, aToolId ); - createTool( _makePipe, aToolId ); - createTool( _makeCylinders,aToolId ); - createTool( _makePipes, aToolId ); -// createTool( _makeRind, aToolId); - createTool( _makeHemiSphere, aToolId ); - //createTool( separator(), aToolId ); - - // Pattern Data Edition - aToolId = createTool ( tr( "Operation" ) ); - createTool( _removeHexa, aToolId ); - createTool( _prismQuad, aToolId ); - createTool( _joinQuad, aToolId ); - createTool( _merge, aToolId ); - createTool( _disconnect, aToolId ); - createTool( _cutEdge, aToolId ); - createTool( _makeTransformation, aToolId ); - createTool( _makeSymmetry, aToolId ); - createTool( _performTransformation, aToolId ); - createTool( _performSymmetry, aToolId ); - createTool( _replaceHexa, aToolId ); - createTool( _quadRevolution, aToolId ); - //createTool( separator(), aToolId ); - - // Association - aToolId = createTool ( tr( "Association" ) ); - createTool( _assocVertex, aToolId ); - createTool( _assocEdge, aToolId ); - createTool( _assocQuad, aToolId ); - //createTool( separator(), aToolId ); - - // Group - aToolId = createTool ( tr( "Group" ) ); - createTool( _addGroup, aToolId ); - createTool( _removeGroup, aToolId ); //CS_TODO - //createTool( separator(), aToolId ); - - // Law - aToolId = createTool ( tr( "Mesh" ) ); - createTool( _addLaw, aToolId ); - createTool( _removeLaw, aToolId ); - createTool( _setPropagation, aToolId ); - createTool( _computeMesh, aToolId ); + int aToolId; + + aToolId = createTool ( tr( "HexaBlock Toolbar" ) ); + createTool( _newAct, aToolId ); + createTool( _importAct, aToolId ); + createTool( _saveAct, aToolId ); + // createTool( _testAct, aToolId ); + //createTool( separator(), aToolId ); + + // Pattern Data + aToolId = createTool ( tr( "Construction" ) ); + createTool( _addVertex, aToolId ); + createTool( _addEdge, aToolId ); + createTool( _addQuad, aToolId ); + createTool( _addHexa, aToolId ); + createTool( separator(), aToolId ); + + // Pattern Builder + createTool( _addVector, aToolId ); + createTool( _addCylinder, aToolId ); + createTool( _addPipe, aToolId ); + createTool( separator(), aToolId ); + + createTool( _makeGrid, aToolId ); + createTool( _makeHemiSphere, aToolId ); + createTool( separator(), aToolId ); + createTool( _makeCylinder, aToolId ); + createTool( _makePipe, aToolId ); + createTool( _makeCylinders,aToolId ); + createTool( _makePipes, aToolId ); + // createTool( _makeRind, aToolId); +// createTool( separator(), aToolId ); + + // Pattern Data Edition + aToolId = createTool ( tr( "Operation" ) ); + createTool( _removeHexa, aToolId ); + createTool( _prismQuad, aToolId ); + createTool( _joinQuad, aToolId ); + createTool( _merge, aToolId ); + createTool( _disconnect, aToolId ); + createTool( _cutEdge, aToolId ); + createTool( _makeTransformation, aToolId ); + createTool( _makeSymmetry, aToolId ); + createTool( _performTransformation, aToolId ); + createTool( _performSymmetry, aToolId ); + createTool( _replaceHexa, aToolId ); + createTool( _quadRevolution, aToolId ); + //createTool( separator(), aToolId ); + + // Association + aToolId = createTool ( tr( "Association" ) ); + createTool( _assocVertex, aToolId ); + createTool( _assocEdge, aToolId ); + createTool( _assocQuad, aToolId ); + //createTool( separator(), aToolId ); + + // Group + aToolId = createTool ( tr( "Group" ) ); + createTool( _addGroup, aToolId ); + createTool( _removeGroup, aToolId ); //CS_TODO + //createTool( separator(), aToolId ); + + // Law + aToolId = createTool ( tr( "Mesh" ) ); + createTool( _addLaw, aToolId ); + createTool( _removeLaw, aToolId ); + createTool( _setPropagation, aToolId ); + createTool( _computeMesh, aToolId ); } void HEXABLOCKGUI::initialMenus() { - showDocumentMenus( true ); - showPatternMenus( false ); - showAssociationMenus( false ); - showGroupsMenus( false ); - showMeshMenus( false ); + showDocumentMenus( true ); + showPatternMenus( false ); + showAssociationMenus( false ); + showGroupsMenus( false ); + showMeshMenus( false ); } void HEXABLOCKGUI::showAllMenus() { - showDocumentMenus( true ); - showPatternMenus( true ); - showAssociationMenus( true ); - showGroupsMenus( true ); - showMeshMenus( true ); + showDocumentMenus( true ); + showPatternMenus( true ); + showAssociationMenus( true ); + showGroupsMenus( true ); + showMeshMenus( true ); } void HEXABLOCKGUI::showDocumentMenus(bool show) { - DEBTRACE("HEXABLOCKGUI::showDocumentMenus " << show); - show = true; // - setMenuShown(_newAct, show); - setToolShown(_newAct, show); - setMenuShown(_importAct, show); - setToolShown(_importAct, show); - setMenuShown(_saveAct, show); - setToolShown(_saveAct, show); -// setMenuShown(_testAct, show); -// setToolShown(_testAct, show); + DEBTRACE("HEXABLOCKGUI::showDocumentMenus " << show); + show = true; // + setMenuShown(_newAct, show); + setToolShown(_newAct, show); + setMenuShown(_importAct, show); + setToolShown(_importAct, show); + setMenuShown(_saveAct, show); + setToolShown(_saveAct, show); + // setMenuShown(_testAct, show); + // setToolShown(_testAct, show); } void HEXABLOCKGUI::showPatternMenus(bool show) { - DEBTRACE("HEXABLOCKGUI::showPatternMenus " << show); - DEBTRACE("_currentModel " << _currentModel ); - if ( show && !_currentModel ) return; - - setMenuShown(_addVertex, show );//true); - setToolShown(_addVertex, show); - setMenuShown(_addEdge, show );//true); - setToolShown(_addEdge, show); - setMenuShown(_addQuad, show );//true); - setToolShown(_addQuad, show); - setMenuShown(_addHexa, show );//true); - setToolShown(_addHexa, show); - - - setMenuShown( _addVector, show );//true); - setToolShown( _addVector, show); - setMenuShown( _addCylinder, show );//true); - setToolShown( _addCylinder, show); - setMenuShown( _addPipe, show );//true); - setToolShown( _addPipe, show); - setMenuShown( _makeGrid, show );//true); - setToolShown( _makeGrid, show); - setMenuShown( _makeCylinder, show );//true); - setToolShown( _makeCylinder, show); - setMenuShown( _makePipe, show );//true); - setToolShown( _makePipe, show); - setMenuShown( _makeCylinders, show );//true); - setToolShown( _makeCylinders, show); - setMenuShown( _makePipes, show );//true); - setToolShown( _makePipes, show); -// setMenuShown( _makeRind, show );//true); -// setToolShown( _makeRind, show); - setMenuShown( _makeHemiSphere, show );//true); - setToolShown( _makeHemiSphere, show); - - // Pattern Data Edition - setMenuShown( _removeHexa, show );//true); - setToolShown( _removeHexa, show); - setMenuShown( _prismQuad, show );//true); - setToolShown( _prismQuad, show); - setMenuShown( _joinQuad, show );//true); - setToolShown( _joinQuad, show); - setMenuShown( _merge, show );//true); - setToolShown( _merge, show); - setMenuShown( _disconnect, show );//true); - setToolShown( _disconnect, show); - setMenuShown( _cutEdge, show );//true); - setToolShown( _cutEdge, show); - setMenuShown( _makeTransformation, show );//true); - setToolShown( _makeTransformation, show); - setMenuShown( _makeSymmetry, show );//true); - setToolShown( _makeSymmetry, show); - setMenuShown( _performTransformation, show );//true); - setToolShown( _performTransformation, show); - setMenuShown( _performSymmetry, show );//true); - setToolShown( _performSymmetry, show); - setMenuShown( _replaceHexa, show );//true); - setToolShown( _replaceHexa, show); - setMenuShown( _quadRevolution, show );//true); - setToolShown( _quadRevolution, show); + DEBTRACE("HEXABLOCKGUI::showPatternMenus " << show); + DEBTRACE("getCurrentModel() " << getCurrentModel() ); + if ( show && !getCurrentModel() ) return; + + setMenuShown(_addVertex, show );//true); + setToolShown(_addVertex, show); + setMenuShown(_addEdge, show );//true); + setToolShown(_addEdge, show); + setMenuShown(_addQuad, show );//true); + setToolShown(_addQuad, show); + setMenuShown(_addHexa, show );//true); + setToolShown(_addHexa, show); + + + setMenuShown( _addVector, show );//true); + setToolShown( _addVector, show); + setMenuShown( _addCylinder, show );//true); + setToolShown( _addCylinder, show); + setMenuShown( _addPipe, show );//true); + setToolShown( _addPipe, show); + setMenuShown( _makeGrid, show );//true); + setToolShown( _makeGrid, show); + setMenuShown( _makeCylinder, show );//true); + setToolShown( _makeCylinder, show); + setMenuShown( _makePipe, show );//true); + setToolShown( _makePipe, show); + setMenuShown( _makeCylinders, show );//true); + setToolShown( _makeCylinders, show); + setMenuShown( _makePipes, show );//true); + setToolShown( _makePipes, show); + // setMenuShown( _makeRind, show );//true); + // setToolShown( _makeRind, show); + setMenuShown( _makeHemiSphere, show );//true); + setToolShown( _makeHemiSphere, show); + + // Pattern Data Edition + setMenuShown( _removeHexa, show );//true); + setToolShown( _removeHexa, show); + setMenuShown( _prismQuad, show );//true); + setToolShown( _prismQuad, show); + setMenuShown( _joinQuad, show );//true); + setToolShown( _joinQuad, show); + setMenuShown( _merge, show );//true); + setToolShown( _merge, show); + setMenuShown( _disconnect, show );//true); + setToolShown( _disconnect, show); + setMenuShown( _cutEdge, show );//true); + setToolShown( _cutEdge, show); + setMenuShown( _makeTransformation, show );//true); + setToolShown( _makeTransformation, show); + setMenuShown( _makeSymmetry, show );//true); + setToolShown( _makeSymmetry, show); + setMenuShown( _performTransformation, show );//true); + setToolShown( _performTransformation, show); + setMenuShown( _performSymmetry, show );//true); + setToolShown( _performSymmetry, show); + setMenuShown( _replaceHexa, show );//true); + setToolShown( _replaceHexa, show); + setMenuShown( _quadRevolution, show );//true); + setToolShown( _quadRevolution, show); } void HEXABLOCKGUI::showAssociationMenus(bool show) { - DEBTRACE("HEXABLOCKGUI::showAssociationMenus" << show); - if ( show && !_currentModel ) return; + DEBTRACE("HEXABLOCKGUI::showAssociationMenus" << show); + if ( show && !getCurrentModel() ) return; - // Association Edition - setMenuShown( _assocVertex, show ); - setToolShown( _assocVertex, show); - setMenuShown( _assocEdge, show ); - setToolShown( _assocEdge, show); - setMenuShown( _assocQuad, show ); - setToolShown( _assocQuad, show); + // Association Edition + setMenuShown( _assocVertex, show ); + setToolShown( _assocVertex, show); + setMenuShown( _assocEdge, show ); + setToolShown( _assocEdge, show); + setMenuShown( _assocQuad, show ); + setToolShown( _assocQuad, show); } void HEXABLOCKGUI::showGroupsMenus(bool show) { - DEBTRACE("HEXABLOCKGUI::showGroupsMenus" << show); - if ( show && !_currentModel ) return; - setMenuShown( _addGroup, show );//true); - setToolShown( _addGroup, show); - setMenuShown( _removeGroup , show );//true); - setToolShown( _removeGroup , show); + DEBTRACE("HEXABLOCKGUI::showGroupsMenus" << show); + if ( show && !getCurrentModel() ) return; + setMenuShown( _addGroup, show );//true); + setToolShown( _addGroup, show); + setMenuShown( _removeGroup , show );//true); + setToolShown( _removeGroup , show); } void HEXABLOCKGUI::showMeshMenus(bool show) { - DEBTRACE("HEXABLOCKGUI::showMeshMenus" << show); - if ( show && !_currentModel ) return; - setMenuShown( _addLaw, show );//true); - setToolShown( _addLaw, show); - setMenuShown( _removeLaw, show );//true); - setToolShown( _removeLaw, show);; - setMenuShown( _setPropagation, show );//true); - setToolShown( _setPropagation, show); - setMenuShown( _computeMesh, show); //true); - setToolShown( _computeMesh, show); + DEBTRACE("HEXABLOCKGUI::showMeshMenus" << show); + if ( show && !getCurrentModel() ) return; + setMenuShown( _addLaw, show );//true); + setToolShown( _addLaw, show); + setMenuShown( _removeLaw, show );//true); + setToolShown( _removeLaw, show);; + setMenuShown( _setPropagation, show );//true); + setToolShown( _setPropagation, show); + setMenuShown( _computeMesh, show); //true); + setToolShown( _computeMesh, show); } +void HEXABLOCKGUI::showActor() +{ + //TODO: Implement the real one (this is not show only actor, but show actor) + VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView(); + if (currentVtkGView == NULL || currentVtkGView->getViewWindow() == NULL || + currentVtkGView->isEmpty() || currentVtkGView->getDocumentActor() == NULL) + return; + currentVtkGView->getViewWindow()->setFocus(); + currentVtkGView->getViewWindow()->Display(currentVtkGView->getDocumentActor()->getIO()); + currentVtkGView->update(); + currentVtkGView->getViewWindow()->onFitAll(); -void HEXABLOCKGUI::switchModel(SUIT_ViewWindow *view) -{ - DEBTRACE("HEXABLOCKGUI::switchModel " << view); + //update the visibility state now + SalomeApp_Study* aStudy = HEXABLOCKGUI::activeStudy(); + SUIT_ViewManager* vman = currentVtkGView->getViewWindow()->getViewManager(); + if (aStudy == NULL || vman == NULL) return; - if ( _documentModels.count(view) == 0 ){ - DEBTRACE("HEXABLOCKGUI::switchModel : no model found, cannot switch"); - initialMenus(); - return; - } + Handle(SALOME_InteractiveObject) anIO = currentVtkGView->getDocumentActor()->getIO(); + aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), VISIBILITY_PROP, 1 ); + displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState); +} + +void HEXABLOCKGUI::showOnlyActor() +{ + VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView(); + if (currentVtkGView == NULL || currentVtkGView->getViewWindow() == NULL || + currentVtkGView->isEmpty() || currentVtkGView->getDocumentActor() == NULL) + return; - if ( _currentModel != _documentModels[view] ){ // need to switch - if (_dwInputPanel){ - QWidget* w = _dwInputPanel->widget(); - if (w) w->close(); + SALOME_Actor *actor = NULL; + vtkActor *aVTKActor = NULL; + Handle(SALOME_InteractiveObject) anIO; + + SUIT_ViewManager* vman = currentVtkGView->getViewWindow()->getViewManager(); + SalomeApp_Study* aStudy = HEXABLOCKGUI::activeStudy(); + vtkRenderer *aRenderer = currentDocGView->getViewWindow()->getRenderer(); + if (aStudy == NULL || vman == NULL || aRenderer == NULL) return; + + //update the visibility state for all actors ----------- + VTK::ActorCollectionCopy aCopy(aRenderer->GetActors()); + vtkActorCollection *aCollection = aCopy.GetActors(); + if (aCollection == NULL) return; + aCollection->InitTraversal(); + + while( aVTKActor = aCollection->GetNextActor() ){ + actor = dynamic_cast( aVTKActor ); + if ( actor && actor->hasIO() ){ + anIO = actor->getIO(); + if( anIO->hasEntry()) + { + aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), VISIBILITY_PROP, 0 ); + displayer()->setVisibilityState(anIO->getEntry(), Qtx::HiddenState); + }//if + }//if + }//while + + //show only the current actor ----------------- + currentVtkGView->getViewWindow()->setFocus(); + currentVtkGView->getViewWindow()->DisplayOnly(currentVtkGView->getDocumentActor()->getIO()); + currentVtkGView->update(); + currentVtkGView->getViewWindow()->onFitAll(); + anIO = currentVtkGView->getDocumentActor()->getIO(); + aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), VISIBILITY_PROP, 1 ); + displayer()->setVisibilityState(anIO->getEntry(), Qtx::ShownState); + + + //showOnly in occ viewer ------------- + + OCCViewer_ViewWindow* occView = currentOccGView == NULL ? NULL : currentOccGView->getViewWindow(); + DocumentModel* docModel = currentVtkGView->getDocumentModel(); + if (occView == NULL || docModel == NULL) return; + SALOME_View* vf = dynamic_cast(occView->getViewManager()->getViewModel()); + if (vf == NULL) return; + + GEOM_Displayer* disp = geomBaseHelper->getDisplayer(); + if (disp == NULL) + { + MESSAGE("Displayer IS NULL"); + return; } + _PTR(Study) aStudyDS = aStudy->studyDS(); + if (aStudyDS == NULL) return; - // models - _currentModel = _documentModels[view]; - _patternDataModel->setSourceModel(_currentModel); - _patternBuilderModel->setSourceModel(_currentModel); -// _associationsModel->setSourceModel(_currentModel); - _groupsModel->setSourceModel(_currentModel); - _meshModel->setSourceModel(_currentModel); + //erase all shapes from the occ viewer + disp->EraseAll(false, true, vf); - // associate models and views - _currentGraphicView = _documentView[view]; -// _currentGraphicView->setModel(_patternDataModel); -// connect( _currentModel, SIGNAL(patternDataChanged() ), _currentGraphicView, SLOT ( onPatternDatachanged() ) ); - _currentGraphicView->setModel(_currentModel); + //show only the shapes of the document + QList entries = docModel->getShapesEntries(); - _patternDataTreeView->setModel(_patternDataModel); //_currentModel - _patternBuilderTreeView->setModel(_patternBuilderModel);//_currentModel -// _associationTreeView->setModel(_associationsModel);; - _groupsTreeView->setModel(_groupsModel); - _meshTreeView->setModel(_meshModel); + CORBA::Object_var aCorbaObj = CORBA::Object::_nil(); + GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_nil(); + HEXABLOCKGUI::geomBaseHelper->erasePreview(true); - // set selections for each view -// if ( _patternDataSelectionModel ) delete _patternDataSelectionModel; -// if ( _patternBuilderSelectionModel ) delete _patternBuilderSelectionModel; -// if ( _groupsSelectionModel ) delete _groupsSelectionModel; -// if ( _meshSelectionModel ) delete _meshSelectionModel; + foreach(const QString& entry, entries) + { + if (!entry.isEmpty()) + { + _PTR(SObject) aSChild = aStudyDS->FindObjectID( entry.toStdString() ); + aCorbaObj = corbaObj( aSChild ); + aGeomObj = GEOM::GEOM_Object::_narrow( aCorbaObj ); + if ( !CORBA::is_nil(aGeomObj) ){ + geomBaseHelper->display(aGeomObj._retn()); +// QString objIOR = GEOMBase::GetIORFromObject( aGeomObj._retn() ); +// Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIORinGEOMAISShape( objIOR );//, true ) +// if ( !aSh.IsNull() ) +// disp->Display(aSh->getIO(), true, vf); +// else +// { +// MESSAGE("aSh IS NULL"); +// } + } + } + } + occView->onResetView (); +} - _patternDataSelectionModel = new PatternDataSelectionModel( _patternDataModel ); - _patternBuilderSelectionModel = new PatternBuilderSelectionModel( _patternBuilderModel, _patternDataSelectionModel ); - _groupsSelectionModel = new GroupsSelectionModel( _groupsModel ); - _meshSelectionModel = new MeshSelectionModel( _meshModel ); +void HEXABLOCKGUI::hideActor() +{ + VtkDocumentGraphicView* currentVtkGView = getCurrentVtkGraphicView(); + if (currentVtkGView == NULL || currentVtkGView->isEmpty() || + currentVtkGView->getViewWindow() == NULL || + currentVtkGView->getDocumentActor() == NULL) return; - _patternDataSelectionModel->setSalomeSelectionMgr( selectionMgr() ); -// _meshSelectionModel->setSalomeSelectionMgr( selectionMgr() ); -// _patternDataSelectionModel->setGeomEngine( _geomEngine ); +// currentVtkGView->getViewWindow()->setFocus(); + currentVtkGView->getViewWindow()->Erase(currentVtkGView->getDocumentActor()->getIO()); + currentVtkGView->getViewWindow()->onFitAll(); - _currentGraphicView->setSelectionModel(_patternDataSelectionModel); + //update the visibility state now + SalomeApp_Study* aStudy = HEXABLOCKGUI::activeStudy(); + SUIT_ViewManager* vman = currentVtkGView->getViewWindow()->getViewManager(); + if (aStudy == NULL || vman == NULL) return; - _patternDataTreeView->setSelectionModel(_patternDataSelectionModel); - _patternDataTreeView->setEditTriggers(/*QAbstractItemView::EditKeyPressed*/QAbstractItemView::AllEditTriggers /*QAbstractItemView::NoEditTriggers*/); + Handle(SALOME_InteractiveObject) anIO = currentVtkGView->getDocumentActor()->getIO(); + aStudy->setObjectProperty(vman->getId(), anIO->getEntry(), VISIBILITY_PROP, 0 ); + displayer()->setVisibilityState(anIO->getEntry(), Qtx::HiddenState); +} - _patternBuilderTreeView->setSelectionModel(_patternBuilderSelectionModel); - _patternBuilderTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); - _groupsTreeView->setSelectionModel(_groupsSelectionModel); - _groupsTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); +VtkDocumentGraphicView* HEXABLOCKGUI::getCurrentVtkGraphicView() +{ +// VtkDocumentGraphicView* gv = graphicViewsHandler->getDocumentGraphicView(currentVtkView); +// return graphicViewsHandler->getDocumentGraphicView(currentVtkView); + return currentDocGView; +} - _meshTreeView->setSelectionModel( _meshSelectionModel ); - _meshTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); +void HEXABLOCKGUI::showDockWidgets(bool isVisible) +{ + DEBTRACE("HEXABLOCKGUI::showDockWidgets " << isVisible); + + if (_dwObjectBrowser) _dwObjectBrowser->setVisible(isVisible); + if (_dwObjectBrowser) _dwObjectBrowser->toggleViewAction()->setVisible(isVisible); + if (_dwPattern) _dwPattern->setVisible(isVisible); + if (_dwPattern) _dwPattern->toggleViewAction()->setVisible(isVisible); - // delegate for edition - _treeViewDelegate->setDocumentModel( _currentModel ); - _treeViewDelegate->setPatternDataSelectionModel( _patternDataSelectionModel ); - _treeViewDelegate->setPatternBuilderSelectionModel( _patternBuilderSelectionModel ); - _treeViewDelegate->setGroupsSelectionModel( _groupsSelectionModel /*_groupsTreeView->selectionModel()*/ ); - _treeViewDelegate->setMeshSelectionModel( _meshSelectionModel/*_meshTreeView->selectionModel()*/ ); + // if (_dwAssociation) _dwAssociation->setVisible(isVisible); + // if (_dwAssociation) _dwAssociation->toggleViewAction()->setVisible(isVisible); + if (_dwMesh) _dwMesh->setVisible(isVisible); + if (_dwMesh) _dwMesh->toggleViewAction()->setVisible(isVisible); - connect( _patternDataSelectionModel, SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - connect( _patternBuilderSelectionModel, SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - connect( _groupsSelectionModel, SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - connect( _meshSelectionModel, SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); + if (_dwGroups) _dwGroups->setVisible(isVisible); + if (_dwGroups) _dwGroups->toggleViewAction()->setVisible(isVisible); - } +// if (_dwInputPanel) _dwInputPanel->setVisible(isVisible); +// if (_dwInputPanel) _dwInputPanel->toggleViewAction()->setVisible(isVisible); - showPatternMenus(true); +// QWidget* w = _dwInputPanel->widget(); +// if (w) w->show(); + // if ( isVisible ) _dwObjectBrowser->raise();//_dwPattern->raise(); } +// void HEXABLOCKGUI::raiseStacked() +// { +// // if (_dwStacked) _dwStacked->raise(); +// } -void HEXABLOCKGUI::showDockWidgets(bool isVisible) +void HEXABLOCKGUI::testDocument() { - DEBTRACE("HEXABLOCKGUI::showDockWidgets " << isVisible); + //CS_TEST + // ---------- + // QStandardItem *parentItem = getCurrentModel()->invisibleRootItem(); + // QStandardItem *myItem = new QStandardItem("MyItem"); + // parentItem->appendRow(myItem); + // // ---------- + // QModelIndex v0 = getCurrentModel()->addVertex(0., 0., 0.); + // QModelIndex v1 = getCurrentModel()->addVertex(5., 0., 0.); + // QModelIndex v2 = getCurrentModel()->addVertex(5., 5., 0.); + // QModelIndex v3 = getCurrentModel()->addVertex(0., 5., 0.); + // QModelIndex v4 = getCurrentModel()->addVertex(0., 0., 5.); + // QModelIndex v5 = getCurrentModel()->addVertex(5., 0., 5.); + // QModelIndex v6 = getCurrentModel()->addVertex(5., 5., 5.); + // QModelIndex v7 = getCurrentModel()->addVertex(0., 5., 5.); + // // + // // + // QModelIndex q0 = getCurrentModel()->addQuadVertices( v0, v1, v2, v3 ); + // QModelIndex q1 = getCurrentModel()->addQuadVertices( v4, v5, v6, v7 ); + // QModelIndex q2 = getCurrentModel()->addQuadVertices( v0, v3, v7, v4 ); + // QModelIndex q3 = getCurrentModel()->addQuadVertices( v1, v2, v6, v5 ); + // QModelIndex q4 = getCurrentModel()->addQuadVertices( v0, v1, v5, v4 ); + // QModelIndex q5 = getCurrentModel()->addQuadVertices( v3, v2, v6, v7 ); + // + // QModelIndex h0 = getCurrentModel()->addHexaQuad( q0, q1, q2, q3, q4, q5 ); + // QModelIndex vx = getCurrentModel()->addVector(1., 0., 0.); + // QModelIndex vy = getCurrentModel()->addVector(0., 1., 0.); + // QModelIndex vz = getCurrentModel()->addVector(0., 0., 1.); + // + + + + // // QModelIndex orig1 = getCurrentModel()->addVertex (0, 0,0); + // // QModelIndex orig2 = getCurrentModel()->addVertex (50,0,0); + // // QModelIndex vz = getCurrentModel()->addVector (0,0,1); + // // QModelIndex vx = getCurrentModel()->addVector (1,0,0); + // // + // // int nr = 4; + // // int nri = 3; + // // int nre = nr; + // // int na = 9; + // // int nl = 5; + // // + // // QModelIndex cyl = getCurrentModel()->addCylinder (orig1, vz, nr, nl); + // // QModelIndex pipe = getCurrentModel()->addPipe (orig2, vz, nri, nre, nl); + // // + // // getCurrentModel()->makeCylinder (cyl, vx, nr, na, nl); + // // getCurrentModel()->makePipe(pipe, vx, nr, na, nl); + + + + // newMesh( "toto", 3, "FactoryServer"); + // newMesh +} - if (_dwObjectBrowser) _dwObjectBrowser->setVisible(isVisible); - if (_dwObjectBrowser) _dwObjectBrowser->toggleViewAction()->setVisible(isVisible); +void HEXABLOCKGUI::test_make_cart_grid() +{ + QModelIndex orig1 = getCurrentModel()->addVertex( 0, 0, 0); + QModelIndex orig2 = getCurrentModel()->addVertex( 10, 0, 0); + QModelIndex orig3 = getCurrentModel()->addVertex( 0, 10, 0); + QModelIndex orig4 = getCurrentModel()->addVertex( 10, 10, 0); + QModelIndex orig5 = getCurrentModel()->addVertex( 0, 20, 0); + QModelIndex orig6 = getCurrentModel()->addVertex( 10, 20, 0); - if (_dwPattern) _dwPattern->setVisible(isVisible); - if (_dwPattern) _dwPattern->toggleViewAction()->setVisible(isVisible); + QModelIndex vz = getCurrentModel()->addVector(0, 0, 1); + QModelIndex vx = getCurrentModel()->addVector(1, 0, 0); -// if (_dwAssociation) _dwAssociation->setVisible(isVisible); -// if (_dwAssociation) _dwAssociation->toggleViewAction()->setVisible(isVisible); + //int dr = 1; + //int dl = 1; + //int nr = 2; + //int nl = 3; - if (_dwMesh) _dwMesh->setVisible(isVisible); - if (_dwMesh) _dwMesh->toggleViewAction()->setVisible(isVisible); + // QModelIndex c1 = getCurrentModel()->makeCylindrical(orig1, vx, vz, dr, 360, dl, nr, 4, nl, true); + // QModelIndex c2 = getCurrentModel()->makeCylindrical(orig2, vx, vz, dr, 360, dl, nr, 8, nl, true); + // QModelIndex c3 = getCurrentModel()->makeCylindrical(orig3, vx, vz, dr, 270, dl, nr, 8, nl, true); + // QModelIndex c4 = getCurrentModel()->makeCylindrical(orig4, vx, vz, dr, 270, dl, nr, 7, nl, true); + // QModelIndex c5 = getCurrentModel()->makeCylindrical(orig5, vx, vz, dr, 360, dl, nr, 5, nl, true); + // QModelIndex c6 = getCurrentModel()->makeCylindrical(orig6, vx, vz, dr, 360, dl, nr, 6, nl, true); - if (_dwGroups) _dwGroups->setVisible(isVisible); - if (_dwGroups) _dwGroups->toggleViewAction()->setVisible(isVisible); +} - if (_dwInputPanel) _dwInputPanel->setVisible(isVisible); - if (_dwInputPanel) _dwInputPanel->toggleViewAction()->setVisible(isVisible); - QWidget* w = _dwInputPanel->widget(); - if (w) w->show(); -// if ( isVisible ) _dwObjectBrowser->raise();//_dwPattern->raise(); -} +void HEXABLOCKGUI::test_make_elmts_transform() +{ + int size_x = 1; + int size_y = 1; + int size_z = 2; -// void HEXABLOCKGUI::raiseStacked() -// { -// // if (_dwStacked) _dwStacked->raise(); -// } + QModelIndex orig = getCurrentModel()->addVertex(0, 0, 0); + QModelIndex dirVr = getCurrentModel()->addVector(1, 1, 1); + QModelIndex grid = getCurrentModel()->makeCartesian(orig, dirVr, size_x, size_y, size_z);//, 0, 0, 0); + // orig.setScalar(2); + // file_name = os.path.join(os.environ['TMP'], 'transfo0.vtk') + // getCurrentModel()->saveVtk(file_name) + QModelIndex devant = getCurrentModel()->addVector(5, 0, 0); + QModelIndex grid2 = getCurrentModel()->makeTranslation(grid, devant); -DocumentGraphicView* HEXABLOCKGUI::newGraphicView() -{ - MESSAGE("HEXABLOCKGUI::newGraphicView"); - DocumentGraphicView *newGView = NULL; - SUIT_ViewWindow *suitVW = NULL; + // file_name = os.path.join(os.environ['TMP'], 'transfo_translation.vtk') + // getCurrentModel()->saveVtk(file_name) - //For the first time initialize occ view manager - if (_documentView.size() == 0) - { - occViewManager = getApp()->getViewManager( OCCViewer_Viewer::Type(), true ); - occViewManager->getActiveView()->setClosable(false); - currentOccView = dynamic_cast(occViewManager->getActiveView()); - } - - vtkViewManager = getApp()->getViewManager( SVTK_Viewer::Type(), true ); - if (_documentView.size() == 0) - { - suitVW = vtkViewManager->getActiveView(); - suitVW->setClosable(false); - } - else - suitVW = vtkViewManager->createViewWindow(); - - currentVtkView = dynamic_cast(suitVW); - currentVtkView->installEventFilter(this); - newGView = new DocumentGraphicView(getApp(), suitVW, application()->desktop()); - _documentView[suitVW] = newGView; - return newGView; -} - -//DocumentGraphicView* HEXABLOCKGUI::newGraphicView() -//{ -// MESSAGE("HEXABLOCKGUI::newGraphicView"); -// DocumentGraphicView *newGView = 0; -// SUIT_ViewWindow *suitVW = NULL; -// -// SUIT_ViewManager *vtkViewManager = getApp()->getViewManager(SVTK_Viewer::Type(), true); -// MESSAGE("suitVM->getViewsCount() => " << suitVM->getViewsCount() ); -// suitVW = suitVM->getActiveView(); -// if ( _documentView.count(suitVW) > 0) -// suitVW = suitVM->createViewWindow(); -// -// if ( suitVW ){ -//// suitVW->setClosable(false); -// suitVW->setClosable(true); -// newGView = new DocumentGraphicView(getApp(), suitVW, application()->desktop()); -// _documentView[suitVW] = newGView; -// } -// -// return newGView; -//} + QModelIndex grid4 = getCurrentModel()->makeRotation(grid2, orig, dirVr, 45); -void HEXABLOCKGUI::testDocument() -{ - //CS_TEST - // ---------- -// QStandardItem *parentItem = _currentModel->invisibleRootItem(); -// QStandardItem *myItem = new QStandardItem("MyItem"); -// parentItem->appendRow(myItem); -// // ---------- -// QModelIndex v0 = _currentModel->addVertex(0., 0., 0.); -// QModelIndex v1 = _currentModel->addVertex(5., 0., 0.); -// QModelIndex v2 = _currentModel->addVertex(5., 5., 0.); -// QModelIndex v3 = _currentModel->addVertex(0., 5., 0.); -// QModelIndex v4 = _currentModel->addVertex(0., 0., 5.); -// QModelIndex v5 = _currentModel->addVertex(5., 0., 5.); -// QModelIndex v6 = _currentModel->addVertex(5., 5., 5.); -// QModelIndex v7 = _currentModel->addVertex(0., 5., 5.); -// // -// // -// QModelIndex q0 = _currentModel->addQuadVertices( v0, v1, v2, v3 ); -// QModelIndex q1 = _currentModel->addQuadVertices( v4, v5, v6, v7 ); -// QModelIndex q2 = _currentModel->addQuadVertices( v0, v3, v7, v4 ); -// QModelIndex q3 = _currentModel->addQuadVertices( v1, v2, v6, v5 ); -// QModelIndex q4 = _currentModel->addQuadVertices( v0, v1, v5, v4 ); -// QModelIndex q5 = _currentModel->addQuadVertices( v3, v2, v6, v7 ); -// -// QModelIndex h0 = _currentModel->addHexaQuad( q0, q1, q2, q3, q4, q5 ); -// QModelIndex vx = _currentModel->addVector(1., 0., 0.); -// QModelIndex vy = _currentModel->addVector(0., 1., 0.); -// QModelIndex vz = _currentModel->addVector(0., 0., 1.); -// + // file_name = os.path.join(os.environ['TMP'], 'transfo_rotation.vtk'); + // getCurrentModel()->saveVtk(file_name); + // print "...test make elements by transforming elements OK" +} -// // QModelIndex orig1 = _currentModel->addVertex (0, 0,0); -// // QModelIndex orig2 = _currentModel->addVertex (50,0,0); -// // QModelIndex vz = _currentModel->addVector (0,0,1); -// // QModelIndex vx = _currentModel->addVector (1,0,0); -// // -// // int nr = 4; -// // int nri = 3; -// // int nre = nr; -// // int na = 9; -// // int nl = 5; -// // -// // QModelIndex cyl = _currentModel->addCylinder (orig1, vz, nr, nl); -// // QModelIndex pipe = _currentModel->addPipe (orig2, vz, nri, nre, nl); -// // -// // _currentModel->makeCylinder (cyl, vx, nr, na, nl); -// // _currentModel->makePipe(pipe, vx, nr, na, nl); +void HEXABLOCKGUI::test() +{ + DEBTRACE("HEXABLOCKGUI::test"); + VtkDocumentGraphicView* currentDGView = getCurrentVtkGraphicView(); + if (currentDGView == NULL) return; + currentDGView->update(); + +} +void HEXABLOCKGUI::test_association() +{ + DEBTRACE("HEXABLOCKGUI::test_association"); + newDocument(); + + QModelIndex v0, v1, v2, v3, e0, e1, q0; + + DocumentModel::GeomObj v0Assoc, v1Assoc, v2Assoc, v3Assoc; + DocumentModel::GeomObj e0AssocA, e1AssocA, e1AssocB, e1AssocC; + DocumentModel::GeomObj q0AssocA, q0AssocB; + + DocumentModel::GeomObj v0Assoc_test, v1Assoc_test, v2Assoc_test, v3Assoc_test; + QList e1Assocs_test; + DocumentModel::GeomObj q0Assoc_test; + + v0 = getCurrentModel()->addVertex(0, 0, 0); + v1 = getCurrentModel()->addVertex(1, 0, 0); + v2 = getCurrentModel()->addVertex(1, 1, 0); + v3 = getCurrentModel()->addVertex(0, 1, 0); + e0 = getCurrentModel()->addEdgeVertices(v0, v1); + e1 = getCurrentModel()->addEdgeVertices(v1, v2); + q0 = getCurrentModel()->addQuadVertices( v0, v1, v2, v3 ); + + + // >>> face3.GetEntry()'0:1:4' + // >>> e1.GetEntry()'0:1:8' + // >>> e2.GetEntry()'0:1:9' + // >>> e3.GetEntry()'0:1:10' + // >>> e4.GetEntry()'0:1:11' + // >>> v1.GetEntry()'0:1:12' + // >>> v2.GetEntry()'0:1:13' + // >>> v3.GetEntry()'0:1:14' + // >>> v4.GetEntry()'0:1:15' + + + // v0Assoc.name = "geomV0"; + // v0Assoc.entry = "0:1:1:1:3:6";//"0:1:12"; + // v0Assoc.brep = "brepV0"; + // v1Assoc.name = "geomV1"; + // v1Assoc.entry = "0:1:1:1:3:7";//"0:1:13"; + // v1Assoc.brep = "brepV1"; + // v2Assoc.name = "geomV2"; + // v2Assoc.entry = "0:1:1:1:3:8";//"0:1:14"; + // v2Assoc.brep = "brepV2"; + // v3Assoc.name = "geomV3"; + // v3Assoc.entry = "0:1:1:1:3:9";//"0:1:15"; + // v3Assoc.brep = "brepV3"; + // + // + // + // e0AssocA.name = "geomE0a"; + // e0AssocA.entry = "0:1:1:1:3:5";//"0:1:8"; + // e0AssocA.brep = "brepE0a"; + // e0AssocA.start = 0.10; + // e0AssocA.end = 0.95; + // + // + // + // e1AssocA.name = "geomE1a"; + // e1AssocA.entry = "0:1:1:1:3:2";//"0:1:8"; + // e1AssocA.brep = "brepE1a"; + // e1AssocA.start = 0.12; + // e1AssocA.end = 0.89; + // e1AssocB.name = "geomE1b"; + // e1AssocB.entry = "0:1:1:1:3:3";//"0:1:9"; + // e1AssocB.brep = "brepE1b"; + // e1AssocB.start = 0.20; + // e1AssocB.end = 0.80; + // e1AssocC.name = "geomE1c"; + // e1AssocC.entry = "0:1:1:1:3:4";//"0:1:10"; + // e1AssocC.brep = "brepE1c"; + // e1AssocC.start = 0.16; + // e1AssocC.end = 0.96; + // + // q0AssocA.name = "geomQuad"; + // q0AssocA.entry = "0:1:1:1:3"; + // q0AssocA.brep = "brepq0"; + // + // q0AssocB.name = "geomQuad"; + // q0AssocB.entry = "0:1:1:1:4"; + // q0AssocB.brep = "brepq0"; + // + // getCurrentModel()->addAssociation( v0, v0Assoc ); + // getCurrentModel()->addAssociation( v1, v1Assoc ); + // getCurrentModel()->addAssociation( v2, v2Assoc ); + // getCurrentModel()->addAssociation( v3, v3Assoc ); + // + // + // getCurrentModel()->addAssociation( e0, e0AssocA ); + // + // getCurrentModel()->addAssociation( e1, e1AssocA ); + // getCurrentModel()->addAssociation( e1, e1AssocB ); + // getCurrentModel()->addAssociation( e1, e1AssocC ); + // + // getCurrentModel()->addAssociation( q0, q0AssocA ); + // getCurrentModel()->addAssociation( q0, q0AssocB ); + + + + + + // v0Assoc_test = getCurrentModel()->getAssociations( v0 )[0]; + // v1Assoc_test = getCurrentModel()->getAssociations( v1 )[0]; + // v2Assoc_test = getCurrentModel()->getAssociations( v2 )[0]; + // v3Assoc_test = getCurrentModel()->getAssociations( v3 )[0]; + // ASSERT( v0Assoc.name == v0Assoc_test.name ); + // ASSERT( v1Assoc.name == v1Assoc_test.name ); + // ASSERT( v2Assoc.name == v2Assoc_test.name ); + // ASSERT( v3Assoc.name == v3Assoc_test.name ); + // ASSERT( v0Assoc.entry == v0Assoc_test.entry ); + // ASSERT( v1Assoc.entry == v1Assoc_test.entry ); + // ASSERT( v2Assoc.entry == v2Assoc_test.entry ); + // ASSERT( v3Assoc.entry == v3Assoc_test.entry ); + // + // + // e1Assocs_test = getCurrentModel()->getAssociations( e1 ); + // ASSERT( e1Assocs_test[0].name == e1AssocA.name ); + // ASSERT( e1Assocs_test[1].name == e1AssocB.name ); + // ASSERT( e1Assocs_test[2].name == e1AssocC.name ); + // ASSERT( e1Assocs_test[0].entry == e1AssocA.entry ); + // ASSERT( e1Assocs_test[1].entry == e1AssocB.entry ); + // ASSERT( e1Assocs_test[2].entry == e1AssocC.entry ); + // ASSERT( e1Assocs_test[0].start == e1AssocA.start ); + // ASSERT( e1Assocs_test[1].start == e1AssocB.start ); + // ASSERT( e1Assocs_test[2].start == e1AssocC.start ); + // ASSERT( e1Assocs_test[0].end == e1AssocA.end ); + // ASSERT( e1Assocs_test[1].end == e1AssocB.end ); + // ASSERT( e1Assocs_test[2].end == e1AssocC.end ); + // + // q0Assoc_test = getCurrentModel()->getAssociations( q0 )[0]; + // ASSERT( q0Assoc_test.name == q0Assoc.name ); + // ASSERT( q0Assoc_test.entry == q0Assoc.entry ); + + + DEBTRACE("HEXABLOCKGUI::test_association fin"); +} + +//clear all used dialogs by the current model +void HEXABLOCKGUI::clearDialogs() +{ + std::set::const_iterator debut (currentModelDialogs.begin()), + fin (currentModelDialogs.end()); + for(;debut!=fin;++debut) (*debut)->clear(); + + if (_vertexAssocDiag != NULL) _vertexAssocDiag->clear(); //not a subclass of HexaBaseDialog + + currentModelDialogs.clear(); //empty the used dialogs list +} + +HexaBaseDialog* HEXABLOCKGUI::getDlgBox(VtkDocumentGraphicView* dgview) +{ + if (!gViewDlgBox.contains(dgview)) return NULL; + return gViewDlgBox[dgview]; +} + +void HEXABLOCKGUI::switchOnGraphicView(VtkDocumentGraphicView* dgview) +{ + if (dgview == NULL) return; + + switchOffGraphicView(dgview, false); //to avoid double connect + + //connect signals + connect( selectionMgr(), SIGNAL( currentSelectionChanged() ), + dgview->getPatternDataSelectionModel(), SLOT( salomeSelectionChanged() ), Qt::UniqueConnection ); + connect( dgview->getPatternDataSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); + connect( dgview->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); + connect( dgview->getPatternGeomSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); + connect( dgview->getGroupsSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); + connect( dgview->getMeshSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); + + if (currentDocGView != NULL) + { + if (currentDocGView->getViewWindow() != NULL) + dgview->setViewWindow(currentDocGView->getViewWindow()); + else + { + dgview->setViewWindow(graphicViewsHandler->createVtkWindow()); + dgview->getViewWindow()->installEventFilter(this); + } + } + dgview->getViewWindow()->setFocus(); -// newMesh( "toto", 3, "FactoryServer"); -// newMesh + showAllMenus(); + //_showDialogBox(getDlgBox(dgview)); } -void HEXABLOCKGUI::test_make_cart_grid() +void HEXABLOCKGUI::switchOffGraphicView(VtkDocumentGraphicView* dgview, bool saveCurrentDlg) { -QModelIndex orig1 = _currentModel->addVertex( 0, 0, 0); -QModelIndex orig2 = _currentModel->addVertex( 10, 0, 0); -QModelIndex orig3 = _currentModel->addVertex( 0, 10, 0); -QModelIndex orig4 = _currentModel->addVertex( 10, 10, 0); -QModelIndex orig5 = _currentModel->addVertex( 0, 20, 0); -QModelIndex orig6 = _currentModel->addVertex( 10, 20, 0); + if (dgview == NULL) return; -QModelIndex vz = _currentModel->addVector(0, 0, 1); -QModelIndex vx = _currentModel->addVector(1, 0, 0); + //disconnect signals + disconnect( selectionMgr(), SIGNAL( currentSelectionChanged() ), + dgview->getPatternDataSelectionModel(), SLOT( salomeSelectionChanged() ) ); + disconnect( dgview->getPatternDataSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); + disconnect( dgview->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); + disconnect( dgview->getPatternGeomSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); + disconnect( dgview->getGroupsSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); + disconnect( dgview->getMeshSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); -//int dr = 1; -//int dl = 1; -//int nr = 2; -//int nl = 3; + if (saveCurrentDlg) + gViewDlgBox[dgview] = currentDialog; -// QModelIndex c1 = _currentModel->makeCylindrical(orig1, vx, vz, dr, 360, dl, nr, 4, nl, true); -// QModelIndex c2 = _currentModel->makeCylindrical(orig2, vx, vz, dr, 360, dl, nr, 8, nl, true); -// QModelIndex c3 = _currentModel->makeCylindrical(orig3, vx, vz, dr, 270, dl, nr, 8, nl, true); -// QModelIndex c4 = _currentModel->makeCylindrical(orig4, vx, vz, dr, 270, dl, nr, 7, nl, true); -// QModelIndex c5 = _currentModel->makeCylindrical(orig5, vx, vz, dr, 360, dl, nr, 5, nl, true); -// QModelIndex c6 = _currentModel->makeCylindrical(orig6, vx, vz, dr, 360, dl, nr, 6, nl, true); + //close opened dialog + if (currentDialog != NULL) currentDialog->close(); + if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); -} + initialMenus(); +} -void HEXABLOCKGUI::test_make_elmts_transform() +void HEXABLOCKGUI::switchModel(VtkDocumentGraphicView* dgview) { + DEBTRACE("HEXABLOCKGUI::switchModel " << dgview); -int size_x = 1; -int size_y = 1; -int size_z = 2; + if (dgview == NULL /*|| dgview == currentDocGView*/ ) //Need to switch? + { + MESSAGE("HEXABLOCKGUI::switchModel : no need to switch!"); + return; + } -QModelIndex orig = _currentModel->addVertex(0, 0, 0); -QModelIndex dirVr = _currentModel->addVector(1, 1, 1); + //switch off the current document graphic view (disconnect signals...) + if (currentDocGView != NULL) + { + //Hide current actor + hideActor(); + switchOffGraphicView(currentDocGView); + } -QModelIndex grid = _currentModel->makeCartesian(orig, dirVr, size_x, size_y, size_z);//, 0, 0, 0); -// orig.setScalar(2); + //clear the dialogs used by the current model so they can be used by the new model + if (currentDocGView != dgview) clearDialogs(); -// file_name = os.path.join(os.environ['TMP'], 'transfo0.vtk') -// _currentModel->saveVtk(file_name) -QModelIndex devant = _currentModel->addVector(5, 0, 0); -QModelIndex grid2 = _currentModel->makeTranslation(grid, devant); + _patternDataTreeView->setModel(dgview->getPatternDataModel()); + _patternBuilderTreeView->setModel(dgview->getPatternBuilderModel()); + _patternGeomTreeView->setModel(dgview->getPatternGeomModel()); + _groupsTreeView->setModel(dgview->getGroupsModel()); + _meshTreeView->setModel(dgview->getMeshModel()); -// file_name = os.path.join(os.environ['TMP'], 'transfo_translation.vtk') -// _currentModel->saveVtk(file_name) + _patternDataTreeView->setSelectionModel(dgview->getPatternDataSelectionModel()); + _patternDataTreeView->setEditTriggers(/*QAbstractItemView::EditKeyPressed*/QAbstractItemView::AllEditTriggers /*QAbstractItemView::NoEditTriggers*/); -QModelIndex grid4 = _currentModel->makeRotation(grid2, orig, dirVr, 45); + _patternBuilderTreeView->setSelectionModel(dgview->getPatternBuilderSelectionModel()); + _patternBuilderTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); + _patternGeomTreeView->setSelectionModel(dgview->getPatternGeomSelectionModel()); + _patternGeomTreeView->setEditTriggers(QAbstractItemView::NoEditTriggers); -// file_name = os.path.join(os.environ['TMP'], 'transfo_rotation.vtk'); -// _currentModel->saveVtk(file_name); + _groupsTreeView->setSelectionModel(dgview->getGroupsSelectionModel()); + _groupsTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); + _meshTreeView->setSelectionModel(dgview->getMeshSelectionModel()); + _meshTreeView->setEditTriggers(QAbstractItemView::AllEditTriggers); -// print "...test make elements by transforming elements OK" + //switch on this graphic view (connect signals...) + switchOnGraphicView(dgview); + currentDocGView = dgview; + if (_vertexAssocDiag != NULL) + { + _vertexAssocDiag->setDocumentModel(getCurrentModel()); + _vertexAssocDiag->setPatternDataSelectionModel(currentDocGView->getPatternDataSelectionModel()); + } + currentDocGView->getViewWindow()->setFocus(); + showOnlyActor(); + currentDocGView->getDocumentModel()->refresh(); + showAllMenus(); } +// void detruitDialog() { + // currentDialog = NULL; -void HEXABLOCKGUI::test() -{ - DEBTRACE("HEXABLOCKGUI::test"); - _currentGraphicView->update(); + // if (_sdjfgjh) delete _sdjfgjh; + + +// } + + +DocumentModel* HEXABLOCKGUI::getCurrentModel() +{ + if (currentDocGView == NULL) return NULL; + return currentDocGView->getDocumentModel(); } -void HEXABLOCKGUI::test_association() + +HEXABLOCKGUI::ViewType HEXABLOCKGUI::getActiveViewType() { - DEBTRACE("HEXABLOCKGUI::test_association"); - newDocument(); - - QModelIndex v0, v1, v2, v3, e0, e1, q0; - - DocumentModel::GeomObj v0Assoc, v1Assoc, v2Assoc, v3Assoc; - DocumentModel::GeomObj e0AssocA, e1AssocA, e1AssocB, e1AssocC; - DocumentModel::GeomObj q0AssocA, q0AssocB; - - DocumentModel::GeomObj v0Assoc_test, v1Assoc_test, v2Assoc_test, v3Assoc_test; - QList e1Assocs_test; - DocumentModel::GeomObj q0Assoc_test; - - v0 = _currentModel->addVertex(0, 0, 0); - v1 = _currentModel->addVertex(1, 0, 0); - v2 = _currentModel->addVertex(1, 1, 0); - v3 = _currentModel->addVertex(0, 1, 0); - e0 = _currentModel->addEdgeVertices(v0, v1); - e1 = _currentModel->addEdgeVertices(v1, v2); - q0 = _currentModel->addQuadVertices( v0, v1, v2, v3 ); - - -// >>> face3.GetEntry()'0:1:4' -// >>> e1.GetEntry()'0:1:8' -// >>> e2.GetEntry()'0:1:9' -// >>> e3.GetEntry()'0:1:10' -// >>> e4.GetEntry()'0:1:11' -// >>> v1.GetEntry()'0:1:12' -// >>> v2.GetEntry()'0:1:13' -// >>> v3.GetEntry()'0:1:14' -// >>> v4.GetEntry()'0:1:15' - - -// v0Assoc.name = "geomV0"; -// v0Assoc.entry = "0:1:1:1:3:6";//"0:1:12"; -// v0Assoc.brep = "brepV0"; -// v1Assoc.name = "geomV1"; -// v1Assoc.entry = "0:1:1:1:3:7";//"0:1:13"; -// v1Assoc.brep = "brepV1"; -// v2Assoc.name = "geomV2"; -// v2Assoc.entry = "0:1:1:1:3:8";//"0:1:14"; -// v2Assoc.brep = "brepV2"; -// v3Assoc.name = "geomV3"; -// v3Assoc.entry = "0:1:1:1:3:9";//"0:1:15"; -// v3Assoc.brep = "brepV3"; -// -// -// -// e0AssocA.name = "geomE0a"; -// e0AssocA.entry = "0:1:1:1:3:5";//"0:1:8"; -// e0AssocA.brep = "brepE0a"; -// e0AssocA.start = 0.10; -// e0AssocA.end = 0.95; -// -// -// -// e1AssocA.name = "geomE1a"; -// e1AssocA.entry = "0:1:1:1:3:2";//"0:1:8"; -// e1AssocA.brep = "brepE1a"; -// e1AssocA.start = 0.12; -// e1AssocA.end = 0.89; -// e1AssocB.name = "geomE1b"; -// e1AssocB.entry = "0:1:1:1:3:3";//"0:1:9"; -// e1AssocB.brep = "brepE1b"; -// e1AssocB.start = 0.20; -// e1AssocB.end = 0.80; -// e1AssocC.name = "geomE1c"; -// e1AssocC.entry = "0:1:1:1:3:4";//"0:1:10"; -// e1AssocC.brep = "brepE1c"; -// e1AssocC.start = 0.16; -// e1AssocC.end = 0.96; -// -// q0AssocA.name = "geomQuad"; -// q0AssocA.entry = "0:1:1:1:3"; -// q0AssocA.brep = "brepq0"; -// -// q0AssocB.name = "geomQuad"; -// q0AssocB.entry = "0:1:1:1:4"; -// q0AssocB.brep = "brepq0"; -// -// _currentModel->addAssociation( v0, v0Assoc ); -// _currentModel->addAssociation( v1, v1Assoc ); -// _currentModel->addAssociation( v2, v2Assoc ); -// _currentModel->addAssociation( v3, v3Assoc ); -// -// -// _currentModel->addAssociation( e0, e0AssocA ); -// -// _currentModel->addAssociation( e1, e1AssocA ); -// _currentModel->addAssociation( e1, e1AssocB ); -// _currentModel->addAssociation( e1, e1AssocC ); -// -// _currentModel->addAssociation( q0, q0AssocA ); -// _currentModel->addAssociation( q0, q0AssocB ); + SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if (anApp == NULL) return UNKNOWN; + SUIT_ViewManager* activeVm = anApp->activeViewManager(); + if (activeVm == NULL) return UNKNOWN; + QString vmType = activeVm->getType(); + if ( (vmType == SVTK_Viewer::Type()) || (vmType == VTKViewer_Viewer::Type()) ) + return VTK; + else if ( vmType == OCCViewer_Viewer::Type() ) + return OCC; + return UNKNOWN; +} +pair HEXABLOCKGUI::newHexaDocument() +{ + // Create Document from HEXABLOCK ENGINE + // WARNING : IN HEXABLOCK component, GUI and ENGINE share the same process + HEXABLOCK_ORB::Document_ptr docIn = _hexaEngine->addDocument("default"); + HEXA_NS::Document* doc = NULL; + QString docEntry; -// v0Assoc_test = _currentModel->getAssociations( v0 )[0]; -// v1Assoc_test = _currentModel->getAssociations( v1 )[0]; -// v2Assoc_test = _currentModel->getAssociations( v2 )[0]; -// v3Assoc_test = _currentModel->getAssociations( v3 )[0]; -// ASSERT( v0Assoc.name == v0Assoc_test.name ); -// ASSERT( v1Assoc.name == v1Assoc_test.name ); -// ASSERT( v2Assoc.name == v2Assoc_test.name ); -// ASSERT( v3Assoc.name == v3Assoc_test.name ); -// ASSERT( v0Assoc.entry == v0Assoc_test.entry ); -// ASSERT( v1Assoc.entry == v1Assoc_test.entry ); -// ASSERT( v2Assoc.entry == v2Assoc_test.entry ); -// ASSERT( v3Assoc.entry == v3Assoc_test.entry ); -// -// -// e1Assocs_test = _currentModel->getAssociations( e1 ); -// ASSERT( e1Assocs_test[0].name == e1AssocA.name ); -// ASSERT( e1Assocs_test[1].name == e1AssocB.name ); -// ASSERT( e1Assocs_test[2].name == e1AssocC.name ); -// ASSERT( e1Assocs_test[0].entry == e1AssocA.entry ); -// ASSERT( e1Assocs_test[1].entry == e1AssocB.entry ); -// ASSERT( e1Assocs_test[2].entry == e1AssocC.entry ); -// ASSERT( e1Assocs_test[0].start == e1AssocA.start ); -// ASSERT( e1Assocs_test[1].start == e1AssocB.start ); -// ASSERT( e1Assocs_test[2].start == e1AssocC.start ); -// ASSERT( e1Assocs_test[0].end == e1AssocA.end ); -// ASSERT( e1Assocs_test[1].end == e1AssocB.end ); -// ASSERT( e1Assocs_test[2].end == e1AssocC.end ); -// -// q0Assoc_test = _currentModel->getAssociations( q0 )[0]; -// ASSERT( q0Assoc_test.name == q0Assoc.name ); -// ASSERT( q0Assoc_test.entry == q0Assoc.entry ); + // looking doc impl ( c++ ) + Document_impl* dServant = DownCast( docIn ); + ASSERT( dServant ); + if ( dServant) doc = dServant->GetImpl(); + // looking for docEntry + if ( !CORBA::is_nil(docIn) ){ + CORBA::String_var anIOR = SalomeApp_Application::orb()->object_to_string( docIn ); + QString docIOR = anIOR.in(); + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( !docIOR.isEmpty() ) { + _PTR(SObject) SO( study->studyDS()->FindObjectIOR( docIOR.toLatin1().constData() ) ); + if ( SO ) + docEntry = SO->GetID().c_str(); + } + } + DEBTRACE("HEXABLOCKGUI::newHexaDocument docEntry "<desktop(); - QWidget *central = aParent->centralWidget(); - if (central) - central->setFocus(); - else - DEBTRACE("No Central Widget"); - - // BasicGUI_PointDlg* aDlg = new BasicGUI_PointDlg( NULL, aParent ); - // aDlg->show(); - - // Create Document from HEXABLOCK ENGINE - // WARNING : IN HEXABLOCK component, GUI and ENGINE share the same process - HEXABLOCK_ORB::Document_ptr docIn = _hexaEngine->addDocument("default"); - - HEXA_NS::Document* doc = NULL; - QString docEntry; - - // looking doc impl ( c++ ) - Document_impl* dServant = DownCast( docIn ); - ASSERT( dServant ); - if ( dServant) doc = dServant->GetImpl(); - - // doc->reorderFaces(); //CS_TEST - - // looking for docEntry - if ( !CORBA::is_nil(docIn) ){ - CORBA::String_var anIOR = SalomeApp_Application::orb()->object_to_string( docIn ); - QString docIOR = anIOR.in(); - SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - if ( !docIOR.isEmpty() ) { - _PTR(SObject) SO( study->studyDS()->FindObjectIOR( docIOR.toLatin1().constData() ) ); - if ( SO ) - docEntry = SO->GetID().c_str(); - } - } - - DEBTRACE("HEXABLOCKGUI::newDocument docEntry "<setHeaderData(0, Qt::Horizontal, tr("HELLOH0")); - // _currentModel->setHeaderData(1, Qt::Horizontal, tr("HELLOH1")); - // _currentModel->setHeaderData(0, Qt::Vertical, tr("HELLOV0")); - _patternDataModel = new PatternDataModel(this); - _patternBuilderModel = new PatternBuilderModel(this); - // _associationsModel = new AssociationsModel(this); - _groupsModel = new GroupsModel(this); - _meshModel = new MeshModel(this); - - _patternDataModel->setSourceModel(_currentModel); - _patternBuilderModel->setSourceModel(_currentModel); - // _associationsModel->setSourceModel(_currentModel); - _groupsModel->setSourceModel(_currentModel); - _meshModel->setSourceModel(_currentModel); - - // --- new Graphic view ( SVTK ) - _currentGraphicView = newGraphicView(); - suitVW = _currentGraphicView->get_SUIT_ViewWindow(); - - // --- setting model - _currentGraphicView->setModel(_currentModel); - // _currentGraphicView->setModel(_patternDataModel); - // connect( _currentModel, SIGNAL(patternDataChanged() ), _currentGraphicView, SLOT ( onPatternDatachanged() ) ); - _patternDataTreeView->setModel(_patternDataModel);//_currentModel; - // _patternDataTreeView->setModel(_currentModel);//; - _patternBuilderTreeView->setModel(_patternBuilderModel);//_currentModel; - // _associationTreeView->setModel(_associationsModel); - _groupsTreeView->setModel(_groupsModel); - _meshTreeView->setModel(_meshModel); - - - // if ( _patternDataSelectionModel ) delete _patternDataSelectionModel; - // if ( _patternBuilderSelectionModel ) delete _patternBuilderSelectionModel; - // if ( _groupsSelectionModel ) delete _groupsSelectionModel; - // if ( _meshSelectionModel ) delete _meshSelectionModel; - - // --- setting selection model - _patternDataSelectionModel = new PatternDataSelectionModel(_patternDataModel); - _patternBuilderSelectionModel = new PatternBuilderSelectionModel( _patternBuilderModel, _patternDataSelectionModel ); - _groupsSelectionModel = new GroupsSelectionModel(_groupsModel); - _meshSelectionModel = new MeshSelectionModel(_meshModel); - - _patternDataSelectionModel->setSalomeSelectionMgr( selectionMgr() ); - // _meshSelectionModel->setSalomeSelectionMgr( selectionMgr() ); - - _currentGraphicView->setSelectionModel(_patternDataSelectionModel); - _patternDataTreeView->setSelectionModel(_patternDataSelectionModel); - _patternDataTreeView->setSelectionMode(QAbstractItemView::SingleSelection); //QAbstractItemView::MultiSelection //CS_TEST - _patternBuilderTreeView->setSelectionModel(_patternBuilderSelectionModel); - _groupsTreeView->setSelectionModel(_groupsSelectionModel); - _meshTreeView->setSelectionModel(_meshSelectionModel); - _meshTreeView->setSelectionMode(QAbstractItemView::SingleSelection); - - _treeViewDelegate->setDocumentModel( _currentModel ); - _treeViewDelegate->setPatternDataSelectionModel( _patternDataSelectionModel ); - _treeViewDelegate->setPatternBuilderSelectionModel( _patternBuilderSelectionModel ); - _treeViewDelegate->setGroupsSelectionModel( _groupsSelectionModel/*_groupsTreeView->selectionModel()*/ ); - _treeViewDelegate->setMeshSelectionModel( _meshSelectionModel/*_meshTreeView->selectionModel()*/ ); - - - connect( _patternDataSelectionModel, SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - connect( _patternBuilderSelectionModel, SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - connect( _groupsSelectionModel, SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - connect( _meshSelectionModel, SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - - - // salome view/object browser/model management - _documentModels[ suitVW ] = _currentModel; - - // _salomeViews[ _currentModel ] = suitVW; - // std::map _salomeViews; - - _salomeViewWindows[docEntry] = suitVW; - currentVtkView = dynamic_cast( _currentGraphicView->get_SUIT_ViewWindow() ); - currentVtkView->raise(); - - // _currentGraphicView->setWindowTitle( _currentModel->getName() ); - // currentVtkView->setWindowTitle( _currentModel->getName() ); - // showDockWidgets(true); - // showPatternMenus - // _dwPattern->setVisible(true); - // _dwPattern->toggleViewAction()->setVisible(true); - _dwPattern->raise(); - // testDocument(); - // test_make_cart_grid(); - // test_make_elmts_transform(); - showAllMenus(); - getApp()->updateObjectBrowser(); - - graphicViewIsEmpty[suitVW] = true; -} + DEBTRACE("HEXABLOCKGUI::newDocument"); +// MESSAGE("===== NEW DOCUMENT: je commence ! " << jepeux); -void HEXABLOCKGUI::slot_modelChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) -{ - //std::cout << "HHHHHHHHHHHHHHHHHH Model changed." << std::endl; - //std::cout << "HHHHHHHHHHHHHHHHHH slot_modelChanged topLeft -> " << topLeft.data().toString().toStdString()<" << bottomRight.data().toString().toStdString()<desktop(); + QWidget *central = aParent->centralWidget(); + if (central) + central->setFocus(); + else + DEBTRACE("No Central Widget"); + + //Init OCC + if (currentOccGView == NULL) + { + currentOccGView = new OccGraphicView(graphicViewsHandler->createOccWindow(), + application()->desktop()); + currentOccGView->getViewWindow()->installEventFilter(this); + } + else if (currentOccGView->getViewWindow() == NULL) + { + currentOccGView->setViewWindow(graphicViewsHandler->createOccWindow()); + currentOccGView->getViewWindow()->installEventFilter(this); + } - _patternDataTreeView->openPersistentEditor( topLeft ); + //NEW DOCUMENT + // Create Document from HEXABLOCK ENGINE + pair docEntry_Doc ( newHexaDocument() ); + + VtkDocumentGraphicView* newGraphicView; + //One document at a time + if (currentDocGView != NULL) + { + if (currentDocGView->getViewWindow() == NULL) + { + currentDocGView->setViewWindow(graphicViewsHandler->createVtkWindow()); + currentDocGView->getViewWindow()->installEventFilter(this); + } + + // Create a new document with the current window + newGraphicView = graphicViewsHandler->createDocumentGraphicView( + new DocumentModel( docEntry_Doc.second, + docEntry_Doc.first, this ), + currentDocGView->getViewWindow(), + application()->desktop() ); + } + else + { + // Create the new Document Graphic View with a new window + newGraphicView = graphicViewsHandler->createDocumentGraphicView( + new DocumentModel( docEntry_Doc.second, + docEntry_Doc.first, this ), + graphicViewsHandler->createVtkWindow(), + application()->desktop() ); + newGraphicView->getViewWindow()->installEventFilter(this); + } + + if (newGraphicView == NULL) + //We couldn't create a new document graphic view + //we'd better show a dialog box info to inform the user + return; + + docs[docEntry_Doc.first] = newGraphicView; + switchModel(newGraphicView); //select the corresponding document in the browser instead + +// showAllMenus(); +// _dwPattern->raise(); + +// _PTR(Study) aStudy = (( SalomeApp_Study* )(getApp()->activeStudy()))->studyDS(); +// _PTR(SComponent) aComponent = aStudy->FindComponent("HEXABLOCK"); +// SalomeApp_DataModel::updateTree (aComponent, HEXABLOCKGUI::activeStudy()); + getApp()->updateObjectBrowser(); + showAllMenus(); +// jepeux = true; +// for (double i=0; i < 10000000000000000; ++i); + +// MESSAGE("===== NEW DOCUMENT: j'ai fini!"); -// // Make the combo boxes always displayed. -// for ( int i = 0; i < _currentModel->rowCount(); ++i ) -// { -// QModelIndex ind = _currentModel->index(i); -// _patternDataTreeView->openPersistentEditor( ind ); -// std::cout << "ind" << ind.data() << std::endl; -// } } + +//Loads the model from the xmlFile in the current graphic view void HEXABLOCKGUI::loadDocument( const QString &inFile ) { - DEBTRACE("HEXABLOCKGUI::loadDocument"); - QMainWindow *aParent = application()->desktop(); - QString selectedFile; + DEBTRACE("HEXABLOCKGUI::loadDocument"); - if ( inFile.isNull() ){ - QFileDialog dialog( aParent, tr("Open HexaBlock Document") , - QString::null, tr( "XML-Files (*.xml);;All Files (*)" ) ); - dialog.setHistory( getQuickDirList() ); - if (dialog.exec()){ - QStringList selectedFiles = dialog.selectedFiles(); - if (!selectedFiles.isEmpty()) - selectedFile = selectedFiles.first(); - } - } else - selectedFile = inFile; + createSComponent(); + QMainWindow *aParent = application()->desktop(); + QString selectedFile; + + if ( inFile.isNull() ){ + QFileDialog dialog( aParent, tr("Open HexaBlock Document") , + QString::null, tr( "XML-Files (*.xml);;All Files (*)" ) ); + dialog.setHistory( getQuickDirList() ); + + //use the last path as default + if (!(loadDocLastPath->absolutePath()).isEmpty()) + dialog.setDirectory(*loadDocLastPath); - if (! selectedFile.isEmpty()){ - if (vtkViewManager==NULL || vtkViewManager->getViewsCount()==0 || !graphicViewIsEmpty[vtkViewManager->getActiveView()]) - newDocument(); - _currentModel->load(selectedFile); - renameObject( _currentModel->documentEntry(), _currentModel->getName() ); - graphicViewIsEmpty[vtkViewManager->getActiveView()] = false; - } + if (dialog.exec()){ + QStringList selectedFiles = dialog.selectedFiles(); + if (!selectedFiles.isEmpty()) + selectedFile = selectedFiles.first(); + + //remember the selected path + *loadDocLastPath = dialog.directory(); + } + } else + selectedFile = inFile; + + if (! selectedFile.isEmpty()) + { + //we create a new document if necessary + if (currentDocGView == NULL) + //Need a new document + newDocument(); + else if (currentDocGView->getViewWindow() == NULL) //there's a document without a view + { + currentDocGView->setViewWindow(graphicViewsHandler->createVtkWindow()); + currentDocGView->getViewWindow()->installEventFilter(this); + } + + if (!currentDocGView->isEmpty()) + //we can only have one document for a graphic view + newDocument(); + + //we load the selected file in the current graphic view + currentDocGView->loadDocument(selectedFile); + DocumentModel* currentModel = getCurrentModel(); + renameObject( currentModel->documentEntry(), currentModel->getName() ); + +// _PTR(Study) aStudy = (( SalomeApp_Study* )(getApp()->activeStudy()))->studyDS(); +// _PTR(SComponent) aComponent = aStudy->FindComponent("HEXABLOCK"); +// SalomeApp_DataModel::updateTree (aComponent, HEXABLOCKGUI::activeStudy()); + getApp()->updateObjectBrowser(); + } + showOnlyActor(); } void HEXABLOCKGUI::saveDocument() { - QMainWindow *aParent = application()->desktop(); - QString anInitialPath = ""; - if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) - anInitialPath = QDir::currentPath(); -// QString aMeshName = anIO->getName(); - - QString aDocName = "document"; - QStringList filter; - filter.append( QObject::tr( "XML_FILES_FILTER" ) + " (*.xml)" ); - filter.append( QObject::tr( "ALL_FILES_FILTER" ) + " (*)" ); - QString aFilename = anInitialPath + QString("/") + aDocName; - aFilename = SUIT_FileDlg::getFileName( aParent, - aFilename, - filter, - tr( "Save HexaBlock Document" ), - false ); - if ( !aFilename.isEmpty() ) { - _currentModel->save( aFilename ); - } - //CS_TODO save doc + QMainWindow *aParent = application()->desktop(); +// QString anInitialPath = ""; +// if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() ) +// anInitialPath = QDir::currentPath(); + // QString aMeshName = anIO->getName(); + + + QString aDocName = "document", aFilename; + QStringList filter; + filter.append( QObject::tr( "XML_FILES_FILTER" ) + " (*.xml)" ); + filter.append( QObject::tr( "ALL_FILES_FILTER" ) + " (*)" ); + + //use the last selected directory as default path for file selection + aFilename = saveDocLastPath->absolutePath(); + if (!aFilename.isEmpty()) + aFilename += QString("/") + aDocName; + + //show the dialog for file selection + aFilename = SUIT_FileDlg::getFileName( aParent, + aFilename, + filter, + tr( "Save HexaBlock Document" ), + false ); + + //save the document in the selected file + if ( !aFilename.isEmpty() ) { + getCurrentVtkGraphicView()->saveDocument( aFilename ); + + //Remember the path for next save + QFileInfo fileInfo(aFilename); + *saveDocLastPath = fileInfo.dir(); + } + //CS_TODO save doc } +void HEXABLOCKGUI::slot_modelChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight) +{ + //std::cout << "HHHHHHHHHHHHHHHHHH Model changed." << std::endl; + //std::cout << "HHHHHHHHHHHHHHHHHH slot_modelChanged topLeft -> " << topLeft.data().toString().toStdString()<" << bottomRight.data().toString().toStdString()<openPersistentEditor( topLeft ); + + // // Make the combo boxes always displayed. + // for ( int i = 0; i < getCurrentModel()->rowCount(); ++i ) + // { + // QModelIndex ind = getCurrentModel()->index(i); + // _patternDataTreeView->openPersistentEditor( ind ); + // std::cout << "ind" << ind.data() << std::endl; + // } +} + void HEXABLOCKGUI::_showDialogBox( HexaBaseDialog* diag ) { - MESSAGE("HEXABLOCKGUI::_showDialogBox()"); - if (vtkViewManager == NULL || vtkViewManager->getViewsCount() == 0) return; - if (!diag) return; - MESSAGE("if (!diag) return;"); - if (!_dwInputPanel) return; - MESSAGE("if (!_dwInputPanel) return;"); + if (diag == NULL || _dwInputPanel == NULL || + getCurrentVtkGraphicView() == NULL) return; + + //mark this dialog as used by the current model + currentModelDialogs.insert(diag); - currentDialog = diag; - diag->setDocumentModel(_currentModel); - diag->setPatternDataSelectionModel(_patternDataSelectionModel); - diag->setPatternBuilderSelectionModel(_patternBuilderSelectionModel); - diag->setGroupsSelectionModel(_groupsSelectionModel); - diag->setMeshSelectionModel(_meshSelectionModel); + //close the current dialog box info + if (_treeViewDelegate != NULL) + _treeViewDelegate->closeDialog(); - //close the current widget - if (_treeViewDelegate != NULL) - _treeViewDelegate->closeDialog(); + if (_dwInputPanel->widget()) + _dwInputPanel->widget()->close(); - if (_dwInputPanel->widget()) - _dwInputPanel->widget()->close(); + //Temporary for debugging EdgeAssoc Faked InfoDialog + if (diag == _edgeAssocDiag) + diag->debugEdgeAssoc = true; + else + diag->debugEdgeAssoc = false; - //Temporary for debugging EdgeAssoc Faked InfoDialog - if (diag == _edgeAssocDiag) - diag->debugEdgeAssoc = true; - else - diag->debugEdgeAssoc = false; + if (diag == _quadAssocDiag || diag == _edgeAssocDiag || diag == _addShapeDiag) + assocInProgress = true; + else + assocInProgress = false; - if (diag == _quadAssocDiag || diag == _edgeAssocDiag) - assocInProgress = true; - else - assocInProgress = false; + //show the dialog box in the dockwidget + diag->resetSizeAndShow(_dwInputPanel); - //show the dialog box in the dockwidget - diag->resetSizeAndShow(_dwInputPanel); - diag->setFocus(); + //clear the current selections + if (HEXABLOCKGUI::selectionMgr() != NULL) + HEXABLOCKGUI::selectionMgr()->clearSelected(); + + currentDialog = diag; + diag->setFocus(); } void HEXABLOCKGUI::addVertex() { - if ( !_vertexDiag ){ - _vertexDiag = new VertexDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _vertexDiag ); + if ( !_vertexDiag ){ + _vertexDiag = new VertexDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _vertexDiag ); + + //set default name + HEXA_NS::Document* doc = getCurrentModel() ? getCurrentModel()->getHexaDocument() : NULL; + if (_vertexDiag != NULL && doc != NULL) + _vertexDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_VERTEX).c_str()); } void HEXABLOCKGUI::addEdge() { - if ( !_edgeDiag ){ - _edgeDiag = new EdgeDialog( _dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _edgeDiag ); + if ( !_edgeDiag ){ + _edgeDiag = new EdgeDialog( _dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _edgeDiag ); + + //set default name + HEXA_NS::Document* doc = getCurrentModel() ? getCurrentModel()->getHexaDocument() : NULL; + if (_edgeDiag != NULL && doc != NULL) + _edgeDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_EDGE).c_str()); } void HEXABLOCKGUI::addQuad() { - if ( !_quadDiag ){ - _quadDiag = new QuadDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _quadDiag ); + if ( !_quadDiag ){ + _quadDiag = new QuadDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + + } + _showDialogBox( _quadDiag ); + + //set default name + HEXA_NS::Document* doc = getCurrentModel() ? getCurrentModel()->getHexaDocument() : NULL; + if (_quadDiag != NULL && doc != NULL) + _quadDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_QUAD).c_str()); } void HEXABLOCKGUI::addHexa() { - if ( !_hexaDiag ){ - _hexaDiag = new HexaDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _hexaDiag ); + if ( !_hexaDiag ){ + _hexaDiag = new HexaDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _hexaDiag ); + + //set default name + HEXA_NS::Document* doc = getCurrentModel() ? getCurrentModel()->getHexaDocument() : NULL; + if (_hexaDiag != NULL && doc != NULL) + _hexaDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_HEXA).c_str()); } void HEXABLOCKGUI::addVector() { - if ( !_vectorDiag ){ - _vectorDiag = new VectorDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _vectorDiag ); + if ( !_vectorDiag ){ + _vectorDiag = new VectorDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _vectorDiag ); + + //set default name + HEXA_NS::Document* doc = getCurrentModel() ? getCurrentModel()->getHexaDocument() : NULL; + if (_vectorDiag != NULL && doc != NULL) + _vectorDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_VECTOR).c_str()); } void HEXABLOCKGUI::addCylinder() { - if ( !_cylinderDiag ){ - _cylinderDiag = new CylinderDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _cylinderDiag ); + if ( !_cylinderDiag ){ + _cylinderDiag = new CylinderDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _cylinderDiag ); + + //set default name + HEXA_NS::Document* doc = getCurrentModel() ? getCurrentModel()->getHexaDocument() : NULL; + if (_cylinderDiag != NULL && doc != NULL) + _cylinderDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_CYLINDER).c_str()); } void HEXABLOCKGUI::addPipe() { - if ( !_pipeDiag){ - _pipeDiag = new PipeDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _pipeDiag ); + if ( !_pipeDiag){ + _pipeDiag = new PipeDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _pipeDiag ); + + //set default name + HEXA_NS::Document* doc = getCurrentModel() ? getCurrentModel()->getHexaDocument() : NULL; + if (_pipeDiag != NULL && doc != NULL) + _pipeDiag->name_le->setText(doc->getNextName(HEXA_NS::EL_CYLINDER).c_str()); } void HEXABLOCKGUI::makeGrid() { - if ( !_makeGridDiag ){ - _makeGridDiag = new MakeGridDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _makeGridDiag ); + if ( !_makeGridDiag ){ + _makeGridDiag = new MakeGridDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _makeGridDiag ); } void HEXABLOCKGUI::makeCylinder() { - if ( !_makeCylinderDiag ){ - _makeCylinderDiag = new MakeCylinderDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _makeCylinderDiag ); + if ( !_makeCylinderDiag ){ + _makeCylinderDiag = new MakeCylinderDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _makeCylinderDiag ); } void HEXABLOCKGUI::makePipe() { - if ( !_makePipeDiag ){ - _makePipeDiag = new MakePipeDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _makePipeDiag ); + if ( !_makePipeDiag ){ + _makePipeDiag = new MakePipeDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _makePipeDiag ); } void HEXABLOCKGUI::makeCylinders() { - if ( !_makeCylindersDiag ){ - _makeCylindersDiag = new MakeCylindersDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _makeCylindersDiag ); + if ( !_makeCylindersDiag ){ + _makeCylindersDiag = new MakeCylindersDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _makeCylindersDiag ); } void HEXABLOCKGUI::makePipes() { - if ( !_makePipesDiag ){ - _makePipesDiag = new MakePipesDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _makePipesDiag ); + if ( !_makePipesDiag ){ + _makePipesDiag = new MakePipesDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _makePipesDiag ); } void HEXABLOCKGUI::makeHemiSphere() // NEW HEXA3 { - if ( !_makeHemiSphereDiag ){ - _makeHemiSphereDiag = new MakeHemiSphereDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _makeHemiSphereDiag ); + if ( !_makeHemiSphereDiag ){ + _makeHemiSphereDiag = new MakeHemiSphereDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _makeHemiSphereDiag ); } void HEXABLOCKGUI::removeHexa() { - if ( !_removeHexaDiag ){ - _removeHexaDiag = new RemoveHexaDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _removeHexaDiag ); + if ( !_removeHexaDiag ){ + _removeHexaDiag = new RemoveHexaDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _removeHexaDiag ); } void HEXABLOCKGUI::prismQuad() { - if ( !_prismQuadDiag ){ - _prismQuadDiag = new PrismQuadDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _prismQuadDiag ); + if ( !_prismQuadDiag ){ + _prismQuadDiag = new PrismQuadDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _prismQuadDiag ); } void HEXABLOCKGUI::joinQuad() { - if ( !_joinQuadDiag ){ - _joinQuadDiag = new JoinQuadDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _joinQuadDiag ); + if ( !_joinQuadDiag ){ + _joinQuadDiag = new JoinQuadDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _joinQuadDiag ); } void HEXABLOCKGUI::merge() { - if ( !_mergeDiag ){ - _mergeDiag = new MergeDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _mergeDiag ); + if ( !_mergeDiag ){ + _mergeDiag = new MergeDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _mergeDiag ); } void HEXABLOCKGUI::disconnectElts() { - if ( !_disconnectDiag ){ - _disconnectDiag = new DisconnectDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _disconnectDiag ); + if ( !_disconnectDiag ){ + _disconnectDiag = new DisconnectDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _disconnectDiag ); } void HEXABLOCKGUI::cutEdge() { - if ( !_cutEdgeDiag ){ - _cutEdgeDiag = new CutEdgeDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _cutEdgeDiag ); + if ( !_cutEdgeDiag ){ + _cutEdgeDiag = new CutEdgeDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _cutEdgeDiag ); } void HEXABLOCKGUI::makeTransformation() { - if ( !_makeTransformationDiag ){ - _makeTransformationDiag = new MakeTransformationDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _makeTransformationDiag ); + if ( !_makeTransformationDiag ){ + _makeTransformationDiag = new MakeTransformationDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _makeTransformationDiag ); } void HEXABLOCKGUI::makeSymmetry() { - if ( !_makeSymmetryDiag ){ - _makeSymmetryDiag = new MakeSymmetryDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _makeSymmetryDiag ); + if ( !_makeSymmetryDiag ){ + _makeSymmetryDiag = new MakeSymmetryDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _makeSymmetryDiag ); } void HEXABLOCKGUI::performTransformation() { - if ( !_performTransformationDiag ){ - _performTransformationDiag = new PerformTransformationDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _performTransformationDiag ); + if ( !_performTransformationDiag ){ + _performTransformationDiag = new PerformTransformationDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _performTransformationDiag ); } void HEXABLOCKGUI::performSymmetry() { - if ( !_performSymmetryDiag ){ - _performSymmetryDiag = new PerformSymmetryDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _performSymmetryDiag ); + if ( !_performSymmetryDiag ){ + _performSymmetryDiag = new PerformSymmetryDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _performSymmetryDiag ); } void HEXABLOCKGUI::replaceHexa() // NEW HEXA3 { - if ( !_replaceHexaDiag ){ - _replaceHexaDiag = new ReplaceHexaDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _replaceHexaDiag ); + if ( !_replaceHexaDiag ){ + _replaceHexaDiag = new ReplaceHexaDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _replaceHexaDiag ); } void HEXABLOCKGUI::quadRevolution() // NEW HEXA3 { - if ( !_quadRevolutionDiag ){ - _quadRevolutionDiag = new QuadRevolutionDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _quadRevolutionDiag ); + if ( !_quadRevolutionDiag ){ + _quadRevolutionDiag = new QuadRevolutionDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _quadRevolutionDiag ); } @@ -2449,288 +2971,361 @@ void HEXABLOCKGUI::quadRevolution() // NEW HEXA3 void HEXABLOCKGUI::assocVertex() { - MESSAGE("HEXABLOCKGUI::assocVertex()"); - if (!_dwInputPanel) return; - QWidget* d = dynamic_cast(_dwInputPanel->parent()); + if (!_dwInputPanel) return; + QWidget* d = dynamic_cast(_dwInputPanel->parent()); - if ( !_vertexAssocDiag ){ - _vertexAssocDiag = new VertexAssocDialog( NULL, d ); - if (!_vertexAssocDiag) return; - } - _vertexAssocDiag->setDocumentModel(_currentModel); - _vertexAssocDiag->setPatternDataSelectionModel(_patternDataSelectionModel); + VtkDocumentGraphicView* currentDGView = getCurrentVtkGraphicView(); + if (currentDGView == NULL) return; - //close current widget - if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); - if (_dwInputPanel->widget()) _dwInputPanel->widget()->close(); + if ( !_vertexAssocDiag ){ + _vertexAssocDiag = new VertexAssocDialog( NULL, d ); + if (!_vertexAssocDiag) return; + } + _vertexAssocDiag->setDocumentModel(getCurrentModel()); + _vertexAssocDiag->setPatternDataSelectionModel(currentDGView->getPatternDataSelectionModel()); + + //close current widget + if (_treeViewDelegate != NULL) _treeViewDelegate->closeDialog(); + if (_dwInputPanel->widget()) _dwInputPanel->widget()->close(); - //add the vertex assoc dialog in the dockwidget - if ( !_dwInputPanel->isVisible() ) _dwInputPanel->setVisible(true); - _dwInputPanel->setWidget(_vertexAssocDiag); - _dwInputPanel->setWindowTitle(_vertexAssocDiag->windowTitle()); - _vertexAssocDiag->adjustSize(); - assocInProgress = true; - _vertexAssocDiag->show(); + //add the vertex assoc dialog in the dockwidget + if ( !_dwInputPanel->isVisible() ) _dwInputPanel->setVisible(true); + _dwInputPanel->setWidget(_vertexAssocDiag); + _dwInputPanel->setWindowTitle(_vertexAssocDiag->windowTitle()); + _vertexAssocDiag->adjustSize(); + assocInProgress = true; + _vertexAssocDiag->show(); } void HEXABLOCKGUI::assocEdge() { - if ( !_edgeAssocDiag ){ - _edgeAssocDiag = new EdgeAssocDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - _edgeAssocDiag->setGeomEngine( _geomEngine ); - } - _showDialogBox( _edgeAssocDiag ); + if ( !_edgeAssocDiag ){ + _edgeAssocDiag = new EdgeAssocDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + // _edgeAssocDiag->setGeomEngine( _geomEngine ); + } + _showDialogBox( _edgeAssocDiag ); } void HEXABLOCKGUI::assocQuad() { - if ( !_quadAssocDiag ){ - _quadAssocDiag = new QuadAssocDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _quadAssocDiag ); + if ( !_quadAssocDiag ){ + _quadAssocDiag = new QuadAssocDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _quadAssocDiag ); } void HEXABLOCKGUI::addGroup() { - if ( !_groupDiag ){ - _groupDiag = new GroupDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _groupDiag ); + if ( !_groupDiag ){ + _groupDiag = new GroupDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _groupDiag ); + if (_groupDiag != NULL && getCurrentModel() != NULL) + { + HEXA_NS::Document* doc = getCurrentModel()->getHexaDocument(); + if (doc == NULL) return; + char defaultName[16]; + sprintf (defaultName, "g%04d", doc->countGroup()); + _groupDiag->name_le->setText(defaultName); + } } - -/* void HEXABLOCKGUI::removeGroup() { - QItemSelectionModel *groupsSelectionModel = _groupsTreeView->selectionModel(); - QModelIndex selected = groupsSelectionModel->currentIndex(); - selected = _groupsModel->mapToSource( selected ); + VtkDocumentGraphicView* currentDGView = getCurrentVtkGraphicView(); + if (currentDGView == NULL) return; -/* - if ( !selected.isValid() ){ - SUIT_MessageBox::information( 0, tr( "CANNOT REMOVE GROUP" ), tr( "No group selected!" ) ); - return; - } - - //Demande de confirmation de la suppression des groupes - if (SUIT_MessageBox::question( - 0, - tr("Remove Group"), - tr("Remove group : %1 ?").arg(selected.data().toString()), - SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel, - SUIT_MessageBox::Cancel - ) == SUIT_MessageBox::Cancel) return; - - groupsSelectionModel->clearSelection(); - - std::cout << "////////////////////////// " << selected.data().toString().toStdString() << std::endl; - bool removed = _currentModel->removeGroup( selected ); - //std::cout << " " << selected.data().toString().toStdString() << std::endl; - if ( !removed ) { - SUIT_MessageBox::critical( 0, tr( "ERR_ERROR" ), tr( "CANNOT REMOVE %1" ).arg(selected.data().toString()) ); - groupsSelectionModel->clearSelection(); - return; - } -}*/ - - - -void HEXABLOCKGUI::removeGroup() -{ - QItemSelectionModel *groupsSelectionModel = _groupsTreeView->selectionModel(); - QModelIndexList l = groupsSelectionModel->selectedIndexes(); - int nbGroupsRemoved = 0; + QItemSelectionModel *groupsSelectionModel = _groupsTreeView->selectionModel(); + QModelIndexList l = groupsSelectionModel->selectedIndexes(); + int nbGroupsRemoved = 0; - if ( l.isEmpty() ){ - SUIT_MessageBox::information( 0, tr( "CANNOT REMOVE GROUP" ), - tr( "No group selected!" ) ); - return; - } - - foreach( QModelIndex selected, l ){ - if ( selected.data(HEXA_TREE_ROLE) == GROUP_TREE ){ - selected = _groupsModel->mapToSource( selected ); - Q_ASSERT(selected.isValid()); - - //Confirm the deletion of the group - if (SUIT_MessageBox::question( - 0, - tr("Remove Group"), - tr("Remove group : %1 ?").arg(selected.data().toString()), - SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel, - SUIT_MessageBox::Cancel - ) == SUIT_MessageBox::Cancel) return; - - bool removed = _currentModel->removeGroup( selected ); - if ( !removed ) { - SUIT_MessageBox::critical( 0, tr( "ERR_ERROR" ), - tr( "CANNOT REMOVE %1" ).arg(selected.data().toString()) ); + if ( l.isEmpty() ){ + SUIT_MessageBox::information( 0, tr( "CANNOT REMOVE GROUP" ), + tr( "No group selected!" ) ); return; - } - nbGroupsRemoved++; } - } - if (!nbGroupsRemoved) - SUIT_MessageBox::information( 0, tr( "CANNOT REMOVE GROUP" ), - tr( "No group selected!" ) ); -} + foreach( QModelIndex selected, l ){ + if ( selected.data(HEXA_TREE_ROLE) == GROUP_TREE ){ + selected = currentDGView->getGroupsModel()->mapToSource( selected ); + Q_ASSERT(selected.isValid()); + + //Confirm the deletion of the group + if (SUIT_MessageBox::question( + 0, + tr("Remove Group"), + tr("Remove group : %1 ?").arg(selected.data().toString()), + SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel, + SUIT_MessageBox::Cancel + ) == SUIT_MessageBox::Cancel) return; + + bool removed = getCurrentModel()->removeGroup( selected ); + if ( !removed ) { + SUIT_MessageBox::critical( 0, tr( "ERR_ERROR" ), + tr( "CANNOT REMOVE %1" ).arg(selected.data().toString()) ); + return; + } + nbGroupsRemoved++; + } + } + if (!nbGroupsRemoved) + SUIT_MessageBox::information( 0, tr( "CANNOT REMOVE GROUP" ), + tr( "No group selected!" ) ); +} void HEXABLOCKGUI::addLaw() { - if ( !_lawDiag ){ - _lawDiag = new LawDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _lawDiag ); + if ( !_lawDiag ){ + _lawDiag = new LawDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _lawDiag ); + if (_lawDiag != NULL && getCurrentModel() != NULL) + { + HEXA_NS::Document* doc = getCurrentModel()->getHexaDocument(); + if (doc == NULL) return; + char defaultName[16]; + sprintf (defaultName, "l%04d", doc->countLaw()); + _lawDiag->name_le->setText(defaultName); + } } void HEXABLOCKGUI::removeLaw() { + VtkDocumentGraphicView* currentDGView = getCurrentVtkGraphicView(); + if (currentDGView == NULL) return; - QModelIndexList l = _meshSelectionModel->selectedIndexes(); - int nbLawsRemoved = 0; - - if ( l.isEmpty() ){ - SUIT_MessageBox::information( 0, tr( "CANNOT REMOVE LAW" ), - tr( "No law selected!" ) ); - return; - } - - foreach( QModelIndex selected, l ){ - if ( selected.data(HEXA_TREE_ROLE) == LAW_TREE ){ - selected = _meshModel->mapToSource( selected ); - Q_ASSERT(selected.isValid()); - - //Confirm the deletion of the law - if (SUIT_MessageBox::question( - 0, - tr("Remove Law"), - tr("Remove law : %1 ?\nAll propagations having this law will \ -have the default law.").arg(selected.data().toString()), - SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel, - SUIT_MessageBox::Cancel - ) == SUIT_MessageBox::Cancel) return; + QModelIndexList l = currentDGView->getMeshSelectionModel()->selectedIndexes(); + int nbLawsRemoved = 0; - bool removed = _currentModel->removeLaw(selected); - if ( !removed ) { - SUIT_MessageBox::critical( 0, tr( "ERR_ERROR" ), - tr( "CANNOT REMOVE %1" ).arg(selected.data().toString()) ); + if ( l.isEmpty() ){ + SUIT_MessageBox::information( 0, tr( "CANNOT REMOVE LAW" ), + tr( "No law selected!" ) ); return; - } - nbLawsRemoved++; } - } - if (!nbLawsRemoved) - SUIT_MessageBox::information( 0, tr( "CANNOT REMOVE LAW" ), - tr( "No law selected!" ) ); + + foreach( QModelIndex selected, l ){ + if ( selected.data(HEXA_TREE_ROLE) == LAW_TREE ){ + selected = currentDGView->getMeshModel()->mapToSource( selected ); + Q_ASSERT(selected.isValid()); + + //Confirm the deletion of the law + if (SUIT_MessageBox::question( + 0, + tr("Remove Law"), + tr("Remove law : %1 ?\nAll propagations having this law will have the default law.").arg(selected.data().toString()), + SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel, + SUIT_MessageBox::Cancel + ) == SUIT_MessageBox::Cancel) return; + + bool removed = getCurrentModel()->removeLaw(selected); + if ( !removed ) { + SUIT_MessageBox::critical( 0, tr( "ERR_ERROR" ), + tr( "CANNOT REMOVE %1" ).arg(selected.data().toString()) ); + return; + } + nbLawsRemoved++; + } + } + if (!nbLawsRemoved) + SUIT_MessageBox::information( 0, tr( "CANNOT REMOVE LAW" ), + tr( "No law selected!" ) ); } void HEXABLOCKGUI::setPropagation() { - if ( !_propagationDiag ){ - _propagationDiag = new PropagationDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _showDialogBox( _propagationDiag ); + if ( !_propagationDiag ){ + _propagationDiag = new PropagationDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _showDialogBox( _propagationDiag ); } // Dialog box to compute a mesh from a document // -------------------------------------------- - void HEXABLOCKGUI::computeMesh() { - if ( !_computeMeshDiag ){ - _computeMeshDiag = new ComputeMeshDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); - } - _computeMeshDiag->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - _showDialogBox( _computeMeshDiag ); + if ( !_computeMeshDiag ){ + _computeMeshDiag = new ComputeMeshDialog(_dwInputPanel, HexaBaseDialog::NEW_MODE); + } + _computeMeshDiag->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + _showDialogBox( _computeMeshDiag ); } void HEXABLOCKGUI::clearAssociations() { -// QMessageBox::warning( 0, "windowTitle()", "clearAssociations" ); - QModelIndex iDataModel = _patternDataTreeView->currentIndex(); - QModelIndex iModel = _patternDataModel->mapToSource(iDataModel); + VtkDocumentGraphicView* currentDGView = getCurrentVtkGraphicView(); + if (currentDGView == NULL) return; + + // QMessageBox::warning( 0, "windowTitle()", "clearAssociations" ); + QModelIndex iDataModel = _patternDataTreeView->currentIndex(); + QModelIndex iModel = currentDGView->getPatternDataModel()->mapToSource(iDataModel); + + getCurrentModel()->clearEltAssociations(iModel); + + // SUIT_MessageBox::information( 0, tr( "HEXA_INFO" ), tr( "ASSOCIATION CLEARED" ) ); +} + +void HEXABLOCKGUI::showModelInfo() +{ + //create the info dialog if not yet + if (_modelInfoDiag == NULL) + _modelInfoDiag = new ModelInfoDialog(_dwInputPanel); - _currentModel->clearEltAssociations(iModel); + //show the model informations dialog + _showDialogBox( _modelInfoDiag ); +} + +void HEXABLOCKGUI::addShape() +{ + //create the info dialog if not yet + if (_addShapeDiag == NULL) + _addShapeDiag = new AddShapeDialog(_dwInputPanel); -// SUIT_MessageBox::information( 0, tr( "HEXA_INFO" ), tr( "ASSOCIATION CLEARED" ) ); + //show the model informations dialog + _showDialogBox( _addShapeDiag ); } void HEXABLOCKGUI::clearAllAssociations() { - //Confirm the deletion of the associations - if (SUIT_MessageBox::question( - 0, - tr("Clear Associations"), - tr("Clear all associations ?"), - SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel, - SUIT_MessageBox::Cancel - ) == SUIT_MessageBox::Cancel) return; + VtkDocumentGraphicView* currentDGView = getCurrentVtkGraphicView(); + if (currentDGView == NULL) return; + + int currentChildIndex = 0; + QModelIndex currentIndex = currentDGView->getPatternDataModel()->mapToSource(_patternDataTreeView->currentIndex()); + if (!currentIndex.isValid()) return; + QVariant currentAssocVariant; + QString currentAssocEntry; + + //Confirm the deletion of the associations + QVariant treeVariant = currentIndex.data( HEXA_TREE_ROLE ); + if ( !treeVariant.isValid() ) return; + int eltType = treeVariant.toInt(); + QString typeStr = ""; + HEXA_NS::EnumElt hexaType; + if (eltType == VERTEX_DIR_TREE) + { + typeStr = tr("TREE_ITEM_VERTEX").toUpper(); + hexaType = HEXA_NS::EL_VERTEX; + } + else if (eltType == EDGE_DIR_TREE) + { + typeStr = tr("TREE_ITEM_EDGE").toUpper(); + hexaType = HEXA_NS::EL_EDGE; + } + else if (eltType == QUAD_DIR_TREE) + { + typeStr = tr("TREE_ITEM_QUAD").toUpper(); + hexaType = HEXA_NS::EL_QUAD; + } - int currentChildIndex = 0; - QModelIndex currentIndex = _patternDataModel->mapToSource(_patternDataTreeView->currentIndex()); - QVariant currentAssocVariant; - QString currentAssocEntry; + if (SUIT_MessageBox::question( + 0, + tr("CLEAR_ASSOCIATIONS"), + tr("CLEAR_ALL_ASSOCIATIONS_ON") + " " + typeStr + "?", + SUIT_MessageBox::Ok | SUIT_MessageBox::Cancel, + SUIT_MessageBox::Cancel + ) == SUIT_MessageBox::Cancel) return; - QModelIndex currentChild = currentIndex.child(currentChildIndex++, 0); - while( currentChild.isValid() ) { - currentAssocVariant = currentChild.data( HEXA_ASSOC_ENTRY_ROLE ); - currentAssocEntry = currentChild.data( HEXA_ASSOC_ENTRY_ROLE ).toString(); - if ( currentAssocVariant.isValid() && !currentAssocEntry.isEmpty() ) - _currentModel->clearEltAssociations(currentChild); + DocumentModel* docModel = getCurrentModel(); + if (docModel == NULL) return; + docModel->clearAssociation(hexaType); - currentChild = currentChild.sibling(currentChildIndex++, 0); - } +// QModelIndex currentChild = currentIndex.child(currentChildIndex++, 0); +// while( currentChild.isValid() ) { +// +// currentAssocVariant = currentChild.data( HEXA_ASSOC_ENTRY_ROLE ); +// currentAssocEntry = currentChild.data( HEXA_ASSOC_ENTRY_ROLE ).toString(); +// if ( currentAssocVariant.isValid() && !currentAssocEntry.isEmpty() ) +// getCurrentModel()->clearEltAssociations(currentChild); +// +// currentChild = currentChild.sibling(currentChildIndex++, 0); +// } - //SUIT_MessageBox::information( 0, tr( "HEXA_INFO" ), tr( "ASSOCIATION CLEARED" ) ); + //SUIT_MessageBox::information( 0, tr( "HEXA_INFO" ), tr( "ASSOCIATION CLEARED" ) ); } void HEXABLOCKGUI::showAssociations() { - QModelIndexList elts; - int currentChildIndex = 0; - QVariant currentAssocVariant; - QString currentAssocEntry; - QModelIndex currentIndex = _patternDataTreeView->currentIndex(); - QModelIndex currentChild = currentIndex.child(currentChildIndex++, 0); + VtkDocumentGraphicView* currentDGView = getCurrentVtkGraphicView(); + if (currentDGView == NULL) return; - while( currentChild.isValid() ) { + QModelIndexList elts; + int currentChildIndex = 0; + QVariant currentAssocVariant; + QString currentAssocEntry; + QModelIndex currentIndex = _patternDataTreeView->currentIndex(); + QModelIndex currentChild = currentIndex.child(currentChildIndex++, 0); - currentAssocVariant = currentChild.data( HEXA_ASSOC_ENTRY_ROLE ); - currentAssocEntry = currentChild.data( HEXA_ASSOC_ENTRY_ROLE ).toString(); - if ( currentAssocVariant.isValid() && !currentAssocEntry.isEmpty() ) - elts << currentChild; + while( currentChild.isValid() ) { - currentChild = currentChild.sibling(currentChildIndex++, 0); - } - _patternDataSelectionModel-> highlightVTKElts( elts ); + currentAssocVariant = currentChild.data( HEXA_ASSOC_ENTRY_ROLE ); + currentAssocEntry = currentChild.data( HEXA_ASSOC_ENTRY_ROLE ).toString(); + if ( currentAssocVariant.isValid() && !currentAssocEntry.isEmpty() ) + elts << currentChild; + currentChild = currentChild.sibling(currentChildIndex++, 0); + } + currentDGView->getPatternDataSelectionModel()->highlightEltsWithAssocs(elts); } LightApp_SelectionMgr* HEXABLOCKGUI::selectionMgr() { - SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); - if( anApp ) - return dynamic_cast( anApp->selectionMgr() ); - else - return NULL; + SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if( anApp ) + return dynamic_cast( anApp->selectionMgr() ); + else + return NULL; +} + +bool HEXABLOCKGUI::eventFilter(QObject *obj, QEvent *event) +{ + if ( currentDialog == NULL ) return false; + + if ( event->type() == QEvent::Enter ){ // ENTER EVENT + + // The window acquire the focus when the cursor enter + + //OCC - window enter + OCCViewer_ViewWindow* occWindow = dynamic_cast(obj); + if ( occWindow != NULL) + { + if (!occWindow->hasFocus()) occWindow->setFocus(); + if (currentDialog != NULL && !currentDialog->isHidden()) + currentDialog->onWindowActivated(occWindow->getViewManager()); + } + + //VTK + SVTK_ViewWindow* vtkWindow = dynamic_cast(obj); + if ( vtkWindow != NULL) + { + if (!vtkWindow->hasFocus()) vtkWindow->setFocus(); + if (currentDialog != NULL && !currentDialog->isHidden()) + currentDialog->onWindowActivated(vtkWindow->getViewManager()); + } + + //Don't pass the signal + return true; + } + else + //standard event processing + return QObject::eventFilter(obj, event); } QStringList HEXABLOCKGUI::getQuickDirList() { - QStringList dirList; - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - if ( resMgr ) - dirList = resMgr->stringValue( "FileDlg", "QuickDirList" ).split( ';', QString::SkipEmptyParts ); - return dirList; + QStringList dirList; + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + if ( resMgr ) + dirList = resMgr->stringValue( "FileDlg", "QuickDirList" ).split( ';', QString::SkipEmptyParts ); + + return dirList; } @@ -2739,15 +3334,15 @@ QStringList HEXABLOCKGUI::getQuickDirList() extern "C" { - HEXABLOCKGUI_EXPORT CAM_Module* createModule() - { +HEXABLOCKGUI_EXPORT CAM_Module* createModule() + { return new HEXABLOCKGUI(); - } + } - HEXABLOCKGUI_EXPORT char* getModuleVersion() - { +HEXABLOCKGUI_EXPORT char* getModuleVersion() + { return (char*)HEXABLOCK_VERSION_STR; - } + } } @@ -2755,6 +3350,7 @@ extern "C" // int dim, // const std::string& container ) // { + // SalomeApp_Application* app = getApp(); // int activeStudyId = app->activeStudy()->id(); // @@ -2766,7 +3362,7 @@ extern "C" // std::cout << "_smeshEngine =>" << _smeshEngine << std::endl; // std::cout << "_geomEngine =>" << _geomEngine << std::endl; // -// HEXA_NS::Document* docImpl = _currentModel->documentImpl(); +// HEXA_NS::Document* docImpl = getCurrentModel()->documentImpl(); // std::cout << "docImpl =>" << docImpl << std::endl; // std::cout << "docImpl->getFile() =>" << docImpl->getFile() << std::endl; // HEXABLOCK_ORB::Document_var anDocObj= _hexaEngine->loadDocument( docImpl->getFile() ); @@ -2867,42 +3463,6 @@ SMESH::SMESH_Gen_var SMESHGUI::GetSMESHGen() return myComponentSMESH; }*/ - bool HEXABLOCKGUI::eventFilter(QObject *obj, QEvent *event) - { - if ( event->type() == QEvent::Enter ){//QEvent::Show ){ //QEvent::KeyPress) { -// showDocumentMenus( false ); -// showPatternMenus( false ); -// showAssociationMenus( false ); -// showGroupsMenus( false ); -// showMeshMenus( false ); -// if ( obj == _dwObjectBrowser ) { -// showDocumentMenus( true ); -// } else if ( obj == _dwPattern ) { -// showPatternMenus( true ); -// } else if ( obj == _dwAssociation ) { -// showAssociationMenus( true ); -// } else if ( obj == _dwGroups ) { -// showGroupsMenus( true ); -// } else if ( obj == _dwMesh ) { -// -// showMeshMenus( true ); -// } - OCCViewer_ViewWindow* occWindow = dynamic_cast(obj); - if ( occWindow != NULL ) - { - occWindow->setFocus(); - } - SVTK_ViewWindow* vtkWindow = dynamic_cast(obj); - if (vtkWindow != NULL) - { -// vtkWindow->setFocus(); - } - return true; - } else { - // standard event processing - return QObject::eventFilter(obj, event); - } - } // try { // // throw SALOME_Exception(LOCALIZED("assocVertex")); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx index 10817e9..49e7126 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI.hxx @@ -22,6 +22,7 @@ #include #include +#include #include #include @@ -32,6 +33,7 @@ #include #include +#include // #include #include @@ -46,6 +48,8 @@ #include "GEOMGUI_OCCSelector.h" +#include "hexa_base.hxx" + @@ -58,7 +62,9 @@ namespace HEXABLOCK { namespace GUI { - class DocumentGraphicView; + class VtkDocumentGraphicView; + class OccGraphicView; + class GraphicViewsHandler; class DocumentDelegate; class DocumentModel; class PatternDataModel; @@ -104,6 +110,8 @@ namespace HEXABLOCK class ReplaceHexaDialog; class QuadRevolutionDialog; class MakeHemiSphereDialog; + class ModelInfoDialog; + class AddShapeDialog; } } @@ -114,6 +122,7 @@ class SUIT_ViewWindow; class SVTK_ViewWindow; class OCCViewer_ViewWindow; class LightApp_VTKSelector; +class MyGEOMBase_Helper; // // SALOME KERNEL includes // #include @@ -133,6 +142,12 @@ public: HEXABLOCKGUI(); virtual ~HEXABLOCKGUI(); + enum ViewType { + VTK, + OCC, + UNKNOWN + }; + static SalomeApp_Study* activeStudy(); static HEXABLOCK_ORB::HEXABLOCK_Gen_ptr InitHEXABLOCKGen( SalomeApp_Application* ); @@ -141,10 +156,17 @@ public: static LightApp_SelectionMgr* selectionMgr(); + //add an object in the study + static QString addInStudy(QString& fileName); + - static SVTK_ViewWindow* currentVtkView; - static OCCViewer_ViewWindow* currentOccView; +// static SVTK_ViewWindow* currentVtkView; + static HEXABLOCK::GUI::VtkDocumentGraphicView* currentDocGView; + static HEXABLOCK::GUI::OccGraphicView* currentOccGView; + static MyGEOMBase_Helper* geomBaseHelper; static bool assocInProgress; + static SalomeApp_Application* myApplication; + static GEOMGUI_OCCSelector* currentOccSelector; //HEXABLOCK::GUI::DocumentModel* @@ -162,6 +184,9 @@ public: virtual void preferencesChanged( const QString& sect, const QString& name ); virtual void studyActivated(); + ///Returns a new HEXA_NS::Document and it's entry in the study + std::pair newHexaDocument(); + //------------------------------------ void createAndFillDockWidget(); void createActions(); @@ -170,15 +195,24 @@ public: void initialMenus(); void showAllMenus(); + void updateSelectors(); // void showBaseMenus(bool show); // void showEditionMenus(bool show); // void showExecMenus(bool show); // void showCommonMenus(bool show); - void switchModel(SUIT_ViewWindow *view); + void switchModel(HEXABLOCK::GUI::VtkDocumentGraphicView* dgview); + void switchOnGraphicView(HEXABLOCK::GUI::VtkDocumentGraphicView* dgview); + void switchOffGraphicView(HEXABLOCK::GUI::VtkDocumentGraphicView* dgview, + bool saveCurrentDlg = true); void showDockWidgets(bool isVisible); + HEXABLOCK::GUI::VtkDocumentGraphicView* getCurrentVtkGraphicView(); + HEXABLOCK::GUI::VtkDocumentGraphicView* getDocument(SalomeApp_DataObject* studyObject); + HEXABLOCK::GUI::DocumentModel* getCurrentModel(); + HEXABLOCK::GUI::HexaBaseDialog* getDlgBox(HEXABLOCK::GUI::VtkDocumentGraphicView* view); + static ViewType getActiveViewType(); public slots: bool deactivateModule( SUIT_Study* theStudy); @@ -201,6 +235,9 @@ protected slots: // void onTryClose(bool &isClosed, QxScene_ViewWindow* window); void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ); + void showActor(); + void hideActor(); + void showOnlyActor(); protected: // virtual CAM_DataModel* createDataModel(); @@ -280,6 +317,12 @@ private slots: void setPropagation(); void computeMesh(); + //show the current model's information (nb vertex, edge, ... and more) + void showModelInfo(); + + //associate a shape to a document + void addShape(); + //Clears associations of a single element (VERTEX, EDGE, QUAD, ...) void clearAssociations(); @@ -295,7 +338,9 @@ private: QStringList getQuickDirList(); - HEXABLOCK::GUI::DocumentGraphicView* newGraphicView(); +// HEXABLOCK::GUI::DocumentGraphicView* newGraphicView(); + void restoreGraphicViews(); + void clearDialogs(); // ------------------------------------------------------------------------------------------------- @@ -342,8 +387,11 @@ private: HEXABLOCK::GUI::ReplaceHexaDialog* _replaceHexaDiag; HEXABLOCK::GUI::QuadRevolutionDialog* _quadRevolutionDiag; HEXABLOCK::GUI::MakeHemiSphereDialog* _makeHemiSphereDiag; + HEXABLOCK::GUI::ModelInfoDialog* _modelInfoDiag; + HEXABLOCK::GUI::AddShapeDialog* _addShapeDiag; + std::set currentModelDialogs; // Actions int _menuId; // Object Browser @@ -406,50 +454,45 @@ private: // Meshing QAction *_computeMesh; + QAction* _showModelInfoAct; + + QAction* _addShapeAct; + +// QAction *_showAct; +// QAction *_showOnlyAct; +// QAction *_hideAct; + // ------------------------------------------------------------------------------------------------- // Model/View implementation // ------------------------------------------------------------------------------------------------- - // MODEL MODEL MODEL MODEL MODEL MODEL MODEL MODEL MODEL - HEXABLOCK::GUI::DocumentModel *_currentModel;// a model for each document : 1..n ( multiple document allowed ) - HEXABLOCK::GUI::PatternDataModel *_patternDataModel; // sub-part of DocumentModel - HEXABLOCK::GUI::PatternBuilderModel *_patternBuilderModel; // sub-part of DocumentModel HEXABLOCK::GUI::AssociationsModel *_associationsModel; // sub-part of DocumentModel - HEXABLOCK::GUI::GroupsModel *_groupsModel; // sub-part of DocumentModel - HEXABLOCK::GUI::MeshModel *_meshModel; // sub-part of DocumentModel + // VIEW VIEW VIEW VIEW VIEW VIEW VIEW VIEW VIEW VIEW - QTreeView *_patternDataTreeView; // document's pattern : 1 ( only one view ) - QTreeView *_patternBuilderTreeView; // document's pattern : 1 ( only one view ) - QTreeView *_associationTreeView; // document's association : 1 ( only one view ) - QTreeView *_groupsTreeView; // document's groups - QTreeView *_meshTreeView; // document's mesh property: 1 ( only one view ) - HEXABLOCK::GUI::DocumentGraphicView *_currentGraphicView;// graphical view (SVTK view) of the document : 1..n ( multiple view ) + QTreeView* _patternDataTreeView; // document's pattern : 1 ( only one view ) + QTreeView* _patternBuilderTreeView; // document's pattern : 1 ( only one view ) + QTreeView* _patternGeomTreeView; // the geometries' tree view + QTreeView* _associationTreeView; // document's association : 1 ( only one view ) + QTreeView* _groupsTreeView; // document's groups + QTreeView* _meshTreeView; // document's mesh property: 1 ( only one view ) // DELEGATE DELEGATE DELEGATE DELEGATE DELEGATE DELEGATE DELEGATE HEXABLOCK::GUI::DocumentDelegate *_treeViewDelegate; // specific editor for each item of the tree - // SELECTION_MODEL SELECTION_MODEL SELECTION_MODEL SELECTION_MODEL SELECTION_MODEL - HEXABLOCK::GUI::PatternDataSelectionModel *_patternDataSelectionModel; // 1..n selection - HEXABLOCK::GUI::PatternBuilderSelectionModel *_patternBuilderSelectionModel;// 1..n selection - HEXABLOCK::GUI::GroupsSelectionModel *_groupsSelectionModel; - HEXABLOCK::GUI::MeshSelectionModel *_meshSelectionModel; + HEXABLOCK::GUI::GraphicViewsHandler* graphicViewsHandler; //vtk views hanlder (create, close, ...) // SALOME SALOME SALOME SALOME SALOME SALOME SALOME SALOME SALOME SALOME - SUIT_ViewManager *vtkViewManager; - SUIT_ViewManager *occViewManager; - std::map _salomeViewWindows; // key = entry - - // SALOME/QT SALOME/QT SALOME/QT SALOME/QT SALOME/QT SALOME/QT - std::map _documentModels; - std::map _documentView; - std::map graphicViewIsEmpty; -// static std::map _salomeViews; + std::map docs; // key = entry + QMap gViewDlgBox; // key = entry // int _documentCnt; bool _isSaved; bool moduleActivatedOnce; + QDir* loadDocLastPath; + QDir* saveDocLastPath; + void testDocument(); void test_make_cart_grid(); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx index 1951143..6597621 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.cxx @@ -39,11 +39,6 @@ using namespace HEXABLOCK::GUI; DocumentDelegate::DocumentDelegate(QDockWidget *dw, QObject *parent) : QItemDelegate(parent), _dw(dw), - _documentModel(0), - _patternDataSelectionModel(0), - _patternBuilderSelectionModel(0), - _groupsSelectionModel(0), - _meshSelectionModel(0), _currentEditor(NULL) { // connect( this, SIGNAL( closeEditor(QWidget *, QAbstractItemDelegate::EndEditHint) ), @@ -57,10 +52,6 @@ QWidget *DocumentDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index ) const { - MESSAGE("DocumentDelegate::createEditor(){"); - MESSAGE("* parent is: " << parent); - MESSAGE("* _dw is: " << _dw); - MESSAGE("* item is: " << index.data(Qt::DisplayRole).toString().toStdString()); //close current editor if there's one before creating a new one if (_currentEditor != NULL) @@ -75,8 +66,9 @@ QWidget *DocumentDelegate::createEditor( QWidget *parent, if ( !_dw->isVisible() ) _dw->setVisible(true); switch ( index.data(HEXA_TREE_ROLE).toInt() ){ - case VERTEX_TREE : editor = new VertexDialog(_dw, HexaBaseDialog::UPDATE_MODE); break; - case EDGE_TREE : editor = new EdgeDialog(_dw, /*HexaBaseDialog::NEW_MODE*/HexaBaseDialog::INFO_MODE); break; +// case VERTEX_TREE : editor = new VertexDialog(_dw, HexaBaseDialog::UPDATE_MODE); break; //Modification + case VERTEX_TREE : editor = new VertexDialog(_dw, HexaBaseDialog::INFO_MODE); break; + case EDGE_TREE : editor = new EdgeDialog(_dw, HexaBaseDialog::INFO_MODE); break; case QUAD_TREE : editor = new QuadDialog(_dw, HexaBaseDialog::INFO_MODE); break; case HEXA_TREE : editor = new HexaDialog(_dw, HexaBaseDialog::INFO_MODE); break; case VECTOR_TREE : editor = new VectorDialog(_dw, HexaBaseDialog::INFO_MODE); break; @@ -85,28 +77,18 @@ QWidget *DocumentDelegate::createEditor( QWidget *parent, // case ELEMENTS_TREE : break; // case CROSSELEMENTS_TREE : break; case GROUP_TREE : editor = new GroupDialog(_dw, HexaBaseDialog::INFO_MODE/*UPDATE_MODE*/); break; - case LAW_TREE : editor = new LawDialog(_dw, HexaBaseDialog::UPDATE_MODE); break; + case LAW_TREE : editor = new LawDialog(_dw, HexaBaseDialog::INFO_MODE); break; case PROPAGATION_TREE : editor = new PropagationDialog(_dw, HexaBaseDialog::INFO_MODE); break; } if ( editor != NULL ){ - if ( _documentModel ) editor->setDocumentModel( _documentModel ); - if ( _patternDataSelectionModel ) - { - editor->setPatternDataSelectionModel( _patternDataSelectionModel ); -// _patternDataSelectionModel->currentDialog = editor; - } - if ( _patternBuilderSelectionModel ) editor->setPatternBuilderSelectionModel( _patternBuilderSelectionModel); - if ( _groupsSelectionModel ) editor->setGroupsSelectionModel( _groupsSelectionModel ); - if ( _meshSelectionModel ) editor->setMeshSelectionModel( _meshSelectionModel); - HEXABLOCKGUI::assocInProgress = false; + //show the editor in the dockwidget editor->resetSizeAndShow(_dw); } else _dw->close(); - MESSAGE("}"); _currentEditor = editor; return editor; @@ -127,51 +109,51 @@ void DocumentDelegate::closeDialog() void DocumentDelegate::setEditorData( QWidget *editor, const QModelIndex &index) const { - MESSAGE("DocumentDelegate::setEditorData(){"); - MESSAGE("* item is: " << index.data(Qt::DisplayRole).toString().toStdString()); - -// HexaBaseDialog* editor = dynamic_cast( editor ); + HexaBaseDialog* hexaEditor = dynamic_cast( editor ); + if (hexaEditor == NULL) return; + DocumentModel* documentModel = hexaEditor->getDocumentModel(); + if (documentModel == NULL) return; switch ( index.data(HEXA_TREE_ROLE).toInt() ){ case VERTEX_TREE : { // HEXA_NS::Vertex *value = index.data( HEXA_DATA_ROLE ).value< HEXA_NS::Vertex* >(); - HEXA_NS::Vertex *value = _documentModel->getHexaPtr(index); + HEXA_NS::Vertex *value = documentModel->getHexaPtr(index); VertexDialog *vertexEditor = static_cast(editor); vertexEditor->setValue(value); } break; case EDGE_TREE : { - HEXA_NS::Edge *value = _documentModel->getHexaPtr(index); + HEXA_NS::Edge *value = documentModel->getHexaPtr(index); EdgeDialog *edgeEditor = static_cast(editor); edgeEditor->setValue(value); } break; case QUAD_TREE : { - HEXA_NS::Quad *value = _documentModel->getHexaPtr(index); + HEXA_NS::Quad *value = documentModel->getHexaPtr(index); QuadDialog *quadEditor = static_cast(editor); quadEditor->setValue(value); } break; case HEXA_TREE : { - HEXA_NS::Hexa *value = _documentModel->getHexaPtr(index); + HEXA_NS::Hexa *value = documentModel->getHexaPtr(index); HexaDialog *hexaEditor = static_cast(editor); hexaEditor->setValue(value); } break; case VECTOR_TREE : { - HEXA_NS::Vector *value = _documentModel->getHexaPtr(index); + HEXA_NS::Vector *value = documentModel->getHexaPtr(index); VectorDialog *vectorEditor = static_cast(editor); vectorEditor->setValue(value); } break; case CYLINDER_TREE : { - HEXA_NS::Cylinder *value = _documentModel->getHexaPtr(index); + HEXA_NS::Cylinder *value = documentModel->getHexaPtr(index); CylinderDialog *cylinderEditor = static_cast(editor); cylinderEditor->setValue(value); } break; case PIPE_TREE : { - HEXA_NS::Pipe *value = _documentModel->getHexaPtr(index); + HEXA_NS::Pipe *value = documentModel->getHexaPtr(index); PipeDialog *pipeEditor= static_cast(editor); pipeEditor->setValue(value); } @@ -198,7 +180,6 @@ void DocumentDelegate::setEditorData( QWidget *editor, break; } - MESSAGE("}"); } @@ -207,6 +188,7 @@ bool DocumentDelegate::editorEvent ( QEvent *event, const QStyleOptionViewItem &option, const QModelIndex &index ) { +/************************************************************ MESSAGE("DocumentDelegate::editorEvent(){"); MESSAGE("* item is: " << index.data().toString().toStdString()); MESSAGE("* event is: " << event->type() ); @@ -219,14 +201,20 @@ bool DocumentDelegate::editorEvent ( QEvent *event, } //return QItemDelegate::editorEvent ( event, model, option, index ); + *************************************************************/ return false; } bool DocumentDelegate::eventFilter ( QObject * editor, QEvent * event ) { if ( event->type() == QEvent::FocusOut ){ - //((QWidget*) editor->parent())->close(); - return true; + return true; //do nothing for this signal } + else if (event->type() == QEvent::HideToParent && editor != NULL) + { + //close the current editor when the tree is reduced + ((QWidget*) editor->parent())->close(); + } + return false; } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx index 27d4ff0..c43b791 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentDelegate.hxx @@ -46,15 +46,20 @@ namespace HEXABLOCK Q_OBJECT public: + /// close the editor void closeDialog(); + DocumentDelegate( QDockWidget *dw, QObject *parent = 0); + /// create the editor QWidget *createEditor( QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const; + /// set editor's data void setEditorData( QWidget *editor, const QModelIndex &index) const; + /// set the editor's model void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const {}; @@ -63,15 +68,6 @@ namespace HEXABLOCK const QStyleOptionViewItem &option, const QModelIndex &index ) const {}; - //Can be used by editor - void setDocumentModel( DocumentModel* m ){_documentModel = m;} - - //Selections - void setPatternDataSelectionModel( PatternDataSelectionModel* s ){_patternDataSelectionModel = s;} - void setPatternBuilderSelectionModel( PatternBuilderSelectionModel* s ){_patternBuilderSelectionModel = s;} - void setGroupsSelectionModel( GroupsSelectionModel* s ){_groupsSelectionModel = s ;} - void setMeshSelectionModel( MeshSelectionModel* s ){_meshSelectionModel = s;} - protected: mutable QWidget* _currentEditor; virtual bool editorEvent ( QEvent * event, @@ -86,14 +82,6 @@ namespace HEXABLOCK private: QDockWidget* _dw; // creator's container - // can be used by editor - DocumentModel* _documentModel; - - PatternDataSelectionModel* _patternDataSelectionModel; - PatternBuilderSelectionModel* _patternBuilderSelectionModel; - GroupsSelectionModel* _groupsSelectionModel; - MeshSelectionModel* _meshSelectionModel; - private slots: void commitEditor(); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentGraphicView.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentGraphicView.cxx deleted file mode 100755 index 08ae35a..0000000 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentGraphicView.cxx +++ /dev/null @@ -1,1123 +0,0 @@ -// Copyright (C) 2009-2012 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -//#define _DEVDEBUG_ - -#include - -#include - -#include - -#include "utilities.h" - -#include - - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// VTK includes -#include -#include -#include -#include -#include -#include -// test tutorial (sphere) -#include -#include - -// test point (cf. SMESHGUI) -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "vtkLookupTable.h" -#include "vtkPoints.h" -#include "vtkCellArray.h" -#include "vtkFloatArray.h" -#include "vtkPolyData.h" -#include "vtkPolyDataMapper.h" -#include "vtkActor.h" -#include "vtkPointData.h" -#include "vtkProperty.h" - - -// #include "vtkStructuredGridReader.h" -#include "vtkUnstructuredGridReader.h" - - -#include - - - - - -#ifndef M_PI -#define M_PI 3.1415927 -#endif - -#include "HEXABLOCKGUI_Trace.hxx" -#include "HEXABLOCKGUI_DocumentModel.hxx" -#include "HEXABLOCKGUI_DocumentGraphicView.hxx" - - - -using namespace std; -using namespace HEXABLOCK::GUI; - -Document_Actor::Document_Actor( HEXA_NS::Document* doc, const QString& entry ): - SALOME_Actor(), - _doc( doc ) -{ - DEBTRACE("Document_Actor::Document_Actor " << entry.toLatin1() ); - Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject( entry.toLatin1(), "HEXABLOCK" );//,theName); CS_TODO - setIO(anIO); - vtkUnstructuredGrid* aGrid = getUnstructuredGrid(); -// std::cout << "Document_Actor aGrid->GetNumberOfCells() =>"<< aGrid->GetNumberOfCells(); - vtkDataSetMapper* aMapper = vtkDataSetMapper::New(); - aMapper->SetInput(aGrid); - aGrid->Delete(); - - SetVisibility( true );//VisibilityOff(); - SetPickable( true ); //PickableOff();// - SetMapper( aMapper ); - aMapper->Delete(); - - vtkProperty* aProp = vtkProperty::New(); - -// aProp->SetRepresentationToSurface(); - aProp->SetRepresentationToWireframe(); -// aProp->SetRepresentationToPoints(); - aProp->EdgeVisibilityOn (); - aProp->SetPointSize(5); - SetProperty( aProp ); - aProp->Delete(); -// SetPointRepresentation(true); - -} - -Document_Actor::~Document_Actor() -{ - -} - - -vtkUnstructuredGrid* Document_Actor::getUnstructuredGrid() -{ - vtkUnstructuredGrid* theGrid = vtkUnstructuredGrid::New(); - - _doc->reorderFaces(); //CS_TEST - - std::map vtkNodeId; - std::map hexaNodeId; - - // Create points - vtkPoints* aPoints = vtkPoints::New(); - int nbVertex = _doc->countVertex(); - aPoints->SetNumberOfPoints( nbVertex ); - - HEXA_NS::Vertex* v = NULL; - int vertexId; - for ( int i=0; i getVertex(i); - aPoints->SetPoint( i, v->getX(), v->getY(), v->getZ() ); - vertexId = reinterpret_cast(v); //v->getId(); - vtkNodeId [ vertexId ] = i; - hexaNodeId[ i ] = vertexId ; -// vtkNodeId [ vertexId ] = i+1; -// hexaNodeId[ i+1 ] = vertexId ; - } - - theGrid->SetPoints( aPoints ); - aPoints->Delete(); -// theGrid->SetCells( 0, 0, 0, 0, 0 ); - - - // Calculate cells size - int nb0DElement = _doc->countVertex(); - int nbEdge = _doc->countEdge(); - int nbFace = _doc->countQuad(); - int nbVolume = _doc->countHexa(); - - vtkIdType aCellsSize = 2*nb0DElement + 3*nbEdge + ( 4 + 1 )*nbFace + ( 8 + 1 )*nbVolume; - vtkIdType aNbCells = nb0DElement + nbEdge + nbFace + nbVolume; - - // Create cells - vtkCellArray* aConnectivity = vtkCellArray::New(); - aConnectivity->Allocate( aCellsSize, 0 ); - - vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New(); - aCellTypesArray->SetNumberOfComponents( 1 ); - aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() ); - - vtkIdList *anIdList = vtkIdList::New(); - vtkIdType iVtkElem = 0; -// vtkIdType iVtkElem = 1; //CS_TEST - int iHexaElem; - - // VERTEX - for ( int i=0; iSetNumberOfIds( 1 ); - v = _doc->getVertex(i); - iHexaElem = reinterpret_cast(v);//v->getId(); - vtkElemsId[iHexaElem] = iVtkElem; - hexaElemsId[iVtkElem] = iHexaElem; - anIdList->SetId(0, vtkNodeId[iHexaElem]); - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_VERTEX );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); - ++iVtkElem; - } - - // EDGE - HEXA_NS::Edge* e = NULL; - HEXA_NS::Vertex* vertexElem = NULL; - for ( int i=0; iSetNumberOfIds( 2 ); - e = _doc->getEdge(i); - iHexaElem = reinterpret_cast(e); //e->getId(); - vtkElemsId[iHexaElem] = iVtkElem; - hexaElemsId[iVtkElem] = iHexaElem; - - for( vtkIdType j = 0; j< 2; ++j ){ //j< e->countVertex(); ++j ){ - vertexElem = e->getVertex( j ); - anIdList->SetId( j, vtkNodeId[ reinterpret_cast(vertexElem) ] );//vertexElem->getId() ]); - } - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_LINE );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); - ++iVtkElem; - } - - // QUAD - HEXA_NS::Quad* q = NULL; - HEXA_NS::Quad* quadElem = NULL; - for ( int i=0; iSetNumberOfIds( 4 ); - q = _doc->getQuad(i); - iHexaElem = reinterpret_cast(q); //q->getId(); - vtkElemsId[iHexaElem] = iVtkElem; - hexaElemsId[iVtkElem] = iHexaElem; - - for( vtkIdType j = 0; j< 4; ++j ){ - vertexElem = q->getVertex( j ); - anIdList->SetId( j, vtkNodeId[ reinterpret_cast(vertexElem) ] );//vertexElem->getId() ]); - } - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_QUAD );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); - ++iVtkElem; - } - - // HEXA - HEXA_NS::Hexa* h = NULL; - HEXA_NS::Hexa* hexaElem = NULL; - std::map connectivity; - connectivity[0] = 0; - connectivity[1] = 1; - connectivity[2] = 3; - connectivity[3] = 2; - connectivity[4] = 4; - connectivity[5] = 5; - connectivity[6] = 7; - connectivity[7] = 6; - for ( int i=0; iSetNumberOfIds( 8 ); - h = _doc->getHexa(i); - iHexaElem = reinterpret_cast(h); //q->getId(); - vtkElemsId[iHexaElem] = iVtkElem; - hexaElemsId[iVtkElem] = iHexaElem; - - for( vtkIdType j = 0; j< 8; ++j ){ - vertexElem = h->getVertex( j );// ); - anIdList->SetId( connectivity[j], vtkNodeId[ reinterpret_cast(vertexElem) ]);//vertexElem->getId() ]); - } - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_HEXAHEDRON ); - ++iVtkElem; - } - - -// 0 1 2 3 4 5 6 7 -// V_ACE, V_ACF, V_ADE, V_ADF, V_BCE, V_BCF, V_BDE, V_BDF, -// -// 0 1 3 2 4 5 7 6 - - // Insert cells in grid - VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); - aCellLocationsArray->SetNumberOfComponents( 1 ); - aCellLocationsArray->SetNumberOfTuples( aNbCells ); -// std::cout << "aNbCells =>" << aNbCells << std::endl; - - aConnectivity->InitTraversal(); - for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ){ - aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); - } - theGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity ); - - aCellLocationsArray->Delete(); - aCellTypesArray->Delete(); - aConnectivity->Delete(); - anIdList->Delete(); - //std::cout << "theGrid->GetNumberOfCells()" << theGrid->GetNumberOfCells() << std::endl; - - return theGrid; -} - -// =============================================================== Abu : debut -// ===================================================== Constructeur -Associate_Actor::Associate_Actor( HEXA_NS::Document* doc, const QString& entry) - : SALOME_Actor(), _doc( doc ) -{ - DEBTRACE("Associate_Actor::Associate_Actor " << entry.toLatin1() ); - Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject( entry.toLatin1(), "HEXABLOCK" );//,theName); CS_TODO - setIO(anIO); - vtkUnstructuredGrid* aGrid = getUnstructuredGrid(); - - vtkDataSetMapper* aMapper = vtkDataSetMapper::New(); - aMapper->SetInput(aGrid); - aGrid->Delete(); - - SetVisibility( true );//VisibilityOff(); - SetPickable( true ); //PickableOff();// - SetMapper( aMapper ); - aMapper->Delete(); - - vtkProperty* aProp = vtkProperty::New(); - aProp->SetColor(0,255,0); -// aProp->SetRepresentationToSurface(); - aProp->SetRepresentationToWireframe(); -// aProp->SetRepresentationToPoints(); - aProp->EdgeVisibilityOn (); - aProp->SetPointSize(5); - SetProperty( aProp ); - aProp->Delete(); -// SetPointRepresentation(true); -} -// ===================================================== getUnstructuredGrid - -vtkUnstructuredGrid* Associate_Actor::getUnstructuredGrid() -{ - vtkUnstructuredGrid* theGrid = vtkUnstructuredGrid::New(); - - _doc->reorderFaces(); //CS_TEST - - std::map vtkNodeId; - std::map hexaNodeId; - - // Create points - vtkPoints* aPoints = vtkPoints::New(); - int nbVertex = _doc->countVertex(); - aPoints->SetNumberOfPoints( nbVertex ); - - HEXA_NS::Vertex* v = NULL; - int vertexId; - for ( int i=0; i getVertex(i); - aPoints->SetPoint( i, v->getX()+6, v->getY()+6, v->getZ() ); - vertexId = reinterpret_cast(v); //v->getId(); - vtkNodeId [ vertexId ] = i; - hexaNodeId[ i ] = vertexId ; -// vtkNodeId [ vertexId ] = i+1; -// hexaNodeId[ i+1 ] = vertexId ; - } - - theGrid->SetPoints( aPoints ); - aPoints->Delete(); -// theGrid->SetCells( 0, 0, 0, 0, 0 ); - - - // Calculate cells size - int nb0DElement = _doc->countVertex(); - int nbEdge = _doc->countEdge(); - int nbFace = _doc->countQuad(); - int nbVolume = _doc->countHexa(); - - vtkIdType aCellsSize = 2*nb0DElement + 3*nbEdge + ( 4 + 1 )*nbFace + ( 8 + 1 )*nbVolume; - vtkIdType aNbCells = nb0DElement + nbEdge + nbFace + nbVolume; - - // Create cells - vtkCellArray* aConnectivity = vtkCellArray::New(); - aConnectivity->Allocate( aCellsSize, 0 ); - - vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New(); - aCellTypesArray->SetNumberOfComponents( 1 ); - aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() ); - - vtkIdList *anIdList = vtkIdList::New(); - vtkIdType iVtkElem = 0; -// vtkIdType iVtkElem = 1; //CS_TEST - int iHexaElem; - - // VERTEX - for ( int i=0; iSetNumberOfIds( 1 ); - v = _doc->getVertex(i); - iHexaElem = reinterpret_cast(v);//v->getId(); - vtkElemsId[iHexaElem] = iVtkElem; - hexaElemsId[iVtkElem] = iHexaElem; - anIdList->SetId(0, vtkNodeId[iHexaElem]); - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_VERTEX );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); - ++iVtkElem; - } - - // EDGE - HEXA_NS::Edge* e = NULL; - HEXA_NS::Vertex* vertexElem = NULL; - for ( int i=0; iSetNumberOfIds( 2 ); - e = _doc->getEdge(i); - iHexaElem = reinterpret_cast(e); //e->getId(); - vtkElemsId[iHexaElem] = iVtkElem; - hexaElemsId[iVtkElem] = iHexaElem; - - for( vtkIdType j = 0; j< 2; ++j ){ //j< e->countVertex(); ++j ){ - vertexElem = e->getVertex( j ); - anIdList->SetId( j, vtkNodeId[ reinterpret_cast(vertexElem) ] );//vertexElem->getId() ]); - } - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_LINE );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); - ++iVtkElem; - } - - // QUAD - HEXA_NS::Quad* q = NULL; - HEXA_NS::Quad* quadElem = NULL; - for ( int i=0; iSetNumberOfIds( 4 ); - q = _doc->getQuad(i); - iHexaElem = reinterpret_cast(q); //q->getId(); - vtkElemsId[iHexaElem] = iVtkElem; - hexaElemsId[iVtkElem] = iHexaElem; - - for( vtkIdType j = 0; j< 4; ++j ){ - vertexElem = q->getVertex( j ); - anIdList->SetId( j, vtkNodeId[ reinterpret_cast(vertexElem) ] );//vertexElem->getId() ]); - } - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_QUAD );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); - ++iVtkElem; - } - - // HEXA - HEXA_NS::Hexa* h = NULL; - HEXA_NS::Hexa* hexaElem = NULL; - std::map connectivity; - connectivity[0] = 0; - connectivity[1] = 1; - connectivity[2] = 3; - connectivity[3] = 2; - connectivity[4] = 4; - connectivity[5] = 5; - connectivity[6] = 7; - connectivity[7] = 6; - for ( int i=0; iSetNumberOfIds( 8 ); - h = _doc->getHexa(i); - iHexaElem = reinterpret_cast(h); //q->getId(); - vtkElemsId[iHexaElem] = iVtkElem; - hexaElemsId[iVtkElem] = iHexaElem; - - for( vtkIdType j = 0; j< 8; ++j ){ - vertexElem = h->getVertex( j );// ); - anIdList->SetId( connectivity[j], vtkNodeId[ reinterpret_cast(vertexElem) ]);//vertexElem->getId() ]); - } - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_HEXAHEDRON ); - ++iVtkElem; - } - - -// 0 1 2 3 4 5 6 7 -// V_ACE, V_ACF, V_ADE, V_ADF, V_BCE, V_BCF, V_BDE, V_BDF, -// -// 0 1 3 2 4 5 7 6 - - // Insert cells in grid - VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); - aCellLocationsArray->SetNumberOfComponents( 1 ); - aCellLocationsArray->SetNumberOfTuples( aNbCells ); -// std::cout << "aNbCells =>" << aNbCells << std::endl; - - aConnectivity->InitTraversal(); - for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ){ - aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); - } - theGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity ); - - aCellLocationsArray->Delete(); - aCellTypesArray->Delete(); - aConnectivity->Delete(); - anIdList->Delete(); - //std::cout << "theGrid->GetNumberOfCells()" << theGrid->GetNumberOfCells() << std::endl; - - return theGrid; -} -/* -{ - vtkUnstructuredGrid* theGrid = vtkUnstructuredGrid::New(); - - _doc->reorderFaces(); //CS_TEST - - std::map vtkNodeId; - std::map hexaNodeId; - - std::vector tab_vertex; - HEXA_NS::Edges tab_edge; - - _doc->getAssoVertices (tab_vertex); - _doc->getAssoEdges (tab_edge); - - int nb0DElement = tab_vertex.size(); - int nbEdge = tab_edge.size(); - int nbFace = 0; - int nbVolume = 0; - - // Create points - vtkPoints* aPoints = vtkPoints::New(); - int nbVertex = nb0DElement; - aPoints->SetNumberOfPoints( nbVertex ); - - HEXA_NS::Vertex* v = NULL; - int vertexId; - for ( int i=0; i getVertex(i); - aPoints->SetPoint( i, v->getX() + 1, v->getY() + 1, v->getZ() ); - vertexId = reinterpret_cast(v); //v->getId(); - vtkNodeId [ vertexId ] = i; - hexaNodeId[ i ] = vertexId ; -// vtkNodeId [ vertexId ] = i+1; -// hexaNodeId[ i+1 ] = vertexId ; - } - - theGrid->SetPoints( aPoints ); - aPoints->Delete(); -// theGrid->SetCells( 0, 0, 0, 0, 0 ); - - // Calculate cells size - - vtkIdType aCellsSize = 2*nb0DElement + 3*nbEdge + ( 4 + 1 )*nbFace + ( 8 + 1 )*nbVolume; - vtkIdType aNbCells = nb0DElement + nbEdge + nbFace + nbVolume; - - // Create cells - vtkCellArray* aConnectivity = vtkCellArray::New(); - aConnectivity->Allocate( aCellsSize, 0 ); - - vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New(); - aCellTypesArray->SetNumberOfComponents( 1 ); - aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() ); - - vtkIdList *anIdList = vtkIdList::New(); - vtkIdType iVtkElem = 0; -// vtkIdType iVtkElem = 1; //CS_TEST - int iHexaElem; - - // VERTEX - for ( int i=0; iSetNumberOfIds( 1 ); - v = _doc->getVertex(i); // Abu - // v = tab_vertex [i]; - iHexaElem = reinterpret_cast(v);//v->getId(); - vtkElemsId[iHexaElem] = iVtkElem; - hexaElemsId[iVtkElem] = iHexaElem; - anIdList->SetId(0, vtkNodeId[iHexaElem]); - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_VERTEX );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); - ++iVtkElem; - } - - // EDGE - HEXA_NS::Edge* e = NULL; - HEXA_NS::Vertex* vertexElem = NULL; - for ( int i=0; iSetNumberOfIds( 2 ); - // e = _doc->getEdge(i); // Abu - e = tab_edge [i]; - iHexaElem = reinterpret_cast(e); //e->getId(); - vtkElemsId[iHexaElem] = iVtkElem; - hexaElemsId[iVtkElem] = iHexaElem; - - for( vtkIdType j = 0; j< 2; ++j ){ //j< e->countVertex(); ++j ){ - vertexElem = e->getVertex( j ); - anIdList->SetId( j, vtkNodeId[ reinterpret_cast(vertexElem) ] );//vertexElem->getId() ]); - } - aConnectivity->InsertNextCell( anIdList ); - aCellTypesArray->InsertNextValue( VTK_LINE );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); - ++iVtkElem; - } - - -// 0 1 2 3 4 5 6 7 -// V_ACE, V_ACF, V_ADE, V_ADF, V_BCE, V_BCF, V_BDE, V_BDF, -// -// 0 1 3 2 4 5 7 6 - - // Insert cells in grid - VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); - aCellLocationsArray->SetNumberOfComponents( 1 ); - aCellLocationsArray->SetNumberOfTuples( aNbCells ); -// std::cout << "aNbCells =>" << aNbCells << std::endl; - - aConnectivity->InitTraversal(); - for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ){ - aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); - } - theGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity ); - - aCellLocationsArray->Delete(); - aCellTypesArray->Delete(); - aConnectivity->Delete(); - anIdList->Delete(); - //std::cout << "theGrid->GetNumberOfCells()" << theGrid->GetNumberOfCells() << std::endl; - - return theGrid; -} -*/ -// =============================================================== Abu : Fin - - -// DocumentGraphicView::DocumentGraphicView(SalomeApp_Application* app, SUIT_ViewWindow *suitView, QWidget *parent) -DocumentGraphicView::DocumentGraphicView( LightApp_Application* app, SUIT_ViewWindow *suitView, QWidget *parent ) - : QAbstractItemView(parent), - _suitView( suitView ), - _documentActor( 0 ), - _associateActor (NULL), // Abu - _currentChanged( false ), - firstUpdate(true) -{ -// MESSAGE("DocumentGraphicView::DocumentGraphicView() app"<getViewPort(); -// _suitView->viewport(); -// _suitView->installEventFilter(this); -} - -DocumentGraphicView::~DocumentGraphicView() -{ -} - -void DocumentGraphicView::setWindowTitle(const QString& title) -{ - _suitView->setWindowTitle( QString("hexablock : ") + title ); -} - -void DocumentGraphicView::onPatternDatachanged() -{ - MESSAGE("DocumentGraphicView::onPatternDatachanged(){"); - update(); - MESSAGE("}"); -} - - -void DocumentGraphicView::update() -{ - MESSAGE("DocumentGraphicView::update(){"); - - SVTK_ViewWindow* theVTKViewWindow = dynamic_cast(_suitView); -// PatternDataModel* theModel = dynamic_cast( model() ); - DocumentModel* theModel = dynamic_cast( model() ); - MESSAGE("model()"<documentImpl(); - QString theDocumentEntry = theModel->documentEntry(); - - if ( _documentActor ){ - theVTKViewWindow->RemoveActor( _documentActor ); - _documentActor->Delete(); - } - _documentActor = new Document_Actor( theDocumentImpl, theDocumentEntry ); - theVTKViewWindow->AddActor( _documentActor ); - - QString autreDocentry = "essai"; - // -------------------- Abu debut - if (HEXA_NS::special_option()) - { - if (_associateActor != NULL) - { - theVTKViewWindow->RemoveActor( _associateActor ); - _associateActor->Delete(); - } - // _associateActor = new Associate_Actor( theDocumentImpl, theDocumentEntry ); - _associateActor = new Associate_Actor( theDocumentImpl, autreDocentry ); - theVTKViewWindow->AddActor( _associateActor ); - } - // -------------------- Abu fin - - // display HEXABLOCK document model -// vtkSmartPointer style = vtkSmartPointer::New(); -// theVTKViewWindow->GetInteractor()->PushInteractorStyle(style); -// style->SetCurrentRenderer(theVTKViewWindow->getRenderer()); - -// theVTKViewWindow->SetInteractionStyle(0); -// theVTKViewWindow->SetDynamicPreSelection (true); - theVTKViewWindow->getRenderer()->Render(); - theVTKViewWindow->Repaint(); - if (firstUpdate) - { - theVTKViewWindow->onFitAll(); - firstUpdate = false; - } -// theVTKViewWindow->GetInteractorStyle()->HighlightProp(_documentActor); -// theVTKViewWindow->getView()->SetPreselectionProp(0., 1., 0., 2.); -// theVTKViewWindow->getView()->SetTransparency(_documentActor->getIO(), 0.2); - - // myVTKViewWindow->SetSelectionMode( ActorSelection ); - // theVTKViewWindow->SetSelectionMode( NodeSelection ); - // myVTKViewWindow->SetSelectionMode( FaceSelection ); - MESSAGE("}"); -} - - -/******************************************************************************** -* ABSTRACT METHOD ( MUST BE IMPLEMENTED ) -********************************************************************************/ - -/* - Returns the item that covers the coordinate given in the view. -*/ - -QModelIndex DocumentGraphicView::indexAt(const QPoint &point) const -{ - MESSAGE("DocumentGraphicView::indexAt(){"); - MESSAGE("}"); - return QModelIndex(); -} - -void DocumentGraphicView::scrollTo(const QModelIndex &index, ScrollHint) -{ - MESSAGE("DocumentGraphicView::scrollTo(){"); - MESSAGE("* item is: " << index.data().toString().toStdString()); - MESSAGE("}"); -} - -/* - Returns the position of the item in viewport coordinates. -*/ -QRect DocumentGraphicView::visualRect(const QModelIndex &index) const -{ - MESSAGE("DocumentGraphicView::visualRect(){"); - MESSAGE("* item is: " << index.data().toString().toStdString()); - MESSAGE("}"); - return QRect(); -} - -// PROTECTED : -int DocumentGraphicView::horizontalOffset() const -{ - MESSAGE("DocumentGraphicView::horizontalOffset(){"); - MESSAGE("}"); - return horizontalScrollBar()->value(); -} - -bool DocumentGraphicView::isIndexHidden(const QModelIndex &index) const -{ - MESSAGE("DocumentGraphicView::isIndexHidden(){"); - MESSAGE("* item is: " << index.data().toString().toStdString()); - MESSAGE("}"); - return false; -} - -QModelIndex DocumentGraphicView::moveCursor(QAbstractItemView::CursorAction cursorAction, - Qt::KeyboardModifiers /*modifiers*/) -{ - MESSAGE("DocumentGraphicView::moveCursor(){"); - QModelIndex current = currentIndex(); - MESSAGE("* current is: " << current.data(Qt::DisplayRole).toString().toStdString()); - MESSAGE("}"); - return current; -} - -/* - Find the indices corresponding to the extent of the selection. -*/ -void DocumentGraphicView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) -{ - MESSAGE("DocumentGraphicView::setSelection(){"); - MESSAGE("}"); -} - - -int DocumentGraphicView::verticalOffset() const -{ - MESSAGE("DocumentGraphicView::verticalOffset(){"); - MESSAGE("}"); - return verticalScrollBar()->value(); -} - -/* - Returns a region corresponding to the selection in viewport coordinates. -*/ -QRegion DocumentGraphicView::visualRegionForSelection(const QItemSelection &selection) const -{ - MESSAGE("DocumentGraphicView::visualRegionForSelection(){"); - MESSAGE("}"); - return QRegion(); -} - - - - -/******************************************************************************** -* PROTECTED SLOTS -********************************************************************************/ -void DocumentGraphicView::closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint ) -{ - MESSAGE("DocumentGraphicView::closeEditor(){"); - MESSAGE("* hint is: " << hint); - MESSAGE("}"); -} - -void DocumentGraphicView::commitData ( QWidget * editor ) -{ - MESSAGE("DocumentGraphicView::commitData(){"); - MESSAGE("}"); -} - -void DocumentGraphicView::currentChanged( const QModelIndex & current, const QModelIndex & previous ) -{ -// MESSAGE("DocumentGraphicView::currentChanged(){"); -// MESSAGE("* current is: " << current.data().toString().toStdString()); -// MESSAGE("* previous is: " << previous.data().toString().toStdString()); -// MESSAGE("}"); -// openPersistentEditor( current ); - _currentChanged = true; -} - -void DocumentGraphicView::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) -{ -// MESSAGE("DocumentGraphicView::dataChanged(){"); -// MESSAGE("* topLeft is: " << topLeft.data().toString().toStdString()); -// MESSAGE("* bottomRight is: " << bottomRight.data().toString().toStdString()); -// MESSAGE("}"); - update(); - _currentChanged = false; -// updateObject(topLeft); -} - -void DocumentGraphicView::editorDestroyed ( QObject * editor ) -{ - MESSAGE("DocumentGraphicView::editorDestroyed(){"); - MESSAGE("}"); -} - -void DocumentGraphicView::rowsAboutToBeRemoved ( const QModelIndex & parent, int start, int end ) -{ -// MESSAGE("DocumentGraphicView::rowsAboutToBeRemoved (){"); -// MESSAGE("* parent is: " << parent.data(Qt::DisplayRole).toString().toStdString()); -// MESSAGE("* start is: " << start); -// MESSAGE("* end is: " << end); -// MESSAGE("}"); -} - -void DocumentGraphicView::rowsInserted ( const QModelIndex & parent, int start, int end ) -{ -// MESSAGE("DocumentGraphicView::rowsInserted(){"); -// MESSAGE("* parent is: " << parent.data(Qt::DisplayRole).toString().toStdString()); -// MESSAGE("* start is: " << start); -// MESSAGE("* end is: " << end); -// MESSAGE("}"); -} - -void DocumentGraphicView::selectionChanged( const QItemSelection & selected, const QItemSelection & deselected ) -{ - MESSAGE("DocumentGraphicView::selectionChanged(){"); - foreach( const QModelIndex& isel, selected.indexes() ){ - MESSAGE("* selected : " << isel.data().toString().toStdString()); - } - foreach( const QModelIndex& iunsel, deselected.indexes() ){ - MESSAGE("* unselected : " << iunsel.data().toString().toStdString()); - } - MESSAGE("}"); -} - -void DocumentGraphicView::updateGeometries () -{ - MESSAGE("DocumentGraphicView::updateGeometries (){"); - MESSAGE("}"); -} - -SUIT_ViewWindow* DocumentGraphicView::get_SUIT_ViewWindow() -{ - return _suitView; -} - -// bool DocumentGraphicView::canBeDisplayed( const QString& entry, const QString& viewer_type ) const //CS_TODO -// { -// bool result = false; -// -// result = (viewer_type==SVTK_Viewer::Type()); -// // QStringList es = entry.split( "_" );22 -// // bool result = ( es.count() == 3 && es[ 0 ] == "ATOMSOLVGUI" && viewer_type == SVTK_Viewer::Type() ); -// // // printf ( " canBeDisplayed : entry = %s, count = %d, res = %d \n", entry.latin1(), es.count(), result ); -// std::cout << "canBeDisplayed => "<< result << std::endl; -// return result; // entry of an atom for sure -// } - -// SALOME_Prs* HEXABLOCKGUI_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame) -// { -// SALOME_Prs* prs = 0; -// -// SALOME_View* aViewFrame = theViewFrame ? theViewFrame : GetActiveView(); -// -// if ( aViewFrame ) -// { -// SVTK_Viewer* vtk_viewer = dynamic_cast( aViewFrame ); -// if (vtk_viewer) -// { -// SUIT_ViewWindow* wnd = vtk_viewer->getViewManager()->getActiveView(); -// SALOME_Actor* anActor = myGraphicView->FindActorByEntry( wnd, entry.toLatin1().data() ); -// if (!anActor) -// { -// // anActor = myGraphicView->CreateActor( study()->studyDS(), entry.toLatin1().data(), true ); -// anActor = myGraphicView->CreateActor(entry.toLatin1().data()); -// } -// if (anActor) -// { -// // Display actor : -// SVTK_ViewWindow* vtkWnd = dynamic_cast (wnd); -// if (vtkWnd != NULL) -// { -// vtkWnd->AddActor(anActor); -// vtkWnd->Repaint(); -// prs = LightApp_Displayer::buildPresentation(entry.toLatin1().data(), aViewFrame); -// } -// } -// if (prs) -// { -// UpdatePrs(prs); -// } -// else if (anActor) -// { -// //SMESH::RemoveActor( vtk_viewer->getViewManager()->getActiveView(), anActor ); -// std::cout << "Remove Actor" << std::endl; -// } -// } -// } -// -// return prs; -// } - -// SALOME_Prs* SMESHGUI_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame ) -// { -// SALOME_Prs* prs = 0; -// -// SALOME_View* aViewFrame = theViewFrame ? theViewFrame : GetActiveView(); -// -// if ( aViewFrame ) -// { -// SVTK_Viewer* vtk_viewer = dynamic_cast( aViewFrame ); -// if( vtk_viewer ) -// { -// SUIT_ViewWindow* wnd = vtk_viewer->getViewManager()->getActiveView(); -// SMESH_Actor* anActor = SMESH::FindActorByEntry( wnd, entry.toLatin1().data() ); -// if( !anActor ) -// anActor = SMESH::CreateActor( study()->studyDS(), entry.toLatin1().data(), true ); -// if( anActor ) -// { -// SMESH::DisplayActor( wnd, anActor ); -// prs = LightApp_Displayer::buildPresentation( entry.toLatin1().data(), aViewFrame ); -// } -// if( prs ) -// UpdatePrs( prs ); -// else if( anActor ) -// SMESH::RemoveActor( vtk_viewer->getViewManager()->getActiveView(), anActor ); -// } -// } -// -// return prs; -// } - -// -// void DocumentGraphicView::RemoveActor(SUIT_ViewWindow *theWnd, SALOME_Actor* theActor) -// { -// std::cout << "RemoveActor() : 1" << std::endl; -// SVTK_ViewWindow* myViewWindow = dynamic_cast(theWnd); -// // SVTK_ViewWindow* myViewWindow = dynamic_cast(_suitView); -// if (myViewWindow != NULL) -// { -// myViewWindow->RemoveActor(theActor); -// if(theActor->hasIO()) -// { -// std::cout << "RemoveActor() : 2" << std::endl; -// Handle(SALOME_InteractiveObject) anIO = theActor->getIO(); -// if(anIO->hasEntry()) -// { -// std::cout << "RemoveActor() : 3" << std::endl; -// std::string anEntry = anIO->getEntry(); -// SalomeApp_Study* aStudy = dynamic_cast( myViewWindow->getViewManager()->study() ); -// int aStudyId = aStudy->id(); -// // TVisualObjCont::key_type aKey(aStudyId,anEntry); -// // VISUAL_OBJ_CONT.erase(aKey); -// } -// } -// theActor->Delete(); -// myViewWindow->Repaint(); -// std::cout << "RemoveActor() : 4" << std::endl; -// } -// } - -// bool DocumentGraphicView::eventFilter(QObject *obj, QEvent *event) -// { -// std::cout << event->type() << std::endl; -// // if ( event->type() == QEvent::FocusIn ){ //QEvent::KeyPress) { -// // return false; -// // } else { -// // // standard event processing -// // // return QObject::eventFilter(obj, event); -// -// if ( event->type() == QEvent::Paint ) { //QEvent::FocusIn ){ -// std::cout << "PAINTTTTTTTTTT"<< std::endl; -// // loadVTK( "/tmp/load.vtk"); //CS_TEST -// } -// return _suitView->event(event); -// // } -// } -// -// -void DocumentGraphicView::setModel ( QAbstractItemModel * model ) -{ - MESSAGE("DocumentGraphicView::setModel (){"); - QAbstractItemView::setModel( model ); - -// PatternDataModel* pdm = dynamic_cast(model); -// MESSAGE("pdm"<(model); - MESSAGE("dm"<getName() ); - connect( dm, SIGNAL(patternDataChanged() ), this, SLOT ( onPatternDatachanged() ) ); - connect( dm, SIGNAL( nameChanged(const QString&) ), this, SLOT ( setWindowTitle(const QString&) ) ); - - } - - -} - -// void DocumentGraphicView::loadVTK( const QString& path ) //CS_TEST -// { -// std::cout << "DocumentGraphicView::loadVTK=>"<(_suitView); -// -// // vtkStructuredGridReader -// vtkUnstructuredGridReader* r = vtkUnstructuredGridReader::New(); -// // r->SetFileName( path.toLocal8Bit().constData() ); -// r->SetInputString( vtkData.toLocal8Bit().constData() ); -// r->SetReadFromInputString( true ); -// r->Update(); -// -// vtkUnstructuredGrid* myGrid = r->GetOutput();//vtkUnstructuredGrid::New(); -// std::cout << "GetNumberOfCells =>"<< myGrid->GetNumberOfCells(); -// // Create and display actor -// -// vtkDataSetMapper* myMapper = vtkDataSetMapper::New(); -// myMapper->SetInput(myGrid); -// -// // if ( myPreviewActor ){ -// // myVTKViewWindow->RemoveActor(myPreviewActor); -// // myPreviewActor->Delete(); -// // } -// -// SALOME_Actor* myPreviewActor = SALOME_Actor::New(); -// myPreviewActor = SALOME_Actor::New(); -// Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(QString::number( reinterpret_cast(_hexaDocument) ),"HEXABLOCK");//,theName); -// myPreviewActor->setIO(anIO); -// -// // myPreviewActor->PickableOff(); -// myPreviewActor->SetVisibility( true );//VisibilityOff(); -// myPreviewActor->SetPickable( true ); -// myPreviewActor->SetMapper(myMapper); -// -// vtkProperty* aProp = vtkProperty::New(); -// // aProp->SetRepresentationToWireframe(); -// aProp->SetRepresentationToSurface(); -// aProp->EdgeVisibilityOn (); -// -// // aProp->SetColor(10, 10, 250); -// aProp->SetPointSize(5); -// myPreviewActor->SetProperty(aProp); -// aProp->Delete(); -// -// /*vtkProperty* myBackProp = vtkProperty::New(); -// GetColor( "SMESH", "backface_color", aBackRGB[0], aBackRGB[1], aBackRGB[2], QColor( 0, 0, 255 ) ); -// myBackProp->SetColor( aBackRGB[0], aBackRGB[1], aBackRGB[2] ); -// myPreviewActor->SetBackfaceProperty( myBackProp ); -// myBackProp->Delete()*/; -// myVTKViewWindow->AddActor(myPreviewActor); -// myVTKViewWindow->getRenderer()->Render(); -// myVTKViewWindow->Repaint(); -// myVTKViewWindow->onFitAll(); -// -// myVTKViewWindow->SetSelectionMode( ActorSelection ); -// // myVTKViewWindow->SetSelectionMode( NodeSelection ); -// // myVTKViewWindow->SetSelectionMode( EdgeSelection ); -// // myVTKViewWindow->SetSelectionMode( FaceSelection ); -// } - -// void DocumentGraphicView::rowsInserted ( const QModelIndex & parent, int start, int end ) -// { -// -// // std::cout << "DocumentGraphicView::rowsInserted : " << parent.data().toString().toStdString() << std::endl; -// QModelIndex newRow; -// -// SVTK_ViewWindow* myViewWindow = dynamic_cast(_suitView); -// SUIT_ViewManager* vman = myViewWindow->getViewManager(); -// SUIT_ViewModel* vmodel = vman->getViewModel(); -// -// for ( int i = start; i<= end; ++i ){ -// newRow = parent.child(i,0); -// // std::cout << "newRow.data().toString() =>" << newRow.data().toString().toStdString() << std::endl; -// QString entry = newRow.data(HEXA_ENTRY_ROLE).toString();//.toStdString(); -// Display(entry, true, dynamic_cast(vmodel)); -// UpdateViewer(); -// -// // addObject(newRow); -// } -// } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentGraphicView.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentGraphicView.hxx deleted file mode 100755 index b0e648d..0000000 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentGraphicView.hxx +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (C) 2009-2012 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef _HEXABLOCKGUI_DOCUMENTGRAPHICVIEW_HXX_ -#define _HEXABLOCKGUI_DOCUMENTGRAPHICVIEW_HXX_ - - -// SALOME GUI includes -#include -// #include -#include -#include -#include -#include -#include - -// #include -// #include -// #include - -#include -#include -#include -#include -#include -#include -#include -#include - -// class LightApp_Displayer; -// class SalomeApp_Application; -class LightApp_Application; -class SALOME_Actor; - -// class vtkLookupTable ; -// class vtkPoints ; -// class vtkCellArray ; -// class vtkFloatArray ; -// class vtkActor ; -// class vtkPolyData; - - -class vtkUnstructuredGrid; - - -namespace HEXABLOCK -{ - - namespace GUI - { - class hexablockInteractorStyle : public SVTK_InteractorStyle - { - public: - hexablockInteractorStyle() {}; - virtual ~hexablockInteractorStyle() {}; - - public: - static hexablockInteractorStyle* New() - { - return new hexablockInteractorStyle; - }; - virtual void HighlightActor2D(vtkActor2D* actor2D) {std::cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HIGHLIGHT PROP 2D%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;}; - virtual void HighlightProp(vtkProp* prop) {std::cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HIGHLIGHT PROP %%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;}; - virtual void HighlightProp3D(vtkProp3D* prop3D) {std::cout << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% HIGHLIGHT PROP 3D%%%%%%%%%%%%%%%%%%%%%%%%%%%%" << std::endl;}; - }; - - class Document_Actor : public SALOME_Actor - { - public: - Document_Actor(HEXA_NS::Document* doc, const QString& entry); - virtual ~Document_Actor(); - - std::map vtkElemsId; - std::map hexaElemsId; - - vtkUnstructuredGrid* getUnstructuredGrid(); - private: - HEXA_NS::Document* _doc; - }; - - // Abu - class Associate_Actor : public SALOME_Actor - { - public: - Associate_Actor(HEXA_NS::Document* doc, const QString& entry); - virtual ~Associate_Actor() {} - - std::map vtkElemsId; - std::map hexaElemsId; - - vtkUnstructuredGrid* getUnstructuredGrid(); - private: - HEXA_NS::Document* _doc; - }; - - - /******************************************************************************** - * DocumentGraphicView - ********************************************************************************/ - class DocumentGraphicView : public QAbstractItemView - { - Q_OBJECT - - public: - DocumentGraphicView( LightApp_Application* app, SUIT_ViewWindow *suitView, QWidget *parent = 0 ); - virtual ~DocumentGraphicView(); - - - void setModel ( QAbstractItemModel * model ); - - - SUIT_ViewWindow* get_SUIT_ViewWindow(); -// static SALOME_Actor* FindActorByEntry(SUIT_ViewWindow *theWindow, const char* theEntry); - -// void loadVTK( const QString& path ); - void update();//mise à jours de la vue : reconstruction complète - -// bool eventFilter(QObject *obj, QEvent *event); -// virtual void setModel ( QAbstractItemModel * model ); - - QModelIndex indexAt(const QPoint &point) const; - void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible); - QRect visualRect(const QModelIndex &index) const; - -// public: -// virtual bool canBeDisplayed( const QString& /*entry*/, const QString& /*viewer_type*/ ) const; - - public slots: - void setWindowTitle(const QString& title); - void onPatternDatachanged(); - - protected slots: - virtual void closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint ); - virtual void commitData ( QWidget * editor ); - virtual void currentChanged ( const QModelIndex & current, const QModelIndex & previous ); - virtual void dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); - virtual void editorDestroyed ( QObject * editor ); - virtual void rowsAboutToBeRemoved ( const QModelIndex & parent, int start, int end ); - virtual void rowsInserted ( const QModelIndex & parent, int start, int end ); - virtual void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected ); - virtual void updateGeometries (); - - protected: - int horizontalOffset() const; - bool isIndexHidden(const QModelIndex &index) const; - QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, - Qt::KeyboardModifiers modifiers); - void setSelection(const QRect&, QItemSelectionModel::SelectionFlags command); - int verticalOffset() const; - QRegion visualRegionForSelection(const QItemSelection &selection) const; - -// protected: -// virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); - - private: - SUIT_ViewWindow *_suitView; - Document_Actor *_documentActor; - Associate_Actor *_associateActor; - bool _currentChanged; - bool firstUpdate; - }; - } -} - - - - -#endif diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx index 4b616ff..1530c66 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.cxx @@ -19,6 +19,9 @@ #include "HEXABLOCKGUI_DocumentItem.hxx" #include "HexShape.hxx" +#include "HEXABLOCKGUI_SalomeTools.hxx" +#include "HEXABLOCKGUI_DocumentModel.hxx" +#include "HexAssoEdge.hxx" #include @@ -33,7 +36,9 @@ QStandardItem() m_type = ttype; if (m_DocElt != NULL) + { setText(m_DocElt->getName()); + } setData( treeRole, HEXA_TREE_ROLE ); setData( entry, HEXA_DOC_ENTRY_ROLE); setData( IDptr(), HEXA_ENTRY_ROLE ); @@ -44,19 +49,29 @@ QStandardItem() QString entry; if (m_type == VERTEXITEM) //Vertex { - HEXA_NS::Shape* assoc = m_DocElt->getAssociation(); - if ( assoc ){ - entry = QString(assoc->ident.c_str()); - setData( entry + ";" , HEXA_ASSOC_ENTRY_ROLE ); - } + HEXA_NS::Vertex* vertex = (HEXA_NS::Vertex*) m_DocElt; + double assocX, assocY, assocZ; + vertex->getAssoCoord(assocX, assocY, assocZ); + entry = QString::number(assocX)+","+QString::number(assocY)+","+QString::number(assocZ); + setData( entry, HEXA_ASSOC_ENTRY_ROLE ); } else if (m_type == EDGEITEM) { QString entries; - const HEXA_NS::Shapes& assocs = ((HEXA_NS::Edge*)m_DocElt)->getAssociations(); - for( HEXA_NS::Shapes::const_iterator anAssoc = assocs.begin(); anAssoc != assocs.end(); ++anAssoc ){ - entry = (*anAssoc)->ident.c_str(); - entries += entry + ";"; + HEXA_NS::Edge* edge = (HEXA_NS::Edge*) m_DocElt; + HEXA_NS::NewShape* mainShape; + HEXA_NS::EdgeShape* geomEdge; + HEXA_NS::AssoEdge* anEdgeAssoc; + int nbAssocs = edge->countAssociation(); + for (int i = 0; i < nbAssocs; ++i) + { + anEdgeAssoc = edge->getAssociation(i); + if (anEdgeAssoc == NULL) continue; + geomEdge = anEdgeAssoc->getEdgeShape(); + if (geomEdge == NULL) continue; + mainShape = geomEdge->getParentShape(); + if (mainShape == NULL) continue; // => les generatrices ne sont pas gerees pour le moment + entries += QString(mainShape->getName())+","+QString::number(geomEdge->getIdent())+";"; } if ( !entries.isEmpty() ) setData( entries, HEXA_ASSOC_ENTRY_ROLE ); @@ -64,10 +79,17 @@ QStandardItem() else if (m_type == QUADITEM) { QString entries; - const HEXA_NS::Shapes& assocs = ((HEXA_NS::Quad*)m_DocElt)->getAssociations(); - for( HEXA_NS::Shapes::const_iterator anAssoc = assocs.begin(); anAssoc != assocs.end(); ++anAssoc ){ - entry = (*anAssoc)->ident.c_str(); - entries += entry + ";"; + HEXA_NS::Quad* quad = (HEXA_NS::Quad*) m_DocElt; + HEXA_NS::NewShape* mainShape; + HEXA_NS::FaceShape* geomFace; + int nbAssocs = quad->countAssociation(); + for (int i = 0; i < nbAssocs; ++i) + { + geomFace = quad->getAssociation(i); + if (geomFace == NULL) continue; + mainShape = geomFace->getParentShape(); + if (mainShape == NULL) continue; + entries += QString(mainShape->getName()) + "," + QString::number(geomFace->getIdent()) + ";"; } if ( !entries.isEmpty() ) setData( entries, HEXA_ASSOC_ENTRY_ROLE ); @@ -75,22 +97,6 @@ QStandardItem() } } - -//ElementItem::ElementItem( HEXA_NS::EltBase* docElement, HexaType ttype, HexaTreeRole treeRole): -//QStandardItem() -//{ -// m_DocElt = docElement; -// m_type = ttype; -// -// if (m_DocElt != NULL) -// setText(m_DocElt->getName()); -// setData( treeRole, HEXA_TREE_ROLE ); -// setData( IDptr(), HEXA_ENTRY_ROLE ); -// -//// if (m_DocElt->isAssociated()) -//// setData( "Y" , HEXA_ASSOC_ENTRY_ROLE ); -//} - //--------------------------------------------------------------- QVariant ElementItem::data( int role ) const { @@ -106,6 +112,10 @@ QVariant ElementItem::data( int role ) const case PIPEITEM: return QVariant::fromValue( (HEXA_NS::Pipe*)m_DocElt ); case ELEMENTSITEM: return QVariant::fromValue( (HEXA_NS::Elements*)m_DocElt ); case CROSSELEMENTSITEM: return QVariant::fromValue( (HEXA_NS::CrossElements*)m_DocElt ); + case GEOMSHAPEITEM: return QVariant::fromValue( (HEXA_NS::NewShape*) m_DocElt ); + case GEOMPOINTITEM: return QVariant::fromValue( (HEXA_NS::VertexShape*) m_DocElt ); + case GEOMEDGEITEM: return QVariant::fromValue( (HEXA_NS::EdgeShape*) m_DocElt ); + case GEOMFACEITEM: return QVariant::fromValue( (HEXA_NS::FaceShape*) m_DocElt ); default: return QVariant::fromValue( m_DocElt ); } } @@ -192,6 +202,37 @@ CrossElementsItem::CrossElementsItem( HEXA_NS::CrossElements* hexaCrossElts, QSt { } +// ----------------------- GEOM (GEOMETRY) +GeomItem::GeomItem( HEXA_NS::EltBase* geomShape, QString entry, HexaType ttype, HexaTreeRole treeRole, HEXA_NS::EltBase* assoc ): + StandardElementItem(geomShape, entry, ttype, treeRole), + association(assoc) +{ +} + +// ----------------------- GEOM SHAPE (GEOMETRY) +GeomShapeItem::GeomShapeItem( HEXA_NS::NewShape* shape, HEXA_NS::EltBase* assoc ): + GeomItem(shape, QString(), GEOMSHAPEITEM, GEOMSHAPE_TREE, assoc) +{ +} + +// ----------------------- GEOM POINT (GEOMETRY) +GeomPointItem::GeomPointItem( HEXA_NS::VertexShape* geomPoint, HEXA_NS::Vertex* associatedVertex ): + GeomItem(geomPoint, QString(), GEOMPOINTITEM, GEOMPOINT_TREE, associatedVertex) +{ +} + +// ----------------------- GEOM EDGE (GEOMETRY) +GeomEdgeItem::GeomEdgeItem( HEXA_NS::EdgeShape* geomEdge, HEXA_NS::Edge* associatedEdge ): + GeomItem(geomEdge, QString(), GEOMEDGEITEM, GEOMEDGE_TREE, associatedEdge) +{ +} + +// ----------------------- GEOM FACE (GEOMETRY) +GeomFaceItem::GeomFaceItem( HEXA_NS::FaceShape* geomFace, HEXA_NS::Quad* associatedQuad ): + GeomItem(geomFace, QString(), GEOMFACEITEM, GEOMFACE_TREE, associatedQuad) +{ +} + // ----------------------- GROUP GroupItem::GroupItem( HEXA_NS::Group* hexaGroup ): QStandardItem(), diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.hxx index 8813de2..334b200 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentItem.hxx @@ -34,6 +34,10 @@ #include #include #include +#include +#include +#include +#include @@ -55,6 +59,10 @@ Q_DECLARE_METATYPE( HEXA_NS::Cylinder* ); Q_DECLARE_METATYPE( HEXA_NS::Pipe* ); Q_DECLARE_METATYPE( HEXA_NS::Elements* ); Q_DECLARE_METATYPE( HEXA_NS::CrossElements* ); +Q_DECLARE_METATYPE( HEXA_NS::NewShape* ); +Q_DECLARE_METATYPE( HEXA_NS::VertexShape* ); +Q_DECLARE_METATYPE( HEXA_NS::EdgeShape* ); +Q_DECLARE_METATYPE( HEXA_NS::FaceShape* ); Q_DECLARE_METATYPE( HEXA_NS::Group* ); Q_DECLARE_METATYPE( HEXA_NS::Law* ); @@ -80,6 +88,14 @@ namespace HEXABLOCK ELEMENTSITEM, CROSSELEMENTSITEM, + EXPSHAPEITEM, + IMPSHAPEITEM, + CLOUDOFPOINTSITEM, + GEOMSHAPEITEM, + GEOMPOINTITEM, + GEOMEDGEITEM, + GEOMFACEITEM, + GROUPITEM, LAWITEM, PROPAGATIONITEM, @@ -97,6 +113,15 @@ namespace HEXABLOCK ELEMENTS_TREE, CROSSELEMENTS_TREE, + EXPLICIT_SHAPES_TREE, + IMPLICIT_SHAPES_TREE, + CLOUD_OF_POINTS_TREE, + GEOMSHAPE_TREE, + GEOMPOINT_TREE, + GEOMEDGE_TREE, + GEOMFACE_TREE, + + GROUP_TREE, LAW_TREE, PROPAGATION_TREE, @@ -112,6 +137,14 @@ namespace HEXABLOCK ELEMENTS_DIR_TREE, CROSSELEMENTS_DIR_TREE, + EXPLICIT_SHAPES_DIR_TREE, + IMPLICIT_SHAPES_DIR_TREE, + CLOUD_OF_POINTS_DIR_TREE, + GEOMSHAPE_DIR_TREE, + GEOMPOINT_DIR_TREE, + GEOMEDGE_DIR_TREE, + GEOMFACE_DIR_TREE, + GROUP_DIR_TREE, LAW_DIR_TREE, PROPAGATION_DIR_TREE @@ -172,63 +205,101 @@ namespace HEXABLOCK class VertexItem : public GraphicElementItem { public: - VertexItem( HEXA_NS::Vertex* hexaVertex, QString entry="" ); + VertexItem( HEXA_NS::Vertex* hexaVertex, QString entry = ""); }; class EdgeItem : public GraphicElementItem { public: - EdgeItem( HEXA_NS::Edge* hexaEdge, QString entry="" ); + EdgeItem( HEXA_NS::Edge* hexaEdge, QString entry = ""); }; //----------------------------------------- class QuadItem : public GraphicElementItem { public: - QuadItem( HEXA_NS::Quad* hexaQuad, QString entry="" ); + QuadItem( HEXA_NS::Quad* hexaQuad, QString entry = ""); }; //----------------------------------------- class HexaItem : public GraphicElementItem { public: - HexaItem( HEXA_NS::Hexa* hexaHexa, QString entry="" ); + HexaItem( HEXA_NS::Hexa* hexaHexa, QString entry = ""); }; //----------------------------------------- class VectorItem : public StandardElementItem { public: - VectorItem( HEXA_NS::Vector* hexaVector, QString entry="" ); + VectorItem( HEXA_NS::Vector* hexaVector, QString entry = ""); }; //----------------------------------------- class CylinderItem : public StandardElementItem { public: - CylinderItem( HEXA_NS::Cylinder* hexaCyl, QString entry="" ); + CylinderItem( HEXA_NS::Cylinder* hexaCyl, QString entry = ""); }; //----------------------------------------- class PipeItem : public StandardElementItem { public: - PipeItem( HEXA_NS::Pipe* hexaPipe, QString entry="" ); + PipeItem( HEXA_NS::Pipe* hexaPipe, QString entry = ""); }; //----------------------------------------- class ElementsItem : public StandardElementItem { public: - ElementsItem( HEXA_NS::Elements* hexaElements, QString entry="" ); + ElementsItem( HEXA_NS::Elements* hexaElements, QString entry = "" ); }; //----------------------------------------- class CrossElementsItem : public StandardElementItem { public: - CrossElementsItem( HEXA_NS::CrossElements* hexaCrossElts, QString entry="" ); + CrossElementsItem( HEXA_NS::CrossElements* hexaCrossElts, QString entry = ""); + }; + + //------------------------------------------------ + class GeomItem: public StandardElementItem + { + public: + GeomItem( HEXA_NS::EltBase* geomShape, QString entry, HexaType ttype, HexaTreeRole treeRole, HEXA_NS::EltBase* assoc = NULL ); + HEXA_NS::EltBase* getAssociation() const { return association; } + void setAssociation(HEXA_NS::EltBase* assoc) { association = assoc; } + + private: + HEXA_NS::EltBase* association; + }; + + //------------------------------------------------ + class GeomShapeItem: public GeomItem + { + public: + GeomShapeItem( HEXA_NS::NewShape* shape, HEXA_NS::EltBase* assoc = NULL); + }; + + //------------------------------------------------ + class GeomPointItem: public GeomItem + { + public: + GeomPointItem( HEXA_NS::VertexShape* geomPoint, HEXA_NS::Vertex* associatedVertex = NULL); }; + //------------------------------------------------ + class GeomEdgeItem: public GeomItem + { + public: + GeomEdgeItem( HEXA_NS::EdgeShape* geomEdge, HEXA_NS::Edge* associatedEdge = NULL); + }; + //------------------------------------------------ + class GeomFaceItem: public GeomItem + { + public: + GeomFaceItem( HEXA_NS::FaceShape* geomFace, HEXA_NS::Quad* associatedQuad = NULL); + }; //----------------------------------------- class GroupItem : public QStandardItem diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx index 3cad03d..94240a2 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.cxx @@ -26,17 +26,33 @@ #include "HEXABLOCKGUI_DocumentModel.hxx" #include "HEXABLOCKGUI_DocumentItem.hxx" +#include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" #include "HEXABLOCKGUI.hxx" #include "HEXABLOCKGUI_Trace.hxx" #include "HexVertex.hxx" #include "HexShape.hxx" +#include "HexSubShape.hxx" +#include "HexAssoEdge.hxx" + #include #include "HEXABLOCKGUI_SalomeTools.hxx" +#include "MyGEOMBase_Helper.hxx" +#include "GEOM_GEOMBase.hxx" +#include "GEOM_GenericObjPtr.h" + +#include +#include +#include +#include +#include CORBA_CLIENT_HEADER(GEOM_Gen) + #include + + //#define _DEVDEBUG_ @@ -46,307 +62,491 @@ using namespace HEXABLOCK::GUI; /***************************************************************** DocumentModel -*****************************************************************/ + *****************************************************************/ // DocumentModel::DocumentModel(QObject * parent): DocumentModel::DocumentModel(HEXA_NS::Document* docIn, const QString& entryIn, QObject * parent): - QStandardItemModel(parent), - _hexaFile( new QTemporaryFile() ), - _hexaDocument( docIn ), - _entry( entryIn ), -// _hexaDocument( new HEXA_NS::Document("/tmp/doc.hex") ), //CS_TODO - - _vertexDirItem( new QStandardItem(tr("TREE_ITEM_VERTEX")) ), - _edgeDirItem( new QStandardItem(tr("TREE_ITEM_EDGE")) ), - _quadDirItem( new QStandardItem(tr("TREE_ITEM_QUAD")) ), - _hexaDirItem( new QStandardItem(tr("TREE_ITEM_HEXA")) ), - - _vectorDirItem( new QStandardItem(tr("TREE_ITEM_VECTOR")) ), - _cylinderDirItem( new QStandardItem(tr("TREE_ITEM_CYLINDER")) ), - _pipeDirItem( new QStandardItem(tr("TREE_ITEM_PIPE")) ), - _elementsDirItem( new QStandardItem(tr("TREE_ITEM_ELEMENT")) ), - _crossElementsDirItem( new QStandardItem(tr("TREE_ITEM_CROSSELEMENT")) ), - - _groupDirItem( new QStandardItem(tr("TREE_ITEM_GROUP")) ), - - _lawDirItem( new QStandardItem(tr("TREE_ITEM_LAW")) ), - _propagationDirItem( new QStandardItem(tr("TREE_ITEM_PROPAGATION")) ), - - _vertexItemFlags( Qt::NoItemFlags ), - _edgeItemFlags( Qt::NoItemFlags ), - _quadItemFlags( Qt::NoItemFlags ), - _hexaItemFlags( Qt::NoItemFlags ), - _vectorItemFlags( Qt::NoItemFlags ), - _cylinderItemFlags( Qt::NoItemFlags ), - _pipeItemFlags( Qt::NoItemFlags ), - _elementsItemFlags( Qt::NoItemFlags ), - _crossElementsItemFlags( Qt::NoItemFlags ), - _disallowEdition( false ) -{ -// setColumnCount( 4 ); //CS_TEST - if ( !_hexaDocument && _hexaFile->open() ){ - _hexaDocument = new HEXA_NS::Document( _hexaFile->fileName().toLatin1() ); - _hexaDocument->reorderFaces(); - } - - QStandardItem *parentItem = invisibleRootItem(); -// parentItem->setData( QString::number( reinterpret_cast(_hexaDocument) ), HEXA_ENTRY_ROLE ); - parentItem->setData( _entry, HEXA_ENTRY_ROLE ); - - _vertexDirItem->setData( VERTEX_DIR_TREE, HEXA_TREE_ROLE ); - _edgeDirItem->setData( EDGE_DIR_TREE, HEXA_TREE_ROLE ); - _quadDirItem->setData( QUAD_DIR_TREE, HEXA_TREE_ROLE ); - _hexaDirItem->setData( HEXA_DIR_TREE, HEXA_TREE_ROLE ); - - _vectorDirItem->setData( VECTOR_DIR_TREE, HEXA_TREE_ROLE ); - _cylinderDirItem->setData( CYLINDER_DIR_TREE, HEXA_TREE_ROLE ); - _pipeDirItem->setData( PIPE_DIR_TREE, HEXA_TREE_ROLE ); - _elementsDirItem->setData( ELEMENTS_DIR_TREE, HEXA_TREE_ROLE ); - _crossElementsDirItem->setData( CROSSELEMENTS_DIR_TREE, HEXA_TREE_ROLE ); - - _groupDirItem->setData( GROUP_DIR_TREE, HEXA_TREE_ROLE ); - - //CS_TODO associations - - _lawDirItem->setData( LAW_DIR_TREE, HEXA_TREE_ROLE ); - _propagationDirItem->setData( PROPAGATION_DIR_TREE, HEXA_TREE_ROLE ); - - - parentItem->appendRow(_vertexDirItem); - parentItem->appendRow(_edgeDirItem); - parentItem->appendRow(_quadDirItem); - parentItem->appendRow(_hexaDirItem); - parentItem->appendRow(_vectorDirItem); - parentItem->appendRow(_cylinderDirItem); - parentItem->appendRow(_pipeDirItem); - parentItem->appendRow(_elementsDirItem); - parentItem->appendRow(_crossElementsDirItem); - parentItem->appendRow(_groupDirItem); - parentItem->appendRow(_lawDirItem); - parentItem->appendRow(_propagationDirItem); + QStandardItemModel(parent), + _hexaFile( new QTemporaryFile() ), + _hexaDocument( docIn ), + _entry( entryIn ), + // _hexaDocument( new HEXA_NS::Document("/tmp/doc.hex") ), //CS_TODO + + _vertexDirItem( new QStandardItem(tr("TREE_ITEM_VERTEX")) ), + _edgeDirItem( new QStandardItem(tr("TREE_ITEM_EDGE")) ), + _quadDirItem( new QStandardItem(tr("TREE_ITEM_QUAD")) ), + _hexaDirItem( new QStandardItem(tr("TREE_ITEM_HEXA")) ), + + _vectorDirItem( new QStandardItem(tr("TREE_ITEM_VECTOR")) ), + _cylinderDirItem( new QStandardItem(tr("TREE_ITEM_CYLINDER")) ), + _pipeDirItem( new QStandardItem(tr("TREE_ITEM_PIPE")) ), + _elementsDirItem( new QStandardItem(tr("TREE_ITEM_ELEMENT")) ), + _crossElementsDirItem( new QStandardItem(tr("TREE_ITEM_CROSSELEMENT")) ), + + _explicitShapesDirItem( new QStandardItem(tr("TREE_ITEM_EXPSHAPE")) ), + _implicitShapesDirItem( new QStandardItem(tr("TREE_ITEM_IMPSHAPE")) ), + _cloudOfPointsDirItem( new QStandardItem(tr("TREE_ITEM_CLOUD_OF_POINT")) ), + + _groupDirItem( new QStandardItem(tr("TREE_ITEM_GROUP")) ), + + _lawDirItem( new QStandardItem(tr("TREE_ITEM_LAW")) ), + _propagationDirItem( new QStandardItem(tr("TREE_ITEM_PROPAGATION")) ), + + _vertexItemFlags( Qt::NoItemFlags ), + _edgeItemFlags( Qt::NoItemFlags ), + _quadItemFlags( Qt::NoItemFlags ), + _hexaItemFlags( Qt::NoItemFlags ), + _vectorItemFlags( Qt::NoItemFlags ), + _cylinderItemFlags( Qt::NoItemFlags ), + _pipeItemFlags( Qt::NoItemFlags ), + _elementsItemFlags( Qt::NoItemFlags ), + _crossElementsItemFlags( Qt::NoItemFlags ), + + _disallowEdition( false ) +{ + // setColumnCount( 4 ); //CS_TEST + if ( !_hexaDocument && _hexaFile->open() ){ + _hexaDocument = new HEXA_NS::Document( _hexaFile->fileName().toLatin1() ); + _hexaDocument->reorderFaces(); + } + + QStandardItem *parentItem = invisibleRootItem(); + // parentItem->setData( QString::number( reinterpret_cast(_hexaDocument) ), HEXA_ENTRY_ROLE ); + parentItem->setData( _entry, HEXA_ENTRY_ROLE ); + + _vertexDirItem->setData( VERTEX_DIR_TREE, HEXA_TREE_ROLE ); + _edgeDirItem->setData( EDGE_DIR_TREE, HEXA_TREE_ROLE ); + _quadDirItem->setData( QUAD_DIR_TREE, HEXA_TREE_ROLE ); + _hexaDirItem->setData( HEXA_DIR_TREE, HEXA_TREE_ROLE ); + + _vectorDirItem->setData( VECTOR_DIR_TREE, HEXA_TREE_ROLE ); + _cylinderDirItem->setData( CYLINDER_DIR_TREE, HEXA_TREE_ROLE ); + _pipeDirItem->setData( PIPE_DIR_TREE, HEXA_TREE_ROLE ); + _elementsDirItem->setData( ELEMENTS_DIR_TREE, HEXA_TREE_ROLE ); + _crossElementsDirItem->setData( CROSSELEMENTS_DIR_TREE, HEXA_TREE_ROLE ); + + _explicitShapesDirItem->setData( EXPLICIT_SHAPES_DIR_TREE, HEXA_TREE_ROLE ); + _implicitShapesDirItem->setData( IMPLICIT_SHAPES_DIR_TREE, HEXA_TREE_ROLE ); + _cloudOfPointsDirItem->setData( CLOUD_OF_POINTS_DIR_TREE, HEXA_TREE_ROLE ); + + _groupDirItem->setData( GROUP_DIR_TREE, HEXA_TREE_ROLE ); + + //CS_TODO associations + + _lawDirItem->setData( LAW_DIR_TREE, HEXA_TREE_ROLE ); + _propagationDirItem->setData( PROPAGATION_DIR_TREE, HEXA_TREE_ROLE ); + + parentItem->appendRow(_vertexDirItem); + parentItem->appendRow(_edgeDirItem); + parentItem->appendRow(_quadDirItem); + parentItem->appendRow(_hexaDirItem); + + parentItem->appendRow(_vectorDirItem); + parentItem->appendRow(_cylinderDirItem); + parentItem->appendRow(_pipeDirItem); + parentItem->appendRow(_elementsDirItem); + parentItem->appendRow(_crossElementsDirItem); + + parentItem->appendRow(_explicitShapesDirItem); + parentItem->appendRow(_implicitShapesDirItem); +// parentItem->appendRow(_cloudOfPointsDirItem); + + parentItem->appendRow(_groupDirItem); + parentItem->appendRow(_lawDirItem); + parentItem->appendRow(_propagationDirItem); } DocumentModel::~DocumentModel() { - delete _hexaDocument; - delete _hexaFile; + if (_hexaDocument != NULL) + delete _hexaDocument; + + if (_hexaFile != NULL) + delete _hexaFile; } void DocumentModel::setName(const QString& name) { - _hexaDocument->setName( name.toLocal8Bit().constData() ); - emit nameChanged(name); + _hexaDocument->setName( name.toLocal8Bit().constData() ); + emit nameChanged(QString(_hexaDocument->getName())); } -QString DocumentModel::getName() +HEXA_NS::EltBase* DocumentModel::getHexaPtr(const QModelIndex& iElt) { - return _hexaDocument->getName(); + HEXA_NS::EltBase *elt = NULL; + switch ( /*data(iElt, HEXA_TREE_ROLE).toInt()*/iElt.data(HEXA_TREE_ROLE).toInt() ){ + case VERTEX_TREE : elt = getHexaPtr(iElt); break; + case EDGE_TREE : elt = getHexaPtr(iElt); break; + case QUAD_TREE : elt = getHexaPtr(iElt); break; + case HEXA_TREE : elt = getHexaPtr(iElt); break; + case VECTOR_TREE : elt = getHexaPtr(iElt); break; + case CYLINDER_TREE : elt = getHexaPtr(iElt); break; + case PIPE_TREE : elt = getHexaPtr(iElt); break; + case ELEMENTS_TREE : elt = getHexaPtr(iElt); break; + case CROSSELEMENTS_TREE : elt = getHexaPtr(iElt); break; + case GEOMSHAPE_TREE: elt = getHexaPtr(iElt); break; + case GEOMPOINT_TREE: elt = getHexaPtr(iElt); break; + case GEOMEDGE_TREE: elt = getHexaPtr(iElt); break; + case GEOMFACE_TREE: elt = getHexaPtr(iElt); break; + } + return elt; } -HEXA_NS::EltBase* DocumentModel::getHexaPtr(const QModelIndex& iElt) +//get the number of elements of type 'eltType' in the document +int DocumentModel::getNbrElt(HEXA_NS::EnumElt eltType) { - HEXA_NS::EltBase *elt = NULL; - switch ( /*data(iElt, HEXA_TREE_ROLE).toInt()*/iElt.data(HEXA_TREE_ROLE).toInt() ){ - case VERTEX_TREE : elt = getHexaPtr(iElt); break; - case EDGE_TREE : elt = getHexaPtr(iElt); break; - case QUAD_TREE : elt = getHexaPtr(iElt); break; - case HEXA_TREE : elt = getHexaPtr(iElt); break; - case VECTOR_TREE : elt = getHexaPtr(iElt); break; - case CYLINDER_TREE : elt = getHexaPtr(iElt); break; - case PIPE_TREE : elt = getHexaPtr(iElt); break; - case ELEMENTS_TREE : elt = getHexaPtr(iElt); break; - case CROSSELEMENTS_TREE : elt = getHexaPtr(iElt); break; - } - return elt; + if (_hexaDocument == NULL) return 0; + + return _hexaDocument->getNbrElt(eltType); +} + +//get the number of elements of type 'eltType' used in the document +int DocumentModel::getNbrUsedElt(HEXA_NS::EnumElt eltType) +{ + if (_hexaDocument == NULL) return 0; + + switch(eltType) { + case HEXA_NS::EL_VERTEX: + return _hexaDocument->countUsedVertex(); + case HEXA_NS::EL_EDGE: + return _hexaDocument->countUsedEdge(); + case HEXA_NS::EL_QUAD: + return _hexaDocument->countUsedQuad(); + case HEXA_NS::EL_HEXA: + return _hexaDocument->countUsedHexa(); + default: return 0; + } +} + +//associate a shape to the current document +bool DocumentModel::addShape(TopoDS_Shape& aShape, QString& name) +{ + if (aShape.IsNull()) return false; + return (_hexaDocument != NULL ? _hexaDocument->addShape(aShape, name.toStdString().c_str()) != NULL : false); +} + +//get the number of unused elements of type 'eltType' in the document +int DocumentModel::getNbrUnusedElt(HEXA_NS::EnumElt eltType) +{ + if (_hexaDocument == NULL) return 0; + + return getNbrElt(eltType) - getNbrUsedElt(eltType); } DocumentModel::GeomObj* DocumentModel::convertToGeomObj(GEOM::GeomObjPtr geomObjPtr) { - TopoDS_Shape aShape; - DocumentModel::GeomObj *res = NULL; - - if ( geomObjPtr && GEOMBase::GetShape(geomObjPtr.get(), aShape) && !aShape.IsNull() ) - { - res = new DocumentModel::GeomObj; - if (res == NULL) return NULL; - QString mainShapeEntry; - int subId = -1; - QString brep; - - if ( geomObjPtr->IsMainShape() ){ - mainShapeEntry = geomObjPtr->GetStudyEntry(); - brep = shape2string( aShape ).c_str(); - } else { - TopoDS_Shape shape; - TopoDS_Shape subshape; - GEOM::GEOM_Object_var mainShape = geomObjPtr->GetMainShape(); - mainShapeEntry = mainShape->GetStudyEntry(); - // CS_TODO : à optimiser - bool okShape = GEOMBase::GetShape( mainShape , shape);//,const TopAbs_ShapeEnum type = TopAbs_SHAPE ); - bool oksubShape = GEOMBase::GetShape( geomObjPtr.get(), subshape );//,const TopAbs_ShapeEnum type = TopAbs_SHAPE ); - if ( okShape && oksubShape ){ - brep = shape2string( subshape ).c_str(); - subId = GEOMBase::GetIndex( subshape, shape ); - } - } - res->name = GEOMBase::GetName( geomObjPtr.get() ); - res->entry = mainShapeEntry; - res->subid = QString::number(subId); - res->brep = brep; - res->start = 0.; - res->end = 1.; - } - - return res; + TopoDS_Shape aShape; + DocumentModel::GeomObj *res = NULL; + + if ( geomObjPtr && GEOMBase::GetShape(geomObjPtr.get(), aShape) && !aShape.IsNull() ) + { + res = new DocumentModel::GeomObj; + if (res == NULL) return NULL; + QString mainShapeEntry; + int subId = -1; + QString brep; + + if ( geomObjPtr->IsMainShape() ){ + mainShapeEntry = geomObjPtr->GetStudyEntry(); + brep = shape2string( aShape ).c_str(); + } else { + TopoDS_Shape shape; + TopoDS_Shape subshape; + GEOM::GEOM_Object_var mainShape = geomObjPtr->GetMainShape(); + mainShapeEntry = mainShape->GetStudyEntry(); + // CS_TODO : à optimiser + bool okShape = GEOMBase::GetShape( mainShape , shape); + bool oksubShape = GEOMBase::GetShape( geomObjPtr.get(), subshape ); + if ( okShape && oksubShape ){ + brep = shape2string( subshape ).c_str(); + subId = GEOMBase::GetIndex( subshape, shape ); + MESSAGE("subid = " << QString::number(subId).toStdString()); + } + } + res->shapeName = getGeomObjName(mainShapeEntry); + res->name = GEOMBase::GetName( geomObjPtr.get() ); + res->subid = QString::number(subId); + res->brep = brep; + res->start = 0.; + res->end = 1.; + } + + return res; +} + + +//Load the current Document +void DocumentModel::load() +{ + if (_hexaDocument == NULL) return; + load(_hexaDocument->getName()); } void DocumentModel::load( const QString& xmlFileName ) // Fill Data { - MESSAGE("HEXABLOCKGUI::load() => "<loadXml(xmlFileName.toLocal8Bit().constData() ); - clearAll(); + _hexaDocument->loadXml(xmlFileName.toLocal8Bit().constData() ); + clearAll(); - fillData(); - fillBuilder(); - fillAssociation(); - fillGroups(); - fillMesh(); + fillData(); + fillBuilder(); + fillGeometry(); + fillAssociation(); + fillGroups(); + fillMesh(); - emit patternDataChanged(); + emit patternDataChanged(); - // BUILDER, ASSOCIATION, GROUPS, ... CS_TODO _fillBuilderFrom( _hexaDocument ); + // BUILDER, ASSOCIATION, GROUPS, ... CS_TODO _fillBuilderFrom( _hexaDocument ); +} + +bool DocumentModel::isEmpty() const +{ + if (_hexaDocument == NULL) return true; + return _hexaDocument->isEmpty(); } void DocumentModel::save( const QString& xmlFileName ) { - MESSAGE("HEXABLOCKGUI::save() => "<save( xmlFileName.toLocal8Bit().constData() ); + _hexaDocument->save( xmlFileName.toLocal8Bit().constData() ); +} + +QString DocumentModel::getName() +{ + return _hexaDocument->getName(); } void DocumentModel::updateData() { - clearData(); - fillData(); - clearMesh(); - fillMesh(); - emit patternDataChanged(); + clearData(); + fillData(); + clearMesh(); + fillMesh(); + emit patternDataChanged(); +} + +void DocumentModel::refresh() +{ + clearAll(); + + fillData(); + fillBuilder(); + fillGeometry(); + fillAssociation(); + fillGroups(); + fillMesh(); + + emit patternDataChanged(); + } -void DocumentModel::clearAll() +void DocumentModel::clearAll() { - clearData(); - clearBuilder(); - clearAssociation(); - clearGroups(); - clearMesh(); - //dataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight ) - //CS_TODO : todo : association, groups, mesh + clearData(); + clearBuilder(); + clearGeometry(); + clearAssociation(); + clearGroups(); + clearMesh(); + + //dataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight ) + //CS_TODO : todo : association, groups, mesh } void DocumentModel::clearData() { - _vertexDirItem->removeRows( 0, _vertexDirItem->rowCount() ); - _edgeDirItem->removeRows(0, _edgeDirItem->rowCount() ); - _quadDirItem->removeRows(0, _quadDirItem->rowCount() ); - _hexaDirItem->removeRows(0, _hexaDirItem->rowCount() ); + _vertexDirItem->removeRows( 0, _vertexDirItem->rowCount() ); + _edgeDirItem->removeRows(0, _edgeDirItem->rowCount() ); + _quadDirItem->removeRows(0, _quadDirItem->rowCount() ); + _hexaDirItem->removeRows(0, _hexaDirItem->rowCount() ); } void DocumentModel::clearBuilder() { - _vectorDirItem->removeRows(0, _vectorDirItem->rowCount() ); - _cylinderDirItem->removeRows(0, _cylinderDirItem->rowCount() ); - _pipeDirItem->removeRows(0, _pipeDirItem->rowCount() ); - _elementsDirItem->removeRows(0, _elementsDirItem->rowCount() ); - _crossElementsDirItem->removeRows(0, _crossElementsDirItem->rowCount() ); + _vectorDirItem->removeRows(0, _vectorDirItem->rowCount() ); + _cylinderDirItem->removeRows(0, _cylinderDirItem->rowCount() ); + _pipeDirItem->removeRows(0, _pipeDirItem->rowCount() ); + _elementsDirItem->removeRows(0, _elementsDirItem->rowCount() ); + _crossElementsDirItem->removeRows(0, _crossElementsDirItem->rowCount() ); } -void DocumentModel::clearAssociation() +void DocumentModel::clearGeometry() { - //CS_TODO + _explicitShapesDirItem->removeRows(0, _explicitShapesDirItem->rowCount() ); + _implicitShapesDirItem->removeRows(0, _implicitShapesDirItem->rowCount() ); + _cloudOfPointsDirItem->removeRows(0, _cloudOfPointsDirItem->rowCount() ); +} + +void DocumentModel::clearAssociation() +{ + //CS_TODO } void DocumentModel::clearGroups() { - _groupDirItem->removeRows(0, _groupDirItem->rowCount() ); + _groupDirItem->removeRows(0, _groupDirItem->rowCount() ); } void DocumentModel::clearMesh() { - _lawDirItem->removeRows(0, _lawDirItem->rowCount() ); - _propagationDirItem->removeRows(0, _propagationDirItem->rowCount() ); + _lawDirItem->removeRows(0, _lawDirItem->rowCount() ); + _propagationDirItem->removeRows(0, _propagationDirItem->rowCount() ); } void DocumentModel::fillData() { - // DATA - HEXA_NS::Vertex *v = NULL; - VertexItem *vItem = NULL; - for ( int i=0; i<_hexaDocument->countVertex(); ++i ){ - v = _hexaDocument->getVertex(i); - - vItem = new VertexItem(v, _entry); - _vertexDirItem->appendRow(vItem); - } - - HEXA_NS::Edge *e = NULL; - EdgeItem *eItem = NULL; - for ( int i=0; i<_hexaDocument->countEdge(); ++i ){ - e = _hexaDocument->getEdge(i); - eItem = new EdgeItem(e, _entry); - _edgeDirItem->appendRow(eItem); - } - - HEXA_NS::Quad *q = NULL; - QuadItem *qItem = NULL; - for ( int i=0; i<_hexaDocument->countQuad(); ++i ){ - q = _hexaDocument->getQuad(i); - qItem = new QuadItem(q, _entry); - _quadDirItem->appendRow(qItem); - } - - HEXA_NS::Hexa *h = NULL; - HexaItem *hItem = NULL; - for ( int i=0; i<_hexaDocument->countHexa(); ++i ){ - h = _hexaDocument->getHexa(i); - hItem = new HexaItem(h, _entry); - _hexaDirItem->appendRow(hItem); - } -} - - -void DocumentModel::fillBuilder() -{ - HEXA_NS::Vector *v = NULL; - VectorItem *vItem = NULL; - for ( int i=0; i<_hexaDocument->countVector(); ++i ){ - v = _hexaDocument->getVector(i); - vItem = new VectorItem(v); - _vectorDirItem->appendRow(vItem); - } - - // _cylinderDirItem - HEXA_NS::Cylinder *c = NULL; - CylinderItem *cItem = NULL; - for ( int i=0; i<_hexaDocument->countCylinder(); ++i ){ - c = _hexaDocument->getCylinder(i); - cItem = new CylinderItem(c, _entry); - _cylinderDirItem->appendRow(cItem); - } - -// _pipeDirItem - HEXA_NS::Pipe *p = NULL; - PipeItem *pItem = NULL; - for ( int i=0; i<_hexaDocument->countPipe(); ++i ){ - p = _hexaDocument->getPipe(i); - pItem = new PipeItem(p); - _pipeDirItem->appendRow(pItem); - } + // DATA + HEXA_NS::Vertex *v = NULL; + VertexItem *vItem = NULL; + for ( int i=0; i<_hexaDocument->countVertex(); ++i ){ + v = _hexaDocument->getVertex(i); + vItem = new VertexItem(v, _entry); + _vertexDirItem->appendRow(vItem); + } + + HEXA_NS::Edge *e = NULL; + EdgeItem *eItem = NULL; + for ( int i=0; i<_hexaDocument->countEdge(); ++i ){ + e = _hexaDocument->getEdge(i); + eItem = new EdgeItem(e, _entry); + _edgeDirItem->appendRow(eItem); + } + + HEXA_NS::Quad *q = NULL; + QuadItem *qItem = NULL; + for ( int i=0; i<_hexaDocument->countQuad(); ++i ){ + q = _hexaDocument->getQuad(i); + qItem = new QuadItem(q, _entry); + _quadDirItem->appendRow(qItem); + } + + HEXA_NS::Hexa *h = NULL; + HexaItem *hItem = NULL; + for ( int i=0; i<_hexaDocument->countHexa(); ++i ){ + h = _hexaDocument->getHexa(i); + hItem = new HexaItem(h, _entry); + _hexaDirItem->appendRow(hItem); + } } -void DocumentModel::fillAssociation() + + +void DocumentModel::fillBuilder() { + HEXA_NS::Vector *v = NULL; + VectorItem *vItem = NULL; + for ( int i=0; i<_hexaDocument->countVector(); ++i ){ + v = _hexaDocument->getVector(i); + vItem = new VectorItem(v); + _vectorDirItem->appendRow(vItem); + } + + // _cylinderDirItem + HEXA_NS::Cylinder *c = NULL; + CylinderItem *cItem = NULL; + for ( int i=0; i<_hexaDocument->countCylinder(); ++i ){ + c = _hexaDocument->getCylinder(i); + cItem = new CylinderItem(c, _entry); + _cylinderDirItem->appendRow(cItem); + } + // _pipeDirItem + HEXA_NS::Pipe *p = NULL; + PipeItem *pItem = NULL; + for ( int i=0; i<_hexaDocument->countPipe(); ++i ){ + p = _hexaDocument->getPipe(i); + pItem = new PipeItem(p); + _pipeDirItem->appendRow(pItem); + } +} + +void DocumentModel::fillGeometry() +{ + + if (_hexaDocument == NULL) return; + + HEXA_NS::NewShape* shape; + HEXA_NS::VertexShape* node; + HEXA_NS::EdgeShape* line; + HEXA_NS::FaceShape* face; + + //explicit shape + + //fill the shape tree + shapeById.clear(); + for (int i=0; i < _hexaDocument->countShape(); ++i) + { + shape = _hexaDocument->getShape(i); + QString shapeName = shape->getName(); + + //publish the shape in the study if not done yet + if (!docShapesEntry.contains(shapeName)) + { + //save the brep of the shape in a temporary file + QString fileName = shapeName + ".brep"; + shape->saveBrep(); + + //importing the brep in the study + QString objStudyEntry = HEXABLOCKGUI::addInStudy(fileName); + + docShapesName[objStudyEntry] = shapeName; + docShapesEntry[shapeName] = objStudyEntry; + } + + GeomShapeItem* shItem = new GeomShapeItem(shape); + if (shape->getOrigin() == HEXA_NS::SH_IMPORT) + _explicitShapesDirItem->appendRow(shItem); + else + _implicitShapesDirItem->appendRow(shItem); + + //add vertices to the tree + QStandardItem* geomPointDirItem = new QStandardItem(tr("TREE_ITEM_VERTEX")); + geomPointDirItem->setData( GEOMPOINT_DIR_TREE, HEXA_TREE_ROLE ); + shItem->appendRow(geomPointDirItem); + for (int j=0; j < shape->countVertex(); ++j) + { + node = shape->getVertexShape(j); + GeomPointItem* gPointItem = new GeomPointItem(node); + geomPointDirItem->appendRow(gPointItem); + shapeById[shapeName+","+QString::number(node->getIdent())] = node; + } + + //add edges to the tree + QStandardItem* geomEdgeDirItem = new QStandardItem(tr("TREE_ITEM_EDGE")); + geomEdgeDirItem->setData( GEOMEDGE_DIR_TREE, HEXA_TREE_ROLE ); + shItem->appendRow(geomEdgeDirItem); + for (int j = 0; j < shape->countEdge(); ++j) + { + line = shape->getEdgeShape(j); + GeomEdgeItem* gEdgeItem = new GeomEdgeItem(line); + geomEdgeDirItem->appendRow(gEdgeItem); + shapeById[shapeName+","+QString::number(line->getIdent())] = line; + } + + //add faces to the tree + QStandardItem* geomFaceDirItem = new QStandardItem(tr("TREE_ITEM_QUAD")); + geomFaceDirItem->setData( GEOMFACE_DIR_TREE, HEXA_TREE_ROLE ); + shItem->appendRow(geomFaceDirItem); + for (int j = 0; j < shape->countFace(); ++j) + { + face = shape->getFaceShape(j); + GeomFaceItem* gFaceItem = new GeomFaceItem(face); + geomFaceDirItem->appendRow(gFaceItem); + shapeById[shapeName+","+QString::number(face->getIdent())] = face; + } + } + + //implicit shapes + //...here + + + //cloud of points + //...here + +} + +void DocumentModel::fillAssociation() +{ } //------------------------------------------- NEW ITEMS @@ -384,94 +584,90 @@ void DocumentModel::fillAssociation() void DocumentModel::fillGroups() { - HEXA_NS::Group *g = NULL; - GroupItem *gItem = NULL; - for ( int i=0; i<_hexaDocument->countGroup(); ++i ){ - g = _hexaDocument->getGroup(i); - //std::cout<<"getGroup => "<< i << std::endl; - gItem = new GroupItem(g); - gItem->setData( _entry, HEXA_DOC_ENTRY_ROLE ); - _groupDirItem->appendRow(gItem); - } + HEXA_NS::Group *g = NULL; + GroupItem *gItem = NULL; + for ( int i=0; i<_hexaDocument->countGroup(); ++i ){ + g = _hexaDocument->getGroup(i); + //std::cout<<"getGroup => "<< i << std::endl; + gItem = new GroupItem(g); + gItem->setData( _entry, HEXA_DOC_ENTRY_ROLE ); + _groupDirItem->appendRow(gItem); + } } void DocumentModel::fillMesh() { - // _lawDirItem - HEXA_NS::Law *l = NULL; - LawItem *lItem = NULL; - for ( int i=0; i<_hexaDocument->countLaw(); ++i ){ - l = _hexaDocument->getLaw(i); - lItem = new LawItem(l); - _lawDirItem->appendRow(lItem); - } - - // _propagationDirItem - HEXA_NS::Propagation *p = NULL; - PropagationItem *pItem = NULL; - for ( int i=0; i<_hexaDocument->countPropagation(); ++i ){ - p = _hexaDocument->getPropagation(i); - pItem = new PropagationItem(p); - pItem->setText(QString("Propagation%1").arg(i) ); - pItem->setData( _entry, HEXA_DOC_ENTRY_ROLE ); - _propagationDirItem->appendRow(pItem); - } + // _lawDirItem + HEXA_NS::Law *l = NULL; + LawItem *lItem = NULL; + for ( int i=0; i<_hexaDocument->countLaw(); ++i ){ + l = _hexaDocument->getLaw(i); + lItem = new LawItem(l); + _lawDirItem->appendRow(lItem); + } + + // _propagationDirItem + HEXA_NS::Propagation *p = NULL; + PropagationItem *pItem = NULL; + for ( int i=0; i<_hexaDocument->countPropagation(); ++i ){ + p = _hexaDocument->getPropagation(i); + pItem = new PropagationItem(p); + pItem->setText(QString("Propagation%1").arg(i) ); + pItem->setData( _entry, HEXA_DOC_ENTRY_ROLE ); + _propagationDirItem->appendRow(pItem); + } } HEXA_NS::Hexa* DocumentModel::getQuadHexa(HEXA_NS::Quad* quad) { - HEXA_NS::Hexa* hexa; - for ( int i=0; i<_hexaDocument->countHexa(); ++i ){ - hexa = _hexaDocument->getHexa(i); - if (hexa->findQuad(quad) > -1) return hexa; - } - return NULL; + HEXA_NS::Hexa* hexa; + for ( int i=0; i<_hexaDocument->countHexa(); ++i ){ + hexa = _hexaDocument->getHexa(i); + if (hexa->findQuad(quad) > -1) return hexa; + } + return NULL; } Qt::ItemFlags DocumentModel::flags(const QModelIndex &index) const { - Qt::ItemFlags flags; + Qt::ItemFlags flags; - if (!index.isValid()) return Qt::ItemIsEnabled; + if (!index.isValid()) return Qt::ItemIsEnabled; - if ( _disallowEdition ){ - return QAbstractItemModel::flags(index) | Qt::ItemFlags( ~Qt::ItemIsEditable ); - } else { - return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; - } + if ( _disallowEdition ){ + return QAbstractItemModel::flags(index) | Qt::ItemFlags( ~Qt::ItemIsEditable ); + } else { + return QAbstractItemModel::flags(index) | Qt::ItemIsEditable; + } } void DocumentModel::allowEdition() { - MESSAGE("DocumentModel::allowEdition(){"); - _disallowEdition = false; - MESSAGE("}"); + _disallowEdition = false; } void DocumentModel::disallowEdition() { - MESSAGE("DocumentModel::disallowEdition (){"); - _disallowEdition = true; - MESSAGE("}"); + _disallowEdition = true; } void DocumentModel::allowDataSelectionOnly() { - _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } void DocumentModel::allowVertexSelectionOnly() @@ -491,550 +687,574 @@ void DocumentModel::allowVertexSelectionOnly() _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); -// emit layoutChanged(); + // emit layoutChanged(); } void DocumentModel::allowEdgeSelectionOnly() { - _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + + _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - - _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } void DocumentModel::allowQuadSelectionOnly() { - _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } void DocumentModel::allowHexaSelectionOnly() { - _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } void DocumentModel::allowVectorSelectionOnly() { - _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } void DocumentModel::allowCylinderSelectionOnly() { - _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } void DocumentModel::allowPipeSelectionOnly() { - _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } void DocumentModel::allowElementsSelectionOnly() { - _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } void DocumentModel::allowCrossElementsSelectionOnly() { - _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _crossElementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } void DocumentModel::allowLawSelectionOnly() { - _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _vertexItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _edgeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _quadItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _hexaItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _crossElementsItemFlags = Qt::ItemFlags( Qt::ItemIsEnabled ); + _vectorItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _cylinderItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _pipeItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _elementsItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _crossElementsItemFlags = Qt::ItemFlags( Qt::ItemIsEnabled ); - _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); - _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); - _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _groupItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); + _lawItemFlags = Qt::ItemFlags( ~Qt::ItemIsEditable ); + _propagationItemFlags = Qt::ItemFlags( ~Qt::ItemIsEnabled ); } void DocumentModel::setName( const QModelIndex& iElt, const QString& name ) { - HEXA_NS::EltBase *elt = NULL; + HEXA_NS::EltBase *elt = NULL; - switch ( data(iElt, HEXA_TREE_ROLE).toInt() ){ - case GROUP_TREE : - { - HEXA_NS::Group* grp = iElt.data( HEXA_DATA_ROLE ).value< HEXA_NS::Group* >(); - grp->setName( name.toLatin1().data() ); - break; - } - case LAW_TREE : - { - HEXA_NS::Law* l = iElt.data( HEXA_DATA_ROLE ).value< HEXA_NS::Law* >(); - l->setName( name.toLatin1().data() ); - break; - } - // case PROPAGATION_TREE : elt = iElt.data( HEXA_DATA_ROLE ).value< HEXA_NS::Propagation* >(); break; - default: elt = getHexaPtr(iElt); - } + switch ( data(iElt, HEXA_TREE_ROLE).toInt() ){ + case GROUP_TREE : + { + HEXA_NS::Group* grp = iElt.data( HEXA_DATA_ROLE ).value< HEXA_NS::Group* >(); + grp->setName( name.toLatin1().data() ); + break; + } + case LAW_TREE : + { + HEXA_NS::Law* l = iElt.data( HEXA_DATA_ROLE ).value< HEXA_NS::Law* >(); + l->setName( name.toLatin1().data() ); + break; + } + // case PROPAGATION_TREE : elt = iElt.data( HEXA_DATA_ROLE ).value< HEXA_NS::Propagation* >(); break; + default: elt = getHexaPtr(iElt); + } - if ( elt != NULL ) elt->setName( name.toStdString() ); - setData( iElt, name ); + if ( elt != NULL ) elt->setName( name.toStdString() ); + setData( iElt, name ); } bool DocumentModel::clearEltAssociations( const QModelIndex& iElt ) { - bool isOk = false; - HEXA_NS::EltBase *elt = getHexaPtr(iElt); + bool isOk = false; + HEXA_NS::EltBase *elt = getHexaPtr(iElt); - if ( elt != NULL ){ - elt->clearAssociation(); - setData( iElt, QVariant(), HEXA_ASSOC_ENTRY_ROLE ); - isOk = true; - } + if ( elt != NULL ){ + elt->clearAssociation(); + setData( iElt, QVariant(), HEXA_ASSOC_ENTRY_ROLE ); + isOk = true; + } - return isOk; + return isOk; } +void DocumentModel::clearAssociation(HEXA_NS::EnumElt& eltType) +{ + if (_hexaDocument != NULL) + _hexaDocument->clearAssociation(eltType); + + QModelIndex iElt; + HEXA_NS::Vertex* vertex; + HEXA_NS::Edge* edge; + HEXA_NS::Quad* quad; + int nbElts; + + if (HEXABLOCKGUI::currentDocGView == NULL) return; + PatternDataSelectionModel* pdsm = HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel(); + PatternDataModel* pdm = HEXABLOCKGUI::currentDocGView->getPatternDataModel(); + if (pdsm == NULL || pdm == NULL) return; + + //update associations in the model + if (eltType == HEXA_NS::EL_VERTEX) + { + nbElts = _hexaDocument->countVertex(); + for (int i = 0; i < nbElts; ++i) + { + vertex = _hexaDocument->getVertex(i); + iElt = pdm->mapToSource(pdsm->indexBy(HEXA_DATA_ROLE, QVariant::fromValue(vertex))); + if (iElt.isValid()) + setData( iElt, QVariant(), HEXA_ASSOC_ENTRY_ROLE ); + } + } + else if (eltType == HEXA_NS::EL_EDGE) + { + nbElts = _hexaDocument->countEdge(); + for (int i = 0; i < nbElts; ++i) + { + edge = _hexaDocument->getEdge(i); + iElt = pdm->mapToSource(pdsm->indexBy(HEXA_DATA_ROLE, QVariant::fromValue(edge))); + if (iElt.isValid()) + setData( iElt, QVariant(), HEXA_ASSOC_ENTRY_ROLE ); + } + } + else if (eltType == HEXA_NS::EL_QUAD) + { + nbElts = _hexaDocument->countQuad(); + for (int i = 0; i < nbElts; ++i) + { + quad = _hexaDocument->getQuad(i); + iElt = pdm->mapToSource(pdsm->indexBy(HEXA_DATA_ROLE, QVariant::fromValue(quad))); + if (iElt.isValid()) + setData( iElt, QVariant(), HEXA_ASSOC_ENTRY_ROLE ); + } + } +} + + QModelIndex DocumentModel::addVertex( double x, double y, double z ) { - QModelIndex vertexIndex; + QModelIndex vertexIndex; + + HEXA_NS::Vertex* hv = _hexaDocument->addVertex(x, y, z); + if (BadElement(hv)) return vertexIndex; - HEXA_NS::Vertex* hv = _hexaDocument->addVertex(x, y, z); - if ( hv->isValid() ){ VertexItem* v = new VertexItem(hv, _entry); _vertexDirItem->appendRow(v); vertexIndex = v->index(); emit patternDataChanged(); - } else { - delete hv; - } - return vertexIndex; + return vertexIndex; } QModelIndex DocumentModel::addEdgeVertices (const QModelIndex &i_v0, const QModelIndex &i_v1 ) { - QModelIndex edgeIndex; + QModelIndex edgeIndex; - HEXA_NS::Vertex* hv0 = getHexaPtr(i_v0); - HEXA_NS::Vertex* hv1 = getHexaPtr(i_v1); + HEXA_NS::Vertex* hv0 = getHexaPtr(i_v0); + HEXA_NS::Vertex* hv1 = getHexaPtr(i_v1); - HEXA_NS::Edge* he = _hexaDocument->addEdge( hv0, hv1 ); + HEXA_NS::Edge* he = _hexaDocument->addEdge( hv0, hv1 ); + if ( BadElement(he) ) return edgeIndex; - if ( he->isValid() ){ EdgeItem* e = new EdgeItem(he, _entry); _edgeDirItem->appendRow(e); edgeIndex = e->index(); emit patternDataChanged(); - } else { - delete he; - } - return edgeIndex; + + return edgeIndex; } QModelIndex DocumentModel::addEdgeVector( const QModelIndex &i_v, const QModelIndex &i_vec ) { - QModelIndex edgeIndex; + QModelIndex edgeIndex; + + HEXA_NS::Vertex* hv = getHexaPtr(i_v); + HEXA_NS::Vector* hvec = getHexaPtr(i_vec); - HEXA_NS::Vertex* hv = getHexaPtr(i_v); - HEXA_NS::Vector* hvec = getHexaPtr(i_vec); + if (!hv || !hvec) return edgeIndex; - if (!hv || !hvec) return edgeIndex; + HEXA_NS::Edge* he = _hexaDocument->addEdge( hv, hvec ); + if ( BadElement(he) ) return edgeIndex; - HEXA_NS::Edge* he = _hexaDocument->addEdge( hv, hvec ); - if (!he) return edgeIndex; - HEXA_NS::Vertex* hv2 = he->getAval(); //the new vertex resulting from the creation of the edge - if (!hv2) return edgeIndex; + HEXA_NS::Vertex* hv2 = he->getAval(); //the new vertex resulting from the creation of the edge + if (hv2 == NULL) return edgeIndex; - //ADD the elements in the treeview - if ( he->isValid() ){ - //The Edge + //ADD the elements in the treeview + //The Edge EdgeItem* e = new EdgeItem(he, _entry); _edgeDirItem->appendRow(e); - //The Vertex + //The resulting Vertex VertexItem* v = new VertexItem(hv2, _entry); _vertexDirItem->appendRow(v); - edgeIndex = e->index(); emit patternDataChanged(); - } else - delete he; - return edgeIndex; + return edgeIndex; } QModelIndex DocumentModel::addQuadVertices( const QModelIndex &i_v0, const QModelIndex &i_v1, - const QModelIndex &i_v2, const QModelIndex &i_v3 ) + const QModelIndex &i_v2, const QModelIndex &i_v3 ) { //CS_TODO : gestion erreur - QModelIndex quadIndex; - - HEXA_NS::Vertex* hv0 = getHexaPtr(i_v0); - HEXA_NS::Vertex* hv1 = getHexaPtr(i_v1); - HEXA_NS::Vertex* hv2 = getHexaPtr(i_v2); - HEXA_NS::Vertex* hv3 = getHexaPtr(i_v3); - - if ( hv0 and hv1 and hv2 and hv3 ){ - HEXA_NS::Quad* hq = _hexaDocument->addQuadVertices( hv0, hv1, hv2, hv3 ); - if ( hq->isValid() ){ - QuadItem* q = new QuadItem(hq, _entry); - _quadDirItem->appendRow(q); - quadIndex = q->index(); - emit patternDataChanged(); - } else { - delete hq; + QModelIndex quadIndex; + + HEXA_NS::Vertex* hv0 = getHexaPtr(i_v0); + HEXA_NS::Vertex* hv1 = getHexaPtr(i_v1); + HEXA_NS::Vertex* hv2 = getHexaPtr(i_v2); + HEXA_NS::Vertex* hv3 = getHexaPtr(i_v3); + + if ( hv0 and hv1 and hv2 and hv3 ){ + HEXA_NS::Quad* hq = _hexaDocument->addQuadVertices( hv0, hv1, hv2, hv3 ); + if ( BadElement(hq) ) return quadIndex; + + QuadItem* q = new QuadItem(hq, _entry); + _quadDirItem->appendRow(q); + quadIndex = q->index(); + emit patternDataChanged(); } - } - return quadIndex; + + return quadIndex; } QModelIndex DocumentModel::addQuadEdges( const QModelIndex &e0, const QModelIndex &e1, - const QModelIndex &e2, const QModelIndex &e3 ) + const QModelIndex &e2, const QModelIndex &e3 ) { //CS_TODO - QModelIndex quadIndex; - - HEXA_NS::Edge* he0 = getHexaPtr(e0); - HEXA_NS::Edge* he1 = getHexaPtr(e1); - HEXA_NS::Edge* he2 = getHexaPtr(e2); - HEXA_NS::Edge* he3 = getHexaPtr(e3); - - if ( he0 and he1 and he2 and he3 ){ - HEXA_NS::Quad* hq = _hexaDocument->addQuad( he0, he1, he2, he3 ); - if ( hq->isValid() ){ - QuadItem* q = new QuadItem(hq, _entry); - _quadDirItem->appendRow(q); - quadIndex = q->index(); - emit patternDataChanged(); - } else { - delete hq; + QModelIndex quadIndex; + + HEXA_NS::Edge* he0 = getHexaPtr(e0); + HEXA_NS::Edge* he1 = getHexaPtr(e1); + HEXA_NS::Edge* he2 = getHexaPtr(e2); + HEXA_NS::Edge* he3 = getHexaPtr(e3); + + if ( he0 and he1 and he2 and he3 ){ + + HEXA_NS::Quad* hq = _hexaDocument->addQuad( he0, he1, he2, he3 ); + if ( BadElement(hq) ) return quadIndex; + + QuadItem* q = new QuadItem(hq, _entry); + _quadDirItem->appendRow(q); + quadIndex = q->index(); + emit patternDataChanged(); } - } - return quadIndex; + + return quadIndex; } -QModelIndex DocumentModel::addHexaVertices( - const QModelIndex &iv0, const QModelIndex &iv1, - const QModelIndex &iv2, const QModelIndex &iv3, - const QModelIndex &iv4, const QModelIndex &iv5, - const QModelIndex &iv6, const QModelIndex &iv7 ) -{ - QModelIndex iHexa; +QModelIndex DocumentModel::addHexaVertices( + const QModelIndex &iv0, const QModelIndex &iv1, + const QModelIndex &iv2, const QModelIndex &iv3, + const QModelIndex &iv4, const QModelIndex &iv5, + const QModelIndex &iv6, const QModelIndex &iv7 ) +{ + QModelIndex iHexa; + + HEXA_NS::Vertex* hv0 = getHexaPtr(iv0); + HEXA_NS::Vertex* hv1 = getHexaPtr(iv1); + HEXA_NS::Vertex* hv2 = getHexaPtr(iv2); + HEXA_NS::Vertex* hv3 = getHexaPtr(iv3); + HEXA_NS::Vertex* hv4 = getHexaPtr(iv4); + HEXA_NS::Vertex* hv5 = getHexaPtr(iv5); + HEXA_NS::Vertex* hv6 = getHexaPtr(iv6); + HEXA_NS::Vertex* hv7 = getHexaPtr(iv7); - HEXA_NS::Vertex* hv0 = getHexaPtr(iv0); - HEXA_NS::Vertex* hv1 = getHexaPtr(iv1); - HEXA_NS::Vertex* hv2 = getHexaPtr(iv2); - HEXA_NS::Vertex* hv3 = getHexaPtr(iv3); - HEXA_NS::Vertex* hv4 = getHexaPtr(iv4); - HEXA_NS::Vertex* hv5 = getHexaPtr(iv5); - HEXA_NS::Vertex* hv6 = getHexaPtr(iv6); - HEXA_NS::Vertex* hv7 = getHexaPtr(iv7); + HEXA_NS::Hexa* hh = _hexaDocument->addHexaVertices( hv0, hv1, hv2, hv3, + hv4, hv5, hv6, hv7 ); - HEXA_NS::Hexa* hh = _hexaDocument->addHexaVertices( hv0, hv1, hv2, hv3, - hv4, hv5, hv6, hv7 ); + if ( BadElement(hh) ) return iHexa; - if ( hh->isValid() ){ HexaItem* h = new HexaItem(hh, _entry); _hexaDirItem->appendRow(h); iHexa = h->index(); emit patternDataChanged(); - } else { - delete hh; - } - return iHexa; + return iHexa; } QModelIndex DocumentModel::addHexaQuad( const QModelIndex &i_q0, const QModelIndex &i_q1, - const QModelIndex &i_q2,const QModelIndex &i_q3, const QModelIndex &i_q4, const QModelIndex &i_q5 ) + const QModelIndex &i_q2,const QModelIndex &i_q3, const QModelIndex &i_q4, const QModelIndex &i_q5 ) { //CS_TODO : gestion erreur - QModelIndex hexaIndex; + QModelIndex hexaIndex; - HEXA_NS::Quad* hq0 = getHexaPtr(i_q0); - HEXA_NS::Quad* hq1 = getHexaPtr(i_q1); - HEXA_NS::Quad* hq2 = getHexaPtr(i_q2); - HEXA_NS::Quad* hq3 = getHexaPtr(i_q3); - HEXA_NS::Quad* hq4 = getHexaPtr(i_q4); - HEXA_NS::Quad* hq5 = getHexaPtr(i_q5); + HEXA_NS::Quad* hq0 = getHexaPtr(i_q0); + HEXA_NS::Quad* hq1 = getHexaPtr(i_q1); + HEXA_NS::Quad* hq2 = getHexaPtr(i_q2); + HEXA_NS::Quad* hq3 = getHexaPtr(i_q3); + HEXA_NS::Quad* hq4 = getHexaPtr(i_q4); + HEXA_NS::Quad* hq5 = getHexaPtr(i_q5); - HEXA_NS::Hexa* hh = _hexaDocument->addHexa( hq0, hq1, hq2, hq3, hq4, hq5 ); + HEXA_NS::Hexa* hh = _hexaDocument->addHexa( hq0, hq1, hq2, hq3, hq4, hq5 ); + if ( BadElement(hh) ) return hexaIndex; - if ( hh->isValid() ){ HexaItem* h = new HexaItem(hh, _entry); _hexaDirItem->appendRow(h); hexaIndex = h->index(); emit patternDataChanged(); - } else - delete hh; - return hexaIndex; + return hexaIndex; } QModelIndex DocumentModel::addHexaQuads( const QModelIndexList &iquads) -{ - QModelIndex hexaIndex; - - HEXA_NS::Hexa* hh = NULL; - HEXA_NS::Quad* hq0, *hq1, *hq2, *hq3, *hq4, *hq5 = NULL; - - hq0 = getHexaPtr(iquads.value(0)); - hq1 = getHexaPtr(iquads.value(1)); - hq2 = getHexaPtr(iquads.value(2)); - hq3 = getHexaPtr(iquads.value(3)); - hq4 = getHexaPtr(iquads.value(4)); - hq5 = getHexaPtr(iquads.value(5)); - - if ( hq0 && hq1 && hq2 && hq3 && hq4 && hq5 ) - hh = _hexaDocument->addHexa( hq0, hq1, hq2, hq3, hq4, hq5 ); - else if ( hq0 && hq1 && hq2 && hq3 && hq4 ) - hh = _hexaDocument->addHexa5Quads( hq0, hq1, hq2, hq3, hq4 ); - else if ( hq0 && hq1 && hq2 && hq3 ) - hh = _hexaDocument->addHexa4Quads( hq0, hq1, hq2, hq3 ); - else if ( hq0 && hq1 && hq2) - hh = _hexaDocument->addHexa3Quads( hq0, hq1, hq2 ); - else if ( hq0 && hq1 ) - hh = _hexaDocument->addHexa2Quads( hq0, hq1); - - if ( hh && hh->isValid() ){ - updateData(); - unsigned int nbRows = _hexaDirItem->rowCount(); - if (nbRows > 0) - hexaIndex = _hexaDirItem->child(nbRows-1)->index(); - } else - delete hh; - - return hexaIndex; +{ + QModelIndex hexaIndex; + + HEXA_NS::Hexa* hh = NULL; + HEXA_NS::Quad* hq0, *hq1, *hq2, *hq3, *hq4, *hq5 = NULL; + + hq0 = getHexaPtr(iquads.value(0)); + hq1 = getHexaPtr(iquads.value(1)); + hq2 = getHexaPtr(iquads.value(2)); + hq3 = getHexaPtr(iquads.value(3)); + hq4 = getHexaPtr(iquads.value(4)); + hq5 = getHexaPtr(iquads.value(5)); + + if ( hq0 && hq1 && hq2 && hq3 && hq4 && hq5 ) + hh = _hexaDocument->addHexa( hq0, hq1, hq2, hq3, hq4, hq5 ); + else if ( hq0 && hq1 && hq2 && hq3 && hq4 ) + hh = _hexaDocument->addHexa5Quads( hq0, hq1, hq2, hq3, hq4 ); + else if ( hq0 && hq1 && hq2 && hq3 ) + hh = _hexaDocument->addHexa4Quads( hq0, hq1, hq2, hq3 ); + else if ( hq0 && hq1 && hq2) + hh = _hexaDocument->addHexa3Quads( hq0, hq1, hq2 ); + else if ( hq0 && hq1 ) + hh = _hexaDocument->addHexa2Quads( hq0, hq1); + + if ( BadElement(hh) ) return hexaIndex; + + updateData(); + unsigned int nbRows = _hexaDirItem->rowCount(); + if (nbRows > 0) + hexaIndex = _hexaDirItem->child(nbRows-1)->index(); + + return hexaIndex; } // Vector addVector( in double dx, in double dy, in double dz ) // raises (SALOME::SALOME_Exception); QModelIndex DocumentModel::addVector( double dx, double dy, double dz ) { - QModelIndex vectorIndex; + QModelIndex vectorIndex; - HEXA_NS::Vector* hv = _hexaDocument->addVector(dx, dy, dz); + HEXA_NS::Vector* hv = _hexaDocument->addVector(dx, dy, dz); + if ( BadElement(hv) ) return vectorIndex; //Invalid index - if ( hv->isValid() ){ VectorItem* v = new VectorItem(hv); _vectorDirItem->appendRow(v); vectorIndex = v->index(); - } else - delete hv; - - return vectorIndex; + return vectorIndex; } QModelIndex DocumentModel::addVectorVertices( const QModelIndex &iv0, const QModelIndex &iv1 ) { - QModelIndex iVec; + QModelIndex iVec; - HEXA_NS::Vertex* hv0 = getHexaPtr(iv0); - HEXA_NS::Vertex* hv1 = getHexaPtr(iv1); + HEXA_NS::Vertex* hv0 = getHexaPtr(iv0); + HEXA_NS::Vertex* hv1 = getHexaPtr(iv1); - HEXA_NS::Vector* hvec = _hexaDocument->addVectorVertices( hv0, hv1 ); + HEXA_NS::Vector* hvec = _hexaDocument->addVectorVertices( hv0, hv1 ); + if ( BadElement(hvec) ) return iVec; - if ( hvec->isValid() ){ VectorItem* vec = new VectorItem(hvec); _vectorDirItem->appendRow(vec); iVec = vec->index(); - } else { - delete hvec; - } - return iVec; + return iVec; } QModelIndex DocumentModel::addCylinder( const QModelIndex &iv, const QModelIndex &ivec, double r, double h ) { - QModelIndex iCyl; + QModelIndex iCyl; - HEXA_NS::Vertex* hv = getHexaPtr(iv); - HEXA_NS::Vector* hvec = getHexaPtr(ivec); + HEXA_NS::Vertex* hv = getHexaPtr(iv); + HEXA_NS::Vector* hvec = getHexaPtr(ivec); - HEXA_NS::Cylinder* hcyl = _hexaDocument->addCylinder( hv, hvec, r, h ); + HEXA_NS::Cylinder* hcyl = _hexaDocument->addCylinder( hv, hvec, r, h ); + if ( BadElement(hcyl) ) return iCyl; - if ( hcyl->isValid() ){ CylinderItem* cyl = new CylinderItem(hcyl); _cylinderDirItem->appendRow(cyl); iCyl = cyl->index(); - } else { - delete hcyl; - } - return iCyl; + return iCyl; } QModelIndex DocumentModel::addPipe( const QModelIndex &iv, const QModelIndex &ivec, double ri, double re, double h ) { - QModelIndex iPipe; + QModelIndex iPipe; - HEXA_NS::Vertex* hv = getHexaPtr(iv); - HEXA_NS::Vector* hvec = getHexaPtr(ivec); + HEXA_NS::Vertex* hv = getHexaPtr(iv); + HEXA_NS::Vector* hvec = getHexaPtr(ivec); - HEXA_NS::Pipe* hPipe = _hexaDocument->addPipe( hv, hvec, ri, re, h ); + HEXA_NS::Pipe* hPipe = _hexaDocument->addPipe( hv, hvec, ri, re, h ); + if ( BadElement(hPipe) ) return iPipe; - if ( hPipe->isValid() ){ PipeItem* pipe = new PipeItem(hPipe); _pipeDirItem->appendRow(pipe); iPipe = pipe->index(); - } else { - delete hPipe; - } - return iPipe; + return iPipe; } QModelIndex DocumentModel::makeCartesian( const QModelIndex& i_pt, - const QModelIndex& i_vec_x, const QModelIndex& i_vec_y, const QModelIndex& i_vec_z, - long nx, long ny, long nz) + const QModelIndex& i_vec_x, const QModelIndex& i_vec_y, const QModelIndex& i_vec_z, + long nx, long ny, long nz) { - QModelIndex eltsIndex; - //std::cout<<"makeCartesian begin"<(i_pt); - HEXA_NS::Vector* hvec_x = getHexaPtr(i_vec_x); - HEXA_NS::Vector* hvec_y = getHexaPtr(i_vec_y); - HEXA_NS::Vector* hvec_z = getHexaPtr(i_vec_z); + HEXA_NS::Vertex* hpt = getHexaPtr(i_pt); + HEXA_NS::Vector* hvec_x = getHexaPtr(i_vec_x); + HEXA_NS::Vector* hvec_y = getHexaPtr(i_vec_y); + HEXA_NS::Vector* hvec_z = getHexaPtr(i_vec_z); - HEXA_NS::Elements* new_helts = _hexaDocument->makeCartesian( hpt, - hvec_x, hvec_y, hvec_z, - nx, ny, nz ); + HEXA_NS::Elements* new_helts = _hexaDocument->makeCartesian( hpt, + hvec_x, hvec_y, hvec_z, + nx, ny, nz ); + if ( BadElement(new_helts) ) return eltsIndex; - if ( new_helts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* eltsItem = new ElementsItem(new_helts); _elementsDirItem->appendRow(eltsItem); eltsIndex = eltsItem->index(); - } else - delete new_helts; - return eltsIndex; + return eltsIndex; } QModelIndex DocumentModel::makeCartesian( const QModelIndex& ivex, - const QModelIndex& ivec, - int nx, int ny, int nz ) + const QModelIndex& ivec, + int nx, int ny, int nz ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Vertex* hVex = getHexaPtr(ivex); - HEXA_NS::Vector* hVec = getHexaPtr(ivec); + HEXA_NS::Vertex* hVex = getHexaPtr(ivex); + HEXA_NS::Vector* hVec = getHexaPtr(ivec); + + HEXA_NS::Elements* hElts = _hexaDocument->makeCartesian( hVex, + hVec, + nx, ny, nz ); + if ( BadElement(hElts) ) return iElts; - HEXA_NS::Elements* hElts = _hexaDocument->makeCartesian( hVex, - hVec, - nx, ny, nz ); - if ( hElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } // Elements makeCylindrical( in Vertex pt, @@ -1050,1417 +1270,1391 @@ QModelIndex DocumentModel::makeCylindrical( const QModelIndex& i_pt, bool fill ) { - QModelIndex eltsIndex; + QModelIndex eltsIndex; - HEXA_NS::Vertex* hpt = getHexaPtr(i_pt); - HEXA_NS::Vector* hvec_x = getHexaPtr(i_vec_x); - HEXA_NS::Vector* hvec_z = getHexaPtr(i_vec_z); + HEXA_NS::Vertex* hpt = getHexaPtr(i_pt); + HEXA_NS::Vector* hvec_x = getHexaPtr(i_vec_x); + HEXA_NS::Vector* hvec_z = getHexaPtr(i_vec_z); - HEXA_NS::Elements* new_helts = _hexaDocument->makeCylindrical( hpt, hvec_x, hvec_z, dr, da, dl, nr, na, nl, fill ); + HEXA_NS::Elements* new_helts = _hexaDocument->makeCylindrical( hpt, hvec_x, hvec_z, dr, da, dl, nr, na, nl, fill ); + if ( BadElement(new_helts) ) return eltsIndex; - if ( new_helts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* eltsItem = new ElementsItem(new_helts); _elementsDirItem->appendRow(eltsItem); eltsIndex = eltsItem->index(); - } else { - delete new_helts; - } - return eltsIndex; + return eltsIndex; } -QModelIndex DocumentModel::makeCylindricals( - const QModelIndex& icenter, const QModelIndex& ibase, const QModelIndex& iheight, - QList< double> radius, QList angles, QList heights, - bool fill ) //HEXA3 +QModelIndex DocumentModel::makeCylindricals( + const QModelIndex& icenter, const QModelIndex& ibase, const QModelIndex& iheight, + QList< double> radius, QList angles, QList heights, + bool fill ) //HEXA3 { - QModelIndex eltsIndex; + QModelIndex eltsIndex; - HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); - HEXA_NS::Vector* hbase =getHexaPtr(ibase); - HEXA_NS::Vector* hheight = getHexaPtr(iheight); + HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); + HEXA_NS::Vector* hbase =getHexaPtr(ibase); + HEXA_NS::Vector* hheight = getHexaPtr(iheight); -// HEXA_NS::Elements* helts; - std::vector r = radius.toVector().toStdVector(); - std::vector a = angles.toVector().toStdVector(); - std::vector h = heights.toVector().toStdVector(); + // HEXA_NS::Elements* helts; + std::vector r = radius.toVector().toStdVector(); + std::vector a = angles.toVector().toStdVector(); + std::vector h = heights.toVector().toStdVector(); - HEXA_NS::Elements* helts = _hexaDocument->makeCylindricals( - hcenter, hbase, hheight, - r, a, h, - fill ); + HEXA_NS::Elements* helts = _hexaDocument->makeCylindricals( + hcenter, hbase, hheight, + r, a, h, + fill ); + if ( BadElement(helts) ) return eltsIndex; - if ( helts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* eltsItem = new ElementsItem(helts); _elementsDirItem->appendRow(eltsItem); eltsIndex = eltsItem->index(); - } else { - delete helts; - } - return eltsIndex; + + return eltsIndex; } QModelIndex DocumentModel::makeSpherical( const QModelIndex& iv, const QModelIndex& ivec, int nb, double k) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Vertex* hv = getHexaPtr(iv); - HEXA_NS::Vector* hvec = getHexaPtr(ivec); + HEXA_NS::Vertex* hv = getHexaPtr(iv); + HEXA_NS::Vector* hvec = getHexaPtr(ivec); - HEXA_NS::Elements* hElts = _hexaDocument->makeSpherical( hv, hvec, nb, k ); + HEXA_NS::Elements* hElts = _hexaDocument->makeSpherical( hv, hvec, nb, k ); + if ( BadElement(hElts) ) return iElts; - if ( hElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } QModelIndex DocumentModel::makeSpherical( const QModelIndex& icenter, double radius, int nb, double k ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); + HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); - HEXA_NS::Elements* helts = _hexaDocument->makeSpherical( hcenter, radius, nb, k ); + HEXA_NS::Elements* helts = _hexaDocument->makeSpherical( hcenter, radius, nb, k ); + if ( BadElement(helts) ) return iElts; - if ( helts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* eltsItem = new ElementsItem(helts); _elementsDirItem->appendRow(eltsItem); iElts = eltsItem->index(); - } else { - delete helts; - } - return iElts; + return iElts; } QModelIndex DocumentModel::makeCylinder( const QModelIndex& icyl, const QModelIndex& ivec, - int nr, int na, int nl ) + int nr, int na, int nl ) { - QModelIndex iElts; + QModelIndex iElts; + + HEXA_NS::Cylinder* hcyl = getHexaPtr(icyl); + HEXA_NS::Vector* hvec = getHexaPtr(ivec); - HEXA_NS::Cylinder* hcyl = getHexaPtr(icyl); - HEXA_NS::Vector* hvec = getHexaPtr(ivec); + HEXA_NS::Elements* hElts = _hexaDocument->makeCylinder( hcyl, hvec, nr, na, nl ); + if ( BadElement(hElts) ) return iElts; - HEXA_NS::Elements* hElts = _hexaDocument->makeCylinder( hcyl, hvec, nr, na, nl ); - if ( hElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } -QModelIndex DocumentModel::makePipe( const QModelIndex& ipipe, const QModelIndex& ivecx, - int nr, int na, int nl ) -{ - QModelIndex iElts; +QModelIndex DocumentModel::makePipe( const QModelIndex& ipipe, const QModelIndex& ivecx, + int nr, int na, int nl ) +{ + QModelIndex iElts; - HEXA_NS::Pipe* hPipe = getHexaPtr(ipipe); - HEXA_NS::Vector* hVecx = getHexaPtr(ivecx); + HEXA_NS::Pipe* hPipe = getHexaPtr(ipipe); + HEXA_NS::Vector* hVecx = getHexaPtr(ivecx); - HEXA_NS::Elements* hElts = _hexaDocument->makePipe( hPipe, hVecx, nr, na, nl ); + HEXA_NS::Elements* hElts = _hexaDocument->makePipe( hPipe, hVecx, nr, na, nl ); + if ( BadElement(hElts) ) return iElts; - if ( hElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } QModelIndex DocumentModel::makeCylinders(const QModelIndex& icyl1, const QModelIndex& icyl2) { //CS_TODO - QModelIndex iCrossElts; - - HEXA_NS::Cylinder* hCyl1 = getHexaPtr(icyl1); - HEXA_NS::Cylinder* hCyl2 = getHexaPtr(icyl2); - - HEXA_NS::CrossElements* hCrossElts = _hexaDocument->makeCylinders( hCyl1, hCyl2 ); - - if ( hCrossElts->isValid() ){ + QModelIndex iCrossElts; + + HEXA_NS::Cylinder* hCyl1 = getHexaPtr(icyl1); + HEXA_NS::Cylinder* hCyl2 = getHexaPtr(icyl2); + + HEXA_NS::CrossElements* hCrossElts = _hexaDocument->makeCylinders( hCyl1, hCyl2 ); + if ( BadElement(hCrossElts) ) return iCrossElts; + updateData(); //CS_TODO more or less? ElementsItem* crossElts = new ElementsItem(hCrossElts); _crossElementsDirItem->appendRow(crossElts); - iCrossElts = crossElts->index(); - } else { - delete hCrossElts; - } - - return iCrossElts; + iCrossElts = crossElts->index(); + + return iCrossElts; } // QModelIndex DocumentModel::makePipes( const QModelIndex& ipipe1, const QModelIndex& ipipe2 ) -{ - QModelIndex iCrossElts; - - HEXA_NS::Pipe* hPipe1 = getHexaPtr(ipipe1); - HEXA_NS::Pipe* hPipe2 = getHexaPtr(ipipe2); - - HEXA_NS::CrossElements* hCrossElts = _hexaDocument->makePipes( hPipe1, hPipe2 ); - - if ( hCrossElts->isValid() ){ +{ + QModelIndex iCrossElts; + + HEXA_NS::Pipe* hPipe1 = getHexaPtr(ipipe1); + HEXA_NS::Pipe* hPipe2 = getHexaPtr(ipipe2); + + HEXA_NS::CrossElements* hCrossElts = _hexaDocument->makePipes( hPipe1, hPipe2 ); + if ( BadElement(hCrossElts) ) return iCrossElts; + updateData(); //CS_TODO more or less? ElementsItem* crossElts = new ElementsItem(hCrossElts); _crossElementsDirItem->appendRow(crossElts); iCrossElts = crossElts->index(); - QString tmp = "/tmp/makePipes.vtk"; - _hexaDocument->saveVtk( tmp.toLocal8Bit().constData() ); - } else { - delete hCrossElts; - } - - return iCrossElts; -} - -QModelIndex DocumentModel::makeRind( const QModelIndex& icenter, - const QModelIndex& ivecx, const QModelIndex& ivecz, - double radext, double radint, double radhole, - const QModelIndex& iplorig, - int nrad, int nang, int nhaut ) -{ - QModelIndex iElts; - - HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); - HEXA_NS::Vector* hvecx = getHexaPtr(ivecx); - HEXA_NS::Vector* hvecz = getHexaPtr(ivecz); - HEXA_NS::Vertex* hplorig = getHexaPtr(iplorig); - - HEXA_NS::Elements* hElts = _hexaDocument->makeRind( hcenter, - hvecx, hvecz, - radext, radint, radhole, - hplorig, - nrad, nang, nhaut ); - - if ( hElts->isValid() ){ + + return iCrossElts; +} + +QModelIndex DocumentModel::makeRind( const QModelIndex& icenter, + const QModelIndex& ivecx, const QModelIndex& ivecz, + double radext, double radint, double radhole, + const QModelIndex& iplorig, + int nrad, int nang, int nhaut ) +{ + QModelIndex iElts; + + HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); + HEXA_NS::Vector* hvecx = getHexaPtr(ivecx); + HEXA_NS::Vector* hvecz = getHexaPtr(ivecz); + HEXA_NS::Vertex* hplorig = getHexaPtr(iplorig); + + HEXA_NS::Elements* hElts = _hexaDocument->makeRind( hcenter, + hvecx, hvecz, + radext, radint, radhole, + hplorig, + nrad, nang, nhaut ); + if ( BadElement(hElts) ) return iElts; + updateData(); //CS_TODO more or less? ElementsItem* eltsItem = new ElementsItem(hElts); _elementsDirItem->appendRow(eltsItem); iElts = eltsItem->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } -QModelIndex DocumentModel::makePartRind( const QModelIndex& icenter, - const QModelIndex& ivecx, const QModelIndex& ivecz, - double radext, double radint, double radhole, - const QModelIndex& iplorig, double angle, - int nrad, int nang, int nhaut ) +QModelIndex DocumentModel::makePartRind( const QModelIndex& icenter, + const QModelIndex& ivecx, const QModelIndex& ivecz, + double radext, double radint, double radhole, + const QModelIndex& iplorig, double angle, + int nrad, int nang, int nhaut ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); - HEXA_NS::Vector* hvecx = getHexaPtr(ivecx); - HEXA_NS::Vector* hvecz = getHexaPtr(ivecz); - HEXA_NS::Vertex* hplorig = getHexaPtr(iplorig); + HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); + HEXA_NS::Vector* hvecx = getHexaPtr(ivecx); + HEXA_NS::Vector* hvecz = getHexaPtr(ivecz); + HEXA_NS::Vertex* hplorig = getHexaPtr(iplorig); - HEXA_NS::Elements* hElts = _hexaDocument->makePartRind( hcenter, - hvecx, hvecz, - radext, radint, radhole, - hplorig, angle, - nrad, nang, nhaut ); + HEXA_NS::Elements* hElts = _hexaDocument->makePartRind( hcenter, + hvecx, hvecz, + radext, radint, radhole, + hplorig, angle, + nrad, nang, nhaut ); + if ( BadElement(hElts) ) return iElts; - if ( hElts->isValid() ){ updateData(); ElementsItem* eltsItem = new ElementsItem(hElts); _elementsDirItem->appendRow(eltsItem); iElts = eltsItem->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } -QModelIndex DocumentModel::makeSphere( const QModelIndex& icenter, - const QModelIndex& ivecx, const QModelIndex& ivecz, - double radius, double radhole, - const QModelIndex& iplorig, - int nrad, int nang, int nhaut ) +QModelIndex DocumentModel::makeSphere( const QModelIndex& icenter, + const QModelIndex& ivecx, const QModelIndex& ivecz, + double radius, double radhole, + const QModelIndex& iplorig, + int nrad, int nang, int nhaut ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); - HEXA_NS::Vector* hvecx = getHexaPtr(ivecx); - HEXA_NS::Vector* hvecz = getHexaPtr(ivecz); - HEXA_NS::Vertex* hplorig = getHexaPtr(iplorig); + HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); + HEXA_NS::Vector* hvecx = getHexaPtr(ivecx); + HEXA_NS::Vector* hvecz = getHexaPtr(ivecz); + HEXA_NS::Vertex* hplorig = getHexaPtr(iplorig); - HEXA_NS::Elements* hElts = _hexaDocument->makeSphere( hcenter, - hvecx, hvecz, - radius, radhole, - hplorig, - nrad, nang, nhaut); + HEXA_NS::Elements* hElts = _hexaDocument->makeSphere( hcenter, + hvecx, hvecz, + radius, radhole, + hplorig, + nrad, nang, nhaut); + if ( BadElement(hElts) ) return iElts; - if ( hElts->isValid() ){ updateData(); ElementsItem* eltsItem = new ElementsItem(hElts); _elementsDirItem->appendRow(eltsItem); iElts = eltsItem->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } -QModelIndex DocumentModel::makePartSphere( const QModelIndex& icenter, - const QModelIndex& ivecx, const QModelIndex& ivecz, - double radius, double radhole, - const QModelIndex& iplorig, double angle, - int nrad, int nang, int nhaut ) +QModelIndex DocumentModel::makePartSphere( const QModelIndex& icenter, + const QModelIndex& ivecx, const QModelIndex& ivecz, + double radius, double radhole, + const QModelIndex& iplorig, double angle, + int nrad, int nang, int nhaut ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); - HEXA_NS::Vector* hvecx = getHexaPtr(ivecx); - HEXA_NS::Vector* hvecz = getHexaPtr(ivecz); - HEXA_NS::Vertex* hplorig = getHexaPtr(iplorig); + HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); + HEXA_NS::Vector* hvecx = getHexaPtr(ivecx); + HEXA_NS::Vector* hvecz = getHexaPtr(ivecz); + HEXA_NS::Vertex* hplorig = getHexaPtr(iplorig); - HEXA_NS::Elements* hElts = _hexaDocument->makePartSphere( hcenter, - hvecx, hvecz, - radius, radhole, - hplorig, angle, - nrad, nang, nhaut); + HEXA_NS::Elements* hElts = _hexaDocument->makePartSphere( hcenter, + hvecx, hvecz, + radius, radhole, + hplorig, angle, + nrad, nang, nhaut); + if ( BadElement(hElts) ) return iElts; - if ( hElts->isValid() ){ updateData(); ElementsItem* eltsItem = new ElementsItem(hElts); _elementsDirItem->appendRow(eltsItem); iElts = eltsItem->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } // ************ EDIT HEXABLOCK MODEL ************ bool DocumentModel::updateVertex( const QModelIndex& ivertex, double x, double y, double z ) { - bool ret = false; + bool ret = false; - //HEXA_NS::Vertex* hVertex = ivertex.data(HEXA_DATA_ROLE).value(); //CS_TODO? pareil pour toutes les autres méthodes du modèle? - HEXA_NS::Vertex* hVertex = getHexaPtr(ivertex); + //HEXA_NS::Vertex* hVertex = ivertex.data(HEXA_DATA_ROLE).value(); //CS_TODO? pareil pour toutes les autres méthodes du modèle? + HEXA_NS::Vertex* hVertex = getHexaPtr(ivertex); - if ( hVertex ){ -// hVertex->setName( name.toStdString() ); - hVertex->setX ( x ); - hVertex->setY ( y ); - hVertex->setZ ( z ); - emit patternDataChanged(); - ret = true; - } + if ( hVertex ){ + // hVertex->setName( name.toStdString() ); + hVertex->setX ( x ); + hVertex->setY ( y ); + hVertex->setZ ( z ); + emit patternDataChanged(); + ret = true; + } - return ret; + return ret; } bool DocumentModel::removeHexa( const QModelIndex& ihexa ) { - bool ret = false; - HEXA_NS::Hexa* hHexa = getHexaPtr(ihexa); + HEXA_NS::Hexa* hHexa = getHexaPtr(ihexa); + int r = _hexaDocument->removeHexa( hHexa ); + if ( r == HOK ){ + updateData(); + return true; + } - int r = _hexaDocument->removeHexa( hHexa ); - if ( r == HOK ){ - updateData(); - ret = true; - } else if ( r == HERR ){ - ret = false; - } - - return ret; + return false; } bool DocumentModel::removeConnectedHexa( const QModelIndex& ihexa ) { - bool ret = false; - HEXA_NS::Hexa* hHexa = getHexaPtr(ihexa); - - int r = _hexaDocument->removeConnectedHexa( hHexa ); - - if ( r == HOK ){ - updateData(); - ret = true; - } else if ( r == HERR ){ - ret = false; - } - - return ret; + HEXA_NS::Hexa* hHexa = getHexaPtr(ihexa); + + int r = _hexaDocument->removeConnectedHexa( hHexa ); + if ( r == HOK ){ + updateData(); + return true; + } + + return false; } QModelIndex DocumentModel::prismQuad( const QModelIndex& iquad, const QModelIndex& ivec, int nb) -{ - QModelIndex iElts; +{ + QModelIndex iElts; - HEXA_NS::Quad* hQuad = getHexaPtr(iquad); - HEXA_NS::Vector* hVect = getHexaPtr(ivec); + HEXA_NS::Quad* hQuad = getHexaPtr(iquad); + HEXA_NS::Vector* hVect = getHexaPtr(ivec); - HEXA_NS::Elements* hElts = _hexaDocument->prismQuad( hQuad, hVect, nb ); + HEXA_NS::Elements* hElts = _hexaDocument->prismQuad( hQuad, hVect, nb ); + if ( BadElement(hElts) ) return iElts; - if ( hElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } QModelIndex DocumentModel::prismQuads( const QModelIndexList& iquads, const QModelIndex& ivec, int nb) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Quads hQuads; - HEXA_NS::Quad* hQuad = NULL; - foreach( const QModelIndex& iquad, iquads ){ - hQuad = getHexaPtr(iquad); - hQuads.push_back( hQuad ); - } - HEXA_NS::Vector* hVect = getHexaPtr(ivec); + HEXA_NS::Quads hQuads; + HEXA_NS::Quad* hQuad = NULL; + foreach( const QModelIndex& iquad, iquads ){ + hQuad = getHexaPtr(iquad); + hQuads.push_back( hQuad ); + } + HEXA_NS::Vector* hVect = getHexaPtr(ivec); + + HEXA_NS::Elements* hElts = _hexaDocument->prismQuads( hQuads, hVect, nb ); + if ( BadElement(hElts) ) return iElts; - HEXA_NS::Elements* hElts = _hexaDocument->prismQuads( hQuads, hVect, nb ); - if ( hElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + + return iElts; } QModelIndex DocumentModel::prismQuads( const QModelIndexList& iquads, const QModelIndex& ivec, std::vector layersSize, int nb) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Quads hQuads; - HEXA_NS::Quad* hQuad = NULL; - foreach( const QModelIndex& iquad, iquads ){ - hQuad = getHexaPtr(iquad); - hQuads.push_back( hQuad ); - } - HEXA_NS::Vector* hVect = getHexaPtr(ivec); + HEXA_NS::Quads hQuads; + HEXA_NS::Quad* hQuad = NULL; + foreach( const QModelIndex& iquad, iquads ){ + hQuad = getHexaPtr(iquad); + hQuads.push_back( hQuad ); + } + HEXA_NS::Vector* hVect = getHexaPtr(ivec); + + HEXA_NS::Elements* hElts = _hexaDocument->prismQuadsVec( hQuads, hVect, layersSize, nb ); + if ( BadElement(hElts) ) return iElts; - HEXA_NS::Elements* hElts = _hexaDocument->prismQuadsVec( hQuads, hVect, layersSize, nb ); - if ( hElts->isValid() ){ - updateData(); //CS_TODO more or less? - ElementsItem* elts = new ElementsItem(hElts); - _elementsDirItem->appendRow(elts); - iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + updateData(); //CS_TODO more or less? + ElementsItem* elts = new ElementsItem(hElts); + _elementsDirItem->appendRow(elts); + iElts = elts->index(); + + return iElts; } // QModelIndex DocumentModel::joinQuad( - const QModelIndex& iquadstart, const QModelIndex& iquaddest, - const QModelIndex& iv0, const QModelIndex& iv1, - const QModelIndex& iv2, const QModelIndex& iv3, - int nb ) + const QModelIndex& iquadstart, const QModelIndex& iquaddest, + const QModelIndex& iv0, const QModelIndex& iv1, + const QModelIndex& iv2, const QModelIndex& iv3, + int nb ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Quad* hQuadStart = getHexaPtr(iquadstart); - HEXA_NS::Quad* hQuadDest = getHexaPtr(iquaddest); + HEXA_NS::Quad* hQuadStart = getHexaPtr(iquadstart); + HEXA_NS::Quad* hQuadDest = getHexaPtr(iquaddest); - HEXA_NS::Vertex* hVertex0 = getHexaPtr(iv0); - HEXA_NS::Vertex* hVertex1 = getHexaPtr(iv1); - HEXA_NS::Vertex* hVertex2 = getHexaPtr(iv2); - HEXA_NS::Vertex* hVertex3 = getHexaPtr(iv3); + HEXA_NS::Vertex* hVertex0 = getHexaPtr(iv0); + HEXA_NS::Vertex* hVertex1 = getHexaPtr(iv1); + HEXA_NS::Vertex* hVertex2 = getHexaPtr(iv2); + HEXA_NS::Vertex* hVertex3 = getHexaPtr(iv3); - HEXA_NS::Elements* hElts = _hexaDocument->joinQuad( hQuadStart, hQuadDest, - hVertex0, hVertex1, hVertex2, hVertex3, nb ); + HEXA_NS::Elements* hElts = _hexaDocument->joinQuad( hQuadStart, hQuadDest, + hVertex0, hVertex1, hVertex2, hVertex3, nb ); + if ( BadElement(hElts) ) return iElts; - if ( hElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } -QModelIndex DocumentModel::joinQuads( - const QModelIndexList& iquadsstart, const QModelIndex& iquaddest, - const QModelIndex& iv0, const QModelIndex& iv1, - const QModelIndex& iv2, const QModelIndex& iv3, - int nb ) +QModelIndex DocumentModel::joinQuads( + const QModelIndexList& iquadsstart, const QModelIndex& iquaddest, + const QModelIndex& iv0, const QModelIndex& iv1, + const QModelIndex& iv2, const QModelIndex& iv3, + int nb ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Quad* hQuadStart; - HEXA_NS::Quads hQuadsStart; + HEXA_NS::Quad* hQuadStart; + HEXA_NS::Quads hQuadsStart; - foreach( const QModelIndex& iquad, iquadsstart ){ - hQuadStart = data( iquad, HEXA_DATA_ROLE ).value(); - hQuadsStart.push_back( hQuadStart ); - } - HEXA_NS::Quad* hQuadDest = data( iquaddest, HEXA_DATA_ROLE ).value(); + foreach( const QModelIndex& iquad, iquadsstart ){ + hQuadStart = data( iquad, HEXA_DATA_ROLE ).value(); + hQuadsStart.push_back( hQuadStart ); + } + HEXA_NS::Quad* hQuadDest = data( iquaddest, HEXA_DATA_ROLE ).value(); - HEXA_NS::Vertex* hVertex0 = getHexaPtr(iv0); - HEXA_NS::Vertex* hVertex1 = getHexaPtr(iv1); - HEXA_NS::Vertex* hVertex2 = getHexaPtr(iv2); - HEXA_NS::Vertex* hVertex3 = getHexaPtr(iv3); + HEXA_NS::Vertex* hVertex0 = getHexaPtr(iv0); + HEXA_NS::Vertex* hVertex1 = getHexaPtr(iv1); + HEXA_NS::Vertex* hVertex2 = getHexaPtr(iv2); + HEXA_NS::Vertex* hVertex3 = getHexaPtr(iv3); - HEXA_NS::Elements* hElts = _hexaDocument->joinQuads( - hQuadsStart, hQuadDest, - hVertex0, hVertex1, hVertex2, hVertex3, - nb ); + HEXA_NS::Elements* hElts = _hexaDocument->joinQuads( + hQuadsStart, hQuadDest, + hVertex0, hVertex1, hVertex2, hVertex3, + nb ); + if ( BadElement(hElts) ) return iElts; - if ( hElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } bool DocumentModel::mergeVertices( const QModelIndex &iv0, const QModelIndex &iv1 ) //CS_TODO : impact sur le model? { - bool ret = false; + HEXA_NS::Vertex* hv0 = getHexaPtr(iv0); + HEXA_NS::Vertex* hv1 = getHexaPtr(iv1); - HEXA_NS::Vertex* hv0 = getHexaPtr(iv0); - HEXA_NS::Vertex* hv1 = getHexaPtr(iv1); - - int r = _hexaDocument->mergeVertices( hv0, hv1 ); - if ( r == HOK ){ - updateData(); //CS_TODO more or less? - ret = true; - } else if ( r == HERR ){ - ret = false; - } + int r = _hexaDocument->mergeVertices( hv0, hv1 ); + if ( r == HOK ){ + updateData(); //CS_TODO more or less? + return true; + } - return ret; + return false; } bool DocumentModel::mergeEdges( const QModelIndex &ie0, const QModelIndex &ie1, - const QModelIndex &iv0, const QModelIndex &iv1 ) + const QModelIndex &iv0, const QModelIndex &iv1 ) //CS_TODO : impact sur le model? { - bool ret = false; - - HEXA_NS::Edge* he0 = getHexaPtr(ie0); - HEXA_NS::Edge* he1 = getHexaPtr(ie1); + HEXA_NS::Edge* he0 = getHexaPtr(ie0); + HEXA_NS::Edge* he1 = getHexaPtr(ie1); - HEXA_NS::Vertex* hv0 = getHexaPtr(iv0); - HEXA_NS::Vertex* hv1 = getHexaPtr(iv1); + HEXA_NS::Vertex* hv0 = getHexaPtr(iv0); + HEXA_NS::Vertex* hv1 = getHexaPtr(iv1); - int r = _hexaDocument->mergeEdges( he0, he1, hv0, hv1 ); - if ( r == HOK ){ - updateData(); - ret = true; - } else if ( r == HERR ){ - ret = false; - } + //Merge + int r = _hexaDocument->mergeEdges( he0, he1, hv0, hv1 ); + if ( r == HOK ){ + updateData(); + return true; + } - return ret; + return false; } bool DocumentModel::mergeQuads( const QModelIndex& iquad0, const QModelIndex& iquad1, - const QModelIndex& iv0, const QModelIndex& iv1, - const QModelIndex& iv2, const QModelIndex& iv3 ) + const QModelIndex& iv0, const QModelIndex& iv1, + const QModelIndex& iv2, const QModelIndex& iv3 ) { - bool ret = false; + HEXA_NS::Quad* hquad0 = data(iquad0, HEXA_DATA_ROLE).value(); + HEXA_NS::Quad* hquad1 = data(iquad1, HEXA_DATA_ROLE).value(); - HEXA_NS::Quad* hquad0 = data(iquad0, HEXA_DATA_ROLE).value(); - HEXA_NS::Quad* hquad1 = data(iquad1, HEXA_DATA_ROLE).value(); + HEXA_NS::Vertex* hv0 = getHexaPtr(iv0); + HEXA_NS::Vertex* hv1 = getHexaPtr(iv1); + HEXA_NS::Vertex* hv2 = getHexaPtr(iv2); + HEXA_NS::Vertex* hv3 = getHexaPtr(iv3); - HEXA_NS::Vertex* hv0 = getHexaPtr(iv0); - HEXA_NS::Vertex* hv1 = getHexaPtr(iv1); - HEXA_NS::Vertex* hv2 = getHexaPtr(iv2); - HEXA_NS::Vertex* hv3 = getHexaPtr(iv3); - - int r = _hexaDocument->mergeQuads( hquad0, hquad1, hv0, hv1, hv2, hv3 ); - if ( r == HOK ){ - updateData(); - ret = true; - } else if ( r == HERR ){ - ret = false; - } + int r = _hexaDocument->mergeQuads( hquad0, hquad1, hv0, hv1, hv2, hv3 ); + if ( r == HOK ){ + updateData(); + return true; + } - return ret; + return false; } // QModelIndex DocumentModel::disconnectVertex( const QModelIndex& ihexa, const QModelIndex& ivertex ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Hexa* hHexa = getHexaPtr(ihexa); - HEXA_NS::Vertex* hVertex = getHexaPtr(ivertex); + HEXA_NS::Hexa* hHexa = getHexaPtr(ihexa); + HEXA_NS::Vertex* hVertex = getHexaPtr(ivertex); - HEXA_NS::Elements* hElts = _hexaDocument->disconnectVertex( hHexa, hVertex ); + HEXA_NS::Elements* hElts = _hexaDocument->disconnectVertex( hHexa, hVertex ); + if ( BadElement(hElts) ) return iElts; - if ( hElts && hElts->isValid() ){ updateData(); //CS_TO_CHECK ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } QModelIndex DocumentModel::disconnectEdge( const QModelIndex& ihexa, const QModelIndex& iedge ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Hexa* hHexa = getHexaPtr(ihexa); - HEXA_NS::Edge* hEdge = getHexaPtr(iedge); + HEXA_NS::Hexa* hHexa = getHexaPtr(ihexa); + HEXA_NS::Edge* hEdge = getHexaPtr(iedge); - HEXA_NS::Elements* hElts = _hexaDocument->disconnectEdge( hHexa, hEdge ); + HEXA_NS::Elements* hElts = _hexaDocument->disconnectEdge( hHexa, hEdge ); + if ( BadElement(hElts) ) return iElts; - if ( hElts->isValid() ){ updateData(); //CS_TO_CHECK ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } QModelIndex DocumentModel::disconnectEdges( const QModelIndexList& ihexas, const QModelIndexList& iedges ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Hexas hHexas; - HEXA_NS::Edges hEdges; + HEXA_NS::Hexas hHexas; + HEXA_NS::Edges hEdges; - //Construction de la liste des edges - HEXA_NS::Edge* hedge = NULL; - foreach( const QModelIndex& iedge, iedges ){ - hedge = getHexaPtr(iedge); - hEdges.push_back( hedge ); - } + //edges list + HEXA_NS::Edge* hedge = NULL; + foreach( const QModelIndex& iedge, iedges ){ + hedge = getHexaPtr(iedge); + hEdges.push_back( hedge ); + } - //Construction de la liste des hexas - HEXA_NS::Hexa* hhexa = NULL; - foreach( const QModelIndex& ihexa, ihexas ){ - hhexa = getHexaPtr(ihexa); - hHexas.push_back( hhexa ); - } + //hexas list + HEXA_NS::Hexa* hhexa = NULL; + foreach( const QModelIndex& ihexa, ihexas ){ + hhexa = getHexaPtr(ihexa); + hHexas.push_back( hhexa ); + } - HEXA_NS::Elements* hElts = _hexaDocument->disconnectEdges( hHexas, hEdges ); + HEXA_NS::Elements* hElts = _hexaDocument->disconnectEdges( hHexas, hEdges ); + if ( BadElement(hElts) ) return iElts; - if ( hElts->isValid() ){ updateData(); //CS_TO_CHECK ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } QModelIndex DocumentModel::disconnectQuad( const QModelIndex& ihexa, const QModelIndex& iquad ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Hexa* hHexa = getHexaPtr(ihexa); - HEXA_NS::Quad* hQuad = getHexaPtr(iquad); + HEXA_NS::Hexa* hHexa = getHexaPtr(ihexa); + HEXA_NS::Quad* hQuad = getHexaPtr(iquad); - HEXA_NS::Elements* hElts = _hexaDocument->disconnectQuad( hHexa, hQuad ); + HEXA_NS::Elements* hElts = _hexaDocument->disconnectQuad( hHexa, hQuad ); + if ( BadElement(hElts) ) return iElts; - if ( hElts->isValid() ){ updateData(); //CS_TO_CHECK ElementsItem* elts = new ElementsItem(hElts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete hElts; - } - return iElts; + return iElts; } QModelIndex DocumentModel::cutEdge( const QModelIndex &i_e0, int nbcuts ) //CS_TODO : impact sur le model? { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Edge* he0 = getHexaPtr(i_e0); - HEXA_NS::Elements* helts = _hexaDocument->cut( he0, nbcuts ); + HEXA_NS::Edge* he0 = getHexaPtr(i_e0); + HEXA_NS::Elements* helts = _hexaDocument->cut( he0, nbcuts ); + + if ( BadElement(helts) ) return iElts; - if ( helts->isValid() ){ updateData(); //CS_TODO more? ElementsItem* elts = new ElementsItem(helts); _elementsDirItem->appendRow(elts); iElts = elts->index(); - } else { - delete helts; - } - return iElts; + return iElts; } - - // Elements makeTranslation( in Elements l, in Vector vec ) // raises (SALOME::SALOME_Exception); QModelIndex DocumentModel::makeTranslation( const QModelIndex& ielts, const QModelIndex& ivec ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vector* hVec = getHexaPtr(ivec); + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vector* hVec = getHexaPtr(ivec); - HEXA_NS::Elements* hNewElts = _hexaDocument->makeTranslation( hElts, hVec ); + HEXA_NS::Elements* hNewElts = _hexaDocument->makeTranslation( hElts, hVec ); + if ( BadElement(hNewElts) ) return iElts; - if ( hNewElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* eltsItem = new ElementsItem(hNewElts); _elementsDirItem->appendRow(eltsItem); iElts = eltsItem->index(); - } else { - delete hNewElts; - } - return iElts; + return iElts; } QModelIndex DocumentModel::makeScale( const QModelIndex& ielts, const QModelIndex& ivex, double k ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vertex* hVex = getHexaPtr(ivex); + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vertex* hVex = getHexaPtr(ivex); - HEXA_NS::Elements* hNewElts = _hexaDocument->makeScale( hElts, hVex, k ); + HEXA_NS::Elements* hNewElts = _hexaDocument->makeScale( hElts, hVex, k ); + if ( BadElement(hNewElts) ) return iElts; - if ( hNewElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* eltsItem = new ElementsItem(hNewElts); _elementsDirItem->appendRow(eltsItem); iElts = eltsItem->index(); - } else { - delete hNewElts; - } - return iElts; + return iElts; } -QModelIndex DocumentModel::makeRotation( const QModelIndex& ielts, - const QModelIndex& iv, - const QModelIndex& ivec, double angle ) +QModelIndex DocumentModel::makeRotation( const QModelIndex& ielts, + const QModelIndex& iv, + const QModelIndex& ivec, double angle ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vertex* hVex = getHexaPtr(iv); - HEXA_NS::Vector* hVec = getHexaPtr(ivec); + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vertex* hVex = getHexaPtr(iv); + HEXA_NS::Vector* hVec = getHexaPtr(ivec); - HEXA_NS::Elements* hNewElts = _hexaDocument->makeRotation( hElts, hVex, hVec, angle ); + HEXA_NS::Elements* hNewElts = _hexaDocument->makeRotation( hElts, hVex, hVec, angle ); + if ( BadElement(hNewElts) ) return iElts; - if ( hNewElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* eltsItem = new ElementsItem(hNewElts); _elementsDirItem->appendRow(eltsItem); iElts = eltsItem->index(); - } else { - delete hNewElts; - } - return iElts; + return iElts; } QModelIndex DocumentModel::makeSymmetryPoint( const QModelIndex& ielts, const QModelIndex& iv ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vertex* hVex = getHexaPtr(iv); + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vertex* hVex = getHexaPtr(iv); - HEXA_NS::Elements* hNewElts = _hexaDocument->makeSymmetryPoint (hElts, hVex); + HEXA_NS::Elements* hNewElts = _hexaDocument->makeSymmetryPoint (hElts, hVex); + if ( BadElement(hNewElts) ) return iElts; - if ( hNewElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* eltsItem = new ElementsItem(hNewElts); _elementsDirItem->appendRow(eltsItem); iElts = eltsItem->index(); - } else { - delete hNewElts; - } - return iElts; + return iElts; } -QModelIndex DocumentModel::makeSymmetryLine( const QModelIndex& ielts, - const QModelIndex& iv, - const QModelIndex& ivec ) +QModelIndex DocumentModel::makeSymmetryLine( const QModelIndex& ielts, + const QModelIndex& iv, + const QModelIndex& ivec ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vertex* hVex = getHexaPtr(iv); - HEXA_NS::Vector* hVec = getHexaPtr(ivec); + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vertex* hVex = getHexaPtr(iv); + HEXA_NS::Vector* hVec = getHexaPtr(ivec); - HEXA_NS::Elements* hNewElts = _hexaDocument->makeSymmetryLine( hElts, hVex, hVec ); + HEXA_NS::Elements* hNewElts = _hexaDocument->makeSymmetryLine( hElts, hVex, hVec ); + if ( BadElement(hNewElts) ) return iElts; - if ( hNewElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* eltsItem = new ElementsItem(hNewElts); _elementsDirItem->appendRow(eltsItem); iElts = eltsItem->index(); - } else { - delete hNewElts; - } - return iElts; + return iElts; } QModelIndex DocumentModel::makeSymmetryPlane( const QModelIndex& ielts, const QModelIndex& iv, const QModelIndex& ivec ) { - QModelIndex iElts; + QModelIndex iElts; - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vertex* hVex = getHexaPtr(iv); - HEXA_NS::Vector* hVec = getHexaPtr(ivec); + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vertex* hVex = getHexaPtr(iv); + HEXA_NS::Vector* hVec = getHexaPtr(ivec); - HEXA_NS::Elements* hNewElts = _hexaDocument->makeSymmetryPlane( hElts, hVex, hVec ); + HEXA_NS::Elements* hNewElts = _hexaDocument->makeSymmetryPlane( hElts, hVex, hVec ); + if ( BadElement(hNewElts) ) return iElts; - if ( hNewElts->isValid() ){ updateData(); //CS_TODO more or less? ElementsItem* eltsItem = new ElementsItem(hNewElts); _elementsDirItem->appendRow(eltsItem); iElts = eltsItem->index(); - } else { - delete hNewElts; - } - return iElts; + return iElts; } bool DocumentModel::performTranslation( const QModelIndex& ielts, const QModelIndex& ivec ) { - bool ret = false; + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vector* hVec = getHexaPtr(ivec); - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vector* hVec = getHexaPtr(ivec); - - int r = _hexaDocument->performTranslation (hElts, hVec); - if ( r == HOK ){ - updateData(); - ret = true; - } else if ( r == HERR ){ - ret = false; - } + int r = _hexaDocument->performTranslation (hElts, hVec); + if ( r == HOK ){ //Job well done? + updateData(); + return true; + } - return ret; + return false; } // bool DocumentModel::performScale( const QModelIndex& ielts, const QModelIndex& ivex, double k ) { - bool ret = false; - - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vertex* hVex = getHexaPtr(ivex); + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vertex* hVex = getHexaPtr(ivex); - int r = _hexaDocument->performScale (hElts, hVex, k); - if ( r == HOK ){ - updateData(); - ret = true; - } else if ( r == HERR ){ - ret = false; - } + int r = _hexaDocument->performScale (hElts, hVex, k); + if ( r == HOK ){ + updateData(); + return true; + } - return ret; + return false; } // bool DocumentModel::performRotation( const QModelIndex& ielts, const QModelIndex& ivex, const QModelIndex& ivec, double angle ) { - bool ret = false; - - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vertex* hVex = getHexaPtr(ivex); - HEXA_NS::Vector* hVec = getHexaPtr(ivec); + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vertex* hVex = getHexaPtr(ivex); + HEXA_NS::Vector* hVec = getHexaPtr(ivec); - int r = _hexaDocument-> performRotation( hElts, hVex, hVec, angle ); - if ( r == HOK ){ - updateData(); - ret = true; - } else if ( r == HERR ){ - ret = false; - } + int r = _hexaDocument-> performRotation( hElts, hVex, hVec, angle ); + if ( r == HOK ){ + updateData(); + return true; + } - return ret; + return false; } // bool DocumentModel::performSymmetryPoint( const QModelIndex& ielts, const QModelIndex& ivex ) { - bool ret = false; - - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vertex* hVex = getHexaPtr(ivex); + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vertex* hVex = getHexaPtr(ivex); - int r = _hexaDocument->performSymmetryPoint( hElts, hVex ); - if ( r == HOK ){ - updateData(); - ret = true; - } else if ( r == HERR ){ - ret = false; - } + int r = _hexaDocument->performSymmetryPoint( hElts, hVex ); + if ( r == HOK ){ + updateData(); + return true; + } - return ret; + return false; } bool DocumentModel::performSymmetryLine( const QModelIndex& ielts, const QModelIndex& ivex, const QModelIndex& ivec ) { - bool ret = false; - - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vertex* hVex = getHexaPtr(ivex); - HEXA_NS::Vector* hVec = getHexaPtr(ivec); + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vertex* hVex = getHexaPtr(ivex); + HEXA_NS::Vector* hVec = getHexaPtr(ivec); - int r = _hexaDocument->performSymmetryLine( hElts, hVex, hVec ); - if ( r == HOK ){ - updateData(); - ret = true; - } else if ( r == HERR ){ - ret = false; - } + int r = _hexaDocument->performSymmetryLine( hElts, hVex, hVec ); + if ( r == HOK ){ + updateData(); + return true; + } - return ret; + return false; } bool DocumentModel::performSymmetryPlane( const QModelIndex& ielts, - const QModelIndex& ivex, - const QModelIndex& ivec ) + const QModelIndex& ivex, + const QModelIndex& ivec ) { - bool ret = false; - - HEXA_NS::Elements* hElts = getHexaPtr(ielts); - HEXA_NS::Vertex* hVex = getHexaPtr(ivex); - HEXA_NS::Vector* hVec = getHexaPtr(ivec); + HEXA_NS::Elements* hElts = getHexaPtr(ielts); + HEXA_NS::Vertex* hVex = getHexaPtr(ivex); + HEXA_NS::Vector* hVec = getHexaPtr(ivec); - int r = _hexaDocument->performSymmetryPlane( hElts, hVex, hVec ); - if ( r == HOK ){ - updateData(); - ret = true; - } else if ( r == HERR ){ - ret = false; - } + int r = _hexaDocument->performSymmetryPlane( hElts, hVex, hVec ); + if ( r == HOK ){ + updateData(); + return true; + } - return ret; + return false; } QModelIndex DocumentModel::revolutionQuads( const QModelIndexList& istartquads, - const QModelIndex& icenter, - const QModelIndex& ivecaxis, - const QList& angles ) + const QModelIndex& icenter, + const QModelIndex& ivecaxis, + const QList& angles ) { - QModelIndex ielts; + QModelIndex ielts; - HEXA_NS::Quads hstartquads; - HEXA_NS::Quad* hquad = NULL; - foreach( const QModelIndex& iquad, istartquads){ - hquad = data( iquad, HEXA_DATA_ROLE ).value(); - hstartquads.push_back( hquad ); - } - HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); - HEXA_NS::Vector* haxis = getHexaPtr(ivecaxis); - std::vector hangles = angles.toVector().toStdVector(); + HEXA_NS::Quads hstartquads; + HEXA_NS::Quad* hquad = NULL; + foreach( const QModelIndex& iquad, istartquads){ + hquad = data( iquad, HEXA_DATA_ROLE ).value(); + hstartquads.push_back( hquad ); + } + HEXA_NS::Vertex* hcenter = getHexaPtr(icenter); + HEXA_NS::Vector* haxis = getHexaPtr(ivecaxis); + std::vector hangles = angles.toVector().toStdVector(); - HEXA_NS::Elements* helts = _hexaDocument->revolutionQuads( hstartquads, hcenter, haxis, hangles ); + HEXA_NS::Elements* helts = _hexaDocument->revolutionQuads( hstartquads, hcenter, haxis, hangles ); + if ( BadElement(helts) ) return ielts; - if ( helts && helts->isValid() ){ updateData(); ElementsItem* eltsItem = new ElementsItem(helts); _elementsDirItem->appendRow(eltsItem); ielts = eltsItem->index(); - } else { - delete helts; - } - return ielts; + return ielts; } QModelIndex DocumentModel::replace( const QModelIndexList& iquadsPattern, - const QModelIndex& ip1, const QModelIndex& ic1, - const QModelIndex& ip2, const QModelIndex& ic2, - const QModelIndex& ip3, const QModelIndex& ic3 ) -{ - QModelIndex ielts; - - HEXA_NS::Vertex* hp1 = getHexaPtr(ip1); - HEXA_NS::Vertex* hc1 = getHexaPtr(ic1); - HEXA_NS::Vertex* hp2 = getHexaPtr(ip2); - HEXA_NS::Vertex* hc2 = getHexaPtr(ic2); - HEXA_NS::Vertex* hp3 = getHexaPtr(ip3); - HEXA_NS::Vertex* hc3 = getHexaPtr(ic3); - - HEXA_NS::Quads hquads; - HEXA_NS::Quad* hquad = NULL; - foreach( const QModelIndex& iquad, iquadsPattern ){ - hquad = getHexaPtr(iquad); - hquads.push_back( hquad ); - } - - HEXA_NS::Elements* helts = _hexaDocument->replace( hquads, - hp1, hc1, hp2, hc2, hp3, hc3 ); -// HEXA_NS::Elements* helts = NULL; - - if ( helts && helts->isValid() ){ + const QModelIndex& ip1, const QModelIndex& ic1, + const QModelIndex& ip2, const QModelIndex& ic2, + const QModelIndex& ip3, const QModelIndex& ic3 ) +{ + QModelIndex ielts; + + HEXA_NS::Vertex* hp1 = getHexaPtr(ip1); + HEXA_NS::Vertex* hc1 = getHexaPtr(ic1); + HEXA_NS::Vertex* hp2 = getHexaPtr(ip2); + HEXA_NS::Vertex* hc2 = getHexaPtr(ic2); + HEXA_NS::Vertex* hp3 = getHexaPtr(ip3); + HEXA_NS::Vertex* hc3 = getHexaPtr(ic3); + + HEXA_NS::Quads hquads; + HEXA_NS::Quad* hquad = NULL; + foreach( const QModelIndex& iquad, iquadsPattern ){ + hquad = getHexaPtr(iquad); + hquads.push_back( hquad ); + } + + HEXA_NS::Elements* helts = _hexaDocument->replace( hquads, + hp1, hc1, hp2, hc2, hp3, hc3 ); + if ( BadElement(helts) ) return ielts; + updateData(); ElementsItem* eltsItem = new ElementsItem(helts); _elementsDirItem->appendRow(eltsItem); ielts = eltsItem->index(); - } else { - delete helts; - } - return ielts; + return ielts; } // ************ ADD ASSOCIATION ************ // -void DocumentModel::addAssociation( const QModelIndex& iElt, const DocumentModel::GeomObj& assocIn ) -{ -// assocIn.name; - HEXA_NS::Shape* assoc = new HEXA_NS::Shape( assocIn.brep.toStdString() );//CS_TODO : delete assoc - assoc->debut = assocIn.start; - assoc->fin = assocIn.end; - assoc->ident = ( assocIn.entry + "," + assocIn.subid ).toStdString(); - _assocName[ assocIn.entry ] = assocIn.name; // for getAssociations() - - QString currentAssoc, newAssoc; - - if ( data(iElt, HEXA_TREE_ROLE) == VERTEX_TREE ){ - HEXA_NS::Vertex* hVex = getHexaPtr(iElt); - hVex->setAssociation( assoc ); - } else if ( data(iElt, HEXA_TREE_ROLE) == EDGE_TREE ){ - HEXA_NS::Edge* hEdge = getHexaPtr(iElt); - hEdge->addAssociation( assoc ); - } else if ( data(iElt, HEXA_TREE_ROLE) == QUAD_TREE ){ - HEXA_NS::Quad* hQuad = getHexaPtr(iElt); - hQuad->addAssociation( assoc ); - } - - currentAssoc = data( iElt, HEXA_ASSOC_ENTRY_ROLE ).toString(); - if ( !currentAssoc.isEmpty() ){ - newAssoc = currentAssoc + assocIn.entry + "," + assocIn.subid + ";"; - } else { - newAssoc = assocIn.entry + "," + assocIn.subid + ";"; - } - - setData( iElt, QVariant::fromValue(newAssoc), HEXA_ASSOC_ENTRY_ROLE ); -} - - -QList DocumentModel::getAssociations( const QModelIndex& iElt ) -{ - MESSAGE("DocumentModel::getAssociations( "<< iElt.data().toString().toStdString() << " )" ); - QList res; - DocumentModel::GeomObj assoc; - - //std::cout << "getAssociations() start" << std::endl; - if ( data(iElt, HEXA_TREE_ROLE) == VERTEX_TREE ){ - MESSAGE("* of a Vertex"); -// HEXA_NS::Vertex* hVex = data(iElt, HEXA_DATA_ROLE).value(); - HEXA_NS::Vertex *hVex = getHexaPtr(iElt); - HEXA_NS::Shape* hShape = hVex->getAssociation(); - QStringList shapeID; - if ( hShape != NULL ){ - assoc.entry = ""; - assoc.subid = QString::number(-1); - assoc.name = ""; - assoc.brep = hShape->getBrep().c_str(); - assoc.start = hShape->debut; - assoc.end = hShape->fin; - - shapeID = QString( hShape->ident.c_str() ).split(","); - if ( shapeID.count() == 2 ){ - assoc.entry = shapeID[0]; - assoc.subid = shapeID[1].isEmpty()? QString::number(-1) : shapeID[1]; - assoc.name = _assocName[assoc.entry]; - } - MESSAGE("* assoc.entry" << assoc.entry.toStdString() ); - MESSAGE("* assoc.subid" << assoc.subid.toStdString() ); - MESSAGE("* -----------" ); - res << assoc; - } - } else if ( data(iElt, HEXA_TREE_ROLE) == EDGE_TREE ){ - MESSAGE("* of an Edge"); - HEXA_NS::Edge* hEdge = getHexaPtr(iElt); - HEXA_NS::Shapes hShapes = hEdge->getAssociations(); - QStringList shapeID; - for ( HEXA_NS::Shapes::iterator it = hShapes.begin(); it != hShapes.end(); ++it){ - assoc.entry = ""; - assoc.subid = QString::number(-1); - assoc.name = ""; - assoc.brep = (*it)->getBrep().c_str(); - assoc.start = (*it)->debut; - assoc.end = (*it)->fin; - - MESSAGE("* assoc.ident " << (*it)->ident ); - shapeID = QString( (*it)->ident.c_str() ).split(","); - if ( shapeID.count() == 2 ){ - assoc.entry = shapeID[0]; - assoc.subid = shapeID[1].isEmpty()? QString::number(-1) : shapeID[1]; - assoc.name = _assocName[assoc.entry]; - } - MESSAGE("* assoc.entry" << assoc.entry.toStdString() ); - MESSAGE("* assoc.subid" << assoc.subid.toStdString() ); - MESSAGE("* assoc.brep" << assoc.brep.toStdString() ); - MESSAGE("* assoc.start" << assoc.start ); - MESSAGE("* assoc.end" << assoc.end ); - MESSAGE("* -----------" ); - res << assoc; - } - } else if ( data(iElt, HEXA_TREE_ROLE) == QUAD_TREE ){ - MESSAGE("* of a Quad"); - HEXA_NS::Quad* hQuad = getHexaPtr(iElt); - HEXA_NS::Shapes hShapes = hQuad->getAssociations(); - QStringList shapeID; - for ( HEXA_NS::Shapes::iterator it = hShapes.begin(); it != hShapes.end(); ++it){ - assoc.entry = ""; - assoc.subid = QString::number(-1); - assoc.name = ""; - assoc.brep = (*it)->getBrep().c_str(); - assoc.start = (*it)->debut; - assoc.end = (*it)->fin; - MESSAGE("* assoc.entry" << assoc.entry.toStdString() ); - MESSAGE("* assoc.subid" << assoc.subid.toStdString() ); -// MESSAGE("* assoc.brep" << assoc.brep.toStdString() ); -// MESSAGE("* assoc.start" << assoc.start ); -// MESSAGE("* assoc.end" << assoc.end ); - MESSAGE("* -----------" ); - shapeID = QString( (*it)->ident.c_str() ).split(","); - if ( shapeID.count() == 2 ){ - assoc.entry = shapeID[0]; - assoc.subid = shapeID[1].isEmpty()? QString::number(-1) : shapeID[1]; - assoc.name = _assocName[assoc.entry]; - } - - res << assoc; - } - } - - MESSAGE("}" ); - return res; -} - -// int associateOpenedLine (Edge* mstart, Edges& mline, Shape* gstart, -// double pstart, Shapes& gline, double pend); -// int associateClosedLine (Vertex* mfirst, Edge* mstart, Edges& mline, -// Shape* gstart, double pstart, Shapes& gline); + +//--------------- METHOD OBSOLETE +//void DocumentModel::addAssociation( const QModelIndex& iElt, const DocumentModel::GeomObj& assocIn ) +//{ +// // assocIn.name; +// HEXA_NS::Shape* assoc = new HEXA_NS::Shape( assocIn.brep.toStdString() );//CS_TODO : delete assoc +// assoc->setStart (assocIn.start); +// assoc->setEnd (assocIn.end); +// assoc->setIdent ( (assocIn.shapeName + "," + assocIn.subid).toStdString() ); +// +// QString currentAssoc, newAssoc; +// +// if ( data(iElt, HEXA_TREE_ROLE) == VERTEX_TREE ){ +// HEXA_NS::Vertex* hVex = getHexaPtr(iElt); +// hVex->setAssociation( assoc ); +// } else if ( data(iElt, HEXA_TREE_ROLE) == EDGE_TREE ){ +// HEXA_NS::Edge* hEdge = getHexaPtr(iElt); +// hEdge->addAssociation( assoc ); +// } else if ( data(iElt, HEXA_TREE_ROLE) == QUAD_TREE ){ +// HEXA_NS::Quad* hQuad = getHexaPtr(iElt); +// hQuad->addAssociation( assoc ); +// } +// +// currentAssoc = data( iElt, HEXA_ASSOC_ENTRY_ROLE ).toString(); +// if ( !currentAssoc.isEmpty() ){ +// newAssoc = currentAssoc + assocIn.shapeName + "," + assocIn.subid + ";"; +// } else { +// newAssoc = assocIn.shapeName + "," + assocIn.subid + ";"; +// } +// setData( iElt, QVariant::fromValue(newAssoc), HEXA_ASSOC_ENTRY_ROLE ); +//} +//-------------------------------- + + +QMultiMap< QString, int > DocumentModel::getAssocShapesIds(const QModelIndex& dataIndex) +{ + QMultiMap< QString, int > result; + HEXA_NS::NewShape* mainShape; + HEXA_NS::VertexShape* node; + HEXA_NS::EdgeShape* line; + HEXA_NS::FaceShape* face; + QString shapeName; + int subid; + + PatternDataSelectionModel* pdsm = HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel(); + QModelIndexList assocsInd = pdsm->getGeomAssociations(/*index*/dataIndex); + foreach( const QModelIndex& anAssoc, assocsInd ) + { + node = getHexaPtr(anAssoc); + line = getHexaPtr(anAssoc); + face = getHexaPtr(anAssoc); + + if (node != NULL) + { + mainShape = node->getParentShape(); + if (mainShape != NULL) + { + shapeName = mainShape->getName(); + subid = node->getIdent(); + } + } + else if (line != NULL) + { + mainShape = line->getParentShape(); + if (mainShape != NULL) + { + shapeName = mainShape->getName(); + subid = line->getIdent(); + } + } + else if (face != NULL) + { + mainShape = face->getParentShape(); + if (mainShape != NULL) + { + shapeName = mainShape->getName(); + subid = face->getIdent(); + } + } + + if (!shapeName.isEmpty()) + result.insert( shapeName, subid ); + + shapeName = QString(); + } + return result; +} + +bool DocumentModel::setVertexAssociation( const QModelIndex& iVertex, double x, double y, double z) +{ + HEXA_NS::Vertex* vertex = getHexaPtr(iVertex); + + if (vertex == NULL || _hexaDocument == NULL || vertex->setAssociation(x, y, z) != HOK) + return false; + + setData( iVertex, QVariant::fromValue(QString::number(x)+","+QString::number(y)+","+QString::number(z)), HEXA_ASSOC_ENTRY_ROLE ); + return true; +} + +bool DocumentModel::setVertexAssociation( const QModelIndex& iVertex, const QModelIndex& iGeomVertex) +{ + //parameters control + QString newAssoc; + HEXA_NS::Vertex* vertex = getHexaPtr(iVertex); + HEXA_NS::VertexShape* geomVertex = getHexaPtr(iGeomVertex); + if (_hexaDocument == NULL || vertex == NULL || geomVertex == NULL) return false; + HEXA_NS::NewShape* mainShape = geomVertex->getParentShape(); + if (mainShape == NULL) return false; + + //add association + if (vertex->setAssociation(geomVertex) != HOK) + return false; + + //update association state in the model + newAssoc = QString(mainShape->getName()) + "," + QString::number(geomVertex->getIdent()) + ";"; + setData( iVertex, QVariant::fromValue(newAssoc), HEXA_ASSOC_ENTRY_ROLE ); + + return true; +} + +bool DocumentModel::addEdgeAssociation( const QModelIndex& iEdge, const QModelIndex& iGeomEdge, double start, double end) +{ + //parameters control + QString currentAssoc, newAssoc; + HEXA_NS::Edge* edge = getHexaPtr(iEdge); + HEXA_NS::EdgeShape* geomEdge = getHexaPtr(iGeomEdge); + if (_hexaDocument == NULL || edge == NULL || + geomEdge == NULL || start > end) return false; + HEXA_NS::NewShape* mainShape = geomEdge->getParentShape(); + if (mainShape == NULL) return false; + + //add association in the engine side + if (edge->addAssociation(geomEdge, start, end) != HOK) + return false; + + //add/update association in the model side (UI) + currentAssoc = data(iEdge, HEXA_ASSOC_ENTRY_ROLE).toString(); + newAssoc = QString(mainShape->getName()) + "," + QString::number(geomEdge->getIdent()) + ";"; + if (!currentAssoc.isEmpty()) newAssoc = currentAssoc + newAssoc; + + setData( iEdge, QVariant::fromValue(newAssoc), HEXA_ASSOC_ENTRY_ROLE ); + + return true; +} + +bool DocumentModel::addQuadAssociation (const QModelIndex& iQuad, const QModelIndex& iGeomFace) +{ + //parameters control + QString currentAssoc, newAssoc; + HEXA_NS::Quad* quad = getHexaPtr(iQuad); + HEXA_NS::FaceShape* geomFace = getHexaPtr(iGeomFace); + if (_hexaDocument == NULL || quad == NULL || geomFace == NULL) + return false; + HEXA_NS::NewShape* mainShape = geomFace->getParentShape(); + if (mainShape == NULL) return false; + + //add association + if (quad->addAssociation(geomFace) != HOK) + return false; + + //update association + currentAssoc = data( iQuad, HEXA_ASSOC_ENTRY_ROLE).toString(); + newAssoc = QString(mainShape->getName()) + "," + QString::number(geomFace->getIdent()) + ";"; + if (!currentAssoc.isEmpty()) newAssoc = currentAssoc + newAssoc; + setData( iQuad, QVariant::fromValue(newAssoc), HEXA_ASSOC_ENTRY_ROLE ); + + return true; +} + + +QModelIndex DocumentModel::getVertexAssociation(const QModelIndex& iVertex) +{ + HEXA_NS::Vertex* vertex = getHexaPtr(iVertex); + if (vertex == NULL) return QModelIndex(); + + //get the associated geom vertex + HEXA_NS::VertexShape* geomVertex = vertex->getAssoVertex(); + if (geomVertex == NULL) return QModelIndex(); + + //convert geom vertex to qmodelindex + if (HEXABLOCKGUI::currentDocGView == NULL) return QModelIndex(); + PatternGeomSelectionModel* pgsm = HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); + PatternGeomModel* pgm = HEXABLOCKGUI::currentDocGView->getPatternGeomModel(); + if (pgsm == NULL || pgm == NULL) return QModelIndex(); + + return pgm->mapToSource(pgsm->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(geomVertex) )); +} + + +QList DocumentModel::getEdgeAssociations(const QModelIndex& iEdge) +{ + QList result; + HEXA_NS::Edge* edge = getHexaPtr(iEdge); + if (edge == NULL) return result; + + DocumentModel::GeomObj assoc; + HEXA_NS::EdgeShape* geomEdge; + HEXA_NS::AssoEdge* anEdgeAssoc; + HEXA_NS::NewShape* mainShape; + QString name; + + int nbAssocs = edge->countAssociation(); + for (int i = 0; i < nbAssocs; ++i) + { + anEdgeAssoc = edge->getAssociation(i); + if (anEdgeAssoc == NULL) continue; + geomEdge = anEdgeAssoc->getEdgeShape(); + if (geomEdge == NULL) continue; + mainShape = geomEdge->getParentShape(); + if (mainShape == NULL) continue; // => les generatrices ne sont pas gerees pour le moment + assoc.shapeName = mainShape->getName(); + assoc.subid = QString::number(geomEdge->getIdent()); + assoc.start = anEdgeAssoc->getStart(); + assoc.end = anEdgeAssoc->getEnd(); + result << assoc; + } + + return result; +} + + +QModelIndexList DocumentModel::getQuadAssociations(const QModelIndex& iQuad) +{ + QModelIndexList result; + QModelIndex geomQuadIndex; + HEXA_NS::Quad* quad = getHexaPtr(iQuad); + if (quad == NULL) return result; + + if (HEXABLOCKGUI::currentDocGView == NULL) return result; + PatternGeomSelectionModel* pgsm = HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); + PatternGeomModel* pgm = HEXABLOCKGUI::currentDocGView->getPatternGeomModel(); + if (pgsm == NULL || pgm == NULL) return result; + + HEXA_NS::FaceShape* geomFace; + + int nbAssocs = quad->countAssociation(); + for (int i = 0; i < nbAssocs; ++i) + { + geomFace = quad->getAssociation(i); + if (geomFace == NULL) continue; + + geomQuadIndex = pgm->mapToSource(pgsm->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(geomFace) )); + result << geomQuadIndex; + } + + return result; +} + +//--------------- METHOD OBSOLETE +//QList DocumentModel::getAssociations( const QModelIndex& iElt ) +//{ +// QList res; +// DocumentModel::GeomObj assoc; +// +// //std::cout << "getAssociations() start" << std::endl; +// if ( data(iElt, HEXA_TREE_ROLE) == VERTEX_TREE ){ +// // HEXA_NS::Vertex* hVex = data(iElt, HEXA_DATA_ROLE).value(); +// HEXA_NS::Vertex *hVex = getHexaPtr(iElt); +// HEXA_NS::Shape* hShape = hVex->getAssociation(); +// QStringList shapeID; +// if ( hShape != NULL ){ +// assoc.shapeName = QString(); +// assoc.subid = QString::number(-1); +// assoc.brep = hShape->getBrep().c_str(); +// assoc.start = hShape->getStart(); +// assoc.end = hShape->getEnd(); +// +// shapeID = QString( hShape->getIdent().c_str() ).split(","); +// if ( shapeID.count() == 2 ){ +// assoc.shapeName = shapeID[0]; +// assoc.subid = shapeID[1].isEmpty()? QString::number(-1) : shapeID[1]; +// } +// res << assoc; +// } +// } else if ( data(iElt, HEXA_TREE_ROLE) == EDGE_TREE ){ +// HEXA_NS::Edge* hEdge = getHexaPtr(iElt); +// HEXA_NS::Shapes hShapes = hEdge->getAssociations(); +// QStringList shapeID; +// for ( HEXA_NS::Shapes::iterator it = hShapes.begin(); it != hShapes.end(); ++it){ +// assoc.shapeName = QString(); +// assoc.subid = QString::number(-1); +// assoc.brep = (*it)->getBrep().c_str(); +// assoc.start = (*it)->getStart(); +// assoc.end = (*it)->getEnd(); +// +// shapeID = QString( (*it)->getIdent().c_str() ).split(","); +// if ( shapeID.count() == 2 ){ +// assoc.shapeName = shapeID[0]; +// assoc.subid = shapeID[1].isEmpty()? QString::number(-1) : shapeID[1]; +// } +// res << assoc; +// } +// } else if ( data(iElt, HEXA_TREE_ROLE) == QUAD_TREE ){ +// HEXA_NS::Quad* hQuad = getHexaPtr(iElt); +// HEXA_NS::Shapes hShapes = hQuad->getAssociations(); +// QStringList shapeID; +// for ( HEXA_NS::Shapes::iterator it = hShapes.begin(); it != hShapes.end(); ++it){ +// assoc.shapeName = QString(); +// assoc.subid = QString::number(-1); +// assoc.brep = (*it)->getBrep().c_str(); +// assoc.start = (*it)->getStart(); +// assoc.end = (*it)->getEnd(); +// shapeID = QString( (*it)->getIdent().c_str() ).split(","); +// if ( shapeID.count() == 2 ){ +// assoc.shapeName = shapeID[0]; +// assoc.subid = shapeID[1].isEmpty()? QString::number(-1) : shapeID[1]; +// } +// +// res << assoc; +// } +// } +// +// return res; +//} +//---------------------------------- + bool DocumentModel::associateOpenedLine( const QModelIndexList& iedges, - const GeomObjList& assocs, - double pstart, - double pend ) + HEXA_NS::NewShapes shapes, + HEXA_NS::IntVector subIds, + double pstart, + double pend ) { - MESSAGE("DocumentModel::associateOpenedLine() "); - bool ret = false; - HEXA_NS::Edge* mstart = NULL; + HEXA_NS::Edges mline; - HEXA_NS::Shape* gstart = NULL; -// double pstart; - HEXA_NS::Shapes gline; -// double pend; HEXA_NS::Edge* hedge = NULL; foreach( const QModelIndex& iedge, iedges ){ hedge = getHexaPtr(iedge); - if ( mstart == NULL ){ - mstart = hedge; - MESSAGE("* mstart" << iedge.data().toString().toStdString() ); - } else { + if (hedge != NULL) mline.push_back( hedge ); - MESSAGE("* mline :" << iedge.data().toString().toStdString() ); - } } - HEXA_NS::Shape* hshape = NULL; - foreach( const GeomObj& anAssoc, assocs ){ - hshape = new HEXA_NS::Shape( anAssoc.brep.toStdString() ); - hshape->debut = anAssoc.start; //0.; - hshape->fin = anAssoc.end; //1.; - hshape->ident = ( anAssoc.entry + "," + anAssoc.subid ).toStdString(); //anAssoc.entry.toStdString(); - - if ( gstart == NULL ){ - gstart = hshape; // CS_TODO :gstart.debut = pstart ?? - MESSAGE("* gstart->debut" << gstart->debut); - MESSAGE("* gstart->fin" << gstart->fin); - MESSAGE("* gstart->ident" << gstart->ident); - MESSAGE("* gstart->getBrep()" << gstart->getBrep()); -// pstart = anAssoc.start; - } else { - gline.push_back( hshape ); //CS_TODO : hshape.fin = pend ?? - MESSAGE("* gline->debut" << hshape->debut); - MESSAGE("* gline->fin" << hshape->fin); - MESSAGE("* gline->ident" << hshape->ident); - MESSAGE("* gline->getBrep()" << hshape->getBrep()); - } - } -// pend = assocs.last().end; - MESSAGE("* pstart" << pstart ); - MESSAGE("* pend" << pend ); - - int r = _hexaDocument->associateOpenedLine( mstart, mline, - gstart, pstart, gline, pend ); - if ( r == HOK ){ + int err = _hexaDocument->associateOpenedLine( mline, shapes, subIds, pstart, pend ); + if ( err == HOK ){ updateData(); - MESSAGE("* DocumentModel:: associateOpenedLine() => OK "); - ret = true; - } else if ( r == HERR ){ - MESSAGE("* DocumentModel:: associateOpenedLine() => ERR "); - ret = false; + return true; } - delete gstart; //CS_TODO : delete gline? - return ret; + return false; } + bool DocumentModel::associateClosedLine( const QModelIndex& ivertex, - const QModelIndexList& iedges, - const GeomObjList& assocs, - double pstart, - bool inv ) + const QModelIndexList& iedges, + HEXA_NS::NewShapes shapes, + HEXA_NS::IntVector subIds, + double pstart, + bool inv ) { - MESSAGE("DocumentModel::associateClosedLine() "); - bool ret = false; HEXA_NS::Vertex* mfirst = getHexaPtr(ivertex); - HEXA_NS::Edge* mstart = NULL; HEXA_NS::Edges mline; - HEXA_NS::Shape* gstart = NULL; -// double pstart; - HEXA_NS::Shapes gline; - HEXA_NS::Edge* hedge = NULL; foreach( const QModelIndex& iedge, iedges ){ hedge = getHexaPtr(iedge); - if ( mstart == NULL ){ - mstart = hedge; - MESSAGE("* mstart" << iedge.data().toString().toStdString() ); - } else { + if (hedge != NULL) mline.push_back( hedge ); - MESSAGE("* mline :" << iedge.data().toString().toStdString() ); - } } - HEXA_NS::Shape* hshape = NULL; - foreach( const GeomObj& anAssoc, assocs ){ - hshape = new HEXA_NS::Shape( anAssoc.brep.toStdString() ); - hshape->debut = anAssoc.start; //0.; - hshape->fin = anAssoc.end; //1.; - hshape->ident = ( anAssoc.entry + "," + anAssoc.subid ).toStdString();//anAssoc.entry.toStdString(); - - if ( gstart == NULL ){ - gstart = hshape; // CS_TODO :gstart.debut = pstart ?? -// pstart = anAssoc.start; - MESSAGE("* gstart->debut" << gstart->debut); - MESSAGE("* gstart->fin" << gstart->fin); - MESSAGE("* gstart->ident" << gstart->ident); - MESSAGE("* gstart->getBrep()" << gstart->getBrep()); - } else { - gline.push_back( hshape ); //CS_TODO : hshape.fin = pend ?? - MESSAGE("* gline->debut" << hshape->debut); - MESSAGE("* gline->fin" << hshape->fin); - MESSAGE("* gline->ident" << hshape->ident); - MESSAGE("* gline->getBrep()" << hshape->getBrep()); - } - } - MESSAGE("* pstart" << pstart ); - - int r = _hexaDocument->associateClosedLine( mfirst, mstart, mline, - gstart, pstart, inv, gline ); - if ( r == HOK ){ + int err = _hexaDocument->associateClosedLine( mfirst, mline, shapes, subIds, pstart, inv); + if ( err == HOK ){ updateData(); - ret = true; - } else if ( r == HERR ){ - ret = false; + return true; } - return ret; + return false; } // ************ GROUPS ************ // QModelIndex DocumentModel::addGroup( const QString& name, Group kind ) { - QModelIndex iGroup; + QModelIndex iGroup; - HEXA_NS::Group* hGroup = _hexaDocument->addGroup( name.toLocal8Bit().constData(), kind ); + HEXA_NS::Group* hGroup = _hexaDocument->addGroup( name.toLocal8Bit().constData(), kind ); + if ( hGroup == NULL ) return iGroup; - GroupItem* groupItem = new GroupItem(hGroup); - groupItem->setData( _entry, HEXA_DOC_ENTRY_ROLE ); - _groupDirItem->appendRow(groupItem); - iGroup = groupItem->index(); + GroupItem* groupItem = new GroupItem(hGroup); + groupItem->setData( _entry, HEXA_DOC_ENTRY_ROLE ); + _groupDirItem->appendRow(groupItem); + iGroup = groupItem->index(); - return iGroup; + return iGroup; } + // bool DocumentModel::removeGroup( const QModelIndex& igrp ) { - bool ret = false; + HEXA_NS::Group* hGroup = data(igrp, HEXA_DATA_ROLE).value(); + int r = _hexaDocument->removeGroup ( hGroup ); - HEXA_NS::Group* hGroup = data(igrp, HEXA_DATA_ROLE).value(); - int r = _hexaDocument->removeGroup ( hGroup ); + if ( r == HOK ){ + removeRow( igrp.row(), igrp.parent()); + return true; + } - if ( r == HOK ){ - removeRow( igrp.row(), igrp.parent()); - ret = true; - } else if ( r == HERR ){ - ret = false; - } - return ret; + return false; } /* QModelIndex* DocumentModel::found(eltBase) { TODO_JMD } -*/ + */ QModelIndexList DocumentModel::getGroupElements( const QModelIndex& iGroup, DocumentModel::Group& kind ) const { - QModelIndexList iElements; - - HEXA_NS::Group* g = iGroup.data(HEXA_DATA_ROLE).value(); - if ( !g ) return iElements; - - QModelIndexList iFound; - QVariant q; - HEXA_NS::EltBase* eltBase = NULL; - for ( int nr = 0; nr < g->countElement(); ++nr ){ - eltBase = g->getElement( nr ); - kind = g->getKind(); - switch ( kind ){ - case HEXA_NS::HexaCell: case HEXA_NS::HexaNode: q = QVariant::fromValue( (HEXA_NS::Hexa *)eltBase ); break; - case HEXA_NS::QuadCell: case HEXA_NS::QuadNode: q = QVariant::fromValue( (HEXA_NS::Quad *)eltBase ); break; - case HEXA_NS::EdgeCell: case HEXA_NS::EdgeNode: q = QVariant::fromValue( (HEXA_NS::Edge *)eltBase ); break; - case HEXA_NS::VertexNode: q = QVariant::fromValue( (HEXA_NS::Vertex *)eltBase ); break; - } - iFound = match( index(0, 0), - HEXA_DATA_ROLE, - q, - 1, - Qt::MatchRecursive ); - if ( !iFound.isEmpty() ) - iElements << iFound[0]; - } - return iElements; + QModelIndexList iElements; + + HEXA_NS::Group* g = iGroup.data(HEXA_DATA_ROLE).value(); + if ( g == NULL ) return iElements; + + QModelIndexList iFound; + QVariant q; + HEXA_NS::EltBase* eltBase = NULL; + for ( int nr = 0; nr < g->countElement(); ++nr ){ + eltBase = g->getElement( nr ); + kind = g->getKind(); + switch ( kind ){ + case HEXA_NS::HexaCell: case HEXA_NS::HexaNode: q = QVariant::fromValue( (HEXA_NS::Hexa *)eltBase ); break; + case HEXA_NS::QuadCell: case HEXA_NS::QuadNode: q = QVariant::fromValue( (HEXA_NS::Quad *)eltBase ); break; + case HEXA_NS::EdgeCell: case HEXA_NS::EdgeNode: q = QVariant::fromValue( (HEXA_NS::Edge *)eltBase ); break; + case HEXA_NS::VertexNode: q = QVariant::fromValue( (HEXA_NS::Vertex *)eltBase ); break; + } + iFound = match( index(0, 0), + HEXA_DATA_ROLE, + q, + 1, + Qt::MatchRecursive ); + if ( !iFound.isEmpty() ) + iElements << iFound[0]; + } + return iElements; } // 7.4 Boite: éditer un groupe void DocumentModel::setGroupName( const QModelIndex& igrp, const QString& name ) { - HEXA_NS::Group* hGroup = data(igrp, HEXA_DATA_ROLE).value(); + HEXA_NS::Group* hGroup = data(igrp, HEXA_DATA_ROLE).value(); - if ( hGroup ){ - hGroup->setName( name.toLocal8Bit().constData() ); - setData(igrp, QVariant::fromValue( name ) ); - } + if ( hGroup ){ + hGroup->setName( name.toLocal8Bit().constData() ); + setData(igrp, QVariant::fromValue( name ) ); + } } bool DocumentModel::addGroupElement( const QModelIndex& igrp, const QModelIndex& ielt ) { //CS_TODO : check input? add child? -// int addElement (EltBase* elt); + // int addElement (EltBase* elt); + + HEXA_NS::Group* hGroup = data(igrp, HEXA_DATA_ROLE).value(); + if (hGroup == NULL) return false; - bool addOk = false; - HEXA_NS::Group* hGroup = data(igrp, HEXA_DATA_ROLE).value(); - HEXA_NS::EltBase* hElt = NULL; - switch ( hGroup->getKind() ){ - case HEXA_NS::HexaCell: case HEXA_NS::HexaNode: hElt = getHexaPtr(ielt); break; - case HEXA_NS::QuadCell: case HEXA_NS::QuadNode: hElt = getHexaPtr(ielt); break; - case HEXA_NS::EdgeCell: case HEXA_NS::EdgeNode: hElt = getHexaPtr(ielt); break; - case HEXA_NS::VertexNode: hElt = getHexaPtr(ielt); break; - } + HEXA_NS::EltBase* hElt = NULL; + switch ( hGroup->getKind() ){ + case HEXA_NS::HexaCell: case HEXA_NS::HexaNode: hElt = getHexaPtr(ielt); break; + case HEXA_NS::QuadCell: case HEXA_NS::QuadNode: hElt = getHexaPtr(ielt); break; + case HEXA_NS::EdgeCell: case HEXA_NS::EdgeNode: hElt = getHexaPtr(ielt); break; + case HEXA_NS::VertexNode: hElt = getHexaPtr(ielt); break; + } - int res = HERR; - if ( hGroup and hElt ) - res = hGroup->addElement( hElt ); + int res = HERR; + if ( hElt != NULL ) + res = hGroup->addElement( hElt ); - if ( res == HOK ) addOk = true; + if ( res == HOK ) return true; - return addOk; + return false; } bool DocumentModel::removeGroupElement( const QModelIndex& igrp, int nro ) { //CS_TODO : remove child? - HEXA_NS::Group* hGroup = data(igrp, HEXA_DATA_ROLE).value(); + HEXA_NS::Group* hGroup = data(igrp, HEXA_DATA_ROLE).value(); + if (hGroup == NULL) return false; - if ( hGroup ) - { - if (hGroup->removeElement( nro ) == HOK) - return true; - } - return false; + if (hGroup->removeElement( nro ) == HOK) return true; + + return false; } bool DocumentModel::clearGroupElement( const QModelIndex& igrp ) { - HEXA_NS::Group* hGroup = data(igrp, HEXA_DATA_ROLE).value(); + HEXA_NS::Group* hGroup = data(igrp, HEXA_DATA_ROLE).value(); - if ( hGroup ) - { - hGroup->clearElement(); - return true; - } - return false; + if ( hGroup != NULL) + { + hGroup->clearElement(); + return true; + } + return false; } // ************ LAWS ************ @@ -2468,100 +2662,94 @@ bool DocumentModel::clearGroupElement( const QModelIndex& igrp ) // QModelIndex DocumentModel::addLaw( const QString& name, int nbnodes ) { - QModelIndex iLaw; + QModelIndex iLaw; - HEXA_NS::Law* hLaw = _hexaDocument->addLaw( name.toLocal8Bit().constData(), nbnodes ); + HEXA_NS::Law* hLaw = _hexaDocument->addLaw( name.toLocal8Bit().constData(), nbnodes ); + if ( BadElement(hLaw) ) return iLaw; - LawItem* lawItem = new LawItem(hLaw); - _lawDirItem->appendRow(lawItem); - iLaw = lawItem->index(); + LawItem* lawItem = new LawItem(hLaw); + _lawDirItem->appendRow(lawItem); + iLaw = lawItem->index(); - return iLaw; + return iLaw; } bool DocumentModel::setLaw( const QModelIndex& ilaw, int nbnodes, double coeff, KindLaw type ) { - bool ret = false; + bool ret = false; - HEXA_NS::Law* hLaw = data(ilaw, HEXA_DATA_ROLE).value(); + HEXA_NS::Law* hLaw = data(ilaw, HEXA_DATA_ROLE).value(); - if ( hLaw ){ - int ok; - ok = hLaw->setNodes( nbnodes ); - ( ok == HOK) ? ret = true : ret = false; - ok = hLaw->setCoefficient( coeff ); - hLaw->setKind(type); - } + if ( hLaw ){ + int ok; + ok = hLaw->setNodes( nbnodes ); + ( ok == HOK) ? ret = true : ret = false; + ok = hLaw->setCoefficient( coeff ); + hLaw->setKind(type); + } - return ret; + return ret; } -// +// bool DocumentModel::removeLaw( const QModelIndex& ilaw ) { - bool ret = false; - HEXA_NS::Law* hLaw = data(ilaw, HEXA_DATA_ROLE).value(); - int r = _hexaDocument->removeLaw( hLaw ); + HEXA_NS::Law* hLaw = data(ilaw, HEXA_DATA_ROLE).value(); + int r = _hexaDocument->removeLaw( hLaw ); - if ( r == HOK ){ - removeRow( ilaw.row(), ilaw.parent()); - ret = true; - } else if ( r == HERR ){ - ret = false; - } + if ( r == HOK ){ + removeRow( ilaw.row(), ilaw.parent()); + return true; + } - return ret; + return false; } bool DocumentModel::setPropagation( const QModelIndex& iPropagation, const QModelIndex& iLaw, bool way ) { - bool ret = false; - HEXA_NS::Propagation* hPropagation = data(iPropagation, HEXA_DATA_ROLE).value(); - HEXA_NS::Law* hLaw = data(iLaw, HEXA_DATA_ROLE).value(); + HEXA_NS::Propagation* hPropagation = data(iPropagation, HEXA_DATA_ROLE).value(); + HEXA_NS::Law* hLaw = data(iLaw, HEXA_DATA_ROLE).value(); + + int r = hPropagation->setLaw( hLaw ); + hPropagation->setWay( way ); - int r = hPropagation->setLaw( hLaw ); - hPropagation->setWay( way ); + if ( r == HOK ) return true; - if ( r == HOK ){ - ret = true; - } else if ( r == HERR ){ - ret = false; - } - return ret; + return false; } QModelIndexList DocumentModel::getPropagation( const QModelIndex& iPropagation ) const { - QModelIndexList iEdges; - - QModelIndexList iFound; - HEXA_NS::Propagation* propa = iPropagation.data(HEXA_DATA_ROLE).value(); - if ( !propa ) return iEdges; - - const HEXA_NS::Edges& edges = propa->getEdges(); - for ( HEXA_NS::Edges::const_iterator anEdge = edges.begin(); - anEdge != edges.end(); - ++anEdge ){ - iFound = match( index(0, 0), - HEXA_DATA_ROLE, - QVariant::fromValue( *anEdge ), - 1, - Qt::MatchRecursive); - if ( !iFound.isEmpty() ) - iEdges << iFound[0]; - } + QModelIndexList iEdges; + + QModelIndexList iFound; + HEXA_NS::Propagation* propa = iPropagation.data(HEXA_DATA_ROLE).value(); + if ( propa == NULL ) return iEdges; + + const HEXA_NS::Edges& edges = propa->getEdges(); + for ( HEXA_NS::Edges::const_iterator anEdge = edges.begin(); + anEdge != edges.end(); + ++anEdge ){ + iFound = match( index(0, 0), + HEXA_DATA_ROLE, + QVariant::fromValue( *anEdge ), + 1, + Qt::MatchRecursive); + if ( !iFound.isEmpty() ) + iEdges << iFound[0]; + } - return iEdges; + return iEdges; } HEXA_NS::Document* DocumentModel::documentImpl() { - return _hexaDocument; + return _hexaDocument; } QString DocumentModel::documentEntry() { - return _entry; + return _entry; } // 8.3 Boite: éditer une loi CS_TODO @@ -2569,17 +2757,17 @@ QString DocumentModel::documentEntry() /***************************************************************** PatternDataModel -*****************************************************************/ + *****************************************************************/ PatternDataModel::PatternDataModel( QObject * parent ) : - QSortFilterProxyModel( parent ) + QSortFilterProxyModel( parent ) { - QString dataRegExp = QString("(%1|%2|%3|%4|%5|%6|%7|%8)"). - arg(VERTEX_TREE).arg(EDGE_TREE).arg(QUAD_TREE).arg(HEXA_TREE). - arg(VERTEX_DIR_TREE).arg(EDGE_DIR_TREE).arg(QUAD_DIR_TREE).arg(HEXA_DIR_TREE); + QString dataRegExp = QString("(%1|%2|%3|%4|%5|%6|%7|%8)"). + arg(VERTEX_TREE).arg(EDGE_TREE).arg(QUAD_TREE).arg(HEXA_TREE). + arg(VERTEX_DIR_TREE).arg(EDGE_DIR_TREE).arg(QUAD_DIR_TREE).arg(HEXA_DIR_TREE); - setFilterRole(HEXA_TREE_ROLE); - setFilterRegExp ( QRegExp(dataRegExp) ); + setFilterRole(HEXA_TREE_ROLE); + setFilterRegExp ( QRegExp(dataRegExp) ); } PatternDataModel::~PatternDataModel() @@ -2588,245 +2776,297 @@ PatternDataModel::~PatternDataModel() HEXA_NS::Document* PatternDataModel::documentImpl() { - HEXA_NS::Document* doc = NULL; - DocumentModel *m = dynamic_cast( sourceModel() ); - if (m) doc = m->documentImpl(); - return doc; + HEXA_NS::Document* doc = NULL; + DocumentModel *m = dynamic_cast( sourceModel() ); + if (m) doc = m->documentImpl(); + return doc; } QString PatternDataModel::documentEntry() { - QString entry; - DocumentModel *m = dynamic_cast( sourceModel() ); - if (m) entry = m->documentEntry(); - return entry; + QString entry; + DocumentModel *m = dynamic_cast( sourceModel() ); + if (m) entry = m->documentEntry(); + return entry; } Qt::ItemFlags PatternDataModel::flags(const QModelIndex &index) const { -// MESSAGE("PatternDataModel::flags() "<< index.data().toString().toStdString() ); - Qt::ItemFlags flags; + Qt::ItemFlags flags; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - flags = m->flags( mapToSource(index) ); - } - return flags; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + flags = m->flags( mapToSource(index) ); + } + return flags; } QVariant PatternDataModel::headerData ( int section, Qt::Orientation orientation, int role ) const { - if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ - return QVariant( "Data" ); - } else { - return QSortFilterProxyModel::headerData ( section, orientation, role ); - } + if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ + return QVariant( "Data" ); + } else { + return QSortFilterProxyModel::headerData ( section, orientation, role ); + } } QStandardItem* PatternDataModel::itemFromIndex ( const QModelIndex & index ) const { - QStandardItem *item = NULL; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - item = m->itemFromIndex( mapToSource(index) ); - } - return item; + QStandardItem *item = NULL; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + item = m->itemFromIndex( mapToSource(index) ); + } + return item; } PatternBuilderModel::PatternBuilderModel( QObject * parent ) : - QSortFilterProxyModel( parent ) + QSortFilterProxyModel( parent ) { - QString builderRegExp =QString("(%1|%2|%3|%4|%5|%6|%7|%8|%9|%10)"). - arg(VECTOR_TREE).arg(CYLINDER_TREE).arg(PIPE_TREE).arg(ELEMENTS_TREE). - arg(CROSSELEMENTS_TREE).arg(VECTOR_DIR_TREE).arg(CYLINDER_DIR_TREE). - arg(PIPE_DIR_TREE).arg(ELEMENTS_DIR_TREE).arg(CROSSELEMENTS_DIR_TREE); + QString builderRegExp =QString("(%1|%2|%3|%4|%5|%6|%7|%8|%9|%10)"). + arg(VECTOR_TREE).arg(CYLINDER_TREE).arg(PIPE_TREE).arg(ELEMENTS_TREE). + arg(CROSSELEMENTS_TREE).arg(VECTOR_DIR_TREE).arg(CYLINDER_DIR_TREE). + arg(PIPE_DIR_TREE).arg(ELEMENTS_DIR_TREE).arg(CROSSELEMENTS_DIR_TREE); - setFilterRole( HEXA_TREE_ROLE ); - setFilterRegExp ( QRegExp(builderRegExp ) ); + setFilterRole( HEXA_TREE_ROLE ); + setFilterRegExp ( QRegExp(builderRegExp ) ); } -PatternBuilderModel::~PatternBuilderModel() +PatternBuilderModel::~PatternBuilderModel() { } Qt::ItemFlags PatternBuilderModel::flags(const QModelIndex &index) const { -// std::cout<<"PatternBuilderModel::flags()"<( sourceModel() ); - if ( m != NULL ){ - flags = m->flags( mapToSource(index) ); - } - return flags; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + flags = m->flags( mapToSource(index) ); + } + return flags; } QVariant PatternBuilderModel::headerData ( int section, Qt::Orientation orientation, int role ) const { - if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ - return QVariant( "Builder" ); - } else { - return QSortFilterProxyModel::headerData ( section, orientation, role ); - } + if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ + return QVariant( "Builder" ); + } else { + return QSortFilterProxyModel::headerData ( section, orientation, role ); + } } QStandardItem* PatternBuilderModel::itemFromIndex ( const QModelIndex & index ) const { - QStandardItem *item = NULL; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - item = m->itemFromIndex( mapToSource(index) ); - } - return item; + QStandardItem *item = NULL; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + item = m->itemFromIndex( mapToSource(index) ); + } + return item; +} + +//==================================================================== +// PatternGeomModel +//==================================================================== +PatternGeomModel::PatternGeomModel( QObject * parent ) : + QSortFilterProxyModel( parent ) +{ + QString builderRegExp =QString("(%1|%2|%3|%4|%5|%6|%7|%8|%9|%10|%11|%12|%13|%14)"). + arg(EXPLICIT_SHAPES_TREE).arg(IMPLICIT_SHAPES_TREE).arg(CLOUD_OF_POINTS_TREE). + arg(GEOMSHAPE_TREE).arg(GEOMPOINT_TREE).arg(GEOMEDGE_TREE).arg(GEOMFACE_TREE). + arg(EXPLICIT_SHAPES_DIR_TREE).arg(IMPLICIT_SHAPES_DIR_TREE).arg(CLOUD_OF_POINTS_DIR_TREE). + arg(GEOMSHAPE_DIR_TREE).arg(GEOMPOINT_DIR_TREE).arg(GEOMEDGE_DIR_TREE).arg(GEOMFACE_DIR_TREE); + + setFilterRole( HEXA_TREE_ROLE ); + setFilterRegExp ( QRegExp(builderRegExp ) ); +} + +PatternGeomModel::~PatternGeomModel() +{ +} + +Qt::ItemFlags PatternGeomModel::flags(const QModelIndex &index) const +{ + Qt::ItemFlags flags; + + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + flags = m->flags( mapToSource(index) ); + } + return flags; +} + +QVariant PatternGeomModel::headerData ( int section, Qt::Orientation orientation, int role ) const +{ + if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ + return QVariant( "Geometry" ); + } else { + return QSortFilterProxyModel::headerData ( section, orientation, role ); + } } +QStandardItem* PatternGeomModel::itemFromIndex ( const QModelIndex & index ) const +{ + QStandardItem *item = NULL; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + item = m->itemFromIndex( mapToSource(index) ); + } + return item; +} +//============================================================== + + + AssociationsModel::AssociationsModel( QObject * parent ) : - QSortFilterProxyModel( parent ) + QSortFilterProxyModel( parent ) { - QString assocRegExp;// =QString("(%1|%2)").arg(GROUP_TREE).arg(GROUP_DIR_TREE); CS_TODO + QString assocRegExp;// =QString("(%1|%2)").arg(GROUP_TREE).arg(GROUP_DIR_TREE); CS_TODO - setFilterRole( HEXA_TREE_ROLE ); - setFilterRegExp ( QRegExp(assocRegExp) ); + setFilterRole( HEXA_TREE_ROLE ); + setFilterRegExp ( QRegExp(assocRegExp) ); } -AssociationsModel::~AssociationsModel() +AssociationsModel::~AssociationsModel() { } Qt::ItemFlags AssociationsModel::flags(const QModelIndex &index) const { - Qt::ItemFlags flags; + Qt::ItemFlags flags; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - flags = m->flags( mapToSource(index) ); - } - return flags; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + flags = m->flags( mapToSource(index) ); + } + return flags; } QVariant AssociationsModel::headerData ( int section, Qt::Orientation orientation, int role ) const { - if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ - return QVariant( "Associations" ); - } else { - return QSortFilterProxyModel::headerData ( section, orientation, role ); - } + if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ + return QVariant( "Associations" ); + } else { + return QSortFilterProxyModel::headerData ( section, orientation, role ); + } } QStandardItem* AssociationsModel::itemFromIndex ( const QModelIndex & index ) const { - QStandardItem *item = NULL; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - item = m->itemFromIndex( mapToSource(index) ); - } - return item; + QStandardItem *item = NULL; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + item = m->itemFromIndex( mapToSource(index) ); + } + return item; } GroupsModel::GroupsModel( QObject * parent ) : - QSortFilterProxyModel( parent ) + QSortFilterProxyModel( parent ) { - QString groupsRegExp =QString("(%1|%2)").arg(GROUP_TREE).arg(GROUP_DIR_TREE); + QString groupsRegExp =QString("(%1|%2)").arg(GROUP_TREE).arg(GROUP_DIR_TREE); - setFilterRole( HEXA_TREE_ROLE ); - setFilterRegExp ( QRegExp(groupsRegExp ) ); + setFilterRole( HEXA_TREE_ROLE ); + setFilterRegExp ( QRegExp(groupsRegExp ) ); } -GroupsModel::~GroupsModel() +GroupsModel::~GroupsModel() { } Qt::ItemFlags GroupsModel::flags(const QModelIndex &index) const { - Qt::ItemFlags flags; + Qt::ItemFlags flags; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - flags = m->flags( mapToSource(index) ); - } - return flags; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + flags = m->flags( mapToSource(index) ); + } + return flags; } QVariant GroupsModel::headerData ( int section, Qt::Orientation orientation, int role ) const { - if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ - return QVariant( "Groups" ); - } else { - return QSortFilterProxyModel::headerData ( section, orientation, role ); - } + if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ + return QVariant( "Groups" ); + } else { + return QSortFilterProxyModel::headerData ( section, orientation, role ); + } } QStandardItem* GroupsModel::itemFromIndex ( const QModelIndex & index ) const { - QStandardItem *item = NULL; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - item = m->itemFromIndex( mapToSource(index) ); - } - return item; + QStandardItem *item = NULL; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + item = m->itemFromIndex( mapToSource(index) ); + } + return item; } QModelIndexList GroupsModel::getGroupElements( const QModelIndex& iGroup, DocumentModel::Group& kind ) const { - QModelIndexList elements; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - elements = m->getGroupElements( mapToSource(iGroup), kind ); - } - return elements; + QModelIndexList elements; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + elements = m->getGroupElements( mapToSource(iGroup), kind ); + } + return elements; } MeshModel::MeshModel( QObject * parent ) : - QSortFilterProxyModel( parent ) + QSortFilterProxyModel( parent ) { - QString meshRegExp =QString("(%1|%2|%3|%4)").arg(LAW_TREE).arg(LAW_DIR_TREE) .arg(PROPAGATION_TREE).arg(PROPAGATION_DIR_TREE); + QString meshRegExp =QString("(%1|%2|%3|%4)").arg(LAW_TREE).arg(LAW_DIR_TREE) .arg(PROPAGATION_TREE).arg(PROPAGATION_DIR_TREE); - setFilterRole( HEXA_TREE_ROLE ); - setFilterRegExp ( QRegExp(meshRegExp) ); + setFilterRole( HEXA_TREE_ROLE ); + setFilterRegExp ( QRegExp(meshRegExp) ); } -MeshModel::~MeshModel() +MeshModel::~MeshModel() { } Qt::ItemFlags MeshModel::flags(const QModelIndex &index) const { - Qt::ItemFlags flags; + Qt::ItemFlags flags; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - flags = m->flags( mapToSource(index) ); - } - return flags; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + flags = m->flags( mapToSource(index) ); + } + return flags; } QVariant MeshModel::headerData ( int section, Qt::Orientation orientation, int role ) const { - if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ - return QVariant( "Mesh" ); - } else { - return QSortFilterProxyModel::headerData ( section, orientation, role ); - } + if ( section == 0 and orientation == Qt::Horizontal and role == Qt::DisplayRole ){ + return QVariant( "Mesh" ); + } else { + return QSortFilterProxyModel::headerData ( section, orientation, role ); + } } QStandardItem* MeshModel::itemFromIndex ( const QModelIndex & index ) const { - QStandardItem *item = NULL; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - item = m->itemFromIndex( mapToSource(index) ); - } - return item; + QStandardItem *item = NULL; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + item = m->itemFromIndex( mapToSource(index) ); + } + return item; } QModelIndexList MeshModel::getPropagation( const QModelIndex& iPropagation ) const { - QModelIndexList edges; - DocumentModel *m = dynamic_cast( sourceModel() ); - if ( m != NULL ){ - edges = m->getPropagation( mapToSource(iPropagation) ); - } - return edges; + QModelIndexList edges; + DocumentModel *m = dynamic_cast( sourceModel() ); + if ( m != NULL ){ + edges = m->getPropagation( mapToSource(iPropagation) ); + } + return edges; } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx index 20b3227..11c9b75 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentModel.hxx @@ -29,6 +29,7 @@ #include "HEXABLOCKGUI_DocumentItem.hxx" #include "HexDocument.hxx" +#include "HexNewShape.hxx" namespace HEXABLOCK { @@ -38,410 +39,482 @@ namespace HEXABLOCK class DocumentModel : public QStandardItemModel { Q_OBJECT - public: - - // enum EnumGroup { HexaCell, QuadCell, EdgeCell, - // HexaNode, QuadNode, EdgeNode, Vertex_Node}; - typedef HEXA_NS::EnumGroup Group; - typedef HEXA_NS::KindLaw KindLaw; - - struct GeomObj - { - QString name; - QString entry; - QString subid; // sub-shape id - QString brep; - double start; - double end; - }; - - typedef QList GeomObjList; - - DocumentModel( HEXA_NS::Document* doc, const QString& entry, QObject * parent = 0 ); - DocumentModel( int rows, int columns, QObject * parent = 0 ); - - virtual ~DocumentModel(); - - - void setName(const QString& name); - QString getName(); - void load( const QString& xmlFileName ); - void save( const QString& xmlFileName ); - struct GeomObj* convertToGeomObj(GEOM::GeomObjPtr geomObjPtr); - void updateData(); - - void clearAll(); - void clearData(); - void clearBuilder(); - void clearAssociation(); - void clearGroups(); - void clearMesh(); - - void fillData(); - void fillBuilder(); - void fillAssociation(); - void fillGroups(); - void fillMesh(); + public: + + // enum EnumGroup { HexaCell, QuadCell, EdgeCell, + // HexaNode, QuadNode, EdgeNode, Vertex_Node}; + typedef HEXA_NS::EnumGroup Group; + typedef HEXA_NS::KindLaw KindLaw; + + struct GeomObj + { + QString shapeName; + QString name; + QString subid; // sub-shape id + QString brep; + double start; + double end; + }; + + typedef QList GeomObjList; + + DocumentModel( HEXA_NS::Document* doc, const QString& entry, QObject * parent = 0 ); + DocumentModel( int rows, int columns, QObject * parent = 0 ); + + virtual ~DocumentModel(); + + + void setName(const QString& name); + QString getName(); + HEXA_NS::Document* getHexaDocument() const { return _hexaDocument; } + void load( const QString& xmlFileName ); + void load(); //Loads the current document + void save( const QString& xmlFileName ); + struct GeomObj* convertToGeomObj(GEOM::GeomObjPtr geomObjPtr); + void updateData(); + void refresh(); //refresh data + bool isEmpty() const; + + void clearAll(); + void clearData(); + void clearBuilder(); + void clearGeometry(); + void clearAssociation(); + void clearGroups(); + void clearMesh(); + + void fillData(); + void fillBuilder(); + void fillGeometry(); + void fillAssociation(); + void fillGroups(); + void fillMesh(); + + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + + + void allowEdition(); + void disallowEdition(); + + // void setDefaultSelection(); + // void allowSelection(); + void allowDataSelectionOnly(); + void allowVertexSelectionOnly(); + void allowEdgeSelectionOnly(); + void allowQuadSelectionOnly(); + void allowHexaSelectionOnly(); + + void allowVectorSelectionOnly(); + void allowCylinderSelectionOnly(); + void allowPipeSelectionOnly(); + void allowElementsSelectionOnly(); + void allowCrossElementsSelectionOnly(); + + void allowLawSelectionOnly(); + + + HEXA_NS::EltBase* getHexaPtr(const QModelIndex& iElt); + template + T getHexaPtr(QModelIndex iElt) + { + if (iElt.isValid()) + return iElt.data( HEXA_DATA_ROLE ).value< T >(); + + return NULL; + } + + int getNbrElt(HEXA_NS::EnumElt eltType); + int getNbrUsedElt(HEXA_NS::EnumElt eltType); + int getNbrUnusedElt(HEXA_NS::EnumElt eltType); + + //associate a shape to the current document + bool addShape(TopoDS_Shape& forme, QString& shapeName); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; + //returns the geom obj id in the document using its entry + QString getGeomObjName(QString& studyEntry) { + return docShapesName.contains(studyEntry) ? docShapesName[studyEntry] : QString(); + } + + //returns the geom obj entry in the document using its id + QString getGeomObjEntry(QString& shapeName) { + return docShapesEntry.contains(shapeName) ? docShapesEntry[shapeName] : QString(); + } + + //returns the document's shapes entries + QList getShapesEntries() const { return docShapesName.uniqueKeys(); } + //returns the associated geom index to the data index + HEXA_NS::SubShape* getGeomPtr(QString& id) + { + if (!shapeById.contains(id)) return NULL; + return shapeById[id]; + } - void allowEdition(); - void disallowEdition(); + void setGeomObjName(QString& studyEntry, QString& shapeName) {docShapesName[studyEntry] = shapeName;} + void setGeomObjEntry(QString& shapeName, QString& studyEntry) {docShapesEntry[shapeName] = studyEntry;} -// void setDefaultSelection(); -// void allowSelection(); - void allowDataSelectionOnly(); - void allowVertexSelectionOnly(); - void allowEdgeSelectionOnly(); - void allowQuadSelectionOnly(); - void allowHexaSelectionOnly(); + void setName( const QModelIndex& iElt, const QString& name ); + bool clearEltAssociations( const QModelIndex& iElt ); + HEXA_NS::Hexa* getQuadHexa(HEXA_NS::Quad* quad); - void allowVectorSelectionOnly(); - void allowCylinderSelectionOnly(); - void allowPipeSelectionOnly(); - void allowElementsSelectionOnly(); - void allowCrossElementsSelectionOnly(); + // ************ BUILD HEXABLOCK MODEL ************ + QModelIndex addVertex( double x, double y, double z ); - void allowLawSelectionOnly(); + // + QModelIndex addEdgeVertices (const QModelIndex &i_v0, const QModelIndex &i_v1 ); + QModelIndex addEdgeVector( const QModelIndex &i_v, const QModelIndex &i_vec ); + // + QModelIndex addQuadVertices( const QModelIndex &i_v0, const QModelIndex &i_v1, + const QModelIndex &i_v2, const QModelIndex &i_v3 ); + QModelIndex addQuadEdges( const QModelIndex &i_e0, const QModelIndex &i_e1, + const QModelIndex &i_e2, const QModelIndex &i_e3 ); - HEXA_NS::EltBase* getHexaPtr(const QModelIndex& iElt); - template - T getHexaPtr(QModelIndex iElt) - { - if (iElt.isValid()) - return iElt.data( HEXA_DATA_ROLE ).value< T >(); + // + QModelIndex addHexaVertices( const QModelIndex &i_v0, const QModelIndex &i_v1, + const QModelIndex &i_v2, const QModelIndex &i_v3, + const QModelIndex &i_v4, const QModelIndex &i_v5, + const QModelIndex &i_v6, const QModelIndex &i_v7 ); + QModelIndex addHexaQuad( const QModelIndex &i_q0, const QModelIndex &i_q1, const QModelIndex &i_q2, const QModelIndex &i_q3, const QModelIndex &i_q4, const QModelIndex &i_q5 ); - return NULL; - } + QModelIndex addHexaQuads( const QModelIndexList &i_quads ); //NEW HEXA3 - void setName( const QModelIndex& iElt, const QString& name ); - bool clearEltAssociations( const QModelIndex& iElt ); - HEXA_NS::Hexa* getQuadHexa(HEXA_NS::Quad* quad); - // ************ BUILD HEXABLOCK MODEL ************ - QModelIndex addVertex( double x, double y, double z ); + // + QModelIndex addVector( double dx, double dy, double dz ); + QModelIndex addVectorVertices( const QModelIndex &i_v0, const QModelIndex &i_v1 ); - // - QModelIndex addEdgeVertices (const QModelIndex &i_v0, const QModelIndex &i_v1 ); - QModelIndex addEdgeVector( const QModelIndex &i_v, const QModelIndex &i_vec ); + // + QModelIndex addCylinder( const QModelIndex &iv, const QModelIndex &ivec, double r, double h ); - // - QModelIndex addQuadVertices( const QModelIndex &i_v0, const QModelIndex &i_v1, - const QModelIndex &i_v2, const QModelIndex &i_v3 ); - QModelIndex addQuadEdges( const QModelIndex &i_e0, const QModelIndex &i_e1, - const QModelIndex &i_e2, const QModelIndex &i_e3 ); + // + QModelIndex addPipe( const QModelIndex &iv, const QModelIndex &ivec, double ri, double re, double h ); - // - QModelIndex addHexaVertices( const QModelIndex &i_v0, const QModelIndex &i_v1, - const QModelIndex &i_v2, const QModelIndex &i_v3, - const QModelIndex &i_v4, const QModelIndex &i_v5, - const QModelIndex &i_v6, const QModelIndex &i_v7 ); - QModelIndex addHexaQuad( const QModelIndex &i_q0, const QModelIndex &i_q1, const QModelIndex &i_q2, const QModelIndex &i_q3, const QModelIndex &i_q4, const QModelIndex &i_q5 ); - QModelIndex addHexaQuads( const QModelIndexList &i_quads ); //NEW HEXA3 + // + QModelIndex makeCartesian( const QModelIndex& ivex, + const QModelIndex& ivecx, const QModelIndex& ivecy, const QModelIndex& ivecz, + long nx, long ny, long nz); + QModelIndex makeCartesian( const QModelIndex& ivex, + const QModelIndex& ivec, + int nx, int ny, int nz ); - // - QModelIndex addVector( double dx, double dy, double dz ); - QModelIndex addVectorVertices( const QModelIndex &i_v0, const QModelIndex &i_v1 ); + QModelIndex makeCylindrical( const QModelIndex& i_pt, + const QModelIndex& i_vx, const QModelIndex& i_vz, + double dr, double da, double dl, + long nr, long na, long nl, + bool fill = false ); - // - QModelIndex addCylinder( const QModelIndex &iv, const QModelIndex &ivec, double r, double h ); - - // - QModelIndex addPipe( const QModelIndex &iv, const QModelIndex &ivec, double ri, double re, double h ); + QModelIndex makeCylindricals( + const QModelIndex& i_center, const QModelIndex& i_base, const QModelIndex& i_height, + QList< double> i_radius, QList i_angles, QList i_heights, + bool fill = false ); //NEW HEXA3 + QModelIndex makeSpherical( const QModelIndex& i_v, const QModelIndex& i_vec, int nb, double k = 1 ); //CS_TO_DEL - // - QModelIndex makeCartesian( const QModelIndex& ivex, - const QModelIndex& ivecx, const QModelIndex& ivecy, const QModelIndex& ivecz, - long nx, long ny, long nz); + QModelIndex makeSpherical( const QModelIndex& i_center, double rayon, int nb, double k = 1 ); - QModelIndex makeCartesian( const QModelIndex& ivex, - const QModelIndex& ivec, - int nx, int ny, int nz ); + // + QModelIndex makeCylinder( const QModelIndex& cyl, const QModelIndex& vec, + int nr, int na, int nl ); - QModelIndex makeCylindrical( const QModelIndex& i_pt, - const QModelIndex& i_vx, const QModelIndex& i_vz, - double dr, double da, double dl, - long nr, long na, long nl, - bool fill = false ); + // + QModelIndex makePipe( const QModelIndex& pipe, const QModelIndex& vecx, + int nr, int na, int nl ); - QModelIndex makeCylindricals( - const QModelIndex& i_center, const QModelIndex& i_base, const QModelIndex& i_height, - QList< double> i_radius, QList i_angles, QList i_heights, - bool fill = false ); //NEW HEXA3 + // + QModelIndex makeCylinders(const QModelIndex& cyl1, const QModelIndex& cyl2); - QModelIndex makeSpherical( const QModelIndex& i_v, const QModelIndex& i_vec, int nb, double k = 1 ); //CS_TO_DEL + // + QModelIndex makePipes( const QModelIndex& pipe1, const QModelIndex& pipe2 ); - QModelIndex makeSpherical( const QModelIndex& i_center, double rayon, int nb, double k = 1 ); - // - QModelIndex makeCylinder( const QModelIndex& cyl, const QModelIndex& vec, - int nr, int na, int nl ); - // - QModelIndex makePipe( const QModelIndex& pipe, const QModelIndex& vecx, - int nr, int na, int nl ); + QModelIndex makeRind( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz, + double radext, double radint, double radhole, + const QModelIndex& plorig, + int nrad, int nang, int nhaut ); //NEW HEXA3 - // - QModelIndex makeCylinders(const QModelIndex& cyl1, const QModelIndex& cyl2); + QModelIndex makePartRind( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz, + double radext, double radint, double radhole, + const QModelIndex& plorig, double angle, + int nrad, int nang, int nhaut ); //NEW HEXA3 - // - QModelIndex makePipes( const QModelIndex& pipe1, const QModelIndex& pipe2 ); + QModelIndex makeSphere( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz, + double radius, double radhole, + const QModelIndex& plorig, + int nrad, int nang, int nhaut ); //NEW HEXA3 + QModelIndex makePartSphere( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz, + double radius, double radhole, + const QModelIndex& plorig, double angle, + int nrad, int nang, int nhaut ); //NEW HEXA3 - - QModelIndex makeRind( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz, - double radext, double radint, double radhole, - const QModelIndex& plorig, - int nrad, int nang, int nhaut ); //NEW HEXA3 + // ************ EDIT HEXABLOCK MODEL ************ - QModelIndex makePartRind( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz, - double radext, double radint, double radhole, - const QModelIndex& plorig, double angle, - int nrad, int nang, int nhaut ); //NEW HEXA3 + bool updateVertex( const QModelIndex& vertex, double x, double y, double z ); - QModelIndex makeSphere( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz, - double radius, double radhole, - const QModelIndex& plorig, - int nrad, int nang, int nhaut ); //NEW HEXA3 + // + bool removeHexa( const QModelIndex& hexa ); + bool removeConnectedHexa( const QModelIndex& hexa ); - QModelIndex makePartSphere( const QModelIndex& center, const QModelIndex& vecx, const QModelIndex& vecz, - double radius, double radhole, - const QModelIndex& plorig, double angle, - int nrad, int nang, int nhaut ); //NEW HEXA3 - // ************ EDIT HEXABLOCK MODEL ************ + // + QModelIndex prismQuad( const QModelIndex& quad, const QModelIndex& dv, int nb); + QModelIndex prismQuads( const QModelIndexList& quads, const QModelIndex& dv, int nb); + QModelIndex prismQuads( const QModelIndexList& quads, const QModelIndex& dv, std::vector, int nb=0); - bool updateVertex( const QModelIndex& vertex, double x, double y, double z ); + // + QModelIndex joinQuad( const QModelIndex& start_q, const QModelIndex& dest_q, + const QModelIndex& v0, const QModelIndex& v1, + const QModelIndex& v2, const QModelIndex& v3, + int nb ); - // - bool removeHexa( const QModelIndex& hexa ); - bool removeConnectedHexa( const QModelIndex& hexa ); + QModelIndex joinQuads( const QModelIndexList& start_q, const QModelIndex& dest_q, + const QModelIndex& v0, const QModelIndex& v1, + const QModelIndex& v2, const QModelIndex& v3, + int nb ); - // - QModelIndex prismQuad( const QModelIndex& quad, const QModelIndex& dv, int nb); - QModelIndex prismQuads( const QModelIndexList& quads, const QModelIndex& dv, int nb); - QModelIndex prismQuads( const QModelIndexList& quads, const QModelIndex& dv, std::vector, int nb=0); - // - QModelIndex joinQuad( const QModelIndex& start_q, const QModelIndex& dest_q, - const QModelIndex& v0, const QModelIndex& v1, - const QModelIndex& v2, const QModelIndex& v3, - int nb ); + // + bool mergeVertices( const QModelIndex& va, const QModelIndex& vb ); + bool mergeEdges( const QModelIndex& ea, const QModelIndex& eb, + const QModelIndex& v0, const QModelIndex& v1 ); + bool mergeQuads( const QModelIndex& qa, const QModelIndex& qb, + const QModelIndex& v0, const QModelIndex& v1, + const QModelIndex& v2, const QModelIndex& v3 ); + // + QModelIndex disconnectVertex( const QModelIndex& h, const QModelIndex& v ); + QModelIndex disconnectEdge( const QModelIndex& h, const QModelIndex& e ); + QModelIndex disconnectQuad( const QModelIndex& h, const QModelIndex& q ); + QModelIndex disconnectEdges( const QModelIndexList& h, const QModelIndexList& e ); - QModelIndex joinQuads( const QModelIndexList& start_q, const QModelIndex& dest_q, - const QModelIndex& v0, const QModelIndex& v1, - const QModelIndex& v2, const QModelIndex& v3, - int nb ); + // + QModelIndex cutEdge( const QModelIndex &e, int nbcuts ); + // + QModelIndex makeTranslation( const QModelIndex& elts, const QModelIndex& vec ); + QModelIndex makeScale( const QModelIndex& elts, const QModelIndex& v, double k ); - // - bool mergeVertices( const QModelIndex& va, const QModelIndex& vb ); - bool mergeEdges( const QModelIndex& ea, const QModelIndex& eb, - const QModelIndex& v0, const QModelIndex& v1 ); - bool mergeQuads( const QModelIndex& qa, const QModelIndex& qb, - const QModelIndex& v0, const QModelIndex& v1, - const QModelIndex& v2, const QModelIndex& v3 ); + // + QModelIndex makeRotation( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec, double angle ); - // - QModelIndex disconnectVertex( const QModelIndex& h, const QModelIndex& v ); - QModelIndex disconnectEdge( const QModelIndex& h, const QModelIndex& e ); - QModelIndex disconnectQuad( const QModelIndex& h, const QModelIndex& q ); - QModelIndex disconnectEdges( const QModelIndexList& h, const QModelIndexList& e ); + // + QModelIndex makeSymmetryPoint( const QModelIndex& elts, const QModelIndex& v ); + QModelIndex makeSymmetryLine( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec ); + QModelIndex makeSymmetryPlane( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec ); - // - QModelIndex cutEdge( const QModelIndex &e, int nbcuts ); + // + bool performTranslation( const QModelIndex& elts, const QModelIndex& vec ); - // - QModelIndex makeTranslation( const QModelIndex& elts, const QModelIndex& vec ); - QModelIndex makeScale( const QModelIndex& elts, const QModelIndex& v, double k ); + // + bool performScale( const QModelIndex& elts, const QModelIndex& v, double k ); - // - QModelIndex makeRotation( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec, double angle ); + // + bool performRotation( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec, double angle ); - // - QModelIndex makeSymmetryPoint( const QModelIndex& elts, const QModelIndex& v ); - QModelIndex makeSymmetryLine( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec ); - QModelIndex makeSymmetryPlane( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec ); + // + bool performSymmetryPoint( const QModelIndex& elts, const QModelIndex& v ); + bool performSymmetryLine( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec ); + bool performSymmetryPlane( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec ); - // - bool performTranslation( const QModelIndex& elts, const QModelIndex& vec ); - // - bool performScale( const QModelIndex& elts, const QModelIndex& v, double k ); + QModelIndex revolutionQuads( const QModelIndexList& startQuads, const QModelIndex& center, + const QModelIndex& vec_axis, const QList& angles); //NEW HEXA3 - // - bool performRotation( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec, double angle ); + QModelIndex replace( const QModelIndexList& quadsPattern, + const QModelIndex& p1, const QModelIndex& c1, + const QModelIndex& p2, const QModelIndex& c2, + const QModelIndex& p3, const QModelIndex& c3 ); //NEW HEXA3 - // - bool performSymmetryPoint( const QModelIndex& elts, const QModelIndex& v ); - bool performSymmetryLine( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec ); - bool performSymmetryPlane( const QModelIndex& elts, const QModelIndex& v, const QModelIndex& vec ); - QModelIndex revolutionQuads( const QModelIndexList& startQuads, const QModelIndex& center, - const QModelIndex& vec_axis, const QList& angles); //NEW HEXA3 - QModelIndex replace( const QModelIndexList& quadsPattern, - const QModelIndex& p1, const QModelIndex& c1, - const QModelIndex& p2, const QModelIndex& c2, - const QModelIndex& p3, const QModelIndex& c3 ); //NEW HEXA3 + // ************ ASSOCIATION ************ + // elt is Vertex, Edge, Quad +// void addAssociation( const QModelIndex& elt, const GeomObj& assoc ); //perime +// QList getAssociations( const QModelIndex& elt ); //perime + bool setVertexAssociation( const QModelIndex& iVertex, double x, double y, double z); + bool setVertexAssociation(const QModelIndex& iVertex, const QModelIndex& iGeomVertex); + bool addEdgeAssociation(const QModelIndex& iEdge, const QModelIndex& iGeomEdge, double start, double end); + bool addQuadAssociation (const QModelIndex& iQuad, const QModelIndex& iGeomFace); + QMultiMap< QString, int > getAssocShapesIds(const QModelIndex& dataIndex); + QModelIndex getVertexAssociation(const QModelIndex& iVertex); + QList getEdgeAssociations(const QModelIndex& iEdge); + QModelIndexList getQuadAssociations(const QModelIndex& iQuad); + //---------- perimees ------------- + bool associateOpenedLine( const QModelIndexList& edges, + const GeomObjList& assocs, + double pstart, + double pend ); - // ************ ASSOCIATION ************ - // elt is Vertex, Edge, Quad - void addAssociation( const QModelIndex& elt, const GeomObj& assoc ); - QList getAssociations( const QModelIndex& elt ); + bool associateClosedLine( const QModelIndex& vertex, + const QModelIndexList& edges, + const GeomObjList& assocs, + double pstart, + bool inv = false ); + //------------- - bool associateOpenedLine( const QModelIndexList& edges, - const GeomObjList& assocs, - double pstart, - double pend ); + bool associateOpenedLine( const QModelIndexList& edges, + HEXA_NS::NewShapes shapes, + HEXA_NS::IntVector subIds, + double pstart, + double pend ); - bool associateClosedLine( const QModelIndex& vertex, - const QModelIndexList& edges, - const GeomObjList& assocs, - double pstart, - bool inv = false ); + bool associateClosedLine( const QModelIndex& vertex, + const QModelIndexList& edges, + HEXA_NS::NewShapes shapes, + HEXA_NS::IntVector subIds, + double pstart, + bool inv = false ); + void clearAssociation(HEXA_NS::EnumElt& eltType); - // ************ GROUPS ************ - // - QModelIndex addGroup( const QString& name, Group kind ); + // ************ GROUPS ************ - // - bool removeGroup( const QModelIndex& grp ); + // + QModelIndex addGroup( const QString& name, Group kind ); - // - QModelIndexList getGroupElements( const QModelIndex& iGroup, Group& kind) const; + // + bool removeGroup( const QModelIndex& grp ); - // 7.4 Boite: éditer un groupe - void setGroupName( const QModelIndex& grp, const QString& name ); - bool addGroupElement( const QModelIndex& grp, const QModelIndex& elt ); - bool removeGroupElement( const QModelIndex& grp, int nro ); //CS_TODO - bool clearGroupElement( const QModelIndex& grp ); + // + QModelIndexList getGroupElements( const QModelIndex& iGroup, Group& kind) const; + // 7.4 Boite: éditer un groupe + void setGroupName( const QModelIndex& grp, const QString& name ); + bool addGroupElement( const QModelIndex& grp, const QModelIndex& elt ); + bool removeGroupElement( const QModelIndex& grp, int nro ); //CS_TODO + bool clearGroupElement( const QModelIndex& grp ); - // ************ LAWS ************ - // - QModelIndex addLaw( const QString& name, int nbnodes ); + // ************ LAWS ************ -// 8.2 Boite: créer une loi -// class Law -// { -// public: -// int setNodes (int nbre); -// int setCoefficient (double coeff); -// void setKind (KindLaw type); -// } + // + QModelIndex addLaw( const QString& name, int nbnodes ); - bool setLaw( const QModelIndex& ilaw, int nbnodes, double coeff, KindLaw type ); + // 8.2 Boite: créer une loi + // class Law + // { + // public: + // int setNodes (int nbre); + // int setCoefficient (double coeff); + // void setKind (KindLaw type); + // } - // - bool removeLaw( const QModelIndex& law ); + bool setLaw( const QModelIndex& ilaw, int nbnodes, double coeff, KindLaw type ); - // 8.3 Boite: éditer une loi - // (idem création) + // + bool removeLaw( const QModelIndex& law ); -// 9 Discrétisation -// 9.1 Boite: poser une loi de discrétisation sur une propagation -// int setLaw (Law* loi); -// void setWay (bool sens); - bool setPropagation( const QModelIndex& iPropagation, const QModelIndex& iLaw, bool way ); - QModelIndexList getPropagation( const QModelIndex& iPropagation ) const; + // 8.3 Boite: éditer une loi + // (idem création) -// -// 9.1 Boite: éditer -// (idem création) + // 9 Discrétisation + // 9.1 Boite: poser une loi de discrétisation sur une propagation + // int setLaw (Law* loi); + // void setWay (bool sens); + bool setPropagation( const QModelIndex& iPropagation, const QModelIndex& iLaw, bool way ); + QModelIndexList getPropagation( const QModelIndex& iPropagation ) const; + + // + // 9.1 Boite: éditer + // (idem création) // tools HEXA_NS::Document* documentImpl(); QString documentEntry(); -// QModelIndex indexBy( int role, const QString& value ); + // QModelIndex indexBy( int role, const QString& value ); signals: - void patternDataChanged(); - void nameChanged(const QString& name); - - private: - QTemporaryFile *_hexaFile; - HEXA_NS::Document *_hexaDocument; - QString _entry; - - QMap _assocName; // clé: id; valeur: nom - bool _disallowEdition; - - //data - QStandardItem *_vertexDirItem; - QStandardItem *_edgeDirItem; - QStandardItem *_quadDirItem; - QStandardItem *_hexaDirItem; - - //builder - QStandardItem *_vectorDirItem; - QStandardItem *_cylinderDirItem; - QStandardItem *_pipeDirItem; - QStandardItem *_elementsDirItem; - QStandardItem *_crossElementsDirItem; - - - //association - // CS_TODO - - - // groups - QStandardItem *_groupDirItem; - - // law - QStandardItem *_lawDirItem; - QStandardItem *_propagationDirItem; - - - Qt::ItemFlags _vertexItemFlags; - Qt::ItemFlags _edgeItemFlags; - Qt::ItemFlags _quadItemFlags; - Qt::ItemFlags _hexaItemFlags; - - Qt::ItemFlags _vectorItemFlags; - Qt::ItemFlags _cylinderItemFlags; - Qt::ItemFlags _pipeItemFlags; - Qt::ItemFlags _elementsItemFlags; - Qt::ItemFlags _crossElementsItemFlags; - - Qt::ItemFlags _groupItemFlags; - Qt::ItemFlags _lawItemFlags; - Qt::ItemFlags _propagationItemFlags; + void patternDataChanged(); + void nameChanged(const QString& name); - }; + private: + QTemporaryFile *_hexaFile; + HEXA_NS::Document *_hexaDocument; + QString _entry; + + //geom + QMap docShapesEntry; + QMap docShapesName; + QMap shapeById; + + QMap _assocName; // clé: id; valeur: nom + bool _disallowEdition; + + //data + QStandardItem *_vertexDirItem; + QStandardItem *_edgeDirItem; + QStandardItem *_quadDirItem; + QStandardItem *_hexaDirItem; + + //builder + QStandardItem *_vectorDirItem; + QStandardItem *_cylinderDirItem; + QStandardItem *_pipeDirItem; + QStandardItem *_elementsDirItem; + QStandardItem *_crossElementsDirItem; + + //geometry + QStandardItem *_explicitShapesDirItem; + QStandardItem *_implicitShapesDirItem; + QStandardItem *_cloudOfPointsDirItem; + //association + // CS_TODO + + + // groups + QStandardItem *_groupDirItem; + + // law + QStandardItem *_lawDirItem; + QStandardItem *_propagationDirItem; + + + Qt::ItemFlags _vertexItemFlags; + Qt::ItemFlags _edgeItemFlags; + Qt::ItemFlags _quadItemFlags; + Qt::ItemFlags _hexaItemFlags; + + Qt::ItemFlags _vectorItemFlags; + Qt::ItemFlags _cylinderItemFlags; + Qt::ItemFlags _pipeItemFlags; + Qt::ItemFlags _elementsItemFlags; + Qt::ItemFlags _crossElementsItemFlags; + + Qt::ItemFlags _groupItemFlags; + Qt::ItemFlags _lawItemFlags; + Qt::ItemFlags _propagationItemFlags; + + }; + class PatternDataModel : public QSortFilterProxyModel { - public: - PatternDataModel( QObject * parent = 0 ); - virtual ~PatternDataModel(); + public: + PatternDataModel( QObject * parent = 0 ); + virtual ~PatternDataModel(); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; - QStandardItem * itemFromIndex ( const QModelIndex & index ) const; + QStandardItem * itemFromIndex ( const QModelIndex & index ) const; - HEXA_NS::Document* documentImpl(); - QString documentEntry(); + HEXA_NS::Document* documentImpl(); + QString documentEntry(); }; @@ -449,12 +522,24 @@ namespace HEXABLOCK class PatternBuilderModel : public QSortFilterProxyModel { - public: - PatternBuilderModel( QObject * parent = 0 ); - virtual ~PatternBuilderModel(); + public: + PatternBuilderModel( QObject * parent = 0 ); + virtual ~PatternBuilderModel(); + + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; + QStandardItem * itemFromIndex ( const QModelIndex & index ) const; + }; + + class PatternGeomModel : public QSortFilterProxyModel + { + public: + PatternGeomModel( QObject* parent = 0); + virtual ~PatternGeomModel(); virtual Qt::ItemFlags flags(const QModelIndex &index) const; virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; + QStandardItem * itemFromIndex ( const QModelIndex & index ) const; }; @@ -462,42 +547,42 @@ namespace HEXABLOCK class AssociationsModel : public QSortFilterProxyModel { - public: - AssociationsModel( QObject * parent = 0 ); - virtual ~AssociationsModel(); + public: + AssociationsModel( QObject * parent = 0 ); + virtual ~AssociationsModel(); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; - QStandardItem * itemFromIndex ( const QModelIndex & index ) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; + QStandardItem * itemFromIndex ( const QModelIndex & index ) const; }; class GroupsModel : public QSortFilterProxyModel { - public: - GroupsModel( QObject * parent = 0 ); - virtual ~GroupsModel(); + public: + GroupsModel( QObject * parent = 0 ); + virtual ~GroupsModel(); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; - QStandardItem * itemFromIndex ( const QModelIndex & index ) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; + QStandardItem * itemFromIndex ( const QModelIndex & index ) const; - QModelIndexList getGroupElements( const QModelIndex& iGroup, DocumentModel::Group& kind ) const; - }; + QModelIndexList getGroupElements( const QModelIndex& iGroup, DocumentModel::Group& kind ) const; + }; class MeshModel : public QSortFilterProxyModel { - public: - MeshModel( QObject * parent = 0 ); - virtual ~MeshModel(); + public: + MeshModel( QObject * parent = 0 ); + virtual ~MeshModel(); - virtual Qt::ItemFlags flags(const QModelIndex &index) const; - virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; - QStandardItem * itemFromIndex ( const QModelIndex & index ) const; + virtual Qt::ItemFlags flags(const QModelIndex &index) const; + virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const; + QStandardItem * itemFromIndex ( const QModelIndex & index ) const; - QModelIndexList getPropagation( const QModelIndex& iPropagation ) const; + QModelIndexList getPropagation( const QModelIndex& iPropagation ) const; }; diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx index 27203c1..01decf1 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.cxx @@ -19,9 +19,10 @@ #include #include "HEXABLOCKGUI_DocumentPanel.hxx" -#include "HEXABLOCKGUI_DocumentGraphicView.hxx" +#include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" +#include "HEXABLOCKGUI_OccGraphicView.hxx" #include "HEXABLOCKGUI_SalomeTools.hxx" -#include "HEXABLOCKGUI.hxx" +//#include "HEXABLOCKGUI.hxx" #include @@ -36,7 +37,6 @@ #include #include -#include #include // #include @@ -92,229 +92,294 @@ Q_DECLARE_METATYPE(TopAbs_ShapeEnum); //General SpinBox Delegate class HexaDoubleSpinBoxDelegate : public QStyledItemDelegate { public: - HexaDoubleSpinBoxDelegate(QObject *parent=0) : QStyledItemDelegate (parent){} - - QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const{ - QDoubleSpinBox *sb = new QDoubleSpinBox( parent ); - sb->setDecimals(NB_DECIMALS); - return sb; - } + HexaDoubleSpinBoxDelegate(QObject *parent=0) : QStyledItemDelegate (parent){} + + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, + const QModelIndex &index) const{ + QDoubleSpinBox *sb = new QDoubleSpinBox( parent ); + sb->setDecimals(NB_DECIMALS); + return sb; + } }; //Angle SpinBox Delegate class HexaAngleDoubleSpinBoxDelegate : public QStyledItemDelegate { public: - HexaAngleDoubleSpinBoxDelegate(QObject *parent=0) : QStyledItemDelegate (parent){} - - QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const{ - QDoubleSpinBox *sb = new QDoubleSpinBox( parent ); - sb->setMinimum(SPINBOX_POSITIVE_DOUBLE_MIN); - sb->setMaximum(SPINBOX_ANGLE_MAX); - sb->setDecimals(NB_DECIMALS); - return sb; - } + HexaAngleDoubleSpinBoxDelegate(QObject *parent=0) : QStyledItemDelegate (parent){} + + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, + const QModelIndex &index) const{ + QDoubleSpinBox *sb = new QDoubleSpinBox( parent ); + sb->setMinimum(SPINBOX_POSITIVE_DOUBLE_MIN); + sb->setMaximum(SPINBOX_ANGLE_MAX); + sb->setDecimals(NB_DECIMALS); + return sb; + } }; //Positive DoubleSpinBox Delegate (for heigth, radius, ...) class HexaPositiveDoubleSpinBoxDelegate : public QStyledItemDelegate { public: - HexaPositiveDoubleSpinBoxDelegate(QObject *parent=0) : QStyledItemDelegate (parent){} - - QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, - const QModelIndex &index) const{ - QDoubleSpinBox *sb = new QDoubleSpinBox( parent ); - sb->setMinimum(SPINBOX_POSITIVE_DOUBLE_MIN); - /////// sb->setMaximum(1000000000000000); //10e15 Abu : Pb en 32 bits - sb->setMaximum(SPINBOX_DOUBLE_MAX); //10e9 - sb->setDecimals(NB_DECIMALS); - return sb; - } + HexaPositiveDoubleSpinBoxDelegate(QObject *parent=0) : QStyledItemDelegate (parent){} + + QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, + const QModelIndex &index) const{ + QDoubleSpinBox *sb = new QDoubleSpinBox( parent ); + sb->setMinimum(SPINBOX_POSITIVE_DOUBLE_MIN); + /////// sb->setMaximum(1000000000000000); //10e15 Abu : Pb en 32 bits + sb->setMaximum(SPINBOX_DOUBLE_MAX); //10e9 + sb->setDecimals(NB_DECIMALS); + return sb; + } }; // ======================================================== Constructeur HexaBaseDialog::HexaBaseDialog( QWidget * parent, Mode editmode, Qt::WindowFlags f ): - // _model(0), - // _selectionModel(0), - QDialog(parent, f), - MyGEOMBase_Helper( dynamic_cast(parent->parent()) ), - _editMode( editmode ), - _documentModel(0), - // _patternDataModel(0), - // _patternBuilderModel(0), - _patternDataSelectionModel(0), - _patternBuilderSelectionModel(0), - _groupsSelectionModel(0), - _meshSelectionModel(0), - _mgr(0), - _vtkVm(0), - _occVm(0), - _currentObj(0), - currentOCCSelectionMode(TopAbs_SHAPE), - _expectedSelection(-1), - _selectionMutex( false ), - // _applyCloseButton(0), - _applyButton(0), - debugEdgeAssoc(false) -{ - MESSAGE("HexaBaseDialog::HexaBaseDialog() dynamic_cast(parent->parent()) =>" << dynamic_cast(parent->parent()) ); - _strHexaWidgetType[VERTEX_TREE] = tr( "VERTEX" ); - _strHexaWidgetType[EDGE_TREE] = tr( "EDGE" ); - _strHexaWidgetType[QUAD_TREE] = tr( "QUAD" ); - _strHexaWidgetType[HEXA_TREE] = tr( "HEXA" ); - - _strHexaWidgetType[VECTOR_TREE] = tr( "VECTOR" ); - _strHexaWidgetType[CYLINDER_TREE] = tr( "CYLINDER" ); - _strHexaWidgetType[PIPE_TREE] = tr( "PIPE" ); - _strHexaWidgetType[ELEMENTS_TREE] = tr( "ELEMENTS" ); - _strHexaWidgetType[CROSSELEMENTS_TREE]= tr( "CROSSELEMENTS" ); - - _strHexaWidgetType[GROUP_TREE] = tr( "GROUP" ); - _strHexaWidgetType[LAW_TREE] = tr( "LAW" ); - _strHexaWidgetType[PROPAGATION_TREE]= tr( "PROPAGATION" ); -} - + QDialog(parent, f), + MyGEOMBase_Helper( dynamic_cast(parent->parent()) ), + _editMode( editmode ), + _currentObj(NULL), + _expectedSelection(-1), + _selectionMutex( false ), + // _applyCloseButton(0), + _applyButton(NULL), + debugEdgeAssoc(false), + autoFocusSwitch(true) +{ + _strHexaWidgetType[VERTEX_TREE] = tr( "VERTEX" ); + _strHexaWidgetType[EDGE_TREE] = tr( "EDGE" ); + _strHexaWidgetType[QUAD_TREE] = tr( "QUAD" ); + _strHexaWidgetType[HEXA_TREE] = tr( "HEXA" ); + + _strHexaWidgetType[VECTOR_TREE] = tr( "VECTOR" ); + _strHexaWidgetType[CYLINDER_TREE] = tr( "CYLINDER" ); + _strHexaWidgetType[PIPE_TREE] = tr( "PIPE" ); + _strHexaWidgetType[ELEMENTS_TREE] = tr( "ELEMENTS" ); + _strHexaWidgetType[CROSSELEMENTS_TREE]= tr( "CROSSELEMENTS" ); + + //geom + _strHexaWidgetType[GEOMSHAPE_TREE] = tr( "GEOMSHAPE" ); + _strHexaWidgetType[GEOMPOINT_TREE] = tr( "GEOMPOINT" ); + _strHexaWidgetType[GEOMEDGE_TREE] = tr( "GEOMEDGE" ); + _strHexaWidgetType[GEOMFACE_TREE] = tr( "GEOMFACE" ); + + + _strHexaWidgetType[GROUP_TREE] = tr( "GROUP" ); + _strHexaWidgetType[LAW_TREE] = tr( "LAW" ); + _strHexaWidgetType[PROPAGATION_TREE]= tr( "PROPAGATION" ); +} + +// ============================================================= getIndexList QModelIndexList HexaBaseDialog::getIndexList(QListWidget* itemsList) { - QModelIndexList iItems; - QModelIndex iItem; - QListWidgetItem* item = NULL; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if (patternDataModel == NULL) return iItems; + QModelIndexList iItems; + QModelIndex iItem; + QListWidgetItem* item = NULL; - unsigned int nbItems = itemsList->count(); - for ( int r = 0; r < nbItems; ++r){ - item = itemsList->item(r); - iItem = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - iItems << iItem; - } - return iItems; -} + const PatternDataModel* patternDataModel = getPatternDataModel(); + if (patternDataModel == NULL || itemsList == NULL) return iItems; + unsigned int nbItems = itemsList->count(); + for ( int r = 0; r < nbItems; ++r){ + item = itemsList->item(r); + iItem = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + iItems << iItem; + } + return iItems; +} // ============================================================= lockSizeToSizeHint void HexaBaseDialog::lockSizeToSizeHint() { - setMaximumHeight(sizeHint().height()); - setMaximumWidth(sizeHint().width()); -// setMinimumHeight(sizeHint().height()); -// setMinimumWidth(sizeHint().width()); + setMaximumHeight(sizeHint().height()); +// setMaximumWidth(sizeHint().width()); + // setMinimumHeight(sizeHint().height()); + // setMinimumWidth(sizeHint().width()); } // ============================================================= unlockSizeModification void HexaBaseDialog::unlockSizeModification() { - setMaximumHeight(MAX_HEIGHT); - setMaximumWidth(MAX_WIDTH); -// setMinimumHeight(MIN_HEIGHT); -// setMinimumWidth(MIN_WIDTH); + setMaximumHeight(MAX_HEIGHT); +// setMaximumWidth(MAX_WIDTH); + // setMinimumHeight(MIN_HEIGHT); + // setMinimumWidth(MIN_WIDTH); } // ============================================================= resetSizeAndShow void HexaBaseDialog::resetSizeAndShow(QDockWidget* parent) { - //force the dialog to fit its contain - lockSizeToSizeHint(); + //force the dialog to fit its contain + lockSizeToSizeHint(); + + //set the dialog in the dockwidget + parent->setWidget(this); + parent->setWindowTitle(windowTitle()); + parent->setVisible(true); + show(); + + unlockSizeModification(); +} + +//unlink the widget from the model +void HexaBaseDialog::modelUnregister(QWidget* widget) +{ + if (widget == NULL) return; + + //Update the line edit + widget->setProperty("QModelIndex", QVariant()); + _index[widget] = QModelIndex(); +} + +// ============================================================= connectDocumentGraphicView +void HexaBaseDialog::connectDocumentGraphicView(VtkDocumentGraphicView* docGView) +{ + if (docGView == NULL) docGView = HEXABLOCKGUI::currentDocGView; + if (docGView == NULL) return; + + disconnectDocumentGraphicView(docGView); //to avoid double connect + + //Connect the graphic view and its model to the dialog box + connect( docGView->getPatternDataSelectionModel(), SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); + connect( docGView->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); + connect( docGView->getPatternGeomSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); + connect( docGView->getGroupsSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); + connect( docGView->getMeshSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ), Qt::UniqueConnection ); +} + +// ============================================================= disconnectDocumentGraphicView +void HexaBaseDialog::disconnectDocumentGraphicView(VtkDocumentGraphicView* docGView) +{ + if (docGView == NULL) docGView = HEXABLOCKGUI::currentDocGView; + if (docGView == NULL) return; + + + //Disconnect graphic view signals form the dialog box + disconnect(docGView->getPatternDataSelectionModel(), SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - //set the dialog in the dockwidget - parent->setWidget(this); - parent->setWindowTitle(windowTitle()); - parent->setVisible(true); - show(); + disconnect(docGView->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - unlockSizeModification(); + disconnect(docGView->getPatternGeomSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); + + disconnect( docGView->getGroupsSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); + + disconnect( docGView->getMeshSelectionModel(), SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); } // ============================================================= onCurrentSelectionChanged void HexaBaseDialog::onCurrentSelectionChanged() { - highlightSelectedAssocs(); + highlightSelectedAssocs(); } +void HexaBaseDialog::clearCurrentObjectFocus() +{ + QWidget* currentWidget = dynamic_cast(_currentObj); + if (currentWidget != NULL) + { + currentWidget->clearFocus(); + _currentObj = NULL; + } +} // ============================================================= setFocusToNextField //Sets focus to the next field of the current object void HexaBaseDialog::setFocusToNextField() { - activateWindow (); - _highlightWidget(_currentObj, Qt::white); - if (!debugEdgeAssoc) focusNextPrevChild(true); + activateWindow (); + + if (!HEXABLOCKGUI::assocInProgress && autoFocusSwitch) + { + _highlightWidget(_currentObj, Qt::white); + focusNextChild (); + } + + if (!_isLineOrListWidget(focusWidget())) clearVTKSelection(); + } // ============================================================== _initButtonBox QGroupBox* HexaBaseDialog::_initButtonBox( Mode editmode ) { - if ( editmode == INFO_MODE ) - return NULL; - - //QDialogButtonBox* buttonBox = new QDialogButtonBox(this); - QGroupBox* buttonBox = new QGroupBox(); - buttonBox->setMinimumWidth(BUTTON_BOX_MIN_WIDTH); - buttonBox->setObjectName(QString::fromUtf8("buttonBox")); - //buttonBox->setOrientation(Qt::Horizontal); - QHBoxLayout* buttonsHLayout = new QHBoxLayout(); - _applyButton = new QPushButton(tr("Apply")); - QPushButton* closeButton = new QPushButton(tr("Close")); - QPushButton* helpButton = new QPushButton(tr("Help")); - //_applyCloseButton = new QPushButton(tr("Apply And Close")); - - //connect( buttonBox, SIGNAL(clicked()), this, SLOT(applyAndClose()) ); - connect( _applyButton, SIGNAL(clicked()), this, SLOT(apply()) ); - connect( closeButton, SIGNAL(clicked()), this, SLOT(close()) ); - connect( helpButton, SIGNAL(clicked()), this, SLOT(onHelpRequested()) ); - - buttonsHLayout->addWidget( _applyButton ); - buttonsHLayout->addWidget( closeButton ); - buttonsHLayout->addStretch(1); - buttonsHLayout->addWidget( helpButton ); - //buttonsHLayout->addButton( _applyCloseButton ); - buttonBox->setLayout(buttonsHLayout); - layout()->addWidget(buttonBox); - buttonBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - return buttonBox; + if ( editmode == INFO_MODE ) + return NULL; + + //QDialogButtonBox* buttonBox = new QDialogButtonBox(this); + QGroupBox* buttonBox = new QGroupBox(); + buttonBox->setMinimumWidth(BUTTON_BOX_MIN_WIDTH); + buttonBox->setObjectName(QString::fromUtf8("buttonBox")); + //buttonBox->setOrientation(Qt::Horizontal); + QHBoxLayout* buttonsHLayout = new QHBoxLayout(); + _applyButton = new QPushButton(tr("Apply")); + QPushButton* closeButton = new QPushButton(tr("Close")); + QPushButton* helpButton = new QPushButton(tr("Help")); + //_applyCloseButton = new QPushButton(tr("Apply And Close")); + + //connect( buttonBox, SIGNAL(clicked()), this, SLOT(applyAndClose()) ); + connect( _applyButton, SIGNAL(clicked()), this, SLOT(apply()), Qt::UniqueConnection ); + connect( closeButton, SIGNAL(clicked()), this, SLOT(close()), Qt::UniqueConnection ); + connect( helpButton, SIGNAL(clicked()), this, SLOT(onHelpRequested()), Qt::UniqueConnection ); + + buttonsHLayout->addWidget( _applyButton ); + buttonsHLayout->addWidget( closeButton ); + buttonsHLayout->addStretch(1); + buttonsHLayout->addWidget( helpButton ); + //buttonsHLayout->addButton( _applyCloseButton ); + buttonBox->setLayout(buttonsHLayout); + layout()->addWidget(buttonBox); + buttonBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); + return buttonBox; } // ============================================================== _initWidget void HexaBaseDialog::_initWidget( Mode editmode ) { - _initInputWidget( editmode ); - _initButtonBox( editmode ); + _initInputWidget( editmode ); + _initButtonBox( editmode ); } - // ============================================================== _initViewManager void HexaBaseDialog::_initViewManager() { - SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); - _mgr = dynamic_cast( anApp->selectionMgr() ); - _occVm = anApp->getViewManager( OCCViewer_Viewer::Type(), true ); - _vtkVm = anApp->getViewManager( SVTK_Viewer::Type(), true ); - SUIT_ViewManager* activeVm = anApp->activeViewManager(); - onWindowActivated ( activeVm ); +// SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); +// if (anApp == NULL) return; +// _mgr = dynamic_cast( anApp->selectionMgr() ); +// _occVm = anApp->getViewManager( OCCViewer_Viewer::Type(), true ); +// _vtkVm = anApp->getViewManager( SVTK_Viewer::Type(), true ); +// SUIT_ViewManager* activeVm = anApp->activeViewManager(); +// onWindowActivated ( activeVm ); } - // ============================================================== apply bool HexaBaseDialog::apply() { - MESSAGE("HexaBaseDialog::apply()"); - QModelIndex iNew; - bool applied = apply(iNew); - if ( applied ){ - // clear all selection - if (_patternDataSelectionModel) _patternDataSelectionModel->clearSelection(); - if (_patternBuilderSelectionModel) _patternBuilderSelectionModel->clearSelection(); - if (_groupsSelectionModel) _groupsSelectionModel->clearSelection(); - if (_meshSelectionModel) _meshSelectionModel->clearSelection(); - // select and highlight in vtk view the result - _selectAndHighlight( iNew ); - // reinitialization -// _currentObj = NULL; - } - return applied; + QModelIndex iNew; + bool applied = apply(iNew); + if ( applied ){ + // clear all selection + if (getPatternDataSelectionModel() != NULL) getPatternDataSelectionModel()->clearSelection(); + if (getPatternBuilderSelectionModel() != NULL) getPatternBuilderSelectionModel()->clearSelection(); + if (getPatternGeomSelectionModel() != NULL) getPatternGeomSelectionModel()->clearSelection(); + if (getGroupsSelectionModel() != NULL) getGroupsSelectionModel()->clearSelection(); + if (getMeshSelectionModel() != NULL) getMeshSelectionModel()->clearSelection(); + // select and highlight in vtk view the result + _selectAndHighlight( iNew ); + // reinitialization + // _currentObj = NULL; + } + return applied; } // ============================================================== accept @@ -329,226 +394,238 @@ bool HexaBaseDialog::apply() void HexaBaseDialog::clearVTKSelection() { - if (HEXABLOCKGUI::currentVtkView == NULL) return; - HEXABLOCKGUI::currentVtkView->unHighlightAll(); - _disallowSelection(); + HEXABLOCKGUI::currentDocGView->clearSelection(); +// setFocus(); + _highlightWidget(_currentObj, Qt::white); +// _disallowSelection(); } void HexaBaseDialog::clearOCCSelection() { - if (HEXABLOCKGUI::selectionMgr() == NULL || HEXABLOCKGUI::currentOccView == NULL) return; - HEXABLOCKGUI::selectionMgr()->clearSelected(); - globalSelection(); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_SHAPE); + if (HEXABLOCKGUI::currentOccGView != NULL) + HEXABLOCKGUI::currentOccGView->clearSelection(); } // ============================================================== close void HexaBaseDialog::close() { -// _currentObj = NULL; - //Clear VTK selection - clearVTKSelection(); + //Clear vtk selection +// clearVTKSelection(); + + //reset the data selection pattern (forget all selections of the current context) +// if (getPatternDataSelectionModel() != NULL) +// getPatternDataSelectionModel()->reset(); +// +// if (getPatternGeomSelectionModel() != NULL) +// getPatternGeomSelectionModel()->reset(); - //Clear OCC selection - clearOCCSelection(); + //Clear occ selection +// clearOCCSelection(); - //Close the dialog box - if (parentWidget()) parentWidget()->close(); + //Close the dialog box + if (parentWidget()) parentWidget()->close(); } // ============================================================== onHelpRequested void HexaBaseDialog::onHelpRequested() { - LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() ); - if ( app ) - // app->onHelpContextModule( myGeometryGUI ? app->moduleName( myGeometryGUI->moduleName() ) : QString( "" ), _helpFileName ); - app->onHelpContextModule( "HEXABLOCK", _helpFileName ); + LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() ); + if ( app ) + // app->onHelpContextModule( myGeometryGUI ? app->moduleName( myGeometryGUI->moduleName() ) : QString( "" ), _helpFileName ); + app->onHelpContextModule( "HEXABLOCK", _helpFileName ); - else { - QString platform; + else { + QString platform; #ifdef WIN32 - platform = "winapplication"; + platform = "winapplication"; #else - platform = "application"; + platform = "application"; #endif - SUIT_MessageBox::warning( 0, QObject::tr( "WRN_WARNING" ), - QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). - arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( _helpFileName ), - QObject::tr( "BUT_OK" ) ); - } + SUIT_MessageBox::warning( 0, QObject::tr( "WRN_WARNING" ), + QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( _helpFileName ), + QObject::tr( "BUT_OK" ) ); + } } // ============================================================== highlightSelectedAssocs void HexaBaseDialog::highlightSelectedAssocs() { - if (!_patternDataSelectionModel || !HEXABLOCKGUI::selectionMgr()) return; - HEXABLOCKGUI::selectionMgr()->clearSelected(); + if (getPatternDataSelectionModel() == NULL || + HEXABLOCKGUI::selectionMgr() == NULL || + HEXABLOCKGUI::currentDocGView->getViewWindow() == NULL) return; - //highlight vtk selected elts - QModelIndexList vtkAssocs = getAssocsVTK(); - if (!vtkAssocs.isEmpty()) _patternDataSelectionModel->highlightVTKElts(vtkAssocs); + QMultiMap geomAssocs = getAssocsGEOM(); + QModelIndexList vtkAssocs = getAssocsVTK(); + + //highlight geom selected elts + if (geomAssocs.size() > 0) + { + HEXABLOCKGUI::selectionMgr()->clearSelected(); + HEXABLOCKGUI::currentOccGView->highlight(geomAssocs); + } + + //highlight vtk selected elts + if (!vtkAssocs.isEmpty()) + HEXABLOCKGUI::currentDocGView->highlight(vtkAssocs); +} - //highlight geom selected elts - QMultiMap geomAssocs = getAssocsGEOM(); - if (geomAssocs.size() > 0) _patternDataSelectionModel->_highlightGEOM(geomAssocs); +// ============================================================== refreshHighlight +void HexaBaseDialog::refreshHighlight() +{ + if (HEXABLOCKGUI::selectionMgr() != NULL) + HEXABLOCKGUI::selectionMgr()->clearSelected(); + highlightSelectedAssocs(); } // ============================================================== getObjectViewType -HexaBaseDialog::ViewType HexaBaseDialog::getObjectViewType(QObject* obj) +HEXABLOCKGUI::ViewType HexaBaseDialog::getObjectViewType(QObject* obj) { - if (obj == NULL) return NONE; - QVariant v = obj->property("HexaWidgetType"); - if ( v.isValid() ) return VTK; - v = obj->property("GeomWidgetType"); - if ( v.isValid() ) return OCC; - return NONE; + if (obj == NULL) return HEXABLOCKGUI::UNKNOWN; + QVariant v = obj->property("HexaWidgetType"); + if ( v.isValid() ) return HEXABLOCKGUI::VTK; + v = obj->property("GeomWidgetType"); + if ( v.isValid() ) return HEXABLOCKGUI::OCC; + return HEXABLOCKGUI::UNKNOWN; } // ============================================================== _selectAndHighlight void HexaBaseDialog::_selectAndHighlight( const QModelIndex& i ) { - if ( !i.isValid() ) return; - setProperty("QModelIndex", QVariant::fromValue(i)); - setFocus(); + if ( !i.isValid() ) return; + setProperty("QModelIndex", QVariant::fromValue(i)); + setFocus(); } // ============================================================== _allowSelection void HexaBaseDialog::_allowSelection() { - MESSAGE("HexaBaseDialog::_allowSelection(){"); - if ( _documentModel ){ - _documentModel->disallowEdition(); - } - MESSAGE("}"); + if ( getDocumentModel() ){ + getDocumentModel()->disallowEdition(); + } } // ============================================================== _disallowSelection void HexaBaseDialog::_disallowSelection() { - MESSAGE("HexaBaseDialog::_disallowSelection(){"); - if ( _documentModel ){ - _documentModel->allowEdition(); - } - if ( _patternDataSelectionModel ){ - _patternDataSelectionModel->setAllSelection(); - } - MESSAGE("}"); + if ( getDocumentModel() ){ + getDocumentModel()->allowEdition(); + } + HEXABLOCKGUI::currentDocGView->setAllSelection(); } -void HexaBaseDialog::setOCCSelectionMode(TopAbs_ShapeEnum mode) -{ - if (HEXABLOCKGUI::selectionMgr() != NULL) - { - HEXABLOCKGUI::selectionMgr()->clearSelected(); - globalSelection(); - localSelection(GEOM::GEOM_Object::_nil(), mode); - currentOCCSelectionMode = mode; - } -} // ============================================================== _allowVTKSelection bool HexaBaseDialog::_allowVTKSelection( QObject* obj ) { - MESSAGE("HexaBaseDialog::_allowVTKSelection(){"); - if ( !_patternDataSelectionModel ) return false; - bool isOk = false; - -// MESSAGE("* HEXABLOCKGUI::currentVtkView->raise()"); -// HEXABLOCKGUI::currentVtkView->raise(); -// HEXABLOCKGUI::currentVtkView->setFocus(); - QVariant v = obj->property("HexaWidgetType"); - HexaWidgetType wType = v.value(); - MESSAGE("* HexaWidgetType property is " << wType ); - - switch (wType){ - case VERTEX_TREE: - _patternDataSelectionModel->setVertexSelection(); isOk = true; - break; - case EDGE_TREE: - _patternDataSelectionModel->setEdgeSelection(); isOk = true; - break; - case QUAD_TREE: - _patternDataSelectionModel->setQuadSelection(); isOk = true; - break; - case HEXA_TREE: - _patternDataSelectionModel->setHexaSelection(); isOk = true; - break; - // case VECTOR_TREE: - // case CYLINDER_TREE: - // case PIPE_TREE: - // case ELEMENTS_TREE: - // case CROSSELEMENTS_TREE: //selector = _patternBuilderSelectionModel; - // case GROUP_TREE: //selector = _groupsSelectionModel; - // case LAW_TREE: - // case PROPAGATION_TREE: // selector = _meshSelectionModel; - default : MESSAGE("NOT YET"); - } - MESSAGE("}"); - return isOk; -} - -void HexaBaseDialog::refreshConnects() -{ - hide(); - show(); + bool isOk = false; + + QVariant v = obj->property("HexaWidgetType"); + HexaWidgetType wType = v.value(); + + switch (wType){ + case VERTEX_TREE: + HEXABLOCKGUI::currentDocGView->setVertexSelection(); isOk = true; + break; + case EDGE_TREE: + HEXABLOCKGUI::currentDocGView->setEdgeSelection(); isOk = true; + break; + case QUAD_TREE: + HEXABLOCKGUI::currentDocGView->setQuadSelection(); isOk = true; + break; + case HEXA_TREE: + HEXABLOCKGUI::currentDocGView->setHexaSelection(); isOk = true; + break; + // case VECTOR_TREE: + // case CYLINDER_TREE: + // case PIPE_TREE: + // case ELEMENTS_TREE: + // case CROSSELEMENTS_TREE: //selector = getPatternDataSelectionModel(); + // case GROUP_TREE: //selector = getGroupsSelectionModel(); + // case LAW_TREE: + // case PROPAGATION_TREE: // selector = getMeshSelectionModel(); + default: HEXABLOCKGUI::currentDocGView->setAllSelection(); + } + return isOk; } // ============================================================== _allowOCCSelection bool HexaBaseDialog::_allowOCCSelection( QObject* obj ) { - MESSAGE("HexaBaseDialog::_allowOCCCSelection(){"); - if ( HEXABLOCKGUI::currentOccView == NULL) return false; + QVariant v = obj->property("GeomWidgetType"); + GeomWidgetType wType = v.value(); + HEXABLOCKGUI::currentOccGView->setSelectionMode(wType); - QVariant v = obj->property("GeomWidgetType"); - GeomWidgetType wType = v.value(); - setOCCSelectionMode(wType); - return true; + return true; } // ============================================================== _getSelector QItemSelectionModel* HexaBaseDialog::_getSelector( QObject* obj ) { - QItemSelectionModel* selector = NULL; - MESSAGE("HexaBaseDialog::_getSelector(){"); - - QString objectName = obj->objectName(); - QString className = obj->metaObject()->className(); - MESSAGE("* obj->objectName() is "<< objectName.toStdString() ); //toStdString() - MESSAGE("* obj->metaObject()->className() is "<< className.toStdString() ); - - HexaWidgetType wtype; - QVariant v = obj->property("HexaWidgetType"); - if ( !v.isValid() ) { - MESSAGE("* no HexaWidgetType property"); - return NULL; - } - - wtype = v.value(); - MESSAGE("* HexaWidgetType property is " << wtype); - - switch (wtype){ - case VERTEX_TREE: - case EDGE_TREE: - case QUAD_TREE: - case HEXA_TREE: selector = _patternDataSelectionModel; break; - case VECTOR_TREE: - case CYLINDER_TREE: - case PIPE_TREE: - case ELEMENTS_TREE: - case CROSSELEMENTS_TREE: selector = _patternBuilderSelectionModel; break; - case GROUP_TREE: selector = _groupsSelectionModel; break; - case LAW_TREE: - case PROPAGATION_TREE: selector = _meshSelectionModel; break; - default : MESSAGE("NOT YET"); - } - MESSAGE("}"); - return selector; + QItemSelectionModel* selector = NULL; + + QString objectName = obj->objectName(); + QString className = obj->metaObject()->className(); + + HexaWidgetType wtype; + QVariant v = obj->property("HexaWidgetType"); + if ( !v.isValid() ) { + return NULL; + } + + wtype = v.value(); + + switch (wtype){ + case VERTEX_TREE: + case EDGE_TREE: + case QUAD_TREE: + case HEXA_TREE: selector = getPatternDataSelectionModel(); break; + case VECTOR_TREE: + case CYLINDER_TREE: + case PIPE_TREE: + case ELEMENTS_TREE: + case CROSSELEMENTS_TREE: selector = getPatternBuilderSelectionModel(); break; + case GEOMPOINT_TREE: + case GEOMEDGE_TREE: + case GEOMFACE_TREE: selector = getPatternGeomSelectionModel(); break; + case GROUP_TREE: selector = getGroupsSelectionModel(); break; + case LAW_TREE: + case PROPAGATION_TREE: selector = getMeshSelectionModel(); break; + default : ; + } + return selector; +} + +DocumentModel::GeomObj* HexaBaseDialog::getGeomObj(const QModelIndex& index) +{ + HEXA_NS::NewShape* aSh = getDocumentModel()->getHexaPtr(index); + DocumentModel::GeomObj* geomObj = NULL; + if (aSh != NULL) + { + geomObj = new DocumentModel::GeomObj; + geomObj->shapeName = aSh->getName(); + geomObj->subid = QString::number(-1); + } + else + { + HEXA_NS::EltBase* aSShElt = getDocumentModel()->getHexaPtr(index); + HEXA_NS::SubShape* aSSh = dynamic_cast(aSShElt); + if (aSSh != NULL) + { + geomObj = new DocumentModel::GeomObj; + QString shapeName; + if (aSSh->getParentShape() != NULL) + shapeName = aSSh->getParentShape()->getName(); + geomObj->shapeName = shapeName; + geomObj->subid = QString::number(aSSh->getIdent()); + } + } + return geomObj; } - // ============================================================== _onSelectionChanged /* * Puts elements selected in the model (treeview) in the corresponding @@ -556,40 +633,45 @@ QItemSelectionModel* HexaBaseDialog::_getSelector( QObject* obj ) */ bool HexaBaseDialog::_onSelectionChanged( const QItemSelection& sel, QLineEdit* le ) { - MESSAGE("HexaBaseDialog::_onSelectionChanged(const QItemSelection& sel, QLineEdit* le)"); - MESSAGE("* le is "<< le->objectName().toStdString() ); - QModelIndexList l = sel.indexes(); - if ( l.count() == 0 ) return false; - - //type from selection (first) - QModelIndex selected = l[0]; - int selType = selected.data(HEXA_TREE_ROLE).toInt(); - - //type of widget - QVariant v = le->property("HexaWidgetType"); - if ( !v.isValid() ) return false; - HexaWidgetType wType = v.value(); - - // check selection compatibility between selection and widget - if ( selType != wType ){ - MESSAGE("* bad selection : " << selType << " is not " << wType ); - SUIT_MessageBox::information( 0, - tr("HEXA_INFO"), - tr("%1: Bad type selected\nPlease select a %2.").arg(windowTitle()).arg(_strHexaWidgetType[wType])); - return false; - } - - //fill the lineEdit if selection is OK - le->setText( selected.data().toString() );// namee - le->setProperty("QModelIndex", QVariant::fromValue(selected) ); - _index[le] = selected; - - QLineEdit* lineEdit = dynamic_cast(_currentObj); - if (selected.isValid() && lineEdit != NULL) - setFocusToNextField(); - - MESSAGE("}"); - return true; + QModelIndexList l = sel.indexes(); + if ( l.count() == 0 ) return false; + + //type from selection (first) + QModelIndex selected = l[0]; + int selType = selected.data(HEXA_TREE_ROLE).toInt(); + + //type of widget + QVariant v = le->property("HexaWidgetType"); + if ( !v.isValid() ) return false; + HexaWidgetType wType = v.value(); + + // check selection compatibility between selection and widget + if ( selType != wType ){ + SUIT_MessageBox::information( 0, + tr("HEXA_INFO"), + tr("%1: Bad type selected\nPlease select a %2.").arg(windowTitle()).arg(_strHexaWidgetType[wType])); + return false; + } + if (le->property("GeomWidgetType").isValid()) + { + DocumentModel::GeomObj* geomObj = getGeomObj(selected); + if (geomObj != NULL) + { + le->setProperty("GeomObj", QVariant::fromValue(*geomObj)); + setCurrentGeomObj(geomObj); + } + } + + //fill the lineEdit if selection is OK + le->setText( selected.data().toString() );// namee + le->setProperty("QModelIndex", QVariant::fromValue(selected) ); + _index[le] = selected; + + QLineEdit* lineEdit = dynamic_cast(_currentObj); + if (selected.isValid() && lineEdit != NULL) + setFocusToNextField(); + + return true; } // ============================================================== _onSelectionChanged @@ -599,45 +681,47 @@ bool HexaBaseDialog::_onSelectionChanged( const QItemSelection& sel, QLineEdit* */ bool HexaBaseDialog::_onSelectionChanged( const QItemSelection& sel, QListWidget* lw ) { - MESSAGE("HexaBaseDialog::_onSelectionChanged( const QItemSelection& sel, QListWidget* lw )"); - MESSAGE("* lw is "<< lw->objectName().toStdString() ); - QModelIndexList l = sel.indexes(); - - if ( l.count() == 0 ) return false; - - //type of widget - QVariant v = lw->property("HexaWidgetType"); - if ( !v.isValid() ) return false; - HexaWidgetType wType = v.value(); - - //fill the listWidget - QListWidgetItem* item = NULL; - int selType; - QString selName; - // int maxSize = 8; - foreach( const QModelIndex& isel, l ){ - // if ( lw->count() == maxSize) break; - selType = isel.data(HEXA_TREE_ROLE).toInt(); - if ( selType != wType ){ // check selection compatibility between selection and widget - MESSAGE("* bad selection : " << selType<< " is not " << wType ); - SUIT_MessageBox::information( 0, - tr("HEXA_INFO"), - tr("%1: Bad type selected\nPlease select a %2.").arg(windowTitle()).arg( _strHexaWidgetType[wType]) ); - return false; - } - // add selection to listWidget if selection is OK - selName = isel.data().toString(); - QList twice = lw->findItems( selName, Qt::MatchExactly); - if ( twice.count() == 0 ){ - item = new QListWidgetItem( selName ); - item->setData( LW_QMODELINDEX_ROLE, QVariant::fromValue(isel) ); - item->setData(LW_DATA_ROLE, isel.data(HEXA_DATA_ROLE)); - lw->addItem(item); - updateButtonBox(); - } - } - MESSAGE("}"); - return true; + QModelIndexList l = sel.indexes(); + + if ( l.count() == 0 ) return false; + + //type of widget + QVariant v = lw->property("HexaWidgetType"); + if ( !v.isValid() ) return false; + HexaWidgetType wType = v.value(); + + //fill the listWidget + QListWidgetItem* item = NULL; + int selType; + QString selName; + // int maxSize = 8; + foreach( const QModelIndex& isel, l ){ + // if ( lw->count() == maxSize) break; + selType = isel.data(HEXA_TREE_ROLE).toInt(); + if ( selType != wType ){ // check selection compatibility between selection and widget + SUIT_MessageBox::information( 0, + tr("HEXA_INFO"), + tr("%1: Bad type selected\nPlease select a %2.").arg(windowTitle()).arg( _strHexaWidgetType[wType]) ); + return false; + } + // add selection to listWidget if selection is OK + selName = isel.data().toString(); + QList twice = lw->findItems( selName, Qt::MatchExactly); + if ( twice.count() == 0 ){ + item = new QListWidgetItem( selName ); + item->setData( LW_QMODELINDEX_ROLE, QVariant::fromValue(isel) ); + item->setData(LW_DATA_ROLE, isel.data(HEXA_DATA_ROLE)); + if (lw->property("GeomWidgetType").isValid()) + { + DocumentModel::GeomObj* geomObj = getGeomObj(isel); + if (geomObj != NULL) + item->setData(LW_ASSOC_ROLE, QVariant::fromValue(*geomObj)); + } + lw->addItem(item); + updateButtonBox(); + } + } + return true; } // ============================================================== onSelectionChanged @@ -647,158 +731,105 @@ bool HexaBaseDialog::_onSelectionChanged( const QItemSelection& sel, QListWidget */ void HexaBaseDialog::onSelectionChanged( const QItemSelection& sel, const QItemSelection& unsel ) { - MESSAGE( "HexaBaseDialog::onSelectionChanged(){" ); - QString className = metaObject()->className(); - MESSAGE( "* I am : " << className.toStdString() ); - MESSAGE( "* sender is : " << sender() ); - MESSAGE( "* _patternDataSelectionModel : " << _patternDataSelectionModel ); - MESSAGE( "* _patternBuilderSelectionModel : " << _patternBuilderSelectionModel ); - MESSAGE( "* _groupsSelectionModel : " << _groupsSelectionModel ); - MESSAGE( "* _meshSelectionModel : " << _meshSelectionModel ); - -// highlightSelectedAssocs(); - QItemSelectionModel* selector = dynamic_cast(sender()); - MESSAGE( "* selector : " << selector); - - foreach( const QModelIndex& isel, sel.indexes() ){ - MESSAGE("* selected : " << isel.data().toString().toStdString()); - } - foreach( const QModelIndex& iunsel, unsel.indexes() ){ - MESSAGE("* unselected : " << iunsel.data().toString().toStdString()); - } - - //type of the selected item - QModelIndexList itemsIndexes = sel.indexes(); - if ( itemsIndexes.count() == 0 ) return; - - //type from selection (first) - QModelIndex selected = itemsIndexes[0]; - int selType = selected.data(HEXA_TREE_ROLE).toInt(); - - switch(selType){ - case VERTEX_TREE: - if (currentOCCSelectionMode != TopAbs_VERTEX) - { -// if (HEXABLOCKGUI::currentOccView != NULL) HEXABLOCKGUI::currentOccView->setFocus(); - setOCCSelectionMode(TopAbs_VERTEX); - } - _patternDataSelectionModel->highlightEltsWithAssocs(itemsIndexes); - break; - case EDGE_TREE: - if (currentOCCSelectionMode != TopAbs_EDGE) - { -// if (HEXABLOCKGUI::currentOccView != NULL) HEXABLOCKGUI::currentOccView->setFocus(); - setOCCSelectionMode(TopAbs_EDGE); - } - _patternDataSelectionModel->highlightEltsWithAssocs(itemsIndexes); - break; - case QUAD_TREE: - if (currentOCCSelectionMode != TopAbs_FACE) - { -// if (HEXABLOCKGUI::currentOccView != NULL) HEXABLOCKGUI::currentOccView->setFocus(); - setOCCSelectionMode(TopAbs_FACE); - } - _patternDataSelectionModel->highlightEltsWithAssocs(itemsIndexes); - break; - case HEXA_TREE: - _patternDataSelectionModel->highlightEltsWithAssocs(itemsIndexes); - break; - } - - if ( _selectionMutex ) return; - - - bool selOk = false; - QLineEdit* aLineEdit = NULL; - QListWidget* aListWidget = NULL; - aLineEdit = dynamic_cast(_currentObj); - - if ( aLineEdit){ //fill the lineedit with selection - selOk = _onSelectionChanged( sel, aLineEdit ); - } - aListWidget = dynamic_cast(_currentObj); - if ( aListWidget){ //fill the listWidget with selection - selOk = _onSelectionChanged( sel, aListWidget ); - } - - if ( !selOk && selector && ( aLineEdit || aListWidget ) ){ - selector->clearSelection(); - } - - MESSAGE("}"); + QString className = metaObject()->className(); + + // highlightSelectedAssocs(); + QItemSelectionModel* selector = dynamic_cast(sender()); + + if ( _selectionMutex ) return; + bool selOk = false; + QLineEdit* aLineEdit = NULL; + QListWidget* aListWidget = NULL; + aLineEdit = dynamic_cast(_currentObj); + + if ( aLineEdit){ //fill the lineedit with selection + selOk = _onSelectionChanged( sel, aLineEdit ); + } + aListWidget = dynamic_cast(_currentObj); + if ( aListWidget){ //fill the listWidget with selection + selOk = _onSelectionChanged( sel, aListWidget ); + } + + if ( !selOk && selector && ( aLineEdit || aListWidget ) ){ + selector->clearSelection(); + } } // ============================================================== showEvent void HexaBaseDialog::showEvent( QShowEvent * event ) { - MESSAGE("HexaBaseDialog::showEvent(){"); - QString className = metaObject()->className(); - MESSAGE( "* I am : " << className.toStdString() ); - - - if ( _editMode == INFO_MODE ){ - _documentModel->allowEdition(); - } else { - _documentModel->disallowEdition(); - } - - if ( _patternDataSelectionModel ){ - _patternDataSelectionModel->clearSelection(); - connect( _patternDataSelectionModel, SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - } - if ( _patternBuilderSelectionModel ){ - _patternBuilderSelectionModel->clearSelection(); - connect( _patternBuilderSelectionModel, SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - } - if ( _groupsSelectionModel ){ - _groupsSelectionModel->clearSelection(); - connect( _groupsSelectionModel, SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - } - if ( _meshSelectionModel ){ - _meshSelectionModel->clearSelection(); - connect( _meshSelectionModel, SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - } - - connect( HEXABLOCKGUI::selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(onCurrentSelectionChanged()) ); - connect( _vtkVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); - connect( _occVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); - - QDialog::showEvent ( event ); - MESSAGE("}"); + QString className = metaObject()->className(); + + if (getDocumentModel() == NULL) + { + QDialog::showEvent ( event ); + return; + } + + if ( _editMode == INFO_MODE ){ + getDocumentModel()->allowEdition(); + } else { + getDocumentModel()->disallowEdition(); + } + + //Connect to salome selection signals + if (HEXABLOCKGUI::selectionMgr() != NULL) + { + connect( HEXABLOCKGUI::selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(onCurrentSelectionChanged()), Qt::UniqueConnection ); + } + + //Connect to vtk window activation signals + if (HEXABLOCKGUI::currentDocGView->getViewWindow() != NULL) + { + connect( HEXABLOCKGUI::currentDocGView->getViewWindow()->getViewManager(), SIGNAL( activated(SUIT_ViewManager*) ), + this, SLOT( onWindowActivated(SUIT_ViewManager*) ), Qt::UniqueConnection ); + } + + //connect to occ window activation signals + if (HEXABLOCKGUI::currentOccGView->getViewWindow() != NULL) + { + connect( HEXABLOCKGUI::currentOccGView->getViewWindow()->getViewManager(), + SIGNAL( activated(SUIT_ViewManager*) ), + this, SLOT( onWindowActivated(SUIT_ViewManager*) ), Qt::UniqueConnection ); + } + + //connect model selection signals + connectDocumentGraphicView(); + + QDialog::showEvent ( event ); } // ============================================================== hideEvent void HexaBaseDialog::hideEvent ( QHideEvent * event ) { - MESSAGE("HexaBaseDialog::hideEvent(){"); - QString className = metaObject()->className(); - MESSAGE( "* I am : " << className.toStdString() ); + QString className = metaObject()->className(); + if (getDocumentModel() == NULL) return; + + //Disconnection salome selection signals + if (HEXABLOCKGUI::selectionMgr() != NULL) + disconnect( HEXABLOCKGUI::selectionMgr() , SIGNAL(currentSelectionChanged()), + this, SLOT(onCurrentSelectionChanged()) ); + + //Disconnect vtk window activation signals + if (HEXABLOCKGUI::currentDocGView->getViewWindow() != NULL) + disconnect( HEXABLOCKGUI::currentDocGView->getViewWindow()->getViewManager(), + SIGNAL( activated(SUIT_ViewManager*) ), + this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); + + //Disconnect occ window activation signals + if (HEXABLOCKGUI::currentOccGView->getViewWindow() != NULL) + disconnect( HEXABLOCKGUI::currentOccGView->getViewWindow()->getViewManager(), + SIGNAL( activated(SUIT_ViewManager*) ), + this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); - if ( _patternDataSelectionModel!=NULL ) - disconnect( _patternDataSelectionModel, SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - if ( _patternBuilderSelectionModel!=NULL ) - disconnect( _patternBuilderSelectionModel, SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - if ( _groupsSelectionModel!=NULL ) - disconnect( _groupsSelectionModel, SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - if ( _meshSelectionModel!=NULL) - disconnect( _meshSelectionModel, SIGNAL( selectionChanged( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - disconnect( HEXABLOCKGUI::selectionMgr() , SIGNAL(currentSelectionChanged()), this, SLOT(onCurrentSelectionChanged()) ); - disconnect( _vtkVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); - disconnect( _occVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); + //Disconnect model selection signals + disconnectDocumentGraphicView(); - _documentModel->allowEdition(); + getDocumentModel()->allowEdition(); - QDialog::hideEvent( event ); - MESSAGE("}"); + QDialog::hideEvent( event ); } // ============================================================== updateButtonBox @@ -806,58 +837,64 @@ void HexaBaseDialog::updateButtonBox() { } -// ============================================================== updateButtonBox +// ============================================================== updateName void HexaBaseDialog::updateName() { - if (!_documentModel) return; - if ( !_patternDataSelectionModel ) return; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); + if (!getDocumentModel()) return; + if ( getPatternDataSelectionModel() == NULL ) return; + const PatternDataModel* patternDataModel = getPatternDataModel(); + if (patternDataModel == NULL) return; - QLineEdit* lineEdit = dynamic_cast(sender()); - if (!lineEdit) return; - QString newName = lineEdit->text(); - if ( newName.isEmpty() ) return; + QLineEdit* lineEdit = dynamic_cast(sender()); + if (!lineEdit) return; + QString newName = lineEdit->text(); + if ( newName.isEmpty() ) return; - QVariant v = lineEdit->property("QModelIndex"); - if ( !v.isValid() ) return; + QVariant v = lineEdit->property("QModelIndex"); + if ( !v.isValid() ) return; - QModelIndex index = v.value(); - if ( index.isValid() ) - _documentModel->setName( patternDataModel->mapToSource(index), newName ); + QModelIndex index = v.value(); + if ( index.isValid() ) + getDocumentModel()->setName( patternDataModel->mapToSource(index), newName ); } +// ============================================================== updateDefaultName +void HexaBaseDialog::updateDefaultName(QLineEdit* name_field, HEXA_NS::EnumElt type) +{ + if (getDocumentModel() == NULL || name_field == NULL) return; + HEXA_NS::Document* doc = getDocumentModel()->getHexaDocument(); + if (doc == NULL) return; -// ============================================================== selectElementOfModel + name_field->setText(doc->getNextName(type).c_str()); +} +// ============================================================== selectElementOfModel /*Selects in the model (treeview) elements selected in a listwidget, * or an element in a line edit.*/ void HexaBaseDialog::selectElementOfModel() { - MESSAGE("HexaBaseDialog::selectElementOfModel()"); - if (!_patternDataSelectionModel) return; + if (getPatternDataSelectionModel() == NULL) return; - QListWidget* currentListWidget = dynamic_cast( sender() ); - if ( !currentListWidget ) return; + QListWidget* currentListWidget = dynamic_cast( sender() ); + if ( !currentListWidget ) return; - _selectionMutex = true; + _selectionMutex = true; - QList sel = currentListWidget->selectedItems(); - QModelIndex index; - _patternDataSelectionModel->clearSelection(); - foreach ( QListWidgetItem *item, sel ){ -// index = item->data(LW_QMODELINDEX_ROLE).value(); //unsafe - index = _patternDataSelectionModel->indexBy(HEXA_DATA_ROLE, item->data(LW_DATA_ROLE)); - if ( index.isValid() ) - { - MESSAGE( "* selecting the element : " << index.data().toString().toStdString() ); - _patternDataSelectionModel->select( index, QItemSelectionModel::Select ); - } - } - _selectionMutex = false; + QList sel = currentListWidget->selectedItems(); + QModelIndex index; + getPatternDataSelectionModel()->clearSelection(); + foreach ( QListWidgetItem *item, sel ){ +// index = item->data(LW_QMODELINDEX_ROLE).value(); //unsafe: index can change in the tree + index = getPatternDataSelectionModel()->indexBy(HEXA_DATA_ROLE, item->data(LW_DATA_ROLE)); + if ( index.isValid() ) + { + getPatternDataSelectionModel()->select( index, QItemSelectionModel::Select ); + } + } + _selectionMutex = false; - MESSAGE("}"); } // ============================================================== _isLineOrListWidget @@ -867,11 +904,11 @@ void HexaBaseDialog::selectElementOfModel() */ bool HexaBaseDialog::_isLineOrListWidget(QObject *widget) { - if (widget == NULL) return false; + if (widget == NULL) return false; - QLineEdit *lineEdit = dynamic_cast(widget); - QListWidget *listWidget = dynamic_cast(widget); - return (lineEdit != NULL) || (listWidget != NULL); + QLineEdit *lineEdit = dynamic_cast(widget); + QListWidget *listWidget = dynamic_cast(widget); + return (lineEdit != NULL) || (listWidget != NULL); }//_isLineOrListWidget @@ -882,12 +919,12 @@ bool HexaBaseDialog::_isLineOrListWidget(QObject *widget) */ void HexaBaseDialog::_highlightWidget(QObject *obj, Qt::GlobalColor clr) { - if (!_isLineOrListWidget(obj)) return; + if (!_isLineOrListWidget(obj)) return; - QWidget *widget = dynamic_cast(obj); //sure it's not NULL (_isLineOrListWidget(obj)) - QPalette palette1 = widget->palette(); - palette1.setColor(widget->backgroundRole(), clr); - widget->setPalette(palette1); + QWidget *widget = dynamic_cast(obj); //sure it's not NULL (_isLineOrListWidget(obj)) + QPalette palette1 = widget->palette(); + palette1.setColor(widget->backgroundRole(), clr); + widget->setPalette(palette1); }//_highlightWidget @@ -895,169 +932,153 @@ void HexaBaseDialog::_highlightWidget(QObject *obj, Qt::GlobalColor clr) // ============================================================== _updateCurrentObject void HexaBaseDialog::_updateCurrentObject(QObject* obj) { - _highlightWidget(_currentObj, Qt::white); - _currentObj = obj; - _highlightWidget(obj, Qt::yellow); + _highlightWidget(_currentObj, Qt::white); + _currentObj = obj; + _highlightWidget(obj, Qt::yellow); } - // ============================================================== eventFilter /* * Handles events from the treeview and the dialog boxes. */ bool HexaBaseDialog::eventFilter(QObject *obj, QEvent *event) { -// highlightSelectedAssocs(); - QLineEdit *lineEdit = dynamic_cast(obj); - QListWidget *listWidget = dynamic_cast(obj); - HexaBaseDialog *dialog = dynamic_cast(obj); - - if ( event->type() == QEvent::KeyPress ) - { - if ( ((QKeyEvent*)event)->key() == Qt::Key_Return) - { - setFocusToNextField(); - return true; - } - } - - if ( event->type() == QEvent::FocusOut ){ - QString className = obj->metaObject()->className(); - QString objectName = obj->objectName(); - MESSAGE("QEvent::FocusOut : I am "<< objectName.toStdString() ); - MESSAGE("QEvent::FocusOut : I am "<< className.toStdString() ); - } - - if ( event->type() == QEvent::FocusIn ){ - QString className = obj->metaObject()->className(); - QString objectName = obj->objectName(); - MESSAGE("QEvent::FocusIn : I am "<< objectName.toStdString() ); - MESSAGE("QEvent::FocusIn : I am "<< className.toStdString() ); - - } - else return false; - - - MESSAGE("HexaBaseDialog::eventFilter{"); - MESSAGE("* QEvent::FocusIn"); - - /* ON FOCUS ON A WIDGET*/ - - QVariant v; - QModelIndex index; - - QItemSelectionModel *selector = 0; - - //vtk selection - if (getObjectViewType(obj) == VTK) - _allowVTKSelection( obj ); - - //geom selection - if (getObjectViewType(obj) == OCC) - _allowOCCSelection( obj ); - - //If the widget is a geom line edit highlight its content in the occ view - if (lineEdit != NULL && _patternDataSelectionModel != NULL && - getObjectViewType(obj) == OCC && !lineEdit->text().isEmpty()) - { - //highlight element in the OCC View - QMultiMap geomElts; - DocumentModel::GeomObj geomObj; - QVariant v = lineEdit->property("GeomObj"); - if ( v.isValid() ) - { - geomObj = v.value(); - geomElts.insert( geomObj.entry, geomObj.subid.toInt() ); - } - _patternDataSelectionModel->_highlightGEOM(geomElts); - } - - //Depending of focused widget type, get the right selector for it - selector = _getSelector( obj ); - if ( selector == NULL ) - { - _updateCurrentObject(obj); - return false; - } - - if ( _currentObj != obj && (lineEdit || listWidget) ) - selector->clearSelection(); - - _updateCurrentObject(obj); - - //If there is a current selection fill the widget with it - if ( selector->hasSelection() ){ -// QItemSelection currentSelection = selector->selection(); -// bool selOk = false; -// if ( lineEdit ){ //element can be from lineEdit -// selOk = _onSelectionChanged( currentSelection, lineEdit ); -// } else if ( listWidget ){ -// selOk = _onSelectionChanged( currentSelection, listWidget ); -// } -// if ( !selOk && ( lineEdit || listWidget ) ){ -// selector->clearSelection(); -// } - - } else { //If the widget contains an hexa element, select it in model/view - if ( lineEdit ){ //element can be from lineEdit - MESSAGE("* on QLineEdit"); - v = lineEdit->property("QModelIndex"); - if ( !v.isValid() ) { - //return QObject::eventFilter(obj, event); - return false; - } - index = v.value(); - - _selectionMutex = true; - MESSAGE("* selecting the element : " << index.data().toString().toStdString()); - MESSAGE("* with selector : " << selector); - MESSAGE( "* _patternDataSelectionModel : " << _patternDataSelectionModel ); - MESSAGE( "* _patternBuilderSelectionModel : " << _patternBuilderSelectionModel ); - MESSAGE( "* _groupsSelectionModel : " << _groupsSelectionModel ); - MESSAGE( "* _meshSelectionModel : " << _meshSelectionModel ); - selector->select( index, QItemSelectionModel::Clear ); - selector->select( index, QItemSelectionModel::Select ); - _selectionMutex = false; - } - - if ( dialog ){ //element can be from a dialog box - MESSAGE("* on Dialog"); - v = dialog->property("QModelIndex"); - if ( !v.isValid() ) { - //return QObject::eventFilter(obj, event); - return false; - } - index = v.value(); - _selectionMutex = true; - MESSAGE("* selecting the element : " << index.data().toString().toStdString()); - selector->select( index, QItemSelectionModel::Clear ); - selector->select( index, QItemSelectionModel::Select ); - _selectionMutex = false; - } - - } - MESSAGE("eventFilter}"); - return false; + // highlightSelectedAssocs(); + QLineEdit *lineEdit = dynamic_cast(obj); + QListWidget *listWidget = dynamic_cast(obj); + HexaBaseDialog *dialog = dynamic_cast(obj); + + if ( event->type() == QEvent::KeyPress ) + { + if ( ((QKeyEvent*)event)->key() == Qt::Key_Return) + { + setFocusToNextField(); + return true; + } + } + + if ( event->type() == QEvent::FocusOut ){ + QString className = obj->metaObject()->className(); + QString objectName = obj->objectName(); + } + + if ( event->type() == QEvent::FocusIn ){ + QString className = obj->metaObject()->className(); + QString objectName = obj->objectName(); + + } + else return false; + + + + /* ON FOCUS ON A WIDGET*/ + + QVariant v; + QModelIndex index; + + QItemSelectionModel *selector = 0; + + //vtk selection + if (getObjectViewType(obj) == HEXABLOCKGUI::VTK) + _allowVTKSelection( obj ); + + //geom selection + if (getObjectViewType(obj) == HEXABLOCKGUI::OCC) + _allowOCCSelection( obj ); + + //If the widget is a geom line edit highlight its content in the occ view + if (lineEdit != NULL && getPatternDataSelectionModel() != NULL && + getObjectViewType(obj) == HEXABLOCKGUI::OCC && !lineEdit->text().isEmpty()) + { + //highlight element in the OCC View + QMultiMap geomElts; + DocumentModel::GeomObj geomObj; + QVariant v = lineEdit->property("GeomObj"); + if ( v.isValid() ) + { + geomObj = v.value(); + geomElts.insert( geomObj.shapeName, geomObj.subid.toInt() ); + } + HEXABLOCKGUI::currentOccGView->highlight(geomElts); + } + + //Depending of focused widget type, get the right selector for it + selector = _getSelector( obj ); + if ( selector == NULL ) + { + _updateCurrentObject(obj); + return false; + } + + if ( _currentObj != obj && (lineEdit || listWidget) ) + selector->clearSelection(); + + _updateCurrentObject(obj); + + //If there is a current selection fill the widget with it + if ( selector->hasSelection() ){ + // QItemSelection currentSelection = selector->selection(); + // bool selOk = false; + // if ( lineEdit ){ //element can be from lineEdit + // selOk = _onSelectionChanged( currentSelection, lineEdit ); + // } else if ( listWidget ){ + // selOk = _onSelectionChanged( currentSelection, listWidget ); + // } + // if ( !selOk && ( lineEdit || listWidget ) ){ + // selector->clearSelection(); + // } + + } else { //If the widget contains an hexa element, select it in model/view + if ( lineEdit ){ //element can be from lineEdit + v = lineEdit->property("QModelIndex"); + if ( !v.isValid() ) { + //return QObject::eventFilter(obj, event); + return false; + } + index = v.value(); + + _selectionMutex = true; + selector->select( index, QItemSelectionModel::Clear ); + selector->select( index, QItemSelectionModel::Select ); + _selectionMutex = false; + } + + if ( dialog ){ //element can be from a dialog box + v = dialog->property("QModelIndex"); + if ( !v.isValid() ) { + //return QObject::eventFilter(obj, event); + return false; + } + index = v.value(); + _selectionMutex = true; + selector->select( index, QItemSelectionModel::Clear ); + selector->select( index, QItemSelectionModel::Select ); + _selectionMutex = false; + } + + } + return false; } - // ------------------------- VERTEX ---------------------------------- - // ============================================================== Constructeur VertexDialog::VertexDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f), - _value(0) + HexaBaseDialog(parent, editmode, f), + _value(0) { - _helpFileName = "gui_vertex.html"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( name_le ); + _helpFileName = "gui_vertex.html"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( name_le ); - if ( editmode == NEW_MODE ){ - setWindowTitle( tr("Vertex Construction") ); - } else if ( editmode == UPDATE_MODE ){ - setWindowTitle( tr("Vertex Modification") ); - } + if ( editmode == NEW_MODE ){ + setWindowTitle( tr("Vertex Construction") ); + } else if ( editmode == UPDATE_MODE ){ + setWindowTitle( tr("Vertex Modification") ); + } + else if ( editmode == INFO_MODE){ + setWindowTitle( tr("Vertex Information") ); + } } // ============================================================== Destructeur @@ -1069,100 +1090,115 @@ VertexDialog::~VertexDialog() // ============================================================== _initInputWidget void VertexDialog::_initInputWidget( Mode editmode ) { - x_spb->setRange(VERTEX_COORD_MIN, VERTEX_COORD_MAX); - y_spb->setRange(VERTEX_COORD_MIN, VERTEX_COORD_MAX); - z_spb->setRange(VERTEX_COORD_MIN, VERTEX_COORD_MAX); + x_spb->setRange(VERTEX_COORD_MIN, VERTEX_COORD_MAX); + y_spb->setRange(VERTEX_COORD_MIN, VERTEX_COORD_MAX); + z_spb->setRange(VERTEX_COORD_MIN, VERTEX_COORD_MAX); + +// setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + installEventFilter(this); +// name_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + name_le->installEventFilter(this); - setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - installEventFilter(this); - name_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - name_le->installEventFilter(this); + if (editmode == INFO_MODE) + { + name_le->setReadOnly(true); + x_spb->setReadOnly(true); + y_spb->setReadOnly(true); + z_spb->setReadOnly(true); + } - //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName())); + //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName())); } // ============================================================== clear void VertexDialog::clear() { - // name_le->clear(); + name_le->clear(); + + modelUnregister(this); } // ============================================================== setValue void VertexDialog::setValue(HEXA_NS::Vertex* v) { - MESSAGE("* setValue : " << v); - //0) Name - name_le->setText( v->getName() ); + //0) Name + name_le->setText( v->getName() ); - //1) Value (x,y,z) - x_spb->setValue( v->getX() ); - y_spb->setValue( v->getY() ); - z_spb->setValue( v->getZ() ); + //1) Value (x,y,z) + x_spb->setValue( v->getX() ); + y_spb->setValue( v->getY() ); + z_spb->setValue( v->getZ() ); - MESSAGE("* _patternDataSelectionModel : " << _patternDataSelectionModel ); - if ( _patternDataSelectionModel ){ - QModelIndex iv = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v) ); - MESSAGE("* selecting the element : " << iv.data().toString().toStdString()); + if ( getPatternDataSelectionModel() != NULL ){ + QModelIndex iv = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v) ); - setProperty( "QModelIndex", QVariant::fromValue(iv) ); - name_le->setProperty( "QModelIndex", QVariant::fromValue(iv) ); - } - _value = v; + setProperty( "QModelIndex", QVariant::fromValue(iv) ); + name_le->setProperty( "QModelIndex", QVariant::fromValue(iv) ); + } + _value = v; } // ============================================================== getValue HEXA_NS::Vertex* VertexDialog::getValue() { - return _value; + return _value; } - // ============================================================== apply bool VertexDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - if ( !_documentModel ) return false; - if ( !_patternDataSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return false; - - bool isOk = false; - - QModelIndex iVertex; - double newX = x_spb->value(); - double newY = y_spb->value(); - double newZ = z_spb->value(); - - if ( _editMode == UPDATE_MODE){ - QVariant v = property("QModelIndex"); - if ( v.isValid() ){ - iVertex = patternDataModel->mapToSource( v.value() ); - if ( iVertex.isValid() ) - isOk = _documentModel->updateVertex( iVertex, newX, newY, newZ ); - } - } else if ( _editMode == NEW_MODE){ - iVertex = _documentModel->addVertex( newX, newY, newZ ); - if ( iVertex.isValid() ) - isOk = true; - } - if (!isOk) { - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "VERTEX UPDATE/CONSTRUCTION" ) ); - return false; - } - - QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ - _documentModel->setName( iVertex, newName ); - - // to select/highlight result - result = patternDataModel->mapFromSource(iVertex); - - return isOk; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + if ( !getPatternDataSelectionModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + if ( !patternDataModel ) return false; + + bool isOk = false; + + QModelIndex iVertex; + double newX = x_spb->value(); + double newY = y_spb->value(); + double newZ = z_spb->value(); + + if ( _editMode == UPDATE_MODE){ + QVariant v = property("QModelIndex"); + if ( v.isValid() ){ + iVertex = patternDataModel->mapToSource( v.value() ); + if ( iVertex.isValid() ) + isOk = getDocumentModel()->updateVertex( iVertex, newX, newY, newZ ); + } + } else if ( _editMode == NEW_MODE){ + iVertex = getDocumentModel()->addVertex( newX, newY, newZ ); + if ( iVertex.isValid() ) + { + isOk = true; + } + } + if (!isOk) { + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "VERTEX UPDATE/CONSTRUCTION" ) ); + return false; + } + + QString newName = name_le->text(); + if ( !newName.isEmpty() )/*{*/ + getDocumentModel()->setName( iVertex, newName ); + + //the default name in the dialog box + HEXA_NS::Vertex* v = getDocumentModel()->getHexaPtr(iVertex); + if (v != NULL) + updateDefaultName(name_le, v->getType()); + + // to select/highlight result + result = patternDataModel->mapFromSource(iVertex); + + // updateDialogBoxName(name_le, result); + // const char *defaultName = getDocumentModel()->getHexaPtr(last)->getName(); + return isOk; } @@ -1170,22 +1206,25 @@ bool VertexDialog::apply(QModelIndex& result) // ============================================================== Constructeur EdgeDialog::EdgeDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f), - _value(0) + HexaBaseDialog(parent, editmode, f), + _value(0) { - _helpFileName = "gui_edge.html"; - setupUi( this ); - _initWidget(editmode); + _helpFileName = "gui_edge.html"; + setupUi( this ); + _initWidget(editmode); -// rb0->setFocusProxy( v0_le_rb0 ); -// rb1->setFocusProxy( vex_le_rb1 ); + // rb0->setFocusProxy( v0_le_rb0 ); + // rb1->setFocusProxy( vex_le_rb1 ); - if ( editmode == INFO_MODE ){ - setWindowTitle( tr("Edge Information") ); - rb1->hide(); - } + if ( editmode == INFO_MODE ){ + setWindowTitle( tr("Edge Information") ); + rb1->hide(); + } + else if ( editmode == UPDATE_MODE ){ + setWindowTitle( tr("Edge Modification") ); + } - rb0->click(); + rb0->click(); } @@ -1198,35 +1237,38 @@ EdgeDialog::~EdgeDialog() // ============================================================== _initInputWidget void EdgeDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + installEventFilter(this); - name_le->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - name_le->installEventFilter(this); +// name_le->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + name_le->installEventFilter(this); - v0_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v1_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v0_le_rb0->setValidator( validator ); - v1_le_rb0->setValidator( validator ); - v0_le_rb0->installEventFilter(this); - v1_le_rb0->installEventFilter(this); + v0_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v1_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v0_le_rb0->setValidator( validator ); + v1_le_rb0->setValidator( validator ); + v0_le_rb0->installEventFilter(this); + v1_le_rb0->installEventFilter(this); - vex_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vec_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - vex_le_rb1->setValidator( validator ); - vec_le_rb1->setValidator( validator ); - vex_le_rb1->installEventFilter(this); - vec_le_rb1->installEventFilter(this); + vex_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vec_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + vex_le_rb1->setValidator( validator ); + vec_le_rb1->setValidator( validator ); + vex_le_rb1->installEventFilter(this); + vec_le_rb1->installEventFilter(this); - v0_le_rb0->setReadOnly(true); - v1_le_rb0->setReadOnly(true); - vex_le_rb1->setReadOnly(true); - vec_le_rb1->setReadOnly(true); + v0_le_rb0->setReadOnly(true); + v1_le_rb0->setReadOnly(true); + vex_le_rb1->setReadOnly(true); + vec_le_rb1->setReadOnly(true); - //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName()) ); + if (editmode == INFO_MODE) + name_le->setReadOnly(true); + + //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName()) ); } @@ -1234,11 +1276,21 @@ void EdgeDialog::_initInputWidget( Mode editmode ) // ============================================================== Clear void EdgeDialog::clear() { - name_le->clear(); - v0_le_rb0->clear(); - v1_le_rb0->clear(); - vex_le_rb1->clear(); - vec_le_rb1->clear(); + name_le->clear(); + + v0_le_rb0->clear(); + modelUnregister(v0_le_rb0); + + v1_le_rb0->clear(); + modelUnregister(v1_le_rb0); + + vex_le_rb1->clear(); + modelUnregister(vex_le_rb1); + + vec_le_rb1->clear(); + modelUnregister(vec_le_rb1); + + modelUnregister(this); } @@ -1246,79 +1298,80 @@ void EdgeDialog::clear() // ============================================================== setValue void EdgeDialog::setValue(HEXA_NS::Edge* e) { - HEXA_NS::Vertex* v0 = e->getVertex(0); - HEXA_NS::Vertex* v1 = e->getVertex(1); -// HEXA_NS::EltBase* e0 = e; -// HEXA_NS::EltBase* v0 = e->getVertex(0); -// HEXA_NS::EltBase* v1 = e->getVertex(1); + HEXA_NS::Vertex* v0 = e->getVertex(0); + HEXA_NS::Vertex* v1 = e->getVertex(1); + // HEXA_NS::EltBase* e0 = e; + // HEXA_NS::EltBase* v0 = e->getVertex(0); + // HEXA_NS::EltBase* v1 = e->getVertex(1); - name_le->setText( e->getName() ); - v0_le_rb0->setText( v0->getName() ); - v1_le_rb0->setText( v1->getName() ); + name_le->setText( e->getName() ); + v0_le_rb0->setText( v0->getName() ); + v1_le_rb0->setText( v1->getName() ); - if ( _patternDataSelectionModel ){ - QModelIndex ie = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(e) ); - QModelIndex iv0 = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v0) ); - QModelIndex iv1 = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v1) ); + if ( getPatternDataSelectionModel() ){ + QModelIndex ie = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(e) ); + QModelIndex iv0 = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v0) ); + QModelIndex iv1 = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v1) ); - name_le->setProperty( "QModelIndex", QVariant::fromValue(ie) ); - v0_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv0) ); - v1_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv1) ); - } - _value = e; + name_le->setProperty( "QModelIndex", QVariant::fromValue(ie) ); + v0_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv0) ); + v1_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv1) ); + } + _value = e; } // ============================================================== getValue HEXA_NS::Edge* EdgeDialog::getValue() { - return _value; + return _value; } // ============================================================== apply bool EdgeDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel ) return false; - QModelIndex iEdge; + QModelIndex iEdge; - if ( rb0->isChecked() ){ - QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb0] ); - QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb0] ); - if ( iv0.isValid()&& iv1.isValid() ){ - iEdge = _documentModel->addEdgeVertices( iv0, iv1 ); - } - } else if ( rb1->isChecked() ){ - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); - if ( ivex.isValid() && ivec.isValid() ){ - iEdge = _documentModel->addEdgeVector( ivex, ivec ); - } - } + if ( rb0->isChecked() ){ + QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb0] ); + QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb0] ); + if ( iv0.isValid()&& iv1.isValid() ){ + iEdge = getDocumentModel()->addEdgeVertices( iv0, iv1 ); + } + } else if ( rb1->isChecked() ){ + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); + if ( ivex.isValid() && ivec.isValid() ){ + iEdge = getDocumentModel()->addEdgeVector( ivex, ivec ); + } + } - if ( !iEdge.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT BUILD EDGE" ) ); - return false; - } - _value = iEdge.model()->data(iEdge, HEXA_DATA_ROLE).value(); + if ( !iEdge.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT BUILD EDGE" ) ); + return false; + } + _value = iEdge.model()->data(iEdge, HEXA_DATA_ROLE).value(); - QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ - _documentModel->setName( iEdge, newName ); + QString newName = name_le->text(); + if ( !newName.isEmpty() )/*{*/ + getDocumentModel()->setName( iEdge, newName ); - result = patternDataModel->mapFromSource(iEdge); + //update the default name in the dialog box + if (_value != NULL) + updateDefaultName(name_le, _value->getType()); - return true; + result = patternDataModel->mapFromSource(iEdge); + + return true; } @@ -1326,19 +1379,19 @@ bool EdgeDialog::apply(QModelIndex& result) // ============================================================== Constructeur QuadDialog::QuadDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f), - _value(0) + HexaBaseDialog(parent, editmode, f), + _value(0) { - _helpFileName = "gui_quadrangle.html"; - setupUi( this ); - _initWidget(editmode); -// rb0->setFocusProxy( v0_le_rb0 ); -// rb1->setFocusProxy( e0_le_rb1 ); - rb0->click(); + _helpFileName = "gui_quadrangle.html"; + setupUi( this ); + _initWidget(editmode); + // rb0->setFocusProxy( v0_le_rb0 ); + // rb1->setFocusProxy( e0_le_rb1 ); + rb0->click(); - if ( editmode == INFO_MODE ){ - setWindowTitle( tr("Quad Information") ); - } + if ( editmode == INFO_MODE ){ + setWindowTitle( tr("Quad Information") ); + } } // ============================================================== Destructeur @@ -1349,197 +1402,223 @@ QuadDialog::~QuadDialog() // ============================================================== _initInputWidget void QuadDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); + +// setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + installEventFilter(this); - setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - installEventFilter(this); +// name_le->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + name_le->installEventFilter(this); - name_le->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - name_le->installEventFilter(this); + v0_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v1_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v2_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v3_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v0_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v1_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v2_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v3_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v0_le_rb0->setValidator( validator ); + v1_le_rb0->setValidator( validator ); + v2_le_rb0->setValidator( validator ); + v3_le_rb0->setValidator( validator ); + v0_le_rb0->installEventFilter(this); + v1_le_rb0->installEventFilter(this); + v2_le_rb0->installEventFilter(this); + v3_le_rb0->installEventFilter(this); - v0_le_rb0->setValidator( validator ); - v1_le_rb0->setValidator( validator ); - v2_le_rb0->setValidator( validator ); - v3_le_rb0->setValidator( validator ); - v0_le_rb0->installEventFilter(this); - v1_le_rb0->installEventFilter(this); - v2_le_rb0->installEventFilter(this); - v3_le_rb0->installEventFilter(this); + e0_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + e1_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + e2_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + e3_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - e0_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - e1_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - e2_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - e3_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + e0_le_rb1->setValidator( validator ); + e1_le_rb1->setValidator( validator ); + e2_le_rb1->setValidator( validator ); + e3_le_rb1->setValidator( validator ); - e0_le_rb1->setValidator( validator ); - e1_le_rb1->setValidator( validator ); - e2_le_rb1->setValidator( validator ); - e3_le_rb1->setValidator( validator ); + e0_le_rb1->installEventFilter(this); + e1_le_rb1->installEventFilter(this); + e2_le_rb1->installEventFilter(this); + e3_le_rb1->installEventFilter(this); - e0_le_rb1->installEventFilter(this); - e1_le_rb1->installEventFilter(this); - e2_le_rb1->installEventFilter(this); - e3_le_rb1->installEventFilter(this); + v0_le_rb0->setReadOnly(true); + v1_le_rb0->setReadOnly(true); + v2_le_rb0->setReadOnly(true); + v3_le_rb0->setReadOnly(true); - v0_le_rb0->setReadOnly(true); - v1_le_rb0->setReadOnly(true); - v2_le_rb0->setReadOnly(true); - v3_le_rb0->setReadOnly(true); + e0_le_rb1->setReadOnly(true); + e1_le_rb1->setReadOnly(true); + e2_le_rb1->setReadOnly(true); + e3_le_rb1->setReadOnly(true); - e0_le_rb1->setReadOnly(true); - e1_le_rb1->setReadOnly(true); - e2_le_rb1->setReadOnly(true); - e3_le_rb1->setReadOnly(true); + if (editmode == INFO_MODE) + name_le->setReadOnly(true); - //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName()) ); + //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName()) ); } // ============================================================== clear void QuadDialog::clear() { - v0_le_rb0->clear(); - v1_le_rb0->clear(); - v2_le_rb0->clear(); - v3_le_rb0->clear(); + //Clear the dialog and unregister it from the model + QModelIndex invalidIndex; + + name_le->clear(); + + v0_le_rb0->clear(); + modelUnregister(v0_le_rb0); + + v1_le_rb0->clear(); + modelUnregister(v1_le_rb0); + + v2_le_rb0->clear(); + modelUnregister(v2_le_rb0); - e0_le_rb1->clear(); - e1_le_rb1->clear(); - e2_le_rb1->clear(); - e3_le_rb1->clear(); + v3_le_rb0->clear(); + modelUnregister(v3_le_rb0); + + e0_le_rb1->clear(); + modelUnregister(e0_le_rb1); + + e1_le_rb1->clear(); + modelUnregister(e1_le_rb1); + + e2_le_rb1->clear(); + modelUnregister(e2_le_rb1); + + e3_le_rb1->clear(); + modelUnregister(e3_le_rb1); + + modelUnregister(this); - name_le->clear(); } // ============================================================== setValue void QuadDialog::setValue(HEXA_NS::Quad* q) { - Q_ASSERT( q->countEdge() == 4 ); - Q_ASSERT( q->countVertex() == 4 ); + Q_ASSERT( q->countEdge() == 4 ); + Q_ASSERT( q->countVertex() == 4 ); - //0) Name - name_le->setText( q->getName() ); + //0) Name + name_le->setText( q->getName() ); - //1) Vertices - HEXA_NS::Vertex* v0 = q->getVertex(0); - HEXA_NS::Vertex* v1 = q->getVertex(1); - HEXA_NS::Vertex* v2 = q->getVertex(2); - HEXA_NS::Vertex* v3 = q->getVertex(3); + //1) Vertices + HEXA_NS::Vertex* v0 = q->getVertex(0); + HEXA_NS::Vertex* v1 = q->getVertex(1); + HEXA_NS::Vertex* v2 = q->getVertex(2); + HEXA_NS::Vertex* v3 = q->getVertex(3); - v0_le_rb0->setText( v0->getName() ); - v1_le_rb0->setText( v1->getName() ); - v2_le_rb0->setText( v2->getName() ); - v3_le_rb0->setText( v3->getName() ); + v0_le_rb0->setText( v0->getName() ); + v1_le_rb0->setText( v1->getName() ); + v2_le_rb0->setText( v2->getName() ); + v3_le_rb0->setText( v3->getName() ); - //2) Edges - HEXA_NS::Edge* e0 = q->getEdge(0); - HEXA_NS::Edge* e1 = q->getEdge(1); - HEXA_NS::Edge* e2 = q->getEdge(2); - HEXA_NS::Edge* e3 = q->getEdge(3); + //2) Edges + HEXA_NS::Edge* e0 = q->getEdge(0); + HEXA_NS::Edge* e1 = q->getEdge(1); + HEXA_NS::Edge* e2 = q->getEdge(2); + HEXA_NS::Edge* e3 = q->getEdge(3); - e0_le_rb1->setText( e0->getName() ); - e1_le_rb1->setText( e1->getName() ); - e2_le_rb1->setText( e2->getName() ); - e3_le_rb1->setText( e3->getName() ); + e0_le_rb1->setText( e0->getName() ); + e1_le_rb1->setText( e1->getName() ); + e2_le_rb1->setText( e2->getName() ); + e3_le_rb1->setText( e3->getName() ); - if ( _patternDataSelectionModel ){ - QModelIndex iq = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(q) ); + if ( getPatternDataSelectionModel() ){ + QModelIndex iq = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(q) ); - QModelIndex iv0 = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v0) ); - QModelIndex iv1 = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v1) ); - QModelIndex iv2 = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v2) ); - QModelIndex iv3 = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v3) ); + QModelIndex iv0 = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v0) ); + QModelIndex iv1 = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v1) ); + QModelIndex iv2 = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v2) ); + QModelIndex iv3 = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v3) ); - QModelIndex ie0 = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(e0) ); - QModelIndex ie1 = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(e1) ); - QModelIndex ie2 = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(e2) ); - QModelIndex ie3 = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(e3) ); + QModelIndex ie0 = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(e0) ); + QModelIndex ie1 = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(e1) ); + QModelIndex ie2 = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(e2) ); + QModelIndex ie3 = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(e3) ); - name_le->setProperty( "QModelIndex", QVariant::fromValue(iq) ); + name_le->setProperty( "QModelIndex", QVariant::fromValue(iq) ); - v0_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv0) ); - v1_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv1) ); - v2_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv2) ); - v3_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv3) ); + v0_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv0) ); + v1_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv1) ); + v2_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv2) ); + v3_le_rb0->setProperty( "QModelIndex", QVariant::fromValue(iv3) ); - e0_le_rb1->setProperty( "QModelIndex", QVariant::fromValue(ie0) ); - e1_le_rb1->setProperty( "QModelIndex", QVariant::fromValue(ie1) ); - e2_le_rb1->setProperty( "QModelIndex", QVariant::fromValue(ie2) ); - e3_le_rb1->setProperty( "QModelIndex", QVariant::fromValue(ie3) ); - } - _value = q; + e0_le_rb1->setProperty( "QModelIndex", QVariant::fromValue(ie0) ); + e1_le_rb1->setProperty( "QModelIndex", QVariant::fromValue(ie1) ); + e2_le_rb1->setProperty( "QModelIndex", QVariant::fromValue(ie2) ); + e3_le_rb1->setProperty( "QModelIndex", QVariant::fromValue(ie3) ); + } + _value = q; } // ============================================================== getValue HEXA_NS::Quad* QuadDialog::getValue() { - return _value; + return _value; } // ============================================================== apply bool QuadDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + if ( !patternDataModel ) return false; - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternDataSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return false; + QModelIndex iQuad; - QModelIndex iQuad; + if ( rb0->isChecked() ){ //vertices + QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb0] ); + QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb0] ); + QModelIndex iv2 = patternDataModel->mapToSource( _index[v2_le_rb0] ); + QModelIndex iv3 = patternDataModel->mapToSource( _index[v3_le_rb0] ); - if ( rb0->isChecked() ){ //vertices - QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb0] ); - QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb0] ); - QModelIndex iv2 = patternDataModel->mapToSource( _index[v2_le_rb0] ); - QModelIndex iv3 = patternDataModel->mapToSource( _index[v3_le_rb0] ); + if ( iv0.isValid() + && iv1.isValid() + && iv2.isValid() + && iv3.isValid() ){ + iQuad = getDocumentModel()->addQuadVertices( iv0, iv1, iv2, iv3 ); + } + } else if ( rb1->isChecked() ){ //edges + QModelIndex ie0 = patternDataModel->mapToSource( _index[e0_le_rb1] ); + QModelIndex ie1 = patternDataModel->mapToSource( _index[e1_le_rb1] ); + QModelIndex ie2 = patternDataModel->mapToSource( _index[e2_le_rb1] ); + QModelIndex ie3 = patternDataModel->mapToSource( _index[e3_le_rb1] ); - if ( iv0.isValid() - && iv1.isValid() - && iv2.isValid() - && iv3.isValid() ){ - iQuad = _documentModel->addQuadVertices( iv0, iv1, iv2, iv3 ); - } - } else if ( rb1->isChecked() ){ //edges - QModelIndex ie0 = patternDataModel->mapToSource( _index[e0_le_rb1] ); - QModelIndex ie1 = patternDataModel->mapToSource( _index[e1_le_rb1] ); - QModelIndex ie2 = patternDataModel->mapToSource( _index[e2_le_rb1] ); - QModelIndex ie3 = patternDataModel->mapToSource( _index[e3_le_rb1] ); + if ( ie0.isValid() + && ie1.isValid() + && ie2.isValid() + && ie3.isValid() ){ + iQuad = getDocumentModel()->addQuadEdges( ie0, ie1, ie2, ie3 ); + } + } - if ( ie0.isValid() - && ie1.isValid() - && ie2.isValid() - && ie3.isValid() ){ - iQuad = _documentModel->addQuadEdges( ie0, ie1, ie2, ie3 ); - } - } + if ( !iQuad.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT BUILD QUAD" ) ); + return false; + } + _value = iQuad.model()->data(iQuad, HEXA_DATA_ROLE).value(); - if ( !iQuad.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT BUILD QUAD" ) ); - return false; - } - _value = iQuad.model()->data(iQuad, HEXA_DATA_ROLE).value(); + QString newName = name_le->text(); + if ( !newName.isEmpty() )/*{*/ + getDocumentModel()->setName( iQuad, newName ); - QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ - _documentModel->setName( iQuad, newName ); + //the default name in the dialog box + if (_value != NULL) + updateDefaultName(name_le, _value->getType()); - // to select/highlight result - result = patternDataModel->mapFromSource(iQuad); + // to select/highlight result + result = patternDataModel->mapFromSource(iQuad); - return true; + return true; } @@ -1549,20 +1628,20 @@ bool QuadDialog::apply(QModelIndex& result) // ============================================================== HexaDialog HexaDialog::HexaDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f), - _value(0) +HexaBaseDialog(parent, editmode, f), +_value(0) { - _helpFileName = "gui_hexahedron.html"; - setupUi( this ); - _initWidget(editmode); -// quads_rb->setFocusProxy( quads_lw ); -// vertices_rb->setFocusProxy( vertices_lw ); - quads_rb->click(); - // quads_rb->setFocus(); + _helpFileName = "gui_hexahedron.html"; + setupUi( this ); + _initWidget(editmode); + // quads_rb->setFocusProxy( quads_lw ); + // vertices_rb->setFocusProxy( vertices_lw ); + quads_rb->click(); + // quads_rb->setFocus(); - if ( editmode == INFO_MODE ){ - setWindowTitle( tr("Hexahedron Information") ); - } + if ( editmode == INFO_MODE ){ + setWindowTitle( tr("Hexahedron Information") ); + } } // ============================================================== Destructeur @@ -1574,44 +1653,62 @@ HexaDialog::~HexaDialog() // ============================================================== _initInputWidget void HexaDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); - setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); + installEventFilter(this); - name_le->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); - name_le->installEventFilter(this); +// name_le->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); + name_le->installEventFilter(this); - quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - quads_lw->installEventFilter(this); + quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + quads_lw->installEventFilter(this); - vertices_lw->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vertices_lw->installEventFilter(this); + vertices_lw->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vertices_lw->installEventFilter(this); - if ( editmode != INFO_MODE ) { - // delete item from listwidget - QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); - QShortcut* delVertexShortcut = new QShortcut( QKeySequence(Qt::Key_X), vertices_lw ); - delQuadShortcut->setContext( Qt::WidgetShortcut ); - delVertexShortcut->setContext( Qt::WidgetShortcut ); - connect(delQuadShortcut, SIGNAL(activated()), this, SLOT(deleteQuadItem())); - connect(delVertexShortcut, SIGNAL(activated()), this, SLOT(deleteVertexItem())); - } - // edit name - //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName()) ); - // highlight item on model view (VTK) from listwidget - connect( quads_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()) ); - connect( vertices_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()) ); + if ( editmode != INFO_MODE ) { + // delete item from listwidget + QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); + QShortcut* delVertexShortcut = new QShortcut( QKeySequence(Qt::Key_X), vertices_lw ); + delQuadShortcut->setContext( Qt::WidgetShortcut ); + delVertexShortcut->setContext( Qt::WidgetShortcut ); + connect(delQuadShortcut, SIGNAL(activated()), this, SLOT(deleteQuadItem())); + connect(delVertexShortcut, SIGNAL(activated()), this, SLOT(deleteVertexItem())); + } + // edit name + //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName()) ); + // highlight item on model view (VTK) from listwidget + connect( quads_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection ); + connect( vertices_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection ); + + if ( editmode != INFO_MODE) + { + connect( vertices_rb, SIGNAL(clicked()), vertices_lw, SLOT(setFocus())); + connect( quads_rb, SIGNAL(clicked()), quads_lw, SLOT(setFocus())); + } + + connect( vertices_rb, SIGNAL(clicked()), this, SLOT(refreshHighlight()), Qt::UniqueConnection); + connect( quads_rb, SIGNAL(clicked()), this, SLOT(refreshHighlight()), Qt::UniqueConnection); + + if (editmode == INFO_MODE) + name_le->setReadOnly(true); + } // ============================================================== clear void HexaDialog::clear() { - name_le->clear(); - quads_lw->clear(); - vertices_lw->clear(); + name_le->clear(); + + quads_lw->clear(); + modelUnregister(quads_lw); + + vertices_lw->clear(); + modelUnregister(vertices_lw); + + modelUnregister(this); } // ============================================================== getAssocsVTK @@ -1620,195 +1717,198 @@ void HexaDialog::clear() */ QModelIndexList HexaDialog::getAssocsVTK() { - QModelIndexList assocs; - QModelIndex iQuad, iVertex; - QListWidgetItem* item = NULL; - - if (quads_rb->isChecked()) - { - //ListWidget content - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return assocs; - for ( int r = 0; r < quads_lw->count(); ++r ){ - item = quads_lw->item(r); - iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( iQuad.isValid() ) - assocs << iQuad; - } - return assocs; - } - else if (vertices_rb->isChecked()) - { - //ListWidget content - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return assocs; - for ( int r = 0; r < vertices_lw->count(); ++r ){ - item = vertices_lw->item(r); - iVertex = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( iVertex.isValid() ) - assocs << iVertex; - } - return assocs; - } - else return assocs; + QModelIndexList assocs; + QModelIndex iQuad, iVertex; + QListWidgetItem* item = NULL; + + const PatternDataModel* patternDataModel = getPatternDataModel(); + if (patternDataModel == NULL) return assocs; + if (quads_rb->isChecked()) + { + //ListWidget content + for ( int r = 0; r < quads_lw->count(); ++r ){ + item = quads_lw->item(r); + iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( iQuad.isValid() ) + assocs << iQuad; + } + return assocs; + } + else if (vertices_rb->isChecked()) + { + //ListWidget content + for ( int r = 0; r < vertices_lw->count(); ++r ){ + item = vertices_lw->item(r); + iVertex = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( iVertex.isValid() ) + assocs << iVertex; + } + return assocs; + } + else return assocs; } // ============================================================== updateButtonBox void HexaDialog::updateButtonBox() { - if ( quads_rb->isChecked() ){ // build from quads count() must be between [2,6] - int nbQuads = quads_lw->count(); - //std::cout << "nbQuads => " << nbQuads << std::endl; - if ( nbQuads >= 2 && nbQuads <= 6 ){ - //_applyCloseButton->setEnabled(true); - _applyButton->setEnabled(true); - // _applyCloseButton->setFlat( false ); - // _applyButton->setFlat( false ); - } else { - //_applyCloseButton->setEnabled(false); - _applyButton->setEnabled(false); - // _applyCloseButton->setFlat( true ); - // _applyButton->setFlat( true ); - } - } else if ( vertices_rb->isChecked() ){ // build from vertices count() must be equals to 8 - int nbVertices = vertices_lw->count(); - //std::cout << "nbVertices => " << nbVertices << std::endl; - if ( nbVertices == 8 ){ - //_applyCloseButton->setEnabled(true); - _applyButton->setEnabled(true); - // _applyCloseButton->setFlat( false ); - // _applyButton->setFlat( false ); - } else { - //_applyCloseButton->setEnabled(false); - _applyButton->setEnabled(false); - // _applyCloseButton->setFlat( true ); - // _applyButton->setFlat( true ); - } - } + if ( quads_rb->isChecked() ){ // build from quads count() must be between [2,6] + int nbQuads = quads_lw->count(); + //std::cout << "nbQuads => " << nbQuads << std::endl; + if ( nbQuads >= 2 && nbQuads <= 6 ){ + //_applyCloseButton->setEnabled(true); + _applyButton->setEnabled(true); + // _applyCloseButton->setFlat( false ); + // _applyButton->setFlat( false ); + } else { + //_applyCloseButton->setEnabled(false); + _applyButton->setEnabled(false); + // _applyCloseButton->setFlat( true ); + // _applyButton->setFlat( true ); + } + } else if ( vertices_rb->isChecked() ){ // build from vertices count() must be equals to 8 + int nbVertices = vertices_lw->count(); + //std::cout << "nbVertices => " << nbVertices << std::endl; + if ( nbVertices == 8 ){ + //_applyCloseButton->setEnabled(true); + _applyButton->setEnabled(true); + // _applyCloseButton->setFlat( false ); + // _applyButton->setFlat( false ); + } else { + //_applyCloseButton->setEnabled(false); + _applyButton->setEnabled(false); + // _applyCloseButton->setFlat( true ); + // _applyButton->setFlat( true ); + } + } } // ============================================================== deleteQuadItem void HexaDialog::deleteQuadItem() { - delete quads_lw->currentItem(); - updateButtonBox(); + delete quads_lw->currentItem(); + updateButtonBox(); } // ============================================================== deleteVertexItem void HexaDialog::deleteVertexItem() { - delete vertices_lw->currentItem(); - updateButtonBox(); + delete vertices_lw->currentItem(); + updateButtonBox(); } // ============================================================== _setValueQuads void HexaDialog::_setValueQuads( HEXA_NS::Hexa* h ) { - QListWidgetItem *qItem = NULL; - HEXA_NS::Quad *q = NULL; - QModelIndex qIndex; - - quads_lw->clear(); - for( int i = 0; i <= 5; ++i ){ - q = h->getQuad(i); - qIndex = _patternDataSelectionModel->indexBy( HEXA_ENTRY_ROLE, QString::number(reinterpret_cast(q)) ); - qItem = new QListWidgetItem( q->getName() ); - qItem->setData( LW_QMODELINDEX_ROLE, QVariant::fromValue(qIndex) ); - quads_lw->addItem( qItem ); - } + QListWidgetItem *qItem = NULL; + HEXA_NS::Quad *q = NULL; + QModelIndex qIndex; + if (getPatternDataSelectionModel() == NULL) return; + quads_lw->clear(); + for( int i = 0; i <= 5; ++i ){ + q = h->getQuad(i); + qIndex = getPatternDataSelectionModel()->indexBy( HEXA_ENTRY_ROLE, QString::number(reinterpret_cast(q)) ); + qItem = new QListWidgetItem( q->getName() ); + qItem->setData( LW_QMODELINDEX_ROLE, QVariant::fromValue(qIndex) ); + qItem->setData(LW_DATA_ROLE, qIndex.data(HEXA_DATA_ROLE)); + quads_lw->addItem( qItem ); + } } // ============================================================== _setValueVertices void HexaDialog::_setValueVertices( HEXA_NS::Hexa* h ) { - QListWidgetItem *vItem = NULL; - HEXA_NS::Vertex* v = NULL; - QModelIndex vIndex; - - vertices_lw->clear(); - for( int i = 0; i <= 7; ++i ){ - v = h->getVertex(i); - vIndex = _patternDataSelectionModel->indexBy( HEXA_ENTRY_ROLE, QString::number(reinterpret_cast(v)) ); - vItem = new QListWidgetItem( v->getName() ); - vItem->setData( LW_QMODELINDEX_ROLE, QVariant::fromValue(vIndex) ); - vertices_lw->addItem( vItem ); - } + QListWidgetItem *vItem = NULL; + HEXA_NS::Vertex* v = NULL; + QModelIndex vIndex; + if (getPatternDataSelectionModel() == NULL) return; + vertices_lw->clear(); + for( int i = 0; i <= 7; ++i ){ + v = h->getVertex(i); + vIndex = getPatternDataSelectionModel()->indexBy( HEXA_ENTRY_ROLE, QString::number(reinterpret_cast(v)) ); + vItem = new QListWidgetItem( v->getName() ); + vItem->setData( LW_QMODELINDEX_ROLE, QVariant::fromValue(vIndex) ); + vItem->setData(LW_DATA_ROLE, vIndex.data(HEXA_DATA_ROLE)); + vertices_lw->addItem( vItem ); + } } // ============================================================== setValue void HexaDialog::setValue(HEXA_NS::Hexa* h) { - // 0) name - name_le->setText( h->getName() ); + // 0) name + name_le->setText( h->getName() ); - if ( _patternDataSelectionModel){ - QModelIndex hIndex = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(h) ); - _setValueVertices(h); - _setValueQuads(h); - name_le->setProperty( "QModelIndex", QVariant::fromValue(hIndex) ); - } - _value = h; + if ( getPatternDataSelectionModel()){ + QModelIndex hIndex = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(h) ); + _setValueVertices(h); + _setValueQuads(h); + name_le->setProperty( "QModelIndex", QVariant::fromValue(hIndex) ); + } + _value = h; } // ============================================================== getValue HEXA_NS::Hexa* HexaDialog::getValue() { - return _value; + return _value; } // ============================================================== apply bool HexaDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - SUIT_OverrideCursor wc; - if ( !_documentModel ) return false; - if ( !_patternDataSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return false; + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + if ( !patternDataModel ) return false; - QModelIndex iHexa; + QModelIndex iHexa; - QListWidget* currentLw = NULL; - QListWidgetItem* item = NULL; + QListWidget* currentLw = NULL; + QListWidgetItem* item = NULL; - if ( quads_rb->isChecked() ) - currentLw = dynamic_cast( quads_lw ); - else if ( vertices_rb->isChecked() ) - currentLw = dynamic_cast( vertices_lw ); + if ( quads_rb->isChecked() ) + currentLw = dynamic_cast( quads_lw ); + else if ( vertices_rb->isChecked() ) + currentLw = dynamic_cast( vertices_lw ); - QModelIndex iElt; - QModelIndexList iElts; - for ( int r = 0; r < currentLw->count(); ++r){ - item = currentLw->item(r); - iElt = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( iElt.isValid() ) - iElts << iElt; - } + QModelIndex iElt; + QModelIndexList iElts; + for ( int r = 0; r < currentLw->count(); ++r){ + item = currentLw->item(r); + iElt = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( iElt.isValid() ) + iElts << iElt; + } - if ( quads_rb->isChecked() and (iElts.count()>=2 and iElts.count()<=6) ){ // build from quads iElts.count() should be between [2,6] - iHexa = _documentModel->addHexaQuads( iElts ); - } else if ( vertices_rb->isChecked() and iElts.count()== 8 ){ // build from vertices - iHexa = _documentModel->addHexaVertices( iElts[0], iElts[1], iElts[2], iElts[3], - iElts[4], iElts[5], iElts[6], iElts[7] ); - } + if ( quads_rb->isChecked() and (iElts.count()>=2 and iElts.count()<=6) ){ // build from quads iElts.count() should be between [2,6] + iHexa = getDocumentModel()->addHexaQuads( iElts ); + } else if ( vertices_rb->isChecked() and iElts.count()== 8 ){ // build from vertices + iHexa = getDocumentModel()->addHexaVertices( iElts[0], iElts[1], iElts[2], iElts[3], + iElts[4], iElts[5], iElts[6], iElts[7] ); + } - if ( !iHexa.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT BUILD HEXA" ) ); - return false; - } - _value = iHexa.model()->data(iHexa, HEXA_DATA_ROLE).value(); + if ( !iHexa.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT BUILD HEXA" ) ); + return false; + } + _value = iHexa.model()->data(iHexa, HEXA_DATA_ROLE).value(); - QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ - _documentModel->setName( iHexa, newName ); + QString newName = name_le->text(); + if ( !newName.isEmpty() )/*{*/ + getDocumentModel()->setName( iHexa, newName ); - // to select/highlight result - result = patternDataModel->mapFromSource(iHexa); + //update the default name in the dialog box + if (_value != NULL) + updateDefaultName(name_le, _value->getType()); - return true; + // to select/highlight result + result = patternDataModel->mapFromSource(iHexa); + + return true; } @@ -1817,22 +1917,22 @@ bool HexaDialog::apply(QModelIndex& result) // ============================================================== Constructeur VectorDialog::VectorDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f), - _value(0) + HexaBaseDialog(parent, editmode, f), + _value(0) { - _helpFileName = "gui_vector.html"; - setupUi( this ); - _initWidget(editmode); + _helpFileName = "gui_vector.html"; + setupUi( this ); + _initWidget(editmode); -// rb0->setFocusProxy( dx_spb_rb0 ); -// rb1->setFocusProxy( v0_le_rb1 ); - rb0->click(); - // setFocusProxy( rb0 ); + // rb0->setFocusProxy( dx_spb_rb0 ); + // rb1->setFocusProxy( v0_le_rb1 ); + rb0->click(); + // setFocusProxy( rb0 ); - if ( editmode == INFO_MODE ){ - setWindowTitle( tr("Vector Information") ); - rb1->hide(); - } + if ( editmode == INFO_MODE ){ + setWindowTitle( tr("Vector Information") ); + rb1->hide(); + } } // ============================================================== Destructeur @@ -1843,115 +1943,122 @@ VectorDialog::~VectorDialog() // ============================================================== _initInputWidget void VectorDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + installEventFilter(this); - name_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - name_le->installEventFilter(this); +// name_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + name_le->installEventFilter(this); - v0_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v0_le_rb1->setValidator( validator ); - v0_le_rb1->installEventFilter(this); + v0_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v0_le_rb1->setValidator( validator ); + v0_le_rb1->installEventFilter(this); - v1_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v1_le_rb1->setValidator( validator ); - v1_le_rb1->installEventFilter(this); + v1_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v1_le_rb1->setValidator( validator ); + v1_le_rb1->installEventFilter(this); - if ( editmode == INFO_MODE ){ - dx_spb_rb0->setReadOnly(true); - dy_spb_rb0->setReadOnly(true); - dz_spb_rb0->setReadOnly(true); - } + if ( editmode == INFO_MODE ){ + name_le->setReadOnly(true); + dx_spb_rb0->setReadOnly(true); + dy_spb_rb0->setReadOnly(true); + dz_spb_rb0->setReadOnly(true); + } - v0_le_rb1->setReadOnly(true); - v1_le_rb1->setReadOnly(true); + v0_le_rb1->setReadOnly(true); + v1_le_rb1->setReadOnly(true); - //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName()) ); + //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName()) ); } // ============================================================== clear void VectorDialog::clear() { - name_le->clear(); - dx_spb_rb0->clear(); - dy_spb_rb0->clear(); - dz_spb_rb0->clear(); - v0_le_rb1->clear(); - v1_le_rb1->clear(); + name_le->clear(); +// dx_spb_rb0->clear(); +// dy_spb_rb0->clear(); +// dz_spb_rb0->clear(); + v0_le_rb1->clear(); + modelUnregister(v0_le_rb1); + + v1_le_rb1->clear(); + modelUnregister(v1_le_rb1); + + modelUnregister(this); } // ============================================================== setValue void VectorDialog::setValue(HEXA_NS::Vector* v) { - name_le->setText( v->getName() ); - dx_spb_rb0->setValue( v->getDx() ); - dy_spb_rb0->setValue( v->getDy() ); - dz_spb_rb0->setValue( v->getDz() ); + name_le->setText( v->getName() ); + dx_spb_rb0->setValue( v->getDx() ); + dy_spb_rb0->setValue( v->getDy() ); + dz_spb_rb0->setValue( v->getDz() ); - if ( _patternDataSelectionModel ){ - QModelIndex ivec = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v) ); - name_le->setProperty( "QModelIndex", QVariant::fromValue(ivec) ); - } - _value = v; + if ( getPatternDataSelectionModel() ){ + QModelIndex ivec = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(v) ); + name_le->setProperty( "QModelIndex", QVariant::fromValue(ivec) ); + } + _value = v; } // ============================================================== getValue HEXA_NS::Vector* VectorDialog::getValue() { - return _value; + return _value; } // ============================================================== apply bool VectorDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - SUIT_OverrideCursor wc; - if ( !_documentModel ) return false; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; - QModelIndex iVector; + QModelIndex iVector; - if ( rb0->isChecked() ){ //scalar - double dx = dx_spb_rb0->value(); - double dy = dy_spb_rb0->value(); - double dz = dz_spb_rb0->value(); + if ( rb0->isChecked() ){ //scalar + double dx = dx_spb_rb0->value(); + double dy = dy_spb_rb0->value(); + double dz = dz_spb_rb0->value(); - iVector = _documentModel->addVector( dx, dy, dz ); - } else if ( rb1->isChecked() ){ //vertices - QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb1] ); - QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb1] ); + iVector = getDocumentModel()->addVector( dx, dy, dz ); + } else if ( rb1->isChecked() ){ //vertices + QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb1] ); + QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb1] ); - if ( iv0.isValid() - && iv1.isValid() ){ - iVector = _documentModel->addVectorVertices( iv0, iv1 ); - } - } + if ( iv0.isValid() + && iv1.isValid() ){ + iVector = getDocumentModel()->addVectorVertices( iv0, iv1 ); + } + } - if ( !iVector.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT BUILD VECTOR" ) ); - return false; - } + if ( !iVector.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT BUILD VECTOR" ) ); + return false; + } - _value = iVector.model()->data(iVector, HEXA_DATA_ROLE).value(); + _value = iVector.model()->data(iVector, HEXA_DATA_ROLE).value(); - QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ - _documentModel->setName( iVector, newName ); + QString newName = name_le->text(); + if ( !newName.isEmpty() )/*{*/ + getDocumentModel()->setName( iVector, newName ); - // to select/highlight result - result = patternBuilderModel->mapFromSource(iVector); + //update the default name in the dialog box + if (_value != NULL) + updateDefaultName(name_le, _value->getType()); - return true; + // to select/highlight result + result = patternBuilderModel->mapFromSource(iVector); + + return true; } @@ -1960,13 +2067,13 @@ CylinderDialog::CylinderDialog( QWidget* parent, Mode editmode, Qt::WindowFlags : HexaBaseDialog(parent, editmode, f), _value(0) { - _helpFileName = "gui_cyl.html"; - setupUi( this ); - _initWidget(editmode); + _helpFileName = "gui_cyl.html"; + setupUi( this ); + _initWidget(editmode); - if ( editmode == INFO_MODE ){ - setWindowTitle( tr("Cylinder Information") ); - } + if ( editmode == INFO_MODE ){ + setWindowTitle( tr("Cylinder Information") ); + } } // ============================================================== Destructeur @@ -1977,70 +2084,85 @@ CylinderDialog::~CylinderDialog() // ============================================================== _initInputWidget void CylinderDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); + +// setProperty( "HexaWidgetType", QVariant::fromValue(CYLINDER_TREE) ); + installEventFilter(this); - setProperty( "HexaWidgetType", QVariant::fromValue(CYLINDER_TREE) ); - installEventFilter(this); +// name_le->setProperty( "HexaWidgetType", QVariant::fromValue(CYLINDER_TREE) ); + name_le->installEventFilter(this); - name_le->setProperty( "HexaWidgetType", QVariant::fromValue(CYLINDER_TREE) ); - name_le->installEventFilter(this); + vex_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - vex_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + vex_le->setValidator( validator ); + vec_le->setValidator( validator ); - vex_le->setValidator( validator ); - vec_le->setValidator( validator ); + vex_le->installEventFilter(this); + vec_le->installEventFilter(this); - vex_le->installEventFilter(this); - vec_le->installEventFilter(this); + vex_le->setReadOnly(true); + vec_le->setReadOnly(true); - vex_le->setReadOnly(true); - vec_le->setReadOnly(true); + if (editmode == INFO_MODE) + { + name_le->setReadOnly(true); + r_spb->setReadOnly(true); + h_spb->setReadOnly(true); + } - //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName())); + //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName())); } // ============================================================== clear void CylinderDialog::clear() { - name_le->clear(); - vex_le->clear(); - vec_le->clear(); - r_spb->clear(); - h_spb->clear(); + name_le->clear(); + + vex_le->clear(); + modelUnregister(vex_le); + + vec_le->clear(); + modelUnregister(vec_le); + + r_spb->clear(); + h_spb->clear(); + + modelUnregister(this); + } // ============================================================== setValue void CylinderDialog::setValue(HEXA_NS::Cylinder* c) { - HEXA_NS::Vertex* base = c->getBase(); - HEXA_NS::Vector* direction = c->getDirection(); - double r = c->getRadius(); - double h = c->getHeight(); + HEXA_NS::Vertex* base = c->getBase(); + HEXA_NS::Vector* direction = c->getDirection(); + double r = c->getRadius(); + double h = c->getHeight(); - name_le->setText( c->getName() ); - vex_le->setText( base->getName() ); - vec_le->setText( direction->getName() ); - r_spb->setValue(r); - h_spb->setValue(h); + name_le->setText( c->getName() ); + vex_le->setText( base->getName() ); + vec_le->setText( direction->getName() ); + r_spb->setValue(r); + h_spb->setValue(h); - if ( _patternDataSelectionModel ){ - QModelIndex iCyl = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(c) ); - QModelIndex iBase = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(base) ); - QModelIndex iDirection = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(direction) ); + if ( getPatternDataSelectionModel() ){ + QModelIndex iCyl = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(c) ); + QModelIndex iBase = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(base) ); + QModelIndex iDirection = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(direction) ); - name_le->setProperty( "QModelIndex", QVariant::fromValue(iCyl) ); - vex_le->setProperty( "QModelIndex", QVariant::fromValue(iBase) ); - vec_le->setProperty( "QModelIndex", QVariant::fromValue(iDirection) ); - } - _value = c; + name_le->setProperty( "QModelIndex", QVariant::fromValue(iCyl) ); + vex_le->setProperty( "QModelIndex", QVariant::fromValue(iBase) ); + vec_le->setProperty( "QModelIndex", QVariant::fromValue(iDirection) ); + } + _value = c; } // ============================================================== getValue HEXA_NS::Cylinder* CylinderDialog::getValue() { - return _value; + return _value; } @@ -2048,44 +2170,45 @@ HEXA_NS::Cylinder* CylinderDialog::getValue() // ============================================================== apply bool CylinderDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; - SUIT_OverrideCursor wc; - if ( !_documentModel ) return false; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; + QModelIndex iCyl; + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); + double r = r_spb->value(); + double h = h_spb->value(); - QModelIndex iCyl; - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); - double r = r_spb->value(); - double h = h_spb->value(); + if ( ivex.isValid() + && ivec.isValid() ){ + iCyl = getDocumentModel()->addCylinder( ivex, ivec, r, h ); + } - if ( ivex.isValid() - && ivec.isValid() ){ - iCyl = _documentModel->addCylinder( ivex, ivec, r, h ); - } + if ( !iCyl.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD CYLINDER" ) ); + return false; + } - if ( !iCyl.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD CYLINDER" ) ); - return false; - } + _value = iCyl.model()->data(iCyl, HEXA_DATA_ROLE).value(); - _value = iCyl.model()->data(iCyl, HEXA_DATA_ROLE).value(); + QString newName = name_le->text(); + if (!newName.isEmpty()) /*{*/ + getDocumentModel()->setName( iCyl, newName ); - QString newName = name_le->text(); - if (!newName.isEmpty()) /*{*/ - _documentModel->setName( iCyl, newName ); + //update the default name in the dialog box + if (_value != NULL) + updateDefaultName(name_le, _value->getType()); - // to select/highlight result - result = patternBuilderModel->mapFromSource(iCyl); + // to select/highlight result + result = patternBuilderModel->mapFromSource(iCyl); - return true; + return true; } @@ -2097,14 +2220,14 @@ PipeDialog::PipeDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f), _value(0) { - _helpFileName = "gui_pipe.html"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( vex_le ); + _helpFileName = "gui_pipe.html"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( vex_le ); - if ( editmode == INFO_MODE ){ - setWindowTitle( tr("Pipe Information") ); - } + if ( editmode == INFO_MODE ){ + setWindowTitle( tr("Pipe Information") ); + } } @@ -2116,130 +2239,138 @@ PipeDialog::~PipeDialog() // ============================================================== _initInputWidget void PipeDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(PIPE_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(PIPE_TREE) ); + installEventFilter(this); - name_le->setProperty( "HexaWidgetType", QVariant::fromValue(PIPE_TREE) ); - name_le->installEventFilter(this); +// name_le->setProperty( "HexaWidgetType", QVariant::fromValue(PIPE_TREE) ); + name_le->installEventFilter(this); - //Vertex Field config - vex_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vex_le->installEventFilter(this); - vex_le->setValidator( validator ); + //Vertex Field config + vex_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vex_le->installEventFilter(this); + vex_le->setValidator( validator ); - //Vector Field config - vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - vec_le->installEventFilter(this); - vec_le->setValidator( validator ); + //Vector Field config + vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + vec_le->installEventFilter(this); + vec_le->setValidator( validator ); - if ( editmode == INFO_MODE ){ - ir_spb->setReadOnly(true); - er_spb->setReadOnly(true); - h_spb->setReadOnly(true); - } + if ( editmode == INFO_MODE ){ + name_le->setReadOnly(true); + ir_spb->setReadOnly(true); + er_spb->setReadOnly(true); + h_spb->setReadOnly(true); + } - vex_le->setReadOnly(true); - vec_le->setReadOnly(true); + vex_le->setReadOnly(true); + vec_le->setReadOnly(true); - //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName())); + //connect( name_le, SIGNAL(returnPressed()), this, SLOT(updateName())); } // ============================================================== clear void PipeDialog::clear() { - name_le->clear(); - vex_le->clear(); - vec_le->clear(); + name_le->clear(); + + vex_le->clear(); + modelUnregister(vex_le); + + vec_le->clear(); + modelUnregister(vec_le); + + modelUnregister(this); } // ============================================================== setValue void PipeDialog::setValue(HEXA_NS::Pipe* p) { - HEXA_NS::Vertex* base = p->getBase(); - HEXA_NS::Vector* direction = p->getDirection(); - double ir = p->getInternalRadius(); - double er = p->getRadius(); - double h = p->getHeight(); + HEXA_NS::Vertex* base = p->getBase(); + HEXA_NS::Vector* direction = p->getDirection(); + double ir = p->getInternalRadius(); + double er = p->getRadius(); + double h = p->getHeight(); - name_le->setText( p->getName() ); - vex_le->setText( base->getName() ); - vec_le->setText( direction->getName() ); - ir_spb->setValue(ir); - er_spb->setValue(er); - h_spb->setValue(h); + name_le->setText( p->getName() ); + vex_le->setText( base->getName() ); + vec_le->setText( direction->getName() ); + ir_spb->setValue(ir); + er_spb->setValue(er); + h_spb->setValue(h); - if ( _patternDataSelectionModel ){ - QModelIndex iPipe = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(p) ); - QModelIndex iBase = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(base) ); - QModelIndex iDirection = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(direction) ); + if ( getPatternDataSelectionModel() ){ + QModelIndex iPipe = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(p) ); + QModelIndex iBase = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(base) ); + QModelIndex iDirection = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(direction) ); - name_le->setProperty( "QModelIndex", QVariant::fromValue(iPipe) ); - vex_le->setProperty( "QModelIndex", QVariant::fromValue(iBase) ); - vec_le->setProperty( "QModelIndex", QVariant::fromValue(iDirection) ); - } - _value = p; + name_le->setProperty( "QModelIndex", QVariant::fromValue(iPipe) ); + vex_le->setProperty( "QModelIndex", QVariant::fromValue(iBase) ); + vec_le->setProperty( "QModelIndex", QVariant::fromValue(iDirection) ); + } + _value = p; } // ============================================================== getValue HEXA_NS::Pipe* PipeDialog::getValue() { - return _value; + return _value; } // ============================================================== apply bool PipeDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; + QModelIndex iPipe; + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); + double ir = ir_spb->value(); + double er = er_spb->value(); + double h = h_spb->value(); - QModelIndex iPipe; - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); - double ir = ir_spb->value(); - double er = er_spb->value(); - double h = h_spb->value(); + if (ir >= er) { + SUIT_MessageBox::information( this, tr( "CANNOT ADD PIPE" ), tr( "External radius must be greather than Internal radius!" ) ); + return false; + } - if (ir >= er) { - SUIT_MessageBox::information( this, tr( "CANNOT ADD PIPE" ), tr( "External radius must be greather than Internal radius!" ) ); - return false; - } + if ( ivex.isValid() + && ivec.isValid() ){ + iPipe = getDocumentModel()->addPipe( ivex, ivec, ir, er, h ); + } - if ( ivex.isValid() - && ivec.isValid() ){ - iPipe = _documentModel->addPipe( ivex, ivec, ir, er, h ); - } + if ( !iPipe.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD PIPE" ) ); + return false; + } + _value = iPipe.model()->data(iPipe, HEXA_DATA_ROLE).value(); - if ( !iPipe.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD PIPE" ) ); - return false; - } - _value = iPipe.model()->data(iPipe, HEXA_DATA_ROLE).value(); + QString newName = name_le->text(); + if ( !newName.isEmpty() )/*{*/ + getDocumentModel()->setName( iPipe, newName ); - QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ - _documentModel->setName( iPipe, newName ); + //update the default name in the dialog box + if (_value != NULL) + updateDefaultName(name_le, _value->getType()); - // to select/highlight result - result = patternBuilderModel->mapFromSource(iPipe); + // to select/highlight result + result = patternBuilderModel->mapFromSource(iPipe); - return true; + return true; } @@ -2251,19 +2382,27 @@ bool PipeDialog::apply(QModelIndex& result) MakeGridDialog::MakeGridDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - setupUi( this ); - _initWidget(editmode); - rb0->click();// Default : cartesian grid - uniform_rb->click(); -// rb0->setFocusProxy( vex_le_rb0 ); -// rb1->setFocusProxy( center_le_rb1 ); -// rb2->setFocusProxy( vex_le_rb2 ); - // setFocusProxy( rb0 ); + setupUi( this ); + _initWidget(editmode); + rb0->click();// Default : cartesian grid + uniform_rb->click(); + // rb0->setFocusProxy( vex_le_rb0 ); + // rb1->setFocusProxy( center_le_rb1 ); + // rb2->setFocusProxy( vex_le_rb2 ); + // setFocusProxy( rb0 ); - _helpFileName = "creategrids.html#guicartgrid"; - connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + _helpFileName = "creategrids.html#guicartgrid"; + connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb0, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( rb0, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); + + connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb1, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( rb1, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); + + connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb2, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( rb2, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); } @@ -2276,58 +2415,58 @@ MakeGridDialog::~MakeGridDialog() void MakeGridDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); - vex_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vec_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - vex_le_rb0->setValidator( validator ); - vec_le_rb0->setValidator( validator ); - vex_le_rb0->installEventFilter(this); - vec_le_rb0->installEventFilter(this); + vex_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vec_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + vex_le_rb0->setValidator( validator ); + vec_le_rb0->setValidator( validator ); + vex_le_rb0->installEventFilter(this); + vec_le_rb0->installEventFilter(this); - center_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - base_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - height_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - center_le_rb1->setValidator( validator ); - base_le_rb1->setValidator( validator ); - height_le_rb1->setValidator( validator ); - center_le_rb1->installEventFilter(this); - base_le_rb1->installEventFilter(this); - height_le_rb1->installEventFilter(this); + center_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + base_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + height_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + center_le_rb1->setValidator( validator ); + base_le_rb1->setValidator( validator ); + height_le_rb1->setValidator( validator ); + center_le_rb1->installEventFilter(this); + base_le_rb1->installEventFilter(this); + height_le_rb1->installEventFilter(this); - vex_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vex_le_rb2->setValidator( validator ); - vex_le_rb2->installEventFilter(this); + vex_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vex_le_rb2->setValidator( validator ); + vex_le_rb2->installEventFilter(this); - if ( editmode != INFO_MODE ){ - //Cylindrical - radius_lw->setItemDelegate(new HexaPositiveDoubleSpinBoxDelegate(radius_lw)); - radius_lw->setEditTriggers(QAbstractItemView::DoubleClicked); + if ( editmode != INFO_MODE ){ + //Cylindrical + radius_lw->setItemDelegate(new HexaPositiveDoubleSpinBoxDelegate(radius_lw)); + radius_lw->setEditTriggers(QAbstractItemView::DoubleClicked); - angle_lw->setItemDelegate(new HexaAngleDoubleSpinBoxDelegate(angle_lw)); - angle_lw->setEditTriggers(QAbstractItemView::DoubleClicked); + angle_lw->setItemDelegate(new HexaAngleDoubleSpinBoxDelegate(angle_lw)); + angle_lw->setEditTriggers(QAbstractItemView::DoubleClicked); - height_lw->setItemDelegate(new HexaPositiveDoubleSpinBoxDelegate(height_lw)); - height_lw->setEditTriggers(QAbstractItemView::DoubleClicked); + height_lw->setItemDelegate(new HexaPositiveDoubleSpinBoxDelegate(height_lw)); + height_lw->setEditTriggers(QAbstractItemView::DoubleClicked); - connect( add_radius_pb, SIGNAL(clicked()), this, SLOT(addRadiusItem()) ); - connect( del_radius_pb, SIGNAL(clicked()), this, SLOT(delRadiusItem()) ); - connect( add_angle_pb, SIGNAL(clicked()), this, SLOT(addAngleItem()) ); - connect( del_angle_pb, SIGNAL(clicked()), this, SLOT(delAngleItem()) ); - connect( add_height_pb, SIGNAL(clicked()), this, SLOT(addHeightItem()) ); - connect( del_height_pb, SIGNAL(clicked()), this, SLOT(delHeightItem()) ); - } + connect( add_radius_pb, SIGNAL(clicked()), this, SLOT(addRadiusItem()) ); + connect( del_radius_pb, SIGNAL(clicked()), this, SLOT(delRadiusItem()) ); + connect( add_angle_pb, SIGNAL(clicked()), this, SLOT(addAngleItem()) ); + connect( del_angle_pb, SIGNAL(clicked()), this, SLOT(delAngleItem()) ); + connect( add_height_pb, SIGNAL(clicked()), this, SLOT(addHeightItem()) ); + connect( del_height_pb, SIGNAL(clicked()), this, SLOT(delHeightItem()) ); + } - vex_le_rb0->setReadOnly(true); - vec_le_rb0->setReadOnly(true); - vex_le_rb2->setReadOnly(true); - center_le_rb1->setReadOnly(true); - base_le_rb1->setReadOnly(true); - height_le_rb1->setReadOnly(true); + vex_le_rb0->setReadOnly(true); + vec_le_rb0->setReadOnly(true); + vex_le_rb2->setReadOnly(true); + center_le_rb1->setReadOnly(true); + base_le_rb1->setReadOnly(true); + height_le_rb1->setReadOnly(true); } @@ -2335,239 +2474,245 @@ void MakeGridDialog::_initInputWidget( Mode editmode ) // ============================================================== clear void MakeGridDialog::clear() { - vex_le_rb0->clear(); - vec_le_rb0->clear(); - base_le_rb1->clear(); - center_le_rb1->clear(); - height_le_rb1->clear(); - random_param_w->clear(); - radius_lw->clear(); - angle_lw->clear(); - height_lw->clear(); - vex_le_rb2->clear(); + vex_le_rb0->clear(); + modelUnregister(vex_le_rb0); + + vec_le_rb0->clear(); + modelUnregister(vec_le_rb0); + + base_le_rb1->clear(); + modelUnregister(base_le_rb1); + + center_le_rb1->clear(); + modelUnregister(center_le_rb1); + + height_le_rb1->clear(); + modelUnregister(height_le_rb1); + + vex_le_rb2->clear(); + modelUnregister(vex_le_rb2); + + modelUnregister(this); } // ============================================================== updateHelpFileName void MakeGridDialog::updateHelpFileName() { - if ( sender() == rb0 ){ - _helpFileName = "creategrids.html#guicartgrid"; - } else if ( sender() == rb1 ){ - _helpFileName = "creategrids.html#guicylgrid"; - } else if ( sender() == rb2 ){ - _helpFileName = "creategrids.html#guisphergrid"; - } + if ( sender() == rb0 ){ + _helpFileName = "creategrids.html#guicartgrid"; + } else if ( sender() == rb1 ){ + _helpFileName = "creategrids.html#guicylgrid"; + } else if ( sender() == rb2 ){ + _helpFileName = "creategrids.html#guisphergrid"; + } } // ============================================================== updateButtonBox void MakeGridDialog::updateButtonBox() //CS_TODO? { - // int nbQuads = quads_lw->count(); - // int nbAngles = angles_lw->count(); - // - // if ( nbQuads>0 && nbAngles> 0 ){ - // _applyCloseButton->setEnabled(true); - // _applyButton->setEnabled(true); - // } else { - // _applyCloseButton->setEnabled(false); - // _applyButton->setEnabled(false); - // } - - // if ( rb0->isChecked() ){ //cartesian - // } else if ( rb1->isChecked() ){ //cylindrical - // nb_radius = radius_lw->item(r); - // nb_angle = angle_lw->item(r); - // nb_height = height_lw->item(r); - // } else if ( rb2->isChecked() ){ //spherical - // } + // int nbQuads = quads_lw->count(); + // int nbAngles = angles_lw->count(); + // + // if ( nbQuads>0 && nbAngles> 0 ){ + // _applyCloseButton->setEnabled(true); + // _applyButton->setEnabled(true); + // } else { + // _applyCloseButton->setEnabled(false); + // _applyButton->setEnabled(false); + // } + + // if ( rb0->isChecked() ){ //cartesian + // } else if ( rb1->isChecked() ){ //cylindrical + // nb_radius = radius_lw->item(r); + // nb_angle = angle_lw->item(r); + // nb_height = height_lw->item(r); + // } else if ( rb2->isChecked() ){ //spherical + // } } // ============================================================== addRadiusItem void MakeGridDialog::addRadiusItem() { - QListWidgetItem* previousItem = radius_lw->currentItem(); - QListWidgetItem* newItem = new QListWidgetItem(); + QListWidgetItem* previousItem = radius_lw->currentItem(); + QListWidgetItem* newItem = new QListWidgetItem(); - double defaultValue = 0.; - if ( previousItem ) - defaultValue = previousItem->data(Qt::EditRole).toDouble(); + double defaultValue = 1.; + if ( previousItem ) + defaultValue = previousItem->data(Qt::EditRole).toDouble(); - newItem->setData( Qt::EditRole, QVariant(defaultValue) ); - newItem->setFlags( newItem->flags () | Qt::ItemIsEditable); - radius_lw->addItem(newItem); + newItem->setData( Qt::EditRole, QVariant(defaultValue) ); + newItem->setFlags( newItem->flags () | Qt::ItemIsEditable); + radius_lw->addItem(newItem); - updateButtonBox(); + updateButtonBox(); } // ============================================================== delRadiusItem void MakeGridDialog::delRadiusItem() { - delete radius_lw->currentItem(); - updateButtonBox(); + delete radius_lw->currentItem(); + updateButtonBox(); } // ============================================================== addAngleItem void MakeGridDialog::addAngleItem() { - QListWidgetItem* previousItem = angle_lw->currentItem(); - QListWidgetItem* newItem = new QListWidgetItem(); + QListWidgetItem* previousItem = angle_lw->currentItem(); + QListWidgetItem* newItem = new QListWidgetItem(); - double defaultValue = 0.; - if ( previousItem ) - defaultValue = previousItem->data(Qt::EditRole).toDouble(); + double defaultValue = 180.; + if ( previousItem ) + defaultValue = previousItem->data(Qt::EditRole).toDouble(); - newItem->setData( Qt::EditRole, QVariant(defaultValue) ); - newItem->setFlags( newItem->flags () | Qt::ItemIsEditable); - angle_lw->addItem(newItem); + newItem->setData( Qt::EditRole, QVariant(defaultValue) ); + newItem->setFlags( newItem->flags () | Qt::ItemIsEditable); + angle_lw->addItem(newItem); - updateButtonBox(); + updateButtonBox(); } // ============================================================== delAngleItem void MakeGridDialog::delAngleItem() { - //std::cout << "delAngleItem()" << std::endl; - delete angle_lw->currentItem(); - updateButtonBox(); + //std::cout << "delAngleItem()" << std::endl; + delete angle_lw->currentItem(); + updateButtonBox(); } // ============================================================== addHeightItem void MakeGridDialog::addHeightItem() { - QListWidgetItem* previousItem = height_lw->currentItem(); - QListWidgetItem* newItem = new QListWidgetItem(); + QListWidgetItem* previousItem = height_lw->currentItem(); + QListWidgetItem* newItem = new QListWidgetItem(); - double defaultValue = 0.; - if ( previousItem ) - defaultValue = previousItem->data(Qt::EditRole).toDouble(); + double defaultValue = 1.; + if ( previousItem ) + defaultValue = previousItem->data(Qt::EditRole).toDouble(); - newItem->setData( Qt::EditRole, QVariant(defaultValue) ); - newItem->setFlags( newItem->flags () | Qt::ItemIsEditable); - height_lw->addItem(newItem); + newItem->setData( Qt::EditRole, QVariant(defaultValue) ); + newItem->setFlags( newItem->flags () | Qt::ItemIsEditable); + height_lw->addItem(newItem); - updateButtonBox(); + updateButtonBox(); } // ============================================================== delHeightItem void MakeGridDialog::delHeightItem() { - //std::cout << "delHeightItem()" << std::endl; - delete height_lw->currentItem(); - updateButtonBox(); + //std::cout << "delHeightItem()" << std::endl; + delete height_lw->currentItem(); + updateButtonBox(); } // ============================================================== apply bool MakeGridDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; - - QModelIndex iNewElts; - if ( rb0->isChecked() ){ //cartesian - QModelIndex ivex_rb0 = patternDataModel->mapToSource( _index[vex_le_rb0] ); - QModelIndex ivec_rb0 = patternBuilderModel->mapToSource( _index[vec_le_rb0] ); - long nx = nx_spb_rb0->value(); - long ny = ny_spb_rb0->value(); - long nz = nz_spb_rb0->value(); - - if ( ivex_rb0.isValid() - && ivec_rb0.isValid() ){ - iNewElts = _documentModel->makeCartesian( ivex_rb0, ivec_rb0, nx, ny, nz ); - } - - } else if ( rb1->isChecked() ){ //cylindrical - QModelIndex icenter_rb1 = patternDataModel->mapToSource( _index[center_le_rb1] ); - QModelIndex ibase_rb1 = patternBuilderModel->mapToSource( _index[base_le_rb1] ); - QModelIndex iheight_rb1 = patternBuilderModel->mapToSource( _index[height_le_rb1] ); - - if ( icenter_rb1.isValid() - && ibase_rb1.isValid() - && iheight_rb1.isValid() ){ - - bool fill = fill_cb_rb1->isChecked(); - if ( uniform_rb->isChecked() ){ - double dr = dr_spb_rb1->value(); - double da = da_spb_rb1->value(); - double dl = dl_spb_rb1->value(); - double nr = nr_spb_rb1->value(); - double na = na_spb_rb1->value(); - double nl = nl_spb_rb1->value(); - - iNewElts = _documentModel->makeCylindrical( icenter_rb1, - ibase_rb1, iheight_rb1, - dr, da, dl, nr, na, nl, fill ); - } - if ( random_rb->isChecked() ){ - QListWidgetItem* item = NULL; -// QDoubleSpinBox* spb = NULL; - - QList radius; - QList angles; - QList heights; - - double somme = 0.; - for ( int r = 0; r < angle_lw->count(); ++r){ - item = angle_lw->item(r); - angles << item->data(Qt::EditRole).toDouble(); - somme += item->data(Qt::EditRole).toDouble(); - } - if (somme > 360.) - { - SUIT_MessageBox::information( 0, - tr("HEXA_INFO"), - tr("The sum of the picked angles has to be \nless or equal than %1 degrees.").arg(360)); - return false; - } - - for ( int r = 0; r < radius_lw->count(); ++r){ - item = radius_lw->item(r); - //std::cout << "radius : " << item->data(Qt::EditRole).toDouble()<< std::endl; - radius << item->data(Qt::EditRole).toDouble(); - } - - for ( int r = 0; r < height_lw->count(); ++r){ - item = height_lw->item(r); - heights << item->data(Qt::EditRole).toDouble(); - } - - iNewElts = _documentModel->makeCylindricals( - icenter_rb1, ibase_rb1, iheight_rb1, - radius, angles, heights, - fill ); //NEW HEXA3 - } - } - - } else if ( rb2->isChecked() ){ //spherical - QModelIndex ivex_rb2 = patternDataModel->mapToSource( _index[vex_le_rb2] ); - // QModelIndex ivecx_rb2 = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); - double radius = radius_spb_rb2->value(); - int nb = nb_spb_rb2->value(); - int k = k_spb_rb2->value(); - - if ( ivex_rb2.isValid() ){ - iNewElts = _documentModel->makeSpherical( ivex_rb2, radius, nb, k ); - } - } - - if ( !iNewElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE GRID" ) ); - return false; - } - - // to select/highlight result - result = patternBuilderModel->mapFromSource( iNewElts ); - - return true; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; + + QModelIndex iNewElts; + if ( rb0->isChecked() ){ //cartesian + QModelIndex ivex_rb0 = patternDataModel->mapToSource( _index[vex_le_rb0] ); + QModelIndex ivec_rb0 = patternBuilderModel->mapToSource( _index[vec_le_rb0] ); + long nx = nx_spb_rb0->value(); + long ny = ny_spb_rb0->value(); + long nz = nz_spb_rb0->value(); + + if ( ivex_rb0.isValid() + && ivec_rb0.isValid() ){ + iNewElts = getDocumentModel()->makeCartesian( ivex_rb0, ivec_rb0, nx, ny, nz ); + } + + } else if ( rb1->isChecked() ){ //cylindrical + QModelIndex icenter_rb1 = patternDataModel->mapToSource( _index[center_le_rb1] ); + QModelIndex ibase_rb1 = patternBuilderModel->mapToSource( _index[base_le_rb1] ); + QModelIndex iheight_rb1 = patternBuilderModel->mapToSource( _index[height_le_rb1] ); + + if ( icenter_rb1.isValid() + && ibase_rb1.isValid() + && iheight_rb1.isValid() ){ + + bool fill = fill_cb_rb1->isChecked(); + if ( uniform_rb->isChecked() ){ + double dr = dr_spb_rb1->value(); + double da = da_spb_rb1->value(); + double dl = dl_spb_rb1->value(); + double nr = nr_spb_rb1->value(); + double na = na_spb_rb1->value(); + double nl = nl_spb_rb1->value(); + + iNewElts = getDocumentModel()->makeCylindrical( icenter_rb1, + ibase_rb1, iheight_rb1, + dr, da, dl, nr, na, nl, fill ); + } + if ( random_rb->isChecked() ){ + QListWidgetItem* item = NULL; + // QDoubleSpinBox* spb = NULL; + + QList radius; + QList angles; + QList heights; + + double somme = 0.; + for ( int r = 0; r < angle_lw->count(); ++r){ + item = angle_lw->item(r); + angles << item->data(Qt::EditRole).toDouble(); + somme += item->data(Qt::EditRole).toDouble(); + } + if (somme > 360.01) + { + SUIT_MessageBox::information( 0, + tr("HEXA_INFO"), + tr("The sum of the picked angles has to be \nless or equal than %1 degrees.").arg(360)); + return false; + } + + for ( int r = 0; r < radius_lw->count(); ++r){ + item = radius_lw->item(r); + //std::cout << "radius : " << item->data(Qt::EditRole).toDouble()<< std::endl; + radius << item->data(Qt::EditRole).toDouble(); + } + + for ( int r = 0; r < height_lw->count(); ++r){ + item = height_lw->item(r); + heights << item->data(Qt::EditRole).toDouble(); + } + + iNewElts = getDocumentModel()->makeCylindricals( + icenter_rb1, ibase_rb1, iheight_rb1, + radius, angles, heights, + fill ); //NEW HEXA3 + } + } + + } else if ( rb2->isChecked() ){ //spherical + QModelIndex ivex_rb2 = patternDataModel->mapToSource( _index[vex_le_rb2] ); + // QModelIndex ivecx_rb2 = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); + double radius = radius_spb_rb2->value(); + int nb = nb_spb_rb2->value(); + int k = k_spb_rb2->value(); + + if ( ivex_rb2.isValid() ){ + iNewElts = getDocumentModel()->makeSpherical( ivex_rb2, radius, nb, k ); + } + } + + if ( !iNewElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE GRID" ) ); + return false; + } + + // to select/highlight result + result = patternBuilderModel->mapFromSource( iNewElts ); + + return true; } @@ -2577,10 +2722,10 @@ bool MakeGridDialog::apply(QModelIndex& result) MakeCylinderDialog::MakeCylinderDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_blocks_for_cyl_pipe.html#make-cylinder"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( cyl_le ); + _helpFileName = "gui_blocks_for_cyl_pipe.html#make-cylinder"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( cyl_le ); } // ============================================================== Destructeur @@ -2590,64 +2735,68 @@ MakeCylinderDialog::~MakeCylinderDialog() void MakeCylinderDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); - cyl_le->setProperty( "HexaWidgetType", QVariant::fromValue(CYLINDER_TREE) ); - vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - cyl_le->setValidator( validator ); - vec_le->setValidator( validator ); - cyl_le->installEventFilter(this); - vec_le->installEventFilter(this); + cyl_le->setProperty( "HexaWidgetType", QVariant::fromValue(CYLINDER_TREE) ); + vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + cyl_le->setValidator( validator ); + vec_le->setValidator( validator ); + cyl_le->installEventFilter(this); + vec_le->installEventFilter(this); - cyl_le->setReadOnly(true); - vec_le->setReadOnly(true); + cyl_le->setReadOnly(true); + vec_le->setReadOnly(true); } // ============================================================== clear void MakeCylinderDialog::clear() { - cyl_le->clear(); - vec_le->clear(); + cyl_le->clear(); + modelUnregister(cyl_le); + + vec_le->clear(); + modelUnregister(vec_le); + + modelUnregister(this); } // ============================================================== apply bool MakeCylinderDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternBuilderSelectionModel ) return false; - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternBuilderModel ) return false; + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternBuilderModel ) return false; - QModelIndex iElts; - QModelIndex icyl = patternBuilderModel->mapToSource( _index[cyl_le] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); - double nr = nr_spb->value(); - double na = na_spb->value(); - double nl = nl_spb->value(); + QModelIndex iElts; + QModelIndex icyl = patternBuilderModel->mapToSource( _index[cyl_le] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); + double nr = nr_spb->value(); + double na = na_spb->value(); + double nl = nl_spb->value(); - if ( icyl.isValid() - && ivec.isValid() ){ - iElts = _documentModel->makeCylinder( icyl, ivec, nr, na, nl ); - } + if ( icyl.isValid() + && ivec.isValid() ){ + iElts = getDocumentModel()->makeCylinder( icyl, ivec, nr, na, nl ); + } - if ( !iElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE CYLINDER" ) ); - return false; - } + if ( !iElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE CYLINDER" ) ); + return false; + } - // to select/highlight result - result = patternBuilderModel->mapFromSource(iElts); + // to select/highlight result + result = patternBuilderModel->mapFromSource(iElts); - return true; + return true; } @@ -2658,10 +2807,10 @@ bool MakeCylinderDialog::apply(QModelIndex& result) MakePipeDialog::MakePipeDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_blocks_for_cyl_pipe.html#make-pipe"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( pipe_le ); + _helpFileName = "gui_blocks_for_cyl_pipe.html#make-pipe"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( pipe_le ); } // ============================================================== Destructeur @@ -2672,23 +2821,23 @@ MakePipeDialog::~MakePipeDialog() // ============================================================== _initInputWidget void MakePipeDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); - pipe_le->setProperty( "HexaWidgetType", QVariant::fromValue(PIPE_TREE) ); - vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + pipe_le->setProperty( "HexaWidgetType", QVariant::fromValue(PIPE_TREE) ); + vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - pipe_le->setValidator( validator ); - vec_le->setValidator( validator ); + pipe_le->setValidator( validator ); + vec_le->setValidator( validator ); - pipe_le->installEventFilter(this); - vec_le->installEventFilter(this); + pipe_le->installEventFilter(this); + vec_le->installEventFilter(this); - pipe_le->setReadOnly(true); - vec_le->setReadOnly(true); + pipe_le->setReadOnly(true); + vec_le->setReadOnly(true); @@ -2697,43 +2846,47 @@ void MakePipeDialog::_initInputWidget( Mode editmode ) // ============================================================== clear void MakePipeDialog::clear() { - pipe_le->clear(); - vec_le->clear(); + pipe_le->clear(); + modelUnregister(pipe_le); + + vec_le->clear(); + modelUnregister(vec_le); + + modelUnregister(this); } // ============================================================== apply bool MakePipeDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternBuilderSelectionModel ) return false; - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternBuilderModel ) return false; + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternBuilderModel ) return false; - QModelIndex iElts; - QModelIndex ipipe = patternBuilderModel->mapToSource( _index[pipe_le] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); - double nr = nr_spb->value(); - double na = na_spb->value(); - double nl = nl_spb->value(); + QModelIndex iElts; + QModelIndex ipipe = patternBuilderModel->mapToSource( _index[pipe_le] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); + double nr = nr_spb->value(); + double na = na_spb->value(); + double nl = nl_spb->value(); - if ( ipipe.isValid() - && ivec.isValid() ){ - iElts = _documentModel->makePipe( ipipe, ivec, nr, na, nl ); - } - if ( !iElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE PIPE" ) ); - return false; - } + if ( ipipe.isValid() + && ivec.isValid() ){ + iElts = getDocumentModel()->makePipe( ipipe, ivec, nr, na, nl ); + } + if ( !iElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE PIPE" ) ); + return false; + } - // to select/highlight result - result = patternBuilderModel->mapFromSource(iElts); + // to select/highlight result + result = patternBuilderModel->mapFromSource(iElts); - return true; + return true; } //---------------------------------- MakeCylindersDialog ----------------------------- @@ -2743,10 +2896,10 @@ bool MakePipeDialog::apply(QModelIndex& result) MakeCylindersDialog::MakeCylindersDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_blocks_for_cyl_pipe.html#make-cylinders"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( cyl1_le ); + _helpFileName = "gui_blocks_for_cyl_pipe.html#make-cylinders"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( cyl1_le ); } // ============================================================== Destructeur @@ -2756,63 +2909,67 @@ MakeCylindersDialog::~MakeCylindersDialog() void MakeCylindersDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(CROSSELEMENTS_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(CROSSELEMENTS_TREE) ); + installEventFilter(this); - cyl1_le->setProperty( "HexaWidgetType", QVariant::fromValue(CYLINDER_TREE) ); - cyl2_le->setProperty( "HexaWidgetType", QVariant::fromValue(CYLINDER_TREE) ); + cyl1_le->setProperty( "HexaWidgetType", QVariant::fromValue(CYLINDER_TREE) ); + cyl2_le->setProperty( "HexaWidgetType", QVariant::fromValue(CYLINDER_TREE) ); - cyl1_le->setValidator( validator ); - cyl2_le->setValidator( validator ); + cyl1_le->setValidator( validator ); + cyl2_le->setValidator( validator ); - cyl1_le->installEventFilter(this); - cyl2_le->installEventFilter(this); + cyl1_le->installEventFilter(this); + cyl2_le->installEventFilter(this); - cyl1_le->setReadOnly(true); - cyl2_le->setReadOnly(true); + cyl1_le->setReadOnly(true); + cyl2_le->setReadOnly(true); } // ============================================================== clear void MakeCylindersDialog::clear() { - cyl1_le->clear(); - cyl2_le->clear(); + cyl1_le->clear(); + modelUnregister(cyl1_le); + + cyl2_le->clear(); + modelUnregister(cyl2_le); + + modelUnregister(this); } // ============================================================== apply bool MakeCylindersDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternBuilderSelectionModel ) return false; - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternBuilderModel ) return false; + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternBuilderModel ) return false; - QModelIndex iCrossElts; - QModelIndex icyl1 = patternBuilderModel->mapToSource( _index[cyl1_le] ); - QModelIndex icyl2 = patternBuilderModel->mapToSource( _index[cyl2_le] ); + QModelIndex iCrossElts; + QModelIndex icyl1 = patternBuilderModel->mapToSource( _index[cyl1_le] ); + QModelIndex icyl2 = patternBuilderModel->mapToSource( _index[cyl2_le] ); - if ( icyl1.isValid() - && icyl2.isValid() ){ - iCrossElts = _documentModel->makeCylinders( icyl1, icyl2 ); - } + if ( icyl1.isValid() + && icyl2.isValid() ){ + iCrossElts = getDocumentModel()->makeCylinders( icyl1, icyl2 ); + } - if ( !iCrossElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE CYLINDERS" ) ); - return false; - } + if ( !iCrossElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE CYLINDERS" ) ); + return false; + } - // to select/highlight result - result = patternBuilderModel->mapFromSource(iCrossElts); + // to select/highlight result + result = patternBuilderModel->mapFromSource(iCrossElts); - return true; + return true; } @@ -2824,10 +2981,10 @@ bool MakeCylindersDialog::apply(QModelIndex& result) MakePipesDialog::MakePipesDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_blocks_for_cyl_pipe.html#make-pipes"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( pipe1_le ); + _helpFileName = "gui_blocks_for_cyl_pipe.html#make-pipes"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( pipe1_le ); } // ============================================================== Destructeur @@ -2838,58 +2995,62 @@ MakePipesDialog::~MakePipesDialog() // ============================================================== _initInputWidget void MakePipesDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - pipe1_le->setProperty( "HexaWidgetType", QVariant::fromValue(PIPE_TREE) ); - pipe2_le->setProperty( "HexaWidgetType", QVariant::fromValue(PIPE_TREE) ); + pipe1_le->setProperty( "HexaWidgetType", QVariant::fromValue(PIPE_TREE) ); + pipe2_le->setProperty( "HexaWidgetType", QVariant::fromValue(PIPE_TREE) ); - pipe1_le->setValidator( validator ); - pipe2_le->setValidator( validator ); + pipe1_le->setValidator( validator ); + pipe2_le->setValidator( validator ); - pipe1_le->installEventFilter(this); - pipe2_le->installEventFilter(this); + pipe1_le->installEventFilter(this); + pipe2_le->installEventFilter(this); - pipe1_le->setReadOnly(true); - pipe2_le->setReadOnly(true); + pipe1_le->setReadOnly(true); + pipe2_le->setReadOnly(true); } // ============================================================== clear void MakePipesDialog::clear() { - pipe1_le->clear(); - pipe2_le->clear(); + pipe1_le->clear(); + modelUnregister(pipe1_le); + + pipe2_le->clear(); + modelUnregister(pipe2_le); + + modelUnregister(this); } // ============================================================== apply bool MakePipesDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternBuilderSelectionModel ) return false; - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternBuilderModel ) return false; + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternBuilderModel ) return false; - QModelIndex iCrossElts; - QModelIndex ipipe1 = patternBuilderModel->mapToSource( _index[pipe1_le] ); - QModelIndex ipipe2 = patternBuilderModel->mapToSource( _index[pipe2_le] ); + QModelIndex iCrossElts; + QModelIndex ipipe1 = patternBuilderModel->mapToSource( _index[pipe1_le] ); + QModelIndex ipipe2 = patternBuilderModel->mapToSource( _index[pipe2_le] ); - if ( ipipe1.isValid() - && ipipe2.isValid() ){ - iCrossElts = _documentModel->makePipes( ipipe1, ipipe2 ); - } - if ( !iCrossElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE PIPES" ) ); - return false; - } - result = patternBuilderModel->mapFromSource(iCrossElts); + if ( ipipe1.isValid() + && ipipe2.isValid() ){ + iCrossElts = getDocumentModel()->makePipes( ipipe1, ipipe2 ); + } + if ( !iCrossElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE PIPES" ) ); + return false; + } + result = patternBuilderModel->mapFromSource(iCrossElts); - return true; + return true; } @@ -2900,13 +3061,12 @@ bool MakePipesDialog::apply(QModelIndex& result) RemoveHexaDialog::RemoveHexaDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_remove.html"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( hexa_le ); + _helpFileName = "gui_remove.html"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( hexa_le ); } - // ============================================================== Destructeur RemoveHexaDialog::~RemoveHexaDialog() { @@ -2915,63 +3075,56 @@ RemoveHexaDialog::~RemoveHexaDialog() // ============================================================== _initInputWidget void RemoveHexaDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); - - hexa_le->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); - hexa_le->setValidator( validator ); - hexa_le->installEventFilter(this); - hexa_le->setReadOnly(true); - + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); + hexa_le->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); + hexa_le->setValidator( validator ); + hexa_le->installEventFilter(this); + hexa_le->setReadOnly(true); + autoFocusSwitch = false; } // ============================================================== clear void RemoveHexaDialog::clear() { - hexa_le->clear(); + hexa_le->clear(); + modelUnregister(hexa_le); + + modelUnregister(this); } // ============================================================== apply bool RemoveHexaDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternDataSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return false; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - QModelIndex ihexa = patternDataModel->mapToSource( _index[hexa_le] ); + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + if ( !patternDataModel ) return false; - bool removed = false; - if ( ihexa.isValid() ){ - if ( connected_cb->isChecked() ){ - removed = _documentModel->removeConnectedHexa( ihexa ); - } else { - removed = _documentModel->removeHexa( ihexa ); - } - } + QModelIndex ihexa = patternDataModel->mapToSource( _index[hexa_le] ); - if ( removed == false ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT REMOVE HEXA" ) ); - return false; - } + bool removed = false; + if ( ihexa.isValid() ){ + if ( connected_cb->isChecked() ){ + removed = getDocumentModel()->removeConnectedHexa( ihexa ); + } else { + removed = getDocumentModel()->removeHexa( ihexa ); + } + } + if ( removed == false ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT REMOVE HEXA" ) ); + return false; + } - //Update the line edit - QVariant invalid; - hexa_le->setProperty("QModelIndex", invalid ); + clear(); - QModelIndex invalidIndex; - _index[hexa_le] = invalidIndex; - - clear(); - - return true; + return true; } @@ -2982,13 +3135,13 @@ bool RemoveHexaDialog::apply(QModelIndex& result) PrismQuadDialog::PrismQuadDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_prism_join_quad.html#prism-quadrangles"; - setupUi( this ); - _initWidget(editmode); -// setFocusProxy( quads_lw ); -// connect( regular_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); -// connect( irregular_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - regular_rb->click(); + _helpFileName = "gui_prism_join_quad.html#prism-quadrangles"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( quads_lw ); + // connect( regular_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + // connect( irregular_rb, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + regular_rb->click(); } @@ -3003,72 +3156,77 @@ PrismQuadDialog::~PrismQuadDialog() */ QModelIndexList PrismQuadDialog::getAssocsVTK() { - QModelIndexList assocs; - QModelIndex iQuad; - QListWidgetItem* item = NULL; + QModelIndexList assocs; + QModelIndex iQuad; + QListWidgetItem* item = NULL; - //ListWidget content - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return assocs; - for ( int r = 0; r < quads_lw->count(); ++r ){ - item = quads_lw->item(r); - iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( iQuad.isValid() ) - assocs << iQuad; - } - return assocs; + //ListWidget content + const PatternDataModel* patternDataModel = getPatternDataModel(); + if ( !patternDataModel ) return assocs; + for ( int r = 0; r < quads_lw->count(); ++r ){ + item = quads_lw->item(r); + iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( iQuad.isValid() ) + assocs << iQuad; + } + return assocs; } // ============================================================== _initInputWidget void PrismQuadDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); - vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - vec_le->setValidator( validator ); + vec_le->setValidator( validator ); - vec_le->installEventFilter(this); - quads_lw->installEventFilter(this); + vec_le->installEventFilter(this); + quads_lw->installEventFilter(this); - if ( editmode != INFO_MODE ){ - QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); - delQuadShortcut->setContext( Qt::WidgetShortcut ); - connect( delQuadShortcut, SIGNAL(activated()), this, SLOT(removeQuad()) ); - } + if ( editmode != INFO_MODE ){ + QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); + delQuadShortcut->setContext( Qt::WidgetShortcut ); + connect( delQuadShortcut, SIGNAL(activated()), this, SLOT(removeQuad()) ); + } - vec_le->setReadOnly(true); + vec_le->setReadOnly(true); - connect( quads_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()) ); - height_lw->setItemDelegate(new HexaPositiveDoubleSpinBoxDelegate(height_lw)); - height_lw->setEditTriggers(QAbstractItemView::DoubleClicked); - connect( add_height_pb, SIGNAL(clicked()), this, SLOT(addHeightItem()) ); - connect( del_height_pb, SIGNAL(clicked()), this, SLOT(delHeightItem()) ); + connect( quads_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection ); + height_lw->setItemDelegate(new HexaPositiveDoubleSpinBoxDelegate(height_lw)); + height_lw->setEditTriggers(QAbstractItemView::DoubleClicked); + connect( add_height_pb, SIGNAL(clicked()), this, SLOT(addHeightItem()) ); + connect( del_height_pb, SIGNAL(clicked()), this, SLOT(delHeightItem()) ); } // ============================================================== clear void PrismQuadDialog::clear() { - vec_le->clear(); - quads_lw->clear(); + quads_lw->clear(); + modelUnregister(quads_lw); + + vec_le->clear(); + modelUnregister(vec_le); + + modelUnregister(this); } // ============================================================== removeQuad void PrismQuadDialog::removeQuad() { - QListWidgetItem *item = quads_lw->currentItem(); + QListWidgetItem *item = quads_lw->currentItem(); - if (item) { - int r = quads_lw->row(item); - quads_lw->takeItem(r); - delete item; - } + if (item) { + int r = quads_lw->row(item); + quads_lw->takeItem(r); + delete item; + } } @@ -3081,25 +3239,25 @@ void PrismQuadDialog::removeQuad() // ============================================================== addHeightItem void PrismQuadDialog::addHeightItem() { - QListWidgetItem* previousItem = height_lw->currentItem(); - QListWidgetItem* newItem = new QListWidgetItem(); + QListWidgetItem* previousItem = height_lw->currentItem(); + QListWidgetItem* newItem = new QListWidgetItem(); - double defaultValue = 0.; - if ( previousItem ) - defaultValue = previousItem->data(Qt::EditRole).toDouble(); + double defaultValue = 1.; + if ( previousItem ) + defaultValue = previousItem->data(Qt::EditRole).toDouble(); - newItem->setData( Qt::EditRole, QVariant(defaultValue) ); - newItem->setFlags( newItem->flags () | Qt::ItemIsEditable); - height_lw->addItem(newItem); + newItem->setData( Qt::EditRole, QVariant(defaultValue) ); + newItem->setFlags( newItem->flags () | Qt::ItemIsEditable); + height_lw->addItem(newItem); -// updateButtonBox(); + // updateButtonBox(); } // ============================================================== delHeightItem void PrismQuadDialog::delHeightItem() { - delete height_lw->currentItem(); -// updateButtonBox(); + delete height_lw->currentItem(); + // updateButtonBox(); } @@ -3107,61 +3265,58 @@ void PrismQuadDialog::delHeightItem() // ============================================================== apply bool PrismQuadDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; - - ///// - QModelIndexList iquads = getIndexList(quads_lw); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); - - QModelIndex iElts; - if ( ivec.isValid() ){ - if (regular_rb->isChecked()) - { - int nb = nb_spb->value(); - if ( iquads.count() == 1 ){ - iElts = _documentModel->prismQuad( iquads[0], ivec, nb ); - } else if ( iquads.count() > 1 ){ - iElts = _documentModel->prismQuads( iquads, ivec, nb ); - } - } - else //irregular_rb is checked - { - QVector heights; - QListWidgetItem* item = NULL; - unsigned int nbItems = height_lw->count(); - - for ( int r = 0; r < nbItems; ++r){ - item = height_lw->item(r); - heights << item->data(Qt::EditRole).toDouble(); - } - if (iquads.count() == 0 || heights.size() == 0) - { - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), - tr( "Parameters are invalid!" ) ); - return false; - } - iElts = _documentModel->prismQuads( iquads, ivec, heights.toStdVector()/*, nb*/ ); - } - } - - if ( !iElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT PRISM QUAD(S)" ) ); - return false; - } - - result = patternBuilderModel->mapFromSource(iElts); - - return true; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; + + ///// + QModelIndexList iquads = getIndexList(quads_lw); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le] ); + + QModelIndex iElts; + if ( ivec.isValid() ){ + if (regular_rb->isChecked()) + { + int nb = nb_spb->value(); + if ( iquads.count() == 1 ){ + iElts = getDocumentModel()->prismQuad( iquads[0], ivec, nb ); + } else if ( iquads.count() > 1 ){ + iElts = getDocumentModel()->prismQuads( iquads, ivec, nb ); + } + } + else //irregular_rb is checked + { + QVector heights; + QListWidgetItem* item = NULL; + unsigned int nbItems = height_lw->count(); + + for ( int r = 0; r < nbItems; ++r){ + item = height_lw->item(r); + heights << item->data(Qt::EditRole).toDouble(); + } + if (iquads.count() == 0 || heights.size() == 0) + { + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), + tr( "Parameters are invalid!" ) ); + return false; + } + iElts = getDocumentModel()->prismQuads( iquads, ivec, heights.toStdVector()/*, nb*/ ); + } + } + + if ( !iElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT PRISM QUAD(S)" ) ); + return false; + } + + result = patternBuilderModel->mapFromSource(iElts); + + return true; } //---------------------------------- JoinQuadDialog ----------------------------- @@ -3171,10 +3326,10 @@ bool PrismQuadDialog::apply(QModelIndex& result) JoinQuadDialog::JoinQuadDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_prism_join_quad.html#join-quadrangles"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( quads_lw ); + _helpFileName = "gui_prism_join_quad.html#join-quadrangles"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( quads_lw ); } @@ -3189,92 +3344,106 @@ JoinQuadDialog::~JoinQuadDialog() */ QModelIndexList JoinQuadDialog::getAssocsVTK() { - QModelIndexList assocs; - QModelIndex iQuad; - QListWidgetItem* item = NULL; + QModelIndexList assocs; + QModelIndex iQuad; + QListWidgetItem* item = NULL; + + if (getPatternDataSelectionModel() == NULL) return assocs; - //ListWidget content - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return assocs; - for ( int r = 0; r < quads_lw->count(); ++r ){ - item = quads_lw->item(r); -// iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); //unsafe - iQuad = _patternDataSelectionModel->indexBy(HEXA_DATA_ROLE, item->data(LW_DATA_ROLE)); - if ( iQuad.isValid() ) assocs << iQuad; - } - return assocs; + //ListWidget content + const PatternDataModel* patternDataModel = getPatternDataModel(); + if ( !patternDataModel ) return assocs; + for ( int r = 0; r < quads_lw->count(); ++r ){ + item = quads_lw->item(r); + // iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); //unsafe + iQuad = getPatternDataSelectionModel()->indexBy(HEXA_DATA_ROLE, item->data(LW_DATA_ROLE)); + if ( iQuad.isValid() ) assocs << iQuad; + } + return assocs; } // ============================================================== _initInputWidget void JoinQuadDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); - vex0_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vex1_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vex2_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vex3_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - quad_dest_le->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + vex0_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vex1_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vex2_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vex3_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + quad_dest_le->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - vex0_le->setValidator( validator ); - vex1_le->setValidator( validator ); - vex2_le->setValidator( validator ); - vex3_le->setValidator( validator ); - quad_dest_le->setValidator( validator ); + vex0_le->setValidator( validator ); + vex1_le->setValidator( validator ); + vex2_le->setValidator( validator ); + vex3_le->setValidator( validator ); + quad_dest_le->setValidator( validator ); - vex0_le->installEventFilter(this); - vex1_le->installEventFilter(this); - vex2_le->installEventFilter(this); - vex3_le->installEventFilter(this); - quad_dest_le->installEventFilter(this); - quads_lw->installEventFilter(this); + vex0_le->installEventFilter(this); + vex1_le->installEventFilter(this); + vex2_le->installEventFilter(this); + vex3_le->installEventFilter(this); + quad_dest_le->installEventFilter(this); + quads_lw->installEventFilter(this); - if ( editmode != INFO_MODE ){ - QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); - delQuadShortcut->setContext( Qt::WidgetShortcut ); - connect( delQuadShortcut, SIGNAL(activated()), this, SLOT(removeQuad()) ); - } + if ( editmode != INFO_MODE ){ + QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); + delQuadShortcut->setContext( Qt::WidgetShortcut ); + connect( delQuadShortcut, SIGNAL(activated()), this, SLOT(removeQuad()) ); + } - vex0_le->setReadOnly(true); - vex1_le->setReadOnly(true); - vex2_le->setReadOnly(true); - vex3_le->setReadOnly(true); - quad_dest_le->setReadOnly(true); + vex0_le->setReadOnly(true); + vex1_le->setReadOnly(true); + vex2_le->setReadOnly(true); + vex3_le->setReadOnly(true); + quad_dest_le->setReadOnly(true); - _currentObj = quads_lw; + _currentObj = quads_lw; - connect( quads_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()) ); + connect( quads_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection ); } // ============================================================== clear void JoinQuadDialog::clear() { - quads_lw->clear(); - vex0_le->clear(); - vex2_le->clear(); + quads_lw->clear(); + modelUnregister(quads_lw); + + vex0_le->clear(); + modelUnregister(vex0_le); + + vex2_le->clear(); + modelUnregister(vex2_le); + + quad_dest_le->clear(); + modelUnregister(quad_dest_le); + + vex1_le->clear(); + modelUnregister(vex1_le); - quad_dest_le->clear(); - vex1_le->clear(); - vex3_le->clear(); + vex3_le->clear(); + modelUnregister(vex3_le); + + modelUnregister(this); } // ============================================================== removeQuad void JoinQuadDialog::removeQuad() { - QListWidgetItem *item = quads_lw->currentItem(); + QListWidgetItem *item = quads_lw->currentItem(); - if (item) { - int r = quads_lw->row(item); - quads_lw->takeItem(r); - delete item; - } + if (item) { + int r = quads_lw->row(item); + quads_lw->takeItem(r); + delete item; + } } @@ -3288,59 +3457,56 @@ void JoinQuadDialog::removeQuad() // ============================================================== apply bool JoinQuadDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; - - ///// - QModelIndexList iquads; - QModelIndex iquad; - QListWidgetItem* item = NULL; - for ( int r = 0; r < quads_lw->count(); ++r){ - item = quads_lw->item(r); - iquad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( iquad.isValid() ) iquads << iquad; - } - QModelIndex iquaddest = patternDataModel->mapToSource( _index[quad_dest_le] ); - QModelIndex ivex0 = patternDataModel->mapToSource( _index[vex0_le] ); - QModelIndex ivex1 = patternDataModel->mapToSource( _index[vex1_le] ); - QModelIndex ivex2 = patternDataModel->mapToSource( _index[vex2_le] ); - QModelIndex ivex3 = patternDataModel->mapToSource( _index[vex3_le] ); - - QModelIndex iElts; - if ( iquaddest.isValid() - && ivex0.isValid() - && ivex1.isValid() - && ivex2.isValid() - && ivex3.isValid() ){ - int nb = nb_spb->value(); - if ( iquads.count() == 1 ){ - iElts = _documentModel->joinQuad( iquads[0], iquaddest, - ivex0, ivex1, ivex2, ivex3, - nb ); - } else if ( iquads.count() > 1 ){ - iElts = _documentModel->joinQuads( iquads, iquaddest, - ivex0, ivex1, ivex2, ivex3, - nb ); - } - } - - if ( !iElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT JOIN QUAD(S)" ) ); - return false; - } - - result = patternBuilderModel->mapFromSource(iElts); - - return true; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; + + ///// + QModelIndexList iquads; + QModelIndex iquad; + QListWidgetItem* item = NULL; + for ( int r = 0; r < quads_lw->count(); ++r){ + item = quads_lw->item(r); + iquad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( iquad.isValid() ) iquads << iquad; + } + QModelIndex iquaddest = patternDataModel->mapToSource( _index[quad_dest_le] ); + QModelIndex ivex0 = patternDataModel->mapToSource( _index[vex0_le] ); + QModelIndex ivex1 = patternDataModel->mapToSource( _index[vex1_le] ); + QModelIndex ivex2 = patternDataModel->mapToSource( _index[vex2_le] ); + QModelIndex ivex3 = patternDataModel->mapToSource( _index[vex3_le] ); + + QModelIndex iElts; + if ( iquaddest.isValid() + && ivex0.isValid() + && ivex1.isValid() + && ivex2.isValid() + && ivex3.isValid() ){ + int nb = nb_spb->value(); + if ( iquads.count() == 1 ){ + iElts = getDocumentModel()->joinQuad( iquads[0], iquaddest, + ivex0, ivex1, ivex2, ivex3, + nb ); + } else if ( iquads.count() > 1 ){ + iElts = getDocumentModel()->joinQuads( iquads, iquaddest, + ivex0, ivex1, ivex2, ivex3, + nb ); + } + } + + if ( !iElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT JOIN QUAD(S)" ) ); + return false; + } + + result = patternBuilderModel->mapFromSource(iElts); + + return true; } @@ -3359,18 +3525,26 @@ bool JoinQuadDialog::apply(QModelIndex& result) MergeDialog::MergeDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - setupUi( this ); - _initWidget(editmode); -// rb0->setFocusProxy( v0_le_rb0 ); -// rb1->setFocusProxy( e0_le_rb1 ); -// rb2->setFocusProxy( q0_le_rb2 ); - // setFocusProxy( rb0 ); - rb0->click(); + setupUi( this ); + _initWidget(editmode); + // rb0->setFocusProxy( v0_le_rb0 ); + // rb1->setFocusProxy( e0_le_rb1 ); + // rb2->setFocusProxy( q0_le_rb2 ); + // setFocusProxy( rb0 ); + rb0->click(); + + _helpFileName = "gui_merge_elmts.html#merge-two-vertices"; + connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb0, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( rb0, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); + + connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb1, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( rb1, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); - _helpFileName = "gui_merge_elmts.html#merge-2-vertices"; - connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb2, SIGNAL(cliked()), this, SLOT(clearVTKSelection()) ); + connect( rb2, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); } // ============================================================== Destructeur @@ -3381,163 +3555,186 @@ MergeDialog::~MergeDialog() // ============================================================== _initInputWidget void MergeDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - v0_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v1_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v0_le_rb0->setValidator( validator ); - v1_le_rb0->setValidator( validator ); - v0_le_rb0->installEventFilter(this); - v1_le_rb0->installEventFilter(this); + v0_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v1_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v0_le_rb0->setValidator( validator ); + v1_le_rb0->setValidator( validator ); + v0_le_rb0->installEventFilter(this); + v1_le_rb0->installEventFilter(this); - v0_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v1_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - e0_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - e1_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + v0_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v1_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + e0_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + e1_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - v0_le_rb1->setValidator( validator ); - v1_le_rb1->setValidator( validator ); - e0_le_rb1->setValidator( validator ); - e1_le_rb1->setValidator( validator ); + v0_le_rb1->setValidator( validator ); + v1_le_rb1->setValidator( validator ); + e0_le_rb1->setValidator( validator ); + e1_le_rb1->setValidator( validator ); - v0_le_rb1->installEventFilter(this); - v1_le_rb1->installEventFilter(this); - e0_le_rb1->installEventFilter(this); - e1_le_rb1->installEventFilter(this); + v0_le_rb1->installEventFilter(this); + v1_le_rb1->installEventFilter(this); + e0_le_rb1->installEventFilter(this); + e1_le_rb1->installEventFilter(this); - v0_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v1_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v2_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - v3_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - q0_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - q1_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + v0_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v1_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v2_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + v3_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + q0_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + q1_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - v0_le_rb2->setValidator( validator ); - v1_le_rb2->setValidator( validator ); - v2_le_rb2->setValidator( validator ); - v3_le_rb2->setValidator( validator ); - q0_le_rb2->setValidator( validator ); - q1_le_rb2->setValidator( validator ); + v0_le_rb2->setValidator( validator ); + v1_le_rb2->setValidator( validator ); + v2_le_rb2->setValidator( validator ); + v3_le_rb2->setValidator( validator ); + q0_le_rb2->setValidator( validator ); + q1_le_rb2->setValidator( validator ); - v0_le_rb2->installEventFilter(this); - v1_le_rb2->installEventFilter(this); - v2_le_rb2->installEventFilter(this); - v3_le_rb2->installEventFilter(this); - q0_le_rb2->installEventFilter(this); - q1_le_rb2->installEventFilter(this); + v0_le_rb2->installEventFilter(this); + v1_le_rb2->installEventFilter(this); + v2_le_rb2->installEventFilter(this); + v3_le_rb2->installEventFilter(this); + q0_le_rb2->installEventFilter(this); + q1_le_rb2->installEventFilter(this); - v0_le_rb0->setReadOnly(true); - v1_le_rb0->setReadOnly(true); - - v0_le_rb1->setReadOnly(true); - v1_le_rb1->setReadOnly(true); - e0_le_rb1->setReadOnly(true); - e1_le_rb1->setReadOnly(true); - - v0_le_rb2->setReadOnly(true); - v1_le_rb2->setReadOnly(true); - v2_le_rb2->setReadOnly(true); - v3_le_rb2->setReadOnly(true); - q0_le_rb2->setReadOnly(true); - q1_le_rb2->setReadOnly(true); + v0_le_rb0->setReadOnly(true); + v1_le_rb0->setReadOnly(true); + v0_le_rb1->setReadOnly(true); + v1_le_rb1->setReadOnly(true); + e0_le_rb1->setReadOnly(true); + e1_le_rb1->setReadOnly(true); + v0_le_rb2->setReadOnly(true); + v1_le_rb2->setReadOnly(true); + v2_le_rb2->setReadOnly(true); + v3_le_rb2->setReadOnly(true); + q0_le_rb2->setReadOnly(true); + q1_le_rb2->setReadOnly(true); } // ============================================================== clear void MergeDialog::clear() { - v0_le_rb0->clear(); - v1_le_rb0->clear(); - v0_le_rb1->clear(); - v1_le_rb1->clear(); - v0_le_rb2->clear(); - v1_le_rb2->clear(); - v2_le_rb2->clear(); - v3_le_rb2->clear(); - e0_le_rb1->clear(); - e1_le_rb1->clear(); - q0_le_rb2->clear(); - q1_le_rb2->clear(); + v0_le_rb0->clear(); + modelUnregister(v0_le_rb0); + + v1_le_rb0->clear(); + modelUnregister(v1_le_rb0); + + e0_le_rb1->clear(); + modelUnregister(e0_le_rb1); + + e1_le_rb1->clear(); + modelUnregister(e1_le_rb1); + + v0_le_rb1->clear(); + modelUnregister(v0_le_rb1); + + v1_le_rb1->clear(); + modelUnregister(v1_le_rb1); + + q0_le_rb2->clear(); + modelUnregister(q0_le_rb2); + + q1_le_rb2->clear(); + modelUnregister(q1_le_rb2); + + v0_le_rb2->clear(); + modelUnregister(v0_le_rb2); + + v1_le_rb2->clear(); + modelUnregister(v1_le_rb2); + + v2_le_rb2->clear(); + modelUnregister(v2_le_rb2); + + v3_le_rb2->clear(); + modelUnregister(v3_le_rb2); + + modelUnregister(this); } // ============================================================== updateHelpFileName void MergeDialog::updateHelpFileName() { - if ( sender() == rb0 ){ - _helpFileName = "gui_merge_elmts.html#merge-2-vertices"; - } else if ( sender() == rb1 ){ - _helpFileName = "gui_merge_elmts.html#merge-2-edges"; - } else if ( sender() == rb2 ){ - _helpFileName = "gui_merge_elmts.html#merge-2-quadrangles"; - } + if ( sender() == rb0 ){ + _helpFileName = "gui_merge_elmts.html#merge-two-vertices"; + } else if ( sender() == rb1 ){ + _helpFileName = "gui_merge_elmts.html#merge-two-edges"; + } else if ( sender() == rb2 ){ + _helpFileName = "gui_merge_elmts.html#merge-two-quadrangles"; + } } // ============================================================== apply bool MergeDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - if ( !_patternDataSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return false; - - bool merged = false; - - if ( rb0->isChecked() ){ - QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb0] ); - QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb0] ); - - if ( iv0.isValid() - && iv1.isValid() ){ - merged = _documentModel->mergeVertices( iv0, iv1 ); - } - } else if ( rb1->isChecked() ){ - QModelIndex ie0 = patternDataModel->mapToSource( _index[e0_le_rb1] ); - QModelIndex ie1 = patternDataModel->mapToSource( _index[e1_le_rb1] ); - QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb1] ); - QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb1] ); - - if ( ie0.isValid() - && ie1.isValid() - && iv0.isValid() - && iv1.isValid() ){ - merged = _documentModel->mergeEdges( ie0, ie1, iv0, iv1); - } - } else if ( rb2->isChecked() ){ - - QModelIndex iq0 = patternDataModel->mapToSource( _index[q0_le_rb2] ); - QModelIndex iq1 = patternDataModel->mapToSource( _index[q1_le_rb2] ); - QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb2] ); - QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb2] ); - QModelIndex iv2 = patternDataModel->mapToSource( _index[v2_le_rb2] ); - QModelIndex iv3 = patternDataModel->mapToSource( _index[v3_le_rb2] ); - - if ( iq0.isValid() - && iq1.isValid() - && iv0.isValid() - && iv1.isValid() - && iv2.isValid() - && iv3.isValid() ){ - merged = _documentModel->mergeQuads( iq0, iq1, - iv0, iv1, iv2, iv3 ); - } - } - - if ( merged == false ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MERGE" ) ); - return false; - } - - return true; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + if (getDocumentModel() == NULL) return false; + SUIT_OverrideCursor wc; + const PatternDataModel* patternDataModel = getPatternDataModel(); + if ( !patternDataModel ) return false; + + bool merged = false; + + if ( rb0->isChecked() ){ + QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb0] ); + QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb0] ); + + if ( iv0.isValid() + && iv1.isValid() ){ + merged = getDocumentModel()->mergeVertices( iv0, iv1 ); + } + } else if ( rb1->isChecked() ){ + QModelIndex ie0 = patternDataModel->mapToSource( _index[e0_le_rb1] ); + QModelIndex ie1 = patternDataModel->mapToSource( _index[e1_le_rb1] ); + QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb1] ); + QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb1] ); + + if ( ie0.isValid() + && ie1.isValid() + && iv0.isValid() + && iv1.isValid() ){ + merged = getDocumentModel()->mergeEdges( ie0, ie1, iv0, iv1); + } + } else if ( rb2->isChecked() ){ + + QModelIndex iq0 = patternDataModel->mapToSource( _index[q0_le_rb2] ); + QModelIndex iq1 = patternDataModel->mapToSource( _index[q1_le_rb2] ); + QModelIndex iv0 = patternDataModel->mapToSource( _index[v0_le_rb2] ); + QModelIndex iv1 = patternDataModel->mapToSource( _index[v1_le_rb2] ); + QModelIndex iv2 = patternDataModel->mapToSource( _index[v2_le_rb2] ); + QModelIndex iv3 = patternDataModel->mapToSource( _index[v3_le_rb2] ); + + if ( iq0.isValid() + && iq1.isValid() + && iv0.isValid() + && iv1.isValid() + && iv2.isValid() + && iv3.isValid() ){ + merged = getDocumentModel()->mergeQuads( iq0, iq1, + iv0, iv1, iv2, iv3 ); + } + } + + if ( merged == false ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MERGE" ) ); + return false; + } + + return true; } @@ -3548,21 +3745,33 @@ bool MergeDialog::apply(QModelIndex& result) DisconnectDialog::DisconnectDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - setupUi( this ); - _initWidget(editmode); -// rb0->setFocusProxy( v_le_rb0 ); -// rb1->setFocusProxy( e_le_rb1 ); -// rb2->setFocusProxy( q_le_rb2 ); -// rb3->setFocusProxy( d_edges_lw); - rb0->click(); - // setFocusProxy( rb0 ); + setupUi( this ); + _initWidget(editmode); + // rb0->setFocusProxy( v_le_rb0 ); + // rb1->setFocusProxy( e_le_rb1 ); + // rb2->setFocusProxy( q_le_rb2 ); + // rb3->setFocusProxy( d_edges_lw); + rb0->click(); + // setFocusProxy( rb0 ); + + _helpFileName = "gui_disc_elmts.html#disconnect-a-vertex"; - _helpFileName = "gui_disc_elmts.html#disconnect-a-vertex"; + connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb0, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( rb0, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); + + connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb1, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( rb1, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); + + connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb2, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( rb2, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); + + connect( rb3, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb3, SIGNAL(clicked()), this, SLOT(clearVTKSelection()) ); + connect( rb3, SIGNAL(clicked()), this, SLOT(clearCurrentObjectFocus()) ); - connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb3, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); } // ============================================================== Destructeur @@ -3573,179 +3782,231 @@ DisconnectDialog::~DisconnectDialog() // ============================================================== _initInputWidget void DisconnectDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); - - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); - - //vertex - v_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - h_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); - v_le_rb0->setValidator( validator ); - h_le_rb0->setValidator( validator ); - v_le_rb0->installEventFilter(this); - h_le_rb0->installEventFilter(this); - - //edge - e_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - h_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); - e_le_rb1->setValidator( validator ); - h_le_rb1->setValidator( validator ); - e_le_rb1->installEventFilter(this); - h_le_rb1->installEventFilter(this); - - //quad - q_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - h_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); - q_le_rb2->setValidator( validator ); - h_le_rb2->setValidator( validator ); - q_le_rb2->installEventFilter(this); - h_le_rb2->installEventFilter(this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); + +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); + + //vertex + v_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + h_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); + v_le_rb0->setValidator( validator ); + h_le_rb0->setValidator( validator ); + v_le_rb0->installEventFilter(this); + h_le_rb0->installEventFilter(this); + + //edge + e_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + h_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); + e_le_rb1->setValidator( validator ); + h_le_rb1->setValidator( validator ); + e_le_rb1->installEventFilter(this); + h_le_rb1->installEventFilter(this); + + //quad + q_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + h_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); + q_le_rb2->setValidator( validator ); + h_le_rb2->setValidator( validator ); + q_le_rb2->installEventFilter(this); + h_le_rb2->installEventFilter(this); + + //edges + d_edges_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + hexas_lw->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); + d_edges_lw->installEventFilter(this); + hexas_lw->installEventFilter(this); + + QShortcut* delEdgeShortcut = new QShortcut(QKeySequence(/*Qt::Key_Delete*/Qt::Key_X/*Qt::Key_Alt*//*Qt::Key_Space*/), d_edges_lw); + QShortcut* delHexaShortcut = new QShortcut(QKeySequence(/*Qt::Key_Delete*/Qt::Key_X/*Qt::Key_Alt*//*Qt::Key_Space*/), hexas_lw); + delEdgeShortcut->setContext( Qt::WidgetShortcut ); + delHexaShortcut->setContext( Qt::WidgetShortcut ); + + v_le_rb0->setReadOnly(true); + h_le_rb0->setReadOnly(true); + + e_le_rb1->setReadOnly(true); + h_le_rb1->setReadOnly(true); + + q_le_rb2->setReadOnly(true); + h_le_rb2->setReadOnly(true); + + connect( d_edges_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection ); + connect( hexas_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection ); + connect( delEdgeShortcut, SIGNAL(activated()), this, SLOT(deleteEdgeItem()) ); + connect( delHexaShortcut, SIGNAL(activated()), this, SLOT(deleteHexaItem()) ); + autoFocusSwitch = false; + +} + +// =============================================== getAssocsVTK +/* + * Returns elements in the list + */ +QModelIndexList DisconnectDialog::getAssocsVTK() +{ + QModelIndexList iElts; + QModelIndex index; + QListWidgetItem* item = NULL; + + const PatternDataModel* patternDataModel = getPatternDataModel(); + if (patternDataModel == NULL) return iElts; + if (rb3->isChecked()) + { + //ListWidget content + if (HEXABLOCKGUI::currentDocGView->getSelectionMode() == EDGE_TREE) + { + for ( int r = 0; r < d_edges_lw->count(); ++r ) + { + item = d_edges_lw->item(r); + index = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( index.isValid() ) + iElts << index; + } + } + else if (HEXABLOCKGUI::currentDocGView->getSelectionMode() == HEXA_TREE) + { + for ( int r = 0; r < hexas_lw->count(); ++r ) + { + item = hexas_lw->item(r); + index = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( index.isValid() ) + iElts << index; + } + } + return iElts; + } + else + return iElts; +} - //edges - d_edges_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - hexas_lw->setProperty( "HexaWidgetType", QVariant::fromValue(HEXA_TREE) ); - d_edges_lw->installEventFilter(this); - hexas_lw->installEventFilter(this); +// ============================================================== clear +void DisconnectDialog::clear() +{ + v_le_rb0->clear(); + modelUnregister(v_le_rb0); - QShortcut* delEdgeShortcut = new QShortcut(QKeySequence(/*Qt::Key_Delete*/Qt::Key_X/*Qt::Key_Alt*//*Qt::Key_Space*/), d_edges_lw); - QShortcut* delHexaShortcut = new QShortcut(QKeySequence(/*Qt::Key_Delete*/Qt::Key_X/*Qt::Key_Alt*//*Qt::Key_Space*/), hexas_lw); - delEdgeShortcut->setContext( Qt::WidgetShortcut ); - delHexaShortcut->setContext( Qt::WidgetShortcut ); + h_le_rb0->clear(); + modelUnregister(h_le_rb0); - v_le_rb0->setReadOnly(true); - h_le_rb0->setReadOnly(true); + e_le_rb1->clear(); + modelUnregister(e_le_rb1); - e_le_rb1->setReadOnly(true); - h_le_rb1->setReadOnly(true); + h_le_rb1->clear(); + modelUnregister(h_le_rb1); - q_le_rb2->setReadOnly(true); - h_le_rb2->setReadOnly(true); + d_edges_lw->clear(); + modelUnregister(d_edges_lw); - connect( d_edges_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()) ); - connect( hexas_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()) ); - connect( delEdgeShortcut, SIGNAL(activated()), this, SLOT(deleteEdgeItem()) ); - connect( delHexaShortcut, SIGNAL(activated()), this, SLOT(deleteHexaItem()) ); + hexas_lw->clear(); + modelUnregister(hexas_lw); -} + q_le_rb2->clear(); + modelUnregister(q_le_rb2); + h_le_rb2->clear(); + modelUnregister(h_le_rb2); -// ============================================================== clear -void DisconnectDialog::clear() -{ - v_le_rb0->clear(); - e_le_rb1->clear(); - q_le_rb2->clear(); - h_le_rb0->clear(); - h_le_rb1->clear(); - h_le_rb2->clear(); - d_edges_lw->clear(); - hexas_lw->clear(); + modelUnregister(this); } // ============================================================== deleteEdgeItem void DisconnectDialog::deleteEdgeItem() { - delete d_edges_lw->currentItem(); + delete d_edges_lw->currentItem(); } // ============================================================== deleteHexaItem void DisconnectDialog::deleteHexaItem() { - delete hexas_lw->currentItem(); + delete hexas_lw->currentItem(); } - // ============================================================== updateHelpFileName void DisconnectDialog::updateHelpFileName() { - if ( sender() == rb0 ){ - _helpFileName = "gui_disc_elmts.html#disconnect-a-vertex"; - } else if ( sender() == rb1 ){ - _helpFileName = "gui_disc_elmts.html#disconnect-an-edge"; - } else if ( sender() == rb2 ){ - _helpFileName = "gui_disc_elmts.html#disconnect-a-quadrangle"; - } else if (sender() == rb3 ){ - _helpFileName = "gui_disc_elmts.html#disconnect-edges"; - } + if ( sender() == rb0 ){ + _helpFileName = "gui_disc_elmts.html#disconnect-a-vertex"; + } else if ( sender() == rb1 ){ + _helpFileName = "gui_disc_elmts.html#disconnect-an-edge"; + } else if ( sender() == rb2 ){ + _helpFileName = "gui_disc_elmts.html#disconnect-a-quadrangle"; + } else if (sender() == rb3 ){ + _helpFileName = "gui_disc_elmts.html#disconnect-edges"; + } } - // ============================================================== apply bool DisconnectDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + if (getDocumentModel() == NULL) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; - QModelIndex iElts; + SUIT_OverrideCursor wc; + QModelIndex iElts; - if ( rb0->isChecked() ){ - QModelIndex ihexa = patternDataModel->mapToSource( _index[h_le_rb0] ); - QModelIndex ivex = patternDataModel->mapToSource( _index[v_le_rb0] ); + if ( rb0->isChecked() ){ + QModelIndex ihexa = patternDataModel->mapToSource( _index[h_le_rb0] ); + QModelIndex ivex = patternDataModel->mapToSource( _index[v_le_rb0] ); - if ( ihexa.isValid() - && ivex.isValid() ){ - iElts = _documentModel->disconnectVertex( ihexa, ivex ); - } - } else if ( rb1->isChecked() ){ - QModelIndex ihexa = patternDataModel->mapToSource( _index[h_le_rb1] ); - QModelIndex iedge = patternDataModel->mapToSource( _index[e_le_rb1] ); + if ( ihexa.isValid() + && ivex.isValid() ){ + iElts = getDocumentModel()->disconnectVertex( ihexa, ivex ); + } + } else if ( rb1->isChecked() ){ + QModelIndex ihexa = patternDataModel->mapToSource( _index[h_le_rb1] ); + QModelIndex iedge = patternDataModel->mapToSource( _index[e_le_rb1] ); - if ( ihexa.isValid() - && iedge.isValid() ){ - iElts = _documentModel->disconnectEdge( ihexa, iedge ); - } - } else if ( rb2->isChecked() ){ - QModelIndex ihexa = patternDataModel->mapToSource( _index[h_le_rb2] ); - QModelIndex iquad = patternDataModel->mapToSource( _index[q_le_rb2] ); + if ( ihexa.isValid() + && iedge.isValid() ){ + iElts = getDocumentModel()->disconnectEdge( ihexa, iedge ); + } + } else if ( rb2->isChecked() ){ + QModelIndex ihexa = patternDataModel->mapToSource( _index[h_le_rb2] ); + QModelIndex iquad = patternDataModel->mapToSource( _index[q_le_rb2] ); - if ( ihexa.isValid() - && iquad.isValid() ){ - iElts = _documentModel->disconnectQuad( ihexa, iquad ); - } - } else if ( rb3->isChecked() ){ // + if ( ihexa.isValid() + && iquad.isValid() ){ + iElts = getDocumentModel()->disconnectQuad( ihexa, iquad ); + } + } else if ( rb3->isChecked() ){ // - QModelIndex iedge, ihexa; - QModelIndexList iedges, ihexas; - QListWidgetItem* item = NULL; + QModelIndex iedge, ihexa; + QModelIndexList iedges, ihexas; + QListWidgetItem* item = NULL; - //Liste des edges - for (int r = 0; r < d_edges_lw->count(); ++r){ - item = d_edges_lw->item(r); - iedge = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( iedge.isValid() ) - iedges << iedge; - } + //Liste des edges + for (int r = 0; r < d_edges_lw->count(); ++r){ + item = d_edges_lw->item(r); + iedge = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( iedge.isValid() ) + iedges << iedge; + } - //Liste des hexas - for (int r = 0; r < hexas_lw->count(); ++r){ - item = hexas_lw->item(r); - ihexa = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( ihexa.isValid() ) - ihexas << ihexa; - } + //Liste des hexas + for (int r = 0; r < hexas_lw->count(); ++r){ + item = hexas_lw->item(r); + ihexa = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( ihexa.isValid() ) + ihexas << ihexa; + } - iElts = _documentModel->disconnectEdges( ihexas, iedges ); - } + iElts = getDocumentModel()->disconnectEdges( ihexas, iedges ); + } - if ( !iElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT DISCONNECT" ) ); - return false; - } + if ( !iElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT DISCONNECT" ) ); + return false; + } - result = patternBuilderModel->mapFromSource(iElts); + result = patternBuilderModel->mapFromSource(iElts); - return true; + return true; } @@ -3756,12 +4017,12 @@ bool DisconnectDialog::apply(QModelIndex& result) // ============================================================== Constructeur CutEdgeDialog::CutEdgeDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f) + HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_cut_hexa.html"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( e_le ); + _helpFileName = "gui_cut_hexa.html"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( e_le ); } // ============================================================== Destructeur @@ -3772,57 +4033,66 @@ CutEdgeDialog::~CutEdgeDialog() // ============================================================== _initInputWidget void CutEdgeDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); - e_le->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - e_le->setValidator( validator ); - e_le->installEventFilter(this); + e_le->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + e_le->setValidator( validator ); + e_le->installEventFilter(this); - e_le->setReadOnly(true); + e_le->setReadOnly(true); } // ============================================================== clear void CutEdgeDialog::clear() { - e_le->clear(); + e_le->clear(); + modelUnregister(e_le); + + modelUnregister(this); } // ============================================================== apply bool CutEdgeDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; + int nbCut = nb_cut_spb->value(); + QModelIndex iedge = patternDataModel->mapToSource( _index[e_le] ); - int nbCut = nb_cut_spb->value(); - QModelIndex iedge = patternDataModel->mapToSource( _index[e_le] ); + QModelIndex iElts; + if ( iedge.isValid() ){ + iElts = getDocumentModel()->cutEdge( iedge, nbCut ); + } - QModelIndex iElts; - if ( iedge.isValid() ){ - iElts = _documentModel->cutEdge( iedge, nbCut ); - } + if ( !iElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT CUT EDGE" ) ); + return false; + } - if ( !iElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT CUT EDGE" ) ); - return false; - } + result = patternBuilderModel->mapFromSource(iElts); - result = patternBuilderModel->mapFromSource(iElts); + //Update the line edit + QVariant invalid; + e_le->setProperty("QModelIndex", invalid ); - return true; + QModelIndex invalidIndex; + _index[e_le] = invalidIndex; + + clear(); + + return true; } // // ------------------------- MakeTransformationDialog ---------------------------------- @@ -3832,18 +4102,18 @@ bool CutEdgeDialog::apply(QModelIndex& result) MakeTransformationDialog::MakeTransformationDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - setupUi( this ); - _initWidget(editmode); -// rb0->setFocusProxy( elts_le_rb0 ); -// rb1->setFocusProxy( elts_le_rb1 ); -// rb2->setFocusProxy( elts_le_rb2 ); -// setFocusProxy( rb0 ); - rb0->click(); + setupUi( this ); + _initWidget(editmode); + // rb0->setFocusProxy( elts_le_rb0 ); + // rb1->setFocusProxy( elts_le_rb1 ); + // rb2->setFocusProxy( elts_le_rb2 ); + // setFocusProxy( rb0 ); + rb0->click(); - _helpFileName = "gui_make_elmts.html#make-elements-by-translation"; - connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + _helpFileName = "gui_make_elmts.html#make-elements-by-translation"; + connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); } // ============================================================== Destructeur @@ -3854,127 +4124,140 @@ MakeTransformationDialog::~MakeTransformationDialog() // ============================================================== _initInputWidget void MakeTransformationDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); - vec_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - elts_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vec_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + elts_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vec_le_rb0->setValidator( validator ); - elts_le_rb0->setValidator( validator ); - vec_le_rb0->installEventFilter(this); - elts_le_rb0->installEventFilter(this); + vec_le_rb0->setValidator( validator ); + elts_le_rb0->setValidator( validator ); + vec_le_rb0->installEventFilter(this); + elts_le_rb0->installEventFilter(this); - vex_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - elts_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vex_le_rb1->setValidator( validator ); - elts_le_rb1->setValidator( validator ); - vex_le_rb1->installEventFilter(this); - elts_le_rb1->installEventFilter(this); + vex_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + elts_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vex_le_rb1->setValidator( validator ); + elts_le_rb1->setValidator( validator ); + vex_le_rb1->installEventFilter(this); + elts_le_rb1->installEventFilter(this); - vex_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vec_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - elts_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vex_le_rb2->setValidator( validator ); - vec_le_rb2->setValidator( validator ); - elts_le_rb2->setValidator( validator ); - vex_le_rb2->installEventFilter(this); - vec_le_rb2->installEventFilter(this); - elts_le_rb2->installEventFilter(this); + vex_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vec_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + elts_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vex_le_rb2->setValidator( validator ); + vec_le_rb2->setValidator( validator ); + elts_le_rb2->setValidator( validator ); + vex_le_rb2->installEventFilter(this); + vec_le_rb2->installEventFilter(this); + elts_le_rb2->installEventFilter(this); - vec_le_rb0->setReadOnly(true); - elts_le_rb0->setReadOnly(true); + vec_le_rb0->setReadOnly(true); + elts_le_rb0->setReadOnly(true); - vex_le_rb1->setReadOnly(true); - elts_le_rb1->setReadOnly(true); + vex_le_rb1->setReadOnly(true); + elts_le_rb1->setReadOnly(true); - vex_le_rb2->setReadOnly(true); - vec_le_rb2->setReadOnly(true); - elts_le_rb2->setReadOnly(true); + vex_le_rb2->setReadOnly(true); + vec_le_rb2->setReadOnly(true); + elts_le_rb2->setReadOnly(true); } // ============================================================== clear void MakeTransformationDialog::clear() { - vex_le_rb1->clear(); - vex_le_rb2->clear(); - vec_le_rb0->clear(); - vec_le_rb2->clear(); - elts_le_rb0->clear(); - elts_le_rb1->clear(); - elts_le_rb2->clear(); + elts_le_rb0->clear(); + modelUnregister(elts_le_rb0); + + vec_le_rb0->clear(); + modelUnregister(vec_le_rb0); + + elts_le_rb1->clear(); + modelUnregister(elts_le_rb1); + + vex_le_rb1->clear(); + modelUnregister(vex_le_rb1); + + elts_le_rb2->clear(); + modelUnregister(elts_le_rb2); + + vex_le_rb2->clear(); + modelUnregister(vex_le_rb2); + + vec_le_rb2->clear(); + modelUnregister(vec_le_rb2); + + modelUnregister(this); } // ============================================================== updateHelpFileName void MakeTransformationDialog::updateHelpFileName() { - if ( sender() == rb0 ){ - _helpFileName = "gui_make_elmts.html#make-elements-by-translation"; - } else if ( sender() == rb1 ){ - _helpFileName = "gui_make_elmts.html#make-elements-by-scaling"; - } else if ( sender() == rb2 ){ - _helpFileName = "gui_make_elmts.html#make-elements-by-rotation"; - } + if ( sender() == rb0 ){ + _helpFileName = "gui_make_elmts.html#make-elements-by-translation"; + } else if ( sender() == rb1 ){ + _helpFileName = "gui_make_elmts.html#make-elements-by-scaling"; + } else if ( sender() == rb2 ){ + _helpFileName = "gui_make_elmts.html#make-elements-by-rotation"; + } } // ============================================================== apply bool MakeTransformationDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - SUIT_OverrideCursor wc; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; + SUIT_OverrideCursor wc; + if (getDocumentModel() == NULL) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; - QModelIndex iNewElts; + QModelIndex iNewElts; - if ( rb0->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb0] ); + if ( rb0->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb0] ); - if ( ielts.isValid() - && ivec.isValid() ) - iNewElts = _documentModel->makeTranslation( ielts, ivec ); + if ( ielts.isValid() + && ivec.isValid() ) + iNewElts = getDocumentModel()->makeTranslation( ielts, ivec ); - } else if ( rb1->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); - double k = k_spb->value(); + } else if ( rb1->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); + double k = k_spb->value(); - if ( ielts.isValid() - && ivex.isValid() ) - iNewElts = _documentModel->makeScale( ielts, ivex, k ); + if ( ielts.isValid() + && ivex.isValid() ) + iNewElts = getDocumentModel()->makeScale( ielts, ivex, k ); - } else if ( rb2->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); - double angle = angle_spb->value(); + } else if ( rb2->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); + double angle = angle_spb->value(); - if ( ielts.isValid() - && ivex.isValid() - && ivec.isValid() ) - iNewElts = _documentModel->makeRotation( ielts, ivex, ivec, angle ); - } + if ( ielts.isValid() + && ivex.isValid() + && ivec.isValid() ) + iNewElts = getDocumentModel()->makeRotation( ielts, ivex, ivec, angle ); + } - if ( !iNewElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE TRANSFORMATION" ) ); - return false; - } + if ( !iNewElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE TRANSFORMATION" ) ); + return false; + } - result = patternBuilderModel->mapFromSource(iNewElts); + result = patternBuilderModel->mapFromSource(iNewElts); - return true; + return true; } // // ------------------------- MakeSymmetryDialog ---------------------------------- @@ -3982,20 +4265,20 @@ bool MakeTransformationDialog::apply(QModelIndex& result) // ============================================================== Constructeur MakeSymmetryDialog::MakeSymmetryDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f) + HexaBaseDialog(parent, editmode, f) { - setupUi( this ); - _initWidget(editmode); -// rb0->setFocusProxy( elts_le_rb0 ); -// rb1->setFocusProxy( elts_le_rb1 ); -// rb2->setFocusProxy( elts_le_rb2 ); - rb0->click(); - // setFocusProxy( rb0 ); + setupUi( this ); + _initWidget(editmode); + // rb0->setFocusProxy( elts_le_rb0 ); + // rb1->setFocusProxy( elts_le_rb1 ); + // rb2->setFocusProxy( elts_le_rb2 ); + rb0->click(); + // setFocusProxy( rb0 ); - _helpFileName = "gui_make_symmetry.html#make-elements-by-point-symmetry"; - connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + _helpFileName = "gui_make_symmetry.html#make-elements-by-point-symmetry"; + connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); } // ============================================================== Destructeur @@ -4006,151 +4289,163 @@ MakeSymmetryDialog::~MakeSymmetryDialog() // ============================================================== _initInputWidget void MakeSymmetryDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); - - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); - - vex_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - elts_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vex_le_rb0->setValidator( validator ); - elts_le_rb0->setValidator( validator ); - vex_le_rb0->installEventFilter(this); - elts_le_rb0->installEventFilter(this); - - vex_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vec_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - elts_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vex_le_rb1->setValidator( validator ); - vec_le_rb1->setValidator( validator ); - elts_le_rb1->setValidator( validator ); - vex_le_rb1->installEventFilter(this); - vec_le_rb1->installEventFilter(this); - elts_le_rb1->installEventFilter(this); - - - vex_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vec_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - elts_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vex_le_rb2->setValidator( validator ); - vec_le_rb2->setValidator( validator ); - elts_le_rb2->setValidator( validator ); - vex_le_rb2->installEventFilter(this); - vec_le_rb2->installEventFilter(this); - elts_le_rb2->installEventFilter(this); - - vex_le_rb0->setReadOnly(true); - elts_le_rb0->setReadOnly(true); - vex_le_rb1->setReadOnly(true); - vec_le_rb1->setReadOnly(true); - elts_le_rb1->setReadOnly(true); - vex_le_rb2->setReadOnly(true); - vec_le_rb2->setReadOnly(true); - elts_le_rb2->setReadOnly(true); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); + +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); + + vex_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + elts_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vex_le_rb0->setValidator( validator ); + elts_le_rb0->setValidator( validator ); + vex_le_rb0->installEventFilter(this); + elts_le_rb0->installEventFilter(this); + + vex_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vec_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + elts_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vex_le_rb1->setValidator( validator ); + vec_le_rb1->setValidator( validator ); + elts_le_rb1->setValidator( validator ); + vex_le_rb1->installEventFilter(this); + vec_le_rb1->installEventFilter(this); + elts_le_rb1->installEventFilter(this); + + + vex_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vec_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + elts_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vex_le_rb2->setValidator( validator ); + vec_le_rb2->setValidator( validator ); + elts_le_rb2->setValidator( validator ); + vex_le_rb2->installEventFilter(this); + vec_le_rb2->installEventFilter(this); + elts_le_rb2->installEventFilter(this); + + vex_le_rb0->setReadOnly(true); + elts_le_rb0->setReadOnly(true); + vex_le_rb1->setReadOnly(true); + vec_le_rb1->setReadOnly(true); + elts_le_rb1->setReadOnly(true); + vex_le_rb2->setReadOnly(true); + vec_le_rb2->setReadOnly(true); + elts_le_rb2->setReadOnly(true); } // ============================================================== clear void MakeSymmetryDialog::clear() { - vex_le_rb0->clear(); - vex_le_rb1->clear(); - vex_le_rb2->clear(); + elts_le_rb0->clear(); + modelUnregister(elts_le_rb0); + + vex_le_rb0->clear(); + modelUnregister(vex_le_rb0); + + elts_le_rb1->clear(); + modelUnregister(elts_le_rb1); + + vex_le_rb1->clear(); + modelUnregister(vex_le_rb1); - vec_le_rb1->clear(); - vec_le_rb2->clear(); + vec_le_rb1->clear(); + modelUnregister(vec_le_rb1); - elts_le_rb0->clear(); - elts_le_rb1->clear(); - elts_le_rb2->clear(); + elts_le_rb2->clear(); + modelUnregister(elts_le_rb2); + + vex_le_rb2->clear(); + modelUnregister(vex_le_rb2); + + vec_le_rb2->clear(); + modelUnregister(vec_le_rb2); + + modelUnregister(this); } // ============================================================== updateHelpFileName void MakeSymmetryDialog::updateHelpFileName() { - if ( sender() == rb0 ){ - _helpFileName = "gui_make_symmetry.html#make-elements-by-point-symmetry"; - } else if ( sender() == rb1 ){ - _helpFileName = "gui_make_symmetry.html#make-elements-by-line-symmetry"; - } else if ( sender() == rb2 ){ - _helpFileName = "gui_make_symmetry.html#make-elements-by-plan-symmetry"; - } + if ( sender() == rb0 ){ + _helpFileName = "gui_make_symmetry.html#make-elements-by-point-symmetry"; + } else if ( sender() == rb1 ){ + _helpFileName = "gui_make_symmetry.html#make-elements-by-line-symmetry"; + } else if ( sender() == rb2 ){ + _helpFileName = "gui_make_symmetry.html#make-elements-by-plane-symmetry"; + } } // ============================================================== apply bool MakeSymmetryDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + if (getDocumentModel() == NULL) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; - SUIT_OverrideCursor wc; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; + SUIT_OverrideCursor wc; + QModelIndex iNewElts; - QModelIndex iNewElts; + if ( rb0->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb0] ); - if ( rb0->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb0] ); + if ( ielts.isValid() + && ivex.isValid() ) + iNewElts = getDocumentModel()->makeSymmetryPoint( ielts, ivex ); - if ( ielts.isValid() - && ivex.isValid() ) - iNewElts = _documentModel->makeSymmetryPoint( ielts, ivex ); + } else if ( rb1->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); - } else if ( rb1->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); + if ( ielts.isValid() + && ivex.isValid() + && ivec.isValid() ) + iNewElts = getDocumentModel()->makeSymmetryLine( ielts, ivex, ivec ); - if ( ielts.isValid() - && ivex.isValid() - && ivec.isValid() ) - iNewElts = _documentModel->makeSymmetryLine( ielts, ivex, ivec ); + } else if ( rb2->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); - } else if ( rb2->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); + if ( ielts.isValid() + && ivex.isValid() + && ivec.isValid() ) + iNewElts = getDocumentModel()->makeSymmetryPlane( ielts, ivex, ivec ); + } - if ( ielts.isValid() - && ivex.isValid() - && ivec.isValid() ) - iNewElts = _documentModel->makeSymmetryPlane( ielts, ivex, ivec ); - } + if ( !iNewElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE TRANSFORMATION" ) ); + return false; + } - if ( !iNewElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE TRANSFORMATION" ) ); - return false; - } + result = patternBuilderModel->mapFromSource(iNewElts); - result = patternBuilderModel->mapFromSource(iNewElts); - - return true; + return true; } // // ------------------------- PerformTransformationDialog ---------------------------------- // ============================================================== Constructeur PerformTransformationDialog::PerformTransformationDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f) + HexaBaseDialog(parent, editmode, f) { - setupUi( this ); - _initWidget(editmode); -// rb0->setFocusProxy( elts_le_rb0 ); -// rb1->setFocusProxy( elts_le_rb1 ); -// rb2->setFocusProxy( elts_le_rb2 ); - // setFocusProxy( rb0 ); - rb0->click(); + setupUi( this ); + _initWidget(editmode); + // rb0->setFocusProxy( elts_le_rb0 ); + // rb1->setFocusProxy( elts_le_rb1 ); + // rb2->setFocusProxy( elts_le_rb2 ); + // setFocusProxy( rb0 ); + rb0->click(); - _helpFileName = "gui_modify_elmts.html#modify-elements-by-translation"; - connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + _helpFileName = "gui_modify_elmts.html#modify-elements-by-translation"; + connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); } // ============================================================== Destructeur @@ -4161,117 +4456,134 @@ PerformTransformationDialog::~PerformTransformationDialog() // ============================================================== _initInputWidget void PerformTransformationDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - vec_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - elts_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vec_le_rb0->setValidator( validator ); - elts_le_rb0->setValidator( validator ); - vec_le_rb0->installEventFilter(this); - elts_le_rb0->installEventFilter(this); + vec_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + elts_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vec_le_rb0->setValidator( validator ); + elts_le_rb0->setValidator( validator ); + vec_le_rb0->installEventFilter(this); + elts_le_rb0->installEventFilter(this); - vex_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - elts_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vex_le_rb1->setValidator( validator ); - elts_le_rb1->setValidator( validator ); - vex_le_rb1->installEventFilter(this); - elts_le_rb1->installEventFilter(this); + vex_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + elts_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vex_le_rb1->setValidator( validator ); + elts_le_rb1->setValidator( validator ); + vex_le_rb1->installEventFilter(this); + elts_le_rb1->installEventFilter(this); - vex_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vec_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - elts_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vex_le_rb2->setValidator( validator ); - vec_le_rb2->setValidator( validator ); - elts_le_rb2->setValidator( validator ); - vex_le_rb2->installEventFilter(this); - vec_le_rb2->installEventFilter(this); - elts_le_rb2->installEventFilter(this); + vex_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vec_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + elts_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vex_le_rb2->setValidator( validator ); + vec_le_rb2->setValidator( validator ); + elts_le_rb2->setValidator( validator ); + vex_le_rb2->installEventFilter(this); + vec_le_rb2->installEventFilter(this); + elts_le_rb2->installEventFilter(this); - vec_le_rb0->setReadOnly(true); - elts_le_rb0->setReadOnly(true); - vex_le_rb1->setReadOnly(true); - elts_le_rb1->setReadOnly(true); - vex_le_rb2->setReadOnly(true); - vec_le_rb2->setReadOnly(true); - elts_le_rb2->setReadOnly(true); + vec_le_rb0->setReadOnly(true); + elts_le_rb0->setReadOnly(true); + vex_le_rb1->setReadOnly(true); + elts_le_rb1->setReadOnly(true); + vex_le_rb2->setReadOnly(true); + vec_le_rb2->setReadOnly(true); + elts_le_rb2->setReadOnly(true); } // ============================================================== clear void PerformTransformationDialog::clear() { - vex_le_rb1->clear(); vex_le_rb2->clear(); - vec_le_rb0->clear(); vec_le_rb2->clear(); - elts_le_rb0->clear(); elts_le_rb1->clear(); elts_le_rb2->clear(); + vec_le_rb0->clear(); + modelUnregister(vec_le_rb0); + + elts_le_rb0->clear(); + modelUnregister(elts_le_rb0); + + vex_le_rb1->clear(); + modelUnregister(vex_le_rb1); + + elts_le_rb1->clear(); + modelUnregister(elts_le_rb1); + + vex_le_rb2->clear(); + modelUnregister(vex_le_rb2); + + vec_le_rb2->clear(); + modelUnregister(vec_le_rb2); + + elts_le_rb2->clear(); + modelUnregister(elts_le_rb2); + + modelUnregister(this); } // ============================================================== updateHelpFileName void PerformTransformationDialog::updateHelpFileName() { - if ( sender() == rb0 ){ - _helpFileName = "gui_modify_elmts.html#modify-elements-by-translation"; - } else if ( sender() == rb1 ){ - _helpFileName = "gui_modify_elmts.html#modify-elements-by-scaling"; - } else if ( sender() == rb2 ){ - _helpFileName = "gui_modify_elmts.html#modify-elements-by-rotation"; - } + if ( sender() == rb0 ){ + _helpFileName = "gui_modify_elmts.html#modify-elements-by-translation"; + } else if ( sender() == rb1 ){ + _helpFileName = "gui_modify_elmts.html#modify-elements-by-scaling"; + } else if ( sender() == rb2 ){ + _helpFileName = "gui_modify_elmts.html#modify-elements-by-rotation"; + } } // ============================================================== apply bool PerformTransformationDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - SUIT_OverrideCursor wc; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; + SUIT_OverrideCursor wc; + if (getDocumentModel() == NULL) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; - bool performed = false; + bool performed = false; - if ( rb0->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb0] ); + if ( rb0->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb0] ); - if ( ielts.isValid() - && ivec.isValid() ) - performed = _documentModel->performTranslation( ielts, ivec ); + if ( ielts.isValid() + && ivec.isValid() ) + performed = getDocumentModel()->performTranslation( ielts, ivec ); - } else if ( rb1->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); - double k = k_spb->value(); + } else if ( rb1->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); + double k = k_spb->value(); - if ( ielts.isValid() - && ivex.isValid() ) - performed = _documentModel->performScale( ielts, ivex, k ); + if ( ielts.isValid() + && ivex.isValid() ) + performed = getDocumentModel()->performScale( ielts, ivex, k ); - } else if ( rb2->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); - double angle = angle_spb->value(); + } else if ( rb2->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); + double angle = angle_spb->value(); - if ( ielts.isValid() - && ivex.isValid() - && ivec.isValid() ) - performed = _documentModel->performRotation( ielts, ivex, ivec, angle ); - } + if ( ielts.isValid() + && ivex.isValid() + && ivec.isValid() ) + performed = getDocumentModel()->performRotation( ielts, ivex, ivec, angle ); + } - if ( performed == false){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT PERFORM TRANSFORMATION" ) ); - return false; - } + if ( performed == false){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT PERFORM TRANSFORMATION" ) ); + return false; + } - return true; + return true; } @@ -4282,18 +4594,18 @@ bool PerformTransformationDialog::apply(QModelIndex& result) PerformSymmetryDialog::PerformSymmetryDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f) { - setupUi( this ); - _initWidget( editmode ); -// rb0->setFocusProxy( elts_le_rb0 ); -// rb1->setFocusProxy( elts_le_rb1 ); -// rb2->setFocusProxy( elts_le_rb2 ); - // setFocusProxy( rb0 ); - rb0->click(); + setupUi( this ); + _initWidget( editmode ); + // rb0->setFocusProxy( elts_le_rb0 ); + // rb1->setFocusProxy( elts_le_rb1 ); + // rb2->setFocusProxy( elts_le_rb2 ); + // setFocusProxy( rb0 ); + rb0->click(); - _helpFileName = "gui_modify_symmetry.html#modify-elements-by-point-symmetry"; - connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); - connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + _helpFileName = "gui_modify_symmetry.html#modify-elements-by-point-symmetry"; + connect( rb0, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( rb2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); } // ============================================================== Destructeur @@ -4304,119 +4616,139 @@ PerformSymmetryDialog::~PerformSymmetryDialog() // ============================================================== _initInputWidget void PerformSymmetryDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); - - vex_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - elts_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vex_le_rb0->setValidator( validator ); - elts_le_rb0->setValidator( validator ); - vex_le_rb0->installEventFilter(this); - elts_le_rb0->installEventFilter(this); - - vex_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vec_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - elts_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vex_le_rb1->setValidator( validator ); - vec_le_rb1->setValidator( validator ); - elts_le_rb1->setValidator( validator ); - vex_le_rb1->installEventFilter(this); - vec_le_rb1->installEventFilter(this); - elts_le_rb1->installEventFilter(this); - - - vex_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - vec_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - elts_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - vex_le_rb2->setValidator( validator ); - vec_le_rb2->setValidator( validator ); - elts_le_rb2->setValidator( validator ); - vex_le_rb2->installEventFilter(this); - vec_le_rb2->installEventFilter(this); - elts_le_rb2->installEventFilter(this); - - vex_le_rb0->setReadOnly(true); - elts_le_rb0->setReadOnly(true); - vex_le_rb1->setReadOnly(true); - vec_le_rb1->setReadOnly(true); - elts_le_rb1->setReadOnly(true); - vex_le_rb2->setReadOnly(true); - vec_le_rb2->setReadOnly(true); - elts_le_rb2->setReadOnly(true); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); + + vex_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + elts_le_rb0->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vex_le_rb0->setValidator( validator ); + elts_le_rb0->setValidator( validator ); + vex_le_rb0->installEventFilter(this); + elts_le_rb0->installEventFilter(this); + + vex_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vec_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + elts_le_rb1->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vex_le_rb1->setValidator( validator ); + vec_le_rb1->setValidator( validator ); + elts_le_rb1->setValidator( validator ); + vex_le_rb1->installEventFilter(this); + vec_le_rb1->installEventFilter(this); + elts_le_rb1->installEventFilter(this); + + + vex_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + vec_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + elts_le_rb2->setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + vex_le_rb2->setValidator( validator ); + vec_le_rb2->setValidator( validator ); + elts_le_rb2->setValidator( validator ); + vex_le_rb2->installEventFilter(this); + vec_le_rb2->installEventFilter(this); + elts_le_rb2->installEventFilter(this); + + vex_le_rb0->setReadOnly(true); + elts_le_rb0->setReadOnly(true); + vex_le_rb1->setReadOnly(true); + vec_le_rb1->setReadOnly(true); + elts_le_rb1->setReadOnly(true); + vex_le_rb2->setReadOnly(true); + vec_le_rb2->setReadOnly(true); + elts_le_rb2->setReadOnly(true); } // ============================================================== clear void PerformSymmetryDialog::clear() { - vex_le_rb0->clear(); vex_le_rb1->clear(); vex_le_rb2->clear(); - vec_le_rb1->clear(); vec_le_rb2->clear(); - elts_le_rb0->clear(); elts_le_rb1->clear(); elts_le_rb2->clear(); + vex_le_rb0->clear(); + modelUnregister(vex_le_rb0); + + elts_le_rb0->clear(); + modelUnregister(elts_le_rb0); + + elts_le_rb1->clear(); + modelUnregister(elts_le_rb1); + + vex_le_rb1->clear(); + modelUnregister(vex_le_rb1); + + vec_le_rb1->clear(); + modelUnregister(vec_le_rb1); + + elts_le_rb2->clear(); + modelUnregister(elts_le_rb2); + + vex_le_rb2->clear(); + modelUnregister(vex_le_rb2); + + vec_le_rb2->clear(); + modelUnregister(vec_le_rb2); + + modelUnregister(this); } // ============================================================== updateHelpFileName void PerformSymmetryDialog::updateHelpFileName() { - if ( sender() == rb0 ){ - _helpFileName = "gui_modify_symmetry.html#modify-elements-by-point-symmetry"; - } else if ( sender() == rb1 ){ - _helpFileName = "gui_modify_symmetry.html#modify-elements-by-line-symmetry"; - } else if ( sender() == rb2 ){ - _helpFileName = "gui_modify_symmetry.html#modify-elements-by-plan-symmetry"; - } + if ( sender() == rb0 ){ + _helpFileName = "gui_modify_symmetry.html#modify-elements-by-point-symmetry"; + } else if ( sender() == rb1 ){ + _helpFileName = "gui_modify_symmetry.html#modify-elements-by-line-symmetry"; + } else if ( sender() == rb2 ){ + _helpFileName = "gui_modify_symmetry.html#modify-elements-by-plane-symmetry"; + } } // ============================================================== apply bool PerformSymmetryDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - SUIT_OverrideCursor wc; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; + SUIT_OverrideCursor wc; + if (getDocumentModel() == NULL) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; - bool performed = false; + bool performed = false; - if ( rb0->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb0] ); + if ( rb0->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb0] ); + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb0] ); - if ( ielts.isValid() - && ivex.isValid() ) - performed = _documentModel->performSymmetryPoint( ielts, ivex ); + if ( ielts.isValid() + && ivex.isValid() ) + performed = getDocumentModel()->performSymmetryPoint( ielts, ivex ); - } else if ( rb1->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); + } else if ( rb1->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb1] ); + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb1] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb1] ); - if ( ielts.isValid() - && ivex.isValid() - && ivec.isValid() ) - performed = _documentModel->performSymmetryLine( ielts, ivex, ivec ); + if ( ielts.isValid() + && ivex.isValid() + && ivec.isValid() ) + performed = getDocumentModel()->performSymmetryLine( ielts, ivex, ivec ); - } else if ( rb2->isChecked() ){ - QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); - QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); - QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); + } else if ( rb2->isChecked() ){ + QModelIndex ielts = patternBuilderModel->mapToSource( _index[elts_le_rb2] ); + QModelIndex ivex = patternDataModel->mapToSource( _index[vex_le_rb2] ); + QModelIndex ivec = patternBuilderModel->mapToSource( _index[vec_le_rb2] ); - if ( ielts.isValid() - && ivex.isValid() - && ivec.isValid() ) - performed = _documentModel->performSymmetryPlane( ielts, ivex, ivec ); - } + if ( ielts.isValid() + && ivex.isValid() + && ivec.isValid() ) + performed = getDocumentModel()->performSymmetryPlane( ielts, ivex, ivec ); + } - if ( performed == false ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT PERFORM SYMMETRY" ) ); - return false; - } + if ( performed == false ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT PERFORM SYMMETRY" ) ); + return false; + } - return true; + return true; } @@ -4426,76 +4758,96 @@ bool PerformSymmetryDialog::apply(QModelIndex& result) // ============================================================== Constructeur EdgeAssocDialog::EdgeAssocDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog( parent, editmode, f ) + HexaBaseDialog( parent, editmode, f ) { - _helpFileName ="gui_asso_quad_to_geom.html#associate-to-edges-or-wires-of-the-geometry"; - setupUi( this ); - _initWidget(editmode); - _initViewManager(); -// setFocusProxy( edges_lw ); + _helpFileName ="gui_asso_quad_to_geom.html#one-edge"; + setupUi( this ); + _initWidget(editmode); + _initViewManager(); + // setFocusProxy( edges_lw ); - myLine.nullify(); + myLine = NULL; - _currentParameter = 0.; - single_rb->click(); + _currentParameter = 0.; + single_rb->click(); } // ============================================================== Destructeur EdgeAssocDialog::~EdgeAssocDialog() { - // disconnect( delEdgeShortcut, SIGNAL(activated()), this, SLOT(deleteEdgeItem()) ); - // disconnect( delLineShortcut, SIGNAL(activated()), this, SLOT(deleteLineItem()) ); - disconnect( HEXABLOCKGUI::selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(addLine()) ); - disconnect( pstart_spb, SIGNAL(valueChanged(double)), this, SLOT( pstartChanged(double)) ); - disconnect( pend_spb, SIGNAL(valueChanged(double)), this, SLOT( pendChanged(double)) ); + // disconnect( delEdgeShortcut, SIGNAL(activated()), this, SLOT(deleteEdgeItem()) ); + // disconnect( delLineShortcut, SIGNAL(activated()), this, SLOT(deleteLineItem()) ); + disconnect( HEXABLOCKGUI::selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(addLine()) ); + disconnect( pstart_spb, SIGNAL(valueChanged(double)), this, SLOT( pstartChanged(double)) ); + disconnect( pend_spb, SIGNAL(valueChanged(double)), this, SLOT( pendChanged(double)) ); } +// ============================================================== close +void EdgeAssocDialog::close() +{ + HEXABLOCKGUI::assocInProgress = false; + HexaBaseDialog::close(); +} // ============================================================== _initInputWidget void EdgeAssocDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); + + //model + first_vex_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + first_vex_le->installEventFilter(this); + first_vex_le->setValidator( validator ); - //model - first_vex_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - first_vex_le->installEventFilter(this); - first_vex_le->setValidator( validator ); + single_edge_le->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + single_edge_le->installEventFilter(this); - single_edge_le->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - single_edge_le->installEventFilter(this); + edges_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); + edges_lw->installEventFilter(this); - edges_lw->setProperty( "HexaWidgetType", QVariant::fromValue(EDGE_TREE) ); - edges_lw->installEventFilter(this); + //geom + lines_lw->setProperty("HexaWidgetType", QVariant::fromValue(GEOMEDGE_TREE) ); + lines_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); + lines_lw->installEventFilter(this); - //geom - lines_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); - lines_lw->installEventFilter(this); + single_line_le->setProperty( "HexaWidgetType", QVariant::fromValue(GEOMEDGE_TREE) ); + single_line_le->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); + single_line_le->installEventFilter(this); - single_line_le->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_EDGE) ); - single_line_le->installEventFilter(this); + QShortcut* delEdgeShortcut = new QShortcut(QKeySequence(/*Qt::Key_Delete*/Qt::Key_X), edges_lw); + QShortcut* delLineShortcut = new QShortcut(QKeySequence(/*Qt::Key_Delete*/Qt::Key_X), lines_lw); + delLineShortcut->setContext( Qt::WidgetWithChildrenShortcut ); + delEdgeShortcut->setContext( Qt::WidgetWithChildrenShortcut ); - QShortcut* delEdgeShortcut = new QShortcut(QKeySequence(/*Qt::Key_Delete*/Qt::Key_X), edges_lw); - QShortcut* delLineShortcut = new QShortcut(QKeySequence(/*Qt::Key_Delete*/Qt::Key_X), lines_lw); - delLineShortcut->setContext( Qt::WidgetWithChildrenShortcut ); - delEdgeShortcut->setContext( Qt::WidgetWithChildrenShortcut ); + pend_spb->setValue(1.); - pend_spb->setValue(1.); + first_vex_le->setReadOnly(true); + single_edge_le->setReadOnly(true); + single_line_le->setReadOnly(true); - first_vex_le->setReadOnly(true); - single_edge_le->setReadOnly(true); - single_line_le->setReadOnly(true); + connect( delEdgeShortcut, SIGNAL(activated()), this, SLOT(deleteEdgeItem()) ); + connect( delLineShortcut, SIGNAL(activated()), this, SLOT(deleteLineItem()) ); + connect( pstart_spb, SIGNAL(valueChanged(double)), this, SLOT( pstartChanged(double)) ); + connect( pend_spb, SIGNAL(valueChanged(double)), this, SLOT( pendChanged(double)) ); + connect( edges_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection ); + connect( lines_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfGeom()), Qt::UniqueConnection ); + connect( single_rb, SIGNAL(clicked()), this, SLOT( refreshHighlight()), Qt::UniqueConnection ); + connect( multiple_rb, SIGNAL(clicked()), this, SLOT(refreshHighlight()), Qt::UniqueConnection ); + connect( single_rb, SIGNAL(clicked()), this, SLOT( updateHelpFileName() ) ); + connect( multiple_rb, SIGNAL(clicked()), this, SLOT( updateHelpFileName() ) ); +} - connect( delEdgeShortcut, SIGNAL(activated()), this, SLOT(deleteEdgeItem()) ); - connect( delLineShortcut, SIGNAL(activated()), this, SLOT(deleteLineItem()) ); - connect( pstart_spb, SIGNAL(valueChanged(double)), this, SLOT( pstartChanged(double)) ); - connect( pend_spb, SIGNAL(valueChanged(double)), this, SLOT( pendChanged(double)) ); - connect( edges_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()) ); - connect( lines_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfGeom()) ); - connect( single_rb, SIGNAL(clicked()), this, SLOT( highlightSelectedAssocs()) ); - connect( multiple_rb, SIGNAL(clicked()), this, SLOT(highlightSelectedAssocs()) ); +// ============================================================== updateHelpFileName +void EdgeAssocDialog::updateHelpFileName() +{ + if ( sender() == single_rb ){ + _helpFileName = "gui_asso_quad_to_geom.html#one-edge"; + } else if ( sender() == multiple_rb ){ + _helpFileName = "gui_asso_quad_to_geom.html#line"; + } } @@ -4505,33 +4857,32 @@ void EdgeAssocDialog::_initInputWidget( Mode editmode ) */ QModelIndexList EdgeAssocDialog::getAssocsVTK() { - QModelIndexList assocs; - QModelIndex iEdge; - QListWidgetItem* item = NULL; - - if (single_rb->isChecked()) - { - //LineEdit content - QVariant v = single_edge_le->property("QModelIndex"); - if ( !v.isValid() ) - return assocs; - assocs << v.value(); - return assocs; - } - else if (multiple_rb->isChecked()) - { - //ListWidget content - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return assocs; - for ( int r = 0; r < edges_lw->count(); ++r){ - item = edges_lw->item(r); - iEdge = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( iEdge.isValid() ) - assocs << iEdge; - } - return assocs; - } - else return assocs; + QModelIndexList assocs; + QModelIndex iEdge; + QListWidgetItem* item = NULL; + + if (getPatternDataSelectionModel() == NULL) return assocs; + if (single_rb->isChecked()) + { + //LineEdit content + QVariant v = single_edge_le->property("QModelIndex"); + if ( !v.isValid() ) return assocs; + assocs << v.value(); + return assocs; + } + else if (multiple_rb->isChecked()) + { + //ListWidget content + const PatternDataModel* patternDataModel = getPatternDataModel(); + if ( !patternDataModel ) return assocs; + for ( int r = 0; r < edges_lw->count(); ++r){ + item = edges_lw->item(r); + iEdge = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( iEdge.isValid() ) assocs << iEdge; + } + return assocs; + } + else return assocs; } // ============================================================== getAssocsGEOM @@ -4540,31 +4891,31 @@ QModelIndexList EdgeAssocDialog::getAssocsVTK() */ QMultiMap EdgeAssocDialog::getAssocsGEOM() { - QMultiMap assocs; - QListWidgetItem* item = NULL; - DocumentModel::GeomObj geomObj; - - if (single_rb->isChecked()) - { - //LineEdit content - QVariant v = single_line_le->property("GeomObj"); - if ( !v.isValid() ) return assocs; - geomObj = v.value(); - assocs.insert( geomObj.entry, geomObj.subid.toInt() ); - return assocs; - } - else if (multiple_rb->isChecked()) - { - //ListWidget content - unsigned int nbEdges = lines_lw->count(); - for ( int r = 0; r < nbEdges; ++r){ - item = lines_lw->item(r); - geomObj = item->data(LW_ASSOC_ROLE).value(); - assocs.insert( geomObj.entry, geomObj.subid.toInt() ); - } - return assocs; - } - else return assocs; + QMultiMap assocs; + QListWidgetItem* item = NULL; + DocumentModel::GeomObj geomObj; + + if (single_rb->isChecked()) + { + //LineEdit content + QVariant v = single_line_le->property("GeomObj"); + if ( !v.isValid() ) return assocs; + geomObj = v.value(); + assocs.insert( geomObj.shapeName, geomObj.subid.toInt() ); + return assocs; + } + else if (multiple_rb->isChecked()) + { + //ListWidget content + unsigned int nbEdges = lines_lw->count(); + for ( int r = 0; r < nbEdges; ++r){ + item = lines_lw->item(r); + geomObj = item->data(LW_ASSOC_ROLE).value(); + assocs.insert( geomObj.shapeName, geomObj.subid.toInt() ); + } + return assocs; + } + else return assocs; } // ============================================================== selectElementOfGeom @@ -4574,291 +4925,343 @@ QMultiMap EdgeAssocDialog::getAssocsGEOM() void EdgeAssocDialog::selectElementOfGeom() { - MESSAGE("HexaBaseDialog::selectElementOfGeom()"); - - QListWidget* currentListWidget = dynamic_cast( sender() ); - if ( !currentListWidget ) return; + QListWidget* currentListWidget = dynamic_cast( sender() ); + if ( !currentListWidget ) return; - _selectionMutex = true; + _selectionMutex = true; - QMultiMap geomElts; - DocumentModel::GeomObj geomObj; - QList sel = currentListWidget->selectedItems(); - foreach ( QListWidgetItem *item, sel ){ - geomObj = item->data(LW_ASSOC_ROLE).value(); - geomElts.insert( geomObj.entry, geomObj.subid.toInt() ); - } - _selectionMutex = false; + QMultiMap geomElts; + DocumentModel::GeomObj geomObj; + QList sel = currentListWidget->selectedItems(); + foreach ( QListWidgetItem *item, sel ){ + geomObj = item->data(LW_ASSOC_ROLE).value(); + geomElts.insert( geomObj.shapeName, geomObj.subid.toInt() ); + } + _selectionMutex = false; - //highlight geom selected elts - if (geomElts.size() > 0) _patternDataSelectionModel->_highlightGEOM(geomElts); + //highlight geom selected elts + if (geomElts.size() > 0 && getPatternDataSelectionModel() != NULL) + HEXABLOCKGUI::currentOccGView->highlight(geomElts); - MESSAGE("}"); } // ============================================================== clear void EdgeAssocDialog::clear() { - first_vex_le->clear(); - edges_lw->clear(); - lines_lw->clear(); - single_edge_le->setText(""); - single_line_le->setText(""); + first_vex_le->clear(); + modelUnregister(first_vex_le); + + edges_lw->clear(); + modelUnregister(edges_lw); + + lines_lw->clear(); + + single_edge_le->clear(); + modelUnregister(single_edge_le); + + single_line_le->clear(); + QVariant invalid; + single_line_le->setProperty("GeomObj", invalid); + + modelUnregister(this); + +// single_edge_le->setText(""); +// single_line_le->setText(""); } // ============================================================== deleteEdgeItem void EdgeAssocDialog::deleteEdgeItem() { - delete edges_lw->currentItem(); + delete edges_lw->currentItem(); } // ============================================================== deleteLineItem void EdgeAssocDialog::deleteLineItem() { - delete lines_lw->currentItem(); + delete lines_lw->currentItem(); } // ============================================================== setGeomEngine void EdgeAssocDialog::setGeomEngine( GEOM::GEOM_Gen_var geomEngine ) { - _geomEngine = geomEngine; + _geomEngine = geomEngine; } // ============================================================== onWindowActivated void EdgeAssocDialog::onWindowActivated(SUIT_ViewManager* vm) { - SUIT_ViewWindow* v = vm->getActiveView(); + QString vmType = vm->getType(); + if ( (vmType == SVTK_Viewer::Type()) || (vmType == VTKViewer_Viewer::Type()) ){ - QString vmType = vm->getType(); - if ( (vmType == SVTK_Viewer::Type()) || (vmType == VTKViewer_Viewer::Type()) ){ + if (single_rb->isChecked()) + single_edge_le->setFocus(); + else if (multiple_rb->isChecked() && focusWidget() != first_vex_le ) + edges_lw->setFocus(); + } + else if ( vmType == OCCViewer_Viewer::Type() ){ + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), TopAbs_EDGE); - if (single_rb->isChecked()) - single_edge_le->setFocus(); - else if (multiple_rb->isChecked()) - { - if (close_cb->isChecked()) - first_vex_le->setFocus(); - else - edges_lw->setFocus(); - } - } - else if ( vmType == OCCViewer_Viewer::Type() ){ - globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); - - if (single_rb->isChecked()) - single_line_le->setFocus(); - else if (multiple_rb->isChecked()) - lines_lw->setFocus(); - } + if (single_rb->isChecked()) + single_line_le->setFocus(); + else if (multiple_rb->isChecked() && focusWidget() != first_vex_le) + lines_lw->setFocus(); + } } // ============================================================== createOperation GEOM::GEOM_IOperations_ptr EdgeAssocDialog::createOperation() { - return _geomEngine->GetIBasicOperations(getStudyId()); + return _geomEngine->GetIBasicOperations(getStudyId()); } // ============================================================== execute bool EdgeAssocDialog::execute(ObjectList& objects) { - MESSAGE("execute(){"); - MESSAGE("* objects.size()" << objects.size() ); - - bool res = false; + bool res = false; - GEOM::GEOM_Object_var anObj; - QStringList aParameters; + GEOM::GEOM_Object_var anObj; + QStringList aParameters; - GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow( getOperation() ); - anObj = anOper->MakePointOnCurve( _currentLine.get(), _currentParameter ); - if ( !anObj->_is_nil() ) { - objects.push_back(anObj._retn()); - res = true; - } - MESSAGE("}execute()"); - return res; + GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow( getOperation() ); + anObj = anOper->MakePointOnCurve( _currentLine.get(), _currentParameter ); + if ( !anObj->_is_nil() ) { + objects.push_back(anObj._retn()); + res = true; + } + return res; } // ============================================================== pstartChanged void EdgeAssocDialog::pstartChanged( double val ) { - MESSAGE("pstartChanged("<item( 0 ); - if (!lineItem) return; - // MESSAGE("data : "<text().toStdString()); - _currentLine = lineItem->data(LW_GEOM_OBJ_ROLE).value(); - _currentParameter = pstart_spb->value(); - displayPreview(true); - MESSAGE("}pstartChanged()"); + QListWidgetItem* lineItem = lines_lw->item( 0 ); + if (!lineItem) return; + _currentLine = lineItem->data(LW_GEOM_OBJ_ROLE).value(); + _currentParameter = pstart_spb->value(); } // ============================================================== pendChanged void EdgeAssocDialog::pendChanged( double val ) { - MESSAGE("pendChanged("<_is_nil() ) return; - QListWidgetItem* lineItem = lines_lw->item( lines_lw->count()-1 ); - if (!lineItem) return; - // MESSAGE("data : "<text().toStdString()); - _currentLine = lineItem->data(LW_GEOM_OBJ_ROLE).value(); - _currentParameter = pend_spb->value(); - displayPreview(true); - MESSAGE("}pendChanged()"); + // if ( _lastLine->_is_nil() ) return; + QListWidgetItem* lineItem = lines_lw->item( lines_lw->count()-1 ); + if (!lineItem) return; + _currentLine = lineItem->data(LW_GEOM_OBJ_ROLE).value(); + _currentParameter = pend_spb->value(); +// displayPreview(true); } // ============================================================== onCurrentSelectionChanged void EdgeAssocDialog::onCurrentSelectionChanged() { - if ( !isVisible() ) - { - highlightSelectedAssocs(); - return; - } - - SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - - bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()); - if (!isOCC || !_documentModel) - { - highlightSelectedAssocs(); - return; - } - - GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_EDGE); - DocumentModel::GeomObj * aLine = _documentModel->convertToGeomObj(aSelectedObject); - if ( aLine == NULL ) - { - highlightSelectedAssocs(); - return; - } - - if (single_rb->isChecked()) { - single_line_le->setText(aLine->name); - single_line_le->setProperty("GeomObj", QVariant::fromValue(*aLine)); - myLine = aSelectedObject; - setFocusToNextField(); - } - else if( multiple_rb->isChecked() ) { - QList twice = lines_lw->findItems( aLine->name, Qt::MatchExactly); - if ( twice.count() == 0 ){ - QListWidgetItem* item = new QListWidgetItem( aLine->name ); - item->setData( LW_ASSOC_ROLE, QVariant::fromValue(*aLine) ); - item->setData( LW_GEOM_OBJ_ROLE, QVariant::fromValue(aSelectedObject) ); - lines_lw->addItem(item); - } - } - highlightSelectedAssocs(); + if ( !isVisible()) + { + highlightSelectedAssocs(); + return; + } + + SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + + bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()); + if (!isOCC || !getDocumentModel()) + { + highlightSelectedAssocs(); + return; + } + + GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_EDGE); + DocumentModel::GeomObj* selectedLine = getDocumentModel()->convertToGeomObj(aSelectedObject); + if ( selectedLine == NULL ) + { + highlightSelectedAssocs(); + return; + } + myLine = selectedLine; + + //don't allow selection on a geometry not associated to the document + QString mainShapeEntry; + if ( aSelectedObject->IsMainShape() ){ + mainShapeEntry = aSelectedObject->GetStudyEntry(); + } else { + GEOM::GEOM_Object_var mainShape = aSelectedObject->GetMainShape(); + mainShapeEntry = mainShape->GetStudyEntry(); + } + if (getDocumentModel()->getGeomObjName(mainShapeEntry).isEmpty()) + { + //unknown geometry + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), HexaBaseDialog::tr( "UNKNOWN_GEOMETRY" ) ); + return; + } + + if (single_rb->isChecked()) { + single_line_le->setText(myLine->name); + single_line_le->setProperty("GeomObj", QVariant::fromValue(*myLine)); + setFocusToNextField(); + } + else if( multiple_rb->isChecked() ) { + QList twice = lines_lw->findItems( myLine->name, Qt::MatchExactly); + if ( twice.count() == 0 ){ + QListWidgetItem* item = new QListWidgetItem( myLine->name ); + item->setData( LW_ASSOC_ROLE, QVariant::fromValue(*myLine) ); + item->setData( LW_GEOM_OBJ_ROLE, QVariant::fromValue(aSelectedObject) ); + lines_lw->addItem(item); + } + } + highlightSelectedAssocs(); } // ============================================================== apply bool EdgeAssocDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - bool assocOk = false; - - highlightSelectedAssocs(); - if ( !_patternDataSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return false; - if (!_documentModel) return false; - - QModelIndex iEdge; - QModelIndexList iEdges; - QListWidgetItem* item = NULL; - QList assocs; - DocumentModel::GeomObj aLine; - DocumentModel::GeomObj *aLinePtr; - - if (single_rb->isChecked()){ //Single edge and/or line association - - GEOM::GeomObjPtr aSelectedObject = myLine; - aLinePtr = _documentModel->convertToGeomObj(aSelectedObject); - aLinePtr->start = pstart_spb->value(); - aLinePtr->end = pend_spb->value(); - iEdge = patternDataModel->mapToSource( _index[single_edge_le] ); - if (!iEdge.isValid()) return false; - _documentModel->addAssociation(iEdge, *aLinePtr); - assocOk = true; - } - else { //Multiple edge and/or line association - - // edges - iEdges = getIndexList(edges_lw); - - // lines - for (int r = 0; r < lines_lw->count(); ++r){ - item = lines_lw->item(r); - aLine = item->data(LW_ASSOC_ROLE).value(); - MESSAGE(" assocs => " << aLine.name.toStdString() ); - MESSAGE(" assocs => " << aLine.brep.toStdString() ); - assocs << aLine; - } - - if ( close_cb->isChecked() ){ //closed line - QModelIndex iFirstVertex = patternDataModel->mapToSource( _index[first_vex_le] ); - bool inv = inverse_cb->isChecked(); - assocOk = _documentModel->associateClosedLine( iFirstVertex, iEdges, assocs, pstart_spb->value(), inv ); - } else - //opened line - assocOk = _documentModel->associateOpenedLine( iEdges, assocs, pstart_spb->value(), pend_spb->value() ); - } - - if ( !assocOk ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE EDGE ASSOCIATION" ) ); - highlightSelectedAssocs(); - return false; - } - - highlightSelectedAssocs(); - return true; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + bool assocOk = false; + + highlightSelectedAssocs(); + + PatternDataModel* patternDataModel = getPatternDataModel(); + PatternGeomModel* pgm = getPatternGeomModel(); + PatternGeomSelectionModel* pgsm = getPatternGeomSelectionModel(); + + QModelIndex iEdge, iGeomEdge; + QModelIndexList iEdges; + QListWidgetItem* item = NULL; + QList assocs; + DocumentModel::GeomObj aLine; + HEXA_NS::SubShape* ssh; + HEXA_NS::EdgeShape* sh; + HEXA_NS::NewShapes shapes; + HEXA_NS::IntVector subIds; + QString id; + + if (single_rb->isChecked()){ //Single edge and/or line association + + iEdge = patternDataModel->mapToSource( _index[single_edge_le] ); + if ( !iEdge.isValid() || myLine == NULL) + { + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE EDGE ASSOCIATION" ) ); + highlightSelectedAssocs(); + return false; + } + id = myLine->shapeName+","+myLine->subid; + MESSAGE("=====> Association with geom id: " << id.toStdString()); + ssh = getDocumentModel()->getGeomPtr(id); + sh = dynamic_cast(ssh); + iGeomEdge = sh == NULL ? QModelIndex() : pgm->mapToSource(pgsm->indexBy(HEXA_DATA_ROLE, QVariant::fromValue(sh))); + if (!iGeomEdge.isValid()) + { + MESSAGE("iGeomEdge IS NOT VALID: ID = " << id.toStdString()); + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE EDGE ASSOCIATION" ) ); + highlightSelectedAssocs(); + return false; + } + assocOk = getDocumentModel()->addEdgeAssociation(iEdge, iGeomEdge, pstart_spb->value(), pend_spb->value()); + } + else { //Multiple edge and/or line association + + // edges + iEdges = getIndexList(edges_lw); + if (iEdges.count() == 0 || lines_lw->count() == 0) + { + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE EDGE ASSOCIATION" ) ); + highlightSelectedAssocs(); + return false; + } + + // lines + for (int r = 0; r < lines_lw->count(); ++r){ + item = lines_lw->item(r); + aLine = item->data(LW_ASSOC_ROLE).value(); + id = aLine.shapeName+","+aLine.subid; + ssh = getDocumentModel()->getGeomPtr(id); + sh = dynamic_cast(ssh); + if (sh == NULL) + { + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE EDGE ASSOCIATION" ) ); + highlightSelectedAssocs(); + return false; + } + shapes.push_back(sh->getParentShape()); + subIds.push_back(sh->getIdent()); + } + + if ( close_cb->isChecked() ){ //closed line + QModelIndex iFirstVertex = patternDataModel->mapToSource( _index[first_vex_le] ); + if ( !iFirstVertex.isValid() ) + { + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE EDGE ASSOCIATION" ) ); + highlightSelectedAssocs(); + return false; + } + bool inv = inverse_cb->isChecked(); + assocOk = getDocumentModel()->associateClosedLine( iFirstVertex, iEdges, shapes, subIds, pstart_spb->value(), inv ); + } else + //opened line + assocOk = getDocumentModel()->associateOpenedLine( iEdges, shapes, subIds, pstart_spb->value(), pend_spb->value() ); + } + + if ( !assocOk ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE EDGE ASSOCIATION" ) ); + highlightSelectedAssocs(); + return false; + } + + highlightSelectedAssocs(); + return true; } // ------------------------- QuadAssocDialog ---------------------------------- // ============================================================== Constructeur QuadAssocDialog::QuadAssocDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f) + HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_asso_quad_to_geom.html#associate-to-a-face-or-a-shell-of-the-geometry"; - setupUi( this ); - _initWidget(editmode); - _initViewManager(); -// setFocusProxy( quad_le ); + _helpFileName = "gui_asso_quad_to_geom.html#associate-to-a-face-or-a-shell-of-the-geometry"; + setupUi( this ); + _initWidget(editmode); + _initViewManager(); + // setFocusProxy( quad_le ); } // ============================================================== Destructeur QuadAssocDialog::~QuadAssocDialog() { - disconnect( _delFaceShortcut, SIGNAL(activated()), this, SLOT(deleteFaceItem()) ); - disconnect( HEXABLOCKGUI::selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(addFace()) ); - delete _delFaceShortcut; + disconnect( _delFaceShortcut, SIGNAL(activated()), this, SLOT(deleteFaceItem()) ); + disconnect( HEXABLOCKGUI::selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(addFace()) ); + delete _delFaceShortcut; +} + +// ============================================================== close +void QuadAssocDialog::close() +{ + HEXABLOCKGUI::assocInProgress = false; + HexaBaseDialog::close(); } // ============================================================== _initInputWidget void QuadAssocDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - quad_le->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - quad_le->installEventFilter(this); - quad_le->setValidator( validator ); + quad_le->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + quad_le->installEventFilter(this); + quad_le->setValidator( validator ); - faces_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_FACE) ); - faces_lw->installEventFilter(this); - _delFaceShortcut = new QShortcut( QKeySequence(Qt::Key_X/*Qt::Key_Delete*/), faces_lw ); - _delFaceShortcut->setContext( Qt::WidgetShortcut ); + faces_lw->setProperty( "HexaWidgetType", QVariant::fromValue(GEOMFACE_TREE) ); + faces_lw->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_FACE) ); + faces_lw->installEventFilter(this); + _delFaceShortcut = new QShortcut( QKeySequence(Qt::Key_X/*Qt::Key_Delete*/), faces_lw ); + _delFaceShortcut->setContext( Qt::WidgetShortcut ); - quad_le->setReadOnly(true); + quad_le->setReadOnly(true); - connect( _delFaceShortcut, SIGNAL(activated()), this, SLOT(deleteFaceItem()) ); - connect( faces_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfGeom()) ); + connect( _delFaceShortcut, SIGNAL(activated()), this, SLOT(deleteFaceItem()) ); + connect( faces_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfGeom()), Qt::UniqueConnection ); } // ============================================================== getAssocsVTK @@ -4867,15 +5270,15 @@ void QuadAssocDialog::_initInputWidget( Mode editmode ) */ QModelIndexList QuadAssocDialog::getAssocsVTK() { - QModelIndexList assocs; - QModelIndex iQuad; + QModelIndexList assocs; + QModelIndex iQuad; - //LineEdit content - QVariant v = quad_le->property("QModelIndex"); - if ( !v.isValid() ) - return assocs; - assocs << v.value(); - return assocs; + //LineEdit content + QVariant v = quad_le->property("QModelIndex"); + if ( !v.isValid() ) + return assocs; + assocs << v.value(); + return assocs; } // ============================================================== getAssocsGEOM @@ -4884,18 +5287,18 @@ QModelIndexList QuadAssocDialog::getAssocsVTK() */ QMultiMap QuadAssocDialog::getAssocsGEOM() { - QMultiMap assocs; - QListWidgetItem* item = NULL; - DocumentModel::GeomObj geomObj; + QMultiMap assocs; + QListWidgetItem* item = NULL; + DocumentModel::GeomObj geomObj; - //ListWidget content - unsigned int nbFaces = faces_lw->count(); - for ( int r = 0; r < nbFaces; ++r){ - item = faces_lw->item(r); - geomObj = item->data(LW_ASSOC_ROLE).value(); - assocs.insert( geomObj.entry, geomObj.subid.toInt() ); - } - return assocs; + //ListWidget content + unsigned int nbFaces = faces_lw->count(); + for ( int r = 0; r < nbFaces; ++r){ + item = faces_lw->item(r); + geomObj = item->data(LW_ASSOC_ROLE).value(); + assocs.insert( geomObj.shapeName, geomObj.subid.toInt() ); + } + return assocs; } // ============================================================== selectElementOfGeom @@ -4904,125 +5307,154 @@ QMultiMap QuadAssocDialog::getAssocsGEOM() void QuadAssocDialog::selectElementOfGeom() { - MESSAGE("HexaBaseDialog::selectElementOfGeom()"); + QListWidget* currentListWidget = dynamic_cast( sender() ); + if ( !currentListWidget ) return; - QListWidget* currentListWidget = dynamic_cast( sender() ); - if ( !currentListWidget ) return; + _selectionMutex = true; - _selectionMutex = true; + QMultiMap geomElts; + DocumentModel::GeomObj geomObj; + QList sel = currentListWidget->selectedItems(); + foreach ( QListWidgetItem *item, sel ){ + geomObj = item->data(LW_ASSOC_ROLE).value(); + geomElts.insert( geomObj.shapeName, geomObj.subid.toInt() ); + } + _selectionMutex = false; - QMultiMap geomElts; - DocumentModel::GeomObj geomObj; - QList sel = currentListWidget->selectedItems(); - foreach ( QListWidgetItem *item, sel ){ - geomObj = item->data(LW_ASSOC_ROLE).value(); - geomElts.insert( geomObj.entry, geomObj.subid.toInt() ); - } - _selectionMutex = false; + //highlight geom selected elts + if (geomElts.size() > 0 && getPatternDataSelectionModel() != NULL) + HEXABLOCKGUI::currentOccGView->highlight(geomElts); - //highlight geom selected elts - if (geomElts.size() > 0) _patternDataSelectionModel->_highlightGEOM(geomElts); - - MESSAGE("}"); } void QuadAssocDialog::clear() { - quad_le->clear(); - faces_lw->clear(); + quad_le->clear(); + modelUnregister(quad_le); + + faces_lw->clear(); + + modelUnregister(this); } // ============================================================== onCurrentSelectionChanged void QuadAssocDialog::onCurrentSelectionChanged() { - if ( !isVisible() ) - { - highlightSelectedAssocs(); - return; - } - - SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); - - bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()); - // bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type()); - if (!isOCC || !_documentModel) - { -// if (HEXABLOCKGUI::currentOccView != NULL) HEXABLOCKGUI::currentOccView->setFocus(); - highlightSelectedAssocs(); - return; - } - - GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_FACE); - DocumentModel::GeomObj* aFace = _documentModel->convertToGeomObj(aSelectedObject); - if (aFace == NULL) - { - highlightSelectedAssocs(); - return; - } - - QList twice = faces_lw->findItems( aFace->name, Qt::MatchExactly); - if ( twice.count() == 0 ){ - QListWidgetItem* item = new QListWidgetItem( aFace->name ); - item->setData( LW_ASSOC_ROLE, QVariant::fromValue(*aFace) ); - faces_lw->addItem(item); - // faces_lw->setCurrentRow( faces_lw->count() - 1 ); - } - - highlightSelectedAssocs(); + + if ( !isVisible() ) + { + highlightSelectedAssocs(); + return; + } + + SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + + bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()); + // bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type()); + if (!isOCC || !getDocumentModel()) + { + highlightSelectedAssocs(); + return; + } + + GEOM::GeomObjPtr aSelectedObject = getSelected(TopAbs_FACE); + DocumentModel::GeomObj* aFace = getDocumentModel()->convertToGeomObj(aSelectedObject); + if (aFace == NULL) + { + highlightSelectedAssocs(); + return; + } + + //don't allow selection on a geometry not associated to the document + QString mainShapeEntry; + if ( aSelectedObject->IsMainShape() ){ + mainShapeEntry = aSelectedObject->GetStudyEntry(); + } else { + GEOM::GEOM_Object_var mainShape = aSelectedObject->GetMainShape(); + mainShapeEntry = mainShape->GetStudyEntry(); + } + if (getDocumentModel()->getGeomObjName(mainShapeEntry).isEmpty()) + { + //unknown geometry + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), HexaBaseDialog::tr( "UNKNOWN_GEOMETRY" ) ); + return; + } + + QList twice = faces_lw->findItems( aFace->name, Qt::MatchExactly); + if ( twice.count() == 0 ){ + QListWidgetItem* item = new QListWidgetItem( aFace->name ); + item->setData( LW_ASSOC_ROLE, QVariant::fromValue(*aFace) ); + faces_lw->addItem(item); + // faces_lw->setCurrentRow( faces_lw->count() - 1 ); + } + + highlightSelectedAssocs(); } // ============================================================== onWindowActivated void QuadAssocDialog::onWindowActivated(SUIT_ViewManager* vm) { - SUIT_ViewWindow* v = vm->getActiveView(); - - QString vmType = vm->getType(); - if ( (vmType == SVTK_Viewer::Type()) || (vmType == VTKViewer_Viewer::Type()) ) - quad_le->setFocus(); - else if ( vmType == OCCViewer_Viewer::Type() ){ - globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); - faces_lw->setFocus(); - } + QString vmType = vm->getType(); + if ( (vmType == SVTK_Viewer::Type()) || (vmType == VTKViewer_Viewer::Type()) ) + quad_le->setFocus(); + else if ( vmType == OCCViewer_Viewer::Type() ){ + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any +// localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), TopAbs_FACE); + faces_lw->setFocus(); + } } // ============================================================== deleteFaceItem void QuadAssocDialog::deleteFaceItem() { - delete faces_lw->currentItem(); + delete faces_lw->currentItem(); } // ============================================================== apply bool QuadAssocDialog::apply(QModelIndex& result) { - highlightSelectedAssocs(); - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + highlightSelectedAssocs(); + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + PatternDataModel* patternDataModel = getPatternDataModel(); + PatternGeomModel* pgm = getPatternGeomModel(); + PatternGeomSelectionModel* pgsm = getPatternGeomSelectionModel(); - SUIT_OverrideCursor wc; - //if ( !_documentModel ) return; - if ( !_patternDataSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return false; - // quad - QModelIndex iQuad = patternDataModel->mapToSource( _index[quad_le] ); + QModelIndex iQuad, iGeomFace; + HEXA_NS::SubShape* ssh; + HEXA_NS::FaceShape* sh; + QString id; - // faces - QListWidgetItem* item = NULL; - DocumentModel::GeomObj aFace; - for ( int r = 0; r < faces_lw->count(); ++r ){ - item = faces_lw->item(r); - aFace = item->data(LW_ASSOC_ROLE).value(); - _documentModel->addAssociation( iQuad, aFace ); - } + // quad + iQuad = patternDataModel->mapToSource( _index[quad_le] ); - result = patternDataModel->mapFromSource(iQuad); + // faces + QListWidgetItem* item = NULL; + DocumentModel::GeomObj aFace; + for ( int r = 0; r < faces_lw->count(); ++r ){ + item = faces_lw->item(r); + aFace = item->data(LW_ASSOC_ROLE).value(); + id = aFace.shapeName+","+aFace.subid; + ssh = getDocumentModel()->getGeomPtr(id); + sh = dynamic_cast(ssh); + iGeomFace = sh == NULL ? QModelIndex() : pgm->mapToSource(pgsm->indexBy(HEXA_DATA_ROLE, QVariant::fromValue(sh))); + if (!getDocumentModel()->addQuadAssociation(iQuad, iGeomFace)) + { + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE QUAD ASSOCIATION" ) ); + highlightSelectedAssocs(); + return false; + } + } - highlightSelectedAssocs(); - return true; + result = patternDataModel->mapFromSource(iQuad); + + highlightSelectedAssocs(); + return true; } @@ -5032,21 +5464,21 @@ bool QuadAssocDialog::apply(QModelIndex& result) // ============================================================== Constructeur GroupDialog::GroupDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f), - _value(NULL) + HexaBaseDialog(parent, editmode, f), + _value(NULL) { - _helpFileName = "gui_groups.html#add-group"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( name_le/*eltBase_lw */); + _helpFileName = "gui_groups.html#add-group"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( name_le/*eltBase_lw */); - if ( editmode == NEW_MODE ){ - setWindowTitle( tr("Group Construction") ); - } else if ( editmode == UPDATE_MODE ){ - setWindowTitle( tr("Group Modification") ); - } else if ( editmode == INFO_MODE ){ - setWindowTitle( tr("Group Information") ); - } + if ( editmode == NEW_MODE ){ + setWindowTitle( tr("Group Construction") ); + } else if ( editmode == UPDATE_MODE ){ + setWindowTitle( tr("Group Modification") ); + } else if ( editmode == INFO_MODE ){ + setWindowTitle( tr("Group Information") ); + } } // ============================================================== Destructeur @@ -5060,214 +5492,232 @@ GroupDialog::~GroupDialog() */ QModelIndexList GroupDialog::getAssocsVTK() { - QModelIndexList assocs; - QModelIndex iItem; - QListWidgetItem* item = NULL; - //ListWidget content - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return assocs; - for ( int r = 0; r < eltBase_lw->count(); ++r){ - item = eltBase_lw->item(r); - iItem = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( iItem.isValid() ) assocs << iItem; - } - return assocs; + QModelIndexList assocs; + QModelIndex iItem; + QListWidgetItem* item = NULL; + if (getPatternDataSelectionModel() == NULL) return assocs; + //ListWidget content + const PatternDataModel* patternDataModel = getPatternDataModel(); + if ( !patternDataModel ) return assocs; + for ( int r = 0; r < eltBase_lw->count(); ++r){ + item = eltBase_lw->item(r); + iItem = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( iItem.isValid() ) assocs << iItem; + } + return assocs; } // ============================================================== _initInputWidget void GroupDialog::_initInputWidget( Mode editmode ) { - setProperty( "HexaWidgetType", QVariant::fromValue(GROUP_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(GROUP_TREE) ); + installEventFilter(this); + +// name_le->setProperty( "HexaWidgetType", QVariant::fromValue(GROUP_TREE) ); + name_le->installEventFilter(this); - name_le->setProperty( "HexaWidgetType", QVariant::fromValue(GROUP_TREE) ); - name_le->installEventFilter(this); + // kind checkbox + strKind[ HEXA_NS::HexaCell ] = "HexaCell"; + strKind[ HEXA_NS::QuadCell ] = "QuadCell"; + strKind[ HEXA_NS::EdgeCell ] = "EdgeCell"; + strKind[ HEXA_NS::HexaNode ] = "HexaNode"; + strKind[ HEXA_NS::QuadNode ] = "QuadNode"; + strKind[ HEXA_NS::EdgeNode ] = "EdgeNode"; + strKind[ HEXA_NS::VertexNode ] = "VertexNode"; + kind_cb->clear(); + QMap::ConstIterator iKind; + for( iKind = strKind.constBegin(); iKind != strKind.constEnd(); ++iKind ) + kind_cb->addItem( iKind.value(), QVariant(iKind.key()) ); - // kind checkbox - strKind[ HEXA_NS::HexaCell ] = "HexaCell"; - strKind[ HEXA_NS::QuadCell ] = "QuadCell"; - strKind[ HEXA_NS::EdgeCell ] = "EdgeCell"; - strKind[ HEXA_NS::HexaNode ] = "HexaNode"; - strKind[ HEXA_NS::QuadNode ] = "QuadNode"; - strKind[ HEXA_NS::EdgeNode ] = "EdgeNode"; - strKind[ HEXA_NS::VertexNode ] = "VertexNode"; - kind_cb->clear(); - QMap::ConstIterator iKind; - for( iKind = strKind.constBegin(); iKind != strKind.constEnd(); ++iKind ) - kind_cb->addItem( iKind.value(), QVariant(iKind.key()) ); + onKindChanged( kind_cb->currentIndex() ); + eltBase_lw->installEventFilter(this); - onKindChanged( kind_cb->currentIndex() ); - eltBase_lw->installEventFilter(this); + if ( editmode != INFO_MODE ){ + QShortcut* delEltShortcut = new QShortcut( QKeySequence(Qt::Key_X), eltBase_lw ); + delEltShortcut->setContext( Qt::WidgetShortcut ); + connect(delEltShortcut, SIGNAL(activated()), this, SLOT(removeEltBase())); + connect(kind_cb, SIGNAL(activated(int)), this, SLOT(onKindChanged(int)) ); + } - if ( editmode != INFO_MODE ){ - QShortcut* delEltShortcut = new QShortcut( QKeySequence(Qt::Key_X), eltBase_lw ); - delEltShortcut->setContext( Qt::WidgetShortcut ); - connect(delEltShortcut, SIGNAL(activated()), this, SLOT(removeEltBase())); - connect(kind_cb, SIGNAL(activated(int)), this, SLOT(onKindChanged(int)) ); - } + if ( editmode == INFO_MODE) + { + name_le->setReadOnly(true); + kind_cb->setEnabled(false); + } - connect(eltBase_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel())); + connect(eltBase_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection); } // ============================================================== clear void GroupDialog::clear() { - name_le->clear(); - eltBase_lw->clear(); + name_le->clear(); + + eltBase_lw->clear(); + modelUnregister(eltBase_lw); + + modelUnregister(this); } // ============================================================== onKindChanged void GroupDialog::onKindChanged(int index) { - // onKind - MESSAGE("GroupDialog::onKindChanged(" << index << ") "); - switch ( kind_cb->itemData(index).toInt() ){ - case HEXA_NS::HexaCell: - case HEXA_NS::HexaNode: - eltBase_lw->setProperty("HexaWidgetType", QVariant::fromValue(HEXA_TREE)); - break; + // onKind + switch ( kind_cb->itemData(index).toInt() ){ + case HEXA_NS::HexaCell: + case HEXA_NS::HexaNode: + eltBase_lw->setProperty("HexaWidgetType", QVariant::fromValue(HEXA_TREE)); + break; - case HEXA_NS::QuadCell: - case HEXA_NS::QuadNode: - eltBase_lw->setProperty("HexaWidgetType", QVariant::fromValue(QUAD_TREE)); - break; + case HEXA_NS::QuadCell: + case HEXA_NS::QuadNode: + eltBase_lw->setProperty("HexaWidgetType", QVariant::fromValue(QUAD_TREE)); + break; - case HEXA_NS::EdgeCell: - case HEXA_NS::EdgeNode: eltBase_lw->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); - break; + case HEXA_NS::EdgeCell: + case HEXA_NS::EdgeNode: eltBase_lw->setProperty("HexaWidgetType", QVariant::fromValue(EDGE_TREE)); + break; - case HEXA_NS::VertexNode: - eltBase_lw->setProperty("HexaWidgetType", QVariant::fromValue(VERTEX_TREE)); - break; + case HEXA_NS::VertexNode: + eltBase_lw->setProperty("HexaWidgetType", QVariant::fromValue(VERTEX_TREE)); + break; - default:Q_ASSERT(false); - } - eltBase_lw->clear(); - eltBase_lw->setFocus(); + default:Q_ASSERT(false); + } + eltBase_lw->clear(); + eltBase_lw->setFocus(); } // ============================================================== setValue void GroupDialog::setValue(HEXA_NS::Group* g) { - //0) name - name_le->setText( g->getName() ); + //0) name + name_le->setText( g->getName() ); - //1) kind - kind_cb->clear(); - kind_cb->addItem ( strKind[g->getKind()], QVariant( g->getKind() ) ); - // onKindChanged( kind_cb->currentIndex() ); + //1) kind + kind_cb->clear(); + kind_cb->addItem ( strKind[g->getKind()], QVariant( g->getKind() ) ); + // onKindChanged( kind_cb->currentIndex() ); - //2) elts - HEXA_NS::EltBase* eltBase = NULL; - QListWidgetItem* item = NULL; - QModelIndex iEltBase; - QList eltBaseItems; - QVariant v; + //2) elts + HEXA_NS::EltBase* eltBase = NULL; + QListWidgetItem* item = NULL; + QModelIndex iEltBase; + QList eltBaseItems; + QVariant v; - if ( !_patternDataSelectionModel ) return; - if ( !_groupsSelectionModel ) return; + if ( !getPatternDataSelectionModel() ) return; + if ( !getGroupsSelectionModel() ) return; - QModelIndex iGroup = _groupsSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(g) ); - name_le->setProperty( "QModelIndex", QVariant::fromValue(iGroup) ); + QModelIndex iGroup = getGroupsSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(g) ); + name_le->setProperty( "QModelIndex", QVariant::fromValue(iGroup) ); - for ( int nr = 0; nr < g->countElement(); ++nr ){ - eltBase = g->getElement( nr ); - switch ( g->getKind() ){ - case HEXA_NS::HexaCell: case HEXA_NS::HexaNode: v = QVariant::fromValue( (HEXA_NS::Hexa *)eltBase ); break; - case HEXA_NS::QuadCell: case HEXA_NS::QuadNode: v = QVariant::fromValue( (HEXA_NS::Quad *)eltBase ); break; - case HEXA_NS::EdgeCell: case HEXA_NS::EdgeNode: v = QVariant::fromValue( (HEXA_NS::Edge *)eltBase ); break; - case HEXA_NS::VertexNode: v = QVariant::fromValue( (HEXA_NS::Vertex *)eltBase ); break; - } - iEltBase = _patternDataSelectionModel->indexBy( HEXA_DATA_ROLE, v); - if ( iEltBase.isValid() ){ - item = new QListWidgetItem( eltBase->getName() ); - item->setData( LW_QMODELINDEX_ROLE, QVariant::fromValue(iEltBase) ); - eltBase_lw->addItem( item ); - } - } + for ( int nr = 0; nr < g->countElement(); ++nr ){ + eltBase = g->getElement( nr ); + switch ( g->getKind() ){ + case HEXA_NS::HexaCell: case HEXA_NS::HexaNode: v = QVariant::fromValue( (HEXA_NS::Hexa *)eltBase ); break; + case HEXA_NS::QuadCell: case HEXA_NS::QuadNode: v = QVariant::fromValue( (HEXA_NS::Quad *)eltBase ); break; + case HEXA_NS::EdgeCell: case HEXA_NS::EdgeNode: v = QVariant::fromValue( (HEXA_NS::Edge *)eltBase ); break; + case HEXA_NS::VertexNode: v = QVariant::fromValue( (HEXA_NS::Vertex *)eltBase ); break; + } + iEltBase = getPatternDataSelectionModel()->indexBy( HEXA_DATA_ROLE, v); + if ( iEltBase.isValid() ){ + item = new QListWidgetItem( eltBase->getName() ); + item->setData( LW_QMODELINDEX_ROLE, QVariant::fromValue(iEltBase) ); + item->setData(LW_DATA_ROLE, iEltBase.data(HEXA_DATA_ROLE)); + eltBase_lw->addItem( item ); + } + } - _value = g; + _value = g; } // ============================================================== getValue HEXA_NS::Group* GroupDialog::getValue() { - return _value; + return _value; } // ============================================================== removeEltBase void GroupDialog::removeEltBase() { - QListWidgetItem *item = eltBase_lw->currentItem(); + QListWidgetItem *item = eltBase_lw->currentItem(); - if (item) { - int r = eltBase_lw->row(item); - eltBase_lw->takeItem(r); - delete item; - } + if (item) { + int r = eltBase_lw->row(item); + eltBase_lw->takeItem(r); + delete item; + } } // ============================================================== apply bool GroupDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - - if ( !_documentModel ) return false; - if ( !_patternDataSelectionModel ) return false; - if ( !_groupsSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const GroupsModel* groupsModel = dynamic_cast( _groupsSelectionModel->model() ); - - QString grpName = name_le->text(); - DocumentModel::Group grpKind = static_cast( kind_cb->itemData( kind_cb->currentIndex() ).toInt()); - QModelIndex iGrp; - if ( _value == NULL ){ // create group - iGrp = _documentModel->addGroup( grpName, grpKind ); - } else { - QModelIndexList iGrps = _documentModel->match( - _documentModel->index(0, 0), - HEXA_DATA_ROLE, - QVariant::fromValue( _value ), - 1, - Qt::MatchRecursive ); - if ( !iGrps.isEmpty() ) - iGrp = iGrps[0]; - } - - // kind_cb-> - if ( !iGrp.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD GROUP" ) ); - return false; - } - - //fill it and select it - QModelIndex iEltBase; - QListWidgetItem* item = NULL; - bool eltAdded = false; - _documentModel->clearGroupElement(iGrp); - for ( int r = 0; r < eltBase_lw->count(); ++r){ - item = eltBase_lw->item(r); - iEltBase = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( iEltBase.isValid() ) - eltAdded = _documentModel->addGroupElement( iGrp, iEltBase ); - // if ( eltAdded == false ){ - // //SUIT_MessageBox::information( this, tr( "HEXA_INFO" ), tr( "ELEMENT NOT ADDED : %1" ).arg( iEltBase.data().toString() )); - // } - } - - QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ - _documentModel->setName( iGrp, newName ); - - result = groupsModel->mapFromSource(iGrp); - - return true; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const GroupsModel* groupsModel = getGroupsModel(); + if (patternDataModel == NULL || groupsModel == NULL) return false; + + QString grpName = name_le->text(); + DocumentModel::Group grpKind = static_cast( kind_cb->itemData( kind_cb->currentIndex() ).toInt()); + QModelIndex iGrp; + if ( _value == NULL ){ // create group + iGrp = getDocumentModel()->addGroup( grpName, grpKind ); + } else { + QModelIndexList iGrps = getDocumentModel()->match( + getDocumentModel()->index(0, 0), + HEXA_DATA_ROLE, + QVariant::fromValue( _value ), + 1, + Qt::MatchRecursive ); + if ( !iGrps.isEmpty() ) + iGrp = iGrps[0]; + } + + // kind_cb-> + if ( !iGrp.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD GROUP" ) ); + return false; + } + + //fill it and select it + QModelIndex iEltBase; + QListWidgetItem* item = NULL; + bool eltAdded = false; + getDocumentModel()->clearGroupElement(iGrp); + for ( int r = 0; r < eltBase_lw->count(); ++r){ + item = eltBase_lw->item(r); + iEltBase = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( iEltBase.isValid() ) + eltAdded = getDocumentModel()->addGroupElement( iGrp, iEltBase ); + // if ( eltAdded == false ){ + // //SUIT_MessageBox::information( this, tr( "HEXA_INFO" ), tr( "ELEMENT NOT ADDED : %1" ).arg( iEltBase.data().toString() )); + // } + } + + QString newName = name_le->text(); + if ( !newName.isEmpty() )/*{*/ + getDocumentModel()->setName( iGrp, newName ); + + HEXA_NS::Group* hGroup = getDocumentModel()->data(iGrp, HEXA_DATA_ROLE).value(); + if (hGroup != NULL) + { + char buffer [16]; + name_le->setText(hGroup->getNextName(buffer)); +// updateDefaultName(name_le, hGroup->getType()); //to be tested to debug default name + } + + result = groupsModel->mapFromSource(iGrp); + + return true; } @@ -5280,14 +5730,17 @@ LawDialog::LawDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ) : HexaBaseDialog(parent, editmode, f), _value(NULL) { - _helpFileName = "gui_discret_law.html#add-law"; - setupUi( this ); - _initWidget(editmode); - if ( editmode == NEW_MODE ){ - setWindowTitle( tr("Law Construction") ); - } else if ( editmode == UPDATE_MODE ){ - setWindowTitle( tr("Law Modification") ); - } + _helpFileName = "gui_discret_law.html#add-law"; + setupUi( this ); + _initWidget(editmode); + if ( editmode == NEW_MODE ){ + setWindowTitle( tr("Law Construction") ); + } else if ( editmode == UPDATE_MODE ){ + setWindowTitle( tr("Law Modification") ); + } + else if ( editmode == INFO_MODE){ + setWindowTitle( tr("Law Information") ); + } } // ============================================================== Destructeur @@ -5298,106 +5751,122 @@ LawDialog::~LawDialog() // ============================================================== _initInputWidget void LawDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + +// setProperty( "HexaWidgetType", QVariant::fromValue(LAW_TREE) ); + installEventFilter(this); - setProperty( "HexaWidgetType", QVariant::fromValue(LAW_TREE) ); - installEventFilter(this); +// name_le->setProperty( "HexaWidgetType", QVariant::fromValue(LAW_TREE) ); + name_le->installEventFilter(this); - name_le->setProperty( "HexaWidgetType", QVariant::fromValue(LAW_TREE) ); - name_le->installEventFilter(this); + // kind checkbox + strKind[ HEXA_NS::Uniform ] = "Uniform"; + strKind[ HEXA_NS::Arithmetic ] = "Arithmetic"; + strKind[ HEXA_NS::Geometric ] = "Geometric"; - // kind checkbox - strKind[ HEXA_NS::Uniform ] = "Uniform"; - strKind[ HEXA_NS::Arithmetic ] = "Arithmetic"; - strKind[ HEXA_NS::Geometric ] = "Geometric"; + kind_cb->clear(); + QMap::ConstIterator iKind; + for( iKind = strKind.constBegin(); iKind != strKind.constEnd(); ++iKind ) + kind_cb->addItem( iKind.value(), QVariant(iKind.key()) ); - kind_cb->clear(); - QMap::ConstIterator iKind; - for( iKind = strKind.constBegin(); iKind != strKind.constEnd(); ++iKind ) - kind_cb->addItem( iKind.value(), QVariant(iKind.key()) ); + if (editmode == INFO_MODE) + { + name_le->setReadOnly(true); + nb_nodes_spb->setReadOnly(true); + coeff_spb->setReadOnly(true); + kind_cb->setEnabled(false); + } } // ============================================================== clear void LawDialog::clear() { - name_le->clear(); + name_le->clear(); + + modelUnregister(this); } // ============================================================== setValue void LawDialog::setValue(HEXA_NS::Law* l) { - // 0) name - name_le->setText( l->getName() ); + // 0) name + name_le->setText( l->getName() ); - nb_nodes_spb->setValue( l->getNodes() ); - coeff_spb->setValue( l->getCoefficient() ); + nb_nodes_spb->setValue( l->getNodes() ); + coeff_spb->setValue( l->getCoefficient() ); - HEXA_NS::KindLaw k = l->getKind(); - kind_cb->setCurrentIndex( kind_cb->findData(k) ); + HEXA_NS::KindLaw k = l->getKind(); + kind_cb->setCurrentIndex( kind_cb->findData(k) ); - _value = l; + _value = l; } // ============================================================== getValue HEXA_NS::Law* LawDialog::getValue() { - return _value; + return _value; } - // ============================================================== apply bool LawDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; - SUIT_OverrideCursor wc; - if ( !_documentModel ) return false; - if ( !_meshSelectionModel ) return false; + const MeshModel* meshModel = getMeshModel(); + if (meshModel == NULL) return false; - const MeshModel* meshModel = dynamic_cast( _meshSelectionModel->model() ); + QString lawName = name_le->text(); + int nbnodes = nb_nodes_spb->value(); + double coeff = coeff_spb->value(); + DocumentModel::KindLaw lawKind = static_cast( kind_cb->itemData( kind_cb->currentIndex() ).toInt()); - QString lawName = name_le->text(); - int nbnodes = nb_nodes_spb->value(); - double coeff = coeff_spb->value(); - DocumentModel::KindLaw lawKind = static_cast( kind_cb->itemData( kind_cb->currentIndex() ).toInt()); + QModelIndex iLaw; + if ( _value == NULL ){ // create Law + iLaw = getDocumentModel()->addLaw( lawName, nbnodes ); + } else { + QModelIndexList iLaws = getDocumentModel()->match( + getDocumentModel()->index(0, 0), + HEXA_DATA_ROLE, + QVariant::fromValue( _value ), + 1, + Qt::MatchRecursive ); + if ( !iLaws.isEmpty() ) + iLaw = iLaws[0]; + } + if ( !iLaw.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD LAW" ) ); + return false; + } + //fill it and select it + bool setOk = getDocumentModel()->setLaw( iLaw, nbnodes, coeff, lawKind ); + if ( !setOk ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD LAW" ) ); + return false; + } - QModelIndex iLaw; - if ( _value == NULL ){ // create Law - iLaw = _documentModel->addLaw( lawName, nbnodes ); - } else { - QModelIndexList iLaws = _documentModel->match( - _documentModel->index(0, 0), - HEXA_DATA_ROLE, - QVariant::fromValue( _value ), - 1, - Qt::MatchRecursive ); - if ( !iLaws.isEmpty() ) - iLaw = iLaws[0]; - } + QString newName = name_le->text(); + if ( !newName.isEmpty() )/*{*/ + getDocumentModel()->setName( iLaw, newName ); - if ( !iLaw.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD LAW" ) ); - return false; - } - //fill it and select it - bool setOk = _documentModel->setLaw( iLaw, nbnodes, coeff, lawKind ); - if ( !setOk ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT ADD LAW" ) ); - return false; - } + HEXA_NS::Law* hLaw = getDocumentModel()->data(iLaw, HEXA_DATA_ROLE).value(); + if (hLaw != NULL) + { + char buffer [16]; + name_le->setText(hLaw->getNextName(buffer)); +// updateDefaultName(name_le, hLaw->getType()); //to be tested to debug default name - QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ - _documentModel->setName( iLaw, newName ); + } - result = meshModel->mapFromSource(iLaw); + result = meshModel->mapFromSource(iLaw); - return true; + return true; } @@ -5411,23 +5880,23 @@ PropagationDialog::PropagationDialog( QWidget* parent, Mode editmode, Qt::Window : HexaBaseDialog(parent, editmode, f), _value(NULL) { - _helpFileName = "gui_propag.html"; - setupUi( this ); - _initWidget(editmode); - // setFocusProxy( law_le ); -// setFocusProxy( propagations_lw ); + _helpFileName = "gui_propag.html"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( law_le ); + // setFocusProxy( propagations_lw ); - if ( editmode == INFO_MODE ){ - setWindowTitle( tr("Propagation Information") ); - if (groupBox_2) - delete groupBox_2; - } else if ( editmode == UPDATE_MODE ){ - setWindowTitle( tr("Propagation Modification") ); - if (groupBox_2) - delete groupBox_2; - } else if ( editmode == NEW_MODE ){ - setWindowTitle( tr("Propagation(s) Setting") ); - } + if ( editmode == INFO_MODE ){ + setWindowTitle( tr("Propagation Information") ); + if (groupBox_2) + delete groupBox_2; + } else if ( editmode == UPDATE_MODE ){ + setWindowTitle( tr("Propagation Modification") ); + if (groupBox_2) + delete groupBox_2; + } else if ( editmode == NEW_MODE ){ + setWindowTitle( tr("Propagation(s) Setting") ); + } } @@ -5440,65 +5909,74 @@ PropagationDialog::~PropagationDialog() // ============================================================== _initInputWidget void PropagationDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); + +// setProperty( "HexaWidgetType", QVariant::fromValue(PROPAGATION_TREE) ); + installEventFilter(this); - setProperty( "HexaWidgetType", QVariant::fromValue(PROPAGATION_TREE) ); - installEventFilter(this); + law_le->setProperty( "HexaWidgetType", QVariant::fromValue(LAW_TREE) ); + law_le->installEventFilter(this); + law_le->setValidator( validator ); - law_le->setProperty( "HexaWidgetType", QVariant::fromValue(LAW_TREE) ); - law_le->installEventFilter(this); - law_le->setValidator( validator ); + propagations_lw->setProperty( "HexaWidgetType", QVariant::fromValue(PROPAGATION_TREE) ); + propagations_lw->installEventFilter(this); - propagations_lw->setProperty( "HexaWidgetType", QVariant::fromValue(PROPAGATION_TREE) ); - propagations_lw->installEventFilter(this); + QShortcut* delPropagationShortcut = new QShortcut(QKeySequence(/*Qt::Key_Delete*/Qt::Key_X/*Qt::Key_Alt*//*Qt::Key_Space*/), propagations_lw); + delPropagationShortcut->setContext( Qt::WidgetShortcut ); - QShortcut* delPropagationShortcut = new QShortcut(QKeySequence(/*Qt::Key_Delete*/Qt::Key_X/*Qt::Key_Alt*//*Qt::Key_Space*/), propagations_lw); - delPropagationShortcut->setContext( Qt::WidgetShortcut ); + law_le->setReadOnly(true); - law_le->setReadOnly(true); + if ( editmode == INFO_MODE) + way_cb->setEnabled(false); - connect( delPropagationShortcut, SIGNAL(activated()), this, SLOT(deletePropagationItem()) ); - connect( propagations_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()) ); + connect( delPropagationShortcut, SIGNAL(activated()), this, SLOT(deletePropagationItem()) ); + connect( propagations_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection ); } // ============================================================== clear void PropagationDialog::clear() { - propagations_lw->clear(); - law_le->clear(); + propagations_lw->clear(); + modelUnregister(propagations_lw); + + law_le->clear(); + modelUnregister(law_le); + + modelUnregister(this); } // ============================================================== deletePropagationItem void PropagationDialog::deletePropagationItem() { - delete propagations_lw->currentItem(); + delete propagations_lw->currentItem(); } // ============================================================== setValue void PropagationDialog::setValue(HEXA_NS::Propagation* p) { - HEXA_NS::Law* l = p->getLaw(); - bool way = p->getWay(); + if (getMeshSelectionModel() == NULL) return; + HEXA_NS::Law* l = p->getLaw(); + bool way = p->getWay(); - // propagation - QModelIndex ip = _meshSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(p) ); - setProperty( "QModelIndex", QVariant::fromValue(ip) ); + // propagation + QModelIndex ip = getMeshSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(p) ); + setProperty( "QModelIndex", QVariant::fromValue(ip) ); - // law on propagation - if ( l != NULL ){ - law_le->setText( l->getName() ); - QModelIndex il = _meshSelectionModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(l) ); - law_le->setProperty( "QModelIndex", QVariant::fromValue(il) ); - } + // law on propagation + if ( l != NULL ){ + law_le->setText( l->getName() ); + QModelIndex il = getMeshSelectionModel()->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(l) ); + law_le->setProperty( "QModelIndex", QVariant::fromValue(il) ); + } - // way of propagation - way_cb->setChecked(way); + // way of propagation + way_cb->setChecked(way); - _value = p; + _value = p; } // ============================================================== selectElementOfModel @@ -5508,81 +5986,76 @@ void PropagationDialog::setValue(HEXA_NS::Propagation* p) void PropagationDialog::selectElementOfModel() { - MESSAGE("HexaBaseDialog::selectElementOfModel()"); - if (!_meshSelectionModel) return; + if (!getMeshSelectionModel()) return; - QListWidget* currentListWidget = dynamic_cast( sender() ); - if ( !currentListWidget ) return; + QListWidget* currentListWidget = dynamic_cast( sender() ); + if ( !currentListWidget ) return; - _selectionMutex = true; + _selectionMutex = true; - QList sel = currentListWidget->selectedItems(); - QModelIndex index; - _meshSelectionModel->clearSelection(); - foreach ( QListWidgetItem *item, sel ){ - index = item->data(LW_QMODELINDEX_ROLE).value(); - if ( index.isValid() ) - { - MESSAGE( "* selecting the element : " << index.data().toString().toStdString() ); - _meshSelectionModel->select( index, QItemSelectionModel::Select ); - } - } - _selectionMutex = false; + QList sel = currentListWidget->selectedItems(); + QModelIndex index; + getMeshSelectionModel()->clearSelection(); + foreach ( QListWidgetItem *item, sel ){ + index = item->data(LW_QMODELINDEX_ROLE).value(); + if ( index.isValid() ) + { + getMeshSelectionModel()->select( index, QItemSelectionModel::Select ); + } + } + _selectionMutex = false; - MESSAGE("}"); } // ============================================================== getValue HEXA_NS::Propagation* PropagationDialog::getValue() { - return _value; + return _value; } // ============================================================== apply bool PropagationDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - bool isOk = false; - SUIT_OverrideCursor wc; - if ( !_documentModel ) return false; - if ( !_meshSelectionModel ) return false; + bool isOk = false; + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const MeshModel* meshModel = getMeshModel(); + if (meshModel == NULL) return false; - const MeshModel* meshModel = dynamic_cast( _meshSelectionModel->model() ); - bool way = way_cb->isChecked(); - QListWidgetItem* item = NULL; + bool way = way_cb->isChecked(); + QListWidgetItem* item = NULL; - QModelIndex iPropagation; - QModelIndex iLaw = meshModel->mapToSource( law_le->property("QModelIndex").value() ); - if (!iLaw.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT SET PROPAGATION" ) ); - return false; - } - MESSAGE("iLaw.isValid() => " << iLaw.isValid() ); + QModelIndex iPropagation; + QModelIndex iLaw = meshModel->mapToSource( law_le->property("QModelIndex").value() ); + if (!iLaw.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT SET PROPAGATION" ) ); + return false; + } - for (int r = 0; r < propagations_lw->count(); ++r){ - item = propagations_lw->item(r); - iPropagation = meshModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( !iPropagation.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT SET PROPAGATION" ) ); - return false; - } - MESSAGE("iPropagation.isValid() => " << iPropagation.isValid() ); + for (int r = 0; r < propagations_lw->count(); ++r){ + item = propagations_lw->item(r); + iPropagation = meshModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( !iPropagation.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT SET PROPAGATION" ) ); + return false; + } - //fill it and select it - isOk = _documentModel->setPropagation( iPropagation, iLaw, way ); - if ( !isOk ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT SET PROPAGATION" ) ); - return false; - } + //fill it and select it + isOk = getDocumentModel()->setPropagation( iPropagation, iLaw, way ); + if ( !isOk ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT SET PROPAGATION" ) ); + return false; + } - result = meshModel->mapFromSource(iPropagation); - } + result = meshModel->mapFromSource(iPropagation); + } - return true; + return true; } @@ -5591,41 +6064,41 @@ bool PropagationDialog::apply(QModelIndex& result) // ============================================================== Constructeur ComputeMeshDialog::ComputeMeshDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f) + HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_mesh.html"; - setWindowTitle( tr("Compute mesh") ); - QVBoxLayout* layout = new QVBoxLayout; - setLayout(layout); + _helpFileName = "gui_mesh.html"; + setWindowTitle( tr("Compute mesh") ); + QVBoxLayout* layout = new QVBoxLayout; + setLayout(layout); - QHBoxLayout* up = new QHBoxLayout; - QHBoxLayout* down = new QHBoxLayout; + QHBoxLayout* up = new QHBoxLayout; + QHBoxLayout* down = new QHBoxLayout; - layout->addLayout(up); - layout->addLayout(down); + layout->addLayout(up); + layout->addLayout(down); - QVBoxLayout* vlg = new QVBoxLayout; - QVBoxLayout* vld = new QVBoxLayout; + QVBoxLayout* vlg = new QVBoxLayout; + QVBoxLayout* vld = new QVBoxLayout; - up->addLayout(vlg); - up->addLayout(vld); + up->addLayout(vlg); + up->addLayout(vld); - vlg->addWidget(new QLabel("Name")); - vlg->addWidget(new QLabel("Dimension")); - vlg->addWidget(new QLabel("Container")); + vlg->addWidget(new QLabel("Name")); + vlg->addWidget(new QLabel("Dimension")); + vlg->addWidget(new QLabel("Container")); - _name = new QLineEdit("Mesh"); - _dim = new QSpinBox(); - _fact = new QLineEdit("FactoryServer"); + _name = new QLineEdit("Mesh"); + _dim = new QSpinBox(); + _fact = new QLineEdit("FactoryServer"); - vld->addWidget(_name); - vld->addWidget(_dim); - vld->addWidget(_fact); + vld->addWidget(_name); + vld->addWidget(_dim); + vld->addWidget(_fact); - _dim->setRange(1, 3); - _dim->setValue(3); + _dim->setRange(1, 3); + _dim->setValue(3); - _initWidget(editmode); + _initWidget(editmode); } @@ -5643,40 +6116,42 @@ void ComputeMeshDialog::_initInputWidget( Mode editmode ) // ============================================================== setDocumentModel void ComputeMeshDialog::setDocumentModel(DocumentModel* m) { - HexaBaseDialog::setDocumentModel(m); - _name->setText(_documentModel->getName()); +// HexaBaseDialog::setDocumentModel(m); + if (m == NULL) return; + _name->setText(m->getName()); } // ============================================================== clear void ComputeMeshDialog::clear() { + modelUnregister(this); } // ============================================================== apply bool ComputeMeshDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; - QString command = QString("import hexablock ; %1 = hexablock.mesh(\"%2\", \"%1\", %3, \"%4\")") - .arg( _name->text() ) - .arg( _documentModel->documentEntry() ) - .arg( _dim->value() ) - .arg( _fact->text() ); - //std::cout << "command: " << command.toStdString() << std::endl; + SUIT_OverrideCursor wc; + if (getDocumentModel() == NULL) return false; + QString command = QString("import hexablock ; %1 = hexablock.mesh(\"%2\", \"%1\", %3, \"%4\")") + .arg( _name->text() ) + .arg( getDocumentModel()->getName() ) + .arg( _dim->value() ) + .arg( _fact->text() ); + //std::cout << "command: " << command.toStdString() << std::endl; - SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ); - PyConsole_Console* pyConsole = app->pythonConsole(); + SalomeApp_Application* app = dynamic_cast( SUIT_Session::session()->activeApplication() ); + PyConsole_Console* pyConsole = app->pythonConsole(); - if ( pyConsole ) - pyConsole->exec( command ); - else - return false; + if ( pyConsole ) + pyConsole->exec( command ); + else + return false; - // clear(); - return true; + // clear(); + return true; } // void ComputeMeshDialog::accept() { @@ -5685,7 +6160,7 @@ bool ComputeMeshDialog::apply(QModelIndex& result) // // QString command = QString("import hexablock ; %1 = hexablock.mesh(\"%1\", \"%2\", %3, \"%4\")") // .arg( _name->text() ) -// .arg( _documentModel->documentEntry() ) +// .arg( getDocumentModel()->documentEntry() ) // .arg( _dim->value() ) // .arg( _fact->text() ); // std::cout << "command: " << command.toStdString() << std::endl; @@ -5708,12 +6183,12 @@ bool ComputeMeshDialog::apply(QModelIndex& result) // ============================================================== Constructeur ReplaceHexaDialog::ReplaceHexaDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f) + HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_replace_hexa.html"; - setupUi( this ); - _initWidget(editmode); -// setFocusProxy( quads_lw ); + _helpFileName = "gui_replace_hexa.html"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( quads_lw ); } // ============================================================== Destructeur @@ -5727,162 +6202,186 @@ ReplaceHexaDialog::~ReplaceHexaDialog() */ QModelIndexList ReplaceHexaDialog::getAssocsVTK() { - QModelIndexList assocs; - QModelIndex iQuad; - QListWidgetItem* item = NULL; + QModelIndexList assocs; + QModelIndex iQuad; + QListWidgetItem* item = NULL; - //ListWidget content - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return assocs; - for ( int r = 0; r < quads_lw->count(); ++r ){ - item = quads_lw->item(r); -// iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); //unsafe - iQuad = _patternDataSelectionModel->indexBy(HEXA_DATA_ROLE, item->data(LW_DATA_ROLE)); - if ( iQuad.isValid() ) assocs << iQuad; - } - return assocs; + //ListWidget content + const PatternDataModel* patternDataModel = getPatternDataModel(); + if ( !patternDataModel ) return assocs; + for ( int r = 0; r < quads_lw->count(); ++r ){ + item = quads_lw->item(r); + // iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); //unsafe + iQuad = getPatternDataSelectionModel()->indexBy(HEXA_DATA_ROLE, item->data(LW_DATA_ROLE)); + if ( iQuad.isValid() ) assocs << iQuad; + } + return assocs; } // ============================================================== _initInputWidget void ReplaceHexaDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); - c1_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - c2_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - c3_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + c1_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + c2_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + c3_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - p1_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - p2_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - p3_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + p1_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + p2_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + p3_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - name_le->installEventFilter(this); - c1_le->installEventFilter(this); - c2_le->installEventFilter(this); - c3_le->installEventFilter(this); +// name_le->installEventFilter(this); + c1_le->installEventFilter(this); + c2_le->installEventFilter(this); + c3_le->installEventFilter(this); - p1_le->installEventFilter(this); - p2_le->installEventFilter(this); - p3_le->installEventFilter(this); + p1_le->installEventFilter(this); + p2_le->installEventFilter(this); + p3_le->installEventFilter(this); - quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - quads_lw->installEventFilter(this); + quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + quads_lw->installEventFilter(this); - if ( editmode == NEW_MODE ){ - QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); - delQuadShortcut->setContext( Qt::WidgetShortcut ); + if ( editmode == NEW_MODE ){ + QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); + delQuadShortcut->setContext( Qt::WidgetShortcut ); - connect( delQuadShortcut, SIGNAL(activated()), this, SLOT(deleteQuadItem()) ); - connect( quads_lw, SIGNAL(currentRowChanged(int)), this, SLOT(updateButtonBox(int)) ); - } + connect( delQuadShortcut, SIGNAL(activated()), this, SLOT(deleteQuadItem()) ); + connect( quads_lw, SIGNAL(currentRowChanged(int)), this, SLOT(updateButtonBox(int)) ); + } - c1_le->setReadOnly(true); - c2_le->setReadOnly(true); - c3_le->setReadOnly(true); + c1_le->setReadOnly(true); + c2_le->setReadOnly(true); + c3_le->setReadOnly(true); - p1_le->setReadOnly(true); - p2_le->setReadOnly(true); - p3_le->setReadOnly(true); + p1_le->setReadOnly(true); + p2_le->setReadOnly(true); + p3_le->setReadOnly(true); - connect(quads_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel())); + connect(quads_lw, SIGNAL(itemSelectionChanged()), + this, SLOT(selectElementOfModel()), Qt::UniqueConnection); } // ============================================================== clear void ReplaceHexaDialog::clear() { +// name_le->clear(); + + quads_lw->clear(); + modelUnregister(quads_lw); + + p1_le->clear(); + modelUnregister(p1_le); + + p2_le->clear(); + modelUnregister(p2_le); + + p3_le->clear(); + modelUnregister(p3_le); + + c1_le->clear(); + modelUnregister(c1_le); + + c2_le->clear(); + modelUnregister(c2_le); + + c3_le->clear(); + modelUnregister(c3_le); + + modelUnregister(this); } // ============================================================== updateButtonBox void ReplaceHexaDialog::updateButtonBox() { - int nbQuad = quads_lw->count(); + int nbQuad = quads_lw->count(); - if ( nbQuad > 0 ){ - //_applyCloseButton->setEnabled(true); - _applyButton->setEnabled(true); - } else { - //_applyCloseButton->setEnabled(false); - _applyButton->setEnabled(false); - } + if ( nbQuad > 0 ){ + //_applyCloseButton->setEnabled(true); + _applyButton->setEnabled(true); + } else { + //_applyCloseButton->setEnabled(false); + _applyButton->setEnabled(false); + } } // ============================================================== deleteQuadItem void ReplaceHexaDialog::deleteQuadItem() { - delete quads_lw->currentItem(); - updateButtonBox(); + delete quads_lw->currentItem(); + updateButtonBox(); } // ============================================================== apply bool ReplaceHexaDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - if ( !_documentModel ) return false; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; - - QModelIndex ielts; //result - - QListWidgetItem* item = NULL; - QModelIndexList iquads; - QModelIndex iquad; - for ( int r = 0; r < quads_lw->count(); ++r){ - item = quads_lw->item(r); - iquad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - //std::cout << "iquad => " << iquad.data().toString().toStdString() << std::endl; - if ( iquad.isValid() ) - iquads << iquad; - } - - QModelIndex ic1 = patternDataModel->mapToSource( _index[c1_le] ); - QModelIndex ic2 = patternDataModel->mapToSource( _index[c2_le] ); - QModelIndex ic3 = patternDataModel->mapToSource( _index[c3_le] ); - - QModelIndex ip1 = patternDataModel->mapToSource( _index[p1_le] ); - QModelIndex ip2 = patternDataModel->mapToSource( _index[p2_le] ); - QModelIndex ip3 = patternDataModel->mapToSource( _index[p3_le] ); - - // std::cout << "nbHexa => " << nbHexa << std::endl; - - if ( ic1.isValid() && ic2.isValid() && ic3.isValid() - && ip1.isValid() && ip2.isValid() && ip3.isValid() ){ - ielts = _documentModel->replace( iquads, - ip1, ic1, - ip2, ic2, - ip3, ic3 ); - } + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; + + QModelIndex ielts; //result + + QListWidgetItem* item = NULL; + QModelIndexList iquads; + QModelIndex iquad; + for ( int r = 0; r < quads_lw->count(); ++r){ + item = quads_lw->item(r); + iquad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + //std::cout << "iquad => " << iquad.data().toString().toStdString() << std::endl; + if ( iquad.isValid() ) + iquads << iquad; + } + + QModelIndex ic1 = patternDataModel->mapToSource( _index[c1_le] ); + QModelIndex ic2 = patternDataModel->mapToSource( _index[c2_le] ); + QModelIndex ic3 = patternDataModel->mapToSource( _index[c3_le] ); + + QModelIndex ip1 = patternDataModel->mapToSource( _index[p1_le] ); + QModelIndex ip2 = patternDataModel->mapToSource( _index[p2_le] ); + QModelIndex ip3 = patternDataModel->mapToSource( _index[p3_le] ); + + // std::cout << "nbHexa => " << nbHexa << std::endl; + + if ( ic1.isValid() && ic2.isValid() && ic3.isValid() + && ip1.isValid() && ip2.isValid() && ip3.isValid() ){ + ielts = getDocumentModel()->replace( iquads, + ip1, ic1, + ip2, ic2, + ip3, ic3 ); + } + + if ( !ielts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT REPLACE HEXA" ) ); + return false; + } + _value = ielts.model()->data(ielts, HEXA_DATA_ROLE).value(); - if ( !ielts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT REPLACE HEXA" ) ); - return false; - } - _value = ielts.model()->data(ielts, HEXA_DATA_ROLE).value(); - - QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ - _documentModel->setName( ielts, newName ); +// QString newName = name_le->text(); +// if ( !newName.isEmpty() )/*{*/ +// getDocumentModel()->setName( ielts, newName ); +// +// updateDefaultName(name_le, ielts); - result = patternBuilderModel->mapFromSource(ielts); + result = patternBuilderModel->mapFromSource(ielts); - //update the list (indexes) - for ( int r = 0; r < quads_lw->count(); ++r ){ - item = quads_lw->item(r); - iquad = _patternDataSelectionModel->indexBy(HEXA_DATA_ROLE, item->data(LW_DATA_ROLE)); - item->setData( LW_QMODELINDEX_ROLE, QVariant::fromValue(iquad) ); - } + //update the list (indexes) + for ( int r = 0; r < quads_lw->count(); ++r ){ + item = quads_lw->item(r); + iquad = getPatternDataSelectionModel()->indexBy(HEXA_DATA_ROLE, item->data(LW_DATA_ROLE)); + item->setData( LW_QMODELINDEX_ROLE, QVariant::fromValue(iquad) ); + item->setData(LW_DATA_ROLE, iquad.data(HEXA_DATA_ROLE)); + } - return true; + return true; } @@ -5893,12 +6392,12 @@ bool ReplaceHexaDialog::apply(QModelIndex& result) // ============================================================== Constructeur QuadRevolutionDialog::QuadRevolutionDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f) + HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_quad_revolution.html"; - setupUi( this ); - _initWidget(editmode); -// setFocusProxy( quads_lw ); + _helpFileName = "gui_quad_revolution.html"; + setupUi( this ); + _initWidget(editmode); + // setFocusProxy( quads_lw ); } // ============================================================== getAssocsVTK @@ -5907,20 +6406,21 @@ QuadRevolutionDialog::QuadRevolutionDialog( QWidget* parent, Mode editmode, Qt:: */ QModelIndexList QuadRevolutionDialog::getAssocsVTK() { - QModelIndexList assocs; - QModelIndex iQuad; - QListWidgetItem* item = NULL; + QModelIndexList assocs; + QModelIndex iQuad; + QListWidgetItem* item = NULL; + if (getPatternDataSelectionModel() == NULL) return assocs; - //ListWidget content - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternDataModel ) return assocs; - for ( int r = 0; r < quads_lw->count(); ++r ){ - item = quads_lw->item(r); - iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( iQuad.isValid() ) - assocs << iQuad; - } - return assocs; + //ListWidget content + const PatternDataModel* patternDataModel = getPatternDataModel(); + if ( !patternDataModel ) return assocs; + for ( int r = 0; r < quads_lw->count(); ++r ){ + item = quads_lw->item(r); + iQuad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( iQuad.isValid() ) + assocs << iQuad; + } + return assocs; } // ============================================================== Destructeur @@ -5931,149 +6431,163 @@ QuadRevolutionDialog::~QuadRevolutionDialog() // ============================================================== _initInputWidget void QuadRevolutionDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); - center_pt_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - axis_vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); + center_pt_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + axis_vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + quads_lw->setProperty( "HexaWidgetType", QVariant::fromValue(QUAD_TREE) ); - center_pt_le->setValidator( validator ); - axis_vec_le->setValidator( validator ); - // quads_lw->setValidator( validator ); + center_pt_le->setValidator( validator ); + axis_vec_le->setValidator( validator ); + // quads_lw->setValidator( validator ); - name_le->installEventFilter(this); - center_pt_le->installEventFilter(this); - axis_vec_le->installEventFilter(this); - quads_lw->installEventFilter(this); +// name_le->installEventFilter(this); + center_pt_le->installEventFilter(this); + axis_vec_le->installEventFilter(this); + quads_lw->installEventFilter(this); - if ( editmode == NEW_MODE ){ - angles_lw->setItemDelegate( new HexaAngleDoubleSpinBoxDelegate(angles_lw) ); - angles_lw->setEditTriggers( QAbstractItemView::DoubleClicked ); + if ( editmode == NEW_MODE ){ + angles_lw->setItemDelegate( new HexaAngleDoubleSpinBoxDelegate(angles_lw) ); + angles_lw->setEditTriggers( QAbstractItemView::DoubleClicked ); - QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); - delQuadShortcut->setContext( Qt::WidgetShortcut ); - connect( delQuadShortcut, SIGNAL(activated()), this, SLOT(delQuadItem()) ); - connect( add_angle_pb, SIGNAL(clicked()), this, SLOT(addAngleItem())); - connect( del_angle_pb, SIGNAL(clicked()), this, SLOT(delAngleItem())); - // connect(clear_pb, SIGNAL(clicked()), this, SLOT(clearQuads())); - } + QShortcut* delQuadShortcut = new QShortcut( QKeySequence(Qt::Key_X), quads_lw ); + delQuadShortcut->setContext( Qt::WidgetShortcut ); + connect( delQuadShortcut, SIGNAL(activated()), this, SLOT(delQuadItem()) ); + connect( add_angle_pb, SIGNAL(clicked()), this, SLOT(addAngleItem())); + connect( del_angle_pb, SIGNAL(clicked()), this, SLOT(delAngleItem())); + // connect(clear_pb, SIGNAL(clicked()), this, SLOT(clearQuads())); + } - center_pt_le->setReadOnly(true); - axis_vec_le->setReadOnly(true); + center_pt_le->setReadOnly(true); + axis_vec_le->setReadOnly(true); - connect(quads_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel())); + connect(quads_lw, SIGNAL(itemSelectionChanged()), this, SLOT(selectElementOfModel()), Qt::UniqueConnection); } // ============================================================== clear void QuadRevolutionDialog::clear() { +// name_le->clear(); + + quads_lw->clear(); + modelUnregister(quads_lw); + + center_pt_le->clear(); + modelUnregister(center_pt_le); + + axis_vec_le->clear(); + modelUnregister(axis_vec_le); + + angles_lw->clear(); + modelUnregister(angles_lw); + + modelUnregister(this); } // ============================================================== updateButtonBox void QuadRevolutionDialog::updateButtonBox() //CS_TODO? : check center, axis { - int nbQuads = quads_lw->count(); - int nbAngles = angles_lw->count(); + int nbQuads = quads_lw->count(); + int nbAngles = angles_lw->count(); - if ( nbQuads>0 && nbAngles> 0 ){ - //_applyCloseButton->setEnabled(true); - _applyButton->setEnabled(true); - } else { - //_applyCloseButton->setEnabled(false); - _applyButton->setEnabled(false); - } + if ( nbQuads>0 && nbAngles> 0 ){ + //_applyCloseButton->setEnabled(true); + _applyButton->setEnabled(true); + } else { + //_applyCloseButton->setEnabled(false); + _applyButton->setEnabled(false); + } } // ============================================================== addAngleItem void QuadRevolutionDialog::addAngleItem() //CS_TODO { - QListWidgetItem* previousItem = angles_lw->currentItem(); - QListWidgetItem* newItem = new QListWidgetItem(); + QListWidgetItem* previousItem = angles_lw->currentItem(); + QListWidgetItem* newItem = new QListWidgetItem(); - double defaultValue = 0.; - if ( previousItem ) - defaultValue = previousItem->data(Qt::EditRole).toDouble(); + double defaultValue = 180.; + if ( previousItem ) + defaultValue = previousItem->data(Qt::EditRole).toDouble(); - newItem->setData( Qt::EditRole, QVariant(defaultValue) ); - newItem->setFlags( newItem->flags () | Qt::ItemIsEditable); - angles_lw->addItem(newItem); + newItem->setData( Qt::EditRole, QVariant(defaultValue) ); + newItem->setFlags( newItem->flags () | Qt::ItemIsEditable); + angles_lw->addItem(newItem); - updateButtonBox(); + updateButtonBox(); } // ============================================================== delAngleItem void QuadRevolutionDialog::delAngleItem() { - delete angles_lw->currentItem(); - updateButtonBox(); + delete angles_lw->currentItem(); + updateButtonBox(); } // ============================================================== delQuadItem void QuadRevolutionDialog::delQuadItem() { - delete quads_lw->currentItem(); - updateButtonBox(); + delete quads_lw->currentItem(); + updateButtonBox(); } // ============================================================== apply bool QuadRevolutionDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - if ( !_documentModel ) return false; - if ( !_patternDataSelectionModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - if ( !patternDataModel ) return false; - if ( !patternBuilderModel ) return false; - - QModelIndex ielts; //result - QListWidgetItem* item = NULL; - - QModelIndexList istartquads; - QModelIndex iquad; - for ( int r = 0; r < quads_lw->count(); ++r){ - item = quads_lw->item(r); - iquad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); - if ( iquad.isValid() ) - istartquads << iquad; - } - - QModelIndex icenter_pt = patternDataModel->mapToSource( _index[center_pt_le] ); - QModelIndex iaxis_vec = patternBuilderModel->mapToSource( _index[axis_vec_le] ); + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; + + QModelIndex ielts; //result + QListWidgetItem* item = NULL; + + QModelIndexList istartquads; + QModelIndex iquad; + for ( int r = 0; r < quads_lw->count(); ++r){ + item = quads_lw->item(r); + iquad = patternDataModel->mapToSource( item->data(LW_QMODELINDEX_ROLE).value() ); + if ( iquad.isValid() ) + istartquads << iquad; + } + + QModelIndex icenter_pt = patternDataModel->mapToSource( _index[center_pt_le] ); + QModelIndex iaxis_vec = patternBuilderModel->mapToSource( _index[axis_vec_le] ); + + QList angles; + for ( int r = 0; r < angles_lw->count(); ++r){ + item = angles_lw->item(r); + angles << item->data(Qt::EditRole).toDouble(); + } + + if ( icenter_pt.isValid() && iaxis_vec.isValid() ){ + ielts = getDocumentModel()->revolutionQuads( istartquads, icenter_pt, iaxis_vec, angles ); + } + + if ( !ielts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE QUAD REVOLUTION" ) ); + return false; + } + _value = ielts.model()->data(ielts, HEXA_DATA_ROLE).value(); - QList angles; - for ( int r = 0; r < angles_lw->count(); ++r){ - item = angles_lw->item(r); - angles << item->data(Qt::EditRole).toDouble(); - } - - if ( icenter_pt.isValid() && iaxis_vec.isValid() ){ - ielts = _documentModel->revolutionQuads( istartquads, icenter_pt, iaxis_vec, angles ); - } - - if ( !ielts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE QUAD REVOLUTION" ) ); - return false; - } - _value = ielts.model()->data(ielts, HEXA_DATA_ROLE).value(); - - QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ - _documentModel->setName( ielts, newName ); +// QString newName = name_le->text(); +// if ( !newName.isEmpty() )/*{*/ +// getDocumentModel()->setName( ielts, newName ); +// +// updateDefaultName(name_le, ielts); - result = patternBuilderModel->mapFromSource(ielts); + result = patternBuilderModel->mapFromSource(ielts); - return true; + return true; } @@ -6083,11 +6597,11 @@ bool QuadRevolutionDialog::apply(QModelIndex& result) // ============================================================== Constructeur MakeHemiSphereDialog::MakeHemiSphereDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): - HexaBaseDialog(parent, editmode, f) + HexaBaseDialog(parent, editmode, f) { - _helpFileName = "gui_hemisphere.html"; - setupUi( this ); - _initWidget(editmode); + _helpFileName = "gui_hemisphere.html"; + setupUi( this ); + _initWidget(editmode); } // ============================================================== Destructeur @@ -6098,213 +6612,280 @@ MakeHemiSphereDialog::~MakeHemiSphereDialog() // ============================================================== _initInputWidget void MakeHemiSphereDialog::_initInputWidget( Mode editmode ) { - QRegExp rx(""); - QValidator *validator = new QRegExpValidator(rx, this); + QRegExp rx(""); + QValidator *validator = new QRegExpValidator(rx, this); - setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); - installEventFilter(this); +// setProperty( "HexaWidgetType", QVariant::fromValue(ELEMENTS_TREE) ); + installEventFilter(this); - sphere_center_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - cross_pt_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); - hole_axis_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - cross_vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - radial_vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + sphere_center_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + cross_pt_le->setProperty( "HexaWidgetType", QVariant::fromValue(VERTEX_TREE) ); + hole_axis_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + cross_vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); + radial_vec_le->setProperty( "HexaWidgetType", QVariant::fromValue(VECTOR_TREE) ); - sphere_center_le->setValidator( validator ); - cross_pt_le->setValidator( validator ); - hole_axis_le->setValidator( validator ); - cross_vec_le->setValidator( validator ); - radial_vec_le->setValidator( validator ); + sphere_center_le->setValidator( validator ); + cross_pt_le->setValidator( validator ); + hole_axis_le->setValidator( validator ); + cross_vec_le->setValidator( validator ); + radial_vec_le->setValidator( validator ); - name_le->installEventFilter(this); - sphere_center_le->installEventFilter(this); - cross_pt_le->installEventFilter(this); - hole_axis_le->installEventFilter(this); - cross_vec_le->installEventFilter(this); - radial_vec_le->installEventFilter(this); +// name_le->installEventFilter(this); + sphere_center_le->installEventFilter(this); + cross_pt_le->installEventFilter(this); + hole_axis_le->installEventFilter(this); + cross_vec_le->installEventFilter(this); + radial_vec_le->installEventFilter(this); - sphere_center_le->setReadOnly(true); - cross_pt_le->setReadOnly(true); - hole_axis_le->setReadOnly(true); - cross_vec_le->setReadOnly(true); - radial_vec_le->setReadOnly(true); + sphere_center_le->setReadOnly(true); + cross_pt_le->setReadOnly(true); + hole_axis_le->setReadOnly(true); + cross_vec_le->setReadOnly(true); + radial_vec_le->setReadOnly(true); } // ============================================================== clear void MakeHemiSphereDialog::clear() { + sphere_center_le->clear(); + modelUnregister(sphere_center_le); + + hole_axis_le->clear(); + modelUnregister(hole_axis_le); + + cross_pt_le->clear(); + modelUnregister(cross_pt_le); + + cross_vec_le->clear(); + modelUnregister(cross_vec_le); + + radial_vec_le->clear(); + modelUnregister(radial_vec_le); + + modelUnregister(this); } // ============================================================== apply bool MakeHemiSphereDialog::apply(QModelIndex& result) { - if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); - _currentObj = NULL; - - SUIT_OverrideCursor wc; - if ( !_documentModel ) return false; - if ( !_patternBuilderSelectionModel ) return false; - if ( !_patternDataSelectionModel ) return false; - const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); - const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); - if ( !patternBuilderModel ) return false; - if ( !patternDataModel ) return false; - - QModelIndex iElts; - QModelIndex icenter = patternDataModel->mapToSource( _index[sphere_center_le] ); - QModelIndex iplorig = patternDataModel->mapToSource( _index[cross_pt_le] ); - QModelIndex ivecx = patternBuilderModel->mapToSource( _index[radial_vec_le] ); - QModelIndex ivecz = patternBuilderModel->mapToSource( _index[hole_axis_le] ); - - double radext = sphere_radext_spb->value(); - double radhole = hole_rad_spb->value(); - - int nrad = ngrid_rad_spb->value(); - int nang = ngrid_ang_spb->value(); - int nhaut = ngrid_height_spb->value(); - - - if ( icenter.isValid() && ivecx.isValid() && ivecz.isValid() && iplorig.isValid() ){ - if ( sphere_rind_cb->isChecked() ){ // rind - double radint = sphere_radint_spb->value(); - if ( radial_partial_cb->isChecked() ){ - double angle = radial_angle_spb->value(); - iElts = _documentModel->makePartRind( icenter, ivecx, ivecz, - radext, radint, radhole, - iplorig, angle, - nrad, nang, nhaut ); - } else { - iElts = _documentModel->makeRind( icenter, - ivecx, ivecz, - radext, radint, radhole, - iplorig, - nrad, nang, nhaut ); - } - } else { // sphere - if ( radial_partial_cb->isChecked() ){ - double angle = radial_angle_spb->value(); - iElts = _documentModel->makePartSphere( icenter, ivecx, ivecz, - radext, radhole, - iplorig, angle, - nrad, nang, nhaut ); - } else { - iElts = _documentModel->makeSphere( icenter, - ivecx, ivecz, - radext, radhole, - iplorig, - nrad, nang, nhaut ); - } - } - } - - - if ( !iElts.isValid() ){ - SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE RIND" ) ); - return false; - } - _value = iElts.model()->data(iElts, HEXA_DATA_ROLE).value(); - - QString newName = name_le->text(); - if ( !newName.isEmpty() )/*{*/ - _documentModel->setName( iElts, newName ); - - result = patternBuilderModel->mapFromSource(iElts); - - return true; -} -// ============================================================== - - -// MakeRindDialog::MakeRindDialog( QWidget* parent, Mode editmode, Qt::WindowFlags f ): -// HexaBaseDialog(parent, editmode, f) -// { -// // _helpFileName() -// setupUi( this ); -// setWindowTitle( tr("MAKE RIND") ); -// -// if ( editmode == NEW_MODE ){ -// _initButtonBox( editmode ); -// -// //selection management -// _vertexLineEdits << center_le << plorig_le; -// _vectorLineEdits << vx_le << vz_le; -// -// center_le->installEventFilter(this); -// plorig_le->installEventFilter(this); -// vx_le->installEventFilter(this); -// vz_le->installEventFilter(this); -// } -// } -// -// -// MakeRindDialog::~MakeRindDialog() -// { -// } -// -// -// -// bool MakeRindDialog::apply(QModelIndex& result) -// { -// if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); -// _currentObj = NULL; -// -// SUIT_OverrideCursor wc; -// if ( !_documentModel ) return false; -// if ( !_patternBuilderSelectionModel ) return false; -// if ( !_patternDataSelectionModel ) return false; -// const PatternBuilderModel* patternBuilderModel = dynamic_cast( _patternBuilderSelectionModel->model() ); -// const PatternDataModel* patternDataModel = dynamic_cast( _patternDataSelectionModel->model() ); -// if ( !patternBuilderModel ) return false; -// if ( !patternDataModel ) return false; -// -// QModelIndex iElts; -// QModelIndex icenter = patternDataModel->mapToSource( _index[center_le] ); -// QModelIndex iplorig = patternDataModel->mapToSource( _index[plorig_le] ); -// QModelIndex ivecx = patternBuilderModel->mapToSource( _index[vx_le] ); -// QModelIndex ivecz = patternBuilderModel->mapToSource( _index[vz_le] ); -// -// double radext = radext_spb->value(); -// double radint = radint_spb->value(); -// double radhole = radhole_spb->value(); -// -// int nrad = nrad_spb->value(); -// int nang = nang_spb->value(); -// int nhaut = nhaut_spb->value(); -// -// if ( icenter.isValid() && ivecx.isValid() && ivecz.isValid() && iplorig.isValid() ){ -// if ( partial_cb->isChecked() ){ -// double angle = angle_spb->value(); // Part Rind only -// iElts = _documentModel->makePartRind( icenter, ivecx, ivecz, -// radext, radint, radhole, -// iplorig, angle, -// nrad, nang, nhaut ); -// } else { -// iElts = _documentModel->makeRind( icenter, -// ivecx, ivecz, -// radext, radint, radhole, -// iplorig, -// nrad, nang, nhaut ); -// } -// } -// -// if ( !iElts.isValid() ){ -// SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE RIND" ) ); -// return false; -// } -// + if (_currentObj != NULL) _highlightWidget(_currentObj, Qt::white); + _currentObj = NULL; + + SUIT_OverrideCursor wc; + if ( !getDocumentModel() ) return false; + const PatternDataModel* patternDataModel = getPatternDataModel(); + const PatternBuilderModel* patternBuilderModel = getPatternBuilderModel(); + if ( !patternDataModel || !patternBuilderModel) return false; + + QModelIndex iElts; + QModelIndex icenter = patternDataModel->mapToSource( _index[sphere_center_le] ); + QModelIndex iplorig = patternDataModel->mapToSource( _index[cross_pt_le] ); + QModelIndex ivecx = patternBuilderModel->mapToSource( _index[radial_vec_le] ); + QModelIndex ivecz = patternBuilderModel->mapToSource( _index[hole_axis_le] ); + + double radext = sphere_radext_spb->value(); + double radhole = hole_rad_spb->value(); + + int nrad = ngrid_rad_spb->value(); + int nang = ngrid_ang_spb->value(); + int nhaut = ngrid_height_spb->value(); + + + if ( icenter.isValid() && ivecx.isValid() && ivecz.isValid() && iplorig.isValid() ){ + if ( sphere_rind_cb->isChecked() ){ // rind + double radint = sphere_radint_spb->value(); + if ( radial_partial_cb->isChecked() ){ + double angle = radial_angle_spb->value(); + iElts = getDocumentModel()->makePartRind( icenter, ivecx, ivecz, + radext, radint, radhole, + iplorig, angle, + nrad, nang, nhaut ); + } else { + iElts = getDocumentModel()->makeRind( icenter, + ivecx, ivecz, + radext, radint, radhole, + iplorig, + nrad, nang, nhaut ); + } + } else { // sphere + if ( radial_partial_cb->isChecked() ){ + double angle = radial_angle_spb->value(); + iElts = getDocumentModel()->makePartSphere( icenter, ivecx, ivecz, + radext, radhole, + iplorig, angle, + nrad, nang, nhaut ); + } else { + iElts = getDocumentModel()->makeSphere( icenter, + ivecx, ivecz, + radext, radhole, + iplorig, + nrad, nang, nhaut ); + } + } + } + + + if ( !iElts.isValid() ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "CANNOT MAKE RIND" ) ); + return false; + } + _value = iElts.model()->data(iElts, HEXA_DATA_ROLE).value(); + // QString newName = name_le->text(); -// if (!newName.isEmpty()) _documentModel->setName( iElts, newName ); +// if ( !newName.isEmpty() )/*{*/ +// getDocumentModel()->setName( iElts, newName ); // -// return true; -// } +// updateDefaultName(name_le, iElts); + + result = patternBuilderModel->mapFromSource(iElts); + + return true; +} + +// ------------------------- ModelInfoDialog ---------------------------------- -// QVariant v = lineEdit->property("index"); -// if ( v.isValid() ){ -// MESSAGE("* get index ... " ); -// QModelIndex i = v.value(); -// _selectionMutex = true; -// _patternDataSelectionModel->select( i, QItemSelectionModel::Clear ); -// _patternDataSelectionModel->select( i, QItemSelectionModel::Select ); -// _selectionMutex = false; -// } +ModelInfoDialog::ModelInfoDialog(QWidget* parent, Qt::WindowFlags wf): + HexaBaseDialog(parent, INFO_MODE, wf) +{ + setupUi( this ); + setWindowTitle(HEXABLOCKGUI::tr("MODEL_INFO")); +} + +void ModelInfoDialog::updateInfo() +{ + DocumentModel* docModel = getDocumentModel(); + if (docModel == NULL) return; + + //Model name + model_name_le->setText(docModel->getName()); + + //Nb of elements in the model + total_vertices_le->setText(QString::number(docModel->getNbrElt(HEXA_NS::EL_VERTEX))); + total_edges_le->setText(QString::number(docModel->getNbrElt(HEXA_NS::EL_EDGE))); + total_quads_le->setText(QString::number(docModel->getNbrElt(HEXA_NS::EL_QUAD))); + total_hexas_le->setText(QString::number(docModel->getNbrElt(HEXA_NS::EL_HEXA))); + + ///Nb of used elements in the model + used_vertices_le->setText(QString::number(docModel->getNbrUsedElt(HEXA_NS::EL_VERTEX))); + used_edges_le->setText(QString::number(docModel->getNbrUsedElt(HEXA_NS::EL_EDGE))); + used_quads_le->setText(QString::number(docModel->getNbrUsedElt(HEXA_NS::EL_QUAD))); + used_hexas_le->setText(QString::number(docModel->getNbrUsedElt(HEXA_NS::EL_HEXA))); + + //Nb of unused elements in the model + unused_vertices_le->setText(QString::number(docModel->getNbrUnusedElt(HEXA_NS::EL_VERTEX))); + unused_edges_le->setText(QString::number(docModel->getNbrUnusedElt(HEXA_NS::EL_EDGE))); + unused_quads_le->setText(QString::number(docModel->getNbrUnusedElt(HEXA_NS::EL_QUAD))); + unused_hexas_le->setText(QString::number(docModel->getNbrUnusedElt(HEXA_NS::EL_HEXA))); +} + +void ModelInfoDialog::showEvent( QShowEvent * event ) +{ + updateInfo(); + QDialog::showEvent ( event ); +} + + +// ============================================================== hideEvent +void ModelInfoDialog::hideEvent ( QHideEvent * event ) +{ + QDialog::hideEvent( event ); +} + + +// ------------------------- AddShapeDialog ---------------------------------- + +AddShapeDialog::AddShapeDialog(QWidget* parent, Mode editmode, Qt::WindowFlags wf): + HexaBaseDialog(parent, editmode, wf) +{ + _helpFileName = ""; + setupUi( this ); + _initWidget(editmode); + setWindowTitle(HEXABLOCKGUI::tr("ADD_SHAPE")); + + currentGeomObj.nullify(); +} + +// ============================================================== Destructeur +AddShapeDialog::~AddShapeDialog() +{ + disconnect( HEXABLOCKGUI::selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(onCurrentSelectionChanged()) ); +} + +// ============================================================== close +void AddShapeDialog::close() +{ + HEXABLOCKGUI::assocInProgress = false; + HexaBaseDialog::close(); +} + +// ============================================================== _initInputWidget +void AddShapeDialog::_initInputWidget( Mode editmode ) +{ + shape_le->setProperty( "HexaWidgetType", QVariant::fromValue(GEOMSHAPE_TREE) ); + shape_le->setProperty( "GeomWidgetType", QVariant::fromValue(TopAbs_SHAPE) ); + shape_le->installEventFilter(this); + shape_le->setReadOnly(true); +} + +void AddShapeDialog::clear() +{ + shape_le->clear(); + shape_le->setProperty("GeomObj", QVariant()); + currentGeomObj.nullify(); + + modelUnregister(this); +} + +// ============================================================== onCurrentSelectionChanged +void AddShapeDialog::onCurrentSelectionChanged() +{ + if ( !isVisible() ) return; + + SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); + + bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()); + if (!isOCC || getDocumentModel() == NULL) return; + + currentGeomObj = getSelected(TopAbs_SHAPE); + shape_le->setText(GEOMBase::GetName( currentGeomObj.get() )); + + DocumentModel::GeomObj* geomObj = getDocumentModel()->convertToGeomObj(currentGeomObj); + if (geomObj != NULL) + shape_le->setProperty("GeomObj", QVariant::fromValue(*geomObj)); +} + +// ============================================================== onWindowActivated +void AddShapeDialog::onWindowActivated(SUIT_ViewManager* vm) +{ + QString vmType = vm->getType(); + if ( vmType == OCCViewer_Viewer::Type() ){ + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), TopAbs_SHAPE); + shape_le->setFocus(); + } +} + + +// ============================================================== apply +bool AddShapeDialog::apply(QModelIndex& result) +{ + TopoDS_Shape aShape; + bool assocOK = false; + + if ( currentGeomObj && GEOMBase::GetShape(currentGeomObj.get(), aShape) && !aShape.IsNull() ) + { + QString shapeName = GEOMBase::GetName( currentGeomObj.get() ); + assocOK = getDocumentModel()->addShape(aShape, shapeName); + } + + if ( !assocOK ){ + SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), HEXABLOCKGUI::tr("ADD_SHAPE_FAILED") ); + return false; + } + + getDocumentModel()->clearGeometry(); + getDocumentModel()->fillGeometry(); + return true; +} diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx index 9ecc174..62ab968 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentPanel.hxx @@ -73,6 +73,8 @@ #include "ui_MakeRind_QTD.h" #include "ui_ReplaceHexa_QTD.h" #include "ui_MakeHemiSphere_QTD.h" +#include "ui_ModelInfo_QTD.h" +#include "ui_AddShapeDialog_QTD.h" #include "MyGEOMBase_Helper.hxx" @@ -87,10 +89,13 @@ #include "HEXABLOCKGUI_DocumentSelectionModel.hxx" #include "HEXABLOCKGUI_DocumentModel.hxx" +#include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" // #include "HEXABLOCKGUI_SalomeTools.hxx" +#include "HEXABLOCKGUI.hxx" #include "klinkitemselectionmodel.hxx" + Q_DECLARE_METATYPE(QModelIndex); Q_DECLARE_METATYPE(HEXABLOCK::GUI::DocumentModel::GeomObj); Q_DECLARE_METATYPE(GEOM::GeomObjPtr); @@ -101,1018 +106,1091 @@ namespace HEXABLOCK { namespace GUI { - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT HexaBaseDialog : public QDialog, - public MyGEOMBase_Helper + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT HexaBaseDialog : public QDialog, public MyGEOMBase_Helper { - Q_OBJECT - - public: - enum Mode { - NEW_MODE, - INFO_MODE, - UPDATE_MODE - }; + Q_OBJECT - enum ViewType { - VTK, - OCC, - NONE - }; + public: + enum Mode { + NEW_MODE, + INFO_MODE, + UPDATE_MODE + }; - // define input widget type => usefull for selection - typedef HexaTreeRole HexaWidgetType; - typedef TopAbs_ShapeEnum/*int */GeomWidgetType; //CS_TODO + // define input widget type => usefull for selection + typedef HexaTreeRole HexaWidgetType; + typedef TopAbs_ShapeEnum/*int */GeomWidgetType; //CS_TODO -// TopAbs_ShapeEnum aType = TopAbs_EDGE; + // TopAbs_ShapeEnum aType = TopAbs_EDGE; - // listwidget - enum { - LW_QMODELINDEX_ROLE = Qt::UserRole + 1, + // listwidget + enum { + LW_QMODELINDEX_ROLE = Qt::UserRole + 1, LW_ASSOC_ROLE, LW_GEOM_OBJ_ROLE, LW_DATA_ROLE - }; - - HexaBaseDialog( QWidget * parent = 0, Mode editmode = NEW_MODE, Qt::WindowFlags f = 0 ); - virtual ~HexaBaseDialog(){}; - - // clear all input widget - virtual void clear(){}; - ViewType getObjectViewType(QObject* obj); + }; + + HexaBaseDialog( QWidget * parent = 0, Mode editmode = NEW_MODE, Qt::WindowFlags f = 0 ); + virtual ~HexaBaseDialog(){}; + + // clear all input widget + virtual void clear(){}; + + void connectDocumentGraphicView(VtkDocumentGraphicView* docGView = NULL); + void disconnectDocumentGraphicView(VtkDocumentGraphicView* docGView = NULL); + + SVTK_ViewWindow* getCurrentVtkView() const { + return HEXABLOCKGUI::currentDocGView->getViewWindow(); + } + + //get model + DocumentModel* getDocumentModel() const { + return HEXABLOCKGUI::currentDocGView->getDocumentModel(); + } + + PatternDataModel* getPatternDataModel() const { + return HEXABLOCKGUI::currentDocGView->getPatternDataModel(); + } + + PatternGeomModel* getPatternGeomModel() const { + return HEXABLOCKGUI::currentDocGView->getPatternGeomModel(); + } + + PatternBuilderModel* getPatternBuilderModel() const { + return HEXABLOCKGUI::currentDocGView->getPatternBuilderModel(); + } + + GroupsModel* getGroupsModel() const { + return HEXABLOCKGUI::currentDocGView->getGroupsModel(); + } + + MeshModel* getMeshModel() const { + return HEXABLOCKGUI::currentDocGView->getMeshModel(); + } - // model - virtual void setDocumentModel( DocumentModel* m ){ _documentModel = m;} + //get selection patterns from the current graphic view + PatternDataSelectionModel* getPatternDataSelectionModel() const { + return HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel(); + } - // selection - virtual void setPatternDataSelectionModel( PatternDataSelectionModel* s ) - { _patternDataSelectionModel = s;} + PatternBuilderSelectionModel* getPatternBuilderSelectionModel() const { + return HEXABLOCKGUI::currentDocGView->getPatternBuilderSelectionModel(); + } - virtual void setPatternBuilderSelectionModel( PatternBuilderSelectionModel* s ) - { _patternBuilderSelectionModel = s; } + PatternGeomSelectionModel* getPatternGeomSelectionModel() const { + return HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); + } - virtual void setGroupsSelectionModel( GroupsSelectionModel* s ) - { _groupsSelectionModel = s; } + GroupsSelectionModel* getGroupsSelectionModel() const { + return HEXABLOCKGUI::currentDocGView->getGroupsSelectionModel(); + } - virtual void setMeshSelectionModel( MeshSelectionModel* s ) - { _meshSelectionModel = s; } + MeshSelectionModel* getMeshSelectionModel() const { + return HEXABLOCKGUI::currentDocGView->getMeshSelectionModel(); + } - void resetSizeAndShow(QDockWidget* parent); - void lockSizeToSizeHint(); - void unlockSizeModification(); - virtual QModelIndexList getAssocsVTK() - { - QModelIndexList assocs; - return assocs; - } - virtual QMultiMap getAssocsGEOM() - { - QMultiMap assocs; - return assocs; - } - void clearVTKSelection(); - void clearOCCSelection(); + HEXABLOCKGUI::ViewType getObjectViewType(QObject* obj); + void modelUnregister(QWidget* widget); //unlink the widget from the model + void resetSizeAndShow(QDockWidget* parent); + void lockSizeToSizeHint(); + void unlockSizeModification(); + virtual QModelIndexList getAssocsVTK() + { + QModelIndexList assocs; + return assocs; + } + virtual QMultiMap getAssocsGEOM() + { + QMultiMap assocs; + return assocs; + } + virtual void setCurrentGeomObj(DocumentModel::GeomObj* geomObj) {} - bool debugEdgeAssoc; //Temporary + bool debugEdgeAssoc; //Temporary + bool autoFocusSwitch; - public slots: - //virtual void accept(); - virtual bool apply(); - virtual void close(); - virtual void onHelpRequested(); + public slots: + //virtual void accept(); + virtual bool apply(); + virtual void close(); + virtual void onHelpRequested(); + void highlightSelectedAssocs(); + void refreshHighlight(); + virtual void onWindowActivated(SUIT_ViewManager*){}; + void clearVTKSelection(); + void clearOCCSelection(); + void clearCurrentObjectFocus(); - protected: - virtual bool eventFilter(QObject *obj, QEvent *event); - virtual void hideEvent ( QHideEvent * event ); - virtual void showEvent ( QShowEvent * event ); - virtual bool apply(QModelIndex& result) = 0; + protected: + virtual bool eventFilter(QObject *obj, QEvent *event); + virtual void hideEvent ( QHideEvent * event ); + virtual void showEvent ( QShowEvent * event ); + virtual bool apply(QModelIndex& result) = 0; - virtual void _initInputWidget( Mode editmode )=0; //must be implemented on inherited dialog box - virtual QGroupBox* _initButtonBox( Mode editmode ); - void _initWidget( Mode editmode ); // call _initInputWidget() & _initButtonBox() - QModelIndexList getIndexList(QListWidget* itemsList); + //Gives a default name to an element according to the last created + void updateDefaultName(QLineEdit* name_field, HEXA_NS::EnumElt type); + DocumentModel::GeomObj* getGeomObj(const QModelIndex& index); - void _initViewManager(); + virtual void _initInputWidget( Mode editmode )=0; //must be implemented on inherited dialog box + virtual QGroupBox* _initButtonBox( Mode editmode ); + void _initWidget( Mode editmode ); // call _initInputWidget() & _initButtonBox() + QModelIndexList getIndexList(QListWidget* itemsList); - void _allowSelection(); - void _disallowSelection(); - QItemSelectionModel* _allowSelection( HexaWidgetType wtype ); + void _initViewManager(); - bool _allowVTKSelection( QObject* obj ); - bool _allowOCCSelection( QObject* obj ); - void setOCCSelectionMode(TopAbs_ShapeEnum mode); - QItemSelectionModel* _getSelector( QObject* obj ); + void _allowSelection(); + void _disallowSelection(); + QItemSelectionModel* _allowSelection( HexaWidgetType wtype ); + bool _allowVTKSelection( QObject* obj ); + bool _allowOCCSelection( QObject* obj ); + QItemSelectionModel* _getSelector( QObject* obj ); - bool _onSelectionChanged( const QItemSelection& sel, QLineEdit* le ); - bool _onSelectionChanged( const QItemSelection& sel, QListWidget* lw ); - void _selectAndHighlight( const QModelIndex& i ); + bool _onSelectionChanged( const QItemSelection& sel, QLineEdit* le ); + bool _onSelectionChanged( const QItemSelection& sel, QListWidget* lw ); - void _highlightWidget(QObject* obj, Qt::GlobalColor clr); + void _selectAndHighlight( const QModelIndex& i ); - void setFocusToNextField(); + void _highlightWidget(QObject* obj, Qt::GlobalColor clr); - Mode _editMode; + void setFocusToNextField(); - DocumentModel* _documentModel; + void _updateCurrentObject(QObject*); - // user selection - PatternDataSelectionModel* _patternDataSelectionModel; - PatternBuilderSelectionModel* _patternBuilderSelectionModel; - GroupsSelectionModel* _groupsSelectionModel; - MeshSelectionModel* _meshSelectionModel; + Mode _editMode; - QMap _index; - QObject* _currentObj; + QMap _index; + QObject* _currentObj; - int _expectedSelection; - bool _selectionMutex; + int _expectedSelection; + bool _selectionMutex; - LightApp_SelectionMgr* _mgr; - SUIT_ViewManager* _vtkVm; - SUIT_ViewManager* _occVm; + QMap _strHexaWidgetType; - QMap _strHexaWidgetType; + //QPushButton* _applyCloseButton; + QPushButton* _applyButton; - //QPushButton* _applyCloseButton; - QPushButton* _applyButton; + QString _helpFileName; - QString _helpFileName; + private: + bool _isLineOrListWidget(QObject*); - private: - bool _isLineOrListWidget(QObject*); - void _updateCurrentObject(QObject*); - TopAbs_ShapeEnum currentOCCSelectionMode; - void refreshConnects(); - - - protected slots: - virtual void onSelectionChanged( const QItemSelection& sel, const QItemSelection& unsel ); //from qt model/view selectionManager - virtual void onCurrentSelectionChanged();//from salome selectionManager - virtual void onWindowActivated(SUIT_ViewManager*){}; - virtual void updateButtonBox(); - void updateName(); - virtual void selectElementOfModel(); - void highlightSelectedAssocs(); + protected slots: + virtual void onSelectionChanged( const QItemSelection& sel, const QItemSelection& unsel ); //from qt model/view selectionManager + virtual void onCurrentSelectionChanged();//from salome selectionManager + virtual void updateButtonBox(); + void updateName(); + virtual void selectElementOfModel(); }; class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT VertexDialog : public HexaBaseDialog, - public Ui::VertexDialog + public Ui::VertexDialog { Q_OBJECT - public: - VertexDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~VertexDialog(); + public: + VertexDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~VertexDialog(); - void clear(); + void clear(); - void setValue(HEXA_NS::Vertex* v); - HEXA_NS::Vertex* getValue(); + void setValue(HEXA_NS::Vertex* v); + HEXA_NS::Vertex* getValue(); - void setIndex(const QModelIndex& i); + void setIndex(const QModelIndex& i); - public slots: - virtual bool apply(QModelIndex& result); -// void updateName(); + public slots: + virtual bool apply(QModelIndex& result); + // void updateName(); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - private: - HEXA_NS::Vertex *_value; - QModelIndex _ivalue; + private: + HEXA_NS::Vertex *_value; + QModelIndex _ivalue; }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT EdgeDialog : public HexaBaseDialog, - public Ui::EdgeDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT EdgeDialog : public HexaBaseDialog, + public Ui::EdgeDialog + { Q_OBJECT - public: - EdgeDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~EdgeDialog(); + public: + EdgeDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~EdgeDialog(); - void clear(); + void clear(); - void setValue(HEXA_NS::Edge* e); - HEXA_NS::Edge* getValue(); + void setValue(HEXA_NS::Edge* e); + HEXA_NS::Edge* getValue(); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - public slots: - virtual bool apply(QModelIndex& result); -// void updateName(); + public slots: + virtual bool apply(QModelIndex& result); + // void updateName(); - private: - HEXA_NS::Edge *_value; - QModelIndex _ivalue; + private: + HEXA_NS::Edge *_value; + QModelIndex _ivalue; }; class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT QuadDialog : public HexaBaseDialog, - public Ui::QuadDialog + public Ui::QuadDialog { Q_OBJECT - public: - QuadDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~QuadDialog(); + public: + QuadDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~QuadDialog(); - void clear(); + void clear(); - void setValue(HEXA_NS::Quad* v); - HEXA_NS::Quad* getValue(); + void setValue(HEXA_NS::Quad* v); + HEXA_NS::Quad* getValue(); - public slots: - virtual bool apply(QModelIndex& result); -// void updateName(); + public slots: + virtual bool apply(QModelIndex& result); + // void updateName(); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - private: - HEXA_NS::Quad *_value; - QModelIndex _ivalue; + private: + HEXA_NS::Quad *_value; + QModelIndex _ivalue; }; class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT HexaDialog : public HexaBaseDialog, - public Ui::HexaDialog + public Ui::HexaDialog { Q_OBJECT - public: - HexaDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~HexaDialog(); + public: + HexaDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~HexaDialog(); - void clear(); - virtual QModelIndexList getAssocsVTK(); + void clear(); + virtual QModelIndexList getAssocsVTK(); - void setValue(HEXA_NS::Hexa* v); - HEXA_NS::Hexa* getValue(); + void setValue(HEXA_NS::Hexa* v); + HEXA_NS::Hexa* getValue(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - protected slots: - void deleteQuadItem(); - void deleteVertexItem(); - void updateButtonBox(); + protected slots: + void deleteQuadItem(); + void deleteVertexItem(); + void updateButtonBox(); - private: - void _setValueQuads( HEXA_NS::Hexa* h ); - void _setValueVertices( HEXA_NS::Hexa* h ); + private: + void _setValueQuads( HEXA_NS::Hexa* h ); + void _setValueVertices( HEXA_NS::Hexa* h ); - HEXA_NS::Hexa *_value; - QModelIndex _ivalue; + HEXA_NS::Hexa *_value; + QModelIndex _ivalue; }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT VectorDialog : public HexaBaseDialog, - public Ui::VectorDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT VectorDialog : public HexaBaseDialog, + public Ui::VectorDialog + { Q_OBJECT - public: - VectorDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~VectorDialog(); + public: + VectorDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~VectorDialog(); - void clear(); + void clear(); - void setValue(HEXA_NS::Vector* v); - HEXA_NS::Vector* getValue(); + void setValue(HEXA_NS::Vector* v); + HEXA_NS::Vector* getValue(); - public slots: - virtual bool apply(QModelIndex& result); -// void updateName(); + public slots: + virtual bool apply(QModelIndex& result); + // void updateName(); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - private: - HEXA_NS::Vector *_value; - QModelIndex _ivalue; - }; + private: + HEXA_NS::Vector *_value; + QModelIndex _ivalue; + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT CylinderDialog : public HexaBaseDialog, - public Ui::CylinderDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT CylinderDialog : public HexaBaseDialog, + public Ui::CylinderDialog + { Q_OBJECT - public: - CylinderDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~CylinderDialog(); + public: + CylinderDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~CylinderDialog(); - void clear(); + void clear(); - void setValue( HEXA_NS::Cylinder* v ); - HEXA_NS::Cylinder* getValue(); + void setValue( HEXA_NS::Cylinder* v ); + HEXA_NS::Cylinder* getValue(); - public slots: - virtual bool apply(QModelIndex& result); -// void updateName(); + public slots: + virtual bool apply(QModelIndex& result); + // void updateName(); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - private: - HEXA_NS::Cylinder *_value; - QModelIndex _ivalue; + private: + HEXA_NS::Cylinder *_value; + QModelIndex _ivalue; }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT PipeDialog : public HexaBaseDialog, - public Ui::PipeDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT PipeDialog : public HexaBaseDialog, + public Ui::PipeDialog + { Q_OBJECT - public: - PipeDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~PipeDialog(); + public: + PipeDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~PipeDialog(); - void clear(); + void clear(); - void setValue( HEXA_NS::Pipe* p ); - HEXA_NS::Pipe* getValue(); + void setValue( HEXA_NS::Pipe* p ); + HEXA_NS::Pipe* getValue(); - public slots: - virtual bool apply(QModelIndex& result); -// void updateName(); + public slots: + virtual bool apply(QModelIndex& result); + // void updateName(); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - private: - HEXA_NS::Pipe *_value; - QModelIndex _ivalue; + private: + HEXA_NS::Pipe *_value; + QModelIndex _ivalue; }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeGridDialog : public HexaBaseDialog, - public Ui::MakeGridDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeGridDialog : public HexaBaseDialog, + public Ui::MakeGridDialog + { Q_OBJECT - public: - MakeGridDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~MakeGridDialog(); + public: + MakeGridDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~MakeGridDialog(); - void clear(); - - public slots: - virtual bool apply(QModelIndex& result); + void clear(); - protected: - void _initInputWidget( Mode editmode ); + public slots: + virtual bool apply(QModelIndex& result); - protected slots: - void addRadiusItem(); - void delRadiusItem(); - void addAngleItem(); - void delAngleItem(); - void addHeightItem(); - void delHeightItem(); - void updateButtonBox(); + protected: + void _initInputWidget( Mode editmode ); - protected slots: - void updateHelpFileName(); + protected slots: + void addRadiusItem(); + void delRadiusItem(); + void addAngleItem(); + void delAngleItem(); + void addHeightItem(); + void delHeightItem(); + void updateButtonBox(); + void updateHelpFileName(); - }; + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeCylinderDialog : public HexaBaseDialog, - public Ui::MakeCylinderDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeCylinderDialog : public HexaBaseDialog, + public Ui::MakeCylinderDialog + { Q_OBJECT - public: - MakeCylinderDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~MakeCylinderDialog(); + public: + MakeCylinderDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~MakeCylinderDialog(); - void clear(); + void clear(); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - public slots: - virtual bool apply(QModelIndex& result); - }; + public slots: + virtual bool apply(QModelIndex& result); + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakePipeDialog : public HexaBaseDialog, - public Ui::MakePipeDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakePipeDialog : public HexaBaseDialog, + public Ui::MakePipeDialog + { Q_OBJECT - public: - MakePipeDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~MakePipeDialog(); + public: + MakePipeDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~MakePipeDialog(); - void clear(); + void clear(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); - }; + protected: + void _initInputWidget( Mode editmode ); + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeCylindersDialog : public HexaBaseDialog, - public Ui::MakeCylindersDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeCylindersDialog : public HexaBaseDialog, + public Ui::MakeCylindersDialog + { Q_OBJECT - public: - MakeCylindersDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~MakeCylindersDialog(); + public: + MakeCylindersDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~MakeCylindersDialog(); - void clear(); + void clear(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); - }; + protected: + void _initInputWidget( Mode editmode ); + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakePipesDialog : public HexaBaseDialog, - public Ui::MakePipesDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakePipesDialog : public HexaBaseDialog, + public Ui::MakePipesDialog + { Q_OBJECT - public: - MakePipesDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~MakePipesDialog(); + public: + MakePipesDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~MakePipesDialog(); - void clear(); + void clear(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); - }; + protected: + void _initInputWidget( Mode editmode ); + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT RemoveHexaDialog : public HexaBaseDialog, - public Ui::RemoveHexaDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT RemoveHexaDialog : public HexaBaseDialog, + public Ui::RemoveHexaDialog + { Q_OBJECT - public: - RemoveHexaDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~RemoveHexaDialog(); + public: + RemoveHexaDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~RemoveHexaDialog(); - void clear(); + void clear(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); - }; + protected: + void _initInputWidget( Mode editmode ); + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT PrismQuadDialog : public HexaBaseDialog, - public Ui::PrismQuadDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT PrismQuadDialog : public HexaBaseDialog, + public Ui::PrismQuadDialog + { Q_OBJECT - public: - PrismQuadDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~PrismQuadDialog(); - void clear(); - virtual QModelIndexList getAssocsVTK(); + public: + PrismQuadDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~PrismQuadDialog(); + void clear(); + virtual QModelIndexList getAssocsVTK(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - protected slots: - void addHeightItem(); - void delHeightItem(); + protected slots: + void addHeightItem(); + void delHeightItem(); - private slots: - void addQuad(); - void removeQuad(); - void clearQuads(); + private slots: + void addQuad(); + void removeQuad(); + void clearQuads(); - }; + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT JoinQuadDialog : public HexaBaseDialog, - public Ui::JoinQuadDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT JoinQuadDialog : public HexaBaseDialog, + public Ui::JoinQuadDialog + { Q_OBJECT - public: - JoinQuadDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~JoinQuadDialog(); + public: + JoinQuadDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~JoinQuadDialog(); - void clear(); - virtual QModelIndexList getAssocsVTK(); + void clear(); + virtual QModelIndexList getAssocsVTK(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - private slots: - void addQuad(); - void removeQuad(); - void clearQuads(); + private slots: + void addQuad(); + void removeQuad(); + void clearQuads(); - }; + }; class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MergeDialog : public HexaBaseDialog, - public Ui::MergeDialog + public Ui::MergeDialog { Q_OBJECT - public: - MergeDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~MergeDialog(); + public: + MergeDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~MergeDialog(); - void clear(); + void clear(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - protected slots: - void updateHelpFileName(); + protected slots: + void updateHelpFileName(); - }; + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT DisconnectDialog : public HexaBaseDialog, - public Ui::DisconnectDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT DisconnectDialog : public HexaBaseDialog, + public Ui::DisconnectDialog + { Q_OBJECT - public: - DisconnectDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~DisconnectDialog(); + public: + DisconnectDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~DisconnectDialog(); - void clear(); + void clear(); + virtual QModelIndexList getAssocsVTK(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - protected slots: - void updateHelpFileName(); - void deleteEdgeItem(); - void deleteHexaItem(); - }; + protected slots: + void updateHelpFileName(); + void deleteEdgeItem(); + void deleteHexaItem(); + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT CutEdgeDialog : public HexaBaseDialog, - public Ui::CutEdgeDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT CutEdgeDialog : public HexaBaseDialog, + public Ui::CutEdgeDialog + { Q_OBJECT - public: - CutEdgeDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~CutEdgeDialog(); + public: + CutEdgeDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~CutEdgeDialog(); - void clear(); + void clear(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); - }; + protected: + void _initInputWidget( Mode editmode ); + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeTransformationDialog : public HexaBaseDialog, - public Ui::TransformationDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeTransformationDialog : public HexaBaseDialog, + public Ui::TransformationDialog + { Q_OBJECT - public: - MakeTransformationDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~MakeTransformationDialog (); + public: + MakeTransformationDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~MakeTransformationDialog (); - void clear(); + void clear(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - protected slots: - void updateHelpFileName(); - }; + protected slots: + void updateHelpFileName(); + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeSymmetryDialog : public HexaBaseDialog, - public Ui::SymmetryDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeSymmetryDialog : public HexaBaseDialog, + public Ui::SymmetryDialog + { Q_OBJECT - public: - MakeSymmetryDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~MakeSymmetryDialog(); + public: + MakeSymmetryDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~MakeSymmetryDialog(); - void clear(); + void clear(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - protected slots: - void updateHelpFileName(); - }; + protected slots: + void updateHelpFileName(); + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT PerformTransformationDialog : public HexaBaseDialog, - public Ui::TransformationDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT PerformTransformationDialog : public HexaBaseDialog, + public Ui::TransformationDialog + { Q_OBJECT - public: - PerformTransformationDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~PerformTransformationDialog (); + public: + PerformTransformationDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~PerformTransformationDialog (); - void clear(); + void clear(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - protected slots: - void updateHelpFileName(); - }; + protected slots: + void updateHelpFileName(); + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT PerformSymmetryDialog : public HexaBaseDialog, - public Ui::SymmetryDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT PerformSymmetryDialog : public HexaBaseDialog, + public Ui::SymmetryDialog + { Q_OBJECT - public: - PerformSymmetryDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~PerformSymmetryDialog(); + public: + PerformSymmetryDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~PerformSymmetryDialog(); - void clear(); + void clear(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - protected slots: - void updateHelpFileName(); - }; + protected slots: + void updateHelpFileName(); + }; -// typedef class MyBasicGUI_PointDlg VertexAssocDialog; + // typedef class MyBasicGUI_PointDlg VertexAssocDialog; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT EdgeAssocDialog : public HexaBaseDialog, - public Ui::EdgeAssocDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT EdgeAssocDialog : public HexaBaseDialog, + public Ui::EdgeAssocDialog + { Q_OBJECT - public: - EdgeAssocDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~EdgeAssocDialog(); - void clear(); - virtual QModelIndexList getAssocsVTK(); - virtual QMultiMap getAssocsGEOM(); - - void setGeomEngine( GEOM::GEOM_Gen_var geomEngine ); + public: + EdgeAssocDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~EdgeAssocDialog(); + void clear(); + virtual QModelIndexList getAssocsVTK(); + virtual QMultiMap getAssocsGEOM(); + virtual void setCurrentGeomObj(DocumentModel::GeomObj* geomObj) { myLine = geomObj; } + void setGeomEngine( GEOM::GEOM_Gen_var geomEngine ); + + + public slots: + virtual bool apply(QModelIndex& result); + virtual void close(); + virtual void onWindowActivated(SUIT_ViewManager*); + + protected: + virtual void _initInputWidget( Mode editmode ); + // virtual void hideEvent ( QHideEvent * event ); + // virtual void showEvent ( QShowEvent * event ); + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool execute( ObjectList& ); + + protected slots: + virtual void onCurrentSelectionChanged(); + // void onSelectionChanged( const QItemSelection& sel, const QItemSelection& unsel ); + virtual void selectElementOfGeom(); + void updateHelpFileName(); + + void deleteEdgeItem(); + void deleteLineItem(); + + void addLine(); + void pstartChanged( double val ); + void pendChanged( double val ); + + private: + // QModelIndexList currentAssocList; + // Preview in GEOM + // GEOM::GeomObjPtr _firstLine; + // GEOM::GeomObjPtr _lastLine; + GEOM::GeomObjPtr _currentLine; +// GEOM::GeomObjPtr myLine; + DocumentModel::GeomObj* myLine; + double _currentParameter; + GEOM::GEOM_Gen_var _geomEngine ; - public slots: - virtual bool apply(QModelIndex& result); + }; - protected: - virtual void _initInputWidget( Mode editmode ); -// virtual void hideEvent ( QHideEvent * event ); -// virtual void showEvent ( QShowEvent * event ); - virtual GEOM::GEOM_IOperations_ptr createOperation(); - virtual bool execute( ObjectList& ); - protected slots: - virtual void onCurrentSelectionChanged(); -// void onSelectionChanged( const QItemSelection& sel, const QItemSelection& unsel ); - virtual void onWindowActivated(SUIT_ViewManager*); - virtual void selectElementOfGeom(); + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT QuadAssocDialog : public HexaBaseDialog, + public Ui::QuadAssocDialog + { + Q_OBJECT - void deleteEdgeItem(); - void deleteLineItem(); + public: + QuadAssocDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~QuadAssocDialog(); + void clear(); + virtual QModelIndexList getAssocsVTK(); + virtual QMultiMap getAssocsGEOM(); + + public slots: + virtual bool apply(QModelIndex& result); + virtual void close(); + virtual void onWindowActivated(SUIT_ViewManager*); + + protected: + virtual void _initInputWidget( Mode editmode ); + // virtual void hideEvent ( QHideEvent * event ); + // virtual void showEvent ( QShowEvent * event ); + + protected slots: + virtual void onCurrentSelectionChanged(); + void deleteFaceItem(); + virtual void selectElementOfGeom(); + + private: + QList _assocs; + QShortcut* _delFaceShortcut; + }; - void addLine(); - void pstartChanged( double val ); - void pendChanged( double val ); - private: -// QModelIndexList currentAssocList; - // Preview in GEOM -// GEOM::GeomObjPtr _firstLine; -// GEOM::GeomObjPtr _lastLine; - GEOM::GeomObjPtr _currentLine; - GEOM::GeomObjPtr myLine; - double _currentParameter; - GEOM::GEOM_Gen_var _geomEngine ; - }; + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT GroupDialog : public HexaBaseDialog, + public Ui::GroupDialog + { + Q_OBJECT + QMap strKind; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT QuadAssocDialog : public HexaBaseDialog, - public Ui::QuadAssocDialog - { - Q_OBJECT + public: + GroupDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~GroupDialog(); + void clear(); + virtual QModelIndexList getAssocsVTK(); - public: - QuadAssocDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~QuadAssocDialog(); - void clear(); - virtual QModelIndexList getAssocsVTK(); - virtual QMultiMap getAssocsGEOM(); + void setValue(HEXA_NS::Group* v); + HEXA_NS::Group* getValue(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - virtual void _initInputWidget( Mode editmode ); -// virtual void hideEvent ( QHideEvent * event ); -// virtual void showEvent ( QShowEvent * event ); + protected: + void _initInputWidget( Mode editmode ); - protected slots: - virtual void onCurrentSelectionChanged(); - virtual void onWindowActivated(SUIT_ViewManager*); - void deleteFaceItem(); - virtual void selectElementOfGeom(); + private slots: + // void addEltBase(); + void removeEltBase(); + // void clearEltBase(); + void onKindChanged( int index ); - private: - QList _assocs; - QShortcut* _delFaceShortcut; - }; + private: + HEXA_NS::Group *_value; + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT GroupDialog : public HexaBaseDialog, - public Ui::GroupDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT LawDialog : public HexaBaseDialog, + public Ui::LawDialog + { Q_OBJECT - QMap strKind; + QMap strKind; - public: - GroupDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~GroupDialog(); - void clear(); - virtual QModelIndexList getAssocsVTK(); + public: + LawDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~LawDialog(); + void clear(); - void setValue(HEXA_NS::Group* v); - HEXA_NS::Group* getValue(); + void setValue(HEXA_NS::Law* v); + HEXA_NS::Law* getValue(); - public slots: - virtual bool apply(QModelIndex& result); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - private slots: -// void addEltBase(); - void removeEltBase(); -// void clearEltBase(); - void onKindChanged( int index ); + private: + HEXA_NS::Law *_value; + }; - private: - HEXA_NS::Group *_value; - }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT LawDialog : public HexaBaseDialog, - public Ui::LawDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT PropagationDialog : public HexaBaseDialog, + public Ui::PropagationDialog + { Q_OBJECT - QMap strKind; + public: + PropagationDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~PropagationDialog(); + void clear(); - public: - LawDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~LawDialog(); - void clear(); + void setValue(HEXA_NS::Propagation* v); + HEXA_NS::Propagation* getValue(); - void setValue(HEXA_NS::Law* v); - HEXA_NS::Law* getValue(); + public slots: + virtual bool apply(QModelIndex& result); - public slots: - virtual bool apply(QModelIndex& result); + protected: + void _initInputWidget( Mode editmode ); - protected: - void _initInputWidget( Mode editmode ); + protected slots: + void updateHelpFileName(); + void deletePropagationItem(); + virtual void selectElementOfModel(); - private: - HEXA_NS::Law *_value; - }; + private: + HEXA_NS::Propagation *_value; + }; + // Define the compute mesh dialog box + // ---------------------------------- - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT PropagationDialog : public HexaBaseDialog, - public Ui::PropagationDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT ComputeMeshDialog : public HexaBaseDialog + { Q_OBJECT - public: - PropagationDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~PropagationDialog(); - void clear(); - - void setValue(HEXA_NS::Propagation* v); - HEXA_NS::Propagation* getValue(); - - public slots: - virtual bool apply(QModelIndex& result); + public: + ComputeMeshDialog( QWidget* parent = 0, Mode editmode = NEW_MODE, Qt::WindowFlags f = Qt::SubWindow ); + virtual ~ComputeMeshDialog(); + void clear(); - protected: - void _initInputWidget( Mode editmode ); + void setDocumentModel(DocumentModel* m); - protected slots: - void updateHelpFileName(); - void deletePropagationItem(); - virtual void selectElementOfModel(); + public slots: + virtual bool apply(QModelIndex& result); + // virtual void accept(); + // virtual void reject(); - private: - HEXA_NS::Propagation *_value; - }; + protected: + void _initInputWidget( Mode editmode ); + private: + QLineEdit* _name; + QSpinBox* _dim; + QLineEdit* _fact; + }; - // Define the compute mesh dialog box - // ---------------------------------- - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT ComputeMeshDialog : public HexaBaseDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT ReplaceHexaDialog : public HexaBaseDialog, + public Ui::ReplaceHexaDialog + { Q_OBJECT - public: - ComputeMeshDialog( QWidget* parent = 0, Mode editmode = NEW_MODE, Qt::WindowFlags f = Qt::SubWindow ); - virtual ~ComputeMeshDialog(); - void clear(); + public: + ReplaceHexaDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~ReplaceHexaDialog(); + void clear(); + virtual QModelIndexList getAssocsVTK(); - void setDocumentModel(DocumentModel* m); - public slots: - virtual bool apply(QModelIndex& result); -// virtual void accept(); -// virtual void reject(); + public slots: + virtual bool apply(QModelIndex& result); - protected: - void _initInputWidget( Mode editmode ); + protected: + void _initInputWidget( Mode editmode ); - private: - QLineEdit* _name; - QSpinBox* _dim; - QLineEdit* _fact; - }; + protected slots: + void deleteQuadItem(); + void updateButtonBox(); + private: + HEXA_NS::Elements *_value; + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT ReplaceHexaDialog : public HexaBaseDialog, - public Ui::ReplaceHexaDialog - { - Q_OBJECT - public: - ReplaceHexaDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~ReplaceHexaDialog(); - void clear(); - virtual QModelIndexList getAssocsVTK(); - public slots: - virtual bool apply(QModelIndex& result); + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT QuadRevolutionDialog : public HexaBaseDialog, + public Ui::QuadRevolutionDialog + { + Q_OBJECT - protected: - void _initInputWidget( Mode editmode ); + public: + QuadRevolutionDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~QuadRevolutionDialog(); + void clear(); + virtual QModelIndexList getAssocsVTK(); - protected slots: - void deleteQuadItem(); - void updateButtonBox(); + public slots: + virtual bool apply(QModelIndex& result); - private: - HEXA_NS::Elements *_value; - }; + protected: + void _initInputWidget( Mode editmode ); + protected slots: + void addAngleItem(); + void delAngleItem(); + void delQuadItem(); + void updateButtonBox(); + private: + HEXA_NS::Elements *_value; + }; - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT QuadRevolutionDialog : public HexaBaseDialog, - public Ui::QuadRevolutionDialog - { + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeHemiSphereDialog : public HexaBaseDialog, + public Ui::MakeHemiSphereDialog + { Q_OBJECT - public: - QuadRevolutionDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~QuadRevolutionDialog(); - void clear(); - virtual QModelIndexList getAssocsVTK(); + public: + MakeHemiSphereDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + virtual ~MakeHemiSphereDialog(); + void clear(); - public slots: - virtual bool apply(QModelIndex& result); + // void setValue(HEXA_NS::Propagation* v); + // HEXA_NS::Propagation* getValue(); - protected: - void _initInputWidget( Mode editmode ); + public slots: + virtual bool apply(QModelIndex& result); - protected slots: - void addAngleItem(); - void delAngleItem(); - void delQuadItem(); - void updateButtonBox(); + protected: + void _initInputWidget( Mode editmode ); - private: - HEXA_NS::Elements *_value; - }; + private: + HEXA_NS::Elements *_value; + }; + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT ModelInfoDialog : public HexaBaseDialog, + public Ui::ModelInfoDialog + { + Q_OBJECT + public: + ModelInfoDialog( QWidget* parent = NULL, Qt::WindowFlags wf = Qt::SubWindow ); + virtual ~ModelInfoDialog(){} - class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeHemiSphereDialog : public HexaBaseDialog, - public Ui::MakeHemiSphereDialog - { - Q_OBJECT + public slots: + void updateInfo(); - public: - MakeHemiSphereDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); - virtual ~MakeHemiSphereDialog(); - void clear(); + protected: + virtual void hideEvent ( QHideEvent * event ); + virtual void showEvent ( QShowEvent * event ); + virtual bool apply(QModelIndex& result){ return true;} + virtual void _initInputWidget( Mode editmode ){} + }; -// void setValue(HEXA_NS::Propagation* v); -// HEXA_NS::Propagation* getValue(); + class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT AddShapeDialog : public HexaBaseDialog, + public Ui::AddShapeDialog + { + Q_OBJECT - public slots: + public: + AddShapeDialog( QWidget* parent = NULL, Mode editmode = NEW_MODE, Qt::WindowFlags wf = Qt::SubWindow ); + virtual ~AddShapeDialog(); + void clear(); + + public slots: virtual bool apply(QModelIndex& result); + virtual void close(); + virtual void onWindowActivated(SUIT_ViewManager*); - protected: - void _initInputWidget( Mode editmode ); + protected: + virtual void _initInputWidget( Mode editmode ); - private: - HEXA_NS::Elements *_value; - }; + protected slots: + virtual void onCurrentSelectionChanged(); -// class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeRindDialog : public HexaBaseDialog, -// public Ui::MakeRindDialog -// { -// Q_OBJECT -// -// public: -// MakeRindDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); -// virtual ~MakeRindDialog(); -// -// public slots: -// virtual bool apply(QModelIndex& result); -// -// private: -// // HEXA_NS::Propagation *_value;:q -// -// }; + private: + GEOM::GeomObjPtr currentGeomObj; + }; + + + // class HEXABLOCKGUI_DOCUMENTPANEL_EXPORT MakeRindDialog : public HexaBaseDialog, + // public Ui::MakeRindDialog + // { + // Q_OBJECT + // + // public: + // MakeRindDialog( QWidget* = 0, Mode = NEW_MODE, Qt::WindowFlags = Qt::SubWindow );//= 0 ); + // virtual ~MakeRindDialog(); + // + // public slots: + // virtual bool apply(QModelIndex& result); + // + // private: + // // HEXA_NS::Propagation *_value;:q + // + // }; } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx index 5627b29..7d6579e 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.cxx @@ -43,11 +43,11 @@ #include #include - +#include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" +#include "HEXABLOCKGUI_OccGraphicView.hxx" #include "HEXABLOCKGUI_SalomeTools.hxx" #include "HEXABLOCKGUI_DocumentSelectionModel.hxx" #include "HEXABLOCKGUI_DocumentModel.hxx" -#include "HEXABLOCKGUI_DocumentGraphicView.hxx" #include "HEXABLOCKGUI_DocumentItem.hxx" #include "HEXABLOCKGUI.hxx" @@ -86,87 +86,28 @@ using namespace std; using namespace HEXABLOCK::GUI; +// //=========================================================================== +// SelectionModel +// //=========================================================================== -PatternDataSelectionModel::PatternDataSelectionModel( QAbstractItemModel * model ): +SelectionModel::SelectionModel( QAbstractItemModel * model ): QItemSelectionModel( model ), -MyGEOMBase_Helper( SUIT_Session::session()->activeApplication()->desktop() ), -_theModelSelectionChanged(false), -_theVtkSelectionChanged(false), -_theGeomSelectionChanged(false), -salomeNothingSelected(true), -_selectionFilter(-1), -_salomeSelectionMgr(0) -{ - connect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), - this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ) ); - connect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), - this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ) ); - -} - -PatternDataSelectionModel::~PatternDataSelectionModel() -{ - disconnect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), - this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ) ); - disconnect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), - this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ) ); - -// if ( _salomeSelectionMgr ) -// disconnect( _salomeSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( salomeSelectionChanged() ) ); - disconnect( HEXABLOCKGUI::selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( salomeSelectionChanged() ) ); -} - -void PatternDataSelectionModel::setVertexSelection() -{ - MESSAGE("PatternDataSelectionModel::setVertexSelection(){"); - SetSelectionMode(NodeSelection); -// // NodeSelection, -// // CellSelection, -// // EdgeOfCellSelection, -// // EdgeSelection, -// // FaceSelection, -// // VolumeSelection, -// // ActorSelection }; - _selectionFilter = VERTEX_TREE; - MESSAGE("}"); -} - -void PatternDataSelectionModel::setEdgeSelection() +//_theModelSelectionChanged(false), +//_theVtkSelectionChanged(false), +//_theGeomSelectionChanged(false), +ignoreSignal(false), +salomeNothingSelected(true) { - MESSAGE("PatternDataSelectionModel::setEdgeSelection(){"); - SetSelectionMode(EdgeSelection); - _selectionFilter = EDGE_TREE; - MESSAGE("}"); -} - -void PatternDataSelectionModel::setQuadSelection() -{ - MESSAGE("PatternDataSelectionModel::setQuadSelection(){"); - SetSelectionMode(FaceSelection); - _selectionFilter = QUAD_TREE; - MESSAGE("}"); -} - -void PatternDataSelectionModel::setHexaSelection() -{ - MESSAGE("PatternDataSelectionModel::setHexaSelection(){"); -// SetSelectionMode(VolumeSelection); - SetSelectionMode(FaceSelection); //temporary for hexa selection debug - _selectionFilter = HEXA_TREE; - MESSAGE("}"); } -void PatternDataSelectionModel::setAllSelection() +SelectionModel::~SelectionModel() { - MESSAGE("PatternDataSelectionModel::setAllSelection(){"); - SetSelectionMode(ActorSelection); - _selectionFilter = -1; - MESSAGE("}"); + disconnect( HEXABLOCKGUI::selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( salomeSelectionChanged() ) ); } -QModelIndex PatternDataSelectionModel::indexBy( int role, const QString& value ) +QModelIndex SelectionModel::indexBy( int role, const QString& value ) { QModelIndex eltIndex; // element (vertex, edge, quad) of model const QAbstractItemModel* theModel = model(); @@ -182,7 +123,7 @@ QModelIndex PatternDataSelectionModel::indexBy( int role, const QString& value ) } -QModelIndex PatternDataSelectionModel::indexBy( int role, const QVariant& var ) +QModelIndex SelectionModel::indexBy( int role, const QVariant& var ) { QModelIndex eltIndex; // element (vertex, edge, quad) of model const QAbstractItemModel* theModel = model(); @@ -197,612 +138,381 @@ QModelIndex PatternDataSelectionModel::indexBy( int role, const QVariant& var ) return eltIndex; } - -void PatternDataSelectionModel::setSalomeSelectionMgr( LightApp_SelectionMgr* mgr ) +QModelIndex SelectionModel::indexOf( const QString& anEntry, int role ) { - _salomeSelectionMgr = mgr; - connect( _salomeSelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( salomeSelectionChanged() ) ); -} - + QModelIndex eltIndex; // element (vertex, edge, quad) of model + const QAbstractItemModel* theModel = model(); + if ( !theModel ) return eltIndex; -void PatternDataSelectionModel::SetSelectionMode(Selection_Mode theMode) -{ - MESSAGE("PatternDataSelectionModel::SetSelectionMode(){"); -// SVTK_ViewWindow* aVTKViewWindow = _getVTKViewWindow(); -// aViewWindow->clearFilters(); -// _salomeSelectionMgr->clearFilters(); - if ( _getVTKViewWindow() != NULL ) - _getVTKViewWindow()->SetSelectionMode( theMode ); - MESSAGE("}"); + QModelIndexList theIndexes = theModel->match( theModel->index(0, 0), + role, + anEntry, + 1, + Qt::MatchRecursive | Qt::MatchContains );//Qt::MatchFixedString ); + if ( theIndexes.count()>0 ) + eltIndex = theIndexes[0] ; + return eltIndex; } -// A) De Salome(OCC, VTK) vers Hexablock(TreeView Data) : -// -Vertex: -// in: selection (vertex associé OCC). -// out: (vertex VTK) highlighté, (vertex TreeView) sélectionné. -// -// in : selection (vertex associé VTK). -// out: (vertex OCC) highlighté, (vertex TreeView) sélectionné. -// -// -Edge: -// in: selection (edge associé OCC). -// out: (vertex VTK) highlighté, (vertex TreeView) sélectionné. -// -// in: selection (edge associé VTK). -// out: (toute la ligne OCC) highlighté + vertex sur (deb,fin) , (edge TreeView) sélectionné. -// -// -Face: idem vertex -void PatternDataSelectionModel::onCurrentChanged( const QModelIndex & current, const QModelIndex & previous ) +QModelIndexList SelectionModel::indexListOf( const QString& anEntry, int role ) { - MESSAGE("PatternDataSelectionModel::onCurrentChanged(){"); - MESSAGE("* current : " << current.data().toString().toStdString()); - MESSAGE("* previous : " << previous.data().toString().toStdString()); - - //Setting the selection mode of the selected item from the treeview - _setVTKSelectionMode( current); - -// _selectSalome( current, true ); -// _selectSalome( previous, false ); - MESSAGE("}"); + QModelIndexList theIndexes; // element (vertex, edge, quad) of model + const QAbstractItemModel* theModel = model(); + if ( !theModel ) return theIndexes; + theIndexes = theModel->match( theModel->index(0, 0), + role, + anEntry, + -1, + Qt::MatchRecursive | Qt::MatchContains );//Qt::MatchFixedString ); + return theIndexes; } -void PatternDataSelectionModel::highlightEltsWithAssocs(const QModelIndexList& elts) -{ - try { -// if ( HEXABLOCKGUI::selectionMgr() != NULL) HEXABLOCKGUI::selectionMgr()->clearSelected(); - highlightVTKElts(elts); - for( QModelIndexList::const_iterator i_index = elts.begin(); i_index != elts.end(); ++i_index ){ - // _selectVTK( *i_index ); - _highlightGEOM( *i_index ); - } - } catch ( ... ) { - MESSAGE("Unknown exception was cought !!!"); - } -} -void PatternDataSelectionModel::onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ) -{ -// MESSAGE("PatternDataSelectionModel::onSelectionChanged(){"); -// foreach( const QModelIndex& isel, selected.indexes() ){ -// MESSAGE("* selected : " << isel.data().toString().toStdString()); -// } -// foreach( const QModelIndex& iunsel, deselected.indexes() ){ -// MESSAGE("* unselected : " << iunsel.data().toString().toStdString()); -// } - -// _theModelSelectionChanged = true; -// try { -// if ( _salomeSelectionMgr == NULL ) return; -//// if ( !_theVtkSelectionChanged and !_theGeomSelectionChanged ) return; -// -// _salomeSelectionMgr->clearSelected(); -// // erasePreview(true); -// QModelIndexList indexes = selected.indexes(); -// for( QModelIndexList::const_iterator i_index = indexes.begin(); i_index != indexes.end(); ++i_index ){ -// // std::cout << "entry selected" << i_index->data( HEXA_ENTRY_ROLE ).toString().toStdString() << std::endl; -// if ( !_theVtkSelectionChanged ) _selectVTK( *i_index ); -// if ( !_theGeomSelectionChanged ) _highlightGEOM( *i_index ); -// } -// // CS_BP todo SALOMEGUI_Swig.cxx:370 -// // indexes = deselected.indexes(); -// // for( QModelIndexList::const_iterator i_index = indexes.begin(); i_index != indexes.end(); ++i_index ) -// // _unselectSalome( *i_index); -// } catch ( ... ) { -// MESSAGE("Unknown exception was cought !!!"); -// } -// _theModelSelectionChanged = false; - -// MESSAGE("}"); -} -void PatternDataSelectionModel::salomeSelectionChanged() +void SelectionModel::salomeSelectionChanged() { - MESSAGE("PatternDataSelectionModel::salomeSelectionChanged(){"); + if (HEXABLOCKGUI::assocInProgress && + HEXABLOCKGUI::getActiveViewType() == HEXABLOCKGUI::OCC) return; + try { - QModelIndex toSelect; - if ( _salomeSelectionMgr == NULL ) return; + if ( HEXABLOCKGUI::selectionMgr() == NULL ) return; SALOME_ListIO salomeSelected; - // _salomeSelectionMgr->selectedObjects( salomeSelected, SVTK_Viewer::Type() );//salomeSelected.Extent() - _salomeSelectionMgr->selectedObjects( salomeSelected, NULL, false ); +// _salomeSelectionMgr->selectedObjects( salomeSelected, SVTK_Viewer::Type() );//salomeSelected.Extent() + if (HEXABLOCKGUI::getActiveViewType() == HEXABLOCKGUI::VTK) + { + HEXABLOCKGUI::selectionMgr()->selectedObjects( salomeSelected, SVTK_Viewer::Type()); + } + else if (HEXABLOCKGUI::getActiveViewType() == HEXABLOCKGUI::OCC) + { + HEXABLOCKGUI::selectionMgr()->selectedObjects( salomeSelected, "", false); + } + +// HEXABLOCKGUI::selectionMgr()->selectedObjects( salomeSelected, NULL, false ); if ( salomeSelected.IsEmpty() ){ - MESSAGE("* salomeSelected.IsEmpty()"); salomeNothingSelected = true; clearSelection(); return; } Handle(SALOME_InteractiveObject) anIObject; - SALOME_ListIteratorOfListIO it(salomeSelected); - for( ; it.More(); it.Next()){ - anIObject = it.Value(); //anIObject->getName() - toSelect = _geomSelectionChanged( anIObject );// is it comming from GEOM? - if ( !toSelect.isValid() ){ - toSelect = _vtkSelectionChanged( anIObject ); ;// or VTK?... - if ( toSelect.isValid() ) - MESSAGE("* OK : selection from VTK"); - } else { - MESSAGE("* OK : selection from GEOM"); - } + + //Handle selection according to the source + if (HEXABLOCKGUI::getActiveViewType() == HEXABLOCKGUI::VTK) + { + for( ; it.More(); it.Next()){ + anIObject = it.Value(); //anIObject->getName() + vtkSelectionChanged( anIObject ); // or VTK?... + } + } + else if (HEXABLOCKGUI::getActiveViewType() == HEXABLOCKGUI::OCC) + { + for( ; it.More(); it.Next()){ + anIObject = it.Value(); //anIObject->getName() + geomSelectionChanged( anIObject );// or VTK?... + } } + salomeNothingSelected = false; } catch ( ... ) { - MESSAGE("* Unknown exception was cought !!!"); + MESSAGE("* Unknown exception was cought !!!"); } - MESSAGE("}"); } -QModelIndex PatternDataSelectionModel::_geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) -{ - MESSAGE("PatternDataSelectionModel::_geomSelectionChanged(){"); - QModelIndexList assocsIndexes;// elements of the model which is associated to the geom object and that is to be selected - QModelIndex assocIndex; - - if (HEXABLOCKGUI::assocInProgress) return assocIndex; - bool fromGEOM = ( strcmp("GEOM", anIObject->getComponentDataType()) == 0 ); - if ( !fromGEOM ) return assocIndex; - if (!_salomeSelectionMgr) return assocIndex; - - QString aName; - GEOM::GEOM_Object_var aGeomObj = GEOMBase::ConvertIOinGEOMObject( anIObject ); - - int anIndex = -1; - if ( GEOMBase::IsShape(aGeomObj) ){ - aName = GEOMBase::GetName(aGeomObj); - TColStd_IndexedMapOfInteger anIndexes; - _salomeSelectionMgr->GetIndexes(anIObject, anIndexes); - if ( anIndexes.Extent() == 1 ) - anIndex = anIndexes(1); - QString aGeomObjStudyEntry = aGeomObj->GetStudyEntry(); - QString aGeomObjModelEntry = aGeomObjStudyEntry + "," + QString::number(anIndex) + ";"; - assocsIndexes = _indexListOf( aGeomObjModelEntry, HEXA_ASSOC_ENTRY_ROLE ); - if ( !_theModelSelectionChanged && assocsIndexes.count()>0 && assocsIndexes[0].isValid() ){ // select in model - _theGeomSelectionChanged = true; - setCurrentIndex( assocsIndexes[0], QItemSelectionModel::Clear ); //CS_TEST - setCurrentIndex( assocsIndexes[0], QItemSelectionModel::SelectCurrent ); - _theGeomSelectionChanged = false; - } else { - clearSelection(); - } - } - - MESSAGE("}"); - - if (assocsIndexes.count() > 0) - { -// HEXABLOCKGUI::currentVtkView->setFocus(); - highlightVTKElts(assocsIndexes); - return assocsIndexes[0]; - } - return assocIndex; -} -QModelIndex PatternDataSelectionModel::_vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) +QModelIndexList SelectionModel::getSelectionFromModel(const Handle(SALOME_InteractiveObject)& anIObject) { - MESSAGE("PatternDataSelectionModel::_vtkSelectionChanged(){"); - QModelIndex anIOIndex;// // the element of the model which is associated to the Interactive object and that is to be selected - - bool fromVTK = ( strcmp("HEXABLOCK", anIObject->getComponentDataType()) == 0 ); - if ( !fromVTK ) return anIOIndex; - - SVTK_ViewWindow* currentVTKViewWindow = _getVTKViewWindow(); - if ( !currentVTKViewWindow ) return anIOIndex; - if ( !anIObject->hasEntry() ) return anIOIndex; - - QString anIOEntry = anIObject->getEntry(); - Document_Actor *anDocActor = NULL; - int anhexaElemsId; - - QString aText = ""; - if ( GetNameOfSelectedElements( currentVTKViewWindow, anIObject, aText ) <= 0 ) return anIOIndex; - anDocActor = dynamic_cast( findActorByEntry( currentVTKViewWindow, anIOEntry.toLatin1() ) ); - if ( !anDocActor ) return anIOIndex; - anhexaElemsId = anDocActor->hexaElemsId[ aText.toInt() ]; - anIOEntry = QString::number( anhexaElemsId ); - anIOIndex = _indexOf( anIOEntry, HEXA_ENTRY_ROLE ); - - if ( !_theModelSelectionChanged && anIOIndex.isValid() ){ // select in model - _theVtkSelectionChanged = true; - - //Temporary Debug for hexa selection ----------------------------------------------------------------- - if (getSelectionFilter() == HEXA_TREE) - { - DocumentModel *docModel = NULL; - const QSortFilterProxyModel *pModel = dynamic_cast( model() ); - - if ( pModel != NULL){ - docModel = dynamic_cast( pModel->sourceModel() ); - if ( docModel != NULL && anIOIndex.isValid()) - { - //get the selected quad - HEXA_NS::Quad* quad = docModel->getHexaPtr(anIOIndex); - if (quad != NULL) - { - //get the hexa the quad belongs to - HEXA_NS::Hexa* hexa = docModel->getQuadHexa(quad); - if (hexa != NULL) //convert the hexa to a QModelIndex so we can select it in the model - anIOIndex = indexBy( HEXA_DATA_ROLE, QVariant::fromValue(hexa)); - else - { - SUIT_MessageBox::critical( 0, - tr("HexaBlock"), - tr("The Hexahedron This quad belongs to has been deleted!")); - return anIOIndex; - } - } - } - } - }//end if HEXA_TREE------------------------------------------------------------------------------------ - - setCurrentIndex( anIOIndex, QItemSelectionModel::Clear ); - setCurrentIndex( anIOIndex, QItemSelectionModel::SelectCurrent ); - _theVtkSelectionChanged = false; - } else { - clearSelection(); - } - -// if (anIOIndex.isValid()) -// _selectVTK(anIOIndex); - -// if (anIOIndex.isValid()) -// { -// QModelIndexList l; -// l << anIOIndex; -// highlightVTKElts(l); -// _highlightGEOM(anIOIndex); // JMD test à faire -// } - MESSAGE("}"); - return anIOIndex; + QModelIndexList selectedIndexes; + + //verify if the IOBject is valid and from VTK selection + bool fromVTK = ( strcmp("HEXABLOCK", anIObject->getComponentDataType()) == 0 ); + if ( !fromVTK || !anIObject->hasEntry() || HEXABLOCKGUI::currentDocGView->getViewWindow() == NULL) + return selectedIndexes; + + QString anIOEntry = anIObject->getEntry(); + int anhexaElemsId; + QString aText = ""; + + //extract vtk selection from the model ----------- + if ( GetNameOfSelectedElements( HEXABLOCKGUI::currentDocGView->getViewWindow(), anIObject, aText ) <= 0 ) + return selectedIndexes; + + Document_Actor* docActor = dynamic_cast( findActorByEntry( HEXABLOCKGUI::currentDocGView->getViewWindow(), + anIOEntry.toLatin1() ) ); + if ( !docActor ) return selectedIndexes; + QStringList idList = aText.split(" "); + foreach( const QString& id, idList ) + { + if (!id.isEmpty()) + { + //find selection in the model + anhexaElemsId = docActor->hexaElemsId[ id.toInt() ]; + anIOEntry = QString::number( anhexaElemsId ); + + selectedIndexes << indexOf( anIOEntry, HEXA_ENTRY_ROLE ); + } + } + return selectedIndexes; } - -SVTK_ViewWindow* PatternDataSelectionModel::_getVTKViewWindow() +//Returns the element of the model which is associated to the Interactive object +QModelIndexList SelectionModel::getSelectionAssociactions(const Handle(SALOME_InteractiveObject)& anIObject) { -// SVTK_ViewWindow* aVtkView = HEXABLOCKGUI::currentVtkView; - return HEXABLOCKGUI::currentVtkView; + QModelIndexList assocsIndexes; + DocumentModel *docModel = NULL; + const QSortFilterProxyModel *pModel = dynamic_cast( model() ); + if ( pModel != NULL) + docModel = dynamic_cast( pModel->sourceModel() ); + + if ( docModel == NULL) return assocsIndexes; + + //verify if the selection is really from OCC View + bool fromGEOM = ( strcmp("GEOM", anIObject->getComponentDataType()) == 0 ); + if ( !fromGEOM || HEXABLOCKGUI::selectionMgr() == NULL || + HEXABLOCKGUI::currentOccGView->getViewWindow() == NULL) + return assocsIndexes; + +// QString aName; + GEOM::GEOM_Object_var aGeomObj = GEOMBase::ConvertIOinGEOMObject( anIObject ); + + //extract associated elements in the model + if ( GEOMBase::IsShape(aGeomObj) ){ +// aName = GEOMBase::GetName(aGeomObj); + TColStd_IndexedMapOfInteger anIndexes; + HEXABLOCKGUI::selectionMgr()->GetIndexes(anIObject, anIndexes); + if (anIndexes.Extent() == 0) return assocsIndexes; + QString aGeomObjStudyEntry = aGeomObj->GetStudyEntry(); + + for( int i = 1; i <= anIndexes.Extent(); ++i) + { + QString aGeomObjModelEntry = docModel->getGeomObjName(aGeomObjStudyEntry) + "," + QString::number(anIndexes(i)) + ";"; + assocsIndexes.append(indexListOf(aGeomObjModelEntry, HEXA_ASSOC_ENTRY_ROLE)); + if (assocsIndexes.count() > 0) + return assocsIndexes; //Premature: On purpose for Monoselection + } + } + + return assocsIndexes; } -OCCViewer_ViewWindow* PatternDataSelectionModel::_getOCCViewWindow() -{ -// OCCViewer_ViewWindow* aOccView = HEXABLOCKGUI::currentOccView; -// MESSAGE(" dans OCCViewer" << aOccView); - return HEXABLOCKGUI::currentOccView; -} - +// //=========================================================================== +// PatternDataSelectionModel +// //=========================================================================== -QModelIndex PatternDataSelectionModel::_indexOf( const QString& anEntry, int role ) +PatternDataSelectionModel::PatternDataSelectionModel( QAbstractItemModel * model ): +SelectionModel( model ) { - QModelIndex eltIndex; // element (vertex, edge, quad) of model - const QAbstractItemModel* theModel = model(); - if ( !theModel ) return eltIndex; - QModelIndexList theIndexes = theModel->match( theModel->index(0, 0), - role, - anEntry, - 1, - Qt::MatchRecursive | Qt::MatchContains );//Qt::MatchFixedString ); - if ( theIndexes.count()>0 ) - eltIndex = theIndexes[0] ; - return eltIndex; -} - + connect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), + this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ), Qt::UniqueConnection ); + connect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), + this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ), Qt::UniqueConnection ); -QModelIndexList PatternDataSelectionModel::_indexListOf( const QString& anEntry, int role ) -{ - QModelIndexList theIndexes; // element (vertex, edge, quad) of model - const QAbstractItemModel* theModel = model(); - if ( !theModel ) return theIndexes; - theIndexes = theModel->match( theModel->index(0, 0), - role, - anEntry, - -1, - Qt::MatchRecursive | Qt::MatchContains );//Qt::MatchFixedString ); - return theIndexes; } - -void PatternDataSelectionModel::_setVTKSelectionMode( const QModelIndex& eltIndex ) +PatternDataSelectionModel::~PatternDataSelectionModel() { - MESSAGE("PatternDataSelectionModel::_setVTKSelectionMode( "<< eltIndex.data().toString().toStdString() << " )"); - QVariant treeVariant = eltIndex.data( HEXA_TREE_ROLE ); - if ( !treeVariant.isValid() ) return; - int eltType = treeVariant.toInt(); - -// if ( (_selectionFilter != -1) and ( _selectionFilter != eltType ) ) return; - if ( _selectionFilter == eltType ) return; - - switch ( eltType ){ - case VERTEX_TREE : - case VERTEX_DIR_TREE : setVertexSelection(); MESSAGE("VERTEX"); break; - case EDGE_TREE : - case EDGE_DIR_TREE : setEdgeSelection(); MESSAGE("EDGE"); break; - case QUAD_TREE : - case QUAD_DIR_TREE : setQuadSelection(); MESSAGE("QUAD"); break; - case HEXA_TREE : - case HEXA_DIR_TREE : setHexaSelection(); MESSAGE("HEXA"); break; - case PROPAGATION_TREE : - case PROPAGATION_DIR_TREE : setEdgeSelection(); MESSAGE("PROPAGATION"); break; -// CellSelection, -// EdgeOfCellSelection, -// VolumeSelection, -// ActorSelection - } + disconnect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), + this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ) ); + disconnect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), + this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ) ); } -void PatternDataSelectionModel::highlightVTKElts( const QModelIndexList& elts ) +void PatternDataSelectionModel::onCurrentChanged( const QModelIndex & current, const QModelIndex & previous ) { - if (!elts.size()) return; - - SVTK_ViewWindow* currentVTKViewWindow = _getVTKViewWindow(); - if ( currentVTKViewWindow == NULL ) return; - SVTK_Selector* selector = currentVTKViewWindow->GetSelector(); - if ( selector == NULL ) return; - - // document selection - Document_Actor* docActor = NULL; - Handle(SALOME_InteractiveObject) docIO; -// Handle(SALOME_InteractiveObject) docIO2; //JMD - - // element highlight - TColStd_MapOfInteger aMap; -// TColStd_MapOfInteger aMap2; - QList::const_iterator anIter; - int vtkElemsId; - - // data from model - QString docEntry; - QVariant docEntryVariant = elts[0].data( HEXA_DOC_ENTRY_ROLE ); - - if ( !docEntryVariant.isValid() ){ - //INFOS("data from model not valid"); - return; - } - - docEntry = docEntryVariant.toString(); - - // Select the document in Salome - docActor = dynamic_cast( findActorByEntry( currentVTKViewWindow, docEntry.toLatin1() ) ); - if ( docActor == NULL) return; - - - // // Set selection mode in VTK view -// currentVTKViewWindow->SetSelectionMode(VolumeSelection); - docIO = docActor->getIO(); - - - -// QString autreDocentry = "toti"; -// Associate_Actor* associateActor = dynamic_cast( findActorByEntry( currentVTKViewWindow, autreDocentry.toLatin1() ) ); -// docIO2 = associateActor->getIO(); - - // Highlight in vtk view the element from document - //bool rr = true; - - QString eltEntry; - foreach( const QModelIndex& iElt, elts ){ - eltEntry = iElt.data( HEXA_ENTRY_ROLE ).toString(); - vtkElemsId = docActor->vtkElemsId[ eltEntry.toInt() ]; - if ( vtkElemsId > 0 ) aMap.Add( vtkElemsId ); -// if (rr) { -// if ( vtkElemsId > 0 ) aMap.Add( vtkElemsId ); -// } -// else -// { -// if ( vtkElemsId > 0 ) aMap2.Add( vtkElemsId ); -// } -// rr = ! rr; - } - - selector->AddOrRemoveIndex( docIO, aMap, false ); //true -// selector->RemoveIObject(docActor); - currentVTKViewWindow->highlight( docIO, true, true ); -// Document_Actor* docActor = NULL; -// QVariant docEntryVariant = selected.data( HEXA_DOC_ENTRY_ROLE ); -// if ( docEntryVariant.isValid() ){ -// QString docEntry = docEntryVariant.toString(); -// docActor = dynamic_cast( findActorByEntry( HEXABLOCKGUI::currentVtkView, docEntry.toLatin1() ) ); -// if ( docActor != NULL) HEXABLOCKGUI::currentVtkView->getView()->highlight( docActor->getIO(), false, false ); -// } -// currentVTKViewWindow->getView()->SetColor(docIO, QColor("blue")); - - -// selector->AddOrRemoveIndex( docIO2, aMap2, false ); -// currentVTKViewWindow->highlight( docIO2, true, true ); + //Setting the selection mode of the selected item from the treeview + HEXABLOCKGUI::currentDocGView->setSelectionMode( current ); + HEXABLOCKGUI::currentOccGView->setSelectionMode( current ); } -//SUIT_ViewManager* PatternDataSelectionModel::initOccViewManager() -//{ -// SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); -// SUIT_ViewManager* occVm = anApp->getViewManager( OCCViewer_Viewer::Type(), true ); -// SVTK_ViewWindow* viewWindow = dynamic_cast(svw); -// return viewWindow; -//} -SUIT_ViewWindow* PatternDataSelectionModel::initOccViewManager() +void PatternDataSelectionModel::highlightEltsWithAssocs(const QModelIndexList& elts) { - SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); - SUIT_ViewManager* occVm = anApp->getViewManager( OCCViewer_Viewer::Type(), true ); - - QVector viewS = occVm->getViews (); - - int nb = viewS.count(); - - MESSAGE("????HexaBaseDialog::initOccView number of : " << nb); - - if (nb == 1) - { - MESSAGE(" OK ????HexaBaseDialog::initOccView number of : " << nb); - return viewS.first(); - } - - return NULL; + try { + /*if ( !_theVtkSelectionChanged )*/ + HEXABLOCKGUI::currentDocGView->highlight(elts); + /*if ( !_theGeomSelectionChanged )*/ + HEXABLOCKGUI::currentOccGView->highlight(elts); + } catch ( ... ) { + MESSAGE("Unknown exception was cought !!!"); + } } -// 1 vertex -> 1 point -// 1 edge -> n lines + points(deb,fin) -// 1 quad -> n faces -void PatternDataSelectionModel::_highlightGEOM( const QMultiMap& entrySubIDs ) +QModelIndexList PatternDataSelectionModel::getGeomAssociations(const QModelIndex& dataIndex) { - MESSAGE("PatternDataSelectionModel::_highlightGEOM( const QMultiMap& entrySubIDs ){"); - MESSAGE("debut entry => "<< entrySubIDs.count()); - - OCCViewer_ViewWindow* occView = _getOCCViewWindow(); - if ( occView == NULL ) { -// occView = (OCCViewer_ViewWindow*)initOccViewManager(); -// if ( occView == NULL ) - return; - } - MESSAGE("step 1 occView=> " << occView); - - MESSAGE("step 1 entry => "); - SOCC_Viewer* soccViewer = dynamic_cast( occView->getViewManager()->getViewModel() ); - if (!soccViewer) return; - MESSAGE("step 2 entry => "); - _PTR(Study) aStudy = GetActiveStudyDocument(); - if (!aStudy) return; - MESSAGE("step 3 entry => "); - - CORBA::Object_var aCorbaObj = CORBA::Object::_nil(); - GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_nil(); - erasePreview(true); - MESSAGE("Avant entry => "<< entrySubIDs.count()); - foreach ( QString entry, entrySubIDs.keys() ){ - _PTR(SObject) aSChild = aStudy->FindObjectID( entry.toStdString() ); - MESSAGE("* entry => "<< entry.toStdString()); - aCorbaObj = corbaObj( aSChild ); - aGeomObj = GEOM::GEOM_Object::_narrow( aCorbaObj ); - if ( !CORBA::is_nil(aGeomObj) ){ - MESSAGE("* !CORBA::is_nil(aGeomObj)"); - QString objIOR = GEOMBase::GetIORFromObject( aGeomObj._retn() ); - Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIORinGEOMAISShape( objIOR );//, true ); - if ( !aSh.IsNull() ){ - MESSAGE("* !aSh.IsNull() "); - TColStd_IndexedMapOfInteger anIndexes; - foreach ( int subid, entrySubIDs.values(entry) ){ - if ( subid != -1 ) - anIndexes.Add( subid ); - } - if ( anIndexes.Extent() > 0 ){ // if it's a sub-shape - MESSAGE("* a sub-shape"); - aSh->highlightSubShapes( anIndexes, true ); - soccViewer->Repaint(); - } else { // or a main shape -// std::cout << "aSh->getIO() => " << aSh->getIO() << std::endl; -// getDisplayer()->SetDisplayMode(0); -// soccViewer->setColor( aSh->getIO(), QColor( Qt::red ), true ); -// soccViewer->switchRepresentation( aSh->getIO(), 2 ); - MESSAGE("* a main shape"); -// globalSelection(); - soccViewer->highlight( aSh->getIO(), true, true ); + QModelIndexList geomIndexList; + HEXA_NS::SubShape* ssh; + HEXA_NS::EdgeShape* sh; + if (HEXABLOCKGUI::currentDocGView == NULL) return geomIndexList; + + DocumentModel *docModel = NULL; + const QSortFilterProxyModel *pModel = dynamic_cast( model() ); + PatternGeomModel* pGModel = HEXABLOCKGUI::currentDocGView->getPatternGeomModel(); + PatternGeomSelectionModel* pGSModel = HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); + + if ( pModel != NULL) + docModel = dynamic_cast( pModel->sourceModel() ); + + if (docModel == NULL || pGModel == NULL || pGSModel == NULL) + return geomIndexList; + + HEXA_NS::Vertex* vertex = docModel->getHexaPtr(dataIndex); + HEXA_NS::Edge* edge = docModel->getHexaPtr(dataIndex); + HEXA_NS::Quad* quad = docModel->getHexaPtr(dataIndex); + QModelIndex index = pModel->mapToSource(dataIndex); + + if (vertex != NULL) + geomIndexList << docModel->getVertexAssociation( index/*dataIndex*/ ); + else if (edge != NULL) + { + QList assocs = docModel->getEdgeAssociations( index/*dataIndex*/ ); + foreach( const DocumentModel::GeomObj& anAssoc, assocs ) + { + QString id = anAssoc.shapeName+","+anAssoc.subid; + ssh = docModel->getGeomPtr(id); + sh = dynamic_cast(ssh); + if (sh != NULL) + geomIndexList << /*pGModel->mapToSource(*/pGSModel->indexBy( HEXA_DATA_ROLE, QVariant::fromValue(sh))/*)*/; } - } } - } + else if ( quad != NULL) + geomIndexList = docModel->getQuadAssociations( index/*dataIndex*/ ); - MESSAGE("}"); + + return geomIndexList; } -void PatternDataSelectionModel::_highlightGEOM( const QModelIndex & anEltIndex ) +void PatternDataSelectionModel::onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ) { - MESSAGE("PatternDataSelectionModel::_highlightGEOM(" << anEltIndex.data().toString().toStdString() << ")"); - // getting association(s) from model - QList assocs; - QMultiMap< QString, int > assocEntrySubIDs; - DocumentModel *docModel = NULL; - const QSortFilterProxyModel *pModel = dynamic_cast( model() ); - - if ( !pModel ) return; - docModel = dynamic_cast( pModel->sourceModel() ); - if ( !docModel ) return; - assocs = docModel->getAssociations( pModel->mapToSource(anEltIndex) ); - foreach( const DocumentModel::GeomObj& anAssoc, assocs ) - { -// MESSAGE(" dedans " << anAssoc.entry.toStdString()); -// MESSAGE(" + " << anAssoc.subid.toInt()); - assocEntrySubIDs.insert( anAssoc.entry, anAssoc.subid.toInt() ); - - } - _highlightGEOM( assocEntrySubIDs ); - MESSAGE("}"); +// if (ignoreSignal) +// { +// MESSAGE("PatternDataSelectionModel: ignoring this signal"); +// ignoreSignal = false; +// return; +// } + //need to highlight the associated geom obj in the geometry tree + //first get the association + QModelIndexList associatedGeomIndexes; + QModelIndexList indexes = selected.indexes(); + highlightEltsWithAssocs(indexes); + +// //highlight in geom +// if (HEXABLOCKGUI::currentDocGView == NULL || indexes.count() == 0) return; +// associatedGeomIndexes = getGeomAssociations(indexes[0]); //Mono Selection +// if (associatedGeomIndexes.count() == 0) +// { +// MESSAGE("ON SELECTION CHANGED: no association found: returning..."); +// HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel()->setIgnoreSignal(false); +// return; +// } +// if (associatedGeomIndexes[0].isValid()) +// { +//// MESSAGE("Association found: but not selecting... now returning"); +//// return; +// //tell geom selection model to ignore this signal +// HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel()->setIgnoreSignal(true); +// +// //selection of the associated element in the geometry tree +//// HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel()->setCurrentIndex( associatedGeomIndexes[0], +//// QItemSelectionModel::Clear ); +// const QSortFilterProxyModel *pModel = dynamic_cast( HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel()->model() ); +// if (pModel == NULL) +// { +// HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel()->setIgnoreSignal(false); +// return; +// } +// MESSAGE("SELECTING THE GEOM TREE INDEX NOW: "); +// MESSAGE(HEXABLOCKGUI::currentDocGView->getDocumentModel()->getHexaPtr(associatedGeomIndexes[0])->getName()); +// +// HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel()->setCurrentIndex( associatedGeomIndexes[0], +// QItemSelectionModel::ClearAndSelect ); +// } } -void PatternDataSelectionModel::_selectVTK( const QModelIndex& eltIndex ) +void PatternDataSelectionModel::geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) { - MESSAGE("PatternDataSelectionModel::_selectVTK( "<< eltIndex.data().toString().toStdString() << ")"); - SVTK_ViewWindow* currentVTKViewWindow = _getVTKViewWindow(); - if ( currentVTKViewWindow == NULL ) return; - SVTK_Selector* selector = currentVTKViewWindow->GetSelector(); - if ( selector == NULL ) return; - - // document selection - Document_Actor* docActor = NULL; - Handle(SALOME_InteractiveObject) docIO; - SALOME_ListIO aList; - - // element highlight - TColStd_MapOfInteger aMap; - QList::const_iterator anIter; - int vtkElemsId; - - // data from model - QString eltEntry; - QString docEntry; - QVariant entryVariant = eltIndex.data( HEXA_ENTRY_ROLE ); - QVariant docEntryVariant = eltIndex.data( HEXA_DOC_ENTRY_ROLE ); - - if ( !entryVariant.isValid() ){ - //INFOS("entryVariant not valid"); - return; - } - if ( !docEntryVariant.isValid() ){ - //INFOS("docEntryVariant not valid"); - return; - } + if (HEXABLOCKGUI::assocInProgress) return; + +// QModelIndexList assocsIndexes = getSelectionAssociactions(anIObject); + PatternGeomSelectionModel* pgsm = NULL; + if (HEXABLOCKGUI::currentDocGView != NULL) + pgsm = HEXABLOCKGUI::currentDocGView->getPatternGeomSelectionModel(); + if (pgsm == NULL) return; + + QModelIndex geomModelIndex = pgsm->getModelIndex(anIObject); + clearSelection(); + if (!geomModelIndex.isValid()) return; + pgsm->setCurrentIndex( geomModelIndex, QItemSelectionModel::Clear ); //CS_TEST + pgsm->setCurrentIndex( geomModelIndex, QItemSelectionModel::SelectCurrent ); +} - eltEntry = entryVariant.toString(); - docEntry = docEntryVariant.toString(); - - // Select the document in Salome - docActor = dynamic_cast( findActorByEntry( currentVTKViewWindow, docEntry.toLatin1() ) ); - if ( docActor == NULL ) return; - - // Set selection mode in VTK view - //_setVTKSelectionMode( eltIndex, currentVTKViewWindow ); - -// if ( _salomeSelectionMgr == NULL ) return; -// _salomeSelectionMgr->selectedObjects( aList ); -// std::cout<<"aList.Extent() => " << aList.Extent() << std::endl; -// aList.Append(docIO); -// _salomeSelectionMgr->setSelectedObjects( aList, true );//false );//true ); //CS_BP false? - docIO = docActor->getIO(); - - // Highlight in vtk view the element from document - vtkElemsId = docActor->vtkElemsId[ eltEntry.toInt() ];// get vtk ids from actor - if ( vtkElemsId > 0 ) // CS_BP ?: erreur si 1er elt == vertex (0,0,0) - aMap.Add( vtkElemsId ); -// for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter) { -// aMap.Add(*anIter); -// } - selector->AddOrRemoveIndex( docIO, aMap, false ); - currentVTKViewWindow->highlight( docIO, true, true ); - MESSAGE("}"); +void PatternDataSelectionModel::vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) +{ + QModelIndexList selectedIndexes = getSelectionFromModel(anIObject); + if (selectedIndexes.count() == 0) + { + clearSelection(); + return; + } + // _theVtkSelectionChanged = true; + QModelIndex anIOIndex = selectedIndexes[0]; //Monoselection + + //Temporary Debug for hexa selection ----------------------------- + if (HEXABLOCKGUI::currentDocGView->getSelectionMode() == HEXA_TREE) + { + DocumentModel *docModel = NULL; + const QSortFilterProxyModel *pModel = dynamic_cast( model() ); + + if ( pModel != NULL){ + docModel = dynamic_cast( pModel->sourceModel() ); + if ( docModel != NULL && anIOIndex.isValid()) + { + //get the selected quad + HEXA_NS::Quad* quad = docModel->getHexaPtr(anIOIndex); + + if (quad != NULL) + { + //get the hexa the quad belongs to + HEXA_NS::Hexa* hexa = docModel->getQuadHexa(quad); + if (hexa != NULL) //convert the hexa to a QModelIndex so we can select it in the model + anIOIndex = indexBy( HEXA_DATA_ROLE, QVariant::fromValue(hexa)); + else + { + SUIT_MessageBox::critical( 0, + tr("HexaBlock"), + tr("The Hexahedron this quad belongs to has been deleted!")); + return; + } + } + } + } + }//end if HEXA_TREE---------------------------------------------- + + //select the element in the model + setCurrentIndex( anIOIndex, QItemSelectionModel::Clear ); + setCurrentIndex( anIOIndex, QItemSelectionModel::SelectCurrent ); + // _theVtkSelectionChanged = false; } -GroupsSelectionModel::GroupsSelectionModel( QAbstractItemModel * model ): -QItemSelectionModel( model ) +// //=========================================================================== +// PatternGeomSelectionModel +// //=========================================================================== + +PatternGeomSelectionModel::PatternGeomSelectionModel( QAbstractItemModel * model ): +SelectionModel( model ) { connect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ) ); connect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), - this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ) ); + this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ), Qt::UniqueConnection ); } -GroupsSelectionModel::~GroupsSelectionModel() +PatternGeomSelectionModel::~PatternGeomSelectionModel() { disconnect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ) ); @@ -811,116 +521,162 @@ GroupsSelectionModel::~GroupsSelectionModel() } - - -QModelIndex GroupsSelectionModel::indexBy( int role, const QVariant& var ) +void PatternGeomSelectionModel::onCurrentChanged( const QModelIndex & current, const QModelIndex & previous ) { - QModelIndex eltIndex; // element (vertex, edge, quad) of model - const QAbstractItemModel* theModel = model(); - if ( !theModel ) return eltIndex; - QModelIndexList theIndexes = theModel->match( theModel->index(0, 0), - role, - var, - 1, - Qt::MatchRecursive /*| Qt::MatchContains*/ );//Qt::MatchFixedString ); - if ( theIndexes.count()>0 ) - eltIndex = theIndexes[0] ; - return eltIndex; -} - + //Setting the selection mode of the selected item from the treeview} + HEXABLOCKGUI::currentDocGView->setSelectionMode( current ); + HEXABLOCKGUI::currentOccGView->setSelectionMode( current ); -SVTK_ViewWindow* GroupsSelectionModel::_getVTKViewWindow() -{ -// SVTK_ViewWindow* aVtkView = HEXABLOCKGUI::currentVtkView; - return HEXABLOCKGUI::currentVtkView; } - -void GroupsSelectionModel::_highlightGroups( const QModelIndex& eltIndex ) +void PatternGeomSelectionModel::onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ) { - const GroupsModel* m = dynamic_cast( model() ); + //don't handle selection signals coming from the data tree +// if (ignoreSignal) +// { +// MESSAGE("PatternGeomSelectionModel: IGNORING THE SIGNAL:!"); +// ignoreSignal = false; +// return; +// } -// ---- VTK ---- - if ( m == NULL ) return; - SVTK_ViewWindow* currentVTKViewWindow = _getVTKViewWindow(); - if ( currentVTKViewWindow == NULL ) return; - SVTK_Selector* selector = currentVTKViewWindow->GetSelector(); - if ( selector == NULL ) return; + DocumentModel *docModel = NULL; + const QSortFilterProxyModel *pModel = dynamic_cast( model() ); + if ( pModel != NULL) + docModel = dynamic_cast( pModel->sourceModel()); -// ---- vtkActor - // document selection - Document_Actor* docActor = NULL; - Handle(SALOME_InteractiveObject) docIO; - SALOME_ListIO aList; + QModelIndexList indexes = selected.indexes(); + if (indexes.count() == 0 || docModel == NULL) return; - // element highlight - TColStd_MapOfInteger aMap; - QList::const_iterator anIter; - int vtkElemsId; + //find the corresponding element in the model + HEXA_NS::SubShape* eltSubShape = dynamic_cast(docModel->getHexaPtr(indexes[0])); + if (eltSubShape == NULL) return; + HEXA_NS::NewShape* subShapeParent = eltSubShape->getParentShape(); + if (subShapeParent == NULL) return; + QString parentShapeName = subShapeParent->getName(); + QString subId = QString::number(eltSubShape->getIdent()); + QString aGeomObjModelEntry = parentShapeName + "," + subId + ";"; - // debut ** data from model - int eltType; - QString docEntry; + //get the model of the data tree + if (HEXABLOCKGUI::currentDocGView == NULL || HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel() == NULL) + return; - QVariant treeVariant = eltIndex.data( HEXA_TREE_ROLE ); - QVariant docEntryVariant = eltIndex.data( HEXA_DOC_ENTRY_ROLE ); + QModelIndexList assocsIndexes = HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel()->indexListOf(aGeomObjModelEntry, HEXA_ASSOC_ENTRY_ROLE); - if ( !treeVariant.isValid() || !docEntryVariant.isValid() ){ - //INFOS("data from model not valid"); - return; - } + //selection of the associated elements + if (assocsIndexes.count() == 1 && assocsIndexes[0].isValid()) + { +// HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel()->setIgnoreSignal(true); + //Select associated element in the model => highlight in vtk view +// HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel()->setCurrentIndex( assocsIndexes[0], QItemSelectionModel::Clear ); //CS_TEST + HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel()->setCurrentIndex( assocsIndexes[0], QItemSelectionModel::ClearAndSelect ); + HEXABLOCKGUI::currentDocGView->getPatternDataSelectionModel()->highlightEltsWithAssocs(assocsIndexes); + } + else + { + /*more than one element associated to this geom object: just highlight in the views, + not in the model (because of mono selection in the model).*/ - eltType = treeVariant.toInt(); - docEntry = docEntryVariant.toString(); + //hight the selected geom obj in the occ view + if (HEXABLOCKGUI::currentOccGView != NULL) + { + QMultiMap entrySubIDs; + entrySubIDs.insert(parentShapeName, eltSubShape->getIdent()); - if ( eltType != GROUP_TREE ){ - //INFOS("bad element type : not a group item" << eltType ); - return; - } - // fin ** data from model - - // Select the document in Salome - docActor = dynamic_cast( findActorByEntry( currentVTKViewWindow, docEntry.toLatin1() ) ); - if ( docActor == NULL) return; - docIO = docActor->getIO(); - - // Highlight in vtk view the element from document - DocumentModel::Group kind; - QModelIndexList iElements = m->getGroupElements( eltIndex, kind ); - - // Set selection mode in VTK view - switch (kind){ - case HEXA_NS::HexaCell: case HEXA_NS::HexaNode: currentVTKViewWindow->SetSelectionMode(VolumeSelection); break; - case HEXA_NS::QuadCell: case HEXA_NS::QuadNode: currentVTKViewWindow->SetSelectionMode(FaceSelection); break; - case HEXA_NS::EdgeCell: case HEXA_NS::EdgeNode: currentVTKViewWindow->SetSelectionMode(EdgeSelection); break; - case HEXA_NS::VertexNode: currentVTKViewWindow->SetSelectionMode(NodeSelection); break; - } + HEXABLOCKGUI::currentOccGView->highlight(entrySubIDs); + } + //...and its associated elements in the vtk view + HEXABLOCKGUI::currentDocGView->highlight(assocsIndexes); + } +} - QString eltEntry; - foreach( const QModelIndex& iElt, iElements ){ - eltEntry = iElt.data( HEXA_ENTRY_ROLE ).toString(); - vtkElemsId = docActor->vtkElemsId[ eltEntry.toInt() ]; - if ( vtkElemsId > 0 ) aMap.Add( vtkElemsId ); - } +QModelIndex PatternGeomSelectionModel::getModelIndex(const Handle(SALOME_InteractiveObject)& anIObject) +{ + QModelIndex result; + DocumentModel *docModel = NULL; + const QSortFilterProxyModel *pModel = dynamic_cast( model() ); + if ( pModel != NULL) + docModel = dynamic_cast( pModel->sourceModel()); + + if ( docModel == NULL) return result; + + //verify if the selection is really from OCC View + bool fromGEOM = ( strcmp("GEOM", anIObject->getComponentDataType()) == 0 ); + if ( !fromGEOM || HEXABLOCKGUI::selectionMgr() == NULL || + HEXABLOCKGUI::currentOccGView->getViewWindow() == NULL) + return result; + + // QString aName; + GEOM::GEOM_Object_var aGeomObj = GEOMBase::ConvertIOinGEOMObject( anIObject ); + + //extract associated elements in the model + if ( GEOMBase::IsShape(aGeomObj) ){ + // aName = GEOMBase::GetName(aGeomObj); + TColStd_IndexedMapOfInteger anIndexes; + HEXABLOCKGUI::selectionMgr()->GetIndexes(anIObject, anIndexes); + if (anIndexes.Extent() == 0) return result; + QString aGeomObjStudyEntry = aGeomObj->GetStudyEntry(); + QString aGeomObjModelEntry = docModel->getGeomObjName(aGeomObjStudyEntry) + "," + QString::number(anIndexes(1)); + + HEXA_NS::SubShape* ssh = docModel->getGeomPtr(aGeomObjModelEntry); + if (ssh != NULL) + { + MESSAGE("Tranna get: " << aGeomObjModelEntry.toStdString() << ", " << ssh->getName()); + } + else + { + MESSAGE("YOUR SHAPE IS NULL"); + } + MESSAGE("Tranna get: " << aGeomObjModelEntry.toStdString()); + HEXA_NS::VertexShape* vSh = dynamic_cast(ssh); + HEXA_NS::EdgeShape* eSh = dynamic_cast(ssh); + HEXA_NS::FaceShape* fSh = dynamic_cast(ssh); + + if (vSh != NULL) + result = indexBy( HEXA_DATA_ROLE, QVariant::fromValue(vSh)); + else if (eSh != NULL) + { + MESSAGE("=====> An EDGE: "<< eSh->getName()); + result = indexBy( HEXA_DATA_ROLE, QVariant::fromValue(eSh)); + } + else if (fSh != NULL) + result = indexBy( HEXA_DATA_ROLE, QVariant::fromValue(fSh)); + } + return result; +} - selector->AddOrRemoveIndex( docIO, aMap, false ); - currentVTKViewWindow->highlight( docIO, true, true ); +// //=========================================================================== +// GroupsSelectionModel +// //=========================================================================== +GroupsSelectionModel::GroupsSelectionModel( QAbstractItemModel * model ): +SelectionModel( model ) +{ + connect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), + this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ), Qt::UniqueConnection ); + connect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), + this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ), Qt::UniqueConnection ); +} + +GroupsSelectionModel::~GroupsSelectionModel() +{ + disconnect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), + this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ) ); + disconnect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), + this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ) ); } + void GroupsSelectionModel::onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ) { - MESSAGE("GroupsSelectionModel::onSelectionChanged"); try { // if ( _salomeSelectionMgr == NULL ) return; // _salomeSelectionMgr->clearSelected(); // erasePreview(true); QModelIndexList indexes = selected.indexes(); for( QModelIndexList::const_iterator i_index = indexes.begin(); i_index != indexes.end(); ++i_index ){ - MESSAGE( "entry selected" << i_index->data( HEXA_ENTRY_ROLE ).toString().toStdString() ); - _highlightGroups( *i_index ); + HEXABLOCKGUI::currentDocGView->highlightGroups( *i_index ); } // CS_BP todo SALOMEGUI_Swig.cxx:370 @@ -933,13 +689,19 @@ void GroupsSelectionModel::onSelectionChanged( const QItemSelection & selected, } + +// //=========================================================================== +// MeshSelectionModel +// //=========================================================================== + + MeshSelectionModel::MeshSelectionModel( QAbstractItemModel * model ): -QItemSelectionModel( model ) +SelectionModel( model ) { connect( this, SIGNAL( currentChanged( const QModelIndex &, const QModelIndex & ) ), - this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ) ); + this, SLOT( onCurrentChanged( const QModelIndex & , const QModelIndex & ) ), Qt::UniqueConnection ); connect( this, SIGNAL( selectionChanged( const QItemSelection & , const QItemSelection & ) ), - this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ) ); + this, SLOT( onSelectionChanged( const QItemSelection & , const QItemSelection & ) ), Qt::UniqueConnection ); } @@ -952,104 +714,13 @@ MeshSelectionModel::~MeshSelectionModel() } -QModelIndex MeshSelectionModel::indexBy( int role, const QVariant& var ) -{ - QModelIndex eltIndex; // element (vertex, edge, quad) of model - const QAbstractItemModel* theModel = model(); - if ( !theModel ) return eltIndex; - QModelIndexList theIndexes = theModel->match( theModel->index(0, 0), - role, - var, - 1, - Qt::MatchRecursive /*| Qt::MatchContains*/ );//Qt::MatchFixedString ); - if ( theIndexes.count()>0 ) - eltIndex = theIndexes[0] ; - return eltIndex; -} - - - -SVTK_ViewWindow* MeshSelectionModel::_getVTKViewWindow() -{ -// SVTK_ViewWindow* aVtkView = HEXABLOCKGUI::currentVtkView; - return HEXABLOCKGUI::currentVtkView; -} - - -void MeshSelectionModel::_highlightPropagation( const QModelIndex& eltIndex ) -{ - const MeshModel* m = dynamic_cast( model() ); - if ( m == NULL ) return; - SVTK_ViewWindow* currentVTKViewWindow = _getVTKViewWindow(); - if ( currentVTKViewWindow == NULL ) return; - SVTK_Selector* selector = currentVTKViewWindow->GetSelector(); - if ( selector == NULL ) return; - - // document selection - Document_Actor* docActor = NULL; - Handle(SALOME_InteractiveObject) docIO; - SALOME_ListIO aList; - - // element highlight - TColStd_MapOfInteger aMap; - QList::const_iterator anIter; - int vtkElemsId; - - // data from model - int eltType; - QString docEntry; - - QVariant treeVariant = eltIndex.data( HEXA_TREE_ROLE ); - QVariant docEntryVariant = eltIndex.data( HEXA_DOC_ENTRY_ROLE ); - - if ( !treeVariant.isValid() || !docEntryVariant.isValid() ){ - //INFOS("data from model not valid"); - return; - } - - eltType = treeVariant.toInt(); - docEntry = docEntryVariant.toString(); - - if ( eltType != PROPAGATION_TREE ){ - //INFOS("bad element type : not a propagation item" << eltType ); - return; - } - - // Select the document in Salome - docActor = dynamic_cast( findActorByEntry( currentVTKViewWindow, docEntry.toLatin1() ) ); - if ( docActor == NULL) return; - -// // Set selection mode in VTK view - currentVTKViewWindow->SetSelectionMode(EdgeSelection); - docIO = docActor->getIO(); - - // Highlight in vtk view the element from document - QModelIndexList iEdges = m->getPropagation( eltIndex ); - - QString edgeEntry; - foreach( const QModelIndex& iEdge, iEdges ){ - edgeEntry = iEdge.data( HEXA_ENTRY_ROLE ).toString(); - vtkElemsId = docActor->vtkElemsId[ edgeEntry.toInt() ]; - if ( vtkElemsId > 0 ) aMap.Add( vtkElemsId ); - } - - selector->AddOrRemoveIndex( docIO, aMap, false ); - currentVTKViewWindow->highlight( docIO, true, true ); -} - - - void MeshSelectionModel::onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ) { - MESSAGE("MeshSelectionModel::onSelectionChanged"); try { - // if ( _salomeSelectionMgr == NULL ) return; - // _salomeSelectionMgr->clearSelected(); - // erasePreview(true); + QModelIndexList indexes = selected.indexes(); for( QModelIndexList::const_iterator i_index = indexes.begin(); i_index != indexes.end(); ++i_index ){ - MESSAGE( "entry selected" << i_index->data( HEXA_ENTRY_ROLE ).toString().toStdString() ); - _highlightPropagation( *i_index ); + HEXABLOCKGUI::currentDocGView->highlightPropagation( *i_index ); } // CS_BP todo SALOMEGUI_Swig.cxx:370 @@ -1063,6 +734,13 @@ void MeshSelectionModel::onSelectionChanged( const QItemSelection & selected, co } + + + + + + + // //================================================================================= // // function : activateSelection // // purpose : Activate selection in accordance with myEditCurrentArgument @@ -1070,7 +748,7 @@ void MeshSelectionModel::onSelectionChanged( const QItemSelection & selected, co // void PatternDataSelectionModel::activateSelection() // { // erasePreview(false); -// +// // // local selection // if (!myObject->_is_nil() && !isAllSubShapes()) // { @@ -1084,38 +762,38 @@ void MeshSelectionModel::onSelectionChanged( const QItemSelection & selected, co // myIsHiddenMain = true; // } // } -// +// // int prevDisplayMode = aDisplayer->SetDisplayMode(0); -// +// // SUIT_ViewWindow* aViewWindow = 0; // SUIT_Study* activeStudy = SUIT_Session::session()->activeApplication()->activeStudy(); // if (activeStudy) // aViewWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); // if (aViewWindow == 0) return; -// +// // SUIT_ViewManager* aViewManager = aViewWindow->getViewManager(); // if (aViewManager->getType() != OCCViewer_Viewer::Type() && // aViewManager->getType() != SVTK_Viewer::Type()) // return; -// +// // SUIT_ViewModel* aViewModel = aViewManager->getViewModel(); // SALOME_View* aView = dynamic_cast(aViewModel); // if (aView == 0) return; -// +// // //TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myObject); -// +// // TopTools_IndexedMapOfShape aSubShapesMap; // TopExp::MapShapes(myShape, aSubShapesMap); // CORBA::String_var aMainEntry = myObject->GetStudyEntry(); // QString anEntryBase = aMainEntry.in(); -// +// // TopExp_Explorer anExp (myShape, (TopAbs_ShapeEnum)shapeType()); // for (; anExp.More(); anExp.Next()) // { // TopoDS_Shape aSubShape = anExp.Current(); // int index = aSubShapesMap.FindIndex(aSubShape); // QString anEntry = anEntryBase + QString("_%1").arg(index); -// +// // SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView); // if (aPrs) { // displayPreview(aPrs, true, false); // append, do not update @@ -1124,7 +802,7 @@ void MeshSelectionModel::onSelectionChanged( const QItemSelection & selected, co // aDisplayer->UpdateViewer(); // aDisplayer->SetDisplayMode(prevDisplayMode); // } -// +// // globalSelection(GEOM_ALLSHAPES); // } @@ -1139,12 +817,12 @@ void MeshSelectionModel::onSelectionChanged( const QItemSelection & selected, co // LightApp_DataOwner* anOwher = new LightApp_DataOwner( anEntry ); // aList.append( anOwher ); // } -// +// // SUIT_Session* session = SUIT_Session::session(); // SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); // if ( !app ) // return false; -// +// // LightApp_SelectionMgr* aMgr = app->selectionMgr(); // if ( !aMgr ) // return false; @@ -1158,14 +836,14 @@ void MeshSelectionModel::onSelectionChanged( const QItemSelection & selected, co // SMESH_Actor* anActor = SMESH::FindActorByObject(myMesh); // if (!anActor || !anActor->hasIO()) // return; -// +// // Handle(SALOME_InteractiveObject) anIO = anActor->getIO(); // //mySelectionMgr->clearSelected(); // //mySelectionMgr->AddIObject(anIO, false); // SALOME_ListIO aList; // aList.Append(anIO); // mySelectionMgr->setSelectedObjects(aList, false); -// +// // // Remove filter corresponding to the current type from viewer // int aType = myTable->GetType(); // int aFilterId = SMESH::UnknownFilter; @@ -1174,19 +852,19 @@ void MeshSelectionModel::onSelectionChanged( const QItemSelection & selected, co // else if (aType == SMESH::VOLUME) aFilterId = SMESH::VolumeFilter; // Handle(VTKViewer_Filter) aFilter = SMESH::GetFilter(aFilterId); // SMESH::RemoveFilter(aFilterId); -// +// // // get vtk ids // TColStd_MapOfInteger aMap; // QList::const_iterator anIter; // for (anIter = theIds.begin(); anIter != theIds.end(); ++anIter) { // aMap.Add(*anIter); // } -// +// // // Set new selection // activeViewWindow->AddOrRemoveIndex(anIO, aMap, false); // if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) // aViewWindow->highlight( anIO, true, true ); -// +// // // insert previously stored filter in viewer if necessary // if (!aFilter.IsNull()) // SMESH::SetFilter(aFilter); @@ -1218,10 +896,10 @@ void MeshSelectionModel::onSelectionChanged( const QItemSelection & selected, co // { // if (myBusy) return; // myMeshActor = 0; -// +// // SALOME_ListIO aList; // mySelectionMgr->selectedObjects(aList,SVTK_Viewer::Type()); -// +// // if (aList.Extent() == 1) { // Handle(SALOME_InteractiveObject) anIO = aList.First(); // myMeshActor = SMESH::FindActorByEntry(anIO->getEntry()); @@ -1244,107 +922,11 @@ void MeshSelectionModel::onSelectionChanged( const QItemSelection & selected, co // } // } // } -// +// // reset(); // } -/* - -void PatternDataSelectionModel::setGeomEngine( GEOM::GEOM_Gen_var geomEngine ) -{gaumont parnasse - _geomEngine = geomEngine; -} - -GEOM::GEOM_IOperations_ptr PatternDataSelectionModel::createOperation() -{ -// return myGeomGUI->GetGeomGen()->GetIBasicOperations(getStudyId()); - return _geomEngine->GetIBasicOperations(getStudyId()); -} - -bool PatternDataSelectionModel::execute(ObjectList& objects) -{ - bool res = false; - - _PTR(Study) aStudy = GetActiveStudyDocument(); - _PTR(SObject) aSChild; - CORBA::Object_var aCorbaObj = CORBA::Object::_nil(); - GEOM::GEOM_Object_var assoc; - - foreach( const DocumentModel::GeomObj& anAssoc, _assocList ){ - std::cout << "FOUND=> " << anAssoc.entry.toStdString() << std::endl; - aSChild = aStudy->FindObjectID( anAssoc.entry.toStdString() ); - aCorbaObj = corbaObj(aSChild); - assoc = GEOM::GEOM_Object::_narrow(aCorbaObj); - - if ( !CORBA::is_nil(assoc) ){ - std::cout << "geom to highlight =>" << anAssoc.name.toStdString() << std::endl; - objects.push_back( assoc._retn() ); - res = true; - } else { - std::cout << "not a geom =>" << anAssoc.name.toStdString()<< std::endl; - } - } - - return res; -} -*/ - - -// SVTK_ViewWindow* PatternDataSelectionModel::GetViewWindow() -// { -// SalomeApp_Application* anApp = dynamic_cast -// (SUIT_Session::session()->activeApplication()); -// if (anApp) { -// if (SVTK_ViewWindow* aView = dynamic_cast(anApp->desktop()->activeWindow())) -// return aView; -// -// // SUIT_ViewManager* aViewManager = -// // anApp->getViewManager(SVTK_Viewer::Type(), createIfNotFound); -// // if (aViewManager) { -// // if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) { -// // if (SVTK_ViewWindow* aView = dynamic_cast(aViewWindow)) { -// // aViewWindow->raise(); -// // aViewWindow->setFocus(); -// // return aView; -// // } -// // } -// // } -// } -// return NULL; -// } - - - - -// void PatternDataSelectionModel::SetSelectionMode(Selection_Mode theMode) -// { -// -// QList aSelectors; -// _salomeSelectionMgr->selectors( SVTK_Viewer::Type(), aSelectors ); -// QListIterator it( aSelectors ); -// -// std::cout << "PatternDataSelectionModel::SetSelectionMode()" << std::endl; -// while ( it.hasNext() ) -// { -// // SUIT_Selector* selector = it.next(); -// SVTK_Selector* selector = dynamic_cast( it.next() ); -// if ( selector ){ -// std::cout << "PatternDataSelectionModel::SetSelectionMode()" << theMode << std::endl; -// selector->SetSelectionMode(theMode); -// } -// } -// } - -// LightApp_SelectionMgr* PatternDataSelectionModel::selectionMgr() -// { -// SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); -// if( anApp ) -// return dynamic_cast( anApp->selectionMgr() ); -// else -// return 0; -// } - // //CS_TEST // SUIT_DataOwnerPtrList aOList; // LightApp_DataOwner* anOwher = new LightApp_DataOwner( "0:1:1:1:2" ); @@ -1352,31 +934,31 @@ bool PatternDataSelectionModel::execute(ObjectList& objects) // _salomeSelectionMgr->setSelected( aOList, false ); // //CS_TEST -// void PatternDataSelectionModel::_highlightGEOM( const QModelIndex & anEltIndex ) +// void PatternDataSelectionModel::highlightGEOM( const QModelIndex & anEltIndex ) // { -// std::cout << "PatternDataSelectionModel::_highlightGEOM go find ASSOCIATION for"<< anEltIndex.data().toString().toStdString()<getViewWindow() +// // QList assocList; -// +// // DocumentModel *docModel = NULL; // const QSortFilterProxyModel *pModel = NULL; // // const QStandardItemModel *smodel // // const QAbstractItemModel *theModel = NULL; -// +// // pModel = dynamic_cast( model() ); -// +// // std::cout << "pModel "<< pModel << std::endl; // if ( pModel ){ // std::cout << "if ( pModel ){"<< std::endl; -// docModel = dynamic_cast( pModel->sourceModel() ); +// docModel = dynamic_cast( pModel->sourceModel() ); // if ( docModel ){ // std::cout << "if ( docModel ){"<< std::endl; // assocList = docModel->getAssociations( pModel->mapToSource(anEltIndex) ); // } // } -// -// +// +// // _PTR(Study) aStudy = GetActiveStudyDocument(); // _PTR(SObject) aSChild; // CORBA::Object_var aCorbaObj = CORBA::Object::_nil(); @@ -1390,25 +972,25 @@ bool PatternDataSelectionModel::execute(ObjectList& objects) // // double start; // // double end; // // }; -// +// // QVariant treeVariant = pModel->mapToSource(anEltIndex).data( HEXA_TREE_ROLE ); // int eltType; // if ( !treeVariant.isValid() ) return; // eltType = treeVariant.toInt(); -// +// // // GEOM::GeomObjPtr // // GEOM::GEOM_Object_ptr firstLine; //firstLine.nullify();// // GEOM::GEOM_Object_var firstLine = GEOM::GEOM_Object::_nil(); //GEOM::GeomObjPtr // GEOM::GEOM_Object_var lastLine = GEOM::GEOM_Object::_nil(); // double firstParameter = 0.2; //CS_TODO // double lastParameter = 0.4; //CS_TODO -// +// // foreach( const DocumentModel::GeomObj& anAssoc, assocList ){ // std::cout << "FOUND=> " << anAssoc.entry.toStdString() << std::endl; // aSChild = aStudy->FindObjectID( anAssoc.entry.toStdString() ); // aCorbaObj = corbaObj(aSChild); // assoc = GEOM::GEOM_Object::_narrow(aCorbaObj); -// +// // if ( !CORBA::is_nil(assoc) ){ // std::cout << "geom to highlight =>" << anAssoc.name.toStdString() << std::endl; // // objects.push_back(assoc._retn()); @@ -1437,7 +1019,7 @@ bool PatternDataSelectionModel::execute(ObjectList& objects) // GEOM::GEOM_IBasicOperations_var anOper = _geomEngine->GetIBasicOperations( getStudyId() ); // GEOM::GEOM_Object_var firstPoint = anOper->MakePointOnCurve( firstLine, firstParameter ); // GEOM::GEOM_Object_var lastPoint = anOper->MakePointOnCurve( lastLine, lastParameter ); -// +// // // std::cout << "firstPoint->_is_nil() =>" << firstPoint->_is_nil() << std::endl; // std::cout << "lastPoint->_is_nil() =>" << lastPoint->_is_nil() << std::endl; // if ( !( CORBA::is_nil(firstPoint) ) )// !firstPoint->_is_nil() ) @@ -1446,4 +1028,4 @@ bool PatternDataSelectionModel::execute(ObjectList& objects) // displayPreview( lastPoint._retn(), true ); // }*/ // } -// +// diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx index e2ee8b0..1604577 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_DocumentSelectionModel.hxx @@ -33,16 +33,55 @@ #include "MyGEOMBase_Helper.hxx" #include "klinkitemselectionmodel.hxx" -#include "HEXABLOCKGUI_DocumentModel.hxx" - class OCCViewer_ViewWindow; + namespace HEXABLOCK { namespace GUI { + class SelectionModel: public QItemSelectionModel + { + Q_OBJECT + + public: + + SelectionModel( QAbstractItemModel * model ); + virtual ~SelectionModel(); + + QModelIndex indexBy( int role, const QString& value ); + QModelIndex indexBy( int role, const QVariant& var ); + QModelIndex indexOf( const QString& anIOEntry, int role ); + QModelIndexList indexListOf( const QString& anEntry, int role ); + void setIgnoreSignal(bool state) { ignoreSignal = state; } + + virtual void geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) {} + virtual void vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ) {} + + bool salomeNothingSelected; + + protected slots: + + virtual void onCurrentChanged( const QModelIndex & current, + const QModelIndex & previous ) {} + + virtual void onSelectionChanged( const QItemSelection & selected, + const QItemSelection & deselected ) {} + + void salomeSelectionChanged(); // Salome to Qt + + protected: + QModelIndexList getSelectionFromModel(const Handle(SALOME_InteractiveObject)& anIObject); + QModelIndexList getSelectionAssociactions(const Handle(SALOME_InteractiveObject)& anIObject); + + bool ignoreSignal; +// bool _theModelSelectionChanged; +// bool _theVtkSelectionChanged; +// bool _theGeomSelectionChanged; + }; + class PatternBuilderSelectionModel: public KLinkItemSelectionModel { public: @@ -53,8 +92,7 @@ namespace HEXABLOCK } }; - class PatternDataSelectionModel : public QItemSelectionModel, - public MyGEOMBase_Helper + class PatternDataSelectionModel : public SelectionModel { Q_OBJECT @@ -62,57 +100,43 @@ namespace HEXABLOCK PatternDataSelectionModel( QAbstractItemModel * model ); virtual ~PatternDataSelectionModel(); - void setVertexSelection(); - void setEdgeSelection(); - void setQuadSelection(); - void setHexaSelection(); - void setAllSelection(); - void highlightVTKElts( const QModelIndexList& elts ); void highlightEltsWithAssocs(const QModelIndexList& elts); - void _highlightGEOM( const QMultiMap& entrySubIDs ); - void _highlightGEOM( const QModelIndex & index ); - - QModelIndex indexBy( int role, const QString& value ); - QModelIndex indexBy( int role, const QVariant& var ); - int getSelectionFilter() const { return _selectionFilter;} + QModelIndexList getGeomAssociations(const QModelIndex& dataIndex); //Salome - void setSalomeSelectionMgr( LightApp_SelectionMgr* mgr ); - void SetSelectionMode( Selection_Mode theMode ); - QModelIndex _geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ); - QModelIndex _vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ); - - - bool salomeNothingSelected; + virtual void geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ); + virtual void vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ); protected slots: - void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous ); - void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ); - void salomeSelectionChanged(); // Salome to Qt + virtual void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous ); + virtual void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ); - private: - SVTK_ViewWindow* _getVTKViewWindow(); - OCCViewer_ViewWindow* _getOCCViewWindow(); + }; - QModelIndex _indexOf( const QString& anIOEntry, int role ); - QModelIndexList _indexListOf( const QString& anEntry, int role ); - void _setVTKSelectionMode( const QModelIndex& eltIndex ); - void _selectVTK( const QModelIndex & index ); - SUIT_ViewWindow* initOccViewManager(); + class PatternGeomSelectionModel : public SelectionModel + { + Q_OBJECT + public: + PatternGeomSelectionModel( QAbstractItemModel * model ); + virtual ~PatternGeomSelectionModel(); - LightApp_SelectionMgr* _salomeSelectionMgr; - int _selectionFilter; + QModelIndex getModelIndex(const Handle(SALOME_InteractiveObject)& anIObject); +// void highlightEltsWithAssocs(const QModelIndexList& elts); +// +// //Salome +// virtual void geomSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ); +// virtual void vtkSelectionChanged( const Handle(SALOME_InteractiveObject)& anIObject ); - bool _theModelSelectionChanged; - bool _theVtkSelectionChanged; - bool _theGeomSelectionChanged; - }; + protected slots: + virtual void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous ); + virtual void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ); + }; - class GroupsSelectionModel : public QItemSelectionModel + class GroupsSelectionModel : public SelectionModel { Q_OBJECT @@ -120,22 +144,15 @@ namespace HEXABLOCK GroupsSelectionModel( QAbstractItemModel * model ); virtual ~GroupsSelectionModel(); - QModelIndex indexBy( int role, const QVariant& var ); - protected slots: -// void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous ); - void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ); - - private: - SVTK_ViewWindow* _getVTKViewWindow(); - void _highlightGroups( const QModelIndex& eltIndex ); +// virtual void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous ); + virtual void onSelectionChanged( const QItemSelection & selected, + const QItemSelection & deselected ); }; - - - class MeshSelectionModel : public QItemSelectionModel + class MeshSelectionModel : public SelectionModel { Q_OBJECT @@ -143,15 +160,10 @@ namespace HEXABLOCK MeshSelectionModel( QAbstractItemModel * model ); virtual ~MeshSelectionModel(); - QModelIndex indexBy( int role, const QVariant& var ); - protected slots: -// void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous ); - void onSelectionChanged( const QItemSelection & selected, const QItemSelection & deselected ); - - private: - SVTK_ViewWindow* _getVTKViewWindow(); - void _highlightPropagation( const QModelIndex& eltIndex ); +// virtual void onCurrentChanged( const QModelIndex & current, const QModelIndex & previous ); + virtual void onSelectionChanged( const QItemSelection & selected, + const QItemSelection & deselected ); }; diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_GraphicViewsHandler.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_GraphicViewsHandler.cxx new file mode 100644 index 0000000..400a842 --- /dev/null +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_GraphicViewsHandler.cxx @@ -0,0 +1,176 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +//Salome +#include +#include +#include +#include +#include + +//HexaBlock +#include "HEXABLOCKGUI_GraphicViewsHandler.hxx" +#include "utilities.h" + + + +using namespace HEXABLOCK::GUI; + + + +/*====================================================== createDocumentGraphicView + * Create a new document + * Returns the new document's window + *=============================================================================*/ +VtkDocumentGraphicView* GraphicViewsHandler::createDocumentGraphicView(DocumentModel* docModel, + SVTK_ViewWindow* wnd, QWidget* parent) +{ + +// if (wnd == NULL) return NULL; +// VtkDocumentGraphicView* dgview = getDocumentGraphicView(wnd); +// if (dgview != NULL) return dgview; +// +// docGraphicViews[wnd] = new VtkDocumentGraphicView(docModel, wnd, parent); +// return docGraphicViews[wnd]; + return new VtkDocumentGraphicView(docModel, wnd, parent); +} + +/*====================================================== getDocumentGraphicView + * Returns the document corresponding to a vtk window (view) + *=============================================================================*/ +VtkDocumentGraphicView* GraphicViewsHandler::getDocumentGraphicView(SVTK_ViewWindow* view) const +{ + if (view == NULL || !docGraphicViews.contains(view)) return NULL; + return docGraphicViews[view]; +} + +/*====================================================== getOrCreateVtkWindow +/// Returns the active vtk window if there's one, +/// create one and return it otherwise. + *=============================================================================*/ +SVTK_ViewWindow* GraphicViewsHandler::getOrCreateVtkWindow() const +{ + SalomeApp_Application* anApp = dynamic_cast(SUIT_Session::session()->activeApplication()); + if( anApp == NULL) return NULL; + SUIT_ViewManager* vmgr = anApp->getViewManager( SVTK_Viewer::Type(), true); + + return dynamic_cast(vmgr->getActiveView()); +} + + +/*====================================================== createVtkWindow +/// Create a vtk window and return it + *=============================================================================*/ +SVTK_ViewWindow* GraphicViewsHandler::createVtkWindow() const +{ + SalomeApp_Application* anApp = dynamic_cast(SUIT_Session::session()->activeApplication()); + if( anApp == NULL) return NULL; + + SUIT_ViewManager* vmgr = anApp->newViewManager (SVTK_Viewer::Type()); + SVTK_ViewWindow* view = dynamic_cast(vmgr->getActiveView()); + if (view == NULL) return NULL; + view->setWindowTitle(QObject::tr("HEXABLOCK") + " : " + view->windowTitle()); + + return view; +} + + +/*====================================================== getOrCreateOccWindow +/// Returns the active occ window if there's one, +/// create one and return it otherwise. + *=============================================================================*/ +OCCViewer_ViewWindow* GraphicViewsHandler::getOrCreateOccWindow() const +{ + SalomeApp_Application* anApp = dynamic_cast(SUIT_Session::session()->activeApplication()); + if( anApp == NULL) return NULL; + SUIT_ViewManager* vmgr = anApp->getViewManager(OCCViewer_Viewer::Type(), true); + + return dynamic_cast(vmgr->getActiveView()); +} + + +/*====================================================== createOccWindow +/// Create an open cascade window and return it + *=============================================================================*/ +OCCViewer_ViewWindow* GraphicViewsHandler::createOccWindow() const +{ + SalomeApp_Application* anApp = dynamic_cast(SUIT_Session::session()->activeApplication()); + if( anApp == NULL) return NULL; + + SUIT_ViewManager* vmgr = anApp->newViewManager (OCCViewer_Viewer::Type()); + OCCViewer_ViewWindow* view = dynamic_cast(vmgr->getActiveView()); + if (view == NULL) return NULL; + view->setWindowTitle(QObject::tr("HEXABLOCK") + " : " + view->windowTitle()); + + return view; +} + + +/*====================================================== createDocumentGraphicView + * Close a document graphic view + *=============================================================================*/ +void GraphicViewsHandler::closeDocumentGraphicView(SVTK_ViewWindow* window) +{ + VtkDocumentGraphicView* dgview = getDocumentGraphicView(window); + if (dgview == NULL) return; //There's nothing to do if the window has no document + + //remove the document + docGraphicViews.remove(window); + delete dgview; +} + +//void GraphicViewsHandler::onPatternDatachanged() +//{ +// INIT_REAC(V_patternDatachaged); +// OCCview->reacPatternDatachanged(); +// OUT_REAC(); +//} + +//VTKGraphicView* m_VTKview; +// +//void DocumentHandler::switchOnVTKGraphicView() +//{ +// verifieVTKView(); +// +// //connect signals +// connect( m_VTKview->getPatternDataSelectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &) ), +// this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); +// connect( m_VTKview->getPatternBuilderSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), +// this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); +// connect( m_VTKview->getGroupsSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), +// this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); +// connect( m_VTKview->getMeshSelectionModel(), SIGNAL( selectionChanged(const QItemSelection &, const QItemSelection &) ), +// this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); +// +// _showDialogBox(getDlgBox(view)); +// } +// +//DocumentHandler::onSelectionChanged(const QItemSelection &, const QItemSelection &) +//{ +// addMapConnect(++cptConnect;"onSelectionChanged"); +// if(onAction) {return;} +// onAction = true; +// +// ptHexaGUI->onSelectionChanged(const QItemSelection &, const QItemSelection &); +// m_VTKview->onSelectionChanged(const QItemSelection &, const QItemSelection &); +// +// onAction = false; +//} + + diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_GraphicViewsHandler.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_GraphicViewsHandler.hxx new file mode 100644 index 0000000..66c6125 --- /dev/null +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_GraphicViewsHandler.hxx @@ -0,0 +1,61 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef _HEXABLOCKGUI_VTKGRAPHICVIEWSHANDLER_HXX_ +#define _HEXABLOCKGUI_VTKGRAPHICVIEWSHANDLER_HXX_ + +//Salome Includes +#include +#include + +//Qt Includes +#include + +//HEXABLOCK Includes +#include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" + +namespace HEXABLOCK +{ + namespace GUI + { + + class GraphicViewsHandler + { + + public: + GraphicViewsHandler()/*: vtkViewManager(NULL)*/ {} + virtual ~GraphicViewsHandler() {} + VtkDocumentGraphicView* getDocumentGraphicView(SVTK_ViewWindow* view) const; + VtkDocumentGraphicView* createDocumentGraphicView(DocumentModel* docModel, SVTK_ViewWindow* wnd, QWidget* parent); + SVTK_ViewWindow* getOrCreateVtkWindow() const; + SVTK_ViewWindow* createVtkWindow() const; + OCCViewer_ViewWindow* getOrCreateOccWindow() const; + OCCViewer_ViewWindow* createOccWindow() const; + void closeDocumentGraphicView(SVTK_ViewWindow* window); + void setViewManager(SUIT_ViewManager* vmanager); + int getNbDocumentGViews() { return docGraphicViews.count();} + + protected: + QMap docGraphicViews; + }; + + } +} + +#endif diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx new file mode 100644 index 0000000..955b8c1 --- /dev/null +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.cxx @@ -0,0 +1,185 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + + + +#include "HEXABLOCKGUI_OccGraphicView.hxx" +#include "utilities.h" +#include "HEXABLOCKGUI.hxx" +#include "HEXABLOCKGUI_DocumentModel.hxx" +#include "GEOMBase.h" +#include "MyGEOMBase_Helper.hxx" +#include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" +#include "HexNewShape.hxx" +#include "HexVertexShape.hxx" +#include "HexEdgeShape.hxx" +#include "HexFaceShape.hxx" + +#include +#include + + + +using namespace HEXABLOCK::GUI; + +// ----------------------------------------------------------------------- +// OccGraphicView implementation +// ----------------------------------------------------------------------- + +OccGraphicView::OccGraphicView( OCCViewer_ViewWindow* view, QWidget* parent ): + viewWindow( view ), + selectionMode(TopAbs_SHAPE) +{ +} + +void OccGraphicView::setSelectionMode(TopAbs_ShapeEnum mode) +{ + if (HEXABLOCKGUI::selectionMgr() == NULL || + HEXABLOCKGUI::geomBaseHelper == NULL || viewWindow == NULL) return; + + HEXABLOCKGUI::selectionMgr()->clearSelected(); + HEXABLOCKGUI::geomBaseHelper->globalSelection(viewWindow); +// HEXABLOCKGUI::geomBaseHelper->localSelection(GEOM::GEOM_Object::_nil(), mode); + HEXABLOCKGUI::geomBaseHelper->localSelection(viewWindow, mode); + selectionMode = mode; + +} + +void OccGraphicView::setSelectionMode(const QModelIndex& eltIndex) +{ + + QVariant treeVariant = eltIndex.data( HEXA_TREE_ROLE ); + if ( !treeVariant.isValid() ) return; + int eltType = treeVariant.toInt(); + + switch ( eltType ){ + case VERTEX_TREE : setSelectionMode(TopAbs_VERTEX); break; + case VERTEX_DIR_TREE : setSelectionMode(TopAbs_VERTEX); break; + case EDGE_TREE : setSelectionMode(TopAbs_EDGE); break; + case EDGE_DIR_TREE : setSelectionMode(TopAbs_EDGE); break; + case QUAD_TREE : setSelectionMode(TopAbs_FACE); break; + case QUAD_DIR_TREE : setSelectionMode(TopAbs_FACE); break; + case HEXA_TREE : setSelectionMode(TopAbs_SHAPE); break; + case HEXA_DIR_TREE : setSelectionMode(TopAbs_SHAPE); break; + case GEOMSHAPE_TREE: setSelectionMode(TopAbs_SHAPE); break; + case GEOMSHAPE_DIR_TREE: setSelectionMode(TopAbs_SHAPE); break; + case GEOMPOINT_TREE: setSelectionMode(TopAbs_VERTEX); break; + case GEOMPOINT_DIR_TREE: setSelectionMode(TopAbs_VERTEX); break; + case GEOMEDGE_TREE: setSelectionMode(TopAbs_EDGE); break; + case GEOMEDGE_DIR_TREE: setSelectionMode(TopAbs_EDGE); break; + case GEOMFACE_TREE: setSelectionMode(TopAbs_FACE); break; + case GEOMFACE_DIR_TREE: setSelectionMode(TopAbs_FACE); break; + case PROPAGATION_TREE : setSelectionMode(TopAbs_EDGE); break; + case PROPAGATION_DIR_TREE : setSelectionMode(TopAbs_EDGE); break; + } +} + + +void OccGraphicView::clearSelection() +{ + if (HEXABLOCKGUI::selectionMgr() == NULL || viewWindow == NULL || + HEXABLOCKGUI::geomBaseHelper == NULL) + return; + + HEXABLOCKGUI::selectionMgr()->clearSelected(); + HEXABLOCKGUI::geomBaseHelper->globalSelection(viewWindow); + HEXABLOCKGUI::geomBaseHelper->localSelection(viewWindow, TopAbs_SHAPE); + selectionMode = TopAbs_SHAPE; +} + + +void OccGraphicView::highlight( const QModelIndex & index ) +{ + + // getting association(s) from model + QMultiMap< QString, int > assocEntrySubIDs; + + if (HEXABLOCKGUI::currentDocGView == NULL || viewWindow == NULL) return; + DocumentModel* docModel = HEXABLOCKGUI::currentDocGView->getDocumentModel(); + if (docModel == NULL) return; + + assocEntrySubIDs += docModel->getAssocShapesIds(index); + highlight( assocEntrySubIDs ); +} + + +void OccGraphicView::highlight( const QModelIndexList & indexList ) +{ + +// QModelIndex index; + QMultiMap< QString, int > assocEntrySubIDs; + + if (HEXABLOCKGUI::currentDocGView == NULL || viewWindow == NULL) return; + DocumentModel* docModel = HEXABLOCKGUI::currentDocGView->getDocumentModel(); + PatternDataModel* pModel = HEXABLOCKGUI::currentDocGView->getPatternDataModel(); + if (docModel == NULL || pModel == NULL) return; + + foreach( const QModelIndex& anEltIndex, indexList) + { +// index = pModel->mapToSource(anEltIndex); + assocEntrySubIDs += docModel->getAssocShapesIds(anEltIndex); + } + highlight( assocEntrySubIDs ); +} + +void OccGraphicView::highlight( const QMultiMap& entrySubIDs ) +{ + if ( viewWindow == NULL ) return; + + SOCC_Viewer* soccViewer = dynamic_cast( viewWindow->getViewManager()->getViewModel() ); + if (!soccViewer) return; + + DocumentModel* docModel = HEXABLOCKGUI::currentDocGView->getDocumentModel(); + _PTR(Study) aStudy = GetActiveStudyDocument(); + if (!aStudy || docModel == NULL) return; + + CORBA::Object_var aCorbaObj = CORBA::Object::_nil(); + GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_nil(); + HEXABLOCKGUI::geomBaseHelper->erasePreview(true); + + foreach ( QString shapeName, entrySubIDs.keys() ){ + QString shapeEntry = docModel->getGeomObjEntry(shapeName); + _PTR(SObject) aSChild = aStudy->FindObjectID( shapeEntry.toStdString() ); + aCorbaObj = corbaObj( aSChild ); + aGeomObj = GEOM::GEOM_Object::_narrow( aCorbaObj ); + if ( !CORBA::is_nil(aGeomObj) ){ + QString objIOR = GEOMBase::GetIORFromObject( aGeomObj._retn() ); + Handle(GEOM_AISShape) aSh = GEOMBase::ConvertIORinGEOMAISShape( objIOR );//, true ); + if ( !aSh.IsNull() ){ + TColStd_IndexedMapOfInteger anIndexes; + foreach ( int subid, entrySubIDs.values(shapeName) ){ + if ( subid != -1 ) + anIndexes.Add( subid ); + } + if ( anIndexes.Extent() > 0 ){ // if it's a sub-shape + aSh->highlightSubShapes( anIndexes, true ); + // soccViewer->Repaint(); + } else { // or a main shape + // std::cout << "aSh->getIO() => " << aSh->getIO() << std::endl; + // soccViewer->setColor( aSh->getIO(), QColor( Qt::red ), true ); + // soccViewer->switchRepresentation( aSh->getIO(), 2 ); + // globalSelection(); + soccViewer->highlight( aSh->getIO(), true, true ); // TODO: not working + } + } + } + } + soccViewer->Repaint(); + +} diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.hxx new file mode 100644 index 0000000..0db8c18 --- /dev/null +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_OccGraphicView.hxx @@ -0,0 +1,73 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + + + +#ifndef _HEXABLOCKGUI_OCCGRAPHICVIEW_HXX_ +#define _HEXABLOCKGUI_OCCGRAPHICVIEW_HXX_ + + +#include +#include "HEXABLOCKGUI_SalomeTools.hxx" + +#include +#include + + + + +namespace HEXABLOCK +{ + + namespace GUI + { + + /******************************************************************************** + * OccGraphicView + ********************************************************************************/ + + class OccGraphicView + { + + public: + OccGraphicView(OCCViewer_ViewWindow* view, QWidget* parent=NULL); + virtual ~OccGraphicView(){}; + + void highlight( const QModelIndex & index ); + void highlight( const QModelIndexList & indexList ); + void highlight( const QMultiMap& entrySubIDs ); + + void setViewWindow(OCCViewer_ViewWindow* view) { viewWindow = view; } + OCCViewer_ViewWindow* getViewWindow() const { return viewWindow; } + + void setSelectionMode(TopAbs_ShapeEnum mode); + void setSelectionMode(const QModelIndex& eltIndex); + TopAbs_ShapeEnum getSelectionMode() const { return selectionMode; } + void clearSelection(); + + private: + OCCViewer_ViewWindow* viewWindow; + TopAbs_ShapeEnum selectionMode; + + }; + } +} + + +#endif diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx index aef9246..206775b 100644 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_SalomeTools.cxx @@ -62,6 +62,7 @@ #include "HEXABLOCKGUI.hxx" #include "HEXABLOCKGUI_SalomeTools.hxx" +#include "HEXABLOCKGUI_OccGraphicView.hxx" @@ -338,7 +339,11 @@ SALOME_Prs* MyGEOM_Displayer::BuildPrs( GEOM::GEOM_Object_ptr theObj ) return 0; SALOME_View* view = NULL; - SUIT_ViewManager* vman = HEXABLOCKGUI::currentOccView->getViewManager(); + + SUIT_ViewManager* vman = NULL; + if (HEXABLOCKGUI::currentOccGView->getViewWindow() != NULL) + vman = HEXABLOCKGUI::currentOccGView->getViewWindow()->getViewManager(); + SUIT_ViewModel* vmodel = NULL; if ( vman ) vmodel = vman->getViewModel(); diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_Trace.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_Trace.cxx index c8b563e..ada0578 100755 --- a/src/HEXABLOCKGUI/HEXABLOCKGUI_Trace.cxx +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_Trace.cxx @@ -23,11 +23,13 @@ #include "HEXABLOCKGUI_Trace.hxx" + #ifdef WNT #include #define getpid _getpid -#else -#include +#else // Modification INCKA AD +#include +#include #include #endif diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx new file mode 100755 index 0000000..ee975d0 --- /dev/null +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.cxx @@ -0,0 +1,1205 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +//#define _DEVDEBUG_ + +#include + +#include + +#include + +#include "utilities.h" + +#include + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// VTK includes +#include +#include +#include +#include +#include +#include +// test tutorial (sphere) +#include +#include + +// test point (cf. SMESHGUI) +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "vtkLookupTable.h" +#include "vtkPoints.h" +#include "vtkCellArray.h" +#include "vtkFloatArray.h" +#include "vtkPolyData.h" +#include "vtkPolyDataMapper.h" +#include "vtkActor.h" +#include "vtkPointData.h" +#include "vtkProperty.h" + + +// #include "vtkStructuredGridReader.h" +#include "vtkUnstructuredGridReader.h" + +#include + + + + + +#ifndef M_PI +#define M_PI 3.1415927 +#endif + +#include "HEXABLOCKGUI_Trace.hxx" +#include "HEXABLOCKGUI_DocumentModel.hxx" +#include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" +#include "HEXABLOCKGUI.hxx" + + + +using namespace std; +using namespace HEXABLOCK::GUI; +using namespace HEXA_NS; + +Document_Actor::Document_Actor( Document* doc, const QString& entry ): + SALOME_Actor(), + _doc( doc ) +{ + DEBTRACE("Document_Actor::Document_Actor " << entry.toLatin1() ); + Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject( entry.toLatin1(), "HEXABLOCK" );//,theName); CS_TODO + setIO(anIO); + vtkUnstructuredGrid* aGrid = getUnstructuredGrid(); + // std::cout << "Document_Actor aGrid->GetNumberOfCells() =>"<< aGrid->GetNumberOfCells(); + vtkDataSetMapper* aMapper = vtkDataSetMapper::New(); + aMapper->SetInput(aGrid); + aGrid->Delete(); + + SetVisibility( true );//VisibilityOff(); + SetPickable( true ); //PickableOff();// + SetMapper( aMapper ); + aMapper->Delete(); + + vtkProperty* aProp = vtkProperty::New(); + + // aProp->SetRepresentationToSurface(); + aProp->SetRepresentationToWireframe(); + // aProp->SetRepresentationToPoints(); + aProp->EdgeVisibilityOn (); + aProp->SetPointSize(5); + SetProperty( aProp ); + aProp->Delete(); + // SetPointRepresentation(true); + +} + +Document_Actor::~Document_Actor() +{ + +} + + +vtkUnstructuredGrid* Document_Actor::getUnstructuredGrid() +{ + vtkUnstructuredGrid* theGrid = vtkUnstructuredGrid::New(); + + _doc->reorderFaces(); //CS_TEST + + map vtkNodeId; + map hexaNodeId; + + // Create points + vtkPoints* aPoints = vtkPoints::New(); + int nbVertex = _doc->countVertex(); + aPoints->SetNumberOfPoints( nbVertex ); + + Vertex* v = NULL; + int vertexId; + for ( int i=0; i getVertex(i); + aPoints->SetPoint( i, v->getX(), v->getY(), v->getZ() ); + vertexId = reinterpret_cast(v); //v->getId(); + vtkNodeId [ vertexId ] = i; + hexaNodeId[ i ] = vertexId ; + // vtkNodeId [ vertexId ] = i+1; + // hexaNodeId[ i+1 ] = vertexId ; + } + + theGrid->SetPoints( aPoints ); + aPoints->Delete(); + // theGrid->SetCells( 0, 0, 0, 0, 0 ); + + + // Calculate cells size + int nb0DElement = _doc->countVertex(); + int nbEdge = _doc->countEdge(); + int nbFace = _doc->countQuad(); + int nbVolume = _doc->countHexa(); + + vtkIdType aCellsSize = 2*nb0DElement + 3*nbEdge + ( 4 + 1 )*nbFace + ( 8 + 1 )*nbVolume; + vtkIdType aNbCells = nb0DElement + nbEdge + nbFace + nbVolume; + + // Create cells + vtkCellArray* aConnectivity = vtkCellArray::New(); + aConnectivity->Allocate( aCellsSize, 0 ); + + vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New(); + aCellTypesArray->SetNumberOfComponents( 1 ); + aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() ); + + vtkIdList *anIdList = vtkIdList::New(); + vtkIdType iVtkElem = 0; + // vtkIdType iVtkElem = 1; //CS_TEST + int iHexaElem; + + // VERTEX + for ( int i=0; iSetNumberOfIds( 1 ); + v = _doc->getVertex(i); + iHexaElem = reinterpret_cast(v);//v->getId(); + vtkElemsId[iHexaElem] = iVtkElem; + hexaElemsId[iVtkElem] = iHexaElem; + anIdList->SetId(0, vtkNodeId[iHexaElem]); + aConnectivity->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_VERTEX );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); + ++iVtkElem; + } + + // EDGE + Edge* e = NULL; + Vertex* vertexElem = NULL; + for ( int i=0; iSetNumberOfIds( 2 ); + e = _doc->getEdge(i); + iHexaElem = reinterpret_cast(e); //e->getId(); + vtkElemsId[iHexaElem] = iVtkElem; + hexaElemsId[iVtkElem] = iHexaElem; + + for( vtkIdType j = 0; j< 2; ++j ){ //j< e->countVertex(); ++j ){ + vertexElem = e->getVertex( j ); + anIdList->SetId( j, vtkNodeId[ reinterpret_cast(vertexElem) ] );//vertexElem->getId() ]); + } + aConnectivity->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_LINE );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); + ++iVtkElem; + } + + // QUAD + Quad* q = NULL; + for ( int i=0; iSetNumberOfIds( 4 ); + q = _doc->getQuad(i); + iHexaElem = reinterpret_cast(q); //q->getId(); + vtkElemsId[iHexaElem] = iVtkElem; + hexaElemsId[iVtkElem] = iHexaElem; + + for( vtkIdType j = 0; j< 4; ++j ){ + vertexElem = q->getVertex( j ); + anIdList->SetId( j, vtkNodeId[ reinterpret_cast(vertexElem) ] );//vertexElem->getId() ]); + } + aConnectivity->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_QUAD );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); + ++iVtkElem; + } + + // HEXA + Hexa* h = NULL; + std::map connectivity; + connectivity[0] = 0; + connectivity[1] = 1; + connectivity[2] = 3; + connectivity[3] = 2; + connectivity[4] = 4; + connectivity[5] = 5; + connectivity[6] = 7; + connectivity[7] = 6; + for ( int i=0; iSetNumberOfIds( 8 ); + h = _doc->getHexa(i); + iHexaElem = reinterpret_cast(h); //q->getId(); + vtkElemsId[iHexaElem] = iVtkElem; + hexaElemsId[iVtkElem] = iHexaElem; + + for( vtkIdType j = 0; j< 8; ++j ){ + vertexElem = h->getVertex( j );// ); + anIdList->SetId( connectivity[j], vtkNodeId[ reinterpret_cast(vertexElem) ]);//vertexElem->getId() ]); + } + aConnectivity->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_HEXAHEDRON ); + ++iVtkElem; + } + + + // 0 1 2 3 4 5 6 7 + // V_ACE, V_ACF, V_ADE, V_ADF, V_BCE, V_BCF, V_BDE, V_BDF, + // + // 0 1 3 2 4 5 7 6 + + // Insert cells in grid + VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); + aCellLocationsArray->SetNumberOfComponents( 1 ); + aCellLocationsArray->SetNumberOfTuples( aNbCells ); + // std::cout << "aNbCells =>" << aNbCells << std::endl; + + aConnectivity->InitTraversal(); + for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ){ + aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); + } + theGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity ); + + aCellLocationsArray->Delete(); + aCellTypesArray->Delete(); + aConnectivity->Delete(); + anIdList->Delete(); + //std::cout << "theGrid->GetNumberOfCells()" << theGrid->GetNumberOfCells() << std::endl; + + return theGrid; +} + +// =============================================================== Abu : debut +// ===================================================== Constructeur +Associate_Actor::Associate_Actor( Document* doc, const QString& entry) +: SALOME_Actor(), _doc( doc ) +{ + DEBTRACE("Associate_Actor::Associate_Actor " << entry.toLatin1() ); + Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject( entry.toLatin1(), "HEXABLOCK" );//,theName); CS_TODO + setIO(anIO); + vtkUnstructuredGrid* aGrid = getUnstructuredGrid(); + + vtkDataSetMapper* aMapper = vtkDataSetMapper::New(); + aMapper->SetInput(aGrid); + aGrid->Delete(); + + SetVisibility( true );//VisibilityOff(); + SetPickable( true ); //PickableOff();// + SetMapper( aMapper ); + aMapper->Delete(); + + vtkProperty* aProp = vtkProperty::New(); + aProp->SetColor(0,255,0); + // aProp->SetRepresentationToSurface(); + aProp->SetRepresentationToWireframe(); + // aProp->SetRepresentationToPoints(); + aProp->EdgeVisibilityOn (); + aProp->SetPointSize(5); + SetProperty( aProp ); + aProp->Delete(); + // SetPointRepresentation(true); +} +// ===================================================== getUnstructuredGrid + +vtkUnstructuredGrid* Associate_Actor::getUnstructuredGrid() +{ + vtkUnstructuredGrid* theGrid = vtkUnstructuredGrid::New(); + + _doc->reorderFaces(); //CS_TEST + + std::map vtkNodeId; + std::map hexaNodeId; + + // Create points + vtkPoints* aPoints = vtkPoints::New(); + int nbVertex = _doc->countVertex(); + aPoints->SetNumberOfPoints( nbVertex ); + + Vertex* v = NULL; + int vertexId; + for ( int i=0; i getVertex(i); + aPoints->SetPoint( i, v->getX()+6, v->getY()+6, v->getZ() ); + vertexId = reinterpret_cast(v); //v->getId(); + vtkNodeId [ vertexId ] = i; + hexaNodeId[ i ] = vertexId ; + // vtkNodeId [ vertexId ] = i+1; + // hexaNodeId[ i+1 ] = vertexId ; + } + + theGrid->SetPoints( aPoints ); + aPoints->Delete(); + // theGrid->SetCells( 0, 0, 0, 0, 0 ); + + + // Calculate cells size + int nb0DElement = _doc->countVertex(); + int nbEdge = _doc->countEdge(); + int nbFace = _doc->countQuad(); + int nbVolume = _doc->countHexa(); + + vtkIdType aCellsSize = 2*nb0DElement + 3*nbEdge + ( 4 + 1 )*nbFace + ( 8 + 1 )*nbVolume; + vtkIdType aNbCells = nb0DElement + nbEdge + nbFace + nbVolume; + + // Create cells + vtkCellArray* aConnectivity = vtkCellArray::New(); + aConnectivity->Allocate( aCellsSize, 0 ); + + vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New(); + aCellTypesArray->SetNumberOfComponents( 1 ); + aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() ); + + vtkIdList *anIdList = vtkIdList::New(); + vtkIdType iVtkElem = 0; + // vtkIdType iVtkElem = 1; //CS_TEST + int iHexaElem; + + // VERTEX + for ( int i=0; iSetNumberOfIds( 1 ); + v = _doc->getVertex(i); + iHexaElem = reinterpret_cast(v);//v->getId(); + vtkElemsId[iHexaElem] = iVtkElem; + hexaElemsId[iVtkElem] = iHexaElem; + anIdList->SetId(0, vtkNodeId[iHexaElem]); + aConnectivity->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_VERTEX );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); + ++iVtkElem; + } + + // EDGE + Edge* e = NULL; + Vertex* vertexElem = NULL; + for ( int i=0; iSetNumberOfIds( 2 ); + e = _doc->getEdge(i); + iHexaElem = reinterpret_cast(e); //e->getId(); + vtkElemsId[iHexaElem] = iVtkElem; + hexaElemsId[iVtkElem] = iHexaElem; + + for( vtkIdType j = 0; j< 2; ++j ){ //j< e->countVertex(); ++j ){ + vertexElem = e->getVertex( j ); + anIdList->SetId( j, vtkNodeId[ reinterpret_cast(vertexElem) ] );//vertexElem->getId() ]); + } + aConnectivity->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_LINE );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); + ++iVtkElem; + } + + // QUAD + Quad* q = NULL; + for ( int i=0; iSetNumberOfIds( 4 ); + q = _doc->getQuad(i); + iHexaElem = reinterpret_cast(q); //q->getId(); + vtkElemsId[iHexaElem] = iVtkElem; + hexaElemsId[iVtkElem] = iHexaElem; + + for( vtkIdType j = 0; j< 4; ++j ){ + vertexElem = q->getVertex( j ); + anIdList->SetId( j, vtkNodeId[ reinterpret_cast(vertexElem) ] );//vertexElem->getId() ]); + } + aConnectivity->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_QUAD );//getCellType( aType, anElem->IsPoly(), aNbNodes ) ); + ++iVtkElem; + } + + // HEXA + Hexa* h = NULL; + std::map connectivity; + connectivity[0] = 0; + connectivity[1] = 1; + connectivity[2] = 3; + connectivity[3] = 2; + connectivity[4] = 4; + connectivity[5] = 5; + connectivity[6] = 7; + connectivity[7] = 6; + for ( int i=0; iSetNumberOfIds( 8 ); + h = _doc->getHexa(i); + iHexaElem = reinterpret_cast(h); //q->getId(); + vtkElemsId[iHexaElem] = iVtkElem; + hexaElemsId[iVtkElem] = iHexaElem; + + for( vtkIdType j = 0; j< 8; ++j ){ + vertexElem = h->getVertex( j );// ); + anIdList->SetId( connectivity[j], vtkNodeId[ reinterpret_cast(vertexElem) ]);//vertexElem->getId() ]); + } + aConnectivity->InsertNextCell( anIdList ); + aCellTypesArray->InsertNextValue( VTK_HEXAHEDRON ); + ++iVtkElem; + } + + + // 0 1 2 3 4 5 6 7 + // V_ACE, V_ACF, V_ADE, V_ADF, V_BCE, V_BCF, V_BDE, V_BDF, + // + // 0 1 3 2 4 5 7 6 + + // Insert cells in grid + VTKViewer_CellLocationsArray* aCellLocationsArray = VTKViewer_CellLocationsArray::New(); + aCellLocationsArray->SetNumberOfComponents( 1 ); + aCellLocationsArray->SetNumberOfTuples( aNbCells ); + // std::cout << "aNbCells =>" << aNbCells << std::endl; + + aConnectivity->InitTraversal(); + for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ ){ + aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) ); + } + theGrid->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity ); + + aCellLocationsArray->Delete(); + aCellTypesArray->Delete(); + aConnectivity->Delete(); + anIdList->Delete(); + + return theGrid; +} + + +// ----------------------------------------------------------------------- +// VtkDocumentGraphicView implementation +// ----------------------------------------------------------------------- +VtkDocumentGraphicView::VtkDocumentGraphicView( DocumentModel* documentModel, + SVTK_ViewWindow* view, QWidget* parent ): + QAbstractItemView(parent), + viewWindow( view ), + documentActor( NULL ), + associateActor (NULL), // Abu + _currentChanged( false ), + firstUpdate(true), + selectionMode(-1) +{ + + //Model + setModel(documentModel); + patternDataModel = new PatternDataModel(parent); + patternBuilderModel = new PatternBuilderModel(parent); + patternGeomModel = new PatternGeomModel(parent); + groupsModel = new GroupsModel(parent); + meshModel = new MeshModel(parent); + patternDataModel->setSourceModel(documentModel); + patternBuilderModel->setSourceModel(documentModel); + patternGeomModel->setSourceModel(documentModel); + groupsModel->setSourceModel(documentModel); + meshModel->setSourceModel(documentModel); + + //Selection Model + patternDataSelectionModel = new PatternDataSelectionModel(patternDataModel); + patternBuilderSelectionModel = new PatternBuilderSelectionModel(patternBuilderModel, patternDataSelectionModel); + patternGeomSelectionModel = new PatternGeomSelectionModel(patternGeomModel); + groupsSelectionModel = new GroupsSelectionModel(groupsModel); + meshSelectionModel = new MeshSelectionModel(meshModel ); + setSelectionModel(patternDataSelectionModel); +} + +//Loads the graphic view document +void VtkDocumentGraphicView::loadDocument() +{ + DocumentModel* docModel = getDocumentModel(); + if (docModel == NULL) return; + + docModel->load(); +} + +//Loads the document from the file in this graphic view +void VtkDocumentGraphicView::loadDocument(const QString& file) +{ + if ( file.isEmpty() ) return; + getDocumentModel()->load(file); +} + +//Saves the graphic view's document in the file +void VtkDocumentGraphicView::saveDocument(const QString& file) +{ + if (file.isEmpty()) return; + getDocumentModel()->save(file); +} + + +VtkDocumentGraphicView::~VtkDocumentGraphicView() +{ + + //Delete Model + delete patternDataModel; + delete patternBuilderModel; + delete groupsModel; + delete meshModel; + + //Delete Selection Model/ Disconnect signals on delete (Qt) +// delete patternDataSelectionModel; +// delete patternBuilderSelectionModel; +// delete groupsSelectionModel; +// delete meshSelectionModel; +} + +void VtkDocumentGraphicView::setWindowTitle(const QString& title) +{ + viewWindow->setWindowTitle( QString("hexablock : ") + title ); +} + +void VtkDocumentGraphicView::onPatternDatachanged() +{ + update(); +} + +void VtkDocumentGraphicView::removeActor() +{ + if ( documentActor != NULL && viewWindow != NULL){ + viewWindow->RemoveActor( documentActor ); + documentActor->Delete(); + } +} + +void VtkDocumentGraphicView::update() +{ + + DocumentModel* theModel = dynamic_cast( model() ); + if (theModel == NULL || viewWindow == NULL) return; + + Document* theDocumentImpl = theModel->documentImpl(); + QString theDocumentEntry = theModel->documentEntry(); + + if ( documentActor ){ + viewWindow->RemoveActor( documentActor ); + documentActor->Delete(); + } + documentActor = new Document_Actor( theDocumentImpl, theDocumentEntry ); + viewWindow->AddActor( documentActor ); + + viewWindow->getRenderer()->Render(); + viewWindow->Repaint(); + if (firstUpdate) + { + viewWindow->onFitAll(); + firstUpdate = false; + } +} + +void VtkDocumentGraphicView::setVertexSelection() +{ + setSelectionMode(NodeSelection); +// // NodeSelection, +// // CellSelection, +// // EdgeOfCellSelection, +// // EdgeSelection, +// // FaceSelection, +// // VolumeSelection, +// // ActorSelection }; + selectionMode = VERTEX_TREE; +} + +void VtkDocumentGraphicView::setEdgeSelection() +{ + setSelectionMode(EdgeSelection); + selectionMode = EDGE_TREE; +} + +void VtkDocumentGraphicView::setQuadSelection() +{ + setSelectionMode(FaceSelection); + selectionMode = QUAD_TREE; +} + +void VtkDocumentGraphicView::setHexaSelection() +{ +// SetSelectionMode(VolumeSelection); + setSelectionMode(FaceSelection); //temporary for hexa selection debug + selectionMode = HEXA_TREE; +// aProp->FaceVisibilityOff (); //would debug hexa preselection, selection??? +} + +void VtkDocumentGraphicView::setAllSelection() +{ + setSelectionMode(ActorSelection); + selectionMode = -1; +} + +void VtkDocumentGraphicView::setSelectionMode(Selection_Mode theMode) +{ + + if ( viewWindow != NULL ) + { + viewWindow->SetSelectionMode( theMode ); + selectionMode = theMode; + } + +} + +void VtkDocumentGraphicView::setSelectionMode( const QModelIndex& eltIndex ) +{ + QVariant treeVariant = eltIndex.data( HEXA_TREE_ROLE ); + if ( !treeVariant.isValid() ) return; + int eltType = treeVariant.toInt(); + + if ( selectionMode == eltType ) return; + + switch ( eltType ){ + case VERTEX_TREE : + case GEOMPOINT_TREE: + case GEOMPOINT_DIR_TREE: + case VERTEX_DIR_TREE : setVertexSelection(); break; + case EDGE_TREE : + case GEOMEDGE_TREE: + case GEOMEDGE_DIR_TREE: + case EDGE_DIR_TREE : setEdgeSelection(); break; + case QUAD_TREE : + case GEOMFACE_TREE: + case GEOMFACE_DIR_TREE: + case QUAD_DIR_TREE : setQuadSelection(); break; + case HEXA_TREE : + case GEOMSHAPE_TREE: + case GEOMSHAPE_DIR_TREE: + case HEXA_DIR_TREE : setHexaSelection(); break; + case PROPAGATION_TREE : + case PROPAGATION_DIR_TREE : setEdgeSelection(); break; + default: setAllSelection(); +// CellSelection, +// EdgeOfCellSelection, +// VolumeSelection, +// ActorSelection + } +} + +void VtkDocumentGraphicView::clearSelection() +{ + if (viewWindow != NULL) + { +// viewWindow->unHighlightAll(); + setSelectionMode(ActorSelection); + } +} + +void VtkDocumentGraphicView::highlight( const QModelIndex& ielt ) +{ + + QModelIndexList indexList; + indexList << ielt; + highlight(indexList); + +} + +void VtkDocumentGraphicView::highlight( const QModelIndexList& elts ) +{ + + if (elts.size() == 0 || viewWindow == NULL || documentActor == NULL) return; + SVTK_Selector* selector = viewWindow->GetSelector(); + if ( selector == NULL ) return; +// // Set selection mode in VTK view +// viewWindow->SetSelectionMode(VolumeSelection); + + // --- elements highlight --- + TColStd_MapOfInteger aMap; + int vtkElemsId; + QString eltEntry; + + foreach( const QModelIndex& iElt, elts ){ + if (iElt.isValid()) + { + eltEntry = iElt.data( HEXA_ENTRY_ROLE ).toString(); + vtkElemsId = documentActor->vtkElemsId[ eltEntry.toInt() ]; + if ( vtkElemsId > 0 ) aMap.Add( vtkElemsId ); + } + } + selector->AddOrRemoveIndex( documentActor->getIO(), aMap, false ); //true + viewWindow->highlight( documentActor->getIO(), true, true ); + documentActor->highlight( false ); //unhighlight de la bounding box rouge + +} + + +void VtkDocumentGraphicView::highlightGroups( const QModelIndex& eltIndex ) +{ + if ( groupsModel == NULL || viewWindow == NULL || documentActor == NULL) return; + SVTK_Selector* selector = viewWindow->GetSelector(); + if ( selector == NULL ) return; + + QVariant treeVariant = eltIndex.data( HEXA_TREE_ROLE ); + if ( !treeVariant.isValid()) + //INFOS("data from model not valid"); + return; + + int eltType = treeVariant.toInt(); + if ( eltType != GROUP_TREE ) + //INFOS("bad element type : not a group item" << eltType ); + return; + + //Get elements to highlight + DocumentModel::Group kind; + QModelIndexList iElements = groupsModel->getGroupElements( eltIndex, kind ); + if (iElements.count() == 0) return; + + // ---------- elements highlight -------------- + + // Set selection mode in VTK view + switch (kind){ + case HexaCell: case HexaNode: viewWindow->SetSelectionMode(VolumeSelection); break; + case QuadCell: case QuadNode: viewWindow->SetSelectionMode(FaceSelection); break; + case EdgeCell: case EdgeNode: viewWindow->SetSelectionMode(EdgeSelection); break; + case VertexNode: viewWindow->SetSelectionMode(NodeSelection); break; + } + + TColStd_MapOfInteger aMap; + int vtkElemsId; + QString eltEntry; + + foreach( const QModelIndex& iElt, iElements ){ + if (iElt.isValid()) + { + eltEntry = iElt.data( HEXA_ENTRY_ROLE ).toString(); + vtkElemsId = documentActor->vtkElemsId[ eltEntry.toInt() ]; + if ( vtkElemsId > 0 ) aMap.Add( vtkElemsId ); + } + } + + selector->AddOrRemoveIndex( documentActor->getIO(), aMap, false ); + viewWindow->highlight( documentActor->getIO(), true, true ); + documentActor->highlight( false ); + +} + + +void VtkDocumentGraphicView::highlightPropagation( const QModelIndex& eltIndex ) +{ + if ( meshModel == NULL || viewWindow == NULL || documentActor == NULL) return; + SVTK_Selector* selector = viewWindow->GetSelector(); + if ( selector == NULL ) return; + + QVariant treeVariant = eltIndex.data( HEXA_TREE_ROLE ); + if ( !treeVariant.isValid()) + //INFOS("data from model not valid"); + return; + + int eltType = treeVariant.toInt(); + if ( eltType != PROPAGATION_TREE ) + //INFOS("bad element type : not a group item" << eltType ); + return; + + // Get elements to highlight + QModelIndexList iEdges = meshModel->getPropagation( eltIndex ); + if (iEdges.count() == 0) return; + + // ---------- elements highlight -------------- + + // Set selection mode in VTK view + viewWindow->SetSelectionMode(EdgeSelection); + + TColStd_MapOfInteger aMap; + int vtkElemsId; + QString edgeEntry; + + foreach( const QModelIndex& iEdge, iEdges ){ + if (iEdge.isValid()) + { + edgeEntry = iEdge.data( HEXA_ENTRY_ROLE ).toString(); + vtkElemsId = documentActor->vtkElemsId[ edgeEntry.toInt() ]; + if ( vtkElemsId > 0 ) aMap.Add( vtkElemsId ); + } + } + + selector->AddOrRemoveIndex( documentActor->getIO(), aMap, false ); + viewWindow->highlight( documentActor->getIO(), true, true ); + documentActor->highlight( false ); + +} + + + + +/******************************************************************************** + * ABSTRACT METHOD ( MUST BE IMPLEMENTED ) + ********************************************************************************/ + +/* + Returns the item that covers the coordinate given in the view. + */ + +QModelIndex VtkDocumentGraphicView::indexAt(const QPoint &point) const +{ + return QModelIndex(); +} + +void VtkDocumentGraphicView::scrollTo(const QModelIndex &index, ScrollHint) +{ +} + + +/* + Returns the position of the item in viewport coordinates. + */ +QRect VtkDocumentGraphicView::visualRect(const QModelIndex &index) const +{ + return QRect(); +} + +// PROTECTED : +int VtkDocumentGraphicView::horizontalOffset() const +{ + return horizontalScrollBar()->value(); +} + +bool VtkDocumentGraphicView::isIndexHidden(const QModelIndex &index) const +{ + return false; +} + +QModelIndex VtkDocumentGraphicView::moveCursor(QAbstractItemView::CursorAction cursorAction, + Qt::KeyboardModifiers /*modifiers*/) +{ + QModelIndex current = currentIndex(); + return current; +} + +/* + Find the indices corresponding to the extent of the selection. + */ +void VtkDocumentGraphicView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) +{ +} + + +int VtkDocumentGraphicView::verticalOffset() const +{ + return verticalScrollBar()->value(); +} + +/* + Returns a region corresponding to the selection in viewport coordinates. + */ +QRegion VtkDocumentGraphicView::visualRegionForSelection(const QItemSelection &selection) const +{ + return QRegion(); +} + + + + +/******************************************************************************** + * PROTECTED SLOTS + ********************************************************************************/ +void VtkDocumentGraphicView::closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint ) +{ +} + +void VtkDocumentGraphicView::commitData ( QWidget * editor ) +{ +} + +void VtkDocumentGraphicView::currentChanged( const QModelIndex & current, const QModelIndex & previous ) +{ + // openPersistentEditor( current ); + _currentChanged = true; +} + +void VtkDocumentGraphicView::dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) +{ + update(); + _currentChanged = false; + // updateObject(topLeft); +} + +void VtkDocumentGraphicView::editorDestroyed ( QObject * editor ) +{ +} + +void VtkDocumentGraphicView::rowsAboutToBeRemoved ( const QModelIndex & parent, int start, int end ) +{ +} + +void VtkDocumentGraphicView::rowsInserted ( const QModelIndex & parent, int start, int end ) +{ +} + +void VtkDocumentGraphicView::selectionChanged( const QItemSelection & selected, const QItemSelection & deselected ) +{ +} + +void VtkDocumentGraphicView::updateGeometries () +{ +} + +// bool DocumentGraphicView::canBeDisplayed( const QString& entry, const QString& viewer_type ) const //CS_TODO +// { +// bool result = false; +// +// result = (viewer_type==SVTK_Viewer::Type()); +// // QStringList es = entry.split( "_" );22 +// // bool result = ( es.count() == 3 && es[ 0 ] == "ATOMSOLVGUI" && viewer_type == SVTK_Viewer::Type() ); +// // // printf ( " canBeDisplayed : entry = %s, count = %d, res = %d \n", entry.latin1(), es.count(), result ); +// std::cout << "canBeDisplayed => "<< result << std::endl; +// return result; // entry of an atom for sure +// } + +// SALOME_Prs* HEXABLOCKGUI_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame) +// { +// SALOME_Prs* prs = 0; +// +// SALOME_View* aViewFrame = theViewFrame ? theViewFrame : GetActiveView(); +// +// if ( aViewFrame ) +// { +// SVTK_Viewer* vtk_viewer = dynamic_cast( aViewFrame ); +// if (vtk_viewer) +// { +// SUIT_ViewWindow* wnd = vtk_viewer->getViewManager()->getActiveView(); +// SALOME_Actor* anActor = myGraphicView->FindActorByEntry( wnd, entry.toLatin1().data() ); +// if (!anActor) +// { +// // anActor = myGraphicView->CreateActor( study()->studyDS(), entry.toLatin1().data(), true ); +// anActor = myGraphicView->CreateActor(entry.toLatin1().data()); +// } +// if (anActor) +// { +// // Display actor : +// SVTK_ViewWindow* vtkWnd = dynamic_cast (wnd); +// if (vtkWnd != NULL) +// { +// vtkWnd->AddActor(anActor); +// vtkWnd->Repaint(); +// prs = LightApp_Displayer::buildPresentation(entry.toLatin1().data(), aViewFrame); +// } +// } +// if (prs) +// { +// UpdatePrs(prs); +// } +// else if (anActor) +// { +// //SMESH::RemoveActor( vtk_viewer->getViewManager()->getActiveView(), anActor ); +// std::cout << "Remove Actor" << std::endl; +// } +// } +// } +// +// return prs; +// } + +// SALOME_Prs* SMESHGUI_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame ) +// { +// SALOME_Prs* prs = 0; +// +// SALOME_View* aViewFrame = theViewFrame ? theViewFrame : GetActiveView(); +// +// if ( aViewFrame ) +// { +// SVTK_Viewer* vtk_viewer = dynamic_cast( aViewFrame ); +// if( vtk_viewer ) +// { +// SUIT_ViewWindow* wnd = vtk_viewer->getViewManager()->getActiveView(); +// SMESH_Actor* anActor = SMESH::FindActorByEntry( wnd, entry.toLatin1().data() ); +// if( !anActor ) +// anActor = SMESH::CreateActor( study()->studyDS(), entry.toLatin1().data(), true ); +// if( anActor ) +// { +// SMESH::DisplayActor( wnd, anActor ); +// prs = LightApp_Displayer::buildPresentation( entry.toLatin1().data(), aViewFrame ); +// } +// if( prs ) +// UpdatePrs( prs ); +// else if( anActor ) +// SMESH::RemoveActor( vtk_viewer->getViewManager()->getActiveView(), anActor ); +// } +// } +// +// return prs; +// } + +// +// void DocumentGraphicView::RemoveActor(SUIT_ViewWindow *theWnd, SALOME_Actor* theActor) +// { +// std::cout << "RemoveActor() : 1" << std::endl; +// SVTK_ViewWindow* myViewWindow = dynamic_cast(theWnd); +// // SVTK_ViewWindow* myViewWindow = dynamic_cast(_suitView); +// if (myViewWindow != NULL) +// { +// myViewWindow->RemoveActor(theActor); +// if(theActor->hasIO()) +// { +// std::cout << "RemoveActor() : 2" << std::endl; +// Handle(SALOME_InteractiveObject) anIO = theActor->getIO(); +// if(anIO->hasEntry()) +// { +// std::cout << "RemoveActor() : 3" << std::endl; +// std::string anEntry = anIO->getEntry(); +// SalomeApp_Study* aStudy = dynamic_cast( myViewWindow->getViewManager()->study() ); +// int aStudyId = aStudy->id(); +// // TVisualObjCont::key_type aKey(aStudyId,anEntry); +// // VISUAL_OBJ_CONT.erase(aKey); +// } +// } +// theActor->Delete(); +// myViewWindow->Repaint(); +// std::cout << "RemoveActor() : 4" << std::endl; +// } +// } + +// bool DocumentGraphicView::eventFilter(QObject *obj, QEvent *event) +// { +// std::cout << event->type() << std::endl; +// // if ( event->type() == QEvent::FocusIn ){ //QEvent::KeyPress) { +// // return false; +// // } else { +// // // standard event processing +// // // return QObject::eventFilter(obj, event); +// +// if ( event->type() == QEvent::Paint ) { //QEvent::FocusIn ){ +// std::cout << "PAINTTTTTTTTTT"<< std::endl; +// // loadVTK( "/tmp/load.vtk"); //CS_TEST +// } +// return _suitView->event(event); +// // } +// } +// +// + +//show the actor when show=true and hide it when show=false +//void VtkDocumentGraphicView::showActor(bool show) +//{ +// SVTK_ViewWindow* theVTKViewWindow = dynamic_cast(_suitView); +// if (theVTKViewWindow == NULL || _documentActor == NULL) +// return; +// +// if (show) +// { +// _documentActor->SetVisibility(1); +// theVTKViewWindow->onFitAll(); +// } +// else +// { +// _documentActor->SetVisibility(0); +// theVTKViewWindow->onResetView (); +// } +//} + +void VtkDocumentGraphicView::setModel ( QAbstractItemModel * model ) +{ + QAbstractItemView::setModel( model ); + + // PatternDataModel* pdm = dynamic_cast(model); + // if (pdm){ + // connect( pdm, SIGNAL(patternDataChanged() ), this, SLOT ( onPatternDatachanged() ) ); + // } + + DocumentModel* dm = dynamic_cast(model); + if (dm){ + // setWindowTitle( dm->getName() ); + connect( dm, SIGNAL(patternDataChanged() ), this, SLOT ( onPatternDatachanged() ) ); + // connect( dm, SIGNAL( nameChanged(const QString&) ), this, SLOT ( setWindowTitle(const QString&) ) ); + } +} + +// void DocumentGraphicView::loadVTK( const QString& path ) //CS_TEST +// { +// std::cout << "DocumentGraphicView::loadVTK=>"<(_suitView); +// +// // vtkStructuredGridReader +// vtkUnstructuredGridReader* r = vtkUnstructuredGridReader::New(); +// // r->SetFileName( path.toLocal8Bit().constData() ); +// r->SetInputString( vtkData.toLocal8Bit().constData() ); +// r->SetReadFromInputString( true ); +// r->Update(); +// +// vtkUnstructuredGrid* myGrid = r->GetOutput();//vtkUnstructuredGrid::New(); +// std::cout << "GetNumberOfCells =>"<< myGrid->GetNumberOfCells(); +// // Create and display actor +// +// vtkDataSetMapper* myMapper = vtkDataSetMapper::New(); +// myMapper->SetInput(myGrid); +// +// // if ( myPreviewActor ){ +// // myVTKViewWindow->RemoveActor(myPreviewActor); +// // myPreviewActor->Delete(); +// // } +// +// SALOME_Actor* myPreviewActor = SALOME_Actor::New(); +// myPreviewActor = SALOME_Actor::New(); +// Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(QString::number( reinterpret_cast(_hexaDocument) ),"HEXABLOCK");//,theName); +// myPreviewActor->setIO(anIO); +// +// // myPreviewActor->PickableOff(); +// myPreviewActor->SetVisibility( true );//VisibilityOff(); +// myPreviewActor->SetPickable( true ); +// myPreviewActor->SetMapper(myMapper); +// +// vtkProperty* aProp = vtkProperty::New(); +// // aProp->SetRepresentationToWireframe(); +// aProp->SetRepresentationToSurface(); +// aProp->EdgeVisibilityOn (); +// +// // aProp->SetColor(10, 10, 250); +// aProp->SetPointSize(5); +// myPreviewActor->SetProperty(aProp); +// aProp->Delete(); +// +// /*vtkProperty* myBackProp = vtkProperty::New(); +// GetColor( "SMESH", "backface_color", aBackRGB[0], aBackRGB[1], aBackRGB[2], QColor( 0, 0, 255 ) ); +// myBackProp->SetColor( aBackRGB[0], aBackRGB[1], aBackRGB[2] ); +// myPreviewActor->SetBackfaceProperty( myBackProp ); +// myBackProp->Delete()*/; +// myVTKViewWindow->AddActor(myPreviewActor); +// myVTKViewWindow->getRenderer()->Render(); +// myVTKViewWindow->Repaint(); +// myVTKViewWindow->onFitAll(); +// +// myVTKViewWindow->SetSelectionMode( ActorSelection ); +// // myVTKViewWindow->SetSelectionMode( NodeSelection ); +// // myVTKViewWindow->SetSelectionMode( EdgeSelection ); +// // myVTKViewWindow->SetSelectionMode( FaceSelection ); +// } + +// void DocumentGraphicView::rowsInserted ( const QModelIndex & parent, int start, int end ) +// { +// +// // std::cout << "DocumentGraphicView::rowsInserted : " << parent.data().toString().toStdString() << std::endl; +// QModelIndex newRow; +// +// SVTK_ViewWindow* myViewWindow = dynamic_cast(_suitView); +// SUIT_ViewManager* vman = myViewWindow->getViewManager(); +// SUIT_ViewModel* vmodel = vman->getViewModel(); +// +// for ( int i = start; i<= end; ++i ){ +// newRow = parent.child(i,0); +// // std::cout << "newRow.data().toString() =>" << newRow.data().toString().toStdString() << std::endl; +// QString entry = newRow.data(HEXA_ENTRY_ROLE).toString();//.toStdString(); +// Display(entry, true, dynamic_cast(vmodel)); +// UpdateViewer(); +// +// // addObject(newRow); +// } +// } diff --git a/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.hxx b/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.hxx new file mode 100755 index 0000000..f19a130 --- /dev/null +++ b/src/HEXABLOCKGUI/HEXABLOCKGUI_VtkDocumentGraphicView.hxx @@ -0,0 +1,239 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef _HEXABLOCKGUI_VTKDOCUMENTGRAPHICVIEW_HXX_ +#define _HEXABLOCKGUI_VTKDOCUMENTGRAPHICVIEW_HXX_ + +// SALOME GUI includes +#include +// #include +#include +#include +#include +#include +#include + +// #include +// #include +// #include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "HEXABLOCKGUI_DocumentModel.hxx" +#include "HEXABLOCKGUI_DocumentSelectionModel.hxx" + +// class LightApp_Displayer; +// class SalomeApp_Application; +class LightApp_Application; +class SALOME_Actor; + +// class vtkLookupTable ; +// class vtkPoints ; +// class vtkCellArray ; +// class vtkFloatArray ; +// class vtkActor ; +// class vtkPolyData; + + +class vtkUnstructuredGrid; + + + +namespace HEXABLOCK +{ + + namespace GUI + { +// class hexablockInteractorStyle : public SVTK_InteractorStyle +// { +// public: +// hexablockInteractorStyle() {}; +// virtual ~hexablockInteractorStyle() {}; +// +// public: +// static hexablockInteractorStyle* New() +// { +// return new hexablockInteractorStyle; +// }; +// virtual void HighlightActor2D(vtkActor2D* actor2D) {MESSAGE("% HIGHLIGHT PROP 2D %");} +// virtual void HighlightProp(vtkProp* prop) {MESSAGE("% HIGHLIGHT PROP %");} +// virtual void HighlightProp3D(vtkProp3D* prop3D) {MESSAGE("% HIGHLIGHT PROP 3D %");} +// }; + + class Document_Actor : public SALOME_Actor + { + public: + Document_Actor(HEXA_NS::Document* doc, const QString& entry); + virtual ~Document_Actor(); + + std::map vtkElemsId; + std::map hexaElemsId; + + vtkUnstructuredGrid* getUnstructuredGrid(); + private: + HEXA_NS::Document* _doc; + }; + + // Abu + class Associate_Actor : public SALOME_Actor + { + public: + Associate_Actor(HEXA_NS::Document* doc, const QString& entry); + virtual ~Associate_Actor() {} + + std::map vtkElemsId; + std::map hexaElemsId; + + vtkUnstructuredGrid* getUnstructuredGrid(); + private: + HEXA_NS::Document* _doc; + }; + + + /******************************************************************************** + * VtkDocumentGraphicView + ********************************************************************************/ + class VtkDocumentGraphicView : public QAbstractItemView + { + Q_OBJECT + + public: + VtkDocumentGraphicView(DocumentModel* docModel, SVTK_ViewWindow* view, QWidget* parent=NULL); + virtual ~VtkDocumentGraphicView(); + + void setModel ( QAbstractItemModel * model ); + bool isEmpty() const { return getDocumentModel()->isEmpty(); } + void highlight( const QModelIndex& ielt ); + void highlight( const QModelIndexList& elts ); + void highlightGroups( const QModelIndex& eltIndex ); + void highlightPropagation( const QModelIndex& eltIndex ); + + void setSelectionMode( const Selection_Mode theMode ); + void setSelectionMode( const QModelIndex& eltIndex ); + int getSelectionMode() const { return selectionMode;} + void clearSelection(); + + void loadDocument(const QString& file); //Loads a selected document + void loadDocument(); //Loads the current document + void saveDocument(const QString& file); + void update();//mise à jours de la vue : reconstruction complète + void removeActor(); + + QModelIndex indexAt(const QPoint &point) const; + void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible); + QRect visualRect(const QModelIndex &index) const; + + SVTK_ViewWindow* getViewWindow() const { return viewWindow; } + void setViewWindow(SVTK_ViewWindow* view) { viewWindow = view; } + Document_Actor* getDocumentActor() const { return documentActor; } + + DocumentModel* getDocumentModel() const { + return dynamic_cast(model()); + } + PatternDataSelectionModel* getPatternDataSelectionModel() const + { return patternDataSelectionModel; } + + PatternBuilderSelectionModel* getPatternBuilderSelectionModel() const + { return patternBuilderSelectionModel; } + + PatternGeomSelectionModel* getPatternGeomSelectionModel() const + { return patternGeomSelectionModel;} + + GroupsSelectionModel* getGroupsSelectionModel() const + { return groupsSelectionModel; } + + MeshSelectionModel* getMeshSelectionModel() const + { return meshSelectionModel; } + + PatternDataModel* getPatternDataModel() const {return patternDataModel;} + PatternBuilderModel* getPatternBuilderModel() const {return patternBuilderModel;} + PatternGeomModel* getPatternGeomModel() const { return patternGeomModel;} + GroupsModel* getGroupsModel() const {return groupsModel;} + MeshModel* getMeshModel() const {return meshModel;} + + public slots: + void setWindowTitle(const QString& title); + void onPatternDatachanged(); + void setVertexSelection(); + void setEdgeSelection(); + void setQuadSelection(); + void setHexaSelection(); + void setAllSelection(); + + protected slots: + virtual void closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint ); + virtual void commitData ( QWidget * editor ); + virtual void currentChanged ( const QModelIndex & current, const QModelIndex & previous ); + virtual void dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ); + virtual void editorDestroyed ( QObject * editor ); + virtual void rowsAboutToBeRemoved ( const QModelIndex & parent, int start, int end ); + virtual void rowsInserted ( const QModelIndex & parent, int start, int end ); + virtual void selectionChanged ( const QItemSelection & selected, const QItemSelection & deselected ); + virtual void updateGeometries (); + + protected: + int horizontalOffset() const; + bool isIndexHidden(const QModelIndex &index) const; + QModelIndex moveCursor(QAbstractItemView::CursorAction cursorAction, + Qt::KeyboardModifiers modifiers); + void setSelection(const QRect&, QItemSelectionModel::SelectionFlags command); + int verticalOffset() const; + QRegion visualRegionForSelection(const QItemSelection &selection) const; + +// protected: +// virtual SALOME_Prs* buildPresentation( const QString&, SALOME_View* = 0 ); + + private: + SVTK_ViewWindow* viewWindow; + int selectionMode; + bool state; + + Document_Actor* documentActor; + Associate_Actor* associateActor; + + PatternDataSelectionModel* patternDataSelectionModel; + PatternBuilderSelectionModel* patternBuilderSelectionModel; + PatternGeomSelectionModel* patternGeomSelectionModel; + GroupsSelectionModel* groupsSelectionModel; + MeshSelectionModel* meshSelectionModel; + + PatternDataModel* patternDataModel; + PatternBuilderModel* patternBuilderModel; + PatternGeomModel* patternGeomModel; + GroupsModel* groupsModel; + MeshModel* meshModel; + + bool _currentChanged; + bool firstUpdate; + }; + } +} + + + + +#endif diff --git a/src/HEXABLOCKGUI/Hexa_QTD.ui b/src/HEXABLOCKGUI/Hexa_QTD.ui index 5b1e818..50da541 100755 --- a/src/HEXABLOCKGUI/Hexa_QTD.ui +++ b/src/HEXABLOCKGUI/Hexa_QTD.ui @@ -20,44 +20,6 @@ Hexahedron Construction - - - - - 0 - 0 - - - - Result Name - - - - - - Name - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - @@ -114,6 +76,41 @@ Arguments + + + + + 0 + 0 + + + + + + + Name + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + + + diff --git a/src/HEXABLOCKGUI/JoinQuad_QTD.ui b/src/HEXABLOCKGUI/JoinQuad_QTD.ui index da20b11..172d694 100644 --- a/src/HEXABLOCKGUI/JoinQuad_QTD.ui +++ b/src/HEXABLOCKGUI/JoinQuad_QTD.ui @@ -6,8 +6,8 @@ 0 0 - 259 - 543 + 226 + 257 @@ -15,231 +15,256 @@ - - - - 0 - 0 - + + + true - - From - - - - - - - 0 - 0 - - - - Quadrangle(s) - - - - - - - - - - - - - 0 - 0 - - - - - - - Point a - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - Point b - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - - - - - - - - 0 - 0 - - - - To - - - - - - Quadrangle - - - - - - - - 0 - 0 - - - - false - - - - - - - Point a - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - Point b - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - - - - - 0 - 0 - - - - Grid - - - - - - - 0 - 0 - - - - size - - - - - - - - 0 - 0 - - - - 1000000 - - - 1 - - - - + + + + 0 + 0 + 212 + 427 + + + + + + + + 0 + 0 + + + + From + + + + + + + 0 + 0 + + + + Quadrangle(s) + + + + + + + + + + + + + 0 + 0 + + + + + + + Point a + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + Point b + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + + + + + + + + 0 + 0 + + + + To + + + + + + Quadrangle + + + + + + + + 0 + 0 + + + + false + + + + + + + Point a + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + Point b + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + + + + + 0 + 0 + + + + Grid + + + + + + + 0 + 0 + + + + size + + + + + + + + 0 + 0 + + + + 1 + + + 1000000 + + + 1 + + + + + + + + groupBox_3 + groupBox_8 + groupBox + diff --git a/src/HEXABLOCKGUI/Law_QTD.ui b/src/HEXABLOCKGUI/Law_QTD.ui index 1f9dbd1..31f39cf 100644 --- a/src/HEXABLOCKGUI/Law_QTD.ui +++ b/src/HEXABLOCKGUI/Law_QTD.ui @@ -70,9 +70,15 @@ + + 0 + 1000000 + + 0 + @@ -90,6 +96,9 @@ 1000000000.000000000000000 + + 1.000000000000000 + diff --git a/src/HEXABLOCKGUI/MakeCylinder_QTD.ui b/src/HEXABLOCKGUI/MakeCylinder_QTD.ui index d940909..22f7ef1 100644 --- a/src/HEXABLOCKGUI/MakeCylinder_QTD.ui +++ b/src/HEXABLOCKGUI/MakeCylinder_QTD.ui @@ -105,6 +105,9 @@ + + 1 + 1000000 @@ -122,6 +125,9 @@ + + 1 + 1000000 @@ -139,6 +145,9 @@ + + 1 + 1000000 diff --git a/src/HEXABLOCKGUI/MakeGrid_QTD.ui b/src/HEXABLOCKGUI/MakeGrid_QTD.ui index 2f0aec6..c47df53 100644 --- a/src/HEXABLOCKGUI/MakeGrid_QTD.ui +++ b/src/HEXABLOCKGUI/MakeGrid_QTD.ui @@ -6,19 +6,19 @@ 0 0 - 276 - 1083 + 226 + 266 - + 0 0 - 276 + 0 0 @@ -66,8 +66,8 @@ 0 0 - 254 - 1061 + 189 + 1057 @@ -747,15 +747,15 @@ - - + + - base + axis - - + + 16777215 @@ -770,15 +770,8 @@ - - - - vector - - - - - + + 16777215 @@ -793,6 +786,13 @@ + + + + base + + + @@ -858,9 +858,15 @@ 6 + + 0.000000000000000 + 1000000000.000000000000000 + + 1.000000000000000 + @@ -910,6 +916,9 @@ 1000000000.000000000000000 + + 1.000000000000000 + @@ -945,8 +954,8 @@ vex_le_rb0 vec_le_rb0 center_le_rb1 - base_le_rb1 height_le_rb1 + base_le_rb1 vex_le_rb2 nx_spb_rb0 ny_spb_rb0 diff --git a/src/HEXABLOCKGUI/MakeHemiSphere_QTD.ui b/src/HEXABLOCKGUI/MakeHemiSphere_QTD.ui index 99a2e2a..aa12507 100644 --- a/src/HEXABLOCKGUI/MakeHemiSphere_QTD.ui +++ b/src/HEXABLOCKGUI/MakeHemiSphere_QTD.ui @@ -6,19 +6,19 @@ 0 0 - 288 - 742 + 291 + 704 - + 0 0 - 285 + 0 0 @@ -39,49 +39,11 @@ 0 0 - 266 - 720 + 269 + 682 - - - - - 0 - 0 - - - - Result Name - - - - - - Name - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - @@ -145,7 +107,7 @@ 1000000000.000000000000000 - 1.000000000000000 + 2.000000000000000 @@ -419,6 +381,9 @@ 0 + + 1 + 1000000 @@ -442,6 +407,9 @@ 0 + + 1 + 1000000 @@ -465,6 +433,9 @@ 0 + + 1 + 1000000 @@ -487,16 +458,15 @@ scrollArea - name_le sphere_center_le - hole_axis_le - cross_pt_le - cross_vec_le - radial_vec_le sphere_radext_spb sphere_radint_spb sphere_rind_cb + hole_axis_le hole_rad_spb + cross_pt_le + cross_vec_le + radial_vec_le radial_angle_spb radial_partial_cb ngrid_rad_spb diff --git a/src/HEXABLOCKGUI/MakePipe_QTD.ui b/src/HEXABLOCKGUI/MakePipe_QTD.ui index ae4834c..92c30d7 100644 --- a/src/HEXABLOCKGUI/MakePipe_QTD.ui +++ b/src/HEXABLOCKGUI/MakePipe_QTD.ui @@ -99,6 +99,9 @@ 0 + + 1 + 1000000 @@ -122,6 +125,9 @@ 0 + + 1 + 1000000 @@ -145,6 +151,9 @@ 0 + + 1 + 1000000 diff --git a/src/HEXABLOCKGUI/Makefile.am b/src/HEXABLOCKGUI/Makefile.am index 4fe6038..a494818 100755 --- a/src/HEXABLOCKGUI/Makefile.am +++ b/src/HEXABLOCKGUI/Makefile.am @@ -40,8 +40,12 @@ dist_libHEXABLOCK_la_SOURCES = \ HEXABLOCKGUI_Trace.cxx \ HEXABLOCKGUI_Resource.hxx \ HEXABLOCKGUI_Resource.cxx \ - HEXABLOCKGUI_DocumentGraphicView.hxx \ - HEXABLOCKGUI_DocumentGraphicView.cxx \ + HEXABLOCKGUI_VtkDocumentGraphicView.hxx \ + HEXABLOCKGUI_VtkDocumentGraphicView.cxx \ + HEXABLOCKGUI_OccGraphicView.hxx \ + HEXABLOCKGUI_OccGraphicView.cxx \ + HEXABLOCKGUI_GraphicViewsHandler.hxx \ + HEXABLOCKGUI_GraphicViewsHandler.cxx \ HEXABLOCKGUI_DocumentModel.hxx \ HEXABLOCKGUI_DocumentModel.cxx \ HEXABLOCKGUI_DocumentSelectionModel.hxx \ @@ -97,13 +101,15 @@ UIC_FILES = \ ui_QuadRevolution_QTD.h \ ui_MakeRind_QTD.h \ ui_ReplaceHexa_QTD.h \ - ui_MakeHemiSphere_QTD.h + ui_MakeHemiSphere_QTD.h\ + ui_ModelInfo_QTD.h\ + ui_AddShapeDialog_QTD.h # MOC pre-processing MOC_FILES = \ HEXABLOCKGUI_moc.cxx \ - HEXABLOCKGUI_DocumentGraphicView_moc.cxx \ + HEXABLOCKGUI_VtkDocumentGraphicView_moc.cxx \ HEXABLOCKGUI_DocumentPanel_moc.cxx \ HEXABLOCKGUI_DocumentDelegate_moc.cxx \ HEXABLOCKGUI_DocumentSelectionModel_moc.cxx \ @@ -160,9 +166,11 @@ BUILT_SOURCES = $(UIC_FILES) # resources files ICONS = \ + resources/LightApp.xml \ resources/SalomeApp.xml \ resources/HEXABLOCKCatalog.xml \ resources/ModuleHexablock.png \ + resources/ModuleHexablock15x15.png\ resources/new_document.png \ resources/load_document.png \ resources/save_document.png \ diff --git a/src/HEXABLOCKGUI/Merge_QTD.ui b/src/HEXABLOCKGUI/Merge_QTD.ui index 45adfed..e8adf7e 100644 --- a/src/HEXABLOCKGUI/Merge_QTD.ui +++ b/src/HEXABLOCKGUI/Merge_QTD.ui @@ -7,11 +7,11 @@ 0 0 254 - 524 + 736 - + 0 0 @@ -24,327 +24,429 @@ QLayout::SetMinimumSize - + - + 0 0 - - Merge + + true - - - - - - 0 - 0 - - - - Vertex - - - true - - - - - - - - 0 - 0 - - - - Edge - - - - - - - Quad - - - - - - - - - - Arguments - - - - - - - - - vertex 1 - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - vertex 2 - - - - - - - - 16777215 - 16777215 - - - - false - - - - - - - - - - - - - edge 1 - - - - - - - - 16777215 - 16777215 - - - - false - - - - - - - edge 2 - - - - - - - - 16777215 - 16777215 - - - - false - - - - - - - vertex 1 - - - - - - - - 16777215 - 16777215 - - - - false - - - - - - - vertex 2 - - - - - - - - 16777215 - 16777215 - - - - false - - - - - - - - - - - - - quad 1 - - - - - - - - 16777215 - 16777215 - - - - false - - - - - - - quad 2 - - - - - - - - 16777215 - 16777215 - - - - false - - - - - - - vertex 1 - - - - - - - - 16777215 - 16777215 - - - - false - - - - - - - vertex 2 - - - - - - - - 16777215 - 16777215 - - - - false - - - - - - - vertex 3 - - - - - - - - 16777215 - 16777215 - - - - false - - - - - - - vertex 4 - - - - - - - - 16777215 - 16777215 - - - - false - - - - - - - + + + + 0 + -8 + 217 + 728 + + + + + + + + 0 + 0 + + + + Merge + + + + + + + 0 + 0 + + + + Vertex + + + true + + + + + + + + 0 + 0 + + + + Edge + + + + + + + Quad + + + + + + + + + + Arguments + + + + + + + + + From + + + + + + vertex 1 + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + + + + To + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + vertex 2 + + + + + + + + 16777215 + 16777215 + + + + false + + + + + + + + + + + + + + + + From + + + + + + edge 1 + + + + + + + + 16777215 + 16777215 + + + + false + + + + + + + vertex 1 + + + + + + + + 16777215 + 16777215 + + + + false + + + + + label_3 + v0_le_rb1 + e0_le_rb1 + label + + + + + + To + + + + + + edge 2 + + + + + + + + 16777215 + 16777215 + + + + false + + + + + + + vertex 2 + + + + + + + + 16777215 + 16777215 + + + + false + + + + + + + + + + + + + + + + From + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + quad 1 + + + + + + + + 16777215 + 16777215 + + + + false + + + + + + + vertex 1a + + + + + + + + 16777215 + 16777215 + + + + false + + + + + + + vertex 1b + + + + + + + + 16777215 + 16777215 + + + + false + + + + + + + + + + To + + + + + + quad 2 + + + + + + + + 16777215 + 16777215 + + + + false + + + + + + + vertex 2a + + + + + + + + 16777215 + 16777215 + + + + false + + + + + + + vertex 2b + + + + + + + + 16777215 + 16777215 + + + + false + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + @@ -356,14 +458,14 @@ v0_le_rb0 v1_le_rb0 e0_le_rb1 - e1_le_rb1 v0_le_rb1 + e1_le_rb1 v1_le_rb1 q0_le_rb2 - q1_le_rb2 v0_le_rb2 - v1_le_rb2 v2_le_rb2 + q1_le_rb2 + v1_le_rb2 v3_le_rb2 diff --git a/src/HEXABLOCKGUI/ModelInfo_QTD.ui b/src/HEXABLOCKGUI/ModelInfo_QTD.ui new file mode 100644 index 0000000..c00628b --- /dev/null +++ b/src/HEXABLOCKGUI/ModelInfo_QTD.ui @@ -0,0 +1,346 @@ + + + ModelInfoDialog + + + + 0 + 0 + 231 + 239 + + + + + 0 + 0 + + + + + 16777215 + 240 + + + + Dialog + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + 0 + + + + + + + Name: + + + + + + + + + + Qt::AlignCenter + + + true + + + + + + + + + + + + Elements: + + + + + + + 0D (Vertex): + + + + + + + Total + + + + + + + Used + + + + + + + Unused + + + + + + + 1D (Edge): + + + + + + + 2D (Quad): + + + + + + + 3D (Hexa): + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + 37 + 0 + + + + Qt::AlignCenter + + + true + + + + + + + + + + + + + + + 10 + + + 10 + + + true + + + true + + + true + + + diff --git a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx index 9c0042e..cb99ce6 100644 --- a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx +++ b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.cxx @@ -60,6 +60,7 @@ #include "HEXABLOCKGUI_DocumentItem.hxx" #include "HEXABLOCKGUI_SalomeTools.hxx" #include "HEXABLOCKGUI.hxx" +#include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" #define PARAM_VALUE 0 #define COORD_VALUE 1 @@ -94,18 +95,12 @@ MyBasicGUI_PointDlg::MyBasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* p myBusy (false), _documentModel(0), _patternDataSelectionModel(0), - _mgr(0), - _vtkVm(0), - _occVm(0), _currentObj(0), _selectionMutex(false) { QWidget* w = centralWidget(); QString objectName = w->objectName(); QString className = w->metaObject()->className(); - MESSAGE("* centralWidget() " << w ); - MESSAGE("* centralWidget()->objectName() is "<< objectName.toStdString() ); //toStdString() - MESSAGE("* centralWidget()->metaObject()->className() is "<< className.toStdString() ); ; SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT"))); @@ -238,7 +233,7 @@ MyBasicGUI_PointDlg::MyBasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* p /* HEXABLOCK */ _initInputWidget(); - _initViewManager(); +// _initViewManager(); /* HEXABLOCK */ } @@ -257,8 +252,6 @@ MyBasicGUI_PointDlg::~MyBasicGUI_PointDlg() //================================================================================= void MyBasicGUI_PointDlg::Init() { - MESSAGE("MyBasicGUI_PointDlg::Init() "); - GroupOnCurve->LineEdit1->setReadOnly(true); GroupOnCurve->LineEdit2->setReadOnly(true); GroupOnSurface->LineEdit1->setReadOnly(true); @@ -306,7 +299,6 @@ void MyBasicGUI_PointDlg::Init() initSpinBox(GroupOnSurface->SpinBox_DY, 0., 1., step, "parametric_precision"); GroupOnSurface->SpinBox_DY->setValue(0.5); - MESSAGE("MyBasicGUI_PointDlg::Init() : myGeomGUI " << myGeomGUI); /* signals and slots connections */ if ( myGeomGUI ){ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); @@ -314,6 +306,7 @@ void MyBasicGUI_PointDlg::Init() } //connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(buttonHelp(), SIGNAL(clicked()), this, SLOT(onHelpRequested()) ); // connect( closeButton, SIGNAL(clicked()), this, SLOT(close()) ); connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int))); @@ -338,6 +331,15 @@ void MyBasicGUI_PointDlg::Init() connect(GroupRefPoint->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupRefPoint->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect( mainFrame()->RadioButton1, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( mainFrame()->RadioButton2, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( mainFrame()->RadioButton3, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( mainFrame()->RadioButton4, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( mainFrame()->RadioButton5, SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( myParamCoord->button(PARAM_VALUE), SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( myParamCoord->button(LENGTH_VALUE), SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + connect( myParamCoord->button(COORD_VALUE), SIGNAL(clicked()), this, SLOT(updateHelpFileName()) ); + if ( myGeomGUI ){ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); @@ -350,6 +352,65 @@ void MyBasicGUI_PointDlg::Init() ConstructorsClicked(0); } +//================================================================================= +// function : onHelpRequested() +// purpose : show help in web browser +//================================================================================= +void MyBasicGUI_PointDlg::onHelpRequested() +{ + LightApp_Application* app = (LightApp_Application*)( SUIT_Session::session()->activeApplication() ); + if ( app ) + // app->onHelpContextModule( myGeometryGUI ? app->moduleName( myGeometryGUI->moduleName() ) : QString( "" ), _helpFileName ); + app->onHelpContextModule( "HEXABLOCK", myHelpFileName ); + + else { + QString platform; +#ifdef WIN32 + platform = "winapplication"; +#else + platform = "application"; +#endif + + SUIT_MessageBox::warning( 0, QObject::tr( "WRN_WARNING" ), + QObject::tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", platform ) ).arg( myHelpFileName ), + QObject::tr( "BUT_OK" ) ); + } +} + +//=============================================================== +// function : updateHelpFileName() +// purpose : update the help file according to the current panel +//=============================================================== +void MyBasicGUI_PointDlg::updateHelpFileName() +{ + if ( sender() == mainFrame()->RadioButton1 ){ + setHelpFileName("gui_asso_quad_to_geom.html#associate-to-a-vertex-of-the-geometry"); + } else if ( sender() == mainFrame()->RadioButton2 ){ + setHelpFileName("gui_asso_vertex_to_geom.html#by-a-reference"); + } else if ( sender() == mainFrame()->RadioButton3 ){ + setHelpFileName("gui_asso_vertex_to_geom.html#by-an-edge-and-a-parameter"); + } else if ( sender() == mainFrame()->RadioButton4 ){ + setHelpFileName("gui_asso_vertex_to_geom.html#by-intersection-of-two-lines-or-wires"); + } else if ( sender() == mainFrame()->RadioButton5 ){ + setHelpFileName("gui_asso_vertex_to_geom.html#by-a-face-and-two-parameters"); + } else if (sender() == myParamCoord->button(PARAM_VALUE)){ + if (mainFrame()->RadioButton3->isChecked()){ + setHelpFileName("gui_asso_vertex_to_geom.html#by-an-edge-and-a-parameter"); + } else if (mainFrame()->RadioButton5->isChecked()){ + setHelpFileName("gui_asso_vertex_to_geom.html#by-a-face-and-two-parameters"); + } + } else if (sender() == myParamCoord->button(LENGTH_VALUE)){ + setHelpFileName("gui_asso_vertex_to_geom.html#by-an-edge-and-a-length"); + } else if (sender() == myParamCoord->button(COORD_VALUE)){ + if (mainFrame()->RadioButton3->isChecked()){ + setHelpFileName("gui_asso_vertex_to_geom.html#by-an-edge-and-coordinates"); + } else if (mainFrame()->RadioButton5->isChecked()){ + setHelpFileName("gui_asso_vertex_to_geom.html#by-a-face-and-coordinates"); + } + } +} + //================================================================================= // function : SetDoubleSpinBoxStep() // purpose : Double spin box management @@ -374,13 +435,12 @@ void MyBasicGUI_PointDlg::ConstructorsClicked(int constructorId) { // HEXABLOCKGUI::currentOccView->raise(); // HEXABLOCKGUI::currentOccView->setFocus(); - MESSAGE("MyBasicGUI_PointDlg::ConstructorsClicked("<< constructorId << ")"); switch (constructorId) { case GEOM_POINT_XYZ: { - globalSelection(); // close local contexts, if any + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any myNeedType = TopAbs_VERTEX; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType); GroupRefPoint->hide(); GroupOnCurve->hide(); @@ -393,9 +453,9 @@ void MyBasicGUI_PointDlg::ConstructorsClicked(int constructorId) } case GEOM_POINT_REF: { - globalSelection(); // close local contexts, if any + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any myNeedType = TopAbs_VERTEX; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType); myEditCurrentArgument = GroupRefPoint->LineEdit1; //myEditCurrentArgument->setText(""); @@ -412,9 +472,9 @@ void MyBasicGUI_PointDlg::ConstructorsClicked(int constructorId) } case GEOM_POINT_EDGE: { - globalSelection(); // close local contexts, if any + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any myNeedType = TopAbs_EDGE; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType); myEditCurrentArgument = GroupOnCurve->LineEdit1; // myEditCurrentArgument->setText(""); @@ -434,9 +494,9 @@ void MyBasicGUI_PointDlg::ConstructorsClicked(int constructorId) } case GEOM_POINT_INTINT: { - globalSelection(); // close local contexts, if any + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any myNeedType = TopAbs_EDGE; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType); myEditCurrentArgument = GroupLineIntersection->LineEdit1; // GroupLineIntersection->LineEdit1->setText(""); @@ -458,9 +518,9 @@ void MyBasicGUI_PointDlg::ConstructorsClicked(int constructorId) } case GEOM_POINT_SURF: { - globalSelection(); // close local contexts, if any + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any myNeedType = TopAbs_FACE; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType); myEditCurrentArgument = GroupOnSurface->LineEdit1; //myEditCurrentArgument->setText(""); @@ -512,8 +572,8 @@ bool MyBasicGUI_PointDlg::ClickOnApply() // ConstructorsClicked(getConstructorId()); //Set selection mode to the last selected mode - globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType); return true; } @@ -525,8 +585,6 @@ bool MyBasicGUI_PointDlg::ClickOnApply() //================================================================================= void MyBasicGUI_PointDlg::SelectionIntoArgument() { - MESSAGE("MyBasicGUI_PointDlg::SelectionIntoArgument() myGeomGUI : "<< myGeomGUI); - GEOM::GeomObjPtr aSelectedObject = getSelected(myNeedType); TopoDS_Shape aShape; if (!aSelectedObject || !GEOMBase::GetShape(aSelectedObject.get(), aShape) || aShape.IsNull()) @@ -626,15 +684,15 @@ void MyBasicGUI_PointDlg::SetEditCurrentArgument() if (send == GroupRefPoint->PushButton1) { GroupRefPoint->LineEdit1->setFocus(); myEditCurrentArgument = GroupRefPoint->LineEdit1; - globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), TopAbs_VERTEX); } else if (send == GroupOnCurve->PushButton1) { GroupOnCurve->LineEdit1->setFocus(); myEditCurrentArgument = GroupOnCurve->LineEdit1; - globalSelection(); // close local contexts, if any + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any myNeedType = TopAbs_EDGE; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType); GroupOnCurve->PushButton2->setDown(false); GroupOnCurve->LineEdit1->setEnabled(true); GroupOnCurve->LineEdit2->setEnabled(false); @@ -642,9 +700,9 @@ void MyBasicGUI_PointDlg::SetEditCurrentArgument() else if (send == GroupOnCurve->PushButton2) { GroupOnCurve->LineEdit2->setFocus(); myEditCurrentArgument = GroupOnCurve->LineEdit2; - globalSelection(); // close local contexts, if any + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any myNeedType = TopAbs_VERTEX; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType); GroupOnCurve->PushButton1->setDown(false); GroupOnCurve->LineEdit2->setEnabled(true); GroupOnCurve->LineEdit1->setEnabled(false); @@ -653,8 +711,8 @@ void MyBasicGUI_PointDlg::SetEditCurrentArgument() { GroupOnSurface->LineEdit1->setFocus(); myEditCurrentArgument = GroupOnSurface->LineEdit1; - globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), TopAbs_FACE); } else if (send == GroupLineIntersection->PushButton1) { GroupLineIntersection->LineEdit1->setFocus(); @@ -684,7 +742,6 @@ void MyBasicGUI_PointDlg::SetEditCurrentArgument() //================================================================================= void MyBasicGUI_PointDlg::enterEvent(QEvent*) { - MESSAGE( "MyBasicGUI_PointDlg::enterEvent() "); if (!mainFrame()->GroupConstructors->isEnabled()) ActivateThisDialog(); } @@ -696,7 +753,6 @@ void MyBasicGUI_PointDlg::enterEvent(QEvent*) //================================================================================= void MyBasicGUI_PointDlg::ActivateThisDialog() { - MESSAGE( "MyBasicGUI_PointDlg::ActivateThisDialog() "); MyGEOMBase_Skeleton::ActivateThisDialog(); if ( myGeomGUI ){ @@ -713,7 +769,6 @@ void MyBasicGUI_PointDlg::ActivateThisDialog() //================================================================================= void MyBasicGUI_PointDlg::DeactivateActiveDialog() { - MESSAGE( "MyBasicGUI_PointDlg::DeactivateActiveDialog() "); // myGeomGUI->SetState(-1); MyGEOMBase_Skeleton::DeactivateActiveDialog(); } @@ -1055,9 +1110,9 @@ void MyBasicGUI_PointDlg::updateParamCoord(bool theIsUpdate) //================================================================================= void MyBasicGUI_PointDlg::onBtnPopup(QAction* a) { - globalSelection(); // close local contexts, if any + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); // close local contexts, if any myNeedType = myActions[a] == SelectEdge ? TopAbs_EDGE : TopAbs_WIRE; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), myNeedType); } //================================================================================= @@ -1130,21 +1185,26 @@ void MyBasicGUI_PointDlg::_initInputWidget() mainFrame()->_vertex_le->setValidator( validator ); } +void MyBasicGUI_PointDlg::clear() +{ + + mainFrame()->_vertex_le->clear(); + mainFrame()->_vertex_le->setProperty("QModelIndex", QVariant()); +} + void MyBasicGUI_PointDlg::_initViewManager() { - SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); - _mgr = dynamic_cast( anApp->selectionMgr() ); - _vtkVm = anApp->getViewManager( SVTK_Viewer::Type(), true ); - _occVm = anApp->getViewManager( OCCViewer_Viewer::Type(), true ); - SUIT_ViewManager* activeVm = anApp->activeViewManager(); - onWindowActivated ( activeVm ); +// SalomeApp_Application* anApp = dynamic_cast( SUIT_Session::session()->activeApplication() ); +// _mgr = dynamic_cast( anApp->selectionMgr() ); +// _vtkVm = anApp->getViewManager( SVTK_Viewer::Type(), false ); +// _occVm = anApp->getViewManager( OCCViewer_Viewer::Type(), false ); +// SUIT_ViewManager* activeVm = anApp->activeViewManager(); +// onWindowActivated ( activeVm ); } // bool MyBasicGUI_PointDlg::_onSelectionChanged( const QItemSelection& sel, QLineEdit* le ) // { -// MESSAGE("HexaBaseDialog::_onSelectionChanged(const QItemSelection& sel, QLineEdit* le)"); -// MESSAGE("* le is "<< le->objectName().toStdString() ); // QModelIndexList l = sel.indexes(); // if ( l.count() == 0 ) return false; // @@ -1159,7 +1219,6 @@ void MyBasicGUI_PointDlg::_initViewManager() // // // check selection compatibility between selection and widget // if ( selType != wType ){ -// MESSAGE("* bad selection : " << selType << " is not " << wType ); // SUIT_MessageBox::information( 0, // tr("HEXA_INFO"), // tr("Bad selection type: please select a %1").arg( _strHexaWidgetType[wType]) ); @@ -1169,7 +1228,6 @@ void MyBasicGUI_PointDlg::_initViewManager() // //fill the lineEdit if selection is OK // le->setText( selected.data().toString() );// name // le->setProperty("QModelIndex", QVariant::fromValue(selected) ); -// MESSAGE("}"); // return true; // } @@ -1177,19 +1235,8 @@ void MyBasicGUI_PointDlg::_initViewManager() void MyBasicGUI_PointDlg::onSelectionChanged( const QItemSelection& sel, const QItemSelection& unsel ) { - MESSAGE( "HexaBaseDialog::onSelectionChanged(){" ); QString className = metaObject()->className(); - MESSAGE( "* I am : " << className.toStdString() ); - MESSAGE( "* sender is : " << sender() ); - QItemSelectionModel* selector = dynamic_cast(sender()); - MESSAGE( "* selector : " << selector); - - foreach( const QModelIndex& isel, sel.indexes() ){ - MESSAGE("* selected : " << isel.data().toString().toStdString()); - } - foreach( const QModelIndex& iunsel, unsel.indexes() ){ - MESSAGE("* unselected : " << iunsel.data().toString().toStdString()); - } +// QItemSelectionModel* selector = dynamic_cast(sender()); if (_patternDataSelectionModel) _patternDataSelectionModel->highlightEltsWithAssocs(sel.indexes()); @@ -1211,27 +1258,23 @@ void MyBasicGUI_PointDlg::onSelectionChanged( const QItemSelection& sel, const Q selOk = true; } else { _patternDataSelectionModel->clearSelection(); - MESSAGE("* bad selection : " << selType << " is not " << HEXABLOCK::GUI::VERTEX_TREE ); SUIT_MessageBox::information( 0, tr("HEXA_INFO"), tr("Bad selection type: please select a %1").arg( "VERTEX" ) ); } } - MESSAGE("}"); } void MyBasicGUI_PointDlg::onWindowActivated(SUIT_ViewManager* vm) { - MESSAGE( "getConstructorId()"<< getConstructorId() ); - SUIT_ViewWindow* v = vm->getActiveView(); +// SUIT_ViewWindow* v = vm->getActiveView(); QString vmType = vm->getType(); if ( (vmType == SVTK_Viewer::Type()) || (vmType == VTKViewer_Viewer::Type()) ){ mainFrame()->_vertex_le->setFocus(); } else if ( vmType == OCCViewer_Viewer::Type() ){ // lines_lw->setFocus(); // ConstructorsClicked(0); - MESSAGE( "getConstructorId()"<< getConstructorId() ); ConstructorsClicked( getConstructorId() ); } } @@ -1282,14 +1325,12 @@ bool MyBasicGUI_PointDlg::eventFilter(QObject *obj, QEvent *event) } // _highlightWidget(obj, Qt::yellow); - MESSAGE("MyBasicGUI_PointDlg::eventFilter{"); - QVariant vxVariant; QModelIndex vxIndex; _currentObj = obj; // HEXABLOCKGUI::currentVtkView->raise(); - _patternDataSelectionModel->setVertexSelection(); + HEXABLOCKGUI::currentDocGView->setVertexSelection(); vxVariant = mainFrame()->_vertex_le->property("QModelIndex"); if ( !vxVariant.isValid() ) { @@ -1297,53 +1338,82 @@ bool MyBasicGUI_PointDlg::eventFilter(QObject *obj, QEvent *event) } vxIndex = vxVariant.value(); _selectionMutex = true; - MESSAGE("* selecting the element : " << vxIndex.data().toString().toStdString()); - MESSAGE("* _patternDataSelectionModel : " << _patternDataSelectionModel ); _patternDataSelectionModel->select( vxIndex, QItemSelectionModel::Clear ); _patternDataSelectionModel->select( vxIndex, QItemSelectionModel::Select ); _selectionMutex = false; - MESSAGE("}"); return false; } void MyBasicGUI_PointDlg::hideEvent ( QHideEvent * event ) { - MESSAGE("MyBasicGUI_PointDlg::hideEvent(){"); - disconnect( _patternDataSelectionModel, SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - disconnect( HEXABLOCKGUI::selectionMgr() , SIGNAL(currentSelectionChanged()), this, SLOT(onCurrentSelectionChanged()) ); - disconnect( _vtkVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); - disconnect( _occVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); - _documentModel->allowEdition(); - DeactivateActiveDialog(); - MyGEOMBase_Skeleton::hideEvent( event ); - MESSAGE("}"); + disconnect( _patternDataSelectionModel, SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection &) ), + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); + + //Disconnection salome selection signals + if (HEXABLOCKGUI::selectionMgr() != NULL) + disconnect( HEXABLOCKGUI::selectionMgr() , SIGNAL(currentSelectionChanged()), + this, SLOT(onCurrentSelectionChanged()) ); + + //Disconnect vtk window activation signals + if (HEXABLOCKGUI::currentDocGView->getViewWindow() != NULL) + disconnect( HEXABLOCKGUI::currentDocGView->getViewWindow()->getViewManager(), + SIGNAL( activated(SUIT_ViewManager*) ), + this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); + + //Disconnect occ window activation signals + if (HEXABLOCKGUI::currentOccGView->getViewWindow() != NULL) + disconnect( HEXABLOCKGUI::currentOccGView->getViewWindow()->getViewManager(), + SIGNAL( activated(SUIT_ViewManager*) ), + this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); + + _documentModel->allowEdition(); + DeactivateActiveDialog(); + MyGEOMBase_Skeleton::hideEvent( event ); } void MyBasicGUI_PointDlg::showEvent( QShowEvent * event ) { - MESSAGE("MyBasicGUI_PointDlg::showEvent(){"); _documentModel->disallowEdition(); // _patternDataSelectionModel->clearSelection(); connect( _patternDataSelectionModel, SIGNAL( selectionChanged ( const QItemSelection &, const QItemSelection &) ), - this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); - connect( _mgr, SIGNAL(currentSelectionChanged()), this, SLOT(onCurrentSelectionChanged()) ); - connect( _vtkVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); - connect( _occVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); + this, SLOT( onSelectionChanged(const QItemSelection &, const QItemSelection &) ) ); + + //Connect to salome selection signals + if (HEXABLOCKGUI::selectionMgr() != NULL) + { + connect( HEXABLOCKGUI::selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(onCurrentSelectionChanged()), Qt::UniqueConnection ); + } + + //Connect to vtk window activation signals + if (HEXABLOCKGUI::currentDocGView->getViewWindow() != NULL) + { + connect( HEXABLOCKGUI::currentDocGView->getViewWindow()->getViewManager(), SIGNAL( activated(SUIT_ViewManager*) ), + this, SLOT( onWindowActivated(SUIT_ViewManager*) ), Qt::UniqueConnection ); + } + + //connect to occ window activation signals + if (HEXABLOCKGUI::currentOccGView->getViewWindow() != NULL) + { + connect( HEXABLOCKGUI::currentOccGView->getViewWindow()->getViewManager(), + SIGNAL( activated(SUIT_ViewManager*) ), + this, SLOT( onWindowActivated(SUIT_ViewManager*) ), Qt::UniqueConnection ); + } + +// connect( _mgr, SIGNAL(currentSelectionChanged()), this, SLOT(onCurrentSelectionChanged()) ); +// connect( _vtkVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); +// connect( _occVm, SIGNAL( activated(SUIT_ViewManager*) ), this, SLOT( onWindowActivated(SUIT_ViewManager*) ) ); SalomeApp_Application* app = (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ); - MESSAGE( "XXXXXXXXXXX myGeomGUI => " << myGeomGUI ); if ( !myGeomGUI && app ) myGeomGUI = dynamic_cast( app->module( "Geometry" ) ); - MESSAGE( "YYYYYYYYYYYYY myGeomGUI => " << myGeomGUI ); ActivateThisDialog(); MyGEOMBase_Skeleton::showEvent ( event ); - MESSAGE("}"); } @@ -1351,12 +1421,12 @@ void MyBasicGUI_PointDlg::showEvent( QShowEvent * event ) bool MyBasicGUI_PointDlg::onAccept( const bool publish, const bool useTransaction ) { - MESSAGE("MyBasicGUI_PointDlg::onAccept()"); GEOM::GEOM_Object_ptr newVertex; QString newVertexEntry; QString newVertexName; QString newVertexBrep; + gp_Pnt aPnt; @@ -1366,7 +1436,6 @@ bool MyBasicGUI_PointDlg::onAccept( const bool publish, const bool useTransactio bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { - MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked"); SUIT_MessageBox::warning ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED"), @@ -1425,10 +1494,9 @@ bool MyBasicGUI_PointDlg::onAccept( const bool publish, const bool useTransactio TopoDS_Shape aShape; GEOMBase::GetShape( newVertex, aShape ); if ( !aShape.IsNull() ){ - MESSAGE("!aShape.IsNull()"); newVertexName = GEOMBase::GetName( newVertex ); - MESSAGE("newVertexName "<< newVertexName.toStdString()); newVertexBrep = HEXABLOCK::GUI::shape2string( aShape ).c_str(); + aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape)); } // updateView=false @@ -1486,19 +1554,19 @@ bool MyBasicGUI_PointDlg::onAccept( const bool publish, const bool useTransactio if ( iVertex.isValid() ){ HEXABLOCK::GUI::DocumentModel::GeomObj aPoint; - aPoint.name = newVertexName; - aPoint.entry = newVertexEntry; + aPoint.shapeName = newVertexName; + aPoint.subid = QString::number(-1); aPoint.brep = newVertexBrep; - MESSAGE(" aPoint.name" << aPoint.name.toStdString() ); - MESSAGE(" aPoint.entry" << aPoint.entry.toStdString() ); - MESSAGE(" aPoint.brep" << aPoint.brep.toStdString() ); - _documentModel->addAssociation( iVertex, aPoint ); + _documentModel->setGeomObjName(newVertexEntry, newVertexName); + _documentModel->setGeomObjEntry(newVertexName, newVertexEntry); +// _documentModel->addAssociation( iVertex, aPoint ); + _documentModel->setVertexAssociation(iVertex, aPnt.X(), aPnt.Y(), aPnt.Z()); // to select/highlight result // _patternDataSelectionModel->clearSelection(); // mainFrame()->_vertex_le->setFocus(); -// globalSelection(); -// localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); +// globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); +// localSelection(HEXABLOCKGUI::currentOccGView->getViewWindow(), TopAbs_VERTEX); _patternDataSelectionModel->select( patternDataModel->mapFromSource(iVertex), QItemSelectionModel::Clear ); _patternDataSelectionModel->select( patternDataModel->mapFromSource(iVertex), QItemSelectionModel::Select ); _currentObj = NULL; diff --git a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx index eaed34a..0598c0e 100755 --- a/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx +++ b/src/HEXABLOCKGUI/MyBasicGUI_PointDlg.hxx @@ -123,6 +123,10 @@ private: QMap myActions; TopAbs_ShapeEnum myNeedType; + + +public slots: + virtual void onHelpRequested(); private slots: void ClickOnOk(); @@ -139,14 +143,12 @@ private slots: void onBtnPopup( QAction* ); void updateSize(); - // HEXABLOCK public: void setDocumentModel( HEXABLOCK::GUI::DocumentModel* m ); void setPatternDataSelectionModel( HEXABLOCK::GUI::PatternDataSelectionModel* s ); - bool onAccept( const bool publish = true, const bool useTransaction = true ); - + void clear(); protected: virtual bool eventFilter( QObject *obj, QEvent *event ); @@ -160,14 +162,12 @@ protected: protected slots: void onSelectionChanged( const QItemSelection& sel, const QItemSelection& unsel ); void onWindowActivated( SUIT_ViewManager* vm ); + void updateHelpFileName(); private: HEXABLOCK::GUI::DocumentModel* _documentModel; HEXABLOCK::GUI::PatternDataSelectionModel* _patternDataSelectionModel; - LightApp_SelectionMgr* _mgr; - SUIT_ViewManager* _vtkVm; - SUIT_ViewManager* _occVm; // QLineEdit* _vertex_le; QObject* _currentObj; diff --git a/src/HEXABLOCKGUI/MyDlgRef/DlgRef_Skeleton_QTD.ui b/src/HEXABLOCKGUI/MyDlgRef/DlgRef_Skeleton_QTD.ui index 406a6b6..856d4b5 100755 --- a/src/HEXABLOCKGUI/MyDlgRef/DlgRef_Skeleton_QTD.ui +++ b/src/HEXABLOCKGUI/MyDlgRef/DlgRef_Skeleton_QTD.ui @@ -6,12 +6,12 @@ 0 0 - 297 - 396 + 225 + 267 - + 0 0 @@ -33,8 +33,8 @@ 0 0 - 275 - 322 + 201 + 307 diff --git a/src/HEXABLOCKGUI/MyGEOMBase_Helper.cxx b/src/HEXABLOCKGUI/MyGEOMBase_Helper.cxx index d8228fb..8f39862 100644 --- a/src/HEXABLOCKGUI/MyGEOMBase_Helper.cxx +++ b/src/HEXABLOCKGUI/MyGEOMBase_Helper.cxx @@ -20,13 +20,13 @@ #include "MyGEOMBase_Helper.hxx" #include "GEOMBase.h" #include "GEOM_Operation.h" +#include "HEXABLOCKGUI.hxx" #include #include #include #include -#include #include #include #include @@ -42,11 +42,13 @@ #include #include +#include #include #include #include #include +#include //To disable automatic genericobj management, the following line should be commented. //Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx @@ -91,7 +93,6 @@ MyGEOMBase_Helper::MyGEOMBase_Helper( SUIT_Desktop* desktop ) //================================================================ MyGEOMBase_Helper::~MyGEOMBase_Helper() { - MESSAGE("DESSSSSSSSSSTTTRRRRUUUCCCCCCCCCCCTTTTOOOOORRRRR"); //rnv: Fix for the "IPAL21922 : WinTC5.1.4: incorrect quit salome" if ( !SUIT_Session::session()->activeApplication() || !SUIT_Session::session()->activeApplication()->desktop() ) return; @@ -169,7 +170,7 @@ void MyGEOMBase_Helper::erase( GEOM::GEOM_Object_ptr object, const bool updateVi if ( !object->_is_nil() ) { QString entry = getEntry( object ); getDisplayer()->Erase( new SALOME_InteractiveObject( - entry.toLatin1().constData(), + entry.toLatin1().constData(), "GEOM", strdup( GEOMBase::GetName( object ).toLatin1().constData() ) ), true, updateView ); } } @@ -255,7 +256,7 @@ void MyGEOMBase_Helper::displayPreview( const bool display, erasePreview( update ); return; } - + isPreview = true; QString msg; if ( !isValid( msg ) ) @@ -480,6 +481,73 @@ void MyGEOMBase_Helper::localSelection( GEOM::GEOM_Object_ptr obj, const int mod localSelection( objList, mode ); } +//================================================================ +// Beta version +// Function : localSelection +// Purpose : Activate selection of subshapes in accordance with mode +// theMode is from TopAbs_ShapeEnum +//================================================================ +void MyGEOMBase_Helper::localSelection(SUIT_ViewWindow *view, const int theMode ) +{ + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( app == NULL || view == NULL ) return; + + LightApp_SelectionMgr* sm = app->selectionMgr(); + + // remove all filters from selection + sm->clearFilters(); + + SALOME_View* vf = dynamic_cast(view->getViewManager()->getViewModel()); + if (vf == NULL) return; + + SALOME_Prs* prs = vf->CreatePrs( NULL ); + vf->LocalSelection( prs, theMode ); + delete prs; // delete presentation because displayer is its owner +} + + + +//================================================================ +// Beta version +// Function : globalSelection2 +// Purpose : Activate selection of subshapes. Set selection filters +// in accordance with mode. theMode is from GEOMImpl_Types +// mode = GEOM_ALLOBJECTS +//================================================================ +void MyGEOMBase_Helper::globalSelection(SUIT_ViewWindow *view, const bool update ) +{ + SUIT_Session* session = SUIT_Session::session(); + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( app == NULL || view == NULL ) return; + + SALOME_View* vf = dynamic_cast(view->getViewManager()->getViewModel()); + if ( vf == NULL ) return; + + // Close local context + vf->GlobalSelection( update ); + + // Set selection filters in accordance with current mode + LightApp_SelectionMgr* sm = app->selectionMgr(); + if ( !sm ) + return; + + + //@ aSel->ClearIndex(); + + sm->clearFilters(); + + // Remove filters from AIS_InteractiveContext + Handle(AIS_InteractiveContext) ic; + SOCC_Viewer* viewer = dynamic_cast( vf ); + if ( viewer ) + { + ic = viewer->getAISContext(); + if ( !ic.IsNull() ) + ic->RemoveFilters(); + } +} + //================================================================ // Function : globalSelection @@ -794,7 +862,6 @@ bool MyGEOMBase_Helper::onAccept( const bool publish, const bool useTransaction bool aLocked = (_PTR(AttributeStudyProperties) (aStudy->GetProperties()))->IsLocked(); if ( aLocked ) { - MESSAGE("MyGEOMBase_Helper::onAccept - ActiveStudy is locked"); SUIT_MessageBox::warning ( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(), QObject::tr("WRN_WARNING"), QObject::tr("WRN_STUDY_LOCKED"), @@ -1079,7 +1146,7 @@ GEOM::GEOM_Object_ptr MyGEOMBase_Helper::findObjectInFather (GEOM::GEOM_Object_p } if (inStudy) return aReturnObject._retn(); - + return GEOM::GEOM_Object::_nil(); } @@ -1093,7 +1160,7 @@ GEOM::GEOM_Object_ptr MyGEOMBase_Helper::findObjectInFather( GEOM::GEOM_Object_p { GEOM::GEOM_Object_var object; bool found = false; - + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); if ( study ) { _PTR(Study) studyDS = study->studyDS(); @@ -1116,7 +1183,7 @@ GEOM::GEOM_Object_ptr MyGEOMBase_Helper::findObjectInFather( GEOM::GEOM_Object_p } } } - + return object._retn(); } @@ -1136,7 +1203,7 @@ void MyGEOMBase_Helper::addSubshapesToStudy() // Returns valid object if only one object of the specified type is selected // (no matter global or local selection is activated). If \a type is TopAbs_SHAPE, // geometrical object of any valid type is expected. -// +// // \param type type of the object to be obtained from selection // \return selected geometrical object or nil object if selection is not satisfactory //================================================================ @@ -1155,7 +1222,7 @@ GEOM::GeomObjPtr MyGEOMBase_Helper::getSelected( TopAbs_ShapeEnum type ) // (no matter global or local selection is activated). The list of allowed // shape types is passed via \a types. If \a types includes TopAbs_SHAPE, // geometrical object of any valid type is expected. -// +// // \param types list of allowed shape types for the objects to be obtained from selection // \return selected geometrical object or nil object if selection is not satisfactory //================================================================ @@ -1175,7 +1242,7 @@ GEOM::GeomObjPtr MyGEOMBase_Helper::getSelected( const QList& // // The \a type parameter specifies allowed type of the object(s) being selected. // The \a count parameter specifies exact number of the objects to be retrieved from selection. -// The \a strict parameter specifies policy being applied to the selection. +// The \a strict parameter specifies policy being applied to the selection. // If \a count < 0, then any number of the selected objects is valid (including 0). // In this case, if \a strict is \c true (default), all selected objects should satisfy // the specified \a type. @@ -1183,7 +1250,7 @@ GEOM::GeomObjPtr MyGEOMBase_Helper::getSelected( const QList& // In this case, if \a strict is \c true (default), function returns empty list if total number of selected // objects does not correspond to the \a count parameter. Otherwise (if \a strict is \c false), // function returns valid list of objects if at least \a count objects satisfy specified \a type. -// +// // \param type type of the object(s) to be obtained from selection // \param count number of items to be retrieved from selection // \param strict selection policy @@ -1214,7 +1281,7 @@ static bool typeInList( TopAbs_ShapeEnum type, const QList& ty // // The \a types parameter specifies allowed types of the object(s) being selected. // The \a count parameter specifies exact number of the objects to be retrieved from selection. -// The \a strict parameter specifies policy being applied to the selection. +// The \a strict parameter specifies policy being applied to the selection. // If \a count < 0, then any number of the selected objects is valid (including 0). // In this case, if \a strict is \c true (default), all selected objects should satisfy // the specified \a type. @@ -1222,7 +1289,7 @@ static bool typeInList( TopAbs_ShapeEnum type, const QList& ty // In this case, if \a strict is \c true (default), function returns empty list if total number of selected // objects does not correspond to the \a count parameter. Otherwise (if \a strict is \c false), // function returns valid list of objects if at least \a count objects satisfy specified \a type. -// +// // \param types list of allowed shape types for the objects to be obtained from selection // \param count number of items to be retrieved from selection // \param strict selection policy @@ -1230,74 +1297,93 @@ static bool typeInList( TopAbs_ShapeEnum type, const QList& ty //================================================================ QList MyGEOMBase_Helper::getSelected( const QList& types, int count, bool strict ) { - SUIT_Session* session = SUIT_Session::session(); - QList result; - - SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); - if ( app ) { - LightApp_SelectionMgr* selMgr = app->selectionMgr(); - if ( selMgr ) { - SALOME_ListIO selected; - selMgr->selectedObjects( selected ); - SALOME_ListIteratorOfListIO it( selected ); - bool stopped = false; - for ( ; it.More() && !stopped; it.Next() ) { - Handle(SALOME_InteractiveObject) IO = it.Value(); - GEOM::GeomObjPtr object = GEOMBase::ConvertIOinGEOMObject( IO ); - if ( object ) { - TColStd_IndexedMapOfInteger subShapes; - selMgr->GetIndexes( IO, subShapes ); - int nbSubShapes = subShapes.Extent(); - if ( nbSubShapes == 0 ) { - // global selection - if ( typeInList( (TopAbs_ShapeEnum)(object->GetShapeType()), types ) ) { - result << object; - if ( count > 0 ) { - if ( strict && result.count() > count ) { - result.clear(); - stopped = true; - } - else if ( !strict && result.count() == count ) - stopped = true; - } - } - else if ( strict ) { - result.clear(); - stopped = true; - } - } - else { - // local selection - for ( int i = 1; i <= nbSubShapes && !stopped; i++ ) { - int idx = subShapes( i ); - GEOM::GeomObjPtr subShape = findObjectInFather( object.get(), idx ); - if ( !subShape ) { - // sub-shape is not yet published in the study - GEOM::ShapesOpPtr shapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); - subShape.take( shapesOp->GetSubShape( object.get(), idx ) ); // take ownership! - } - if ( typeInList( (TopAbs_ShapeEnum)(subShape->GetShapeType()), types ) ) { - result << subShape; - if ( count > 0 ) { - if ( strict && result.count() > count ) { - result.clear(); - stopped = true; - } - else if ( !strict && result.count() == count ) - stopped = true; - } - } - else if ( strict ) { - result.clear(); - stopped = true; - } - } - } - } - } + SUIT_Session* session = SUIT_Session::session(); + QList result; + + SalomeApp_Application* app = dynamic_cast( session->activeApplication() ); + if ( app ) { +// LightApp_SelectionMgr* selMgr = app->selectionMgr(); +// if ( selMgr ) { + if ( HEXABLOCKGUI::selectionMgr() != NULL) { + SALOME_ListIO selected; + + //====================================== +// SUIT_DataOwnerPtrList selectedDataOwner; +// AIS_ListOfInteractive listOfSelected; +// +// if (HEXABLOCKGUI::currentOccSelector != NULL) +// HEXABLOCKGUI::currentOccSelector->viewer()->getSelectedObjects(listOfSelected); +// +// AIS_ListIteratorOfListOfInteractive it (listOfSelected); +// while (it.More ()) +// { +// //do something with the current item : it.Value () +// selected.Append(it.Value()); +// it.Next (); +// } + //====================================== + +// selMgr->selectedObjects( selected ); + HEXABLOCKGUI::selectionMgr()->selectedObjects( selected/*, "", false*/ ); + SALOME_ListIteratorOfListIO it( selected ); + bool stopped = false; + for ( ; it.More() && !stopped; it.Next() ) { + Handle(SALOME_InteractiveObject) IO = it.Value(); + GEOM::GeomObjPtr object = GEOMBase::ConvertIOinGEOMObject( IO ); + if ( object ) { + TColStd_IndexedMapOfInteger subShapes; + HEXABLOCKGUI::selectionMgr()->GetIndexes( IO, subShapes ); + int nbSubShapes = subShapes.Extent(); + if ( nbSubShapes == 0 ) { + // global selection + if ( typeInList( (TopAbs_ShapeEnum)(object->GetShapeType()), types ) ) { + result << object; + if ( count > 0 ) { + if ( strict && result.count() > count ) { + result.clear(); + stopped = true; + } + else if ( !strict && result.count() == count ) + stopped = true; + } + } + else if ( strict ) { + result.clear(); + stopped = true; + } + } + else { + // local selection + for ( int i = 1; i <= nbSubShapes && !stopped; i++ ) { + int idx = subShapes( i ); + GEOM::GeomObjPtr subShape = findObjectInFather( object.get(), idx ); + if ( !subShape ) { + // sub-shape is not yet published in the study + GEOM::ShapesOpPtr shapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + subShape.take( shapesOp->GetSubShape( object.get(), idx ) ); // take ownership! + } + if ( typeInList( (TopAbs_ShapeEnum)(subShape->GetShapeType()), types ) ) { + result << subShape; + if ( count > 0 ) { + if ( strict && result.count() > count ) { + result.clear(); + stopped = true; + } + else if ( !strict && result.count() == count ) + stopped = true; + } + } + else if ( strict ) { + result.clear(); + stopped = true; + } + } + } + } + } + } } - } - return result; + return result; } //================================================================ diff --git a/src/HEXABLOCKGUI/MyGEOMBase_Helper.hxx b/src/HEXABLOCKGUI/MyGEOMBase_Helper.hxx index ea3bac8..365b566 100644 --- a/src/HEXABLOCKGUI/MyGEOMBase_Helper.hxx +++ b/src/HEXABLOCKGUI/MyGEOMBase_Helper.hxx @@ -26,6 +26,7 @@ #include #include #include +#include #include CORBA_CLIENT_HEADER(GEOM_Gen) #include @@ -60,12 +61,18 @@ public: void globalSelection( const int = GEOM_ALLOBJECTS, const bool = false ); void globalSelection( const TColStd_MapOfInteger&, const bool = false ); void globalSelection( const TColStd_MapOfInteger&, const QList& ,const bool = false ); + void erasePreview ( const bool = true ); + void display ( GEOM::GEOM_Object_ptr, const bool = true ); + QString addInStudy ( GEOM::GEOM_Object_ptr, const char* theName ); + + void localSelection(SUIT_ViewWindow *view, const int theMode); + void globalSelection( SUIT_ViewWindow *view, const bool update = false ); protected: static GEOM::GEOM_Gen_ptr getGeomEngine(); void display ( const ObjectList&, const bool = true ); - void display ( GEOM::GEOM_Object_ptr, const bool = true ); +// void display ( GEOM::GEOM_Object_ptr, const bool = true ); void erase ( const ObjectList&, const bool = true ); void erase ( GEOM::GEOM_Object_ptr, const bool = true ); void redisplay ( const ObjectList&, const bool = true, const bool = true ); @@ -91,7 +98,6 @@ protected: void displayPreview ( const SALOME_Prs* prs, const bool append = false, const bool = true ); - void erasePreview ( const bool = true ); // void localSelection( const ObjectList&, const int ); // void localSelection( GEOM::GEOM_Object_ptr, const int ); @@ -104,7 +110,7 @@ protected: void prepareSelection( const ObjectList&, const int ); void prepareSelection( GEOM::GEOM_Object_ptr, const int ); - QString addInStudy ( GEOM::GEOM_Object_ptr, const char* theName ); +// QString addInStudy ( GEOM::GEOM_Object_ptr, const char* theName ); bool openCommand (); bool abortCommand (); diff --git a/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.cxx b/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.cxx index b67d1f9..48955fa 100755 --- a/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.cxx +++ b/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.cxx @@ -19,6 +19,7 @@ #include "MyGEOMBase_Skeleton.hxx" #include "GEOMBase.h" +#include "HEXABLOCKGUI_VtkDocumentGraphicView.hxx" #include "MyDlgRef.hxx" #include @@ -54,7 +55,6 @@ MyGEOMBase_Skeleton::MyGEOMBase_Skeleton( GeometryGUI* theGeometryGUI, QWidget* // setAttribute( Qt::WA_DeleteOnClose ); setModal( modal ); - MESSAGE("MyGEOMBase_Skeleton::MyGEOMBase_Skeleton()"); myMainFrame = new MyDlgRef_Skeleton( this ); QVBoxLayout* topLayout = new QVBoxLayout( this ); @@ -208,11 +208,12 @@ void MyGEOMBase_Skeleton::close() { // _currentObj = NULL; - //Clear VTK selection -// clearVTKSelection(); + //Clear VTK selection //no need to test if the graphic view exist + HEXABLOCKGUI::currentDocGView->clearSelection(); //Clear OCC selection -// clearOCCSelection(); + if (HEXABLOCKGUI::currentOccGView != NULL) + HEXABLOCKGUI::currentOccGView->clearSelection(); //Close the dialog box if (parentWidget()) parentWidget()->close(); @@ -248,7 +249,7 @@ void MyGEOMBase_Skeleton::LineEditReturnPressed() void MyGEOMBase_Skeleton::DeactivateActiveDialog() { this->setEnabled( false ); - globalSelection(); + globalSelection(HEXABLOCKGUI::currentOccGView->getViewWindow()); if ( myGeomGUI ) { myGeomGUI->SetActiveDialogBox( 0 ); disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 ); diff --git a/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx b/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx index ebbdf76..3d1a6ea 100755 --- a/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx +++ b/src/HEXABLOCKGUI/MyGEOMBase_Skeleton.hxx @@ -22,6 +22,8 @@ #include "GEOM_GEOMBase.hxx" #include "MyGEOMBase_Helper.hxx" +#include "HEXABLOCKGUI_OccGraphicView.hxx" +#include "HEXABLOCKGUI.hxx" #include diff --git a/src/HEXABLOCKGUI/PrismQuad_QTD.ui b/src/HEXABLOCKGUI/PrismQuad_QTD.ui index 7be90fb..357108d 100644 --- a/src/HEXABLOCKGUI/PrismQuad_QTD.ui +++ b/src/HEXABLOCKGUI/PrismQuad_QTD.ui @@ -6,8 +6,8 @@ 0 0 - 254 - 500 + 260 + 376 @@ -18,7 +18,7 @@ - 5 + 0 0 @@ -33,248 +33,276 @@ - - - - 5 - 0 - + + + true - - Arguments - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Quad(s) - - - - - - - 0 - 0 - - - - - - - - - - - - 16777215 - 50 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Direction - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - false - - - - - - - - - - - 0 - 0 - - - - Layer(s) - - - - - - - - regular - - - true - - - - - - - irregular - - - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - nb - - - - - - - 1000000 - - - 1 - - - - - - - - - - - 16777215 - 169 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - 0 - 0 - - - - 0 - - - - height - - + + + + 0 + 0 + 267 + 500 + + + + + + + + 0 + 0 + + + + Arguments + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Quad(s) + + + + + + + 0 + 0 + + + + + + + + + + + + 16777215 + 50 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 0 + 0 + + + + Direction + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + false + + + + + + + + + + + 0 + 0 + + + + Layer(s) + + + + + + + + regular + + + true + + + + + + + irregular + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + - - - true - - - - 0 - 0 - - + - + + nb - - - - - 0 - 0 - + + + + 1 + + + 1000000 + + + 1 - - + + + + + + + + 16777215 + 169 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + - + 0 0 - - - + + 0 + + + height + + + + + + true + + + + 0 + 0 + + + + + + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + - + + + + + + + Qt::Vertical + + + + 20 + 139 + + + + + + - - - - Qt::Vertical - - - - 20 - 139 - - - - - - - - - - - - - + + + + + + + + + diff --git a/src/HEXABLOCKGUI/QuadAssoc_QTD.ui b/src/HEXABLOCKGUI/QuadAssoc_QTD.ui index 43fe6df..2d5d150 100644 --- a/src/HEXABLOCKGUI/QuadAssoc_QTD.ui +++ b/src/HEXABLOCKGUI/QuadAssoc_QTD.ui @@ -65,7 +65,7 @@ - Quad + Quad of the model @@ -93,7 +93,7 @@ - Face(s) + Face(s) of the geometry diff --git a/src/HEXABLOCKGUI/QuadRevolution_QTD.ui b/src/HEXABLOCKGUI/QuadRevolution_QTD.ui index 0f90bec..55452fe 100644 --- a/src/HEXABLOCKGUI/QuadRevolution_QTD.ui +++ b/src/HEXABLOCKGUI/QuadRevolution_QTD.ui @@ -20,44 +20,6 @@ Quad(s) Revolution - - - - - 5 - 0 - - - - Result Name - - - - - - Name : - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - diff --git a/src/HEXABLOCKGUI/ReplaceHexa_QTD.ui b/src/HEXABLOCKGUI/ReplaceHexa_QTD.ui index 038cf13..08a9399 100644 --- a/src/HEXABLOCKGUI/ReplaceHexa_QTD.ui +++ b/src/HEXABLOCKGUI/ReplaceHexa_QTD.ui @@ -6,13 +6,13 @@ 0 0 - 234 - 461 + 227 + 255 - 5 + 0 0 @@ -21,297 +21,271 @@ - - - - 0 - 0 - + + + true - - - 0 - 0 - - - - Result Name - - - - - - Name - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - - - - - - - - - 0 - 0 - - - - - 0 - 0 - - - - Arguments - - - - - - - 0 - 0 - - - - Quad(s) source - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Select hexa - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Point a - - - - - - - - 0 - 0 - - - - Select vertex - - - - - - false - - - - - - - Point b - - - - - - - - 0 - 0 - - - - Select vertex - - - - - - false - - - - - - - Point c - - - - - - - - 0 - 0 - - - - Select vertex - - - - - - false - - - - - - - - - - - - - - 0 - 0 - - - - Quad destination - - - - - - Point a - - - - - - - - 0 - 0 - - - - Select vertex - - - - - - false - - - - - - - Point b - - - - - - - - 0 - 0 - - - - Select vertex - - - - - - false - - - - - - - Point c - - - - - - - - 0 - 0 - - - - Select vertex - - - - - - false - - - - - - - + + + + 0 + 0 + 234 + 397 + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Arguments + + + + + + + 0 + 0 + + + + Quad(s) source + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Select hexa + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + Point a + + + + + + + + 0 + 0 + + + + Select vertex + + + + + + false + + + + + + + Point b + + + + + + + + 0 + 0 + + + + Select vertex + + + + + + false + + + + + + + Point c + + + + + + + + 0 + 0 + + + + Select vertex + + + + + + false + + + + + + + + + + + + + + 0 + 0 + + + + Quad destination + + + + + + Point a + + + + + + + + 0 + 0 + + + + Select vertex + + + + + + false + + + + + + + Point b + + + + + + + + 0 + 0 + + + + Select vertex + + + + + + false + + + + + + + Point c + + + + + + + + 0 + 0 + + + + Select vertex + + + + + + false + + + + + + + + + + + - name_le quads_lw p1_le p2_le diff --git a/src/HEXABLOCKGUI/Symmetry_QTD.ui b/src/HEXABLOCKGUI/Symmetry_QTD.ui index 80e4e7f..4719b89 100644 --- a/src/HEXABLOCKGUI/Symmetry_QTD.ui +++ b/src/HEXABLOCKGUI/Symmetry_QTD.ui @@ -85,7 +85,7 @@ - Plan + Plane diff --git a/src/HEXABLOCKGUI/Vector_QTD.ui b/src/HEXABLOCKGUI/Vector_QTD.ui index f09de3f..df482f8 100644 --- a/src/HEXABLOCKGUI/Vector_QTD.ui +++ b/src/HEXABLOCKGUI/Vector_QTD.ui @@ -139,7 +139,7 @@ 1000000000.000000000000000 - 0.000000000000000 + 1.000000000000000 diff --git a/src/HEXABLOCKGUI/klinkitemselectionmodel.cxx b/src/HEXABLOCKGUI/klinkitemselectionmodel.cxx index d41011c..8304b3d 100644 --- a/src/HEXABLOCKGUI/klinkitemselectionmodel.cxx +++ b/src/HEXABLOCKGUI/klinkitemselectionmodel.cxx @@ -85,7 +85,7 @@ void KLinkItemSelectionModel::select(const QModelIndex &index, QItemSelectionMod void KLinkItemSelectionModel::select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) { - std::cout<<"KLinkItemSelectionModel::select(const QItemSelection &selection"<"< " << i.data().toString().toStdString() << std::endl; - } else { - std::cout<<"range NOT VALID"<"< " << i.data().toString().toStdString() << std::endl; +// } else { +// std::cout<<"range NOT VALID"< " << i.data().toString().toStdString() << std::endl; - } +// Q_FOREACH(const QModelIndex &i, range.indexes ()) +// { +//// std::cout<< " =====> " << i.data().toString().toStdString() << std::endl; +// } if (!range.isValid()) continue; // std::cout<< " is VALID !!"<< std::endl; diff --git a/src/HEXABLOCKGUI/resources/HEXABLOCK_icons.ts b/src/HEXABLOCKGUI/resources/HEXABLOCK_icons.ts index 69dafca..7526304 100755 --- a/src/HEXABLOCKGUI/resources/HEXABLOCK_icons.ts +++ b/src/HEXABLOCKGUI/resources/HEXABLOCK_icons.ts @@ -203,6 +203,10 @@ ICO_WIRE build_wire.png + + ICO_MODULE_HEXABLOCK_SMALL + ModuleHexablock15x15.png + diff --git a/src/HEXABLOCKGUI/resources/HEXABLOCK_msg_en.ts b/src/HEXABLOCKGUI/resources/HEXABLOCK_msg_en.ts index 9cc0fc8..d358d48 100755 --- a/src/HEXABLOCKGUI/resources/HEXABLOCK_msg_en.ts +++ b/src/HEXABLOCKGUI/resources/HEXABLOCK_msg_en.ts @@ -45,6 +45,41 @@ Cannot disconnect + + HEXABLOCKGUI + + CLEAR_ASSOCIATIONS + Clear associations + + + CLEAR_ALL_ASSOCIATIONS_ON + Clear all associations on + + + TREE_ITEM_VERTEX + Vertices + + + TREE_ITEM_EDGE + Edges + + + TREE_ITEM_QUAD + Quadrangles + + + MODEL_INFO + Model Information + + + ADD_SHAPE + Add geometry + + + ADD_SHAPE_FAILED + Add geometry failed! + + HEXABLOCK::GUI::DocumentModel @@ -83,6 +118,18 @@ TREE_ITEM_CROSSELEMENT Cross Elements + + TREE_ITEM_EXPSHAPE + Explicit geometries + + + TREE_ITEM_IMPSHAPE + Implicit geometries + + + TREE_ITEM_CLOUD_OF_POINT + Cloud of points + TREE_ITEM_GROUP Groups @@ -96,6 +143,17 @@ Propagations + + HEXABLOCK::GUI::QuadAssocDialog + + ERR_ERROR + Error + + + CANNOT MAKE QUAD ASSOCIATION + Cannot make quad association + + HEXABLOCK::GUI::EdgeAssocDialog @@ -183,6 +241,22 @@ CROSSELEMENTS Cross Elements + + GEOMSHAPE + Geom Shape + + + GEOMPOINT + Geom Vertex + + + GEOMEDGE + Geom Edge + + + GEOMFACE + Geom Face + GROUP Group @@ -214,6 +288,10 @@ HEXA_INFO HexaBlock + + + UNKNOWN_GEOMETRY + Unknown Geometry! %1: Bad type selected diff --git a/src/HEXABLOCKGUI/resources/HEXABLOCK_msg_fr.ts b/src/HEXABLOCKGUI/resources/HEXABLOCK_msg_fr.ts index 6432157..2b2307c 100755 --- a/src/HEXABLOCKGUI/resources/HEXABLOCK_msg_fr.ts +++ b/src/HEXABLOCKGUI/resources/HEXABLOCK_msg_fr.ts @@ -45,6 +45,29 @@ Impossible de déconnecter + + HEXABLOCKGUI + + CLEAR_ASSOCIATIONS + Suppression des associations + + + CLEAR_ALL_ASSOCIATIONS_ON + Supprimer toutes les associations sur les + + + TREE_ITEM_VERTEX + Sommets + + + TREE_ITEM_EDGE + Arêtes + + + TREE_ITEM_QUAD + Quadrangles + + HEXABLOCK::GUI::DocumentModel @@ -83,6 +106,18 @@ TREE_ITEM_CROSSELEMENT Eléments de croix + + TREE_ITEM_EXPSHAPE + Géométries explicites + + + TREE_ITEM_IMPSHAPE + Géométries implicites + + + TREE_ITEM_CLOUD_OF_POINT + Nuage de points + TREE_ITEM_GROUP Groupes @@ -107,6 +142,17 @@ Impossible d'associer les arêtes + + HEXABLOCK::GUI::QuadAssocDialog + + ERR_ERROR + Erreur + + + CANNOT MAKE QUAD ASSOCIATION + Impossible d'associer les faces + + HEXABLOCK::GUI::EdgeDialog @@ -183,6 +229,22 @@ CROSSELEMENTS Eléments de croix + + GEOMSHAPE + Geométrie + + + GEOMPOINT + Sommet Geom + + + GEOMEDGE + Arête Geom + + + GEOMFACE + Face Geom + GROUP Groupe @@ -215,6 +277,10 @@ HEXA_INFO HexaBlock + + UNKNOWN_GEOMETRY + Geométrie inconnue! + %1: Bad type selected Please select a %2. @@ -1240,6 +1306,18 @@ Choisissez un(e) %2. MEN_FILE + + MODEL_INFO + Info du model + + + ADD_SHAPE + Ajout d'une géométrie + + + ADD_SHAPE_FAILED + L'ajout de la géométrie a échoué! + MyGEOMBase_Skeleton diff --git a/src/HEXABLOCKGUI/resources/LightApp.xml b/src/HEXABLOCKGUI/resources/LightApp.xml new file mode 100644 index 0000000..c04b2ac --- /dev/null +++ b/src/HEXABLOCKGUI/resources/LightApp.xml @@ -0,0 +1,32 @@ + + +
+ + + +
+
+ + +
+
diff --git a/src/HEXABLOCKGUI/resources/ModuleHexablock15x15.png b/src/HEXABLOCKGUI/resources/ModuleHexablock15x15.png new file mode 100644 index 0000000..cd7e212 Binary files /dev/null and b/src/HEXABLOCKGUI/resources/ModuleHexablock15x15.png differ diff --git a/src/HEXABLOCKGUI/resources/ModuleHexablock20x20.png b/src/HEXABLOCKGUI/resources/ModuleHexablock20x20.png new file mode 100644 index 0000000..66d4886 Binary files /dev/null and b/src/HEXABLOCKGUI/resources/ModuleHexablock20x20.png differ diff --git a/src/HEXABLOCK_I/HEXABLOCK.cxx b/src/HEXABLOCK_I/HEXABLOCK.cxx index 68f09ed..1c1fd45 100755 --- a/src/HEXABLOCK_I/HEXABLOCK.cxx +++ b/src/HEXABLOCK_I/HEXABLOCK.cxx @@ -40,11 +40,6 @@ static bool db = false; //////////// - - - - - #include #include #include @@ -68,12 +63,13 @@ static bool db = false; #include "HEXABLOCK.hxx" +#include "HEXABLOCK_version.h" #include "utilities.h" #include "HexDocument_impl.hxx" #include -// #include "SALOMEDS_Tool.hxx" +#include "SALOMEDS_Tool.hxx" // #include "SALOMEDSImpl_TMPFile.hxx" using namespace HEXABLOCK_ORB; @@ -101,15 +97,14 @@ HEXABLOCK_Gen_i::HEXABLOCK_Gen_i(CORBA::ORB_ptr orb, const char *interfaceName) : Engines_Component_i(orb, poa, contId, instanceName, interfaceName) { - MESSAGE("activate object"); _thisObj = this ; _poa = PortableServer::POA::_duplicate(poa); _orb = CORBA::ORB::_duplicate(orb); _id = _poa->activate_object(_thisObj); - _engine_cpp = new HEXA_NS::Hex; +//_engine_cpp = new HEXA_NS::Hex; + _engine_cpp = HEXA_NS::Hex::getInstance (); _geomClient = NULL; _HEXABLOCKGen = this; - MESSAGE("ALRRRRRIGHTTTTT"); } //============================================================================= @@ -143,9 +138,6 @@ HEXABLOCK_Gen_i::~HEXABLOCK_Gen_i() { } - - - //============================================================================= /*! * DumpPython @@ -156,7 +148,6 @@ Engines::TMPFile* HEXABLOCK_Gen_i::DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean /*isMultiFile*/, CORBA::Boolean& isValidScript) { - MESSAGE("DumpPython DumpPython DumpPython DumpPython"); std::cout << "DumpPython DumpPython DumpPython DumpPython" << std::endl; isValidScript = true; // to avoid dump python operation failing Engines::TMPFile_var aStreamFile = new Engines::TMPFile(0); @@ -245,7 +236,6 @@ Engines::TMPFile* HEXABLOCK_Gen_i::DumpPython(CORBA::Object_ptr theStudy, void HEXABLOCK_Gen_i::test() { - MESSAGE("HEEEEEEEEEEEEEEYYYYYYYYYYY"); } CORBA::Long HEXABLOCK_Gen_i::countDocument() @@ -258,7 +248,9 @@ CORBA::Long HEXABLOCK_Gen_i::countDocument() Document_ptr HEXABLOCK_Gen_i::getDocument(CORBA::Long i) { HEXA_NS::Document *doc=_engine_cpp->getDocument(i); - if ( doc == NULL ) return Document::_nil(); + if ( doc == NULL ) + return Document::_nil(); + Document_impl *servantCorba = new Document_impl( GetPOA(), doc ); return servantCorba->_this(); } @@ -273,6 +265,16 @@ void HEXABLOCK_Gen_i::removeDocument(HEXABLOCK_ORB::Document_ptr docIn) } } +Document_ptr HEXABLOCK_Gen_i::findDocument(const char* name) +{ + HEXA_NS::Document *doc=_engine_cpp->findDocument (name); + + if (doc==NULL) + return Document::_nil(); + + Document_impl *servantCorba=new Document_impl( GetPOA(), doc); + return servantCorba->_this(); +} Document_ptr HEXABLOCK_Gen_i::addDocument(const char* name) { @@ -498,60 +500,30 @@ int HEXABLOCK_Gen_i::RegisterObject(CORBA::Object_ptr theObject) } -// SMESH::SMESH_Mesh_ptr SMESH_Gen_i::createMesh() -// throw ( SALOME::SALOME_Exception ) - - char* HEXABLOCK_Gen_i::ComponentDataType() { -// if(MYDEBUG) MESSAGE( "HEXABLOCK_Gen_i::ComponentDataType" ); return CORBA::string_dup( "HEXABLOCK" ); } - -// SMESH_Mesh* SMESH_Gen::CreateMesh(int theStudyId, bool theIsEmbeddedMode) -// throw(SALOME_Exception) -// { -// Unexpect aCatch(SalomeException); -// MESSAGE("SMESH_Gen::CreateMesh"); -// -// // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document -// StudyContextStruct *aStudyContext = GetStudyContext(theStudyId); -// -// // create a new SMESH_mesh object -// SMESH_Mesh *aMesh = new SMESH_Mesh(_localId++, -// theStudyId, -// this, -// theIsEmbeddedMode, -// aStudyContext->myDocument); -// aStudyContext->mapMesh[_localId] = aMesh; -// -// return aMesh; -// } - - - - Document_ptr HEXABLOCK_Gen_i::createDoc (const char* name) throw ( SALOME::SALOME_Exception ) { Unexpect aCatch(SALOME_SalomeException); -// if(MYDEBUG) MESSAGE( "SMESH_Gen_i::createMesh" ); // Get or create the GEOM_Client instance try { - HEXA_NS::Document *d = _engine_cpp->addDocument (name); - Document_impl *docImpl = new Document_impl( GetPOA(), d ); + HEXA_NS::Document *doc = NULL; + doc = _engine_cpp->addDocument (name); + Document_impl *docImpl = new Document_impl( GetPOA(), doc ); // activate the CORBA servant of Mesh Document_var docServant = Document::_narrow( docImpl->_this() ); /* int nextId = */ RegisterObject( docServant ); -// if(MYDEBUG) MESSAGE( "Add mesh to map with id = "<< nextId); + return docServant._retn(); } catch (SALOME_Exception& S_ex) { -// THROW_SALOME_CORBA_EXCEPTION( S_ex.what(), SALOME::BAD_PARAM ); } return Document::_nil(); } @@ -560,7 +532,6 @@ Document_ptr HEXABLOCK_Gen_i::createDocInStudy (const char* name) throw ( SALOME::SALOME_Exception ) { Unexpect aCatch(SALOME_SalomeException); -// if(MYDEBUG) MESSAGE( "SMESH_Gen_i::CreateMesh" ); // create mesh Document_var doc = this->createDoc (name); @@ -570,10 +541,6 @@ Document_ptr HEXABLOCK_Gen_i::createDocInStudy (const char* name) aStudyBuilder->NewCommand(); // There is a transaction SALOMEDS::SObject_var aSO = PublishDoc( myCurrentStudy, doc.in() ); aStudyBuilder->CommitCommand(); -// if ( !aSO->_is_nil() ) { -// // Update Python script -// TPythonDump() << aSO << " = " << this << ".CreateEmptyMesh()"; -// } } return doc._retn(); @@ -644,23 +611,14 @@ void HEXABLOCK_Gen_i::SetCurrentStudy( SALOMEDS::Study_ptr theStudy ) } - - - - TopoDS_Shape string2shape( const string& brep ) { TopoDS_Shape shape; -// istringstream streamBrep(brep.c_str()); istringstream streamBrep(brep); -// char* chaine = new char[brep.size()]; -// strcpy(chaine, brep.c_str()); -// istringstream streamBrep( chaine ); BRep_Builder aBuilder; BRepTools::Read(shape, streamBrep, aBuilder); -// BRepTools::Read(shape, brep, aBuilder); return shape; } @@ -677,9 +635,7 @@ TopoDS_Shape string2shape( const string& brep ) string shape2string( const TopoDS_Shape& aShape ) { ostringstream streamShape; -// string strShape; BRepTools::Write(aShape, streamShape); -// BRepTools::Write(aShape, strShape); return streamShape.str(); } @@ -693,7 +649,6 @@ extern "C" const char *instanceName, const char *interfaceName) { - MESSAGE("PortableServer::ObjectId * HEXABLOCKEngine_factory()"); SCRUTE(interfaceName); HEXABLOCK_Gen_i *myHEXABLOCK = new HEXABLOCK_Gen_i(orb, poa, contId, instanceName, interfaceName); @@ -745,9 +700,8 @@ char* HEXABLOCK_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, { if (db) cout << " +++++++ Je suis passe par HEXABLOCK_Gen_i::" << "IORToLocalPersistentID" << endl; - /// static char empty [8] = ""; - char* empty = strdup (""); - return empty; + const char* empty = ""; + return CORBA::string_dup (empty); } // =================================================== LocalPersistentIDToIOR char* HEXABLOCK_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, @@ -757,8 +711,9 @@ char* HEXABLOCK_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, { if (db) cout << " +++++++ Je suis passe par HEXABLOCK_Gen_i::" << "LocalPersistentIDToIOR" << endl; - static char empty [8] = ""; - return empty; + + const char* empty = ""; + return CORBA::string_dup (empty); } // // =========================================================== CanCopy @@ -793,11 +748,6 @@ SALOMEDS::SObject_ptr HEXABLOCK_Gen_i::PasteInto(const SALOMEDS::TMPFile& fic, << "PasteInto" << endl; return NULL; } -// ======================================================== CanPublishInStudy -// bool HEXABLOCK_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) -// { - // return NULL; -// } // =========================================================== CanPaste SALOMEDS::SObject_ptr HEXABLOCK_Gen_i::PublishInStudy (SALOMEDS::Study_ptr stud, SALOMEDS::SObject_ptr theSObject, @@ -810,23 +760,102 @@ SALOMEDS::SObject_ptr HEXABLOCK_Gen_i::PublishInStudy (SALOMEDS::Study_ptr stud, return NULL; } // =========================================================== Save -SALOMEDS::TMPFile* HEXABLOCK_Gen_i::Save( - const SALOMEDS::SComponent_ptr compo, - const char* theURL, - bool isMultiFile) +SALOMEDS::TMPFile* HEXABLOCK_Gen_i::Save(const SALOMEDS::SComponent_ptr compo, + const char* theURL, + bool isMultiFile) { if (db) cout << " +++++++ Je suis passe par HEXABLOCK_Gen_i::" << "Save" << endl; - return NULL; + + string tmp_fic = SALOMEDS_Tool::GetTmpDir(); +// tmp_fic += "hexablock.xml"; + tmp_fic = "hexablock.xml"; + cpchar fic_study = tmp_fic.c_str(); + + int len_buffer = 4; + char* ch_buffer = NULL; + int ier = _engine_cpp->saveAllDocs (fic_study); + if (ier==HOK) + ch_buffer = Hex::read_file (fic_study, len_buffer); + else + ch_buffer = strdup ("<0>"); + + CORBA::Octet* oct_buffer = (CORBA::Octet*) ch_buffer; + SALOMEDS::TMPFile* oct_stream = new SALOMEDS::TMPFile (len_buffer, + len_buffer, oct_buffer, 1); + return oct_stream; } // =========================================================== Load CORBA::Boolean HEXABLOCK_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, - const SALOMEDS::TMPFile& theStream, + const SALOMEDS::TMPFile& stream, const char* theURL, bool isMultiFile) { if (db) cout << " +++++++ Je suis passe par HEXABLOCK_Gen_i::" << "Load" << endl; - return false; + char *ch_buffer = (char*) stream.NP_data(); + + int ier = _engine_cpp->loadAllDocs (ch_buffer); + return ier==HOK; +} + +// =========================================================== addDocInStudy +CORBA::Long HEXABLOCK_Gen_i::addDocInStudy (Document_ptr doc_in) + throw ( SALOME::SALOME_Exception ) +{ + if (CORBA::is_nil(myCurrentStudy)) + return 986; + + Document_impl* doc_servant = ::DownCast (doc_in); + if (doc_servant == NULL) + return 987; + + HEXA_NS::Document* doc = doc_servant->GetImpl(); + if (doc == NULL) + return 988; + + cpchar name = doc->getName(); + PutData (name); + + SALOMEDS::StudyBuilder_var study_builder = myCurrentStudy->NewBuilder(); + // study_builder->NewCommand(); // There is a transaction ??? + + + SALOMEDS::SObject_var obj = ObjectToSObject( myCurrentStudy, doc_in ); + if ( obj->_is_nil() ) + { + SALOMEDS::SComponent_var father = PublishComponent( myCurrentStudy ); + if ( father->_is_nil() ) + return 989; + + // SALOMEDS::SObject_var + // s_obj = HEXABLOCK_Gen_i::ObjectToSObject( my_current_study, doc_in ); ??? + // if ( obj->_is_nil() ) --> C'est le cas + + SALOMEDS::SObject_var s_obj = study_builder->NewObject (father); + obj = s_obj._retn(); + if ( obj->_is_nil() ) + return 981; + } + + SALOMEDS::GenericAttribute_var attrib; + SALOMEDS::AttributeName_var attname; + + attrib = study_builder->FindOrCreateAttribute( obj, "AttributeName" ); + attname = SALOMEDS::AttributeName::_narrow( attrib ); + attname->SetValue (name); + /// ----------- Fin de SetName + // study_builder->CommitCommand(); ??? + return HOK; +} +// =========================================================== Version information + +char* HEXABLOCK_Gen_i::getVersion() +{ +#if HEXABLOCK_DEVELOPMENT + return CORBA::string_dup(HEXABLOCK_VERSION_STR"dev"); +#else + return CORBA::string_dup(HEXABLOCK_VERSION_STR); +#endif } diff --git a/src/HEXABLOCK_I/HEXABLOCK.hxx b/src/HEXABLOCK_I/HEXABLOCK.hxx index 6a7b164..23b68cb 100755 --- a/src/HEXABLOCK_I/HEXABLOCK.hxx +++ b/src/HEXABLOCK_I/HEXABLOCK.hxx @@ -141,6 +141,7 @@ public: Document_ptr getDocument(::CORBA::Long i); void removeDocument(Document_ptr d); //CS_TODO Document_ptr addDocument (const char* name); + Document_ptr findDocument (const char* name); Document_ptr loadDocument (const char* xmlFilename); GEOM_Client* getGeomClient(); @@ -178,9 +179,11 @@ public: - Document_ptr createDoc(const char* name) + Document_ptr createDoc (const char* name) throw ( SALOME::SALOME_Exception ); - Document_ptr createDocInStudy(const char* name) + Document_ptr createDocInStudy (const char* name) + throw ( SALOME::SALOME_Exception ); + CORBA::Long addDocInStudy (Document_ptr doc) throw ( SALOME::SALOME_Exception ); //-----------------------------------------------------------------------// @@ -234,6 +237,7 @@ public : CORBA::Boolean isMultiFile, CORBA::Boolean isASCII); + char* getVersion(); #if 0 virtual std::string GetIOR(); @@ -325,6 +329,8 @@ private : map myStudyContextMap; // Map of study context objects SALOMEDS::Study_var myCurrentStudy; // Current study + bool first_document; + }; extern "C" diff --git a/src/HEXABLOCK_I/HEXABLOCK_1.cxx b/src/HEXABLOCK_I/HEXABLOCK_1.cxx index 26491b5..75fcaa9 100644 --- a/src/HEXABLOCK_I/HEXABLOCK_1.cxx +++ b/src/HEXABLOCK_I/HEXABLOCK_1.cxx @@ -19,11 +19,6 @@ #include "HEXABLOCK.hxx" -// #include "SMESH_Mesh_i.hxx" -// #include "SMESH_Hypothesis_i.hxx" -// #include "SMESH_Algo_i.hxx" -// #include "SMESH_Group_i.hxx" -// #include "SMESH_subMesh_i.hxx" #include "SALOME_NamingService.hxx" @@ -34,114 +29,11 @@ #include -// #ifdef _DEBUG_ -// static int MYDEBUG = 0; -// static int VARIABLE_DEBUG = 0; -// #else -// static int MYDEBUG = 0; -// static int VARIABLE_DEBUG = 0; -// #endif - static int MYDEBUG = 1; using namespace HEXABLOCK_ORB; - -//============================================================================= -/*! - * Get...Tag [ static ] - * - * Methods which determine SMESH data model structure - */ -//============================================================================= - -// long SMESH_Gen_i::GetHypothesisRootTag() -// { -// return SMESH::Tag_HypothesisRoot; -// } -// -// long SMESH_Gen_i::GetAlgorithmsRootTag() -// { -// return SMESH::Tag_AlgorithmsRoot; -// } -// -// long SMESH_Gen_i::GetRefOnShapeTag() -// { -// return SMESH::Tag_RefOnShape; -// } -// -// long SMESH_Gen_i::GetRefOnAppliedHypothesisTag() -// { -// return SMESH::Tag_RefOnAppliedHypothesis; -// } -// -// long SMESH_Gen_i::GetRefOnAppliedAlgorithmsTag() -// { -// return SMESH::Tag_RefOnAppliedAlgorithms; -// } -// -// long SMESH_Gen_i::GetSubMeshOnVertexTag() -// { -// return SMESH::Tag_SubMeshOnVertex; -// } -// -// long SMESH_Gen_i::GetSubMeshOnEdgeTag() -// { -// return SMESH::Tag_SubMeshOnEdge; -// } -// -// long SMESH_Gen_i::GetSubMeshOnFaceTag() -// { -// return SMESH::Tag_SubMeshOnFace; -// } -// -// long SMESH_Gen_i::GetSubMeshOnSolidTag() -// { -// return SMESH::Tag_SubMeshOnSolid; -// } -// -// long SMESH_Gen_i::GetSubMeshOnCompoundTag() -// { -// return SMESH::Tag_SubMeshOnCompound; -// } -// -// long SMESH_Gen_i::GetSubMeshOnWireTag() -// { -// return SMESH::Tag_SubMeshOnWire; -// } -// -// long SMESH_Gen_i::GetSubMeshOnShellTag() -// { -// return SMESH::Tag_SubMeshOnShell; -// } -// -// long SMESH_Gen_i::GetNodeGroupsTag() -// { -// return SMESH::Tag_NodeGroups; -// } -// -// long SMESH_Gen_i::GetEdgeGroupsTag() -// { -// return SMESH::Tag_EdgeGroups; -// } -// -// long SMESH_Gen_i::GetFaceGroupsTag() -// { -// return SMESH::Tag_FaceGroups; -// } -// -// long SMESH_Gen_i::GetVolumeGroupsTag() -// { -// return SMESH::Tag_VolumeGroups; -// } -// -// long SMESH_Gen_i::Get0DElementsGroupsTag() -// { -// return SMESH::Tag_0DElementsGroups; -// } - - //============================================================================= /*! * SMESH_Gen_i::CanPublishInStudy @@ -151,7 +43,6 @@ using namespace HEXABLOCK_ORB; //============================================================================= bool HEXABLOCK_Gen_i::CanPublishInStudy(CORBA::Object_ptr theIOR) { - if(MYDEBUG) MESSAGE("CanPublishInStudy - "<_is_nil() ) return true; -// SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(theIOR); -// if( !aSubMesh->_is_nil() ) -// return true; -// -// SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow(theIOR); -// if( !aHyp->_is_nil() ) -// return true; -// -// SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(theIOR); -// if( !aGroup->_is_nil() ) -// return true; - if(MYDEBUG) MESSAGE("CanPublishInStudy--CANT"); return false; } @@ -192,65 +71,6 @@ SALOMEDS::SObject_ptr HEXABLOCK_Gen_i::ObjectToSObject( SALOMEDS::Study_ptr theS return aSO._retn(); } -//======================================================================= -//function : objectToServant -//purpose : -//======================================================================= - -// template static inline T* objectToServant( CORBA::Object_ptr theIOR ) -// { -// return dynamic_cast( SMESH_Gen_i::GetServant( theIOR ).in() ); -// } - -//======================================================================= -//function : ShapeToGeomObject -//purpose : -//======================================================================= - -// GEOM::GEOM_Object_ptr SMESH_Gen_i::ShapeToGeomObject (const TopoDS_Shape& theShape ) -// { -// GEOM::GEOM_Object_var aShapeObj; -// if ( !theShape.IsNull() ) { -// GEOM_Client* aClient = GetShapeReader(); -// TCollection_AsciiString IOR; -// if ( aClient && aClient->Find( theShape, IOR )) -// { -// CORBA::Object_var obj = GetORB()->string_to_object( IOR.ToCString() ); -// aShapeObj = GEOM::GEOM_Object::_narrow ( obj ); -// } -// } -// return aShapeObj._retn(); -// } - -//======================================================================= -//function : GeomObjectToShape -//purpose : -//======================================================================= - -// TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject) -// { -// TopoDS_Shape S; -// if ( !theGeomObject->_is_nil() ) { -// GEOM_Client* aClient = GetShapeReader(); -// GEOM::GEOM_Gen_ptr aGeomEngine = GetGeomEngine(); -// if ( aClient && !aGeomEngine->_is_nil () ) -// S = aClient->GetShape( aGeomEngine, theGeomObject ); -// } -// return S; -// } - - - - - - - - - - - - - //======================================================================= @@ -287,10 +107,6 @@ static SALOMEDS::SObject_ptr publish(SALOMEDS::Study_ptr theStudy, pm->SetPixMap( thePixMap ); } -// if ( !theSelectable ) { -// anAttr = aStudyBuilder->FindOrCreateAttribute( SO, "AttributeSelectable" ); -// SALOMEDS::AttributeSelectable::_narrow( anAttr )->SetSelectable( false ); -// } return SO._retn(); } @@ -304,139 +120,27 @@ std::string HEXABLOCK_Gen_i::SetName( SALOMEDS::SObject_ptr theSObject, const char* theDefaultName ) { std::string attrName; - if ( !theSObject->_is_nil() ) { - SALOMEDS::StudyBuilder_var aStudyBuilder = theSObject->GetStudy()->NewBuilder(); - SALOMEDS::GenericAttribute_var anAttr = + if (theSObject->_is_nil() ) + return attrName; + + SALOMEDS::StudyBuilder_var aStudyBuilder = theSObject->GetStudy()->NewBuilder(); + SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute( theSObject, "AttributeName" ); - SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr ); + SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow( anAttr ); if ( theName && strlen( theName ) != 0 ) -// aNameAttr->SetValue( theName ); attrName = theName; else { CORBA::String_var curName = CORBA::string_dup( aNameAttr->Value() ); if ( strlen( curName ) == 0 ) { TCollection_AsciiString aName( (char*) theDefaultName ); - aName += TCollection_AsciiString("_") + TCollection_AsciiString( theSObject->Tag() ); attrName = aName.ToCString(); -// aNameAttr->SetValue( aName.ToCString() ); } } - aNameAttr->SetValue( attrName.c_str() ); - } + + aNameAttr->SetValue( attrName.c_str() ); return attrName; } -//======================================================================= -//function : SetPixMap -//purpose : -//======================================================================= -// void SMESH_Gen_i::SetPixMap(SALOMEDS::SObject_ptr theSObject, -// const char* thePixMap) -// { -// if ( !theSObject->_is_nil() && thePixMap && strlen( thePixMap )) -// { -// SALOMEDS::Study_var aStudy = theSObject->GetStudy(); -// SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); -// SALOMEDS::GenericAttribute_var anAttr = -// aStudyBuilder->FindOrCreateAttribute( theSObject, "AttributePixMap" ); -// SALOMEDS::AttributePixMap_var aPMAttr = SALOMEDS::AttributePixMap::_narrow( anAttr ); -// aPMAttr->SetPixMap( thePixMap ); -// } -// } - -//======================================================================= -//function : addReference -//purpose : -//======================================================================= - -// static void addReference (SALOMEDS::Study_ptr theStudy, -// SALOMEDS::SObject_ptr theSObject, -// CORBA::Object_ptr theToObject, -// int theTag = 0) -// { -// SALOMEDS::SObject_var aToObjSO = SMESH_Gen_i::ObjectToSObject( theStudy, theToObject ); -// if ( !aToObjSO->_is_nil() && !theSObject->_is_nil() ) { -// SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); -// SALOMEDS::SObject_var aReferenceSO; -// if ( !theTag ) { -// // check if the reference to theToObject already exists -// // and find a free label for the reference object -// bool isReferred = false; -// int tag = 1; -// SALOMEDS::ChildIterator_var anIter = theStudy->NewChildIterator( theSObject ); -// for ( ; !isReferred && anIter->More(); anIter->Next(), ++tag ) { -// if ( anIter->Value()->ReferencedObject( aReferenceSO )) { -// if ( strcmp( aReferenceSO->GetID(), aToObjSO->GetID() ) == 0 ) -// isReferred = true; -// } -// else if ( !theTag ) { -// SALOMEDS::GenericAttribute_var anAttr; -// if ( !anIter->Value()->FindAttribute( anAttr, "AttributeIOR" )) -// theTag = tag; -// } -// } -// if ( isReferred ) -// return; -// if ( !theTag ) -// theTag = tag; -// } -// if ( !theSObject->FindSubObject( theTag, aReferenceSO )) -// aReferenceSO = aStudyBuilder->NewObjectToTag( theSObject, theTag ); -// aStudyBuilder->Addreference( aReferenceSO, aToObjSO ); -// } -// } - -//============================================================================= -/*! - * SMESH_Gen_i::PublishInStudy - * - * Publish object in the study - */ -//============================================================================= - -// SALOMEDS::SObject_ptr HEXABLOCK_Gen_i::PublishInStudy( SALOMEDS::Study_ptr theStudy, -// SALOMEDS::SObject_ptr theSObject, -// CORBA::Object_ptr theIOR, -// const char* theName ) -// throw (SALOME::SALOME_Exception) -// { -// Unexpect aCatch(SALOME_SalomeException); -// SALOMEDS::SObject_var aSO; -// if ( CORBA::is_nil( theStudy ) || CORBA::is_nil( theIOR )) -// return aSO._retn(); -// if(MYDEBUG) MESSAGE("PublishInStudy"); -// -// // Publishing a mesh -// // SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( theIOR ); -// HEXABLOCK_Gen_i::Document_var aDoc = HEXABLOCK_Gen_i::Document::_narrow( theIOR ); -// if( !aDoc->_is_nil() ) -// aSO = PublishDoc( theStudy, aDoc, theName ); -// -// // // Publishing a sub-mesh -// // SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow( theIOR ); -// // if( aSO->_is_nil() && !aSubMesh->_is_nil() ) { -// // GEOM::GEOM_Object_var aShapeObject = aSubMesh->GetSubShape(); -// // aMesh = aSubMesh->GetFather(); -// // aSO = PublishSubMesh( theStudy, aMesh, aSubMesh, aShapeObject, theName ); -// // } -// // -// // // Publishing a hypothesis or algorithm -// // SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( theIOR ); -// // if ( aSO->_is_nil() && !aHyp->_is_nil() ) -// // aSO = PublishHypothesis( theStudy, aHyp ); -// // -// // // Publishing a group -// // SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(theIOR); -// // if ( aSO->_is_nil() && !aGroup->_is_nil() ) { -// // GEOM::GEOM_Object_var aShapeObject; -// // aMesh = aGroup->GetMesh(); -// // aSO = PublishGroup( theStudy, aMesh, aGroup, aShapeObject, theName ); -// // } -// if(MYDEBUG) MESSAGE("PublishInStudy_END"); -// -// return aSO._retn(); -// } - // ======================================================================= // function : PublishComponent // purpose : @@ -445,24 +149,20 @@ SALOMEDS::SComponent_ptr HEXABLOCK_Gen_i::PublishComponent(SALOMEDS::Study_ptr t { if ( CORBA::is_nil( theStudy )) return SALOMEDS::SComponent::_nil(); - if(MYDEBUG) MESSAGE("PublishComponent"); SALOMEDS::SComponent_var father = SALOMEDS::SComponent::_narrow( theStudy->FindComponent( ComponentDataType() ) ); if ( !CORBA::is_nil( father ) ) return father._retn(); - MESSAGE("AAAAAAAAAAA"); SALOME_ModuleCatalog::ModuleCatalog_var aCat = SALOME_ModuleCatalog::ModuleCatalog::_narrow( GetNS()->Resolve("/Kernel/ModulCatalog") ); if ( CORBA::is_nil( aCat ) ) return father._retn(); - MESSAGE("BBBBBBBBBBB"); SALOME_ModuleCatalog::Acomponent_var aComp = aCat->GetComponent( ComponentDataType() ); if ( CORBA::is_nil( aComp ) ) return father._retn(); - MESSAGE("CCCCCCCCCCC"); SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; @@ -470,16 +170,12 @@ SALOMEDS::SComponent_ptr HEXABLOCK_Gen_i::PublishComponent(SALOMEDS::Study_ptr t father = aStudyBuilder->NewComponent( ComponentDataType() ); aStudyBuilder->DefineComponentInstance( father, HEXABLOCK_Gen_i::_this() ); -// aStudyBuilder->DefineComponentInstance( father, _orb->object_to_string( HEXABLOCK_Gen_i::_this() ) ); -// MESSAGE("PublishComponent-- _orb->object_to_string( this ) =>"<< _orb->object_to_string( this ) ); - MESSAGE("PublishComponent-- HEXABLOCK_Gen_i::_this() =>"<< HEXABLOCK_Gen_i::_this() ); anAttr = aStudyBuilder->FindOrCreateAttribute( father, "AttributePixMap" ); aPixmap = SALOMEDS::AttributePixMap::_narrow( anAttr ); aPixmap ->SetPixMap( "ICON_OBJBROWSER_HEXABLOCK" ); SetName( father, aComp->componentusername(), "HEXABLOCK" ); - if(MYDEBUG) MESSAGE("PublishComponent--END"); return father._retn(); } @@ -521,173 +217,6 @@ SALOMEDS::SComponent_ptr HEXABLOCK_Gen_i::PublishComponent(SALOMEDS::Study_ptr t - - - - - - - - - - - - - - -// SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, -// SALOMEDS::SObject_ptr theSObject, -// CORBA::Object_ptr theObject, -// const char* theName) throw (SALOME::SALOME_Exception) -// { -// Unexpect aCatch(SALOME_SalomeException); -// SALOMEDS::SObject_var aResultSO; -// if(CORBA::is_nil(theObject) || theStudy->_is_nil()) return aResultSO; -// -// -// GEOM::GEOM_Object_var aShape = GEOM::GEOM_Object::_narrow(theObject); -// if(aShape->_is_nil()) return aResultSO; -// -// SALOMEDS::GenericAttribute_var anAttr; -// SALOMEDS::StudyBuilder_var aStudyBuilder = theStudy->NewBuilder(); -// -// SALOMEDS::SComponent_var aFather = theStudy->FindComponent("GEOM"); -// if (aFather->_is_nil()) { -// aFather = aStudyBuilder->NewComponent("GEOM"); -// anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributeName"); -// SALOMEDS::AttributeName_var aName = SALOMEDS::AttributeName::_narrow(anAttr); -// aName->SetValue("Geometry"); -// aName->UnRegister(); -// anAttr = aStudyBuilder->FindOrCreateAttribute(aFather, "AttributePixMap"); -// SALOMEDS::AttributePixMap_var aPixMap=SALOMEDS::AttributePixMap::_narrow(anAttr); -// aPixMap->SetPixMap("ICON_OBJBROWSER_Geometry"); -// aPixMap->UnRegister(); -// aStudyBuilder->DefineComponentInstance(aFather, (GEOM::GEOM_Gen_var)GEOM_Gen::_this()); -// } -// if (aFather->_is_nil()) return aResultSO; -// -// if (CORBA::is_nil(theSObject)) { -// aResultSO = aStudyBuilder->NewObject(aFather); -// } else { -// if (!theSObject->ReferencedObject(aResultSO)) -// aResultSO = SALOMEDS::SObject::_duplicate(theSObject); //SRN: Added Aug 24,2004 : for the method AddInStudy with theFather argumenet != NULL -// //THROW_SALOME_CORBA_EXCEPTION("Publish in study supervision graph error",SALOME::BAD_PARAM); -// } -// CORBA::String_var aGeomObjIOR = _orb->object_to_string(theObject); -// aResultSO->SetAttrString("AttributeIOR",aGeomObjIOR); -// -// TCollection_AsciiString aShapeName("Shape_"); -// -// CORBA::Long mytype=aShape->GetType(); -// if ( mytype == GEOM_GROUP ) { -// GEOM::GEOM_IGroupOperations_var anOp = GetIGroupOperations( theStudy->StudyId() ); -// switch ( (TopAbs_ShapeEnum)anOp->GetType( aShape ) ) { -// case TopAbs_VERTEX: -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_PNT" ); -// aShapeName = "Group_Of_Vertices_"; -// break; -// case TopAbs_EDGE: -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_EDGE"); -// aShapeName = "Group_Of_Edges_"; -// break; -// case TopAbs_FACE: -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_FACE"); -// aShapeName = "Group_Of_Faces_"; -// break; -// case TopAbs_SOLID: -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_SOLID"); -// aShapeName = "Group_Of_Solids_"; -// break; -// } -// } else if ( mytype == GEOM_MARKER ) { -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_LCS"); -// aShapeName = "LocalCS_"; -// } else if ( mytype > ADVANCED_BASE ) { -// char buf[20]; -// sprintf( buf, "%d", aShape->GetType() ); -// std::string advId = "ICON_OBJBROWSER_ADVANCED_"; advId += buf; -// aResultSO->SetAttrString("AttributePixMap",advId.c_str()); -// aShapeName = "Advanced_"; -// } else { -// GEOM::shape_type myshapetype=aShape->GetShapeType(); -// if ( myshapetype == GEOM::COMPOUND ) { -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPOUND" ); -// aShapeName = "Compound_"; -// } else if ( myshapetype == GEOM::COMPSOLID ) { -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_COMPSOLID"); -// aShapeName = "Compsolid_"; -// } else if ( myshapetype == GEOM::SOLID ) { -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SOLID"); -// aShapeName = "Solid_"; -// } else if ( myshapetype == GEOM::SHELL ) { -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_SHELL"); -// aShapeName = "Shell_"; -// } else if ( myshapetype == GEOM::FACE ) { -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_FACE"); -// aShapeName = "Face_"; -// } else if ( myshapetype == GEOM::WIRE ) { -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_WIRE"); -// aShapeName = "Wire_"; -// } else if ( myshapetype == GEOM::EDGE ) { -// aResultSO->SetAttrString("AttributePixMap", "ICON_OBJBROWSER_EDGE"); -// aShapeName = "Edge_"; -// } else if ( myshapetype == GEOM::VERTEX ) { -// aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_VERTEX" ); -// aShapeName = "Vertex_"; -// } -// } -// //if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag()); -// //else aShapeName = TCollection_AsciiString(CORBA::string_dup(theName)); -// -// // BEGIN: try to find existed name for current shape -// bool HasName = false; -// // recieve current TopoDS shape -// CORBA::String_var entry = aShape->GetEntry(); -// Handle(GEOM_Object) aGShape = _impl->GetObject(aShape->GetStudyID(), entry); -// TopoDS_Shape TopoSh = aGShape->GetValue(); -// // find label of main shape -// GEOM::GEOM_Object_var aMainSh = aShape; -// while( !aMainSh->IsMainShape() ) { -// aMainSh = aMainSh->GetMainShape(); -// } -// entry = aMainSh->GetEntry(); -// Handle(GEOM_Object) anObj = _impl->GetObject(aMainSh->GetStudyID(), entry); -// TDF_Label aMainLbl = anObj->GetFunction(1)->GetNamingEntry(); -// -// // check all named shapes using iterator -// TDF_ChildIDIterator anIt (aMainLbl, TNaming_NamedShape::GetID(), Standard_True); -// -// for (; anIt.More() && !HasName; anIt.Next()) { -// Handle(TNaming_NamedShape) anAttr = -// Handle(TNaming_NamedShape)::DownCast(anIt.Value()); -// if (anAttr.IsNull()) continue; -// TopoDS_Shape S = anAttr->Get(); -// if (S.IsEqual(TopoSh)) { -// TDF_Label L = anAttr->Label(); -// Handle(TDataStd_Name) aName; -// if (L.FindAttribute(TDataStd_Name::GetID(), aName)) { -// aShapeName = aName->Get(); -// HasName = true; -// } -// } -// } -// // END: try to find existed name for current shape -// -// -// aResultSO->SetAttrString("AttributeString",aVars.ToCString()); -// -// aFather->UnRegister(); -// -// //Set a name of the GEOM object -// aShape->SetName(aShapeName.ToCString()); -// -// return aResultSO._retn(); -// } - - - - - //============================================================================= /*! * findMaxChildTag [ static internal ] @@ -724,7 +253,6 @@ SALOMEDS::SObject_ptr HEXABLOCK_Gen_i::PublishDoc ( SALOMEDS::Study_ptr theS if ( CORBA::is_nil( theStudy ) || CORBA::is_nil( theDoc )) return SALOMEDS::SComponent::_nil(); - if(MYDEBUG) MESSAGE("PublishMesh--IN"); // find or publish a mesh @@ -737,532 +265,16 @@ SALOMEDS::SObject_ptr HEXABLOCK_Gen_i::PublishDoc ( SALOMEDS::Study_ptr theS // Find correct free tag long aTag = findMaxChildTag( father.in() ); -// if ( aTag <= GetAlgorithmsRootTag() ) -// aTag = GetAlgorithmsRootTag() + 1; -// else -// aTag++; aTag++; - aDocSO = publish (theStudy, theDoc, father, aTag);//, "ICON_DOC_TREE_MESH_WARN" ); + aDocSO = publish (theStudy, theDoc, father, aTag); if ( aDocSO->_is_nil() ) return aDocSO._retn(); } std::string docName = SetName( aDocSO, theName, theDoc->getName()); // Bph - // theDoc->setName( docName.c_str() ); // Abu // Add shape reference -// GEOM::GEOM_Object_var aShapeObject = theMesh->GetShapeToMesh(); -// if ( !CORBA::is_nil( aShapeObject )) { -// addReference( theStudy, aMeshSO, aShapeObject, GetRefOnShapeTag() ); -// -// // Publish global hypotheses -// -// SMESH::ListOfHypothesis_var hypList = theMesh->GetHypothesisList( aShapeObject ); -// for ( int i = 0; i < hypList->length(); i++ ) { -// SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( hypList[ i ]); -// PublishHypothesis( theStudy, aHyp ); -// AddHypothesisToShape( theStudy, theMesh, aShapeObject, aHyp ); -// } -// } -// -// // Publish submeshes -// -// SMESH_Mesh_i* mesh_i = objectToServant( theMesh ); -// if ( !mesh_i ) -// return aMeshSO._retn(); -// map& subMap = mesh_i->_mapSubMesh_i; -// map::iterator subIt = subMap.begin(); -// for ( ; subIt != subMap.end(); subIt++ ) { -// SMESH::SMESH_subMesh_ptr aSubMesh = (*subIt).second->_this(); -// if ( !CORBA::is_nil( aSubMesh )) { -// aShapeObject = aSubMesh->GetSubShape(); -// PublishSubMesh( theStudy, theMesh, aSubMesh, aShapeObject ); -// } -// } -// -// // Publish groups -// const map& grMap = mesh_i->getGroups(); -// map::const_iterator it = grMap.begin(); -// for ( ; it != grMap.end(); it++ ) -// { -// SMESH::SMESH_GroupBase_ptr aGroup = (*it).second; -// if ( !aGroup->_is_nil() ) { -// GEOM::GEOM_Object_var aShapeObj; -// SMESH::SMESH_GroupOnGeom_var aGeomGroup = -// SMESH::SMESH_GroupOnGeom::_narrow( aGroup ); -// if ( !aGeomGroup->_is_nil() ) -// aShapeObj = aGeomGroup->GetShape(); -// PublishGroup( theStudy, theMesh, aGroup, aShapeObj ); -// } -// } - if(MYDEBUG) MESSAGE("PublishDoc_END"); return aDocSO._retn(); } -//======================================================================= -//function : PublishSubMesh -//purpose : -//======================================================================= - -// SALOMEDS::SObject_ptr SMESH_Gen_i::PublishSubMesh (SALOMEDS::Study_ptr theStudy, -// SMESH::SMESH_Mesh_ptr theMesh, -// SMESH::SMESH_subMesh_ptr theSubMesh, -// GEOM::GEOM_Object_ptr theShapeObject, -// const char* theName) -// { -// if (theStudy->_is_nil() || theMesh->_is_nil() || -// theSubMesh->_is_nil() || theShapeObject->_is_nil() ) -// return SALOMEDS::SObject::_nil(); -// -// SALOMEDS::SObject_var aSubMeshSO = ObjectToSObject( theStudy, theSubMesh ); -// if ( aSubMeshSO->_is_nil() ) -// { -// SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh ); -// if ( aMeshSO->_is_nil() ) { -// aMeshSO = PublishMesh( theStudy, theMesh ); -// if ( aMeshSO->_is_nil()) -// return SALOMEDS::SObject::_nil(); -// } -// // Find submesh sub-tree tag -// long aRootTag; -// const char* aRootName = ""; -// switch ( theShapeObject->GetShapeType() ) { -// case GEOM::VERTEX: -// aRootTag = GetSubMeshOnVertexTag(); -// aRootName = "SubMeshes on Vertex"; -// break; -// case GEOM::EDGE: -// aRootTag = GetSubMeshOnEdgeTag(); -// aRootName = "SubMeshes on Edge"; -// break; -// case GEOM::WIRE: -// aRootTag = GetSubMeshOnWireTag(); -// aRootName = "SubMeshes on Wire"; -// break; -// case GEOM::FACE: -// aRootTag = GetSubMeshOnFaceTag(); -// aRootName = "SubMeshes on Face"; -// break; -// case GEOM::SHELL: -// aRootTag = GetSubMeshOnShellTag(); -// aRootName = "SubMeshes on Shell"; -// break; -// case GEOM::SOLID: -// aRootTag = GetSubMeshOnSolidTag(); -// aRootName = "SubMeshes on Solid"; -// break; -// default: -// aRootTag = GetSubMeshOnCompoundTag(); -// aRootName = "SubMeshes on Compound"; -// break; -// } -// -// // Find or create submesh root -// SALOMEDS::SObject_var aRootSO = publish (theStudy, CORBA::Object::_nil(), -// aMeshSO, aRootTag, 0, false ); -// SetName( aRootSO, aRootName ); -// -// // Add new submesh to corresponding sub-tree -// aSubMeshSO = publish (theStudy, theSubMesh, aRootSO, 0, "ICON_SMESH_TREE_MESH_WARN"); -// if ( aSubMeshSO->_is_nil() ) -// return aSubMeshSO._retn(); -// } -// SetName( aSubMeshSO, theName, "SubMesh" ); -// -// // Add reference to theShapeObject -// -// addReference( theStudy, aSubMeshSO, theShapeObject, 1 ); -// -// // Publish hypothesis -// -// SMESH::ListOfHypothesis * hypList = theMesh->GetHypothesisList( theShapeObject ); -// if ( hypList ) -// for ( int i = 0; i < hypList->length(); i++ ) { -// SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( (*hypList)[ i ]); -// PublishHypothesis( theStudy, aHyp ); -// AddHypothesisToShape( theStudy, theMesh, theShapeObject, aHyp ); -// } -// -// return aSubMeshSO._retn(); -// } - -//======================================================================= -//function : PublishGroup -//purpose : -//======================================================================= - -// SALOMEDS::SObject_ptr SMESH_Gen_i::PublishGroup (SALOMEDS::Study_ptr theStudy, -// SMESH::SMESH_Mesh_ptr theMesh, -// SMESH::SMESH_GroupBase_ptr theGroup, -// GEOM::GEOM_Object_ptr theShapeObject, -// const char* theName) -// { -// if (theStudy->_is_nil() || theMesh->_is_nil() || theGroup->_is_nil() ) -// return SALOMEDS::SObject::_nil(); -// -// SALOMEDS::SObject_var aGroupSO = ObjectToSObject( theStudy, theGroup ); -// if ( aGroupSO->_is_nil() ) -// { -// SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh ); -// if ( aMeshSO->_is_nil() ) { -// aMeshSO = PublishInStudy( theStudy, SALOMEDS::SObject::_nil(), theMesh, ""); -// if ( aMeshSO->_is_nil()) -// return SALOMEDS::SObject::_nil(); -// } -// int aType = (int)theGroup->GetType(); -// const char* aRootNames[] = { -// "Compound Groups", "Groups of Nodes", "Groups of Edges", -// "Groups of Faces", "Groups of Volumes", "Groups of 0D Elements" }; -// -// // Currently, groups with heterogenous content are not supported -// if ( aType != SMESH::ALL ) { -// long aRootTag = GetNodeGroupsTag() + aType - 1; -// -// // Find or create groups root -// SALOMEDS::SObject_var aRootSO = publish (theStudy, CORBA::Object::_nil(), -// aMeshSO, aRootTag, 0, false ); -// if ( aType < 6 ) -// SetName( aRootSO, aRootNames[aType] ); -// -// // Add new group to corresponding sub-tree -// aGroupSO = publish (theStudy, theGroup, aRootSO, 0, "ICON_SMESH_TREE_GROUP" ); -// } -// if ( aGroupSO->_is_nil() ) -// return aGroupSO._retn(); -// } -// -// SetName( aGroupSO, theName, "Group" ); -// -// //Add reference to geometry -// if ( !theShapeObject->_is_nil() ) -// addReference( theStudy, aGroupSO, theShapeObject, 1 ); -// -// return aGroupSO._retn(); -// } - -//======================================================================= -//function : PublishHypothesis -//purpose : -//======================================================================= - -// SALOMEDS::SObject_ptr -// SMESH_Gen_i::PublishHypothesis (SALOMEDS::Study_ptr theStudy, -// SMESH::SMESH_Hypothesis_ptr theHyp, -// const char* theName) -// { -// if(MYDEBUG) MESSAGE("PublishHypothesis") -// if (theStudy->_is_nil() || theHyp->_is_nil()) -// return SALOMEDS::SObject::_nil(); -// -// SALOMEDS::SObject_var aHypSO = ObjectToSObject( theStudy, theHyp ); -// if ( aHypSO->_is_nil() ) -// { -// SALOMEDS::SComponent_var father = PublishComponent( theStudy ); -// if ( father->_is_nil() ) -// return aHypSO._retn(); -// -// //Find or Create Hypothesis root -// bool isAlgo = ( !SMESH::SMESH_Algo::_narrow( theHyp )->_is_nil() ); -// int aRootTag = isAlgo ? GetAlgorithmsRootTag() : GetHypothesisRootTag(); -// SALOMEDS::SObject_var aRootSO = -// publish (theStudy, CORBA::Object::_nil(),father, aRootTag, -// isAlgo ? "ICON_SMESH_TREE_ALGO" : "ICON_SMESH_TREE_HYPO", false); -// SetName( aRootSO, isAlgo ? "Algorithms" : "Hypotheses" ); -// -// // Add New Hypothesis -// string aPmName = isAlgo ? "ICON_SMESH_TREE_ALGO_" : "ICON_SMESH_TREE_HYPO_"; -// aPmName += theHyp->GetName(); -// // prepend plugin name to pixmap name -// string pluginName = myHypCreatorMap[string(theHyp->GetName())]->GetModuleName(); -// if ( pluginName != "StdMeshers" ) -// aPmName = pluginName + "::" + aPmName; -// aHypSO = publish( theStudy, theHyp, aRootSO, 0, aPmName.c_str() ); -// } -// -// if ( !aHypSO->_is_nil() ) { -// CORBA::String_var aHypName = CORBA::string_dup( theHyp->GetName() ); -// SetName( aHypSO, theName, aHypName ); -// } -// -// if(MYDEBUG) MESSAGE("PublishHypothesis--END") -// return aHypSO._retn(); -// } - -//======================================================================= -//function : GetMeshOrSubmeshByShape -//purpose : -//======================================================================= - -// SALOMEDS::SObject_ptr -// SMESH_Gen_i::GetMeshOrSubmeshByShape (SALOMEDS::Study_ptr theStudy, -// SMESH::SMESH_Mesh_ptr theMesh, -// GEOM::GEOM_Object_ptr theShape) -// { -// if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape") -// SALOMEDS::SObject_var aMeshOrSubMesh; -// if (theMesh->_is_nil() || ( theShape->_is_nil() && theMesh->HasShapeToMesh())) -// return aMeshOrSubMesh._retn(); -// -// TopoDS_Shape aShape; -// if(theMesh->HasShapeToMesh()) -// aShape = GeomObjectToShape( theShape ); -// else -// aShape = SMESH_Mesh::PseudoShape(); -// -// SMESH_Mesh_i* mesh_i = objectToServant( theMesh ); -// -// if ( !aShape.IsNull() && mesh_i && mesh_i->GetImpl().GetMeshDS() ) { -// SMESHDS_Mesh* meshDS = mesh_i->GetImpl().GetMeshDS(); -// if ( aShape.IsSame( meshDS->ShapeToMesh() )) -// aMeshOrSubMesh = ObjectToSObject( theStudy, theMesh ); -// else { -// int shapeID = meshDS->ShapeToIndex( aShape ); -// SMESH::SMESH_subMesh_var aSubMesh = mesh_i->getSubMesh(shapeID); -// if ( !aSubMesh->_is_nil() ) -// aMeshOrSubMesh = ObjectToSObject( theStudy, aSubMesh ); -// } -// } -// if(MYDEBUG) MESSAGE("GetMeshOrSubmeshByShape--END") -// return aMeshOrSubMesh._retn(); -// } - -//======================================================================= -//function : AddHypothesisToShape -//purpose : -//======================================================================= - -// bool SMESH_Gen_i::AddHypothesisToShape(SALOMEDS::Study_ptr theStudy, -// SMESH::SMESH_Mesh_ptr theMesh, -// GEOM::GEOM_Object_ptr theShape, -// SMESH::SMESH_Hypothesis_ptr theHyp) -// { -// if(MYDEBUG) MESSAGE("AddHypothesisToShape") -// if (theStudy->_is_nil() || theMesh->_is_nil() || -// theHyp->_is_nil() || (theShape->_is_nil() -// && theMesh->HasShapeToMesh()) ) -// return false; -// -// SALOMEDS::SObject_var aMeshSO = ObjectToSObject( theStudy, theMesh ); -// if ( aMeshSO->_is_nil() ) -// aMeshSO = PublishMesh( theStudy, theMesh ); -// SALOMEDS::SObject_var aHypSO = PublishHypothesis( theStudy, theHyp ); -// if ( aMeshSO->_is_nil() || aHypSO->_is_nil()) -// return false; -// -// // Find a mesh or submesh refering to theShape -// SALOMEDS::SObject_var aMeshOrSubMesh = -// GetMeshOrSubmeshByShape( theStudy, theMesh, theShape ); -// if ( aMeshOrSubMesh->_is_nil() ) -// { -// // publish submesh -// TopoDS_Shape aShape = GeomObjectToShape( theShape ); -// SMESH_Mesh_i* mesh_i = objectToServant( theMesh ); -// if ( !aShape.IsNull() && mesh_i && mesh_i->GetImpl().GetMeshDS() ) { -// SMESHDS_Mesh* meshDS = mesh_i->GetImpl().GetMeshDS(); -// int shapeID = meshDS->ShapeToIndex( aShape ); -// SMESH::SMESH_subMesh_var aSubMesh = mesh_i->getSubMesh(shapeID); -// aMeshOrSubMesh = PublishSubMesh( theStudy, theMesh, aSubMesh, theShape ); -// } -// if ( aMeshOrSubMesh->_is_nil() ) -// return false; -// } -// -// //Find or Create Applied Hypothesis root -// bool aIsAlgo = !SMESH::SMESH_Algo::_narrow( theHyp )->_is_nil(); -// SALOMEDS::SObject_var AHR = -// publish (theStudy, CORBA::Object::_nil(), aMeshOrSubMesh, -// aIsAlgo ? GetRefOnAppliedAlgorithmsTag() : GetRefOnAppliedHypothesisTag(), -// aIsAlgo ? "ICON_SMESH_TREE_ALGO" : "ICON_SMESH_TREE_HYPO", false); -// SetName( AHR, aIsAlgo ? "Applied algorithms" : "Applied hypotheses" ); -// if ( AHR->_is_nil() ) -// return false; -// -// addReference( theStudy, AHR, theHyp ); -// if(MYDEBUG) MESSAGE("AddHypothesisToShape--END") -// return true; -// } - -//======================================================================= -//function : RemoveHypothesisFromShape -//purpose : -//======================================================================= - -// bool SMESH_Gen_i::RemoveHypothesisFromShape(SALOMEDS::Study_ptr theStudy, -// SMESH::SMESH_Mesh_ptr theMesh, -// GEOM::GEOM_Object_ptr theShape, -// SMESH::SMESH_Hypothesis_ptr theHyp) -// { -// if (theStudy->_is_nil() || theMesh->_is_nil() || -// theHyp->_is_nil() || (theShape->_is_nil() -// && theMesh->HasShapeToMesh())) -// return false; -// -// SALOMEDS::SObject_var aHypSO = ObjectToSObject( theStudy, theHyp ); -// if ( aHypSO->_is_nil() ) -// return false; -// -// // Find a mesh or submesh refering to theShape -// SALOMEDS::SObject_var aMeshOrSubMesh = -// GetMeshOrSubmeshByShape( theStudy, theMesh, theShape ); -// if ( aMeshOrSubMesh->_is_nil() ) -// return false; -// -// // Find and remove a reference to aHypSO -// SALOMEDS::SObject_var aRef, anObj; -// CORBA::String_var anID = CORBA::string_dup( aHypSO->GetID() ); -// SALOMEDS::ChildIterator_var it = theStudy->NewChildIterator( aMeshOrSubMesh ); -// for ( it->InitEx( true ); it->More(); it->Next() ) { -// anObj = it->Value(); -// if (anObj->ReferencedObject( aRef ) && strcmp( aRef->GetID(), anID ) == 0 ) { -// theStudy->NewBuilder()->RemoveObject( anObj ); -// break; -// } -// } -// return true; -// } - -//======================================================================= -//function : UpdateParameters -//purpose : -//======================================================================= -// void SMESH_Gen_i::UpdateParameters(CORBA::Object_ptr theObject, const char* theParameters) -// { -// -// if(VARIABLE_DEBUG) -// cout<<"UpdateParameters : "<_is_nil() || CORBA::is_nil(theObject)) -// return; -// -// SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject); -// if(aSObj->_is_nil()) -// return; -// -// SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); -// -// SALOMEDS::GenericAttribute_var aFindAttr; -// bool hasAttr = aSObj->FindAttribute(aFindAttr, "AttributeString"); -// if(VARIABLE_DEBUG) -// cout<<"Find Attribute "<FindOrCreateAttribute( aSObj, "AttributeString"); -// SALOMEDS::AttributeString_var aStringAttr = SALOMEDS::AttributeString::_narrow(anAttr); -// -// CORBA::String_var oldparVar = aStringAttr->Value(); -// CORBA::String_var inpparVar = ParseParameters(theParameters); -// TCollection_AsciiString aNewParams; -// TCollection_AsciiString aOldParameters(oldparVar.inout()); -// TCollection_AsciiString anInputParams(inpparVar.inout()); -// if(!hasAttr) -// aNewParams = anInputParams; -// else -// { -// int pos = aOldParameters.SearchFromEnd("|"); -// if(pos==-1) pos = 0; -// TCollection_AsciiString previousParamFull(aOldParameters.Split(pos)); -// TCollection_AsciiString previousParam(previousParamFull); -// TCollection_AsciiString theRepet("1"); -// pos = previousParam.SearchFromEnd(";*="); -// if(pos >= 0) -// { -// theRepet = previousParam.Split(pos+2); -// pos = pos-1; -// if(pos==-1) pos = 0; -// previousParam.Split(pos); -// } -// if(previousParam == anInputParams) -// { -// theRepet = theRepet.IntegerValue()+1; -// aNewParams = aOldParameters + previousParam + ";*=" + theRepet; -// } -// else -// { -// aNewParams = aOldParameters + previousParamFull + "|" + anInputParams; -// } -// } -// -// if(VARIABLE_DEBUG) -// { -// cout<<"Input Parameters : "<SetValue( aNewParams.ToCString() ); -// } - -//======================================================================= -//function : ParseParameters -//purpose : -//======================================================================= -// char* SMESH_Gen_i::ParseParameters(const char* theParameters) -// { -// //const char* aParameters = theParameters; -// // const char* aParameters = CORBA::string_dup(theParameters); -// TCollection_AsciiString anInputParams; -// SALOMEDS::Study_var aStudy = GetCurrentStudy(); -// if( !aStudy->_is_nil() ) { -// // SALOMEDS::ListOfListOfStrings_var aSections = aStudy->ParseVariables(theParameters); -// // for(int j=0;jlength();j++) { -// // SALOMEDS::ListOfStrings aVars= aSections[j]; -// // for(int i=0;iIsVariable(aVars[i].in()) ? -// // TCollection_AsciiString(aVars[i].in()) : TCollection_AsciiString(""); -// // if(i != aVars.length()-1) -// // anInputParams+=":"; -// // } -// // if(j!=aSections->length()-1) -// // anInputParams+="|"; -// // } -// TCollection_AsciiString paramStr( theParameters ); -// static TCollection_AsciiString separators(":|"); -// int beg = 0, end; -// char sep, *pParams = (char*)paramStr.ToCString(); -// while ( beg < paramStr.Length() ) -// { -// end = beg-1; -// while ( ++end < paramStr.Length() ) -// if ( pParams[end] == ':' || pParams[end] == '|') -// break; -// if ( end < paramStr.Length()) -// { -// sep = pParams[end]; -// pParams[end] = '\0'; -// } -// if ( aStudy->IsVariable( pParams+beg )) -// anInputParams += pParams+beg; -// if ( end < paramStr.Length() ) -// anInputParams += sep; -// else -// break; -// beg = end + 1; -// } -// } -// return CORBA::string_dup(anInputParams.ToCString()); -// } - -//======================================================================= -//function : GetParameters -//purpose : -//======================================================================= -// char* SMESH_Gen_i::GetParameters(CORBA::Object_ptr theObject) -// { -// TCollection_AsciiString aResult; -// -// SALOMEDS::Study_ptr aStudy = GetCurrentStudy(); -// SALOMEDS::SObject_var aSObj = ObjectToSObject(aStudy,theObject); -// -// if(!aStudy->_is_nil() && -// !CORBA::is_nil(theObject) && -// !aSObj->_is_nil()){ -// -// SALOMEDS::GenericAttribute_var anAttr; -// if ( aSObj->FindAttribute(anAttr, "AttributeString")) { -// aResult = TCollection_AsciiString(SALOMEDS::AttributeString::_narrow(anAttr)->Value()); -// } -// } -// -// return CORBA::string_dup( aResult.ToCString() ); -// } diff --git a/src/HEXABLOCK_I/HexBiCylinder_impl.cxx b/src/HEXABLOCK_I/HexBiCylinder_impl.cxx new file mode 100755 index 0000000..d7cce2c --- /dev/null +++ b/src/HEXABLOCK_I/HexBiCylinder_impl.cxx @@ -0,0 +1,170 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +using namespace std; +#include "hexa_base.hxx" +#include "HexVertex_impl.hxx" +#include "HexEdge_impl.hxx" +#include "HexQuad_impl.hxx" +#include "HexHexa_impl.hxx" +#include "HexCylinder_impl.hxx" +#include "HexBiCylinder_impl.hxx" +#include "HEXABLOCK.hxx" + + +BiCylinder_impl::BiCylinder_impl( HEXA_NS::BiCylinder *ptrCpp ) +{ + bi_cylinder_cpp = ptrCpp; +} + + +HEXA_NS::BiCylinder* BiCylinder_impl::GetImpl() +{ + return bi_cylinder_cpp; +} + + +Vertex_ptr BiCylinder_impl::getVertexIJK(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception) +{ + Vertex_ptr result = Vertex::_nil(); + HEXA_NS::Vertex* v = bi_cylinder_cpp->getVertexIJK(part, x, y, z); + if ( v != NULL ){ + Vertex_impl* servantCorba = new Vertex_impl(v); + result = servantCorba->_this(); + } + return result; +} + + +Edge_ptr BiCylinder_impl::getEdgeI(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception) +{ + Edge_ptr result = Edge::_nil(); + HEXA_NS::Edge* e = bi_cylinder_cpp->getEdgeI(part, x, y, z); + if ( e != NULL ){ + Edge_impl* servantCorba = new Edge_impl(e); + result = servantCorba->_this(); + } + return result; +} + + +Edge_ptr BiCylinder_impl::getEdgeJ(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception) +{ + Edge_ptr result = Edge::_nil(); + HEXA_NS::Edge* e = bi_cylinder_cpp->getEdgeJ(part, x, y, z); + if ( e != NULL ){ + Edge_impl* servantCorba = new Edge_impl(e); + result = servantCorba->_this(); + } + return result; +} + + +Edge_ptr BiCylinder_impl::getEdgeK(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception) +{ + Edge_ptr result = Edge::_nil(); + HEXA_NS::Edge* e = bi_cylinder_cpp->getEdgeK(part, x, y, z); + if ( e != NULL ){ + Edge_impl* servantCorba = new Edge_impl(e); + result = servantCorba->_this(); + } + return result; +} + +Quad_ptr BiCylinder_impl::getQuadIJ(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception) +{ + Quad_ptr result = Quad::_nil(); + HEXA_NS::Quad* q = bi_cylinder_cpp->getQuadIJ(part, x, y, z); + if ( q != NULL ){ + Quad_impl* servantCorba = new Quad_impl(q); + result = servantCorba->_this(); + } + return result; +} + + +Quad_ptr BiCylinder_impl::getQuadIK(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception) +{ + Quad_ptr result = Quad::_nil(); + HEXA_NS::Quad* q = bi_cylinder_cpp->getQuadIK(part, x, y, z); + if ( q != NULL ){ + Quad_impl* servantCorba = new Quad_impl(q); + result = servantCorba->_this(); + } + return result; +} + + +Quad_ptr BiCylinder_impl::getQuadJK(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception) +{ + Quad_ptr result = Quad::_nil(); + HEXA_NS::Quad* q = bi_cylinder_cpp->getQuadJK(part, x, y, z); + if ( q != NULL ){ + Quad_impl* servantCorba = new Quad_impl(q); + result = servantCorba->_this(); + } + return result; +} + + +Hexa_ptr BiCylinder_impl::getHexaIJK(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) throw (SALOME::SALOME_Exception) +{ + Hexa_ptr result = Hexa::_nil(); + HEXA_NS::Hexa* h = bi_cylinder_cpp->getHexaIJK(part, x, y, z); + if ( h != NULL ){ + Hexa_impl* servantCorba = new Hexa_impl(h); + result = servantCorba->_this(); + } + return result; +} +::CORBA::Long BiCylinder_impl::saveVtk(const char* fname) throw (SALOME::SALOME_Exception) +{ + ::CORBA::Long ret = bi_cylinder_cpp->saveVtk( fname ); + return ret; +} + +void BiCylinder_impl::dump() throw (SALOME::SALOME_Exception) +{ + bi_cylinder_cpp->dump(); +} + + +void BiCylinder_impl::printName() throw (SALOME::SALOME_Exception) +{ + bi_cylinder_cpp->printName(); +} + +char* BiCylinder_impl::getName() throw (SALOME::SALOME_Exception) +{ + return CORBA::string_dup( bi_cylinder_cpp->getName() ); +} + +// ========================================================= setName +void BiCylinder_impl::setName(const char* name) + throw (SALOME::SALOME_Exception) +{ + bi_cylinder_cpp->setName (name); +} + diff --git a/src/HEXABLOCK_I/HexBiCylinder_impl.hxx b/src/HEXABLOCK_I/HexBiCylinder_impl.hxx new file mode 100755 index 0000000..93e9e97 --- /dev/null +++ b/src/HEXABLOCK_I/HexBiCylinder_impl.hxx @@ -0,0 +1,68 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef __HexBiCylinder_impl__ +#define __HexBiCylinder_impl__ + +#include +#include CORBA_SERVER_HEADER(BiCylinder) +#include "SALOME_GenericObj_i.hh" + +#include "hexa_base.hxx" +#include "HexBiCylinder.hxx" + +using namespace HEXABLOCK_ORB; + +class BiCylinder_impl : public POA_HEXABLOCK_ORB::BiCylinder, + public SALOME::GenericObj_i +{ +public: + BiCylinder_impl(HEXA_NS::BiCylinder *ptrCpp); + HEXA_NS::BiCylinder* GetImpl(); + + Vertex_ptr getVertexIJK(::CORBA::Long part,::CORBA::Long x,::CORBA::Long y,::CORBA::Long z) + throw (SALOME::SALOME_Exception); + + Edge_ptr getEdgeI(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception); + Edge_ptr getEdgeJ(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception); + Edge_ptr getEdgeK(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception); + + Quad_ptr getQuadIJ(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception); + Quad_ptr getQuadIK(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception); + Quad_ptr getQuadJK(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception); + + Hexa_ptr getHexaIJK(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) + throw (SALOME::SALOME_Exception); + + ::CORBA::Long saveVtk(const char* fname) throw (SALOME::SALOME_Exception); + void dump() throw (SALOME::SALOME_Exception); + void printName() throw (SALOME::SALOME_Exception); + char* getName() throw (SALOME::SALOME_Exception); + void setName (const char* name) throw (SALOME::SALOME_Exception); + +private: + HEXA_NS::BiCylinder* bi_cylinder_cpp; +}; + +#endif diff --git a/src/HEXABLOCK_I/HexCrossElements_impl.cxx b/src/HEXABLOCK_I/HexCrossElements_impl.cxx index f89765c..4201313 100755 --- a/src/HEXABLOCK_I/HexCrossElements_impl.cxx +++ b/src/HEXABLOCK_I/HexCrossElements_impl.cxx @@ -139,36 +139,12 @@ Hexa_ptr CrossElements_impl::getHexaIJK(::CORBA::Long part, ::CORBA::Long x, ::C return result; } -::CORBA::Long CrossElements_impl::crossCylinders(Cylinder_ptr c1In, Cylinder_ptr c2In) -throw (SALOME::SALOME_Exception) -{ - ::CORBA::Long result; - Cylinder_impl* c1InServant = ::DownCast( c1In ); - Cylinder_impl* c2InServant = ::DownCast( c2In ); - - ASSERT( c1InServant ); - ASSERT( c2InServant ); - - if ( c1InServant && c2InServant ) { - HEXA_NS::Cylinder* c1 = c1InServant->GetImpl(); - HEXA_NS::Cylinder* c2 = c2InServant->GetImpl(); - - result = _crossElements_cpp->crossCylinders(c1,c2); - } - return result; - -} - - - ::CORBA::Long CrossElements_impl::saveVtk(const char* fname) throw (SALOME::SALOME_Exception) { ::CORBA::Long ret = _crossElements_cpp->saveVtk( fname ); return ret; } - - void CrossElements_impl::dump() throw (SALOME::SALOME_Exception) { _crossElements_cpp->dump(); diff --git a/src/HEXABLOCK_I/HexCrossElements_impl.hxx b/src/HEXABLOCK_I/HexCrossElements_impl.hxx index 87b9438..2f21a74 100755 --- a/src/HEXABLOCK_I/HexCrossElements_impl.hxx +++ b/src/HEXABLOCK_I/HexCrossElements_impl.hxx @@ -47,8 +47,6 @@ public: Hexa_ptr getHexaIJK(::CORBA::Long part, ::CORBA::Long x, ::CORBA::Long y, ::CORBA::Long z) throw (SALOME::SALOME_Exception); - ::CORBA::Long crossCylinders(Cylinder_ptr cyl1, Cylinder_ptr cyl2) throw (SALOME::SALOME_Exception); - ::CORBA::Long saveVtk(const char* fname) throw (SALOME::SALOME_Exception); void dump() throw (SALOME::SALOME_Exception); void printName() throw (SALOME::SALOME_Exception); diff --git a/src/HEXABLOCK_I/HexDocument_impl.cxx b/src/HEXABLOCK_I/HexDocument_impl.cxx index f9b5215..cc706ae 100755 --- a/src/HEXABLOCK_I/HexDocument_impl.cxx +++ b/src/HEXABLOCK_I/HexDocument_impl.cxx @@ -24,7 +24,7 @@ using namespace std; #include "HEXABLOCK.hxx" #include "HexDocument_impl.hxx" -// +// #include "HexVertex_impl.hxx" #include "HexEdge_impl.hxx" @@ -40,7 +40,8 @@ using namespace std; #include "HexGroup_impl.hxx" #include "HexPipe_impl.hxx" -#include "HexShape.hxx" +#include "HexBiCylinder.hxx" +#include "HexNewShape_impl.hxx" using namespace HEXABLOCK_ORB; @@ -83,7 +84,7 @@ HEXA_NS::Document* Document_impl::GetImpl() throw (SALOME::SALOME_Exception) return ret; } -::CORBA::Long Document_impl::setName(const char* name) +::CORBA::Long Document_impl::setName(const char* name) throw (SALOME::SALOME_Exception) { ::CORBA::Long ret = _document_cpp->setName(name); @@ -145,7 +146,7 @@ Vertex_ptr Document_impl::findVertex(::CORBA::Double x, ::CORBA::Double y, ::COR return result; } - +// ======================================================== addEdge Edge_ptr Document_impl::addEdge(Vertex_ptr v0In, Vertex_ptr v1In) throw(SALOME::SALOME_Exception) { @@ -166,6 +167,27 @@ Edge_ptr Document_impl::addEdge(Vertex_ptr v0In, Vertex_ptr v1In) } return result; } +// ======================================================== addEdgeVector +Edge_ptr Document_impl::addEdgeVector (Vertex_ptr v0In, Vector_ptr w1In) + throw(SALOME::SALOME_Exception) +{ + Edge_ptr result = Edge::_nil(); + + Vertex_impl* v0InServant = ::DownCast( v0In ); + Vector_impl* w1InServant = ::DownCast( w1In ); + ASSERT( v0InServant ); + ASSERT( w1InServant ); + if ( v0InServant && w1InServant ) { + HEXA_NS::Vertex* v0 = v0InServant->GetImpl(); + HEXA_NS::Vector* w1 = w1InServant->GetImpl(); + HEXA_NS::Edge* e = _document_cpp->addEdgeVector ( v0, w1 ); + if ( e != NULL ){ + Edge_impl* servantCorba = new Edge_impl(e); + result = servantCorba->_this(); + } + } + return result; +} ::CORBA::Long Document_impl::countEdge() throw (SALOME::SALOME_Exception) @@ -466,7 +488,7 @@ Vector_ptr Document_impl::addVectorVertices( Vertex_ptr v0In, Vertex_ptr v1In ) { return _document_cpp->countVector(); } - + Vector_ptr Document_impl::getVector(::CORBA::Long i) throw (SALOME::SALOME_Exception) { HEXA_NS::Vector* h = _document_cpp->getVector(i); @@ -503,7 +525,7 @@ throw (SALOME::SALOME_Exception) { return _document_cpp->countCylinder(); } - + Cylinder_ptr Document_impl::getCylinder(::CORBA::Long i) throw (SALOME::SALOME_Exception) { HEXA_NS::Cylinder* c = _document_cpp->getCylinder(i); @@ -541,7 +563,7 @@ throw (SALOME::SALOME_Exception) { return _document_cpp->countPipe(); } - + Pipe_ptr Document_impl::getPipe(::CORBA::Long i) throw (SALOME::SALOME_Exception) { HEXA_NS::Pipe* p = _document_cpp->getPipe(i); @@ -576,7 +598,7 @@ Pipe_ptr Document_impl::getPipe(::CORBA::Long i) throw (SALOME::SALOME_Exception if ( ok == HOK ) return true; else - return false; + return false; } } @@ -603,12 +625,12 @@ Elements_ptr Document_impl::makeCartesian( Vertex_ptr ptIn, HEXA_NS::Vector* vy = vyInServant->GetImpl(); HEXA_NS::Vector* vz = vzInServant->GetImpl(); - HEXA_NS::Elements* l = _document_cpp->makeCartesian( + HEXA_NS::Elements* grid = _document_cpp->makeCartesian( pt, vx, vy, vz, nx, ny, nz ); - if ( l != NULL ){ - Elements_impl* servantCorba = new Elements_impl(l); + if ( grid != NULL ){ + Elements_impl* servantCorba = new Elements_impl(grid); result = servantCorba->_this(); } } @@ -619,7 +641,7 @@ Elements_ptr Document_impl::makeCartesian( Vertex_ptr ptIn, Elements_ptr Document_impl::makeCartesian1( - Vertex_ptr vxIn, + Vertex_ptr vxIn, Vector_ptr vr1In, ::CORBA::Long px, ::CORBA::Long py, ::CORBA::Long pz, ::CORBA::Long mx, ::CORBA::Long my, ::CORBA::Long mz ) @@ -636,14 +658,14 @@ Elements_ptr Document_impl::makeCartesian1( HEXA_NS::Vertex* vx = vxInServant->GetImpl(); HEXA_NS::Vector* vr1 = vr1InServant->GetImpl(); - HEXA_NS::Elements* l = _document_cpp->makeCartesian( + HEXA_NS::Elements* grid = _document_cpp->makeCartesian( vx, vr1, px, py, pz, mx, my, mz ); - if ( l != NULL ){ - Elements_impl* servantCorba = new Elements_impl(l); + if ( grid != NULL ){ + Elements_impl* servantCorba = new Elements_impl(grid); result = servantCorba->_this(); } } @@ -671,11 +693,11 @@ Elements_ptr Document_impl::makeCylindrical( Vertex_ptr ptIn, HEXA_NS::Vertex* pt = ptServant->GetImpl(); HEXA_NS::Vector* vex = vexServant->GetImpl(); HEXA_NS::Vector* vez = vezServant->GetImpl(); - HEXA_NS::Elements* l = _document_cpp->makeCylindrical( pt, + HEXA_NS::Elements* grid = _document_cpp->makeCylindrical( pt, vex, vez, dr, da, dl, nr, na, nl, fill ); - if ( l != NULL ){ - Elements_impl* servantCorba = new Elements_impl(l); + if ( grid != NULL ){ + Elements_impl* servantCorba = new Elements_impl(grid); result = servantCorba->_this(); } } @@ -683,7 +705,7 @@ Elements_ptr Document_impl::makeCylindrical( Vertex_ptr ptIn, } // =================================================== makeCylindricals -Elements_ptr Document_impl::makeCylindricals (Vertex_ptr ptin, +Elements_ptr Document_impl::makeCylindricals (Vertex_ptr ptin, Vector_ptr vexin, Vector_ptr vezin, const RealVector& tdr, const RealVector& tda, const RealVector& tdl, ::CORBA::Boolean fill) @@ -703,19 +725,19 @@ Elements_ptr Document_impl::makeCylindricals (Vertex_ptr ptin, return result; std::vector cdr, cda, cdl; - for ( int nro = 0; nro < tdr.length(); nro++) + for ( int nro = 0; nro < tdr.length(); nro++) cdr.push_back (tdr[nro]); - for ( int nro = 0; nro < tda.length(); nro++) + for ( int nro = 0; nro < tda.length(); nro++) cda.push_back (tda[nro]); - for ( int nro = 0; nro < tdl.length(); nro++) + for ( int nro = 0; nro < tdl.length(); nro++) cdl.push_back (tdl[nro]); HEXA_NS::Vertex* pt = ptServant->GetImpl(); HEXA_NS::Vector* vex = vexServant->GetImpl(); HEXA_NS::Vector* vez = vezServant->GetImpl(); - HEXA_NS::Elements* grid = _document_cpp->makeCylindricals ( pt, vex, vez, + HEXA_NS::Elements* grid = _document_cpp->makeCylindricals ( pt, vex, vez, cdr, cda, cdl, fill ); if ( grid != NULL ) { @@ -735,7 +757,7 @@ Elements_ptr Document_impl::makeCylindricals (Vertex_ptr ptin, // { // Vertex_impl* ptServant = ::DownCast( ptIn ); // ASSERT( ptServant ); -// +// // if ( ptServant ) { // HEXA_NS::Vertex* pt = ptServant->GetImpl(); // HEXA_NS::Elements* l = _document_cpp->makeSpherical( pt, dx, dy, dz, n ); @@ -769,7 +791,7 @@ Elements_ptr Document_impl::makeSpherical( - + // Elements_ptr Document_impl::makeCylinder(Cylinder_ptr cylIn, ::CORBA::Long nr, ::CORBA::Long na, ::CORBA::Long nl) @@ -795,14 +817,14 @@ Elements_ptr Document_impl::makeCylinder(Cylinder_ptr cylIn, Vector_ptr vrIn, :: return result; } -Elements_ptr Document_impl::makePipe( Pipe_ptr pIn, Vector_ptr vrIn, +Elements_ptr Document_impl::makePipe( Pipe_ptr pIn, Vector_ptr vrIn, ::CORBA::Long nr, ::CORBA::Long na, ::CORBA::Long nl) throw (SALOME::SALOME_Exception) { Pipe_impl* pServant = ::DownCast( pIn ); Vector_impl* vrServant = ::DownCast( vrIn ); ASSERT( pServant ); - + if ( pServant ) { HEXA_NS::Pipe* p = pServant ->GetImpl(); HEXA_NS::Vector* vr = vrServant->GetImpl(); @@ -836,20 +858,20 @@ CrossElements_ptr Document_impl::makeCylinders(Cylinder_ptr c1In, Cylinder_ptr c return result; } -Elements_ptr Document_impl::makePipes( Pipe_ptr p1In, Pipe_ptr p2In) +CrossElements_ptr Document_impl::makePipes( Pipe_ptr p1In, Pipe_ptr p2In) throw (SALOME::SALOME_Exception) { Pipe_impl* p1Servant = ::DownCast( p1In ); Pipe_impl* p2Servant = ::DownCast( p2In ); ASSERT( p1Servant ); ASSERT( p2Servant ); - + if ( p1Servant && p2Servant ) { HEXA_NS::Pipe* p1= p1Servant->GetImpl(); HEXA_NS::Pipe* p2= p2Servant->GetImpl(); - - HEXA_NS::Elements* l = _document_cpp->makePipes( p1, p2); - Elements_impl* servantCorba = new Elements_impl(l); + + HEXA_NS::CrossElements* l = _document_cpp->makePipes( p1, p2); + CrossElements_impl* servantCorba = new CrossElements_impl(l); return servantCorba->_this(); } } @@ -980,7 +1002,6 @@ Elements_ptr Document_impl::joinQuads(const Quads& qdsIn, Quad_ptr qbIn, Vertex_ HEXA_NS::Vertex* va2 = va2Servant->GetImpl(); HEXA_NS::Vertex* vb2 = vb2Servant->GetImpl(); -// MESSAGE("joinQuads AAAAAAAAAAAAA"); HEXA_NS::Quads qds; for ( int i = 0; i < qdsIn.length(); i++) { Quad_impl* qServant = ::DownCast( qdsIn[i] ); @@ -1016,7 +1037,7 @@ Elements_ptr Document_impl::joinQuads(const Quads& qdsIn, Quad_ptr qbIn, Vertex_ ASSERT( qaServant ); ASSERT( qbServant ); - // ASSERT( va1Servant ); Controle supprime Abu + // ASSERT( va1Servant ); Controle supprime Abu // ASSERT( vb1Servant ); // ASSERT( va2Servant ); // ASSERT( vb2Servant ); @@ -1096,7 +1117,7 @@ Elements_ptr Document_impl::joinQuads(const Quads& qdsIn, Quad_ptr qbIn, Vertex_ } -Elements_ptr Document_impl::disconnectQuad(Hexa_ptr hexIn, Quad_ptr quadIn) +Elements_ptr Document_impl::disconnectQuad(Hexa_ptr hexIn, Quad_ptr quadIn) throw (SALOME::SALOME_Exception) { Elements_ptr result = Elements::_nil(); @@ -1120,7 +1141,7 @@ Elements_ptr Document_impl::disconnectQuad(Hexa_ptr hexIn, Quad_ptr quadIn) return result; } -Elements_ptr Document_impl::disconnectEdge(Hexa_ptr hexIn, Edge_ptr edgeIn) +Elements_ptr Document_impl::disconnectEdge(Hexa_ptr hexIn, Edge_ptr edgeIn) throw (SALOME::SALOME_Exception) { Elements_ptr result = Elements::_nil(); @@ -1144,7 +1165,7 @@ Elements_ptr Document_impl::disconnectEdge(Hexa_ptr hexIn, Edge_ptr edgeIn) return result; } -Elements_ptr Document_impl::disconnectVertex(Hexa_ptr hexIn, Vertex_ptr vxIn) +Elements_ptr Document_impl::disconnectVertex(Hexa_ptr hexIn, Vertex_ptr vxIn) throw (SALOME::SALOME_Exception) { Elements_ptr result = Elements::_nil(); @@ -1169,14 +1190,14 @@ Elements_ptr Document_impl::disconnectVertex(Hexa_ptr hexIn, Vertex_ptr vxIn) return result; } // ====================================================== disconnectEdges -Elements_ptr Document_impl::disconnectEdges (const Hexas& hexas_in, - const Edges& edges_in) +Elements_ptr Document_impl::disconnectEdges (const Hexas& hexas_in, + const Edges& edges_in) throw (SALOME::SALOME_Exception) { Elements_ptr result = Elements::_nil(); std::vector tab_hexas; - for (int i = 0; i < hexas_in.length(); i++) + for (int i = 0; i < hexas_in.length(); i++) { Hexa_impl* im_hexa = ::DownCast ( hexas_in[i] ); ASSERT( im_hexa ); @@ -1185,7 +1206,7 @@ Elements_ptr Document_impl::disconnectEdges (const Hexas& hexas_in, } std::vector tab_edges; - for (int i = 0; i < edges_in.length(); i++) + for (int i = 0; i < edges_in.length(); i++) { Edge_impl* im_edge = ::DownCast ( edges_in[i] ); ASSERT( im_edge ); @@ -1204,7 +1225,7 @@ Elements_ptr Document_impl::disconnectEdges (const Hexas& hexas_in, return result; } // ====================================================== cut -Elements_ptr Document_impl::cut(Edge_ptr eIn, ::CORBA::Long nb_of_cuts) +Elements_ptr Document_impl::cut(Edge_ptr eIn, ::CORBA::Long nb_of_cuts) throw (SALOME::SALOME_Exception) { Elements_ptr result = Elements::_nil(); @@ -1410,7 +1431,7 @@ Group_ptr Document_impl::getGroup(::CORBA::Long i) throw (SALOME::SALOME_Excepti { Group_ptr result = Group::_nil(); HEXA_NS::Group* g = _document_cpp->getGroup(i); - if ( g != NULL ){ //CS_TODO + if ( g != NULL ){ //CS_TODO Group_impl* servantCorba = new Group_impl(g); result = servantCorba->_this(); } @@ -1422,7 +1443,7 @@ Group_ptr Document_impl::findGroup(const char* name) throw (SALOME::SALOME_Excep { Group_ptr result = Group::_nil(); HEXA_NS::Group* g = _document_cpp->findGroup(name); - if ( g != NULL ){ //CS_TODO + if ( g != NULL ){ //CS_TODO Group_impl* servantCorba = new Group_impl(g); result = servantCorba->_this(); } @@ -1437,7 +1458,7 @@ Law_ptr Document_impl::addLaw(const char* name, ::CORBA::Long nb_nodes) throw (S HEXA_NS::Law* l = _document_cpp->addLaw(name, nb_nodes); if ( l != NULL ){ Law_impl* servantCorba = new Law_impl(l); - result = servantCorba->_this(); + result = servantCorba->_this(); } return result; @@ -1500,9 +1521,9 @@ Propagation_ptr Document_impl::getPropagation(::CORBA::Long i) throw (SALOME::SA HEXA_NS::Propagation* p = _document_cpp->getPropagation(i); // //CS_Test -// +// // const HEXA_NS::Edges& edges_cpp = p->getEdges(); -// +// // // HEXA_NS::Edges::const_iterator itertest = edges_cpp.begin(); // // itertest != edges_cpp.end(); // for ( HEXA_NS::Edges::const_iterator iter = edges_cpp.begin(); @@ -1538,184 +1559,6 @@ Propagation_ptr Document_impl::findPropagation(Edge_ptr eIn) throw (SALOME::SALO return result; } -// ======================================================= associateOpenedLine -::CORBA::Long Document_impl::associateOpenedLine (Edge_ptr mstart, - const Edges& mline, - GEOM::GEOM_Object_ptr gstart, - ::CORBA::Double pstart, - const Shapes& gline, - ::CORBA::Double pend) - throw (SALOME::SALOME_Exception) -{ - Edge_impl* im_start = ::DownCast( mstart ); - - ASSERT ( im_start ); - if (im_start == NULL) - return HERR; - - std::vector md_line; - for (int i = 0; i < mline.length(); i++) - { - Edge_impl* im_edge = ::DownCast ( mline[i] ); - ASSERT( im_edge ); - HEXA_NS::Edge* un_edge = im_edge->GetImpl(); - md_line.push_back (un_edge); - } - - TopoDS_Shape shape = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->geomObjectToShape(gstart); - string b_rep = shape2string( shape ); - HEXA_NS::Shape* gg_start = new HEXA_NS::Shape( b_rep ); - - std::vector gg_line; - for (int i = 0; i < gline.length(); i++) - { - shape = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->geomObjectToShape(gline[i]); - b_rep = shape2string( shape ); - HEXA_NS::Shape* gg_edge = new HEXA_NS::Shape( b_rep ); - gg_line.push_back (gg_edge); - } - - // Call model - - HEXA_NS::Edge* md_start = im_start->GetImpl(); - - ::CORBA::Long ier = _document_cpp->associateOpenedLine (md_start, md_line, - gg_start, pstart, gg_line, pend); - return ier; -} - -// ======================================================= associateClosedLine -::CORBA::Long Document_impl::associateClosedLine (Vertex_ptr mfirst, - Edge_ptr mstart, - const Edges& mline, - GEOM::GEOM_Object_ptr gstart, - ::CORBA::Double pstart, - ::CORBA::Boolean inv, - const Shapes& gline) - throw (SALOME::SALOME_Exception) -{ - std::vector md_line; - for (int i = 0; i < mline.length(); i++) - { - Edge_impl* im_edge = ::DownCast ( mline[i] ); - ASSERT( im_edge ); - HEXA_NS::Edge* un_edge = im_edge->GetImpl(); - md_line.push_back (un_edge); - } - - TopoDS_Shape shape = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->geomObjectToShape(gstart); - string b_rep = shape2string( shape ); - HEXA_NS::Shape* gg_start = new HEXA_NS::Shape( b_rep ); - - std::vector gg_line; - for (int i = 0; i < gline.length(); i++) - { - shape = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->geomObjectToShape(gline[i]); - b_rep = shape2string( shape ); - HEXA_NS::Shape* gg_edge = new HEXA_NS::Shape( b_rep ); - gg_line.push_back (gg_edge); - } - - // Call model - - Edge_impl* im_start = ::DownCast ( mstart ); - Vertex_impl* im_first = ::DownCast( mfirst ); - - HEXA_NS::Vertex* md_first = im_first->GetImpl(); - HEXA_NS::Edge* md_start = im_start->GetImpl(); - - printf (" +++ HexDocument_impl.cxx : Appel de associateClosedLine \n"); - - ::CORBA::Long ier = _document_cpp->associateClosedLine (md_first, md_start, - md_line, gg_start, pstart, inv, gg_line); - HexDisplay (ier); - return ier; -} -// ---------------------------------------------- Ajouts Abu Sept 2011 -// ===================================================== setShape -void Document_impl::setShape (GEOM::GEOM_Object_ptr geom_object) - throw(SALOME::SALOME_Exception) -{ - TopoDS_Shape shape = HEXABLOCK_Gen_i::GetHEXABLOCKGen() - ->geomObjectToShape(geom_object); - CORBA::String_var anIOR = HEXABLOCK_Gen_i::GetORB()->object_to_string( geom_object); - - string strBrep = shape2string( shape ); - std::cout << "setShape ---------> len(strBrep) = " - << strBrep.size() << std::endl; - HEXA_NS::Shape* s = new HEXA_NS::Shape( strBrep ); - - s->ior = anIOR.in(); - s->ident = geom_object->GetStudyEntry(); - - std::cout << " ............ Shape creee" << std::endl; - _document_cpp->setShape (s); - std::cout << " ............ Shape associee" << std::endl; -} -// ===================================================== getShape -GEOM::GEOM_Object_ptr Document_impl::getShape () - throw (SALOME::SALOME_Exception) -{ - HEXA_NS::Shape* s = _document_cpp->getShape (); - CORBA::Object_var corbaObj; - GEOM::GEOM_Object_var geomObj; // = new GEOM::GEOM_Object; - - if (s != NULL) - { - if ( !s->ior.empty() ) - { // geom object from current session - corbaObj = HEXABLOCK_Gen_i::GetORB()->string_to_object( s->ior.c_str() ); - if ( !CORBA::is_nil( corbaObj ) ) - { - geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); - } - } - else // no geom object => we have to built it - { - geomObj = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->brepToGeomObject( s->getBrep() ); - } - } - return geomObj._retn(); -} - - -/* *********************************************************** - GEOM::GEOM_Object_var result; // = new GEOM::GEOM_Object; - - HEXA_NS::Shape* s = _document_cpp->getShape(); - - std::cout << "getShape ->" << s << std::endl; - - if (s != NULL) - { - string strBrep = s->getBrep(); - std::cout << "getShape -->len (getBrep) = " - << strBrep.size() << std::endl; - TopoDS_Shape shape = string2shape( strBrep ); - std::cout << "getShape -->string2shape->" << std::endl; - result = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->shapeToGeomObject(shape); - std::cout << "getShape -->GetHEXABLOCKGen--" << std::endl; - } - - return result._retn(); - **************************************************************** */ -// ===================================================== getBrep -char* Document_impl::getBrep () throw (SALOME::SALOME_Exception) -{ - const char* brep = NULL; - - HEXA_NS::Shape* shape = _document_cpp->getShape(); - if (shape != NULL) - { - string b_rep = shape->getBrep(); - brep = b_rep.c_str(); - // brep = shape->getBrep().c_str(); - } - - if (brep == NULL) - brep = ""; - return CORBA::string_dup (brep); -} // ===================================================== getName char* Document_impl::getName () throw (SALOME::SALOME_Exception) { @@ -1723,13 +1566,13 @@ char* Document_impl::getName () throw (SALOME::SALOME_Exception) return CORBA::string_dup (name); } // ===================================================== countUsedVertex -::CORBA::Long Document_impl::countUsedVertex() +::CORBA::Long Document_impl::countUsedVertex() throw (SALOME::SALOME_Exception) { return _document_cpp->countUsedVertex(); } // ===================================================== getUsedVertex -Vertex_ptr Document_impl::getUsedVertex(::CORBA::Long i) +Vertex_ptr Document_impl::getUsedVertex(::CORBA::Long i) throw (SALOME::SALOME_Exception) { Vertex_ptr result = Vertex::_nil(); @@ -1743,13 +1586,13 @@ Vertex_ptr Document_impl::getUsedVertex(::CORBA::Long i) return result; } // ===================================================== countUsedEdge -::CORBA::Long Document_impl::countUsedEdge() +::CORBA::Long Document_impl::countUsedEdge() throw (SALOME::SALOME_Exception) { return _document_cpp->countUsedEdge(); } // ===================================================== getUsedEdge -Edge_ptr Document_impl::getUsedEdge(::CORBA::Long i) +Edge_ptr Document_impl::getUsedEdge(::CORBA::Long i) throw (SALOME::SALOME_Exception) { Edge_ptr result = Edge::_nil(); @@ -1763,13 +1606,13 @@ Edge_ptr Document_impl::getUsedEdge(::CORBA::Long i) return result; } // ===================================================== countUsedQuad -::CORBA::Long Document_impl::countUsedQuad() +::CORBA::Long Document_impl::countUsedQuad() throw (SALOME::SALOME_Exception) { return _document_cpp->countUsedQuad(); } // ===================================================== getUsedQuad -Quad_ptr Document_impl::getUsedQuad(::CORBA::Long i) +Quad_ptr Document_impl::getUsedQuad(::CORBA::Long i) throw (SALOME::SALOME_Exception) { Quad_ptr result = Quad::_nil(); @@ -1783,13 +1626,13 @@ Quad_ptr Document_impl::getUsedQuad(::CORBA::Long i) return result; } // ===================================================== countUsedHexa -::CORBA::Long Document_impl::countUsedHexa() +::CORBA::Long Document_impl::countUsedHexa() throw (SALOME::SALOME_Exception) { return _document_cpp->countUsedHexa(); } // ===================================================== getUsedHexa -Hexa_ptr Document_impl::getUsedHexa(::CORBA::Long i) +Hexa_ptr Document_impl::getUsedHexa(::CORBA::Long i) throw (SALOME::SALOME_Exception) { Hexa_ptr result = Hexa::_nil(); @@ -1803,7 +1646,7 @@ Hexa_ptr Document_impl::getUsedHexa(::CORBA::Long i) return result; } // ===================================================== addHexa5Quads -Hexa_ptr Document_impl::addHexa5Quads (Quad_ptr q1, Quad_ptr q2, Quad_ptr q3, +Hexa_ptr Document_impl::addHexa5Quads (Quad_ptr q1, Quad_ptr q2, Quad_ptr q3, Quad_ptr q4, Quad_ptr q5) throw (SALOME::SALOME_Exception) { @@ -1839,7 +1682,7 @@ Hexa_ptr Document_impl::addHexa5Quads (Quad_ptr q1, Quad_ptr q2, Quad_ptr q3, return result; } // ===================================================== addHexa4Quads -Hexa_ptr Document_impl::addHexa4Quads (Quad_ptr q1, Quad_ptr q2, Quad_ptr q3, +Hexa_ptr Document_impl::addHexa4Quads (Quad_ptr q1, Quad_ptr q2, Quad_ptr q3, Quad_ptr q4) throw (SALOME::SALOME_Exception) { @@ -1930,7 +1773,7 @@ Hexa_ptr Document_impl::addHexa2Quads (Quad_ptr q1, Quad_ptr q2) } // ===================================================== removeQuad -::CORBA::Boolean Document_impl::removeQuad(Quad_ptr quad) +::CORBA::Boolean Document_impl::removeQuad(Quad_ptr quad) throw (SALOME::SALOME_Exception) { Quad_impl* hServant = ::DownCast( quad ); @@ -1946,7 +1789,7 @@ Hexa_ptr Document_impl::addHexa2Quads (Quad_ptr q1, Quad_ptr q2) } } // ===================================================== removeElements -::CORBA::Boolean Document_impl::removeElements(Elements_ptr bloc) +::CORBA::Boolean Document_impl::removeElements(Elements_ptr bloc) throw (SALOME::SALOME_Exception) { Elements_impl* hServant = ::DownCast( bloc ); @@ -1962,8 +1805,8 @@ Hexa_ptr Document_impl::addHexa2Quads (Quad_ptr q1, Quad_ptr q2) } } // ===================================================== revolutionQuads -Elements_ptr Document_impl::revolutionQuads (const Quads& start, - Vertex_ptr center, Vector_ptr axis, +Elements_ptr Document_impl::revolutionQuads (const Quads& start, + Vertex_ptr center, Vector_ptr axis, const RealVector &angles) throw (SALOME::SALOME_Exception) { @@ -1979,7 +1822,7 @@ Elements_ptr Document_impl::revolutionQuads (const Quads& start, return result; HEXA_NS::Quads t_start; - for ( int nq = 0; nq < start.length(); nq++) + for ( int nq = 0; nq < start.length(); nq++) { Quad_impl* v_quad = ::DownCast (start[nq]); ASSERT( v_quad ); @@ -1988,7 +1831,7 @@ Elements_ptr Document_impl::revolutionQuads (const Quads& start, } std::vector t_angles; - for ( int na = 0; na < angles.length(); na++) + for ( int na = 0; na < angles.length(); na++) { CORBA::Double alpha = angles[na]; t_angles.push_back (alpha); @@ -1996,7 +1839,7 @@ Elements_ptr Document_impl::revolutionQuads (const Quads& start, HEXA_NS::Vector* i_axis = v_axis ->GetImpl(); HEXA_NS::Vertex* i_center = v_center->GetImpl(); - HEXA_NS::Elements* i_elts = _document_cpp->revolutionQuads (t_start, + HEXA_NS::Elements* i_elts = _document_cpp->revolutionQuads (t_start, i_center, i_axis, t_angles); if (i_elts != NULL) { @@ -2007,7 +1850,7 @@ Elements_ptr Document_impl::revolutionQuads (const Quads& start, return result; } // ===================================================== prismQuadsVec -Elements_ptr Document_impl::prismQuadsVec (const Quads& start, Vector_ptr dir, +Elements_ptr Document_impl::prismQuadsVec (const Quads& start, Vector_ptr dir, const RealVector &thaut, ::CORBA::Long opt) throw (SALOME::SALOME_Exception) { @@ -2020,7 +1863,7 @@ Elements_ptr Document_impl::prismQuadsVec (const Quads& start, Vector_ptr dir, return result; HEXA_NS::Quads t_start; - for ( int nq = 0; nq < start.length(); nq++) + for ( int nq = 0; nq < start.length(); nq++) { Quad_impl* v_quad = ::DownCast (start[nq]); ASSERT( v_quad ); @@ -2029,14 +1872,14 @@ Elements_ptr Document_impl::prismQuadsVec (const Quads& start, Vector_ptr dir, } std::vector t_haut; - for ( int na = 0; na < thaut.length(); na++) + for ( int na = 0; na < thaut.length(); na++) { CORBA::Double alpha = thaut[na]; t_haut.push_back (alpha); } HEXA_NS::Vector* i_dir = v_dir ->GetImpl(); - HEXA_NS::Elements* i_elts = _document_cpp->prismQuadsVec (t_start, + HEXA_NS::Elements* i_elts = _document_cpp->prismQuadsVec (t_start, i_dir, t_haut, opt); if (i_elts != NULL) { @@ -2048,8 +1891,8 @@ Elements_ptr Document_impl::prismQuadsVec (const Quads& start, Vector_ptr dir, } // ===================================================== makeSphere -Elements_ptr Document_impl::replace (const Quads& pattern, - Vertex_ptr p1, Vertex_ptr c1, +Elements_ptr Document_impl::replace (const Quads& pattern, + Vertex_ptr p1, Vertex_ptr c1, Vertex_ptr p2, Vertex_ptr c2, Vertex_ptr p3, Vertex_ptr c3) throw (SALOME::SALOME_Exception) @@ -2072,7 +1915,7 @@ Elements_ptr Document_impl::replace (const Quads& pattern, return result; HEXA_NS::Quads t_pattern; - for ( int nq = 0; nq < pattern.length(); nq++) + for ( int nq = 0; nq < pattern.length(); nq++) { Quad_impl* v_quad = ::DownCast (pattern[nq]); ASSERT( v_quad ); @@ -2089,7 +1932,7 @@ Elements_ptr Document_impl::replace (const Quads& pattern, HEXA_NS::Vertex* i_c2 = v_c2->GetImpl(); HEXA_NS::Vertex* i_c3 = v_c3->GetImpl(); - HEXA_NS::Elements* i_elts = _document_cpp->replace (t_pattern, + HEXA_NS::Elements* i_elts = _document_cpp->replace (t_pattern, i_p1, i_c1, i_p2, i_c2, i_p3, i_c3); if (i_elts != NULL) { @@ -2100,9 +1943,9 @@ Elements_ptr Document_impl::replace (const Quads& pattern, return result; } // ===================================================== makeSphere -Elements_ptr Document_impl::makeSphere (Vertex_ptr center, Vector_ptr vx, - Vector_ptr vz, ::CORBA::Double radius, - ::CORBA::Double radhole, Vertex_ptr plorig, +Elements_ptr Document_impl::makeSphere (Vertex_ptr center, Vector_ptr vx, + Vector_ptr vz, ::CORBA::Double radius, + ::CORBA::Double radhole, Vertex_ptr plorig, ::CORBA::Long nrad, ::CORBA::Long nang, ::CORBA::Long nhaut) throw (SALOME::SALOME_Exception) { @@ -2135,8 +1978,8 @@ Elements_ptr Document_impl::makeSphere (Vertex_ptr center, Vector_ptr vx, return result; } // ===================================================== makePartSphere -Elements_ptr Document_impl::makePartSphere (Vertex_ptr center, Vector_ptr vx, - Vector_ptr vz, ::CORBA::Double radius, +Elements_ptr Document_impl::makePartSphere (Vertex_ptr center, Vector_ptr vx, + Vector_ptr vz, ::CORBA::Double radius, ::CORBA::Double radhole, Vertex_ptr plorig, ::CORBA::Double angle, ::CORBA::Long nrad, ::CORBA::Long nang, ::CORBA::Long nhaut) @@ -2160,7 +2003,7 @@ Elements_ptr Document_impl::makePartSphere (Vertex_ptr center, Vector_ptr vx, HEXA_NS::Vector* i_x = v_x ->GetImpl(); HEXA_NS::Vector* i_z = v_z ->GetImpl(); - HEXA_NS::Elements* i_elts = _document_cpp->makePartSphere (i_center, i_x, + HEXA_NS::Elements* i_elts = _document_cpp->makePartSphere (i_center, i_x, i_z, radius, radhole, i_orig, angle, nrad, nang, nhaut); if (i_elts != NULL) @@ -2172,10 +2015,10 @@ Elements_ptr Document_impl::makePartSphere (Vertex_ptr center, Vector_ptr vx, return result; } // ===================================================== makeRind -Elements_ptr Document_impl::makeRind (Vertex_ptr center, Vector_ptr vx, - Vector_ptr vz, - ::CORBA::Double radext, ::CORBA::Double radint, - ::CORBA::Double radhole, Vertex_ptr plorig, +Elements_ptr Document_impl::makeRind (Vertex_ptr center, Vector_ptr vx, + Vector_ptr vz, + ::CORBA::Double radext, ::CORBA::Double radint, + ::CORBA::Double radhole, Vertex_ptr plorig, ::CORBA::Long nrad, ::CORBA::Long nang, ::CORBA::Long nhaut) throw (SALOME::SALOME_Exception) { @@ -2196,7 +2039,7 @@ Elements_ptr Document_impl::makeRind (Vertex_ptr center, Vector_ptr vx, HEXA_NS::Vector* i_x = v_x ->GetImpl(); HEXA_NS::Vector* i_z = v_z ->GetImpl(); - HEXA_NS::Elements* i_elts = _document_cpp->makeRind (i_center, i_x, i_z, + HEXA_NS::Elements* i_elts = _document_cpp->makeRind (i_center, i_x, i_z, radext, radint, radhole, i_orig, nrad, nang, nhaut); if (i_elts != NULL) @@ -2208,9 +2051,9 @@ Elements_ptr Document_impl::makeRind (Vertex_ptr center, Vector_ptr vx, return result; } // ===================================================== makePartRind -Elements_ptr Document_impl::makePartRind (Vertex_ptr center, Vector_ptr vx, - Vector_ptr vz, - ::CORBA::Double radext, ::CORBA::Double radint, +Elements_ptr Document_impl::makePartRind (Vertex_ptr center, Vector_ptr vx, + Vector_ptr vz, + ::CORBA::Double radext, ::CORBA::Double radint, ::CORBA::Double radhole, Vertex_ptr plorig, ::CORBA::Double angle, ::CORBA::Long nrad, ::CORBA::Long nang, ::CORBA::Long nhaut) @@ -2245,7 +2088,7 @@ Elements_ptr Document_impl::makePartRind (Vertex_ptr center, Vector_ptr vx, return result; } // ================================================== makeScale -Elements_ptr Document_impl::makeScale (Elements_ptr lIn, Vertex_ptr pIn, +Elements_ptr Document_impl::makeScale (Elements_ptr lIn, Vertex_ptr pIn, ::CORBA::Double k) throw (SALOME::SALOME_Exception) { @@ -2350,8 +2193,8 @@ Elements_ptr Document_impl::makeSymmetryPoint (Elements_ptr lIn, Vertex_ptr pIn) return result; } // ================================================== performScale -void Document_impl::performScale (Elements_ptr lIn, Vertex_ptr pIn, - ::CORBA::Double k) +void Document_impl::performScale (Elements_ptr lIn, Vertex_ptr pIn, + ::CORBA::Double k) throw (SALOME::SALOME_Exception) { Elements_impl* lServant = ::DownCast( lIn ); @@ -2367,8 +2210,8 @@ void Document_impl::performScale (Elements_ptr lIn, Vertex_ptr pIn, } } // ================================================== performSymmetryPlane -void Document_impl::performSymmetryPlane (Elements_ptr lIn, Vertex_ptr pIn, - Vector_ptr vecIn) +void Document_impl::performSymmetryPlane (Elements_ptr lIn, Vertex_ptr pIn, + Vector_ptr vecIn) throw (SALOME::SALOME_Exception) { Elements_impl* lServant = ::DownCast( lIn ); @@ -2387,8 +2230,8 @@ void Document_impl::performSymmetryPlane (Elements_ptr lIn, Vertex_ptr pIn, } } // ================================================== performSymmetryLine -void Document_impl::performSymmetryLine (Elements_ptr lIn, Vertex_ptr pIn, - Vector_ptr vecIn) +void Document_impl::performSymmetryLine (Elements_ptr lIn, Vertex_ptr pIn, + Vector_ptr vecIn) throw (SALOME::SALOME_Exception) { Elements_impl* lServant = ::DownCast( lIn ); @@ -2434,3 +2277,173 @@ void Document_impl::clearAssociation () { _document_cpp->clearAssociation (); } +// ---------------------------------------------- Ajouts Hexa5 (nov 2012) +// ===================================================== addShape +NewShape_ptr Document_impl::addShape (GEOM::GEOM_Object_ptr gobject, + const char* name) + throw (SALOME::SALOME_Exception) +{ + TopoDS_Shape shape = HEXABLOCK_Gen_i::GetHEXABLOCKGen() + ->geomObjectToShape(gobject); + + HEXA_NS::NewShape* new_shape = _document_cpp->addShape (shape, name); + + NewShape_ptr result = NewShape::_nil(); + if (new_shape != NULL) + { + NewShape_impl* servantCorba = new NewShape_impl (new_shape); + result = servantCorba->_this(); + } + + return result; +} +// ===================================================== countShape +::CORBA::Long Document_impl::countShape () + throw (SALOME::SALOME_Exception) +{ + return _document_cpp->countShape(); +} +// ========================================================= getShape +NewShape_ptr Document_impl::getShape (::CORBA::Long nro) + throw (SALOME::SALOME_Exception) +{ + HEXA_NS::NewShape* new_shape = _document_cpp->getShape (nro); + + NewShape_ptr result = NewShape::_nil(); + if (new_shape != NULL) + { + NewShape_impl* servantCorba = new NewShape_impl (new_shape); + result = servantCorba->_this(); + } + + return result; +} +// ==================================================== associateOpenedLine +::CORBA::Long Document_impl::associateOpenedLine (const Edges& mline, + const Shapes& gline, + const IntVector& subid, + ::CORBA::Double pstart, + ::CORBA::Double pend) + throw (SALOME::SALOME_Exception) +{ + Hex::Edges md_line; + Hex::NewShapes geo_line; + Hex::IntVector sub_ids; + + for (int nro = 0; nro < mline.length(); nro++) + { + Edge_impl* im_edge = ::DownCast (mline[nro]); + ASSERT (im_edge); + HEXA_NS::Edge* un_edge = im_edge->GetImpl(); + md_line.push_back (un_edge); + } + + for (int nro = 0; nro < gline.length(); nro++) + { + NewShape_impl* im_shape = ::DownCast (gline[nro]); + ASSERT (im_shape); + HEXA_NS::NewShape* la_shape = im_shape->GetImpl(); + geo_line.push_back (la_shape); + } + + for (int nro = 0; nro < subid.length(); nro++) + { + int alpha = subid [nro]; + sub_ids.push_back (alpha); + } + + ::CORBA::Long ier = _document_cpp->associateOpenedLine (md_line, geo_line, + sub_ids, pstart, pend); + return ier; +} +// ====================================================== associateClosedLine +::CORBA::Long Document_impl::associateClosedLine (Vertex_ptr mfirst, + const Edges& mline, + const Shapes& gline, + const IntVector& subid, + ::CORBA::Double pstart, + ::CORBA::Boolean inv) + throw (SALOME::SALOME_Exception) +{ + Hex::Edges md_line; + Hex::NewShapes geo_line; + Hex::IntVector sub_ids; + + Vertex_impl* im_first = ::DownCast( mfirst ); + HEXA_NS::Vertex* md_first = im_first->GetImpl(); + + for (int nro = 0; nro < mline.length(); nro++) + { + Edge_impl* im_edge = ::DownCast (mline[nro]); + ASSERT (im_edge); + HEXA_NS::Edge* un_edge = im_edge->GetImpl(); + md_line.push_back (un_edge); + } + + for (int nro = 0; nro < gline.length(); nro++) + { + NewShape_impl* im_shape = ::DownCast (gline[nro]); + ASSERT (im_shape); + HEXA_NS::NewShape* la_shape = im_shape->GetImpl(); + geo_line.push_back (la_shape); + } + + for (int nro = 0; nro < subid.length(); nro++) + { + int alpha = subid [nro]; + sub_ids.push_back (alpha); + } + + ::CORBA::Long ier = _document_cpp->associateClosedLine (md_first, md_line, + geo_line, sub_ids, pstart, inv); + return ier; +} +//--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 +// =========================================================== MakeBiCylinder +Elements_ptr Document_impl::makeBiCylinder (Cylinder_ptr c1In, + Cylinder_ptr c2In) + throw (SALOME::SALOME_Exception) +{ + Elements_ptr result = Elements::_nil(); + + Cylinder_impl* c1Servant = ::DownCast( c1In ); + Cylinder_impl* c2Servant = ::DownCast( c2In ); + + ASSERT( c1Servant ); + ASSERT( c2Servant ); + + if ( c1Servant && c2Servant ) { + HEXA_NS::Cylinder* c1= c1Servant->GetImpl(); + HEXA_NS::Cylinder* c2= c2Servant->GetImpl(); + + HEXA_NS::Elements* grid = _document_cpp->makeBiCylinder (c1,c2); + Elements_impl* servantCorba = new Elements_impl(grid); + result = servantCorba->_this(); + } + return result; +} +// ================================================================ MakeBiPipe +Elements_ptr Document_impl::makeBiPipe (Pipe_ptr p1In, Pipe_ptr p2In) + throw (SALOME::SALOME_Exception) +{ + Pipe_impl* p1Servant = ::DownCast( p1In ); + Pipe_impl* p2Servant = ::DownCast( p2In ); + + ASSERT( p1Servant ); + ASSERT( p2Servant ); + + Elements_ptr result = Elements::_nil(); + + if ( p1Servant && p2Servant ) + { + HEXA_NS::Pipe* p1= p1Servant->GetImpl(); + HEXA_NS::Pipe* p2= p2Servant->GetImpl(); + + HEXA_NS::Elements* grid = _document_cpp->makeBiPipe ( p1, p2); + Elements_impl* servantCorba = new Elements_impl(grid); + result = servantCorba->_this(); + } + + return result; +} + diff --git a/src/HEXABLOCK_I/HexDocument_impl.hxx b/src/HEXABLOCK_I/HexDocument_impl.hxx index 4f5e54a..04089d3 100755 --- a/src/HEXABLOCK_I/HexDocument_impl.hxx +++ b/src/HEXABLOCK_I/HexDocument_impl.hxx @@ -56,7 +56,10 @@ public: ::CORBA::Long countVertex() throw (SALOME::SALOME_Exception); Vertex_ptr getVertex(::CORBA::Long i) throw (SALOME::SALOME_Exception); Vertex_ptr findVertex(::CORBA::Double x, ::CORBA::Double y, ::CORBA::Double z) throw (SALOME::SALOME_Exception); - Edge_ptr addEdge(Vertex_ptr v0, Vertex_ptr v1) throw (SALOME::SALOME_Exception); + Edge_ptr addEdge(Vertex_ptr v0, Vertex_ptr v1) + throw (SALOME::SALOME_Exception); + Edge_ptr addEdgeVector (Vertex_ptr v0, Vector_ptr w1) + throw (SALOME::SALOME_Exception); ::CORBA::Long countEdge() throw (SALOME::SALOME_Exception); Edge_ptr getEdge(::CORBA::Long i) throw (SALOME::SALOME_Exception); Edge_ptr findEdge(Vertex_ptr p1, Vertex_ptr p2) throw (SALOME::SALOME_Exception); @@ -93,25 +96,26 @@ Pipe_ptr getPipe(::CORBA::Long i) throw (SALOME::SALOME_Exception); throw (SALOME::SALOME_Exception); Elements_ptr makeSpherical( Vertex_ptr ptIn, - ::CORBA::Double rayon, + ::CORBA::Double rayon, ::CORBA::Long n, ::CORBA::Double k ) throw (SALOME::SALOME_Exception); Elements_ptr makeCylinder(Cylinder_ptr cyl, Vector_ptr vr, ::CORBA::Long nr, ::CORBA::Long na, ::CORBA::Long nl) throw (SALOME::SALOME_Exception); - Elements_ptr makePipe(Pipe_ptr p, Vector_ptr vr, ::CORBA::Long nr, - ::CORBA::Long na, ::CORBA::Long nl) + Elements_ptr makePipe(Pipe_ptr p, Vector_ptr vr, ::CORBA::Long nr, + ::CORBA::Long na, ::CORBA::Long nl) throw (SALOME::SALOME_Exception); // Elements_ptr makeCylinders(Cylinder_ptr c1, Cylinder_ptr c2) throw (SALOME::SALOME_Exception); - CrossElements_ptr makeCylinders(Cylinder_ptr cyl1, Cylinder_ptr cyl2) throw (SALOME::SALOME_Exception); - - Elements_ptr makePipes(Pipe_ptr p1, Pipe_ptr p2) throw (SALOME::SALOME_Exception); + CrossElements_ptr makeCylinders(Cylinder_ptr cyl1, Cylinder_ptr cyl2) + throw (SALOME::SALOME_Exception); + CrossElements_ptr makePipes(Pipe_ptr p1, Pipe_ptr p2) + throw (SALOME::SALOME_Exception); Elements_ptr prismQuad(Quad_ptr qd, Vector_ptr v, ::CORBA::Long nb) throw (SALOME::SALOME_Exception); Elements_ptr prismQuads(const Quads& qds, Vector_ptr v, ::CORBA::Long nb) throw (SALOME::SALOME_Exception); - Elements_ptr prismQuadsVec(const Quads& qds, Vector_ptr v, + Elements_ptr prismQuadsVec(const Quads& qds, Vector_ptr v, const RealVector &thaut, ::CORBA::Long opt) throw (SALOME::SALOME_Exception); @@ -122,29 +126,29 @@ Pipe_ptr getPipe(::CORBA::Long i) throw (SALOME::SALOME_Exception); ::CORBA::Long mergeEdges(Edge_ptr e1, Edge_ptr e2, Vertex_ptr v1, Vertex_ptr v2) throw (SALOME::SALOME_Exception); ::CORBA::Long mergeVertices(Vertex_ptr v1, Vertex_ptr v2) throw (SALOME::SALOME_Exception); - Elements_ptr disconnectQuad(Hexa_ptr h, Quad_ptr q) + Elements_ptr disconnectQuad(Hexa_ptr h, Quad_ptr q) throw (SALOME::SALOME_Exception); - Elements_ptr disconnectEdge(Hexa_ptr h, Edge_ptr e) + Elements_ptr disconnectEdge(Hexa_ptr h, Edge_ptr e) throw (SALOME::SALOME_Exception); - Elements_ptr disconnectVertex(Hexa_ptr h, Vertex_ptr v) + Elements_ptr disconnectVertex(Hexa_ptr h, Vertex_ptr v) throw (SALOME::SALOME_Exception); - Elements_ptr disconnectEdges(const Hexas& th, const Edges& e) + Elements_ptr disconnectEdges(const Hexas& th, const Edges& e) throw (SALOME::SALOME_Exception); Elements_ptr cut(Edge_ptr e, ::CORBA::Long nb_of_cuts) throw (SALOME::SALOME_Exception); Elements_ptr makeTranslation(Elements_ptr e, Vector_ptr vec) throw (SALOME::SALOME_Exception); -Elements_ptr makeRotation(Elements_ptr l, Vertex_ptr ver, Vector_ptr vec, - ::CORBA::Double angle) +Elements_ptr makeRotation(Elements_ptr l, Vertex_ptr ver, Vector_ptr vec, + ::CORBA::Double angle) throw (SALOME::SALOME_Exception); -Elements_ptr makeScale (Elements_ptr e, Vertex_ptr ver, ::CORBA::Double k) +Elements_ptr makeScale (Elements_ptr e, Vertex_ptr ver, ::CORBA::Double k) throw (SALOME::SALOME_Exception); -Elements_ptr makeSymmetryPoint (Elements_ptr e, Vertex_ptr ver) +Elements_ptr makeSymmetryPoint (Elements_ptr e, Vertex_ptr ver) throw (SALOME::SALOME_Exception); -Elements_ptr makeSymmetryLine (Elements_ptr e, Vertex_ptr ver, Vector_ptr vec) +Elements_ptr makeSymmetryLine (Elements_ptr e, Vertex_ptr ver, Vector_ptr vec) throw (SALOME::SALOME_Exception); Elements_ptr makeSymmetryPlane (Elements_ptr e, Vertex_ptr ver, Vector_ptr vec) throw (SALOME::SALOME_Exception); @@ -154,13 +158,13 @@ Elements_ptr makeSymmetryPlane (Elements_ptr e, Vertex_ptr ver, Vector_ptr vec) void performRotation(Elements_ptr l, Vertex_ptr ver, Vector_ptr vec, ::CORBA::Double angle) throw (SALOME::SALOME_Exception); -void performScale (Elements_ptr e, Vertex_ptr ver, ::CORBA::Double k) +void performScale (Elements_ptr e, Vertex_ptr ver, ::CORBA::Double k) throw (SALOME::SALOME_Exception); -void performSymmetryPoint (Elements_ptr e, Vertex_ptr ver) +void performSymmetryPoint (Elements_ptr e, Vertex_ptr ver) throw (SALOME::SALOME_Exception); -void performSymmetryLine (Elements_ptr e, Vertex_ptr ver, Vector_ptr vec) +void performSymmetryLine (Elements_ptr e, Vertex_ptr ver, Vector_ptr vec) throw (SALOME::SALOME_Exception); -void performSymmetryPlane (Elements_ptr e, Vertex_ptr ver, Vector_ptr vec) +void performSymmetryPlane (Elements_ptr e, Vertex_ptr ver, Vector_ptr vec) throw (SALOME::SALOME_Exception); Group_ptr addHexaGroup(const char* name) throw (SALOME::SALOME_Exception); @@ -186,28 +190,6 @@ void performSymmetryPlane (Elements_ptr e, Vertex_ptr ver, Vector_ptr vec) // Evols 13/12/2010 - ::CORBA::Long associateOpenedLine (Edge_ptr mstart, - const Edges& mline, - GEOM::GEOM_Object_ptr gstart, - ::CORBA::Double pstart, - const Shapes& gline, - ::CORBA::Double pend) - throw (SALOME::SALOME_Exception); - ::CORBA::Long associateClosedLine (Vertex_ptr mfirst, - Edge_ptr mstart, - const Edges& mline, - GEOM::GEOM_Object_ptr gstart, - ::CORBA::Double pstart, - ::CORBA::Boolean inv, - const Shapes& gline) - throw (SALOME::SALOME_Exception); - -void setShape (GEOM::GEOM_Object_ptr geom_object) - throw (SALOME::SALOME_Exception); -GEOM::GEOM_Object_ptr getShape () - throw (SALOME::SALOME_Exception); -char* getBrep () throw (SALOME::SALOME_Exception); - // Evols 05/09/2011 // ::CORBA::Long countUsedVertex () throw (SALOME::SALOME_Exception); @@ -220,7 +202,7 @@ char* getBrep () throw (SALOME::SALOME_Exception); Quad_ptr getUsedQuad (::CORBA::Long i) throw (SALOME::SALOME_Exception); Hexa_ptr getUsedHexa (::CORBA::Long i) throw (SALOME::SALOME_Exception); - Hexa_ptr addHexa5Quads (Quad_ptr q1, Quad_ptr q2, Quad_ptr q3, Quad_ptr q4, + Hexa_ptr addHexa5Quads (Quad_ptr q1, Quad_ptr q2, Quad_ptr q3, Quad_ptr q4, Quad_ptr q5) throw (SALOME::SALOME_Exception); Hexa_ptr addHexa4Quads (Quad_ptr q1, Quad_ptr q2, Quad_ptr q3, Quad_ptr q4) @@ -230,48 +212,76 @@ char* getBrep () throw (SALOME::SALOME_Exception); Hexa_ptr addHexa2Quads (Quad_ptr q1, Quad_ptr q2) throw (SALOME::SALOME_Exception); - Elements_ptr revolutionQuads (const Quads& start, Vertex_ptr center, + Elements_ptr revolutionQuads (const Quads& start, Vertex_ptr center, Vector_ptr axis, const RealVector &angles) throw (SALOME::SALOME_Exception); - Elements_ptr replace (const Quads& pattern, Vertex_ptr p1, Vertex_ptr c1, + Elements_ptr replace (const Quads& pattern, Vertex_ptr p1, Vertex_ptr c1, Vertex_ptr p2, Vertex_ptr c2, Vertex_ptr p3, Vertex_ptr c3) throw (SALOME::SALOME_Exception); - Elements_ptr makeSphere (Vertex_ptr center, Vector_ptr vx, Vector_ptr vz, + Elements_ptr makeSphere (Vertex_ptr center, Vector_ptr vx, Vector_ptr vz, ::CORBA::Double radius, ::CORBA::Double radhole, - Vertex_ptr plorig, + Vertex_ptr plorig, ::CORBA::Long nrad, ::CORBA::Long nang, ::CORBA::Long nhaut) throw (SALOME::SALOME_Exception); - Elements_ptr makePartSphere (Vertex_ptr center, Vector_ptr vx, Vector_ptr vz, + Elements_ptr makePartSphere (Vertex_ptr center, Vector_ptr vx, Vector_ptr vz, ::CORBA::Double radius, ::CORBA::Double radhole, Vertex_ptr plorig, ::CORBA::Double angle, ::CORBA::Long nrad, ::CORBA::Long nang, ::CORBA::Long nhaut) throw (SALOME::SALOME_Exception); - Elements_ptr makeRind (Vertex_ptr center, Vector_ptr vx, Vector_ptr vz, - ::CORBA::Double radext, ::CORBA::Double radint, - ::CORBA::Double radhole, Vertex_ptr plorig, + Elements_ptr makeRind (Vertex_ptr center, Vector_ptr vx, Vector_ptr vz, + ::CORBA::Double radext, ::CORBA::Double radint, + ::CORBA::Double radhole, Vertex_ptr plorig, ::CORBA::Long nrad, ::CORBA::Long nang, ::CORBA::Long nhaut) throw (SALOME::SALOME_Exception); - Elements_ptr makePartRind (Vertex_ptr center, Vector_ptr vx, Vector_ptr vz, - ::CORBA::Double radext, ::CORBA::Double radint, + Elements_ptr makePartRind (Vertex_ptr center, Vector_ptr vx, Vector_ptr vz, + ::CORBA::Double radext, ::CORBA::Double radint, ::CORBA::Double radhole, Vertex_ptr plorig, ::CORBA::Double angle, ::CORBA::Long nrad, ::CORBA::Long nang, ::CORBA::Long nhaut) throw (SALOME::SALOME_Exception); public: - ::CORBA::Boolean removeQuad (Quad_ptr quad) + ::CORBA::Boolean removeQuad (Quad_ptr quad) throw (SALOME::SALOME_Exception); - ::CORBA::Boolean removeElements (Elements_ptr bloc) + ::CORBA::Boolean removeElements (Elements_ptr bloc) throw (SALOME::SALOME_Exception); void setLevel(::CORBA::Long level) throw (SALOME::SALOME_Exception); void clearAssociation () throw (SALOME::SALOME_Exception); + // Hexa5 + + NewShape_ptr addShape (GEOM::GEOM_Object_ptr geom_object, const char* name) + throw (SALOME::SALOME_Exception); + ::CORBA::Long countShape () throw (SALOME::SALOME_Exception); + NewShape_ptr getShape (::CORBA::Long nro) + throw (SALOME::SALOME_Exception); + + ::CORBA::Long associateOpenedLine (const Edges& mline, + const Shapes& gline, + const IntVector& subid, + ::CORBA::Double pstart, + ::CORBA::Double pend) + throw (SALOME::SALOME_Exception); + + ::CORBA::Long associateClosedLine (Vertex_ptr mfirst, + const Edges& mline, + const Shapes& gline, + const IntVector& subid, + ::CORBA::Double pstart, + ::CORBA::Boolean inv) + throw (SALOME::SALOME_Exception); + // Hexa5 + Elements_ptr makeBiCylinder (Cylinder_ptr cyl1, Cylinder_ptr cyl2) + throw (SALOME::SALOME_Exception); + Elements_ptr makeBiPipe (Pipe_ptr p1, Pipe_ptr p2) + throw (SALOME::SALOME_Exception); + private: HEXA_NS::Document *_document_cpp; }; diff --git a/src/HEXABLOCK_I/HexEdge_impl.cxx b/src/HEXABLOCK_I/HexEdge_impl.cxx index 1f4faea..4426ff8 100755 --- a/src/HEXABLOCK_I/HexEdge_impl.cxx +++ b/src/HEXABLOCK_I/HexEdge_impl.cxx @@ -25,7 +25,7 @@ using namespace std; #include "HexVertex_impl.hxx" #include "HexEdge_impl.hxx" -#include "HexShape.hxx" +#include "HexNewShape_impl.hxx" using namespace HEXABLOCK_ORB; @@ -43,12 +43,6 @@ HEXA_NS::Edge* Edge_impl::GetImpl() ::CORBA::Boolean Edge_impl::getWay() throw (SALOME::SALOME_Exception) { -// bool way = _edge_cpp->getWay(); -// if ( way == true ) { -// return CORBA::TRUE; -// else { -// return CORBA::FALSE; -// } return _edge_cpp->getWay(); } @@ -84,132 +78,41 @@ char* Edge_impl::getName() throw (SALOME::SALOME_Exception) } // ========================================================= setName -void Edge_impl::setName(const char* name) +void Edge_impl::setName(const char* name) throw (SALOME::SALOME_Exception) { _edge_cpp->setName (name); } +// ========================================================= setColor void Edge_impl::setColor (::CORBA::Double val) throw (SALOME::SALOME_Exception) { _edge_cpp->setColor (val); } -void Edge_impl::setScalar( ::CORBA::Double val )throw (SALOME::SALOME_Exception) -{ - _edge_cpp->setScalar(val); -} - - -::CORBA::Long Edge_impl::addAssociation( GEOM::GEOM_Object_ptr geom_object_1D, double debut, double fin ) - throw (SALOME::SALOME_Exception) -{ - ::CORBA::Long ok; - TopoDS_Shape aShape = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->geomObjectToShape( geom_object_1D ); - string strBrep = shape2string( aShape ); - CORBA::String_var anIOR = HEXABLOCK_Gen_i::GetORB()->object_to_string( geom_object_1D ); - HEXA_NS::Shape* s = new HEXA_NS::Shape( strBrep ); - s->ior = anIOR.in(); //geom_object_1D->GetStudyEntry(); GetEntry() - s->ident = geom_object_1D->GetStudyEntry(); - s->debut = debut; - s->fin = fin; - ok = _edge_cpp->addAssociation( s ); - -// Edge_impl::Assoc assoc; -// assoc.geomObj = GEOM::GEOM_Object::_duplicate( geom_object_1D ); -// assoc.debut = debut; -// assoc.fin = fin; -// _associations.push_back(assoc); - - return ok; -} - +// ========================================================= clearAssociation void Edge_impl::clearAssociation() throw (SALOME::SALOME_Exception) { _edge_cpp->clearAssociation (); } - - -// EdgeAssociations* Edge_impl::getAssociations() //CS_NOT_SPEC -// throw (SALOME::SALOME_Exception) -// { -// HEXABLOCK_ORB::EdgeAssociations* result = new HEXABLOCK_ORB::EdgeAssociations; -// result->length( _associations.size() ); -// -// HEXABLOCK_ORB::EdgeAssociation assoc; -// CORBA::ULong i = 0; -// for ( std::vector::const_iterator iter = _associations.begin(); -// iter != _associations.end(); -// ++iter){ -// // assoc.geomObj = (*iter).geomObj; -// assoc.geomObj = GEOM::GEOM_Object::_duplicate( (*iter).geomObj ); -// assoc.debut = (*iter).debut; -// assoc.fin = (*iter).fin; -// (*result)[i++] = assoc; -// } -// return result; -// } - - - - -EdgeAssociations* Edge_impl::getAssociations () +// =========================================================== countAssociation +::CORBA::Long Edge_impl::countAssociation () throw (SALOME::SALOME_Exception) { - HEXABLOCK_ORB::EdgeAssociations* result = new HEXABLOCK_ORB::EdgeAssociations; -// HEXABLOCK_ORB::GEOM_Object_ptr ge; -// GEOM::GEOM_Object_ptr ge; - TopoDS_Shape aShape; - const std::vector shapes = _edge_cpp->getAssociations(); - - result->length( shapes.size() ); - HEXABLOCK_ORB::EdgeAssociation assoc; - CORBA::ULong i = 0; - CORBA::Object_var corbaObj; - GEOM::GEOM_Object_var geomObj; - -// std::cout << "XXXXXXXX shapes "<< shapes.size() << std::endl; - for ( std::vector::const_iterator iter = shapes.begin(); - iter != shapes.end(); - ++iter ){ -// ge = GEOM::GEOM_Object::_duplicate(HEXABLOCK::GetHEXABLOCKGen()->shapeToGeomObject( aShape )); -// ge = HEXABLOCK_ORB::GEOM_Edge::_duplicate(HEXABLOCK::GetHEXABLOCKGen()->shapeToGeomObject( aShape )); -// ge = HEXABLOCK::GetHEXABLOCKGen()->shapeToGeomObject( aShape ); -// ge->debut( (*iter)->debut ); -// ge->fin( (*iter)->fin ); -// assoc.geomObj = GEOM::GEOM_Object::_duplicate( (*iter).geomObj ); -// aShape = string2shape( (*iter)->getBrep()); -// assoc.geomObj = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->shapeToGeomObject( aShape ); - -// if ( !(*iter)->ior.empty() ){ -// corbaObj = HEXABLOCK_Gen_i::GetORB()->string_to_object( (*iter)->ior.c_str() ); -// if ( !CORBA::is_nil( corbaObj ) ){ -// geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); -// assoc.geomObj = geomObj._retn(); -// assoc.debut = (*iter)->debut; -// assoc.fin = (*iter)->fin; -// (*result)[ i++ ] = assoc; -// } -// } - assoc.debut = (*iter)->debut; - assoc.fin = (*iter)->fin; - - if ( !(*iter)->ior.empty() ){ // geom object from current session - corbaObj = HEXABLOCK_Gen_i::GetORB()->string_to_object( (*iter)->ior.c_str() ); - if ( !CORBA::is_nil( corbaObj ) ){ - geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); - assoc.geomObj = geomObj._retn(); - } - } else { // no geom object => we have to built it - assoc.geomObj = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->brepToGeomObject( (*iter)->getBrep() ); - } - - (*result)[ i++ ] = assoc; - } - return result; + return _edge_cpp->countAssociation (); } +// ========================================================= addAssociation +::CORBA::Long Edge_impl::addAssociation (NewShape_ptr geom, + ::CORBA::Long subid, + double debut, double fin ) + throw (SALOME::SALOME_Exception) +{ + NewShape_impl* im_shape = ::DownCast (geom ); + HEXA_NS::NewShape* md_shape = im_shape->GetImpl(); - + ::CORBA::Long ier = _edge_cpp->addAssociation (md_shape, subid, debut, fin); + return ier; +} diff --git a/src/HEXABLOCK_I/HexEdge_impl.hxx b/src/HEXABLOCK_I/HexEdge_impl.hxx index a0c349c..069511f 100755 --- a/src/HEXABLOCK_I/HexEdge_impl.hxx +++ b/src/HEXABLOCK_I/HexEdge_impl.hxx @@ -25,6 +25,7 @@ #include "hexa_base.hxx" #include "HexEdge.hxx" +#include "HexNewShape_impl.hxx" using namespace HEXABLOCK_ORB; @@ -43,25 +44,23 @@ public: ::CORBA::Boolean getWay() throw (SALOME::SALOME_Exception); Vertex_ptr getVertex(::CORBA::Long n) throw (SALOME::SALOME_Exception); -// void setAssociation(GEOM::GEOM_Object_ptr geom_object_1D) throw (SALOME::SALOME_Exception); -// GEOM::GEOM_Object_ptr getAssociation() throw (SALOME::SALOME_Exception); - ::CORBA::Long addAssociation( GEOM::GEOM_Object_ptr geom_object_1D, double debut, double fin ) //CS_NOT_SPEC - throw (SALOME::SALOME_Exception); void clearAssociation() throw (SALOME::SALOME_Exception); - EdgeAssociations* getAssociations () //CS_NOT_SPEC + ::CORBA::Long countAssociation () throw (SALOME::SALOME_Exception); void setColor (::CORBA::Double val) throw (SALOME::SALOME_Exception); - void setScalar( ::CORBA::Double val )throw (SALOME::SALOME_Exception); void dump() throw (SALOME::SALOME_Exception); void printName() throw (SALOME::SALOME_Exception); char* getName() throw (SALOME::SALOME_Exception); void setName (const char* name) throw (SALOME::SALOME_Exception); + ::CORBA::Long addAssociation (NewShape_ptr geom, ::CORBA::Long subid, + double debut, double fin ) + throw (SALOME::SALOME_Exception); + private: HEXA_NS::Edge* _edge_cpp; - std::vector _associations; }; #endif diff --git a/src/HEXABLOCK_I/HexNewShape_impl.cxx b/src/HEXABLOCK_I/HexNewShape_impl.cxx new file mode 100755 index 0000000..c222803 --- /dev/null +++ b/src/HEXABLOCK_I/HexNewShape_impl.cxx @@ -0,0 +1,113 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#include "HEXABLOCK.hxx" +#include "utilities.h" + +#include + +#include "HexNewShape_impl.hxx" + +// ============================================================== Constructeur +NewShape_impl::NewShape_impl( HEXA_NS::NewShape *ptrCpp ) +{ + _shape_cpp = ptrCpp; +} +// ============================================================== GetImpl +HEXA_NS::NewShape* NewShape_impl::GetImpl() + throw (SALOME::SALOME_Exception) +{ + return _shape_cpp; +} +// ========================================================= countVertex +::CORBA::Long NewShape_impl::countVertex () + throw (SALOME::SALOME_Exception) +{ + return _shape_cpp->countVertex (); +} +// ========================================================= countEdge +::CORBA::Long NewShape_impl::countEdge () + throw (SALOME::SALOME_Exception) +{ + return _shape_cpp->countEdge (); +} +// ========================================================= countFace +::CORBA::Long NewShape_impl::countFace () + throw (SALOME::SALOME_Exception) +{ + return _shape_cpp->countFace (); +} +// --------------------------------------------------------------------- +// ========================================================= getVertex +::CORBA::Long NewShape_impl::getVertex (::CORBA::Long nro) + throw (SALOME::SALOME_Exception) +{ + return _shape_cpp->getVertex (nro); +} +// ========================================================= getEdge +::CORBA::Long NewShape_impl::getEdge (::CORBA::Long nro) + throw (SALOME::SALOME_Exception) +{ + return _shape_cpp->getEdge (nro); +} +// ========================================================= getFace +::CORBA::Long NewShape_impl::getFace (::CORBA::Long nro) + throw (SALOME::SALOME_Exception) +{ + return _shape_cpp->getFace (nro); +} +// --------------------------------------------------------------------- +// ========================================================= getNameVertex +char* NewShape_impl::getNameVertex (::CORBA::Long nro) + throw (SALOME::SALOME_Exception) +{ + return CORBA::string_dup (_shape_cpp->getNameVertex (nro)); +} +// ========================================================= getNameEdge +char* NewShape_impl::getNameEdge (::CORBA::Long nro) + throw (SALOME::SALOME_Exception) +{ + return CORBA::string_dup (_shape_cpp->getNameEdge (nro)); +} +// ========================================================= getNameFace +char* NewShape_impl::getNameFace (::CORBA::Long nro) + throw (SALOME::SALOME_Exception) +{ + return CORBA::string_dup (_shape_cpp->getNameFace (nro)); +} +// ========================================================= dump +void NewShape_impl::dump() throw (SALOME::SALOME_Exception) +{ + +} +// ========================================================= setName +void NewShape_impl::printName() throw (SALOME::SALOME_Exception) +{ + _shape_cpp->printName(); +} +// ========================================================= setName +char* NewShape_impl::getName() throw (SALOME::SALOME_Exception) +{ + return CORBA::string_dup( _shape_cpp->getName() ); +} +// ========================================================= setName +void NewShape_impl::setName(const char* name) + throw (SALOME::SALOME_Exception) +{ + _shape_cpp->setName (name); +} diff --git a/src/HEXABLOCK_I/HexNewShape_impl.hxx b/src/HEXABLOCK_I/HexNewShape_impl.hxx new file mode 100755 index 0000000..cacb715 --- /dev/null +++ b/src/HEXABLOCK_I/HexNewShape_impl.hxx @@ -0,0 +1,70 @@ +// Copyright (C) 2009-2012 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +#ifndef __HexNewShape_impl__ +#define __HexNewShape_impl__ + +#include +#include CORBA_SERVER_HEADER(NewShape) +#include "SALOME_GenericObj_i.hh" + +#include "hexa_base.hxx" +#include "HexNewShape.hxx" + +using namespace HEXABLOCK_ORB; + +class NewShape_impl : public POA_HEXABLOCK_ORB::NewShape, + public SALOME::GenericObj_i +{ +public: + NewShape_impl (HEXA_NS::NewShape *ptrCpp); + HEXA_NS::NewShape* GetImpl() throw (SALOME::SALOME_Exception); + + + ::CORBA::Long countVertex () + throw (SALOME::SALOME_Exception); + ::CORBA::Long countEdge () + throw (SALOME::SALOME_Exception); + ::CORBA::Long countFace () + throw (SALOME::SALOME_Exception); + + ::CORBA::Long getVertex (::CORBA::Long nro) + throw (SALOME::SALOME_Exception); + ::CORBA::Long getEdge (::CORBA::Long nro) + throw (SALOME::SALOME_Exception); + ::CORBA::Long getFace (::CORBA::Long nro) + throw (SALOME::SALOME_Exception); + + char* getNameVertex (::CORBA::Long nro) + throw (SALOME::SALOME_Exception); + char* getNameEdge (::CORBA::Long nro) + throw (SALOME::SALOME_Exception); + char* getNameFace (::CORBA::Long nro) + throw (SALOME::SALOME_Exception); + + void dump() throw (SALOME::SALOME_Exception); + void printName() throw (SALOME::SALOME_Exception); + char* getName() throw (SALOME::SALOME_Exception); + void setName (const char* name) throw (SALOME::SALOME_Exception); + + +private: + HEXA_NS::NewShape* _shape_cpp; +}; + +#endif diff --git a/src/HEXABLOCK_I/HexPropagation_impl.cxx b/src/HEXABLOCK_I/HexPropagation_impl.cxx index 49af3b5..ddb1849 100755 --- a/src/HEXABLOCK_I/HexPropagation_impl.cxx +++ b/src/HEXABLOCK_I/HexPropagation_impl.cxx @@ -45,19 +45,12 @@ HEXABLOCK_ORB::Edges* Propagation_impl::getEdges() throw (SALOME::SALOME_Excepti HEXABLOCK_ORB::Edges* result = new HEXABLOCK_ORB::Edges; const HEXA_NS::Edges& edges_cpp = _propagation_cpp->getEdges(); -// HEXA_NS::Edges edges_cpp = _propagation_cpp->getEdges(); - std::cout<<"XX edges_cpp.size() ->"<length( edges_cpp.size() ); -// HEXA_NS::Edges::const_iterator itertest = edges_cpp.begin(); -// itertest != edges_cpp.end(); for ( HEXA_NS::Edges::const_iterator iter = edges_cpp.begin(); iter != edges_cpp.end(); ++iter){ -// printf (" ("); -// (*iter)->getVertex (0)->printName (", "); -// (*iter)->getVertex (1)->printName (")\n"); Edge_impl *servantEdge = new Edge_impl( *iter ); (*result)[ i++ ] = servantEdge->_this(); @@ -66,26 +59,6 @@ HEXABLOCK_ORB::Edges* Propagation_impl::getEdges() throw (SALOME::SALOME_Excepti } -// HEXABLOCK_ORB::Ways* Propagation_impl::getWays() throw (SALOME::SALOME_Exception) -// { -// HEXABLOCK_ORB::Ways* result = new HEXABLOCK_ORB::Ways; -// const vector& ways_cpp = _propagation_cpp->getWays(); -// -// CORBA::ULong i = 0; -// result->length( ways_cpp.size() ); -// for ( vector::const_iterator iter = ways_cpp.begin(); -// iter != ways_cpp.end(); ++iter ){ -// (*result)[ i++ ] = *iter; -// // if (*iter == true ) { -// // (*result)[ i++ ] = ::CORBA::TRUE; -// // } else { -// // (*result)[ i++ ] = ::CORBA::FALSE; -// // } -// } -// return result; -// -// } - void Propagation_impl::setLaw(HEXABLOCK_ORB::Law_ptr lawIn) throw (SALOME::SALOME_Exception) { Law_impl* lawInServant = ::DownCast( lawIn ); diff --git a/src/HEXABLOCK_I/HexQuad_impl.cxx b/src/HEXABLOCK_I/HexQuad_impl.cxx index c647ecd..b640ad1 100755 --- a/src/HEXABLOCK_I/HexQuad_impl.cxx +++ b/src/HEXABLOCK_I/HexQuad_impl.cxx @@ -26,7 +26,6 @@ using namespace std; #include "HexQuad_impl.hxx" #include "HexVertex_impl.hxx" #include "HexEdge_impl.hxx" -#include "HexShape.hxx" Quad_impl::Quad_impl( HEXA_NS::Quad *ptrCpp ):_quad_cpp(ptrCpp) { @@ -68,22 +67,14 @@ Vertex_ptr Quad_impl::getVertex(::CORBA::Long n) -::CORBA::Long Quad_impl::addAssociation( GEOM::GEOM_Object_ptr geom_object_2D) +::CORBA::Long Quad_impl::addAssociation(NewShape_ptr geom, ::CORBA::Long subid) throw (SALOME::SALOME_Exception) { - ::CORBA::Long ok; + NewShape_impl* im_shape = ::DownCast (geom ); + HEXA_NS::NewShape* md_shape = im_shape->GetImpl(); - TopoDS_Shape aShape = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->geomObjectToShape( geom_object_2D ); - string strBrep = shape2string( aShape ); - - CORBA::String_var anIOR = HEXABLOCK_Gen_i::GetORB()->object_to_string( geom_object_2D ); - HEXA_NS::Shape* s = new HEXA_NS::Shape( strBrep ); - s->ior = anIOR.in(); - s->ident = geom_object_2D->GetStudyEntry(); - - ok = _quad_cpp->addAssociation( s ); -// _associations.push_back(GEOM::GEOM_Object::_duplicate( geom_object_2D )); - return ok; + ::CORBA::Long ier = _quad_cpp->addAssociation (md_shape, subid); + return ier; } void Quad_impl::clearAssociation() @@ -92,70 +83,6 @@ void Quad_impl::clearAssociation() _quad_cpp->clearAssociation (); } - - -GEOM::ListOfGO* Quad_impl::getAssociations() //CS_NOT_SPEC - throw (SALOME::SALOME_Exception) -// { -// GEOM::ListOfGO* result = new GEOM::ListOfGO; -// result->length( _associations.size() ); -// -// CORBA::ULong i = 0; -// for ( std::vector::const_iterator iter = _associations.begin(); -// iter != _associations.end(); -// ++iter){ -// // (*result)[i++] = *iter; -// (*result)[i++] = GEOM::GEOM_Object::_duplicate( *iter ); -// } -// return result; -// } -{ - TopoDS_Shape aShape; - const std::vector shapes = _quad_cpp->getAssociations(); - - GEOM::ListOfGO* result = new GEOM::ListOfGO; - result->length( shapes.size() ); - - CORBA::Object_var corbaObj; - GEOM::GEOM_Object_var geomObj; - HEXABLOCK_ORB::EdgeAssociation assoc; - CORBA::ULong i = 0; - for ( std::vector::const_iterator iter = shapes.begin(); - iter != shapes.end(); - ++iter ){ - if ( !(*iter)->ior.empty() ){ // geom object from current session - corbaObj = HEXABLOCK_Gen_i::GetORB()->string_to_object( (*iter)->ior.c_str() ); - if ( !CORBA::is_nil( corbaObj ) ){ - geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); - } - } else { // no geom object => we have to built it - geomObj = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->brepToGeomObject( (*iter)->getBrep() ); - } - (*result)[ i++ ] = geomObj._retn(); - } - - return result; -} - - - - - - - - -// void Quad_impl::setAssociation(GEOM::GEOM_Object_ptr geom_object_2D) throw (SALOME::SALOME_Exception) -// { -// } -// -// GEOM::GEOM_Object_ptr Quad_impl::getAssociation() throw (SALOME::SALOME_Exception) -// { -// } -// -// void Quad_impl::removeAssociation() throw (SALOME::SALOME_Exception) -// { -// } - void Quad_impl::setColor (::CORBA::Double val) throw (SALOME::SALOME_Exception) { @@ -183,7 +110,7 @@ char* Quad_impl::getName() throw (SALOME::SALOME_Exception) return CORBA::string_dup( _quad_cpp->getName() ); } // ========================================================= setName -void Quad_impl::setName(const char* name) +void Quad_impl::setName(const char* name) throw (SALOME::SALOME_Exception) { _quad_cpp->setName (name); diff --git a/src/HEXABLOCK_I/HexQuad_impl.hxx b/src/HEXABLOCK_I/HexQuad_impl.hxx index e0aaa8d..183565e 100755 --- a/src/HEXABLOCK_I/HexQuad_impl.hxx +++ b/src/HEXABLOCK_I/HexQuad_impl.hxx @@ -38,10 +38,10 @@ public: Edge_ptr getEdge(::CORBA::Long n) throw (SALOME::SALOME_Exception); Vertex_ptr getVertex(::CORBA::Long n) throw (SALOME::SALOME_Exception); -// void setAssociation(GEOM::GEOM_Object_ptr geom_object_2D) throw (SALOME::SALOME_Exception); -// GEOM::GEOM_Object_ptr getAssociation() throw (SALOME::SALOME_Exception); - ::CORBA::Long addAssociation ( GEOM::GEOM_Object_ptr geom_object_2D) //CS_NOT_SPEC - throw (SALOME::SALOME_Exception); + + ::CORBA::Long addAssociation (NewShape_ptr geom, ::CORBA::Long subid) + throw (SALOME::SALOME_Exception); + GEOM::ListOfGO* getAssociations () //CS_NOT_SPEC throw (SALOME::SALOME_Exception); @@ -57,7 +57,6 @@ public: private: HEXA_NS::Quad *_quad_cpp; -// std::vector _associations; }; #endif diff --git a/src/HEXABLOCK_I/HexVertex_impl.cxx b/src/HEXABLOCK_I/HexVertex_impl.cxx index dcf0030..6be2c08 100755 --- a/src/HEXABLOCK_I/HexVertex_impl.cxx +++ b/src/HEXABLOCK_I/HexVertex_impl.cxx @@ -24,11 +24,10 @@ using namespace std; #include "hexa_base.hxx" #include "HexVertex_impl.hxx" -#include "HexShape.hxx" +#include "HexNewShape_impl.hxx" Vertex_impl::Vertex_impl( HEXA_NS::Vertex *ptrCpp ): _vertex_cpp( ptrCpp ) -// _association( GEOM::GEOM_Object::_nil() ) { } @@ -67,48 +66,6 @@ void Vertex_impl::setZ( CORBA::Double z ) throw(SALOME::SALOME_Exception) _vertex_cpp->setZ(z); } - -void Vertex_impl::setAssociation(GEOM::GEOM_Object_ptr geom_object_vertex) - throw (SALOME::SALOME_Exception) -{ - TopoDS_Shape shape = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->geomObjectToShape(geom_object_vertex); -// HEXABLOCK::HEXABLOCK* gen = HEXABLOCK::GetHEXABLOCKGen(); -// TopoDS_Shape shape = gen->geomObjectToShape(geom_object_vertex); - string strBrep = shape2string( shape ); - CORBA::String_var anIOR = HEXABLOCK_Gen_i::GetORB()->object_to_string( geom_object_vertex ); - HEXA_NS::Shape* s = new HEXA_NS::Shape( strBrep ); - s->ior = anIOR.in(); - s->ident = geom_object_vertex->GetStudyEntry(); //geom_object_vertex->GetEntry() - _vertex_cpp->setAssociation(s); - -// _association = GEOM::GEOM_Object::_duplicate( geom_object_vertex ); -} - - -GEOM::GEOM_Object_ptr Vertex_impl::getAssociation() - throw (SALOME::SALOME_Exception) -{ -// GEOM::GEOM_Object_var result = GEOM::GEOM_Object::_nil(); -// GEOM::GEOM_Object_ptr result = GEOM::GEOM_Object::_nil(); - GEOM::GEOM_Object_var geomObj; // = new GEOM::GEOM_Object; - CORBA::Object_var corbaObj; - - HEXA_NS::Shape* s = _vertex_cpp->getAssociation(); - if (s != NULL){ - if ( !s->ior.empty() ){ // geom object from current session - corbaObj = HEXABLOCK_Gen_i::GetORB()->string_to_object( s->ior.c_str() ); - if ( !CORBA::is_nil( corbaObj ) ){ - geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); - } - } else { // no geom object => we have to built it - geomObj = HEXABLOCK_Gen_i::GetHEXABLOCKGen()->brepToGeomObject( s->getBrep() ); - } - } - - return geomObj._retn(); -} - - void Vertex_impl::clearAssociation() throw (SALOME::SALOME_Exception) { @@ -122,11 +79,6 @@ void Vertex_impl::setColor (::CORBA::Double val) _vertex_cpp->setColor (val); } -void Vertex_impl::setScalar( ::CORBA::Double val )throw (SALOME::SALOME_Exception) -{ - _vertex_cpp->setScalar(val); -} - void Vertex_impl::dump() throw (SALOME::SALOME_Exception) { _vertex_cpp->dump(); @@ -143,9 +95,35 @@ char* Vertex_impl::getName() throw (SALOME::SALOME_Exception) { return CORBA::string_dup( _vertex_cpp->getName() ); } +// ========================================================== setAssociation +::CORBA::Long Vertex_impl::setAssociation (NewShape_ptr geom, + ::CORBA::Long subid) + throw (SALOME::SALOME_Exception) +{ + NewShape_impl* im_shape = ::DownCast (geom ); + HEXA_NS::NewShape* md_shape = im_shape->GetImpl(); + + ::CORBA::Long ier = _vertex_cpp->setAssociation (md_shape, subid); + return ier; +} // ========================================================= setName -void Vertex_impl::setName(const char* name) +void Vertex_impl::setName(const char* name) throw (SALOME::SALOME_Exception) { _vertex_cpp->setName (name); } +// ========================================================= getAssoX +CORBA::Double Vertex_impl::getAssoX() throw(SALOME::SALOME_Exception) +{ + return _vertex_cpp->getAssoX(); +} +// ========================================================= getAssoY +CORBA::Double Vertex_impl::getAssoY() throw(SALOME::SALOME_Exception) +{ + return _vertex_cpp->getAssoY(); +} +// ========================================================= getAssoZ +CORBA::Double Vertex_impl::getAssoZ() throw(SALOME::SALOME_Exception) +{ + return _vertex_cpp->getAssoZ(); +} diff --git a/src/HEXABLOCK_I/HexVertex_impl.hxx b/src/HEXABLOCK_I/HexVertex_impl.hxx index a1cb8f4..853155e 100755 --- a/src/HEXABLOCK_I/HexVertex_impl.hxx +++ b/src/HEXABLOCK_I/HexVertex_impl.hxx @@ -19,16 +19,14 @@ #ifndef __HexVertex_impl__ #define __HexVertex_impl__ -// #include - #include #include CORBA_SERVER_HEADER(Vertex) #include "SALOME_GenericObj_i.hh" #include "hexa_base.hxx" -#include "hexa_base.hxx" #include "HexVertex.hxx" +#include "HexNewShape_impl.hxx" class Vertex_impl : public POA_HEXABLOCK_ORB::Vertex, public SALOME::GenericObj_i @@ -40,24 +38,29 @@ public: ::CORBA::Double getX() throw (SALOME::SALOME_Exception); ::CORBA::Double getY() throw (SALOME::SALOME_Exception); ::CORBA::Double getZ() throw (SALOME::SALOME_Exception); + void setX(::CORBA::Double x) throw (SALOME::SALOME_Exception); void setY(::CORBA::Double y) throw (SALOME::SALOME_Exception); void setZ(::CORBA::Double z) throw (SALOME::SALOME_Exception); - void setAssociation(GEOM::GEOM_Object_ptr geom_object_vertex) throw (SALOME::SALOME_Exception); GEOM::GEOM_Object_ptr getAssociation() throw (SALOME::SALOME_Exception); void clearAssociation() throw (SALOME::SALOME_Exception); void setColor (::CORBA::Double val) throw (SALOME::SALOME_Exception); - void setScalar( ::CORBA::Double val )throw (SALOME::SALOME_Exception); void dump() throw (SALOME::SALOME_Exception); void printName() throw (SALOME::SALOME_Exception); char* getName() throw (SALOME::SALOME_Exception); void setName (const char* name) throw (SALOME::SALOME_Exception); + ::CORBA::Long setAssociation (NewShape_ptr geom, ::CORBA::Long subid) + throw (SALOME::SALOME_Exception); // Hexa5 + + ::CORBA::Double getAssoX() throw (SALOME::SALOME_Exception); + ::CORBA::Double getAssoY() throw (SALOME::SALOME_Exception); + ::CORBA::Double getAssoZ() throw (SALOME::SALOME_Exception); + private: HEXA_NS::Vertex* _vertex_cpp; -// GEOM::GEOM_Object_ptr _association; }; #endif diff --git a/src/HEXABLOCK_I/Makefile.am b/src/HEXABLOCK_I/Makefile.am index 679c294..9d9531d 100755 --- a/src/HEXABLOCK_I/Makefile.am +++ b/src/HEXABLOCK_I/Makefile.am @@ -43,6 +43,7 @@ salomeinclude_HEADERS = \ HexPropagation_impl.hxx \ HexQuad_impl.hxx \ HexVector_impl.hxx \ + HexNewShape_impl.hxx \ HexVertex_impl.hxx # Scripts to be installed @@ -59,6 +60,7 @@ dist_libHEXABLOCKEngine_la_SOURCES = \ HexQuad_impl.cxx \ HexHexa_impl.cxx \ HexVector_impl.cxx \ + HexNewShape_impl.cxx \ HexElements_impl.cxx \ HexCrossElements_impl.cxx \ HexCylinder_impl.cxx \ @@ -79,6 +81,7 @@ libHEXABLOCKEngine_la_CPPFLAGS = \ $(GEOM_CXXFLAGS) \ $(CAS_CPPFLAGS) \ -I$(srcdir)/../HEXABLOCK \ + -I$(top_builddir) \ -I$(top_builddir)/idl \ -I$(top_builddir)/salome_adm/unix diff --git a/src/HEXABLOCK_I/hexablock.py b/src/HEXABLOCK_I/hexablock.py index a99d685..3bdb45e 100755 --- a/src/HEXABLOCK_I/hexablock.py +++ b/src/HEXABLOCK_I/hexablock.py @@ -30,10 +30,16 @@ import HEXABLOCKPlugin geompy = smesh.geompy +# Gives the component name +# ----------------------------------------------------------- + +def moduleName() : + return "HEXABLOCK" + # Load HEXABLOCK componant # ------------------------ -component = salome.lcc.FindOrLoadComponent("FactoryServer", "HEXABLOCK") +component = salome.lcc.FindOrLoadComponent("FactoryServer", moduleName()) component = component._narrow(HEXABLOCK_Gen) for k in dir(component): @@ -43,6 +49,12 @@ for k in dir(component): del k +# Gives the component +# ----------------------------------------------------------- + +def getEngine() : + return component + # Add laws on propagations based on min or max segment length # ----------------------------------------------------------- @@ -154,30 +166,27 @@ def mesh(doc, name=None, dim=3, container="FactoryServer"): study = salome.myStudy if type(doc) == type(""): - sobject = study.FindObjectID(doc) - builder = study.NewBuilder() - ok, ior = builder.FindAttribute(sobject, "AttributeIOR") - obj = salome.orb.string_to_object(ior.Value()) - doc = obj._narrow(Document) + doc = component.findDocument (doc) - shape = doc.getShape() - if shape == None: - shape = geompy.MakeBox(0, 0, 0, 1, 1, 1) + #### shape = doc.getShape() + #### if shape == None: + #### shape = geompy.MakeBox(0, 0, 0, 1, 1, 1) + shape = geompy.MakeBox(0, 0, 0, 1, 1, 1) if (name == None) or (name == ""): name = doc.getName() geompy.addToStudy(shape, name) - component = salome.lcc.FindOrLoadComponent(container, "SMESH") - component.init_smesh(study, geompy.geom) - meshexa = component.Mesh(shape) + comp_smesh = salome.lcc.FindOrLoadComponent(container, "SMESH") + comp_smesh.init_smesh(study, geompy.geom) + meshexa = comp_smesh.Mesh(shape) so = "libHexaBlockEngine.so" - algo = smesh.SMESH._objref_SMESH_Gen.CreateHypothesis(component, "HEXABLOCK_3D", so) + algo = smesh.SMESH._objref_SMESH_Gen.CreateHypothesis(comp_smesh, "HEXABLOCK_3D", so) meshexa.mesh.AddHypothesis(shape, algo) - hypo = smesh.SMESH._objref_SMESH_Gen.CreateHypothesis(component, "HEXABLOCK_Parameters", so) + hypo = smesh.SMESH._objref_SMESH_Gen.CreateHypothesis(comp_smesh, "HEXABLOCK_Parameters", so) meshexa.mesh.AddHypothesis(shape, hypo) hypo.SetDocument(doc) @@ -186,3 +195,61 @@ def mesh(doc, name=None, dim=3, container="FactoryServer"): meshexa.Compute() return meshexa + +# Get a document from the current study +# ------------------------------------- + +def getFromStudy(entry): + study = salome.myStudy + sobject = study.FindObjectID(entry) + if sobject == None : + print " **** Entry ", entry, " is undefined" + return None + + builder = study.NewBuilder() + ok, attname = builder.FindAttribute(sobject, "AttributeName") + docname = attname.Value() + doc = component.findDocument(docname) + if doc == None : + print " **** Entry ", entry, " doesn't correspond to an HexaBlock Document" + + return doc + +# Find or create HexaBlock Study Component +# ------------------------------------- + +def findOrCreateComponent( study, builder ): + father = study.FindComponent( moduleName() ) + if father is None: + father = builder.NewComponent( moduleName() ) + attr = builder.FindOrCreateAttribute( father, "AttributeName" ) + attr.SetValue( "HexaBlock" ) + attr = builder.FindOrCreateAttribute( father, "AttributePixMap" ) + ### attr.SetPixMap( "ICON_OBJBROWSER_HEXABLOCK" ) + attr.SetPixMap( "ICO_MODULE_HEXABLOCK_SMALL" ) + builder.DefineComponentInstance( father, getEngine() ) + + return father + +# Add a document in the current study +# ------------------------------------- + +def addToStudy(doc): + if doc == None : + print " *** addToStudy : Bad Document Pointer" + return + + study = salome.myStudy + builder = study.NewBuilder() + father = findOrCreateComponent( study, builder ) + name = doc.getName () + + present = study.FindObjectByName(name, moduleName()) + if present != [] : + print " *** addToStudy : Document ", name, "is already in the study" + return + + object = builder.NewObject( father ) + attr = builder.FindOrCreateAttribute( object, "AttributeName" ) + attr.SetValue( name ) + return object.GetID () diff --git a/src/TEST_CPP/ModelTest.cxx b/src/TEST_CPP/ModelTest.cxx index 28da605..1013cfe 100755 --- a/src/TEST_CPP/ModelTest.cxx +++ b/src/TEST_CPP/ModelTest.cxx @@ -32,7 +32,6 @@ #include "HexVertex.hxx" #include "HexPropagation.hxx" -#include "HexShape.hxx" #include "HexLaw.hxx" #include "HexMatrix.hxx" @@ -92,12 +91,12 @@ void ModelTest::_print_propagations (Hex::Document* doc) // Hex::Hex mon_ex; // Hex::Document* doc = mon_ex.addDocument (); // Hex::Vertex* orig = doc->addVertex (0,0,0); -// +// // int ncouches = 1; // double k = 0.8; // Hex::Vector* decal = doc->addVector (1,1,1); // Hex::Elements* sphere = doc->makeSpherical (orig, decal, ncouches, k); -// +// // for (int nc=0 ; nc <= ncouches ; nc++) // { // Hex::Hexa* cell = sphere->getStrate (nc, Hex::Q_A); @@ -105,14 +104,14 @@ void ModelTest::_print_propagations (Hex::Document* doc) // // sphere->getStrate (nc, Hex::Q_A)->remove (); // // sphere->getStrate (nc, Hex::Q_B)->remove (); // } -// +// // sphere->saveVtk ("sphere.vtk"); // CPPUNIT_ASSERT( true ); // } // ======================================================== Test_cartesi1 void ModelTest::Test_cartesi1 () { - + const int size_x = 15; const int size_y = 12; const int size_z = 8; @@ -133,7 +132,7 @@ void ModelTest::Test_cartesi1 () Hex::Hexa* cell = grid->getHexaIJK (nx, ny, nz); cell->remove (); } - + doc->setLevel (1); _print_propagations (doc); grid->saveVtk ("grid_cart.vtk"); @@ -157,7 +156,7 @@ int ModelTest::_afficher (cpchar nom, Hex::EltBase* elt) // ======================================================== Test_find void ModelTest::Test_find () { - + const int size_x = 2; const int size_y = 2; const int size_z = 2; @@ -202,7 +201,7 @@ void ModelTest::Test_find () // ======================================================== Test_joint void ModelTest::Test_joint () { - + const int dimx = 11; const int dimy = 11; const int dimz = 2; @@ -218,13 +217,13 @@ void ModelTest::Test_joint () Hex::Vertex* orig2 = doc->addVertex (dimx/2.0,0,8); Hex::Vector* vectj = doc->addVector (0,1,0); Hex::Vector* vecti = doc->addVector (1,0,0); - Hex::Elements* grid2 = doc->makeCylindrical (orig2, vecti, vectj, + Hex::Elements* grid2 = doc->makeCylindrical (orig2, vecti, vectj, 1, 180, 1, dimz,dimy,dimx); int mx = dimx/2; int my = dimy/2; - Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); - Hex::Quad* cible = grid2->getQuadJK (dimz, mx, my); + Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); + Hex::Quad* cible = grid2->getQuadJK (dimz, mx, my); Hex::Vertex* v1 = prems->getVertex (0); @@ -237,14 +236,14 @@ void ModelTest::Test_joint () liste.push_back (prems); for (int nx=0; nxgetQuadIJ (nx, my, dimz)); + if (nx!=mx) + liste.push_back (grid1->getQuadIJ (nx, my, dimz)); for (int ny=0; nygetQuadIJ (mx, ny, dimz)); + if (ny!=my) + liste.push_back (grid1->getQuadIJ (mx, ny, dimz)); - // Hex::Elements* joint = + // Hex::Elements* joint = // doc->joinQuads (liste, cible, v1, v2, v3, v4, 5); doc->saveVtk ("joint.vtk"); @@ -254,7 +253,7 @@ void ModelTest::Test_joint () // ======================================================== Test_prism void ModelTest::Test_prism () { - + const int dimx = 11; const int dimy = 11; const int dimz = 2; @@ -269,17 +268,17 @@ void ModelTest::Test_prism () int mx = dimx/2; int my = dimy/2; - Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); + Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); Hex::Quads liste; liste.push_back (prems); for (int nx=0; nxgetQuadIJ (nx, my, dimz)); + if (nx!=mx) + liste.push_back (grid1->getQuadIJ (nx, my, dimz)); for (int ny=0; nygetQuadIJ (mx, ny, dimz)); + if (ny!=my) + liste.push_back (grid1->getQuadIJ (mx, ny, dimz)); doc->prismQuads (liste, dir, 5); doc->saveVtk ("prisme.vtk"); @@ -291,22 +290,22 @@ void ModelTest::Test_prism () // ======================================================== Test_prism2 void ModelTest::Test_prism2 () { - + const int dimx = 11; const int dimy = 11; const int dimz = 2; - + Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument ("foo"); - + Hex::Vertex* orig1 = doc->addVertex (0,0,0); Hex::Vector* dir = doc->addVector (1,1,1); - + Hex::Elements* grid1 = doc->makeCartesian (orig1, dir, dimx,dimy,dimz); - + int mx = dimx/2; int my = dimy/2; - Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); + Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); Hex::Elements* prism = doc->prismQuad(prems, dir, 5); int nbHexa = prism->countHexa(); @@ -315,10 +314,6 @@ void ModelTest::Test_prism2 () std::cout << "getHexa(1) " << hp1 << std::endl; Hex::Vertex* hp1_v0 = hp1->getVertex(0); std::cout << "getVertex ->" << hp1_v0 << std::endl; - Hex::Shape* s = new Hex::Shape("la shape"); - std::cout << "new Hex::Shape->" << s << std::endl; - hp1_v0->setAssociation(s); - std::cout << "setAssociation ->" << std::endl; doc->saveVtk ("prisme2.vtk"); CPPUNIT_ASSERT( true ); @@ -334,7 +329,7 @@ void ModelTest::Test_prism2 () // ======================================================== Test_hexa1 void ModelTest::Test_hexa1 () { - + const int size_x = 1; const int size_y = 1; const int size_z = 1; @@ -343,7 +338,7 @@ void ModelTest::Test_hexa1 () Hex::Document* doc = mon_ex.addDocument ("foo"); Hex::Vertex* orig = doc->addVertex (0,0,0); Hex::Vector* dir = doc->addVector (1,1,1); - // Hex::Elements* grid = + // Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); doc ->dump (); @@ -353,7 +348,7 @@ void ModelTest::Test_hexa1 () // ======================================================== Test_decoupage void ModelTest::Test_decoupage () { - + const int size_x = 2; const int size_y = 1; const int size_z = 1; @@ -380,7 +375,7 @@ void ModelTest::Test_decoupage () // ======================================================== Test_gen_xml void ModelTest::Test_gen_xml () { - + const int size_x = 2; const int size_y = 2; const int size_z = 2; @@ -397,14 +392,6 @@ void ModelTest::Test_gen_xml () Hex::Edge* arete = cell->getEdge (0); Hex::Vertex* noeud = cell->getVertex (0); - Hex::Shape* shape1 = new Hex::Shape("riri"); - Hex::Shape* shape2 = new Hex::Shape("fifi"); - Hex::Shape* shape3 = new Hex::Shape("loulou"); - - noeud->setAssociation (shape1); - arete->setAssociation (shape2); - face ->setAssociation (shape3); - Hex::Law* law1 = doc->addLaw("loi1", 1); Hex::Law* law2 = doc->addLaw("loi2", 2); Hex::Law* law3 = doc->addLaw("loi3", 3); @@ -433,7 +420,7 @@ void ModelTest::Test_gen_xml () // ======================================================== Test_relecture void ModelTest::Test_relecture () { - + Hex::Hex mon_ex; Hex::Document* doc = mon_ex.loadDocument ("Essai"); @@ -447,7 +434,7 @@ void ModelTest::Test_relecture () // ======================================================== Test_clone void ModelTest::Test_clone () { - + const int size_x = 2; const int size_y = 2; const int size_z = 2; @@ -474,7 +461,7 @@ void ModelTest::Test_clone () // ======================================================== Test_separ void ModelTest::Test_separ () { - + const int size_x = 2; const int size_y = 2; const int size_z = 2; @@ -484,7 +471,7 @@ void ModelTest::Test_separ () Hex::Vertex* orig = doc->addVertex (0,0,0); Hex::Vector* dir = doc->addVector (1,1,1); - // Hex::Elements* grid = + // Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); doc ->saveVtk ("separ.vtk"); @@ -495,34 +482,34 @@ void ModelTest::Test_separ () // // ======================================================== Test_cyl_karima // void ModelTest::Test_cyl_karima () // { -// +// // Hex::Hex mon_ex; // Hex::Document* doc = mon_ex.addDocument ("foo"); -// +// // Hex::Vertex* c2 = doc->addVertex (0,0,0); // Hex::Vector* dz = doc->addVector (0,0,1); // Hex::Vector* dx = doc->addVector (1,0,0); -// +// // double dr = 4.12; -// +// // double a2 = 180; // int l2 = 70; -// +// // int nr2 = 5; // int na2 = 5; // int nl2 = 1; -// -// /* Hex::Elements* cyl2 = */ doc->makeCylindrical (c2, dx, dz, dr, a2, l2, +// +// /* Hex::Elements* cyl2 = */ doc->makeCylindrical (c2, dx, dz, dr, a2, l2, // nr2, na2, nl2, false ); // doc->saveVtk ("cyl_karima.vtk"); // // doc->dump (); -// +// // CPPUNIT_ASSERT( true ); // } // ================================================== Test_grille_cyl void ModelTest::Test_grille_cyl () { - + Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument ("foo"); @@ -558,7 +545,7 @@ void ModelTest::Test_grille_cyl () // ===================================================== Test_cylinder void ModelTest::Test_cylinder () { - + int nvtk = 0; cpchar fic_vtk = "cylindre"; @@ -598,7 +585,7 @@ void ModelTest::myTest_croix () // Hex::Vector* dx1 = doc->addVector( -1, 0, 0 ); // Hex::Vector* dz1 = doc->addVector( 0, 0, 1 ); -// +// // Hex::Vertex* c_pte_1 = doc->addVertex ( 195., 0., 220. ); // Hex::Vertex* c_grd_1 = doc->addVertex ( 300., 0., 400. ); // Hex::Cylinder* cyl_pte_1 = doc->addCylinder( c_pte_1 , dz1 , 25 , 360 ); @@ -607,7 +594,7 @@ void ModelTest::myTest_croix () Hex::Vector* dx2 = doc->addVector(-1, 0, 0 ); Hex::Vector* dz2 = doc->addVector( 0, 0, 1 ); - + Hex::Vertex* c_pte_2 = doc->addVertex( 110., 0. , 400. ); Hex::Vertex* c_grd_2 = doc->addVertex( 0. , 0. , 0. ); @@ -639,7 +626,7 @@ void ModelTest::myTest_croix () // ======================================================== Test_croix void ModelTest::Test_croix () { - + Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument ("foo"); @@ -710,7 +697,7 @@ void ModelTest::Test_croix () // ======================================================== Test_pipes void ModelTest::Test_pipes () { - + Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument ("foo"); @@ -737,7 +724,7 @@ void ModelTest::Test_pipes () // ======================================================== Test_lorraine void ModelTest::Test_lorraine() { - + Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument ("foo"); @@ -773,7 +760,7 @@ void ModelTest::Test_lorraine() // vc3 = grid2->getVertexIJK (Hex::Cyl1, 0,0,0); // Cyl i j k Hex::Quad* qb = grid1-> getQuadIJ (Hex::Cyl2, nx_ext, Hex::S_E, 4); - Hex::Quad* qh = grid2-> getQuadIJ (Hex::Cyl1, nx_ext, Hex::S_N, 0); + Hex::Quad* qh = grid2-> getQuadIJ (Hex::Cyl1, nx_ext, Hex::S_N, 0); Hex::Vertex* vb0 = qb->getVertex (3); Hex::Vertex* vb1 = qb->getVertex (2); @@ -798,11 +785,11 @@ void ModelTest::Test_lorraine() for (int ny=1; nygetQuadIJ (Hex::Cyl1, nx_ext, ns, 0)); + hliste.push_back (grid2->getQuadIJ (Hex::Cyl1, nx_ext, ns, 0)); } for (int ny=0; ny<4 ; ny++) - hliste.push_back (grid2->getQuadIJ (Hex::Cyl1, nx_int, ny, 0)); + hliste.push_back (grid2->getQuadIJ (Hex::Cyl1, nx_int, ny, 0)); doc->joinQuads (hliste, qb, vh0, vb0, vh1, vb1, 5); doc->saveVtk ("lorraine.vtk"); @@ -812,7 +799,7 @@ void ModelTest::Test_lorraine() // ======================================================== Test_disconnect void ModelTest::Test_disconnect () { - + const int size_x = 2; const int size_y = 2; const int size_z = 1; @@ -871,7 +858,7 @@ void ModelTest::Test_disconnect () // ======================================================== Test_propagation void ModelTest::Test_propagation () { - + const int size_x = 2; const int size_y = 1; const int size_z = 1; @@ -881,7 +868,7 @@ void ModelTest::Test_propagation () Hex::Vertex* orig = doc->addVertex (0,0,0); Hex::Vector* dir = doc->addVector (1,1,1); - // Hex::Elements* grid = + // Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); int nb = doc->countPropagation (); @@ -918,7 +905,7 @@ void ModelTest::Test_propagation () // ======================================================== Test_move void ModelTest::Test_move () { - + const int size_x = 1; const int size_y = 1; const int size_z = 2; @@ -940,7 +927,7 @@ void ModelTest::Test_move () Hex::Hexa* cube = grid->getHexa (1); Hex::Quad* dessous = cube->getQuad (Hex::Q_A); dessous->dump(); - + Hex::Elements* grid2 = doc->makeTranslation (grid, devant); /* Hex::Elements* grid3 = doc->makeTranslation (grid, agauche); */ Hex::Hexa* cube2 = grid2->getHexa (1); @@ -959,7 +946,7 @@ void ModelTest::Test_move () // ======================================================== Test_deux_cyl void ModelTest::Test_deux_cyl () { - + Hex::Hex mon_ex; Hex::Document* doc = mon_ex.addDocument ("foo"); @@ -977,10 +964,10 @@ void ModelTest::Test_deux_cyl () int na = 6; int nl = 10; - /* Hex::Elements* cyl1 = */ doc->makeCylindrical(orig1, vy,vz, dr, da, + /* Hex::Elements* cyl1 = */ doc->makeCylindrical(orig1, vy,vz, dr, da, dl,nr,na,nl); - /* Hex::Elements* cyl2 = */ doc->makeCylindrical(orig2, vz,vx, dr/2, da, + /* Hex::Elements* cyl2 = */ doc->makeCylindrical(orig2, vz,vx, dr/2, da, dl,nr,na,nl); doc->saveVtk ("deux_cylindres.vtk"); CPPUNIT_ASSERT( true ); @@ -988,7 +975,7 @@ void ModelTest::Test_deux_cyl () // ======================================================== Test_move2 void ModelTest::Test_transfo () { - + const int size_x = 1; const int size_y = 1; const int size_z = 2; diff --git a/src/TEST_CPP/Test_HEXABLOCK.cxx b/src/TEST_CPP/Test_HEXABLOCK.cxx index ab912d5..f3be098 100755 --- a/src/TEST_CPP/Test_HEXABLOCK.cxx +++ b/src/TEST_CPP/Test_HEXABLOCK.cxx @@ -51,14 +51,14 @@ int main (int nbargs, cpchar tabargs []) TestUnit (test_coude ); TestUnit (test_count ); TestUnit (test_decoupage ); - TestUnit (test_gen_xml ); - TestUnit (test_string_xml ); + // TestUnit (test_gen_xml ); + // TestUnit (test_string_xml ); /// TestUnit (test_relecture ); TestUnit (test_spherical); TestUnit (test_grille_cyl ); TestUnit (test_cylindrical ); TestUnit (test_cylinder ); - TestUnit (test_xml_cylinder ); + // TestUnit (test_xml_cylinder ); TestUnit (test_pipe ); TestUnit (test_joint2 ); TestUnit (test_croix ); diff --git a/src/TEST_CPP/test_hexa1.cxx b/src/TEST_CPP/test_hexa1.cxx index 84217fd..1771620 100755 --- a/src/TEST_CPP/test_hexa1.cxx +++ b/src/TEST_CPP/test_hexa1.cxx @@ -35,7 +35,6 @@ #include "HexVertex.hxx" #include "HexPropagation.hxx" -#include "HexShape.hxx" #include "HexLaw.hxx" #include "HexMatrix.hxx" #include "HexCramer.hxx" @@ -152,7 +151,7 @@ int test_cartesi1 () Hex::Hexa* cell = grid->getHexaIJK (nx, ny, nz); cell->remove (); } - + doc->setLevel (1); print_propagations (doc); grid->saveVtk ("grid_cart.vtk"); @@ -235,13 +234,13 @@ int test_joint (int nbargs, cpchar tabargs[]) Hex::Vertex* orig2 = doc->addVertex (dimx/2.0,0,8); Hex::Vector* vectj = doc->addVector (0,1,0); Hex::Vector* vecti = doc->addVector (1,0,0); - Hex::Elements* grid2 = doc->makeCylindrical (orig2, vecti, vectj, + Hex::Elements* grid2 = doc->makeCylindrical (orig2, vecti, vectj, 1, 180, 1, dimz,dimy,dimx); int mx = dimx/2; int my = dimy/2; - Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); - Hex::Quad* cible = grid2->getQuadJK (dimz, mx, my); + Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); + Hex::Quad* cible = grid2->getQuadJK (dimz, mx, my); Hex::Vertex* v1 = prems->getVertex (0); Hex::Vertex* v3 = prems->getVertex (1); @@ -258,12 +257,12 @@ int test_joint (int nbargs, cpchar tabargs[]) liste.push_back (prems); for (int nx=0; nxgetQuadIJ (nx, my, dimz)); + if (nx!=mx) + liste.push_back (grid1->getQuadIJ (nx, my, dimz)); for (int ny=0; nygetQuadIJ (mx, ny, dimz)); + if (ny!=my) + liste.push_back (grid1->getQuadIJ (mx, ny, dimz)); doc->saveVtk ("joint1.vtk"); const int hauteur = 5; @@ -279,10 +278,10 @@ int test_joint (int nbargs, cpchar tabargs[]) int indice0 = joint->findVertex (v1); HexDisplay (indice0); - for (int nh=0 ; nhgetVertex(nh)->setScalar (5); - for (int nh=0 ; nh<=hauteur ; nh++) + for (int nh=0 ; nh<=hauteur ; nh++) joint->getVertex(nh*nbr_surf_vertex)->setScalar (3); doc->saveVtk ("joint2.vtk"); @@ -308,20 +307,20 @@ int test_prism (int nbargs, cpchar tabargs[]) int my = dimy/2; Hex::Quads liste1, liste2; - liste1.push_back (grid1->getQuadIJ (mx, my, dimz)); - liste2.push_back (grid1->getQuadIJ (mx, my, 0)); + liste1.push_back (grid1->getQuadIJ (mx, my, dimz)); + liste2.push_back (grid1->getQuadIJ (mx, my, 0)); for (int nx=0; nxgetQuadIJ (nx, my, dimz)); - liste2.push_back (grid1->getQuadIJ (nx, my, 0)); + liste1.push_back (grid1->getQuadIJ (nx, my, dimz)); + liste2.push_back (grid1->getQuadIJ (nx, my, 0)); } for (int ny=0; nygetQuadIJ (mx, ny, dimz)); - liste2.push_back (grid1->getQuadIJ (mx, ny, 0)); + liste1.push_back (grid1->getQuadIJ (mx, ny, dimz)); + liste2.push_back (grid1->getQuadIJ (mx, ny, 0)); } Hex::RealVector tlen; @@ -331,7 +330,7 @@ int test_prism (int nbargs, cpchar tabargs[]) dh = 2*dh + 1; tlen.push_back (dh); } - + const int nbiter = 5; doc->saveVtk ("prisme1.vtk"); Hex::Elements* prisme2 = doc->prismQuads (liste2, dir2, nbiter); @@ -345,7 +344,7 @@ int test_prism (int nbargs, cpchar tabargs[]) PutData (prisme1->countQuad()); PutData (prisme1->countEdge()); PutData (prisme1->countVertex()); - + for (int nro=0 ; nro getHexa (nbiter+nro); @@ -372,23 +371,23 @@ int test_revolution9 (int nbargs, cpchar tabargs[]) int mx = dimx/2; int my = dimy/2; - Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); + Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); Hex::Quads liste; liste.push_back (prems); prems -> setScalar (5); for (int nx=0; nxgetQuadIJ (nx, my, dimz); + Hex::Quad* cell = grid1->getQuadIJ (nx, my, dimz); liste.push_back (cell); cell -> setScalar (5); } for (int ny=0; nygetQuadIJ (mx, ny, dimz); + Hex::Quad* cell = grid1->getQuadIJ (mx, ny, dimz); liste.push_back (cell); cell -> setScalar (5); } @@ -442,14 +441,14 @@ int test_revolution (int nbargs, cpchar tabargs[]) int na = 6; int nl = 1; - Hex::Elements* grid = doc->makeCylindrical (ori, vx,vz, dr,da,dl, + Hex::Elements* grid = doc->makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, false); Hex::Quads liste; for (int nx=0; nxgetQuadIJ (nx, ny, nl); + Hex::Quad* cell = grid->getQuadIJ (nx, ny, nl); liste.push_back (cell); cell -> setScalar (5); } @@ -510,23 +509,23 @@ int test_coude (int nbargs, cpchar tabargs[]) nr, 10, nl, false); int mx = dimx/2; int my = dimy/2; - Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); + Hex::Quad* prems = grid1->getQuadIJ (mx, my, dimz); Hex::Quads liste; liste.push_back (prems); prems -> setScalar (5); for (int nx=0; nxgetQuadIJ (nx, my, dimz); + Hex::Quad* cell = grid1->getQuadIJ (nx, my, dimz); liste.push_back (cell); cell -> setScalar (5); } for (int ny=0; nygetQuadIJ (mx, ny, dimz); + Hex::Quad* cell = grid1->getQuadIJ (mx, ny, dimz); liste.push_back (cell); cell -> setScalar (5); } @@ -633,14 +632,6 @@ int test_gen_xml (int nbargs, cpchar tabargs[]) Hex::Edge* arete = cell->getEdge (0); Hex::Vertex* noeud = cell->getVertex (0); - Hex::Shape* shape1 = new Hex::Shape("riri"); - Hex::Shape* shape2 = new Hex::Shape("fifi"); - Hex::Shape* shape3 = new Hex::Shape("loulou"); - - noeud->setAssociation (shape1); - arete->setAssociation (shape2); - face ->setAssociation (shape3); - Hex::Law* law1 = doc->addLaw("loi1", 1); Hex::Law* law2 = doc->addLaw("loi2", 2); Hex::Law* law3 = doc->addLaw("loi3", 3); @@ -685,14 +676,6 @@ int test_string_xml (int nbargs, cpchar tabargs[]) Hex::Edge* arete = cell->getEdge (0); Hex::Vertex* noeud = cell->getVertex (0); - Hex::Shape* shape1 = new Hex::Shape("riri"); - Hex::Shape* shape2 = new Hex::Shape("fifi"); - Hex::Shape* shape3 = new Hex::Shape("loulou"); - - noeud->setAssociation (shape1); - arete->setAssociation (shape2); - face ->setAssociation (shape3); - Hex::Law* law1 = doc->addLaw("loi1", 1); Hex::Law* law2 = doc->addLaw("loi2", 2); Hex::Law* law3 = doc->addLaw("loi3", 3); @@ -728,7 +711,7 @@ int test_relecture (int nbargs, cpchar tabargs[]) { Hex::Hex mon_ex; cpchar nomdoc = "Essai"; - if (nbargs>1) + if (nbargs>1) nomdoc = tabargs[1]; Hex::Document* doc = mon_ex.loadDocument (nomdoc); @@ -792,7 +775,7 @@ int test_separ () Hex::Vertex* orig = doc->addVertex (0,0,0); Hex::Vector* dir = doc->addVector (1,1,1); - // Hex::Elements* grid = + // Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); doc ->saveVtk ("separ.vtk"); @@ -864,57 +847,6 @@ int test_grille_cyl (int nbargs, cpchar tabargs[]) return HOK; } -// ================================================== test_asso_line -int test_asso_line (int nbargs, cpchar tabargs[]) -{ - Hex::Hex mon_ex; - Hex::Document* doc = mon_ex.addDocument (); - - Hex::Vertex* orig1 = doc->addVertex ( 0, 0,0); - - Hex::Vector* vz = doc->addVector (0,0,1); - Hex::Vector* vx = doc->addVector (1,0,0); - - double dr = 1; - double dl = 1; - int nr = 2; - int nl = 3; - int ntheta = 8; - - Hex::Elements *c1 = NULL; - - c1 = doc->makeCylindrical (orig1, vx,vz,dr, 360, dl,nr, ntheta, nl, true); - - Hex::Edges m_line; - Hex::Edge* m_start = c1->getEdgeJ (nr, 1, 0); - - for (int na=2 ; nagetEdgeJ (nr, na, 0); - arete->setScalar (5); - m_line.push_back (arete); - } - - // m_line.push_back (c1->getEdgeJ (nr, 0, 2)); - // m_line.push_back (NULL); - Hex::Shape* gstart = NULL; - Hex::Shapes gline; - double pstart = 0 , pend = 0; - - int ier = doc-> associateOpenedLine (m_start, m_line, - gstart, pstart, gline, pend); - HexDisplay (ier); - doc->saveVtk ("asso_line.vtk"); - - m_line.push_back (c1->getEdgeJ (nr, 0, 0)); - Hex::Vertex* m_first = m_start->getVertex (Hex::V_AMONT); - ier = doc-> associateClosedLine (m_first, m_start, m_line, - gstart, pstart, false, gline); - HexDisplay (ier); - // doc->dump (); - - return HOK; -} // ===================================================== test_cylindrical int test_cylindrical (int nbargs, cpchar tabargs[]) { @@ -935,7 +867,7 @@ int test_cylindrical (int nbargs, cpchar tabargs[]) int na = 8; int nl = 2; - if (nbargs>1) + if (nbargs>1) { na = atoi (tabargs[1]); HexDisplay (na); @@ -943,7 +875,7 @@ int test_cylindrical (int nbargs, cpchar tabargs[]) na = 8; } - if (nbargs>2) + if (nbargs>2) { da = atof (tabargs[2]); HexDisplay (da); @@ -1070,9 +1002,9 @@ int del_tranche (Hex::CrossElements* grid, int cyl, int ni, int nk, int dr=1) for (int nj = 0 ; nj < 8 ; nj++) del_hexa (grid, cyl, ni, nj, nk, dr); - if (dr==1) + if (dr==1) save_vtk (); - printf ("del_tranche (g=%d, i=%d, k=%d) : fic = %d\n", + printf ("del_tranche (g=%d, i=%d, k=%d) : fic = %d\n", cyl, ni, nk, nbr_vtk-1); return nbr_vtk; } @@ -1297,7 +1229,7 @@ int test_lorraine(int nbargs, cpchar tabargs[]) // vc3 = grid2->getVertexIJK (Hex::CylSmall, 0,0,0); // Cyl i j k Hex::Quad* qb = grid1-> getQuadIJ (Hex::CylBig, nx_ext, Hex::S_E, 4); - Hex::Quad* qh = grid2-> getQuadIJ (Hex::CylSmall, nx_ext, Hex::S_N, 0); + Hex::Quad* qh = grid2-> getQuadIJ (Hex::CylSmall, nx_ext, Hex::S_N, 0); Hex::Vertex* vb0 = qb->getVertex (3); Hex::Vertex* vb1 = qb->getVertex (2); @@ -1322,11 +1254,11 @@ int test_lorraine(int nbargs, cpchar tabargs[]) for (int ny=1; nygetQuadIJ (Hex::CylSmall, nx_ext, ns, 0)); + hliste.push_back (grid2->getQuadIJ (Hex::CylSmall, nx_ext, ns, 0)); } for (int ny=0; ny<4 ; ny++) - hliste.push_back (grid2->getQuadIJ (Hex::CylSmall, nx_int, ny, 0)); + hliste.push_back (grid2->getQuadIJ (Hex::CylSmall, nx_int, ny, 0)); int hauteur = 3; doc->joinQuads (hliste, qb, vh0, vb0, vh1, vb1, hauteur); @@ -1521,9 +1453,9 @@ void contraction (Hex::Hexa* hexa, Hex::Elements* grid) for (int nro=0; nrogetVertex(nro)->getX()/Hex::HV_MAXI; - cg [1] += hexa->getVertex(nro)->getY()/Hex::HV_MAXI; - cg [2] += hexa->getVertex(nro)->getZ()/Hex::HV_MAXI; + cg [0] += hexa->getVertex(nro)->getX()/Hex::HV_MAXI; + cg [1] += hexa->getVertex(nro)->getY()/Hex::HV_MAXI; + cg [2] += hexa->getVertex(nro)->getZ()/Hex::HV_MAXI; } int nbvertex = grid->countVertex(); @@ -1607,7 +1539,7 @@ int test_propagation () Hex::Vertex* orig = doc->addVertex (0,0,0); Hex::Vector* dir = doc->addVector (1,1,1); - // Hex::Elements* grid = + // Hex::Elements* grid = doc->makeCartesian (orig, dir, size_x,size_y,size_z); int nb = doc->countPropagation (); @@ -1665,7 +1597,7 @@ int test_move () Hex::Hexa* cube = grid->getHexa (1); Hex::Quad* dessous = cube->getQuad (Hex::Q_A); dessous->dump(); - + Hex::Elements* grid2 = doc->makeTranslation (grid, devant); /* Hex::Elements* grid3 = doc->makeTranslation (grid, agauche); */ Hex::Hexa* cube2 = grid2->getHexa (1); @@ -1866,10 +1798,10 @@ int test_remove () return HOK; } // ================================================== init_vec -void init_vec (Hex::RealVector& tab, double n0=0, double n1=0, double n2=0, - double n3=0, double n4=0, double n5=0, double n6=0, +void init_vec (Hex::RealVector& tab, double n0=0, double n1=0, double n2=0, + double n3=0, double n4=0, double n5=0, double n6=0, double n7=0, double n8=0, double n9=0, double n10=0, - double n11=0, double n12=0, double n13=0, double n14=0, + double n11=0, double n12=0, double n13=0, double n14=0, double n15=0, double n16=0) { if (n0>0.0) tab.push_back (n0); @@ -1905,7 +1837,7 @@ int test_cylindricals (int nbargs, cpchar tabargs[]) /****************** init_vec (tdr, 2, 1, 0.5); - init_vec (tda, 40, 35, 30, 25, 20, 15, 10, 5, + init_vec (tda, 40, 35, 30, 25, 20, 15, 10, 5, 5, 10, 15, 20, 25, 30, 35, 40); init_vec (tdl, 1, 2, 3 ); diff --git a/src/TEST_PY/non_regression/bielle.stp b/src/TEST_PY/non_regression/bielle.stp new file mode 100644 index 0000000..ef67fa5 --- /dev/null +++ b/src/TEST_PY/non_regression/bielle.stp @@ -0,0 +1,1178 @@ +ISO-10303-21; +HEADER; + FILE_DESCRIPTION(('a Product shape'),'1'); + FILE_NAME('Euclid Shape Model','1998-12-23T10:04:46',('Author Name'),( + 'MATRA-DATAVISION'),'OL-2.0D','EUCLID','Authorisation status'); + FILE_SCHEMA(('AUTOMOTIVE_DESIGN_CC2 { 1 2 10303 214 -1 1 5 4 }')); +ENDSEC; +DATA; +#1 = PRODUCT_TYPE('part',$,(#2)); +#2 = PRODUCT('bielle','bielle','void',(#3)); +#3 = MECHANICAL_CONTEXT('Mechanical',#4,'Assembly'); +#4 = APPLICATION_CONTEXT('EUCLID'); +#5 = APPLICATION_PROTOCOL_DEFINITION('CommitteeDraft', + 'automotive_design',1997,#4); +#6 = SHAPE_DEFINITION_REPRESENTATION(#7,#11); +#7 = PRODUCT_DEFINITION_SHAPE('void','void',#8); +#8 = PRODUCT_DEFINITION('void','void',#9,#10); +#9 = PRODUCT_DEFINITION_FORMATION('ID','void',#2); +#10 = PRODUCT_DEFINITION_CONTEXT('as proposed',#4,'First_Design'); +#11 = ADVANCED_BREP_SHAPE_REPRESENTATION('',(#12),#866); +#12 = MANIFOLD_SOLID_BREP('',#13); +#13 = CLOSED_SHELL('',(#14,#338,#415,#466,#518,#566,#617,#668,#720,#747, + #798,#849)); +#14 = ADVANCED_FACE('',(#15,#270,#304),#30,.F.); +#15 = FACE_BOUND('',#16,.T.); +#16 = EDGE_LOOP('',(#17,#56,#88,#120,#148,#180,#212,#244)); +#17 = ORIENTED_EDGE('',*,*,#18,.T.); +#18 = EDGE_CURVE('',#19,#21,#23,.T.); +#19 = VERTEX_POINT('',#20); +#20 = CARTESIAN_POINT('',(63.609212636948,27.934517711401, + -19.99999955296)); +#21 = VERTEX_POINT('',#22); +#22 = CARTESIAN_POINT('',(93.497879803181,36.745399236679, + -19.99999955296)); +#23 = SURFACE_CURVE('',#24,(#29,#45),.PCURVE_S2.); +#24 = CIRCLE('',#25,74.466478447737); +#25 = AXIS2_PLACEMENT_3D('',#26,#27,#28); +#26 = CARTESIAN_POINT('',(57.963432099881,102.18666633037, + -19.99999955296)); +#27 = DIRECTION('',(0.,0.,1.)); +#28 = DIRECTION('',(1.,0.,0.)); +#29 = PCURVE('',#30,#35); +#30 = PLANE('',#31); +#31 = AXIS2_PLACEMENT_3D('',#32,#33,#34); +#32 = CARTESIAN_POINT('',(0.,0.,-19.99999955296)); +#33 = DIRECTION('',(0.,0.,1.)); +#34 = DIRECTION('',(1.,0.,0.)); +#35 = DEFINITIONAL_REPRESENTATION('',(#36),#44); +#36 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#37,#38,#39,#40,#41,#42,#43), +.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#37 = CARTESIAN_POINT('',(132.42991054761,102.18666633037)); +#38 = CARTESIAN_POINT('',(132.42991054761,231.16639046259)); +#39 = CARTESIAN_POINT('',(20.730192876013,166.67652839648)); +#40 = CARTESIAN_POINT('',(-90.96952479559,102.18666633037)); +#41 = CARTESIAN_POINT('',(20.730192876013,37.696804264271)); +#42 = CARTESIAN_POINT('',(132.42991054761,-26.79305780183)); +#43 = CARTESIAN_POINT('',(132.42991054761,102.18666633037)); +#44 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#45 = PCURVE('',#46,#51); +#46 = CYLINDRICAL_SURFACE('',#47,74.466478447737); +#47 = AXIS2_PLACEMENT_3D('',#48,#49,#50); +#48 = CARTESIAN_POINT('',(57.963432099881,102.18666633037, + -19.99999955296)); +#49 = DIRECTION('',(0.,0.,1.)); +#50 = DIRECTION('',(1.,0.,0.)); +#51 = DEFINITIONAL_REPRESENTATION('',(#52),#55); +#52 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#53,#54),.UNSPECIFIED.,.F.,.F.,(2, + 2),(4.788278205588,5.209840138517),.PIECEWISE_BEZIER_KNOTS.); +#53 = CARTESIAN_POINT('',(4.788278205588,0.)); +#54 = CARTESIAN_POINT('',(5.209840138517,0.)); +#55 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#56 = ORIENTED_EDGE('',*,*,#57,.T.); +#57 = EDGE_CURVE('',#21,#58,#60,.T.); +#58 = VERTEX_POINT('',#59); +#59 = CARTESIAN_POINT('',(93.497879803181,-41.78636148572, + -19.99999955296)); +#60 = SURFACE_CURVE('',#61,(#66,#77),.PCURVE_S2.); +#61 = CIRCLE('',#62,44.68116165083); +#62 = AXIS2_PLACEMENT_3D('',#63,#64,#65); +#63 = CARTESIAN_POINT('',(114.81915663942,-2.52048112452,-19.99999955296 + )); +#64 = DIRECTION('',(0.,0.,-1.)); +#65 = DIRECTION('',(1.,0.,0.)); +#66 = PCURVE('',#30,#67); +#67 = DEFINITIONAL_REPRESENTATION('',(#68),#76); +#68 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#69,#70,#71,#72,#73,#74,#75), +.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#69 = CARTESIAN_POINT('',(159.50031829025,-2.52048112452)); +#70 = CARTESIAN_POINT('',(159.50031829025,-79.91052324495)); +#71 = CARTESIAN_POINT('',(92.478575814005,-41.21550218473)); +#72 = CARTESIAN_POINT('',(25.45683333776,-2.52048112452)); +#73 = CARTESIAN_POINT('',(92.478575814005,36.174539935697)); +#74 = CARTESIAN_POINT('',(159.50031829025,74.869560995915)); +#75 = CARTESIAN_POINT('',(159.50031829025,-2.52048112452)); +#76 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#77 = PCURVE('',#78,#83); +#78 = CYLINDRICAL_SURFACE('',#79,44.68116165083); +#79 = AXIS2_PLACEMENT_3D('',#80,#81,#82); +#80 = CARTESIAN_POINT('',(114.81915663942,-2.52048112452,-19.99999955296 + )); +#81 = DIRECTION('',(0.,0.,-1.)); +#82 = DIRECTION('',(1.,0.,0.)); +#83 = DEFINITIONAL_REPRESENTATION('',(#84),#87); +#84 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#85,#86),.UNSPECIFIED.,.F.,.F.,(2, + 2),(4.214937822253,8.351432792106),.PIECEWISE_BEZIER_KNOTS.); +#85 = CARTESIAN_POINT('',(4.214937822253,0.)); +#86 = CARTESIAN_POINT('',(8.351432792106,0.)); +#87 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#88 = ORIENTED_EDGE('',*,*,#89,.T.); +#89 = EDGE_CURVE('',#58,#90,#92,.T.); +#90 = VERTEX_POINT('',#91); +#91 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + -19.99999955296)); +#92 = SURFACE_CURVE('',#93,(#98,#109),.PCURVE_S2.); +#93 = CIRCLE('',#94,84.24770250966); +#94 = AXIS2_PLACEMENT_3D('',#95,#96,#97); +#95 = CARTESIAN_POINT('',(53.295957524102,-115.8233848133, + -19.99999955296)); +#96 = DIRECTION('',(0.,0.,1.)); +#97 = DIRECTION('',(1.,0.,0.)); +#98 = PCURVE('',#30,#99); +#99 = DEFINITIONAL_REPRESENTATION('',(#100),#108); +#100 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#101,#102,#103,#104,#105,#106 +,#107),.UNSPECIFIED.,.T.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#101 = CARTESIAN_POINT('',(137.54366003376,-115.8233848133)); +#102 = CARTESIAN_POINT('',(137.54366003376,30.097916354281)); +#103 = CARTESIAN_POINT('',(11.172106269272,-42.86273422955)); +#104 = CARTESIAN_POINT('',(-115.1994474952,-115.8233848133)); +#105 = CARTESIAN_POINT('',(11.172106269272,-188.7840353972)); +#106 = CARTESIAN_POINT('',(137.54366003376,-261.744685981)); +#107 = CARTESIAN_POINT('',(137.54366003376,-115.8233848133)); +#108 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#109 = PCURVE('',#110,#115); +#110 = CYLINDRICAL_SURFACE('',#111,84.24770250966); +#111 = AXIS2_PLACEMENT_3D('',#112,#113,#114); +#112 = CARTESIAN_POINT('',(53.295957524102,-115.8233848133, + -19.99999955296)); +#113 = DIRECTION('',(0.,0.,1.)); +#114 = DIRECTION('',(1.,0.,0.)); +#115 = DEFINITIONAL_REPRESENTATION('',(#116),#119); +#116 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#117,#118),.UNSPECIFIED.,.F.,.F., + (2,2),(1.073345168663,1.501387093594),.PIECEWISE_BEZIER_KNOTS.); +#117 = CARTESIAN_POINT('',(1.073345168663,0.)); +#118 = CARTESIAN_POINT('',(1.501387093594,0.)); +#119 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#120 = ORIENTED_EDGE('',*,*,#121,.T.); +#121 = EDGE_CURVE('',#90,#122,#124,.T.); +#122 = VERTEX_POINT('',#123); +#123 = CARTESIAN_POINT('',(-72.42252677679,-22.63227291405, + -19.99999955296)); +#124 = SURFACE_CURVE('',#125,(#129,#136),.PCURVE_S2.); +#125 = LINE('',#126,#127); +#126 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + -19.99999955296)); +#127 = VECTOR('',#128,1.); +#128 = DIRECTION('',(-0.997592146088,6.935351515554E-02,0.)); +#129 = PCURVE('',#30,#130); +#130 = DEFINITIONAL_REPRESENTATION('',(#131),#135); +#131 = LINE('',#132,#133); +#132 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384)); +#133 = VECTOR('',#134,1.); +#134 = DIRECTION('',(-0.997592146088,6.935351515554E-02)); +#135 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#136 = PCURVE('',#137,#142); +#137 = PLANE('',#138); +#138 = AXIS2_PLACEMENT_3D('',#139,#140,#141); +#139 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + -19.99999955296)); +#140 = DIRECTION('',(-6.935351515554E-02,-0.997592146088,0.)); +#141 = DIRECTION('',(-0.997592146088,6.935351515554E-02,0.)); +#142 = DEFINITIONAL_REPRESENTATION('',(#143),#147); +#143 = LINE('',#144,#145); +#144 = CARTESIAN_POINT('',(0.,-3.552713678801E-14)); +#145 = VECTOR('',#146,1.); +#146 = DIRECTION('',(1.,0.)); +#147 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#148 = ORIENTED_EDGE('',*,*,#149,.T.); +#149 = EDGE_CURVE('',#122,#150,#152,.T.); +#150 = VERTEX_POINT('',#151); +#151 = CARTESIAN_POINT('',(-88.51642906665,-27.22925320267, + -19.99999955296)); +#152 = SURFACE_CURVE('',#153,(#158,#169),.PCURVE_S2.); +#153 = CIRCLE('',#154,24.565238684828); +#154 = AXIS2_PLACEMENT_3D('',#155,#156,#157); +#155 = CARTESIAN_POINT('',(-74.12621243021,-47.1383620928, + -19.99999955296)); +#156 = DIRECTION('',(0.,0.,1.)); +#157 = DIRECTION('',(1.,0.,0.)); +#158 = PCURVE('',#30,#159); +#159 = DEFINITIONAL_REPRESENTATION('',(#160),#168); +#160 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#161,#162,#163,#164,#165,#166 +,#167),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#161 = CARTESIAN_POINT('',(-49.56097374539,-47.1383620928)); +#162 = CARTESIAN_POINT('',(-49.56097374539,-4.590120590624)); +#163 = CARTESIAN_POINT('',(-86.40883177263,-25.86424134171)); +#164 = CARTESIAN_POINT('',(-123.2566897998,-47.1383620928)); +#165 = CARTESIAN_POINT('',(-86.40883177263,-68.41248284389)); +#166 = CARTESIAN_POINT('',(-49.56097374539,-89.68660359498)); +#167 = CARTESIAN_POINT('',(-49.56097374539,-47.1383620928)); +#168 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#169 = PCURVE('',#170,#175); +#170 = CYLINDRICAL_SURFACE('',#171,24.565238684828); +#171 = AXIS2_PLACEMENT_3D('',#172,#173,#174); +#172 = CARTESIAN_POINT('',(-74.12621243021,-47.1383620928, + -19.99999955296)); +#173 = DIRECTION('',(0.,0.,1.)); +#174 = DIRECTION('',(1.,0.,0.)); +#175 = DEFINITIONAL_REPRESENTATION('',(#176),#179); +#176 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#177,#178),.UNSPECIFIED.,.F.,.F., + (2,2),(1.501387093594,2.196658099744),.PIECEWISE_BEZIER_KNOTS.); +#177 = CARTESIAN_POINT('',(1.501387093594,0.)); +#178 = CARTESIAN_POINT('',(2.196658099744,0.)); +#179 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#180 = ORIENTED_EDGE('',*,*,#181,.T.); +#181 = EDGE_CURVE('',#150,#182,#184,.T.); +#182 = VERTEX_POINT('',#183); +#183 = CARTESIAN_POINT('',(-88.51642906665,21.039046347141, + -19.99999955296)); +#184 = SURFACE_CURVE('',#185,(#190,#201),.PCURVE_S2.); +#185 = CIRCLE('',#186,29.778387016109); +#186 = AXIS2_PLACEMENT_3D('',#187,#188,#189); +#187 = CARTESIAN_POINT('',(-105.9604867346,-3.095103427768, + -19.99999955296)); +#188 = DIRECTION('',(0.,0.,-1.)); +#189 = DIRECTION('',(1.,0.,0.)); +#190 = PCURVE('',#30,#191); +#191 = DEFINITIONAL_REPRESENTATION('',(#192),#200); +#192 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#193,#194,#195,#196,#197,#198 +,#199),.UNSPECIFIED.,.T.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#193 = CARTESIAN_POINT('',(-76.18209971851,-3.095103427768)); +#194 = CARTESIAN_POINT('',(-76.18209971851,-54.67278270711)); +#195 = CARTESIAN_POINT('',(-120.8496802426,-28.88394306744)); +#196 = CARTESIAN_POINT('',(-165.5172607668,-3.095103427768)); +#197 = CARTESIAN_POINT('',(-120.8496802426,22.693736211908)); +#198 = CARTESIAN_POINT('',(-76.18209971851,48.482575851583)); +#199 = CARTESIAN_POINT('',(-76.18209971851,-3.095103427768)); +#200 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#201 = PCURVE('',#202,#207); +#202 = CYLINDRICAL_SURFACE('',#203,29.778387016109); +#203 = AXIS2_PLACEMENT_3D('',#204,#205,#206); +#204 = CARTESIAN_POINT('',(-105.9604867346,-3.095103427768, + -19.99999955296)); +#205 = DIRECTION('',(0.,0.,-1.)); +#206 = DIRECTION('',(1.,0.,0.)); +#207 = DEFINITIONAL_REPRESENTATION('',(#208),#211); +#208 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#209,#210),.UNSPECIFIED.,.F.,.F., + (2,2),(0.944934553846,5.338250753333),.PIECEWISE_BEZIER_KNOTS.); +#209 = CARTESIAN_POINT('',(0.944934553846,0.)); +#210 = CARTESIAN_POINT('',(5.338250753333,0.)); +#211 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#212 = ORIENTED_EDGE('',*,*,#213,.T.); +#213 = EDGE_CURVE('',#182,#214,#216,.T.); +#214 = VERTEX_POINT('',#215); +#215 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + -19.99999955296)); +#216 = SURFACE_CURVE('',#217,(#222,#233),.PCURVE_S2.); +#217 = CIRCLE('',#218,20.41914254867); +#218 = AXIS2_PLACEMENT_3D('',#219,#220,#221); +#219 = CARTESIAN_POINT('',(-76.55497863763,37.587915977932, + -19.99999955296)); +#220 = DIRECTION('',(0.,0.,1.)); +#221 = DIRECTION('',(1.,0.,0.)); +#222 = PCURVE('',#30,#223); +#223 = DEFINITIONAL_REPRESENTATION('',(#224),#232); +#224 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#225,#226,#227,#228,#229,#230 +,#231),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#225 = CARTESIAN_POINT('',(-56.13583608896,37.587915977932)); +#226 = CARTESIAN_POINT('',(-56.13583608896,72.954908319219)); +#227 = CARTESIAN_POINT('',(-86.76454991196,55.271412148575)); +#228 = CARTESIAN_POINT('',(-117.3932637349,37.587915977932)); +#229 = CARTESIAN_POINT('',(-86.76454991196,19.904419807288)); +#230 = CARTESIAN_POINT('',(-56.13583608896,2.220923636644)); +#231 = CARTESIAN_POINT('',(-56.13583608896,37.587915977932)); +#232 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#233 = PCURVE('',#234,#239); +#234 = CYLINDRICAL_SURFACE('',#235,20.41914254867); +#235 = AXIS2_PLACEMENT_3D('',#236,#237,#238); +#236 = CARTESIAN_POINT('',(-76.55497863763,37.587915977932, + -19.99999955296)); +#237 = DIRECTION('',(0.,0.,1.)); +#238 = DIRECTION('',(1.,0.,0.)); +#239 = DEFINITIONAL_REPRESENTATION('',(#240),#243); +#240 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#241,#242),.UNSPECIFIED.,.F.,.F., + (2,2),(4.086527207436,4.916177873213),.PIECEWISE_BEZIER_KNOTS.); +#241 = CARTESIAN_POINT('',(4.086527207436,0.)); +#242 = CARTESIAN_POINT('',(4.916177873213,0.)); +#243 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#244 = ORIENTED_EDGE('',*,*,#245,.T.); +#245 = EDGE_CURVE('',#214,#19,#246,.T.); +#246 = SURFACE_CURVE('',#247,(#251,#258),.PCURVE_S2.); +#247 = LINE('',#248,#249); +#248 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + -19.99999955296)); +#249 = VECTOR('',#250,1.); +#250 = DIRECTION('',(0.997121794488,7.581640296081E-02,0.)); +#251 = PCURVE('',#30,#252); +#252 = DEFINITIONAL_REPRESENTATION('',(#253),#257); +#253 = LINE('',#254,#255); +#254 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011)); +#255 = VECTOR('',#256,1.); +#256 = DIRECTION('',(0.997121794488,7.581640296081E-02)); +#257 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#258 = PCURVE('',#259,#264); +#259 = PLANE('',#260); +#260 = AXIS2_PLACEMENT_3D('',#261,#262,#263); +#261 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + -19.99999955296)); +#262 = DIRECTION('',(-7.581640296081E-02,0.997121794488,0.)); +#263 = DIRECTION('',(0.997121794488,7.581640296081E-02,0.)); +#264 = DEFINITIONAL_REPRESENTATION('',(#265),#269); +#265 = LINE('',#266,#267); +#266 = CARTESIAN_POINT('',(0.,-3.552713678801E-14)); +#267 = VECTOR('',#268,1.); +#268 = DIRECTION('',(1.,0.)); +#269 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#270 = FACE_BOUND('',#271,.F.); +#271 = EDGE_LOOP('',(#272)); +#272 = ORIENTED_EDGE('',*,*,#273,.T.); +#273 = EDGE_CURVE('',#274,#274,#276,.T.); +#274 = VERTEX_POINT('',#275); +#275 = CARTESIAN_POINT('',(-91.4143372247,-2.809300087392, + -19.99999955296)); +#276 = SURFACE_CURVE('',#277,(#282,#293),.PCURVE_S2.); +#277 = CIRCLE('',#278,15.057678156153); +#278 = AXIS2_PLACEMENT_3D('',#279,#280,#281); +#279 = CARTESIAN_POINT('',(-106.4720153808,-2.809300087392, + -19.99999955296)); +#280 = DIRECTION('',(0.,0.,-1.)); +#281 = DIRECTION('',(0.,1.,0.)); +#282 = PCURVE('',#30,#283); +#283 = DEFINITIONAL_REPRESENTATION('',(#284),#292); +#284 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#285,#286,#287,#288,#289,#290 +,#291),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#285 = CARTESIAN_POINT('',(-106.4720153808,12.24837806876)); +#286 = CARTESIAN_POINT('',(-80.39135177038,12.24837806876)); +#287 = CARTESIAN_POINT('',(-93.43168357562,-10.33813916546)); +#288 = CARTESIAN_POINT('',(-106.4720153808,-32.92465639969)); +#289 = CARTESIAN_POINT('',(-119.512347186,-10.33813916546)); +#290 = CARTESIAN_POINT('',(-132.5526789913,12.24837806876)); +#291 = CARTESIAN_POINT('',(-106.4720153808,12.24837806876)); +#292 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#293 = PCURVE('',#294,#299); +#294 = CYLINDRICAL_SURFACE('',#295,15.057678156153); +#295 = AXIS2_PLACEMENT_3D('',#296,#297,#298); +#296 = CARTESIAN_POINT('',(-106.4720153808,-2.809300087392, + -40.00019910593)); +#297 = DIRECTION('',(0.,0.,1.)); +#298 = DIRECTION('',(1.,0.,0.)); +#299 = DEFINITIONAL_REPRESENTATION('',(#300),#303); +#300 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#301,#302),.UNSPECIFIED.,.F.,.F., + (2,2),(1.570796326795,7.853981633974),.PIECEWISE_BEZIER_KNOTS.); +#301 = CARTESIAN_POINT('',(6.28318530718,20.000199552965)); +#302 = CARTESIAN_POINT('',(0.,20.000199552965)); +#303 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#304 = FACE_BOUND('',#305,.F.); +#305 = EDGE_LOOP('',(#306)); +#306 = ORIENTED_EDGE('',*,*,#307,.T.); +#307 = EDGE_CURVE('',#308,#308,#310,.T.); +#308 = VERTEX_POINT('',#309); +#309 = CARTESIAN_POINT('',(141.97662545896,-4.606760106981, + -19.99999955296)); +#310 = SURFACE_CURVE('',#311,(#316,#327),.PCURVE_S2.); +#311 = CIRCLE('',#312,23.40416683412); +#312 = AXIS2_PLACEMENT_3D('',#313,#314,#315); +#313 = CARTESIAN_POINT('',(118.57245862484,-4.606760106981, + -19.99999955296)); +#314 = DIRECTION('',(0.,0.,-1.)); +#315 = DIRECTION('',(0.,1.,0.)); +#316 = PCURVE('',#30,#317); +#317 = DEFINITIONAL_REPRESENTATION('',(#318),#326); +#318 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#319,#320,#321,#322,#323,#324 +,#325),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#319 = CARTESIAN_POINT('',(118.57245862484,18.797406727139)); +#320 = CARTESIAN_POINT('',(159.10966469035,18.797406727139)); +#321 = CARTESIAN_POINT('',(138.84106165759,-16.30884352404)); +#322 = CARTESIAN_POINT('',(118.57245862484,-51.41509377522)); +#323 = CARTESIAN_POINT('',(98.303855592083,-16.30884352404)); +#324 = CARTESIAN_POINT('',(78.035252559326,18.797406727139)); +#325 = CARTESIAN_POINT('',(118.57245862484,18.797406727139)); +#326 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#327 = PCURVE('',#328,#333); +#328 = CYLINDRICAL_SURFACE('',#329,23.40416683412); +#329 = AXIS2_PLACEMENT_3D('',#330,#331,#332); +#330 = CARTESIAN_POINT('',(118.57245862484,-4.606760106981, + -40.00019910593)); +#331 = DIRECTION('',(0.,0.,1.)); +#332 = DIRECTION('',(1.,0.,0.)); +#333 = DEFINITIONAL_REPRESENTATION('',(#334),#337); +#334 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#335,#336),.UNSPECIFIED.,.F.,.F., + (2,2),(1.570796326795,7.853981633974),.PIECEWISE_BEZIER_KNOTS.); +#335 = CARTESIAN_POINT('',(6.28318530718,20.000199552965)); +#336 = CARTESIAN_POINT('',(0.,20.000199552965)); +#337 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#338 = ADVANCED_FACE('',(#339),#46,.F.); +#339 = FACE_BOUND('',#340,.T.); +#340 = EDGE_LOOP('',(#341,#363,#395,#414)); +#341 = ORIENTED_EDGE('',*,*,#342,.T.); +#342 = EDGE_CURVE('',#19,#343,#345,.T.); +#343 = VERTEX_POINT('',#344); +#344 = CARTESIAN_POINT('',(63.609212636948,27.934517711401, + 19.999999552965)); +#345 = SURFACE_CURVE('',#346,(#350,#356),.PCURVE_S2.); +#346 = LINE('',#347,#348); +#347 = CARTESIAN_POINT('',(63.609212636948,27.934517711401, + -19.99999955296)); +#348 = VECTOR('',#349,1.); +#349 = DIRECTION('',(0.,0.,1.)); +#350 = PCURVE('',#46,#351); +#351 = DEFINITIONAL_REPRESENTATION('',(#352),#355); +#352 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#353,#354),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#353 = CARTESIAN_POINT('',(4.788278205588,0.)); +#354 = CARTESIAN_POINT('',(4.788278205588,39.99999910593)); +#355 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#356 = PCURVE('',#259,#357); +#357 = DEFINITIONAL_REPRESENTATION('',(#358),#362); +#358 = LINE('',#359,#360); +#359 = CARTESIAN_POINT('',(136.42439686482,0.)); +#360 = VECTOR('',#361,1.); +#361 = DIRECTION('',(0.,-1.)); +#362 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#363 = ORIENTED_EDGE('',*,*,#364,.T.); +#364 = EDGE_CURVE('',#343,#365,#367,.T.); +#365 = VERTEX_POINT('',#366); +#366 = CARTESIAN_POINT('',(93.497879803181,36.745399236679, + 19.999999552965)); +#367 = SURFACE_CURVE('',#368,(#373,#379),.PCURVE_S2.); +#368 = CIRCLE('',#369,74.466478447737); +#369 = AXIS2_PLACEMENT_3D('',#370,#371,#372); +#370 = CARTESIAN_POINT('',(57.963432099881,102.18666633037, + 19.999999552965)); +#371 = DIRECTION('',(0.,0.,1.)); +#372 = DIRECTION('',(1.,0.,0.)); +#373 = PCURVE('',#46,#374); +#374 = DEFINITIONAL_REPRESENTATION('',(#375),#378); +#375 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#376,#377),.UNSPECIFIED.,.F.,.F., + (2,2),(4.788278205588,5.209840138517),.PIECEWISE_BEZIER_KNOTS.); +#376 = CARTESIAN_POINT('',(4.788278205588,39.99999910593)); +#377 = CARTESIAN_POINT('',(5.209840138517,39.99999910593)); +#378 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#379 = PCURVE('',#380,#385); +#380 = PLANE('',#381); +#381 = AXIS2_PLACEMENT_3D('',#382,#383,#384); +#382 = CARTESIAN_POINT('',(0.,0.,19.999999552965)); +#383 = DIRECTION('',(0.,0.,1.)); +#384 = DIRECTION('',(1.,0.,0.)); +#385 = DEFINITIONAL_REPRESENTATION('',(#386),#394); +#386 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#387,#388,#389,#390,#391,#392 +,#393),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#387 = CARTESIAN_POINT('',(132.42991054761,102.18666633037)); +#388 = CARTESIAN_POINT('',(132.42991054761,231.16639046259)); +#389 = CARTESIAN_POINT('',(20.730192876013,166.67652839648)); +#390 = CARTESIAN_POINT('',(-90.96952479559,102.18666633037)); +#391 = CARTESIAN_POINT('',(20.730192876013,37.696804264271)); +#392 = CARTESIAN_POINT('',(132.42991054761,-26.79305780183)); +#393 = CARTESIAN_POINT('',(132.42991054761,102.18666633037)); +#394 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#395 = ORIENTED_EDGE('',*,*,#396,.F.); +#396 = EDGE_CURVE('',#21,#365,#397,.T.); +#397 = SURFACE_CURVE('',#398,(#402,#408),.PCURVE_S2.); +#398 = LINE('',#399,#400); +#399 = CARTESIAN_POINT('',(93.497879803181,36.745399236679, + -19.99999955296)); +#400 = VECTOR('',#401,1.); +#401 = DIRECTION('',(0.,0.,1.)); +#402 = PCURVE('',#46,#403); +#403 = DEFINITIONAL_REPRESENTATION('',(#404),#407); +#404 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#405,#406),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#405 = CARTESIAN_POINT('',(5.209840138517,0.)); +#406 = CARTESIAN_POINT('',(5.209840138517,39.99999910593)); +#407 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#408 = PCURVE('',#78,#409); +#409 = DEFINITIONAL_REPRESENTATION('',(#410),#413); +#410 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#411,#412),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#411 = CARTESIAN_POINT('',(4.214937822253,0.)); +#412 = CARTESIAN_POINT('',(4.214937822253,-39.99999910593)); +#413 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#414 = ORIENTED_EDGE('',*,*,#18,.F.); +#415 = ADVANCED_FACE('',(#416),#78,.T.); +#416 = FACE_BOUND('',#417,.T.); +#417 = EDGE_LOOP('',(#418,#419,#446,#465)); +#418 = ORIENTED_EDGE('',*,*,#396,.T.); +#419 = ORIENTED_EDGE('',*,*,#420,.T.); +#420 = EDGE_CURVE('',#365,#421,#423,.T.); +#421 = VERTEX_POINT('',#422); +#422 = CARTESIAN_POINT('',(93.497879803181,-41.78636148572, + 19.999999552965)); +#423 = SURFACE_CURVE('',#424,(#429,#435),.PCURVE_S2.); +#424 = CIRCLE('',#425,44.68116165083); +#425 = AXIS2_PLACEMENT_3D('',#426,#427,#428); +#426 = CARTESIAN_POINT('',(114.81915663942,-2.52048112452, + 19.999999552965)); +#427 = DIRECTION('',(0.,0.,-1.)); +#428 = DIRECTION('',(1.,0.,0.)); +#429 = PCURVE('',#78,#430); +#430 = DEFINITIONAL_REPRESENTATION('',(#431),#434); +#431 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#432,#433),.UNSPECIFIED.,.F.,.F., + (2,2),(4.214937822253,8.351432792106),.PIECEWISE_BEZIER_KNOTS.); +#432 = CARTESIAN_POINT('',(4.214937822253,-39.99999910593)); +#433 = CARTESIAN_POINT('',(8.351432792106,-39.99999910593)); +#434 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#435 = PCURVE('',#380,#436); +#436 = DEFINITIONAL_REPRESENTATION('',(#437),#445); +#437 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#438,#439,#440,#441,#442,#443 +,#444),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#438 = CARTESIAN_POINT('',(159.50031829025,-2.52048112452)); +#439 = CARTESIAN_POINT('',(159.50031829025,-79.91052324495)); +#440 = CARTESIAN_POINT('',(92.478575814005,-41.21550218473)); +#441 = CARTESIAN_POINT('',(25.45683333776,-2.52048112452)); +#442 = CARTESIAN_POINT('',(92.478575814005,36.174539935697)); +#443 = CARTESIAN_POINT('',(159.50031829025,74.869560995915)); +#444 = CARTESIAN_POINT('',(159.50031829025,-2.52048112452)); +#445 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#446 = ORIENTED_EDGE('',*,*,#447,.F.); +#447 = EDGE_CURVE('',#58,#421,#448,.T.); +#448 = SURFACE_CURVE('',#449,(#453,#459),.PCURVE_S2.); +#449 = LINE('',#450,#451); +#450 = CARTESIAN_POINT('',(93.497879803181,-41.78636148572, + -19.99999955296)); +#451 = VECTOR('',#452,1.); +#452 = DIRECTION('',(0.,0.,1.)); +#453 = PCURVE('',#78,#454); +#454 = DEFINITIONAL_REPRESENTATION('',(#455),#458); +#455 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#456,#457),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#456 = CARTESIAN_POINT('',(8.351432792106,0.)); +#457 = CARTESIAN_POINT('',(8.351432792106,-39.99999910593)); +#458 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#459 = PCURVE('',#110,#460); +#460 = DEFINITIONAL_REPRESENTATION('',(#461),#464); +#461 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#462,#463),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#462 = CARTESIAN_POINT('',(1.073345168663,0.)); +#463 = CARTESIAN_POINT('',(1.073345168663,39.99999910593)); +#464 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#465 = ORIENTED_EDGE('',*,*,#57,.F.); +#466 = ADVANCED_FACE('',(#467),#110,.F.); +#467 = FACE_BOUND('',#468,.T.); +#468 = EDGE_LOOP('',(#469,#470,#497,#517)); +#469 = ORIENTED_EDGE('',*,*,#447,.T.); +#470 = ORIENTED_EDGE('',*,*,#471,.T.); +#471 = EDGE_CURVE('',#421,#472,#474,.T.); +#472 = VERTEX_POINT('',#473); +#473 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + 19.999999552965)); +#474 = SURFACE_CURVE('',#475,(#480,#486),.PCURVE_S2.); +#475 = CIRCLE('',#476,84.24770250966); +#476 = AXIS2_PLACEMENT_3D('',#477,#478,#479); +#477 = CARTESIAN_POINT('',(53.295957524102,-115.8233848133, + 19.999999552965)); +#478 = DIRECTION('',(0.,0.,1.)); +#479 = DIRECTION('',(1.,0.,0.)); +#480 = PCURVE('',#110,#481); +#481 = DEFINITIONAL_REPRESENTATION('',(#482),#485); +#482 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#483,#484),.UNSPECIFIED.,.F.,.F., + (2,2),(1.073345168663,1.501387093594),.PIECEWISE_BEZIER_KNOTS.); +#483 = CARTESIAN_POINT('',(1.073345168663,39.99999910593)); +#484 = CARTESIAN_POINT('',(1.501387093594,39.99999910593)); +#485 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#486 = PCURVE('',#380,#487); +#487 = DEFINITIONAL_REPRESENTATION('',(#488),#496); +#488 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#489,#490,#491,#492,#493,#494 +,#495),.UNSPECIFIED.,.T.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#489 = CARTESIAN_POINT('',(137.54366003376,-115.8233848133)); +#490 = CARTESIAN_POINT('',(137.54366003376,30.097916354281)); +#491 = CARTESIAN_POINT('',(11.172106269272,-42.86273422955)); +#492 = CARTESIAN_POINT('',(-115.1994474952,-115.8233848133)); +#493 = CARTESIAN_POINT('',(11.172106269272,-188.7840353972)); +#494 = CARTESIAN_POINT('',(137.54366003376,-261.744685981)); +#495 = CARTESIAN_POINT('',(137.54366003376,-115.8233848133)); +#496 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#497 = ORIENTED_EDGE('',*,*,#498,.F.); +#498 = EDGE_CURVE('',#90,#472,#499,.T.); +#499 = SURFACE_CURVE('',#500,(#504,#510),.PCURVE_S2.); +#500 = LINE('',#501,#502); +#501 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + -19.99999955296)); +#502 = VECTOR('',#503,1.); +#503 = DIRECTION('',(0.,0.,1.)); +#504 = PCURVE('',#110,#505); +#505 = DEFINITIONAL_REPRESENTATION('',(#506),#509); +#506 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#507,#508),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#507 = CARTESIAN_POINT('',(1.501387093594,0.)); +#508 = CARTESIAN_POINT('',(1.501387093594,39.99999910593)); +#509 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#510 = PCURVE('',#137,#511); +#511 = DEFINITIONAL_REPRESENTATION('',(#512),#516); +#512 = LINE('',#513,#514); +#513 = CARTESIAN_POINT('',(0.,0.)); +#514 = VECTOR('',#515,1.); +#515 = DIRECTION('',(0.,-1.)); +#516 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#517 = ORIENTED_EDGE('',*,*,#89,.F.); +#518 = ADVANCED_FACE('',(#519),#137,.T.); +#519 = FACE_BOUND('',#520,.T.); +#520 = EDGE_LOOP('',(#521,#522,#545,#565)); +#521 = ORIENTED_EDGE('',*,*,#498,.T.); +#522 = ORIENTED_EDGE('',*,*,#523,.T.); +#523 = EDGE_CURVE('',#472,#524,#526,.T.); +#524 = VERTEX_POINT('',#525); +#525 = CARTESIAN_POINT('',(-72.42252677679,-22.63227291405, + 19.999999552965)); +#526 = SURFACE_CURVE('',#527,(#531,#538),.PCURVE_S2.); +#527 = LINE('',#528,#529); +#528 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + 19.999999552965)); +#529 = VECTOR('',#530,1.); +#530 = DIRECTION('',(-0.997592146088,6.935351515554E-02,0.)); +#531 = PCURVE('',#137,#532); +#532 = DEFINITIONAL_REPRESENTATION('',(#533),#537); +#533 = LINE('',#534,#535); +#534 = CARTESIAN_POINT('',(0.,-39.99999910593)); +#535 = VECTOR('',#536,1.); +#536 = DIRECTION('',(1.,0.)); +#537 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#538 = PCURVE('',#380,#539); +#539 = DEFINITIONAL_REPRESENTATION('',(#540),#544); +#540 = LINE('',#541,#542); +#541 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384)); +#542 = VECTOR('',#543,1.); +#543 = DIRECTION('',(-0.997592146088,6.935351515554E-02)); +#544 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#545 = ORIENTED_EDGE('',*,*,#546,.F.); +#546 = EDGE_CURVE('',#122,#524,#547,.T.); +#547 = SURFACE_CURVE('',#548,(#552,#559),.PCURVE_S2.); +#548 = LINE('',#549,#550); +#549 = CARTESIAN_POINT('',(-72.42252677679,-22.63227291405, + -19.99999955296)); +#550 = VECTOR('',#551,1.); +#551 = DIRECTION('',(0.,0.,1.)); +#552 = PCURVE('',#137,#553); +#553 = DEFINITIONAL_REPRESENTATION('',(#554),#558); +#554 = LINE('',#555,#556); +#555 = CARTESIAN_POINT('',(131.87890374807,0.)); +#556 = VECTOR('',#557,1.); +#557 = DIRECTION('',(0.,-1.)); +#558 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#559 = PCURVE('',#170,#560); +#560 = DEFINITIONAL_REPRESENTATION('',(#561),#564); +#561 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#562,#563),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#562 = CARTESIAN_POINT('',(1.501387093594,0.)); +#563 = CARTESIAN_POINT('',(1.501387093594,39.99999910593)); +#564 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#565 = ORIENTED_EDGE('',*,*,#121,.F.); +#566 = ADVANCED_FACE('',(#567),#170,.F.); +#567 = FACE_BOUND('',#568,.T.); +#568 = EDGE_LOOP('',(#569,#570,#597,#616)); +#569 = ORIENTED_EDGE('',*,*,#546,.T.); +#570 = ORIENTED_EDGE('',*,*,#571,.T.); +#571 = EDGE_CURVE('',#524,#572,#574,.T.); +#572 = VERTEX_POINT('',#573); +#573 = CARTESIAN_POINT('',(-88.51642906665,-27.22925320267, + 19.999999552965)); +#574 = SURFACE_CURVE('',#575,(#580,#586),.PCURVE_S2.); +#575 = CIRCLE('',#576,24.565238684828); +#576 = AXIS2_PLACEMENT_3D('',#577,#578,#579); +#577 = CARTESIAN_POINT('',(-74.12621243021,-47.1383620928, + 19.999999552965)); +#578 = DIRECTION('',(0.,0.,1.)); +#579 = DIRECTION('',(1.,0.,0.)); +#580 = PCURVE('',#170,#581); +#581 = DEFINITIONAL_REPRESENTATION('',(#582),#585); +#582 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#583,#584),.UNSPECIFIED.,.F.,.F., + (2,2),(1.501387093594,2.196658099744),.PIECEWISE_BEZIER_KNOTS.); +#583 = CARTESIAN_POINT('',(1.501387093594,39.99999910593)); +#584 = CARTESIAN_POINT('',(2.196658099744,39.99999910593)); +#585 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#586 = PCURVE('',#380,#587); +#587 = DEFINITIONAL_REPRESENTATION('',(#588),#596); +#588 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#589,#590,#591,#592,#593,#594 +,#595),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#589 = CARTESIAN_POINT('',(-49.56097374539,-47.1383620928)); +#590 = CARTESIAN_POINT('',(-49.56097374539,-4.590120590624)); +#591 = CARTESIAN_POINT('',(-86.40883177263,-25.86424134171)); +#592 = CARTESIAN_POINT('',(-123.2566897998,-47.1383620928)); +#593 = CARTESIAN_POINT('',(-86.40883177263,-68.41248284389)); +#594 = CARTESIAN_POINT('',(-49.56097374539,-89.68660359498)); +#595 = CARTESIAN_POINT('',(-49.56097374539,-47.1383620928)); +#596 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#597 = ORIENTED_EDGE('',*,*,#598,.F.); +#598 = EDGE_CURVE('',#150,#572,#599,.T.); +#599 = SURFACE_CURVE('',#600,(#604,#610),.PCURVE_S2.); +#600 = LINE('',#601,#602); +#601 = CARTESIAN_POINT('',(-88.51642906665,-27.22925320267, + -19.99999955296)); +#602 = VECTOR('',#603,1.); +#603 = DIRECTION('',(0.,0.,1.)); +#604 = PCURVE('',#170,#605); +#605 = DEFINITIONAL_REPRESENTATION('',(#606),#609); +#606 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#607,#608),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#607 = CARTESIAN_POINT('',(2.196658099744,0.)); +#608 = CARTESIAN_POINT('',(2.196658099744,39.99999910593)); +#609 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#610 = PCURVE('',#202,#611); +#611 = DEFINITIONAL_REPRESENTATION('',(#612),#615); +#612 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#613,#614),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#613 = CARTESIAN_POINT('',(0.944934553846,0.)); +#614 = CARTESIAN_POINT('',(0.944934553846,-39.99999910593)); +#615 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#616 = ORIENTED_EDGE('',*,*,#149,.F.); +#617 = ADVANCED_FACE('',(#618),#202,.T.); +#618 = FACE_BOUND('',#619,.T.); +#619 = EDGE_LOOP('',(#620,#621,#648,#667)); +#620 = ORIENTED_EDGE('',*,*,#598,.T.); +#621 = ORIENTED_EDGE('',*,*,#622,.T.); +#622 = EDGE_CURVE('',#572,#623,#625,.T.); +#623 = VERTEX_POINT('',#624); +#624 = CARTESIAN_POINT('',(-88.51642906665,21.039046347141, + 19.999999552965)); +#625 = SURFACE_CURVE('',#626,(#631,#637),.PCURVE_S2.); +#626 = CIRCLE('',#627,29.778387016109); +#627 = AXIS2_PLACEMENT_3D('',#628,#629,#630); +#628 = CARTESIAN_POINT('',(-105.9604867346,-3.095103427768, + 19.999999552965)); +#629 = DIRECTION('',(0.,0.,-1.)); +#630 = DIRECTION('',(1.,0.,0.)); +#631 = PCURVE('',#202,#632); +#632 = DEFINITIONAL_REPRESENTATION('',(#633),#636); +#633 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#634,#635),.UNSPECIFIED.,.F.,.F., + (2,2),(0.944934553846,5.338250753333),.PIECEWISE_BEZIER_KNOTS.); +#634 = CARTESIAN_POINT('',(0.944934553846,-39.99999910593)); +#635 = CARTESIAN_POINT('',(5.338250753333,-39.99999910593)); +#636 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#637 = PCURVE('',#380,#638); +#638 = DEFINITIONAL_REPRESENTATION('',(#639),#647); +#639 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#640,#641,#642,#643,#644,#645 +,#646),.UNSPECIFIED.,.T.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#640 = CARTESIAN_POINT('',(-76.18209971851,-3.095103427768)); +#641 = CARTESIAN_POINT('',(-76.18209971851,-54.67278270711)); +#642 = CARTESIAN_POINT('',(-120.8496802426,-28.88394306744)); +#643 = CARTESIAN_POINT('',(-165.5172607668,-3.095103427768)); +#644 = CARTESIAN_POINT('',(-120.8496802426,22.693736211908)); +#645 = CARTESIAN_POINT('',(-76.18209971851,48.482575851583)); +#646 = CARTESIAN_POINT('',(-76.18209971851,-3.095103427768)); +#647 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#648 = ORIENTED_EDGE('',*,*,#649,.F.); +#649 = EDGE_CURVE('',#182,#623,#650,.T.); +#650 = SURFACE_CURVE('',#651,(#655,#661),.PCURVE_S2.); +#651 = LINE('',#652,#653); +#652 = CARTESIAN_POINT('',(-88.51642906665,21.039046347141, + -19.99999955296)); +#653 = VECTOR('',#654,1.); +#654 = DIRECTION('',(0.,0.,1.)); +#655 = PCURVE('',#202,#656); +#656 = DEFINITIONAL_REPRESENTATION('',(#657),#660); +#657 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#658,#659),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#658 = CARTESIAN_POINT('',(5.338250753333,0.)); +#659 = CARTESIAN_POINT('',(5.338250753333,-39.99999910593)); +#660 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#661 = PCURVE('',#234,#662); +#662 = DEFINITIONAL_REPRESENTATION('',(#663),#666); +#663 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#664,#665),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#664 = CARTESIAN_POINT('',(4.086527207436,0.)); +#665 = CARTESIAN_POINT('',(4.086527207436,39.99999910593)); +#666 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#667 = ORIENTED_EDGE('',*,*,#181,.F.); +#668 = ADVANCED_FACE('',(#669),#234,.F.); +#669 = FACE_BOUND('',#670,.T.); +#670 = EDGE_LOOP('',(#671,#672,#699,#719)); +#671 = ORIENTED_EDGE('',*,*,#649,.T.); +#672 = ORIENTED_EDGE('',*,*,#673,.T.); +#673 = EDGE_CURVE('',#623,#674,#676,.T.); +#674 = VERTEX_POINT('',#675); +#675 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + 19.999999552965)); +#676 = SURFACE_CURVE('',#677,(#682,#688),.PCURVE_S2.); +#677 = CIRCLE('',#678,20.41914254867); +#678 = AXIS2_PLACEMENT_3D('',#679,#680,#681); +#679 = CARTESIAN_POINT('',(-76.55497863763,37.587915977932, + 19.999999552965)); +#680 = DIRECTION('',(0.,0.,1.)); +#681 = DIRECTION('',(1.,0.,0.)); +#682 = PCURVE('',#234,#683); +#683 = DEFINITIONAL_REPRESENTATION('',(#684),#687); +#684 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#685,#686),.UNSPECIFIED.,.F.,.F., + (2,2),(4.086527207436,4.916177873213),.PIECEWISE_BEZIER_KNOTS.); +#685 = CARTESIAN_POINT('',(4.086527207436,39.99999910593)); +#686 = CARTESIAN_POINT('',(4.916177873213,39.99999910593)); +#687 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#688 = PCURVE('',#380,#689); +#689 = DEFINITIONAL_REPRESENTATION('',(#690),#698); +#690 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#691,#692,#693,#694,#695,#696 +,#697),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#691 = CARTESIAN_POINT('',(-56.13583608896,37.587915977932)); +#692 = CARTESIAN_POINT('',(-56.13583608896,72.954908319219)); +#693 = CARTESIAN_POINT('',(-86.76454991196,55.271412148575)); +#694 = CARTESIAN_POINT('',(-117.3932637349,37.587915977932)); +#695 = CARTESIAN_POINT('',(-86.76454991196,19.904419807288)); +#696 = CARTESIAN_POINT('',(-56.13583608896,2.220923636644)); +#697 = CARTESIAN_POINT('',(-56.13583608896,37.587915977932)); +#698 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#699 = ORIENTED_EDGE('',*,*,#700,.F.); +#700 = EDGE_CURVE('',#214,#674,#701,.T.); +#701 = SURFACE_CURVE('',#702,(#706,#712),.PCURVE_S2.); +#702 = LINE('',#703,#704); +#703 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + -19.99999955296)); +#704 = VECTOR('',#705,1.); +#705 = DIRECTION('',(0.,0.,1.)); +#706 = PCURVE('',#234,#707); +#707 = DEFINITIONAL_REPRESENTATION('',(#708),#711); +#708 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#709,#710),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#709 = CARTESIAN_POINT('',(4.916177873213,0.)); +#710 = CARTESIAN_POINT('',(4.916177873213,39.99999910593)); +#711 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#712 = PCURVE('',#259,#713); +#713 = DEFINITIONAL_REPRESENTATION('',(#714),#718); +#714 = LINE('',#715,#716); +#715 = CARTESIAN_POINT('',(0.,0.)); +#716 = VECTOR('',#717,1.); +#717 = DIRECTION('',(0.,-1.)); +#718 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#719 = ORIENTED_EDGE('',*,*,#213,.F.); +#720 = ADVANCED_FACE('',(#721),#259,.T.); +#721 = FACE_BOUND('',#722,.T.); +#722 = EDGE_LOOP('',(#723,#724,#745,#746)); +#723 = ORIENTED_EDGE('',*,*,#700,.T.); +#724 = ORIENTED_EDGE('',*,*,#725,.T.); +#725 = EDGE_CURVE('',#674,#343,#726,.T.); +#726 = SURFACE_CURVE('',#727,(#731,#738),.PCURVE_S2.); +#727 = LINE('',#728,#729); +#728 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + 19.999999552965)); +#729 = VECTOR('',#730,1.); +#730 = DIRECTION('',(0.997121794488,7.581640296081E-02,0.)); +#731 = PCURVE('',#259,#732); +#732 = DEFINITIONAL_REPRESENTATION('',(#733),#737); +#733 = LINE('',#734,#735); +#734 = CARTESIAN_POINT('',(0.,-39.99999910593)); +#735 = VECTOR('',#736,1.); +#736 = DIRECTION('',(1.,0.)); +#737 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#738 = PCURVE('',#380,#739); +#739 = DEFINITIONAL_REPRESENTATION('',(#740),#744); +#740 = LINE('',#741,#742); +#741 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011)); +#742 = VECTOR('',#743,1.); +#743 = DIRECTION('',(0.997121794488,7.581640296081E-02)); +#744 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#745 = ORIENTED_EDGE('',*,*,#342,.F.); +#746 = ORIENTED_EDGE('',*,*,#245,.F.); +#747 = ADVANCED_FACE('',(#748),#294,.F.); +#748 = FACE_BOUND('',#749,.T.); +#749 = EDGE_LOOP('',(#750,#771,#796,#797)); +#750 = ORIENTED_EDGE('',*,*,#751,.T.); +#751 = EDGE_CURVE('',#274,#752,#754,.T.); +#752 = VERTEX_POINT('',#753); +#753 = CARTESIAN_POINT('',(-91.4143372247,-2.809300087392, + 19.999999552965)); +#754 = SEAM_CURVE('',#755,(#759,#765),.PCURVE_S2.); +#755 = LINE('',#756,#757); +#756 = CARTESIAN_POINT('',(-91.4143372247,-2.809300087392, + -40.00019910593)); +#757 = VECTOR('',#758,1.); +#758 = DIRECTION('',(0.,0.,1.)); +#759 = PCURVE('',#294,#760); +#760 = DEFINITIONAL_REPRESENTATION('',(#761),#764); +#761 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#762,#763),.UNSPECIFIED.,.F.,.F., + (2,2),(20.000199552965,60.000198658895),.PIECEWISE_BEZIER_KNOTS.); +#762 = CARTESIAN_POINT('',(0.,20.000199552965)); +#763 = CARTESIAN_POINT('',(0.,60.000198658895)); +#764 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#765 = PCURVE('',#294,#766); +#766 = DEFINITIONAL_REPRESENTATION('',(#767),#770); +#767 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#768,#769),.UNSPECIFIED.,.F.,.F., + (2,2),(20.000199552965,60.000198658895),.PIECEWISE_BEZIER_KNOTS.); +#768 = CARTESIAN_POINT('',(6.28318530718,20.000199552965)); +#769 = CARTESIAN_POINT('',(6.28318530718,60.000198658895)); +#770 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#771 = ORIENTED_EDGE('',*,*,#772,.F.); +#772 = EDGE_CURVE('',#752,#752,#773,.T.); +#773 = SURFACE_CURVE('',#774,(#779,#785),.PCURVE_S2.); +#774 = CIRCLE('',#775,15.057678156153); +#775 = AXIS2_PLACEMENT_3D('',#776,#777,#778); +#776 = CARTESIAN_POINT('',(-106.4720153808,-2.809300087392, + 19.999999552965)); +#777 = DIRECTION('',(0.,0.,-1.)); +#778 = DIRECTION('',(0.,1.,0.)); +#779 = PCURVE('',#294,#780); +#780 = DEFINITIONAL_REPRESENTATION('',(#781),#784); +#781 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#782,#783),.UNSPECIFIED.,.F.,.F., + (2,2),(1.570796326795,7.853981633974),.PIECEWISE_BEZIER_KNOTS.); +#782 = CARTESIAN_POINT('',(6.28318530718,60.000198658895)); +#783 = CARTESIAN_POINT('',(0.,60.000198658895)); +#784 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#785 = PCURVE('',#380,#786); +#786 = DEFINITIONAL_REPRESENTATION('',(#787),#795); +#787 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#788,#789,#790,#791,#792,#793 +,#794),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#788 = CARTESIAN_POINT('',(-106.4720153808,12.24837806876)); +#789 = CARTESIAN_POINT('',(-80.39135177038,12.24837806876)); +#790 = CARTESIAN_POINT('',(-93.43168357562,-10.33813916546)); +#791 = CARTESIAN_POINT('',(-106.4720153808,-32.92465639969)); +#792 = CARTESIAN_POINT('',(-119.512347186,-10.33813916546)); +#793 = CARTESIAN_POINT('',(-132.5526789913,12.24837806876)); +#794 = CARTESIAN_POINT('',(-106.4720153808,12.24837806876)); +#795 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#796 = ORIENTED_EDGE('',*,*,#751,.F.); +#797 = ORIENTED_EDGE('',*,*,#273,.T.); +#798 = ADVANCED_FACE('',(#799),#328,.F.); +#799 = FACE_BOUND('',#800,.T.); +#800 = EDGE_LOOP('',(#801,#822,#847,#848)); +#801 = ORIENTED_EDGE('',*,*,#802,.T.); +#802 = EDGE_CURVE('',#308,#803,#805,.T.); +#803 = VERTEX_POINT('',#804); +#804 = CARTESIAN_POINT('',(141.97662545896,-4.606760106981, + 19.999999552965)); +#805 = SEAM_CURVE('',#806,(#810,#816),.PCURVE_S2.); +#806 = LINE('',#807,#808); +#807 = CARTESIAN_POINT('',(141.97662545896,-4.606760106981, + -40.00019910593)); +#808 = VECTOR('',#809,1.); +#809 = DIRECTION('',(0.,0.,1.)); +#810 = PCURVE('',#328,#811); +#811 = DEFINITIONAL_REPRESENTATION('',(#812),#815); +#812 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#813,#814),.UNSPECIFIED.,.F.,.F., + (2,2),(20.000199552965,60.000198658895),.PIECEWISE_BEZIER_KNOTS.); +#813 = CARTESIAN_POINT('',(0.,20.000199552965)); +#814 = CARTESIAN_POINT('',(0.,60.000198658895)); +#815 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#816 = PCURVE('',#328,#817); +#817 = DEFINITIONAL_REPRESENTATION('',(#818),#821); +#818 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#819,#820),.UNSPECIFIED.,.F.,.F., + (2,2),(20.000199552965,60.000198658895),.PIECEWISE_BEZIER_KNOTS.); +#819 = CARTESIAN_POINT('',(6.28318530718,20.000199552965)); +#820 = CARTESIAN_POINT('',(6.28318530718,60.000198658895)); +#821 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#822 = ORIENTED_EDGE('',*,*,#823,.F.); +#823 = EDGE_CURVE('',#803,#803,#824,.T.); +#824 = SURFACE_CURVE('',#825,(#830,#836),.PCURVE_S2.); +#825 = CIRCLE('',#826,23.40416683412); +#826 = AXIS2_PLACEMENT_3D('',#827,#828,#829); +#827 = CARTESIAN_POINT('',(118.57245862484,-4.606760106981, + 19.999999552965)); +#828 = DIRECTION('',(0.,0.,-1.)); +#829 = DIRECTION('',(0.,1.,0.)); +#830 = PCURVE('',#328,#831); +#831 = DEFINITIONAL_REPRESENTATION('',(#832),#835); +#832 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#833,#834),.UNSPECIFIED.,.F.,.F., + (2,2),(1.570796326795,7.853981633974),.PIECEWISE_BEZIER_KNOTS.); +#833 = CARTESIAN_POINT('',(6.28318530718,60.000198658895)); +#834 = CARTESIAN_POINT('',(0.,60.000198658895)); +#835 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#836 = PCURVE('',#380,#837); +#837 = DEFINITIONAL_REPRESENTATION('',(#838),#846); +#838 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#839,#840,#841,#842,#843,#844 +,#845),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#839 = CARTESIAN_POINT('',(118.57245862484,18.797406727139)); +#840 = CARTESIAN_POINT('',(159.10966469035,18.797406727139)); +#841 = CARTESIAN_POINT('',(138.84106165759,-16.30884352404)); +#842 = CARTESIAN_POINT('',(118.57245862484,-51.41509377522)); +#843 = CARTESIAN_POINT('',(98.303855592083,-16.30884352404)); +#844 = CARTESIAN_POINT('',(78.035252559326,18.797406727139)); +#845 = CARTESIAN_POINT('',(118.57245862484,18.797406727139)); +#846 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#847 = ORIENTED_EDGE('',*,*,#802,.F.); +#848 = ORIENTED_EDGE('',*,*,#307,.T.); +#849 = ADVANCED_FACE('',(#850,#860,#863),#380,.T.); +#850 = FACE_BOUND('',#851,.F.); +#851 = EDGE_LOOP('',(#852,#853,#854,#855,#856,#857,#858,#859)); +#852 = ORIENTED_EDGE('',*,*,#364,.T.); +#853 = ORIENTED_EDGE('',*,*,#420,.T.); +#854 = ORIENTED_EDGE('',*,*,#471,.T.); +#855 = ORIENTED_EDGE('',*,*,#523,.T.); +#856 = ORIENTED_EDGE('',*,*,#571,.T.); +#857 = ORIENTED_EDGE('',*,*,#622,.T.); +#858 = ORIENTED_EDGE('',*,*,#673,.T.); +#859 = ORIENTED_EDGE('',*,*,#725,.T.); +#860 = FACE_BOUND('',#861,.T.); +#861 = EDGE_LOOP('',(#862)); +#862 = ORIENTED_EDGE('',*,*,#772,.T.); +#863 = FACE_BOUND('',#864,.T.); +#864 = EDGE_LOOP('',(#865)); +#865 = ORIENTED_EDGE('',*,*,#823,.T.); +#866 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#869)) GLOBAL_UNIT_ASSIGNED_CONTEXT +((#867,#868)) REPRESENTATION_CONTEXT('Context #1', + '3D Context with UNIT and UNCERTAINTY') ); +#867 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) ); +#868 = ( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) ); +#869 = UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-04),#867, + 'distance_accuracy_value','Confusion accuracy'); +ENDSEC; +END-ISO-10303-21; + diff --git a/src/TEST_PY/non_regression/k21592_getAsso.py b/src/TEST_PY/non_regression/k21592_getAsso.py new file mode 100644 index 0000000..cb2ecdd --- /dev/null +++ b/src/TEST_PY/non_regression/k21592_getAsso.py @@ -0,0 +1,282 @@ +# -*- coding: latin-1 -*- +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# Francis KLOSS : 2011-2012 : CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France +# ============================================================================================= + +import math + +import geompy +import hexablock + +# Construire le modèle de bloc +# ============================ + +doc = hexablock.addDocument("bielle") + +# Construire les 2 grilles cylindriques +# ------------------------------------- + +centre_pb = doc.addVertex(0, 0, 0) +centre_gb = doc.addVertex(7, 0, 0) + +angle_px = math.pi / 3 +vecteur_px = doc.addVector(math.cos(angle_px), math.sin(angle_px), 0) +vecteur_gx = doc.addVector(1, 0, 0) + +vecteur_z = doc.addVector(0, 0, 1) + +grille_p = doc.makeCylindrical(centre_pb, vecteur_px, vecteur_z, 1, 360, 1, 1, 3, 1, False) +grille_g = doc.makeCylindrical(centre_gb, vecteur_gx, vecteur_z, 1, 360, 1, 1, 3, 1, False) + +# Relier les 2 grilles +# -------------------- + +quad_p = grille_p.getQuadJK(1, 2, 0) +quad_g = grille_g.getQuadJK(1, 1, 0) + +point_p1 = grille_p.getVertexIJK(1, 0, 0) +point_p2 = grille_p.getVertexIJK(1, 2, 0) + +point_g1 = grille_g.getVertexIJK(1, 1, 0) +point_g2 = grille_g.getVertexIJK(1, 2, 0) + +prisme = doc.joinQuad(quad_p, quad_g, point_p1, point_g1, point_p2, point_g2, 3) + +# Charger la géométrie +# ==================== + +bielle = geompy.ImportSTEP("bielle.stp") + +# Sélectionner des sous-parties de la géométrie +# --------------------------------------------- + +sommets = geompy.SubShapeAllSortedCentres(bielle, geompy.ShapeType["VERTEX"]) + +sommets_petit = [ 6, 8, 7, 9 ] +sommets_grand = [ 10, 12, 11, 13 ] + +aretes = geompy.SubShapeAllSortedCentres(bielle, geompy.ShapeType["EDGE"]) + +aretes_petit = [ 7, 9, 8, 10 ] +aretes_grand = [ 19, 21, 20, 22 ] + +ga_pbcd = aretes[ 0] +ga_pbe = aretes[ 2] + +ga_phcd = aretes[ 1] +ga_phe = aretes[ 3] + +ga_gbcd = aretes[27] +ga_gbe = aretes[25] + +ga_ghcd = aretes[28] +ga_ghe = aretes[26] + +# Associer le modèle de bloc avec la géométrie +# ============================================ + +doc.setShape(bielle) + +# Netoyer les associations implicites du prisme +# --------------------------------------------- + +for i in xrange( prisme.countEdge() ): + em = prisme.getEdge(i) + if em != None: + em.clearAssociation() + +# Associer les cercles extérieurs +# ------------------------------- + +def cercle(grille, k, ge, p): + ms = grille.getVertexIJK(0, 0, k) + ma1 = grille.getEdgeJ(0, 2, k) + ma2 = grille.getEdgeJ(0, 1, k) + ma3 = grille.getEdgeJ(0, 0, k) + doc.associateClosedLine(ms, ma1, [ ma2, ma3 ], ge, p, False, []) + +cercle(grille_p, 0, ga_pbe, 5.0/6) +cercle(grille_p, 1, ga_phe, 5.0/6) + +cercle(grille_g, 0, ga_gbe, 0) +cercle(grille_g, 1, ga_ghe, 0) + +# Associer les arcs extérieurs (excentrés) +# ---------------------------------------- + +def arc(grille, i1, i2, k, ge): + ma1 = grille.getEdgeJ(1, i1, k) + ma2 = grille.getEdgeJ(1, i2, k) + doc.associateOpenedLine(ma1, [ ma2 ], ge, 0, [], 1) + +arc(grille_p, 1, 0, 0, ga_pbcd) +arc(grille_p, 1, 0, 1, ga_phcd) + +arc(grille_g, 0, 2, 0, ga_gbcd) +arc(grille_g, 0, 2, 1, ga_ghcd) + +# Associer les arcs de cercle de raccord +# -------------------------------------- + +hm = prisme.getHexa(0) +for i in xrange(0, 4): + em = hm.getEdge(i+8) + ga = aretes[ aretes_petit[i] ] + + em.addAssociation(ga, 0, 1) + +hm = prisme.getHexa(2) +for i in xrange(0, 4): + em = hm.getEdge(i+8) + ga = aretes[ aretes_grand[i] ] + +# Associer les sommets des arcs de cercle de raccord +# -------------------------------------------------- + +hm = prisme.getHexa(1) +for i in xrange(0, 4): + vm = hm.getVertex(i) + ga = sommets[ sommets_petit[i] ] + vm.setAssociation(ga) + +hm = prisme.getHexa(2) +for i in xrange(0, 4): + vm = hm.getVertex(i) + ga = sommets[ sommets_grand[i] ] + vm.setAssociation(ga) + +# Associer les arcs de cercle de raccord +# -------------------------------------- + +hm = prisme.getHexa(0) +for i in xrange(0, 4): + em = hm.getEdge(i+8) + ga = aretes[ aretes_petit[i] ] + em.clearAssociation() + em.addAssociation(ga, 0, 1) + +hm = prisme.getHexa(2) +for i in xrange(0, 4): + em = hm.getEdge(i+8) + ga = aretes[ aretes_grand[i] ] + em.clearAssociation() + em.addAssociation(ga, 0, 1) + +# Arrondir des associations implicites cylindriques +# ------------------------------------------------- + +for h, i, ech in [ [0, 0, 0.95], [0, 1, 0.95], [2, 2, 0.85], [2, 3, 0.85] ]: + hm = prisme.getHexa(h) + em = hm.getEdge(i) + va = em.getVertex(0).getAssociation() + vb = em.getVertex(1).getAssociation() + vax, vay, vaz = geompy.PointCoordinates(va) + vbx, vby, vbz = geompy.PointCoordinates(vb) + vmx = ( vax + vbx ) / 2.0 * ech + vmy = ( vay + vby ) / 2.0 + vmz = ( vaz + vbz ) / 2.0 + vm = geompy.MakeVertex(vmx, vmy, vmz) + eg = geompy.MakeArc(va, vm, vb) + em.clearAssociation() + em.addAssociation(eg, 0, 1) + +# Test getAsso sur les edges +nbedges = doc.countEdge () +for nro in range (nbedges) : + edge = doc.getEdge (nro) + assos = edge.getAssociations() + nbass = len (assos) + print " ... %d Edge = %s, nb asso = %d" % (nro, edge.getName(), nbass) + for na in range (nbass) : + print " ... Asso(", na, ") = ", assos[na] + + +# Mailler le modèle de bloc +# ========================= + +# Définir 5 groupes de faces +# -------------------------- + +groupe_petit = doc.addQuadGroup("Petit") +groupe_grand = doc.addQuadGroup("Grand") +groupe_bas = doc.addQuadGroup("Bas") +groupe_haut = doc.addQuadGroup("Haut") +groupe_contour = doc.addQuadGroup("Contour") + +# Constituer les groupes petit et grand +# ------------------------------------- + +for i in xrange(3): + groupe_petit.addElement( grille_p.getQuadJK(0, i, 0) ) + groupe_grand.addElement( grille_g.getQuadJK(0, i, 0) ) + +# Constituer les groupes bas et haut +# ---------------------------------- + +for i in xrange(3): + groupe_bas.addElement( grille_p.getQuadIJ(0, i, 0) ) + groupe_bas.addElement( grille_g.getQuadIJ(0, i, 0) ) + + groupe_haut.addElement( grille_p.getQuadIJ(0, i, 1) ) + groupe_haut.addElement( grille_g.getQuadIJ(0, i, 1) ) + +for i in xrange(3): + h = prisme.getHexa(i) + groupe_bas.addElement( h.getQuad(2) ) + groupe_haut.addElement( h.getQuad(3) ) + +# Constituer le groupe contour +# ---------------------------- + +for i in xrange(2): + groupe_contour.addElement( grille_p.getQuadJK(1, i, 0) ) + +for i in [0, 2]: + groupe_contour.addElement( grille_g.getQuadJK(1, i, 0) ) + +for i in xrange(3): + h = prisme.getHexa(i) + + groupe_contour.addElement( h.getQuad(4) ) + groupe_contour.addElement( h.getQuad(5) ) + +# Définir 3 groupes de volumes +# ---------------------------- + +groupe_petit = doc.addHexaGroup("Petit") +groupe_grand = doc.addHexaGroup("Grand") +groupe_prisme = doc.addHexaGroup("Prisme") + +for i in xrange(3): + groupe_petit.addElement( grille_p.getHexa(i) ) + groupe_grand.addElement( grille_g.getHexa(i) ) + +for i in xrange(3): + groupe_prisme.addElement( prisme.getHexa(i) ) + +# Mailler le modèle de bloc avec association +# ------------------------------------------ + +hexablock.addLaws(doc, 0.003, True) + +blocs = hexablock.mesh(doc) + +muv, mue, muq, muh = hexablock.dump(doc, blocs) diff --git a/src/TEST_PY/test_unit/bielle.brep b/src/TEST_PY/test_unit/bielle.brep new file mode 100644 index 0000000..c0f086e --- /dev/null +++ b/src/TEST_PY/test_unit/bielle.brep @@ -0,0 +1,639 @@ + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 32 +7 0 0 1 2 2 4.788278205588 0 5.2098401385170003 0 + 4.788278205588 2 5.2098401385170003 2 +7 0 0 1 2 2 4.2149378222529998 0 8.3514327921059994 0 + 4.2149378222529998 2 8.3514327921059994 2 +7 0 0 1 2 2 1.073345168663 0 1.5013870935939999 0 + 1.073345168663 2 1.5013870935939999 2 +7 0 0 1 2 2 1.5013870935939999 0 2.1966580997439999 0 + 1.5013870935939999 2 2.1966580997439999 2 +7 0 0 1 2 2 0.944934553846 0 5.3382507533329999 0 + 0.944934553846 2 5.3382507533329999 2 +7 0 0 1 2 2 4.0865272074360002 0 4.9161778732129999 0 + 4.0865272074360002 2 4.9161778732129999 2 +7 0 0 1 2 2 6.2831853071800001 0.020000199552965 0 0.020000199552965 + 1.570796326795 2 7.8539816339739996 2 +7 0 0 1 2 2 6.2831853071800001 0.020000199552965 0 0.020000199552965 + 1.570796326795 2 7.8539816339739996 2 +7 0 0 1 2 2 4.788278205588 0 4.788278205588 0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 4.788278205588 0.039999999105930002 5.2098401385170003 0.039999999105930002 + 4.788278205588 2 5.2098401385170003 2 +7 0 0 1 2 2 5.2098401385170003 0 5.2098401385170003 0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 4.2149378222529998 0 4.2149378222529998 -0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 4.2149378222529998 -0.039999999105930002 8.3514327921059994 -0.039999999105930002 + 4.2149378222529998 2 8.3514327921059994 2 +7 0 0 1 2 2 8.3514327921059994 0 8.3514327921059994 -0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 1.073345168663 0 1.073345168663 0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 1.073345168663 0.039999999105930002 1.5013870935939999 0.039999999105930002 + 1.073345168663 2 1.5013870935939999 2 +7 0 0 1 2 2 1.5013870935939999 0 1.5013870935939999 0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 1.5013870935939999 0 1.5013870935939999 0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 1.5013870935939999 0.039999999105930002 2.1966580997439999 0.039999999105930002 + 1.5013870935939999 2 2.1966580997439999 2 +7 0 0 1 2 2 2.1966580997439999 0 2.1966580997439999 0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 0.944934553846 0 0.944934553846 -0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 0.944934553846 -0.039999999105930002 5.3382507533329999 -0.039999999105930002 + 0.944934553846 2 5.3382507533329999 2 +7 0 0 1 2 2 5.3382507533329999 0 5.3382507533329999 -0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 4.0865272074360002 0 4.0865272074360002 0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 4.0865272074360002 0.039999999105930002 4.9161778732129999 0.039999999105930002 + 4.0865272074360002 2 4.9161778732129999 2 +7 0 0 1 2 2 4.9161778732129999 0 4.9161778732129999 0.039999999105930002 + 0 2 0.039999999105924999 2 +7 0 0 1 2 2 6.2831853071800001 0.020000199552965 6.2831853071800001 0.060000198658895006 + 0.020000199552970003 2 0.060000198658894999 2 +7 0 0 1 2 2 0 0.020000199552965 0 0.060000198658895006 + 0.020000199552970003 2 0.060000198658894999 2 +7 0 0 1 2 2 6.2831853071800001 0.060000198658895006 0 0.060000198658895006 + 1.570796326795 2 7.8539816339739996 2 +7 0 0 1 2 2 6.2831853071800001 0.020000199552965 6.2831853071800001 0.060000198658895006 + 0.020000199552970003 2 0.060000198658894999 2 +7 0 0 1 2 2 0 0.020000199552965 0 0.060000198658895006 + 0.020000199552970003 2 0.060000198658894999 2 +7 0 0 1 2 2 6.2831853071800001 0.060000198658895006 0 0.060000198658895006 + 1.570796326795 2 7.8539816339739996 2 +Curves 30 +2 0.057963432099881002 0.10218666633037 -0.019999999552959998 0 0 1 1 0 -0 -0 1 0 0.074466478447737003 +2 0.11481915663942001 -0.00252048112452 -0.019999999552959998 0 0 -1 1 0 0 0 -1 0 0.044681161650829998 +2 0.053295957524102003 -0.1158233848133 -0.019999999552959998 0 0 1 1 0 -0 -0 1 0 0.084247702509660002 +1 0.059138831836925004 -0.031778538463840003 -0.019999999552959998 -0.99759214608755542 0.069353515155509096 0 +2 -0.074126212430210003 -0.0471383620928 -0.019999999552959998 0 0 1 1 0 -0 -0 1 0 0.024565238684828 +2 -0.1059604867346 -0.0030951034277679999 -0.019999999552959998 0 0 -1 1 0 0 0 -1 0 0.029778387016109003 +2 -0.07655497863763 0.037587915977931999 -0.019999999552959998 0 0 1 1 0 -0 -0 1 0 0.02041914254867 +1 -0.072422526776789994 0.017591310665011 -0.019999999552959998 0.99712179448755867 0.075816402960776436 0 +2 -0.10647201538080001 -0.0028093000873920001 -0.019999999552959998 0 0 -1 0 1 0 1 -0 0 0.015057678156153002 +2 0.11857245862484 -0.0046067601069809993 -0.019999999552959998 0 0 -1 0 1 0 1 -0 0 0.023404166834120003 +1 0.063609212636948007 0.027934517711401 -0.019999999552959998 0 0 1 +2 0.057963432099881002 0.10218666633037 0.019999999552965001 0 0 1 1 0 -0 -0 1 0 0.074466478447737003 +1 0.093497879803181 0.036745399236679001 -0.019999999552959998 0 0 1 +2 0.11481915663942001 -0.00252048112452 0.019999999552965001 0 0 -1 1 0 0 0 -1 0 0.044681161650829998 +1 0.093497879803181 -0.04178636148572 -0.019999999552959998 0 0 1 +2 0.053295957524102003 -0.1158233848133 0.019999999552965001 0 0 1 1 0 -0 -0 1 0 0.084247702509660002 +1 0.059138831836925004 -0.031778538463840003 -0.019999999552959998 0 0 1 +1 0.059138831836925004 -0.031778538463840003 0.019999999552965001 -0.99759214608755542 0.069353515155509096 0 +1 -0.072422526776789994 -0.022632272914050001 -0.019999999552959998 0 0 1 +2 -0.074126212430210003 -0.0471383620928 0.019999999552965001 0 0 1 1 0 -0 -0 1 0 0.024565238684828 +1 -0.088516429066650013 -0.027229253202670001 -0.019999999552959998 0 0 1 +2 -0.1059604867346 -0.0030951034277679999 0.019999999552965001 0 0 -1 1 0 0 0 -1 0 0.029778387016109003 +1 -0.088516429066650013 0.021039046347140999 -0.019999999552959998 0 0 1 +2 -0.07655497863763 0.037587915977931999 0.019999999552965001 0 0 1 1 0 -0 -0 1 0 0.02041914254867 +1 -0.072422526776789994 0.017591310665011 -0.019999999552959998 0 0 1 +1 -0.072422526776789994 0.017591310665011 0.019999999552965001 0.99712179448755867 0.075816402960776436 0 +1 -0.091414337224700007 -0.0028093000873920001 -0.040000199105930001 0 0 1 +2 -0.10647201538080001 -0.0028093000873920001 0.019999999552965001 0 0 -1 0 1 0 1 -0 0 0.015057678156153002 +1 0.14197662545896 -0.0046067601069809993 -0.040000199105930001 0 0 1 +2 0.11857245862484 -0.0046067601069809993 0.019999999552965001 0 0 -1 0 1 0 1 -0 0 0.023404166834120003 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 12 +1 0 0 -0.019999999552959998 0 0 1 1 0 -0 -0 1 0 +2 0.057963432099881002 0.10218666633037 -0.019999999552959998 0 0 1 1 0 -0 -0 1 0 0.074466478447737003 +2 0.11481915663942001 -0.00252048112452 -0.019999999552959998 0 0 -1 1 0 0 0 -1 0 0.044681161650829998 +2 0.053295957524102003 -0.1158233848133 -0.019999999552959998 0 0 1 1 0 -0 -0 1 0 0.084247702509660002 +2 -0.074126212430210003 -0.0471383620928 -0.019999999552959998 0 0 1 1 0 -0 -0 1 0 0.024565238684828 +2 -0.1059604867346 -0.0030951034277679999 -0.019999999552959998 0 0 -1 1 0 0 0 -1 0 0.029778387016109003 +2 -0.07655497863763 0.037587915977931999 -0.019999999552959998 0 0 1 1 0 -0 -0 1 0 0.02041914254867 +2 -0.10647201538080001 -0.0028093000873920001 -0.040000199105930001 0 0 1 1 0 -0 -0 1 0 0.015057678156153002 +2 0.11857245862484 -0.0046067601069809993 -0.040000199105930001 0 0 1 1 0 -0 -0 1 0 0.023404166834120003 +1 -0.072422526776789994 0.017591310665011 -0.019999999552959998 -0.075816402960776449 0.99712179448755867 0 0.99712179448755867 0.075816402960776449 0 0 0 -1 +1 0.059138831836925004 -0.031778538463840003 -0.019999999552959998 -0.069353515155509096 -0.99759214608755542 0 -0.99759214608755542 0.069353515155509096 0 -0 0 -1 +1 0 0 0.019999999552965001 0 0 1 1 0 -0 -0 1 0 +Triangulations 0 + +TShapes 80 +Ve +1.0001000025e-07 +0.063609212636948 0.027934517711401 -0.01999999955296 +0 0 + +0101101 +* +Ve +1.00005e-07 +0.093497879803181 0.036745399236679 -0.01999999955296 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 1 0 4.78827820558768 5.20984013851675 +2 1 2 0 4.78827820558768 5.20984013851675 +0 + +0101000 ++80 0 -79 0 * +Ve +1.00005e-07 +0.093497879803181 -0.04178636148572 -0.01999999955296 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 2 0 4.21493782225269 8.35143279210647 +2 2 3 0 4.21493782225269 8.35143279210647 +0 + +0101000 ++79 0 -77 0 * +Ve +1.0001000025e-07 +0.059138831836925 -0.03177853846384 -0.01999999955296 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 3 0 1.07334516866233 1.50138709359361 +2 3 4 0 1.07334516866233 1.50138709359361 +0 + +0101000 ++77 0 -75 0 * +Ve +1.0001000025e-07 +-0.07242252677679 -0.02263227291405 -0.01999999955296 +0 0 + +0101101 +* +Ed + 1.0001000025e-07 1 1 0 +1 4 0 0 0.131878903748074 +0 + +0101000 ++75 0 -73 0 * +Ve +1.00005e-07 +-0.08851642906665 -0.02722925320267 -0.01999999955296 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 5 0 1.501387093594 2.19665809974347 +2 4 5 0 1.501387093594 2.19665809974347 +0 + +0101000 ++73 0 -71 0 * +Ve +1.00005e-07 +-0.08851642906665 0.021039046347141 -0.01999999955296 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 6 0 0.944934553846607 5.33825075333284 +2 5 6 0 0.944934553846607 5.33825075333284 +0 + +0101000 ++71 0 -69 0 * +Ve +1.0001000025e-07 +-0.07242252677679 0.017591310665011 -0.01999999955296 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 7 0 4.08652720743619 4.91617787321301 +2 6 7 0 4.08652720743619 4.91617787321301 +0 + +0101000 ++69 0 -67 0 * +Ed + 1.0001000025e-07 1 1 0 +1 8 0 0 0.136424396864826 +0 + +0101000 ++67 0 -80 0 * +Wi + +0101000 ++78 0 +76 0 +74 0 +72 0 +70 0 +68 0 +66 0 +65 0 * +Ve +1.00005e-07 +-0.0914143372247 -0.002809300087392 -0.01999999955296 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 9 0 1.5707963267949 7.85398163397448 +2 7 8 0 1.5707963267949 7.85398163397448 +0 + +0101100 ++63 0 -63 0 * +Wi + +0101000 ++62 0 * +Ve +1.00005e-07 +0.14197662545896 -0.004606760106981 -0.01999999955296 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 10 0 1.5707963267949 7.85398163397448 +2 8 9 0 1.5707963267949 7.85398163397448 +0 + +0101100 ++60 0 -60 0 * +Wi + +0101000 ++59 0 * +Fa +0 1e-07 1 0 + +0111000 +-64 0 +61 0 +58 0 * +Ve +1.0001000025e-07 +0.063609212636948 0.027934517711401 0.019999999552965 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 11 0 0 0.039999999105925 +2 9 2 0 0 0.039999999105925 +4 G1 2 0 10 0 +0 + +0101000 ++80 0 -56 0 * +Ve +1.00005e-07 +0.093497879803181 0.036745399236679 0.019999999552965 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 12 0 4.78827820558768 5.20984013851675 +2 10 2 0 4.78827820558768 5.20984013851675 +0 + +0101000 ++56 0 -54 0 * +Ed + 1e-07 1 1 0 +1 13 0 0 0.039999999105925 +2 11 2 0 0 0.039999999105925 +2 12 3 0 0 0.039999999105925 +4 G1 2 0 3 0 +0 + +0101000 ++79 0 -54 0 * +Wi + +0101000 ++55 0 +53 0 -52 0 -78 0 * +Fa +0 1e-07 2 0 + +0111000 +-51 0 * +Ve +1.00005e-07 +0.093497879803181 -0.04178636148572 0.019999999552965 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 14 0 4.21493782225269 8.35143279210647 +2 13 3 0 4.21493782225269 8.35143279210647 +0 + +0101000 ++54 0 -49 0 * +Ed + 1e-07 1 1 0 +1 15 0 0 0.039999999105925 +2 14 3 0 0 0.039999999105925 +2 15 4 0 0 0.039999999105925 +4 G1 3 0 4 0 +0 + +0101000 ++77 0 -49 0 * +Wi + +0101000 ++52 0 +48 0 -47 0 -76 0 * +Fa +0 1e-07 3 0 + +0111000 ++46 0 * +Ve +1.0001000025e-07 +0.059138831836925 -0.03177853846384 0.019999999552965 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 16 0 1.07334516866233 1.50138709359361 +2 16 4 0 1.07334516866233 1.50138709359361 +0 + +0101000 ++49 0 -44 0 * +Ed + 1.00005e-07 1 1 0 +1 17 0 0 0.039999999105925 +2 17 4 0 0 0.039999999105925 +4 G1 4 0 11 0 +0 + +0101000 ++75 0 -44 0 * +Wi + +0101000 ++47 0 +43 0 -42 0 -74 0 * +Fa +0 1e-07 4 0 + +0111000 +-41 0 * +Ve +1.0001000025e-07 +-0.07242252677679 -0.02263227291405 0.019999999552965 +0 0 + +0101101 +* +Ed + 1.0001000025e-07 1 1 0 +1 18 0 0 0.131878903748074 +0 + +0101000 ++44 0 -39 0 * +Ed + 1.00005e-07 1 1 0 +1 19 0 0 0.039999999105925 +2 18 5 0 0 0.039999999105925 +4 G1 11 0 5 0 +0 + +0101000 ++73 0 -39 0 * +Wi + +0101000 ++42 0 +38 0 -37 0 -72 0 * +Fa +0 1e-07 11 0 + +0111000 ++36 0 * +Ve +1.00005e-07 +-0.08851642906665 -0.02722925320267 0.019999999552965 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 20 0 1.501387093594 2.19665809974347 +2 19 5 0 1.501387093594 2.19665809974347 +0 + +0101000 ++39 0 -34 0 * +Ed + 1e-07 1 1 0 +1 21 0 0 0.039999999105925 +2 20 5 0 0 0.039999999105925 +2 21 6 0 0 0.039999999105925 +4 G1 5 0 6 0 +0 + +0101000 ++71 0 -34 0 * +Wi + +0101000 ++37 0 +33 0 -32 0 -70 0 * +Fa +0 1e-07 5 0 + +0111000 +-31 0 * +Ve +1.00005e-07 +-0.08851642906665 0.021039046347141 0.019999999552965 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 22 0 0.944934553846607 5.33825075333284 +2 22 6 0 0.944934553846607 5.33825075333284 +0 + +0101000 ++34 0 -29 0 * +Ed + 1e-07 1 1 0 +1 23 0 0 0.039999999105925 +2 23 6 0 0 0.039999999105925 +2 24 7 0 0 0.039999999105925 +4 G1 6 0 7 0 +0 + +0101000 ++69 0 -29 0 * +Wi + +0101000 ++32 0 +28 0 -27 0 -68 0 * +Fa +0 1e-07 6 0 + +0111000 ++26 0 * +Ve +1.0001000025e-07 +-0.07242252677679 0.017591310665011 0.019999999552965 +0 0 + +0101101 +* +Ed + 1.00005e-07 1 1 0 +1 24 0 4.08652720743619 4.91617787321301 +2 25 7 0 4.08652720743619 4.91617787321301 +0 + +0101000 ++29 0 -24 0 * +Ed + 1.00005e-07 1 1 0 +1 25 0 0 0.039999999105925 +2 26 7 0 0 0.039999999105925 +0 + +0101000 ++67 0 -24 0 * +Wi + +0101000 ++27 0 +23 0 -22 0 -66 0 * +Fa +0 1e-07 7 0 + +0111000 +-21 0 * +Ed + 1.0001000025e-07 1 1 0 +1 26 0 0 0.136424396864826 +0 + +0101000 ++24 0 -56 0 * +Wi + +0101000 ++22 0 +19 0 -55 0 -65 0 * +Fa +0 1e-07 10 0 + +0111000 ++18 0 * +Ve +1.00005e-07 +-0.0914143372247 -0.002809300087392 0.019999999552965 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 27 0 0.02000019955297 0.060000198658895 +3 27 28G1 8 0 0.02000019955297 0.060000198658895 +0 + +0101000 ++63 0 -16 0 * +Ed + 1.00005e-07 1 1 0 +1 28 0 1.5707963267949 7.85398163397448 +2 29 8 0 1.5707963267949 7.85398163397448 +0 + +0101100 ++16 0 -16 0 * +Wi + +0101000 ++15 0 -14 0 -15 0 +62 0 * +Fa +0 1e-07 8 0 + +0111000 +-13 0 * +Ve +1.00005e-07 +0.14197662545896 -0.004606760106981 0.019999999552965 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 29 0 0.02000019955297 0.060000198658895 +3 30 31G1 9 0 0.02000019955297 0.060000198658895 +0 + +0101000 ++60 0 -11 0 * +Ed + 1.00005e-07 1 1 0 +1 30 0 1.5707963267949 7.85398163397448 +2 32 9 0 1.5707963267949 7.85398163397448 +0 + +0101100 ++11 0 -11 0 * +Wi + +0101000 ++10 0 -9 0 -10 0 +59 0 * +Fa +0 1e-07 9 0 + +0111000 +-8 0 * +Wi + +0101000 ++53 0 +48 0 +43 0 +38 0 +33 0 +28 0 +23 0 +19 0 * +Wi + +0101000 ++14 0 * +Wi + +0101000 ++9 0 * +Fa +0 1e-07 12 0 + +0111000 +-6 0 +5 0 +4 0 * +Sh + +0101100 +-57 0 -50 0 +45 0 -40 0 +35 0 -30 0 +25 0 -20 0 +17 0 -12 0 +-7 0 +3 0 * +So + +0100000 ++2 0 * + ++1 0 diff --git a/src/TEST_PY/test_unit/bielle.py b/src/TEST_PY/test_unit/bielle.py deleted file mode 100644 index b19126d..0000000 --- a/src/TEST_PY/test_unit/bielle.py +++ /dev/null @@ -1,239 +0,0 @@ -# -*- coding: latin-1 -*- -# Copyright (C) 2009-2012 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# Francis KLOSS - 2011 - CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France -# ======================================================================================== - -import geompy -import hexablock - -# Définir les paramètres -# ---------------------- - -nom = "bielle" - -# Construire le modèle de bloc -# ============================ - -doc = hexablock.addDocument(nom) - -# Construire les 2 grilles cylindriques -# ------------------------------------- - -centre_a = doc.addVertex(0, 0, 0) -centre_b = doc.addVertex(6, 0, 0) - -vecteur_a = doc.addVector(1, 1, 0) -vecteur_z = doc.addVector(0, 0, 1) -vecteur_b = doc.addVector(6, 0, 0) - -grille_a = doc.makeCylindrical(centre_a, vecteur_a, vecteur_z, 1, 360, 1, 1, 4, 1, False) - -### grille_b = doc.makeTranslation(grille_a, vecteur_b) -grille_b = doc.makeCylindrical(centre_b, vecteur_a, vecteur_z, 2, 360, 1, 1, 4, 1, False) - -grilles = [ grille_a, grille_b ] - -# Relier les 2 grilles -# -------------------- - -quad_a = grille_a.getQuadJK(1, 3, 0) -quad_b = grille_b.getQuadJK(1, 1, 0) - -point_a1 = grille_a.getVertexIJK(1, 0, 0) -point_a2 = grille_a.getVertexIJK(1, 3, 0) - -point_b1 = grille_b.getVertexIJK(1, 1, 0) -point_b2 = grille_b.getVertexIJK(1, 2, 0) - -prisme = doc.joinQuad(quad_a, quad_b, point_a1, point_b1, point_a2, point_b2, 3) - -# Associer le modèle de bloc avec la géométrie -# ============================================ - -# Charger la géométrie à associer -# ------------------------------- - -bielle = geompy.ImportSTEP("crank.stp") - -doc.setShape(bielle) - -# Extraire les subshapes de la géométrie -# -------------------------------------- - -g_vertices = geompy.SubShapeAllSortedCentres(bielle, geompy.ShapeType["VERTEX"]) -g_edges = geompy.SubShapeAllSortedCentres(bielle, geompy.ShapeType["EDGE" ]) - -sommets = [ [ 8, 6, 9, 7 ], [ 12, 10, 13, 11 ] ] - -cercles = [ [2, 3], [25, 26] ] -arcs_gr = [ [0, 1], [27, 28] ] -arcs_pe = [ [ 9, 7, 10, 8 ], [ 21, 19, 22, 20 ] ] - -# Associer les 4 cercles intérieurs -# --------------------------------- - -for k in xrange(0, 2): - for g in xrange(0, 2): - grille = grilles[g] - ve = grille.getVertexIJK(0, 1, k) - le = [ grille.getEdgeJ(0, j, k) for j in xrange(0, 4) ] - cercle = g_edges[ cercles[g][k] ] - doc.associateClosedLine(ve, le[0], le[1:], cercle, 0.625, False, []) - -# Associer les 4 grands arcs de cercle extérieurs -# ----------------------------------------------- - -for k in xrange(0, 2): - g=0 - grille = grilles[g] - le = [ grille.getEdgeJ(1, j, k) for j in [2, 1, 0] ] - ed = g_edges[ arcs_gr[g][k] ] - doc.associateOpenedLine(le[0], le[1:], ed, 0, [], 1) - -for k in xrange(0, 2): - g=1 - grille = grilles[g] - le = [ grille.getEdgeJ(1, j, k) for j in [0, 3, 2] ] - ed = g_edges[ arcs_gr[g][k] ] - doc.associateOpenedLine(le[0], le[1:], ed, 0, [], 1) - -# Associer les 8 sommets des petits arcs de cercle extérieurs -# ----------------------------------------------------------- - -for g, h in [ [0, 1], [1, 2] ]: - hexa = prisme.getHexa(h) - for vi in xrange(0, 4): - nv = 2*(vi/2) + 1 - vi % 2 - vm = hexa.getVertex(nv) - vg = g_vertices[ sommets[g][vi] ] - x, y, z = geompy.PointCoordinates(vg) - vm.setAssociation(vg) - -# Associer les 8 petits arcs de cercle extérieurs -# ----------------------------------------------- - -for g, h in [ [0, 0], [1, 2] ]: - hexa = prisme.getHexa(h) - for ei in xrange(0, 4): - nv = 2*(ei/2) + 1 - ei % 2 - em = hexa.getEdge(nv+8) - eg = g_edges[ arcs_pe[g][ei] ] - em.clearAssociation() - em.addAssociation(eg, 0, 1) - -# Associer 4 arcs nouveaux qui complétent les 4 grands arcs de cercle extérieurs -# ------------------------------------------------------------------------------ - -for h, ei, ech in [ [0, 0, 0.9], [0, 1, 0.9], [2, 2, 0.85], [2, 3, 0.85] ]: - hexa = prisme.getHexa(h) - em = hexa.getEdge(ei) - va = em.getVertex(0).getAssociation() - vb = em.getVertex(1).getAssociation() - vax, vay, vaz = geompy.PointCoordinates(va) - vbx, vby, vbz = geompy.PointCoordinates(vb) - vmx = ( vax + vbx ) / 2.0 * ech - vmy = ( vay + vby ) / 2.0 - vmz = ( vaz + vbz ) / 2.0 - vm = geompy.MakeVertex(vmx, vmy, vmz) - eg = geompy.MakeArc(va, vm, vb) - em.clearAssociation() - em.addAssociation(eg, 0, 1) - -# Mailler le modèle de bloc -# ========================= - -# Définir 5 groupes de faces -# -------------------------- - -groupe_trou_p = doc.addQuadGroup("Trou_petit") -groupe_trou_g = doc.addQuadGroup("Trou_grand") -groupe_bas = doc.addQuadGroup("Bas") -groupe_haut = doc.addQuadGroup("Haut") -groupe_contour = doc.addQuadGroup("Contour") - -for i in xrange(4): - groupe_trou_p.addElement(grille_a.getQuadJK(0, i, 0)) - groupe_trou_g.addElement(grille_b.getQuadJK(0, i, 0)) - - groupe_bas.addElement( grille_a.getQuadIJ(0, i, 0)) - groupe_bas.addElement( grille_b.getQuadIJ(0, i, 0)) - groupe_haut.addElement(grille_a.getQuadIJ(0, i, 1)) - groupe_haut.addElement(grille_b.getQuadIJ(0, i, 1)) - -for i in xrange(3): - groupe_contour.addElement(grille_a.getQuadJK(1, i, 0)) - -for i in [0, 2, 3]: - groupe_contour.addElement(grille_b.getQuadJK(1, i, 0)) - -for i in xrange(0, 3): - h = prisme.getHexa(i) - - q = h.getQuad(2) - groupe_bas.addElement(q) - - q = h.getQuad(3) - groupe_haut.addElement(q) - - q = h.getQuad(4) - groupe_contour.addElement(q) - q = h.getQuad(5) - groupe_contour.addElement(q) - -# Définir 3 groupes de volumes -# ---------------------------- - -groupe_cyli_p = doc.addHexaGroup("Cylindre_petit") -groupe_cyli_g = doc.addHexaGroup("Cylindre_grand") -groupe_prisme = doc.addHexaGroup("Prisme") - -for i in xrange(4): - groupe_cyli_p.addElement(grille_a.getHexa(i)) - groupe_cyli_g.addElement(grille_b.getHexa(i)) - -for i in xrange(3): - groupe_prisme.addElement(prisme.getHexa(i)) - -# Mailler le modèle de bloc avec association -# ------------------------------------------ - -l = doc.addLaw("Uniform1", 17) -n = doc.countPropagation() - -for i in xrange(n): - p = doc.getPropagation(i) - p.setLaw(l) - -l = doc.addLaw("Uniform2", 40) -p = doc.getPropagation(11) -p.setLaw(l) - -blocs = hexablock.mesh (doc) - -print "nombre de sommets du modèle de bloc: ", doc.countUsedVertex() -print "nombre d'arêtes du modèle de bloc: ", doc.countUsedEdge() -print "nombre de quadrangles du modèle de bloc: ", doc.countUsedQuad() -print "nombre de blocs du modèle de bloc: ", doc.countUsedHexa() - -print "Nombre de noeuds du maillage: ", blocs.NbNodes() -print "Nombre de segments du maillage: ", blocs.NbEdges() -print "Nombre de quadrangles du maillage: ", blocs.NbQuadrangles() -print "Nombre d'hexaèdres du maillage: ", blocs.NbHexas() diff --git a/src/TEST_PY/test_unit/bielle.stp b/src/TEST_PY/test_unit/bielle.stp new file mode 100644 index 0000000..ef67fa5 --- /dev/null +++ b/src/TEST_PY/test_unit/bielle.stp @@ -0,0 +1,1178 @@ +ISO-10303-21; +HEADER; + FILE_DESCRIPTION(('a Product shape'),'1'); + FILE_NAME('Euclid Shape Model','1998-12-23T10:04:46',('Author Name'),( + 'MATRA-DATAVISION'),'OL-2.0D','EUCLID','Authorisation status'); + FILE_SCHEMA(('AUTOMOTIVE_DESIGN_CC2 { 1 2 10303 214 -1 1 5 4 }')); +ENDSEC; +DATA; +#1 = PRODUCT_TYPE('part',$,(#2)); +#2 = PRODUCT('bielle','bielle','void',(#3)); +#3 = MECHANICAL_CONTEXT('Mechanical',#4,'Assembly'); +#4 = APPLICATION_CONTEXT('EUCLID'); +#5 = APPLICATION_PROTOCOL_DEFINITION('CommitteeDraft', + 'automotive_design',1997,#4); +#6 = SHAPE_DEFINITION_REPRESENTATION(#7,#11); +#7 = PRODUCT_DEFINITION_SHAPE('void','void',#8); +#8 = PRODUCT_DEFINITION('void','void',#9,#10); +#9 = PRODUCT_DEFINITION_FORMATION('ID','void',#2); +#10 = PRODUCT_DEFINITION_CONTEXT('as proposed',#4,'First_Design'); +#11 = ADVANCED_BREP_SHAPE_REPRESENTATION('',(#12),#866); +#12 = MANIFOLD_SOLID_BREP('',#13); +#13 = CLOSED_SHELL('',(#14,#338,#415,#466,#518,#566,#617,#668,#720,#747, + #798,#849)); +#14 = ADVANCED_FACE('',(#15,#270,#304),#30,.F.); +#15 = FACE_BOUND('',#16,.T.); +#16 = EDGE_LOOP('',(#17,#56,#88,#120,#148,#180,#212,#244)); +#17 = ORIENTED_EDGE('',*,*,#18,.T.); +#18 = EDGE_CURVE('',#19,#21,#23,.T.); +#19 = VERTEX_POINT('',#20); +#20 = CARTESIAN_POINT('',(63.609212636948,27.934517711401, + -19.99999955296)); +#21 = VERTEX_POINT('',#22); +#22 = CARTESIAN_POINT('',(93.497879803181,36.745399236679, + -19.99999955296)); +#23 = SURFACE_CURVE('',#24,(#29,#45),.PCURVE_S2.); +#24 = CIRCLE('',#25,74.466478447737); +#25 = AXIS2_PLACEMENT_3D('',#26,#27,#28); +#26 = CARTESIAN_POINT('',(57.963432099881,102.18666633037, + -19.99999955296)); +#27 = DIRECTION('',(0.,0.,1.)); +#28 = DIRECTION('',(1.,0.,0.)); +#29 = PCURVE('',#30,#35); +#30 = PLANE('',#31); +#31 = AXIS2_PLACEMENT_3D('',#32,#33,#34); +#32 = CARTESIAN_POINT('',(0.,0.,-19.99999955296)); +#33 = DIRECTION('',(0.,0.,1.)); +#34 = DIRECTION('',(1.,0.,0.)); +#35 = DEFINITIONAL_REPRESENTATION('',(#36),#44); +#36 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#37,#38,#39,#40,#41,#42,#43), +.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#37 = CARTESIAN_POINT('',(132.42991054761,102.18666633037)); +#38 = CARTESIAN_POINT('',(132.42991054761,231.16639046259)); +#39 = CARTESIAN_POINT('',(20.730192876013,166.67652839648)); +#40 = CARTESIAN_POINT('',(-90.96952479559,102.18666633037)); +#41 = CARTESIAN_POINT('',(20.730192876013,37.696804264271)); +#42 = CARTESIAN_POINT('',(132.42991054761,-26.79305780183)); +#43 = CARTESIAN_POINT('',(132.42991054761,102.18666633037)); +#44 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#45 = PCURVE('',#46,#51); +#46 = CYLINDRICAL_SURFACE('',#47,74.466478447737); +#47 = AXIS2_PLACEMENT_3D('',#48,#49,#50); +#48 = CARTESIAN_POINT('',(57.963432099881,102.18666633037, + -19.99999955296)); +#49 = DIRECTION('',(0.,0.,1.)); +#50 = DIRECTION('',(1.,0.,0.)); +#51 = DEFINITIONAL_REPRESENTATION('',(#52),#55); +#52 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#53,#54),.UNSPECIFIED.,.F.,.F.,(2, + 2),(4.788278205588,5.209840138517),.PIECEWISE_BEZIER_KNOTS.); +#53 = CARTESIAN_POINT('',(4.788278205588,0.)); +#54 = CARTESIAN_POINT('',(5.209840138517,0.)); +#55 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#56 = ORIENTED_EDGE('',*,*,#57,.T.); +#57 = EDGE_CURVE('',#21,#58,#60,.T.); +#58 = VERTEX_POINT('',#59); +#59 = CARTESIAN_POINT('',(93.497879803181,-41.78636148572, + -19.99999955296)); +#60 = SURFACE_CURVE('',#61,(#66,#77),.PCURVE_S2.); +#61 = CIRCLE('',#62,44.68116165083); +#62 = AXIS2_PLACEMENT_3D('',#63,#64,#65); +#63 = CARTESIAN_POINT('',(114.81915663942,-2.52048112452,-19.99999955296 + )); +#64 = DIRECTION('',(0.,0.,-1.)); +#65 = DIRECTION('',(1.,0.,0.)); +#66 = PCURVE('',#30,#67); +#67 = DEFINITIONAL_REPRESENTATION('',(#68),#76); +#68 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#69,#70,#71,#72,#73,#74,#75), +.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#69 = CARTESIAN_POINT('',(159.50031829025,-2.52048112452)); +#70 = CARTESIAN_POINT('',(159.50031829025,-79.91052324495)); +#71 = CARTESIAN_POINT('',(92.478575814005,-41.21550218473)); +#72 = CARTESIAN_POINT('',(25.45683333776,-2.52048112452)); +#73 = CARTESIAN_POINT('',(92.478575814005,36.174539935697)); +#74 = CARTESIAN_POINT('',(159.50031829025,74.869560995915)); +#75 = CARTESIAN_POINT('',(159.50031829025,-2.52048112452)); +#76 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#77 = PCURVE('',#78,#83); +#78 = CYLINDRICAL_SURFACE('',#79,44.68116165083); +#79 = AXIS2_PLACEMENT_3D('',#80,#81,#82); +#80 = CARTESIAN_POINT('',(114.81915663942,-2.52048112452,-19.99999955296 + )); +#81 = DIRECTION('',(0.,0.,-1.)); +#82 = DIRECTION('',(1.,0.,0.)); +#83 = DEFINITIONAL_REPRESENTATION('',(#84),#87); +#84 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#85,#86),.UNSPECIFIED.,.F.,.F.,(2, + 2),(4.214937822253,8.351432792106),.PIECEWISE_BEZIER_KNOTS.); +#85 = CARTESIAN_POINT('',(4.214937822253,0.)); +#86 = CARTESIAN_POINT('',(8.351432792106,0.)); +#87 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#88 = ORIENTED_EDGE('',*,*,#89,.T.); +#89 = EDGE_CURVE('',#58,#90,#92,.T.); +#90 = VERTEX_POINT('',#91); +#91 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + -19.99999955296)); +#92 = SURFACE_CURVE('',#93,(#98,#109),.PCURVE_S2.); +#93 = CIRCLE('',#94,84.24770250966); +#94 = AXIS2_PLACEMENT_3D('',#95,#96,#97); +#95 = CARTESIAN_POINT('',(53.295957524102,-115.8233848133, + -19.99999955296)); +#96 = DIRECTION('',(0.,0.,1.)); +#97 = DIRECTION('',(1.,0.,0.)); +#98 = PCURVE('',#30,#99); +#99 = DEFINITIONAL_REPRESENTATION('',(#100),#108); +#100 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#101,#102,#103,#104,#105,#106 +,#107),.UNSPECIFIED.,.T.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#101 = CARTESIAN_POINT('',(137.54366003376,-115.8233848133)); +#102 = CARTESIAN_POINT('',(137.54366003376,30.097916354281)); +#103 = CARTESIAN_POINT('',(11.172106269272,-42.86273422955)); +#104 = CARTESIAN_POINT('',(-115.1994474952,-115.8233848133)); +#105 = CARTESIAN_POINT('',(11.172106269272,-188.7840353972)); +#106 = CARTESIAN_POINT('',(137.54366003376,-261.744685981)); +#107 = CARTESIAN_POINT('',(137.54366003376,-115.8233848133)); +#108 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#109 = PCURVE('',#110,#115); +#110 = CYLINDRICAL_SURFACE('',#111,84.24770250966); +#111 = AXIS2_PLACEMENT_3D('',#112,#113,#114); +#112 = CARTESIAN_POINT('',(53.295957524102,-115.8233848133, + -19.99999955296)); +#113 = DIRECTION('',(0.,0.,1.)); +#114 = DIRECTION('',(1.,0.,0.)); +#115 = DEFINITIONAL_REPRESENTATION('',(#116),#119); +#116 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#117,#118),.UNSPECIFIED.,.F.,.F., + (2,2),(1.073345168663,1.501387093594),.PIECEWISE_BEZIER_KNOTS.); +#117 = CARTESIAN_POINT('',(1.073345168663,0.)); +#118 = CARTESIAN_POINT('',(1.501387093594,0.)); +#119 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#120 = ORIENTED_EDGE('',*,*,#121,.T.); +#121 = EDGE_CURVE('',#90,#122,#124,.T.); +#122 = VERTEX_POINT('',#123); +#123 = CARTESIAN_POINT('',(-72.42252677679,-22.63227291405, + -19.99999955296)); +#124 = SURFACE_CURVE('',#125,(#129,#136),.PCURVE_S2.); +#125 = LINE('',#126,#127); +#126 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + -19.99999955296)); +#127 = VECTOR('',#128,1.); +#128 = DIRECTION('',(-0.997592146088,6.935351515554E-02,0.)); +#129 = PCURVE('',#30,#130); +#130 = DEFINITIONAL_REPRESENTATION('',(#131),#135); +#131 = LINE('',#132,#133); +#132 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384)); +#133 = VECTOR('',#134,1.); +#134 = DIRECTION('',(-0.997592146088,6.935351515554E-02)); +#135 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#136 = PCURVE('',#137,#142); +#137 = PLANE('',#138); +#138 = AXIS2_PLACEMENT_3D('',#139,#140,#141); +#139 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + -19.99999955296)); +#140 = DIRECTION('',(-6.935351515554E-02,-0.997592146088,0.)); +#141 = DIRECTION('',(-0.997592146088,6.935351515554E-02,0.)); +#142 = DEFINITIONAL_REPRESENTATION('',(#143),#147); +#143 = LINE('',#144,#145); +#144 = CARTESIAN_POINT('',(0.,-3.552713678801E-14)); +#145 = VECTOR('',#146,1.); +#146 = DIRECTION('',(1.,0.)); +#147 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#148 = ORIENTED_EDGE('',*,*,#149,.T.); +#149 = EDGE_CURVE('',#122,#150,#152,.T.); +#150 = VERTEX_POINT('',#151); +#151 = CARTESIAN_POINT('',(-88.51642906665,-27.22925320267, + -19.99999955296)); +#152 = SURFACE_CURVE('',#153,(#158,#169),.PCURVE_S2.); +#153 = CIRCLE('',#154,24.565238684828); +#154 = AXIS2_PLACEMENT_3D('',#155,#156,#157); +#155 = CARTESIAN_POINT('',(-74.12621243021,-47.1383620928, + -19.99999955296)); +#156 = DIRECTION('',(0.,0.,1.)); +#157 = DIRECTION('',(1.,0.,0.)); +#158 = PCURVE('',#30,#159); +#159 = DEFINITIONAL_REPRESENTATION('',(#160),#168); +#160 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#161,#162,#163,#164,#165,#166 +,#167),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#161 = CARTESIAN_POINT('',(-49.56097374539,-47.1383620928)); +#162 = CARTESIAN_POINT('',(-49.56097374539,-4.590120590624)); +#163 = CARTESIAN_POINT('',(-86.40883177263,-25.86424134171)); +#164 = CARTESIAN_POINT('',(-123.2566897998,-47.1383620928)); +#165 = CARTESIAN_POINT('',(-86.40883177263,-68.41248284389)); +#166 = CARTESIAN_POINT('',(-49.56097374539,-89.68660359498)); +#167 = CARTESIAN_POINT('',(-49.56097374539,-47.1383620928)); +#168 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#169 = PCURVE('',#170,#175); +#170 = CYLINDRICAL_SURFACE('',#171,24.565238684828); +#171 = AXIS2_PLACEMENT_3D('',#172,#173,#174); +#172 = CARTESIAN_POINT('',(-74.12621243021,-47.1383620928, + -19.99999955296)); +#173 = DIRECTION('',(0.,0.,1.)); +#174 = DIRECTION('',(1.,0.,0.)); +#175 = DEFINITIONAL_REPRESENTATION('',(#176),#179); +#176 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#177,#178),.UNSPECIFIED.,.F.,.F., + (2,2),(1.501387093594,2.196658099744),.PIECEWISE_BEZIER_KNOTS.); +#177 = CARTESIAN_POINT('',(1.501387093594,0.)); +#178 = CARTESIAN_POINT('',(2.196658099744,0.)); +#179 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#180 = ORIENTED_EDGE('',*,*,#181,.T.); +#181 = EDGE_CURVE('',#150,#182,#184,.T.); +#182 = VERTEX_POINT('',#183); +#183 = CARTESIAN_POINT('',(-88.51642906665,21.039046347141, + -19.99999955296)); +#184 = SURFACE_CURVE('',#185,(#190,#201),.PCURVE_S2.); +#185 = CIRCLE('',#186,29.778387016109); +#186 = AXIS2_PLACEMENT_3D('',#187,#188,#189); +#187 = CARTESIAN_POINT('',(-105.9604867346,-3.095103427768, + -19.99999955296)); +#188 = DIRECTION('',(0.,0.,-1.)); +#189 = DIRECTION('',(1.,0.,0.)); +#190 = PCURVE('',#30,#191); +#191 = DEFINITIONAL_REPRESENTATION('',(#192),#200); +#192 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#193,#194,#195,#196,#197,#198 +,#199),.UNSPECIFIED.,.T.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#193 = CARTESIAN_POINT('',(-76.18209971851,-3.095103427768)); +#194 = CARTESIAN_POINT('',(-76.18209971851,-54.67278270711)); +#195 = CARTESIAN_POINT('',(-120.8496802426,-28.88394306744)); +#196 = CARTESIAN_POINT('',(-165.5172607668,-3.095103427768)); +#197 = CARTESIAN_POINT('',(-120.8496802426,22.693736211908)); +#198 = CARTESIAN_POINT('',(-76.18209971851,48.482575851583)); +#199 = CARTESIAN_POINT('',(-76.18209971851,-3.095103427768)); +#200 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#201 = PCURVE('',#202,#207); +#202 = CYLINDRICAL_SURFACE('',#203,29.778387016109); +#203 = AXIS2_PLACEMENT_3D('',#204,#205,#206); +#204 = CARTESIAN_POINT('',(-105.9604867346,-3.095103427768, + -19.99999955296)); +#205 = DIRECTION('',(0.,0.,-1.)); +#206 = DIRECTION('',(1.,0.,0.)); +#207 = DEFINITIONAL_REPRESENTATION('',(#208),#211); +#208 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#209,#210),.UNSPECIFIED.,.F.,.F., + (2,2),(0.944934553846,5.338250753333),.PIECEWISE_BEZIER_KNOTS.); +#209 = CARTESIAN_POINT('',(0.944934553846,0.)); +#210 = CARTESIAN_POINT('',(5.338250753333,0.)); +#211 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#212 = ORIENTED_EDGE('',*,*,#213,.T.); +#213 = EDGE_CURVE('',#182,#214,#216,.T.); +#214 = VERTEX_POINT('',#215); +#215 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + -19.99999955296)); +#216 = SURFACE_CURVE('',#217,(#222,#233),.PCURVE_S2.); +#217 = CIRCLE('',#218,20.41914254867); +#218 = AXIS2_PLACEMENT_3D('',#219,#220,#221); +#219 = CARTESIAN_POINT('',(-76.55497863763,37.587915977932, + -19.99999955296)); +#220 = DIRECTION('',(0.,0.,1.)); +#221 = DIRECTION('',(1.,0.,0.)); +#222 = PCURVE('',#30,#223); +#223 = DEFINITIONAL_REPRESENTATION('',(#224),#232); +#224 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#225,#226,#227,#228,#229,#230 +,#231),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#225 = CARTESIAN_POINT('',(-56.13583608896,37.587915977932)); +#226 = CARTESIAN_POINT('',(-56.13583608896,72.954908319219)); +#227 = CARTESIAN_POINT('',(-86.76454991196,55.271412148575)); +#228 = CARTESIAN_POINT('',(-117.3932637349,37.587915977932)); +#229 = CARTESIAN_POINT('',(-86.76454991196,19.904419807288)); +#230 = CARTESIAN_POINT('',(-56.13583608896,2.220923636644)); +#231 = CARTESIAN_POINT('',(-56.13583608896,37.587915977932)); +#232 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#233 = PCURVE('',#234,#239); +#234 = CYLINDRICAL_SURFACE('',#235,20.41914254867); +#235 = AXIS2_PLACEMENT_3D('',#236,#237,#238); +#236 = CARTESIAN_POINT('',(-76.55497863763,37.587915977932, + -19.99999955296)); +#237 = DIRECTION('',(0.,0.,1.)); +#238 = DIRECTION('',(1.,0.,0.)); +#239 = DEFINITIONAL_REPRESENTATION('',(#240),#243); +#240 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#241,#242),.UNSPECIFIED.,.F.,.F., + (2,2),(4.086527207436,4.916177873213),.PIECEWISE_BEZIER_KNOTS.); +#241 = CARTESIAN_POINT('',(4.086527207436,0.)); +#242 = CARTESIAN_POINT('',(4.916177873213,0.)); +#243 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#244 = ORIENTED_EDGE('',*,*,#245,.T.); +#245 = EDGE_CURVE('',#214,#19,#246,.T.); +#246 = SURFACE_CURVE('',#247,(#251,#258),.PCURVE_S2.); +#247 = LINE('',#248,#249); +#248 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + -19.99999955296)); +#249 = VECTOR('',#250,1.); +#250 = DIRECTION('',(0.997121794488,7.581640296081E-02,0.)); +#251 = PCURVE('',#30,#252); +#252 = DEFINITIONAL_REPRESENTATION('',(#253),#257); +#253 = LINE('',#254,#255); +#254 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011)); +#255 = VECTOR('',#256,1.); +#256 = DIRECTION('',(0.997121794488,7.581640296081E-02)); +#257 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#258 = PCURVE('',#259,#264); +#259 = PLANE('',#260); +#260 = AXIS2_PLACEMENT_3D('',#261,#262,#263); +#261 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + -19.99999955296)); +#262 = DIRECTION('',(-7.581640296081E-02,0.997121794488,0.)); +#263 = DIRECTION('',(0.997121794488,7.581640296081E-02,0.)); +#264 = DEFINITIONAL_REPRESENTATION('',(#265),#269); +#265 = LINE('',#266,#267); +#266 = CARTESIAN_POINT('',(0.,-3.552713678801E-14)); +#267 = VECTOR('',#268,1.); +#268 = DIRECTION('',(1.,0.)); +#269 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#270 = FACE_BOUND('',#271,.F.); +#271 = EDGE_LOOP('',(#272)); +#272 = ORIENTED_EDGE('',*,*,#273,.T.); +#273 = EDGE_CURVE('',#274,#274,#276,.T.); +#274 = VERTEX_POINT('',#275); +#275 = CARTESIAN_POINT('',(-91.4143372247,-2.809300087392, + -19.99999955296)); +#276 = SURFACE_CURVE('',#277,(#282,#293),.PCURVE_S2.); +#277 = CIRCLE('',#278,15.057678156153); +#278 = AXIS2_PLACEMENT_3D('',#279,#280,#281); +#279 = CARTESIAN_POINT('',(-106.4720153808,-2.809300087392, + -19.99999955296)); +#280 = DIRECTION('',(0.,0.,-1.)); +#281 = DIRECTION('',(0.,1.,0.)); +#282 = PCURVE('',#30,#283); +#283 = DEFINITIONAL_REPRESENTATION('',(#284),#292); +#284 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#285,#286,#287,#288,#289,#290 +,#291),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#285 = CARTESIAN_POINT('',(-106.4720153808,12.24837806876)); +#286 = CARTESIAN_POINT('',(-80.39135177038,12.24837806876)); +#287 = CARTESIAN_POINT('',(-93.43168357562,-10.33813916546)); +#288 = CARTESIAN_POINT('',(-106.4720153808,-32.92465639969)); +#289 = CARTESIAN_POINT('',(-119.512347186,-10.33813916546)); +#290 = CARTESIAN_POINT('',(-132.5526789913,12.24837806876)); +#291 = CARTESIAN_POINT('',(-106.4720153808,12.24837806876)); +#292 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#293 = PCURVE('',#294,#299); +#294 = CYLINDRICAL_SURFACE('',#295,15.057678156153); +#295 = AXIS2_PLACEMENT_3D('',#296,#297,#298); +#296 = CARTESIAN_POINT('',(-106.4720153808,-2.809300087392, + -40.00019910593)); +#297 = DIRECTION('',(0.,0.,1.)); +#298 = DIRECTION('',(1.,0.,0.)); +#299 = DEFINITIONAL_REPRESENTATION('',(#300),#303); +#300 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#301,#302),.UNSPECIFIED.,.F.,.F., + (2,2),(1.570796326795,7.853981633974),.PIECEWISE_BEZIER_KNOTS.); +#301 = CARTESIAN_POINT('',(6.28318530718,20.000199552965)); +#302 = CARTESIAN_POINT('',(0.,20.000199552965)); +#303 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#304 = FACE_BOUND('',#305,.F.); +#305 = EDGE_LOOP('',(#306)); +#306 = ORIENTED_EDGE('',*,*,#307,.T.); +#307 = EDGE_CURVE('',#308,#308,#310,.T.); +#308 = VERTEX_POINT('',#309); +#309 = CARTESIAN_POINT('',(141.97662545896,-4.606760106981, + -19.99999955296)); +#310 = SURFACE_CURVE('',#311,(#316,#327),.PCURVE_S2.); +#311 = CIRCLE('',#312,23.40416683412); +#312 = AXIS2_PLACEMENT_3D('',#313,#314,#315); +#313 = CARTESIAN_POINT('',(118.57245862484,-4.606760106981, + -19.99999955296)); +#314 = DIRECTION('',(0.,0.,-1.)); +#315 = DIRECTION('',(0.,1.,0.)); +#316 = PCURVE('',#30,#317); +#317 = DEFINITIONAL_REPRESENTATION('',(#318),#326); +#318 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#319,#320,#321,#322,#323,#324 +,#325),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#319 = CARTESIAN_POINT('',(118.57245862484,18.797406727139)); +#320 = CARTESIAN_POINT('',(159.10966469035,18.797406727139)); +#321 = CARTESIAN_POINT('',(138.84106165759,-16.30884352404)); +#322 = CARTESIAN_POINT('',(118.57245862484,-51.41509377522)); +#323 = CARTESIAN_POINT('',(98.303855592083,-16.30884352404)); +#324 = CARTESIAN_POINT('',(78.035252559326,18.797406727139)); +#325 = CARTESIAN_POINT('',(118.57245862484,18.797406727139)); +#326 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#327 = PCURVE('',#328,#333); +#328 = CYLINDRICAL_SURFACE('',#329,23.40416683412); +#329 = AXIS2_PLACEMENT_3D('',#330,#331,#332); +#330 = CARTESIAN_POINT('',(118.57245862484,-4.606760106981, + -40.00019910593)); +#331 = DIRECTION('',(0.,0.,1.)); +#332 = DIRECTION('',(1.,0.,0.)); +#333 = DEFINITIONAL_REPRESENTATION('',(#334),#337); +#334 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#335,#336),.UNSPECIFIED.,.F.,.F., + (2,2),(1.570796326795,7.853981633974),.PIECEWISE_BEZIER_KNOTS.); +#335 = CARTESIAN_POINT('',(6.28318530718,20.000199552965)); +#336 = CARTESIAN_POINT('',(0.,20.000199552965)); +#337 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#338 = ADVANCED_FACE('',(#339),#46,.F.); +#339 = FACE_BOUND('',#340,.T.); +#340 = EDGE_LOOP('',(#341,#363,#395,#414)); +#341 = ORIENTED_EDGE('',*,*,#342,.T.); +#342 = EDGE_CURVE('',#19,#343,#345,.T.); +#343 = VERTEX_POINT('',#344); +#344 = CARTESIAN_POINT('',(63.609212636948,27.934517711401, + 19.999999552965)); +#345 = SURFACE_CURVE('',#346,(#350,#356),.PCURVE_S2.); +#346 = LINE('',#347,#348); +#347 = CARTESIAN_POINT('',(63.609212636948,27.934517711401, + -19.99999955296)); +#348 = VECTOR('',#349,1.); +#349 = DIRECTION('',(0.,0.,1.)); +#350 = PCURVE('',#46,#351); +#351 = DEFINITIONAL_REPRESENTATION('',(#352),#355); +#352 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#353,#354),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#353 = CARTESIAN_POINT('',(4.788278205588,0.)); +#354 = CARTESIAN_POINT('',(4.788278205588,39.99999910593)); +#355 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#356 = PCURVE('',#259,#357); +#357 = DEFINITIONAL_REPRESENTATION('',(#358),#362); +#358 = LINE('',#359,#360); +#359 = CARTESIAN_POINT('',(136.42439686482,0.)); +#360 = VECTOR('',#361,1.); +#361 = DIRECTION('',(0.,-1.)); +#362 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#363 = ORIENTED_EDGE('',*,*,#364,.T.); +#364 = EDGE_CURVE('',#343,#365,#367,.T.); +#365 = VERTEX_POINT('',#366); +#366 = CARTESIAN_POINT('',(93.497879803181,36.745399236679, + 19.999999552965)); +#367 = SURFACE_CURVE('',#368,(#373,#379),.PCURVE_S2.); +#368 = CIRCLE('',#369,74.466478447737); +#369 = AXIS2_PLACEMENT_3D('',#370,#371,#372); +#370 = CARTESIAN_POINT('',(57.963432099881,102.18666633037, + 19.999999552965)); +#371 = DIRECTION('',(0.,0.,1.)); +#372 = DIRECTION('',(1.,0.,0.)); +#373 = PCURVE('',#46,#374); +#374 = DEFINITIONAL_REPRESENTATION('',(#375),#378); +#375 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#376,#377),.UNSPECIFIED.,.F.,.F., + (2,2),(4.788278205588,5.209840138517),.PIECEWISE_BEZIER_KNOTS.); +#376 = CARTESIAN_POINT('',(4.788278205588,39.99999910593)); +#377 = CARTESIAN_POINT('',(5.209840138517,39.99999910593)); +#378 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#379 = PCURVE('',#380,#385); +#380 = PLANE('',#381); +#381 = AXIS2_PLACEMENT_3D('',#382,#383,#384); +#382 = CARTESIAN_POINT('',(0.,0.,19.999999552965)); +#383 = DIRECTION('',(0.,0.,1.)); +#384 = DIRECTION('',(1.,0.,0.)); +#385 = DEFINITIONAL_REPRESENTATION('',(#386),#394); +#386 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#387,#388,#389,#390,#391,#392 +,#393),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#387 = CARTESIAN_POINT('',(132.42991054761,102.18666633037)); +#388 = CARTESIAN_POINT('',(132.42991054761,231.16639046259)); +#389 = CARTESIAN_POINT('',(20.730192876013,166.67652839648)); +#390 = CARTESIAN_POINT('',(-90.96952479559,102.18666633037)); +#391 = CARTESIAN_POINT('',(20.730192876013,37.696804264271)); +#392 = CARTESIAN_POINT('',(132.42991054761,-26.79305780183)); +#393 = CARTESIAN_POINT('',(132.42991054761,102.18666633037)); +#394 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#395 = ORIENTED_EDGE('',*,*,#396,.F.); +#396 = EDGE_CURVE('',#21,#365,#397,.T.); +#397 = SURFACE_CURVE('',#398,(#402,#408),.PCURVE_S2.); +#398 = LINE('',#399,#400); +#399 = CARTESIAN_POINT('',(93.497879803181,36.745399236679, + -19.99999955296)); +#400 = VECTOR('',#401,1.); +#401 = DIRECTION('',(0.,0.,1.)); +#402 = PCURVE('',#46,#403); +#403 = DEFINITIONAL_REPRESENTATION('',(#404),#407); +#404 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#405,#406),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#405 = CARTESIAN_POINT('',(5.209840138517,0.)); +#406 = CARTESIAN_POINT('',(5.209840138517,39.99999910593)); +#407 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#408 = PCURVE('',#78,#409); +#409 = DEFINITIONAL_REPRESENTATION('',(#410),#413); +#410 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#411,#412),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#411 = CARTESIAN_POINT('',(4.214937822253,0.)); +#412 = CARTESIAN_POINT('',(4.214937822253,-39.99999910593)); +#413 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#414 = ORIENTED_EDGE('',*,*,#18,.F.); +#415 = ADVANCED_FACE('',(#416),#78,.T.); +#416 = FACE_BOUND('',#417,.T.); +#417 = EDGE_LOOP('',(#418,#419,#446,#465)); +#418 = ORIENTED_EDGE('',*,*,#396,.T.); +#419 = ORIENTED_EDGE('',*,*,#420,.T.); +#420 = EDGE_CURVE('',#365,#421,#423,.T.); +#421 = VERTEX_POINT('',#422); +#422 = CARTESIAN_POINT('',(93.497879803181,-41.78636148572, + 19.999999552965)); +#423 = SURFACE_CURVE('',#424,(#429,#435),.PCURVE_S2.); +#424 = CIRCLE('',#425,44.68116165083); +#425 = AXIS2_PLACEMENT_3D('',#426,#427,#428); +#426 = CARTESIAN_POINT('',(114.81915663942,-2.52048112452, + 19.999999552965)); +#427 = DIRECTION('',(0.,0.,-1.)); +#428 = DIRECTION('',(1.,0.,0.)); +#429 = PCURVE('',#78,#430); +#430 = DEFINITIONAL_REPRESENTATION('',(#431),#434); +#431 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#432,#433),.UNSPECIFIED.,.F.,.F., + (2,2),(4.214937822253,8.351432792106),.PIECEWISE_BEZIER_KNOTS.); +#432 = CARTESIAN_POINT('',(4.214937822253,-39.99999910593)); +#433 = CARTESIAN_POINT('',(8.351432792106,-39.99999910593)); +#434 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#435 = PCURVE('',#380,#436); +#436 = DEFINITIONAL_REPRESENTATION('',(#437),#445); +#437 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#438,#439,#440,#441,#442,#443 +,#444),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#438 = CARTESIAN_POINT('',(159.50031829025,-2.52048112452)); +#439 = CARTESIAN_POINT('',(159.50031829025,-79.91052324495)); +#440 = CARTESIAN_POINT('',(92.478575814005,-41.21550218473)); +#441 = CARTESIAN_POINT('',(25.45683333776,-2.52048112452)); +#442 = CARTESIAN_POINT('',(92.478575814005,36.174539935697)); +#443 = CARTESIAN_POINT('',(159.50031829025,74.869560995915)); +#444 = CARTESIAN_POINT('',(159.50031829025,-2.52048112452)); +#445 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#446 = ORIENTED_EDGE('',*,*,#447,.F.); +#447 = EDGE_CURVE('',#58,#421,#448,.T.); +#448 = SURFACE_CURVE('',#449,(#453,#459),.PCURVE_S2.); +#449 = LINE('',#450,#451); +#450 = CARTESIAN_POINT('',(93.497879803181,-41.78636148572, + -19.99999955296)); +#451 = VECTOR('',#452,1.); +#452 = DIRECTION('',(0.,0.,1.)); +#453 = PCURVE('',#78,#454); +#454 = DEFINITIONAL_REPRESENTATION('',(#455),#458); +#455 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#456,#457),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#456 = CARTESIAN_POINT('',(8.351432792106,0.)); +#457 = CARTESIAN_POINT('',(8.351432792106,-39.99999910593)); +#458 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#459 = PCURVE('',#110,#460); +#460 = DEFINITIONAL_REPRESENTATION('',(#461),#464); +#461 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#462,#463),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#462 = CARTESIAN_POINT('',(1.073345168663,0.)); +#463 = CARTESIAN_POINT('',(1.073345168663,39.99999910593)); +#464 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#465 = ORIENTED_EDGE('',*,*,#57,.F.); +#466 = ADVANCED_FACE('',(#467),#110,.F.); +#467 = FACE_BOUND('',#468,.T.); +#468 = EDGE_LOOP('',(#469,#470,#497,#517)); +#469 = ORIENTED_EDGE('',*,*,#447,.T.); +#470 = ORIENTED_EDGE('',*,*,#471,.T.); +#471 = EDGE_CURVE('',#421,#472,#474,.T.); +#472 = VERTEX_POINT('',#473); +#473 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + 19.999999552965)); +#474 = SURFACE_CURVE('',#475,(#480,#486),.PCURVE_S2.); +#475 = CIRCLE('',#476,84.24770250966); +#476 = AXIS2_PLACEMENT_3D('',#477,#478,#479); +#477 = CARTESIAN_POINT('',(53.295957524102,-115.8233848133, + 19.999999552965)); +#478 = DIRECTION('',(0.,0.,1.)); +#479 = DIRECTION('',(1.,0.,0.)); +#480 = PCURVE('',#110,#481); +#481 = DEFINITIONAL_REPRESENTATION('',(#482),#485); +#482 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#483,#484),.UNSPECIFIED.,.F.,.F., + (2,2),(1.073345168663,1.501387093594),.PIECEWISE_BEZIER_KNOTS.); +#483 = CARTESIAN_POINT('',(1.073345168663,39.99999910593)); +#484 = CARTESIAN_POINT('',(1.501387093594,39.99999910593)); +#485 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#486 = PCURVE('',#380,#487); +#487 = DEFINITIONAL_REPRESENTATION('',(#488),#496); +#488 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#489,#490,#491,#492,#493,#494 +,#495),.UNSPECIFIED.,.T.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#489 = CARTESIAN_POINT('',(137.54366003376,-115.8233848133)); +#490 = CARTESIAN_POINT('',(137.54366003376,30.097916354281)); +#491 = CARTESIAN_POINT('',(11.172106269272,-42.86273422955)); +#492 = CARTESIAN_POINT('',(-115.1994474952,-115.8233848133)); +#493 = CARTESIAN_POINT('',(11.172106269272,-188.7840353972)); +#494 = CARTESIAN_POINT('',(137.54366003376,-261.744685981)); +#495 = CARTESIAN_POINT('',(137.54366003376,-115.8233848133)); +#496 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#497 = ORIENTED_EDGE('',*,*,#498,.F.); +#498 = EDGE_CURVE('',#90,#472,#499,.T.); +#499 = SURFACE_CURVE('',#500,(#504,#510),.PCURVE_S2.); +#500 = LINE('',#501,#502); +#501 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + -19.99999955296)); +#502 = VECTOR('',#503,1.); +#503 = DIRECTION('',(0.,0.,1.)); +#504 = PCURVE('',#110,#505); +#505 = DEFINITIONAL_REPRESENTATION('',(#506),#509); +#506 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#507,#508),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#507 = CARTESIAN_POINT('',(1.501387093594,0.)); +#508 = CARTESIAN_POINT('',(1.501387093594,39.99999910593)); +#509 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#510 = PCURVE('',#137,#511); +#511 = DEFINITIONAL_REPRESENTATION('',(#512),#516); +#512 = LINE('',#513,#514); +#513 = CARTESIAN_POINT('',(0.,0.)); +#514 = VECTOR('',#515,1.); +#515 = DIRECTION('',(0.,-1.)); +#516 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#517 = ORIENTED_EDGE('',*,*,#89,.F.); +#518 = ADVANCED_FACE('',(#519),#137,.T.); +#519 = FACE_BOUND('',#520,.T.); +#520 = EDGE_LOOP('',(#521,#522,#545,#565)); +#521 = ORIENTED_EDGE('',*,*,#498,.T.); +#522 = ORIENTED_EDGE('',*,*,#523,.T.); +#523 = EDGE_CURVE('',#472,#524,#526,.T.); +#524 = VERTEX_POINT('',#525); +#525 = CARTESIAN_POINT('',(-72.42252677679,-22.63227291405, + 19.999999552965)); +#526 = SURFACE_CURVE('',#527,(#531,#538),.PCURVE_S2.); +#527 = LINE('',#528,#529); +#528 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384, + 19.999999552965)); +#529 = VECTOR('',#530,1.); +#530 = DIRECTION('',(-0.997592146088,6.935351515554E-02,0.)); +#531 = PCURVE('',#137,#532); +#532 = DEFINITIONAL_REPRESENTATION('',(#533),#537); +#533 = LINE('',#534,#535); +#534 = CARTESIAN_POINT('',(0.,-39.99999910593)); +#535 = VECTOR('',#536,1.); +#536 = DIRECTION('',(1.,0.)); +#537 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#538 = PCURVE('',#380,#539); +#539 = DEFINITIONAL_REPRESENTATION('',(#540),#544); +#540 = LINE('',#541,#542); +#541 = CARTESIAN_POINT('',(59.138831836925,-31.77853846384)); +#542 = VECTOR('',#543,1.); +#543 = DIRECTION('',(-0.997592146088,6.935351515554E-02)); +#544 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#545 = ORIENTED_EDGE('',*,*,#546,.F.); +#546 = EDGE_CURVE('',#122,#524,#547,.T.); +#547 = SURFACE_CURVE('',#548,(#552,#559),.PCURVE_S2.); +#548 = LINE('',#549,#550); +#549 = CARTESIAN_POINT('',(-72.42252677679,-22.63227291405, + -19.99999955296)); +#550 = VECTOR('',#551,1.); +#551 = DIRECTION('',(0.,0.,1.)); +#552 = PCURVE('',#137,#553); +#553 = DEFINITIONAL_REPRESENTATION('',(#554),#558); +#554 = LINE('',#555,#556); +#555 = CARTESIAN_POINT('',(131.87890374807,0.)); +#556 = VECTOR('',#557,1.); +#557 = DIRECTION('',(0.,-1.)); +#558 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#559 = PCURVE('',#170,#560); +#560 = DEFINITIONAL_REPRESENTATION('',(#561),#564); +#561 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#562,#563),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#562 = CARTESIAN_POINT('',(1.501387093594,0.)); +#563 = CARTESIAN_POINT('',(1.501387093594,39.99999910593)); +#564 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#565 = ORIENTED_EDGE('',*,*,#121,.F.); +#566 = ADVANCED_FACE('',(#567),#170,.F.); +#567 = FACE_BOUND('',#568,.T.); +#568 = EDGE_LOOP('',(#569,#570,#597,#616)); +#569 = ORIENTED_EDGE('',*,*,#546,.T.); +#570 = ORIENTED_EDGE('',*,*,#571,.T.); +#571 = EDGE_CURVE('',#524,#572,#574,.T.); +#572 = VERTEX_POINT('',#573); +#573 = CARTESIAN_POINT('',(-88.51642906665,-27.22925320267, + 19.999999552965)); +#574 = SURFACE_CURVE('',#575,(#580,#586),.PCURVE_S2.); +#575 = CIRCLE('',#576,24.565238684828); +#576 = AXIS2_PLACEMENT_3D('',#577,#578,#579); +#577 = CARTESIAN_POINT('',(-74.12621243021,-47.1383620928, + 19.999999552965)); +#578 = DIRECTION('',(0.,0.,1.)); +#579 = DIRECTION('',(1.,0.,0.)); +#580 = PCURVE('',#170,#581); +#581 = DEFINITIONAL_REPRESENTATION('',(#582),#585); +#582 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#583,#584),.UNSPECIFIED.,.F.,.F., + (2,2),(1.501387093594,2.196658099744),.PIECEWISE_BEZIER_KNOTS.); +#583 = CARTESIAN_POINT('',(1.501387093594,39.99999910593)); +#584 = CARTESIAN_POINT('',(2.196658099744,39.99999910593)); +#585 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#586 = PCURVE('',#380,#587); +#587 = DEFINITIONAL_REPRESENTATION('',(#588),#596); +#588 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#589,#590,#591,#592,#593,#594 +,#595),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#589 = CARTESIAN_POINT('',(-49.56097374539,-47.1383620928)); +#590 = CARTESIAN_POINT('',(-49.56097374539,-4.590120590624)); +#591 = CARTESIAN_POINT('',(-86.40883177263,-25.86424134171)); +#592 = CARTESIAN_POINT('',(-123.2566897998,-47.1383620928)); +#593 = CARTESIAN_POINT('',(-86.40883177263,-68.41248284389)); +#594 = CARTESIAN_POINT('',(-49.56097374539,-89.68660359498)); +#595 = CARTESIAN_POINT('',(-49.56097374539,-47.1383620928)); +#596 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#597 = ORIENTED_EDGE('',*,*,#598,.F.); +#598 = EDGE_CURVE('',#150,#572,#599,.T.); +#599 = SURFACE_CURVE('',#600,(#604,#610),.PCURVE_S2.); +#600 = LINE('',#601,#602); +#601 = CARTESIAN_POINT('',(-88.51642906665,-27.22925320267, + -19.99999955296)); +#602 = VECTOR('',#603,1.); +#603 = DIRECTION('',(0.,0.,1.)); +#604 = PCURVE('',#170,#605); +#605 = DEFINITIONAL_REPRESENTATION('',(#606),#609); +#606 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#607,#608),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#607 = CARTESIAN_POINT('',(2.196658099744,0.)); +#608 = CARTESIAN_POINT('',(2.196658099744,39.99999910593)); +#609 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#610 = PCURVE('',#202,#611); +#611 = DEFINITIONAL_REPRESENTATION('',(#612),#615); +#612 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#613,#614),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#613 = CARTESIAN_POINT('',(0.944934553846,0.)); +#614 = CARTESIAN_POINT('',(0.944934553846,-39.99999910593)); +#615 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#616 = ORIENTED_EDGE('',*,*,#149,.F.); +#617 = ADVANCED_FACE('',(#618),#202,.T.); +#618 = FACE_BOUND('',#619,.T.); +#619 = EDGE_LOOP('',(#620,#621,#648,#667)); +#620 = ORIENTED_EDGE('',*,*,#598,.T.); +#621 = ORIENTED_EDGE('',*,*,#622,.T.); +#622 = EDGE_CURVE('',#572,#623,#625,.T.); +#623 = VERTEX_POINT('',#624); +#624 = CARTESIAN_POINT('',(-88.51642906665,21.039046347141, + 19.999999552965)); +#625 = SURFACE_CURVE('',#626,(#631,#637),.PCURVE_S2.); +#626 = CIRCLE('',#627,29.778387016109); +#627 = AXIS2_PLACEMENT_3D('',#628,#629,#630); +#628 = CARTESIAN_POINT('',(-105.9604867346,-3.095103427768, + 19.999999552965)); +#629 = DIRECTION('',(0.,0.,-1.)); +#630 = DIRECTION('',(1.,0.,0.)); +#631 = PCURVE('',#202,#632); +#632 = DEFINITIONAL_REPRESENTATION('',(#633),#636); +#633 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#634,#635),.UNSPECIFIED.,.F.,.F., + (2,2),(0.944934553846,5.338250753333),.PIECEWISE_BEZIER_KNOTS.); +#634 = CARTESIAN_POINT('',(0.944934553846,-39.99999910593)); +#635 = CARTESIAN_POINT('',(5.338250753333,-39.99999910593)); +#636 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#637 = PCURVE('',#380,#638); +#638 = DEFINITIONAL_REPRESENTATION('',(#639),#647); +#639 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#640,#641,#642,#643,#644,#645 +,#646),.UNSPECIFIED.,.T.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#640 = CARTESIAN_POINT('',(-76.18209971851,-3.095103427768)); +#641 = CARTESIAN_POINT('',(-76.18209971851,-54.67278270711)); +#642 = CARTESIAN_POINT('',(-120.8496802426,-28.88394306744)); +#643 = CARTESIAN_POINT('',(-165.5172607668,-3.095103427768)); +#644 = CARTESIAN_POINT('',(-120.8496802426,22.693736211908)); +#645 = CARTESIAN_POINT('',(-76.18209971851,48.482575851583)); +#646 = CARTESIAN_POINT('',(-76.18209971851,-3.095103427768)); +#647 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#648 = ORIENTED_EDGE('',*,*,#649,.F.); +#649 = EDGE_CURVE('',#182,#623,#650,.T.); +#650 = SURFACE_CURVE('',#651,(#655,#661),.PCURVE_S2.); +#651 = LINE('',#652,#653); +#652 = CARTESIAN_POINT('',(-88.51642906665,21.039046347141, + -19.99999955296)); +#653 = VECTOR('',#654,1.); +#654 = DIRECTION('',(0.,0.,1.)); +#655 = PCURVE('',#202,#656); +#656 = DEFINITIONAL_REPRESENTATION('',(#657),#660); +#657 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#658,#659),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#658 = CARTESIAN_POINT('',(5.338250753333,0.)); +#659 = CARTESIAN_POINT('',(5.338250753333,-39.99999910593)); +#660 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#661 = PCURVE('',#234,#662); +#662 = DEFINITIONAL_REPRESENTATION('',(#663),#666); +#663 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#664,#665),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#664 = CARTESIAN_POINT('',(4.086527207436,0.)); +#665 = CARTESIAN_POINT('',(4.086527207436,39.99999910593)); +#666 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#667 = ORIENTED_EDGE('',*,*,#181,.F.); +#668 = ADVANCED_FACE('',(#669),#234,.F.); +#669 = FACE_BOUND('',#670,.T.); +#670 = EDGE_LOOP('',(#671,#672,#699,#719)); +#671 = ORIENTED_EDGE('',*,*,#649,.T.); +#672 = ORIENTED_EDGE('',*,*,#673,.T.); +#673 = EDGE_CURVE('',#623,#674,#676,.T.); +#674 = VERTEX_POINT('',#675); +#675 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + 19.999999552965)); +#676 = SURFACE_CURVE('',#677,(#682,#688),.PCURVE_S2.); +#677 = CIRCLE('',#678,20.41914254867); +#678 = AXIS2_PLACEMENT_3D('',#679,#680,#681); +#679 = CARTESIAN_POINT('',(-76.55497863763,37.587915977932, + 19.999999552965)); +#680 = DIRECTION('',(0.,0.,1.)); +#681 = DIRECTION('',(1.,0.,0.)); +#682 = PCURVE('',#234,#683); +#683 = DEFINITIONAL_REPRESENTATION('',(#684),#687); +#684 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#685,#686),.UNSPECIFIED.,.F.,.F., + (2,2),(4.086527207436,4.916177873213),.PIECEWISE_BEZIER_KNOTS.); +#685 = CARTESIAN_POINT('',(4.086527207436,39.99999910593)); +#686 = CARTESIAN_POINT('',(4.916177873213,39.99999910593)); +#687 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#688 = PCURVE('',#380,#689); +#689 = DEFINITIONAL_REPRESENTATION('',(#690),#698); +#690 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#691,#692,#693,#694,#695,#696 +,#697),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#691 = CARTESIAN_POINT('',(-56.13583608896,37.587915977932)); +#692 = CARTESIAN_POINT('',(-56.13583608896,72.954908319219)); +#693 = CARTESIAN_POINT('',(-86.76454991196,55.271412148575)); +#694 = CARTESIAN_POINT('',(-117.3932637349,37.587915977932)); +#695 = CARTESIAN_POINT('',(-86.76454991196,19.904419807288)); +#696 = CARTESIAN_POINT('',(-56.13583608896,2.220923636644)); +#697 = CARTESIAN_POINT('',(-56.13583608896,37.587915977932)); +#698 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#699 = ORIENTED_EDGE('',*,*,#700,.F.); +#700 = EDGE_CURVE('',#214,#674,#701,.T.); +#701 = SURFACE_CURVE('',#702,(#706,#712),.PCURVE_S2.); +#702 = LINE('',#703,#704); +#703 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + -19.99999955296)); +#704 = VECTOR('',#705,1.); +#705 = DIRECTION('',(0.,0.,1.)); +#706 = PCURVE('',#234,#707); +#707 = DEFINITIONAL_REPRESENTATION('',(#708),#711); +#708 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#709,#710),.UNSPECIFIED.,.F.,.F., + (2,2),(0.,39.99999910593),.PIECEWISE_BEZIER_KNOTS.); +#709 = CARTESIAN_POINT('',(4.916177873213,0.)); +#710 = CARTESIAN_POINT('',(4.916177873213,39.99999910593)); +#711 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#712 = PCURVE('',#259,#713); +#713 = DEFINITIONAL_REPRESENTATION('',(#714),#718); +#714 = LINE('',#715,#716); +#715 = CARTESIAN_POINT('',(0.,0.)); +#716 = VECTOR('',#717,1.); +#717 = DIRECTION('',(0.,-1.)); +#718 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#719 = ORIENTED_EDGE('',*,*,#213,.F.); +#720 = ADVANCED_FACE('',(#721),#259,.T.); +#721 = FACE_BOUND('',#722,.T.); +#722 = EDGE_LOOP('',(#723,#724,#745,#746)); +#723 = ORIENTED_EDGE('',*,*,#700,.T.); +#724 = ORIENTED_EDGE('',*,*,#725,.T.); +#725 = EDGE_CURVE('',#674,#343,#726,.T.); +#726 = SURFACE_CURVE('',#727,(#731,#738),.PCURVE_S2.); +#727 = LINE('',#728,#729); +#728 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011, + 19.999999552965)); +#729 = VECTOR('',#730,1.); +#730 = DIRECTION('',(0.997121794488,7.581640296081E-02,0.)); +#731 = PCURVE('',#259,#732); +#732 = DEFINITIONAL_REPRESENTATION('',(#733),#737); +#733 = LINE('',#734,#735); +#734 = CARTESIAN_POINT('',(0.,-39.99999910593)); +#735 = VECTOR('',#736,1.); +#736 = DIRECTION('',(1.,0.)); +#737 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#738 = PCURVE('',#380,#739); +#739 = DEFINITIONAL_REPRESENTATION('',(#740),#744); +#740 = LINE('',#741,#742); +#741 = CARTESIAN_POINT('',(-72.42252677679,17.591310665011)); +#742 = VECTOR('',#743,1.); +#743 = DIRECTION('',(0.997121794488,7.581640296081E-02)); +#744 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#745 = ORIENTED_EDGE('',*,*,#342,.F.); +#746 = ORIENTED_EDGE('',*,*,#245,.F.); +#747 = ADVANCED_FACE('',(#748),#294,.F.); +#748 = FACE_BOUND('',#749,.T.); +#749 = EDGE_LOOP('',(#750,#771,#796,#797)); +#750 = ORIENTED_EDGE('',*,*,#751,.T.); +#751 = EDGE_CURVE('',#274,#752,#754,.T.); +#752 = VERTEX_POINT('',#753); +#753 = CARTESIAN_POINT('',(-91.4143372247,-2.809300087392, + 19.999999552965)); +#754 = SEAM_CURVE('',#755,(#759,#765),.PCURVE_S2.); +#755 = LINE('',#756,#757); +#756 = CARTESIAN_POINT('',(-91.4143372247,-2.809300087392, + -40.00019910593)); +#757 = VECTOR('',#758,1.); +#758 = DIRECTION('',(0.,0.,1.)); +#759 = PCURVE('',#294,#760); +#760 = DEFINITIONAL_REPRESENTATION('',(#761),#764); +#761 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#762,#763),.UNSPECIFIED.,.F.,.F., + (2,2),(20.000199552965,60.000198658895),.PIECEWISE_BEZIER_KNOTS.); +#762 = CARTESIAN_POINT('',(0.,20.000199552965)); +#763 = CARTESIAN_POINT('',(0.,60.000198658895)); +#764 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#765 = PCURVE('',#294,#766); +#766 = DEFINITIONAL_REPRESENTATION('',(#767),#770); +#767 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#768,#769),.UNSPECIFIED.,.F.,.F., + (2,2),(20.000199552965,60.000198658895),.PIECEWISE_BEZIER_KNOTS.); +#768 = CARTESIAN_POINT('',(6.28318530718,20.000199552965)); +#769 = CARTESIAN_POINT('',(6.28318530718,60.000198658895)); +#770 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#771 = ORIENTED_EDGE('',*,*,#772,.F.); +#772 = EDGE_CURVE('',#752,#752,#773,.T.); +#773 = SURFACE_CURVE('',#774,(#779,#785),.PCURVE_S2.); +#774 = CIRCLE('',#775,15.057678156153); +#775 = AXIS2_PLACEMENT_3D('',#776,#777,#778); +#776 = CARTESIAN_POINT('',(-106.4720153808,-2.809300087392, + 19.999999552965)); +#777 = DIRECTION('',(0.,0.,-1.)); +#778 = DIRECTION('',(0.,1.,0.)); +#779 = PCURVE('',#294,#780); +#780 = DEFINITIONAL_REPRESENTATION('',(#781),#784); +#781 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#782,#783),.UNSPECIFIED.,.F.,.F., + (2,2),(1.570796326795,7.853981633974),.PIECEWISE_BEZIER_KNOTS.); +#782 = CARTESIAN_POINT('',(6.28318530718,60.000198658895)); +#783 = CARTESIAN_POINT('',(0.,60.000198658895)); +#784 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#785 = PCURVE('',#380,#786); +#786 = DEFINITIONAL_REPRESENTATION('',(#787),#795); +#787 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#788,#789,#790,#791,#792,#793 +,#794),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#788 = CARTESIAN_POINT('',(-106.4720153808,12.24837806876)); +#789 = CARTESIAN_POINT('',(-80.39135177038,12.24837806876)); +#790 = CARTESIAN_POINT('',(-93.43168357562,-10.33813916546)); +#791 = CARTESIAN_POINT('',(-106.4720153808,-32.92465639969)); +#792 = CARTESIAN_POINT('',(-119.512347186,-10.33813916546)); +#793 = CARTESIAN_POINT('',(-132.5526789913,12.24837806876)); +#794 = CARTESIAN_POINT('',(-106.4720153808,12.24837806876)); +#795 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#796 = ORIENTED_EDGE('',*,*,#751,.F.); +#797 = ORIENTED_EDGE('',*,*,#273,.T.); +#798 = ADVANCED_FACE('',(#799),#328,.F.); +#799 = FACE_BOUND('',#800,.T.); +#800 = EDGE_LOOP('',(#801,#822,#847,#848)); +#801 = ORIENTED_EDGE('',*,*,#802,.T.); +#802 = EDGE_CURVE('',#308,#803,#805,.T.); +#803 = VERTEX_POINT('',#804); +#804 = CARTESIAN_POINT('',(141.97662545896,-4.606760106981, + 19.999999552965)); +#805 = SEAM_CURVE('',#806,(#810,#816),.PCURVE_S2.); +#806 = LINE('',#807,#808); +#807 = CARTESIAN_POINT('',(141.97662545896,-4.606760106981, + -40.00019910593)); +#808 = VECTOR('',#809,1.); +#809 = DIRECTION('',(0.,0.,1.)); +#810 = PCURVE('',#328,#811); +#811 = DEFINITIONAL_REPRESENTATION('',(#812),#815); +#812 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#813,#814),.UNSPECIFIED.,.F.,.F., + (2,2),(20.000199552965,60.000198658895),.PIECEWISE_BEZIER_KNOTS.); +#813 = CARTESIAN_POINT('',(0.,20.000199552965)); +#814 = CARTESIAN_POINT('',(0.,60.000198658895)); +#815 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#816 = PCURVE('',#328,#817); +#817 = DEFINITIONAL_REPRESENTATION('',(#818),#821); +#818 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#819,#820),.UNSPECIFIED.,.F.,.F., + (2,2),(20.000199552965,60.000198658895),.PIECEWISE_BEZIER_KNOTS.); +#819 = CARTESIAN_POINT('',(6.28318530718,20.000199552965)); +#820 = CARTESIAN_POINT('',(6.28318530718,60.000198658895)); +#821 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#822 = ORIENTED_EDGE('',*,*,#823,.F.); +#823 = EDGE_CURVE('',#803,#803,#824,.T.); +#824 = SURFACE_CURVE('',#825,(#830,#836),.PCURVE_S2.); +#825 = CIRCLE('',#826,23.40416683412); +#826 = AXIS2_PLACEMENT_3D('',#827,#828,#829); +#827 = CARTESIAN_POINT('',(118.57245862484,-4.606760106981, + 19.999999552965)); +#828 = DIRECTION('',(0.,0.,-1.)); +#829 = DIRECTION('',(0.,1.,0.)); +#830 = PCURVE('',#328,#831); +#831 = DEFINITIONAL_REPRESENTATION('',(#832),#835); +#832 = B_SPLINE_CURVE_WITH_KNOTS('',1,(#833,#834),.UNSPECIFIED.,.F.,.F., + (2,2),(1.570796326795,7.853981633974),.PIECEWISE_BEZIER_KNOTS.); +#833 = CARTESIAN_POINT('',(6.28318530718,60.000198658895)); +#834 = CARTESIAN_POINT('',(0.,60.000198658895)); +#835 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#836 = PCURVE('',#380,#837); +#837 = DEFINITIONAL_REPRESENTATION('',(#838),#846); +#838 = ( BOUNDED_CURVE() B_SPLINE_CURVE(2,(#839,#840,#841,#842,#843,#844 +,#845),.UNSPECIFIED.,.F.,.F.) B_SPLINE_CURVE_WITH_KNOTS((1,2,2,2,2,1),( + -2.094395102393,0.,2.094395102393,4.188790204786,6.28318530718, +8.377580409573),.UNSPECIFIED.) CURVE() GEOMETRIC_REPRESENTATION_ITEM() +RATIONAL_B_SPLINE_CURVE((1.,0.5,1.,0.5,1.,0.5,1.)) REPRESENTATION_ITEM( + '') ); +#839 = CARTESIAN_POINT('',(118.57245862484,18.797406727139)); +#840 = CARTESIAN_POINT('',(159.10966469035,18.797406727139)); +#841 = CARTESIAN_POINT('',(138.84106165759,-16.30884352404)); +#842 = CARTESIAN_POINT('',(118.57245862484,-51.41509377522)); +#843 = CARTESIAN_POINT('',(98.303855592083,-16.30884352404)); +#844 = CARTESIAN_POINT('',(78.035252559326,18.797406727139)); +#845 = CARTESIAN_POINT('',(118.57245862484,18.797406727139)); +#846 = ( GEOMETRIC_REPRESENTATION_CONTEXT(2) +PARAMETRIC_REPRESENTATION_CONTEXT() REPRESENTATION_CONTEXT('2D SPACE','' + ) ); +#847 = ORIENTED_EDGE('',*,*,#802,.F.); +#848 = ORIENTED_EDGE('',*,*,#307,.T.); +#849 = ADVANCED_FACE('',(#850,#860,#863),#380,.T.); +#850 = FACE_BOUND('',#851,.F.); +#851 = EDGE_LOOP('',(#852,#853,#854,#855,#856,#857,#858,#859)); +#852 = ORIENTED_EDGE('',*,*,#364,.T.); +#853 = ORIENTED_EDGE('',*,*,#420,.T.); +#854 = ORIENTED_EDGE('',*,*,#471,.T.); +#855 = ORIENTED_EDGE('',*,*,#523,.T.); +#856 = ORIENTED_EDGE('',*,*,#571,.T.); +#857 = ORIENTED_EDGE('',*,*,#622,.T.); +#858 = ORIENTED_EDGE('',*,*,#673,.T.); +#859 = ORIENTED_EDGE('',*,*,#725,.T.); +#860 = FACE_BOUND('',#861,.T.); +#861 = EDGE_LOOP('',(#862)); +#862 = ORIENTED_EDGE('',*,*,#772,.T.); +#863 = FACE_BOUND('',#864,.T.); +#864 = EDGE_LOOP('',(#865)); +#865 = ORIENTED_EDGE('',*,*,#823,.T.); +#866 = ( GEOMETRIC_REPRESENTATION_CONTEXT(3) +GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#869)) GLOBAL_UNIT_ASSIGNED_CONTEXT +((#867,#868)) REPRESENTATION_CONTEXT('Context #1', + '3D Context with UNIT and UNCERTAINTY') ); +#867 = ( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) ); +#868 = ( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) ); +#869 = UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-04),#867, + 'distance_accuracy_value','Confusion accuracy'); +ENDSEC; +END-ISO-10303-21; + diff --git a/src/TEST_PY/test_unit/bielle_v1.py b/src/TEST_PY/test_unit/bielle_v1.py new file mode 100644 index 0000000..466e9c5 --- /dev/null +++ b/src/TEST_PY/test_unit/bielle_v1.py @@ -0,0 +1,275 @@ +# -*- coding: latin-1 -*- +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# Francis KLOSS : 2011-2012 : CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France +# ============================================================================================= + +import math + +import geompy +import hexablock + +# Construire le modèle de bloc +# ============================ + +doc = hexablock.addDocument("bielle") + +# Construire les 2 grilles cylindriques +# ------------------------------------- + +centre_pb = doc.addVertex(0, 0, 0) +centre_gb = doc.addVertex(7, 0, 0) + +angle_px = math.pi / 3 +vecteur_px = doc.addVector(math.cos(angle_px), math.sin(angle_px), 0) +vecteur_gx = doc.addVector(1, 0, 0) + +vecteur_z = doc.addVector(0, 0, 1) + +grille_p = doc.makeCylindrical(centre_pb, vecteur_px, vecteur_z, 1, 360, 1, 1, 3, 1, False) +grille_g = doc.makeCylindrical(centre_gb, vecteur_gx, vecteur_z, 1, 360, 1, 1, 3, 1, False) + +# Relier les 2 grilles +# -------------------- + +quad_p = grille_p.getQuadJK(1, 2, 0) +quad_g = grille_g.getQuadJK(1, 1, 0) + +point_p1 = grille_p.getVertexIJK(1, 0, 0) +point_p2 = grille_p.getVertexIJK(1, 2, 0) + +point_g1 = grille_g.getVertexIJK(1, 1, 0) +point_g2 = grille_g.getVertexIJK(1, 2, 0) + +prisme = doc.joinQuad(quad_p, quad_g, point_p1, point_g1, point_p2, point_g2, 3) + +# Charger la géométrie +# ==================== + +bielle = geompy.ImportSTEP("bielle.stp") + +# Sélectionner des sous-parties de la géométrie +# --------------------------------------------- + +sommets = geompy.SubShapeAllSortedCentres(bielle, geompy.ShapeType["VERTEX"]) + +sommets_petit = [ 6, 8, 7, 9 ] +sommets_grand = [ 10, 12, 11, 13 ] + +aretes = geompy.SubShapeAllSortedCentres(bielle, geompy.ShapeType["EDGE"]) + +aretes_petit = [ 7, 9, 8, 10 ] +aretes_grand = [ 19, 21, 20, 22 ] + +ga_pbcd = aretes[ 0] +ga_pbe = aretes[ 2] + +ga_phcd = aretes[ 1] +ga_phe = aretes[ 3] + +ga_gbcd = aretes[27] +ga_gbe = aretes[25] + +ga_ghcd = aretes[28] +ga_ghe = aretes[26] + +# Associer le modèle de bloc avec la géométrie +# ============================================ + +doc.setShape(bielle) + +# Netoyer les associations implicites du prisme +# --------------------------------------------- + +for i in xrange( prisme.countEdge() ): + em = prisme.getEdge(i) + if em != None: + em.clearAssociation() + +# Associer les cercles extérieurs +# ------------------------------- + +def cercle(grille, k, ge, p): + ms = grille.getVertexIJK(0, 0, k) + + ma1 = grille.getEdgeJ(0, 2, k) + ma2 = grille.getEdgeJ(0, 1, k) + ma3 = grille.getEdgeJ(0, 0, k) + + doc.associateClosedLine(ms, ma1, [ ma2, ma3 ], ge, p, False, []) + +cercle(grille_p, 0, ga_pbe, 5.0/6) +cercle(grille_p, 1, ga_phe, 5.0/6) + +cercle(grille_g, 0, ga_gbe, 0) +cercle(grille_g, 1, ga_ghe, 0) + +# Associer les arcs extérieurs (excentrés) +# ---------------------------------------- + +def arc(grille, i1, i2, k, ge): + ma1 = grille.getEdgeJ(1, i1, k) + ma2 = grille.getEdgeJ(1, i2, k) + + doc.associateOpenedLine(ma1, [ ma2 ], ge, 0, [], 1) + +arc(grille_p, 1, 0, 0, ga_pbcd) +arc(grille_p, 1, 0, 1, ga_phcd) + +arc(grille_g, 0, 2, 0, ga_gbcd) +arc(grille_g, 0, 2, 1, ga_ghcd) + +# Associer les sommets des arcs de cercle de raccord +# -------------------------------------------------- + +hm = prisme.getHexa(1) +for i in xrange(0, 4): + vm = hm.getVertex(i) + ga = sommets[ sommets_petit[i] ] + vm.setAssociation(ga) + +hm = prisme.getHexa(2) +for i in xrange(0, 4): + vm = hm.getVertex(i) + ga = sommets[ sommets_grand[i] ] + vm.setAssociation(ga) + +# Associer les arcs de cercle de raccord +# -------------------------------------- + +hm = prisme.getHexa(0) +for i in xrange(0, 4): + em = hm.getEdge(i+8) + ga = aretes[ aretes_petit[i] ] + em.addAssociation(ga, 0, 1) + +hm = prisme.getHexa(2) +for i in xrange(0, 4): + em = hm.getEdge(i+8) + ga = aretes[ aretes_grand[i] ] + em.addAssociation(ga, 0, 1) + +# Arrondir des associations implicites cylindriques +# ------------------------------------------------- + +for h, i, ech in [ [0, 0, 0.95], [0, 1, 0.95], [2, 2, 0.85], [2, 3, 0.85] ]: + hm = prisme.getHexa(h) + em = hm.getEdge(i) + + va = em.getVertex(0).getAssociation() + vb = em.getVertex(1).getAssociation() + vax, vay, vaz = geompy.PointCoordinates(va) + vbx, vby, vbz = geompy.PointCoordinates(vb) + + va = em.getVertex(0) + vb = em.getVertex(1) + + print " vax, vay, vaz = ", vax, vay, vaz + vax = va.getAssoX (); + vay = va.getAssoY (); + vaz = va.getAssoZ (); + print " vax, vay, vaz = ", vax, vay, vaz + + print " vbx, vby, vbz = ", vbx, vby, vbz + vbx = vb.getAssoX (); + vby = vb.getAssoY (); + vbz = vb.getAssoZ (); + print " vbx, vby, vbz = ", vbx, vby, vbz + + vmx = ( vax + vbx ) / 2.0 * ech + vmy = ( vay + vby ) / 2.0 + vmz = ( vaz + vbz ) / 2.0 + vm = geompy.MakeVertex(vmx, vmy, vmz) + eg = geompy.MakeArc(va, vm, vb) + em.clearAssociation() + em.addAssociation(eg, 0, 1) + +# Mailler le modèle de bloc +# ========================= + +# Définir 5 groupes de faces +# -------------------------- + +groupe_petit = doc.addQuadGroup("Petit") +groupe_grand = doc.addQuadGroup("Grand") +groupe_bas = doc.addQuadGroup("Bas") +groupe_haut = doc.addQuadGroup("Haut") +groupe_contour = doc.addQuadGroup("Contour") + +# Constituer les groupes petit et grand +# ------------------------------------- + +for i in xrange(3): + groupe_petit.addElement( grille_p.getQuadJK(0, i, 0) ) + groupe_grand.addElement( grille_g.getQuadJK(0, i, 0) ) + +# Constituer les groupes bas et haut +# ---------------------------------- + +for i in xrange(3): + groupe_bas.addElement( grille_p.getQuadIJ(0, i, 0) ) + groupe_bas.addElement( grille_g.getQuadIJ(0, i, 0) ) + + groupe_haut.addElement( grille_p.getQuadIJ(0, i, 1) ) + groupe_haut.addElement( grille_g.getQuadIJ(0, i, 1) ) + +for i in xrange(3): + h = prisme.getHexa(i) + + groupe_bas.addElement( h.getQuad(2) ) + groupe_haut.addElement( h.getQuad(3) ) + +# Constituer le groupe contour +# ---------------------------- + +for i in xrange(2): + groupe_contour.addElement( grille_p.getQuadJK(1, i, 0) ) + +for i in [0, 2]: + groupe_contour.addElement( grille_g.getQuadJK(1, i, 0) ) + +for i in xrange(3): + h = prisme.getHexa(i) + + groupe_contour.addElement( h.getQuad(4) ) + groupe_contour.addElement( h.getQuad(5) ) + +# Définir 3 groupes de volumes +# ---------------------------- + +groupe_petit = doc.addHexaGroup("Petit") +groupe_grand = doc.addHexaGroup("Grand") +groupe_prisme = doc.addHexaGroup("Prisme") + +for i in xrange(3): + groupe_petit.addElement( grille_p.getHexa(i) ) + groupe_grand.addElement( grille_g.getHexa(i) ) + +for i in xrange(3): + groupe_prisme.addElement( prisme.getHexa(i) ) + +# Mailler le modèle de bloc avec association +# ------------------------------------------ + +hexablock.addLaws(doc, 0.003, True) + +blocs = hexablock.mesh(doc) + +muv, mue, muq, muh = hexablock.dump(doc, blocs) diff --git a/src/TEST_PY/test_unit/bielle_v5.py b/src/TEST_PY/test_unit/bielle_v5.py new file mode 100644 index 0000000..f16e97e --- /dev/null +++ b/src/TEST_PY/test_unit/bielle_v5.py @@ -0,0 +1,315 @@ +# -*- coding: latin-1 -*- +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# Francis KLOSS : 2011-2012 : CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France +# ============================================================================================= + +import math + +import geompy +import hexablock + +# Construire le modele de bloc +# ============================ + +doc = hexablock.addDocument("bielle_v5") + +# Construire les 2 grilles cylindriques +# ------------------------------------- + +centre_pb = doc.addVertex(-0.107, 0, -0.02) +centre_gb = doc.addVertex(0.119, 0, -0.02) + +angle_px = math.pi / 3 +vecteur_px = doc.addVector(math.cos(angle_px), math.sin(angle_px), 0) +vecteur_gx = doc.addVector(1, 0, 0) + +vecteur_z = doc.addVector(0, 0, 1) + +grille_p = doc.makeCylindrical(centre_pb, vecteur_px, vecteur_z, 0.012, 360, 0.04, 1, 3, 1, False) +grille_g = doc.makeCylindrical(centre_gb, vecteur_gx, vecteur_z, 0.025, 360, 0.04, 1, 3, 1, False) + +# Relier les 2 grilles +# -------------------- + +quad_p = grille_p.getQuadJK(1, 2, 0) +quad_g = grille_g.getQuadJK(1, 1, 0) + +point_p1 = grille_p.getVertexIJK(1, 0, 0) +point_p2 = grille_p.getVertexIJK(1, 2, 0) + +point_g1 = grille_g.getVertexIJK(1, 1, 0) +point_g2 = grille_g.getVertexIJK(1, 2, 0) + +prisme = doc.joinQuad(quad_p, quad_g, point_p1, point_g1, point_p2, point_g2, 3) + +# Charger la geometrie +# ==================== + +bielle = geompy.ImportSTEP("bielle.stp") + +# Selectionner des sous-parties de la geometrie +# --------------------------------------------- + +sommets = geompy.SubShapeAllSortedCentres (bielle, geompy.ShapeType["VERTEX"]) +nodes_id = geompy.SubShapeAllSortedCentresIDs (bielle, geompy.ShapeType["VERTEX"]) + ## 0 1 2 3 4 5 6 7 8 9 + ## 23, 70, 15, 52, 17, 57, 13, 47, 19, 62, + ## 11, 42, 6, 30, 9, 37, 7, 32, 26, 75] + +sommets_petit = [ 6, 8, 7, 9 ] +sommets_grand = [ 10, 12, 11, 13 ] +node_little_subid = [ 13, 19, 47, 62 ] +node_big_subid = [ 11, 6, 42, 30 ] + +aretes = geompy.SubShapeAllSortedCentres (bielle, geompy.ShapeType["EDGE"]) +edge_id = geompy.SubShapeAllSortedCentresIDs (bielle, geompy.ShapeType["EDGE"]) + ## 0 1 2 3 4 5 6 7 8 9 + ## 16, 56, 22, 71, 69, 53, 58, 14, 51, 18, + ## 61, 48, 63, 12, 46, 20, 66, 43, 29, 10, + ## 41, 5, 31, 38, 33, 25, 76, 8, 36, 74 + + +aretes_petit = [ 7, 9, 8, 10 ] +aretes_grand = [ 19, 21, 20, 22 ] +arc_little_subid = [ 14, 18, 51, 61 ] +arc_big_subid = [ 10, 5, 41, 31 ] + +subid_pbcd = 16 +subid_pbe = 22 + +subid_phcd = 56 +subid_phe = 71 + +subid_gbcd = 8 +subid_gbe = 25 + +subid_ghcd = 36 +subid_ghe = 76 + +ga_pbcd = aretes[ 0] +ga_pbe = aretes[ 2] + +ga_phcd = aretes[ 1] +ga_phe = aretes[ 3] + +ga_gbcd = aretes[27] +ga_gbe = aretes[25] + +ga_ghcd = aretes[28] +ga_ghe = aretes[26] + +# Associer le modele de bloc avec la geometrie +# ============================================ + +geometry = doc.addShape(bielle, "bielle") +doc.setLevel (748) + +# Nettoyer les associations implicites du document +# ------------------------------------------------ + +doc.clearAssociation() + +# Associer les cercles exterieurs +# ------------------------------- + +def cercle(grille, k, subid, p): + ms = grille.getVertexIJK(0, 0, k) + + ma1 = grille.getEdgeJ (0, 2, k) + ma2 = grille.getEdgeJ (0, 1, k) + ma3 = grille.getEdgeJ (0, 0, k) + + doc.associateClosedLine (ms, [ma1, ma2, ma3 ], [geometry], [subid], p, False) + +cercle (grille_p, 0, subid_pbe, 5.0/6) +cercle (grille_p, 1, subid_phe, 5.0/6) + +cercle (grille_g, 0, subid_gbe, 0) +cercle (grille_g, 1, subid_ghe, 0) + +# Associer les arcs exterieurs (excentres) +# ---------------------------------------- + +def arc(grille, i1, i2, k, subid): + ma1 = grille.getEdgeJ(1, i1, k) + ma2 = grille.getEdgeJ(1, i2, k) + + doc.associateOpenedLine ([ma1, ma2 ], [geometry], [subid], 0, 1) + +arc(grille_p, 1, 0, 0, subid_pbcd) +arc(grille_p, 1, 0, 1, subid_phcd) + +arc(grille_g, 0, 2, 0, subid_gbcd) +arc(grille_g, 0, 2, 1, subid_ghcd) + +# Associer les sommets des arcs de cercle de raccord +# -------------------------------------------------- + +hm = prisme.getHexa(1) +for i in xrange(0, 4): + vm = hm.getVertex(i) + subid = node_little_subid [i] + vm.setAssociation (geometry, subid) + +hm = prisme.getHexa(2) +for i in xrange(0, 4): + vm = hm.getVertex(i) + subid = node_big_subid [i] + vm.setAssociation (geometry, subid) + +# Associer les arcs de cercle de raccord +# -------------------------------------- + +hm = prisme.getHexa(0) +for i in xrange(0, 4): + em = hm.getEdge(i+8) + subid = arc_little_subid [i] + em.addAssociation (geometry, subid, 0, 1) + +hm = prisme.getHexa(2) +for i in xrange(0, 4): + em = hm.getEdge(i+8) + subid = arc_big_subid [i] + em.addAssociation (geometry, subid, 0, 1) + +# Arrondir des associations implicites cylindriques +# ------------------------------------------------- + +larc = [] +for h, i, ech in [ [0, 0, 0.95], [0, 1, 0.95], [2, 2, 0.85], [2, 3, 0.85] ]: + hm = prisme.getHexa(h) + em = hm.getEdge(i) + + v1 = em.getVertex(0) + v2 = em.getVertex(1) + + vax = v1.getAssoX (); + vay = v1.getAssoY (); + vaz = v1.getAssoZ (); + + vbx = v2.getAssoX (); + vby = v2.getAssoY (); + vbz = v2.getAssoZ (); + + vmx = ( vax + vbx ) / 2.0 * ech + vmy = ( vay + vby ) / 2.0 + vmz = ( vaz + vbz ) / 2.0 + + va = geompy.MakeVertex(vax, vay, vaz) + vb = geompy.MakeVertex(vbx, vby, vbz) + vm = geompy.MakeVertex(vmx, vmy, vmz) + eg = geompy.MakeArc(va, vm, vb) + larc.append(eg) + +arc = geompy.MakeCompound(larc) +shape = doc.addShape (arc, "arc") + +# Mailler le modele de bloc +for h, i in [ [0, 0], [0, 1], [2, 2], [2, 3] ]: + hm = prisme.getHexa(h) + em = hm.getEdge(i) + + em.clearAssociation() + shape_subid = 2+3*i + em.addAssociation (shape, shape_subid, 0.0, 1.0) + +# Mailler le modele de bloc +# ========================= + +# Definir 5 groupes de faces +# -------------------------- + +groupe_petit = doc.addQuadGroup("Petit") +groupe_grand = doc.addQuadGroup("Grand") +groupe_bas = doc.addQuadGroup("Bas") +groupe_haut = doc.addQuadGroup("Haut") +groupe_contour = doc.addQuadGroup("Contour") + +# Constituer les groupes petit et grand +# ------------------------------------- + +for i in xrange(3): + groupe_petit.addElement( grille_p.getQuadJK(0, i, 0) ) + groupe_grand.addElement( grille_g.getQuadJK(0, i, 0) ) + +# Constituer les groupes bas et haut +# ---------------------------------- + +for i in xrange(3): + groupe_bas.addElement( grille_p.getQuadIJ(0, i, 0) ) + groupe_bas.addElement( grille_g.getQuadIJ(0, i, 0) ) + + groupe_haut.addElement( grille_p.getQuadIJ(0, i, 1) ) + groupe_haut.addElement( grille_g.getQuadIJ(0, i, 1) ) + +for i in xrange(3): + h = prisme.getHexa(i) + + groupe_bas.addElement( h.getQuad(2) ) + groupe_haut.addElement( h.getQuad(3) ) + +# Constituer le groupe contour +# ---------------------------- + +for i in xrange(2): + groupe_contour.addElement( grille_p.getQuadJK(1, i, 0) ) + +for i in [0, 2]: + groupe_contour.addElement( grille_g.getQuadJK(1, i, 0) ) + +for i in xrange(3): + h = prisme.getHexa(i) + + groupe_contour.addElement( h.getQuad(4) ) + groupe_contour.addElement( h.getQuad(5) ) + +# Definir 3 groupes de volumes +# ---------------------------- + +groupe_petit = doc.addHexaGroup("Petit") +groupe_grand = doc.addHexaGroup("Grand") +groupe_prisme = doc.addHexaGroup("Prisme") + +for i in xrange(3): + groupe_petit.addElement( grille_p.getHexa(i) ) + groupe_grand.addElement( grille_g.getHexa(i) ) + +for i in xrange(3): + groupe_prisme.addElement( prisme.getHexa(i) ) + +# Mailler le modele de bloc avec association +# ------------------------------------------ + +########## hexablock.addLaws(doc, 0.003, True) Ne marche plus !!!! + +law = doc.addLaw("Uniform", 4) + +for j in range(doc.countPropagation()): + propa = doc.getPropagation(j) + propa.setLaw(law) + +doc.save("bielle_v5") +doc.setName("bielle_v5") +hexablock.addToStudy(doc) + +blocs = hexablock.mesh(doc) + +muv, mue, muq, muh = hexablock.dump(doc, blocs) diff --git a/src/TEST_PY/test_unit/cut_grille.py b/src/TEST_PY/test_unit/cut_grille.py new file mode 100644 index 0000000..4d30d6b --- /dev/null +++ b/src/TEST_PY/test_unit/cut_grille.py @@ -0,0 +1,94 @@ +# -*- coding: latin-1 -*- + +# Francis KLOSS - 2011 - CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France +# ======================================================================================== + +import geompy +import hexablock + +# Construire le modèle de blocs +# ============================= + +nom = "exemple_cut" + +# Créer le document +# ----------------- + +doc = hexablock.addDocument("default") + +# Construire la grille sphérique +# ------------------------------ + +centre = doc.addVertex(0, 0, 0) + +vecteur_x = doc.addVector(1, 0, 0) +vecteur_y = doc.addVector(0, 1, 0) +vecteur_z = doc.addVector(0, 0, 1) + +grille = doc.makeCartesian(centre, vecteur_x, vecteur_y, vecteur_z, 4, 3, 2) + +# Associer une arête, puis couper cettee arête +# -------------------------------------------- + +arete = grille.getEdgeJ(0, 1, 0) + +sommet_a = arete.getVertex(0) +sommet_b = arete.getVertex(1) + +ax = sommet_a.getX() +ay = sommet_a.getY() +az = sommet_a.getZ() + +bx = sommet_b.getX() +by = sommet_b.getY() +bz = sommet_b.getZ() + +mx = (ax+bx)/2.0 - 0.25 +my = (ay+by)/2.0 +mz = (az+bz)/2.0 + +vertex_d = geompy.MakeVertex(ax, ay, az) +vertex_m = geompy.MakeVertex(mx, my, mz) +vertex_f = geompy.MakeVertex(bx, by, bz) + +edge = geompy.MakeArc(vertex_d, vertex_m, vertex_f) +geompy.addToStudy(edge, "arc") +geompy.addToStudy(vertex_d, "debut") +geompy.addToStudy(vertex_m, "milieu") +geompy.addToStudy(vertex_f, "fin") + +sommet_a.setAssociation(vertex_d) +sommet_b.setAssociation(vertex_f) + +arete.addAssociation(edge, 0, 1) + +elements = doc.cut(arete, 4) + +# Définir la loi de maillage sur les propagations +# ----------------------------------------------- + +l = doc.addLaw("Uniform", 5) +n = doc.countPropagation() + +for i in xrange(n): + p = doc.getPropagation(i) + p.setLaw(l) + +# Générer le maillage +# ------------------- +maillage = hexablock.mesh (doc) + +# Afficher des informations +# ------------------------- + +print "Sur le document:" +print "nombre de sommets du modèle de bloc: ", doc.countUsedVertex() +print "nombre d'arêtes du modèle de bloc: ", doc.countUsedEdge() +print "nombre de quadrangles du modèle de bloc: ", doc.countUsedQuad() +print "nombre de blocs du modèle de bloc: ", doc.countUsedHexa() + +print "Sur le maillage:" +print " - Nombre de noeuds : ", maillage.NbNodes() +print " - Nombre de segments : ", maillage.NbEdges() +print " - Nombre de quadrangles: ", maillage.NbQuadrangles() +print " - Nombre d'hexaèdres : ", maillage.NbHexas() diff --git a/src/TEST_PY/test_unit/hexa_quads.py b/src/TEST_PY/test_unit/hexa_quads.py index 15cda17..ddb48d2 100644 --- a/src/TEST_PY/test_unit/hexa_quads.py +++ b/src/TEST_PY/test_unit/hexa_quads.py @@ -77,7 +77,7 @@ def test_hexa_quads_5 () : # ========================================================== test_hexa_quads_ab def test_hexa_quads_ab () : - doc = hexablock.addDocument() + doc = hexablock.addDocument ("default") vtk = FileVtk (doc, "HexaQuadsAB"); grid = add_grid (doc, 1, 1, 3) vtk.save () @@ -105,7 +105,7 @@ def test_hexa_quads_ab () : # ========================================================== test_hexa_quads_ac def test_hexa_quads_ac () : - doc = hexablock.addDocument() + doc = hexablock.addDocument ("default") vtk = FileVtk (doc, "HexaQuadsAC"); grid = add_grid (doc, 2, 1, 2) vtk.save () @@ -134,7 +134,7 @@ def test_hexa_quads_ac () : # ======================================================= test_hexa_quads_acd def test_hexa_quads_acd () : - doc = hexablock.addDocument() + doc = hexablock.addDocument ("default") vtk = FileVtk (doc, "HexaQuadsACD"); grid = add_grid (doc, 3, 1, 2) vtk.save () @@ -163,7 +163,7 @@ def test_hexa_quads_acd () : # ======================================================= test_hexa_quads_ace def test_hexa_quads_ace () : - doc = hexablock.addDocument() + doc = hexablock.addDocument ("default") vtk = FileVtk (doc, "HexaQuadsACE"); grid = add_grid (doc, 2, 2, 2) vtk.save () @@ -191,7 +191,7 @@ def test_hexa_quads_ace () : # ======================================================= test_hexa_quads_abcd def test_hexa_quads_abcd () : - doc = hexablock.addDocument() + doc = hexablock.addDocument ("default") vtk = FileVtk (doc, "HexaQuadsABCD"); grid = add_grid (doc, 3, 1, 3) vtk.save () @@ -218,7 +218,7 @@ def test_hexa_quads_abcd () : # ======================================================= test_hexa_quads_abce def test_hexa_quads_abce () : - doc = hexablock.addDocument() + doc = hexablock.addDocument ("default") vtk = FileVtk (doc, "HexaQuadsABCE"); grid = add_grid (doc, 3, 2, 2) vtk.save () diff --git a/src/TEST_PY/test_unit/test_cone.py b/src/TEST_PY/test_unit/test_cone.py new file mode 100644 index 0000000..24d9454 --- /dev/null +++ b/src/TEST_PY/test_unit/test_cone.py @@ -0,0 +1,76 @@ +# -*- coding: latin-1 -*- +# Hexa : Creation d'hexaedres + +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ +# or email : webmaster.salome@opencascade.com +# + +import hexablock +import os +import geompy + +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 + + +doc = hexablock.addDocument ("test_cone") + +orig = doc.addVertex (0, 0, 0) +ori2 = doc.addVertex (0, 0, 10) +vz = doc.addVector (0, 0, 1) +vx = doc.addVector (1 ,0, 0) + +rad1 = 2.0 +rad2 = 1.0 +height = 5.0 +angle = 270.0 +hollow = False + +nr = 2 +na = 8 +nl = 1 + +c1 = doc.makeCylindrical (orig, vx,vz, rad1, angle, height, nr,na,nl, hollow) +c2 = doc.makeCylindrical (ori2, vx,vz, rad2, angle, height, nr,na,nl, hollow) + +vh0 = c2.getVertexIJK (0, 0, 0) +vh1 = c2.getVertexIJK (1, 0, 0) + +vb0 = c1.getVertexIJK (0, 0, nl) +vb1 = c1.getVertexIJK (1, 0, nl) + +qcible = c2.getQuadIJ (0, 0, 0) +qliste = [] +for ni in range (nr) : + for nj in range (na) : + quad = c1.getQuadIJ (ni, nj, nl) + qliste.append (quad) + + ## Join quads to make a cone between the 2 cylinders +doc.joinQuads (qliste, qcible, vb0, vh0, vb1, vh1, 1) + + ### -------------------- Mesh + +law = doc.addLaw ("Uniform", 4) + +for np in range(doc.countPropagation()): + propa = doc.getPropagation (np) + propa.setLaw (law) + +mesh_hexas = hexablock.mesh(doc) + diff --git a/src/TEST_PY/test_unit/test_cross.py b/src/TEST_PY/test_unit/test_cross.py index 05b2e28..692bf7b 100644 --- a/src/TEST_PY/test_unit/test_cross.py +++ b/src/TEST_PY/test_unit/test_cross.py @@ -48,6 +48,7 @@ def test_pipes () : pipe2 = doc.addPipe (ori2, vx, ni2, nr2, nl2) grid = doc.makePipes (pipe1, pipe2) + doc.save ("pipes") doc.saveVtk ("pipes.vtk") return doc @@ -78,6 +79,7 @@ def test_croix () : # ================================================================= Begin doc = test_pipes () +doc.setLevel (747) law = doc.addLaw("Uniform", 4) @@ -85,5 +87,5 @@ for j in range(doc.countPropagation()): propa = doc.getPropagation(j) propa.setLaw(law) -mesh_hexas = hexablock.mesh(doc, "maillage:hexas") +mesh_hexas = hexablock.mesh (doc, "maillage:hexas") diff --git a/src/TEST_PY/test_unit/test_cylinders.py b/src/TEST_PY/test_unit/test_cylinders.py index ef33272..1b8462f 100644 --- a/src/TEST_PY/test_unit/test_cylinders.py +++ b/src/TEST_PY/test_unit/test_cylinders.py @@ -30,33 +30,93 @@ import geompy # ======================================================= test_cylindricals def test_cylindricals () : - doc = hexablock.addDocument ("rind:hexas") + doc = hexablock.addDocument ("cyl:hexas") orig = doc.addVertex (0, 0, 0) vz = doc.addVector (0, 0, 1) vx = doc.addVector (1 ,0, 0) + tdr = [ 1, 1, 1, 1 ] + tda = [ 45, 45, 45, 45, 45, 45, 45, 45 ] + tdl = [ 1, 1, 1 ] + tdr = [ 1, 2, 0.5 ] tda = [ 30, 30, 30, 10, 10, 10, 10, 10, 10, 10, 10, 10, 30, 30, 30, 10, 10, 10, 10, 10, 10, 10, 10, 10 ] tdl = [ 1, 2, 3 ] - tdr = [ 1, 1, 1, 1 ] - tda = [ 45, 45, 45, 45, 45, 45, 45, 45 ] - tdl = [ 1, 1, 1 ] - c1 = doc.makeCylindricals (orig, vx,vz, tdr, tda, tdl, False) - ## c1 = doc.makeCylindrical (orig, vx,vz, 1.0, 360.0, 1.0, 3, 8, 3, False) + + doc.saveVtk ("cylindricals.vtk") + return doc + +# ======================================================= test_cylindrical +def test_cylindrical () : + + doc = hexablock.addDocument ("cyl:hexas") + + orig = doc.addVertex (0, 0, 0) + vz = doc.addVector (0, 0, 1) + vx = doc.addVector (1 ,0, 0) + + nr = 3 + na = 8 + nl = 3 + c1 = doc.makeCylindrical (orig, vx,vz, 1.0, 360.0, 1.0, nr,na,nl, False) doc.saveVtk ("cylindricals.vtk") return doc + +# ======================================================= test_cone +def test_cone () : + + doc = hexablock.addDocument ("cyl:hexas") + + orig = doc.addVertex (0, 0, 0) + ori2 = doc.addVertex (0, 0, 10) + vz = doc.addVector (0, 0, 1) + vx = doc.addVector (1 ,0, 0) + + nr = 2 + na = 8 + nl = 1 + c1 = doc.makeCylindrical (orig, vx,vz, 2.0, 360.0, 5.0, nr,na,nl, False) + c2 = doc.makeCylindrical (ori2, vx,vz, 1.0, 360.0, 5.0, nr,na,nl, False) + + vh0 = c2.getVertexIJK (0, 0, 0) + vh1 = c2.getVertexIJK (1, 0, 0) + + vb0 = c1.getVertexIJK (0, 0, nl) + vb1 = c1.getVertexIJK (1, 0, nl) + + qcible = c2.getQuadIJ (0, 0, 0) + qliste = [] + for ni in range (nr) : + for nj in range (na) : + quad = c1.getQuadIJ (ni, nj, nl) + qliste.append (quad) + quad .setColor (3); + + qcible.setColor (3); + vb0.setColor (5); + vh0.setColor (5); + vb1.setColor (5); + vh1.setColor (5); + + doc.joinQuads (qliste, qcible, vb0, vh0, vb1, vh1, 1) + + doc.saveVtk ("cone.vtk") + return doc + # ================================================================= Begin -doc = test_cylindricals () +#### doc = test_cylindricals () +#### doc = test_cylindrical () +doc = test_cone () law = doc.addLaw("Uniform", 4) diff --git a/src/TEST_PY/test_unit/test_disco.py b/src/TEST_PY/test_unit/test_disco.py index 0d53e73..bf1af59 100644 --- a/src/TEST_PY/test_unit/test_disco.py +++ b/src/TEST_PY/test_unit/test_disco.py @@ -38,18 +38,19 @@ def test_disco_edges () : vy = doc.addVector ( 0, 1, 1) vx = doc.addVector ( 1 ,0, 0) - size_x = 2 + size_x = 1 size_y = 2 - size_z = 5 + size_z = 2 grid = doc.makeCartesian (ori, vx, vy, vz, size_x, size_y, size_z) t_hexas = [] t_edges = [] + doc.setLevel (1) for nk in range (size_z) : - t_hexas.append (grid.getHexaIJK (1,1,nk)) - t_edges.append (grid.getEdgeK (1,2,nk)) + t_hexas.append (grid.getHexaIJK (0,0,nk)) + t_edges.append (grid.getEdgeK (0,1,nk)) disco_edges = doc.disconnectEdges (t_hexas, t_edges) return doc diff --git a/src/TEST_PY/test_unit/test_double_t.py b/src/TEST_PY/test_unit/test_double_t.py index d02fca6..158bab8 100644 --- a/src/TEST_PY/test_unit/test_double_t.py +++ b/src/TEST_PY/test_unit/test_double_t.py @@ -108,7 +108,7 @@ def test_lorraine () : rsmall = 1 rmoy = 3 - rbig = 5 + rbig = 4 cyl1 = doc.addCylinder (ori1, vz, rmoy, nl1) cyl2 = doc.addCylinder (ori2, vx, rsmall, nl2) @@ -155,7 +155,7 @@ def test_lorraine () : # ================================================================= Begin -doc = test_lorraine () +doc = test_double_t () law = doc.addLaw("Uniform", 4) diff --git a/src/TEST_PY/test_unit/test_perform.py b/src/TEST_PY/test_unit/test_perform.py new file mode 100644 index 0000000..8dde7ee --- /dev/null +++ b/src/TEST_PY/test_unit/test_perform.py @@ -0,0 +1,125 @@ +# -*- coding: latin-1 -*- +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# Hexa : Creation d'hexaedres + +import hexablock +import os +import geompy + +#---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 + + +# ======================================================= make_grid +def make_grid (doc) : + + ori = doc.addVertex ( 0, 0, 0) + vz = doc.addVector ( 0, 0, 1) + vx = doc.addVector ( 1 ,0, 0) + + dr = 1 + da = 360 + dl = 1 + + nr = 1 + na = 6 + nl = 1 + grid = doc.makeCylindrical (ori, vx,vz, dr,da,dl, nr,na,nl, False) + doc .saveVtk ("transfo1.vtk") + return grid + +# ======================================================= test_translation +def test_translation () : + + doc = hexablock.addDocument ("default") + grid = make_grid (doc) + + devant = doc.addVector (10, 0, 0) + grid2 = doc.performTranslation (grid, devant) + + doc .saveVtk ("transfo2.vtk") + return doc + +# ======================================================= test_scale +def test_scale () : + + doc = hexablock.addDocument ("default") + grid = make_grid (doc) + + dest = doc.addVertex (15, 0, 0) + grid2 = doc.performScale (grid, dest, 0.5) + + doc .saveVtk ("transfo3.vtk") + return doc + +# ======================================================= test_sym_point +def test_sym_point () : + + doc = hexablock.addDocument ("default") + grid = make_grid (doc) + + orig = doc.addVertex (5, 0, 0) + ier = doc.performSymmetryPoint (grid, orig) + + doc .saveVtk ("transfo4.vtk") + return doc + +# ======================================================= test_sym_line +def test_sym_line () : + + doc = hexablock.addDocument ("default") + grid = make_grid (doc) + + orig = doc.addVertex (5, 0, 0) + dir = doc.addVector (0, 0, 1); + ier = doc.performSymmetryLine (grid, orig, dir) + + doc .saveVtk ("transfo5.vtk") + return doc + +# ======================================================= test_sym_plan +def test_sym_plan () : + + doc = hexablock.addDocument ("default") + grid = make_grid (doc) + + orig = doc.addVertex (5, 0, 0) + dir = doc.addVector (1, 0, 0); + ier = doc.performSymmetryPlane (grid, orig, dir) + + doc .saveVtk ("transfo6.vtk") + return doc + +# ================================================================= Begin + +### doc = test_translation () +doc = test_scale () +### doc = test_sym_point () +### doc = test_sym_line () +### doc = test_sym_plan () + +law = doc.addLaw("Uniform", 4) + +for j in range(doc.countPropagation()): + propa = doc.getPropagation(j) + propa.setLaw(law) + +mesh_hexas = hexablock.mesh(doc, "maillage:hexas") + diff --git a/src/TEST_PY/test_unit/test_shapes.py b/src/TEST_PY/test_unit/test_shapes.py new file mode 100644 index 0000000..0e2a2c9 --- /dev/null +++ b/src/TEST_PY/test_unit/test_shapes.py @@ -0,0 +1,48 @@ +# -*- coding: latin-1 -*- + +# Francis KLOSS : 2011-2012 : CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France +# ============================================================================================= + +import math + +import geompy +import hexablock + +# Construire le modèle de bloc +# ============================ + +doc = hexablock.addDocument("bielle") + +# Charger la géométrie +# ==================== + +bielle = geompy.ImportSTEP("bielle.stp") +shape = doc.addShape (bielle, "bielle") + + +# Sélectionner des sous-parties de la géométrie +# --------------------------------------------- + +sommets = geompy.SubShapeAllIDs (bielle, geompy.ShapeType["VERTEX"]) +aretes = geompy.SubShapeAllIDs (bielle, geompy.ShapeType["EDGE"]) + +print " ... Aretes = ", aretes +print " ... Sommets = ", sommets + +nbfaces = shape.countFace () +nbedges = shape.countEdge () +nbvertex = shape.countVertex () + +for n in range (nbfaces) : + print " Face nro %d = %s" % (n , shape.getNameFace (n)) +print + +for n in range (nbedges) : + print " Edge nro %d = %s" % (n , shape.getNameEdge (n)) +print + +for n in range (nbvertex) : + print " Vertex nro %d = %s" % (n , shape.getNameVertex (n)) + + + diff --git a/src/TEST_PY/test_unit/test_xml.py b/src/TEST_PY/test_unit/test_xml.py new file mode 100644 index 0000000..594780f --- /dev/null +++ b/src/TEST_PY/test_unit/test_xml.py @@ -0,0 +1,9 @@ + +import hexablock + +# Construire le modele de bloc +# ============================ + +doc = hexablock.loadDocument("bielle_v5") +doc.save("pipo") + diff --git a/src/TEST_PY/test_unit/troisCylindres.brep b/src/TEST_PY/test_unit/troisCylindres.brep new file mode 100644 index 0000000..f07be10 --- /dev/null +++ b/src/TEST_PY/test_unit/troisCylindres.brep @@ -0,0 +1,509 @@ + +CASCADE Topology V1, (c) Matra-Datavision +Locations 8 +1 +1.11022302462516e-16 0 1 0 + 0 1 0 0 + -1 0 1.11022302462516e-16 400 +1 + 1 0 0 190 + 0 1 0 0 + 0 0 1 380 +1 + 1 0 0 190 + 0 1 0 0 + 0 0 1 220 +2 1 -1 0 +2 2 -1 0 +2 2 1 3 -1 0 +2 3 -1 0 +2 3 1 2 -1 0 +Curve2ds 38 +1 0 800 1 0 +2 0 0 1 0 -0 1 100 +7 0 0 8 23 4 5.7595865315812871 400 5.7595865315812871 396.4531264233774 5.7629069293083175 392.92833608277681 5.7694749436140853 389.51230084494648 5.7788372822703087 386.24424709027198 5.7905468978363102 383.14348794697975 5.8042009023008854 380.21545709727701 5.8195042660091962 377.45508725218542 5.8543892203674739 372.04985730479018 5.8742056575325181 369.42820567367704 5.89564313364939 366.96284011636072 5.9186431153591617 364.64644480202827 5.9431911157077195 362.47799188863092 5.969306315324145 360.46051727651405 5.997060367620036 358.60197280754011 6.0537021647479774 355.37514358939779 6.082311505809308 353.97770142062154 6.1125302711814751 352.74076825489283 6.1443482006914323 351.69171562635694 6.1776550181455665 350.86267948835513 6.212224813535169 350.28862243838159 6.2476523776714217 350.00000035532935 6.2831853071795862 350 + 0 9 0.32715155003298801 7 0.67848367377663077 7 1 9 +7 0 0 8 23 4 4.7123889803846897 86.602540378443834 4.7833264519171417 86.602540378443834 4.8538221133434041 86.768554360301735 4.9226876586617614 87.096991301102832 4.9896492478955832 87.559643674082267 5.0546217349220237 88.124612677936994 5.1177137403899753 88.763476885346691 5.1791713917111073 89.453947255999054 5.3042530285650589 90.961452312325122 5.3677102240744938 91.784169844339971 5.4305599185356694 92.631457510690808 5.4932602887666402 93.488642372673752 5.5562165742572436 94.341495300176803 5.6198260616794098 95.175736723592024 5.6845162320744418 95.976668732951339 5.8116848841313695 97.413920783548804 5.8739248236055932 98.05887438439521 5.9379452637785519 98.646808131231438 6.0038837402756018 99.157716247916923 6.071712633333922 99.568620170602287 6.1412648768472247 99.855699662295933 6.2121194481632589 99.999999822335369 6.2831853071795862 100 + 0 9 0.32715155003298801 7 0.67848367377663077 7 1 9 +1 6.2831853071795862 -0 0 1 +1 0 -0 0 1 +1 0 0 1 0 +2 0 0 1 0 -0 1 100 +7 0 0 8 23 4 0 350 0.033576530560921469 349.99999966423474 0.067082892452182463 350.25770810060493 0.099869308879887875 350.77111458667099 0.13156628624254196 351.51570531988671 0.16195866809536152 352.46209608878792 0.19093398028496456 353.58237755135616 0.21846654983792213 354.85222820605424 0.27426368959368119 357.84920888955003 0.3021491186068328 359.61622715531161 0.32842484744605827 361.54040041871144 0.35316416580412735 363.61204164396673 0.37639683220717668 365.8264229027584 0.39812537333505649 368.18305324271273 0.41831630740511905 370.68769525783222 0.4557439761033848 376.0736018517199 0.47292011875991768 378.9594576910697 0.48830018181480117 382.03427944841542 0.50156023379092929 385.30662787333353 0.51222803597861422 388.77333266748747 0.51976991720685906 392.41514581060738 0.52359877559829915 396.1912597343462 0.52359877559829915 400 + 0 9 0.30404471865854837 7 0.64918916271671423 7 1 9 +7 0 0 8 23 4 -8.8817841970012523e-16 100 0.06715306112184205 100.00000016788263 0.13416540811772926 99.871153979566813 0.2000859947170639 99.614413693494853 0.26450877997241218 99.244989236204376 0.32725315809820543 98.782719490159323 0.38826782246932368 98.247314081382243 0.44764126817363259 97.656293340043064 0.57139795897359669 96.305069830741061 0.63542889192342944 95.53220561073141 0.69827952069100885 94.722154327366113 0.76035187352387279 93.8895784161206 0.82202051989645941 93.048311226451347 0.8836693219130547 92.211706870163411 0.9457321983952216 91.393072001530811 1.0730247241787252 89.809460344875689 1.138267311008704 89.045865019642434 1.2052426425872236 88.333353522290537 1.2742871129404838 87.697209384435382 1.3455881079195908 87.171127692761559 1.4190994971417732 86.793973628457834 1.4946215214818199 86.602540378443862 1.5707963267948957 86.602540378443862 + 0 9 0.30404471865854837 7 0.64918916271671423 7 1 9 +7 0 0 8 23 4 0 450 0.033576535464432844 450 0.06708288862795353 449.74229256882165 0.099869310240679354 449.22888491692595 0.13156628503243795 448.48429456674455 0.16195866455356001 447.53790447273542 0.19093398418656715 446.41762209624159 0.21846654988386938 445.14777179147779 0.27426368959368741 442.15079111044957 0.3021491186068106 440.38377284469061 0.32842484744608935 438.45959958128537 0.3531641658041238 436.38795835603389 0.37639683220714382 434.17357709724484 0.39812537333508846 431.81694675728357 0.41831630740511105 429.31230474216915 0.45574397610337858 423.92639814828101 0.4729201187599914 421.04054230892496 0.48830018181460044 417.96572055159834 0.50156023379119397 414.6933721266472 0.51222803597843036 411.22666733252822 0.51976991720691501 407.58485418938534 0.52359877559829915 403.80874026565544 0.52359877559829915 400 + 0 9 0.30404471828653629 7 0.64918916252934122 7 1 9 +7 0 0 8 23 4 3.1415926535897931 100 3.0744395826609292 100 3.0074272532690807 99.871154312247398 2.9415066557379972 99.614413450152753 2.8770838762873723 99.24498917729909 2.8143395030913991 98.782719765237147 2.7533248227475049 98.247313911151892 2.6939513853142487 97.656293338930354 2.5701946946161791 96.305069830740877 2.5061637616664392 95.532205610732049 2.4433131328986759 94.722154327365189 2.3812407800659359 93.889578416120742 2.319572133693443 93.048311226452213 2.257923331676631 92.211706870162374 2.195860455194603 91.393072001531209 2.0685679294110897 89.809460344875959 2.003325342581054 89.04586501964134 1.9363500110025664 88.333353522292768 1.8673055406493542 87.697209384432796 1.7960045456701803 87.171127692763221 1.7224931564479862 86.793973628457351 1.6469711321080045 86.602540378443862 1.5707963267948963 86.602540378443862 + 0 9 0.30404471828653629 7 0.64918916252934122 7 1 9 +7 0 0 8 23 4 5.7595865315812871 400 5.7595865315812871 403.54687357661732 5.7629069293083264 407.0716639172436 5.7694749436140578 410.487699155016 5.7788372822703495 413.75575290976724 5.7905468978362755 416.85651205299661 5.804200902300904 419.78454290273055 5.8195042660091909 422.54491274781367 5.8543892203674712 427.95014269520948 5.874205657532519 430.57179432632284 5.8956431336493971 433.03715988364036 5.9186431153591563 435.35355519797133 5.9431911157077124 437.52200811136817 5.9693063153241566 439.53948272348691 5.9970603676200325 441.39802719245961 6.0537021647981906 444.62485641346274 6.0823115099356198 446.02229896119849 6.1125302674090722 447.25923114449233 6.1443481994298761 448.30828448674504 6.1776550195756252 449.13732104001321 6.2122248094106727 449.71137685489032 6.2476523829853585 450 6.2831853071795862 450 + 0 9 0.32715154983796968 7 0.67848367337201809 7 1 9 +7 0 0 8 23 4 4.7123889803846897 86.602540378443834 4.6414515088523443 86.602540378443834 4.5709558474254868 86.76855436030219 4.5020903021086447 87.096991301101312 4.4351287128726282 87.559643674084498 4.3701562258480955 88.124612677935161 4.3070642203791722 88.7634768853476 4.2456065690582925 89.453947255998813 4.1205249322043267 90.961452312325036 4.0570677366948757 91.784169844340013 3.9942180422337055 92.631457510690936 3.9315176720027551 93.48864237267361 3.8685613865121442 94.341495300176661 3.8049518990899482 95.175736723592308 3.7402617286949473 95.976668732951225 3.6130930765252778 97.413920784822892 3.5508531282366924 98.058874567884871 3.4868327051487182 98.646807838009721 3.4208942233135531 99.157716307234637 3.3530653240854145 99.568620428735727 3.2835130923467619 99.855699311460796 3.2126585019782485 100 3.1415926535897931 100 + 0 9 0.32715154983796968 7 0.67848367337201809 7 1 9 +7 0 0 8 86 13 2.7300758075223057 190 2.7300758075223057 188.76161711057227 2.73198839472064 187.55133668015193 2.7356595879105567 186.40804485479049 2.7406522245640779 185.33795497726547 2.7466665999124618 184.34258844053036 2.7534345015999824 183.4162771353935 2.7608247966701325 182.54924607309326 2.7805106679886924 180.5313877921306 2.7934228662572296 179.44012090542088 2.8074042576548592 178.42489439075112 2.8224021612079322 177.47714125871727 2.8383853128399443 176.58765276942751 2.8553986657883739 175.75234570339671 2.8735299500160485 174.96696097018872 2.9096367995004702 173.60217638596475 2.927074703391964 173.01544757903642 2.9455701846587412 172.46336132523098 2.9653382299711857 171.94696597602535 2.9865550769566158 171.47070368601692 3.0094637838744882 171.044924719389 3.0342362135094789 170.68192128165288 3.0846904814586811 170.16788483391167 3.110457736212882 169.98675095042276 3.1373772459573144 169.90241768877223 3.1644097931300808 169.92983296212577 3.1907387356792545 170.06246027525333 3.2157117427758561 170.28378283343829 3.2387860886964592 170.56795276727468 3.2857128896829386 171.28490034470798 3.3095267559518353 171.75813983885746 3.3315889559519829 172.28669212661248 3.3520793566732001 172.86264456356133 3.3712426139199891 173.47925753251525 3.3892171781517373 174.13467786991569 3.4061709628706178 174.82956714675092 3.4315765607080646 176.00111900189935 3.4406202276953 176.44739232078726 3.4493683641263591 176.90942117645849 3.4578076048696391 177.38676190073474 3.4659242604470752 177.87897923803828 3.473704317034132 178.38564634539176 3.4811334364598099 178.90634479241825 3.4952602825731667 179.97496970201598 3.5019582387828598 180.52299721930251 3.5082759977769666 181.08420673921333 3.5141984025436779 181.65818491571483 3.5197099661181288 182.24464543072799 3.5247948715823951 182.84342899412766 3.5294369720654961 183.45450334374323 3.5385783136065494 184.81704385450712 3.5430774304692174 185.60147540318962 3.5470027815210834 186.43393805468477 3.550193052094881 187.31387149619184 3.552464823959987 188.23647567906212 3.553634828362437 189.1915419192367 3.5535877444215225 190.16041200836165 3.5507263605782593 192.52143481281828 3.5466264819059488 193.84478773876532 3.540673500034889 195.06679581640853 3.5333903287665258 196.19442250073351 3.5251084225945828 197.2339901412731 3.516072019876451 198.19784034352128 3.5063476353219669 199.100910190511 3.4816461951625191 201.11765616922102 3.4662615750150878 202.17669187279171 3.4497197612770401 203.16359594026292 3.4319965274128248 204.08585426002017 3.4130562502099866 204.9499797977617 3.3927629809540236 205.75731315708825 3.370961354722068 206.5085724462667 3.3350837042681274 207.55059273349855 3.3227385987925833 207.87877699148535 3.3101400373711489 208.18373555748497 3.2973072930831178 208.46471177911445 3.2842597447996993 208.72099547901203 3.2710176981806867 208.95192203202214 3.2576032066711278 209.15687144238044 3.2326080049219881 209.48565334621975 3.2207392065634544 209.6214488622964 3.2084220832166892 209.74086778055747 3.1956632541851522 209.841223344334 3.1824987868080563 209.9195218531847 3.1690046109869345 209.9730562872202 3.1553069337122155 209.99999993142859 3.1415926535897936 210 + 0 9 0.073876687960228921 7 0.18146279930185341 7 0.27297502317927325 7 0.35146796836731969 7 0.45078644852611266 7 0.50839166691615778 7 0.56599530822916722 7 0.63428155117843577 7 0.73589383894819183 7 0.87241439129297038 7 0.94164192250558687 7 1 9 +7 0 0 8 86 13 1.5707963267948968 65.825756949558411 1.6327154712662824 65.825756949558411 1.6932291717524472 65.864006867500905 1.7507575795202066 65.937442892223871 1.8052712051910964 66.036312569896907 1.856761496125801 66.15335170344234 1.9055415063953094 66.282483552944811 1.952099936317812 66.420471346860978 2.0629161296348029 66.778932482089601 2.1250872198225084 67.006800398456491 2.1853339544706767 67.244156185569551 2.2442620112456466 67.487414231305635 2.3025351264202438 67.733314062545347 2.3606629110135016 67.979402450812643 2.4192472016931634 68.223500209089394 2.5302050784324877 68.667615336463385 2.5817194923431264 68.866839100938464 2.6345541235314025 69.06107511247879 2.6893439271069774 69.248614551513228 2.746579728106743 69.426477008510119 2.8069200610078164 69.589274370436641 2.8708713445249514 69.730508107268591 2.9992017060969078 69.932606288496331 3.0640476966405026 70.004909868877107 3.1311719850682302 70.039355662624061 3.1983917367763195 70.028318240219718 3.2641727172498611 69.974453483590707 3.3272181349982342 69.886050094789667 3.3862870149554607 69.774683728264634 3.5081798163713582 69.498670248443474 3.5714250919605042 69.319625207022071 3.6315898963777626 69.124464927538256 3.6892108940849053 68.918088997427191 3.7449840031488155 68.70476714178713 3.7993700099136132 68.486956905337252 3.8529595443561395 68.266363258980974 3.937551875106212 67.914511323779521 3.9686270521261031 67.784481815413258 3.9997344878372516 67.654297451190075 4.0308853739217598 67.524679509972557 4.0620919606083179 67.396357443356322 4.0933675566722023 67.270068875670106 4.124726529435276 67.146559603975803 4.1876412188668342 66.906610876783731 4.2192025058601512 66.790155974378578 4.2508767385050721 66.677978633765278 4.2826801747989798 66.570823982696439 4.3146367579775191 66.469422533765098 4.346778116514594 66.374490184404721 4.3791435641223728 66.286728216889173 4.4504690845129815 66.11210000381476 4.491002003142964 66.024851515159256 4.5335175110851669 65.947703969718717 4.5780101363095511 65.884232047726371 4.6242947661492 65.838676004199897 4.671990288798467 65.815204415050005 4.7203649033722543 65.816217123196935 4.8385980686239742 65.873356695599171 4.9051850188102994 65.955074132754632 4.9674898644093322 66.072897682052684 5.0260608936826561 66.214413321800095 5.0812532833458581 66.371581754615221 5.1336879948128482 66.538559525712174 5.1841437822594489 66.713161178984919 5.3004316740301887 67.141550836337416 5.3644149845568734 67.397608881735124 5.4271937142726046 67.659694988105471 5.4894601011457427 67.92460429403188 5.5518865820242498 68.189151454086755 5.6151397004226302 68.450150063818768 5.6799108441584014 68.704352379472581 5.7820106096441055 69.070516194378229 5.8164404445381965 69.188355493726078 5.850946054836804 69.299959962125172 5.8855291296563488 69.404507511993899 5.9201917940156994 69.501233167507081 5.9549345429758302 69.589436335509944 5.9897541757794714 69.668488076432126 6.0540515696396966 69.796299944449615 6.084361898704401 69.849526935371983 6.1156117040988267 69.896686629941101 6.1478015408718143 69.936560691373231 6.1808677843451756 69.967806999600143 6.2146568822517638 69.989221486740504 6.2488996068735307 69.999999972571445 6.2831853071795862 70 + 0 9 0.073876687960228921 7 0.18146279930185341 7 0.27297502317927325 7 0.35146796836731969 7 0.45078644852611266 7 0.50839166691615778 7 0.56599530822916722 7 0.63428155117843577 7 0.73589383894819183 7 0.87241439129297038 7 0.94164192250558687 7 1 9 +7 0 0 8 23 4 3.1415926535897931 210 3.1210614961277394 210.00000010265583 3.1005291311075647 209.93977343220345 3.0802162982823336 209.81934542997405 3.060284995992693 209.64146807704995 3.0408510042354786 209.41030407615489 3.0219936054749454 209.13045541836325 3.0037625031966315 208.80633633462796 2.9570088239511896 207.83713099429386 2.9296594696116953 207.12197755130393 2.9040228867397606 206.31025246004447 2.8800610357605061 205.41069337265455 2.8577522026420392 204.42944864183883 2.8371056950111546 203.36899179251105 2.8181483011816177 202.22871149661322 2.7852216827921472 199.8723811516461 2.7709760875281595 198.67075640785762 2.7583507212744514 197.39099658337528 2.7475970196832398 196.03237707895312 2.739053731187802 194.5987376061355 2.7330886214394798 193.09989869850125 2.7300758075223053 191.554374056744 2.7300758075223053 190 + 0 9 0.23911948610599457 7 0.63591333721726562 7 1 9 +7 0 0 8 23 4 0 70 0.051327893655133572 70.000000041062307 0.1026585095332937 69.975913030090624 0.1536145142233849 69.927731557706068 0.20396142023838504 69.856930569898694 0.25355894084285602 69.765831025734656 0.30232997965063024 69.65711085521778 0.35024725499271447 69.533463217305211 0.47547900793230546 69.171622753195393 0.55125596438760471 68.911912620840965 0.62536924204793554 68.628209581487553 0.69830566983646758 68.329050162545343 0.77052910495163474 68.022247356855743 0.84253146084878594 67.71504812589032 0.91487134073599652 67.414277104885272 1.0559406020423046 66.864292017065196 1.1244501887663443 66.612974265628466 1.1944986103494166 66.379922852188102 1.2663529078851745 66.17381782714574 1.340143255040398 66.005326901049187 1.4158015554213002 65.886011034309178 1.4930776239576975 65.825756949558411 1.5707963267948966 65.825756949558411 + 0 9 0.23911948610599457 7 0.63591333721726562 7 1 9 +7 0 0 7 20 4 5.8716684611120975 190 5.8716684611120975 188.40529526822812 5.8749059028716166 186.81699263164407 5.8813321069643507 185.28146610968872 5.8904651265717982 183.8194733092634 5.9018780409367047 182.44087859992891 5.9151979318998391 181.14756859074458 5.9462084611711727 178.64894098900859 5.9641289663954833 177.45327801148096 5.9838251760732435 176.34076071834318 6.0052210062401752 175.31033358514742 6.0282871279818746 174.36355769593391 6.0530414572620703 173.50466322258802 6.1044269515590086 172.03087512917583 6.1308375000050619 171.40311466706285 6.1588814209752867 170.86877872094436 6.1884827860001463 170.44450690892319 6.2194178500469297 170.14859873510889 6.2512650406347934 170 6.2831853071795862 170 + 0 8 0.32749647483565042 6 0.67535626432716744 6 1 8 +7 0 0 7 20 4 4.7123889803846897 134.17424305044165 4.6326537437960944 134.17424305044165 4.5532394662454161 134.10950158823803 4.4756303392982897 133.98093441747497 4.4000913717954164 133.80144025823813 4.3266832464327729 133.58463698586775 4.2551915157717408 133.34204238483454 4.1106230834163906 132.80607638506953 4.0376765392582641 132.51031302161269 3.9653735469234719 132.20408324999829 3.8931647386010106 131.89522935165351 3.8205023141418311 131.591632576276 3.7468598154328787 131.30105579191766 3.6010565258622278 130.78164824019552 3.5290824764252773 130.54984232049199 3.4551199134103063 130.34511406165251 3.3790487521878019 130.1778232028887 3.3010107446235413 130.05943531939073 3.2213933199517744 130 3.1415926535897931 130 + 0 8 0.32749647483565042 6 0.67535626432716744 6 1 8 +1 6.2831853071795862 -0 0 1 +1 0 -0 0 1 +7 0 0 7 20 4 0 170 0.030225785850175768 170 0.060403942208535177 170.13323829157676 0.089809656452376707 170.39892023771003 0.11805541204867875 170.78166224300142 0.14492818020641529 171.26570088958786 0.17034350106111606 171.83645995042141 0.22097719814426409 173.20566738156501 0.24587007505197889 174.02300961145505 0.26911311729308007 174.92708234710466 0.29073064043857233 175.91279129804428 0.31070894112663172 176.97782263526184 0.32899625972681701 178.12264337007468 0.36230785920280351 180.61524721177804 0.37725325445837399 181.9676846606753 0.39011764872841503 183.41728858328361 0.40046937309713293 184.96339172675098 0.40780791812416606 186.59601333953287 0.41151684606748784 188.29315701982478 0.41151684606748784 190 + 0 8 0.30759457669048318 6 0.64982227833657946 6 1 8 +7 0 0 7 20 4 3.1415926535897931 130 3.0660281889643519 130 2.990583169127206 130.05329228421115 2.9164748151389448 130.15958274693631 2.8440992178683127 130.31074365945841 2.7736158232905277 130.49706344959191 2.70495819896867 130.70955796991018 2.5631379941723229 131.19840252074181 2.490285660793738 131.47942926704206 2.4185365367169682 131.77519479638855 2.3473926232230196 132.07805706842547 2.2763352439147004 132.38049995237745 2.2048371881245359 132.67525479805303 2.0576203695522826 133.23927066004759 1.9818085176967826 133.50790196241167 1.9039233721279634 133.75038739924142 1.8236483193528268 133.95324155007785 1.7409942942068719 134.10007506789546 1.6561384758036586 134.17424305044159 1.5707963267948966 134.17424305044159 + 0 8 0.30759457669048318 6 0.64982227833657946 6 1 8 +7 0 0 7 20 4 0 210 0.030225781949774877 210.00000015112892 0.060403947046212103 209.86676130590678 0.089809652021665798 209.60108031223749 0.11805541820573318 209.218337305402 0.14492817656264201 208.73429928613263 0.17034350101405416 208.16354005084071 0.22097719814238648 206.79433261849749 0.24587007505078695 205.97699038859366 0.26911311729224341 205.07291765293593 0.29073064043839469 204.0872087019697 0.31070894112672143 203.02217736473835 0.32899625972729307 201.87735662989815 0.36230785920336483 199.38475278817143 0.37725325445872215 198.03231533928286 0.390117648728741 196.58271141667572 0.40046937309720754 195.03660827322122 0.40780791812423445 193.40398666044547 0.41151684606748784 191.70684298016479 0.41151684606748784 190 + 0 8 0.30759457708374965 6 0.64982227853976171 6 1 8 +7 0 0 7 20 4 0 130 0.075564454874439413 129.99999993954845 0.15100949674968245 130.05329244438005 0.22511782661739943 130.15958252985621 0.29749345235156621 130.31074383584001 0.36797682046048319 130.49706338173036 0.43663445448953642 130.70955796945879 0.57845465941195773 131.19840252072038 0.65130699279232651 131.47942926702643 0.72305611686996407 131.77519479637638 0.79420003036601372 132.07805706842194 0.86525740967521614 132.38049995237844 0.9367554654670105 132.67525479806048 1.083972284040347 133.23927066005763 1.1597841358952055 133.50790196241874 1.237669281464072 133.75038739924679 1.3179443342382484 133.95324155008026 1.4005983593840572 134.10007506789648 1.4854541777866581 134.17424305044159 1.5707963267948966 134.17424305044159 + 0 8 0.30759457708374965 6 0.64982227853976171 6 1 8 +1 0 300 1 0 +2 0 0 1 0 -0 1 50 +7 0 0 7 20 4 5.8716684611120975 190 5.8716684611120975 191.59470473177032 5.8749059028716193 193.18300736835764 5.8813321069643223 194.71853389030395 5.8904651265718124 196.18052669073927 5.9018780409366576 197.55912140006541 5.9151979318998142 198.85243140925283 5.9462084611708423 201.35105901096543 5.9641289663948038 202.54672198847359 5.9838251760721368 203.65923928159609 6.0052210062386386 204.68966641477729 6.0282871279797714 205.63644230398049 6.0530414572594031 206.49533677731949 6.1044269515080547 207.96912486937774 6.1308374961490646 208.59688514306879 6.1588814275196162 209.13122176228288 6.1884827812567487 209.55549250885861 6.2194178552699579 209.85140168924835 6.2512650364101381 209.99999984039866 6.2831853071795862 210 + 0 8 0.32749647504072238 6 0.67535626474437049 6 1 8 +7 0 0 7 20 4 4.7123889803846897 134.17424305044165 4.792124216973205 134.17424305044165 4.871538494524069 134.109501588238 4.9491476214706687 133.98093441747562 5.0246865889741397 133.80144025823762 5.0980947143362885 133.58463698586883 5.1695864449974964 133.342042384835 5.3141548773514753 132.80607638507519 5.3871014215083353 132.51031302162392 5.4594044138419315 132.20408325001534 5.5316132221631182 131.89522935167579 5.60427564662095 131.59163257630365 5.677918145328567 131.30105579194895 5.8237214347629163 130.78164824070652 5.8956954738428466 130.54984239343437 5.9696580651840625 130.34511387364307 6.0457291958282866 130.17782343218008 6.1237672294309933 130.05943515068626 6.2033846302559654 130.00000006384056 6.2831853071795862 130 + 0 8 0.32749647504072238 6 0.67535626474437049 6 1 8 +1 6.2831853071795862 -0 0 1 +1 0 -0 0 1 +1 0 200 1 0 +2 0 0 1 0 -0 1 20 +1 0 40 1 0 +1 0 0 1 0 +2 0 0 1 0 -0 1 20 +1 0 160 1 0 +Curves 18 +2 0 0 800 0 0 1 1 0 -0 -0 1 0 100 +7 0 0 8 23 4 86.602540378443834 -50.000000000000043 400 86.602540378443834 -50.000000000000043 396.4531264233774 86.768554360301678 -49.712441623392252 392.92833608277681 87.096991301103003 -49.143655969881841 389.51230084494648 87.559643674082039 -48.329700648459557 386.24424709027198 88.124612677937151 -47.303758601946697 383.14348794697975 88.763476885346648 -46.096633933969066 380.21545709727701 89.453947255999054 -44.730534623268426 377.45508725218542 90.961452312325122 -41.584580251230875 372.04985730479018 91.784169844339857 -39.781402281845395 369.42820567367704 92.631457510690922 -37.81125762107866 366.96284011636072 93.48864237267378 -35.675359427746407 364.64644480202827 94.341495300176689 -33.371375094216411 362.47799188863092 95.175736723592081 -30.894400229760695 360.46051727651405 95.976668732951339 -28.235197605551782 358.60197280754011 97.413920783548775 -22.756398616550438 355.37514358939779 98.05887438439548 -19.967859727516355 353.97770142062154 98.646808131230941 -17.001060903351803 352.74076825489283 99.157716247916952 -13.856554777440659 351.69171562635694 99.568620170602742 -10.546176703746648 350.86267948835513 99.855699662295592 -7.0960544318152783 350.28862243838159 99.999999822335354 -3.55329295081635 350.00000035532935 100 0 350 + 0 9 0.32715155003298801 7 0.67848367377663077 7 1 9 +1 100 -2.4492127076447545e-14 0 0 0 1 +2 0 0 0 0 0 1 1 0 -0 -0 1 0 100 +7 0 0 8 23 4 100 0 350 100.00000016788265 3.357653056092063 349.99999966423474 99.871153979567325 6.7082922507060294 350.25770810060493 99.614413693494157 9.9811535532793023 350.77111458667099 99.244989236204319 13.133667254014087 351.51570531988671 98.782719490160005 16.14106204554367 352.46209608878792 98.247314081381845 18.991065369133018 353.58237755135616 97.656293340043064 21.681267443995591 354.85222820605424 96.305069830741061 27.094898672399299 357.84920888955003 95.532205610731751 29.776083412862121 359.61622715531161 94.722154327365587 32.277992523382729 361.54040041871144 93.889578416120571 34.609753071732321 363.61204164396673 93.048311226451844 36.776998731952766 365.8264229027584 92.211706870163113 38.783329440035715 368.18305324271273 91.393072001530825 40.629443402342417 370.68769525783222 89.809460344875703 44.020678864939597 376.0736018517199 89.045865019642378 45.559762660744155 378.9594576910697 88.333353522290722 46.923337441037496 382.03427944841542 87.697209384435155 48.087216148864847 385.30662787333353 87.171127692761729 49.015295205844701 388.77333266748747 86.793973628457792 49.668405227687359 392.41514581060738 86.602540378443862 50 396.1912597343462 86.602540378443862 50 400 + 0 9 0.30404471865854837 7 0.64918916271671423 7 1 9 +7 0 0 8 23 4 100 0 450 100 3.3576535464432191 450 99.871154312247143 6.7082918702808545 449.74229256882165 99.614413450153194 9.9811536835594623 449.22888491692595 99.244989177299104 13.133667136739369 448.48429456674455 98.782719765236706 16.141061698735722 447.53790447273542 98.247313911152233 18.991065751063456 446.41762209624159 97.656293338930354 21.681267448453593 445.14777179147779 96.305069830740891 27.09489867239995 442.15079111044957 95.532205610732319 29.776083412860999 440.38377284469061 94.722154327364748 32.277992523383702 438.45959958128537 93.88957841612077 34.609753071732086 436.38795835603389 93.048311226452682 36.776998731951778 434.17357709724484 92.211706870162118 38.783329440037349 431.81694675728357 91.393072001531223 40.629443402341558 429.31230474216915 89.809460344875973 44.020678864939015 423.92639814828101 89.045865019641511 45.559762660746543 421.04054230892496 88.333353522292256 46.923337441033972 417.96572055159834 87.697209384433535 48.087216148866737 414.6933721266472 87.17112769276271 49.015295205845263 411.22666733252822 86.793973628457522 49.668405227686577 407.58485418938534 86.602540378443862 50 403.80874026565544 86.602540378443862 50 400 + 0 9 0.30404471828653629 7 0.64918916252934122 7 1 9 +7 0 0 8 23 4 86.602540378443834 -50.000000000000043 400 86.602540378443834 -50.000000000000043 403.54687357661732 86.768554360302232 -49.712441623391754 407.0716639172436 87.09699130110117 -49.143655969883547 410.487699155016 87.559643674084654 -48.329700648456935 413.75575290976724 88.124612677935062 -47.303758601949092 416.85651205299661 88.763476885347615 -46.096633933967624 419.78454290273055 89.453947255998813 -44.730534623268937 422.54491274781367 90.961452312325036 -41.584580251231031 427.95014269520948 91.784169844340013 -39.781402281845253 430.57179432632284 92.631457510690936 -37.811257621078354 433.03715988364036 93.488642372673581 -35.675359427746841 435.35355519797133 94.341495300176646 -33.37137509421671 437.52200811136817 95.175736723592308 -30.89440022975991 439.53948272348691 95.976668732951225 -28.235197605552226 441.39802719245961 97.413920784822892 -22.756398611693562 444.62485641346274 98.058874567884601 -19.967859324472435 446.02229896119849 98.646807838010218 -17.001061271986877 447.25923114449233 99.157716307234622 -13.856554899211012 448.30828448674504 99.568620428735201 -10.546176567483982 449.13732104001321 99.855699311461152 -7.0960548419637099 449.71137685489032 100 -3.5532924194227782 450 100 0 450 + 0 9 0.32715154983796968 7 0.67848367337201809 7 1 9 +7 0 0 8 86 13 190 20 445.82575694955841 188.76161711057227 20 445.82575694955841 187.55133668015193 19.91235337387026 445.86400686750096 186.40804485479049 19.744123905050216 445.93744289222383 185.33795497726547 19.514902285540977 446.03631256989695 184.34258844053036 19.237873159851539 446.15335170344235 183.4162771353935 18.925064118927583 446.28248355294483 182.54924607309326 18.582260868803356 446.42047134686101 180.5313877921306 17.665560569655433 446.7789324820896 179.44012090542088 17.061450737150739 447.00680039845656 178.42489439075112 16.40377787695131 447.2441561855693 177.47714125871727 15.694221315276218 447.4874142313061 176.58765276942751 14.933544392727526 447.73331406254499 175.75234570339671 14.118946812391625 447.97940245081276 174.96696097018872 13.245592454199262 448.22350020908942 173.60217638596475 11.495728687255017 448.66761533646343 173.01544757903642 10.646755069979088 448.86683910093825 172.46336132523098 9.7423084173559129 449.0610751124795 171.94696597602535 8.771423029278985 449.24861455151228 171.47070368601692 7.7249441623440038 449.42647700851086 171.044924719389 6.5904239412074901 449.58927437043644 170.68192128165288 5.3591604830220598 449.73050810726863 170.16788483391167 2.8445553031042996 449.93260628849634 169.98675095042276 1.5578500753039846 450.00490986887729 169.90241768877223 0.21126482985045633 450.03935566262362 169.92983296212577 -1.1418347912938847 450.02831824022019 170.06246027525333 -2.4583899354909087 449.97445348359048 170.28378283343829 -3.704622003922788 449.88605009478971 170.56795276727468 -4.8532125714778402 449.77468372826468 171.28490034470798 -7.1832615379201048 449.49867024844349 171.75813983885746 -8.3610693252848058 449.31962520702172 172.28669212661248 -9.4474000731872163 449.12446492753941 172.86264456356133 -10.451521549066081 448.91808899742563 173.47925753251525 -11.386037243846355 448.70476714178824 174.13467786991569 -12.258255622356449 448.48695690533697 174.82956714675092 -13.076870757778455 448.26636325898102 176.00111900189935 -14.297448989351548 447.91451132377955 176.44739232078726 -14.730560988794394 447.78448181541324 176.90942117645849 -15.148186634249697 447.65429745119013 177.38676190073474 -15.549790747042026 447.5246795099726 177.87897923803828 -15.934838498820188 447.39635744335635 178.38564634539176 -16.302795411557238 447.27006887567012 178.90634479241825 -16.653127357550481 447.14655960397596 179.97496970201598 -17.317464667277328 446.90661087678365 180.52299721930251 -17.631473643437698 446.79015597437859 181.08420673921333 -17.926789246506338 446.67797863376529 181.65818491571483 -18.202858939283349 446.57082398269648 182.24464543072799 -18.459115888765186 446.469422533765 182.84342899412766 -18.694978966144653 446.37449018440464 183.45450334374323 -18.909852746810909 446.28672821688906 184.81704385450712 -19.332245100108075 446.1121000038147 185.60147540318962 -19.539596822360508 446.02485151515918 186.43393805468477 -19.720072090406671 445.94770396971876 187.31387149619184 -19.866415718649087 445.8842320477263 188.23647567906212 -19.970468445414252 445.83867600419984 189.1915419192367 -20.02405348878451 445.81520441504995 190.16041200836165 -20.021926857902038 445.81621712319691 192.52143481281828 -19.89076336064802 445.87335669559917 193.84478773876532 -19.702761135389348 445.95507413275465 195.06679581640853 -19.429423733772833 446.07289768205271 196.19442250073351 -19.093863615052797 446.21441332180007 197.2339901412731 -18.710705503299977 446.37158175461525 198.19784034352128 -18.29082509447235 446.53855952571217 199.100910190511 -17.836992814585784 446.71316117898493 201.11765616922102 -16.678595142648216 447.14155083633744 202.17669187279171 -15.953143137007794 447.39760888173515 203.16359594026292 -15.168455096124706 447.6596949881054 204.08585426002017 -14.322479844337014 447.92460429403201 204.9499797977617 -13.41268261852915 448.1891514540867 205.75731315708825 -12.431663425542878 448.4501500638188 206.5085724462667 -11.371142075518817 448.7043523794726 207.55059273349855 -9.6150274534363902 449.07051619437817 207.87877699148535 -9.0090680862683605 449.18835549372614 208.18373555748497 -8.3889992621684186 449.29995996212511 208.46471177911445 -7.7557979054120896 449.40450751199393 208.72099547901203 -7.1104820307283623 449.50123316750705 208.95192203202214 -6.4541494263144097 449.5894363355099 209.15687144238044 -5.7880163368502879 449.66848807643208 209.48565334621975 -4.5448090320959809 449.7962999444498 209.6214488622964 -3.9537215627022064 449.84952693537196 209.74086778055747 -3.3395736896957944 449.89668662994114 209.841223344334 -2.702739282198082 449.93656069137319 209.9195218531847 -2.0451075411731523 449.9678069996001 209.9730562872202 -1.3706044135127382 449.98922148674052 209.99999993142859 -0.68571400612111455 449.9999999725714 210 -9.1940344226770776e-17 450 + 0 9 0.073876687960228921 7 0.18146279930185341 7 0.27297502317927325 7 0.35146796836731969 7 0.45078644852611266 7 0.50839166691615778 7 0.56599530822916722 7 0.63428155117843577 7 0.73589383894819183 7 0.87241439129297038 7 0.94164192250558687 7 1 9 +7 0 0 8 23 4 210 0 450 210.00000010265583 1.0265578731026479 450.00000004106238 209.93977343220345 2.0531775184097456 449.97591303009051 209.81934542997405 3.0681562548346761 449.92773155770618 209.64146807704995 4.0627445455190339 449.85693056989879 209.41030407615489 5.0306400381813221 449.76583102573477 209.13045541836325 5.967555357915689 449.65711085521787 208.80633633462796 6.8708596524406813 449.53346321730521 207.83713099429386 9.18036994382215 449.17162275319538 207.12197755130393 10.523829394329878 448.91191262084078 206.31025246004447 11.774932713181144 448.62820958148819 205.41069337265455 12.936028214861254 448.32905016254443 204.42944864183883 14.00912988520586 448.02224735685644 203.36899179251105 14.995089694532629 447.71504812589012 202.22871149661322 15.894132086087689 447.41427710488529 199.8723811516461 17.445880100292989 446.86429201706522 198.67075640785762 18.112500879287495 446.61297426562851 197.39099658337528 18.699329061251035 446.37992285218809 196.03237707895312 19.196046924645117 446.17381782714585 194.5987376061355 19.588584661696704 446.00532690104916 193.09989869850125 19.861934582966615 445.88601103430921 191.554374056744 20 445.82575694955841 190 20 445.82575694955841 + 0 9 0.23911948610599457 7 0.63591333721726562 7 1 9 +7 0 0 7 20 4 190 -20.000000000000004 354.17424305044159 188.40529526822812 -20.000000000000004 354.17424305044159 186.81699263164407 -19.85163748421305 354.10950158823778 185.28146610968872 -19.557176296119984 353.98093441747551 183.8194733092634 -19.137252010782827 353.80144025823751 182.44087859992891 -18.609272595736567 353.58463698586797 181.14756859074458 -17.988894519498103 353.34204238483449 178.64894098900859 -16.533946836137474 352.8060763850695 177.45327801148096 -15.688010730209923 352.51031302161272 176.34076071834318 -14.751671354023641 352.20408324999806 175.31033358514742 -13.726821040656557 351.89522935165371 174.36355769593391 -12.613431647889318 351.59163257627586 173.50466322258802 -11.409602762233769 351.30105579191763 172.03087512917583 -8.8933777413809842 350.78164824019547 171.40311466706285 -7.5928607668802197 350.54984232049196 170.86877872094436 -6.2046298165562233 350.34511406165245 170.44450690892319 -4.7324669523921434 350.1778232028887 170.14859873510889 -3.188373618690417 350.05943531939067 170 -1.5960133272396184 349.99999999999994 170 0 349.99999999999994 + 0 8 0.32749647483565042 6 0.67535626432716744 6 1 8 +1 50 -1.2246063538223773e-14 0 0 0 1 +7 0 0 7 20 4 170 0 350 170 1.5112892925088235 350 170.13323829157676 3.0201974972875441 350.05329228421118 170.39892023771003 4.4882262522719127 350.15958274693634 170.78166224300142 5.8937836338085239 350.31074365945841 171.26570088958786 7.2253835508502897 350.49706344959191 171.83645995042141 8.4787047126246602 350.70955796991018 173.20566738156501 10.962745615245275 351.19840252074181 174.02300961145505 12.175956849896046 351.47942926704201 174.92708234710466 13.300618833567951 351.77519479638875 175.91279129804428 14.338824970520468 352.07805706842532 176.97782263526184 15.29122457343451 352.38049995237753 178.12264337007468 16.156924091174648 352.67525479805306 180.61524721177804 17.724100774430205 353.23927066004762 181.9676846606753 18.42161104257076 353.50790196241178 183.41728858328361 19.017546268068447 353.75038739924128 184.96339172675098 19.493771560366365 353.95324155007802 186.59601333953287 19.830029166827707 354.10007506789543 188.29315701982478 19.999999999999982 354.17424305044159 190 19.999999999999982 354.17424305044159 + 0 8 0.30759457669048318 6 0.64982227833657946 6 1 8 +7 0 0 7 20 4 210 0 350 210.00000015112892 1.5112890974887772 349.99999993954845 209.86676130590678 3.0201977385758565 350.05329244438008 209.60108031223749 4.4882260331561916 350.15958252985627 209.218337305402 5.8937839375949101 350.31074383584001 208.73429928613263 7.2253833710765241 350.49706338173036 208.16354005084071 8.4787047103152631 350.70955796945879 206.79433261849749 10.962745615153812 351.19840252072038 205.97699038859366 12.175956849838967 351.47942926702643 205.07291765293593 13.300618833526656 351.77519479637635 204.0872087019697 14.338824970513437 352.07805706842197 203.02217736473835 15.291224573438482 352.38049995237844 201.87735662989815 16.156924091197233 352.67525479806051 199.38475278817143 17.724100774456375 353.23927066005763 198.03231533928286 18.421611042587735 353.50790196241871 196.58271141667572 19.017546268081134 353.75038739924679 195.03660827322122 19.493771560372139 353.95324155008029 193.40398666044547 19.830029166829849 354.10007506789646 191.70684298016479 19.999999999999982 354.17424305044159 190 19.999999999999982 354.17424305044159 + 0 8 0.30759457708374965 6 0.64982227853976171 6 1 8 +2 0 0 300 0 0 1 1 0 -0 -0 1 0 50 +7 0 0 7 20 4 190 -20.000000000000004 354.17424305044159 191.59470473177032 -20.000000000000004 354.17424305044165 193.18300736835764 -19.851637484212873 354.10950158823789 194.71853389030395 -19.557176296121398 353.98093441747574 196.18052669073927 -19.13725201078212 353.80144025823745 197.55912140006541 -18.609272595738776 353.58463698586883 198.85243140925283 -17.988894519499269 353.34204238483494 201.35105901096543 -16.533946836152985 352.80607638507519 202.54672198847359 -15.688010730242384 352.51031302162386 203.65923928159609 -14.751671354075334 352.2040832500154 204.68966641477729 -13.726821040731068 351.89522935167571 205.63644230398049 -12.613431647990538 351.59163257630365 206.49533677731949 -11.409602762363491 351.30105579194895 207.96912486937774 -8.8933777438768757 350.78164824070649 208.59688514306879 -7.592860956872455 350.54984239343435 209.13122176228288 -6.2046294940723943 350.34511387364302 209.55549250885861 -4.7324671867573436 350.17782343218005 209.85140168924835 -3.1883733582241396 350.05943515068623 209.99999984039866 -1.5960135384724008 350.0000000638405 210 0 349.99999999999994 + 0 8 0.32749647504072238 6 0.67535626474437049 6 1 8 +1 20 -4.898425415289509e-15 0 0 0 1 +2 0 0 200 0 0 1 1 0 -0 -0 1 0 20 +2 0 0 0 0 0 1 1 0 -0 -0 1 0 20 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 8 +1 0 0 800 0 0 1 1 0 -0 -0 1 0 +2 0 0 0 0 0 1 1 0 -0 -0 1 0 100 +2 0 0 0 0 0 1 1 0 -0 -0 1 0 50 +1 0 0 0 0 0 1 1 0 -0 -0 1 0 +2 0 0 0 0 0 1 1 0 -0 -0 1 0 20 +1 0 0 300 0 0 1 1 0 -0 -0 1 0 +1 0 0 200 0 0 1 1 0 -0 -0 1 0 +1 0 0 0 0 0 1 1 0 -0 -0 1 0 +Triangulations 0 + +TShapes 57 +Ve +1e-07 +100 -2.44921270764475e-14 800 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 1 0 0 6.28318530717959 +2 1 2 0 0 6.28318530717959 +2 2 1 0 0 6.28318530717959 +0 + +0101100 ++57 0 -57 0 * +Wi + +0101000 ++56 0 * +Fa +0 1e-07 1 0 + +0101000 ++55 0 * +Ve +3.77011308578173e-06 +86.6025403784438 -50 400 +0 0 + +0101101 +* +Ve +3.77011308578173e-06 +100 -1.83690953073357e-14 350 +0 0 + +0101101 +* +Ed + 3.77011308578173e-06 1 1 0 +1 2 0 0 1 +2 3 2 0 0 1 +2 4 3 1 0 1 +0 + +0101000 ++53 0 -52 0 * +Ve +1e-07 +100 -2.44921270764475e-14 0 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 3 0 0 350 +3 5 6CN 2 0 0 350 +0 + +0101000 ++50 0 -52 0 * +Ed + 1e-07 1 1 0 +1 4 0 0 6.28318530717959 +2 7 2 0 0 6.28318530717959 +2 8 4 0 0 6.28318530717959 +0 + +0101100 ++50 0 -50 0 * +Ve +3.77011308578173e-06 +86.6025403784439 50 400 +0 0 + +0101101 +* +Ed + 3.77011308578173e-06 1 1 0 +1 5 0 0 1 +2 9 2 0 0 1 +2 10 3 1 0 1 +0 + +0101000 ++52 0 -47 0 * +Ve +3.77011308578173e-06 +100 -2.44921270764475e-14 450 +0 0 + +0101101 +* +Ed + 3.77011308578173e-06 1 1 0 +1 6 0 0 1 +2 11 2 0 0 1 +2 12 3 1 0 1 +0 + +0101000 ++45 0 -47 0 * +Ed + 1e-07 1 1 0 +1 3 0 450 800 +3 5 6CN 2 0 450 800 +0 + +0101000 ++45 0 -57 0 * +Ed + 3.77011308578173e-06 1 1 0 +1 7 0 0 1 +2 13 2 0 0 1 +2 14 3 1 0 1 +0 + +0101000 ++53 0 -45 0 * +Wi + +0101000 +-51 0 +49 0 +48 0 -49 0 -46 0 +44 0 -43 0 -56 0 +43 0 +42 0 +* +Fa +0 1e-07 2 0 + +0101000 ++41 0 * +Ve +7.99539616382488e-05 +190 20 445.825756949558 +0 0 + +0101101 +* +Ve +7.99539616382488e-05 +210 -4.89842541528951e-15 450 +0 0 + +0101101 +* +Ed + 7.99539616382488e-05 1 1 0 +1 8 0 0 1 +2 15 3 1 0 1 +2 16 5 2 0 1 +0 + +0101000 ++39 0 -38 0 * +Ed + 7.99539616382488e-05 1 1 0 +1 9 0 0 1 +2 17 3 1 0 1 +2 18 5 2 0 1 +0 + +0101000 ++38 0 -39 0 * +Wi + +0101000 +-37 0 -36 0 * +Ve +1.92831599071361e-06 +190 -20 354.174243050442 +0 0 + +0101101 +* +Ve +1.92831599071361e-06 +170 -1.22460635382238e-14 350 +0 0 + +0101101 +* +Ed + 1.92831599071361e-06 1 1 0 +1 10 0 0 1 +2 19 3 1 0 1 +2 20 5 3 0 1 +0 + +0101000 ++34 0 -33 0 * +Ed + 1e-07 1 1 0 +1 11 0 100 170 +3 21 22CN 3 0 100 170 +0 + +0101000 ++52 4 -33 4 * +Ve +1.92831599071361e-06 +190 20 354.174243050442 +0 0 + +0101101 +* +Ed + 1.92831599071361e-06 1 1 0 +1 12 0 0 1 +2 23 3 1 0 1 +2 24 5 3 0 1 +0 + +0101000 ++33 0 -30 0 * +Ve +1.92831599071361e-06 +210 -8.57224447675664e-15 350 +0 0 + +0101101 +* +Ed + 1.92831599071361e-06 1 1 0 +1 13 0 0 1 +2 25 3 1 0 1 +2 26 5 3 0 1 +0 + +0101000 ++28 0 -30 0 * +Ve +1e-07 +50 -1.22460635382238e-14 300 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 11 0 210 300 +3 21 22CN 3 0 210 300 +0 + +0101000 ++28 4 -26 0 * +Ed + 1e-07 1 1 0 +1 14 0 0 6.28318530717959 +2 27 3 0 0 6.28318530717959 +2 28 6 0 0 6.28318530717959 +0 + +0101100 ++26 0 -26 0 * +Ed + 1.92831599071361e-06 1 1 0 +1 15 0 0 1 +2 29 3 1 0 1 +2 30 5 3 0 1 +0 + +0101000 ++34 0 -28 0 * +Wi + +0101000 +-32 0 +31 1 +51 0 -42 0 -44 0 +46 0 -31 1 -29 0 +27 0 -25 1 +-24 1 +25 1 +23 0 * +Fa +0 1e-07 3 1 + +0101000 ++35 0 +22 0 * +Wi + +0101000 +-48 0 * +Fa +0 1e-07 4 0 + +0101000 +-20 0 * +Ve +1e-07 +20 -4.89842541528951e-15 200 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 16 0 70 200 +3 31 32CN 5 0 70 200 +0 + +0101000 ++38 5 -18 0 * +Ed + 1e-07 1 1 0 +1 17 0 0 6.28318530717959 +2 33 5 0 0 6.28318530717959 +2 34 7 0 0 6.28318530717959 +2 35 5 6 0 6.28318530717959 +0 + +0101100 ++18 0 -18 0 * +Wi + +0101000 ++36 0 -17 2 -16 2 +17 2 +37 0 * +Fa +0 1e-07 5 2 + +0101000 ++15 0 * +Ve +1e-07 +20 -4.89842541528951e-15 0 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 16 0 0 130 +3 31 32CN 5 0 0 130 +0 + +0101000 ++13 0 -28 7 * +Ed + 1e-07 1 1 0 +1 18 0 0 6.28318530717959 +2 36 5 0 0 6.28318530717959 +2 37 8 0 0 6.28318530717959 +2 38 5 8 0 6.28318530717959 +0 + +0101100 ++13 0 -13 0 * +Wi + +0101000 +-23 0 +12 3 +11 3 -12 3 -27 0 +29 0 +32 0 * +Fa +0 1e-07 5 3 + +0101000 ++10 0 * +Wi + +0101000 ++24 0 * +Fa +0 1e-07 6 0 + +0101000 ++8 0 * +Wi + +0101000 ++16 0 * +Fa +0 1e-07 7 0 + +0101000 ++6 0 * +Wi + +0101000 +-11 0 * +Fa +0 1e-07 8 0 + +0101000 +-4 0 * +Sh + +0101000 ++54 0 +40 0 +21 0 -19 0 +14 0 +9 0 +7 1 +5 2 -3 3 * +So + +0100000 ++2 0 * + ++1 0 diff --git a/src/TEST_PY/test_unit/troisCylindres_v5.py b/src/TEST_PY/test_unit/troisCylindres_v5.py new file mode 100644 index 0000000..27dd1f9 --- /dev/null +++ b/src/TEST_PY/test_unit/troisCylindres_v5.py @@ -0,0 +1,216 @@ +# -*- coding: latin-1 -*- +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# Francis KLOSS : 2012 : CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France +# ======================================================================================== + +import geompy +import hexablock + +# Charger la geometrie +# ==================== + +nom = "troisCylindres" + +piece = geompy.ImportBREP(nom+".brep") + +# Selectionner des sous-parties de la geometrie +# --------------------------------------------- + +sommets = geompy.SubShapeAllSortedCentres(piece, geompy.ShapeType["VERTEX"]) +aretes = geompy.SubShapeAllSortedCentres(piece, geompy.ShapeType["EDGE" ]) + +moy_b_x, moy_b_y, moy_b_z = geompy.PointCoordinates(sommets[14]) +moy_p_x, moy_p_y, moy_p_z = geompy.PointCoordinates(sommets[ 6]) +moy_g_x, moy_g_y, moy_g_z = geompy.PointCoordinates(sommets[ 3]) + +grand0, grand_xb, grand_yb, grand_zb, grand1, grand2, grand3, grand_rayon = geompy.KindOfShape(aretes[ 0]) +grand4, grand_xh, grand_yh, grand_zh, grand5, grand6, grand7, grand8 = geompy.KindOfShape(aretes[ 1]) + +moyen0, moyen_x , moyen_y , moyen_z , moyen1, moyen2, moyen3, moyen_rayon = geompy.KindOfShape(aretes[20]) + +petit0, petit_xb, petit_yb, petit_zb, petit1, petit2, petit3, petit_rayon = geompy.KindOfShape(aretes[12]) +petit4, petit_xh, petit_yh, petit_zh, petit5, petit6, petit7, petit8 = geompy.KindOfShape(aretes[13]) + +# Construire le modele de bloc +# ============================ + +doc = hexablock.addDocument(nom) + +doc.addShape(piece,nom) + +# Construire le grand cylindre +# ---------------------------- + +grand_base = doc.addVertex(grand_xb, grand_yb, grand_zb) +grand_oppo = doc.addVertex(grand_xh, grand_yh, grand_zh) + +grand_dir = doc.addVectorVertices(grand_base, grand_oppo) + +grand_hauteur = grand_dir.getNorm() + +grand_cylindre = doc.addCylinder(grand_base, grand_dir, grand_rayon, grand_hauteur) + +# Construire le moyen cylindre cote grand +# --------------------------------------- + +moy_g_r1 = 0.8 +moy_g_r2 = 0.5 + +moy_g_base_x = moy_p_x + (moy_g_x-moy_p_x)*moy_g_r1 + moyen_x - moy_b_x +moy_g_base_y = moy_p_y + (moy_g_y-moy_p_y)*moy_g_r1 + moyen_y - moy_b_y +moy_g_base_z = moy_p_z + (moy_g_z-moy_p_z)*moy_g_r1 + moyen_z - moy_b_z + +moy_g_base = doc.addVertex(moy_g_base_x, moy_g_base_y, moy_g_base_z) +moy_g_oppo = doc.addVertex( (grand_xh+grand_xb) * moy_g_r2, (grand_yh+grand_yb) * moy_g_r2, (grand_zh+grand_zb) * moy_g_r2 ) + +moy_g_dir = doc.addVectorVertices(moy_g_base, moy_g_oppo) + +moy_g_hauteur = moy_g_dir.getNorm() + +moy_g_cylindre = doc.addCylinder(moy_g_base, moy_g_dir, moyen_rayon, moy_g_hauteur) + +# Construire le moyen cylindre cote petit +# --------------------------------------- + +moy_p_r = 0.18 + +moy_p_base = doc.addVertex(moyen_x, moyen_y, moyen_z) +moy_b_base = doc.addVertex(moy_b_x, moy_b_y, moy_b_z) +moy_p_oppo = doc.addVertex( moy_p_x+(moy_g_x-moy_p_x) * moy_p_r, moy_p_y+(moy_g_y-moy_p_y) * moy_p_r, moy_p_z+(moy_g_z-moy_p_z) * moy_p_r ) + +moy_p_dir = doc.addVectorVertices(moy_b_base, moy_p_oppo) + +moy_p_hauteur = moy_p_dir.getNorm() + +moy_p_cylindre = doc.addCylinder(moy_p_base, moy_p_dir, moyen_rayon, moy_p_hauteur) + +# Construire le petit cylindre +# ---------------------------- + +petit_base = doc.addVertex(petit_xb, petit_yb, petit_zb) +petit_oppo = doc.addVertex(petit_xh, petit_yh, petit_zh) + +petit_dir = doc.addVectorVertices(petit_base, petit_oppo) + +petit_hauteur = petit_dir.getNorm() + +petit_cylindre = doc.addCylinder(petit_base, petit_dir, petit_rayon, petit_hauteur) + +# Construire le T et la X +# ----------------------- + +en_te = doc.makeCylinders(grand_cylindre, moy_g_cylindre) +croix = doc.makeCylinders(moy_p_cylindre, petit_cylindre) + +# Relier le T et la X +# ------------------- + +croix_quads = [] + +for i in xrange(1, -1, -1): + for j in xrange( [hexablock.CV_MAXI_INT, hexablock.CV_MAXI_EXT][i] ): + quad = croix.getQuadIJ(hexablock.CYL_BIG, i, j, hexablock.CYL_BIG_SLICES) + croix_quads.append(quad) + +en_te_q = en_te.getQuadIJ(hexablock.CYL_SMALL, 1, hexablock.V_N, 0) + +en_te_v0 = en_te.getVertexIJK(hexablock.CYL_SMALL, 2, hexablock.V_N , 0) +en_te_v1 = en_te.getVertexIJK(hexablock.CYL_SMALL, 2, hexablock.V_NW, 0) + +croix_v0 = croix.getVertexIJK(hexablock.CYL_BIG, 2, hexablock.V_E , hexablock.CYL_BIG_SLICES) +croix_v1 = croix.getVertexIJK(hexablock.CYL_BIG, 2, hexablock.V_NE, hexablock.CYL_BIG_SLICES) + +prisme = doc.joinQuads(croix_quads, en_te_q, croix_v0, en_te_v0, croix_v1, en_te_v1, 1) + +# Associer +# ======== + +# fkl: comme pour la tuyauterie: associer pour le prisme (sauf si item 142 et 146 de Taches.ods) + +# Mailler le modele de bloc +# ========================= + +# Definir 5 groupes de faces +# -------------------------- + +groupe_grand_a = doc.addQuadGroup("Grand_A") +groupe_grand_b = doc.addQuadGroup("Grand_B") +groupe_moyen_f = doc.addQuadGroup("Moyen") +groupe_petit_a = doc.addQuadGroup("Petit_A") +groupe_petit_b = doc.addQuadGroup("Petit_B") + +for i in xrange(2): + for j in xrange( [hexablock.CV_MAXI_INT, hexablock.CV_MAXI_EXT][i] ): + quad = en_te.getQuadIJ(hexablock.CYL_BIG , i, j, 0) + groupe_grand_a.addElement(quad) + + quad = en_te.getQuadIJ(hexablock.CYL_BIG , i, j, hexablock.CYL_BIG_SLICES) + groupe_grand_b.addElement(quad) + + quad = croix.getQuadIJ(hexablock.CYL_BIG , i, j, 0) + groupe_moyen_f.addElement(quad) + + quad = croix.getQuadIJ(hexablock.CYL_SMALL, i, j, 0) + groupe_petit_a.addElement(quad) + + quad = croix.getQuadIJ(hexablock.CYL_SMALL, i, j, hexablock.CYL_SMALL_SLICES) + groupe_petit_b.addElement(quad) + +# Definir 3 groupes de volumes +# ---------------------------- + +groupe_grand = doc.addHexaGroup("Grand") +groupe_moyen = doc.addHexaGroup("Moyen") +groupe_petit = doc.addHexaGroup("Petit") + +for i in xrange( doc.countUsedHexa() ): + h = doc.getUsedHexa(i) + groupe_moyen.addElement(h) + +for i in xrange(2): + for j in xrange( [hexablock.CV_MAXI_INT, hexablock.CV_MAXI_EXT][i] ): + for k in [ 0, hexablock.CYL_BIG_SLICES-1 ]: + h = en_te.getHexaIJK(hexablock.CYL_BIG, i, j, k) + groupe_grand.addElement(h) + groupe_moyen.removeElement(h) + + for k in [0, hexablock.CYL_SMALL_SLICES-1 ]: + h = croix.getHexaIJK(hexablock.CYL_SMALL, i, j, k) + groupe_petit.addElement(h) + groupe_moyen.removeElement(h) + +# Mailler le modele de bloc avec association +# ------------------------------------------ + +########## hexablock.addLaws(doc, 10, True) Ne marche pas + +law = doc.addLaw("Uniform", 4) +for j in range(doc.countPropagation()): + propa = doc.getPropagation(j) + propa.setLaw(law) + +doc.save("troisCylindres_v5") +doc.setName("troisCylindres_v5") +hexablock.addToStudy(doc) + +blocs = hexablock.mesh(doc, dim=3) + +muv, mue, muq, muh = hexablock.dump(doc, blocs) diff --git a/src/TEST_PY/test_unit/tuyau.brep b/src/TEST_PY/test_unit/tuyau.brep new file mode 100755 index 0000000..aa50342 --- /dev/null +++ b/src/TEST_PY/test_unit/tuyau.brep @@ -0,0 +1,425 @@ + +CASCADE Topology V1, (c) Matra-Datavision +Locations 0 +Curve2ds 28 +1 0 0 0 1 +1 0 0 0 1 +1 0 0 1 0 +3 5.0000000000000009 0 -1 -0 -0 1 5 2 +1 3.1415926535897931 0 0 1 +1 3.1415926535897931 0 0 1 +1 0 1 1 0 +2 0 -4.5 -6.123233995736766e-17 1 1 6.123233995736766e-17 4.5 +3 5.0000000000000009 0 -1 -0 -0 1 5 2 +2 0 -4.5 -6.123233995736766e-17 1 1 6.123233995736766e-17 4.5 +1 0 0 1 0 +1 0 0 1 0 +1 0 0 1 0 +3 5.0000000000000009 0 -1 -0 -0 1 4 1.6000000000000001 +1 10.000000000000002 2.4492935982947064e-16 -1 -4.8985871965894112e-17 +1 10.000000000000002 2.4492935982947064e-16 -1 -4.8985871965894112e-17 +1 0 0 0 1 +1 0 0 0 1 +1 3.1415926535897931 0 0 1 +1 3.1415926535897931 0 0 1 +1 0 1 1 0 +2 0 -4.5 -6.123233995736766e-17 1 1 6.123233995736766e-17 3.6000000000000001 +3 5.0000000000000009 0 -1 -0 -0 1 4 1.6000000000000001 +2 0 -4.5 -6.123233995736766e-17 1 1 6.123233995736766e-17 3.6000000000000001 +1 0 -0 6.1232339957367759e-17 -1 +1 0 -0 6.1232339957367759e-17 -1 +1 1.1021821192326179e-15 -9 -1.8369701987210317e-16 1 +1 1.1021821192326179e-15 -9 -1.8369701987210317e-16 1 +Curves 16 +7 1 0 7 8 2 3.5355339059327386 -3.5355339059327386 4.4408920985006262e-16 1 9.6048855423786907 5.6779402750195374 -5.742238377723344e-16 0.99999999999999989 18.214762018199355 14.344823330601708 -3.1843740466902976e-15 1.0000000000000058 31.904943295729403 14.237869646355081 1.2028108957336017e-14 0.99999999999998868 37.172160522651843 17.64988141136174 -8.7773709183773399e-15 1.0000000000000071 52.812746249130484 14.81612372870539 2.3298725788871153e-15 0.99999999999999833 63.447227270624914 15.5 0 1 75 15.5 0 1 + 0 8 1 8 +7 0 0 10 11 2 3.5355339059327386 -3.5355339059327386 4.4408920985006262e-16 3.5355339059328195 -3.5355339059328195 -0.62831853071801369 3.1478202812511471 -3.1478202812511471 -1.2566370068591419 2.3723834259365431 -2.3723834259365431 -1.7988274783398068 1.2775986014269276 -1.2775986014269276 -2.1687580291315651 1.1719514247943195e-12 -1.1719514247943195e-12 -2.3005529012372383 -1.2775986014289811 1.2775986014289811 -2.1687580291316819 -2.3723834259351833 2.3723834259351833 -1.7988274783396521 -3.1478202812517777 3.1478202812517777 -1.256637006859245 -3.5355339059326556 3.5355339059326556 -0.62831853071798205 -3.5355339059327386 3.5355339059327386 2.2204460492503131e-16 + 0 11 3.1415926535897931 11 +7 1 0 7 8 2 -3.5355339059327386 3.5355339059327386 2.2204460492503131e-16 1 3.5505706064268643 12.92839695201633 -1.5975347728255742e-15 0.99999999999999989 14.233536249242547 23.186298181990903 -5.559004606855246e-15 1.0000000000000058 28.117657554132329 15.130373948082415 1.4762487599297348e-14 0.99999999999998868 41.978695964977959 33.453377516518131 -1.3515968997086305e-14 1.0000000000000071 51.368462505527539 21.938158843438853 1.6901778625232096e-15 0.99999999999999833 63.447227270624914 24.500000000000004 -1.5086264655892687e-15 1 75.000000000000014 24.5 -1.5086264655892687e-15 1 + 0 8 1 8 +7 0 0 10 11 2 75 15.5 0 74.999999999999105 15.49999999999994 -1.4137166941154202 75.000000000003425 15.993478879707238 -2.8274332654334842 74.999999999990621 16.98044886550209 -4.0473618262637086 75.000000000018389 18.373882457535071 -4.8797055655472787 74.999999999974861 19.999999999996184 -5.1762440277824107 75.00000000002386 21.626117542471153 -4.879705565547396 74.999999999984084 23.019551134494474 -4.047361826263554 75.000000000007219 24.006521120294067 -2.8274332654335823 74.999999999998124 24.499999999999748 -1.4137166941153954 75.000000000000014 24.5 -1.5086264655892687e-15 + 0 11 3.1415926535897931 11 +7 0 0 10 11 2 3.5355339059327386 -3.5355339059327386 -4.4408920985006262e-16 3.5355339059328195 -3.5355339059328195 0.62831853071801369 3.1478202812511471 -3.1478202812511471 1.2566370068591419 2.3723834259365431 -2.3723834259365431 1.7988274783398068 1.2775986014269276 -1.2775986014269276 2.1687580291315651 1.1719514247943195e-12 -1.1719514247943195e-12 2.3005529012372383 -1.2775986014289811 1.2775986014289811 2.1687580291316819 -2.3723834259351833 2.3723834259351833 1.7988274783396521 -3.1478202812517777 3.1478202812517777 1.256637006859245 -3.5355339059326556 3.5355339059326556 0.62831853071798205 -3.5355339059327386 3.5355339059327386 -2.2204460492503131e-16 + 0 11 3.1415926535897931 11 +7 0 0 10 11 2 75 15.5 0 74.999999999999105 15.49999999999994 1.4137166941154202 75.000000000003425 15.993478879707238 2.8274332654334842 74.999999999990621 16.98044886550209 4.0473618262637086 75.000000000018389 18.373882457535071 4.8797055655472787 74.999999999974861 19.999999999996184 5.1762440277824107 75.00000000002386 21.626117542471153 4.879705565547396 74.999999999984084 23.019551134494474 4.047361826263554 75.000000000007219 24.006521120294067 2.8274332654335823 74.999999999998124 24.499999999999748 1.4137166941153954 75.000000000000014 24.5 1.5086264655892687e-15 + 0 11 3.1415926535897931 11 +1 3.5355339059327378 -3.5355339059327378 0 -0.70710678118654757 0.70710678118654757 0 +7 0 0 10 11 2 2.8284271247461912 -2.8284271247461912 4.4408920985006262e-16 2.8284271247462276 -2.8284271247462276 -0.50265482457439326 2.5182562250010312 -2.5182562250010312 -1.0053096054873778 1.8979067407489889 -1.8979067407489889 -1.4390619826717084 1.0220788811419279 -1.0220788811419279 -1.7350064233054643 4.6762593797211755e-13 -4.6762593797211755e-13 -1.8404423209895382 -1.0220788811427488 1.0220788811427488 -1.73500642330558 -1.8979067407484411 1.8979067407484411 -1.4390619826715594 -2.5182562250012874 2.5182562250012874 -1.0053096054874726 -2.8284271247461601 2.8284271247461601 -0.50265482457436672 -2.8284271247461903 2.8284271247461903 2.2204460492503131e-16 + 0 11 3.1415926535897931 11 +1 -3.5355339059327378 3.5355339059327378 -2.4492935982947064e-16 0.70710678118654757 -0.70710678118654757 4.89858719658941e-17 +7 1 0 7 8 2 2.8284271247461912 -2.8284271247461912 4.4408920985006262e-16 1 9.0159805468327825 6.4281751612018496 2.0133058846416192e-16 1 17.777778499972118 15.165580394866463 -8.0236115873956118e-16 0.99999999999998979 31.571168515292573 14.409868988290894 5.8731757129539919e-15 1.0000000000000278 37.64839458161984 19.182925960538899 -3.5800583136374853e-15 0.99999999999997424 52.67616934408646 15.539676739546138 1.5172914623676952e-15 1.0000000000000095 63.449895514329839 16.399999999999999 4.4408920985006262e-16 1 75 16.399999999999999 4.4408920985006262e-16 1 + 0 8 1 8 +7 1 0 7 8 2 -2.8284271247461903 2.8284271247461903 2.2204460492503131e-16 1 4.1746945180469197 12.228938087750445 -4.3498515050138725e-16 1 14.587149100985133 22.237911020917949 -1.2111033831702273e-15 0.99999999999998979 28.549479609839526 15.123956971356947 2.3425383791132212e-15 1.0000000000000278 41.490579147983965 31.827861148346255 -1.0269151715707795e-15 0.99999999999997424 51.521030626222753 21.236230289860686 5.1873396212586411e-16 1.0000000000000095 63.449895514329832 23.600000000000001 2.141842990487521e-16 1 75.000000000000014 23.600000000000001 2.1418429904875208e-16 1 + 0 8 1 8 +7 0 0 10 11 2 75 16.399999999999999 4.4408920985006262e-16 74.999999999999105 16.399999999999604 -1.1309733552923305 75.000000000003425 16.79478310376723 -2.2619466123468186 74.999999999990621 17.584359092398095 -3.2378894610108695 75.000000000018389 18.699105966034271 -3.9037644524379904 74.999999999974861 19.999999999989107 -4.1409952222257402 75.00000000002386 21.300894033984143 -3.9037644524380775 74.999999999984084 22.415640907590802 -3.2378894610107412 75.000000000007219 23.205216896237388 -2.261946612346911 74.999999999998124 23.599999999999262 -1.1309733552923047 75.000000000000014 23.600000000000001 2.1418429904875208e-16 + 0 11 3.1415926535897931 11 +7 0 0 10 11 2 2.8284271247461912 -2.8284271247461912 -4.4408920985006262e-16 2.8284271247462276 -2.8284271247462276 0.50265482457439326 2.5182562250010312 -2.5182562250010312 1.0053096054873778 1.8979067407489889 -1.8979067407489889 1.4390619826717084 1.0220788811419279 -1.0220788811419279 1.7350064233054643 4.6762593797211755e-13 -4.6762593797211755e-13 1.8404423209895382 -1.0220788811427488 1.0220788811427488 1.73500642330558 -1.8979067407484411 1.8979067407484411 1.4390619826715594 -2.5182562250012874 2.5182562250012874 1.0053096054874726 -2.8284271247461601 2.8284271247461601 0.50265482457436672 -2.8284271247461903 2.8284271247461903 -2.2204460492503131e-16 + 0 11 3.1415926535897931 11 +7 0 0 10 11 2 75 16.399999999999999 -4.4408920985006262e-16 74.999999999999105 16.399999999999604 1.1309733552923305 75.000000000003425 16.79478310376723 2.2619466123468186 74.999999999990621 17.584359092398095 3.2378894610108695 75.000000000018389 18.699105966034271 3.9037644524379904 74.999999999974861 19.999999999989107 4.1409952222257402 75.00000000002386 21.300894033984143 3.9037644524380775 74.999999999984084 22.415640907590802 3.2378894610107412 75.000000000007219 23.205216896237388 2.261946612346911 74.999999999998124 23.599999999999262 1.1309733552923047 75.000000000000014 23.600000000000001 -2.1418429904875208e-16 + 0 11 3.1415926535897931 11 +1 75 15.5 2.7554552980815448e-16 0 1 -6.1232339957367759e-17 +1 75 24.5 -8.2663658942446333e-16 0 -1 1.8369701987210317e-16 +Polygon3D 0 +PolygonOnTriangulations 0 +Surfaces 8 +9 1 0 0 0 10 7 11 8 2 2 3.5355339059327386 -3.5355339059327386 4.4408920985006262e-16 1 9.6048855423786907 5.6779402750195374 -5.742238377723344e-16 0.99999999999999989 18.214762018199355 14.344823330601708 -3.1843740466902976e-15 1.0000000000000058 31.904943295729403 14.237869646355081 1.2028108957336017e-14 0.99999999999998868 37.172160522651843 17.64988141136174 -8.7773709183773399e-15 1.0000000000000071 52.812746249130484 14.81612372870539 2.3298725788871153e-15 0.99999999999999833 63.447227270624914 15.5 0 1 75 15.5 0 1 +3.5355339059328195 -3.5355339059328195 -0.62831853071801369 1 9.604885542379284 5.6779402750195667 -0.73164124169730604 0.99999999999999989 18.214762018200037 14.344823330601164 -1.0469888149911395 1.0000000000000058 31.904943295730241 14.237869646359984 -0.39948502431303995 0.99999999999998868 37.172160522650039 17.649881411357878 -2.4092611365725189 1.0000000000000071 52.812746249132488 14.816123728706323 -1.1284938924273324 0.99999999999999833 63.447227270625511 15.499999999999938 -1.4137166941154204 1 74.999999999999105 15.49999999999994 -1.4137166941154202 1 +3.1478202812511471 -3.1478202812511471 -1.2566370068591419 1 9.2729214810444986 6.0754899681670214 -1.463282419842884 0.99999999999999989 17.996467481271083 14.829610120007128 -2.0939775390394035 1.0000000000000058 31.697282681850869 14.286806537772526 -0.79897001392370559 0.99999999999998868 37.435707603251764 18.516402695092999 -4.8185220638754691 1.0000000000000071 52.733554746481623 15.206631940884614 -2.2569876868315566 0.99999999999999833 63.447227270622655 15.993478879707236 -2.8274332654334846 1 75.000000000003425 15.993478879707238 -2.8274332654334842 1 +2.3723834259365431 -2.3723834259365431 -1.7988274783398068 1 8.6089851336806884 6.8705992041127821 -2.0946324284719631 0.99999999999999989 17.559872998990649 15.799195709829741 -2.9974482015801436 1.0000000000000058 31.28195630911361 14.384681533173158 -1.1436948041305759 0.99999999999998868 37.962808294048074 20.249466731308765 -6.897528758237212 1.0000000000000071 52.575169779178417 15.987658040456525 -3.2307909501209608 0.99999999999999833 63.447227270628531 16.98044886550209 -4.0473618262637086 1 74.999999999990621 16.98044886550209 -4.0473618262637086 1 +1.2775986014269276 -1.2775986014269276 -2.1687580291315651 1 7.6716200438365361 7.9931580809223801 -2.5253955435015549 0.99999999999999989 16.943475918531011 17.168085494405027 -3.6138762234641644 1.0000000000000058 30.695586178585053 14.522864363617154 -1.3788967086524706 0.99999999999998868 38.706984732566291 22.696258103010518 -8.3160119887771682 1.0000000000000071 52.351557169731038 17.090333926265838 -3.8952061261517525 0.99999999999999833 63.447227270621916 18.373882457535071 -4.8797055655472787 1 75.000000000018389 18.373882457535071 -4.8797055655472787 1 +1.1719514247943195e-12 -1.1719514247943195e-12 -2.3005529012372383 1 6.5777280744114703 9.3031686135167266 -2.6788631863653043 0.99999999999999989 16.224149133738432 18.76556075628185 -3.8334905595379762 1.0000000000000058 30.011300424905656 14.684121797300168 -1.462691909845385 0.99999999999998868 39.575428243818408 25.551629463869848 -8.8213739156197359 1.0000000000000071 52.09060437734513 18.377141286086164 -4.1319168086379028 0.99999999999999833 63.447227270625667 19.999999999996184 -5.1762440277824107 1 74.999999999974861 19.999999999996184 -5.1762440277824107 1 +-1.2775986014289811 1.2775986014289811 -2.1687580291316819 1 5.4838361049540145 10.613179146115629 -2.5253955435017352 0.99999999999999989 15.504822348881138 20.363036018212849 -3.613876223464215 1.0000000000000058 29.327014671318086 14.845379230678686 -1.3788967086533002 0.99999999999998868 40.443871755058836 28.407000824990529 -8.3160119887766726 1.0000000000000071 51.829651584897462 19.663948645853612 -3.8952061261520572 0.99999999999999833 63.447227270625788 21.626117542471153 -4.879705565547396 1 75.00000000002386 21.626117542471153 -4.879705565547396 1 +-2.3723834259351833 2.3723834259351833 -1.7988274783396521 1 4.5464710151344043 11.735738022921637 -2.0946324284717539 0.99999999999999989 14.888425268470534 21.73192580274673 -2.9974482015801169 1.0000000000000058 28.740644540721632 14.983562061355201 -1.1436948041293928 0.99999999999998868 41.188048193587157 30.853792196494638 -6.8975287582379137 1.0000000000000071 51.606038975498372 20.766624531703982 -3.2307909501205487 0.99999999999999833 63.447227270623706 23.019551134494478 -4.047361826263554 1 74.999999999984084 23.019551134494474 -4.047361826263554 1 +-3.1478202812517777 3.1478202812517777 -1.256637006859245 1 3.8825346677568429 12.530847258869537 -1.4632824198430057 0.99999999999999989 14.451830786163059 22.701511392593083 -2.093977539039428 1.0000000000000058 28.32531816801977 15.081437056623322 -0.79897001392448364 0.99999999999998868 41.715148884378252 32.586856232821489 -4.8185220638750348 1.0000000000000071 51.447654008166793 21.547650631251887 -2.2569876868317986 0.99999999999999833 63.447227270625731 24.006521120294064 -2.8274332654335819 1 75.000000000007219 24.006521120294067 -2.8274332654335823 1 +-3.5355339059326556 3.5355339059326556 -0.62831853071798205 1 3.5505706064273257 12.928396952016087 -0.73164124169727363 0.99999999999999989 14.233536249244064 23.186298181990281 -1.0469888149911422 1.0000000000000058 28.117657554128364 15.130373948086152 -0.39948502431278238 0.99999999999998868 41.978695964980815 33.453377516515026 -2.4092611365726784 1.0000000000000071 51.368462505527397 21.938158843439282 -1.1284938924272563 0.99999999999999833 63.447227270624651 24.499999999999744 -1.4137166941153956 1 74.999999999998124 24.499999999999748 -1.4137166941153954 1 +-3.5355339059327386 3.5355339059327386 2.2204460492503131e-16 1 3.5505706064268643 12.92839695201633 -1.5975347728255742e-15 0.99999999999999989 14.233536249242547 23.186298181990903 -5.559004606855246e-15 1.0000000000000058 28.117657554132329 15.130373948082415 1.4762487599297348e-14 0.99999999999998868 41.978695964977959 33.453377516518131 -1.3515968997086305e-14 1.0000000000000071 51.368462505527539 21.938158843438853 1.6901778625232096e-15 0.99999999999999833 63.447227270624914 24.500000000000004 -1.5086264655892687e-15 1 75.000000000000014 24.5 -1.5086264655892687e-15 1 + +0 11 +3.1415926535897931 11 + +0 8 +1 8 + +9 1 0 0 0 10 7 11 8 2 2 3.5355339059327386 -3.5355339059327386 -4.4408920985006262e-16 1 9.6048855423786907 5.6779402750195374 5.742238377723344e-16 0.99999999999999989 18.214762018199355 14.344823330601708 3.1843740466902976e-15 1.0000000000000058 31.904943295729403 14.237869646355081 -1.2028108957336017e-14 0.99999999999998868 37.172160522651843 17.64988141136174 8.7773709183773399e-15 1.0000000000000071 52.812746249130484 14.81612372870539 -2.3298725788871153e-15 0.99999999999999833 63.447227270624914 15.5 0 1 75 15.5 0 1 +3.5355339059328195 -3.5355339059328195 0.62831853071801369 1 9.604885542379284 5.6779402750195667 0.73164124169730604 0.99999999999999989 18.214762018200037 14.344823330601164 1.0469888149911395 1.0000000000000058 31.904943295730241 14.237869646359984 0.39948502431303995 0.99999999999998868 37.172160522650039 17.649881411357878 2.4092611365725189 1.0000000000000071 52.812746249132488 14.816123728706323 1.1284938924273324 0.99999999999999833 63.447227270625511 15.499999999999938 1.4137166941154204 1 74.999999999999105 15.49999999999994 1.4137166941154202 1 +3.1478202812511471 -3.1478202812511471 1.2566370068591419 1 9.2729214810444986 6.0754899681670214 1.463282419842884 0.99999999999999989 17.996467481271083 14.829610120007128 2.0939775390394035 1.0000000000000058 31.697282681850869 14.286806537772526 0.79897001392370559 0.99999999999998868 37.435707603251764 18.516402695092999 4.8185220638754691 1.0000000000000071 52.733554746481623 15.206631940884614 2.2569876868315566 0.99999999999999833 63.447227270622655 15.993478879707236 2.8274332654334846 1 75.000000000003425 15.993478879707238 2.8274332654334842 1 +2.3723834259365431 -2.3723834259365431 1.7988274783398068 1 8.6089851336806884 6.8705992041127821 2.0946324284719631 0.99999999999999989 17.559872998990649 15.799195709829741 2.9974482015801436 1.0000000000000058 31.28195630911361 14.384681533173158 1.1436948041305759 0.99999999999998868 37.962808294048074 20.249466731308765 6.897528758237212 1.0000000000000071 52.575169779178417 15.987658040456525 3.2307909501209608 0.99999999999999833 63.447227270628531 16.98044886550209 4.0473618262637086 1 74.999999999990621 16.98044886550209 4.0473618262637086 1 +1.2775986014269276 -1.2775986014269276 2.1687580291315651 1 7.6716200438365361 7.9931580809223801 2.5253955435015549 0.99999999999999989 16.943475918531011 17.168085494405027 3.6138762234641644 1.0000000000000058 30.695586178585053 14.522864363617154 1.3788967086524706 0.99999999999998868 38.706984732566291 22.696258103010518 8.3160119887771682 1.0000000000000071 52.351557169731038 17.090333926265838 3.8952061261517525 0.99999999999999833 63.447227270621916 18.373882457535071 4.8797055655472787 1 75.000000000018389 18.373882457535071 4.8797055655472787 1 +1.1719514247943195e-12 -1.1719514247943195e-12 2.3005529012372383 1 6.5777280744114703 9.3031686135167266 2.6788631863653043 0.99999999999999989 16.224149133738432 18.76556075628185 3.8334905595379762 1.0000000000000058 30.011300424905656 14.684121797300168 1.462691909845385 0.99999999999998868 39.575428243818408 25.551629463869848 8.8213739156197359 1.0000000000000071 52.09060437734513 18.377141286086164 4.1319168086379028 0.99999999999999833 63.447227270625667 19.999999999996184 5.1762440277824107 1 74.999999999974861 19.999999999996184 5.1762440277824107 1 +-1.2775986014289811 1.2775986014289811 2.1687580291316819 1 5.4838361049540145 10.613179146115629 2.5253955435017352 0.99999999999999989 15.504822348881138 20.363036018212849 3.613876223464215 1.0000000000000058 29.327014671318086 14.845379230678686 1.3788967086533002 0.99999999999998868 40.443871755058836 28.407000824990529 8.3160119887766726 1.0000000000000071 51.829651584897462 19.663948645853612 3.8952061261520572 0.99999999999999833 63.447227270625788 21.626117542471153 4.879705565547396 1 75.00000000002386 21.626117542471153 4.879705565547396 1 +-2.3723834259351833 2.3723834259351833 1.7988274783396521 1 4.5464710151344043 11.735738022921637 2.0946324284717539 0.99999999999999989 14.888425268470534 21.73192580274673 2.9974482015801169 1.0000000000000058 28.740644540721632 14.983562061355201 1.1436948041293928 0.99999999999998868 41.188048193587157 30.853792196494638 6.8975287582379137 1.0000000000000071 51.606038975498372 20.766624531703982 3.2307909501205487 0.99999999999999833 63.447227270623706 23.019551134494478 4.047361826263554 1 74.999999999984084 23.019551134494474 4.047361826263554 1 +-3.1478202812517777 3.1478202812517777 1.256637006859245 1 3.8825346677568429 12.530847258869537 1.4632824198430057 0.99999999999999989 14.451830786163059 22.701511392593083 2.093977539039428 1.0000000000000058 28.32531816801977 15.081437056623322 0.79897001392448364 0.99999999999998868 41.715148884378252 32.586856232821489 4.8185220638750348 1.0000000000000071 51.447654008166793 21.547650631251887 2.2569876868317986 0.99999999999999833 63.447227270625731 24.006521120294064 2.8274332654335819 1 75.000000000007219 24.006521120294067 2.8274332654335823 1 +-3.5355339059326556 3.5355339059326556 0.62831853071798205 1 3.5505706064273257 12.928396952016087 0.73164124169727363 0.99999999999999989 14.233536249244064 23.186298181990281 1.0469888149911422 1.0000000000000058 28.117657554128364 15.130373948086152 0.39948502431278238 0.99999999999998868 41.978695964980815 33.453377516515026 2.4092611365726784 1.0000000000000071 51.368462505527397 21.938158843439282 1.1284938924272563 0.99999999999999833 63.447227270624651 24.499999999999744 1.4137166941153956 1 74.999999999998124 24.499999999999748 1.4137166941153954 1 +-3.5355339059327386 3.5355339059327386 -2.2204460492503131e-16 1 3.5505706064268643 12.92839695201633 1.5975347728255742e-15 0.99999999999999989 14.233536249242547 23.186298181990903 5.559004606855246e-15 1.0000000000000058 28.117657554132329 15.130373948082415 -1.4762487599297348e-14 0.99999999999998868 41.978695964977959 33.453377516518131 1.3515968997086305e-14 1.0000000000000071 51.368462505527539 21.938158843438853 -1.6901778625232096e-15 0.99999999999999833 63.447227270624914 24.500000000000004 1.5086264655892687e-15 1 75.000000000000014 24.5 1.5086264655892687e-15 1 + +0 11 +3.1415926535897931 11 + +0 8 +1 8 + +1 3.5355339059327378 -3.5355339059327378 0 -0.70710678118654757 -0.70710678118654757 0 -0.70710678118654757 0.70710678118654757 0 -0 0 -1 +1 75 15.5 2.7554552980815448e-16 -1 0 0 0 0 -1 -0 -1 -0 +1 3.5355339059327378 -3.5355339059327378 0 -0.70710678118654757 -0.70710678118654757 -0 -0.70710678118654757 0.70710678118654757 -0 -0 -0 1 +1 75 15.5 -2.7554552980815448e-16 -1 -0 -0 -0 0 1 -0 -1 0 +9 1 0 0 0 10 7 11 8 2 2 2.8284271247461912 -2.8284271247461912 4.4408920985006262e-16 1 9.0159805468327825 6.4281751612018496 2.0133058846416192e-16 1 17.777778499972118 15.165580394866463 -8.0236115873956118e-16 0.99999999999998979 31.571168515292573 14.409868988290894 5.8731757129539919e-15 1.0000000000000278 37.64839458161984 19.182925960538899 -3.5800583136374853e-15 0.99999999999997424 52.67616934408646 15.539676739546138 1.5172914623676952e-15 1.0000000000000095 63.449895514329839 16.399999999999999 4.4408920985006262e-16 1 75 16.399999999999999 4.4408920985006262e-16 1 +2.8284271247462276 -2.8284271247462276 -0.50265482457439326 1 9.0159805468328216 6.4281751612018621 -0.58553428033384047 1 17.777778499971209 15.165580394865655 -0.83702922341251151 0.99999999999998979 31.571168515297988 14.409868988295917 -0.32030380321158969 1.0000000000000278 37.648394581614838 19.182925960534281 -1.9273256235209786 0.99999999999997424 52.676169344089331 15.539676739546854 -0.90272885493142008 1.0000000000000095 63.449895514330436 16.399999999999601 -1.1309733552923305 1 74.999999999999105 16.399999999999604 -1.1309733552923305 1 +2.5182562250010312 -2.5182562250010312 -1.0053096054873778 1 8.7505280572964637 6.7462367156950842 -1.1710685098071594 1 17.602833142044837 15.553363260898562 -1.674058374119779 0.99999999999998979 31.405486331285697 14.449023136926375 -0.64060757859783735 1.0000000000000278 37.85906535224138 19.876260232829232 -3.8546510796345723 0.99999999999997424 52.612831948476334 15.852024391121061 -1.8054576314498902 1.0000000000000095 63.449895514327579 16.79478310376723 -2.2619466123468186 1 75.000000000003425 16.79478310376723 -2.2619466123468186 1 +1.8979067407489889 -1.8979067407489889 -1.4390619826717084 1 8.2196165014000666 7.3823677049416423 -1.676339470317372 1 17.252938091745996 16.328938600612986 -2.3963500893836529 0.99999999999998979 31.074117858447767 14.527332404383019 -0.91700507699040601 1.0000000000000278 38.280412112952412 21.262945955287442 -5.5177845659494009 0.99999999999997424 52.486155588068115 16.476727432979835 -2.5844430656618647 1.0000000000000095 63.449895514333448 17.584359092398095 -3.2378894610108699 1 74.999999999990621 17.584359092398095 -3.2378894610108695 1 +1.0220788811419279 -1.0220788811419279 -1.7350064233054643 1 7.4700597701643572 8.2804763628600888 -2.021080247871553 1 16.758945849069651 17.423918941557226 -2.8891617231474176 0.99999999999998979 30.606281988837953 14.637891757957481 -1.1055880274247882 1.0000000000000278 38.875282006554237 23.220710117598962 -6.6525221148448219 0.99999999999997424 52.307310133244791 17.358701774719187 -3.1159361956481719 1.0000000000000095 63.44989551432684 18.699105966034271 -3.9037644524379909 1 75.000000000018389 18.699105966034271 -3.9037644524379904 1 +4.6762593797211755e-13 -4.6762593797211755e-13 -1.8404423209895382 1 6.5953375324381369 9.3285566244738707 -2.1439007788875823 1 16.182463800463946 18.701745707871858 -3.064735343935824 0.99999999999998979 30.060324062636926 14.76691297991343 -1.1727743297930939 1.0000000000000278 39.569486864737151 25.505393554351894 -7.0567941864600172 0.99999999999997424 52.098599985188997 18.387953514714269 -3.3052908432768442 1.0000000000000095 63.449895514330578 19.999999999989107 -4.1409952222257402 1 74.999999999974861 19.999999999989107 -4.1409952222257402 1 +-1.0220788811427488 1.0220788811427488 -1.73500642330558 1 5.7206152947181215 10.376636886096147 -2.0210802478716676 1 15.605981751912061 19.97957247426147 -2.8891617231474713 0.99999999999998979 29.514366136174079 14.895934201537747 -1.1055880274253354 1.0000000000000278 40.26369172315826 27.790076991440177 -6.6525221148445537 0.99999999999997424 51.889889837005235 19.417205254669291 -3.1159361956483513 1.0000000000000095 63.449895514330713 21.300894033984143 -3.9037644524380779 1 75.00000000002386 21.300894033984143 -3.9037644524380775 1 +-1.8979067407484411 1.8979067407484411 -1.4390619826715594 1 4.9710585634781923 11.274745544008159 -1.6763394703172221 1 15.111989509197203 21.074552815149307 -2.3963500893835668 0.99999999999998979 29.04653026675712 15.006493555362955 -0.91700507698972389 1.0000000000000278 40.858561616586826 29.747841153500076 -5.5177845659496922 0.99999999999997424 51.711044382278359 20.299179596439458 -2.584443065661632 1.0000000000000095 63.449895514328631 22.415640907590799 -3.2378894610107416 1 74.999999999984084 22.415640907590802 -3.2378894610107412 1 +-2.5182562250012874 2.5182562250012874 -1.0053096054874726 1 4.4401470075837057 11.910876533258277 -1.1710685098072586 1 14.762094458918183 21.850128154895057 -1.6740583741198436 0.99999999999998979 28.715161793814971 15.084802822679471 -0.6406075785982992 1.0000000000000278 41.279908377390043 31.134526876097311 -3.8546510796343862 0.99999999999997424 51.584368021816545 20.92388263828046 -1.8054576314500514 1.0000000000000095 63.449895514330656 23.205216896237385 -2.261946612346911 1 75.000000000007219 23.205216896237388 -2.261946612346911 1 +-2.8284271247461601 2.8284271247461601 -0.50265482457436672 1 4.1746945180467883 12.228938087750157 -0.58553428033381372 1 14.587149100984806 22.237911020916648 -0.83702922341252328 0.99999999999998979 28.549479609841558 15.123956971361764 -0.3203038032113672 1.0000000000000278 41.490579147982118 31.82786114834126 -1.9273256235211105 0.99999999999997424 51.521030626224039 21.236230289861044 -0.90272885493134847 1.0000000000000095 63.449895514329569 23.599999999999262 -1.1309733552923047 1 74.999999999998124 23.599999999999262 -1.1309733552923047 1 +-2.8284271247461903 2.8284271247461903 2.2204460492503131e-16 1 4.1746945180469197 12.228938087750445 -4.3498515050138725e-16 1 14.587149100985133 22.237911020917949 -1.2111033831702273e-15 0.99999999999998979 28.549479609839526 15.123956971356947 2.3425383791132212e-15 1.0000000000000278 41.490579147983965 31.827861148346255 -1.0269151715707795e-15 0.99999999999997424 51.521030626222753 21.236230289860686 5.1873396212586411e-16 1.0000000000000095 63.449895514329832 23.600000000000001 2.141842990487521e-16 1 75.000000000000014 23.600000000000001 2.1418429904875208e-16 1 + +0 11 +3.1415926535897931 11 + +0 8 +1 8 + +9 1 0 0 0 10 7 11 8 2 2 2.8284271247461912 -2.8284271247461912 -4.4408920985006262e-16 1 9.0159805468327825 6.4281751612018496 -2.0133058846416192e-16 1 17.777778499972118 15.165580394866463 8.0236115873956118e-16 0.99999999999998979 31.571168515292573 14.409868988290894 -5.8731757129539919e-15 1.0000000000000278 37.64839458161984 19.182925960538899 3.5800583136374853e-15 0.99999999999997424 52.67616934408646 15.539676739546138 -1.5172914623676952e-15 1.0000000000000095 63.449895514329839 16.399999999999999 -4.4408920985006262e-16 1 75 16.399999999999999 -4.4408920985006262e-16 1 +2.8284271247462276 -2.8284271247462276 0.50265482457439326 1 9.0159805468328216 6.4281751612018621 0.58553428033384047 1 17.777778499971209 15.165580394865655 0.83702922341251151 0.99999999999998979 31.571168515297988 14.409868988295917 0.32030380321158969 1.0000000000000278 37.648394581614838 19.182925960534281 1.9273256235209786 0.99999999999997424 52.676169344089331 15.539676739546854 0.90272885493142008 1.0000000000000095 63.449895514330436 16.399999999999601 1.1309733552923305 1 74.999999999999105 16.399999999999604 1.1309733552923305 1 +2.5182562250010312 -2.5182562250010312 1.0053096054873778 1 8.7505280572964637 6.7462367156950842 1.1710685098071594 1 17.602833142044837 15.553363260898562 1.674058374119779 0.99999999999998979 31.405486331285697 14.449023136926375 0.64060757859783735 1.0000000000000278 37.85906535224138 19.876260232829232 3.8546510796345723 0.99999999999997424 52.612831948476334 15.852024391121061 1.8054576314498902 1.0000000000000095 63.449895514327579 16.79478310376723 2.2619466123468186 1 75.000000000003425 16.79478310376723 2.2619466123468186 1 +1.8979067407489889 -1.8979067407489889 1.4390619826717084 1 8.2196165014000666 7.3823677049416423 1.676339470317372 1 17.252938091745996 16.328938600612986 2.3963500893836529 0.99999999999998979 31.074117858447767 14.527332404383019 0.91700507699040601 1.0000000000000278 38.280412112952412 21.262945955287442 5.5177845659494009 0.99999999999997424 52.486155588068115 16.476727432979835 2.5844430656618647 1.0000000000000095 63.449895514333448 17.584359092398095 3.2378894610108699 1 74.999999999990621 17.584359092398095 3.2378894610108695 1 +1.0220788811419279 -1.0220788811419279 1.7350064233054643 1 7.4700597701643572 8.2804763628600888 2.021080247871553 1 16.758945849069651 17.423918941557226 2.8891617231474176 0.99999999999998979 30.606281988837953 14.637891757957481 1.1055880274247882 1.0000000000000278 38.875282006554237 23.220710117598962 6.6525221148448219 0.99999999999997424 52.307310133244791 17.358701774719187 3.1159361956481719 1.0000000000000095 63.44989551432684 18.699105966034271 3.9037644524379909 1 75.000000000018389 18.699105966034271 3.9037644524379904 1 +4.6762593797211755e-13 -4.6762593797211755e-13 1.8404423209895382 1 6.5953375324381369 9.3285566244738707 2.1439007788875823 1 16.182463800463946 18.701745707871858 3.064735343935824 0.99999999999998979 30.060324062636926 14.76691297991343 1.1727743297930939 1.0000000000000278 39.569486864737151 25.505393554351894 7.0567941864600172 0.99999999999997424 52.098599985188997 18.387953514714269 3.3052908432768442 1.0000000000000095 63.449895514330578 19.999999999989107 4.1409952222257402 1 74.999999999974861 19.999999999989107 4.1409952222257402 1 +-1.0220788811427488 1.0220788811427488 1.73500642330558 1 5.7206152947181215 10.376636886096147 2.0210802478716676 1 15.605981751912061 19.97957247426147 2.8891617231474713 0.99999999999998979 29.514366136174079 14.895934201537747 1.1055880274253354 1.0000000000000278 40.26369172315826 27.790076991440177 6.6525221148445537 0.99999999999997424 51.889889837005235 19.417205254669291 3.1159361956483513 1.0000000000000095 63.449895514330713 21.300894033984143 3.9037644524380779 1 75.00000000002386 21.300894033984143 3.9037644524380775 1 +-1.8979067407484411 1.8979067407484411 1.4390619826715594 1 4.9710585634781923 11.274745544008159 1.6763394703172221 1 15.111989509197203 21.074552815149307 2.3963500893835668 0.99999999999998979 29.04653026675712 15.006493555362955 0.91700507698972389 1.0000000000000278 40.858561616586826 29.747841153500076 5.5177845659496922 0.99999999999997424 51.711044382278359 20.299179596439458 2.584443065661632 1.0000000000000095 63.449895514328631 22.415640907590799 3.2378894610107416 1 74.999999999984084 22.415640907590802 3.2378894610107412 1 +-2.5182562250012874 2.5182562250012874 1.0053096054874726 1 4.4401470075837057 11.910876533258277 1.1710685098072586 1 14.762094458918183 21.850128154895057 1.6740583741198436 0.99999999999998979 28.715161793814971 15.084802822679471 0.6406075785982992 1.0000000000000278 41.279908377390043 31.134526876097311 3.8546510796343862 0.99999999999997424 51.584368021816545 20.92388263828046 1.8054576314500514 1.0000000000000095 63.449895514330656 23.205216896237385 2.261946612346911 1 75.000000000007219 23.205216896237388 2.261946612346911 1 +-2.8284271247461601 2.8284271247461601 0.50265482457436672 1 4.1746945180467883 12.228938087750157 0.58553428033381372 1 14.587149100984806 22.237911020916648 0.83702922341252328 0.99999999999998979 28.549479609841558 15.123956971361764 0.3203038032113672 1.0000000000000278 41.490579147982118 31.82786114834126 1.9273256235211105 0.99999999999997424 51.521030626224039 21.236230289861044 0.90272885493134847 1.0000000000000095 63.449895514329569 23.599999999999262 1.1309733552923047 1 74.999999999998124 23.599999999999262 1.1309733552923047 1 +-2.8284271247461903 2.8284271247461903 -2.2204460492503131e-16 1 4.1746945180469197 12.228938087750445 4.3498515050138725e-16 1 14.587149100985133 22.237911020917949 1.2111033831702273e-15 0.99999999999998979 28.549479609839526 15.123956971356947 -2.3425383791132212e-15 1.0000000000000278 41.490579147983965 31.827861148346255 1.0269151715707795e-15 0.99999999999997424 51.521030626222753 21.236230289860686 -5.1873396212586411e-16 1.0000000000000095 63.449895514329832 23.600000000000001 -2.141842990487521e-16 1 75.000000000000014 23.600000000000001 -2.1418429904875208e-16 1 + +0 11 +3.1415926535897931 11 + +0 8 +1 8 + +Triangulations 0 + +TShapes 42 +Ve +1.00000011584738e-07 +3.53553390593274 -3.53553390593274 0 +0 0 + +0101101 +* +Ve +2.00001022062862e-07 +75 15.5 -6.88863824520386e-17 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 1 0 0 1 +2 1 1 0 0 1 +2 2 2 0 0 1 +0 + +0101000 ++42 0 -41 0 * +Ve +2.00001005003195e-07 +-3.53553390593273 3.53553390593274 -7.40818758532816e-16 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 2 0 0 3.14159265358979 +2 3 1 0 0 3.14159265358979 +2 4 3 0 0 3.14159265358979 +0 + +0101000 ++42 0 -39 0 * +Ve +2.00001041588069e-07 +75 24.5 2.06659147356116e-16 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 3 0 0 1 +2 5 1 0 0 1 +2 6 2 0 0 1 +0 + +0101000 ++39 0 -37 0 * +Ed + 1e-07 1 1 0 +1 4 0 0 3.14159265358979 +2 7 1 0 0 3.14159265358979 +2 8 4 0 0 3.14159265358979 +0 + +0101000 ++41 0 -37 0 * +Wi + +0101000 +-40 0 +38 0 +36 0 -35 0 * +Fa +1 1e-07 1 0 + +0101000 ++34 0 * +Ed + 1e-07 1 1 0 +1 5 0 0 3.14159265358979 +2 3 2 0 0 3.14159265358979 +2 9 5 0 0 3.14159265358979 +0 + +0101000 ++42 0 -39 0 * +Ed + 1e-07 1 1 0 +1 6 0 0 3.14159265358979 +2 7 2 0 0 3.14159265358979 +2 10 6 0 0 3.14159265358979 +0 + +0101000 ++41 0 -37 0 * +Wi + +0101000 +-40 0 +32 0 +36 0 -31 0 * +Fa +1 1e-07 2 0 + +0101000 ++30 0 * +Ve +1.00000003092948e-07 +2.82842712474619 -2.82842712474619 0 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 7 0 0 1 +2 11 3 0 0 1 +2 12 5 0 0 1 +0 + +0101000 ++42 0 -28 0 * +Ve +2.000010012582e-07 +-2.82842712474619 2.82842712474619 9.68596121552874e-16 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 8 0 0 3.14159265358979 +2 13 7 0 0 3.14159265358979 +2 14 3 0 0 3.14159265358979 +0 + +0101000 ++28 0 -26 0 * +Ed + 1e-07 1 1 0 +1 9 0 0 1 +2 15 3 0 0 1 +2 16 5 0 0 1 +0 + +0101000 ++39 0 -26 0 * +Wi + +0101000 ++38 0 -27 0 -25 0 +24 0 * +Fa +0 1e-07 3 0 + +0101000 +-23 0 * +Ve +2.00001030198519e-07 +75 16.4 -5.51091059616309e-17 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 10 0 0 1 +2 17 7 0 0 1 +2 18 8 0 0 1 +0 + +0101000 ++28 0 -21 0 * +Ve +2.00001064344293e-07 +75 23.5999999999999 1.65327317884893e-16 +0 0 + +0101101 +* +Ed + 1e-07 1 1 0 +1 11 0 0 1 +2 19 7 0 0 1 +2 20 8 0 0 1 +0 + +0101000 ++26 0 -19 0 * +Ed + 1e-07 1 1 0 +1 12 0 0 3.14159265358979 +2 21 7 0 0 3.14159265358979 +2 22 4 0 0 3.14159265358979 +0 + +0101000 ++21 0 -19 0 * +Wi + +0101000 +-20 0 +25 0 +18 0 -17 0 * +Fa +1 1e-07 7 0 + +0101000 ++16 0 * +Ed + 1e-07 1 1 0 +1 13 0 0 3.14159265358979 +2 13 8 0 0 3.14159265358979 +2 23 5 0 0 3.14159265358979 +0 + +0101000 ++28 0 -26 0 * +Ed + 1e-07 1 1 0 +1 14 0 0 3.14159265358979 +2 21 8 0 0 3.14159265358979 +2 24 6 0 0 3.14159265358979 +0 + +0101000 ++21 0 -19 0 * +Wi + +0101000 +-20 0 +14 0 +18 0 -13 0 * +Fa +1 1e-07 8 0 + +0101000 ++12 0 * +Wi + +0101000 ++32 0 -27 0 -14 0 +24 0 * +Fa +0 1e-07 5 0 + +0101000 +-10 0 * +Ed + 1e-07 1 1 0 +1 15 0 0 0.899999999999999 +2 25 4 0 0 0.899999999999999 +2 26 6 0 0 0.899999999999999 +0 + +0101000 ++41 0 -21 0 * +Ed + 1e-07 1 1 0 +1 16 0 0 0.899999999999999 +2 27 4 0 0 0.899999999999999 +2 28 6 0 0 0.899999999999999 +0 + +0101000 ++37 0 -19 0 * +Wi + +0101000 ++35 0 -8 0 -17 0 +7 0 * +Fa +0 1e-07 4 0 + +0101000 +-6 0 * +Wi + +0101000 ++31 0 -8 0 -13 0 +7 0 * +Fa +0 1e-07 6 0 + +0101000 +-4 0 * +Sh + +0101100 ++33 0 -29 0 +22 0 -15 0 +11 0 -9 0 -5 0 +3 0 * +So + +1100000 ++2 0 * + ++1 0 diff --git a/src/TEST_PY/test_unit/tuyau_v5.py b/src/TEST_PY/test_unit/tuyau_v5.py new file mode 100644 index 0000000..c293ef1 --- /dev/null +++ b/src/TEST_PY/test_unit/tuyau_v5.py @@ -0,0 +1,260 @@ +# -*- coding: latin-1 -*- +# Copyright (C) 2009-2012 CEA/DEN, EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# Francis KLOSS : 2012 : CEA-Saclay, DEN, DM2S, SFME, LGLS, F-91191 Gif-sur-Yvette, France +# ======================================================================================== + +import geompy +import hexablock + +# Charger la geometrie +# ==================== + +nom = "tuyau" + +geometrie = geompy.ImportBREP(nom+".brep") + +# Selectionner des sous-parties de la geometrie +# --------------------------------------------- + +aretes = geompy.SubShapeAllSortedCentres (geometrie, geompy.ShapeType["EDGE"]) +edge_id = geompy.SubShapeAllSortedCentresIDs (geometrie, geompy.ShapeType["EDGE"]) +faces = geompy.SubShapeAllSortedCentres (geometrie, geompy.ShapeType["FACE"]) +face_id = geompy.SubShapeAllSortedCentresIDs (geometrie, geompy.ShapeType["FACE"]) + +subid_arc_int_bas = 30 +subid_arc_int_haut = 34 +subid_arc_ext_bas = 12 +subid_arc_ext_haut = 16 + +arc_int_bas = aretes[12] +arc_int_haut = aretes[13] +arc_ext_bas = aretes[11] +arc_ext_haut = aretes[14] + +subid_ell_int_bas = 21 +subid_ell_int_haut = 33 +subid_ell_ext_bas = 8 +subid_ell_ext_haut = 15 + +ell_int_bas = aretes[2] +ell_int_haut = aretes[3] +ell_ext_bas = aretes[1] +ell_ext_haut = aretes[4] + +subid_gen_int_avan = 26 +subid_gen_int_arri = 28 +subid_gen_ext_avan = 5 +subid_gen_ext_arri = 10 + +gen_int_avan = aretes[8] +gen_int_arri = aretes[7] +gen_ext_avan = aretes[9] +gen_ext_arri = aretes[6] + +subid_face_int_bas = 24 +subid_face_int_haut = 31 +subid_face_ext_bas = 3 +subid_face_ext_haut = 13 + +face_int_bas = faces[4] +face_int_haut = faces[5] +face_ext_bas = faces[2] +face_ext_haut = faces[3] + +# Construire le modele de bloc +# ============================ + +doc = hexablock.addDocument(nom) + +# Definir le tuyau +# ---------------- + +base = doc.addVertex(0, 0, 0) + +direction = doc.addVector(1, 0, 0) + +tuyau = doc.addPipe(base, direction, 1, 2, 10) + +# Construire le modele de blocs du tuyau +# -------------------------------------- + +depart = doc.addVector(0, 1, 0) + +modele = doc.makePipe(tuyau, depart, 1, 4, 1) + +# Associer le modele de bloc a la geometrie +# ========================================= + +sh_tuyau = doc.addShape(geometrie,nom) +doc.clearAssociation() + +# Associer les cercles +# -------------------- + +cer_int_dep = modele.getVertexIJK(0, 0, 1) +cer_ext_dep = modele.getVertexIJK(1, 0, 1) + +cer_int = [] +cer_ext = [] +for j in xrange(4): + a = modele.getEdgeJ(0, j, 1) + cer_int.append(a) + + a = modele.getEdgeJ(1, j, 1) + cer_ext.append(a) + +doc.associateClosedLine(cer_int_dep, cer_int, [sh_tuyau], [34,30], 1, True) +doc.associateClosedLine(cer_ext_dep, cer_ext, [sh_tuyau], [16,12], 1, True) + +# Associer les ellipses +# --------------------- + +ell_int_dep = modele.getVertexIJK(0, 0, 0) +ell_ext_dep = modele.getVertexIJK(1, 0, 0) + +ell_int = [] +ell_ext = [] +for j in xrange(4): + a = modele.getEdgeJ(0, j, 0) + ell_int.append(a) + + a = modele.getEdgeJ(1, j, 0) + ell_ext.append(a) + +doc.associateClosedLine(ell_int_dep, ell_int, [sh_tuyau], [33,21], 1, True) +doc.associateClosedLine(ell_ext_dep, ell_ext, [sh_tuyau], [15, 8], 1, True) + +# Associer les generatrices +# ------------------------- + +def generatrice(face): + n = 10 + l = [] + for i in xrange(0, n+1): + v = float(i) / n + s = geompy.MakeVertexOnSurface(face, 0.5, v) + l.append(s) + + return geompy.MakeInterpol(l) + +gen = [] +gen_int_haut = generatrice(face_int_haut) +gen_ext_haut = generatrice(face_ext_haut) +gen_int_bas = generatrice(face_int_bas ) +gen_ext_bas = generatrice(face_ext_bas ) +gen.append(gen_int_haut) +gen.append(gen_ext_haut) +gen.append(gen_int_bas) +gen.append(gen_ext_bas) + +generatrices = geompy.MakeCompound(gen) +sh_gen = doc.addShape(generatrices,"generatrices") + +modele.getEdgeK(0, 0, 0).addAssociation(sh_tuyau, 28, 0, 1) +modele.getEdgeK(1, 0, 0).addAssociation(sh_tuyau, 10, 0, 1) + +modele.getEdgeK(0, 1, 0).addAssociation(sh_gen , 2, 0, 1) +modele.getEdgeK(1, 1, 0).addAssociation(sh_gen , 5, 0, 1) + +modele.getEdgeK(0, 2, 0).addAssociation(sh_tuyau, 26, 0, 1) +modele.getEdgeK(1, 2, 0).addAssociation(sh_tuyau, 5, 0, 1) + +modele.getEdgeK(0, 3, 0).addAssociation(sh_gen , 8, 0, 1) +modele.getEdgeK(1, 3, 0).addAssociation(sh_gen , 11, 0, 1) + +# Associer les faces courbees +# --------------------------- + +modele.getQuadJK(0, 0, 0).addAssociation(sh_tuyau, 31) +modele.getQuadJK(0, 1, 0).addAssociation(sh_tuyau, 31) +modele.getQuadJK(0, 2, 0).addAssociation(sh_tuyau, 24) +modele.getQuadJK(0, 3, 0).addAssociation(sh_tuyau, 24) + +modele.getQuadJK(1, 0, 0).addAssociation(sh_tuyau, 13) +modele.getQuadJK(1, 1, 0).addAssociation(sh_tuyau, 13) +modele.getQuadJK(1, 2, 0).addAssociation(sh_tuyau, 3) +modele.getQuadJK(1, 3, 0).addAssociation(sh_tuyau, 3) + +# Mailler le modele de bloc +# ========================= + +# Definir 3 groupes d'aretes +# -------------------------- + +groupe_cercles = doc.addEdgeGroup("Cercles") +groupe_ellipses = doc.addEdgeGroup("Ellipses") +groupe_generatrices = doc.addEdgeGroup("Generatrices") + +# Definir 4 groupes de faces +# -------------------------- + +groupe_couronne = doc.addQuadGroup("Couronne") +groupe_ovale = doc.addQuadGroup("Ovale") +groupe_interieur = doc.addQuadGroup("Interieur") +groupe_exterieur = doc.addQuadGroup("Exterieur") + +# Constituer les groupes d'aretes +# ------------------------------- + +for i in xrange(2): + for j in xrange(4): + arete = modele.getEdgeJ(i, j, 1) + groupe_cercles.addElement(arete) + + arete = modele.getEdgeJ(i, j, 0) + groupe_ellipses.addElement(arete) + + arete = modele.getEdgeK(i, j, 0) + groupe_generatrices.addElement(arete) + +# Constituer les groupes de faces +# ------------------------------- + +for j in xrange(4): + quad = modele.getQuadIJ(0, j, 1) + groupe_couronne.addElement(quad) + + quad = modele.getQuadIJ(0, j, 0) + groupe_ovale.addElement(quad) + + quad = modele.getQuadJK(0, j, 0) + groupe_interieur.addElement(quad) + + quad = modele.getQuadJK(1, j, 0) + groupe_exterieur.addElement(quad) + +# Mailler le modele de bloc avec ses associations +# ----------------------------------------------- + +########## hexablock.addLaws(doc, 0.7, True) Ne marche pas + +law = doc.addLaw("Uniform", 4) +for j in range(doc.countPropagation()): + propa = doc.getPropagation(j) + propa.setLaw(law) + +doc.save("tuyau_v5") +doc.setName("tuyau_v5") +hexablock.addToStudy(doc) + +blocs = hexablock.mesh(doc) + +muv, mue, muq, muh = hexablock.dump(doc, blocs)