diff --git a/build_cmake b/build_cmake index 83f78035a..7acc570e5 100755 --- a/build_cmake +++ b/build_cmake @@ -21,7 +21,7 @@ CURRENT_DIR=`pwd` CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` cd ${CONF_DIR} -python $KERNEL_ROOT_DIR/salome_adm/cmake_files/am2cmake.py --geom +python $KERNEL_ROOT_DIR/salome_adm/cmake_files/deprecated/am2cmake.py --geom status=$? cd ${CURRENT_DIR} exit $status diff --git a/build_cmake.bat b/build_cmake.bat index 0829ab1f1..6b14a8ade 100644 --- a/build_cmake.bat +++ b/build_cmake.bat @@ -17,4 +17,4 @@ @REM See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com @REM -%PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\am2cmake.py --geom +%PYTHONBIN% %KERNEL_ROOT_DIR%\salome_adm\cmake_files\deprecated\am2cmake.py --geom diff --git a/doc/salome/examples/3dsketcher.py b/doc/salome/examples/3dsketcher.py index 84dc28112..69b779898 100644 --- a/doc/salome/examples/3dsketcher.py +++ b/doc/salome/examples/3dsketcher.py @@ -5,7 +5,7 @@ import salome gg = salome.ImportComponentGUI("GEOM") # Create a 3D sketcher (wire) on the given points coordinates -sketcher1 = geompy.Make3DSketcher([ 0,0,0, 50,50,50, 0,50,0, 50,0,50, 10,20,100, 0,0,0 ]) +sketcher1 = geompy.Make3DSketcher([ 0,0,0, 50,50,50, 0,50,0, 50,0,25, 10,20,100, 0,0,0 ]) # add object in the study id_sketcher1 = geompy.addToStudy(sketcher1, "Sketcher1") @@ -24,7 +24,7 @@ sk = geompy.Sketcher3D() sk.addPointsAbsolute(1,2,3, 7,0,0, 10,-3.5,-11) # add one segment, defined by two angles in "OXY" coordinate system and length -sk.addPointAnglesLength("OXY", 45, 0, 100) +sk.addPointRadiusAnglesRelative(45, 0, 100, "OXY") # add three points with relative coordinates # three segments will be added by this command diff --git a/doc/salome/examples/Makefile.am b/doc/salome/examples/Makefile.am index 1174f0114..dc2264250 100644 --- a/doc/salome/examples/Makefile.am +++ b/doc/salome/examples/Makefile.am @@ -26,7 +26,8 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am pyexamplesdir = $(docdir)/examples/GEOM -BAD_TESTS = +BAD_TESTS = \ + repairing_operations_ex09.py GOOD_TESTS = \ 3dsketcher.py \ @@ -95,7 +96,6 @@ GOOD_TESTS = \ repairing_operations_ex06.py \ repairing_operations_ex07.py \ repairing_operations_ex08.py \ - repairing_operations_ex09.py \ repairing_operations_ex10.py \ repairing_operations_ex11.py \ sketcher.py \ @@ -135,7 +135,7 @@ pyexamples_SCRIPTS = $(BAD_TESTS) $(GOOD_TESTS) EXTRA_DIST += $(pyexamples_SCRIPTS) testme.py -check-local: +installcheck-local: @for f in $(GOOD_TESTS) ; do \ - python $(top_srcdir)/doc/salome/examples/testme.py $(top_srcdir)/doc/salome/examples/$$f || exit 1; \ + env GEOM_ROOT_DIR=$(prefix) python -B $(top_srcdir)/doc/salome/examples/testme.py $(top_srcdir)/doc/salome/examples/$$f || exit 1; \ done diff --git a/doc/salome/examples/angle.py b/doc/salome/examples/angle.py index 547db7184..324d72653 100644 --- a/doc/salome/examples/angle.py +++ b/doc/salome/examples/angle.py @@ -53,8 +53,11 @@ pnt1 = geompy.MakeVertex(0, 0, 0) pnt2 = geompy.MakeVertex(10, 0, 0) pnt3 = geompy.MakeVertex(20, 10, 0) arc = geompy.MakeArc(pnt1, pnt2, pnt3) -Angle = geompy.GetAngle(OX, arc) - -if (math.fabs(Angle + 1.0) > 1e-6 or geompy.MeasuOp.IsDone()): - print "Error. Angle must not be computed on curvilinear edges" +try: + Angle = geompy.GetAngle(OX, arc) pass +except: + # It is a correct case, because GetAngle() must not be computed on curvilinear edges. + pass + +assert (not geompy.MeasuOp.IsDone() ), 'Angle must not be computed on curvilinear edges.' diff --git a/doc/salome/examples/blocks_operations_ex03.py b/doc/salome/examples/blocks_operations_ex03.py index 546bc2274..268a52e10 100644 --- a/doc/salome/examples/blocks_operations_ex03.py +++ b/doc/salome/examples/blocks_operations_ex03.py @@ -4,7 +4,7 @@ import geompy import salome # create a box -box = geompy.MakeBoxDXDYDZ(200, 200, 200) +check_box = geompy.MakeBoxDXDYDZ(200, 200, 200) # build all possible propagation groups listChains = geompy.Propagate(check_box) diff --git a/doc/salome/examples/complex_objs_ex06.py b/doc/salome/examples/complex_objs_ex06.py index a836b35fc..4a3dfe439 100644 --- a/doc/salome/examples/complex_objs_ex06.py +++ b/doc/salome/examples/complex_objs_ex06.py @@ -2,19 +2,25 @@ import geompy import salome +import math gg = salome.ImportComponentGUI("GEOM") # create path WirePath = geompy.MakeSketcher("Sketcher:F 0 0:TT 100 0:R 0:C 100 90:T 0 200", [0, 0, 0, 0, 0, 1, 1, 0, -0]) +# get sub-shapes +edges = geompy.SubShapeAll(WirePath, geompy.ShapeType["EDGE"]) +vertices = geompy.SubShapeAll(WirePath, geompy.ShapeType["VERTEX"]) + + #======================================================= # Create shell sections #======================================================= -ps = [Vertex_1,Vertex_2,Vertex_3,Vertex_4] -theLocations = [Vertex_1, Vertex_2, Vertex_3, Vertex_4] +ps = [vertices[0],vertices[1],vertices[2],vertices[3]] +theLocations = [vertices[0],vertices[1],vertices[2],vertices[3]] VC = geompy.MakeCompound(theLocations) geompy.addToStudy(VC,"VC") -vs = [Edge_1,Edge_1,Edge_3,Edge_3] +vs = [edges[0],edges[0],edges[2],edges[2]] hs = [20,40,30,20] shells = [] subbases = [] @@ -49,30 +55,30 @@ faces = [] w = geompy.MakeSketcher("Sketcher:F 20 20:TT 0 20:TT 0 0:TT 20 0", [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1]) -[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"]) -arc = MakeArc(w,3,-1) -w = geompy.MakeWire([e1,e2,e3,arc]) +contour = geompy.CloseContour(w, [], isCommonVertex=False) +[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"]) +w = geompy.MakeWire([e1,e2,e3,e4]) f1 = geompy.MakeFace(w,1) w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20", [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1]) -[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"]) -arc = MakeArc(w,3,-1) -w = geompy.MakeWire([e1,e2,e3,arc]) +contour = geompy.CloseContour(w, [], isCommonVertex=False) +[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"]) +w = geompy.MakeWire([e1,e2,e3,e4]) f2 = geompy.MakeFace(w,1) w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20", [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1]) -[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"]) -arc = MakeArc(w,3,-1) -w = geompy.MakeWire([e1,e2,e3,arc]) +contour = geompy.CloseContour(w, [], isCommonVertex=False) +[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"]) +w = geompy.MakeWire([e1,e2,e3,e4]) f3 = geompy.MakeFace(w,1) w = geompy.MakeSketcher("Sketcher:F -20 -20:TT 0 -20:TT 0 0:TT -20 0", [c1[0], c1[1], c1[2], nx, ny, nz, 0, 0, 1]) -[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"]) -arc = MakeArc(w,3,-1) -w = geompy.MakeWire([e1,e2,e3,arc]) +contour = geompy.CloseContour(w, [], isCommonVertex=False) +[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"]) +w = geompy.MakeWire([e1,e2,e3,e4]) f4 = geompy.MakeFace(w,1) faces.append(f1) @@ -94,30 +100,30 @@ nz = c3[2] - c2[2] w = geompy.MakeSketcher("Sketcher:F 20 20:TT 0 20:TT 0 0:TT 20 0", [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1]) -[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"]) -arc = MakeArc(w,3,1) -w = geompy.MakeWire([e1,e2,e3,arc]) +contour = geompy.CloseContour(w, [], isCommonVertex=False) +[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"]) +w = geompy.MakeWire([e1,e2,e3,e4]) f1 = geompy.MakeFace(w,1) w = geompy.MakeSketcher("Sketcher:F -20 0:TT 0 0:TT 0 20:TT -20 20", [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1]) -[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"]) -arc = MakeArc(w,3,1) -w = geompy.MakeWire([e1,e2,e3,arc]) +contour = geompy.CloseContour(w, [], isCommonVertex=False) +[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"]) +w = geompy.MakeWire([e1,e2,e3,e4]) f2 = geompy.MakeFace(w,1) w = geompy.MakeSketcher("Sketcher:F 20 0:TT 0 0:TT 0 -20:TT 20 -20", [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1]) -[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"]) -arc = MakeArc(w,3,1) -w = geompy.MakeWire([e1,e2,e3,arc]) +contour = geompy.CloseContour(w, [], isCommonVertex=False) +[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"]) +w = geompy.MakeWire([e1,e2,e3,e4]) f3 = geompy.MakeFace(w,1) w = geompy.MakeSketcher("Sketcher:F -20 -20:TT 0 -20:TT 0 0:TT -20 0", [c2[0], c2[1], c2[2], nx, ny, nz, 0, 0, 1]) -[e1,e2,e3] = geompy.SubShapeAll(w, geompy.ShapeType["EDGE"]) -arc = MakeArc(w,3,1) -w = geompy.MakeWire([e1,e2,e3,arc]) +contour = geompy.CloseContour(w, [], isCommonVertex=False) +[e1,e2,e3,e4] = geompy.SubShapeAll(contour, geompy.ShapeType["EDGE"]) +w = geompy.MakeWire([e1,e2,e3,e4]) f4 = geompy.MakeFace(w,1) faces.append(f1) @@ -163,19 +169,19 @@ fs.append(ff) aPartition = geompy.MakePartition(shellsph,fs) fs = geompy.SubShapeAllSortedCentres(aPartition, geompy.ShapeType["FACE"]) -faces.append(fs[0]) -faces.append(fs[1]) -faces.append(fs[2]) -faces.append(fs[3]) +for face in fs: + if ( 4 == geompy.NbShapes(face, geompy.ShapeType["VERTEX"]) ): + faces.append(face) + pass + pass shell = geompy.MakeSewing(faces,1.e-6) shells.append(shell) faces = geompy.SubShapeAllSortedCentres(shell, geompy.ShapeType["FACE"]) - +subbases.append(faces[2]) #=========================================================== # Create Pipe #=========================================================== -subbases = [] Pipe = geompy.MakePipeWithShellSections(shells, subbases, theLocations, WirePath, theWithContact=0, theWithCorrection=0) diff --git a/doc/salome/examples/primitives_ex06.py b/doc/salome/examples/primitives_ex06.py index c558eafb8..d3fd53e35 100644 --- a/doc/salome/examples/primitives_ex06.py +++ b/doc/salome/examples/primitives_ex06.py @@ -31,5 +31,5 @@ id_disk3 = geompy.addToStudy(disk3,"Disk3") # display disks gg.createAndDisplayGO(id_vxy) gg.createAndDisplayGO(id_disk1) -gg.createAndDisplayGO(id_diks2) -gg.createAndDisplayGO(id_diks3) +gg.createAndDisplayGO(id_disk2) +gg.createAndDisplayGO(id_disk3) diff --git a/doc/salome/examples/repairing_operations_ex05.py b/doc/salome/examples/repairing_operations_ex05.py index f6593b3e8..b7534ab65 100644 --- a/doc/salome/examples/repairing_operations_ex05.py +++ b/doc/salome/examples/repairing_operations_ex05.py @@ -2,6 +2,7 @@ import geompy import salome +import GEOM gg = salome.ImportComponentGUI("GEOM") # create a vertex and a vector @@ -21,20 +22,19 @@ cone = geompy.MakeCone(p1, v, 70, 0, 80) cut = geompy.MakeCut(cone, cylinder) # get faces as sub-shapes -faces = [] faces = geompy.SubShapeAllSortedCentres(cut, geompy.ShapeType["FACE"]) f_2 = geompy.GetSubShapeID(cut, faces[2]) # remove one face from the shape cut_without_f_2 = geompy.SuppressFaces(cut, [f_2]) -# get wires as sub-shapes -wires = [] -wires = geompy.SubShapeAllSortedCentres(cut_without_f_2, geompy.ShapeType["WIRE"]) -w_0 = geompy.GetSubShapeID(cut_without_f_2, wires[0]) +# get edges as sub-shapes +edges = geompy.SubShapeAllSortedCentres(faces[2], geompy.ShapeType["EDGE"]) +edge = geompy.GetInPlace(cut_without_f_2, edges[0], True) +e_2 = geompy.GetSubShapeID(cut_without_f_2, edge) -# suppress the selected wire -result = geompy.SuppressHoles(cut_without_f_2, [w_0]) +# suppress a hole using the selected edge +result = geompy.SuppressHoles(cut_without_f_2, [e_2]) # add objects in the study id_cut = geompy.addToStudy(cut, "Cut") diff --git a/doc/salome/examples/repairing_operations_ex09.py b/doc/salome/examples/repairing_operations_ex09.py index 41807fee4..e94b1aa03 100644 --- a/doc/salome/examples/repairing_operations_ex09.py +++ b/doc/salome/examples/repairing_operations_ex09.py @@ -1,9 +1,10 @@ # Limit Tolerance import geompy +import salome gg = salome.ImportComponentGUI("GEOM") -# import initial topology +# import initial topology with bad tolerances (more than 1e-07) shape1 = geompy.ImportBREP("my_shape_1.brep") shape2 = geompy.ImportBREP("my_shape_2.brep") diff --git a/doc/salome/examples/testme.py b/doc/salome/examples/testme.py index d8a98200d..f6c5e7837 100755 --- a/doc/salome/examples/testme.py +++ b/doc/salome/examples/testme.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -import unittest, sys +import unittest, sys, os class SalomeSession(object): def __init__(self, script): @@ -10,11 +10,10 @@ class SalomeSession(object): sys.argv += ["--modules=GEOM"] sys.argv += ["--execute=%s" % script] clt, d = runSalome.main() - self.port = d['port'] return def __del__(self): - port = self.port + port = os.getenv('NSPORT') import killSalomeWithPort killSalomeWithPort.killMyPort(port) return diff --git a/doc/salome/examples/viewing_geom_objs_ex04.py b/doc/salome/examples/viewing_geom_objs_ex04.py index cf521f407..f31edefee 100644 --- a/doc/salome/examples/viewing_geom_objs_ex04.py +++ b/doc/salome/examples/viewing_geom_objs_ex04.py @@ -2,8 +2,9 @@ import salome import geompy +import GEOM -texture = geompy.LoadTexture("/users/user/mytexture.dat") +texture = geompy.LoadTexture(os.getenv("DATA_DIR")+"/Textures/texture1.dat") v1 = geompy.MakeVertex(0, 0, 0) v2 = geompy.MakeVertex(100, 0, 0) diff --git a/doc/salome/gui/GEOM/doxyfile.in b/doc/salome/gui/GEOM/doxyfile.in index 267b71c24..35639edb0 100755 --- a/doc/salome/gui/GEOM/doxyfile.in +++ b/doc/salome/gui/GEOM/doxyfile.in @@ -43,7 +43,7 @@ FILE_PATTERNS = *.doc EXCLUDE_PATTERNS = creating_adv_obj.doc EXCLUDE = IMAGE_PATH = @srcdir@/images -EXAMPLE_PATH = @top_srcdir@/src/GEOM_SWIG @top_srcdir@/doc/salome/examples +EXAMPLE_PATH = @top_srcdir@/doc/salome/examples @top_srcdir@/src/GEOM_SWIG #--------------------------------------------------------------------------- #HTML related options @@ -81,3 +81,8 @@ TAGFILES = geompy_doc.tag=../GEOM/geompy_doc #rnv: 07.04.2011 Workaroun #because it wrongly defines location of the html files for search. ALLEXTERNALS = NO SEARCHENGINE = YES + +#--------------------------------------------------------------------------- +#Custom commands +#--------------------------------------------------------------------------- +ALIASES += tui_script{1}="\include \1 Download this script" diff --git a/doc/salome/gui/GEOM/doxyfile_tui.in b/doc/salome/gui/GEOM/doxyfile_tui.in index 9617a169d..516f87b16 100755 --- a/doc/salome/gui/GEOM/doxyfile_tui.in +++ b/doc/salome/gui/GEOM/doxyfile_tui.in @@ -41,7 +41,7 @@ WARNINGS = YES INPUT = @srcdir@/input FILE_PATTERNS = tui_*.doc IMAGE_PATH = @srcdir@/images -EXAMPLE_PATH = @top_srcdir@/src/GEOM_SWIG +EXAMPLE_PATH = @top_srcdir@/doc/salome/examples @top_srcdir@/src/GEOM_SWIG #--------------------------------------------------------------------------- #HTML related options @@ -71,3 +71,8 @@ GENERATE_RTF = NO #--------------------------------------------------------------------------- GENERATE_TAGFILE = tui_examples.tag SEARCHENGINE = YES + +#--------------------------------------------------------------------------- +#Custom commands +#--------------------------------------------------------------------------- +ALIASES += tui_script{1}="\include \1 Download this script" diff --git a/doc/salome/gui/GEOM/input/tui_3dsketcher.doc b/doc/salome/gui/GEOM/input/tui_3dsketcher.doc index 9afadc9ca..db3504a1f 100755 --- a/doc/salome/gui/GEOM/input/tui_3dsketcher.doc +++ b/doc/salome/gui/GEOM/input/tui_3dsketcher.doc @@ -1,7 +1,6 @@ /*! \page tui_3dsketcher_page 3D Sketcher -\include 3dsketcher.py -Download this script +\tui_script{3dsketcher.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc index 1f513a496..d963c28ea 100644 --- a/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_advanced_geom_objs.doc @@ -4,18 +4,15 @@ \anchor tui_creation_pipetshape

Creation of PipeTShape

-\include advanced_geom_objs_ex01.py -Download this script +\tui_script{advanced_geom_objs_ex01.py} \anchor tui_creation_divideddisk

Creation of DividedDisk

-\include advanced_geom_objs_ex02.py -Download this script +\tui_script{advanced_geom_objs_ex02.py} \anchor tui_creation_dividedcylinder

Creation of DividedCylinder

-\include advanced_geom_objs_ex03.py -Download this script +\tui_script{advanced_geom_objs_ex03.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_angle.doc b/doc/salome/gui/GEOM/input/tui_angle.doc index e1618fb30..7cca534f4 100644 --- a/doc/salome/gui/GEOM/input/tui_angle.doc +++ b/doc/salome/gui/GEOM/input/tui_angle.doc @@ -1,7 +1,6 @@ /*! \page tui_angle_page Angle -\include angle.py -Download this script +\tui_script{angle.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc index fcb21c268..89be6f64b 100644 --- a/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_basic_geom_objs.doc @@ -4,47 +4,38 @@ \anchor tui_creation_point

Creation of a Point

-\include basic_geom_objs_ex01.py -Download this script +\tui_script{basic_geom_objs_ex01.py} \anchor tui_creation_line

Creation of a Line

-\include basic_geom_objs_ex02.py -Download this script +\tui_script{basic_geom_objs_ex02.py} \anchor tui_creation_circle

Creation of a Circle

-\include basic_geom_objs_ex03.py -Download this script +\tui_script{basic_geom_objs_ex03.py} \anchor tui_creation_ellipse

Creation of an Ellipse

-\include basic_geom_objs_ex04.py -Download this script +\tui_script{basic_geom_objs_ex04.py} \anchor tui_creation_arc

Creation of an Arc

-\include basic_geom_objs_ex05.py -Download this script +\tui_script{basic_geom_objs_ex05.py} \anchor tui_creation_curve

Creation of a Curve

-\include basic_geom_objs_ex06.py -Download this script +\tui_script{basic_geom_objs_ex06.py} \anchor tui_creation_vector

Creation of a Vector

-\include basic_geom_objs_ex07.py -Download this script +\tui_script{basic_geom_objs_ex07.py} \anchor tui_creation_plane

Creation of a Plane

-\include basic_geom_objs_ex08.py -Download this script +\tui_script{basic_geom_objs_ex08.py} \anchor tui_creation_lcs

Creation of a Local Coordinate System

-\include basic_geom_objs_ex09.py -Download this script +\tui_script{basic_geom_objs_ex09.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_basic_operations.doc b/doc/salome/gui/GEOM/input/tui_basic_operations.doc index 3899255b1..743b75dc2 100644 --- a/doc/salome/gui/GEOM/input/tui_basic_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_basic_operations.doc @@ -4,17 +4,14 @@ \anchor tui_partition

Partition

-\include basic_operations_ex01.py -Download this script +\tui_script{basic_operations_ex01.py} \anchor tui_archimede

Archimede

-\include basic_operations_ex02.py -Download this script +\tui_script{basic_operations_ex02.py} \anchor tui_restore_prs_params

Restore presentation parameters and sub-shapes

-\include basic_operations_ex03.py -Download this script +\tui_script{basic_operations_ex03.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_basic_properties.doc b/doc/salome/gui/GEOM/input/tui_basic_properties.doc index dad8e828b..ed03ccfd4 100644 --- a/doc/salome/gui/GEOM/input/tui_basic_properties.doc +++ b/doc/salome/gui/GEOM/input/tui_basic_properties.doc @@ -1,7 +1,6 @@ /*! \page tui_basic_properties_page Basic Properties -\include basic_properties.py -Download this script +\tui_script{basic_properties.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_blocks_operations.doc b/doc/salome/gui/GEOM/input/tui_blocks_operations.doc index 4acb44f80..58a761a42 100644 --- a/doc/salome/gui/GEOM/input/tui_blocks_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_blocks_operations.doc @@ -4,17 +4,14 @@ \anchor tui_multi_transformation

Multi Transformation

-\include blocks_operations_ex01.py -Download this script +\tui_script{blocks_operations_ex01.py} \anchor tui_explode_on_blocks

Explode on Blocks

-\include blocks_operations_ex02.py -Download this script +\tui_script{blocks_operations_ex02.py} \anchor tui_propagate

Propagate

-\include blocks_operations_ex03.py -Download this script +\tui_script{blocks_operations_ex03.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_boolean_operations.doc b/doc/salome/gui/GEOM/input/tui_boolean_operations.doc index 0ab8db001..784003c3c 100644 --- a/doc/salome/gui/GEOM/input/tui_boolean_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_boolean_operations.doc @@ -4,22 +4,18 @@ \anchor tui_fuse

Fuse

-\include boolean_operations_ex01.py -Download this script +\tui_script{boolean_operations_ex01.py} \anchor tui_common

Common

-\include boolean_operations_ex02.py -Download this script +\tui_script{boolean_operations_ex02.py} \anchor tui_cut

Cut

-\include boolean_operations_ex03.py -Download this script +\tui_script{boolean_operations_ex03.py} \anchor tui_section

Section

-\include boolean_operations_ex04.py -Download this script +\tui_script{boolean_operations_ex04.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_bounding_box.doc b/doc/salome/gui/GEOM/input/tui_bounding_box.doc index 76d4b4347..5dd436773 100644 --- a/doc/salome/gui/GEOM/input/tui_bounding_box.doc +++ b/doc/salome/gui/GEOM/input/tui_bounding_box.doc @@ -1,7 +1,6 @@ /*! \page tui_bounding_box_page Bounding Box -\include bounding_box.py -Download this script +\tui_script{bounding_box.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_building_by_blocks.doc b/doc/salome/gui/GEOM/input/tui_building_by_blocks.doc index 77f8e363b..ab66d27a4 100644 --- a/doc/salome/gui/GEOM/input/tui_building_by_blocks.doc +++ b/doc/salome/gui/GEOM/input/tui_building_by_blocks.doc @@ -3,11 +3,9 @@ \page tui_building_by_blocks_page Building by Blocks

Quadrangle Face

-\include building_by_blocks_ex01.py -Download this script +\tui_script{building_by_blocks_ex01.py}

Hexagonal Solid

-\include building_by_blocks_ex02.py -Download this script +\tui_script{building_by_blocks_ex02.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_center_of_mass.doc b/doc/salome/gui/GEOM/input/tui_center_of_mass.doc index 49eb49538..604d67b61 100644 --- a/doc/salome/gui/GEOM/input/tui_center_of_mass.doc +++ b/doc/salome/gui/GEOM/input/tui_center_of_mass.doc @@ -1,7 +1,6 @@ /*! \page tui_center_of_mass_page Center of masses -\include center_of_mass.py -Download this script +\tui_script{center_of_mass.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc b/doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc index eeb9d92a1..ff448334b 100644 --- a/doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc +++ b/doc/salome/gui/GEOM/input/tui_check_compound_of_blocks.doc @@ -1,7 +1,6 @@ /*! \page tui_check_compound_of_blocks_page Check Compound of Blocks -\include check_compound_of_blocks.py -Download this script +\tui_script{check_compound_of_blocks.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_check_self_intersections.doc b/doc/salome/gui/GEOM/input/tui_check_self_intersections.doc index 346de0c2b..d3d6c06af 100644 --- a/doc/salome/gui/GEOM/input/tui_check_self_intersections.doc +++ b/doc/salome/gui/GEOM/input/tui_check_self_intersections.doc @@ -1,7 +1,6 @@ /*! \page tui_check_self_intersections_page Detect Self-intersections -\include check_self_intersections.py -Download this script +\tui_script{check_self_intersections.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_check_shape.doc b/doc/salome/gui/GEOM/input/tui_check_shape.doc index 5e11279ef..59ebd7d47 100644 --- a/doc/salome/gui/GEOM/input/tui_check_shape.doc +++ b/doc/salome/gui/GEOM/input/tui_check_shape.doc @@ -1,7 +1,6 @@ /*! \page tui_check_shape_page Check Shape -\include check_shape.py -Download this script +\tui_script{check_shape.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_complex_objs.doc b/doc/salome/gui/GEOM/input/tui_complex_objs.doc index 030943956..61ce18b5a 100644 --- a/doc/salome/gui/GEOM/input/tui_complex_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_complex_objs.doc @@ -4,51 +4,42 @@ \anchor tui_creation_prism

Creation of a Prism

-\include complex_objs_ex01.py -Download this script +\tui_script{complex_objs_ex01.py} \anchor tui_creation_revolution

Creation of a Revolution

-\include complex_objs_ex02.py -Download this script +\tui_script{complex_objs_ex02.py} \anchor tui_creation_filling

Creation of a Filling

-\include complex_objs_ex03.py -Download this script +\tui_script{complex_objs_ex03.py} \anchor tui_creation_pipe

Creation of a Pipe

-\include complex_objs_ex04.py -Download this script +\tui_script{complex_objs_ex04.py} \anchor tui_creation_pipe_with_diff_sec

Creation of a PipeWithDifferentSections

-\include complex_objs_ex05.py -Download this script +\tui_script{complex_objs_ex05.py} \anchor tui_creation_pipe_with_shell_sec

Creation of a PipeWithShellSections

-\include complex_objs_ex06.py -Download this script +\tui_script{complex_objs_ex06.py} \anchor tui_creation_pipe_without_path

Creation of a PipeShellsWithoutPath

-\include complex_objs_ex07.py -Download this script +\tui_script{complex_objs_ex07.py} \anchor tui_creation_pipe_binormal_along_vector

Creation of a PipeBiNormalAlongVector

-\include complex_objs_ex08.py -Download this script +\tui_script{complex_objs_ex08.py} \anchor tui_creation_pipe_path

Creation of a Middle Path

-\include complex_objs_ex09.py -Download this script +\tui_script{complex_objs_ex09.py} +\anchor tui_creation_tangent_plane_on_face

Creation of Tangent Plane On Face

-\include complex_objs_ex10.py -Download this script +\tui_script{complex_objs_ex10.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_free_boundaries.doc b/doc/salome/gui/GEOM/input/tui_free_boundaries.doc index fb0420c6d..41a2a5dd8 100644 --- a/doc/salome/gui/GEOM/input/tui_free_boundaries.doc +++ b/doc/salome/gui/GEOM/input/tui_free_boundaries.doc @@ -1,7 +1,6 @@ /*! \page tui_free_boundaries_page Check Free Boundaries -\include free_boundaries.py -Download this script +\tui_script{free_boundaries.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_free_faces.doc b/doc/salome/gui/GEOM/input/tui_free_faces.doc index 00ae5bd23..c0a9286fd 100644 --- a/doc/salome/gui/GEOM/input/tui_free_faces.doc +++ b/doc/salome/gui/GEOM/input/tui_free_faces.doc @@ -1,7 +1,6 @@ /*! \page tui_free_faces_page Check Free Faces -\include free_faces.py -Download this script +\tui_script{free_faces.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_get_non_blocks.doc b/doc/salome/gui/GEOM/input/tui_get_non_blocks.doc index ca7a98d8f..df1ffe054 100644 --- a/doc/salome/gui/GEOM/input/tui_get_non_blocks.doc +++ b/doc/salome/gui/GEOM/input/tui_get_non_blocks.doc @@ -1,7 +1,6 @@ /*! \page tui_get_non_blocks_page Get Non Blocks -\include get_non_blocks.py -Download this script +\tui_script{get_non_blocks.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_import_export.doc b/doc/salome/gui/GEOM/input/tui_import_export.doc index 52adf987e..7b3efdde4 100644 --- a/doc/salome/gui/GEOM/input/tui_import_export.doc +++ b/doc/salome/gui/GEOM/input/tui_import_export.doc @@ -1,7 +1,6 @@ /*! \page tui_import_export_page Import/Export -\include import_export.py -Download this script +\tui_script{import_export.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_inertia.doc b/doc/salome/gui/GEOM/input/tui_inertia.doc index a62b20784..2f7923d8b 100644 --- a/doc/salome/gui/GEOM/input/tui_inertia.doc +++ b/doc/salome/gui/GEOM/input/tui_inertia.doc @@ -1,7 +1,6 @@ /*! \page tui_inertia_page Inertia -\include inertia.py -Download this script +\tui_script{inertia.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_min_distance.doc b/doc/salome/gui/GEOM/input/tui_min_distance.doc index db024ca4b..a53e90104 100644 --- a/doc/salome/gui/GEOM/input/tui_min_distance.doc +++ b/doc/salome/gui/GEOM/input/tui_min_distance.doc @@ -1,7 +1,6 @@ /*! \page tui_min_distance_page Minimal Distance -\include min_distance.py -Download this script +\tui_script{min_distance.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_normal_face.doc b/doc/salome/gui/GEOM/input/tui_normal_face.doc index 7d31fcc26..13d900003 100644 --- a/doc/salome/gui/GEOM/input/tui_normal_face.doc +++ b/doc/salome/gui/GEOM/input/tui_normal_face.doc @@ -1,7 +1,6 @@ /*! \page tui_normal_face_page Normal to a Face -\include normal_face.py -Download this script +\tui_script{normal_face.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_notebook_geom.doc b/doc/salome/gui/GEOM/input/tui_notebook_geom.doc index 8db9c59d2..38dac8255 100644 --- a/doc/salome/gui/GEOM/input/tui_notebook_geom.doc +++ b/doc/salome/gui/GEOM/input/tui_notebook_geom.doc @@ -3,7 +3,6 @@ \page tui_notebook_geom_page Using SALOME NoteBook \anchor tui_notebook_geom -\include notebook_geom.py -Download this script +\tui_script{notebook_geom.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_point_coordinates.doc b/doc/salome/gui/GEOM/input/tui_point_coordinates.doc index 6fbb9c9a6..3dcba1b21 100644 --- a/doc/salome/gui/GEOM/input/tui_point_coordinates.doc +++ b/doc/salome/gui/GEOM/input/tui_point_coordinates.doc @@ -1,7 +1,6 @@ /*! \page tui_point_coordinates_page Point Coordinates -\include point_coordinates.py -Download this script +\tui_script{point_coordinates.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_primitives.doc b/doc/salome/gui/GEOM/input/tui_primitives.doc index 9c4f49d55..f70bead3c 100644 --- a/doc/salome/gui/GEOM/input/tui_primitives.doc +++ b/doc/salome/gui/GEOM/input/tui_primitives.doc @@ -4,37 +4,30 @@ \anchor tui_creation_box

Creation of a Box

-\include primitives_ex01.py -Download this script +\tui_script{primitives_ex01.py} \anchor tui_creation_cylinder

Creation of a Cylinder

-\include primitives_ex02.py -Download this script +\tui_script{primitives_ex02.py} \anchor tui_creation_sphere

Creation of a Sphere

-\include primitives_ex03.py -Download this script +\tui_script{primitives_ex03.py} \anchor tui_creation_torus

Creation of a Torus

-\include primitives_ex04.py -Download this script +\tui_script{primitives_ex04.py} \anchor tui_creation_cone

Creation of a Cone

-\include primitives_ex05.py -Download this script +\tui_script{primitives_ex05.py} \anchor tui_creation_disk

Creation of a Disk

-\include primitives_ex06.py -Download this script +\tui_script{primitives_ex06.py} \anchor tui_creation_squareface

Creation of a Rectangle

-\include primitives_ex07.py -Download this script +\tui_script{primitives_ex07.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_repairing_operations.doc b/doc/salome/gui/GEOM/input/tui_repairing_operations.doc index 286731970..711800caa 100644 --- a/doc/salome/gui/GEOM/input/tui_repairing_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_repairing_operations.doc @@ -4,57 +4,46 @@ \anchor tui_shape_processing

Shape Processing

-\include repairing_operations_ex01.py -Download this script +\tui_script{repairing_operations_ex01.py} \anchor tui_suppress_faces

Suppress Faces

-\include repairing_operations_ex02.py -Download this script +\tui_script{repairing_operations_ex02.py} \anchor tui_close_contour

Close Contour

-\include repairing_operations_ex03.py -Download this script +\tui_script{repairing_operations_ex03.py} \anchor tui_suppress_internal_wires

Suppress Internal Wires

-\include repairing_operations_ex04.py -Download this script +\tui_script{repairing_operations_ex04.py} \anchor tui_suppress_holes

Suppress Holes

-\include repairing_operations_ex05.py -Download this script +\tui_script{repairing_operations_ex05.py} \anchor tui_sewing

Sewing

-\include repairing_operations_ex06.py -Download this script +\tui_script{repairing_operations_ex06.py} \anchor tui_glue_faces

Glue Faces

-\include repairing_operations_ex07.py -Download this script +\tui_script{repairing_operations_ex07.py} \anchor tui_glue_edges

Glue Edges

-\include repairing_operations_ex08.py -Download this script +\tui_script{repairing_operations_ex08.py} \anchor tui_limit_tolerance

Limit Tolerance

-\include repairing_operations_ex09.py -Download this script +\tui_script{repairing_operations_ex09.py} \anchor tui_add_point_on_edge

Add Point on Edge

-\include repairing_operations_ex10.py -Download this script +\tui_script{repairing_operations_ex10.py} \anchor tui_fuse_collinear_edges

Fuse Collinear Edges within a Wire

-\include repairing_operations_ex11.py -Download this script +\tui_script{repairing_operations_ex11.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_sketcher.doc b/doc/salome/gui/GEOM/input/tui_sketcher.doc index be24fd763..2c0f2d885 100644 --- a/doc/salome/gui/GEOM/input/tui_sketcher.doc +++ b/doc/salome/gui/GEOM/input/tui_sketcher.doc @@ -1,7 +1,6 @@ /*! \page tui_sketcher_page 2D Sketcher -\include sketcher.py -Download this script +\tui_script{sketcher.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_tolerance.doc b/doc/salome/gui/GEOM/input/tui_tolerance.doc index 4da20b249..552454cf8 100644 --- a/doc/salome/gui/GEOM/input/tui_tolerance.doc +++ b/doc/salome/gui/GEOM/input/tui_tolerance.doc @@ -1,7 +1,6 @@ /*! \page tui_tolerance_page Tolerance -\include tolerance.py -Download this script +\tui_script{tolerance.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_topological_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_topological_geom_objs.doc index 2b9f5d1c2..9576e47a8 100644 --- a/doc/salome/gui/GEOM/input/tui_topological_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_topological_geom_objs.doc @@ -4,32 +4,26 @@ \anchor tui_creation_edge

Creation of an Edge

-\include topological_geom_objs_ex01.py -Download this script +\tui_script{topological_geom_objs_ex01.py} \anchor tui_creation_wire

Creation of a Wire

-\include topological_geom_objs_ex02.py -Download this script +\tui_script{topological_geom_objs_ex02.py} \anchor tui_creation_face

Creation of a Face

-\include topological_geom_objs_ex03.py -Download this script +\tui_script{topological_geom_objs_ex03.py} \anchor tui_creation_shell

Creation of a Shell

-\include topological_geom_objs_ex04.py -Download this script +\tui_script{topological_geom_objs_ex04.py} \anchor tui_creation_solid

Creation of a Solid

-\include topological_geom_objs_ex05.py -Download this script +\tui_script{topological_geom_objs_ex05.py} \anchor tui_creation_compound

Creation of a Compound

-\include topological_geom_objs_ex06.py -Download this script +\tui_script{topological_geom_objs_ex06.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_transformation_operations.doc b/doc/salome/gui/GEOM/input/tui_transformation_operations.doc index 10e392ec0..f25eb9c76 100644 --- a/doc/salome/gui/GEOM/input/tui_transformation_operations.doc +++ b/doc/salome/gui/GEOM/input/tui_transformation_operations.doc @@ -4,67 +4,54 @@ \anchor tui_translation

Translation

-\include transformation_operations_ex01.py -Download this script +\tui_script{transformation_operations_ex01.py} \anchor tui_rotation

Rotation

-\include transformation_operations_ex02.py -Download this script +\tui_script{transformation_operations_ex02.py} \anchor tui_modify_location

Modify Location

-\include transformation_operations_ex03.py -Download this script +\tui_script{transformation_operations_ex03.py} \anchor tui_mirror

Mirror Image

-\include transformation_operations_ex04.py -Download this script +\tui_script{transformation_operations_ex04.py} \anchor tui_scale

Scale Transform

-\include transformation_operations_ex05.py -Download this script +\tui_script{transformation_operations_ex05.py} \anchor tui_offset

Offset Surface

-\include transformation_operations_ex06.py -Download this script +\tui_script{transformation_operations_ex06.py} \anchor tui_projection

Projection

-\include transformation_operations_ex07.py -Download this script +\tui_script{transformation_operations_ex07.py} \anchor tui_multi_translation

Multi Translation

-\include transformation_operations_ex08.py -Download this script +\tui_script{transformation_operations_ex08.py} \anchor tui_multi_rotation

Multi Rotation

-\include transformation_operations_ex09.py -Download this script +\tui_script{transformation_operations_ex09.py} \anchor tui_fillet2d

Fillet 2D

-\include transformation_operations_ex10.py -Download this script +\tui_script{transformation_operations_ex10.py} \anchor tui_fillet1d

Fillet 1D

-\include transformation_operations_ex11.py -Download this script +\tui_script{transformation_operations_ex11.py} \anchor tui_fillet

Fillet

-\include transformation_operations_ex12.py -Download this script +\tui_script{transformation_operations_ex12.py} \anchor tui_chamfer

Chamfer

-\include transformation_operations_ex13.py -Download this script +\tui_script{transformation_operations_ex13.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc b/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc index 8505548d3..205ac6183 100644 --- a/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc +++ b/doc/salome/gui/GEOM/input/tui_viewing_geom_objs.doc @@ -4,22 +4,18 @@ \anchor tui_change_disp_mode

Changing Display Mode

-\include viewing_geom_objs_ex01.py -Download this script +\tui_script{viewing_geom_objs_ex01.py} \anchor tui_change_color

Changing Color

-\include viewing_geom_objs_ex02.py -Download this script +\tui_script{viewing_geom_objs_ex02.py} \anchor tui_change_transparency

Changing Transparency

-\include viewing_geom_objs_ex03.py -Download this script +\tui_script{viewing_geom_objs_ex03.py} \anchor tui_point_marker

Set Point Marker

-\include viewing_geom_objs_ex04.py -Download this script +\tui_script{viewing_geom_objs_ex04.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_whatis.doc b/doc/salome/gui/GEOM/input/tui_whatis.doc index d1c8fc911..603f34147 100644 --- a/doc/salome/gui/GEOM/input/tui_whatis.doc +++ b/doc/salome/gui/GEOM/input/tui_whatis.doc @@ -1,7 +1,6 @@ /*! \page tui_whatis_page What Is -\include whatis.py -Download this script +\tui_script{whatis.py} */ diff --git a/doc/salome/gui/GEOM/input/tui_working_with_groups.doc b/doc/salome/gui/GEOM/input/tui_working_with_groups.doc index 4f252c2e9..e21cb5588 100644 --- a/doc/salome/gui/GEOM/input/tui_working_with_groups.doc +++ b/doc/salome/gui/GEOM/input/tui_working_with_groups.doc @@ -5,35 +5,29 @@
\anchor tui_create_groups_anchor

Creation of a group

-\include working_with_groups_ex01.py -Download this script +\tui_script{working_with_groups_ex01.py} \anchor tui_edit_groups_anchor

Adding an object to the group

-\include working_with_groups_ex02.py -Download this script +\tui_script{working_with_groups_ex02.py}

Removing an object from the group

-\include working_with_groups_ex03.py -Download this script +\tui_script{working_with_groups_ex03.py}
\anchor tui_union_groups_anchor

Union Groups

-\include working_with_groups_ex04.py -Download this script +\tui_script{working_with_groups_ex04.py}
\anchor tui_intersect_groups_anchor

Intersect Groups

-\include working_with_groups_ex05.py -Download this script +\tui_script{working_with_groups_ex05.py}
\anchor tui_cut_groups_anchor

Cut Groups

-\include working_with_groups_ex06.py -Download this script +\tui_script{working_with_groups_ex06.py} */ diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index b7bcf45e2..d16392a9f 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -1541,6 +1541,19 @@ module GEOM in GEOM_Object thePath, in GEOM_Object theVec); + + /*! + * \brief Make a thick solid from a surface shape (face or shell) + * \param theObject Surface from which the thick solid is made + * \param theThickness Value of the thickness + * \return New GEOM_Object, containing the created pipe if isCopy = true + * or the modified object if isCopy = false + */ + GEOM_Object MakeThickening (in GEOM_Object theObject, + in double theThickness, + in boolean isCopy); + + /*! * \brief Build a middle path of a pipe-like shape. * diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index 0dc9455d4..15f9a2396 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -204,7 +204,7 @@ void DisplayGUI::EraseAll() SUIT_ViewManager* vman = vw->getViewManager(); if ( vman->getType() == OCCViewer_Viewer::Type() || vman->getType() == SVTK_Viewer::Type() ) { - GEOM_Displayer( appStudy ).EraseAll(); + GEOM_Displayer( appStudy ).EraseAll(true); } } } @@ -406,59 +406,29 @@ void DisplayGUI::SetDisplayMode( const int mode, SUIT_ViewWindow* viewWindow ) { SUIT_OverrideCursor(); + SalomeApp_Application* app = getGeometryGUI()->getApp(); + if ( !app ) return; + if ( !viewWindow ) - viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow(); - if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { - SVTK_View* aView = ((SVTK_ViewWindow*)viewWindow)->getView(); - aView->SetDisplayMode( mode ); - GeometryGUI::Modified(); - } - else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { - OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer(); - Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + viewWindow = app->desktop()->activeWindow(); - AIS_DisplayMode newmode; - switch (mode) { - case 0: - newmode = AIS_WireFrame; - break; - case 1: - newmode = AIS_Shaded; - break; - case 2: - newmode = AIS_DisplayMode( GEOM_AISShape::ShadingWithEdges ); - break; - case 3: - newmode = AIS_DisplayMode( GEOM_AISShape::TexturedShape ); - break; - default: - break; - } + SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); + if ( !aStudy ) return; - AIS_ListOfInteractive List; - ic->DisplayedObjects( List ); - AIS_ListOfInteractive List1; - ic->ObjectsInCollector( List1 ); - List.Append( List1 ); - - AIS_ListIteratorOfListOfInteractive ite( List ); - while( ite.More() ) { - if( ite.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( ite.Value() ); - if(aSh->isTopLevel()) { - aSh->setPrevDisplayMode(Standard_Integer( newmode )); - } - else { - ic->SetDisplayMode( aSh, Standard_Integer( newmode ),true ); - } - } - ite.Next(); - } - - ic->SetDisplayMode( newmode, Standard_False ); + GEOM_Displayer displayer( aStudy ); - GeometryGUI::Modified(); + int mgrId = viewWindow->getViewManager()->getGlobalId(); + + SALOME_ListIO anIOlst; + displayer.GetActiveView()->GetVisible( anIOlst ); + + for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::DisplayMode ), mode ); + displayer.Redisplay( io, false ); } + displayer.UpdateViewer(); + GeometryGUI::Modified(); } //===================================================================================== @@ -469,46 +439,31 @@ void DisplayGUI::SetVectorMode( const bool mode, SUIT_ViewWindow* viewWindow ) { SUIT_OverrideCursor(); - if ( !viewWindow ) - viewWindow = getGeometryGUI()->getApp()->desktop()->activeWindow(); - if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { - viewWindow->setProperty( "VectorsMode", mode ); - SVTK_ViewWindow* vw = dynamic_cast( viewWindow ); - vtkActorCollection* allActors = vw->getRenderer()->GetActors(); - allActors->InitTraversal(); - while (vtkActor* actor = allActors->GetNextActor()) { - if (actor->GetVisibility()) { // only for visible actors - GEOM_Actor* aGeomActor = 0; - if ( actor->IsA( "GEOM_Actor" ) ) { - aGeomActor = GEOM_Actor::SafeDownCast( actor ); - if ( aGeomActor ) - aGeomActor->SetVectorMode( mode ); - } - } - } - GeometryGUI::Modified(); - } - else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { - viewWindow->setProperty( "VectorsMode", mode ); - OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer(); - Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - AIS_ListOfInteractive List; - ic->DisplayedObjects( List ); - AIS_ListOfInteractive List1; - ic->ObjectsInCollector( List1 ); - List.Append( List1 ); + SalomeApp_Application* app = getGeometryGUI()->getApp(); + if ( !app ) return; - AIS_ListIteratorOfListOfInteractive ite( List ); - while( ite.More() ) { - if( ite.Value()->IsInstance( STANDARD_TYPE(GEOM_AISShape) ) ) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( ite.Value() ); - aSh->SetDisplayVectors(mode); - ic->RecomputePrsOnly(ite.Value()); - } - ite.Next(); - } - GeometryGUI::Modified(); + SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); + if ( !aStudy ) return; + + if ( !viewWindow ) + viewWindow = app->desktop()->activeWindow(); + + GEOM_Displayer displayer( aStudy ); + + viewWindow->setProperty( "VectorsMode", mode ); + + int aMgrId = viewWindow->getViewManager()->getGlobalId(); + + SALOME_ListIO anIOlst; + displayer.GetActiveView()->GetVisible( anIOlst ); + + for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + aStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), mode ); + displayer.Redisplay( io, false ); } + displayer.UpdateViewer(); + GeometryGUI::Modified(); } //===================================================================================== @@ -538,103 +493,34 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); if ( !aSelMgr ) return; - SalomeApp_Study* aStudy = dynamic_cast(app->activeStudy()); - - if(!aStudy) - return; + SalomeApp_Study* aStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); + if ( !aStudy ) return; SUIT_OverrideCursor(); - SALOME_ListIO aList; + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) return; - if ( viewWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) { - SVTK_ViewWindow* vw = dynamic_cast( viewWindow ); - SVTK_View* aView = vw->getView(); - int mgrId = viewWindow->getViewManager()->getGlobalId(); - bool vectorMode = false; + GEOM_Displayer displayer( aStudy ); - aSelMgr->selectedObjects( aList ); - SALOME_ListIteratorOfListIO It( aList ); + int mgrId = viewWindow->getViewManager()->getGlobalId(); - for( ;It.More(); It.Next() ) { - SVTK_Viewer* stvkViewer = dynamic_cast(vw->getViewManager()->getViewModel()); - SVTK_Prs* vtkPrs = - stvkViewer ? dynamic_cast( stvkViewer->CreatePrs( It.Value()->getEntry() ) ) : 0; - if ( vtkPrs && !vtkPrs->IsNull() ) { - if (mode == 0 ) - aView->ChangeRepresentationToWireframe( vtkPrs->GetObjects() ); - else if ( mode == 1 ) - aView->ChangeRepresentationToSurface( vtkPrs->GetObjects() ); - else if ( mode == 2 ) - aView->ChangeRepresentationToSurfaceWithEdges( vtkPrs->GetObjects() ); - else if ( mode == 4 ) { - vtkActorCollection* anActors = vtkPrs->GetObjects(); - anActors->InitTraversal(); - while (vtkActor* anAct = anActors->GetNextActor()) { - GEOM_Actor* aGeomActor = GEOM_Actor::SafeDownCast(anAct); - vectorMode = !aGeomActor->GetVectorMode(); - aGeomActor->SetVectorMode(vectorMode); - } - } - if(mode == 0 || mode == 1 || mode == 2) { - aStudy->setObjectProperty(mgrId,It.Value()->getEntry(),GEOM::propertyName( GEOM::DisplayMode ), mode); - } - else if (mode == 4) { - aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::EdgesDirection ), vectorMode); - } - } + QVariant v = aStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), QVariant() ); + bool vectorMode = v.isValid() ? !v.toBool() : false; + + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + if ( mode == 0 || mode == 1 || mode == 2 || mode == 3 ) { + aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::DisplayMode ), mode ); } - aView->Repaint(); - GeometryGUI::Modified(); - } - else if ( viewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) { - OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(viewWindow->getViewManager()))->getOCCViewer(); - Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - - aSelMgr->selectedObjects( aList ); - SALOME_ListIteratorOfListIO It( aList ); - int mgrId = viewWindow->getViewManager()->getGlobalId(); - bool vectorMode = 0; - - for( ;It.More(); It.Next() ) { - SOCC_Viewer* soccViewer = (SOCC_Viewer*)(viewWindow->getViewManager()->getViewModel()); - SOCC_Prs* occPrs = dynamic_cast( soccViewer->CreatePrs( It.Value()->getEntry() ) ); - if ( occPrs && !occPrs->IsNull() ) { - AIS_ListOfInteractive shapes; occPrs->GetObjects( shapes ); - AIS_ListIteratorOfListOfInteractive interIter( shapes ); - for ( ; interIter.More(); interIter.Next() ) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast( interIter.Value() ); - if ( !aSh.IsNull() ) { - if(!aSh->isTopLevel()) { - if ( mode == 0 ) - ic->SetDisplayMode( interIter.Value(), AIS_WireFrame, false ); - else if ( mode == 1 ) - ic->SetDisplayMode( interIter.Value(), AIS_Shaded, false ); - else if ( mode == 2 ) - ic->SetDisplayMode( interIter.Value(), GEOM_AISShape::ShadingWithEdges, false ); - else if ( mode == 3 ) - ic->SetDisplayMode( interIter.Value(), AIS_ExactHLR, false ); - } else { - aSh->setPrevDisplayMode(mode); - } - if (mode == 4 ) { - vectorMode = !aSh->isShowVectors(); - aSh->SetDisplayVectors(vectorMode); - ic->RecomputePrsOnly(interIter.Value()); - } - } - } - if(mode == 0 || mode == 1 || mode == 2 || mode == 3) { - aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::DisplayMode ), mode); - } - else if (mode == 4) { - aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::EdgesDirection ), vectorMode); - } - } + else if ( mode == 4 ) { + aStudy->setObjectProperty( mgrId, io->getEntry(), GEOM::propertyName( GEOM::EdgesDirection ), vectorMode ); } - ic->UpdateCurrentViewer(); - GeometryGUI::Modified(); + displayer.Redisplay( io, false ); } + displayer.UpdateViewer(); + GeometryGUI::Modified(); } //===================================================================================== diff --git a/src/DlgRef/DlgRef.cxx b/src/DlgRef/DlgRef.cxx index a7a551f60..80e6c0c5a 100644 --- a/src/DlgRef/DlgRef.cxx +++ b/src/DlgRef/DlgRef.cxx @@ -21,6 +21,20 @@ #include "DlgRef.h" +////////////////////////////////////////// +// DlgRef_1Check1Spin1Check +////////////////////////////////////////// + +DlgRef_1Check1Spin1Check::DlgRef_1Check1Spin1Check( QWidget* parent, Qt::WindowFlags f ) +: QWidget( parent, f ) +{ + setupUi( this ); +} + +DlgRef_1Check1Spin1Check::~DlgRef_1Check1Spin1Check() +{ +} + ////////////////////////////////////////// // DlgRef_1List1Spin1Btn ////////////////////////////////////////// diff --git a/src/DlgRef/DlgRef.h b/src/DlgRef/DlgRef.h index b727e96ec..6bda15434 100644 --- a/src/DlgRef/DlgRef.h +++ b/src/DlgRef/DlgRef.h @@ -32,6 +32,23 @@ # define DLGREF_EXPORT #endif +////////////////////////////////////////// +// DlgRef_1Check1Spin1Check +////////////////////////////////////////// + +#include "ui_DlgRef_1Check1Spin1Check_QTD.h" + +class DLGREF_EXPORT DlgRef_1Check1Spin1Check : public QWidget, + public Ui::DlgRef_1Check1Spin1Check_QTD +{ + Q_OBJECT + +public: + DlgRef_1Check1Spin1Check( QWidget* = 0, Qt::WindowFlags = 0 ); + ~DlgRef_1Check1Spin1Check(); +}; + + ////////////////////////////////////////// // DlgRef_1List1Spin1Btn ////////////////////////////////////////// diff --git a/src/DlgRef/DlgRef_1Check1Spin1Check_QTD.ui b/src/DlgRef/DlgRef_1Check1Spin1Check_QTD.ui new file mode 100644 index 000000000..d4dc9543f --- /dev/null +++ b/src/DlgRef/DlgRef_1Check1Spin1Check_QTD.ui @@ -0,0 +1,91 @@ + + + DlgRef_1Check1Spin1Check_QTD + + + + 0 + 0 + 165 + 94 + + + + + + + + 0 + + + 0 + + + + + + 0 + 0 + + + + + + + + 6 + + + + + CheckBox + + + + + + + + + + + + + + + 0 + 0 + + + + TL1 + + + false + + + + + + + + + + + + + qPixmapFromMimeSource + + + SalomeApp_DoubleSpinBox + QDoubleSpinBox +
SalomeApp_DoubleSpinBox.h
+
+
+ + SpinBox_DX + checkButton2 + + + +
diff --git a/src/DlgRef/Makefile.am b/src/DlgRef/Makefile.am index 681636166..774ba9b8d 100644 --- a/src/DlgRef/Makefile.am +++ b/src/DlgRef/Makefile.am @@ -34,6 +34,7 @@ MOC_FILES = \ DlgRef_moc.cxx UIC_FILES = \ + ui_DlgRef_1Check1Spin1Check_QTD.h \ ui_DlgRef_1List1Spin1Btn_QTD.h \ ui_DlgRef_1Sel1Check1List_QTD.h \ ui_DlgRef_1Sel1Check1Sel_QTD.h \ diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index 0e13b280e..fb56bdeaf 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -728,13 +728,7 @@ void GEOMBase::ShowErrorMessage( const QString& errorCode, const QString& commen //======================================================================= GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const QString& IOR ) { - GEOM::GEOM_Object_var geomObj; - if ( !IOR.isEmpty() ) { - CORBA::Object_var corbaObj = SalomeApp_Application::orb()->string_to_object( IOR.toLatin1().constData() ); - if ( !CORBA::is_nil( corbaObj ) ) - geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); - } - return geomObj._retn(); + return GeometryGUI::GetObjectFromIOR (IOR); } //======================================================================= @@ -743,12 +737,7 @@ GEOM::GEOM_Object_ptr GEOMBase::GetObjectFromIOR( const QString& IOR ) //======================================================================= QString GEOMBase::GetIORFromObject( GEOM::GEOM_Object_ptr object ) { - QString IOR; - if ( !CORBA::is_nil( object ) ) { - CORBA::String_var anIOR = SalomeApp_Application::orb()->object_to_string( object ); - IOR = anIOR.in(); - } - return IOR; + return GeometryGUI::GetIORFromObject (object); } //======================================================================= diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index 4a051722c..4d3358874 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -676,30 +676,7 @@ GEOM_Displayer* GEOMBase_Helper::getDisplayer() //================================================================ void GEOMBase_Helper::clearShapeBuffer( GEOM::GEOM_Object_ptr theObj ) { - if ( CORBA::is_nil( theObj ) ) - return; - - CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( theObj ); - TCollection_AsciiString asciiIOR( (char *)IOR.in() ); - GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR ); - - if ( !getStudy() || !getStudy()->studyDS() ) - return; - - _PTR(Study) aStudy = getStudy()->studyDS(); - _PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR ) ) ); - if ( !aSObj ) - return; - - _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); - for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { - _PTR(GenericAttribute) anAttr; - if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) { - _PTR(AttributeIOR) anIOR ( anAttr ); - TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() ); - GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR ); - } - } + GeometryGUI::ClearShapeBuffer(theObj); } //================================================================ diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index dfe43b573..87d23adbe 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -1080,12 +1080,20 @@ Please, select face, shell or solid and try again GEOM_MINDIST_NO_SOL - No solution found + No solution found GEOM_MINDIST_OBJ Objects And Results + + GEOM_MINDIST_PUBLISH_TITLE + Multiple solutions found + + + GEOM_MINDIST_PUBLISH_TEXT + Do you want to publish in the study all found solutions? If No, only the currently selected solution will be published. + GEOM_MINDIST_TITLE Minimun Distance Between Two Objects diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 81418e0c8..d07b791f5 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -1070,10 +1070,26 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_MIN Min : + + GEOM_MINDIST_NAME + MinDist + + + GEOM_MINDIST_NO_SOL + No solution found + GEOM_MINDIST_OBJ Objets et résultats + + GEOM_MINDIST_PUBLISH_TITLE + Multiple solutions found + + + GEOM_MINDIST_PUBLISH_TEXT + Do you want to publish in the study all found solutions? If No, only the currently selected solution will be published. + GEOM_MINDIST_TITLE Distance minimale entre deux objets diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 10c4d4ec6..ddc668c97 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -2326,6 +2326,118 @@ QAction* GeometryGUI::getAction(const int id) { return action(id); } +/*! + \brief GEOM module message handler + + This method can be re-implemented in the subclasses. + This is a GEOM module message handler. + + \param msg the message received. +*/ +void GeometryGUI::message(const QString& msg) +{ + // dispatch message + QStringList data = msg.split("/"); + const int nbStrings = data.count(); + + if (nbStrings > 0) { + if (data[0] == "modified") { + // get mesh entry + QString anIOR = nbStrings > 1 ? data[1] : QString(); + + if ( anIOR.isEmpty() ) { + return; + } + + // Get the geom object. + GEOM::GEOM_Object_ptr anObj = GeometryGUI::GetObjectFromIOR (anIOR); + + // Clear the shape buffer + GeometryGUI::ClearShapeBuffer (anObj); + } + } +} + +/*! + \brief Clears the shape buffer. + + This is a static method. It clears the shape buffer. + + \param theObj the object +*/ +void GeometryGUI::ClearShapeBuffer( GEOM::GEOM_Object_ptr theObj ) +{ + if ( CORBA::is_nil( theObj ) ) + return; + + CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( theObj ); + TCollection_AsciiString asciiIOR( (char *)IOR.in() ); + GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR ); + + SALOMEDSClient_StudyManager *aManager = SalomeApp_Application::studyMgr(); + + if (!aManager) + return; + + _PTR(Study) aStudy = aManager->GetStudyByID(theObj->GetStudyID()); + + if ( !aStudy ) + return; + + _PTR(SObject) aSObj ( aStudy->FindObjectIOR( std::string( IOR ) ) ); + if ( !aSObj ) + return; + + _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) ); + for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) { + _PTR(GenericAttribute) anAttr; + if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) { + _PTR(AttributeIOR) anIOR ( anAttr ); + TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() ); + GEOM_Client::get_client().RemoveShapeFromBuffer( asciiIOR ); + } + } +} + +/*! + \brief Returns the object from IOR. + + This is a static method. It returns the object from its IOR. + + \param IOR object IOR + \return GEOM object. +*/ +GEOM::GEOM_Object_ptr GeometryGUI::GetObjectFromIOR( const QString& IOR ) +{ + GEOM::GEOM_Object_var geomObj; + if ( !IOR.isEmpty() ) { + CORBA::Object_var corbaObj = SalomeApp_Application::orb()->string_to_object + ( IOR.toLatin1().constData() ); + if ( !CORBA::is_nil( corbaObj ) ) + geomObj = GEOM::GEOM_Object::_narrow( corbaObj ); + } + return geomObj._retn(); +} + +/*! + \brief Returns IOR of the object. + + This is a static method. It returns the object's IOR. + + \param object the GEOM object. + \return object's IOR. +*/ +QString GeometryGUI::GetIORFromObject( GEOM::GEOM_Object_ptr object ) +{ + QString IOR; + if ( !CORBA::is_nil( object ) ) { + CORBA::String_var anIOR = + SalomeApp_Application::orb()->object_to_string( object ); + IOR = anIOR.in(); + } + return IOR; +} + /*! \brief Check if this object is can't be renamed in place diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 9bf6e6326..34c19c6b2 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -135,6 +135,14 @@ public: QAction* getAction(const int id); + virtual void message( const QString& msg); + static void ClearShapeBuffer( GEOM::GEOM_Object_ptr ); + static GEOM::GEOM_Object_ptr + GetObjectFromIOR( const QString& IOR ); + + static QString GetIORFromObject( GEOM::GEOM_Object_ptr object ); + + public slots: virtual bool deactivateModule( SUIT_Study* ); virtual bool activateModule( SUIT_Study* ); diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index ffe04f377..2698619b1 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -69,6 +70,7 @@ #include #include #include +#include #include #include @@ -1489,7 +1491,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeRevolutionAxisAngle (Handle( //Make a Python command GEOM::TPythonDump(aFunction) << aRevolution << " = geompy.MakeRevolution(" << theBase << ", " << theAxis << ", " << theAngle * 180.0 / M_PI << "*math.pi/180.0)"; - + SetErrorCode(OK); return aRevolution; } @@ -2237,6 +2239,76 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePipeBiNormalAlongVector (Han return aPipe; } +//============================================================================= +/*! + * MakeThickening + */ +//============================================================================= +Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThickening(Handle(GEOM_Object) theObject, + double theOffset, + bool copy = true) +{ + SetErrorCode(KO); + + if (theObject.IsNull()) return NULL; + + Handle(GEOM_Function) anOriginal = theObject->GetLastFunction(); + if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset + + //Add a new Offset function + Handle(GEOM_Function) aFunction; + Handle(GEOM_Object) aCopy; + if (copy) + { + //Add a new Copy object + aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + aFunction = aCopy->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_THICKENING_COPY); + } + else + aFunction = theObject->AddFunction(GEOMImpl_OffsetDriver::GetID(), OFFSET_THICKENING); + + if (aFunction.IsNull()) return NULL; + + //Check if the function is set correctly + if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL; + + GEOMImpl_IOffset aTI (aFunction); + aTI.SetShape(anOriginal); + aTI.SetValue(theOffset); + + //Compute the offset + try { +#if OCC_VERSION_LARGE > 0x06010000 + OCC_CATCH_SIGNALS; +#endif + if (!GetSolver()->ComputeFunction(aFunction)) { + SetErrorCode("Offset driver failed"); + return NULL; + } + } + catch (Standard_Failure) { + Handle(Standard_Failure) aFail = Standard_Failure::Caught(); + SetErrorCode(aFail->GetMessageString()); + return NULL; + } + + //Make a Python command + if(copy) + { + GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeThickSolid(" + << theObject << ", " << theOffset << ")"; + SetErrorCode(OK); + return aCopy; + } + else + { + GEOM::TPythonDump(aFunction) << "geompy.Thicken(" + << theObject << ", " << theOffset << ")"; + SetErrorCode(OK); + return theObject; + } +} + //============================================================================= /*! * RestorePath diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx index 6cd2dd25d..3ce36cd27 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.hxx @@ -68,7 +68,8 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase, Handle(GEOM_Object) theVec, - double theH, double theScaleFactor = -1.0); + double theH, + double theScaleFactor = -1.0); Standard_EXPORT Handle(GEOM_Object) MakePrismVecH2Ways (Handle(GEOM_Object) theBase, Handle(GEOM_Object) theVec, double theH); @@ -137,6 +138,10 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations { Standard_EXPORT Handle(GEOM_Object) MakePipeBiNormalAlongVector (Handle(GEOM_Object) theBase, Handle(GEOM_Object) thePath, Handle(GEOM_Object) theVec); + + Standard_EXPORT Handle(GEOM_Object) MakeThickening (Handle(GEOM_Object) theObject, + double theOffset, + bool isCopy); Standard_EXPORT Handle(GEOM_Object) RestorePath (Handle(GEOM_Object) theShape, Handle(GEOM_Object) theBase1, diff --git a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx index dc47e1f0e..78a0548e8 100644 --- a/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IGroupOperations.cxx @@ -80,6 +80,12 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup { SetErrorCode(KO); + if ( theShapeType != TopAbs_VERTEX && theShapeType != TopAbs_EDGE && + theShapeType != TopAbs_FACE && theShapeType != TopAbs_SOLID ) { + SetErrorCode( "Error: You could create group only next type: vertex, edge, face or solid" ); + return NULL; + } + Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1); anArray->SetValue(1, -1); @@ -113,6 +119,11 @@ void GEOMImpl_IGroupOperations::AddObject(Handle(GEOM_Object) theGroup, int theS SetErrorCode(KO); if(theGroup.IsNull()) return; + if ( theGroup->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return; + } + Handle(GEOM_Function) aFunction = theGroup->GetLastFunction(); if(aFunction.IsNull()) return; @@ -129,6 +140,13 @@ void GEOMImpl_IGroupOperations::AddObject(Handle(GEOM_Object) theGroup, int theS TopTools_IndexedMapOfShape aMapOfShapes; TopExp::MapShapes(aMainShape, aMapOfShapes); + TopAbs_ShapeEnum aGroupType = GetType(theGroup); + TopAbs_ShapeEnum aShapeType = aMapOfShapes.FindKey(theSubShapeID).ShapeType(); + if ( aGroupType != aShapeType ) { + SetErrorCode( "Error: You could perform this operation only with object the same type as the type of group." ); + return; + } + if (theSubShapeID < 1 || aMapOfShapes.Extent() < theSubShapeID) { SetErrorCode("Invalid sub-shape index: out of range"); return; @@ -184,6 +202,11 @@ void GEOMImpl_IGroupOperations::RemoveObject (Handle(GEOM_Object) theGroup, int SetErrorCode(KO); if(theGroup.IsNull()) return; + if ( theGroup->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return; + } + Handle(GEOM_Function) aFunction = theGroup->GetLastFunction(); if(aFunction.IsNull()) return; @@ -263,6 +286,11 @@ void GEOMImpl_IGroupOperations::UnionList (Handle(GEOM_Object) theGroup, SetErrorCode(KO); if (theGroup.IsNull()) return; + if ( theGroup->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return; + } + Standard_Integer aLen = theSubShapes->Length(); if (aLen < 1) { //SetErrorCode("The list is empty"); @@ -413,6 +441,11 @@ void GEOMImpl_IGroupOperations::DifferenceList (Handle(GEOM_Object) theGroup, SetErrorCode(KO); if (theGroup.IsNull()) return; + if ( theGroup->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return; + } + Standard_Integer aLen = theSubShapes->Length(); if (aLen < 1) { //SetErrorCode("The list is empty"); @@ -558,6 +591,11 @@ void GEOMImpl_IGroupOperations::UnionIDs (Handle(GEOM_Object) theGroup, SetErrorCode(KO); if (theGroup.IsNull()) return; + if ( theGroup->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return; + } + Standard_Integer aLen = theSubShapes->Length(); if (aLen < 1) { //SetErrorCode("The list is empty"); @@ -657,6 +695,11 @@ void GEOMImpl_IGroupOperations::DifferenceIDs (Handle(GEOM_Object) theGroup, SetErrorCode(KO); if (theGroup.IsNull()) return; + if ( theGroup->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return; + } + Standard_Integer aLen = theSubShapes->Length(); if (aLen < 1) { //SetErrorCode("The list is empty"); @@ -760,6 +803,11 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::UnionGroups (Handle(GEOM_Object) SetErrorCode(KO); if (theGroup1.IsNull() || theGroup2.IsNull()) return NULL; + if ( theGroup1->GetType() != GEOM_GROUP || theGroup2->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return NULL; + } + // Get group type TopAbs_ShapeEnum aType1 = GetType(theGroup1); TopAbs_ShapeEnum aType2 = GetType(theGroup2); @@ -866,6 +914,11 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::IntersectGroups (Handle(GEOM_Obje SetErrorCode(KO); if (theGroup1.IsNull() || theGroup2.IsNull()) return NULL; + if ( theGroup1->GetType() != GEOM_GROUP || theGroup2->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return NULL; + } + // Get group type TopAbs_ShapeEnum aType1 = GetType(theGroup1); TopAbs_ShapeEnum aType2 = GetType(theGroup2); @@ -972,6 +1025,11 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::CutGroups (Handle(GEOM_Object) th SetErrorCode(KO); if (theGroup1.IsNull() || theGroup2.IsNull()) return NULL; + if ( theGroup1->GetType() != GEOM_GROUP || theGroup2->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return NULL; + } + // Get group type TopAbs_ShapeEnum aType1 = GetType(theGroup1); TopAbs_ShapeEnum aType2 = GetType(theGroup2); @@ -1092,7 +1150,10 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::UnionListOfGroups // Iterate on the initial groups for (i = 1; i <= aLen; i++) { Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList->Value(i)); - + if ( aGr_i->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return NULL; + } // Get group type aType_i = GetType(aGr_i); if (i == 1) @@ -1204,7 +1265,10 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::IntersectListOfGroups // Iterate on the initial groups for (i = 1; i <= aLen; i++) { Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList->Value(i)); - + if ( aGr_i->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return NULL; + } // Get group type aType_i = GetType(aGr_i); if (i == 1) @@ -1342,7 +1406,10 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::CutListOfGroups // 1. Collect indices to be excluded (from theGList2) into the mapIDs for (i = 1; i <= aLen2; i++) { Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList2->Value(i)); - + if ( aGr_i->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return NULL; + } // Get group type aType_i = GetType(aGr_i); if (i == 1) @@ -1393,7 +1460,10 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::CutListOfGroups // 2. Collect indices from theGList1, avoiding indices from theGList2 (mapIDs) for (i = 1; i <= aLen1; i++) { Handle(GEOM_Object) aGr_i = Handle(GEOM_Object)::DownCast(theGList1->Value(i)); - + if ( aGr_i->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return NULL; + } // Get group type aType_i = GetType(aGr_i); if (i == 1 && aLen2 < 1) @@ -1513,7 +1583,10 @@ Handle(GEOM_Object) GEOMImpl_IGroupOperations::GetMainShape (Handle(GEOM_Object) SetErrorCode(KO); if(theGroup.IsNull()) return NULL; - + if ( theGroup->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return NULL; + } Handle(GEOM_Function) aGroupFunction = theGroup->GetFunction(1); if (aGroupFunction.IsNull()) return NULL; @@ -1543,7 +1616,10 @@ Handle(TColStd_HArray1OfInteger) GEOMImpl_IGroupOperations::GetObjects(Handle(GE SetErrorCode(KO); if(theGroup.IsNull()) return NULL; - + if ( theGroup->GetType() != GEOM_GROUP ) { + SetErrorCode( "Error: You could perform this operation only with group. Please select a group." ); + return NULL; + } Handle(GEOM_Function) aFunction = theGroup->GetLastFunction(); if(aFunction.IsNull()) return NULL; diff --git a/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx b/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx index 7bcf8af96..63d945549 100644 --- a/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_OffsetDriver.cxx @@ -77,20 +77,20 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const Standard_Integer aType = aFunction->GetType(); TopoDS_Shape aShape; - - if (aType == OFFSET_SHAPE || aType == OFFSET_SHAPE_COPY) { - Handle(GEOM_Function) aRefShape = aCI.GetShape(); - TopoDS_Shape aShapeBase = aRefShape->GetValue(); - Standard_Real anOffset = aCI.GetValue(); - Standard_Real aTol = Precision::Confusion(); - - if (Abs(anOffset) < aTol) { + + Handle(GEOM_Function) aRefShape = aCI.GetShape(); + TopoDS_Shape aShapeBase = aRefShape->GetValue(); + Standard_Real anOffset = aCI.GetValue(); + Standard_Real aTol = Precision::Confusion(); + + if (Abs(anOffset) < aTol) { TCollection_AsciiString aMsg ("Absolute value of offset can not be less than the tolerance value ("); aMsg += TCollection_AsciiString(aTol); aMsg += ")"; StdFail_NotDone::Raise(aMsg.ToCString()); - } + } + if (aType == OFFSET_SHAPE || aType == OFFSET_SHAPE_COPY) { BRepOffsetAPI_MakeOffsetShape MO (aShapeBase, aCI.GetValue(), aTol); @@ -114,7 +114,17 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const else { StdFail_NotDone::Raise("Offset construction failed"); } - } else { + } + else if (aType == OFFSET_THICKENING || aType == OFFSET_THICKENING_COPY) + { + BRepOffset_MakeOffset myOffsetShape(aShapeBase, anOffset, aTol, BRepOffset_Skin, + Standard_False, Standard_False, GeomAbs_Intersection, Standard_True); + + if (!myOffsetShape.IsDone()) + { + StdFail_NotDone::Raise("Thickening construction failed"); + } + aShape = myOffsetShape.Shape(); } if (aShape.IsNull()) return 0; diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index 9812da16a..c03d62d5c 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -97,12 +97,6 @@ #include "utilities.h" -////////////////////////////////////////////////////////////////////////// -// Uncomment below macro to perform gluing in the end of MakePipe operation -// as fix of issue 0020207. -////////////////////////////////////////////////////////////////////////// -//#define GLUE_0020207 - //======================================================================= //function : GetID @@ -2483,23 +2477,22 @@ Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result"); } - // Glue (for bug 0020207) - // No gluing is needed as the bug 0020207 is fixed in OCCT. -#ifdef GLUE_0020207 - TopExp_Explorer anExpV (aShape, TopAbs_VERTEX); - if (anExpV.More()) { - Standard_Real aVertMaxTol = -RealLast(); - for (; anExpV.More(); anExpV.Next()) { - TopoDS_Vertex aVertex = TopoDS::Vertex(anExpV.Current()); - Standard_Real aTol = BRep_Tool::Tolerance(aVertex); - if (aTol > aVertMaxTol) - aVertMaxTol = aTol; + if (aType != PIPE_BASE_PATH && + aType != PIPE_SHELLS_WITHOUT_PATH) { + TopExp_Explorer anExpV (aShape, TopAbs_VERTEX); + if (anExpV.More()) { + Standard_Real aVertMaxTol = -RealLast(); + for (; anExpV.More(); anExpV.Next()) { + TopoDS_Vertex aVertex = TopoDS::Vertex(anExpV.Current()); + Standard_Real aTol = BRep_Tool::Tolerance(aVertex); + if (aTol > aVertMaxTol) + aVertMaxTol = aTol; + } + aVertMaxTol += Precision::Confusion(); + aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, aVertMaxTol, Standard_True); + //aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, Precision::Confusion(), Standard_True); } - aVertMaxTol += Precision::Confusion(); - aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, aVertMaxTol, Standard_True); - //aShape = GEOMImpl_GlueDriver::GlueFaces(aShape, Precision::Confusion(), Standard_True); } -#endif TopoDS_Shape aRes = GEOMUtils::CompsolidToCompound(aShape); aFunction->SetValue(aRes); diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx index 0419dd169..a11558920 100755 --- a/src/GEOMImpl/GEOMImpl_Types.hxx +++ b/src/GEOMImpl/GEOMImpl_Types.hxx @@ -102,6 +102,8 @@ #define GEOM_PIPE_PATH 48 +#define GEOM_THICKENING 49 + //GEOM_Function types #define COPY_WITH_REF 1 @@ -164,6 +166,8 @@ #define OFFSET_SHAPE 1 #define OFFSET_SHAPE_COPY 2 +#define OFFSET_THICKENING 3 +#define OFFSET_THICKENING_COPY 4 #define PROJECTION_COPY 1 diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h index 6c04a9be5..6e7e2f9b4 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -60,8 +60,6 @@ public: enum ActionType { SHOWDLG, INCR, DECR }; - static void SetColor( const QString&, const QColor&, bool ); - private: // Import and export topology methods bool Import(); @@ -99,18 +97,6 @@ private: _PTR(Study), QList, GEOM_Displayer* ); - - static void setVtkColor( SalomeApp_Study* study, - int mgrId, - SVTK_View* view, - const Handle_SALOME_InteractiveObject& IO, - const QColor& color ); - - static void setOccColor( SalomeApp_Study* study, - int mgrId, - const Handle_AIS_InteractiveContext& ic, - const Handle_SALOME_InteractiveObject& IO, - const QColor& color ); }; #endif // GEOMTOOLSGUI_H diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index 268c101c1..1d87448c4 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -131,40 +131,36 @@ void GEOMToolsGUI::OnCheckGeometry() void GEOMToolsGUI::OnAutoColor() { - SALOME_ListIO selected; - SalomeApp_Application* app = - dynamic_cast< SalomeApp_Application* >(SUIT_Session::session()->activeApplication()); - if (!app) - return; + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) return; + + SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); + if ( !appStudy ) return; LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); - if (!aSelMgr || !appStudy) - return; + if ( !aSelMgr ) return; - aSelMgr->selectedObjects(selected); - if (selected.IsEmpty()) - return; + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) return; Handle(SALOME_InteractiveObject) anIObject = selected.First(); _PTR(Study) aStudy = appStudy->studyDS(); _PTR(SObject) aMainSObject(aStudy->FindObjectID(anIObject->getEntry())); GEOM::GEOM_Object_var aMainObject = GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aMainSObject)); - if (CORBA::is_nil(aMainObject)) - return; + if (CORBA::is_nil(aMainObject)) return; aMainObject->SetAutoColor( true ); QList aReservedColors; - GEOM_Displayer aDisp (appStudy); + GEOM_Displayer displayer ( appStudy ); - SALOME_View* vf = aDisp.GetActiveView(); + SALOME_View* window = displayer.GetActiveView(); + if ( !window ) return; - SUIT_ViewWindow* window = app->desktop()->activeWindow(); - bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); - bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); + int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId(); for( _PTR(ChildIterator) it( aStudy->NewChildIterator( aMainSObject ) ); it->More(); it->Next() ) { @@ -185,76 +181,19 @@ void GEOMToolsGUI::OnAutoColor() aReservedColors.append( aColor ); #endif // SIMPLE_AUTOCOLOR aChildObject->SetColor( aColor ); - + QColor c( (int)( aColor.R * 255.0 ), (int)( aColor.G * 255.0 ), (int)( aColor.B * 255.0 ) ); - SALOME_Prs* aPrs = vf->CreatePrs( aChildSObject->GetID().c_str() ); - - if ( isVTK ) - { - SVTK_ViewWindow* vtkVW = dynamic_cast( window ); - if ( !vtkVW ) - return; - SVTK_View* aView = vtkVW->getView(); - SUIT_OverrideCursor(); - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) - aView->SetColor( It.Value(), c ); - } - else if ( isOCC ) - { - OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); - Handle(AIS_InteractiveContext) ic = vm->getAISContext(); - - SOCC_Prs* anOCCPrs = dynamic_cast( aPrs ); - if( !anOCCPrs ) - continue; - - AIS_ListOfInteractive aList; - anOCCPrs->GetObjects( aList ); - if( !aList.Extent() ) - continue; - - Handle(AIS_InteractiveObject) io = aList.First(); - if( io.IsNull() ) - continue; - - Quantity_Color aQuanColor( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB ); - - // Set color for a point - Handle(AIS_Drawer) aCurDrawer = io->Attributes(); - Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect(); - Quantity_Color aCurColor; - Standard_Real aCurScale; - Aspect_TypeOfMarker aCurTypeOfMarker; - aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale ); - if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) { - aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aQuanColor, aCurScale) ); - } - else { - Standard_Integer aWidth, aHeight; - aCurPointAspect->GetTextureSize( aWidth, aHeight ); - -#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 - Handle(TColStd_HArray1OfByte) aTexture = aCurPointAspect->GetTexture(); -#else - Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture(); -#endif - - aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aQuanColor, 1, aWidth, aHeight, aTexture ) ); - } - ic->SetLocalAttributes( io, aCurDrawer ); - - io->SetColor( aQuanColor ); - if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) { - Handle(GEOM_AISShape) aGAISShape = Handle(GEOM_AISShape)::DownCast( io ); - aGAISShape->SetShadingColor( aQuanColor ); - aGAISShape->storeBoundaryColors(); - } - - io->Redisplay( Standard_True ); - } + SUIT_OverrideCursor(); + + appStudy->setObjectProperty( aMgrId, aChildObject->GetEntry(), GEOM::propertyName( GEOM::Color ), c ); + Handle( SALOME_InteractiveObject ) io = new SALOME_InteractiveObject( aChildObject->GetEntry(), "GEOM", "" ); + if ( window->isVisible( io ) ) displayer.Redisplay( io, false ); } + displayer.UpdateViewer(); + // update actions + appStudy->Modified(); app->updateActions(); //SRN: To update a Save button in the toolbar } @@ -285,53 +224,6 @@ void GEOMToolsGUI::OnDisableAutoColor() aMainObject->SetAutoColor( false ); } -void GEOMToolsGUI::SetColor( const QString& entry, const QColor& color, bool updateViewer ) -{ - if ( entry.isEmpty() || !color.isValid() ) return; - - // get active application - SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - if ( !app ) return; - - // get current study - SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); - if ( !appStudy ) return; - - // get active view - SUIT_ViewWindow* window = app->desktop()->activeWindow(); - if ( !window ) return; - - bool isOCC = window->getViewManager()->getType() == OCCViewer_Viewer::Type(); - bool isVTK = window->getViewManager()->getType() == SVTK_Viewer::Type(); - - // get view id - int mgrId = window->getViewManager()->getGlobalId(); - - Handle(SALOME_InteractiveObject) IO = - new SALOME_InteractiveObject( entry.toLatin1().data(), "GEOM", ""); - - if ( isVTK ) { - SVTK_ViewWindow* vtkVW = dynamic_cast( window ); - if ( !vtkVW ) return; - SVTK_View* aView = vtkVW->getView(); - - GEOMToolsGUI::setVtkColor( appStudy, mgrId, aView, IO, color ); - if ( updateViewer ) aView->Repaint(); - } - else if ( isOCC ) { - OCCViewer_Viewer* vm = dynamic_cast ( window->getViewManager()->getViewModel() ); - Handle (AIS_InteractiveContext) ic = vm->getAISContext(); - GEOMToolsGUI::setOccColor( appStudy, mgrId, ic, IO, color ); - if ( updateViewer ) ic->UpdateCurrentViewer(); - } - - // mark study as modified - GeometryGUI::Modified(); - - // update actions - app->updateActions(); //SRN: To update a Save button in the toolbar -} - void GEOMToolsGUI::OnColor() { // get active application @@ -339,7 +231,7 @@ void GEOMToolsGUI::OnColor() if ( !app ) return; // get current study - SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); + SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); if ( !appStudy ) return; // get selection manager @@ -350,217 +242,71 @@ void GEOMToolsGUI::OnColor() SALOME_ListIO selected; aSelMgr->selectedObjects( selected ); if ( selected.IsEmpty() ) return; - + + GEOM_Displayer displayer( appStudy ); + // get active view - SUIT_ViewWindow* window = app->desktop()->activeWindow(); - bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); - bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); + SALOME_View* window = displayer.GetActiveView(); + if ( !window ) return; // get view id - int mgrId = window ? window->getViewManager()->getGlobalId() : -1; + int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId(); - if ( isVTK ) { - SVTK_ViewWindow* vtkVW = dynamic_cast( window ); - if ( !vtkVW ) return; + QColor color; + QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Color ), color ); - // get initial color (use first object from selection) - SVTK_View* aView = vtkVW->getView(); - QColor color = aView->GetColor( selected.First() ); - QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Color ), color ); + // show Choose Color dialog box + color = QColorDialog::getColor( v.value(), app->desktop() ); + if ( !color.isValid() ) return; - // show Choose Color dialog box - color = QColorDialog::getColor( v.value(), app->desktop() ); - if ( !color.isValid() ) return; - - // iterate through list of objects and assign new color - SUIT_OverrideCursor(); - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - GEOMToolsGUI::setVtkColor( appStudy, mgrId, aView, It.Value(), color ); - } - aView->Repaint(); + // iterate through list of objects and assign new color + SUIT_OverrideCursor(); + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::Color ), color ); + if ( window->isVisible( io ) ) displayer.Redisplay( io, false ); } - else if ( isOCC ) { - // find AIS interactive object (for first item in selection) - Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( selected.First() ); - if ( io.IsNull() ) return; - - // get initial color (use first object from selection) - Quantity_Color aColor; - io->Color( aColor ); - QColor color = QColor((int)( aColor.Red() * 255.0 ), - (int)( aColor.Green() * 255.0 ), - (int)( aColor.Blue() * 255.0 )); - QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Color ), color ); - - // show Choose Color dialog box - color = QColorDialog::getColor( v.value(), app->desktop() ); - if ( !color.isValid() ) return; - - // iterate through list of objects and assign new color - SUIT_OverrideCursor(); - OCCViewer_Viewer* vm = dynamic_cast ( window->getViewManager()->getViewModel() ); - Handle (AIS_InteractiveContext) ic = vm->getAISContext(); - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - GEOMToolsGUI::setOccColor( appStudy, mgrId, ic, It.Value(), color ); - } - ic->UpdateCurrentViewer(); - } - - // mark study as modified + displayer.UpdateViewer(); GeometryGUI::Modified(); - + // update actions app->updateActions(); //SRN: To update a Save button in the toolbar } - -void GEOMToolsGUI::setVtkColor( SalomeApp_Study* study, // study - int mgrId, // view window id - SVTK_View* view, // VTK view - const Handle(SALOME_InteractiveObject)& IO, // interactive object - const QColor& color ) // color -{ - // get material property - QString matProp; - matProp = study->getObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Material ), matProp ).toString(); - Material_Model material; - material.fromProperties( matProp ); - - // change color only for shapes with not physical type of material - if ( !material.isPhysical() ) { - view->SetColor( IO, color ); - study->setObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Color ), color ); - } - - // store color to GEOM_Object - _PTR(Study) aStudy = study->studyDS(); - _PTR(SObject) aSObject( aStudy->FindObjectID( IO->getEntry() ) ); - if ( !aSObject ) return; - - GEOM::GEOM_Object_var anObject = - GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject)); - - if ( CORBA::is_nil( anObject ) ) return; - - SALOMEDS::Color aSColor; - aSColor.R = (double)color.red() / 255.0; - aSColor.G = (double)color.green() / 255.0; - aSColor.B = (double)color.blue() / 255.0; - anObject->SetColor( aSColor ); - anObject->SetAutoColor( false ); -} - -void GEOMToolsGUI::setOccColor( SalomeApp_Study* study, // study - int mgrId, // view window id - const Handle(AIS_InteractiveContext)& ic, // OCC interactive context - const Handle(SALOME_InteractiveObject)& IO, // interactive object - const QColor& color ) // color -{ - // get AIS object - Handle(AIS_InteractiveObject) io = GEOMBase::GetAIS( IO, true ); - if ( io.IsNull() ) return; - - // get material property - QString matProp; - matProp = study->getObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Material ), matProp ).toString(); - Material_Model material; - material.fromProperties( matProp ); - - Quantity_Color aColor = Quantity_Color( color.red() / 255., color.green() / 255., color.blue() / 255., Quantity_TOC_RGB ); - - // change color only for shapes with not physical type of material - if ( !material.isPhysical() ) { - if ( io->IsKind( STANDARD_TYPE(AIS_Shape) ) ) { - TopoDS_Shape theShape = Handle(AIS_Shape)::DownCast( io )->Shape(); - bool onlyVertex = (theShape.ShapeType() == TopAbs_VERTEX || GEOM_Displayer::isCompoundOfVertices( theShape )); - if ( onlyVertex ) { - // set color for a point - Handle(AIS_Drawer) aCurDrawer = io->Attributes(); - Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect(); - Quantity_Color aCurColor; - Standard_Real aCurScale; - Aspect_TypeOfMarker aCurTypeOfMarker; - aCurPointAspect->Aspect()->Values( aCurColor, aCurTypeOfMarker, aCurScale ); - if ( aCurTypeOfMarker != Aspect_TOM_USERDEFINED ) { - aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aCurTypeOfMarker, aColor, aCurScale ) ); - } - else { - Standard_Integer aWidth, aHeight; - aCurPointAspect->GetTextureSize( aWidth, aHeight ); -#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1 - Handle(TColStd_HArray1OfByte) aTexture = aCurPointAspect->GetTexture(); -#else - Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture(); -#endif - aCurDrawer->SetPointAspect( new Prs3d_PointAspect( aColor, 1, aWidth, aHeight, aTexture ) ); - } - ic->SetLocalAttributes( io, aCurDrawer, Standard_False ); - } - } - - io->SetColor( aColor ); - if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) { - Handle(GEOM_AISShape) aGAISShape = Handle(GEOM_AISShape)::DownCast( io ); - aGAISShape->SetShadingColor( aColor ); - aGAISShape->storeBoundaryColors(); - } - - io->Redisplay( Standard_True ); - - study->setObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Color ), color ); - } - - // store color to GEOM_Object - _PTR(Study) aStudy = study->studyDS(); - _PTR(SObject) aSObject( aStudy->FindObjectID( IO->getEntry() ) ); - GEOM::GEOM_Object_var anObject = - GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject)); - SALOMEDS::Color aSColor; - aSColor.R = (double)color.red() / 255.0; - aSColor.G = (double)color.green() / 255.0; - aSColor.B = (double)color.blue() / 255.0; - anObject->SetColor( aSColor ); - anObject->SetAutoColor( false ); -} - void GEOMToolsGUI::OnTexture() { - SALOME_ListIO selected; SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - SalomeApp_Study* appStudy = dynamic_cast( app->activeStudy() ); - if ( app && appStudy ) { - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - if ( aSelMgr ) { - aSelMgr->selectedObjects( selected ); - if ( !selected.IsEmpty() ) { - SUIT_ViewWindow* window = app->desktop()->activeWindow(); - bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); - if ( isOCC ) { - QString aTexture = QFileDialog::getOpenFileName(window,tr( "GEOM_SELECT_IMAGE"),QString(), tr("OCC_TEXTURE_FILES")); - if( !aTexture.isEmpty() ) - { - SUIT_OverrideCursor(); - OCCViewer_Viewer* vm = dynamic_cast ( window->getViewManager()->getViewModel() ); - Handle (AIS_InteractiveContext) ic = vm->getAISContext(); - Handle(AIS_InteractiveObject) io ; - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - io = GEOMBase::GetAIS( It.Value(), true ); - if ( !io.IsNull() ) { - if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) ) - Handle(GEOM_AISShape)::DownCast( io )->SetTextureFileName(TCollection_AsciiString(aTexture.toStdString().c_str())); - io->Redisplay( Standard_True ); - } // if ( !io.IsNull() ) - } // for - ic->UpdateCurrentViewer(); - GeometryGUI::Modified(); - GeometryGUI* myGeomGUI = getGeometryGUI(); - myGeomGUI->OnGUIEvent(GEOMOp::OpTexture); - } // if ( !selFile.isEmpty() ) - } // if ( isOCC ) - } // if ( selection not empty ) + if ( !app ) return; + + SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); + if ( !appStudy ) return; + + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) return; + + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) return; + + GEOM_Displayer displayer( appStudy ); + SALOME_View* window = displayer.GetActiveView(); + if ( !window ) return; + + int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId(); + + QString aTexture = QFileDialog::getOpenFileName( dynamic_cast< SUIT_ViewWindow* >( window ),tr("GEOM_SELECT_IMAGE"),QString(), tr("OCC_TEXTURE_FILES")); + if( !aTexture.isEmpty() ) { + displayer.SetTexture( aTexture.toStdString() ); + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::DisplayMode ), 3 ); + if ( window->isVisible( io ) ) displayer.Redisplay( io, false ); } } + displayer.UpdateViewer(); + GeometryGUI::Modified(); + // update actions app->updateActions(); //SRN: To update a Save button in the toolbar } @@ -572,377 +318,158 @@ void GEOMToolsGUI::OnTransparency() void GEOMToolsGUI::OnChangeTransparency( bool increase ) { - SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - if ( !app ) - return; + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) return; + + SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); + if( !appStudy) return; + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - if ( !aSelMgr ) - return; + if ( !aSelMgr ) return; + SALOME_ListIO selected; aSelMgr->selectedObjects( selected ); - if ( selected.IsEmpty() ) - return; + if ( selected.IsEmpty() ) return; - Handle(SALOME_InteractiveObject) FirstIOS = selected.First(); - if ( FirstIOS.IsNull() ) - return; + GEOM_Displayer displayer( appStudy ); + SALOME_View* window = displayer.GetActiveView(); + if ( !window ) return; + + int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId(); // Delta float delta = 0.1; // VSR: 23/11/2010 (transparency value <= 0.05 is ignored) if ( !increase ) delta *= -1; - - SUIT_ViewWindow* window = app->desktop()->activeWindow(); - bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); - bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); - if ( isVTK ) { - SVTK_ViewWindow* vtkVW = dynamic_cast( window ); - if ( !vtkVW ) - return; - SVTK_View* aView = vtkVW->getView(); - - float transp = aView->GetTransparency(FirstIOS); - - // Compute new transparency value - transp = transp + delta; - if ( transp < 0 ) - transp = 0; - else if ( transp > 1 ) - transp = 1; + QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Transparency ), QVariant() ); + float transp = v.isValid() ? v.toFloat() : 1; - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - aView->SetTransparency( It.Value(), transp ); - } - aView->Repaint(); - GeometryGUI::Modified(); - } // if ( isVTK ) - - else if ( isOCC ) { - GEOMBase* gb = new GEOMBase(); - Handle(GEOM_AISShape) aisShape; - - aisShape = gb->ConvertIOinGEOMAISShape( FirstIOS, true ); - if( aisShape.IsNull() ) - return; - float transp = aisShape->Transparency(); + // Compute new transparency value + transp = transp + delta; + if ( transp < 0 ) + transp = 0; + else if ( transp > 1 ) + transp = 1; - // Compute new transparency value - transp = transp + delta; - if ( transp < 0 ) - transp = 0; - else if ( transp > 1 ) - transp = 1; - - OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); - if ( !vm ) - return; - Handle(AIS_InteractiveContext) ic = vm->getAISContext(); - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), true ); - if ( !aisShape.IsNull() ) { - ic->SetTransparency( aisShape, transp, false ); - ic->Redisplay( aisShape, Standard_False, Standard_True ); - } - } // for... - ic->UpdateCurrentViewer(); - GeometryGUI::Modified(); - } // if ( isOCC ) + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + appStudy->setObjectProperty( aMgrId ,io->getEntry(), GEOM::propertyName( GEOM::Transparency ), transp ); + if ( window->isVisible( io ) ) displayer.Redisplay( io, false ); + } + displayer.UpdateViewer(); + GeometryGUI::Modified(); } void GEOMToolsGUI::OnNbIsos( ActionType actionType ) { - SalomeApp_Application* app = - dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - SalomeApp_Study* aStudy = dynamic_cast( app->activeStudy() ); - SUIT_ViewWindow* window = app->desktop()->activeWindow(); + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) return; - bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); - bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); + SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); + if ( !appStudy ) return; - if(isOCC){ // if is OCCViewer + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) return; - OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); - Handle (AIS_InteractiveContext) ic = vm->getAISContext(); - int aMgrId = window->getViewManager()->getGlobalId(); + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) return; - ic->InitCurrent(); - if ( ic->MoreCurrent() ) { - Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); - CurObject->restoreIsoNumbers(); - Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); + GEOM_Displayer displayer( appStudy ); + SALOME_View* window = displayer.GetActiveView(); + if ( !window ) return; + + int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId(); - int UIso = CurDrawer->UIsoAspect()->Number(); - int VIso = CurDrawer->VIsoAspect()->Number(); - - int newNbUIso = -1; - int newNbVIso = -1; - - if ( actionType == SHOWDLG ) { - GEOMToolsGUI_NbIsosDlg * NbIsosDlg = - new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); - - NbIsosDlg->setU( UIso ); - NbIsosDlg->setV( VIso ); - - if ( NbIsosDlg->exec() ) { - SUIT_OverrideCursor(); - - newNbUIso = NbIsosDlg->getU(); - newNbVIso = NbIsosDlg->getV(); - } else //Cancel case - return; - } - else if ( actionType == INCR || actionType == DECR ) { - int delta = 1; - if (actionType == DECR) - delta = -1; - - newNbUIso = UIso + delta; - newNbVIso = VIso + delta; - - if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 ) - return; - } - - for(; ic->MoreCurrent(); ic->NextCurrent()) { - CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); - - Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); - - QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ) , QVariant() ); - - int width = v.isValid() ? v.toInt() : 1; - - CurDrawer->SetUIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width , newNbUIso) ); - CurDrawer->SetVIsoAspect( new Prs3d_IsoAspect(Quantity_NOC_GRAY75, Aspect_TOL_SOLID, width , newNbVIso) ); - - CurObject->storeIsoNumbers(); - - ic->SetLocalAttributes(CurObject, CurDrawer); - ic->Redisplay(CurObject); - - QString anIsos = QString("%1%2%3").arg(newNbUIso).arg(GEOM::subSectionSeparator()).arg(newNbVIso); - aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::NbIsos ), anIsos); - } - } - GeometryGUI::Modified(); + QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::NbIsos ) , QVariant() ); + QString aStr = v.toString(); + QStringList aStrList = aStr.split( GEOM::subSectionSeparator() ); + int UIso = SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "iso_number_u", 1 ); + int VIso = SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "iso_number_v", 1 ); + if ( aStrList.count() == 2 ) { + if ( !aStrList[0].isEmpty() ) UIso = aStrList[0].toInt(); + if ( !aStrList[1].isEmpty() ) VIso = aStrList[1].toInt(); } - else if(isVTK){ // if is VTKViewer - // - // Warning. It's works incorrect. must be recheked. - // - SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > - ( SUIT_Session::session()->activeApplication() ); - if ( !app ) + + int newNbUIso = -1; + int newNbVIso = -1; + + if ( actionType == SHOWDLG ) { + GEOMToolsGUI_NbIsosDlg * NbIsosDlg = + new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); + + NbIsosDlg->setU( UIso ); + NbIsosDlg->setV( VIso ); + + if ( NbIsosDlg->exec() ) { + SUIT_OverrideCursor(); + newNbUIso = NbIsosDlg->getU(); + newNbVIso = NbIsosDlg->getV(); + } else //Cancel case return; - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - if ( !aSelMgr ) - return; - SALOME_ListIO selected; - aSelMgr->selectedObjects( selected ); - if ( selected.IsEmpty() ) + } + else if ( actionType == INCR || actionType == DECR ) { + int delta = 1; + if (actionType == DECR) + delta = -1; + + newNbUIso = UIso + delta; + newNbVIso = VIso + delta; + + if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 ) return; + } - SVTK_ViewWindow* vtkVW = dynamic_cast( window ); - if ( !vtkVW ) - return; - - int aMgrId = window->getViewManager()->getGlobalId(); - - SALOME_View* view = GEOM_Displayer::GetActiveView(); - - vtkActorCollection* aCollection = vtkActorCollection::New(); - - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - Handle(SALOME_InteractiveObject) anIObject = It.Value(); - SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() ); - SVTK_Prs* vtkPrs = dynamic_cast( aPrs ); - if ( vtkPrs ) { - vtkActorCollection* anActors = vtkPrs->GetObjects(); - anActors->InitTraversal(); - vtkActor* anAct = anActors->GetNextActor(); - aCollection->AddItem(anAct); - } - } - - if(aCollection) - aCollection->InitTraversal(); - else - return; - - int UIso = 0; - int VIso = 0; - - vtkActor* anAct = aCollection->GetNextActor(); - if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { - anActor->RestoreIsoNumbers(); - anActor->GetNbIsos(UIso,VIso); - } - else - return; - - int newNbUIso = -1; - int newNbVIso = -1; - - if ( actionType == SHOWDLG ) { - GEOMToolsGUI_NbIsosDlg* NbIsosDlg = - new GEOMToolsGUI_NbIsosDlg( SUIT_Session::session()->activeApplication()->desktop() ); - - NbIsosDlg->setU( UIso ); - NbIsosDlg->setV( VIso ); - - if ( NbIsosDlg->exec() ) { - SUIT_OverrideCursor(); - - newNbUIso = NbIsosDlg->getU(); - newNbVIso = NbIsosDlg->getV(); - } else - return; //Cancel case - } - else if ( actionType == INCR || actionType == DECR ) { - int delta = 1; - if (actionType == DECR) - delta = -1; - - newNbUIso = UIso + delta; - newNbVIso = VIso + delta; - - if ( newNbUIso < 0 || newNbVIso < 0 || newNbUIso > 99 || newNbVIso > 99 ) - return; - } - - while( anAct!=NULL ) { - if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)){ - // There are no casting to needed actor. - int aIsos[2]={newNbUIso,newNbVIso}; - anActor->SetNbIsos(aIsos); - anActor->StoreIsoNumbers(); - - QString anIsos = QString("%1%2%3").arg(newNbUIso).arg(GEOM::subSectionSeparator()).arg(newNbVIso); - aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::NbIsos ), anIsos); - } - anAct = aCollection->GetNextActor(); - } - view->Repaint(); - GeometryGUI::Modified(); - } // end vtkviewer + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + QString anIsos = QString( "%1%2%3" ).arg( newNbUIso ).arg( GEOM::subSectionSeparator() ).arg( newNbVIso ); + appStudy->setObjectProperty( aMgrId ,io->getEntry(), GEOM::propertyName( GEOM::NbIsos ), anIsos ); + if ( window->isVisible( io ) ) displayer.Redisplay( io, false ); + } + displayer.UpdateViewer(); + GeometryGUI::Modified(); } void GEOMToolsGUI::OnDeflection() { - SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) return; + SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); + if ( !appStudy ) return; - bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()); - bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type()); - int mgrId = window ? window->getViewManager()->getGlobalId() : -1; + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) return; - if (isOCC) { // if is OCCViewer - OCCViewer_Viewer* vm = dynamic_cast(window->getViewManager()->getViewModel()); - Handle (AIS_InteractiveContext) ic = vm->getAISContext(); + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) return; - ic->InitCurrent(); - if (ic->MoreCurrent()) { - Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + GEOM_Displayer displayer( appStudy ); + SALOME_View* window = displayer.GetActiveView(); + if ( !window ) return; - Standard_Real aDC, aPrevDC; - Standard_Boolean isOwnDC = CurObject->OwnDeviationCoefficient(aDC, aPrevDC); - if (!isOwnDC) - aDC = ic->DeviationCoefficient(); + int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId(); - GEOMToolsGUI_DeflectionDlg * DeflectionDlg = new GEOMToolsGUI_DeflectionDlg - (SUIT_Session::session()->activeApplication()->desktop()); - DeflectionDlg->setTheDC(aDC); - double aNewDC = 0.0; - bool ok = false; - while (!ok) { - if (DeflectionDlg->exec()) { - SUIT_OverrideCursor(); - aNewDC = DeflectionDlg->getTheDC(); - ok = (1e-07 <= aNewDC && aNewDC <= 1.0); // spinbox can return zero - if (ok) { - for (; ic->MoreCurrent(); ic->NextCurrent()) { - CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); - ic->SetDeviationCoefficient(CurObject, aNewDC, Standard_True); - ic->Redisplay(CurObject); - appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::Deflection ), aNewDC); - } - } - } - else { - ok = true; - } - } + QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Deflection ), QVariant() ); + double aDC = v.isValid() ? v.toDouble() : SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "deflection_coef", 0.001 ); + + GEOMToolsGUI_DeflectionDlg * DeflectionDlg = new GEOMToolsGUI_DeflectionDlg + ( SUIT_Session::session()->activeApplication()->desktop() ); + DeflectionDlg->setTheDC( aDC ); + if ( DeflectionDlg->exec() ) { + SUIT_OverrideCursor(); + aDC = DeflectionDlg->getTheDC(); + + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::Deflection ), aDC ); + if ( window->isVisible( io ) ) displayer.Redisplay( io, false ); } - GeometryGUI::Modified(); } - else if (isVTK) { // if is VTKViewer - SalomeApp_Application* app = dynamic_cast - (SUIT_Session::session()->activeApplication()); - if (!app) - return; - - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - if (!aSelMgr) - return; - - SALOME_ListIO selected; - aSelMgr->selectedObjects(selected); - if (selected.IsEmpty()) - return; - - SVTK_ViewWindow* vtkVW = dynamic_cast(window); - if (!vtkVW) - return; - - SALOME_View* view = GEOM_Displayer::GetActiveView(); - - vtkActorCollection* aCollection = vtkActorCollection::New(); - - for (SALOME_ListIteratorOfListIO It (selected); It.More(); It.Next()) { - Handle(SALOME_InteractiveObject) anIObject = It.Value(); - SALOME_Prs* aPrs = view->CreatePrs(anIObject->getEntry()); - SVTK_Prs* vtkPrs = dynamic_cast(aPrs); - if (vtkPrs) { - vtkActorCollection* anActors = vtkPrs->GetObjects(); - anActors->InitTraversal(); - vtkActor* anAct = anActors->GetNextActor(); - aCollection->AddItem(anAct); - } - } - - if (aCollection) - aCollection->InitTraversal(); - else - return; - - double aDC = 0.; - - vtkActor* anAct = aCollection->GetNextActor(); - if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) - aDC = anActor->GetDeflection(); - else - return; - - GEOMToolsGUI_DeflectionDlg* DeflectionDlg = new GEOMToolsGUI_DeflectionDlg - (SUIT_Session::session()->activeApplication()->desktop()); - DeflectionDlg->setTheDC(aDC); - if (DeflectionDlg->exec()) { - SUIT_OverrideCursor(); - aDC = DeflectionDlg->getTheDC(); - while (anAct != NULL) { - if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { - // There are no casting to needed actor. - anActor->SetDeflection(aDC); - appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::Deflection ), aDC); - } - anAct = aCollection->GetNextActor(); - } - } - GeometryGUI::Modified(); - } // end vtkviewer + displayer.UpdateViewer(); + GeometryGUI::Modified(); } void GEOMToolsGUI::OnSelectOnly(int mode) @@ -1098,361 +625,148 @@ void GEOMToolsGUI::OnPublishObject() { void GEOMToolsGUI::OnEdgeWidth() { - SUIT_ViewWindow* window = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); - SalomeApp_Study* appStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) return; + SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); + if ( !appStudy ) return; - bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type()); - bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type()); - int mgrId = window ? window->getViewManager()->getGlobalId() : -1; + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) return; - if (isOCC) { // if is OCCViewer - OCCViewer_Viewer* vm = dynamic_cast(window->getViewManager()->getViewModel()); - Handle (AIS_InteractiveContext) ic = vm->getAISContext(); - SALOME_View* view = GEOM_Displayer::GetActiveView(); - ic->InitCurrent(); - if (ic->MoreCurrent()) { - Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) return; - int aWidth = (int)CurObject->Width(); + GEOM_Displayer displayer( appStudy ); - GEOMToolsGUI_LineWidthDlg * Dlg = new GEOMToolsGUI_LineWidthDlg - (SUIT_Session::session()->activeApplication()->desktop(),"EDGE_WIDTH_TLT"); - Dlg->setTheLW(aWidth); - int aNewWidth = 0; - if (Dlg->exec()) { - aNewWidth = Dlg->getTheLW(); - bool ok = (aNewWidth != aWidth && aNewWidth != 0 ); - if (ok) { - for(; ic->MoreCurrent(); ic->NextCurrent()) { - CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); - SOCC_Prs* aPrs = dynamic_cast(view->CreatePrs(CurObject->getIO()->getEntry())); - AIS_ListOfInteractive anAISObjects; - aPrs->GetObjects( anAISObjects ); - AIS_ListIteratorOfListOfInteractive aIter( anAISObjects ); - for ( ; aIter.More(); aIter.Next() ) { - Handle(SALOME_AISShape) cur = Handle(SALOME_AISShape)::DownCast(aIter.Value()); - if ( !cur.IsNull() ) { - cur->SetWidth(aNewWidth); - ic->Redisplay(cur); - } - } - appStudy->setObjectProperty(mgrId, CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aNewWidth); - } - } - } + SALOME_View* window = displayer.GetActiveView(); + if ( !window ) return; + + int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId(); + + GEOMToolsGUI_LineWidthDlg* Dlg = + new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(), "EDGE_WIDTH_TLT" ); + + QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), QVariant() ); + int aWidth = v.isValid() ? v.toInt() : SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "edge_width", 1 ); + + Dlg->setTheLW( aWidth ); + if ( Dlg->exec() ) { + SUIT_OverrideCursor(); + aWidth = Dlg->getTheLW(); + } else + return; //Cancel case + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aWidth ); + if ( window->isVisible( io ) ) displayer.Redisplay( io, false ); } - else { - return; - } - GeometryGUI::Modified(); - } - else if (isVTK) { // if is VTKViewer - SalomeApp_Application* app = dynamic_cast - (SUIT_Session::session()->activeApplication()); - if (!app) - return; - - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - if (!aSelMgr) - return; - - SALOME_ListIO selected; - aSelMgr->selectedObjects(selected); - if (selected.IsEmpty()) - return; - - SVTK_ViewWindow* vtkVW = dynamic_cast(window); - if (!vtkVW) - return; - - SALOME_View* view = GEOM_Displayer::GetActiveView(); - - vtkActorCollection* aCollection = vtkActorCollection::New(); - - for (SALOME_ListIteratorOfListIO It (selected); It.More(); It.Next()) { - Handle(SALOME_InteractiveObject) anIObject = It.Value(); - SALOME_Prs* aPrs = view->CreatePrs(anIObject->getEntry()); - SVTK_Prs* vtkPrs = dynamic_cast(aPrs); - if (vtkPrs) { - vtkActorCollection* anActors = vtkPrs->GetObjects(); - anActors->InitTraversal(); - vtkActor* anAct = anActors->GetNextActor(); - aCollection->AddItem(anAct); - } - } - - if (aCollection) - aCollection->InitTraversal(); - else - return; - - int aWidth = 1; - - vtkActor* anAct = aCollection->GetNextActor(); - if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) - aWidth = anActor->GetWidth(); - else - return; - - GEOMToolsGUI_LineWidthDlg * Dlg = new GEOMToolsGUI_LineWidthDlg - (SUIT_Session::session()->activeApplication()->desktop(),"EDGE_WIDTH_TLT"); - - Dlg->setTheLW(aWidth); - if (Dlg->exec()) { - SUIT_OverrideCursor(); - aWidth = Dlg->getTheLW(); - while (anAct != NULL) { - if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { - // There are no casting to needed actor. - anActor->SetWidth(aWidth); - appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aWidth); - } - anAct = aCollection->GetNextActor(); - } - } - GeometryGUI::Modified(); - } // end vtkviewer + displayer.UpdateViewer(); + GeometryGUI::Modified(); } void GEOMToolsGUI::OnIsosWidth() { - SalomeApp_Application* app = - dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - SalomeApp_Study* aStudy = dynamic_cast( app->activeStudy() ); - SUIT_ViewWindow* window = app->desktop()->activeWindow(); + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) return; - bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); - bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); + SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); + if ( !appStudy ) return; - if(isOCC){ // if is OCCViewer - - OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); - Handle (AIS_InteractiveContext) ic = vm->getAISContext(); - int aMgrId = window->getViewManager()->getGlobalId(); - - ic->InitCurrent(); - if ( ic->MoreCurrent() ) { - Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); - CurObject->restoreIsoNumbers(); - Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); - - Handle(Graphic3d_AspectLine3d) asp = CurDrawer->UIsoAspect()->Aspect(); - - Quantity_Color C; - Aspect_TypeOfLine T; - Standard_Real W; - asp->Values(C,T,W); - - int aWidth = (int)W; - - GEOMToolsGUI_LineWidthDlg * Dlg = - new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(),"ISOS_WIDTH_TLT" ); - - Dlg->setTheLW( aWidth ); - - if ( Dlg->exec() ) { - SUIT_OverrideCursor(); - aWidth = Dlg->getTheLW(); - } else //Cancel case - return; - - for(; ic->MoreCurrent(); ic->NextCurrent()) { - CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); - - Handle(AIS_Drawer) CurDrawer = CurObject->Attributes(); - - CurObject->Attributes()->UIsoAspect()->SetWidth(aWidth); - CurObject->Attributes()->VIsoAspect()->SetWidth(aWidth); - - ic->Redisplay(CurObject); - - aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth); - } - GeometryGUI::Modified(); - } - } - else if(isVTK){ // if is VTKViewer - // - // Warning. It's works incorrect. must be recheked. - // - SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* > - ( SUIT_Session::session()->activeApplication() ); - if ( !app ) - return; - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - if ( !aSelMgr ) - return; - SALOME_ListIO selected; - aSelMgr->selectedObjects( selected ); - if ( selected.IsEmpty() ) - return; - - SVTK_ViewWindow* vtkVW = dynamic_cast( window ); - if ( !vtkVW ) - return; - - int aMgrId = window->getViewManager()->getGlobalId(); - - SALOME_View* view = GEOM_Displayer::GetActiveView(); - - vtkActorCollection* aCollection = vtkActorCollection::New(); - - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - Handle(SALOME_InteractiveObject) anIObject = It.Value(); - SALOME_Prs* aPrs = view->CreatePrs( anIObject->getEntry() ); - SVTK_Prs* vtkPrs = dynamic_cast( aPrs ); - if ( vtkPrs ) { - vtkActorCollection* anActors = vtkPrs->GetObjects(); - anActors->InitTraversal(); - vtkActor* anAct = anActors->GetNextActor(); - aCollection->AddItem(anAct); - } - } - - if(aCollection) - aCollection->InitTraversal(); - else - return; - - int aWidth = 1; - - vtkActor* anAct = aCollection->GetNextActor(); - if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { - aWidth = anActor->GetIsosWidth(); - } - else - return; - - GEOMToolsGUI_LineWidthDlg* Dlg = - new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(), "ISOS_WIDTH_TLT" ); - - Dlg->setTheLW( aWidth ); - if (Dlg->exec() ) { - SUIT_OverrideCursor(); - aWidth = Dlg->getTheLW(); - } else - return; //Cancel case - - while( anAct!= NULL ) { - if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) { - // There are no casting to needed actor. - anActor->SetIsosWidth(aWidth); - aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth); - } - anAct = aCollection->GetNextActor(); - } - - view->Repaint(); - GeometryGUI::Modified(); - } // end vtkviewer -} - -void GEOMToolsGUI::OnBringToFront() { - SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - if ( !app ) - return; - - SalomeApp_Module* mod = dynamic_cast(app->activeModule()); - if(!mod) - return; - - GEOM_Displayer* disp = dynamic_cast(mod->displayer()); - - if(!disp) - return; - LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); - if ( !aSelMgr ) - return; + if ( !aSelMgr ) return; SALOME_ListIO selected; aSelMgr->selectedObjects( selected ); - if ( selected.IsEmpty() ) - return; + if ( selected.IsEmpty() ) return; - SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); - if(!appStudy) - return; + GEOM_Displayer displayer( appStudy ); - SUIT_ViewWindow* window = app->desktop()->activeWindow(); + SALOME_View* window = displayer.GetActiveView(); + if ( !window ) return; - OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); - if ( !vm ) - return; - - bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); + int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId(); + + GEOMToolsGUI_LineWidthDlg* Dlg = + new GEOMToolsGUI_LineWidthDlg( SUIT_Session::session()->activeApplication()->desktop(), "ISOS_WIDTH_TLT" ); + + QVariant v = appStudy->getObjectProperty( aMgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), QVariant() ); + int aWidth = v.isValid() ? v.toInt() : SUIT_Session::session()->resourceMgr()->integerValue( "Geometry", "isolines_width", 1 ); + + Dlg->setTheLW( aWidth ); + if ( Dlg->exec() ) { + SUIT_OverrideCursor(); + aWidth = Dlg->getTheLW(); + } else + return; //Cancel case + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth ); + if ( window->isVisible( io ) ) displayer.Redisplay( io, false ); + } + displayer.UpdateViewer(); + GeometryGUI::Modified(); +} + +void GEOMToolsGUI::OnBringToFront() { + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) return; + + SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy()); + if (!appStudy) return; + + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); + if ( !aSelMgr ) return; + + SALOME_ListIO selected; + aSelMgr->selectedObjects( selected ); + if ( selected.IsEmpty() ) return; + + GEOM_Displayer displayer( appStudy ); + + SALOME_View* window = displayer.GetActiveView(); + if ( !window ) return; + + int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId(); QAction* a = getGeometryGUI()->getAction( GEOMOp::OpBringToFront ); bool checked = a->isChecked(); - - if ( isOCC ) { - GEOMBase* gb = new GEOMBase(); - Handle(GEOM_AISShape) aisShape; - int aMgrId = window->getViewManager()->getGlobalId(); - - Handle(AIS_InteractiveContext) ic = vm->getAISContext(); - SALOME_ListIO anIOlst; - for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), true ); - if ( !aisShape.IsNull() ) { - appStudy->setObjectProperty( aMgrId, aisShape->getIO()->getEntry(), GEOM::propertyName( GEOM::TopLevel ), checked ); - aisShape->setTopLevel(checked); - anIOlst.Append(aisShape->getIO()); - } - } // for... - disp->Redisplay(anIOlst); - GeometryGUI::Modified(); - } // if ( isOCC ) + + for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + appStudy->setObjectProperty( aMgrId, io->getEntry(), GEOM::propertyName( GEOM::TopLevel ), checked ); + if ( window->isVisible( io ) ) displayer.Redisplay( io, false ); + } + displayer.UpdateViewer(); + GeometryGUI::Modified(); } void GEOMToolsGUI::OnClsBringToFront() { - SalomeApp_Application* app = - dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); - if(!app) - return; + SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + if ( !app ) return; - SalomeApp_Module* mod = dynamic_cast(app->activeModule()); - if(!mod) - return; - - GEOM_Displayer* disp = dynamic_cast(mod->displayer()); - - if(!disp) - return; + SalomeApp_Study* appStudy = dynamic_cast< SalomeApp_Study* >( app->activeStudy() ); + if ( !appStudy ) return; + GEOM_Displayer displayer( appStudy ); - SalomeApp_Study* appStudy = dynamic_cast(app->activeStudy()); - if(!appStudy) - return; - - SUIT_ViewWindow* window = app->desktop()->activeWindow(); - - bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); - - if(isOCC){ // if is OCCViewer - - OCCViewer_Viewer* vm = dynamic_cast( window->getViewManager()->getViewModel() ); - Handle (AIS_InteractiveContext) ic = vm->getAISContext(); - int aMgrId = window->getViewManager()->getGlobalId(); - - SALOME_ListIO anIOlst; - AIS_ListOfInteractive aList; - ic->DisplayedObjects( aList ); - for ( AIS_ListIteratorOfListOfInteractive it( aList ); it.More(); it.Next() ) { - - Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(it.Value()); - - if(CurObject.IsNull()) - continue; - - appStudy->setObjectProperty( aMgrId, QString(CurObject->getIO()->getEntry()), GEOM::propertyName( GEOM::TopLevel ), Standard_False ); - CurObject->setTopLevel(Standard_False); - anIOlst.Append(CurObject->getIO()); - } - disp->Redisplay(anIOlst); - GeometryGUI::Modified(); + SALOME_View* window = displayer.GetActiveView(); + if ( !window ) return; + + int aMgrId = dynamic_cast< SUIT_ViewModel* >( window )->getViewManager()->getGlobalId(); + + SALOME_ListIO anIOlst; + window->GetVisible( anIOlst ); + + for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) { + Handle( SALOME_InteractiveObject ) io = It.Value(); + appStudy->setObjectProperty( aMgrId, QString( io->getEntry() ), GEOM::propertyName( GEOM::TopLevel ), Standard_False ); + if ( window->isVisible( io ) ) displayer.Redisplay( io, false ); } + displayer.Redisplay( anIOlst ); + displayer.UpdateViewer(); + GeometryGUI::Modified(); } void GEOMToolsGUI::OnSetMaterial( const QVariant& theParam ) diff --git a/src/GEOM_I/GEOM_Gen_i.hh b/src/GEOM_I/GEOM_Gen_i.hh index 021ce1bcb..0f45c54fe 100644 --- a/src/GEOM_I/GEOM_Gen_i.hh +++ b/src/GEOM_I/GEOM_Gen_i.hh @@ -85,6 +85,11 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi // generic method to be put in a super class void register_name(char * name); + // Get ORB object + CORBA::ORB_ptr GetORB() { return CORBA::ORB::_duplicate(_orb); } + + // Get Naming Service object + SALOME_NamingService* GetNS() { return name_service; } //-----------------------------------------------------------------------// // Inherited methods from SALOMEDS::Driver // diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index 95948ed24..ee9ee2e4b 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -30,6 +30,8 @@ #include "GEOM_Engine.hxx" #include "GEOM_Object.hxx" +#define SUBSHAPE_ERROR "Sub shape cannot be transformed" + //============================================================================= /*! * constructor: @@ -1126,6 +1128,56 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector return GetObject(anObject); } +//============================================================================= +/*! + * MakeThickening + */ +//============================================================================= +GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThickening + (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset, + CORBA::Boolean doCopy) +{ + GEOM::GEOM_Object_var aGEOMObject; + //Set a not done flag + GetOperations()->SetNotDone(); + + if (CORBA::is_nil(theObject)) return aGEOMObject._retn(); + + //check if the object is a sub-shape + if (!theObject->IsMainShape() && !doCopy) { + GetOperations()->SetErrorCode(SUBSHAPE_ERROR); + return aGEOMObject._retn(); + } + + if (!doCopy) + aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject); + + //Get the basic object + Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject); + if (aBasicObject.IsNull()) return aGEOMObject._retn(); + + //Create the thickened shape + if (doCopy) + { + Handle(GEOM_Object) anObject = GetOperations()->MakeThickening( + aBasicObject, theOffset, doCopy); + if (!GetOperations()->IsDone() || anObject.IsNull()) + return aGEOMObject._retn(); + + return GetObject(anObject); + } + else + { + GetOperations()->MakeThickening(aBasicObject, theOffset, doCopy); + + // Update GUI. + UpdateGUIForObject(theObject); + + return aGEOMObject._retn(); + } +} + //============================================================================= /*! * RestorePath diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh index 5b274671b..6a03d8d42 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh @@ -186,6 +186,10 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i : GEOM::GEOM_Object_ptr MakePipeBiNormalAlongVector (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath, GEOM::GEOM_Object_ptr theVec); + + GEOM::GEOM_Object_ptr MakeThickening (GEOM::GEOM_Object_ptr theObject, + CORBA::Double theOffset, + CORBA::Boolean isCopy); GEOM::GEOM_Object_ptr RestorePath (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr theBase1, diff --git a/src/GEOM_I/GEOM_IGroupOperations_i.cc b/src/GEOM_I/GEOM_IGroupOperations_i.cc index 60a26e129..c129da936 100644 --- a/src/GEOM_I/GEOM_IGroupOperations_i.cc +++ b/src/GEOM_I/GEOM_IGroupOperations_i.cc @@ -99,6 +99,9 @@ void GEOM_IGroupOperations_i::AddObject(GEOM::GEOM_Object_ptr theGroup, CORBA::L if (aGroupRef.IsNull()) return; GetOperations()->AddObject(aGroupRef, theSubShapeId); + + // Update GUI. + UpdateGUIForObject(theGroup); } //============================================================================= @@ -116,6 +119,9 @@ void GEOM_IGroupOperations_i::RemoveObject(GEOM::GEOM_Object_ptr theGroup, CORBA if (aGroupRef.IsNull()) return; GetOperations()->RemoveObject(aGroupRef, theSubShapeId); + + // Update GUI. + UpdateGUIForObject(theGroup); } //============================================================================= diff --git a/src/GEOM_I/GEOM_IOperations_i.cc b/src/GEOM_I/GEOM_IOperations_i.cc index b56c32942..aecbee269 100644 --- a/src/GEOM_I/GEOM_IOperations_i.cc +++ b/src/GEOM_I/GEOM_IOperations_i.cc @@ -23,6 +23,8 @@ #include "GEOM_IOperations_i.hh" #include "GEOM_Engine.hxx" +#include "GEOM_Gen_i.hh" +#include #include "utilities.h" #include "OpUtil.hxx" @@ -32,6 +34,8 @@ #include #include +#include CORBA_SERVER_HEADER(SALOME_Session) + //============================================================================= /*! * default constructor: @@ -155,3 +159,32 @@ Handle(GEOM_Object) GEOM_IOperations_i::GetObjectImpl(GEOM::GEOM_Object_ptr theO } return anImpl; } + +//============================================================================= +/*! + * UpdateGUIForObject + */ +//============================================================================= +void GEOM_IOperations_i::UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj) +{ + if (!CORBA::is_nil (theObj)) { + // Cast _engine to GEOM_Gen_i type. + PortableServer::Servant aServant = myPOA->reference_to_servant(_engine.in()); + GEOM_Gen_i *anEngine = dynamic_cast(aServant); + + if (anEngine) { + SALOME_NamingService *aNameService = anEngine->GetNS(); + CORBA::Object_var aSessionObj = aNameService->Resolve("/Kernel/Session"); + SALOME::Session_var aSession = SALOME::Session::_narrow(aSessionObj); + + if (!aSession->_is_nil()) + { + std::string aMsg("GEOM/modified/"); + CORBA::String_var anIOR = anEngine->GetORB()->object_to_string(theObj); + + aMsg += anIOR.in(); + aSession->emitMessageOneWay(aMsg.c_str()); + } + } + } +} diff --git a/src/GEOM_I/GEOM_IOperations_i.hh b/src/GEOM_I/GEOM_IOperations_i.hh index dc45fffa3..9c1ea32b2 100644 --- a/src/GEOM_I/GEOM_IOperations_i.hh +++ b/src/GEOM_I/GEOM_IOperations_i.hh @@ -59,6 +59,8 @@ class GEOM_I_EXPORT GEOM_IOperations_i : public virtual POA_GEOM::GEOM_IOperatio ::GEOM_IOperations* GetImpl() { return _impl; } + virtual void UpdateGUIForObject(GEOM::GEOM_Object_ptr theObj); + private: ::GEOM_IOperations* _impl; diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.cc b/src/GEOM_I/GEOM_ITransformOperations_i.cc index 05b132959..27a3893bf 100644 --- a/src/GEOM_I/GEOM_ITransformOperations_i.cc +++ b/src/GEOM_I/GEOM_ITransformOperations_i.cc @@ -100,6 +100,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPoints //Perform the translation GetOperations()->TranslateTwoPoints(anObject, aPoint1, aPoint2); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -169,6 +172,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ //Perform the translation GetOperations()->TranslateDXDYDZ(anObject, theDX, theDY, theDZ); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -233,6 +239,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVector //Perform the translation GetOperations()->TranslateVector(anObject, aVector); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -310,6 +319,10 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorDistance } GetOperations()->TranslateVectorDistance(aBasicObject, aVector, theDistance, theCopy); + + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -347,6 +360,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::Rotate (GEOM::GEOM_Object_ptr //Perform the rotation GetOperations()->Rotate(anObject, anAxis, theAngle); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -413,6 +429,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlane //Perform the mirror GetOperations()->MirrorPlane(anObject, aPlane); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -479,6 +498,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxis //Perform the mirror GetOperations()->MirrorAxis(anObject, aAxis); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -545,6 +567,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPoint //Perform the mirror GetOperations()->MirrorPoint(anObject, aPoint); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -607,6 +632,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape //Create the offset shape GetOperations()->OffsetShape(aBasicObject, theOffset); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -700,6 +728,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape //Perform the scale GetOperations()->ScaleShape(anObject, aPoint, theFactor); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -778,6 +809,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxes GetOperations()->ScaleShapeAlongAxes (anObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/false); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -860,6 +894,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShape //Perform the Position GetOperations()->PositionShape(anObject, aStartLCS, aEndLCS); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } @@ -933,6 +970,11 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); + if (!theCopy) { + // Update GUI. + UpdateGUIForObject(theObject); + } + return GetObject(anObject); } @@ -1209,6 +1251,9 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePoints //Perform the translation GetOperations()->RotateThreePoints(anObject, aCentPoint, aPoint1, aPoint2); + // Update GUI. + UpdateGUIForObject(theObject); + return aGEOMObject._retn(); } diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py index bf66f2e21..a5959bf6e 100644 --- a/src/GEOM_SWIG/geompyDC.py +++ b/src/GEOM_SWIG/geompyDC.py @@ -3714,6 +3714,61 @@ class geompyDC(GEOM._objref_GEOM_Gen): RaiseIfFailed("MakePipeBiNormalAlongVector", self.PrimOp) self._autoPublish(anObj, theName, "pipe") return anObj + + ## Makes a thick solid from a face or a shell + # @param theShape Face or Shell to be thicken + # @param theThickness Thickness of the resulting solid + # @param theName Object name; when specified, this parameter is used + # for result publication in the study. Otherwise, if automatic + # publication is switched on, default value is used for result name. + # + # @return New GEOM.GEOM_Object, containing the created solid + # + def MakeThickSolid(self, theShape, theThickness, theName=None): + """ + Make a thick solid from a face or a shell + + Parameters: + theShape Face or Shell to be thicken + theThickness Thickness of the resulting solid + theName Object name; when specified, this parameter is used + for result publication in the study. Otherwise, if automatic + publication is switched on, default value is used for result name. + + Returns: + New GEOM.GEOM_Object, containing the created solid + """ + # Example: see GEOM_TestAll.py + anObj = self.PrimOp.MakeThickening(theShape, theThickness, True) + RaiseIfFailed("MakeThickening", self.PrimOp) + self._autoPublish(anObj, theName, "pipe") + return anObj + + + ## Modifies a face or a shell to make it a thick solid + # @param theShape Face or Shell to be thicken + # @param theThickness Thickness of the resulting solid + # + # @return The modified shape + # + def Thicken(self, theShape, theThickness): + """ + Modifies a face or a shell to make it a thick solid + + Parameters: + theBase Base shape to be extruded. + thePath Path shape to extrude the base shape along it. + theName Object name; when specified, this parameter is used + for result publication in the study. Otherwise, if automatic + publication is switched on, default value is used for result name. + + Returns: + The modified shape + """ + # Example: see GEOM_TestAll.py + anObj = self.PrimOp.MakeThickening(theShape, theThickness, False) + RaiseIfFailed("MakeThickening", self.PrimOp) + return anObj ## Build a middle path of a pipe-like shape. # The path shape can be a wire or an edge. diff --git a/src/GEOM_SWIG/gsketcher.py b/src/GEOM_SWIG/gsketcher.py index a3810ae06..f0354e8c3 100644 --- a/src/GEOM_SWIG/gsketcher.py +++ b/src/GEOM_SWIG/gsketcher.py @@ -45,8 +45,8 @@ class Sketcher3D: sk = geompy.Sketcher3D() sk.addPointsAbsolute(0,0,0, 70,0,0) sk.addPointsRelative(0, 0, 130) - sk.addPointAnglesLength("OXY", 50, 0, 100) - sk.addPointAnglesLength("OXZ", 30, 80, 130) + sk.addPointRadiusAnglesRelative(50, 0, 100, 'OXY') + sk.addPointRadiusAnglesRelative(30, 80, 130, 'OXZ') sk.close() a3D_Sketcher_1 = sk.wire() """ diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index b5cc5e31a..c14903c94 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -109,12 +109,19 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWi GroupDXDYDZ->TextLabel5->setText(tr("GEOM_SCALE_FACTOR")); GroupDXDYDZ->CheckBox1->setText(tr("GEOM_BOTHWAY")); GroupDXDYDZ->CheckBox2->setText(tr("GEOM_SCALE_PRISM")); + + GroupThickening = new DlgRef_1Check1Spin1Check(centralWidget()); + GroupThickening->GroupBox1->setTitle("Thickening"); + GroupThickening->checkButton1->setText("Add thickness (edges or wires only)"); + GroupThickening->checkButton2->setText("Thicken towards outside"); + GroupThickening->TextLabel1->setText("Thickness"); QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); layout->addWidget(GroupVecH); layout->addWidget(Group2Points); layout->addWidget(GroupDXDYDZ); + layout->addWidget(GroupThickening); /***************************************************************/ setHelpFileName("create_extrusion_page.html"); @@ -145,6 +152,9 @@ void GenerationGUI_PrismDlg::Init() double aScaleFactor = 2.0; double aScaleStep = 0.5; double aScaleMin = Precision::Confusion() * 10.0; + + double aThickness = 10; + double aThicknessMin = Precision::Confusion() * 10.0; initSpinBox(GroupVecH->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" ); GroupVecH->SpinBox_DX->setValue(100.0); @@ -163,6 +173,9 @@ void GenerationGUI_PrismDlg::Init() GroupVecH->SpinBox_DY->setValue(aScaleFactor); Group2Points->SpinBox1->setValue(aScaleFactor); GroupDXDYDZ->SpinBox_SC->setValue(aScaleFactor); + + initSpinBox(GroupThickening->SpinBox_DX, aThicknessMin, COORD_MAX, step, "length_precision" ); + GroupThickening->SpinBox_DX->setValue(aThickness); // hide not used controls Group2Points->TextLabel5->hide(); @@ -190,6 +203,19 @@ void GenerationGUI_PrismDlg::Init() Group2Points->LineEdit3->setText(""); GroupDXDYDZ->LineEdit1->setText(""); + + GroupThickening->SpinBox_DX->hide(); + GroupThickening->checkButton2->hide(); + GroupThickening->TextLabel1->hide(); + + GroupVecH->TextLabel4->hide(); + GroupVecH->SpinBox_DY->hide(); + + Group2Points->TextLabel4->hide(); + Group2Points->SpinBox1->hide(); + + GroupDXDYDZ->TextLabel5->hide(); + GroupDXDYDZ->SpinBox_SC->hide(); myBaseObjects.clear(); myPoint1.nullify(); @@ -212,14 +238,14 @@ void GenerationGUI_PrismDlg::Init() connect(GroupVecH->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); connect(GroupVecH->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onReverse())); - connect(GroupVecH->CheckBox3, SIGNAL(toggled(bool)), this, SLOT(onScalePrism())); + connect(GroupVecH->CheckBox3, SIGNAL(toggled(bool)), this, SLOT(onScalePrism(bool))); connect(GroupVecH->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(Group2Points->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group2Points->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group2Points->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(Group2Points->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); - connect(Group2Points->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism())); + connect(Group2Points->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism(bool))); connect(Group2Points->SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDXDYDZ->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); @@ -228,7 +254,11 @@ void GenerationGUI_PrismDlg::Init() connect(GroupDXDYDZ->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDXDYDZ->SpinBox_SC, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); connect(GroupDXDYDZ->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(onBothway())); - connect(GroupDXDYDZ->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism())); + connect(GroupDXDYDZ->CheckBox2, SIGNAL(toggled(bool)), this, SLOT(onScalePrism(bool))); + + connect(GroupThickening->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox())); + connect(GroupThickening->checkButton1, SIGNAL(toggled(bool)), this, SLOT(onAddThickening(bool))); + connect(GroupThickening->checkButton2, SIGNAL(toggled(bool)), this, SLOT(onChangeDirection(bool))); initName(tr("GEOM_EXTRUSION")); @@ -335,11 +365,19 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() myEditCurrentArgument == Group2Points->LineEdit1 || myEditCurrentArgument == GroupDXDYDZ->LineEdit1 ) { myBaseObjects.clear(); + GroupThickening->checkButton1->setEnabled(true); + QList objects = getSelected( TopAbs_SHAPE, -1 ); for ( int i = 0; i < objects.count(); i++ ) { GEOM::shape_type stype = objects[i]->GetMaxShapeType(); if ( stype < GEOM::SHELL || stype > GEOM::VERTEX ) continue; + if ( stype > GEOM::EDGE || stype < GEOM::WIRE ) + { + GroupThickening->checkButton1->setChecked(false); + GroupThickening->checkButton1->setEnabled(false); + } + myBaseObjects << objects[i]; } if ( !myBaseObjects.isEmpty() ) { @@ -561,17 +599,50 @@ void GenerationGUI_PrismDlg::onBothway() // function : onScalePrism() // purpose : //================================================================================= -void GenerationGUI_PrismDlg::onScalePrism() +void GenerationGUI_PrismDlg::onScalePrism(bool isChecked) { - GroupVecH->TextLabel4->setEnabled(GroupVecH->CheckBox3->isChecked()); - GroupVecH->SpinBox_DY->setEnabled(GroupVecH->CheckBox3->isChecked()); + GroupVecH->TextLabel4->setVisible(isChecked); + GroupVecH->SpinBox_DY->setVisible(isChecked); - Group2Points->TextLabel4->setEnabled(Group2Points->CheckBox2->isChecked()); - Group2Points->SpinBox1->setEnabled(Group2Points->CheckBox2->isChecked()); + Group2Points->TextLabel4->setVisible(isChecked); + Group2Points->SpinBox1->setVisible(isChecked); - GroupDXDYDZ->TextLabel5->setEnabled(GroupDXDYDZ->CheckBox2->isChecked()); - GroupDXDYDZ->SpinBox_SC->setEnabled(GroupDXDYDZ->CheckBox2->isChecked()); + GroupDXDYDZ->TextLabel5->setVisible(isChecked); + GroupDXDYDZ->SpinBox_SC->setVisible(isChecked); + + GroupVecH->TextLabel4->setEnabled(isChecked); + GroupVecH->SpinBox_DY->setEnabled(isChecked); + Group2Points->TextLabel4->setEnabled(isChecked); + Group2Points->SpinBox1->setEnabled(isChecked); + + GroupDXDYDZ->TextLabel5->setEnabled(isChecked); + GroupDXDYDZ->SpinBox_SC->setEnabled(isChecked); + + processPreview(); +} + +//================================================================================= +// function : onAddThickening(bool) +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::onAddThickening(bool isChecked) +{ + GroupThickening->SpinBox_DX->setVisible(isChecked); + GroupThickening->checkButton2->setVisible(isChecked); + GroupThickening->TextLabel1->setVisible(isChecked); + + updateGeometry(); + resize(minimumSizeHint()); + processPreview(); +} + +//================================================================================= +// function : onChangeDirection(bool) +// purpose : +//================================================================================= +void GenerationGUI_PrismDlg::onChangeDirection(bool isChecked) +{ processPreview(); } @@ -585,6 +656,7 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects) GEOM::GEOM_Object_var anObj; GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); + GEOM::GEOM_I3DPrimOperations_var anotherOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); for (int i = 0; i < myBaseObjects.count(); i++) { switch (getConstructorId()) { @@ -641,7 +713,19 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects) } break; } - + + if(GroupThickening->checkButton1->isChecked()) + { + double aThickness = 0.0; + + if(GroupThickening->checkButton2->isChecked() ^ GroupVecH->CheckBox2->isChecked()) // if "towards outside" XOR "reversed" is checked + aThickness = -1.0*(GroupThickening->SpinBox_DX->value()); // change the offset sign to negative + else + aThickness = GroupThickening->SpinBox_DX->value(); + + anObj = anotherOper->MakeThickening(anObj, aThickness, /*copy=*/false); + } + if (!anObj->_is_nil()) objects.push_back(anObj._retn()); } diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.h b/src/GenerationGUI/GenerationGUI_PrismDlg.h index 5b1524517..01f3deff8 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.h +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.h @@ -33,6 +33,7 @@ class DlgRef_2Sel1Spin3Check1Spin; class DlgRef_3Sel2Check3Spin; class DlgRef_1Sel3Spin2Check1Spin; +class DlgRef_1Check1Spin1Check; //================================================================================= // class : GenerationGUI_PrismDlg @@ -66,6 +67,7 @@ private: DlgRef_2Sel1Spin3Check1Spin* GroupVecH; DlgRef_3Sel2Check3Spin* Group2Points; DlgRef_1Sel3Spin2Check1Spin* GroupDXDYDZ; + DlgRef_1Check1Spin1Check* GroupThickening; private slots: void ClickOnOk(); @@ -78,7 +80,9 @@ private slots: void SetDoubleSpinBoxStep( double ); void onReverse(); void onBothway(); - void onScalePrism(); + void onScalePrism(bool); + void onAddThickening( bool ); + void onChangeDirection( bool ); }; #endif // GENERATIONGUI_PRISMDLG_H diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index a49f2789d..d46f94206 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -433,9 +434,37 @@ bool MeasureGUI_DistanceDlg::execute (ObjectList& objects) int nbSols = anOper->ClosestPoints(myObj1, myObj2, aDbls); if (anOper->IsDone()) { - for (int i = 0; i < nbSols; i++) { - GEOM::GEOM_Object_var anObj1 = aBasicOper->MakePointXYZ(aDbls[i*6 + 0], aDbls[i*6 + 1], aDbls[i*6 + 2]); - GEOM::GEOM_Object_var anObj2 = aBasicOper->MakePointXYZ(aDbls[i*6 + 3], aDbls[i*6 + 4], aDbls[i*6 + 5]); + bool doPublishAll = true; + if (nbSols > 1) { + QMessageBox::StandardButton anAnswer = + SUIT_MessageBox::question(this, tr("GEOM_MINDIST_PUBLISH_TITLE"), + tr("GEOM_MINDIST_PUBLISH_TEXT"), + QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel, + QMessageBox::No); + if (anAnswer == QMessageBox::No) + doPublishAll = false; + else if (anAnswer != QMessageBox::Yes) + return true; + } + if (doPublishAll) { + for (int i = 0; i < nbSols; i++) { + GEOM::GEOM_Object_var anObj1 = + aBasicOper->MakePointXYZ(aDbls[i*6 + 0], aDbls[i*6 + 1], aDbls[i*6 + 2]); + GEOM::GEOM_Object_var anObj2 = + aBasicOper->MakePointXYZ(aDbls[i*6 + 3], aDbls[i*6 + 4], aDbls[i*6 + 5]); + + if (!anObj1->_is_nil() && !anObj2->_is_nil()) { + objects.push_back(anObj1._retn()); + objects.push_back(anObj2._retn()); + } + } + } + else { + int i = myGrp->ComboBox1->currentIndex(); + GEOM::GEOM_Object_var anObj1 = + aBasicOper->MakePointXYZ(aDbls[i*6 + 0], aDbls[i*6 + 1], aDbls[i*6 + 2]); + GEOM::GEOM_Object_var anObj2 = + aBasicOper->MakePointXYZ(aDbls[i*6 + 3], aDbls[i*6 + 4], aDbls[i*6 + 5]); if (!anObj1->_is_nil() && !anObj2->_is_nil()) { objects.push_back(anObj1._retn());