diff --git a/CMakeLists.txt b/CMakeLists.txt index 6431c2161..dbe3a9531 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,8 +30,8 @@ CMAKE_POLICY(SET CMP0003 NEW) STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC) SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7) -SET(${PROJECT_NAME_UC}_MINOR_VERSION 6) -SET(${PROJECT_NAME_UC}_PATCH_VERSION 0) +SET(${PROJECT_NAME_UC}_MINOR_VERSION 7) +SET(${PROJECT_NAME_UC}_PATCH_VERSION 1) SET(${PROJECT_NAME_UC}_VERSION ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION}) SET(${PROJECT_NAME_UC}_VERSION_DEV 0) @@ -108,7 +108,9 @@ IF(SALOME_BUILD_GUI) IF(EXISTS ${GUI_ROOT_DIR}) LIST(APPEND CMAKE_MODULE_PATH "${GUI_ROOT_DIR}/adm_local/cmake_files") FIND_PACKAGE(SalomeGUI) - FULL_GUI(TRUE) #check whether GUI builded in full mode and with CORBA + SALOME_GUI_WITH_CORBA() #check whether GUI builded with CORBA + SALOME_GUI_MODE(SALOME_USE_OCCVIEWER SALOME_USE_VTKVIEWER SALOME_USE_SALOMEOBJECT + OPTIONAL SALOME_USE_PLOT2DVIEWER SALOME_USE_GRAPHICSVIEW SALOME_USE_PYCONSOLE) ADD_DEFINITIONS(${GUI_DEFINITIONS}) INCLUDE_DIRECTORIES(${GUI_INCLUDE_DIRS}) ELSE(EXISTS ${GUI_ROOT_DIR}) @@ -125,12 +127,6 @@ IF(SALOME_BUILD_GUI) # Qt4 FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml) - - # Optional prerequisites for GUI - IF(SALOME_USE_GLVIEWER) - FIND_PACKAGE(SalomeOpenGL) - SALOME_LOG_OPTIONAL_PACKAGE(OpenGL SALOME_USE_GLVIEWER) - ENDIF() ENDIF(SALOME_BUILD_GUI) ## @@ -231,9 +227,12 @@ IF(SALOME_BUILD_GUI) LIST(APPEND _${PROJECT_NAME}_exposed_targets AdvancedGUI BasicGUI BlocksGUI BooleanGUI BuildGUI DisplayGUI DlgRef CurveCreator EntityGUI GEOMBase GEOMFiltersSelection GEOM GEOMToolsGUI GenerationGUI GroupGUI Material MeasureGUI GEOMObject - OperationGUI PrimitiveGUI RepairGUI TransformationGUI DependencyTree + OperationGUI PrimitiveGUI RepairGUI TransformationGUI STLPluginGUI BREPPluginGUI STEPPluginGUI IGESPluginGUI XAOPluginGUI VTKPluginGUI ) + IF(SALOME_USE_GRAPHICSVIEW) + LIST(APPEND _${PROJECT_NAME}_exposed_targets DependencyTree) + ENDIF(SALOME_USE_GRAPHICSVIEW) ENDIF(SALOME_BUILD_GUI) IF(SALOME_GEOM_USE_OPENCV) diff --git a/doc/salome/examples/CMakeLists.txt b/doc/salome/examples/CMakeLists.txt index a437b4078..afd0a3a6a 100644 --- a/doc/salome/examples/CMakeLists.txt +++ b/doc/salome/examples/CMakeLists.txt @@ -68,6 +68,7 @@ SET(GOOD_TESTS complex_objs_ex09.py complex_objs_ex10.py complex_objs_ex11.py + fast_intersection.py free_boundaries.py free_faces.py GEOM_box.py @@ -131,9 +132,9 @@ SET(GOOD_TESTS working_with_groups_ex05.py working_with_groups_ex06.py ) -IF(CAS_VERSION_STR VERSION_GREATER "6.8.0") +IF(CAS_VERSION_STR VERSION_GREATER "6.9.0") LIST(APPEND GOOD_TESTS - fast_intersection.py + check_self_intersections_fast.py ) ENDIF() diff --git a/doc/salome/examples/check_self_intersections.py b/doc/salome/examples/check_self_intersections.py index 8df91b9fe..f70a54540 100644 --- a/doc/salome/examples/check_self_intersections.py +++ b/doc/salome/examples/check_self_intersections.py @@ -7,9 +7,15 @@ from salome.geom import geomBuilder geompy = geomBuilder.New(salome.myStudy) # create a box -box = geompy.MakeBoxDXDYDZ(100,30,100) -IsValid = geompy.CheckSelfIntersections(box) -if IsValid == 0: - raise RuntimeError, "Box with self-intersections created" +box = geompy.MakeBoxDXDYDZ(100,100,100) +# create a cylinder +cylinder = geompy.MakeCylinderRH(100, 300) +# make a compound +compound = geompy.MakeCompound([box, cylinder]) + +# check self-intersection +IsValid = geompy.CheckSelfIntersections(compound) +if not IsValid: + print "Shape is self-intersected!" else: - print "\nBox is valid" + print "No self-intersection detected in a shape" diff --git a/doc/salome/examples/check_self_intersections_fast.py b/doc/salome/examples/check_self_intersections_fast.py new file mode 100644 index 000000000..83c8a741e --- /dev/null +++ b/doc/salome/examples/check_self_intersections_fast.py @@ -0,0 +1,21 @@ +# Detect Self-intersections fast + +import salome +salome.salome_init() +import GEOM +from salome.geom import geomBuilder +geompy = geomBuilder.New(salome.myStudy) + +# create a box +box = geompy.MakeBoxDXDYDZ(100,100,100) +# create a cylinder +cylinder = geompy.MakeCylinderRH(100, 300) +# make a compound +compound = geompy.MakeCompound([box, cylinder]) + +# check self-intersection +IsValid = geompy.CheckSelfIntersectionsFast(compound) +if not IsValid: + print "Shape is self-intersected!" +else: + print "No self-intersection detected in a shape" diff --git a/doc/salome/examples/complex_objs_ex05.py b/doc/salome/examples/complex_objs_ex05.py index f38f0816b..f6681b587 100644 --- a/doc/salome/examples/complex_objs_ex05.py +++ b/doc/salome/examples/complex_objs_ex05.py @@ -18,18 +18,22 @@ circles.append(geompy.MakeCircle(vertices[1], edges[0], 40)) circles.append(geompy.MakeCircle(vertices[2], edges[2], 30)) circles.append(geompy.MakeCircle(vertices[3], edges[2], 20)) -# create pipe -Pipe = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0) +# create pipes +Pipe1 = geompy.MakePipeWithDifferentSections(circles, vertices, Wire_1, 0, 0) +Pipe2 = geompy.MakePipeWithDifferentSectionsBySteps(circles, vertices, Wire_1) # add objects in the study geompy.addToStudy(circles[0], "circles1") geompy.addToStudy(circles[1], "circles2") geompy.addToStudy(circles[2], "circles3") geompy.addToStudy(circles[3], "circles4") -id_wire = geompy.addToStudy(Wire_1, "Path") -id_pipe = geompy.addToStudy(Pipe, "Pipe") +id_wire = geompy.addToStudy(Wire_1, "Path") +id_pipe1 = geompy.addToStudy(Pipe1, "Pipe1") +id_pipe2 = geompy.addToStudy(Pipe2, "Pipe2") # display the wire(path) and the pipe gg.createAndDisplayGO(id_wire) -gg.createAndDisplayGO(id_pipe) -gg.setDisplayMode(id_pipe,1) +gg.createAndDisplayGO(id_pipe1) +gg.createAndDisplayGO(id_pipe2) +gg.setDisplayMode(id_pipe1,1) +gg.setDisplayMode(id_pipe2,1) diff --git a/doc/salome/gui/GEOM/collect_geom_methods.py b/doc/salome/gui/GEOM/collect_geom_methods.py index 3639181c4..2f489aefb 100644 --- a/doc/salome/gui/GEOM/collect_geom_methods.py +++ b/doc/salome/gui/GEOM/collect_geom_methods.py @@ -117,16 +117,22 @@ if __name__ == "__main__": if len( args ) < 1: sys.exit("Plugin name is not specified") f = open(options.output, "w") - + + if len(args) > 1: + plugins_names = " ".join(args) + " plugins" + elif len(args) == 1: + plugins_names = args[0] + " plugin" + else: + plugins_names = "" output = [] if options.dummygeomhelp: output.append( "## @package geomBuilder" ) - output.append( "# Documentation of the methods dynamically added by the " + plugin_name + " Geometry plug-in to the geomBuilder class." ) + output.append( "# Documentation of the methods dynamically added by the " + plugins_names + " to the @b %geomBuilder class." ) # Add dummy Geometry help # This is supposed to be done when generating documentation for Geometry module plug-ins output.append( "# @note The documentation below does not provide complete description of class @b %geomBuilder" ) output.append( "# from @b geomBuilder package. This documentation provides only information about" ) - output.append( "# the methods dynamically added to the %geomBuilder class by the " + plugin_name + " plugin" ) + output.append( "# the methods dynamically added to the %geomBuilder class by the " + plugins_names + "." ) output.append( "# For more details on the %geomBuilder class, please refer to the SALOME %Geometry module" ) output.append( "# documentation." ) pass diff --git a/doc/salome/gui/GEOM/images/editgroup.png b/doc/salome/gui/GEOM/images/editgroup.png index c7f55074e..4501fa61f 100755 Binary files a/doc/salome/gui/GEOM/images/editgroup.png and b/doc/salome/gui/GEOM/images/editgroup.png differ diff --git a/doc/salome/gui/GEOM/images/geomcreategroup.png b/doc/salome/gui/GEOM/images/geomcreategroup.png index 0f67a625c..c982f0bc9 100755 Binary files a/doc/salome/gui/GEOM/images/geomcreategroup.png and b/doc/salome/gui/GEOM/images/geomcreategroup.png differ diff --git a/doc/salome/gui/GEOM/images/measures11.png b/doc/salome/gui/GEOM/images/measures11.png index 6ee449874..562714d31 100644 Binary files a/doc/salome/gui/GEOM/images/measures11.png and b/doc/salome/gui/GEOM/images/measures11.png differ diff --git a/doc/salome/gui/GEOM/images/measures13.png b/doc/salome/gui/GEOM/images/measures13.png new file mode 100644 index 000000000..6e9deb566 Binary files /dev/null and b/doc/salome/gui/GEOM/images/measures13.png differ diff --git a/doc/salome/gui/GEOM/images/pipe3.png b/doc/salome/gui/GEOM/images/pipe3.png index d1b7f4031..c5c314915 100644 Binary files a/doc/salome/gui/GEOM/images/pipe3.png and b/doc/salome/gui/GEOM/images/pipe3.png differ diff --git a/doc/salome/gui/GEOM/images/point3.png b/doc/salome/gui/GEOM/images/point3.png old mode 100755 new mode 100644 index 8b4daecc1..57cccab0a Binary files a/doc/salome/gui/GEOM/images/point3.png and b/doc/salome/gui/GEOM/images/point3.png differ diff --git a/doc/salome/gui/GEOM/images/proj_on_cyl_angles.png b/doc/salome/gui/GEOM/images/proj_on_cyl_angles.png new file mode 100644 index 000000000..0d36e4e38 Binary files /dev/null and b/doc/salome/gui/GEOM/images/proj_on_cyl_angles.png differ diff --git a/doc/salome/gui/GEOM/images/proj_on_cyl_dlg.png b/doc/salome/gui/GEOM/images/proj_on_cyl_dlg.png index 38d81b51e..7ce80c1e8 100644 Binary files a/doc/salome/gui/GEOM/images/proj_on_cyl_dlg.png and b/doc/salome/gui/GEOM/images/proj_on_cyl_dlg.png differ diff --git a/doc/salome/gui/GEOM/images/shape_statistics.png b/doc/salome/gui/GEOM/images/shape_statistics.png new file mode 100644 index 000000000..2aaaa9ad3 Binary files /dev/null and b/doc/salome/gui/GEOM/images/shape_statistics.png differ diff --git a/doc/salome/gui/GEOM/images/shape_statistics_simple.png b/doc/salome/gui/GEOM/images/shape_statistics_simple.png new file mode 100644 index 000000000..bc2c0767b Binary files /dev/null and b/doc/salome/gui/GEOM/images/shape_statistics_simple.png differ diff --git a/doc/salome/gui/GEOM/input/add_point_on_edge_operation.doc b/doc/salome/gui/GEOM/input/add_point_on_edge_operation.doc index 187cefbcd..92d6c31a1 100644 --- a/doc/salome/gui/GEOM/input/add_point_on_edge_operation.doc +++ b/doc/salome/gui/GEOM/input/add_point_on_edge_operation.doc @@ -10,25 +10,24 @@ This operation is available in OCC Viewer only. The \b Result will be a \b GEOM_Object. -\n Location of a new vertex on a selected edge can be defined two ways: +\n The location of a new vertex on the selected edge can be defined in two ways:
    -
  1. We can specify a position (ranging from 0.0 to 1.0) of the - vertex on the selected edge either by length or by parameter. +
  2. By specifying the position (ranging from 0.0 to 1.0) by length or by parameter.

    TUI Command: geompy.DivideEdge(Shape, EdgeID, Value, IsByParameter)

    \b Arguments: Name + 1 Edge + 1 Value setting the position of - the point according to one of the selected modes. + the point according to the selected mode. The difference between "by parameter" and "by length" modes becomes apparent on the edges with irregular parametrization (for example, @@ -41,15 +40,15 @@ The \b Result will be a \b GEOM_Object. \image html repair8.png \n\n
  3. -
  4. We can select several points that will be projected to the selected +
  5. By selecting several points that will be projected to the selected edge to find the location of new vertices.

    - TUI Command: geompy.DivideEdgeByPoint(Shape, Edge, Points) + TUI Command: geompy.DivideEdgeByPoint(Shape, Edge, Points):

    \b Arguments: Name + 1 Edge + 1 or more Points. diff --git a/doc/salome/gui/GEOM/input/check_compound_of_blocks.doc b/doc/salome/gui/GEOM/input/check_compound_of_blocks.doc index 7151dcff7..486184871 100644 --- a/doc/salome/gui/GEOM/input/check_compound_of_blocks.doc +++ b/doc/salome/gui/GEOM/input/check_compound_of_blocks.doc @@ -2,16 +2,17 @@ \page check_compound_of_blocks_page Check Compound of Blocks -This operation checks whether a shape is a compound of glued blocks. +This operation checks whether a shape is a compound of glued blocks +and tries to improve the shape to make it include only valid blocks. \image html measures10.png To be considered as a compound of blocks, the given shape must satisfy the following conditions: -- Each element of the compound should be a Block (6 quadrangle faces); -- Each quadrangle face is a face that has 1 wire with 4 edges. If there are -more than 4 edges in a single wire and C1 continuity mode is switched on, -a face is quadrangular if it has 4 bounds of C1 continuity. +- Each element of the compound should be a Block, i.e. have 6 quadrangle faces; +- Each quadrangle face should have one wire with four edges. If there are +more than four edges in a single wire and C1 continuity mode is switched on, +a face is quadrangular if it has four bounds with C1 continuity. - Blocks can be connected only via an entire quadrangle face or an entire edge; - The compound should be connected; - Each couple of connecting quadrangle faces should be glued. @@ -20,14 +21,22 @@ a face is quadrangular if it has 4 bounds of C1 continuity. In this dialog: - \b Object - the checked object. \b Selection button allows picking it in the viewer or in the object browser. -- Use C1 criterion - option that shitches on/off the C1 continuity mode. +- Use C1 criterion - option switches on/off the C1 continuity mode. - Angular Tolerance - angular tolerance to check C1 continuity between neighbor edges in a wire. - \b Errors list informs of possible errors, for example: - Not a block; - Not glued; - Not connected; - Extra or degenerated edge. -- Incriminated Sub-shapes field outputs the list of sub-shapes that cause problem. It is possible to select them in the list and publish in the study for further analysis by clicking \b Apply or Apply and Close button. +- Incriminated Sub-shapes field outputs the list of sub-shapes that cause problem. +- \b Apply and Apply and Close buttons launch an improving process +and publish a result shape which includes valid blocks only. The +improving process tries to + - remove seam edges and degenerated edges of surfaces of revolution; + - re-approximate surfaces to exclude singularities on boundaries; + - unite edges and faces; + - glue faces. + \n TUI Command: @@ -38,4 +47,4 @@ is returned, and encountered errors are printed in the python console. See also a \ref tui_check_compound_of_blocks_page "TUI example". -*/ \ No newline at end of file +*/ diff --git a/doc/salome/gui/GEOM/input/check_self_intersections.doc b/doc/salome/gui/GEOM/input/check_self_intersections.doc index 8cf4d57bf..c92695a10 100644 --- a/doc/salome/gui/GEOM/input/check_self_intersections.doc +++ b/doc/salome/gui/GEOM/input/check_self_intersections.doc @@ -2,6 +2,14 @@ \page check_self_intersections_page Detect Self-intersections +\n To Detect Self-intersections in the Main Menu select +Inspection - > Detect Self-intersections. + +There are two ways to check self-intersections. + +\anchor check_self_intersections_topological +

    Check topological intersections

    + This operation checks the topology of the selected shape to detect self-intersections. \image html measures11.png @@ -9,17 +17,14 @@ This operation checks the topology of the selected shape to detect self-intersec In this dialog: - \b Object - the checked object. \b Selection button allows picking it in the viewer or in the object browser. -- Level of check - The combo box that allows to set the level of checking shape on self-interference. - It defines which interferferences will be checked. Default value is "All interferences". -- Compute self-intersections button computes self-interferences. -- \b Summary section contains the general report if the object has self-intersections and/or if errors are occured during computation. -- \b Self-intersections list contains the list of self-intersections detected. -Select the intersection(s) to show Sub-shapes in the field to the right. -- \b Apply and Apply and Close buttons are used to store interferences selected in the "Self-intersections" list box in the study for further analysis. -If no any interference is selected, all interferences are published in the study. Each interference is published as a child -compound of the source shape and contains a couple of intersecting sub-shapes. +- Level of check - combo box allows setting the level of self-interference checking. It defines, which interferences will be checked. The default value is "All interferences". +- Compute self-intersections button performs the computation. +- \b Summary section contains the general report about self-intersections of the object and/or errors that occurred during the computation. +- \b Self-intersections list contains the list of detected self-intersections. Select the intersection to show Sub-shapes in the field to the right. +- \b Apply and Apply and Close buttons store the interferences selected in the Self-intersections list box in the study for further analysis. +If no interferences are selected, all of them are published in the study. Each interference is published as a child compound of the source shape and contains a couple of intersecting sub-shapes. -\note This tool is useful for detection of shapes, not suitable for +\note This tool is useful for detection of shapes that are not suitable as arguments of Boolean operations and Partition algorithm. For more information about Partition and Boolean Operations Algorithms and their limitations refer to this document. @@ -32,5 +37,28 @@ where: \n See also a \ref tui_check_self_intersections_page "TUI example". +\anchor check_self_intersections_fast +

    Fast intersection

    -*/ \ No newline at end of file +This operations allows to quickly detect self-interferences of the given shape by means of algorithm based on mesh intersections. + +\image html measures13.png + +This algorithm works on the faces level, i.e. it computes only face-to-face intersections. No additional types of intersections is computed. +This case can be useful in order to detect all the intersections between the subshapes of type "surface" inside assembly. +Quality of result will depend on the quality of tesselation (managed via the deflection parameter). However, small values of deflection can +significantly decrease performance of the algorithm. +Nevertheless, performance of Fast Intersect algorithm is much higher than topological intersection. + +\n Result: Boolean. +\n TUI Command: geompy.CheckSelfIntersectionsFast(theShape, theDeflection, theTolerance), \n +where: \n +\em theShape is the shape checked for validity. \n +\em theDeflection is a linear deflection coefficient that specifies quality of tesselation. If theDeflection <= 0, default deflection 0.001 is used. +\em theTolerance Specifies a distance between shapes used for detecting gaps: + - if theTolerance <= 0, algorithm detects intersections; + - if theTolerance > 0, algorithm detects gaps. + +See also a \ref tui_check_self_intersections_fast_page "TUI example". + +*/ diff --git a/doc/salome/gui/GEOM/input/creating_complex_obj.doc b/doc/salome/gui/GEOM/input/creating_complex_obj.doc index 1fbb1d6a2..01b6eb85f 100644 --- a/doc/salome/gui/GEOM/input/creating_complex_obj.doc +++ b/doc/salome/gui/GEOM/input/creating_complex_obj.doc @@ -15,10 +15,8 @@ axis, creating a body of revolution.
  6. \subpage create_extrusion_alongpath_page "Extrude an object along a path", creating a more complex trajectory object.
  7. \subpage create_pipe_path_page "Restore Path" of a pipe-like shape.
  8. -
  9. \subpage create_thickness_page "Thickness" operation that allows to add a thickness to objects.
  10. - -
  11. \subpage create_groups_page "Generate Groups". -This cross-operation functionality allows creation of groups for certain generation operations.
  12. +
  13. \subpage create_thickness_page "Add thickness" to objects.
  14. +
  15. \subpage create_groups_page "Generate Groups" for certain generation operations.
  16. New entity -> Advanced sub-menu allows creating new geometric diff --git a/doc/salome/gui/GEOM/input/creating_explode.doc b/doc/salome/gui/GEOM/input/creating_explode.doc index c25b719ae..693773973 100644 --- a/doc/salome/gui/GEOM/input/creating_explode.doc +++ b/doc/salome/gui/GEOM/input/creating_explode.doc @@ -16,7 +16,7 @@ obtain from it. The \b Result of the operation will be a List of \b GEOM_Objects (vertexes, edges, wires, faces, shells or solids). -Available choices in the Sub Shapes Type combo box depend on the type +The choices available in the Sub Shapes Type combo box depend on the type of selected Main Object: - \b Compound: to extract compounds; - \b Compsolid: to extract compsolids; @@ -29,72 +29,70 @@ of selected Main Object: - \b Shape: to extract top-level contents of the compound shape; - \b Flat: to extract "flat" contents of the compound shape. -Note: "flat" contents means top-level simple-type sub-shapes extracted from -the compound object recursively (i.e. there is no compounds in the result). -For example, if a compound C1 contains a solid S1 and another compound C2 that -contains solids S2 and S3 (see picture below): +Note: "flat" contents means that top-level simple-type sub-shapes are extracted from +the compound object recursively (i.e. there are no compounds in the result). + +Let us take, for example, compound C1 that contains solid S1 and another compound C2 that +contains solids S2 and S3 (see the picture below): - Explode operation with \b Shape type given as parameter will return S1 and C2; - Explode operation with \b Flat type given as parameter will return S1, S2 and S3. \image html flat_contents.png Switching on Select Sub-shapes check box allows manual selection of sub-shapes -to be extracted from the main object. In this mode the user can select sub-shapes +to be extracted from the main object. In this mode it is possible to select sub-shapes directly in 3D viewer. When Select Sub-shapes check box is switched on, additional \b Filter controls -allow to automatically pick up entites which satisfy specified threshold value(s). -The numerical functor for each sub-shape that is compared with threshold value(s) -is computed according to the shape's topological properties: -- length for edges and wires -- area for faces and shells -- volume for solids, compounds, compsolids +allow to automatically pick up entities, which satisfy the specified threshold value(s). +The numerical functor for each sub-shape that is compared with the threshold value(s) +is computed according to the topological properties of the shape: +- length for edges and wires; +- area for faces and shells; +- volume for solids, compounds and compsolids. Filtering capabilities are not available for vertices. -In order to filter out some entities: -- Activate one or two filtering controls by switching on corresponding check boxes; -- Select required threshold comparator type; the following choices are available: +To filter out some entities it is necessary to do the following: +- Activate one or two filtering controls by switching on the corresponding check boxes; +- Select the required threshold comparator type; the following choices are available: - Less Than or Equal or Less Than for the first comparator; - Greater Than or Equal or Greater Than for the second comparator; -- Enter required threshold value (values); +- Enter the required threshold value (values); - Press \b Apply button in the \b Filter group. -The entities which satisfy entered filtering parameters will be automatically highlighted +The entities, which correspond to the entered filtering parameters, will be automatically highlighted in the 3D viewer. Using TUI Commands you can perform this operation in a variety of ways: - geompy.ExtractShapes(Shape, Type, isSorted) explodes a Shape into sub-shapes of a given Type and returns a List of sub-shapes. - This method does not return the Shape itself if it matches the - Type. -- geompy.SubShapeAll(Shape, Type) explodes a Shape on + This method does not return the Shape itself if it matches the Type. +- geompy.SubShapeAll(Shape, Type) explodes a Shape into sub-shapes of a given Type and returns a List of sub-shapes. -- geompy.SubShapeAllIDs(Shape, Type) explodes a Shape on - sub-shapes of a given Type and returns a List of IDs of - sub-shapes. +- geompy.SubShapeAllIDs(Shape, Type) explodes a Shape into sub-shapes of a given Type and returns a List of IDs of sub-shapes. - geompy.SubShapeAllSortedCentres(Shape, Type) explodes a - shape on sub-shapes of a given type and sorts them taking into account + shape into sub-shapes of a given type and sorts them taking into account their gravity centers, to provide a stable order of sub-shapes. It returns a list of sub-shapes. - geompy.SubShapeAllSortedCentresIDs(Shape, Type) explodes - a shape on sub-shapes of a given type and sorts them taking into + a shape into sub-shapes of a given type and sorts them taking into account their gravity centers, to provide a stable order of sub-shapes. It returns a List of IDs of sub-shapes. - geompy.SubShape(Shape, Type, ListOfInd) allows to obtain - a compound of sub-shapes of the Shape, selected by they indices in a + a compound of sub-shapes of the Shape, selected by their indexes in a list of all sub-shapes of the given Type. Each index is in the range [1, Nb_Sub-Shapes_Of_Given_Type]. - geompy.SubShapeSortedCentres(Shape, Type, ListOfInd) allows to obtain a compound of sub-shapes of the Shape, selected by - they indices in sorted list of all sub-shapes of the given Type. Each + their indexes in a sorted list of all sub-shapes of the given Type. Each index is in the range [1, Nb_Sub-Shapes_Of_Given_Type] Arguments: 1 SHAPE + 1 type of SubShape. Example: -\image html explode.png "A box, exploded into faces" +\image html explode.png "A box exploded into faces" */ diff --git a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc index 078089362..84260fe68 100644 --- a/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc +++ b/doc/salome/gui/GEOM/input/creating_extrusion_alongpath.doc @@ -72,18 +72,33 @@ Additional controls: - If With contact is checked, the section is translated in contact with the spine. - If With correction is checked, the section is rotated to be orthogonal to the spine tangent in the corresponding point. +- If Step-by-step generation is checked, the result is created +step-by-step, i.e. it creates pipes between each pair of neighbor sections and +fuses them into a single shape. + +\note If Step-by-step generation is checked, With contact and +With correction controls are disabled as corrections of bases are +not allowed in step-by-step mode. Generate groups checkbox - if checked allows to create groups of sub-shapes. For more details on groups creation please refer to \ref create_groups_page "this description". \n The \b Result of the operation will be a shell or a solid. -\n TUI Command: geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection, +\n TUI Commands: +- geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection, IsGenerateGroups=False) \n Arguments: Name + list of shapes (edges, planar wires, faces or shells) serving as base object + list of locations (vertices) on the path corresponding specified list of the shapes + 1 shape (edge or wire) for definition of the path + 3 Boolean parameters (withContact, withCorrection, IsGenerateGroups). +- geompy.MakePipeWithDifferentSectionsBySteps(baseShape, locations, pathShape, + IsGenerateGroups=False) +\n Arguments: Name + list of shapes (edges, planar wires, faces or shells) serving as base object + +list of locations (vertices) on the path corresponding specified list of the shapes + +1 shape (edge or wire) for definition of the path + +Boolean parameter. + \n Advanced options \ref preview_anchor "Preview" \image html pipe3.png diff --git a/doc/salome/gui/GEOM/input/creating_face.doc b/doc/salome/gui/GEOM/input/creating_face.doc index cb626f83d..e75288de7 100644 --- a/doc/salome/gui/GEOM/input/creating_face.doc +++ b/doc/salome/gui/GEOM/input/creating_face.doc @@ -11,7 +11,7 @@ of the operation will be a GEOM_Object (FACE). \n Firstly, to create a \b Face you need to select input shape(s). The list of input shapes can include shapes of any type except vertices; if the shapes are neither wires nor edges, the algorithm extracts all edges from -the input shapes and works on the obtaineed edges. +the input shapes and works on the obtained edges. \n The edges and wires do not necessarily have to be closed, the algorithm automatically builds a wire of maximum length from all given edges and wires. If several closed wires are detected the algorithm tries @@ -26,7 +26,7 @@ exceeds 1e-06, a warning will be shown, but the face will be created and published in the study in a normal way. Using such faces can lead to failures or unpredictable results in most operations. -\n The \b Result will be a \b GEOM_Object (FACE). +\n The \b Result will be a \b GEOM_Object. It can be either a single face or, in specific cases, a compound of faces. \n TUI Command: geompy.MakeFaceWires([list of Shapes], isPlanarWanted) \n Arguments: Name + 1 wire. @@ -35,7 +35,7 @@ or unpredictable results in most operations. \n Secondly, it is possible to create a face based on another face's surface and bounded by a wire. -\n The \b Result will be a \b GEOM_Object (FACE). +\n The \b Result will be a \b GEOM_Object (face). \n TUI Command: geompy.MakeFaceFromSurface(theFace, theWire) \n Arguments: Name + 1 face + 1 wire. @@ -50,7 +50,7 @@ and constraints: \note Please note, that the constraint face must be connected to a reference edge. -\n The \b Result will be a \b GEOM_Object (FACE). +\n The \b Result will be a \b GEOM_Object (face). \n TUI Command: geompy.MakeFaceWithConstraints([List of constraints]) \n Arguments: Name + List of input edges and constraint faces. If a constraint diff --git a/doc/salome/gui/GEOM/input/creating_isoline.doc b/doc/salome/gui/GEOM/input/creating_isoline.doc index c69418547..9736a2982 100644 --- a/doc/salome/gui/GEOM/input/creating_isoline.doc +++ b/doc/salome/gui/GEOM/input/creating_isoline.doc @@ -3,7 +3,9 @@ \page create_isoline_page Isoline \b Isoline is a 3D curve built on a bounded face limited by [Umin, Umax] and [Vmin, Vmax] -values of U and V parameters. For all points of the isoline U or V parameter value is constant. +values of U and V parameters. For all points of the isoline U or V parameter value is constant. + +Result of this operation is either a single edge or a compound of edges. To create an \b Isoline of a face in the Main Menu select New Entity - > Basic - > Isoline. diff --git a/doc/salome/gui/GEOM/input/creating_point.doc b/doc/salome/gui/GEOM/input/creating_point.doc index cc8790624..5929a8fd1 100644 --- a/doc/salome/gui/GEOM/input/creating_point.doc +++ b/doc/salome/gui/GEOM/input/creating_point.doc @@ -28,9 +28,10 @@ the position of this point regarding the reference one. \n Thirdly, we can define a point by an \b Edge and a \b Parameter indicating its position on the Edge, ranging from 0.0 to 1.0. For example, 0.5 means that the point is located in the middle of the edge. -\n TUI Command: geompy.MakeVertexOnCurve(Edge,Parameter). +\n TUI Command: geompy.MakeVertexOnCurve(Edge,Parameter,takeOrientationIntoAccount). \n Arguments: Name + 1 edge + 1 Parameter defining the -position of the point on the given edge. +position of the point on the given edge + flag that tells if it is necessary +to take the edge orientation into account. \image html point3.png Alternatively, it is possible to define a point by an \b Edge and a \b Length. diff --git a/doc/salome/gui/GEOM/input/creating_shell.doc b/doc/salome/gui/GEOM/input/creating_shell.doc index 32cc8783c..822b8d953 100644 --- a/doc/salome/gui/GEOM/input/creating_shell.doc +++ b/doc/salome/gui/GEOM/input/creating_shell.doc @@ -6,7 +6,7 @@ To create a \b Shell in the Main Menu select New Entity - > Build - > Shell \n You can create a \b Shell from a compound of faces or a list of faces or shells. -\n The \b Result will be a \b GEOM_Object (shell). +\n The \b Result will be a \b GEOM_Object. It can be either a single shell or, in specific cases, a compound of shells. \n TUI Command: geompy.MakeShell(ListOfShape) \n Arguments: Name + Compound of faces or List of faces having connected edges. diff --git a/doc/salome/gui/GEOM/input/creating_surface_from_face.doc b/doc/salome/gui/GEOM/input/creating_surface_from_face.doc index 6034ed5e3..a707dc64e 100644 --- a/doc/salome/gui/GEOM/input/creating_surface_from_face.doc +++ b/doc/salome/gui/GEOM/input/creating_surface_from_face.doc @@ -4,10 +4,10 @@ To create a Surface From Face in the Main Menu select New Entity - > Basic - > Surface From Face -\n This function takes some face as input parameter and creates new -GEOM_Object, i.e. topological shape by extracting underlying surface -of the source face and limiting it by the Umin, Umax, Vmin, Vmax -parameters of the source face (in the parametrical space). +\n This function takes a face at input and creates a new +GEOM_Object, i.e. topological shape by extracting the underlying surface +of the source face and limiting it by the Umin, Umax, Vmin and Vmax +parameters of the source face (in the parametric space). \n \ref restore_presentation_parameters_page "Advanced options". diff --git a/doc/salome/gui/GEOM/input/creating_thickness_page.doc b/doc/salome/gui/GEOM/input/creating_thickness_page.doc index 140c02fc1..88dfc221e 100644 --- a/doc/salome/gui/GEOM/input/creating_thickness_page.doc +++ b/doc/salome/gui/GEOM/input/creating_thickness_page.doc @@ -2,26 +2,28 @@ \page create_thickness_page Thickness Construction -To add a \b Thickness to a shape in the Main Menu select New Entity - > Generation - > Thickness -\n -It is possible to create a Solid from a Face or a Shell by applying a -\b Thickness. To do it you should define an \b Object that is a Face or a -Shell, \b Thickness and to define the thickness direction by means of -Thicken towards the inside check box. +To add \b Thickness to a shape in the Main Menu select New Entity - > Generation - > Thickness. + +Switch between adding thickness to a Face (Shell) or a Solid using radio buttons. + +Firstly, \b Thickness can be applied to a Face or a Shell to create a Solid. \image html thickness.png +It is necessary to define an \b Object (Face or Shell) and the value of \b Thickness. +Thicken towards the inside check box allows changing the thickness direction. + Example: \image html thickness_result.png "Thickness of Shell" -It is possible to apply \b Thickness to a Solid. The result of this operation -is the hollowed Solid. To do it you should define an \b Object that is a Solid, -\b Faces to be removed from result, \b Thickness and the thickness direction by -means of Thicken towards the inside check box. +Secondly, the \b Thickness can be applied to a Solid to create a hollowed Solid. \image html thicksolid.png +It is necessary to define a Solid \b Object \b Faces to be removed from the result and \b Thickness. +Thicken towards the inside check box allows changing the thickness direction. + Example: \image html thicksolid_result.png "Thickness of Solid" @@ -36,8 +38,8 @@ Modifies a shape to make it a thick solid. Arguments: Name + 1 shape (face, shell or solid) + thickness + the list of face IDs. -\n If the shape is face or shell the list of face IDs is not used. -The thickness can be positive or negative for thicken towards the inside. +\n If the shape is a face or a shell the list of face IDs is not used. +The thickness can be positive or negative for thickening towards the inside. \n\n Advanced options \ref preview_anchor "Preview" Our TUI Scripts provide you with useful examples of creation of diff --git a/doc/salome/gui/GEOM/input/dependency_tree.doc b/doc/salome/gui/GEOM/input/dependency_tree.doc index 2f07c9bd3..40e1a2ac4 100644 --- a/doc/salome/gui/GEOM/input/dependency_tree.doc +++ b/doc/salome/gui/GEOM/input/dependency_tree.doc @@ -28,13 +28,15 @@ It is also possible to select an object(s) directly in the "Dependency Tree" vie All necessary parameters of Dependency Tree Viewer can be edited in the \ref pref_dependency_tree "Preferences". +\note This functionality is available only if GUI module is builded with Graphics view (set option SALOME_USE_GRAPHICSVIEW to ON when building GUI module). +
    \anchor dependency_tree_nodes_anchor

    Nodes

    Tree nodes in the Dependency Viewer are named according to the study names of the corresponding objects. -All nodes have fixed size, so long names are cut; the full object name can be seen in the tooltip +All nodes have fixed size, so long names are cut; the full object name can be seen in the tool-tip when the cursor is hovered over the node. "Dependency Tree" view supports the following states of nodes: @@ -61,11 +63,11 @@ Browser, OCC Viewer or Dependency Tree Viewer; Dependency Tree Viewer shows oriented links between nodes to represent the dependency direction. The viewer supports the following states of links: - + \image html tree_unidir_link.png - + \image html tree_bidir_link.png diff --git a/doc/salome/gui/GEOM/input/display_mode.doc b/doc/salome/gui/GEOM/input/display_mode.doc index 7ba535184..af842ccf1 100644 --- a/doc/salome/gui/GEOM/input/display_mode.doc +++ b/doc/salome/gui/GEOM/input/display_mode.doc @@ -29,7 +29,7 @@ functionality for all objects in the current view via the main menu \n TUI Command: gg.setVectorsMode(ID, Bool) -\n Also it is possible to show the vertices of the selected +\n It is possible to show the vertices of the selected shape. For this, choose in the context menu of the shape Display mode -> Show Vertices, or apply this functionality for all objects in the current view via the main menu @@ -40,10 +40,9 @@ functionality for all objects in the current view via the main menu \n TUI Command: gg.setVerticesMode(ID, Bool) -\n Moreover user can show the name of the selected -shape. For this, choose in the context menu of the shape +\n To show the name of the selected shape, choose in its context menu Display mode -> Show Name, or apply this -functionality for all objects in the current view via the main menu +functionality for all objects in the current view via the main menu option View -> Display Mode -> Show/Hide Name. \image html name_mode.png diff --git a/doc/salome/gui/GEOM/input/extension_operation.doc b/doc/salome/gui/GEOM/input/extension_operation.doc index 605ff176f..dd2ad27fa 100644 --- a/doc/salome/gui/GEOM/input/extension_operation.doc +++ b/doc/salome/gui/GEOM/input/extension_operation.doc @@ -1,25 +1,20 @@ /*! -\page extension_operation_page Extension of an Edge or a Face +\page extension_operation_page Extension -\n To produce an \b Extension in the Main Menu select -Operations - > Transformation - > Extension +\n To produce an \b Extension of an Edge or a Face select in the Main Menu +Operations - > Transformation - > Extension. The type of extension is defined using the radio buttons. -\n This operation resizes an \b Edge by means of first - and last parameters modification or a \b Face by means of modification - of minimal and maximal U- and V-Parameters. \n -\ref restore_presentation_parameters_page "Advanced options". +Firstly it is possible to resize an \b Edge by modifying its first +and last parameters -The type of extension is defined using the radio buttons. +\image html extension1.png "Edge Extension" -Firstly it is possible to resize an \b Edge. \n TUI Command: geompy.ExtendEdge(theEdge, theMin, theMax), where \em theEdge the input edge to be resized, \em theMin the minimal parameter value, \em theMax the maximal parameter value. \n Arguments: Name + Object (Edge) + 2 values (Min and Max Parameters). -\image html extension1.png "Extension of an Edge" - \n Example: \image html extend_edge_example.png "Original edge (white) and extended edge" @@ -28,8 +23,12 @@ parameter value, \em theMax the maximal parameter value. negative, the input Edge is extended, otherwise it is shrinked by \b theMin parameter. If \b theMax is greater than 1, the Edge is extended, otherwise it is shrinked by \b theMax parameter. + +Secondly it is possible to resize a \b Face by modifying its +minimal and maximal U- and V-Parameters. -Secondly it is possible to resize a \b Face. + \image html extension2.png "Face Extension" + \n TUI Command: geompy.ExtendFace(theFace, theUMin, theUMax, theVMin, theVMax), where \em theFace the input face to be resized, \em theUMin the minimal U-Parameter value, \em theUMax the maximal U-Parameter @@ -38,18 +37,16 @@ V-Parameter value. \n Arguments: Name + Object (Face) + 4 values (Min and Max U- and V-Parameters). -\image html extension2.png "Extension of a Face" \n Example: -\image html extend_face_example.png "The original face (gray) and a result - face shrinked along U-Direction and extended along V-Direction" +\image html extend_face_example.png "The original face (gray) and a result face shrinked along U-Direction and extended along V-Direction" \note The input Face U- and V-Parameters range is [0, 1]. If \b theUMin parameter is negative, the input Face is extended, otherwise it is - shrinked along U-Direction by \b theUMin parameter. If theUMax is + shrinked along U-Direction by \b theUMin parameter. If \b theUMax is greater than 1, the Face is extended, otherwise it is shrinked along - U-Direction by \b theUMax parameter. So as for \b theVMin, \b theVMax + U-Direction by \b theUMax parameter. The same applies to \b theVMin, \b theVMax and V-Direction of the input Face. Our TUI Scripts provide you with useful examples of the use of diff --git a/doc/salome/gui/GEOM/input/fast_intersection.doc b/doc/salome/gui/GEOM/input/fast_intersection.doc index 4de27fc29..f27a6d944 100644 --- a/doc/salome/gui/GEOM/input/fast_intersection.doc +++ b/doc/salome/gui/GEOM/input/fast_intersection.doc @@ -1,11 +1,11 @@ /*! \page fast_intersection_page Fast intersection -This operation checks whether or not two selected shapes are overlapped. +This operation checks if two selected shapes are overlapped. This tool is useful for fast detection of intersections and gaps. In contrast to Boolean Operations, Partition and Detect Self-intersection -algorithms that compute topological intersections, this algoritm computes +algorithms that compute topological intersections, this algorithm computes intersections by generating tessellation (triangulation) of the source shapes and detecting overlapping of resulting meshes. High performance is achieved through the use of existing triangulation of faces. @@ -28,22 +28,21 @@ of the GUI module's documentation. In this dialog: -- \b Object 1 - first checked object. \b Selection button allows picking it in the viewer or in the object browser. -- \b Object 2 - second checked object. \b Selection button allows picking it in the viewer or in the object browser. +- Object 1 and Object 2 the checked objects. \b Selection button allows picking them in the viewer or in the object browser. - Deflection coefficient specifies the quality of shapes tessellation. - Detect gaps - when switched on, allows detecting gaps between shapes. -- Tolerance - specifies a distance between shapes used for detecting gaps. +- Tolerance - specifies the distance between shapes used for detecting gaps. - Compute intersections - press this button to compute interferences. - Sub-shapes of Object 1 - list of sub-shapes from the first source shape that localize the intersection. - Sub-shapes of Object 2 - list of sub-shapes from the second source shape that localize the intersection. - \b Apply and Apply and Close buttons are used to store selected intersected shapes in the study for further analysis (see below). -\note Quality of the result depends on the quality of triangulation. Changing a value of the deflection coefficient -parameter can strongly affect the result. On the other hand, small values of deflection coefficient might lead to +\note The result quality depends on the quality of triangulation. Changing the value of the deflection coefficient +parameter can strongly affect the result. However, small values of the deflection coefficient might lead to some performance loss of the algorithm, as number of triangles of the tesselation mesh depends on this parameter. -It is possible to store sub-shapes selected by the user in the study, for the further analysis. +Press Apply and Close or \b Apply button to store the selected sub-shapes in the study for further analysis. The selection will be published as a compound containing intersected sub-shapes from both source objects. TUI Command: geompy.FastIntersect(theShape1, theShape2, theTolerance = 0.0, theDeflection = 0.001), \n diff --git a/doc/salome/gui/GEOM/input/glue_edges_operation.doc b/doc/salome/gui/GEOM/input/glue_edges_operation.doc index eb7d2377c..2b5c8a981 100644 --- a/doc/salome/gui/GEOM/input/glue_edges_operation.doc +++ b/doc/salome/gui/GEOM/input/glue_edges_operation.doc @@ -17,7 +17,7 @@ given tolerance value. \n TUI Command:

    geompy.MakeGlueEdges( theShapes, theTolerance ), -\n where \em theShapes is either a list or compound of shapes to be +\n where \em theShapes is a list or compound of shapes to be glued, and \em theTolerance is a maximum distance between two edges, which can be considered as coincident. @@ -41,12 +41,12 @@ The selected edges will be marked in white. theTolerance is a maximum distance between two edges, which can be considered as coincident. The \b Result will be a list of \b GEOM_Objects (edges), containing one sub-shape per each detected set of - coincident sub-shapes. For example if there are two coincident edges -in selected shapes, the result list contains one of the two coincident edges. + coincident sub-shapes. For example, if there are two coincident edges +in the selected shapes, the result list contains one of the two coincident edges. geompy.MakeGlueEdgesByList( theShapes, theTolerance, theEdges ), -\n where \em theShape is either a list or compound of shapes to be glued, \em - theTolerance is a maximum distance between two edges, which can +\n where \em theShape is a list or compound of shapes to be glued, +\em theTolerance is a maximum distance between two edges, which can be considered as coincident, \em theEdges is a list of edges to be glued. diff --git a/doc/salome/gui/GEOM/input/glue_faces_operation.doc b/doc/salome/gui/GEOM/input/glue_faces_operation.doc index 8f020115b..c6a6fa021 100644 --- a/doc/salome/gui/GEOM/input/glue_faces_operation.doc +++ b/doc/salome/gui/GEOM/input/glue_faces_operation.doc @@ -41,12 +41,12 @@ The selected faces will be marked in white. When the faces are glued their edges are glued as well. By default, other edges are not glued. To force gluing of all edges, check Glue all coincident edges -checkbox. +check-box. \n TUI Commands: geompy.GetGlueFaces( theShapes, theTolerance ), -\n where \em theShapes is either a list or compound of shapes to be glued, \em +\n where \em theShapes is a list or compound of shapes to be glued, \em theTolerance is a maximum distance between two faces, which can be considered as coincident. The \b Result will be a list of \b GEOM_Objects (faces), containing one sub-shape per each detected set of diff --git a/doc/salome/gui/GEOM/input/inspect_object_operation.doc b/doc/salome/gui/GEOM/input/inspect_object_operation.doc index 40cc4c027..0650bd47b 100755 --- a/doc/salome/gui/GEOM/input/inspect_object_operation.doc +++ b/doc/salome/gui/GEOM/input/inspect_object_operation.doc @@ -12,11 +12,11 @@ In this dialog: - Click on the "selection" button and select an object to inspect in the Object Browser or in the viewer. - Show/hide sub-shape(s) in the 3D viewer, by pressing “eye” icon in the first column of the tree view. - Show/hide all sub-shapes in the 3D viewer, by pressing “eye” icon in the first column of the tree view header. -- Rename selected sub-shape by double-clicking on the item or pressing key. -- Show selected sub-shape(s) in the 3D viewer by pressing Show Selected button. -- Show selected sub-shape(s) in the 3D viewer and erase all currently shown objects by pressing Show Only Selected button. -- Hide selected sub-shape(s) from the 3D viewer by pressing Hide Selected button. -- Publish selected sub-shapes in the study, by pressing Publish Selected button. +- Rename the selected sub-shape by double-clicking on the item or pressing key. +- Show the selected sub-shape(s) in the 3D viewer by pressing Show Selected button. +- Show the selected sub-shape(s) in the 3D viewer and erase all currently shown objects by pressing Show Only Selected button. +- Hide the selected sub-shape(s) from the 3D viewer by pressing Hide Selected button. +- Publish the selected sub-shapes in the study, by pressing Publish Selected button. - Close dialog box, by pressing Close button. */ diff --git a/doc/salome/gui/GEOM/input/projection_on_cylinder_operation.doc b/doc/salome/gui/GEOM/input/projection_on_cylinder_operation.doc index be0c5aa27..5cc528fb6 100644 --- a/doc/salome/gui/GEOM/input/projection_on_cylinder_operation.doc +++ b/doc/salome/gui/GEOM/input/projection_on_cylinder_operation.doc @@ -14,24 +14,31 @@ To make a projection it is necessary to define: - \b Object to be projected. It can be either a planar wire or a face; - \b Radius of the cylinder; - Starting angle from the cylinder's X axis around Z axis. This is -the angle of the projection starting. -- Length angle in which to project the total length of -the wire. If it is unchecked the projection is not scaled and natural +the angle of the projection start. +- Length angle where the total length of +the wire should be projected. If it is unchecked the projection is not scaled and the natural wire length is kept for the projection. - -\ref restore_presentation_parameters_page "Advanced options". +- Rotation angle the desired angle between the tangent vector to +the first curve at the first point of the theObject's projection in 2D space +and U-direction of cylinder's 2D space. +- \ref restore_presentation_parameters_page "Advanced options". \image html proj_on_cyl_dlg.png +\n The following figure explains meaning of each input angle: + +\image html proj_on_cyl_angles.png "Input angles of projection on the cylinder" + \n Example: \image html proj_on_cyl_preview.png "The curve (in red) and its projection on the cylinder" \n TUI Command: geompy.MakeProjectionOnCylinder(theObject, theRadius, -theStartAngle=0.0, theAngleLength=-1.0), -where \em theObject is a shape which has to be projected, \em theRadius -is a cylinder radius, \em theStartAngle the starting angle of projection in -radians, \em theAngleLength the projection length angle in radians. +theStartAngle=0.0, theAngleLength=-1.0, theAngleRotation=0.0), +where \em theObject is a shape to be projected, \em theRadius +is a cylinder radius, \em theStartAngle is the starting angle of projection in +radians, \em theAngleLength the projection length angle in radians, +\em theAngleRotation projection rotation angle in radians. The \em Result will be a \em GEOM_Object. Our TUI Scripts provide you with useful examples of the use of diff --git a/doc/salome/gui/GEOM/input/sewing_operation.doc b/doc/salome/gui/GEOM/input/sewing_operation.doc index 0008dc80a..9d293dec4 100644 --- a/doc/salome/gui/GEOM/input/sewing_operation.doc +++ b/doc/salome/gui/GEOM/input/sewing_operation.doc @@ -3,18 +3,18 @@ \page sewing_operation_page Sewing \b Sewing operation allows uniting several faces (possibly contained -in a shell, solid or compound) into one shell while geometrically +in a shell, solid or compound) into one shell. Geometrically coincident (within a specified tolerance) edges (or parts of edges) of different faces are replaced by one edge thus producing a shell of faces with shared boundaries.

    This operation is similar to New Entity - > Build - > Shell operation, the difference is that with \b Sewing you can specify the -tolerance and can get a non-manifold result.

    -Possibility to create a non-manifold shell can be used e.g. to create a +tolerance and get a non-manifold result.

    +The possibility to create a non-manifold shell can be used e.g. to create a shell forming several closed domains and then to create several solids with shared boundaries from this shell. -\note Geometrically coincident faces (or part of faces) won't be +\note Geometrically coincident faces (or parts of faces) will not be replaced by one face during \b Sewing. To produce a \b Sewing operation in the Main Menu select Repair - > Sewing. diff --git a/doc/salome/gui/GEOM/input/shape_processing_operation.doc b/doc/salome/gui/GEOM/input/shape_processing_operation.doc index c92d48b8c..643c70638 100644 --- a/doc/salome/gui/GEOM/input/shape_processing_operation.doc +++ b/doc/salome/gui/GEOM/input/shape_processing_operation.doc @@ -56,22 +56,22 @@ merge with neighboring edges.

  17. 3D Tolerance (DropSmallEdges.Tolerance3d) - defines minimum possible distance between two parallel edges.
  18. -
  19. Drop Small Solids (DropSmallSolids) - either removes small +
  20. Drop Small Solids (DropSmallSolids) - removes small solids or merges them with neighboring ones.
  21. If the both tolerances are activated a solid is considered small if -it meets the both criteria. +it meets both criteria.
  22. Split Angle (SplitAngle) - splits faces based on conical surfaces, surfaces of revolution and cylindrical surfaces in segments using a certain angle.
  23. diff --git a/doc/salome/gui/GEOM/input/shape_statistics_operation.doc b/doc/salome/gui/GEOM/input/shape_statistics_operation.doc new file mode 100644 index 000000000..991d103b5 --- /dev/null +++ b/doc/salome/gui/GEOM/input/shape_statistics_operation.doc @@ -0,0 +1,30 @@ +/*! + +\page shape_statistics_operation_page Shape Statistics + +This operation allows plotting a distribution histogram for the numerical parameters and creating the corresponding geometrical groups of the given shape. + +To call Shape Statistics dialog box, in the Main Menu select Inspection - > Shape Statistics. + +\image html shape_statistics.png + +In this dialog: +- "Selected objects" standard selection box allows selecting one or more geometrical objects. + +- "Type" combo-box with the following items: "Edges length", "Faces area", "Solids volume". +\note "Type" combo-box includes only parameters applied to the currently selected shape (e.g. "Solids volume" will not be available for face or shell being selected); multiple selection is processed correspondingly (i.e. only types applicable for all selected shapes will be available). + +- "Number of intervals" spin box is used to specify number of distribution histogram ranges. + +- "Scalar range" checkable group box that, when switched ON, allows specifying custom values range used for plotting and creating groups. +\note By default, "Scalar range" controls is empty; pressing "Compute" button allows automatic computing initial range of the chosen parameter. This is needed as computation of the parameters range can be time-consuming for large or complex models. In case of multiple selection, scalar range is computed as common from all selected shapes. + +- "Plot" button opens or uses an opened Plot2d viewer and plots the distribution histogram for the selected shape(s). + +- "Create groups" button allows creating a groups according to the currently specified parameters. The groups names will include numerical values of the range, e.g. "Edges_length_0-20", "Edges_length_20-40", etc. Empty groups are not created. + +- Close dialog box, by pressing Close button. + +\note This functionality is available only if GUI module is builded with Plot 2D Viewer (set option SALOME_USE_PLOT2DVIEWER to ON when building GUI module). + +*/ diff --git a/doc/salome/gui/GEOM/input/shared_shapes.doc b/doc/salome/gui/GEOM/input/shared_shapes.doc index 802fc45a1..23d94d2f0 100755 --- a/doc/salome/gui/GEOM/input/shared_shapes.doc +++ b/doc/salome/gui/GEOM/input/shared_shapes.doc @@ -15,22 +15,22 @@ Shared Shapes. The following dialog box will appear. In this dialog: - Name is the base name of the resulting shapes. -- Shapes are the shapes to fing shared sub-shapes of. +- Shapes are the shapes whose shared sub-shapes should be found. - Sub-shapes Type is the type of required sub-shapes. - Shared by all option specifies what type of shared sub-shapes should be checked: - - \b On: causes to search sub-shapes from the first input shape shared with all other input shapes; - - \b Off: causes to search sub-shapes shared between couples of input shapes. + - \b On: searches for sub-shapes from the first input shape shared with all other input shapes; + - \b Off: searches for sub-shapes shared between couples of input shapes. \note For the case when "Shared by all" option is switched off - if an input list of shapes -contains single compound, the sub-shapes shared between all possible couples of its top-level shapes -are searched; otherwise, only sub-shapes that are shared between first input shape and all rest input -shapes are searched. +contains a single compound, the sub-shapes shared between all possible couples of its top-level shapes +are searched for; otherwise, only sub-shapes that are shared between the first input shape and +all other input shapes are searched. Advanced options: \ref preview_anchor "Preview" TUI Command: geompy.GetSharedShapesMulti( Shapes, Type ), -
    where \em Shapes is a list or compound of shapes to fing shared sub- -shapes of and \em Type is the type of required sub-shapes. +
    where \em Shapes is a list or compound of shapes, whose shared sub- +shapes should be found and \em Type is the type of required sub-shapes. Our TUI Scripts provide you with useful examples of the use of Get Shared Shapes functionality: diff --git a/doc/salome/gui/GEOM/input/size_models_range.doc b/doc/salome/gui/GEOM/input/size_models_range.doc index 5f77a22e3..c8594abff 100644 --- a/doc/salome/gui/GEOM/input/size_models_range.doc +++ b/doc/salome/gui/GEOM/input/size_models_range.doc @@ -4,37 +4,33 @@ \tableofcontents -This document determines the range of numbers (tolerances, locations -and sizes) that are to be taken into account for any 3D model design -in Salome. Although it is not obligatory to create models within this range, -algorithms can fail or return unexpected result in this case. +In Salome and Open CASCADE Technology (OCCT), which is a modeling core +of Salome %GEOM module, any model has its location in the 3D-space and size. + +This document defines the range of values (tolerances, locations +and sizes) that should be taken into account for any 3D model design. -This document refers mainly to Open CASCADE Technology (OCCT). However it -concerns Salome as well as OCCT is a modeling core of Salome %GEOM module. - -Any model in 3D-space has its location and sizes. The last two things in Salome -and OCCT are represented by the double precision floating point numbers. - -The goal of the document is to define the range of numbers that can be used in -modeling algorithms provided by Salome and Open CASCADE Technology. +It is not obligatory to create models within this range, +however, algorithms can fail or return unexpected results if the +recommendations are not followed. \section sec1 Maximal Size of the Model -The Maximal Size of the model is a number defined as the maximal diameter of +The Maximal Size of the model corresponds to the maximal diameter of enclosed sphere built for the model. In OCCT any model has a location defined -relative the absolute origin. Thus the maximal diameter above should be built +relatively to the absolute origin. Thus the maximal diameter should be built taking into account the model itself and its location. -In Open CASCADE there are two tolerances: Tolerance Confusion (TolC) +In OCCT there are two tolerances: Tolerance Confusion (TolC) and Tolerance Angular (TolA) (see OCCT Precision package for more details). -These values are used for geometric comparisons. They are not used inside -low-level algorithms (intersection for e.g.), where more precise values are +These values are used for geometric comparisons. However, they are not used inside +low-level algorithms (e.g. intersection), where more precise values are used instead. The value TolC guarantees that the error associated with -the computations for given geometric entity is not greater than TolC. +the computations for a given geometric entity is not greater than TolC. -- TolC - precision value when checking coincidence of two points +- TolC - precision value used to check the coincidence of two points [by default 1.e-7]; -- TolA - precision value when checking the equality of two angles +- TolA - precision value used to check the equality of two angles [by default 1.e-12]. For more information on tolerance definition please see @@ -43,8 +39,8 @@ that are due to modeling errors or inaccuracies of tolerance usage please refer to Chapter 9.2.2 of the same document. To provide robust geometric modeling the computations should be consistent, -i.e. the one tolerance value should be used for all computations. To provide -consistent computations the values TolC and TolA should be consistent: +i.e. the one tolerance value should be used for all computations. Thus, the +TolC and TolA values should be consistent:
    Smax = TolC / TolA             (1)
    @@ -56,16 +52,16 @@ In accordance with (1) the Maximal Size for the Model is [by default]: \section sec2 Minimal Size of the Model -The Minimal Size of the Model is defined as maximal diameter of enclosed +The Minimal Size of the Model is defined as the maximal diameter of enclosed sphere built for the smallest BRep entity of the Model. -All models in Open CASCADE Technology are represented using double precision +All models in OCCT are represented using double precision floating point numbers. This representation contains approximately 14-16 significant digits. -From the experience of using it is considered that the least four significant +From the experience, it is considered that the last four significant digits contain rounding-off errors occurring during the computation. So -(taking in account the worst cases), there are ten reliable significant digits +(taking into account the worst cases), there are ten reliable significant digits for double precision floating point numbers. Having the estimation it is possible to compute the value of the Minimal size of the model: @@ -78,7 +74,7 @@ In accordance with (2) for the default value it will be [by default]: \section sec3 Full Range of Sizes The values Smax (2), Smin (4) are theoretical. Taking into -account the practical purposes of improving the reliability the lower limit +account the practical purposes of improving the reliability, the lower limit should be restricted by one order. Thus, the full Range of Sizes of the Models is: diff --git a/doc/salome/gui/GEOM/input/transfer_data.doc b/doc/salome/gui/GEOM/input/transfer_data.doc index b34b34f31..87a64860f 100644 --- a/doc/salome/gui/GEOM/input/transfer_data.doc +++ b/doc/salome/gui/GEOM/input/transfer_data.doc @@ -21,24 +21,23 @@ In this dialog: -To copy data click on \b Apply or Apply and Close button. As the result -it is possible to see how many names and materials are copied as well as -maximum number of names and materials available for copying. This information is -provided on the following message box: +To copy the data click on \b Apply or Apply and Close button. +It is possible to see how many names and materials are copied as well as +the maximum number of names and materials available for copying. This information is +provided in the following message box: \image html transfer_data2.png "Transfer Data Information" diff --git a/doc/salome/gui/GEOM/input/tui_check_self_intersections_fast.doc b/doc/salome/gui/GEOM/input/tui_check_self_intersections_fast.doc new file mode 100644 index 000000000..c8266e331 --- /dev/null +++ b/doc/salome/gui/GEOM/input/tui_check_self_intersections_fast.doc @@ -0,0 +1,6 @@ +/*! + +\page tui_check_self_intersections_fast_page Detect Self-intersections fast +\tui_script{check_self_intersections_fast.py} + +*/ diff --git a/doc/salome/gui/GEOM/input/tui_measurement_tools.doc b/doc/salome/gui/GEOM/input/tui_measurement_tools.doc index 6e83325c3..be111dbb1 100644 --- a/doc/salome/gui/GEOM/input/tui_measurement_tools.doc +++ b/doc/salome/gui/GEOM/input/tui_measurement_tools.doc @@ -19,6 +19,7 @@
  24. \subpage tui_check_compound_of_blocks_page
  25. \subpage tui_get_non_blocks_page
  26. \subpage tui_check_self_intersections_page
  27. +
  28. \subpage tui_check_self_intersections_fast_page
  29. \subpage tui_fast_intersection_page
  30. diff --git a/doc/salome/gui/GEOM/input/tui_test_measures.doc b/doc/salome/gui/GEOM/input/tui_test_measures.doc index b954b7f60..3e147f388 100644 --- a/doc/salome/gui/GEOM/input/tui_test_measures.doc +++ b/doc/salome/gui/GEOM/input/tui_test_measures.doc @@ -17,7 +17,10 @@ \until Detect Self-intersections \anchor swig_CheckSelfIntersections -\until Detect Fast intersection +\until Detect Self-intersections fast + +\anchor swig_CheckSelfIntersectionsFast +\until Fast intersection \anchor swig_FastIntersection \until WhatIs diff --git a/doc/salome/gui/GEOM/input/using_measurement_tools.doc b/doc/salome/gui/GEOM/input/using_measurement_tools.doc index 77a5ee4b3..515a94ce4 100644 --- a/doc/salome/gui/GEOM/input/using_measurement_tools.doc +++ b/doc/salome/gui/GEOM/input/using_measurement_tools.doc @@ -19,6 +19,7 @@
  31. \subpage managing_dimensions_page "Dimensions"
  32. \subpage whatis_page "WhatIs"
  33. \subpage inspect_object_operation_page "Inspect Object"
  34. +
  35. \subpage shape_statistics_operation_page "Shape Statistics"
  36. \n To check their integrity: diff --git a/doc/salome/gui/GEOM/input/whatis.doc b/doc/salome/gui/GEOM/input/whatis.doc index fad70f01c..43dc0f6f7 100644 --- a/doc/salome/gui/GEOM/input/whatis.doc +++ b/doc/salome/gui/GEOM/input/whatis.doc @@ -5,13 +5,13 @@ This operation provides the list of types and quantities of all topological entities, composing the selected geometrical object. -For the \em COMPOUND or \em COMPSOLID shape, additionally the information about -"flat" content is shown - a number of "simple" top-level shapes enclosed into the compound. +The information about \em COMPOUND or \em COMPSOLID shapes additionally shows +"flat" content - the number of "simple" top-level shapes enclosed into the compound. \image html measures8.png \note This dialog supports navigation through the selectable objects (in OCC 3D viewer only): -- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when input focus is +- Scroll mouse wheel with pressed \em Ctrl key or press \em "S", \em "P" keys when the input focus is in the viewer to navigate between selectable objects. - Press left mouse button to select an appropriate object to the dialog box. . diff --git a/doc/salome/gui/GEOM/input/working_with_groups.doc b/doc/salome/gui/GEOM/input/working_with_groups.doc index 36a0d49a3..852047dfb 100644 --- a/doc/salome/gui/GEOM/input/working_with_groups.doc +++ b/doc/salome/gui/GEOM/input/working_with_groups.doc @@ -24,7 +24,7 @@ This functionality is available in OCC viewer only. To create a group of sub-shapes of a geometrical object in the main menu select New entity > Group > Create -\n The following menu will appear: +\n The following dialog box will appear: \image html geomcreategroup.png @@ -81,26 +81,31 @@ creation of other groups), or skip it by clicking \b Close button. \n The Result of the operation will be a \b GEOM_Object. -The \b Filter controls allow to automatically pick up entites which satisfy specified +The \b Filter controls allow to automatically pick up entities, which satisfy specified threshold value(s). The numerical functor for each sub-shape that is compared with threshold value(s) is computed according to the shape's topological properties: -- length for edges and wires -- area for faces and shells -- volume for solids, compounds, compsolids +- length for edges and wires; +- area for faces and shells; +- volume for solids, compounds, compsolids. Filtering capabilities are not available for vertices. In order to filter out some entities: -- Activate one or two filtering controls by switching on corresponding check boxes; -- Select required threshold comparator type; the following choices are available: +- Activate one or two filtering controls by switching on the corresponding check boxes; +- Select the required threshold comparator type; the following choices are available: - Less Than or Equal or Less Than for the first comparator; - Greater Than or Equal or Greater Than for the second comparator; -- Enter required threshold value (values); +- Enter the required threshold value (values); - Press \b Apply button in the \b Filter group. -The entities which satisfy entered filtering parameters will be automatically highlighted +The entities, which satisfy the entered filtering parameters, will be automatically highlighted in the 3D viewer. +\b Plot button into "Filter" group box provides an access +to the \ref shape_statistics_operation_page "Shape Statistics" functionality with simplified look-n-feel: + +\image html shape_statistics_simple.png + \n TUI Command: geompy.CreateGroup(MainShape, ShapeType), where MainShape is a shape for which the group is created, ShapeType is a type of shapes in the created group. diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 87a912edc..98af123bd 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -732,10 +732,13 @@ module GEOM * Create a point, corresponding to the given parameter on the given curve. * \param theRefCurve The referenced curve. * \param theParameter Value of parameter on the referenced curve. + * \param takeOrientationIntoAccount flag that tells if it is necessary + * to take the curve's orientation into account. * \return New GEOM_Object, containing the created point. */ GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve, - in double theParameter); + in double theParameter, + in boolean takeOrientationIntoAccount); /*! * \brief Create a point, corresponding to the given length on the given curve. @@ -1439,13 +1442,17 @@ module GEOM * to project the total length of the wire. If it is negative the * projection is not scaled and natural wire length is kept for * the projection. + * \param theAngleRotation the desired angle between the tangent vector + * to the first curve at the first point of the theObject's + * projection in 2D space and U-direction of cylinder's 2D space. * \return A wire or a face or a compound of faces that represents a * projection of the source shape onto a cylinder. */ GEOM_Object MakeProjectionOnCylinder (in GEOM_Object theObject, in double theRadius, in double theStartAngle, - in double theAngleLength); + in double theAngleLength, + in double theAngleRotation); }; /*! @@ -1801,9 +1808,13 @@ module GEOM * should be equal to number of bases or list of locations can be empty. * \param thePath - Path shape to extrude the base shape along it. * \param theWithContact - the mode defining that the section is translated to be in - * contact with the spine. + * contact with the spine. Ignored if IsBySteps is set. * \param theWithCorrection - defining that the section is rotated to be - * orthogonal to the spine tangent in the correspondent point + * orthogonal to the spine tangent in + * the correspondent point. Ignored if IsBySteps is set. + * \param IsBySteps - flag that tells if the result should be created + * step by step or as a whole. If IsBySteps is set no correction + * of bases is allowed. * \param IsGenerateGroups flag that tells if it is necessary to * return groups (true) or not (false). * \return The list of objects. The first one is a result pipe, @@ -1816,6 +1827,7 @@ module GEOM in GEOM_Object thePath, in boolean theWithContact , in boolean theWithCorrection, + in boolean IsBySteps, in boolean IsGenerateGroups); /*! @@ -4204,6 +4216,7 @@ module GEOM // VERTEX VERTEX, // ADVANCED shapes + LCS, /*! all advanced shapes (temporary implementation) */ ADVANCED }; @@ -4448,6 +4461,21 @@ module GEOM in long theCheckLevel, out ListOfLong theIntersections); + /*! + * \brief Detect self-intersections of the given shape with algorithm based on mesh intersections. + * \param theShape Shape to check validity of. + * \param theDeflection Linear deflection coefficient that specifies quality of tesselation. + * \param theTolerance Specifies a distance between sub-shapes used for detecting gaps: + * - if \a theTolerance <= 0, algorithm detects intersections + * - if \a theTolerance > 0, algorithm detects gaps + * \param theIntersections Output. List of intersected sub-shapes IDs, it contains pairs of IDs. + * \return TRUE, if the shape does not have any self-intersections. + */ + boolean CheckSelfIntersectionsFast (in GEOM_Object theShape, + in float theDeflection, + in double theTolerance, + out ListOfLong theIntersections); + /*! * \brief Detect intersections of the given shapes with algorithm based on mesh intersections. * \param theShape1 First source object diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index cef2c42f2..3d47d93ed 100755 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -35,6 +35,7 @@ SET( _res_files GEOM.config GEOMDS_Resources ShHealing + Y14.5M-2009.ttf 3dsketch.png isoline.png isoline_v.png @@ -113,6 +114,7 @@ SET( _res_files fuse_collinear_edges.png geometry.png import_picture.png + import.png limit_tolerance.png line.png line2points.png diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in index 84f53783c..8e83fdbc2 100644 --- a/resources/SalomeApp.xml.in +++ b/resources/SalomeApp.xml.in @@ -92,12 +92,13 @@ - + - + + diff --git a/resources/Y14.5M-2009.ttf b/resources/Y14.5M-2009.ttf new file mode 100644 index 000000000..1f1ca199a Binary files /dev/null and b/resources/Y14.5M-2009.ttf differ diff --git a/resources/import.png b/resources/import.png new file mode 100644 index 000000000..71690c912 Binary files /dev/null and b/resources/import.png differ diff --git a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx index 4da6ad710..39197f059 100644 --- a/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_DividedDiskDlg.cxx @@ -335,11 +335,11 @@ void AdvancedGUI_DividedDiskDlg::SetEditCurrentArgument() disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); if (myEditCurrentArgument == GroupPntVecR->LineEdit2) { globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } else { globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); diff --git a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx index 5999c6471..f00d74043 100644 --- a/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_PipeTShapeDlg.cxx @@ -642,7 +642,7 @@ void AdvancedGUI_PipeTShapeDlg::SetEditCurrentArgument() disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); //globalSelection(GEOM_POINT); globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } diff --git a/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx index e51ad791b..412fa23c6 100644 --- a/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx +++ b/src/AdvancedGUI/AdvancedGUI_SmoothingSurfaceDlg.cxx @@ -120,7 +120,7 @@ void AdvancedGUI_SmoothingSurfaceDlg::Init() showOnlyPreviewControl(); globalSelection(); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); //@@ initialize dialog box widgets here @@// // Signal/slot connections @@ -163,7 +163,7 @@ bool AdvancedGUI_SmoothingSurfaceDlg::ClickOnApply() initName(); globalSelection(); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); return true; } @@ -175,7 +175,7 @@ void AdvancedGUI_SmoothingSurfaceDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection(); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); //displayPreview(); } @@ -363,6 +363,6 @@ void AdvancedGUI_SmoothingSurfaceDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupPoints->LineEdit1; myEditCurrentArgument->setFocus(); globalSelection(); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); SelectionIntoArgument(); } diff --git a/src/BREPPlugin/BREPPlugin_GUI.cxx b/src/BREPPlugin/BREPPlugin_GUI.cxx index 9da10a0d1..312919727 100644 --- a/src/BREPPlugin/BREPPlugin_GUI.cxx +++ b/src/BREPPlugin/BREPPlugin_GUI.cxx @@ -36,10 +36,13 @@ #include "GEOM_Operation.h" #include "GEOMBase.h" #include "GEOM_Displayer.h" +#include "GEOM_GenericObjPtr.h" #include #include CORBA_SERVER_HEADER(BREPPlugin) +typedef GEOM::GenericObjPtr BREPOpPtr; + //======================================================================= // function : BREPPlugin_GUI() // purpose : Constructor @@ -111,8 +114,8 @@ bool BREPPlugin_GUI::importBREP( SUIT_Desktop* parent ) SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() ); GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "BREPPluginEngine" ); - GEOM::IBREPOperations_var brepOp = GEOM::IBREPOperations::_narrow( op ); - if ( CORBA::is_nil( brepOp ) ) return false; + BREPOpPtr brepOp = GEOM::IBREPOperations::_narrow( op ); + if ( brepOp.isNull() ) return false; QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""), tr( "BREP_FILES" ), @@ -126,7 +129,7 @@ bool BREPPlugin_GUI::importBREP( SUIT_Desktop* parent ) foreach( QString fileName, fileNames ) { SUIT_OverrideCursor wc; - GEOM_Operation transaction( app, brepOp.in() ); + GEOM_Operation transaction( app, brepOp.get() ); try { @@ -145,6 +148,7 @@ bool BREPPlugin_GUI::importBREP( SUIT_Desktop* parent ) entryList.append( so->GetID() ); transaction.commit(); GEOM_Displayer( study ).Display( main.in() ); + main->UnRegister(); } else { @@ -183,8 +187,8 @@ bool BREPPlugin_GUI::exportBREP( SUIT_Desktop* parent ) SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() ); GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "BREPPluginEngine" ); - GEOM::IBREPOperations_var brepOp = GEOM::IBREPOperations::_narrow( op ); - if ( CORBA::is_nil( brepOp ) ) return false; + BREPOpPtr brepOp = GEOM::IBREPOperations::_narrow( op ); + if ( brepOp.isNull() ) return false; LightApp_SelectionMgr* sm = app->selectionMgr(); if ( !sm ) return false; @@ -212,7 +216,7 @@ bool BREPPlugin_GUI::exportBREP( SUIT_Desktop* parent ) SUIT_OverrideCursor wc; - GEOM_Operation transaction( app, brepOp.in() ); + GEOM_Operation transaction( app, brepOp.get() ); try { diff --git a/src/BasicGUI/BasicGUI_ArcDlg.cxx b/src/BasicGUI/BasicGUI_ArcDlg.cxx index 37e50ea4b..43cb1f493 100644 --- a/src/BasicGUI/BasicGUI_ArcDlg.cxx +++ b/src/BasicGUI/BasicGUI_ArcDlg.cxx @@ -330,7 +330,7 @@ void BasicGUI_ArcDlg::SelectionIntoArgument() void BasicGUI_ArcDlg::SetEditCurrentArgument() { globalSelection(); // close local selection to clear it - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); QPushButton* send = (QPushButton*)sender(); switch ( getConstructorId() ) { @@ -580,7 +580,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId ) } globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes + localSelection( TopAbs_VERTEX ); //Select Vertex on All Shapes qApp->processEvents(); updateGeometry(); diff --git a/src/BasicGUI/BasicGUI_CircleDlg.cxx b/src/BasicGUI/BasicGUI_CircleDlg.cxx index 21515ed32..55dabb285 100644 --- a/src/BasicGUI/BasicGUI_CircleDlg.cxx +++ b/src/BasicGUI/BasicGUI_CircleDlg.cxx @@ -283,7 +283,7 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId ) myEditCurrentArgument->setFocus(); globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); @@ -471,7 +471,7 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument() TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) ? TopAbs_EDGE : TopAbs_VERTEX; globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); + localSelection( aNeedType ); myEditCurrentArgument->setFocus(); // SelectionIntoArgument(); diff --git a/src/BasicGUI/BasicGUI_CurveDlg.cxx b/src/BasicGUI/BasicGUI_CurveDlg.cxx index 110c80c7f..0b4d9030e 100644 --- a/src/BasicGUI/BasicGUI_CurveDlg.cxx +++ b/src/BasicGUI/BasicGUI_CurveDlg.cxx @@ -280,15 +280,15 @@ void BasicGUI_CurveDlg::SetEditCurrentArgument() if (sender() == myGroupPoints->PushButton1) { myEditCurrentArgument = myGroupPoints->LineEdit1; - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } else if (sender() == myPushBtnV1) { myEditCurrentArgument = myLineEditV1; - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } else if (sender() == myPushBtnV2) { myEditCurrentArgument = myLineEditV2; - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } myEditCurrentArgument->setFocus(); diff --git a/src/BasicGUI/BasicGUI_EllipseDlg.cxx b/src/BasicGUI/BasicGUI_EllipseDlg.cxx index f1e74179f..53ac9b491 100644 --- a/src/BasicGUI/BasicGUI_EllipseDlg.cxx +++ b/src/BasicGUI/BasicGUI_EllipseDlg.cxx @@ -155,7 +155,7 @@ void BasicGUI_EllipseDlg::Init() initName( tr( "GEOM_ELLIPSE" ) ); globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); resize( minimumSizeHint() ); SelectionIntoArgument(); @@ -212,7 +212,7 @@ bool BasicGUI_EllipseDlg::ClickOnApply() myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); displayPreview(true); return true; @@ -303,7 +303,7 @@ void BasicGUI_EllipseDlg::SetEditCurrentArgument() myEditCurrentArgument == GroupPoints->LineEdit3 ) ? TopAbs_EDGE : TopAbs_VERTEX; globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); + localSelection( aNeedType ); myEditCurrentArgument->setFocus(); //SelectionIntoArgument(); @@ -333,7 +333,7 @@ void BasicGUI_EllipseDlg::ActivateThisDialog() myDir.nullify(); //globalSelection( GEOM_POINT ); globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); } //================================================================================= diff --git a/src/BasicGUI/BasicGUI_LineDlg.cxx b/src/BasicGUI/BasicGUI_LineDlg.cxx index 56a4fe041..6ac2df336 100644 --- a/src/BasicGUI/BasicGUI_LineDlg.cxx +++ b/src/BasicGUI/BasicGUI_LineDlg.cxx @@ -220,7 +220,7 @@ void BasicGUI_LineDlg::ConstructorsClicked( int constructorId ) myEditCurrentArgument == GroupFaces->LineEdit2 ) ? TopAbs_FACE : TopAbs_VERTEX; globalSelection(); // close local selection to clear it - localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); + localSelection( aNeedType ); qApp->processEvents(); updateGeometry(); @@ -318,7 +318,7 @@ void BasicGUI_LineDlg::SetEditCurrentArgument() myEditCurrentArgument == GroupFaces->LineEdit2 ) ? TopAbs_FACE : TopAbs_VERTEX; globalSelection(); // close local selection to clear it - localSelection( GEOM::GEOM_Object::_nil(), aNeedType ); + localSelection( aNeedType ); myEditCurrentArgument->setFocus(); // SelectionIntoArgument(); diff --git a/src/BasicGUI/BasicGUI_MarkerDlg.cxx b/src/BasicGUI/BasicGUI_MarkerDlg.cxx index 8cb1dd447..7b2a7106c 100644 --- a/src/BasicGUI/BasicGUI_MarkerDlg.cxx +++ b/src/BasicGUI/BasicGUI_MarkerDlg.cxx @@ -228,7 +228,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) { if ( myConstructorId == constructorId && myConstructorId == 0 ) { globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); activate( GEOM_MARKER ); return; } @@ -244,7 +244,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) Group2->hide(); aMainGrp->show(); globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); activate( GEOM_MARKER ); break; } @@ -269,7 +269,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId ) Group2->PushButton2->setDown( false ); Group2->PushButton3->setDown( false ); globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); myEditCurrentArgument = Group2->LineEdit1; Group2->LineEdit1->setText( "" ); Group2->LineEdit2->setText( "" ); @@ -442,7 +442,7 @@ void BasicGUI_MarkerDlg::SetEditCurrentArgument() } else if ( send == Group2->PushButton1 ) { myEditCurrentArgument = Group2->LineEdit1; - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); Group2->PushButton2->setDown( false ); Group2->PushButton3->setDown( false ); Group2->LineEdit1->setEnabled( true ); @@ -451,7 +451,7 @@ void BasicGUI_MarkerDlg::SetEditCurrentArgument() } else if ( send == Group2->PushButton2 ) { myEditCurrentArgument = Group2->LineEdit2; - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); Group2->PushButton1->setDown( false ); Group2->PushButton3->setDown( false ); Group2->LineEdit1->setEnabled( false ); @@ -460,7 +460,7 @@ void BasicGUI_MarkerDlg::SetEditCurrentArgument() } else if ( send == Group2->PushButton3 ) { myEditCurrentArgument = Group2->LineEdit3; - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); Group2->PushButton1->setDown( false ); Group2->PushButton2->setDown( false ); Group2->LineEdit1->setEnabled( false ); diff --git a/src/BasicGUI/BasicGUI_PlaneDlg.cxx b/src/BasicGUI/BasicGUI_PlaneDlg.cxx index 707a45604..053fa5089 100644 --- a/src/BasicGUI/BasicGUI_PlaneDlg.cxx +++ b/src/BasicGUI/BasicGUI_PlaneDlg.cxx @@ -291,7 +291,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) /* for the first argument */ globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); break; } case 1: /* plane from 3 points */ @@ -315,7 +315,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) /* for the first argument */ globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); break; } case 2: /* plane from a planar face */ @@ -331,7 +331,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) GroupFace->PushButton1->setDown( true ); globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + localSelection( TopAbs_FACE ); break; } case 3: /* plane from a 2 Vectors */ @@ -347,7 +347,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId ) Group2Vec->PushButton1->setDown( true ); globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); break; } case 4: /* plane from a LCS */ @@ -575,7 +575,7 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument() if ( myEditCurrentArgument == GroupPntDir->LineEdit2 || myEditCurrentArgument == Group2Vec->LineEdit1 || myEditCurrentArgument == Group2Vec->LineEdit2 ) { - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); } else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) { TColStd_MapOfInteger aMap; aMap.Add( GEOM_PLANE ); @@ -585,7 +585,7 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument() globalSelection( GEOM_MARKER ); } else { // 3 Pnts - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); } // SelectionIntoArgument(); diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index 983666d28..96a989a88 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -125,13 +125,17 @@ BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* paren GroupXYZ->TextLabel2->setText(tr("GEOM_Y")); GroupXYZ->TextLabel3->setText(tr("GEOM_Z")); - GroupOnCurve = new DlgRef_2Sel1Spin(centralWidget()); + GroupOnCurve = new DlgRef_2Sel1Spin2Check(centralWidget()); GroupOnCurve->GroupBox1->setTitle(tr("GEOM_POINT_ON_EDGE")); GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE")); GroupOnCurve->TextLabel2->setText(tr("GEOM_START_POINT")); GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER")); GroupOnCurve->PushButton1->setIcon(image2); GroupOnCurve->PushButton2->setIcon(image2); + GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER")); + GroupOnCurve->CheckButton1->setText(tr("GEOM_TAKE_ORIENTATION_INTO_ACCOUNT")); + GroupOnCurve->CheckButton2->setAttribute( Qt::WA_DeleteOnClose ); + GroupOnCurve->CheckButton2->close(); GroupOnSurface = new DlgRef_1Sel2Spin(centralWidget()); GroupOnSurface->GroupBox1->setTitle(tr("GEOM_POINT_ON_FACE")); @@ -258,6 +262,7 @@ void BasicGUI_PointDlg::Init() initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision"); GroupOnCurve->SpinBox_DX->setValue(0.5); + GroupOnCurve->CheckButton1->setChecked(true); initSpinBox(GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision"); GroupOnSurface->SpinBox_DX->setValue(0.5); @@ -275,6 +280,8 @@ void BasicGUI_PointDlg::Init() connect(myParamCoord, SIGNAL(buttonClicked(int)), this, SLOT(ClickParamCoord(int))); + connect(GroupOnCurve->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CheckBoxClicked())); + connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupOnCurve->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupOnSurface->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); @@ -328,7 +335,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) { globalSelection(); // close local contexts, if any myNeedType = TopAbs_VERTEX; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(myNeedType); GroupRefPoint->hide(); GroupOnCurve->hide(); @@ -343,7 +350,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) { globalSelection(); // close local contexts, if any myNeedType = TopAbs_VERTEX; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(myNeedType); myEditCurrentArgument = GroupRefPoint->LineEdit1; myEditCurrentArgument->setText(""); @@ -362,7 +369,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) { globalSelection(); // close local contexts, if any myNeedType = TopAbs_EDGE; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(myNeedType); myEditCurrentArgument = GroupOnCurve->LineEdit1; myEditCurrentArgument->setText(""); @@ -385,7 +392,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) globalSelection(); // close local contexts, if any std::list needTypes; needTypes.push_back( TopAbs_EDGE ), needTypes.push_back( TopAbs_WIRE ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + localSelection(needTypes ); myEditCurrentArgument = GroupLineIntersection->LineEdit1; GroupLineIntersection->LineEdit1->setText(""); @@ -409,7 +416,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId) { globalSelection(); // close local contexts, if any myNeedType = TopAbs_FACE; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(myNeedType); myEditCurrentArgument = GroupOnSurface->LineEdit1; myEditCurrentArgument->setText(""); @@ -568,14 +575,14 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() GroupRefPoint->LineEdit1->setFocus(); myEditCurrentArgument = GroupRefPoint->LineEdit1; globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } else if (send == GroupOnCurve->PushButton1) { GroupOnCurve->LineEdit1->setFocus(); myEditCurrentArgument = GroupOnCurve->LineEdit1; globalSelection(); // close local contexts, if any myNeedType = TopAbs_EDGE; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(myNeedType); GroupOnCurve->PushButton2->setDown(false); GroupOnCurve->LineEdit1->setEnabled(true); GroupOnCurve->LineEdit2->setEnabled(false); @@ -585,7 +592,7 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupOnCurve->LineEdit2; globalSelection(); // close local contexts, if any myNeedType = TopAbs_VERTEX; - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection(myNeedType); GroupOnCurve->PushButton1->setDown(false); GroupOnCurve->LineEdit2->setEnabled(true); GroupOnCurve->LineEdit1->setEnabled(false); @@ -595,7 +602,7 @@ void BasicGUI_PointDlg::SetEditCurrentArgument() GroupOnSurface->LineEdit1->setFocus(); myEditCurrentArgument = GroupOnSurface->LineEdit1; globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); + localSelection(TopAbs_FACE); } else if (send == GroupLineIntersection->PushButton1) { GroupLineIntersection->LineEdit1->setFocus(); @@ -669,7 +676,7 @@ void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue) // function : CheckBoxClicked() // purpose : Check Boxes Management //================================================================================= -void BasicGUI_PointDlg::CheckBoxClicked(int State) +void BasicGUI_PointDlg::CheckBoxClicked() { displayPreview(true); } @@ -821,7 +828,9 @@ bool BasicGUI_PointDlg::execute(ObjectList& objects) case GEOM_POINT_EDGE : { if (myParamCoord->checkedId() == PARAM_VALUE) { - anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter()); + bool isUseOrientation = GroupOnCurve->CheckButton1->isChecked(); + + anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter(), isUseOrientation); aParameters<SpinBox_DX->text(); } else if (myParamCoord->checkedId() == LENGTH_VALUE) { @@ -973,6 +982,7 @@ void BasicGUI_PointDlg::updateParamCoord(bool theIsUpdate) GroupOnCurve->LineEdit2->setVisible(isLength); GroupOnCurve->TextLabel3->setVisible(isParam || isLength); GroupOnCurve->SpinBox_DX->setVisible(isParam || isLength); + GroupOnCurve->CheckButton1->setVisible(isParam); if (isParam){ initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision"); GroupOnCurve->SpinBox_DX->setValue(0.5); diff --git a/src/BasicGUI/BasicGUI_PointDlg.h b/src/BasicGUI/BasicGUI_PointDlg.h index 7002333db..ffc01a165 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.h +++ b/src/BasicGUI/BasicGUI_PointDlg.h @@ -31,7 +31,7 @@ #include "GEOM_GenericObjPtr.h" #include -class DlgRef_2Sel1Spin; +class DlgRef_2Sel1Spin2Check; class DlgRef_3Spin; class DlgRef_2Sel; class DlgRef_1Sel3Spin; @@ -88,7 +88,7 @@ private: DlgRef_3Spin* GroupXYZ; DlgRef_1Sel3Spin* GroupRefPoint; - DlgRef_2Sel1Spin* GroupOnCurve; + DlgRef_2Sel1Spin2Check* GroupOnCurve; DlgRef_2Sel* GroupLineIntersection; DlgRef_1Sel2Spin* GroupOnSurface; @@ -115,7 +115,7 @@ private slots: void ValueChangedInSpinBox( double ); void SetDoubleSpinBoxStep( double ); void ClickParamCoord( int ); - void CheckBoxClicked( int ); + void CheckBoxClicked(); void updateSize(); }; diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 8b915423b..d2648f9cf 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -204,7 +204,7 @@ void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId ) GroupPoints->LineEdit2->setEnabled( false ); globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); break; @@ -325,7 +325,7 @@ void BasicGUI_VectorDlg::SetEditCurrentArgument() myEditCurrentArgument->setFocus(); // SelectionIntoArgument(); globalSelection(); // close local selection to clear it - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); send->setDown(true); displayPreview(true); } diff --git a/src/BlockFix/BlockFix_UnionEdges.cxx b/src/BlockFix/BlockFix_UnionEdges.cxx index 4647d9e55..62a0307c5 100644 --- a/src/BlockFix/BlockFix_UnionEdges.cxx +++ b/src/BlockFix/BlockFix_UnionEdges.cxx @@ -88,6 +88,37 @@ #include "utilities.h" +//======================================================================= +//function : IsToMerge +//purpose : This method return Standard_True if two edges have common +// vertex. This vertex is returned by output parameter. The +// difference with the method TopExp::CommonVertex is only in +// the case if there are two common vertices. In this case +// this method returns the last vertex of theEdge1, not the first +// one that TopExp::CommonVertex does. +//======================================================================= +static Standard_Boolean GetCommonVertex(const TopoDS_Edge &theEdge1, + const TopoDS_Edge &theEdge2, + TopoDS_Vertex &theCommon) +{ + Standard_Boolean isFound = Standard_True; + ShapeAnalysis_Edge aSae; + TopoDS_Vertex aVF1 = aSae.FirstVertex(theEdge1); + TopoDS_Vertex aVL1 = aSae.LastVertex(theEdge1); + TopoDS_Vertex aVF2 = aSae.FirstVertex(theEdge2); + TopoDS_Vertex aVL2 = aSae.LastVertex(theEdge2); + + if (aVL1.IsSame(aVF2) || aVL1.IsSame(aVL2)) { + theCommon = aVL1; + } else if (aVF1.IsSame(aVL2) || aVF1.IsSame(aVF2)) { + theCommon = aVF1; + } else { + theCommon.Nullify(); + isFound = Standard_False; + } + + return isFound; +} //======================================================================= //function : IsToMerge @@ -148,7 +179,7 @@ static Standard_Boolean IsToMerge // that are connected to the common vertex. TopoDS_Vertex aVCommon; - if (TopExp::CommonVertex(theEdge1, theEdge2, aVCommon)) { + if (GetCommonVertex(theEdge1, theEdge2, aVCommon)) { TopTools_IndexedDataMapOfShapeListOfShape aMapVE; TopExp::MapShapesAndAncestors @@ -328,7 +359,7 @@ static TopoDS_Edge GlueEdgesWithPCurves(const TopTools_SequenceOfShape& aChain, if (i > 1) { - TopExp::CommonVertex(PrevEdge, anEdge, CV); + GetCommonVertex(PrevEdge, anEdge, CV); Standard_Real Tol = BRep_Tool::Tolerance(CV); tabtolvertex(i-2) = Tol; } diff --git a/src/BlockFix/BlockFix_UnionFaces.cxx b/src/BlockFix/BlockFix_UnionFaces.cxx index c1b56f260..c1788bbb1 100644 --- a/src/BlockFix/BlockFix_UnionFaces.cxx +++ b/src/BlockFix/BlockFix_UnionFaces.cxx @@ -138,8 +138,9 @@ static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges, { //map of edges TopTools_MapOfShape aNewEdges; + TopExp_Explorer exp(aShape,TopAbs_EDGE); //add edges without seams - for(TopExp_Explorer exp(aShape,TopAbs_EDGE); exp.More(); exp.Next()) { + for(; exp.More(); exp.Next()) { TopoDS_Shape edge = exp.Current(); if(aNewEdges.Contains(edge)) aNewEdges.Remove(edge); @@ -164,9 +165,14 @@ static Standard_Boolean AddOrdinaryEdges(TopTools_SequenceOfShape& edges, } } - //add edges to the sequemce - for(TopTools_MapIteratorOfMapOfShape anIter(aNewEdges); anIter.More(); anIter.Next()) - edges.Append(anIter.Key()); + //add edges to the sequence + for(exp.ReInit(); exp.More(); exp.Next()) { + const TopoDS_Shape &anEdge = exp.Current(); + + if (aNewEdges.Contains(anEdge)) { + edges.Append(anEdge); + } + } return isDropped; } diff --git a/src/BlocksGUI/BlocksGUI_BlockDlg.cxx b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx index c4b986271..657d1ac39 100644 --- a/src/BlocksGUI/BlocksGUI_BlockDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_BlockDlg.cxx @@ -387,7 +387,7 @@ void BlocksGUI_BlockDlg::SetEditCurrentArgument() aSender->setDown(true); globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); //Select Faces on All Shapes + localSelection(TopAbs_FACE); //Select Faces on All Shapes connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } @@ -400,7 +400,7 @@ void BlocksGUI_BlockDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); //Select Faces on All Shapes + localSelection(TopAbs_FACE); //Select Faces on All Shapes connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); displayPreview(true); diff --git a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx index 1f1fcda89..63352c47b 100644 --- a/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_ExplodeDlg.cxx @@ -46,7 +46,7 @@ // purpose : Constructs a BlocksGUI_ExplodeDlg which is a child of 'parent'. //================================================================================= BlocksGUI_ExplodeDlg::BlocksGUI_ExplodeDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) - : GEOMBase_Skeleton( theGeometryGUI, parent ) + : GEOMBase_Skeleton( theGeometryGUI, parent ), myNbBlocks( 0 ) { QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BLOCK_EXPLODE" ) ) ); QPixmap imageS( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); @@ -189,7 +189,7 @@ bool BlocksGUI_ExplodeDlg::ClickOnApply() } } - if ( !onAccept() ) + if ( !onAccept( true, true, false ) ) return false; activateSelection(); @@ -351,7 +351,7 @@ void BlocksGUI_ExplodeDlg::updateButtonState() //================================================================================= bool BlocksGUI_ExplodeDlg::isAllSubShapes() const { - return !myGrp1->CheckBox1->isChecked() || !myGrp1->CheckBox1->isEnabled(); + return !(myGrp1->CheckBox1->isEnabled() && myGrp1->CheckBox1->isChecked()); } //================================================================================= diff --git a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx index b004d5c87..39c42e5ba 100644 --- a/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx @@ -466,11 +466,11 @@ void BlocksGUI_QuadFaceDlg::activateSelection() myEditCurrentArgument == mySelName[Vertex3] || myEditCurrentArgument == mySelName[Vertex4]) { - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertices on All Shapes + localSelection(TopAbs_VERTEX); //Select Vertices on All Shapes } else { - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); //Select Edges on All Shapes + localSelection(TopAbs_EDGE); //Select Edges on All Shapes } connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); diff --git a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx index b441b58a8..985bfc97e 100644 --- a/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx +++ b/src/BlocksGUI/BlocksGUI_TrsfDlg.cxx @@ -219,7 +219,6 @@ bool BlocksGUI_TrsfDlg::ClickOnApply() //================================================================================= void BlocksGUI_TrsfDlg::SelectionIntoArgument() { - erasePreview(); myEditCurrentArgument->setText(""); // Get index of current selection focus @@ -273,7 +272,6 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument() } myEditCurrentArgument->setText(aName); myFaces[aCurrFocus] = anIndex; - processPreview(); } switch (aCurrFocus) { @@ -316,6 +314,8 @@ void BlocksGUI_TrsfDlg::SelectionIntoArgument() default: break; } + + processPreview(); } //================================================================================= @@ -379,6 +379,8 @@ void BlocksGUI_TrsfDlg::SetEditCurrentArgument() aSender->setDown(true); activateSelection(); + + processPreview(); } //================================================================================= diff --git a/src/BooleanGUI/BooleanGUI_Dialog.cxx b/src/BooleanGUI/BooleanGUI_Dialog.cxx index 115394514..02ebd41d5 100644 --- a/src/BooleanGUI/BooleanGUI_Dialog.cxx +++ b/src/BooleanGUI/BooleanGUI_Dialog.cxx @@ -198,10 +198,7 @@ void BooleanGUI_Dialog::Init() mainFrame()->RadioButton1->setFocus(); globalSelection(GEOM_ALLSHAPES); - - std::list needTypes; - needTypes.push_back( TopAbs_VERTEX ), needTypes.push_back( TopAbs_EDGE ), needTypes.push_back( TopAbs_WIRE ), needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ), needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPOUND ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + //localSelection(TopAbs_SHAPE); // VSR 24/09/2015: dectivate local selection in BOP (CoTech decision) myGroup->PushButton1->click(); resize(100,100); @@ -341,10 +338,7 @@ void BooleanGUI_Dialog::SetEditCurrentArgument() } globalSelection(GEOM_ALLSHAPES); - - std::list needTypes; - needTypes.push_back( TopAbs_VERTEX ), needTypes.push_back( TopAbs_EDGE ), needTypes.push_back( TopAbs_WIRE ), needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ), needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPOUND ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + //localSelection(TopAbs_SHAPE); // VSR 24/09/2015: dectivate local selection in BOP (CoTech decision) // enable line edit myEditCurrentArgument->setEnabled(true); diff --git a/src/BuildGUI/BuildGUI_EdgeDlg.cxx b/src/BuildGUI/BuildGUI_EdgeDlg.cxx index b96feeeae..c34e448e5 100644 --- a/src/BuildGUI/BuildGUI_EdgeDlg.cxx +++ b/src/BuildGUI/BuildGUI_EdgeDlg.cxx @@ -145,7 +145,7 @@ void BuildGUI_EdgeDlg::Init() myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->PushButton1->setDown(true); globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); // signals and slots connections connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); @@ -210,7 +210,7 @@ void BuildGUI_EdgeDlg::ConstructorsClicked(int constructorId) case 0: { globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); myEditCurrentArgument = GroupPoints->LineEdit1; GroupPoints->LineEdit1->setText(""); @@ -229,7 +229,7 @@ void BuildGUI_EdgeDlg::ConstructorsClicked(int constructorId) case 1: { globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_WIRE); + localSelection(TopAbs_WIRE); myEditCurrentArgument = GroupWire->LineEdit1; GroupWire->LineEdit1->setText(""); @@ -244,7 +244,7 @@ void BuildGUI_EdgeDlg::ConstructorsClicked(int constructorId) case 2: { globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); myEditCurrentArgument = GroupOnCurve->LineEdit1; GroupOnCurve->LineEdit1->setText(""); @@ -302,7 +302,7 @@ void BuildGUI_EdgeDlg::SelectionIntoArgument() myEditCurrentArgument->setText(aName); globalSelection(); - localSelection(GEOM::GEOM_Object::_nil(), aNeedType); + localSelection(aNeedType); if (myEditCurrentArgument == GroupPoints->LineEdit1) { myPoint1 = aSelectedObject; @@ -359,7 +359,7 @@ void BuildGUI_EdgeDlg::SetEditCurrentArgument() GroupOnCurve->LineEdit2->setEnabled(false); globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } else if (send == GroupOnCurve->PushButton2) { myEditCurrentArgument = GroupOnCurve->LineEdit2; @@ -367,7 +367,7 @@ void BuildGUI_EdgeDlg::SetEditCurrentArgument() GroupOnCurve->LineEdit1->setEnabled(false); globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } // enable line edit diff --git a/src/BuildGUI/BuildGUI_FaceDlg.cxx b/src/BuildGUI/BuildGUI_FaceDlg.cxx index 1f42c752a..d474817f1 100644 --- a/src/BuildGUI/BuildGUI_FaceDlg.cxx +++ b/src/BuildGUI/BuildGUI_FaceDlg.cxx @@ -263,7 +263,7 @@ void BuildGUI_FaceDlg::ConstructorsClicked(int constructorId) case 1: { globalSelection(GEOM_FACE); // For the first element. - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + localSelection( TopAbs_FACE ); myEditCurrentArgument = myGroupSurf->LineEdit1; myGroupSurf->LineEdit1->setText(""); @@ -277,7 +277,7 @@ void BuildGUI_FaceDlg::ConstructorsClicked(int constructorId) case 2: { globalSelection(); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_WIRE ); + localSelection( TopAbs_WIRE ); myTreeConstraints->clear(); myCurrentItem = 0; @@ -323,7 +323,7 @@ void BuildGUI_FaceDlg::updateConstraintsTree() myEditCurrentArgument->setEnabled(false); globalSelection(); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + localSelection( TopAbs_FACE ); myTreeConstraints->resizeColumnToContents(0); QTreeWidgetItem* firstItem = myTreeConstraints->topLevelItem(0); @@ -509,21 +509,21 @@ void BuildGUI_FaceDlg::SetEditCurrentArgument() } else if (send == myGroupSurf->PushButton1) { globalSelection(GEOM_FACE); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + localSelection( TopAbs_FACE ); myEditCurrentArgument = myGroupSurf->LineEdit1; myGroupSurf->PushButton2->setDown(false); myGroupSurf->LineEdit2->setEnabled(false); } else if (send == myGroupSurf->PushButton2) { globalSelection(GEOM_WIRE); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_WIRE ); + localSelection( TopAbs_WIRE ); myEditCurrentArgument = myGroupSurf->LineEdit2; myGroupSurf->PushButton1->setDown(false); myGroupSurf->LineEdit1->setEnabled(false); } else if (send == myGroupWireConstraints->PushButton1) { globalSelection(); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_WIRE ); + localSelection( TopAbs_WIRE ); myEditCurrentArgument = myGroupWireConstraints->LineEdit1; myCurrentItem = 0; } @@ -659,8 +659,6 @@ bool BuildGUI_FaceDlg::execute( ObjectList& objects ) } if (!anObj->_is_nil()) { - objects.push_back(anObj._retn()); - if ( !anOper->IsDone() && QString(anOper->GetErrorCode()) == "MAKE_FACE_TOLERANCE_TOO_BIG") { if ( !IsPreview() ) { SUIT_OverrideCursor wc; @@ -670,6 +668,14 @@ bool BuildGUI_FaceDlg::execute( ObjectList& objects ) } anOper->SetErrorCode("PAL_NO_ERROR"); } + else if ( anObj->GetShapeType() == GEOM::COMPOUND ) { + if ( !IsPreview() ) { + SUIT_MessageBox::warning(this, + QObject::tr("GEOM_WRN_WARNING"), + QObject::tr("GEOM_WRN_FACES_NOT_FACE")); + } + } + objects.push_back(anObj._retn()); } return res; diff --git a/src/BuildGUI/BuildGUI_ShellDlg.cxx b/src/BuildGUI/BuildGUI_ShellDlg.cxx index 36ed6ad7e..6674e9eac 100644 --- a/src/BuildGUI/BuildGUI_ShellDlg.cxx +++ b/src/BuildGUI/BuildGUI_ShellDlg.cxx @@ -262,10 +262,7 @@ bool BuildGUI_ShellDlg::execute( ObjectList& objects ) GEOM::GEOM_Object_var anObj = anOper->MakeShell( objlist.in() ); if ( !anObj->_is_nil() ) { - TopoDS_Shape aShell; - GEOMBase::GetShape(anObj, aShell, TopAbs_SHELL); - - if (aShell.IsNull()) { + if (anObj->GetShapeType() == GEOM::COMPOUND) { SUIT_MessageBox::warning(this, QObject::tr("GEOM_WRN_WARNING"), QObject::tr("GEOM_WRN_FACES_NOT_SHELL")); diff --git a/src/BuildGUI/BuildGUI_WireDlg.cxx b/src/BuildGUI/BuildGUI_WireDlg.cxx index 83c7213cf..097028208 100644 --- a/src/BuildGUI/BuildGUI_WireDlg.cxx +++ b/src/BuildGUI/BuildGUI_WireDlg.cxx @@ -121,7 +121,7 @@ void BuildGUI_WireDlg::Init() myEdgesAndWires.clear(); - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); /* signals and slots connections */ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); @@ -177,12 +177,12 @@ void BuildGUI_WireDlg::TypeButtonClicked() { if ( GroupType->RadioButton1->isChecked() ) { globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); GroupArgs->TextLabel1->setText( tr( "GEOM_EDGE" ) ); } else if ( GroupType->RadioButton2->isChecked() ) { globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_WIRE ); + localSelection( TopAbs_WIRE ); GroupArgs->TextLabel1->setText( tr( "GEOM_WIRE" ) ); } SelectionIntoArgument(); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d271e268e..bd7e3428d 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,11 +42,14 @@ ENDIF() IF(SALOME_BUILD_GUI) SET(SUBDIRS_GUI OBJECT DlgRef GEOMFiltersSelection Material GEOMGUI - GEOMBase DependencyTree GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI - CurveCreator EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI - RepairGUI MeasureGUI GroupGUI BlocksGUI AdvancedGUI + GEOMBase GEOMToolsGUI DisplayGUI BasicGUI PrimitiveGUI GenerationGUI + CurveCreator MeasureGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI + RepairGUI GroupGUI BlocksGUI AdvancedGUI GEOM_SWIG_WITHIHM ) + IF(SALOME_USE_GRAPHICSVIEW) + LIST(APPEND SUBDIRS_GUI DependencyTree) + ENDIF() ENDIF() SET(SUBDIRS diff --git a/src/EntityGUI/CMakeLists.txt b/src/EntityGUI/CMakeLists.txt index ecfc09a2d..0bb93f921 100755 --- a/src/EntityGUI/CMakeLists.txt +++ b/src/EntityGUI/CMakeLists.txt @@ -39,6 +39,7 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/GEOMImpl ${PROJECT_SOURCE_DIR}/src/GEOMGUI ${PROJECT_SOURCE_DIR}/src/GEOMBase + ${PROJECT_SOURCE_DIR}/src/MeasureGUI ${PROJECT_SOURCE_DIR}/src/SKETCHER ${PROJECT_SOURCE_DIR}/src/CurveCreator ${PROJECT_SOURCE_DIR}/src/ShapeRecognition @@ -67,6 +68,7 @@ SET(_link_LIBRARIES DlgRef GEOMSketcher CurveCreator + MeasureGUI ) # optional sources diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx index 41a10d232..861d7c5b3 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx @@ -327,7 +327,7 @@ void EntityGUI_3DSketcherDlg::Init() myLengthPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); myTextPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); /* Get setting of step value from file configuration */ double step = SUIT_Session::session()->resourceMgr()->doubleValue("Geometry", "SettingsGeomStep", 100.0); @@ -823,7 +823,7 @@ void EntityGUI_3DSketcherDlg::ActivateThisDialog() connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth); } diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx index f489c89c2..6b0248b08 100644 --- a/src/EntityGUI/EntityGUI_SketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -541,7 +541,7 @@ void EntityGUI_SketcherDlg::InitClick() Group4Spin->hide(); GroupRect->hide(); globalSelection(); // close local selection to clear it - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); } @@ -1571,7 +1571,7 @@ void EntityGUI_SketcherDlg::SetEditCurrentArgument() selButton->setDown(true); } globalSelection(); // close local selection to clear it - localSelection(GEOM::GEOM_Object::_nil(), myNeedType); + localSelection( myNeedType ); } diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx index 9db5fbab0..085028ce1 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -30,6 +30,9 @@ #include #include #include +#ifndef DISABLE_PLOT2DVIEWER + #include +#endif #include #include @@ -165,6 +168,9 @@ EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(GeometryGUI* theGeometryGUI, QWidge myLessFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp); myGreaterFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp); myApplyFilterButton = new QPushButton(tr("GEOM_BUT_APPLY"), myFilterGrp); +#ifndef DISABLE_PLOT2DVIEWER + myPlotDistributionButton = new QPushButton(tr("GEOM_PLOT_DISTRIBUTION"), myFilterGrp); +#endif QGridLayout* filterLayout = new QGridLayout(myFilterGrp); filterLayout->addWidget(myLessFilterCheck, 0, 0); @@ -174,6 +180,9 @@ EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(GeometryGUI* theGeometryGUI, QWidge filterLayout->addWidget(myGreaterFilterCombo, 1, 1); filterLayout->addWidget(myGreaterFilterSpin, 1, 2); filterLayout->addWidget(myApplyFilterButton, 0, 3); +#ifndef DISABLE_PLOT2DVIEWER + filterLayout->addWidget(myPlotDistributionButton, 1, 3); +#endif QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); @@ -250,6 +259,9 @@ void EntityGUI_SubShapeDlg::Init() connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(showOnlySelected())); connect(myApplyFilterButton, SIGNAL(clicked()), this, SLOT(ClickOnOkFilter())); +#ifndef DISABLE_PLOT2DVIEWER + connect(myPlotDistributionButton, SIGNAL(clicked()), this, SLOT(ClickOnPlot())); +#endif connect(myLessFilterCheck, SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled())); connect(myGreaterFilterCheck, SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled())); @@ -322,7 +334,7 @@ void EntityGUI_SubShapeDlg::ClickOnOk() } if (isOk) - isOk = onAccept(); + isOk = onAccept( true, true, false ); if (isOk) ClickOnCancel(); @@ -491,6 +503,13 @@ void EntityGUI_SubShapeDlg::SubShapeToggled() GroupPoints->CheckButton1->isChecked() && shapeType() < GEOM::VERTEX); +#ifndef DISABLE_PLOT2DVIEWER + myPlotDistributionButton->setEnabled( myFilterGrp->isEnabled() && + ( shapeType() == TopAbs_EDGE || + shapeType() == TopAbs_FACE || + shapeType() == TopAbs_SOLID ) ); +#endif + activateSelection(); } @@ -936,6 +955,20 @@ void EntityGUI_SubShapeDlg::ClickOnOkFilter() updateButtonState(); } +#ifndef DISABLE_PLOT2DVIEWER +//================================================================================= +// function : ClickOnPlot() +// purpose : opens "Shape Statistics" dialog box in order to plot sub-shapes distribution. +//================================================================================= +void EntityGUI_SubShapeDlg::ClickOnPlot() +{ + QDialog* dlg = new MeasureGUI_ShapeStatisticsDlg( this, myShape, (TopAbs_ShapeEnum)shapeType() ); + if ( dlg ) { + dlg->show(); + } +} +#endif + //================================================================================= // function : MeasureToggled() // purpose : diff --git a/src/EntityGUI/EntityGUI_SubShapeDlg.h b/src/EntityGUI/EntityGUI_SubShapeDlg.h index e3618ac41..18c0c9ec8 100644 --- a/src/EntityGUI/EntityGUI_SubShapeDlg.h +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.h @@ -73,6 +73,9 @@ private slots: void showOnlySelected(); void ClickOnOkFilter(); +#ifndef DISABLE_PLOT2DVIEWER + void ClickOnPlot(); +#endif void MeasureToggled(); private: @@ -102,6 +105,7 @@ private: SalomeApp_DoubleSpinBox* myLessFilterSpin; SalomeApp_DoubleSpinBox* myGreaterFilterSpin; QPushButton* myApplyFilterButton; + QPushButton* myPlotDistributionButton; QGroupBox* myFilterGrp; }; diff --git a/src/GEOM/GEOM_PythonDump.cxx b/src/GEOM/GEOM_PythonDump.cxx index 6d697dd99..bcee3dc04 100644 --- a/src/GEOM/GEOM_PythonDump.cxx +++ b/src/GEOM/GEOM_PythonDump.cxx @@ -144,7 +144,7 @@ namespace GEOM TPythonDump::operator<< (const std::list& theObjects) { Standard_Integer aLength = theObjects.size(); - if ( aLength > 1 ) { + if ( aLength != 1 ) { myStream << "["; } std::list::const_iterator obj = theObjects.begin(); @@ -152,7 +152,7 @@ namespace GEOM *this << *obj; if ( i < aLength ) myStream << ", "; } - if ( aLength > 1 ) { + if ( aLength != 1 ) { myStream << "]"; } return *this; diff --git a/src/GEOMAlgo/CMakeLists.txt b/src/GEOMAlgo/CMakeLists.txt index f44663a10..d2b6024ab 100755 --- a/src/GEOMAlgo/CMakeLists.txt +++ b/src/GEOMAlgo/CMakeLists.txt @@ -59,7 +59,10 @@ SET(GEOMAlgo_HEADERS GEOMAlgo_DataMapOfPassKeyInteger.hxx GEOMAlgo_DataMapOfShapeMapOfShape.hxx GEOMAlgo_DataMapOfShapePnt.hxx + GEOMAlgo_FinderShapeOn.hxx + GEOMAlgo_FinderShapeOn1.hxx GEOMAlgo_FinderShapeOn2.hxx + GEOMAlgo_FinderShapeOnQuad.hxx GEOMAlgo_GetInPlace.hxx GEOMAlgo_GetInPlaceAPI.hxx GEOMAlgo_GlueAnalyser.hxx @@ -77,6 +80,7 @@ SET(GEOMAlgo_HEADERS GEOMAlgo_IndexedDataMapOfShapeState.hxx GEOMAlgo_KindOfBounds.hxx GEOMAlgo_KindOfClosed.hxx + GEOMAlgo_KindOfDef.hxx GEOMAlgo_KindOfName.hxx GEOMAlgo_KindOfShape.hxx GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx diff --git a/src/GEOMAlgo/FILES b/src/GEOMAlgo/FILES index 85d55bcfc..91e59813f 100644 --- a/src/GEOMAlgo/FILES +++ b/src/GEOMAlgo/FILES @@ -11,25 +11,28 @@ GEOMAlgo_ShellSolid.cxx GEOMAlgo_AlgoTools.hxx GEOMAlgo_AlgoTools.cxx GEOMAlgo_AlgoTools_1.cxx -GEOMAlgo_AlgoTools_2.cxx GEOMAlgo_SolidSolid.hxx GEOMAlgo_SolidSolid.cxx GEOMAlgo_ShapeAlgo.hxx GEOMAlgo_ShapeAlgo.cxx +GEOMAlgo_FinderShapeOn.hxx +GEOMAlgo_FinderShapeOn.cxx +GEOMAlgo_FinderShapeOn1.hxx +GEOMAlgo_FinderShapeOn1.cxx GEOMAlgo_HAlgo.hxx GEOMAlgo_HAlgo.cxx GEOMAlgo_Clsf.hxx GEOMAlgo_Clsf.cxx GEOMAlgo_ClsfBox.hxx GEOMAlgo_ClsfBox.cxx -GEOMAlgo_ClsfQuad.hxx -GEOMAlgo_ClsfQuad.cxx GEOMAlgo_ClsfSolid.hxx GEOMAlgo_ClsfSolid.cxx GEOMAlgo_ClsfSurf.hxx GEOMAlgo_ClsfSurf.cxx GEOMAlgo_FinderShapeOn2.hxx GEOMAlgo_FinderShapeOn2.cxx +GEOMAlgo_FinderShapeOnQuad.hxx +GEOMAlgo_FinderShapeOnQuad.cxx GEOMAlgo_Gluer.hxx GEOMAlgo_Gluer.cxx GEOMAlgo_GlueAnalyser.hxx @@ -50,8 +53,6 @@ GEOMAlgo_GetInPlace.cxx GEOMAlgo_GetInPlace_1.cxx GEOMAlgo_GetInPlace_2.cxx GEOMAlgo_GetInPlace_3.cxx -GEOMAlgo_GetInPlaceAPI.hxx -GEOMAlgo_GetInPlaceAPI.cxx GEOMAlgo_Splitter.hxx GEOMAlgo_Splitter.cxx GEOMAlgo_ShapeInfoFiller.hxx @@ -106,3 +107,5 @@ GEOMAlgo_ShapeInfo.cxx GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx Basics_OCCTVersion.hxx + +GEOMAlgo_KindOfDef.hxx diff --git a/src/GEOMAlgo/GEOMAlgo.cdl b/src/GEOMAlgo/GEOMAlgo.cdl old mode 100755 new mode 100644 diff --git a/src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx b/src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx index ae08f5480..57184bff1 100644 --- a/src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx +++ b/src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx @@ -93,15 +93,15 @@ static Standard_Integer& iCnt); static void CopySource(const TopoDS_Shape& aS, - TopTools_IndexedDataMapOfShapeShape& aMapSS, - TopoDS_Shape& aSC); + TopTools_IndexedDataMapOfShapeShape& aMapSS, + TopoDS_Shape& aSC); //======================================================================= //function : CopyShape //purpose : //======================================================================= void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS, - TopoDS_Shape& aSC) + TopoDS_Shape& aSC) { TopTools_IndexedDataMapOfShapeShape aMapSS; // @@ -112,8 +112,8 @@ void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS, //purpose : //======================================================================= void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS, - TopoDS_Shape& aSC, - TopTools_IndexedDataMapOfShapeShape& aMapSS) + TopoDS_Shape& aSC, + TopTools_IndexedDataMapOfShapeShape& aMapSS) { CopySource(aS, aMapSS, aSC); } @@ -172,9 +172,9 @@ void CopySource(const TopoDS_Shape& aS, //purpose : //======================================================================= void GEOMAlgo_AlgoTools::FaceNormal (const TopoDS_Face& aF, - const Standard_Real U, - const Standard_Real V, - gp_Vec& aN) + const Standard_Real U, + const Standard_Real V, + gp_Vec& aN) { gp_Pnt aPnt ; gp_Vec aD1U, aD1V; @@ -343,7 +343,7 @@ Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace // purpose: //======================================================================= void GEOMAlgo_AlgoTools::MakeContainer(const TopAbs_ShapeEnum theType, - TopoDS_Shape& theC) + TopoDS_Shape& theC) { BRep_Builder aBB; // @@ -412,9 +412,9 @@ Standard_Boolean GEOMAlgo_AlgoTools::IsUPeriodic(const Handle(Geom_Surface) &aS //purpose : //======================================================================= void GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE, - const TopoDS_Face& aF, - const Standard_Real aUMin, - const Standard_Real aUMax) + const TopoDS_Face& aF, + const Standard_Real aUMin, + const Standard_Real aUMax) { Standard_Real aT1, aT2, aTx, aUx, aTol; gp_Pnt2d aP2D; @@ -559,7 +559,7 @@ Standard_Boolean GEOMAlgo_AlgoTools::ProjectPointOnShape //purpose : //======================================================================= void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE, - gp_Pnt& aP3D) + gp_Pnt& aP3D) { Standard_Real aTx, aT1, aT2; // @@ -572,8 +572,8 @@ void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE, //purpose : //======================================================================= void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE, - const Standard_Real aT, - gp_Pnt& aP3D) + const Standard_Real aT, + gp_Pnt& aP3D) { Standard_Real aT1, aT2; Handle(Geom_Curve) aC3D; @@ -586,9 +586,9 @@ void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE, //purpose : //======================================================================= void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF, - const Standard_Real aU, - const Standard_Real aV, - gp_Pnt& aP3D) + const Standard_Real aU, + const Standard_Real aV, + gp_Pnt& aP3D) { Handle(Geom_Surface) aS; // @@ -600,7 +600,7 @@ void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF, //purpose : //======================================================================= void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF, - gp_Pnt& aP3D) + gp_Pnt& aP3D) { Standard_Real aU, aV, aUMin, aUMax, aVMin, aVMax; // @@ -616,7 +616,7 @@ void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF, //purpose : //======================================================================= void GEOMAlgo_AlgoTools::PointOnShape(const TopoDS_Shape& aS, - gp_Pnt& aP3D) + gp_Pnt& aP3D) { TopAbs_ShapeEnum aType; // @@ -713,7 +713,7 @@ Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes return 0; // Nothing to do } // - while(1) { + for(;;) { aNbEProcessed=aMProcessed.Extent(); if (aNbEProcessed==aNbE) { break; @@ -922,8 +922,8 @@ void GetCount(const TopoDS_Shape& aS, //purpose : //======================================================================= Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF, - gp_Pnt& theP, - gp_Pnt2d& theP2D) + gp_Pnt& theP, + gp_Pnt2d& theP2D) { Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint; Standard_Integer iErr, aIx, aNbDomains, i; @@ -948,8 +948,8 @@ Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF, // Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr); Geom2dHatch_Hatcher aHatcher(aIntr, - aTolHatch2D, aTolHatch3D, - Standard_True, Standard_False); + aTolHatch2D, aTolHatch3D, + Standard_True, Standard_False); // iErr=0; aEpsT=1.e-12; @@ -1004,30 +1004,33 @@ Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF, } // // 4. + aVx=aVMin; aNbDomains=aHatcher.NbDomains(aIx); - for (i=1; i<=aNbDomains; ++i) { - const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ; - bHasFirstPoint=aDomain.HasFirstPoint(); - if (!bHasFirstPoint) { - iErr=5; - return iErr; - } - // - aV1=aDomain.FirstPoint().Parameter(); - // - bHasSecondPoint=aDomain.HasSecondPoint(); - if (!bHasSecondPoint) { - iErr=6; - return iErr; - } - // - aV2=aDomain.SecondPoint().Parameter(); - // - aVx=IntTools_Tools::IntermediatePoint(aV1, aV2); - // - break; + if (!aNbDomains) { + iErr=5; + return iErr; } // + i=1; + const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ; + bHasFirstPoint=aDomain.HasFirstPoint(); + if (!bHasFirstPoint) { + iErr=5; + return iErr; + } + // + aV1=aDomain.FirstPoint().Parameter(); + // + bHasSecondPoint=aDomain.HasSecondPoint(); + if (!bHasSecondPoint) { + iErr=6; + return iErr; + } + // + aV2=aDomain.SecondPoint().Parameter(); + // + aVx=IntTools_Tools::IntermediatePoint(aV1, aV2); + // aS->D0(aUx, aVx, aPx); // theP2D.SetCoord(aUx, aVx); diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx index e721aca85..4db6801de 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx @@ -62,7 +62,6 @@ #include #include -//#include #include #include @@ -300,7 +299,6 @@ void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS) { myErrorStatus=0; // - Standard_Boolean bIsDone; Standard_Integer i, iErr; TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON}; TopTools_ListIteratorOfListOfShape aIt; diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx index 6487a04ac..f2f7fe0d5 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx @@ -309,6 +309,9 @@ void GEOMAlgo_FinderShapeOn1::ProcessEdges() aType1=myGAS.GetType(); // TopExp::MapShapes(myShape, TopAbs_EDGE, aM); + // + bIsConformState=Standard_False; + // aNb=aM.Extent(); for (i=1; i<=aNb; ++i) { GEOMAlgo_ListOfPnt aLP; @@ -427,6 +430,8 @@ void GEOMAlgo_FinderShapeOn1::ProcessFaces() } } // + bIsConformState=Standard_False; + // aExp.Init(aF, TopAbs_EDGE); for (; aExp.More(); aExp.Next()) { const TopoDS_Shape& aE=aExp.Current(); @@ -500,6 +505,9 @@ void GEOMAlgo_FinderShapeOn1::ProcessSolids() const TopoDS_Shape& aSd=aM(i); aMF.Clear(); TopExp::MapShapes(aSd, TopAbs_FACE, aMF); + // + bIsConformState=Standard_False; + // aNbF=aMF.Extent(); for (j=1; j<=aNbF; ++j) { const TopoDS_Shape& aF=aMF(j); @@ -660,7 +668,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF, }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder) }// if (!aNb && myNbPntsMin) { } -//modified by NIZNHY-PKV Thu Jan 26 09:56:20 2012f //======================================================================= //function : InnerPoints //purpose : @@ -676,7 +683,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE, aLP.Clear(); InnerPoints(aE, aNbPntsMin, aLP); } -//modified by NIZNHY-PKV Thu Jan 26 09:56:32 2012t //======================================================================= //function : InnerPoints //purpose : @@ -702,16 +708,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE, return; } // - //modified by NIZNHY-PKV Thu Jan 26 09:51:20 2012f - /* - aNbT=myNbPntsMin+1; - dT=(aT2-aT1)/aNbT; - for (j=1; j<=aNbPntsMin; ++j) { - aT=aT1+j*dT; - aC3D->D0(aT, aP); - aLP.Append(aP); - } - */ aNbT=aNbPntsMin+1; dT=(aT2-aT1)/aNbT; for (j=1; jD0(aT, aP); aLP.Append(aP); } - //modified by NIZNHY-PKV Thu Jan 26 09:51:24 2012t } //======================================================================= diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx index 439caec37..e2e34de0f 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx @@ -362,6 +362,8 @@ void GEOMAlgo_FinderShapeOn2::ProcessEdges() // const TopoDS_Edge& aE=TopoDS::Edge(aM(i)); // + bIsConformState=Standard_False; + // aExp.Init(aE, TopAbs_VERTEX); for (; aExp.More(); aExp.Next()) { const TopoDS_Shape& aV=aExp.Current(); @@ -475,6 +477,9 @@ void GEOMAlgo_FinderShapeOn2::ProcessFaces() } } // + // + bIsConformState=Standard_False; + // aExp.Init(aF, TopAbs_EDGE); for (; aExp.More(); aExp.Next()) { const TopoDS_Shape& aE=aExp.Current(); @@ -558,6 +563,9 @@ void GEOMAlgo_FinderShapeOn2::ProcessSolids() const TopoDS_Shape& aSd=aM(i); aMF.Clear(); TopExp::MapShapes(aSd, TopAbs_FACE, aMF); + // + bIsConformState=Standard_False; + // aNbF=aMF.Extent(); for (j=1; j<=aNbF; ++j) { const TopoDS_Shape& aF=aMF(j); diff --git a/src/GEOMAlgo/GEOMAlgo_GetInPlaceAPI.cxx b/src/GEOMAlgo/GEOMAlgo_GetInPlaceAPI.cxx index 6c1afa4e9..878faf172 100644 --- a/src/GEOMAlgo/GEOMAlgo_GetInPlaceAPI.cxx +++ b/src/GEOMAlgo/GEOMAlgo_GetInPlaceAPI.cxx @@ -126,93 +126,75 @@ Standard_Integer GEOMAlgo_GetInPlaceAPI::GetInPlaceOld return 1; } - TopoDS_Shape aPntShape; - TopoDS_Vertex aVertex; - bool isFound = false; - TopAbs_ShapeEnum iType = TopAbs_SOLID; - //Standard_Real aWhat_Mass = 0., aWhere_Mass = 0.; - Standard_Real tab_aWhat[4], tab_aWhere[4]; - Standard_Real dl_l = 1e-3; - Standard_Real min_l, Tol_0D, Tol_1D, Tol_2D, Tol_3D, Tol_Mass; - Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; - Bnd_Box BoundingBox; - gp_Pnt aPnt, aPnt_aWhat, tab_Pnt[2]; - GProp_GProps aProps; + // Check shape type. + TopAbs_ShapeEnum iType = GEOMUtils::GetTypeOfSimplePart(theWhat); - iType = GEOMUtils::GetTypeOfSimplePart(theWhat); if (iType == TopAbs_SHAPE) { // Error: An attempt to extract a shape of not supported type. return 2; } - TopExp_Explorer Exp_aWhat ( theWhat, iType ); - TopExp_Explorer Exp_aWhere ( theWhere, iType ); - TopExp_Explorer Exp_Edge ( theWhere, TopAbs_EDGE ); + // Compute confusion tolerance. + Standard_Real aTolConf = Precision::Confusion(); + Standard_Integer i; - // Find the shortest edge in theShapeWhere shape - BRepBndLib::Add(theWhere, BoundingBox); - BoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); - min_l = fabs(aXmax - aXmin); - if( min_l < fabs(aYmax - aYmin) ) min_l = fabs(aYmax - aYmin); - if( min_l < fabs(aZmax - aZmin) ) min_l = fabs(aZmax - aZmin); - min_l /= dl_l; - // Mantis issue 0020908 BEGIN - if (!Exp_Edge.More()) { - min_l = Precision::Confusion(); - } - // Mantis issue 0020908 END - for ( Standard_Integer nbEdge = 0; Exp_Edge.More(); Exp_Edge.Next(), nbEdge++ ) { - TopExp_Explorer Exp_Vertex( Exp_Edge.Current(), TopAbs_VERTEX); - for ( Standard_Integer nbVertex = 0; Exp_Vertex.More(); Exp_Vertex.Next(), nbVertex++ ) { - aPnt = BRep_Tool::Pnt( TopoDS::Vertex( Exp_Vertex.Current() ) ); - tab_Pnt[nbVertex] = aPnt; - } - if ( ! tab_Pnt[0].IsEqual(tab_Pnt[1], dl_l) ) { - BRepGProp::LinearProperties(Exp_Edge.Current(), aProps); - if ( aProps.Mass() < min_l ) min_l = aProps.Mass(); + for (i = 0; i < 2; ++i) { + TopExp_Explorer anExp(i == 0 ? theWhere : theWhat, TopAbs_VERTEX); + + for (; anExp.More(); anExp.Next()) { + const TopoDS_Vertex aVtx = TopoDS::Vertex(anExp.Current()); + const Standard_Real aTolVtx = BRep_Tool::Tolerance(aVtx); + + if (aTolVtx > aTolConf) { + aTolConf = aTolVtx; + } } } - // Compute tolerances - Tol_0D = dl_l; - Tol_1D = dl_l * min_l; - Tol_2D = dl_l * ( min_l * min_l) * ( 2. + dl_l); - Tol_3D = dl_l * ( min_l * min_l * min_l ) * ( 3. + (3 * dl_l) + (dl_l * dl_l) ); + // Compute mass tolerance. + Bnd_Box aBoundingBox; + Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax; + Standard_Real aMassTol; - if (Tol_0D < Precision::Confusion()) Tol_0D = Precision::Confusion(); - if (Tol_1D < Precision::Confusion()) Tol_1D = Precision::Confusion(); - if (Tol_2D < Precision::Confusion()) Tol_2D = Precision::Confusion(); - if (Tol_3D < Precision::Confusion()) Tol_3D = Precision::Confusion(); + BRepBndLib::Add(theWhere, aBoundingBox); + BRepBndLib::Add(theWhat, aBoundingBox); + aBoundingBox.Get(aXmin, aYmin, aZmin, aXmax, aYmax, aZmax); + aMassTol = Max(aXmax - aXmin, aYmax - aYmin); + aMassTol = Max(aMassTol, aZmax - aZmin); + aMassTol *= aTolConf; - Tol_Mass = Tol_3D; - if ( iType == TopAbs_VERTEX ) Tol_Mass = Tol_0D; - else if ( iType == TopAbs_EDGE ) Tol_Mass = Tol_1D; - else if ( iType == TopAbs_FACE ) Tol_Mass = Tol_2D; - - // Searching for the sub-shapes inside the ShapeWhere shape + // Compute the result. + TopExp_Explorer Exp_aWhat (theWhat, iType); + TopExp_Explorer Exp_aWhere (theWhere, iType); + Standard_Real tab_aWhat[4], tab_aWhere[4]; + gp_Pnt aPnt, aPnt_aWhat; + TopoDS_Shape aPntShape; + TopoDS_Vertex aVertex; + bool isFound = false; TopTools_MapOfShape map_aWhere; - for ( Exp_aWhere.ReInit(); Exp_aWhere.More(); Exp_aWhere.Next() ) { + + for (; Exp_aWhere.More(); Exp_aWhere.Next()) { if (!map_aWhere.Add(Exp_aWhere.Current())) continue; // skip repeated shape to avoid mass addition GetShapeProperties( Exp_aWhere.Current(), tab_aWhere, aPnt ); for ( Exp_aWhat.ReInit(); Exp_aWhat.More(); Exp_aWhat.Next() ) { GetShapeProperties( Exp_aWhat.Current(), tab_aWhat, aPnt_aWhat ); - if ( fabs(tab_aWhat[3] - tab_aWhere[3]) <= Tol_Mass && aPnt_aWhat.Distance(aPnt) <= Tol_1D ) + if (fabs(tab_aWhat[3] - tab_aWhere[3]) <= aMassTol && aPnt_aWhat.Distance(aPnt) <= aTolConf) isFound = true; else { - if ( (tab_aWhat[3] - tab_aWhere[3]) > Tol_Mass ) { + if (tab_aWhat[3] > tab_aWhere[3]) { aPntShape = BRepBuilderAPI_MakeVertex( aPnt ).Shape(); aVertex = TopoDS::Vertex( aPntShape ); BRepExtrema_DistShapeShape aWhereDistance ( aVertex, Exp_aWhere.Current() ); BRepExtrema_DistShapeShape aWhatDistance ( aVertex, Exp_aWhat.Current() ); - if ( aWhereDistance.IsDone() && aWhatDistance.IsDone() && - fabs(aWhereDistance.Value() - aWhatDistance.Value()) <= Tol_1D ) + if (aWhereDistance.IsDone() && aWhatDistance.IsDone() && + fabs(aWhereDistance.Value() - aWhatDistance.Value()) <= aTolConf) { // 0020162: "EDF 961 GEOM : Getinplace is getting additionnal orthogonal faces" // aVertex must be projected to the same point on Where and on What gp_Pnt pOnWhat = aWhatDistance.PointOnShape2(1); gp_Pnt pOnWhere = aWhereDistance.PointOnShape2(1); - isFound = ( pOnWhat.Distance(pOnWhere) <= Tol_1D ); + isFound = (pOnWhat.Distance(pOnWhere) <= aTolConf); if ( isFound && iType == TopAbs_FACE ) { // check normals at pOnWhat and pOnWhere diff --git a/src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx b/src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx index c717997e3..03416d293 100644 --- a/src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx @@ -239,7 +239,6 @@ Standard_Integer PntInSolid(const TopoDS_Solid& aZ, gp_Pnt aPx; gp_Pnt2d aP2Dx; gp_Vec aDNx; - TopoDS_Face aF; TopExp_Explorer aExp; // @@ -247,9 +246,8 @@ Standard_Integer PntInSolid(const TopoDS_Solid& aZ, aCoef=10.; // aExp.Init (aZ, TopAbs_FACE); - for (; aExp.More() ; aExp.Next()) { + if (aExp.More()) { aF=*((TopoDS_Face*)&aExp.Current()); - break; } // iErr=PntInFace(aF, aPx, aP2Dx); @@ -368,29 +366,31 @@ Standard_Integer PntInFace(const TopoDS_Face& aF, // // 4. aNbDomains=aHatcher.NbDomains(aIx); - for (i=1; i<=aNbDomains; ++i) { - const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ; - bHasFirstPoint=aDomain.HasFirstPoint(); - if (!bHasFirstPoint) { - iErr=5; - return iErr; - } - // - aV1=aDomain.FirstPoint().Parameter(); - // - bHasSecondPoint=aDomain.HasSecondPoint(); - if (!bHasSecondPoint) { - iErr=6; - return iErr; - } - // - aV2=aDomain.SecondPoint().Parameter(); - // - aVx=IntTools_Tools::IntermediatePoint(aV1, aV2); - // - break; + if (!aNbDomains) { + iErr=5; + return iErr; } // + i=1; + const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ; + bHasFirstPoint=aDomain.HasFirstPoint(); + if (!bHasFirstPoint) { + iErr=5; + return iErr; + } + // + aV1=aDomain.FirstPoint().Parameter(); + // + bHasSecondPoint=aDomain.HasSecondPoint(); + if (!bHasSecondPoint) { + iErr=6; + return iErr; + } + // + aV2=aDomain.SecondPoint().Parameter(); + // + aVx=IntTools_Tools::IntermediatePoint(aV1, aV2); + // aS->D0(aUx, aVx, aPx); // theP2D.SetCoord(aUx, aVx); diff --git a/src/GEOMAlgo/GEOMAlgo_GlueDetector.cxx b/src/GEOMAlgo/GEOMAlgo_GlueDetector.cxx index e5ca7dfbd..bad1fe01f 100644 --- a/src/GEOMAlgo/GEOMAlgo_GlueDetector.cxx +++ b/src/GEOMAlgo/GEOMAlgo_GlueDetector.cxx @@ -90,7 +90,6 @@ GEOMAlgo_GlueDetector::GEOMAlgo_GlueDetector() //======================================================================= GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector() {} -//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f //======================================================================= //function : StickedShapes //purpose : @@ -100,7 +99,6 @@ const TopTools_IndexedDataMapOfShapeListOfShape& { return myStickedShapes; } -//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t //======================================================================= //function : Perform //purpose : @@ -124,12 +122,10 @@ void GEOMAlgo_GlueDetector::Perform() return; } // - //modified by NIZNHY-PKV Wed Mar 14 08:00:09 2012f CheckDetected(); if (myErrorStatus) { return; } - //modified by NIZNHY-PKV Wed Mar 14 08:00:12 2012t // DetectEdges(); if (myErrorStatus) { @@ -206,7 +202,7 @@ void GEOMAlgo_GlueDetector::DetectVertices() TColStd_MapIteratorOfMapOfInteger aIt1; // aMIP.Add(i); - while(1) { + for(;;) { aNbIP=aMIP.Extent(); aIt1.Initialize(aMIP); for(; aIt1.More(); aIt1.Next()) { @@ -460,7 +456,6 @@ void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE, // aPK.SetShapes(aLV); } -//modified by NIZNHY-PKV Tue Mar 13 09:54:18 2012f //======================================================================= //function : CheckDetected //purpose : @@ -607,4 +602,3 @@ Standard_Integer CheckAncesstors // return iRet; } -//modified by NIZNHY-PKV Tue Mar 13 09:54:59 2012t diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx old mode 100755 new mode 100644 index 3c1d629ca..d9f807906 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx @@ -20,10 +20,10 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File: GEOMAlgo_Gluer.cxx -// Created: Sat Dec 04 12:45:53 2004 -// Author: Peter KURNEV -// +// File: GEOMAlgo_Gluer.cxx +// Created: Sat Dec 04 12:45:53 2004 +// Author: Peter KURNEV +// // #include @@ -100,7 +100,7 @@ // static void GetSubShapes(const TopoDS_Shape& aS, - TopTools_IndexedMapOfShape& aMSS); + TopTools_IndexedMapOfShape& aMSS); //======================================================================= //function : GEOMAlgo_Gluer @@ -228,10 +228,7 @@ void GEOMAlgo_Gluer::MakeVertices() TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm; TopTools_DataMapOfShapeListOfShape aMVV; GEOMAlgo_IndexedDataMapOfIntegerShape aMIS; - //modified by NIZNHY-PKV Thu Jan 21 10:03:07 2010f - //GEOMAlgo_IndexedDataMapOfShapeBox aMSB; GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB; - //modified by NIZNHY-PKV Thu Jan 21 10:03:10 2010t // GEOMAlgo_BndSphereTreeSelector aSelector; GEOMAlgo_BndSphereTree aBBTree; @@ -278,57 +275,54 @@ void GEOMAlgo_Gluer::MakeVertices() TColStd_MapIteratorOfMapOfInteger aIt1; // aMIP.Add(i); - while(1) { + for(;;) { aNbIP=aMIP.Extent(); aIt1.Initialize(aMIP); for(; aIt1.More(); aIt1.Next()) { - aIP=aIt1.Key(); - if (aMIPC.Contains(aIP)) { - continue; - } - // - const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); - //modified by NIZNHY-PKV Thu Jan 21 10:04:09 2010f - const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP); - //const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP); - //modified by NIZNHY-PKV Thu Jan 21 10:04:11 2010t - // - aSelector.Clear(); - aSelector.SetBox(aBoxVP); - // - aNbVSD=aBBTree.Select(aSelector); - if (!aNbVSD) { - continue; // it must not be - } - // - const TColStd_ListOfInteger& aLI=aSelector.Indices(); - // - aIt.Initialize(aLI); - for (; aIt.More(); aIt.Next()) { - aIP1=aIt.Value(); - if (aMIP.Contains(aIP1)) { - continue; - } - aMIP1.Add(aIP1); - } //for (; aIt.More(); aIt.Next()) { + aIP=aIt1.Key(); + if (aMIPC.Contains(aIP)) { + continue; + } + // + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP); + // + aSelector.Clear(); + aSelector.SetBox(aBoxVP); + // + aNbVSD=aBBTree.Select(aSelector); + if (!aNbVSD) { + continue; // it must not be + } + // + const TColStd_ListOfInteger& aLI=aSelector.Indices(); + // + aIt.Initialize(aLI); + for (; aIt.More(); aIt.Next()) { + aIP1=aIt.Value(); + if (aMIP.Contains(aIP1)) { + continue; + } + aMIP1.Add(aIP1); + } //for (; aIt.More(); aIt.Next()) { }//for(; aIt1.More(); aIt1.Next()) { // aNbIP1=aMIP1.Extent(); if (!aNbIP1) { - break; + break; } // aIt1.Initialize(aMIP); for(; aIt1.More(); aIt1.Next()) { - aIP=aIt1.Key(); - aMIPC.Add(aIP); + aIP=aIt1.Key(); + aMIPC.Add(aIP); } // aMIP.Clear(); aIt1.Initialize(aMIP1); for(; aIt1.More(); aIt1.Next()) { - aIP=aIt1.Key(); - aMIP.Add(aIP); + aIP=aIt1.Key(); + aMIP.Add(aIP); } aMIP1.Clear(); }// while(1) @@ -344,13 +338,13 @@ void GEOMAlgo_Gluer::MakeVertices() else { // SD vertices founded [ aMIPC ] aIt1.Initialize(aMIPC); for(j=0; aIt1.More(); aIt1.Next(), ++j) { - aIP=aIt1.Key(); - const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); - if (!j) { - aVF=aVP; - } - aLVSD.Append(aVP); - aMVProcessed.Add(aVP); + aIP=aIt1.Key(); + const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP); + if (!j) { + aVF=aVP; + } + aLVSD.Append(aVP); + aMVProcessed.Add(aVP); } } myImages.Bind(aVF, aLVSD); @@ -395,7 +389,7 @@ void GEOMAlgo_Gluer::MakeVertices() for (; aItS.More(); aItS.Next()) { const TopoDS_Shape& aVSD=aItS.Value(); if (!myOrigins.IsBound(aVSD)) { - myOrigins.Bind(aVSD, aV); + myOrigins.Bind(aVSD, aV); } } } @@ -468,7 +462,8 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape, aER.Orientation(TopAbs_FORWARD); if (!BRep_Tool::Degenerated(aER)) { // orient image - Standard_Boolean bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext); + Standard_Boolean bIsToReverse= + GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext); if (bIsToReverse) { aER.Reverse(); } @@ -490,8 +485,7 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape& theShape, aBB.Add(theResult, aShapeR); } } - else - { + else { if (myKeepNonSolids) { // just add image const TopoDS_Shape& aShapeR = myOrigins.Find(theShape); @@ -554,12 +548,12 @@ void GEOMAlgo_Gluer::MakeShells() const TopoDS_Face& aF=TopoDS::Face(aExp.Current()); aFR=TopoDS::Face(myOrigins.Find(aF)); if (aFR.IsSame(aF)) { - aBB.Add(aNewShell, aF); - continue; + aBB.Add(aNewShell, aF); + continue; } bIsToReverse=IsToReverse(aFR, aF); if (bIsToReverse) { - aFR.Reverse(); + aFR.Reverse(); } aBB.Add(aNewShell, aFR); } @@ -660,25 +654,25 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) if (aNbSDF==1) { bHasNewSubShape=HasNewSubShape(aS1); if (!bHasNewSubShape) { - aNewShape=aS1; - aNewShape.Orientation(TopAbs_FORWARD); + aNewShape=aS1; + aNewShape.Orientation(TopAbs_FORWARD); } } // if (bHasNewSubShape) { if (aType==TopAbs_FACE) { - TopoDS_Face aNewFace; - // - const TopoDS_Face& aF1=TopoDS::Face(aS1); - MakeFace(aF1, aNewFace); - aNewShape=aNewFace; + TopoDS_Face aNewFace; + // + const TopoDS_Face& aF1=TopoDS::Face(aS1); + MakeFace(aF1, aNewFace); + aNewShape=aNewFace; } else if (aType==TopAbs_EDGE) { - TopoDS_Edge aNewEdge; - // - const TopoDS_Edge& aE1=TopoDS::Edge(aS1); - MakeEdge(aE1, aNewEdge); - aNewShape=aNewEdge; + TopoDS_Edge aNewEdge; + // + const TopoDS_Edge& aE1=TopoDS::Edge(aS1); + MakeEdge(aE1, aNewEdge); + aNewShape=aNewEdge; } } // @@ -688,7 +682,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType) for (; aItS.More(); aItS.Next()) { const TopoDS_Shape& aFSD=aItS.Value(); if (!myOrigins.IsBound(aFSD)) { - myOrigins.Bind(aFSD, aNewShape); + myOrigins.Bind(aFSD, aNewShape); } } } @@ -728,12 +722,12 @@ void GEOMAlgo_Gluer::CheckResult() for (j=1; j<=aNbFS; ++j) { const TopoDS_Shape& aFS=aMFS(j); if (aMFR.Contains(aFS)) { - const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS); - aNbSx=aLSx.Extent(); - if (aNbSx==2) { - bFound=!bFound; - break; - } + const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS); + aNbSx=aLSx.Extent(); + if (aNbSx==2) { + bFound=!bFound; + break; + } } } // @@ -795,7 +789,7 @@ void GEOMAlgo_Gluer::InnerTolerance() //purpose : //======================================================================= void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, - GEOMAlgo_PassKeyShape& aPK) + GEOMAlgo_PassKeyShape& aPK) { Standard_Integer i, aNbE; TopTools_ListOfShape aLE; @@ -820,7 +814,7 @@ void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF, //purpose : //======================================================================= void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE, - GEOMAlgo_PassKeyShape& aPK) + GEOMAlgo_PassKeyShape& aPK) { TopoDS_Vertex aV1, aV2; // @@ -839,7 +833,7 @@ void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE, //purpose : //======================================================================= void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV, - TopoDS_Vertex& aNewVertex) + TopoDS_Vertex& aNewVertex) { Standard_Integer aNbV; Standard_Real aTolV, aD, aDmax; @@ -885,7 +879,7 @@ void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV, //purpose : //======================================================================= void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE, - TopoDS_Edge& aNewEdge) + TopoDS_Edge& aNewEdge) { myErrorStatus=0; // @@ -939,7 +933,7 @@ void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE, //purpose : //======================================================================= void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF, - TopoDS_Face& aNewFace) + TopoDS_Face& aNewFace) { myErrorStatus=0; // @@ -975,20 +969,20 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF, // aER.Orientation(TopAbs_FORWARD); if (!BRep_Tool::Degenerated(aER)) { - // build p-curve - if (bIsUPeriodic) { - GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax); - } - BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aER, aFFWD); - - // orient image - bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext); - if (bIsToReverse) { - aER.Reverse(); - } + // build p-curve + if (bIsUPeriodic) { + GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax); + } + BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aER, aFFWD); + + // orient image + bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext); + if (bIsToReverse) { + aER.Reverse(); + } } else { - aER.Orientation(aE.Orientation()); + aER.Orientation(aE.Orientation()); } // aBB.Add(newWire, aER); @@ -1009,7 +1003,7 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF, //purpose : //======================================================================= Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR, - const TopoDS_Face& aF) + const TopoDS_Face& aF) { Standard_Boolean bRet; Standard_Real aT, aT1, aT2, aTR, aScPr; @@ -1088,7 +1082,7 @@ Standard_Boolean GEOMAlgo_Gluer::HasNewSubShape(const TopoDS_Shape& aS)const //purpose : //======================================================================= void GetSubShapes(const TopoDS_Shape& aS, - TopTools_IndexedMapOfShape& aMSS) + TopTools_IndexedMapOfShape& aMSS) { Standard_Integer aR; TopAbs_ShapeEnum aType; @@ -1111,7 +1105,8 @@ void GetSubShapes(const TopoDS_Shape& aS, //function : Modified //purpose : //======================================================================= -const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS) +const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified + (const TopoDS_Shape& aS) { TopAbs_ShapeEnum aType; // @@ -1127,7 +1122,7 @@ const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS) if(myOrigins.IsBound(aS)) { const TopoDS_Shape& aSnew=myOrigins.Find(aS); if (!aSnew.IsSame(aS)) { - myGenerated.Append(aSnew); + myGenerated.Append(aSnew); } } } diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer2.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer2.cxx index 80e71f4fa..7ecbd807b 100644 --- a/src/GEOMAlgo/GEOMAlgo_Gluer2.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Gluer2.cxx @@ -84,11 +84,8 @@ void GEOMAlgo_Gluer2::Clear() myImagesToWork.Clear(); myOriginsToWork.Clear(); myKeepNonSolids=Standard_False; - //modified by NIZNHY-PKV Tue Mar 13 13:38:28 2012f myDetector.Clear(); - //modified by NIZNHY-PKV Tue Mar 13 13:38:30 2012t } -//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f //======================================================================= //function : StickedShapes //purpose : @@ -98,12 +95,12 @@ const TopTools_IndexedDataMapOfShapeListOfShape& { return myDetector.StickedShapes(); } -//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t //======================================================================= //function : SetShapesToGlue //purpose : //======================================================================= -void GEOMAlgo_Gluer2::SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM) +void GEOMAlgo_Gluer2::SetShapesToGlue + (const TopTools_DataMapOfShapeListOfShape& aM) { myShapesToGlue=aM; } @@ -241,6 +238,7 @@ void GEOMAlgo_Gluer2::CheckData() myWarningStatus=0; // aNbSG=myShapesToGlue.Extent(); + aType=TopAbs_SHAPE; if (aNbSG) { // Check myShapesToGlue aItDMSLS.Initialize(myShapesToGlue); @@ -587,6 +585,7 @@ void GEOMAlgo_Gluer2::BuildResult() myErrorStatus=0; myWarningStatus=0; // + bHasImage=Standard_False; aItC.Initialize(myArgument); for (; aItC.More(); aItC.Next()) { const TopoDS_Shape& aCx=aItC.Value(); diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfDef.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfDef.hxx new file mode 100644 index 000000000..fab59298a --- /dev/null +++ b/src/GEOMAlgo/GEOMAlgo_KindOfDef.hxx @@ -0,0 +1,37 @@ +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +//GEOMAlgo_KindOfDef +#ifndef _GEOMAlgo_KindOfDef_HeaderFile +#define _GEOMAlgo_KindOfDef_HeaderFile + + +enum GEOMAlgo_KindOfDef { +GEOMAlgo_KD_UNKNOWN, +GEOMAlgo_KD_SPECIFIED, +GEOMAlgo_KD_ARBITRARY +}; + +#ifndef _Standard_PrimitiveTypes_HeaderFile +#include +#endif + +#endif diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx index eda5fba08..cf012663e 100644 --- a/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx +++ b/src/GEOMAlgo/GEOMAlgo_KindOfName.hxx @@ -44,7 +44,8 @@ GEOMAlgo_KN_DISKELLIPSE, GEOMAlgo_KN_RECTANGLE, GEOMAlgo_KN_TRIANGLE, GEOMAlgo_KN_QUADRANGLE, -GEOMAlgo_KN_ARCELLIPSE +GEOMAlgo_KN_ARCELLIPSE, +GEOMAlgo_KN_SOLID }; #ifndef _Standard_PrimitiveTypes_HeaderFile diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx index 32efa59c9..382fdef6a 100644 --- a/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx +++ b/src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx @@ -35,9 +35,7 @@ GEOMAlgo_KS_PLANE, GEOMAlgo_KS_CIRCLE, GEOMAlgo_KS_LINE, GEOMAlgo_KS_DEGENERATED, -//modified by NIZNHY-PKV Tue Jul 03 10:28:09 2012f GEOMAlgo_KS_BSPLINE -//modified by NIZNHY-PKV Tue Jul 03 10:28:11 2012t }; #ifndef _Standard_PrimitiveTypes_HeaderFile diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx index b91eb9728..fe4b7f69b 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx @@ -29,6 +29,8 @@ static void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB); static void DumpKindOfName(const GEOMAlgo_KindOfName aKS); +static + void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD); static void DumpPosition(const gp_Ax3& aAx3); static @@ -39,7 +41,7 @@ static //function : //purpose : //======================================================================= - GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo() +GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo() { Reset(); } @@ -47,14 +49,14 @@ static //function : ~ //purpose : //======================================================================= - GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo() +GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo() { } //======================================================================= //function : Reset //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::Reset() +void GEOMAlgo_ShapeInfo::Reset() { Standard_Integer i; // @@ -69,6 +71,7 @@ static myKindOfBounds=GEOMAlgo_KB_UNKNOWN; myKindOfClosed=GEOMAlgo_KC_UNKNOWN; myKindOfName=GEOMAlgo_KN_UNKNOWN; + myKindOfDef=GEOMAlgo_KD_UNKNOWN; // myLocation.SetCoord(99., 99., 99.); myDirection.SetCoord(1.,0.,0.); @@ -83,7 +86,7 @@ static //function : SetType //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType) +void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType) { myType=aType; } @@ -91,7 +94,7 @@ static //function : Type //purpose : //======================================================================= - TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const +TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const { return myType; } @@ -99,8 +102,8 @@ static //function : SetNbSubShapes //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetNbSubShapes(const TopAbs_ShapeEnum aType, - const Standard_Integer aNb) +void GEOMAlgo_ShapeInfo::SetNbSubShapes(const TopAbs_ShapeEnum aType, + const Standard_Integer aNb) { Standard_Integer iN; @@ -113,7 +116,8 @@ static //function : NbSubShapes //purpose : //======================================================================= - Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes(const TopAbs_ShapeEnum aType) const +Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes + (const TopAbs_ShapeEnum aType) const { Standard_Integer iN; @@ -127,7 +131,7 @@ static //function : SetKindOfShape //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetKindOfShape(const GEOMAlgo_KindOfShape aT) +void GEOMAlgo_ShapeInfo::SetKindOfShape(const GEOMAlgo_KindOfShape aT) { myKindOfShape=aT; } @@ -135,7 +139,7 @@ static //function : KindOfShape //purpose : //======================================================================= - GEOMAlgo_KindOfShape GEOMAlgo_ShapeInfo::KindOfShape() const +GEOMAlgo_KindOfShape GEOMAlgo_ShapeInfo::KindOfShape() const { return myKindOfShape; } @@ -143,7 +147,7 @@ static //function : SetKindOfName //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetKindOfName(const GEOMAlgo_KindOfName aT) +void GEOMAlgo_ShapeInfo::SetKindOfName(const GEOMAlgo_KindOfName aT) { myKindOfName=aT; } @@ -151,7 +155,7 @@ static //function : KindOfName //purpose : //======================================================================= - GEOMAlgo_KindOfName GEOMAlgo_ShapeInfo::KindOfName() const +GEOMAlgo_KindOfName GEOMAlgo_ShapeInfo::KindOfName() const { return myKindOfName; } @@ -159,7 +163,7 @@ static //function : SetKindOfBounds //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetKindOfBounds(const GEOMAlgo_KindOfBounds aT) +void GEOMAlgo_ShapeInfo::SetKindOfBounds(const GEOMAlgo_KindOfBounds aT) { myKindOfBounds=aT; } @@ -167,7 +171,7 @@ static //function : KindOfBounds //purpose : //======================================================================= - GEOMAlgo_KindOfBounds GEOMAlgo_ShapeInfo::KindOfBounds() const +GEOMAlgo_KindOfBounds GEOMAlgo_ShapeInfo::KindOfBounds() const { return myKindOfBounds; } @@ -175,7 +179,7 @@ static //function : SetKindOfClosed //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetKindOfClosed(const GEOMAlgo_KindOfClosed aT) +void GEOMAlgo_ShapeInfo::SetKindOfClosed(const GEOMAlgo_KindOfClosed aT) { myKindOfClosed=aT; } @@ -183,15 +187,31 @@ static //function : KindOfClosed //purpose : //======================================================================= - GEOMAlgo_KindOfClosed GEOMAlgo_ShapeInfo::KindOfClosed() const +GEOMAlgo_KindOfClosed GEOMAlgo_ShapeInfo::KindOfClosed() const { return myKindOfClosed; } //======================================================================= +//function : SetKindOfDef +//purpose : +//======================================================================= +void GEOMAlgo_ShapeInfo::SetKindOfDef(const GEOMAlgo_KindOfDef aT) +{ + myKindOfDef=aT; +} +//======================================================================= +//function : KindOfDef +//purpose : +//======================================================================= +GEOMAlgo_KindOfDef GEOMAlgo_ShapeInfo::KindOfDef() const +{ + return myKindOfDef; +} +//======================================================================= //function : SetLocation //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetLocation(const gp_Pnt& aP) +void GEOMAlgo_ShapeInfo::SetLocation(const gp_Pnt& aP) { myLocation=aP; } @@ -199,7 +219,7 @@ static //function : Location //purpose : //======================================================================= - const gp_Pnt& GEOMAlgo_ShapeInfo::Location() const +const gp_Pnt& GEOMAlgo_ShapeInfo::Location() const { return myLocation; } @@ -207,7 +227,7 @@ static //function : SetDirection //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetDirection(const gp_Dir& aD) +void GEOMAlgo_ShapeInfo::SetDirection(const gp_Dir& aD) { myDirection=aD; } @@ -215,7 +235,7 @@ static //function : Direction //purpose : //======================================================================= - const gp_Dir& GEOMAlgo_ShapeInfo::Direction() const +const gp_Dir& GEOMAlgo_ShapeInfo::Direction() const { return myDirection; } @@ -223,7 +243,7 @@ static //function : SetPosition //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax2& aAx2) +void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax2& aAx2) { gp_Ax3 aAx3(aAx2); SetPosition(aAx3); @@ -232,7 +252,7 @@ static //function : SetPosition //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax3& aAx3) +void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax3& aAx3) { myPosition=aAx3; } @@ -240,7 +260,7 @@ static //function : Position //purpose : //======================================================================= - const gp_Ax3& GEOMAlgo_ShapeInfo::Position() const +const gp_Ax3& GEOMAlgo_ShapeInfo::Position() const { return myPosition; } @@ -249,7 +269,7 @@ static //function : SetPnt1 //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetPnt1(const gp_Pnt& aP) +void GEOMAlgo_ShapeInfo::SetPnt1(const gp_Pnt& aP) { myPnt1=aP; } @@ -257,7 +277,7 @@ static //function : Pnt1 //purpose : //======================================================================= - const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt1() const +const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt1() const { return myPnt1; } @@ -265,7 +285,7 @@ static //function : SetPnt2 //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetPnt2(const gp_Pnt& aP) +void GEOMAlgo_ShapeInfo::SetPnt2(const gp_Pnt& aP) { myPnt2=aP; } @@ -273,7 +293,7 @@ static //function : Pnt2 //purpose : //======================================================================= - const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt2() const +const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt2() const { return myPnt2; } @@ -281,7 +301,7 @@ static //function : SetRadius1 //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetRadius1(const Standard_Real aR) +void GEOMAlgo_ShapeInfo::SetRadius1(const Standard_Real aR) { myRadius1=aR; } @@ -289,7 +309,7 @@ static //function : Radius1 //purpose : //======================================================================= - Standard_Real GEOMAlgo_ShapeInfo::Radius1() const +Standard_Real GEOMAlgo_ShapeInfo::Radius1() const { return myRadius1; } @@ -297,7 +317,7 @@ static //function : SetRadius2 //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetRadius2(const Standard_Real aR) +void GEOMAlgo_ShapeInfo::SetRadius2(const Standard_Real aR) { myRadius2=aR; } @@ -305,7 +325,7 @@ static //function : Radius2 //purpose : //======================================================================= - Standard_Real GEOMAlgo_ShapeInfo::Radius2() const +Standard_Real GEOMAlgo_ShapeInfo::Radius2() const { return myRadius2; } @@ -313,7 +333,7 @@ static //function : SetLength //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetLength(const Standard_Real aL) +void GEOMAlgo_ShapeInfo::SetLength(const Standard_Real aL) { myLength=aL; } @@ -321,7 +341,7 @@ static //function : Length //purpose : //======================================================================= - Standard_Real GEOMAlgo_ShapeInfo::Length() const +Standard_Real GEOMAlgo_ShapeInfo::Length() const { return myLength; } @@ -329,7 +349,7 @@ static //function : SetWidth //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetWidth(const Standard_Real aW) +void GEOMAlgo_ShapeInfo::SetWidth(const Standard_Real aW) { myWidth=aW; } @@ -337,7 +357,7 @@ static //function : Width //purpose : //======================================================================= - Standard_Real GEOMAlgo_ShapeInfo::Width() const +Standard_Real GEOMAlgo_ShapeInfo::Width() const { return myWidth; } @@ -345,7 +365,7 @@ static //function : SetHeight //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::SetHeight(const Standard_Real aH) +void GEOMAlgo_ShapeInfo::SetHeight(const Standard_Real aH) { myHeight=aH; } @@ -353,7 +373,7 @@ static //function : Height //purpose : //======================================================================= - Standard_Real GEOMAlgo_ShapeInfo::Height() const +Standard_Real GEOMAlgo_ShapeInfo::Height() const { return myHeight; } @@ -372,7 +392,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) //function : Dump //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::Dump()const +void GEOMAlgo_ShapeInfo::Dump()const { switch (myType) { // @@ -417,7 +437,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) //function : DumpCompound //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::DumpCompound()const +void GEOMAlgo_ShapeInfo::DumpCompound()const { Standard_Integer aNbV, aNbE, aNbF, aNbS, aNbC, aNbP; GEOMAlgo_KindOfShape aKS; @@ -452,7 +472,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) //function : DumpCompSolid //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::DumpCompSolid()const +void GEOMAlgo_ShapeInfo::DumpCompSolid()const { Standard_Integer aNbV, aNbE, aNbF, aNbS; GEOMAlgo_KindOfShape aKS; @@ -479,12 +499,11 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) DumpKindOfBounds(aKB); DumpKindOfClosed(aKC); } - //======================================================================= //function : DumpSolid //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::DumpSolid()const +void GEOMAlgo_ShapeInfo::DumpSolid()const { Standard_Integer aNbV, aNbE, aNbF; GEOMAlgo_KindOfShape aKS; @@ -545,18 +564,18 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) printf(" Height : %.3lf\n", myHeight); } } - //======================================================================= //function : DumpFace //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::DumpFace()const +void GEOMAlgo_ShapeInfo::DumpFace()const { Standard_Integer aNbV, aNbE; GEOMAlgo_KindOfShape aKS; GEOMAlgo_KindOfName aKN; GEOMAlgo_KindOfBounds aKB; GEOMAlgo_KindOfClosed aKC; + GEOMAlgo_KindOfDef aKD; // aNbV=NbSubShapes(TopAbs_VERTEX); aNbE=NbSubShapes(TopAbs_EDGE); @@ -564,6 +583,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) aKN=KindOfName(); aKB=KindOfBounds(); aKC=KindOfClosed(); + aKD=KindOfDef(); // printf(" *FACE\n"); printf(" number of vertices: %d\n", aNbV); @@ -572,6 +592,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) DumpKindOfName (aKN); DumpKindOfBounds(aKB); DumpKindOfClosed(aKC); + DumpKindOfDef(aKD); // // PLANE if (aKN==GEOMAlgo_KN_PLANE) { @@ -641,7 +662,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) //function : DumpShell //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::DumpShell()const +void GEOMAlgo_ShapeInfo::DumpShell()const { Standard_Integer aNbV, aNbE, aNbF; GEOMAlgo_KindOfClosed aKC; @@ -662,7 +683,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) //function : DumpWire //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::DumpWire()const +void GEOMAlgo_ShapeInfo::DumpWire()const { Standard_Integer aNbV, aNbE; GEOMAlgo_KindOfClosed aKC; @@ -682,7 +703,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) //function : DumpEdge //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::DumpEdge()const +void GEOMAlgo_ShapeInfo::DumpEdge()const { Standard_Integer aNbV; Standard_Real aX, aY, aZ; @@ -755,7 +776,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) //function : DumpVertex //purpose : //======================================================================= - void GEOMAlgo_ShapeInfo::DumpVertex()const +void GEOMAlgo_ShapeInfo::DumpVertex()const { printf(" *VERTEX\n"); DumpLocation(myLocation); @@ -764,7 +785,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) //function : DumpLocation //purpose : //======================================================================= - void DumpLocation(const gp_Pnt& aP) +void DumpLocation(const gp_Pnt& aP) { Standard_Real aX, aY, aZ; // @@ -775,7 +796,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType) //function : DumpDirection //purpose : //======================================================================= - void DumpDirection(const gp_Dir& aD) +void DumpDirection(const gp_Dir& aD) { Standard_Real aX, aY, aZ; // @@ -881,10 +902,27 @@ void DumpKindOfName(const GEOMAlgo_KindOfName aKS) "KN_RECTANGLE", "KN_TRIANGLE", "KN_QUADRANGLE", - "KN_ARCELLIPSE" + "KN_ARCELLIPSE", + "KN_SOLID" }; int i; // i=(Standard_Integer)aKS; printf(" KindOfName : %s\n", pStr[i]); } +//======================================================================= +//function : DumpKindOfDef +//purpose : +//======================================================================= +void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD) +{ + const char *pStr[]={ + "KD_UNKNOWN", + "KD_SPECIFIED", + "KB_ARBITRARY" + }; + int i; + // + i=(Standard_Integer)aKD; + printf(" KindOfDef: %s\n", pStr[i]); +} diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.hxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.hxx index 827370343..0556e68d4 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfo.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfo.hxx @@ -37,6 +37,7 @@ #include #include #include +#include //======================================================================= @@ -62,7 +63,8 @@ class GEOMAlgo_ShapeInfo TopAbs_ShapeEnum Type() const; Standard_EXPORT - void SetNbSubShapes(const TopAbs_ShapeEnum aType,const Standard_Integer aNb) ; + void SetNbSubShapes(const TopAbs_ShapeEnum aType, + const Standard_Integer aNb) ; Standard_EXPORT Standard_Integer NbSubShapes(const TopAbs_ShapeEnum aType) const; @@ -91,6 +93,12 @@ class GEOMAlgo_ShapeInfo Standard_EXPORT GEOMAlgo_KindOfClosed KindOfClosed() const; + Standard_EXPORT + void SetKindOfDef(const GEOMAlgo_KindOfDef aT) ; + + Standard_EXPORT + GEOMAlgo_KindOfDef KindOfDef() const; + Standard_EXPORT void SetLocation(const gp_Pnt& aP) ; @@ -189,6 +197,7 @@ class GEOMAlgo_ShapeInfo GEOMAlgo_KindOfName myKindOfName; GEOMAlgo_KindOfBounds myKindOfBounds; GEOMAlgo_KindOfClosed myKindOfClosed; + GEOMAlgo_KindOfDef myKindOfDef; gp_Pnt myLocation; gp_Dir myDirection; gp_Ax3 myPosition; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx index 84a4f4322..e440912b6 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx @@ -59,7 +59,7 @@ //function : //purpose : //======================================================================= - GEOMAlgo_ShapeInfoFiller::GEOMAlgo_ShapeInfoFiller() +GEOMAlgo_ShapeInfoFiller::GEOMAlgo_ShapeInfoFiller() : GEOMAlgo_Algo() { @@ -69,14 +69,14 @@ //function : ~ //purpose : //======================================================================= - GEOMAlgo_ShapeInfoFiller::~GEOMAlgo_ShapeInfoFiller() +GEOMAlgo_ShapeInfoFiller::~GEOMAlgo_ShapeInfoFiller() { } //======================================================================= //function : SetTolerance //purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::SetTolerance(const Standard_Real aT) +void GEOMAlgo_ShapeInfoFiller::SetTolerance(const Standard_Real aT) { myTolerance=aT; } @@ -84,7 +84,7 @@ //function : Tolerance //purpose : //======================================================================= - Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const +Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const { return myTolerance; } @@ -92,7 +92,7 @@ //function : SetShape //purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS) +void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS) { myShape=aS; } @@ -100,7 +100,7 @@ //function : Shape //purpose : //======================================================================= - const TopoDS_Shape& GEOMAlgo_ShapeInfoFiller::Shape() const +const TopoDS_Shape& GEOMAlgo_ShapeInfoFiller::Shape() const { return myShape; } @@ -108,7 +108,7 @@ //function : Info //purpose : //======================================================================= - const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info() const +const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info() const { return Info(myShape); } @@ -116,7 +116,8 @@ //function : Info //purpose : //======================================================================= - const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info(const TopoDS_Shape& aS) const +const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info + (const TopoDS_Shape& aS) const { if (!aS.IsNull()) { if (myMapInfo.Contains(aS)) { @@ -131,7 +132,7 @@ //function : CheckData //purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::CheckData() +void GEOMAlgo_ShapeInfoFiller::CheckData() { myErrorStatus=0; // @@ -144,7 +145,7 @@ //function : Perform //purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::Perform() +void GEOMAlgo_ShapeInfoFiller::Perform() { myErrorStatus=0; // @@ -161,7 +162,7 @@ //function :FillShape //purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillShape(const TopoDS_Shape& aS) +void GEOMAlgo_ShapeInfoFiller::FillShape(const TopoDS_Shape& aS) { TopAbs_ShapeEnum aType; // @@ -199,7 +200,7 @@ //function :FillSubShapes //purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillSubShapes(const TopoDS_Shape& aS) +void GEOMAlgo_ShapeInfoFiller::FillSubShapes(const TopoDS_Shape& aS) { TopoDS_Iterator aIt; // @@ -213,7 +214,7 @@ //function : FillContainer //purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillContainer(const TopoDS_Shape& aS) +void GEOMAlgo_ShapeInfoFiller::FillContainer(const TopoDS_Shape& aS) { myErrorStatus=0; // @@ -258,9 +259,8 @@ //function : FillSolid //purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS) +void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS) { - Standard_Integer aNbShells; TopoDS_Solid aSd; // myErrorStatus=0; @@ -280,40 +280,32 @@ // aSd=TopoDS::Solid(aS); // - aNbShells=GEOMAlgo_ShapeInfoFiller::NbShells(aSd); - if (aNbShells>1) { - return; - } - // FillDetails(aSd); } //======================================================================= //function :FillFace //purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS) +void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS) { myErrorStatus=0; + if (myMapInfo.Contains(aS)) { + return; + } // Standard_Boolean bIsAllowedType; - Standard_Integer aNbWires;//, iRet Standard_Boolean bInf, bInfU1, bInfU2, bInfV1, bInfV2; - Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2; + Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2, dV; gp_Pnt aP0; gp_Dir aDN; gp_Ax3 aAx3; GeomAbs_SurfaceType aST; Handle(Geom_Surface) aSurf; TopoDS_Face aF; - //GEOMAlgo_KindOfName aKindOfName; //---------------------------------------------------- - if (myMapInfo.Contains(aS)) { - return; - } - else { - GEOMAlgo_ShapeInfo aInfoX; - myMapInfo.Add(aS, aInfoX); - } + GEOMAlgo_ShapeInfo aInfoX; + myMapInfo.Add(aS, aInfoX); + // GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS); //---------------------------------------------------- aInfo.SetType(TopAbs_FACE); @@ -324,8 +316,6 @@ // aF=TopoDS::Face(aS); // - aNbWires=GEOMAlgo_ShapeInfoFiller::NbWires(aF); - // aSurf=BRep_Tool::Surface(aF); GeomAdaptor_Surface aGAS(aSurf); aST=aGAS.GetType(); @@ -334,6 +324,7 @@ return; } // + //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // 1. Plane if (aST==GeomAbs_Plane) { gp_Pln aPln; @@ -342,16 +333,12 @@ aP0=aPln.Location(); aAx3=aPln.Position(); // - aInfo.SetKindOfShape(GEOMAlgo_KS_PLANE); + aInfo.SetKindOfShape(GEOMAlgo_KS_PLANE); + aInfo.SetKindOfName(GEOMAlgo_KN_PLANE); aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED); aInfo.SetLocation(aP0); aInfo.SetPosition(aAx3); // - if (aNbWires>1) { - return; - } - // - //aSurf->Bounds(aUMin, aUMax, aVMin, aVMax); BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); bInfU1=Precision::IsNegativeInfinite(aUMin); bInfU2=Precision::IsPositiveInfinite(aUMax); @@ -361,14 +348,15 @@ bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); if (bInf) { aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); + return; } - else { - aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); - } + // + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); // FillDetails(aF, aPln); }// if (aCT==GeomAbs_Line) { // + //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // 2. Sphere else if (aST==GeomAbs_Sphere) { gp_Sphere aSphere; @@ -379,20 +367,18 @@ aR1=aSphere.Radius(); // aInfo.SetKindOfShape(GEOMAlgo_KS_SPHERE); + aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE); aInfo.SetLocation(aP0); aInfo.SetPosition(aAx3); aInfo.SetRadius1(aR1); // - if (aNbWires>1) { - return; - } - // aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED); // FillDetails(aF, aSphere); }// else if (aST==GeomAbs_Sphere) { // + //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // 3. Cylinder else if (aST==GeomAbs_Cylinder) { gp_Cylinder aCyl; @@ -403,14 +389,11 @@ aR1=aCyl.Radius(); // aInfo.SetKindOfShape(GEOMAlgo_KS_CYLINDER); + aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER); aInfo.SetLocation(aP0); aInfo.SetPosition(aAx3); aInfo.SetRadius1(aR1); // - if (aNbWires>1) { - return; - } - // BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); bInfU1=Precision::IsNegativeInfinite(aUMin); bInfU2=Precision::IsPositiveInfinite(aUMax); @@ -420,30 +403,31 @@ bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); if (bInf) { aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); + return; } - else { - aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); - } + // + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + // + dV=aVMax-aVMin; + aInfo.SetHeight(dV); + // FillDetails(aF, aCyl); } // + //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // 4. Cone else if (aST==GeomAbs_Cone) { + Standard_Real aSemiAngle; gp_Cone aCone; // aCone=aGAS.Cone(); aP0=aCone.Location(); aAx3=aCone.Position(); - //aR1=aCyl.Radius(); // aInfo.SetKindOfShape(GEOMAlgo_KS_CONE); + aInfo.SetKindOfName(GEOMAlgo_KN_CONE); aInfo.SetLocation(aP0); aInfo.SetPosition(aAx3); - //aInfo.SetRadius1(aR1); - // - if (aNbWires>1) { - return; - } // BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax); bInfU1=Precision::IsNegativeInfinite(aUMin); @@ -454,13 +438,20 @@ bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2); if (bInf) { aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE); + return; } - else { - aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); - } + // + aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); + // + aSemiAngle=fabs(aCone.SemiAngle()); + dV=(aVMax-aVMin)*cos(aSemiAngle); + + aInfo.SetHeight(dV); + // FillDetails(aF, aCone); } // + //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // 5. Torus else if (aST==GeomAbs_Torus) { gp_Torus aTorus; @@ -472,15 +463,12 @@ aR2=aTorus.MinorRadius(); // aInfo.SetKindOfShape(GEOMAlgo_KS_TORUS); + aInfo.SetKindOfName(GEOMAlgo_KN_TORUS); aInfo.SetLocation(aP0); aInfo.SetPosition(aAx3); aInfo.SetRadius1(aR1); aInfo.SetRadius2(aR2); // - if (aNbWires>1) { - return; - } - // aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED); // FillDetails(aF, aTorus); @@ -535,7 +523,6 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS) FillSubShapes(aS); return; } - //modified by NIZNHY-PKV Tue Jul 03 10:19:03 2012f // BSplineCurve if (aCT==GeomAbs_BSplineCurve) { Standard_Integer aNbKnots, aNbPoles, aDegree; @@ -577,7 +564,6 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS) aInfo.SetDirection(aDir); } } - //modified by NIZNHY-PKV Tue Jul 03 10:19:06 2012t // Line else if (aCT==GeomAbs_Line) { Standard_Boolean bInf1, bInf2; @@ -712,7 +698,7 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS) //function :FillVertex //purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS) +void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS) { myErrorStatus=0; // @@ -739,8 +725,8 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS) //function : FillNbSubshapes //purpose : //======================================================================= - void GEOMAlgo_ShapeInfoFiller::FillNbSubShapes(const TopoDS_Shape& aS, - GEOMAlgo_ShapeInfo& aInfo) +void GEOMAlgo_ShapeInfoFiller::FillNbSubShapes(const TopoDS_Shape& aS, + GEOMAlgo_ShapeInfo& aInfo) { myErrorStatus=0; // @@ -776,7 +762,8 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS) //function :NbShells //purpose : //======================================================================= -Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd) +Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells + (const TopoDS_Solid& aSd) { Standard_Integer iCnt; TopoDS_Iterator aIt; @@ -785,7 +772,6 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd) // aIt.Initialize(aSd); for (; aIt.More(); aIt.Next()) { - //const TopoDS_Shape& aSh=aIt.Value(); ++iCnt; } return iCnt; @@ -794,7 +780,8 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd) //function : NbWires //purpose : //======================================================================= -Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF) +Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires + (const TopoDS_Face& aF) { Standard_Integer iCnt; TopoDS_Iterator aIt; @@ -803,7 +790,6 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF) // aIt.Initialize(aF); for (; aIt.More(); aIt.Next()) { - //const TopoDS_Shape& aW=aIt.Value(); ++iCnt; } return iCnt; @@ -812,7 +798,8 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF) //function : IsAllowedType //purpose : //======================================================================= -Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType aCT) +Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType + (const GeomAbs_CurveType aCT) { Standard_Boolean bRet; Standard_Integer i, aNb; @@ -820,7 +807,7 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType GeomAbs_Line, GeomAbs_Circle, GeomAbs_Ellipse, - GeomAbs_BSplineCurve //modified by NIZNHY-PKV Tue Jul 03 10:18:01 2012ft + GeomAbs_BSplineCurve }; // bRet=Standard_False; @@ -834,7 +821,8 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType //function : IsAllowedType //purpose : //======================================================================= -Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_SurfaceType aST) +Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType + (const GeomAbs_SurfaceType aST) { Standard_Boolean bRet; Standard_Integer i, aNb; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx old mode 100644 new mode 100755 index 77fb5e0c6..7c4a9b2de --- a/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx @@ -68,10 +68,12 @@ static void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd) { Standard_Boolean bIsStepSphere; - Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct, aNbCrc, aNbX; + Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct; + Standard_Integer aNbShells, aNbCrc, aNbX; TopoDS_Shape aFCyl, aFCon; TopTools_IndexedMapOfShape aMF; GEOMAlgo_KindOfName aKNF; + GEOMAlgo_KindOfDef aKD; // GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aSd); aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN); @@ -83,7 +85,37 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd) return; } // + //modified by NIZNHY-PKV Tue Jun 09 08:35:23 2015f + if (aNbF==2) { + // case requested by the customer + // specific solid that should be treated as a sphere + bIsStepSphere=TreatStepSphere(aSd); + if (bIsStepSphere) { + return; + } + } + //modified by NIZNHY-PKV Tue Jun 09 08:35:28 2015t + // + aKD=GEOMAlgo_KD_SPECIFIED; + for (i=1; i<=aNbF && aKD==GEOMAlgo_KD_SPECIFIED; ++i) { + const TopoDS_Shape& aF=aMF(i); + GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF); + aKD=aInfoF.KindOfDef(); + } + if (aKD!=GEOMAlgo_KD_SPECIFIED) { + aInfo.SetKindOfName(GEOMAlgo_KN_SOLID); + return; + } + // + aNbShells=GEOMAlgo_ShapeInfoFiller::NbShells(aSd); + if (aNbShells>1) { + aInfo.SetKindOfName(GEOMAlgo_KN_SOLID); + return; + } + // + // if (aNbF==1) { + // mb: sphere, torus const TopoDS_Shape& aF=aMF(1); GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF); aKNF=aInfoF.KindOfName(); // mb: sphere, torus @@ -99,7 +131,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd) return; } } - //modified by NIZNHY-PKV Tue Jul 03 13:23:55 2012f + //modified by NIZNHY-PKV Tue Jun 09 08:36:08 2015f + /* else if (aNbF==2) { // specific solid that should be treated as a sphere bIsStepSphere=TreatStepSphere(aSd); @@ -107,7 +140,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd) return; } } - //modified by NIZNHY-PKV Tue Jul 03 13:23:57 2012t + */ + //modified by NIZNHY-PKV Tue Jun 09 08:36:12 2015t // aNbCyl=0; aNbCon=0; @@ -229,11 +263,9 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd) const gp_Dir& aDNj=aIFj.Position().Direction(); // aDot=aDNi*aDNj; - //modified by NIZNHY-PKV Tue Jul 03 10:01:56 2012f if (aDot<0.) { aDot=-aDot; } - //modified by NIZNHY-PKV Tue Jul 03 10:01:52 2012t if (fabs(1.-aDot)<0.0001) { aMp.Add(i); aMp.Add(j); @@ -248,6 +280,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd) return; } // + iMin=-1; + iMax=-1; aDistMin=1.e15; aDistMax=-aDistMin; for (i=0; i myTolerance) { - isRectangle = Standard_False; - break; + if (aNbV==4 && aNbE==4) { + aIt.Initialize(aF); + if (aIt.More()) { + aW=*((TopoDS_Wire*)&aIt.Value()); } - } - // - // rectangle - // shift location to the center - aXYZc.SetCoord(0.,0.,0.); - TopExp::MapShapes(aF, TopAbs_VERTEX, aMV); - for (i=1; i<=aNbV; ++i) { - const TopoDS_Vertex& aV=TopoDS::Vertex(aMV(i)); - aP=BRep_Tool::Pnt(aV); - const gp_XYZ& aXYZ=aP.XYZ(); - aXYZc=aXYZc+aXYZ; - } - // - // Location : aPc in center of rectangle - // Position : 0z is plane normal - // 0x is along the first edge (quadrangle) or - // along length (rectangle) - // - aXYZc.Divide(4.); - aPc.SetXYZ(aXYZc); - aDX=aDx[0]; - aInfo.SetLocation(aPc); + // + aWExp.Init(aW, aF); + for (i=0; aWExp.More(); aWExp.Next(), ++i) { + aEx=aWExp.Current(); + const GEOMAlgo_ShapeInfo& aInfoEx=myMapInfo.FindFromKey(aEx); + aDx[i]=aInfoEx.Direction(); + aPx[i]=aInfoEx.Location(); + } + // + Standard_Boolean isRectangle = Standard_True; + for (i=0; i<4; ++i) { + j=(i==3) ? 0 : i+1; + aDot=aDx[i]*aDx[j]; + if (fabs (aDot) > myTolerance) { + isRectangle = Standard_False; + break; + } + } + // + // rectangle + // shift location to the center + aXYZc.SetCoord(0.,0.,0.); + TopExp::MapShapes(aF, TopAbs_VERTEX, aMV); + for (i=1; i<=aNbV; ++i) { + const TopoDS_Vertex& aV=TopoDS::Vertex(aMV(i)); + aP=BRep_Tool::Pnt(aV); + const gp_XYZ& aXYZ=aP.XYZ(); + aXYZc=aXYZc+aXYZ; + } + // + // Location : aPc in center of rectangle + // Position : 0z is plane normal + // 0x is along the first edge (quadrangle) or + // along length (rectangle) + // + aXYZc.Divide(4.); + aPc.SetXYZ(aXYZc); + aDX=aDx[0]; + aInfo.SetLocation(aPc); - if (isRectangle) { + if (isRectangle) { // Calculate sizes - gp_Lin aL0(aPx[0], aDx[0]); - gp_Lin aL1(aPx[1], aDx[1]); - // - aD0=aL0.Distance(aPc); - aD1=aL1.Distance(aPc); - // - aLength=aD1; - aWidth =aD0; - - if (aD0>aD1) { - aLength=aD0; - aWidth =aD1; - aDX=aDx[1]; + gp_Lin aL0(aPx[0], aDx[0]); + gp_Lin aL1(aPx[1], aDx[1]); + // + aD0=aL0.Distance(aPc); + aD1=aL1.Distance(aPc); + // + aLength=aD1; + aWidth =aD0; + + if (aD0>aD1) { + aLength=aD0; + aWidth =aD1; + aDX=aDx[1]; + } + // + aLength=2.*aLength; + aWidth =2.*aWidth; + // + aInfo.SetLength(aLength); + aInfo.SetWidth(aWidth); + aInfo.SetKindOfName(GEOMAlgo_KN_RECTANGLE); + } else { + aInfo.SetKindOfName(GEOMAlgo_KN_QUADRANGLE); } // - aLength=2.*aLength; - aWidth =2.*aWidth; + const gp_Dir& aDZ=aPln.Axis().Direction(); + gp_Ax2 aAx2(aPc, aDZ, aDX); + gp_Ax3 aAx3(aAx2); + aInfo.SetPosition(aAx3); // - aInfo.SetLength(aLength); - aInfo.SetWidth(aWidth); - aInfo.SetKindOfName(GEOMAlgo_KN_RECTANGLE); - } else { - aInfo.SetKindOfName(GEOMAlgo_KN_QUADRANGLE); - } - // - const gp_Dir& aDZ=aPln.Axis().Direction(); - gp_Ax2 aAx2(aPc, aDZ, aDX); - gp_Ax3 aAx3(aAx2); - aInfo.SetPosition(aAx3); - } - - return; + }// if (aNbV==4 && aNbE==4) { + return; + }// if (bSegment) { + // + //aInfo.SetKindOfName(GEOMAlgo_KN_PLANE); } //======================================================================= //function : FillDetails //purpose : //======================================================================= void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Sphere& ) + const gp_Sphere& )//aSph) { + Standard_Integer aNbV, aNbE, aNbSE, aNbDE; TopoDS_Edge aE; TopExp_Explorer aExp; TopTools_MapOfShape aM; - GEOMAlgo_KindOfShape aKS, aKSE; + GEOMAlgo_KindOfShape aKSE;//, aKSE; // GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); - aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN); - // - aKS=aInfo.KindOfShape(); - if (aKS!=GEOMAlgo_KS_SPHERE) { - return; - } - // + // + aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY); aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); aNbE=aInfo.NbSubShapes(TopAbs_EDGE); - if (!(aNbV==2 && aNbE==3)) { - return; - } - // - aNbSE=0; - aNbDE=0; - aExp.Init(aF, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - aE=TopoDS::Edge(aExp.Current()); - if(aM.Add(aE)) { - const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); - aKSE=aInfoE.KindOfShape(); - // - if (BRep_Tool::IsClosed(aE, aF)) { - ++aNbSE; - } - else if (aKSE==GEOMAlgo_KS_DEGENERATED) { - ++aNbDE; - } - } - } - // - if (!(aNbSE==1 && aNbDE==2)) { - return; - } - aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE); -} -//======================================================================= -//function : FillDetails -//purpose : -//======================================================================= -void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, - const gp_Cone& )//aCone) -{ - Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i; - Standard_Real aR[3], aHeight; - gp_Pnt aPC[3], aPD, aPc, aPX[3]; - TopoDS_Vertex aVD; - TopoDS_Edge aE; - TopoDS_Iterator aIt; - TopExp_Explorer aExp; - TopTools_MapOfShape aM; - GEOMAlgo_KindOfShape aKS, aKSE; - GEOMAlgo_KindOfName aKN, aKNE; - GEOMAlgo_KindOfClosed aKCE; - // - GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); - aKN=GEOMAlgo_KN_UNKNOWN; - aInfo.SetKindOfName(aKN); - // - aKS=aInfo.KindOfShape(); - if (aKS!=GEOMAlgo_KS_CONE) { - return; - } - // - if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) { - return; - } - // - aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); - aNbE=aInfo.NbSubShapes(TopAbs_EDGE); - if (!(aNbV==2 && aNbE==3)) { - return; - } - // - i=0; - aNbCE=0; - aNbSE=0; - aNbDE=0; - aExp.Init(aF, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - aE=TopoDS::Edge(aExp.Current()); - if(aM.Add(aE)) { - const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); - aKNE=aInfoE.KindOfName(); - aKCE=aInfoE.KindOfClosed(); - aKSE=aInfoE.KindOfShape(); - if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) { - aPC[i]=aInfoE.Location(); - aR[i]=aInfoE.Radius1(); + if (aNbV==2 && aNbE==3) { + aNbSE=0; + aNbDE=0; + aExp.Init(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + aE=TopoDS::Edge(aExp.Current()); + if(aM.Add(aE)) { + const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); + aKSE=aInfoE.KindOfShape(); // - aIt.Initialize(aE); - for (; aIt.More(); aIt.Next()) { - aVD=TopoDS::Vertex(aIt.Value()); - break; - } - aPX[i]=BRep_Tool::Pnt(aVD); - // - ++i; - ++aNbCE; - } - else if (aKNE==GEOMAlgo_KN_SEGMENT) { if (BRep_Tool::IsClosed(aE, aF)) { ++aNbSE; } - } - else if (aKSE==GEOMAlgo_KS_DEGENERATED) { - aIt.Initialize(aE); - for (; aIt.More(); aIt.Next()) { - aVD=TopoDS::Vertex(aIt.Value()); - break; + else if (aKSE==GEOMAlgo_KS_DEGENERATED) { + ++aNbDE; } - // - aPD=BRep_Tool::Pnt(aVD); - // - ++aNbDE; } } + // + if (aNbSE==1 && aNbDE==2) { + aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED); + } } - // - if (!((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1)) { - return; - } - // - if (aNbDE==1) { - aPC[1]=aPD; - aR[1]=0.; - } - // - aHeight=aPC[0].Distance(aPC[1]); - // - Standard_Real aRmin, aRmax; - gp_Ax2 aAx2new; - // - if (aR[0]>aR[1]) { - aRmin=aR[1]; - aRmax=aR[0]; - aPc=aPC[0]; - gp_Vec aVz(aPC[0], aPC[1]); - gp_Vec aVx(aPC[0], aPX[0]); - gp_Dir aDz(aVz); - gp_Dir aDx(aVx); - gp_Ax2 aAx2(aPc, aDz, aDx); - aAx2new=aAx2; - } - else { - aRmin=aR[0]; - aRmax=aR[1]; - aPc=aPC[1]; - gp_Vec aVz(aPC[1], aPC[0]); - gp_Vec aVx(aPC[1], aPX[1]); - gp_Dir aDz(aVz); - gp_Dir aDx(aVx); - gp_Ax2 aAx2(aPc, aDz, aDx); - aAx2new=aAx2; - } - // - gp_Ax3 aAx3(aAx2new); - aInfo.SetLocation(aPc); - aInfo.SetPosition(aAx3); - aInfo.SetRadius1(aRmax); - aInfo.SetRadius2(aRmin); - aInfo.SetHeight(aHeight); - // - aInfo.SetKindOfName(GEOMAlgo_KN_CONE); } //======================================================================= //function : FillDetails @@ -667,6 +557,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, //======================================================================= void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, const gp_Cylinder& aCyl) + { Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE; Standard_Real aT0, aT1, aHeight; @@ -674,78 +565,185 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, TopoDS_Edge aE; TopExp_Explorer aExp; TopTools_MapOfShape aM; - GEOMAlgo_KindOfShape aKS; - GEOMAlgo_KindOfName aKN, aKNE; + GEOMAlgo_KindOfName aKNE; GEOMAlgo_KindOfClosed aKCE; // GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); - aKN=GEOMAlgo_KN_UNKNOWN; - aInfo.SetKindOfName(aKN); - // - aKS=aInfo.KindOfShape(); - if (aKS!=GEOMAlgo_KS_CYLINDER) { - return; - } - // - if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) { - return; - } // + aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY); aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); aNbE=aInfo.NbSubShapes(TopAbs_EDGE); - if (!(aNbV==2 && aNbE==3)) { - return; - } - // - i=0; - aNbCE=0; - aNbSE=0; - aExp.Init(aF, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - aE=TopoDS::Edge(aExp.Current()); - if(aM.Add(aE)) { - const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); - aKNE=aInfoE.KindOfName(); - aKCE=aInfoE.KindOfClosed(); - if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) { - aPC[aNbCE]=aInfoE.Location(); - ++aNbCE; - } - else if (aKNE==GEOMAlgo_KN_SEGMENT) { - if (BRep_Tool::IsClosed(aE, aF)) { - ++aNbSE; + if (aNbV==2 && aNbE==3) { + const gp_Ax1& aAx1=aCyl.Axis(); + const gp_Dir& aDir=aAx1.Direction(); + const gp_Pnt& aPLoc=aAx1.Location(); + // + i=0; + aNbCE=0; + aNbSE=0; + aExp.Init(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + aE=TopoDS::Edge(aExp.Current()); + if(aM.Add(aE)) { + const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); + aKNE=aInfoE.KindOfName(); + aKCE=aInfoE.KindOfClosed(); + if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) { + aPC[aNbCE]=aInfoE.Location(); + ++aNbCE; + } + else if (aKNE==GEOMAlgo_KN_SEGMENT) { + if (BRep_Tool::IsClosed(aE, aF)) { + ++aNbSE; + } } } } - } - // - if (!(aNbCE==2 && aNbSE==1)) { - return; - } - // - const gp_Ax1& aAx1=aCyl.Axis(); - const gp_Dir& aDir=aAx1.Direction(); - const gp_Pnt& aPLoc=aAx1.Location(); - gp_Lin aLin(aPLoc, aDir); - // - aT0=ElCLib::Parameter(aLin, aPC[0]); - aT1=ElCLib::Parameter(aLin, aPC[1]); - // - aPc=aPC[0];; - if (aT0>aT1) { - aPc=aPC[1]; - } - aHeight=aPC[0].Distance(aPC[1]); - // - gp_Ax3 aAx3=aCyl.Position(); - aAx3.SetLocation(aPc); - // - aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER); - aInfo.SetPosition(aAx3); - aInfo.SetLocation(aPc); - aInfo.SetHeight(aHeight); + // + if (aNbCE==2 && aNbSE==1) { + gp_Lin aLin(aPLoc, aDir); + // + aT0=ElCLib::Parameter(aLin, aPC[0]); + aT1=ElCLib::Parameter(aLin, aPC[1]); + // + aPc=aPC[0]; + if (aT0>aT1) { + aPc=aPC[1]; + } + aHeight=aPC[0].Distance(aPC[1]); + // + gp_Ax3 aAx3=aCyl.Position(); + aAx3.SetLocation(aPc); + // + aInfo.SetPosition(aAx3); + aInfo.SetLocation(aPc); + aInfo.SetHeight(aHeight); + // + aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED); + return; // conventional cylinder + }//if (aNbCE==2 && aNbSE==1) { + }//if (aNbV==2 && aNbE==3) { +} +//======================================================================= +//function : FillDetails +//purpose : +//======================================================================= +void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, + const gp_Cone& aCone) +{ + Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i; + Standard_Real aR[3], aHeight, aRmin, aRmax; + gp_Pnt aPC[3], aPD, aPc, aPX[3]; + TopoDS_Vertex aVD; + TopoDS_Edge aE; + TopoDS_Iterator aIt; + TopExp_Explorer aExp; + TopTools_MapOfShape aM; + GEOMAlgo_KindOfShape aKSE; + GEOMAlgo_KindOfName aKNE; + GEOMAlgo_KindOfClosed aKCE; + // + GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); + // + aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY); + // + aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); + aNbE=aInfo.NbSubShapes(TopAbs_EDGE); + if (aNbV==2 && aNbE==3) { + i=0; + aNbCE=0; + aNbSE=0; + aNbDE=0; + aExp.Init(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + aE=TopoDS::Edge(aExp.Current()); + if(aM.Add(aE)) { + const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE); + aKNE=aInfoE.KindOfName(); + aKCE=aInfoE.KindOfClosed(); + aKSE=aInfoE.KindOfShape(); + if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) { + aPC[i]=aInfoE.Location(); + aR[i]=aInfoE.Radius1(); + // + aIt.Initialize(aE); + if (aIt.More()) { + aVD=*((TopoDS_Vertex*)&aIt.Value()); + } + aPX[i]=BRep_Tool::Pnt(aVD); + // + ++i; + ++aNbCE; + } + else if (aKNE==GEOMAlgo_KN_SEGMENT) { + if (BRep_Tool::IsClosed(aE, aF)) { + ++aNbSE; + } + } + else if (aKSE==GEOMAlgo_KS_DEGENERATED) { + aIt.Initialize(aE); + if (aIt.More()) { + aVD=*((TopoDS_Vertex*)&aIt.Value()); + } + // + aPD=BRep_Tool::Pnt(aVD); + // + ++aNbDE; + } + } + } + // + if ((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1) { + if (aNbDE==1) { + aPC[1]=aPD; + aR[1]=0.; + } + // + aHeight=aPC[0].Distance(aPC[1]); + // + + gp_Ax2 aAx2new; + // + if (aR[0]>aR[1]) { + aRmin=aR[1]; + aRmax=aR[0]; + aPc=aPC[0]; + gp_Vec aVz(aPC[0], aPC[1]); + gp_Vec aVx(aPC[0], aPX[0]); + gp_Dir aDz(aVz); + gp_Dir aDx(aVx); + gp_Ax2 aAx2(aPc, aDz, aDx); + aAx2new=aAx2; + } + else { + aRmin=aR[0]; + aRmax=aR[1]; + aPc=aPC[1]; + gp_Vec aVz(aPC[1], aPC[0]); + gp_Vec aVx(aPC[1], aPX[1]); + gp_Dir aDz(aVz); + gp_Dir aDx(aVx); + gp_Ax2 aAx2(aPc, aDz, aDx); + aAx2new=aAx2; + } + // + gp_Ax3 aAx3(aAx2new); + aInfo.SetLocation(aPc); + aInfo.SetPosition(aAx3); + aInfo.SetRadius1(aRmax); + aInfo.SetRadius2(aRmin); + aInfo.SetHeight(aHeight); + // + aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED); + return; + }//if ((aNbCE==2 || (aNbCE==1 && aNbDE==1)) && aNbSE==1) { + }//if (aNbV==2 && aNbE==3) { + // + aInfo.SetRadius1 (aCone.RefRadius()); + // + aRmin=0.; // ZZ + aInfo.SetRadius2(aRmin); } - //======================================================================= //function : FillDetails //purpose : @@ -753,6 +751,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, const gp_Torus& ) { + Standard_Integer aNbV, aNbE, aNbSE; TopoDS_Edge aE; TopExp_Explorer aExp; @@ -760,46 +759,43 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF, GEOMAlgo_KindOfShape aKS; // GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF); - aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN); + aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY); // aKS=aInfo.KindOfShape(); if (aKS!=GEOMAlgo_KS_TORUS) { return; } - // + aNbV=aInfo.NbSubShapes(TopAbs_VERTEX); - aNbE=aInfo.NbSubShapes(TopAbs_EDGE); - if (!(aNbV==1 && aNbE==2)) { - return; - } - // - aNbSE=0; - aExp.Init(aF, TopAbs_EDGE); - for (; aExp.More(); aExp.Next()) { - aE=TopoDS::Edge(aExp.Current()); - if (aM.Add(aE)) { - if (BRep_Tool::IsClosed(aE, aF)) { - ++aNbSE; + aNbE=aInfo.NbSubShapes(TopAbs_EDGE); + + if (aNbV==1 && aNbE==2) { + aNbSE=0; + aExp.Init(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + aE=TopoDS::Edge(aExp.Current()); + if (aM.Add(aE)) { + if (BRep_Tool::IsClosed(aE, aF)) { + ++aNbSE; + } } } + // + if (aNbSE==2) { + aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED); + } } - // - if (aNbSE!=2) { - return; - } - aInfo.SetKindOfName(GEOMAlgo_KN_TORUS); } -//modified by NIZNHY-PKV Tue Jul 03 13:29:41 2012f //======================================================================= //function : TreatStepSphere //purpose : //======================================================================= -Standard_Boolean - GEOMAlgo_ShapeInfoFiller::TreatStepSphere(const TopoDS_Solid& aSd) +Standard_Boolean GEOMAlgo_ShapeInfoFiller::TreatStepSphere + (const TopoDS_Solid& aSd) { Standard_Boolean bRet, bIsAllowedType, bOnlyClosed, bIsEqual; Standard_Integer j; - Standard_Real aTolAng, aTolLin; + Standard_Real aTolAng, aTol; Standard_Real aVolume, aVolumeS, dV, aArea, aAreaS, dA; gp_Sphere aSphere[2]; GeomAbs_SurfaceType aST; @@ -808,7 +804,7 @@ Standard_Boolean TopExp_Explorer aExp; // bRet=Standard_False; - aTolLin=Precision::Confusion(); + aTol=Precision::Confusion(); aTolAng=Precision::Angular(); // aExp.Init(aSd, TopAbs_FACE); @@ -829,7 +825,7 @@ Standard_Boolean aSphere[j]=aGAS.Sphere(); } // - bIsEqual=IsEqual(aSphere[0], aSphere[1], aTolLin); + bIsEqual=IsEqual(aSphere[0], aSphere[1], aTol); if (!bIsEqual) { return bRet; } @@ -841,24 +837,30 @@ Standard_Boolean // aVolume=aSphere[0].Volume(); // - BRepGProp::VolumeProperties(aSd, aGProps, bOnlyClosed); + //modified by NIZNHY-PKV Tue Jun 09 08:39:47 2015f + BRepGProp::VolumeProperties(aSd, aGProps, aTol, bOnlyClosed); + //BRepGProp::VolumeProperties(aSd, aGProps, bOnlyClosed); + //modified by NIZNHY-PKV Tue Jun 09 08:39:50 2015t aVolumeS=aGProps.Mass(); if (aVolumeS<0.) { aVolumeS=-aVolumeS; } // dV=fabs(aVolumeS-aVolume); - if (dV>aTolLin) { + if (dV>aTol) { return bRet; } //-------------------------------- aArea=aSphere[0].Area(); // - BRepGProp::SurfaceProperties(aSd, aGProps); + //modified by NIZNHY-PKV Tue Jun 09 08:23:54 2015f + BRepGProp::SurfaceProperties(aSd, aGProps, aTol); + //BRepGProp::SurfaceProperties(aSd, aGProps); + //modified by NIZNHY-PKV Tue Jun 09 08:23:56 2015t aAreaS=aGProps.Mass(); // dA=fabs(aAreaS-aArea); - if (dA>aTolLin) { + if (dA>aTol) { return bRet; } // @@ -906,4 +908,3 @@ Standard_Boolean IsEqual(const gp_Sphere& aSp1, // return bRet; } -//modified by NIZNHY-PKV Tue Jul 03 13:29:43 2012t diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx index 3749b7cd7..964ea96cd 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx @@ -245,7 +245,7 @@ void GEOMAlgo_ShellSolid::Perform() const BOPDS_IndexRange& aRange=pDS->Range(iRank); aRange.Indices(iBeg, iEnd); const TopoDS_Solid& aSolid=(!iRank) ? *((TopoDS_Solid*)&aTool) : *((TopoDS_Solid*)&aObj); - BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid); + //BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid); // //------------------------------ShellSolidBuilder GEOMAlgo_ShellSolidBuilder aSSB; @@ -264,50 +264,50 @@ void GEOMAlgo_ShellSolid::Perform() const TopoDS_Shape& aS=pDS->Shape(i); aType=aS.ShapeType(); if (aType!=TopAbs_FACE) { - continue; + continue; } // aState=TopAbs_UNKNOWN; aF=*((TopoDS_Face*)&aS); // if (!aImages.IsBound(aS)) { - iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D); - if (iErr) { - myErrorStatus=16; - return; - } - // - aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx); + iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D); + if (iErr) { + myErrorStatus=16; + return; + } + // + aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx); } else { - const BOPCol_ListOfShape& aLSp=aImages.Find(aS); - aNbSp=aLSp.Extent(); - if (aNbSp>0) { - continue; - } - // - if (aNbSp==1) { - aF=*((TopoDS_Face*)&aLSp.First()); - } - // - iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D); - if (iErr) { - myErrorStatus=16; - return; - } - // - aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx); + const BOPCol_ListOfShape& aLSp=aImages.Find(aS); + aNbSp=aLSp.Extent(); + if (aNbSp>0) { + continue; + } + // + if (aNbSp==1) { + aF=*((TopoDS_Face*)&aLSp.First()); + } + // + iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D); + if (iErr) { + myErrorStatus=16; + return; + } + // + aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx); } //---------- if (aState==TopAbs_ON) { - myLSON.Append(aF); + myLSON.Append(aF); } else if (aState==TopAbs_OUT) { - myLSOUT.Append(aF); + myLSOUT.Append(aF); } else if (aState==TopAbs_IN) { - myLSIN.Append(aF); - } + myLSIN.Append(aF); + } //---------- }//for (i=iBeg; i<=iEnd; ++i) { diff --git a/src/GEOMAlgo/GEOMAlgo_Splitter.cxx b/src/GEOMAlgo/GEOMAlgo_Splitter.cxx old mode 100755 new mode 100644 index 4bbcf5c48..f48c5e193 --- a/src/GEOMAlgo/GEOMAlgo_Splitter.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Splitter.cxx @@ -301,7 +301,7 @@ void TreatCompound(const TopoDS_Shape& aC1, TopoDS_Iterator aItC; // aLC.Append (aC1); - while(1) { + for(;;) { aLC1.Clear(); aIt.Initialize(aLC); for (; aIt.More(); aIt.Next()) { diff --git a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx index 59cfe94ad..4a02ac4be 100644 --- a/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx +++ b/src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx @@ -48,10 +48,11 @@ //function : GetState //purpose : //======================================================================= - Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP, - const GeomAdaptor_Surface& aGAS, - const Standard_Real aTol, - TopAbs_State& aState) + Standard_Integer GEOMAlgo_SurfaceTools::GetState + (const gp_Pnt& aP, + const GeomAdaptor_Surface& aGAS, + const Standard_Real aTol, + TopAbs_State& aState) { Standard_Integer iErr = 0; GeomAbs_SurfaceType aType = aGAS.GetType(); @@ -95,10 +96,11 @@ //function : GetState //purpose : //======================================================================= - Standard_Integer GEOMAlgo_SurfaceTools::GetState(const gp_Pnt& aP, - const Handle(Geom_Surface)& aSurf, - const Standard_Real aTol, - TopAbs_State& aState) + Standard_Integer GEOMAlgo_SurfaceTools::GetState + (const gp_Pnt& aP, + const Handle(Geom_Surface)& aSurf, + const Standard_Real aTol, + TopAbs_State& aState) { Standard_Integer iErr; GeomAdaptor_Surface aGAS; @@ -114,7 +116,8 @@ //function : ReverseState //purpose : //======================================================================= - TopAbs_State GEOMAlgo_SurfaceTools::ReverseState(const TopAbs_State aState) + TopAbs_State GEOMAlgo_SurfaceTools::ReverseState + (const TopAbs_State aState) { TopAbs_State aRSt=aState; // @@ -135,10 +138,11 @@ //function : IsCoaxial //purpose : //======================================================================= -Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1, - const gp_Pnt& aP2, - const gp_Cylinder& aCyl, - const Standard_Real aTol) +Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial + (const gp_Pnt& aP1, + const gp_Pnt& aP2, + const gp_Cylinder& aCyl, + const Standard_Real aTol) { const gp_XYZ &aLoc = aCyl.Location().XYZ(); const gp_Ax1 &aAxis = aCyl.Axis(); @@ -147,7 +151,7 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1, gp_XYZ aDP2 = aP2.XYZ().Subtracted(aLoc); Standard_Real aDot1 = aDP1.Dot(aDAxis); Standard_Real aDot2 = aDP1.Dot(aDAxis); - Standard_Real aTol2 = aTol*aTol; + //Standard_Real aTol2 = aTol*aTol; // Project P1 and P2 onto a plane with location aLoc and Norm aDAxis. aDP1.Subtract(aDAxis.Multiplied(aDot1)); @@ -160,7 +164,7 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1, if (fabs(aRadius1 - aRadius2) <= aTol) { // Check the deflection of the middle point. gp_XYZ aMidP = 0.5*(aDP1 + aDP2); - Standard_Real aMidRadius1 = aMidP.Modulus(); + //Standard_Real aMidRadius1 = aMidP.Modulus(); if (fabs(aRadius1 - aRadius2) <= aTol) { isOn = Standard_True; @@ -173,7 +177,8 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1, //function : IsAnalytic //purpose : //======================================================================= -Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& aSurf) +Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic + (const Handle(Geom_Surface)& aSurf) { Standard_Boolean bRet; GeomAbs_SurfaceType aType; @@ -190,8 +195,9 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& a //function : IsConformState //purpose : //======================================================================= -Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState(const TopAbs_State aST1, - const GEOMAlgo_State aST2) +Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState + (const TopAbs_State aST1, + const GEOMAlgo_State aST2) { Standard_Boolean bRet=Standard_False; // diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index e10909ddc..0cfe8f6ae 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -859,7 +859,7 @@ QString GEOMBase::GetEntry( GEOM::GEOM_Object_ptr object ) // Function : PublishSubObject // Purpose : Publish sub-shape under the main object //================================================================ -void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object ) +void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object, const QString& name ) { SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); if ( study && !CORBA::is_nil( object ) ) { @@ -868,9 +868,9 @@ void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object ) GEOM::GEOM_Object_var father = object->GetMainShape(); QString fatherEntry = GetEntry( father ); if ( entry.isEmpty() && !CORBA::is_nil( father ) && !fatherEntry.isEmpty() ) { - QString name = GetName( object ); + QString aName = !name.isEmpty() ? name : GetName( object ); GeometryGUI::GetGeomGen()->AddInStudy( GeometryGUI::ClientStudyToStudy( studyDS ), - object, name.toLatin1().data(), father.in() ); + object, aName.toLatin1().data(), father.in() ); } } } diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index 242e5fdcd..69e21e778 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -133,7 +133,7 @@ public : static QString GetEntry( GEOM::GEOM_Object_ptr object ); /* Publish sub-shape under the main object */ - static void PublishSubObject( GEOM::GEOM_Object_ptr object ); + static void PublishSubObject( GEOM::GEOM_Object_ptr object, const QString& name = QString() ); static void Synchronize( QList& left, QList& right ); }; diff --git a/src/GEOMBase/GEOMBase_Helper.cxx b/src/GEOMBase/GEOMBase_Helper.cxx index 1e795376c..469365617 100755 --- a/src/GEOMBase/GEOMBase_Helper.cxx +++ b/src/GEOMBase/GEOMBase_Helper.cxx @@ -528,6 +528,28 @@ void GEOMBase_Helper::localSelection( GEOM::GEOM_Object_ptr obj, const int mode localSelection( obj, modes ); } +//================================================================ +// Function : localSelection +// Purpose : Activate selection of sub-shapes in accordance with mode +// modes are from TopAbs_ShapeEnum +//================================================================ +void GEOMBase_Helper::localSelection( const std::list modes ) +{ + localSelection( GEOM::GEOM_Object::_nil(), modes ); +} + +//================================================================ +// Function : localSelection +// Purpose : Activate selection of sub-shapes in accordance with mode +// mode is from TopAbs_ShapeEnum +//================================================================ +void GEOMBase_Helper::localSelection( const int mode ) +{ + std::list modes; + modes.push_back( mode ); + localSelection( modes ); +} + //================================================================ // Function : globalSelection // Purpose : Activate selection of sub-shapes. Set selection filters diff --git a/src/GEOMBase/GEOMBase_Helper.h b/src/GEOMBase/GEOMBase_Helper.h index fac2d89ba..44f424def 100755 --- a/src/GEOMBase/GEOMBase_Helper.h +++ b/src/GEOMBase/GEOMBase_Helper.h @@ -100,6 +100,8 @@ protected: void localSelection( const ObjectList&, const int ); void localSelection( GEOM::GEOM_Object_ptr, const std::list ); void localSelection( GEOM::GEOM_Object_ptr, const int ); + void localSelection( const std::list ); + void localSelection( const int ); void activate( const int ); void globalSelection( const int = GEOM_ALLOBJECTS, const bool = false ); void globalSelection( const TColStd_MapOfInteger&, const bool = false ); diff --git a/src/GEOMGUI/CMakeLists.txt b/src/GEOMGUI/CMakeLists.txt index 211156716..c5e9e928f 100755 --- a/src/GEOMGUI/CMakeLists.txt +++ b/src/GEOMGUI/CMakeLists.txt @@ -76,12 +76,14 @@ SET(GEOMGUI_HEADERS GEOMGUI_Selection.h GEOM_GEOMGUI.hxx GEOMGUI_CreationInfoWdg.h + GEOMGUI_TextTreeWdg.h GEOMGUI_DimensionProperty.h ) # header files / to be processed by moc SET(_moc_HEADERS GEOMGUI_CreationInfoWdg.h + GEOMGUI_TextTreeWdg.h GeometryGUI.h ) @@ -114,6 +116,7 @@ SET(GEOMGUI_SOURCES GEOMGUI_OCCSelector.cxx GEOMGUI_Selection.cxx GEOMGUI_CreationInfoWdg.cxx + GEOMGUI_TextTreeWdg.cxx GEOMGUI_DimensionProperty.cxx ${_moc_SOURCES} ${_rcc_SOURCES} diff --git a/src/GEOMGUI/GEOMGUI_CreationInfoWdg.cxx b/src/GEOMGUI/GEOMGUI_CreationInfoWdg.cxx index 5c3681e28..35a59ccfb 100644 --- a/src/GEOMGUI/GEOMGUI_CreationInfoWdg.cxx +++ b/src/GEOMGUI/GEOMGUI_CreationInfoWdg.cxx @@ -124,7 +124,10 @@ void GEOMGUI_CreationInfoWdg::setInfo( GEOM::CreationInformationSeq& info ) } // get icon QString prefix = plugin_name.isEmpty() ? "GEOM" : plugin_name; - icon = resMgr->loadPixmap( prefix, tr( ("ICO_"+name).toLatin1().constData() ), false ); + if ( name.startsWith( "Import")) + icon = resMgr->loadPixmap( "GEOM", tr("ICO_IMPORT_SHAPE"), true ); + else + icon = resMgr->loadPixmap( prefix, tr( ("ICO_"+name).toLatin1().constData() ), false ); // translate operation name operationName = tr( ("MEN_"+name).toLatin1().constData() ); diff --git a/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx new file mode 100644 index 000000000..2c00a3bd4 --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx @@ -0,0 +1,421 @@ +// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +// File : GEOMGUI_TextTreeWdg.cxx +// Author : Alexander KOVALEV (akl) + +#include "GEOMGUI_TextTreeWdg.h" + +#include "GEOMGUI_DimensionProperty.h" +#include "GeometryGUI.h" +#include "GeometryGUI_Operations.h" +#include +#include + +// GUI includes +#include +#include +#include +#include +#include +#include +#include + +// Qt includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +GEOMGUI_TextTreeWdg::GEOMGUI_TextTreeWdg( SalomeApp_Application* app ) + : myDisplayer(NULL) +{ + myStudy = dynamic_cast( app->activeStudy() ); + myDisplayer = GEOM_Displayer( myStudy ); + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + myVisibleIcon = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_VISIBLE" ) ) ); + myInvisibleIcon = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_INVISIBLE" ) ) ); + + setWindowTitle( tr( "TEXT_TREE_VIEW_TITLE" ) ); + setObjectName( "geomTextTreeWdg" ); + + setRootIsDecorated( true ); + setSelectionMode( QAbstractItemView::ExtendedSelection ); + setAllColumnsShowFocus( true ); + setUniformRowHeights( true ); + + QStringList columnNames; + columnNames << tr("TEXT_TREE_VIEW_NAME") << ""; + QTreeWidgetItem * headerItem = new QTreeWidgetItem( columnNames ); + headerItem->setIcon( 1, myVisibleIcon ); + setHeaderItem ( headerItem ); + header()->moveSection( 1, 0 ); + header()->setResizeMode( 1, QHeaderView::ResizeToContents ); + + QStringList rootNames; + rootNames << tr("GEOM_DIMENSIONS") << ""; + myDimensionsItem = new QTreeWidgetItem( this, rootNames ); + myDimensionsItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); + addTopLevelItem( myDimensionsItem ); + + // get a free dockable window id + myWindowID = 11; + while( app->dockWindow( myWindowID )) + ++myWindowID; + ++myWindowID; + + createActions(); + setContextMenuPolicy( Qt::CustomContextMenu ); + connect( this, SIGNAL( customContextMenuRequested(const QPoint&) ), + this, SLOT( showContextMenu(const QPoint&) ) ); + + connect( myStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ), + this, SLOT( updateVisibilityColumn( QString, Qtx::VisibilityState ) ) ); + connect( app->objectBrowser(), SIGNAL( updated() ), this, SLOT( updateTree() ) ); + GeometryGUI* aGeomGUI = dynamic_cast( app->module( "Geometry" ) ); + connect( aGeomGUI, SIGNAL( DimensionsUpdated( const QString& ) ), this, SLOT( updateBranch( const QString& ) ) ); + connect( this, SIGNAL( itemClicked( QTreeWidgetItem*, int) ), + this, SLOT( onItemClicked( QTreeWidgetItem*, int ) ) ); + +} + +GEOMGUI_TextTreeWdg::~GEOMGUI_TextTreeWdg() +{ + //std::cout<<"~GEOMGUI_TextTreeWdg"<setIcon( myVisibleIcon ); + myActions.insert( GEOMOp::OpShow, a ); + + QAction* b = new QAction( tr( "MEN_ERASE" ), this ); + b->setIcon( myInvisibleIcon ); + myActions.insert( GEOMOp::OpHide, b ); +} + +//================================================================================= +// function : updateTree +// purpose : +//================================================================================= +void GEOMGUI_TextTreeWdg::updateTree() +{ + myStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + _PTR(Study) aDSStudy = myStudy->studyDS(); + if ( aDSStudy ) { + _PTR(SComponent) SC ( aDSStudy->FindComponent( "GEOM" ) ); + if ( SC ) { + _PTR(ChildIterator) anIter ( aDSStudy->NewChildIterator( SC ) ); + anIter->InitEx( true ); + QList objEntries = myObjects.keys(); + while( anIter->More() ) { + _PTR(SObject) valSO ( anIter->Value() ); + _PTR(SObject) refSO; + if ( !valSO->ReferencedObject( refSO ) ) { + // update tree of object's dimensions + QString anEntry = valSO->GetID().c_str(); + updateBranch( anEntry ); + objEntries.removeAll( anEntry ); + } + anIter->Next(); + } + foreach (QString entry, objEntries) { + removeBranch( entry, true ); + } + } + } +} + +//================================================================================= +// function : updateBranch +// purpose : +//================================================================================= +void GEOMGUI_TextTreeWdg::updateBranch( const QString& theEntry ) +{ + myStudy = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if ( myStudy ) { + _PTR(Study) aStudyDS = myStudy->studyDS(); + if ( aStudyDS ) { + _PTR(SObject) obj( aStudyDS->FindObjectID( theEntry.toStdString() ) ); + QString aName = obj->GetName().c_str(); + + GEOMGUI_DimensionProperty aProp; + aProp.LoadFromAttribute( myStudy, theEntry.toStdString() ); + int nbProps = aProp.GetNumber(); + + QTreeWidgetItem* objectItem = itemFromEntry( theEntry ); + if ( objectItem ) { + removeBranch( theEntry, nbProps > 0 ? false : true ); + } + QStringList itemName; + if ( nbProps > 0 ) { + itemName << aName << ""; + if ( !objectItem ) { + objectItem = new QTreeWidgetItem( myDimensionsItem, itemName ); + objectItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); + objectItem->setData( 1, Qt::UserRole, theEntry ); + myDimensionsItem->addChild( objectItem ); + myObjects.insert( theEntry, objectItem ); + if ( myDimensionsItem->childCount() == 1 ) + myDimensionsItem->setExpanded( true ); + } + bool isDisplayed = myDisplayer.IsDisplayed( theEntry ); + // read dimension records from property + for ( int anIt = 0; anIt < aProp.GetNumber(); ++anIt ) + { + QString aName = aProp.GetName( anIt ); + bool isVisible = aProp.IsVisible( anIt ); + + QTreeWidgetItem* anItem = new QTreeWidgetItem; + anItem->setText( 0, aName ); + // if ( isDisplayed ) + anItem->setIcon( 1, isVisible ? myVisibleIcon : myInvisibleIcon ); + anItem->setData( 0, Qt::UserRole, anIt ); + anItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); + objectItem->addChild( anItem ); + } + } + } + } +} + +//================================================================================= +// function : removeBranch +// purpose : +//================================================================================= +void GEOMGUI_TextTreeWdg::removeBranch( const QString& theEntry, bool force ) +{ + QTreeWidgetItem* objectItem = itemFromEntry( theEntry ); + if ( !objectItem ) + return; + qDeleteAll( objectItem->takeChildren() ); + if ( force ) { + myDimensionsItem->removeChild( objectItem ); + myObjects.remove( theEntry ); + } +} + +//================================================================================= +// function : onItemClicked() +// purpose : called when tree item was clicked +//================================================================================= +void GEOMGUI_TextTreeWdg::onItemClicked( QTreeWidgetItem* theItem, int theColumn ) +{ + if( theColumn != 1 || theItem->icon( 1 ).isNull() || theItem->isDisabled() ) + return; + + std::string anEntry = entryFromItem( theItem->parent() ).toStdString(); + int aDimIndex = idFromItem( theItem ); + GEOMGUI_DimensionProperty aProp; + aProp.LoadFromAttribute( myStudy, anEntry ); + if ( aProp.IsVisible( aDimIndex ) ) { + aProp.SetVisible( aDimIndex, false ); + theItem->setIcon( 1, myInvisibleIcon ); + } else { + aProp.SetVisible( aDimIndex, true ); + theItem->setIcon( 1, myVisibleIcon ); + } + aProp.SaveToAttribute( myStudy, anEntry ); + redisplay( anEntry.c_str() ); +} + +//================================================================================= +// function : idFromItem +// purpose : +//================================================================================= +int GEOMGUI_TextTreeWdg::idFromItem( QTreeWidgetItem* theItem ) +{ + if ( !theItem ) + return -1; + + bool isIdOK = false; + const int anId = theItem->data( 0, Qt::UserRole ).toInt( &isIdOK ); + + return isIdOK ? anId : -1; +} + +//================================================================================= +// function : entryFromItem +// purpose : +//================================================================================= +QString GEOMGUI_TextTreeWdg::entryFromItem( QTreeWidgetItem* theShapeItem ) +{ + if ( !theShapeItem ) + return ""; + + return theShapeItem->data( 1, Qt::UserRole ).toString(); +} + +//================================================================================= +// function : itemFromEntry +// purpose : +//================================================================================= +QTreeWidgetItem* GEOMGUI_TextTreeWdg::itemFromEntry( QString theEntry ) +{ + if ( theEntry.isEmpty() ) + return 0; + + return myObjects.value( theEntry, 0 ); +} + +//================================================================================= +// function : updateVisibilityColumn +// purpose : Update icons of dimension items. +//================================================================================= +void GEOMGUI_TextTreeWdg::updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState ) +{ + QTreeWidgetItem* anItem = itemFromEntry( theEntry ); + if ( !anItem ) + return; + anItem->setDisabled( theState != Qtx::ShownState ); + QTreeWidgetItem* aChildItem; + GEOMGUI_DimensionProperty aProp; + for ( int i=0; i < anItem->childCount(); i++ ) { + aChildItem = anItem->child( i ); + if ( theState == Qtx::ShownState ) { + aProp.LoadFromAttribute( myStudy, theEntry.toStdString() ); + if ( aProp.GetNumber() == 0 ) + continue; + aChildItem->setIcon( 1, aProp.IsVisible( idFromItem( aChildItem ) ) ? myVisibleIcon : myInvisibleIcon ); + aChildItem->setDisabled( false ); + } else { + aChildItem->setIcon( 1, QIcon() ); + aChildItem->setDisabled( true ); + } + } +} + +//================================================================================= +// function : showContextMenu +// purpose : +//================================================================================= +void GEOMGUI_TextTreeWdg::showContextMenu( const QPoint& pos ) +{ + if ( selectedItems().isEmpty() ) + return; + QMenu aMenu; + aMenu.addAction( myActions[GEOMOp::OpShow] ); + aMenu.addAction( myActions[GEOMOp::OpHide] ); + if ( selectedItems().count() == 1 ) { + QTreeWidgetItem* anItem = selectedItems().first(); + QString anEntry = entryFromItem( anItem->parent() ); + if ( !anEntry.isEmpty() ) { + GEOMGUI_DimensionProperty aProp; + aProp.LoadFromAttribute( myStudy, anEntry.toStdString() ); + if ( aProp.GetNumber() == 0 ) + return; + aMenu.clear(); + if ( aProp.IsVisible( idFromItem( anItem ) ) ) + aMenu.addAction( myActions[GEOMOp::OpHide] ); + else + aMenu.addAction( myActions[GEOMOp::OpShow] ); + } + } + QAction* selPopupItem = aMenu.exec( viewport()->mapToGlobal(pos) ); + if ( selPopupItem == myActions[GEOMOp::OpShow] ) + setVisibility( true ); + else if ( selPopupItem == myActions[GEOMOp::OpHide] ) + setVisibility( false ); +} + +//================================================================================= +// function : setVisibility +// purpose : +//================================================================================= +void GEOMGUI_TextTreeWdg::setVisibility( bool theVisibility ) +{ + if ( myDimensionsItem->isSelected() ) { + // set visibility for all dimensions + QTreeWidgetItem* anItem; + foreach ( QString entry, myObjects.keys() ) { + anItem = itemFromEntry( entry ); + if ( !anItem->isDisabled() ) + setShapeDimensionsVisibility( entry, theVisibility ); + } + return; + } + foreach ( QTreeWidgetItem* item, selectedItems() ) { + if ( item->isDisabled() || item->parent()->isSelected() ) + continue; + QString anEntry = entryFromItem( item ); + if ( !anEntry.isEmpty() ) { + // it is a shape item + setShapeDimensionsVisibility( anEntry, theVisibility ); + } else { + // it is a dimension item + anEntry = entryFromItem( item->parent() ); + setDimensionVisibility( anEntry, item, theVisibility ); + } + } +} + +//================================================================================= +// function : setShapeDimensionsVisibility +// purpose : +//================================================================================= +void GEOMGUI_TextTreeWdg::setShapeDimensionsVisibility( QString theEntry, bool theVisibility ) +{ + QTreeWidgetItem* anItem = itemFromEntry( theEntry ); + QTreeWidgetItem* aChildItem; + for ( int i=0; i < anItem->childCount(); i++ ) { + aChildItem = anItem->child( i ); + setDimensionVisibility( theEntry, aChildItem, theVisibility ); + } + redisplay( theEntry ); +} + +//================================================================================= +// function : setDimensionVisibility +// purpose : +//================================================================================= +void GEOMGUI_TextTreeWdg::setDimensionVisibility( QString theEntry, QTreeWidgetItem* theDimItem, bool theVisibility ) +{ + GEOMGUI_DimensionProperty aProp; + aProp.LoadFromAttribute( myStudy, theEntry.toStdString() ); + int aDimIndex = idFromItem( theDimItem ); + if ( aProp.GetNumber() == 0 || aProp.IsVisible( aDimIndex ) == theVisibility ) + return;; + aProp.SetVisible( aDimIndex, theVisibility ); + aProp.SaveToAttribute( myStudy, theEntry.toStdString() ); + + theDimItem->setIcon( 1, theVisibility ? myVisibleIcon : myInvisibleIcon ); + redisplay( theEntry ); +} + +//================================================================================= +// function : redisplay +// purpose : +//================================================================================= +void GEOMGUI_TextTreeWdg::redisplay( QString theEntry ) +{ + Handle(SALOME_InteractiveObject) io = new SALOME_InteractiveObject( theEntry.toLatin1().constData(), "GEOM", "TEMP_IO" ); + myDisplayer.Redisplay( io ); +} diff --git a/src/GEOMGUI/GEOMGUI_TextTreeWdg.h b/src/GEOMGUI/GEOMGUI_TextTreeWdg.h new file mode 100644 index 000000000..689a21a67 --- /dev/null +++ b/src/GEOMGUI/GEOMGUI_TextTreeWdg.h @@ -0,0 +1,89 @@ +// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef GEOMGUI_TEXTTREEWDG_H +#define GEOMGUI_TEXTTREEWDG_H + +#include "GEOM_GEOMGUI.hxx" +#include "GEOM_Displayer.h" + +#include +#include + +#include + +class QLabel; +class QLineEdit; +class QString; +class QTreeWidgetItem; +class SalomeApp_Application; +class SalomeApp_Study; + +/*! + * \brief Tree view contains Dimension and Annotation text items: + * - text visibility in OCC viewer + * - text object name + */ +class GEOMGUI_EXPORT GEOMGUI_TextTreeWdg : public QTreeWidget +{ + Q_OBJECT + + public: + GEOMGUI_TextTreeWdg( SalomeApp_Application* app ); + ~GEOMGUI_TextTreeWdg(); + + int getWinID() { return myWindowID; } + + void removeBranch( const QString& theEntry, + bool force = true ); + int idFromItem( QTreeWidgetItem* theItem ); + QString entryFromItem( QTreeWidgetItem* theShapeItem ); + QTreeWidgetItem* itemFromEntry( QString theEntry ); + void setShapeDimensionsVisibility( QString theEntry, bool theVisibility ); + void setDimensionVisibility( QString theEntry, QTreeWidgetItem* theDimItem, bool theVisibility ); + +protected: + void createActions(); + void redisplay( QString theEntry ); + + public slots: + void updateTree(); + void updateBranch( const QString& theEntry ); + +private slots: + void onItemClicked(QTreeWidgetItem*, int ); + void updateVisibilityColumn( QString theEntry, Qtx::VisibilityState theState ); + void setVisibility( bool visibility ); + void showContextMenu( const QPoint& pos ); + + private: + + int myWindowID; + + QIcon myVisibleIcon; + QIcon myInvisibleIcon; + QHash myObjects; + SalomeApp_Study* myStudy; + QTreeWidgetItem* myDimensionsItem; + GEOM_Displayer myDisplayer; + + QMap myActions; //!< menu actions list + +}; +#endif diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 205e9db75..3166ac20a 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -1234,11 +1234,12 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t QColor aQColor = aResMgr->colorValue ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) ); int aLineWidth = aResMgr->integerValue( "Geometry", "dimensions_line_width", 1 ); - double aFontHeight = aResMgr->doubleValue ( "Geometry", "dimensions_font_height", 10 ); + QFont aFont = aResMgr->fontValue ( "Geometry", "dimensions_font", QFont("Y14.5M-2009", 14) ); double anArrowLength = aResMgr->doubleValue ( "Geometry", "dimensions_arrow_length", 5 ); bool isUnitsShown = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false ); QString aUnitsLength = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" ); QString aUnitsAngle = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" ); + bool aUseText3d = aResMgr->booleanValue( "Geometry", "dimensions_use_text3d", false ); // restore dimension presentation from saved attribute or property data AIS_ListOfInteractive aRestoredDimensions; @@ -1304,10 +1305,12 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t aStyle->SetCommonColor( aColor ); aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown ); - aStyle->MakeText3d( Standard_True ); + aStyle->MakeText3d( aUseText3d ); aStyle->MakeTextShaded( Standard_True ); - aStyle->SetExtensionSize( aFontHeight * 0.5 ); - aStyle->TextAspect()->SetHeight( aFontHeight ); + int fsize = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize(); + aStyle->SetExtensionSize( fsize * 0.5 ); + aStyle->TextAspect()->SetFont( aFont.family().toLatin1().data() ); + aStyle->TextAspect()->SetHeight( fsize ); aStyle->ArrowAspect()->SetLength( anArrowLength ); aStyle->LineAspect()->SetWidth( aLineWidth ); aStyle->SetTextHorizontalPosition( aPrs->DimensionAspect()->TextHorizontalPosition() ); diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts index 1e906fe81..cfcccd313 100644 --- a/src/GEOMGUI/GEOM_images.ts +++ b/src/GEOMGUI/GEOM_images.ts @@ -1387,6 +1387,10 @@ ICO_TRANSFER_DATA transfer_data.png + + ICO_IMPORT_SHAPE + import.png + ICON_DLG_POINT_FACE pointonface.png diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts index 72fb131e1..491d964f8 100644 --- a/src/GEOMGUI/GEOM_msg_en.ts +++ b/src/GEOMGUI/GEOM_msg_en.ts @@ -431,6 +431,10 @@ Please, select face, shell or solid and try again GEOM_FAST_CHECK_INTERSECTIONS Fast intersection + + GEOM_SHAPE_STATISTICS + Shape Statistics + GEOM_CIRCLE Circle @@ -1348,6 +1352,10 @@ Please, select face, shell or solid and try again GEOM_LENGTH_VALUE By length + + GEOM_TAKE_ORIENTATION_INTO_ACCOUNT + Take edge orientation into account + GEOM_PARTITION Partition @@ -1420,6 +1428,10 @@ Please, select face, shell or solid and try again GEOM_GROUP_NAME_PREFIX Group Names Prefix + + GEOM_STEP_BY_STEP + Step-by-step generation + GEOM_PLANE Plane @@ -2414,7 +2426,11 @@ Please, select face, shell or solid and try again GEOM_WRN_FACES_NOT_SHELL - Unable to create a shell. Result is a compound of faces. + Unable to create single shell. Result is a compound of shells. + + + GEOM_WRN_FACES_NOT_FACE + Unable to create single face. Result is a compound of faces. WRN_SHAPE_UNCLOSED @@ -2556,6 +2572,10 @@ Please, select face, shell or solid and try again MEN_FAST_CHECK_INTERSECTIONS Fast intersection + + MEN_SHAPE_STATISTICS + Shape Statistics + MEN_CHECK_FREE_BNDS Check Free Boundaries @@ -2838,7 +2858,7 @@ Please, select face, shell or solid and try again MEN_MEASURES - Measures + Inspection MEN_MIN_DIST @@ -3445,8 +3465,8 @@ Please, select face, shell or solid and try again Line width - PREF_DIMENSIONS_FONT_HEIGHT - Font height + PREF_DIMENSIONS_FONT + Font PREF_DIMENSIONS_ARROW_LENGTH @@ -3468,6 +3488,10 @@ Please, select face, shell or solid and try again PREF_DIMENSIONS_SHOW_UNITS Show units of measurement + + PREF_DIMENSIONS_USE_TEXT3D + Use 3D text + PREF_HIDE_INPUT_OBJECT Hide input objects from the viewer @@ -3591,8 +3615,12 @@ Please, select face, shell or solid and try again STB_FAST_CHECK_INTERSECTIONS Fast intersection - + + STB_SHAPE_STATISTICS + Shape Statistics + + STB_CHECK_FREE_BNDS Check free boundaries @@ -4224,6 +4252,10 @@ Please, select face, shell or solid and try again TOP_FAST_CHECK_INTERSECTIONS Fast intersection + + TOP_SHAPE_STATISTICS + Shape Statistics + TOP_CHECK_FREE_BNDS Check free boundaries @@ -5116,6 +5148,10 @@ Please, select face, shell or solid and try again GEOM_Z_I Z%1 : + + GEOM_A_I + A%1 : + GEOM_SHAPES_ON_SHAPE_TITLE Get shapes on shape @@ -5384,6 +5420,26 @@ shells and solids on the other hand. GEOM_HEALING_STATS_COL_2 Modification + + GEOM_PLOT_DISTRIBUTION + Plot + + + GEOM_X_AXIS + X Axis + + + GEOM_Y_AXIS + Y Axis + + + GEOM_Z_AXIS + Z Axis + + + GEOM_DIM_AXES + Dimensions along local axes + GeometryGUI @@ -5433,7 +5489,7 @@ shells and solids on the other hand. TOOL_MEASURES - Measures + Inspection TOOL_IMPORTEXPORT @@ -7218,6 +7274,17 @@ Do you want to create new material? (No info available) + + GEOMGUI_TextTreeWdg + + TEXT_TREE_VIEW_TITLE + Text + + + TEXT_TREE_VIEW_NAME + Name + + EntityGUI_IsolineDlg @@ -7239,6 +7306,10 @@ Do you want to create new material? MeasureGUI_CheckSelfIntersectionsDlg + + GEOM_CHECK_INTERSECT_TYPE + Self-intersection Detection Type + GEOM_CHECK_INTE_INTERSECTIONS Self-intersections @@ -7303,6 +7374,14 @@ Do you want to create new material? GEOM_CHECK_INTE_ALL Face to Face + all above + + GEOM_CHECK_INT_DEFLECT + Deflection coefficient + + + GEOM_CHECK_INT_DETECT_GAPS + Detect gaps with tolerance + MeasureGUI_FastCheckIntersectionsDlg @@ -7335,6 +7414,69 @@ Do you want to create new material? Objects And Results + + MeasureGUI_ShapeStatisticsDlg + + GEOM_SHAPE_STATISTICS_TYPE + Type + + + GEOM_SHAPE_STATISTICS_LENGTH + Edges length + + + GEOM_SHAPE_STATISTICS_AREA + Faces area + + + GEOM_SHAPE_STATISTICS_VOLUME + Solids volume + + + GEOM_SHAPE_STATISTICS_NB_INTERVALS + Number of intervals + + + GEOM_SHAPE_STATISTICS_SCALAR_RANGE + Scalar range + + + GEOM_SHAPE_STATISTICS_COMPUTE + Compute + + + GEOM_SHAPE_STATISTICS_MIN + Min + + + GEOM_SHAPE_STATISTICS_MAX + Max + + + GEOM_SHAPE_STATISTICS_CREATE_GROUPS + Create Groups + + + GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT + Number of entities + + + GEOM_SHAPE_STATISTICS_MIN_ERROR + Set minimal range value or switch-off Scalar range + + + GEOM_SHAPE_STATISTICS_MAX_ERROR + Set maximal range value or switch-off Scalar range + + + GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR + Minimal range value can not be more than maximal + + + GEOM_MSG_GROUPS_CREATED + %1 groups created + + TransformationGUI_ExtensionDlg @@ -7462,5 +7604,9 @@ Do you want to create new material? GEOM_PROJ_ON_CYL_LENGTH_ANGLE Length angle + + GEOM_PROJ_ON_CYL_ROTATION_ANGLE + Rotation angle + diff --git a/src/GEOMGUI/GEOM_msg_fr.ts b/src/GEOMGUI/GEOM_msg_fr.ts index 203e4d6aa..1a1231364 100644 --- a/src/GEOMGUI/GEOM_msg_fr.ts +++ b/src/GEOMGUI/GEOM_msg_fr.ts @@ -431,6 +431,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_FAST_CHECK_INTERSECTIONS Intersection rapide + + GEOM_SHAPE_STATISTICS + Statistiques sur l'objet + GEOM_CIRCLE Cercle @@ -685,7 +689,7 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_TOWARDS_INSIDE - Epaissit vers l'intérieur + Epaissit vers l'intérieur GEOM_SCALE_PRISM @@ -2414,7 +2418,11 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_WRN_FACES_NOT_SHELL - Impossible de créer une coque. Le résultat est un assemblage de faces. + Impossible de créer une coque. Le résultat est un assemblage de coques. + + + GEOM_WRN_FACES_NOT_FACE + Impossible de créer une face. Le résultat est un assemblage de faces. WRN_SHAPE_UNCLOSED @@ -2556,6 +2564,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau MEN_FAST_CHECK_INTERSECTIONS Intersection rapide + + MEN_SHAPE_STATISTICS + Statistiques sur l'objet + MEN_CHECK_FREE_BNDS Contrôler les contours libres @@ -2838,7 +2850,7 @@ Choisissez une face, une coque ou un solide et essayez de nouveau MEN_MEASURES - Mesures + Inspection MEN_MIN_DIST @@ -3445,8 +3457,8 @@ Choisissez une face, une coque ou un solide et essayez de nouveau Epaisseur de la ligne - PREF_DIMENSIONS_FONT_HEIGHT - Taille de police + PREF_DIMENSIONS_FONT + Police PREF_DIMENSIONS_ARROW_LENGTH @@ -3468,6 +3480,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau PREF_DIMENSIONS_SHOW_UNITS Afficher les unités + + PREF_DIMENSIONS_USE_TEXT3D + Utiliser du texte 3D + PREF_HIDE_INPUT_OBJECT Cacher dans la vue les objets en entrée @@ -3592,6 +3608,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau STB_FAST_CHECK_INTERSECTIONS Intersection rapide + + STB_SHAPE_STATISTICS + Statistique de l'objet + STB_CHECK_FREE_BNDS Vérifier les contours libres @@ -3862,7 +3882,7 @@ Choisissez une face, une coque ou un solide et essayez de nouveau STB_THICKNESS - Crée un solide par ajout d'épaisseur + Crée un solide par ajout d'épaisseur STB_PLANE @@ -4224,6 +4244,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau TOP_FAST_CHECK_INTERSECTIONS Intersection rapide + + TOP_SHAPE_STATISTICS + Statistique de l'objet + TOP_CHECK_FREE_BNDS Valider les contours libres @@ -5116,6 +5140,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau GEOM_Z_I Z%1 : + + GEOM_A_I + A%1 : + GEOM_SHAPES_ON_SHAPE_TITLE Trouver les éléments d'un objet @@ -5384,6 +5412,26 @@ le paramètre '%1' aux préférences du module Géométrie.GEOM_HEALING_STATS_COL_2 Modification + + GEOM_PLOT_DISTRIBUTION + Graphe + + + GEOM_X_AXIS + Axe X + + + GEOM_Y_AXIS + Axe Y + + + GEOM_Z_AXIS + Axe Z + + + GEOM_DIM_AXES + Dimensions sur les axes locaux + GeometryGUI @@ -5433,7 +5481,7 @@ le paramètre '%1' aux préférences du module Géométrie. TOOL_MEASURES - Informations + Inspection TOOL_IMPORTEXPORT @@ -7218,6 +7266,17 @@ Voulez-vous en créer un nouveau ? (aucune information disponible) + + GEOMGUI_TextTreeWdg + + TEXT_TREE_VIEW_TITLE + Texte + + + TEXT_TREE_VIEW_NAME + Nom + + EntityGUI_IsolineDlg @@ -7239,6 +7298,10 @@ Voulez-vous en créer un nouveau ? MeasureGUI_CheckSelfIntersectionsDlg + + GEOM_CHECK_INTERSECT_TYPE + Détection du type d'auto-intersection + GEOM_CHECK_INTE_INTERSECTIONS Auto-intersections @@ -7303,6 +7366,14 @@ Voulez-vous en créer un nouveau ? GEOM_CHECK_INTE_ALL Face à Face + tout au-delà + + GEOM_CHECK_INT_DEFLECT + Coefficient de déflexion + + + GEOM_CHECK_INT_DETECT_GAPS + Détection des écarts avec tolérance + MeasureGUI_FastCheckIntersectionsDlg @@ -7335,6 +7406,69 @@ Voulez-vous en créer un nouveau ? Objets et résultats + + MeasureGUI_ShapeStatisticsDlg + + GEOM_SHAPE_STATISTICS_TYPE + Type + + + GEOM_SHAPE_STATISTICS_LENGTH + Longueur des arêtes + + + GEOM_SHAPE_STATISTICS_AREA + Aire des faces + + + GEOM_SHAPE_STATISTICS_VOLUME + Volume des solides + + + GEOM_SHAPE_STATISTICS_NB_INTERVALS + Nombre d'intervalles + + + GEOM_SHAPE_STATISTICS_SCALAR_RANGE + Echelle de dimension + + + GEOM_SHAPE_STATISTICS_COMPUTE + Calculer + + + GEOM_SHAPE_STATISTICS_MIN + Min + + + GEOM_SHAPE_STATISTICS_MAX + Max + + + GEOM_SHAPE_STATISTICS_CREATE_GROUPS + Créer des groupes + + + GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT + Nombre d'entités + + + GEOM_SHAPE_STATISTICS_MIN_ERROR + Spécifier une valeur minimale ou ignorer l'échelle de dimension + + + GEOM_SHAPE_STATISTICS_MAX_ERROR + Spécifier une valeur maximale ou ignorer l'échelle de dimension + + + GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR + La valeur minimal ne peut pas être plus grande que la maximale + + + GEOM_MSG_GROUPS_CREATED + %1 groupes créés + + TransformationGUI_ExtensionDlg @@ -7460,7 +7594,7 @@ Voulez-vous en créer un nouveau ? GEOM_PROJ_ON_CYL_LENGTH_ANGLE - Longueur de l'angle + Longueur de l'angle diff --git a/src/GEOMGUI/GEOM_msg_ja.ts b/src/GEOMGUI/GEOM_msg_ja.ts index fc01a2b0a..0a55e444f 100644 --- a/src/GEOMGUI/GEOM_msg_ja.ts +++ b/src/GEOMGUI/GEOM_msg_ja.ts @@ -427,6 +427,10 @@ GEOM_FAST_CHECK_INTERSECTIONS クイック交点 + + GEOM_SHAPE_STATISTICS + 形状の統計 + GEOM_CIRCLE Circle @@ -1343,6 +1347,10 @@ GEOM_LENGTH_VALUE 長さで + + GEOM_TAKE_ORIENTATION_INTO_ACCOUNT + エッジの方向に注意 + GEOM_PARTITION Partition @@ -1415,6 +1423,10 @@ GEOM_GROUP_NAME_PREFIX グループ名Prefix + + GEOM_STEP_BY_STEP + ステップ生成 + GEOM_PLANE Plane @@ -2411,6 +2423,10 @@ GEOM_WRN_FACES_NOT_SHELL シェルを作成できません。面の結合です。 + + GEOM_WRN_FACES_NOT_FACE + たった1つの面を作成することはできません。結果は複合面になります。 + WRN_SHAPE_UNCLOSED 閉じていないオブジェクト %1 からソリッドを作成できません @@ -2551,6 +2567,10 @@ MEN_FAST_CHECK_INTERSECTIONS クイック交点 + + MEN_SHAPE_STATISTICS + 形状の統計 + MEN_CHECK_FREE_BNDS 自由境界の確認 @@ -3440,8 +3460,8 @@ 線幅 - PREF_DIMENSIONS_FONT_HEIGHT - フォント高さ + PREF_DIMENSIONS_FONT + フォント PREF_DIMENSIONS_ARROW_LENGTH @@ -3463,6 +3483,10 @@ PREF_DIMENSIONS_SHOW_UNITS 測定単位の表示 + + PREF_DIMENSIONS_USE_TEXT3D + 3Dテキストの使用 + PREF_HIDE_INPUT_OBJECT ビューワから入力したオブジェクトの非表示 @@ -3587,6 +3611,10 @@ STB_FAST_CHECK_INTERSECTIONS クイック交点 + + STB_SHAPE_STATISTICS + 形状の統計 + STB_CHECK_FREE_BNDS 自由境界をチェック @@ -4219,6 +4247,10 @@ TOP_FAST_CHECK_INTERSECTIONS クイック交点 + + TOP_SHAPE_STATISTICS + 形状の統計 + TOP_CHECK_FREE_BNDS 自由境界を確認 @@ -5111,6 +5143,10 @@ GEOM_Z_I Z%1 : + + GEOM_A_I + A%1 : + GEOM_SHAPES_ON_SHAPE_TITLE オブジェクトの要素を見つける @@ -5329,11 +5365,11 @@ CC_PNT_ITEM_X_Y - X=%1, Y=%2 + X=%1, Y=%2 CC_PNT_ITEM_X_Y_Z - X=%1, Y=%2, Z=%3 + X=%1, Y=%2, Z=%3 GEOM_FILTER @@ -5375,6 +5411,26 @@ GEOM_HEALING_STATS_COL_2 修正 + + GEOM_PLOT_DISTRIBUTION + Plot + + + GEOM_X_AXIS + X軸 + + + GEOM_Y_AXIS + Y軸 + + + GEOM_Z_AXIS + Z軸 + + + GEOM_DIM_AXES + 局所座標軸に沿った次元 + GeometryGUI @@ -5737,11 +5793,11 @@ TABLE_X - X + X TABLE_Y - Y + Y @@ -6415,7 +6471,7 @@ Z - Z + Z @@ -6731,7 +6787,7 @@ OperationGUI_ChamferDlg D - D + D FACE_1 @@ -7199,6 +7255,17 @@ (有効情報なし) + + GEOMGUI_TextTreeWdg + + TEXT_TREE_VIEW_TITLE + テキスト + + + TEXT_TREE_VIEW_NAME + 名前 + + EntityGUI_IsolineDlg @@ -7220,6 +7287,10 @@ MeasureGUI_CheckSelfIntersectionsDlg + + GEOM_CHECK_INTERSECT_TYPE + 自己交差検出型 + GEOM_CHECK_INTE_INTERSECTIONS 自己交差 @@ -7284,6 +7355,14 @@ GEOM_CHECK_INTE_ALL 面から面と上記すべて + + GEOM_CHECK_INT_DEFLECT + 偏向係数 + + + GEOM_CHECK_INT_DETECT_GAPS + トレランスとのギャップ検出 + MeasureGUI_FastCheckIntersectionsDlg @@ -7316,6 +7395,69 @@ オブジェクトと結果 + + MeasureGUI_ShapeStatisticsDlg + + GEOM_SHAPE_STATISTICS_TYPE + タイプ + + + GEOM_SHAPE_STATISTICS_LENGTH + エッジ長さ + + + GEOM_SHAPE_STATISTICS_AREA + 面の面積 + + + GEOM_SHAPE_STATISTICS_VOLUME + ソリッドの体積 + + + GEOM_SHAPE_STATISTICS_NB_INTERVALS + 間隔数 + + + GEOM_SHAPE_STATISTICS_SCALAR_RANGE + スカラ範囲 + + + GEOM_SHAPE_STATISTICS_COMPUTE + 計算 + + + GEOM_SHAPE_STATISTICS_MIN + Min + + + GEOM_SHAPE_STATISTICS_MAX + Max + + + GEOM_SHAPE_STATISTICS_CREATE_GROUPS + グループの作成 + + + GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT + エンティティ数 + + + GEOM_SHAPE_STATISTICS_MIN_ERROR + 範囲内最小の値をセットするかスカラ範囲のスイッチをOFFにしてください。 + + + GEOM_SHAPE_STATISTICS_MAX_ERROR + 範囲内最大の値をセットするかスカラ範囲のスイッチをOFFにしてください。 + + + GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR + 範囲内最小値が最大値より大きくすることはできません + + + GEOM_MSG_GROUPS_CREATED + %1 グループを作成しました。 + + TransformationGUI_ExtensionDlg @@ -7443,5 +7585,9 @@ GEOM_PROJ_ON_CYL_LENGTH_ANGLE Length angle + + GEOM_PROJ_ON_CYL_ROTATION_ANGLE + 回転角度 + diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 3e61afba7..0d3f733a6 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -33,6 +33,7 @@ #include "GEOMGUI_OCCSelector.h" #include "GEOMGUI_Selection.h" #include "GEOMGUI_CreationInfoWdg.h" +#include "GEOMGUI_TextTreeWdg.h" #include "GEOMGUI_DimensionProperty.h" #include "GEOM_Constants.h" #include "GEOM_Displayer.h" @@ -50,8 +51,6 @@ #include #include -#include - #include #include #include @@ -65,7 +64,9 @@ #include #include +#ifndef DISABLE_GRAPHICSVIEW #include +#endif #include #include @@ -86,6 +87,7 @@ #include #include +#include // External includes #include @@ -97,6 +99,7 @@ #include #include #include +#include #include #include @@ -107,6 +110,7 @@ #include #include +#include #include @@ -116,6 +120,10 @@ #include #include +#include +#include +#include + #include "GEOM_version.h" #include "GEOMImpl_Types.hxx" // dangerous hxx (defines short-name macros) - include after all @@ -218,6 +226,7 @@ GeometryGUI::GeometryGUI() : myLocalSelectionMode = GEOM_ALLOBJECTS; myCreationInfoWdg = 0; + myTextTreeWdg = 0; connect( Material_ResourceMgr::resourceMgr(), SIGNAL( changed() ), this, SLOT( updateMaterials() ) ); @@ -429,7 +438,11 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam ) SUIT_ViewWindow* window = desk->activeWindow(); bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() ); bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() ); +#ifndef DISABLE_GRAPHICSVIEW bool ViewDep = ( window && window->getViewManager()->getType() == GraphicsView_Viewer::Type() ); +#else + bool ViewDep = 0; +#endif // if current viewframe is not of OCC and not of VTK type - return immediately // fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example) QList NotViewerDependentCommands; @@ -470,7 +483,9 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam ) case GEOMOp::OpSelectCompound: // POPUP MENU - SELECT ONLY - COMPOUND case GEOMOp::OpSelectAll: // POPUP MENU - SELECT ONLY - SELECT ALL case GEOMOp::OpDelete: // MENU EDIT - DELETE +#ifndef DISABLE_PYCONSOLE case GEOMOp::OpCheckGeom: // MENU TOOLS - CHECK GEOMETRY +#endif case GEOMOp::OpMaterialsLibrary: // MENU TOOLS - MATERIALS LIBRARY case GEOMOp::OpDeflection: // POPUP MENU - DEFLECTION COEFFICIENT case GEOMOp::OpColor: // POPUP MENU - COLOR @@ -497,7 +512,9 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam ) case GEOMOp::OpClsBringToFront: // case GEOMOp::OpCreateFolder: // POPUP MENU - CREATE FOLDER case GEOMOp::OpSortChildren: // POPUP MENU - SORT CHILD ITEMS +#ifndef DISABLE_GRAPHICSVIEW case GEOMOp::OpShowDependencyTree: // POPUP MENU - SHOW DEPENDENCY TREE +#endif case GEOMOp::OpReduceStudy: // POPUP MENU - REDUCE STUDY libName = "GEOMToolsGUI"; break; @@ -644,6 +661,9 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam ) case GEOMOp::OpCheckSelfInters: // MENU MEASURE - CHECK SELF INTERSECTIONS case GEOMOp::OpFastCheckInters: // MENU MEASURE - FAST CHECK INTERSECTIONS case GEOMOp::OpManageDimensions: // MENU MEASURE - MANAGE DIMENSIONS +#ifndef DISABLE_PLOT2DVIEWER + case GEOMOp::OpShapeStatistics: // MENU MEASURE - SHAPE STATISTICS +#endif case GEOMOp::OpShowAllDimensions: // POPUP MENU - SHOW ALL DIMENSIONS case GEOMOp::OpHideAllDimensions: // POPUP MENU - HIDE ALL DIMENSIONS libName = "MeasureGUI"; @@ -878,6 +898,11 @@ void GeometryGUI::createOriginAndBaseVectors() GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOX, "OX" ); GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOY, "OY" ); GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOZ, "OZ" ); + anOrigin->UnRegister(); + anOX->UnRegister(); + anOY->UnRegister(); + anOZ->UnRegister(); + aBasicOperations->UnRegister(); getApp()->updateObjectBrowser( true ); } @@ -1025,9 +1050,14 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( GEOMOp::OpGetNonBlocks, "GET_NON_BLOCKS" ); createGeomAction( GEOMOp::OpCheckSelfInters, "CHECK_SELF_INTERSECTIONS" ); createGeomAction( GEOMOp::OpFastCheckInters, "FAST_CHECK_INTERSECTIONS" ); +#ifndef DISABLE_PLOT2DVIEWER + createGeomAction( GEOMOp::OpShapeStatistics, "SHAPE_STATISTICS" ); +#endif +#ifndef DISABLE_PYCONSOLE #ifdef _DEBUG_ // PAL16821 createGeomAction( GEOMOp::OpCheckGeom, "CHECK_GEOMETRY" ); +#endif #endif createGeomAction( GEOMOp::OpMaterialsLibrary, "MATERIALS_LIBRARY" ); @@ -1082,7 +1112,9 @@ void GeometryGUI::initialize( CAM_Application* app ) createGeomAction( GEOMOp::OpPredefMaterCustom, "POP_PREDEF_MATER_CUSTOM" ); createGeomAction( GEOMOp::OpCreateFolder, "POP_CREATE_FOLDER" ); createGeomAction( GEOMOp::OpSortChildren, "POP_SORT_CHILD_ITEMS" ); +#ifndef DISABLE_GRAPHICSVIEW createGeomAction( GEOMOp::OpShowDependencyTree, "POP_SHOW_DEPENDENCY_TREE" ); +#endif createGeomAction( GEOMOp::OpReduceStudy, "POP_REDUCE_STUDY" ); createGeomAction( GEOMOp::OpShowAllDimensions, "POP_SHOW_ALL_DIMENSIONS" ); createGeomAction( GEOMOp::OpHideAllDimensions, "POP_HIDE_ALL_DIMENSIONS" ); @@ -1288,11 +1320,16 @@ void GeometryGUI::initialize( CAM_Application* app ) createMenu( GEOMOp::OpCheckSelfInters, measurId, -1 ); createMenu( GEOMOp::OpFastCheckInters, measurId, -1 ); createMenu( GEOMOp::OpInspectObj, measurId, -1 ); +#ifndef DISABLE_PLOT2DVIEWER + createMenu( GEOMOp::OpShapeStatistics, measurId, -1 ); +#endif int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 ); +#ifndef DISABLE_PYCONSOLE #if defined(_DEBUG_) || defined(_DEBUG) // PAL16821 createMenu( separator(), toolsId, -1 ); createMenu( GEOMOp::OpCheckGeom, toolsId, -1 ); +#endif #endif createMenu( separator(), toolsId, -1 ); @@ -1621,9 +1658,11 @@ void GeometryGUI::initialize( CAM_Application* app ) mgr->insert( action( GEOMOp::OpSortChildren ), -1, -1 ); // Sort child items mgr->setRule( action( GEOMOp::OpSortChildren ), QString("client='ObjectBrowser' and $component={'GEOM'} and nbChildren>1"), QtxPopupMgr::VisibleRule ); +#ifndef DISABLE_GRAPHICSVIEW mgr->insert( separator(), -1, -1 ); // ----------- mgr->insert( action( GEOMOp::OpShowDependencyTree ), -1, -1 ); // Show dependency tree mgr->setRule( action( GEOMOp::OpShowDependencyTree ), clientOCCorVTKorOB + " and selcount>0 and ($component={'GEOM'}) and type='Shape'", QtxPopupMgr::VisibleRule ); +#endif mgr->insert( separator(), -1, -1 ); // ----------- mgr->insert( action( GEOMOp::OpReduceStudy ), -1, -1 ); // Reduce Study @@ -1744,17 +1783,18 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) // import Python module that manages GEOM plugins (need to be here because SalomePyQt API uses active module) PyGILState_STATE gstate = PyGILState_Ensure(); - PyObjWrapper pluginsmanager = PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager"); + PyObject* pluginsmanager = PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager"); if ( !pluginsmanager ) { PyErr_Print(); } else { - PyObjWrapper result = + PyObject* result = PyObject_CallMethod(pluginsmanager, (char*)"initialize", (char*)"isss", 1, "geom", tr("MEN_NEW_ENTITY").toUtf8().data(), tr("GEOM_PLUGINS_OTHER").toUtf8().data()); if ( !result ) PyErr_Print(); + Py_XDECREF(result); } PyGILState_Release(gstate); // end of GEOM plugins loading @@ -1780,6 +1820,11 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) getApp()->insertDockWindow( myCreationInfoWdg->getWinID(), myCreationInfoWdg ); getApp()->placeDockWindow( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea ); + if ( !myTextTreeWdg ) + myTextTreeWdg = new GEOMGUI_TextTreeWdg( getApp() ); + getApp()->insertDockWindow( myTextTreeWdg->getWinID(), myTextTreeWdg ); + getApp()->placeDockWindow( myTextTreeWdg->getWinID(), Qt::LeftDockWidgetArea ); + //NPAL 19674 SALOME_ListIO selected; sm->selectedObjects( selected ); @@ -1818,6 +1863,7 @@ bool GeometryGUI::activateModule( SUIT_Study* study ) } } + Py_XDECREF(pluginsmanager); return true; } @@ -1841,8 +1887,15 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study ) disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateCreationInfo() )); disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateFieldColorScale() )); - getApp()->removeDockWindow( myCreationInfoWdg->getWinID() ); - myCreationInfoWdg = 0; + if ( myCreationInfoWdg ) { + getApp()->removeDockWindow( myCreationInfoWdg->getWinID() ); + myCreationInfoWdg = 0; + } + if ( myTextTreeWdg ) { + getApp()->removeDockWindow( myTextTreeWdg->getWinID() ); + disconnect( application(), 0, myTextTreeWdg, 0 ); + myTextTreeWdg = 0; + } EmitSignalCloseAllDialogs(); @@ -1897,9 +1950,13 @@ void GeometryGUI::windows( QMap& mappa ) const { mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea ); mappa.insert( SalomeApp_Application::WT_NoteBook, Qt::LeftDockWidgetArea ); +#ifndef DISABLE_PYCONSOLE mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea ); +#endif if ( myCreationInfoWdg ) mappa.insert( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea ); + if ( myTextTreeWdg ) + mappa.insert( myTextTreeWdg->getWinID(), Qt::LeftDockWidgetArea ); } void GeometryGUI::viewManagers( QStringList& lst ) const @@ -2211,6 +2268,8 @@ void GeometryGUI::OnSetMaterial(const QString& theName) void GeometryGUI::createPreferences() { + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) ); int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId ); @@ -2307,12 +2366,36 @@ void GeometryGUI::createPreferences() setPreferenceProperty( aDimLineWidthId, "min", 1 ); setPreferenceProperty( aDimLineWidthId, "max", 5 ); - int aDimFontHeightId = addPreference( tr( "PREF_DIMENSIONS_FONT_HEIGHT" ), aDimGroupId, - LightApp_Preferences::DblSpin, "Geometry", "dimensions_font_height" ); + int aDimFontId = addPreference( tr( "PREF_DIMENSIONS_FONT" ), aDimGroupId, LightApp_Preferences::Font, "Geometry", "dimensions_font" ); - setPreferenceProperty( aDimFontHeightId, "min", 1e-9 ); - setPreferenceProperty( aDimFontHeightId, "max", 1e+9 ); - setPreferenceProperty( aDimFontHeightId, "precision", 9 ); + int f = QtxFontEdit::Family | QtxFontEdit::Size; + setPreferenceProperty( aDimFontId, "features", f ); + setPreferenceProperty( aDimFontId, "mode", QtxFontEdit::Custom ); + + Handle(Font_FontMgr) fmgr = Font_FontMgr::GetInstance(); + QString aFontFile = ""; + resMgr->value("resources", "GEOM", aFontFile); + aFontFile = aFontFile + QDir::separator() + "Y14.5M-2009.ttf"; + // add enginier font into combobox + int fontID = QFontDatabase::addApplicationFont( aFontFile ); + Handle(Font_SystemFont) sf = new Font_SystemFont( + new TCollection_HAsciiString("Y14.5M-2009"), + Font_FA_Regular, + new TCollection_HAsciiString(aFontFile.toLatin1().data()) ); + // register font in OCC font manager + fmgr->RegisterFont( sf, Standard_False ); + + // get list of supported fonts by OCC + QStringList anOCCFonts; + TColStd_SequenceOfHAsciiString theFontsNames; + fmgr->GetAvailableFontsNames( theFontsNames ); + for(Standard_Integer i=1; i<=theFontsNames.Length(); i++) { + Handle(TCollection_HAsciiString) str = theFontsNames(i); + anOCCFonts << str->ToCString(); + } + anOCCFonts.removeDuplicates(); + // set the supported fonts into combobox to use its only + setPreferenceProperty( aDimFontId, "fonts", anOCCFonts ); int aDimArrLengthId = addPreference( tr( "PREF_DIMENSIONS_ARROW_LENGTH" ), aDimGroupId, LightApp_Preferences::DblSpin, "Geometry", "dimensions_arrow_length" ); @@ -2327,9 +2410,6 @@ void GeometryGUI::createPreferences() int anAngUnitsId = addPreference( tr( "PREF_DIMENSIONS_ANGLE_UNITS" ), aDimGroupId, LightApp_Preferences::Selector, "Geometry", "dimensions_angle_units" ); - addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId, - LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" ); - QStringList aListOfLengthUnits; aListOfLengthUnits << "m"; aListOfLengthUnits << "cm"; @@ -2344,6 +2424,9 @@ void GeometryGUI::createPreferences() setPreferenceProperty( aLengthUnitsId, "strings", aListOfLengthUnits ); setPreferenceProperty( anAngUnitsId, "strings", aListOfAngUnits ); + addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId, + LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" ); + int aDimDefFlyout = addPreference( tr( "PREF_DIMENSIONS_DEFAULT_FLYOUT" ), aDimGroupId, LightApp_Preferences::DblSpin, "Geometry", "dimensions_default_flyout" ); @@ -2351,6 +2434,9 @@ void GeometryGUI::createPreferences() setPreferenceProperty( aDimDefFlyout, "max", 1e+9 ); setPreferenceProperty( aDimDefFlyout, "precision", 9 ); + addPreference( tr( "PREF_DIMENSIONS_USE_TEXT3D" ), aDimGroupId, + LightApp_Preferences::Bool, "Geometry", "dimensions_use_text3d" ); + int isoGroup = addPreference( tr( "PREF_ISOS" ), tabId ); setPreferenceProperty( isoGroup, "columns", 2 ); int isoU = addPreference( tr( "PREF_ISOS_U" ), isoGroup, @@ -2457,7 +2543,6 @@ void GeometryGUI::createPreferences() QList aMarkerTypeIndicesList; QList aMarkerTypeIconsList; - SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); for ( int i = GEOM::MT_POINT; i < GEOM::MT_USER; i++ ) { QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i ); QPixmap pixmap = resMgr->loadPixmap( "GEOM", tr( qPrintable( icoFile ) ) ); @@ -2619,11 +2704,12 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par } else if ( param == QString("dimensions_color") || param == QString("dimensions_line_width") || - param == QString("dimensions_font_height") || + param == QString("dimensions_font") || param == QString("dimensions_arrow_length") || param == QString("dimensions_show_units") || param == QString("dimensions_length_units") || param == QString("dimensions_angle_units") || + param == QString("dimensions_use_text3d") || param == QString("label_color") ) { SalomeApp_Application* anApp = getApp(); @@ -3442,3 +3528,8 @@ void GeometryGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* wher // update Object browser getApp()->updateObjectBrowser( false ); } + +void GeometryGUI::emitDimensionsUpdated( QString entry ) +{ + emit DimensionsUpdated( entry ); +} diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index 53d314ed1..f0abf2da2 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -64,6 +64,7 @@ class LightApp_Selection; class SUIT_ViewManager; class SalomeApp_Study; class GEOMGUI_CreationInfoWdg; +class GEOMGUI_TextTreeWdg; //================================================================================= // class : GeometryGUI @@ -148,6 +149,8 @@ public: SUIT_DataObject* where, const int row, Qt::DropAction action ); + void emitDimensionsUpdated( QString entry ); + public slots: virtual bool deactivateModule( SUIT_Study* ); virtual bool activateModule( SUIT_Study* ); @@ -176,6 +179,7 @@ signals : void SignalDefaultStepValueChanged( double newVal ); void SignalDependencyTreeParamChanged( const QString&, const QString& ); void SignalDependencyTreeRenameObject( const QString& ); + void DimensionsUpdated( const QString& ); protected: virtual LightApp_Selection* createSelection() const; @@ -224,6 +228,8 @@ private: GEOMGUI_CreationInfoWdg* myCreationInfoWdg; + GEOMGUI_TextTreeWdg* myTextTreeWdg; + SALOME_ListIO myTopLevelIOList; friend class DisplayGUI; diff --git a/src/GEOMGUI/GeometryGUI_Operations.h b/src/GEOMGUI/GeometryGUI_Operations.h index 915f5d1f1..480b7d2fd 100644 --- a/src/GEOMGUI/GeometryGUI_Operations.h +++ b/src/GEOMGUI/GeometryGUI_Operations.h @@ -26,7 +26,9 @@ namespace GEOMOp { enum { // ToolsGUI --------------------//-------------------------------- OpDelete = 1020, // MENU EDIT - DELETE +#ifndef DISABLE_PYCONSOLE OpCheckGeom = 1030, // MENU TOOLS - CHECK GEOMETRY +#endif OpMaterialsLibrary = 1040, // MENU TOOLS - MATERIALS LIBRARY OpSelectVertex = 1100, // POPUP MENU - SELECT ONLY - VERTEX OpSelectEdge = 1101, // POPUP MENU - SELECT ONLY - EDGE @@ -59,7 +61,9 @@ namespace GEOMOp { OpIsosWidth = 1261, // POPUP MENU - LINE WIDTH - ISOS WIDTH OpCreateFolder = 1262, // POPUP MENU - CREATE FOLDER OpSortChildren = 1263, // POPUP MENU - SORT CHILD ITEMS +#ifndef DISABLE_GRAPHICSVIEW OpShowDependencyTree = 1264, // POPUP MENU - SHOW DEPENDENCY TREE +#endif OpReduceStudy = 1265, // POPUP MENU - REDUCE STUDY // DisplayGUI ------------------//-------------------------------- OpSwitchVectors = 2001, // MENU VIEW - DISPLAY MODE - SHOW/HIDE EDGE DIRECTION @@ -199,7 +203,10 @@ namespace GEOMOp { OpShowAllDimensions = 5015, // POPUP MENU - SHOW ALL DIMENSIONS OpHideAllDimensions = 5016, // POPUP MENU - HIDE ALL DIMENSIONS OpFastCheckInters = 5017, // MENU MEASURES - FAST CHECK INTERSECTIONS - OpInspectObj = 5018, // MENU MEASURES - INSPECT OBJECT + OpInspectObj = 5018, // MENU MEASURES - INSPECT OBJECT +#ifndef DISABLE_PLOT2DVIEWER + OpShapeStatistics = 5019, // MENU MEASURES - SHAPE STATISTICS +#endif // GroupGUI --------------------//-------------------------------- OpGroupCreate = 6000, // MENU GROUP - CREATE OpGroupEdit = 6001, // MENU GROUP - EDIT diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx index 4d6a72f2a..54ab68721 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -82,7 +82,7 @@ static TopoDS_Shape RemoveExtraEdges(const TopoDS_Shape &theShape) else { TopoDS_Shape aFixed; ShHealOper_ShapeProcess aHealer; - aHealer.Perform(aResult, aFixed); + aHealer.Perform(aShape, aFixed); if (aHealer.isDone() && GEOMUtils::CheckShape(aFixed)) aResult = aFixed; } diff --git a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx index 3c519465c..fab57241a 100644 --- a/src/GEOMImpl/GEOMImpl_HealingDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_HealingDriver.cxx @@ -804,25 +804,73 @@ void GEOMImpl_HealingDriver::FuseCollinearEdges (const TopoDS_Shape& theOriginal theWire = TopoDS::Wire(Fixer->Shape()); */ - TopoDS_Edge prevEdge; - TopTools_ListOfShape finalList, currChain; + // Get the ordered list of edges. + TopTools_ListOfShape anEdges; + TopTools_ListOfShape aCurVertices; + BRepTools_WireExplorer aWExp (theWire); - BRepTools_WireExplorer wexp (theWire); - if (wexp.More()) { - prevEdge = wexp.Current(); - currChain.Append(prevEdge); - wexp.Next(); + for (; aWExp.More(); aWExp.Next()) { + anEdges.Append(aWExp.Current()); + aCurVertices.Append(aWExp.CurrentVertex()); } - else { + + if (anEdges.IsEmpty()) { Standard_NullObject::Raise("Empty wire given"); } - for (; wexp.More(); wexp.Next()) { - TopoDS_Edge anEdge = wexp.Current(); - TopoDS_Vertex CurVertex = wexp.CurrentVertex(); + // Treat the case if the wire is closed and first and last edges are C1. + Standard_Boolean isShift = Standard_False; + + if (BRep_Tool::IsClosed(theWire)) { + // Wire is closed. Check if there are more than 2 edges in the wire. + if (!anEdges.First().IsSame(anEdges.Last())) { + isShift = Standard_True; + } + } + + if (isShift) { + // Put first edge to the end of the list while the chain break is reached. + TopoDS_Shape aFirstEdge = anEdges.First(); + + while (isShift) { + isShift = Standard_False; + + // Check if the first vertex should be kept + if (aMapToRemove.Contains(aCurVertices.First()) || removeAll) { + // Check if first and last edges are C1. + TopoDS_Edge anEdge1 = TopoDS::Edge(anEdges.Last()); + TopoDS_Edge anEdge2 = TopoDS::Edge(anEdges.First()); + + if (AreEdgesC1(anEdge1, anEdge2)) { + // Make the first edge last. + anEdges.Append(anEdge2); + anEdges.RemoveFirst(); + aCurVertices.Append(aCurVertices.First()); + aCurVertices.RemoveFirst(); + + // Check if we reached the first edge again. + // Break the loop in this case. + isShift = !aFirstEdge.IsSame(anEdges.First()); + } + } + } + } + + TopTools_ListOfShape finalList, currChain; + TopTools_ListIteratorOfListOfShape anEIter(anEdges); + TopTools_ListIteratorOfListOfShape aVIter(aCurVertices); + TopoDS_Edge prevEdge = TopoDS::Edge(anEIter.Value()); + + currChain.Append(prevEdge); + anEIter.Next(); + aVIter.Next(); + + for (; anEIter.More(); anEIter.Next(), aVIter.Next()) { + TopoDS_Edge anEdge = TopoDS::Edge(anEIter.Value()); + const TopoDS_Shape &aCurVertex = aVIter.Value(); bool continueChain = false; - if (aMapToRemove.Contains(CurVertex) || removeAll) { + if (aMapToRemove.Contains(aCurVertex) || removeAll) { // if C1 -> continue chain if (AreEdgesC1(prevEdge, anEdge)) { continueChain = true; diff --git a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx index 017447071..4f46c1bbd 100644 --- a/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_I3DPrimOperations.cxx @@ -1828,6 +1828,7 @@ Handle(TColStd_HSequenceOfTransient) const Handle(GEOM_Object) &thePath, const bool theWithContact, const bool theWithCorrections, + const bool IsBySteps, const bool IsGenerateGroups) { SetErrorCode(KO); @@ -1897,8 +1898,13 @@ Handle(TColStd_HSequenceOfTransient) aCI.SetBases(aSeqBases); aCI.SetLocations(aSeqLocs); aCI.SetPath(aRefPath); - aCI.SetWithContactMode(theWithContact); - aCI.SetWithCorrectionMode(theWithCorrections); + + if (!IsBySteps) { + aCI.SetWithContactMode(theWithContact); + aCI.SetWithCorrectionMode(theWithCorrections); + } + + aCI.SetIsBySteps(IsBySteps); aCI.SetGenerateGroups(IsGenerateGroups); //Compute the Pipe value @@ -1930,7 +1936,11 @@ Handle(TColStd_HSequenceOfTransient) pyDump << aPipeDS; } - pyDump << " = geompy.MakePipeWithDifferentSections(["; + if (IsBySteps) { + pyDump << " = geompy.MakePipeWithDifferentSectionsBySteps(["; + } else { + pyDump << " = geompy.MakePipeWithDifferentSections(["; + } for(i =1 ; i <= nbBases; i++) { @@ -1962,7 +1972,11 @@ Handle(TColStd_HSequenceOfTransient) } } - pyDump<< "], "<AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), GEOM_COPY); if (theObject->GetType() == GEOM_VECTOR) { // Mantis issue 21066 //Add the function diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx index d1d23d51c..e1b9e08cd 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx @@ -50,8 +50,10 @@ #include #include #include -#if OCC_VERSION_LARGE > 0x06080000 #include +#if OCC_VERSION_LARGE > 0x06090000 +#include +#include #endif #include #include @@ -61,6 +63,7 @@ #include #include #include +#include #include #include #include @@ -71,10 +74,13 @@ #include #include #include +#include #include #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC +#include + //============================================================================= /*! * Constructor @@ -142,6 +148,38 @@ GEOMImpl_IMeasureOperations::ShapeKind GEOMImpl_IMeasureOperations::KindOfShape } const GEOMAlgo_ShapeInfo& anInfo = aSF.Info(); + // specific processing for some "advandced" objects + switch ( geom_type ) { + case GEOM_MARKER: + // local coordinate systen + // (+) geompy.kind.LCS xc yc zc xx xy xz yx yy yz zx zy zz + + TopoDS_Face aFace = TopoDS::Face( aShape ); + Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) ); + gp_Pnt aC = aPlane->Pln().Location(); + gp_Ax3 anAx3 = aPlane->Pln().Position(); + + theDoubles->Append(aC.X()); + theDoubles->Append(aC.Y()); + theDoubles->Append(aC.Z()); + + gp_Dir aD = anAx3.XDirection(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + aD = anAx3.YDirection(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + aD = anAx3.Direction(); + theDoubles->Append(aD.X()); + theDoubles->Append(aD.Y()); + theDoubles->Append(aD.Z()); + + SetErrorCode(OK); + return SK_LCS; + } + // Interprete results TopAbs_ShapeEnum aType = anInfo.Type(); switch (aType) @@ -523,35 +561,22 @@ GEOMImpl_IMeasureOperations::ShapeKind GEOMImpl_IMeasureOperations::KindOfShape theDoubles->Append(aD.X()); theDoubles->Append(aD.Y()); theDoubles->Append(aD.Z()); + + if (anInfo.KindOfBounds() != GEOMAlgo_KB_INFINITE) + { + // (+) geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices + aKind = SK_PLANAR; + + theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); + } } break; default: - if (anInfo.KindOfShape() == GEOMAlgo_KS_PLANE) { - // (+) geompy.kind.PLANAR xo yo zo dx dy dz nb_edges nb_vertices - - aKind = SK_PLANAR; - - gp_Pnt aC = anInfo.Location(); - theDoubles->Append(aC.X()); - theDoubles->Append(aC.Y()); - theDoubles->Append(aC.Z()); - - gp_Ax3 anAx3 = anInfo.Position(); - gp_Dir aD = anAx3.Direction(); - theDoubles->Append(aD.X()); - theDoubles->Append(aD.Y()); - theDoubles->Append(aD.Z()); - - theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); - theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); - } - else { - // ??? geompy.kind.FACE nb_edges nb_vertices _surface_type_id_ - // (+) geompy.kind.FACE nb_edges nb_vertices - - theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); - theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); - } + // ??? geompy.kind.FACE nb_edges nb_vertices _surface_type_id_ + // (+) geompy.kind.FACE nb_edges nb_vertices + theIntegers->Append(anInfo.NbSubShapes(TopAbs_EDGE)); + theIntegers->Append(anInfo.NbSubShapes(TopAbs_VERTEX)); } } break; @@ -1510,7 +1535,6 @@ bool GEOMImpl_IMeasureOperations::CheckSelfIntersections Handle(TColStd_HSequenceOfInteger)& theIntersections) { SetErrorCode(KO); - bool isGood = false; if (theIntersections.IsNull()) theIntersections = new TColStd_HSequenceOfInteger; @@ -1518,13 +1542,13 @@ bool GEOMImpl_IMeasureOperations::CheckSelfIntersections theIntersections->Clear(); if (theShape.IsNull()) - return isGood; + return false; Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); - if (aRefShape.IsNull()) return isGood; + if (aRefShape.IsNull()) return false; TopoDS_Shape aShape = aRefShape->GetValue(); - if (aShape.IsNull()) return isGood; + if (aShape.IsNull()) return false; // 0. Prepare data TopoDS_Shape aScopy; @@ -1546,7 +1570,6 @@ bool GEOMImpl_IMeasureOperations::CheckSelfIntersections aCSI.Perform(); Standard_Integer iErr = aCSI.ErrorStatus(); - isGood = true; // Standard_Integer aNbS, n1, n2; BOPDS_MapIteratorMapOfPassKey aItMPK; @@ -1570,14 +1593,82 @@ bool GEOMImpl_IMeasureOperations::CheckSelfIntersections theIntersections->Append(anIndices.FindIndex(aS1)); theIntersections->Append(anIndices.FindIndex(aS2)); - isGood = false; } if (!iErr) { SetErrorCode(OK); } - return isGood; + return theIntersections->IsEmpty(); +} + +//============================================================================= +/*! + * CheckSelfIntersectionsFast + */ +//============================================================================= +bool GEOMImpl_IMeasureOperations::CheckSelfIntersectionsFast + (Handle(GEOM_Object) theShape, + float theDeflection, double theTolerance, + Handle(TColStd_HSequenceOfInteger)& theIntersections) +{ + SetErrorCode(KO); + + if (theIntersections.IsNull()) + theIntersections = new TColStd_HSequenceOfInteger; + else + theIntersections->Clear(); + + if (theShape.IsNull()) + return false; + + Handle(GEOM_Function) aRefShape = theShape->GetLastFunction(); + if (aRefShape.IsNull()) return false; + + TopoDS_Shape aShape = aRefShape->GetValue(); + if (aShape.IsNull()) return false; + + // Prepare data + TopoDS_Shape aScopy; + + GEOMAlgo_AlgoTools::CopyShape(aShape, aScopy); + GEOMUtils::MeshShape(aScopy, theDeflection); + + // Map sub-shapes and their indices + TopTools_IndexedMapOfShape anIndices; + TopExp::MapShapes(aScopy, anIndices); + +#if OCC_VERSION_LARGE > 0x06090000 + // Checker of fast interferences + BRepExtrema_SelfIntersection aTool(aScopy, (theTolerance <= 0.) ? 0.0 : theTolerance); + + // Launch the checker + aTool.Perform(); + + const BRepExtrema_MapOfIntegerPackedMapOfInteger& intersections = aTool.OverlapElements(); + + std::set processed; + + for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator it(intersections); it.More(); it.Next()) { + Standard_Integer idxLeft = it.Key(); + if (processed.count(idxLeft) > 0) continue; // already added + processed.insert(idxLeft); + const TColStd_PackedMapOfInteger& overlaps = it.Value(); + for (TColStd_MapIteratorOfPackedMapOfInteger subit(overlaps); subit.More(); subit.Next()) { + Standard_Integer idxRight = subit.Key(); + if (processed.count(idxRight) > 0) continue; // already added + const TopoDS_Shape& aS1 = aTool.GetSubShape(idxLeft); + const TopoDS_Shape& aS2 = aTool.GetSubShape(idxRight); + theIntersections->Append(anIndices.FindIndex(aS1)); + theIntersections->Append(anIndices.FindIndex(aS2)); + } + } + + if (aTool.IsDone()) + SetErrorCode(OK); +#endif + + return theIntersections->IsEmpty(); } //============================================================================= @@ -1593,8 +1684,6 @@ bool GEOMImpl_IMeasureOperations::FastIntersect (Handle(GEOM_Object) theShape1, SetErrorCode(KO); bool isGood = false; -#if OCC_VERSION_LARGE > 0x06080000 - if (theIntersections1.IsNull()) theIntersections1 = new TColStd_HSequenceOfInteger; else @@ -1646,12 +1735,22 @@ bool GEOMImpl_IMeasureOperations::FastIntersect (Handle(GEOM_Object) theShape1, aBSP.Perform(); // 2. Get sets of IDs of overlapped faces - for (BRepExtrema_OverlappedSubShapes::Iterator anIt1 (aBSP.OverlapSubShapes1()); anIt1.More(); anIt1.Next()) { +#if OCC_VERSION_LARGE > 0x06090000 + for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt1 (aBSP.OverlapSubShapes1()); anIt1.More(); anIt1.Next()) +#else + for (BRepExtrema_OverlappedSubShapes::Iterator anIt1 (aBSP.OverlapSubShapes1()); anIt1.More(); anIt1.Next()) +#endif + { const TopoDS_Shape& aS1 = aBSP.GetSubShape1(anIt1.Key()); theIntersections1->Append(anIndices1.FindIndex(aS1)); } - for (BRepExtrema_OverlappedSubShapes::Iterator anIt2 (aBSP.OverlapSubShapes2()); anIt2.More(); anIt2.Next()) { +#if OCC_VERSION_LARGE > 0x06090000 + for (BRepExtrema_MapOfIntegerPackedMapOfInteger::Iterator anIt2 (aBSP.OverlapSubShapes2()); anIt2.More(); anIt2.Next()) +#else + for (BRepExtrema_OverlappedSubShapes::Iterator anIt2 (aBSP.OverlapSubShapes2()); anIt2.More(); anIt2.Next()) +#endif + { const TopoDS_Shape& aS2 = aBSP.GetSubShape2(anIt2.Key()); theIntersections2->Append(anIndices2.FindIndex(aS2)); } @@ -1661,8 +1760,6 @@ bool GEOMImpl_IMeasureOperations::FastIntersect (Handle(GEOM_Object) theShape1, if (aBSP.IsDone()) SetErrorCode(OK); -#endif // OCC_VERSION_LARGE > 0x06080000 - return isGood; } diff --git a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx index 3798af25e..72329c18d 100644 --- a/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx @@ -80,8 +80,10 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { SK_SEGMENT, // segment SK_EDGE, // other edge // VERTEX - SK_VERTEX, + SK_VERTEX, // vertex // ADVANCED shapes + SK_LCS, // local coordinate system + // (other advanced shapes) SK_ADVANCED, // all advanced shapes (temporary implementation) }; @@ -158,6 +160,11 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations { const SICheckLevel theCheckLevel, Handle(TColStd_HSequenceOfInteger)& theIntersections); + Standard_EXPORT bool CheckSelfIntersectionsFast (Handle(GEOM_Object) theShape, + float deflection, + double tolerance, + Handle(TColStd_HSequenceOfInteger)& theIntersections); + Standard_EXPORT bool FastIntersect (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) theShape2, double tolerance, float deflection, Handle(TColStd_HSequenceOfInteger)& theIntersections1, diff --git a/src/GEOMImpl/GEOMImpl_IPipe.hxx b/src/GEOMImpl/GEOMImpl_IPipe.hxx index fc346c5f1..3e0892f81 100644 --- a/src/GEOMImpl/GEOMImpl_IPipe.hxx +++ b/src/GEOMImpl/GEOMImpl_IPipe.hxx @@ -42,6 +42,7 @@ #define PIPEDS_LIST_LOCATIONS 3 #define PIPEDS_ARG_WITHCONTACT 4 #define PIPEDS_ARG_WITHCORRECT 5 +#define PIPEDS_ARG_BY_STEPS 6 // ---- GEOMImpl_IPipeShellSect #define PIPEDS_LIST_SUBBASES 6 diff --git a/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx b/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx index 902f0cf4d..ad9b10db3 100644 --- a/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx +++ b/src/GEOMImpl/GEOMImpl_IPipeDiffSect.hxx @@ -73,6 +73,12 @@ class GEOMImpl_IPipeDiffSect : public GEOMImpl_IPipe int GetWithCorrectionMode() { return _func->GetInteger(PIPEDS_ARG_WITHCORRECT); } + void SetIsBySteps (int IsBySteps) + { _func->SetInteger(PIPEDS_ARG_BY_STEPS, IsBySteps); } + + int GetIsBySteps() + { return _func->GetInteger(PIPEDS_ARG_BY_STEPS); } + }; #endif diff --git a/src/GEOMImpl/GEOMImpl_IPoint.hxx b/src/GEOMImpl/GEOMImpl_IPoint.hxx old mode 100755 new mode 100644 index 650330272..07f81f000 --- a/src/GEOMImpl/GEOMImpl_IPoint.hxx +++ b/src/GEOMImpl/GEOMImpl_IPoint.hxx @@ -40,7 +40,7 @@ #define ARG_LENGTH 11 -//#define ARG_FLAG 12 +#define ARG_USE_ORIENTATION 12 class GEOMImpl_IPoint { @@ -73,12 +73,13 @@ class GEOMImpl_IPoint void SetParameter(double theParam) { _func->SetReal(ARG_PARAM, theParam); } void SetParameter2(double theParam) { _func->SetReal(ARG_PARAM2, theParam); } void SetLength(double theLength) { _func->SetReal(ARG_LENGTH, theLength); } - //void SetReversed(bool theReversed) { _func->SetInteger(ARG_FLAG, theReversed); } + void SetTakeOrientationIntoAccount(bool takeOrientationIntoAccount) + { _func->SetInteger(ARG_USE_ORIENTATION, takeOrientationIntoAccount); } double GetParameter() { return _func->GetReal(ARG_PARAM); } double GetParameter2() { return _func->GetReal(ARG_PARAM2); } double GetLength() { return _func->GetReal(ARG_LENGTH); } - //bool GetReversed() { return _func->GetInteger(ARG_FLAG); } + bool GetTakeOrientationIntoAccount() { return _func->GetInteger(ARG_USE_ORIENTATION); } private: diff --git a/src/GEOMImpl/GEOMImpl_IProjOnCyl.hxx b/src/GEOMImpl/GEOMImpl_IProjOnCyl.hxx index a5162534e..8e0dd2bb5 100644 --- a/src/GEOMImpl/GEOMImpl_IProjOnCyl.hxx +++ b/src/GEOMImpl/GEOMImpl_IProjOnCyl.hxx @@ -28,6 +28,7 @@ #define PROJCYL_ARG_RADIUS 2 #define PROJCYL_ARG_START_ANGLE 3 #define PROJCYL_ARG_ANGLE_LENGTH 4 +#define PROJCYL_ARG_ANGLE_ROTATION 5 class GEOMImpl_IProjOnCyl { @@ -36,14 +37,16 @@ public: GEOMImpl_IProjOnCyl(Handle(GEOM_Function) theFunction): _func(theFunction) {} - void SetShape (const Handle(GEOM_Function) &theShape) - { _func->SetReference(PROJCYL_ARG_SHAPE, theShape); } - void SetRadius (const Standard_Real theRadius) - { _func->SetReal(PROJCYL_ARG_RADIUS, theRadius); } - void SetStartAngle (const Standard_Real theStartAngle) - { _func->SetReal(PROJCYL_ARG_START_ANGLE, theStartAngle); } - void SetAngleLength (const Standard_Real theAngleLength) - { _func->SetReal(PROJCYL_ARG_ANGLE_LENGTH, theAngleLength); } + void SetShape (const Handle(GEOM_Function) &theShape) + { _func->SetReference(PROJCYL_ARG_SHAPE, theShape); } + void SetRadius (const Standard_Real theRadius) + { _func->SetReal(PROJCYL_ARG_RADIUS, theRadius); } + void SetStartAngle (const Standard_Real theStartAngle) + { _func->SetReal(PROJCYL_ARG_START_ANGLE, theStartAngle); } + void SetAngleLength (const Standard_Real theAngleLength) + { _func->SetReal(PROJCYL_ARG_ANGLE_LENGTH, theAngleLength); } + void SetAngleRotation (const Standard_Real theAngleLength) + { _func->SetReal(PROJCYL_ARG_ANGLE_ROTATION, theAngleLength); } Handle(GEOM_Function) GetShape() { return _func->GetReference(PROJCYL_ARG_SHAPE); } @@ -53,6 +56,8 @@ public: { return _func->GetReal(PROJCYL_ARG_START_ANGLE ); } Standard_Real GetAngleLength() { return _func->GetReal(PROJCYL_ARG_ANGLE_LENGTH ); } + Standard_Real GetAngleRotation() + { return _func->GetReal(PROJCYL_ARG_ANGLE_ROTATION ); } private: diff --git a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx index affb64b9c..96c8e49b1 100644 --- a/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IShapesOperations.cxx @@ -690,8 +690,12 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeFaceWithConstraints if ( aFace->GetValue().ShapeType() != TopAbs_FACE ) // constraint face can be omitted - it is a valid case continue; + // Keep the old error code as IsSubShapeBelongsTo changes it. + TCollection_AsciiString anOldCode = GetErrorCode(); + if ( IsSubShapeBelongsTo( anObject, 0, aFace, 0 ) ) { // valid constraint + SetErrorCode(anOldCode); aRefSh = aFace->GetLastFunction(); aConstraints->Append(aRefSh); it++; @@ -2019,6 +2023,8 @@ Standard_Boolean GEOMImpl_IShapesOperations::IsSubShapeBelongsTo( Handle(GEOM_Ob Handle(GEOM_Object) theObject, const Standard_Integer theObjectIndex) { + SetErrorCode(KO); + if ( theObject.IsNull() || theSubObject.IsNull() ) return false; @@ -2039,7 +2045,12 @@ Standard_Boolean GEOMImpl_IShapesOperations::IsSubShapeBelongsTo( Handle(GEOM_Ob } TopExp::MapShapes( shape, anIndices ); - return anIndices.Contains( subShape ); + + const Standard_Boolean isBelongTo = anIndices.Contains(subShape); + + SetErrorCode(OK); + + return isBelongTo; } //============================================================================= @@ -2615,7 +2626,7 @@ Handle(TColStd_HSequenceOfInteger) TopoDS_Shape aShape = theShape->GetValue(); // Check presence of triangulation, build if need - if (!GEOMUtils::CheckTriangulation(aShape)) { + if (theShapeType != TopAbs_VERTEX && !GEOMUtils::CheckTriangulation(aShape)) { SetErrorCode("Cannot build triangulation on the shape"); return aSeqOfIDs; } @@ -2782,7 +2793,7 @@ Handle(TColStd_HSequenceOfInteger) TopTools_ListOfShape res; // Check presence of triangulation, build if need - if (!GEOMUtils::CheckTriangulation(aShape)) { + if (theShapeType != TopAbs_VERTEX && !GEOMUtils::CheckTriangulation(aShape)) { SetErrorCode("Cannot build triangulation on the shape"); return aSeqOfIDs; } @@ -3071,7 +3082,8 @@ Handle(TColStd_HSequenceOfInteger) Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; // Check presence of triangulation, build if need - if (!GEOMUtils::CheckTriangulation(theShape)) { + if (theShapeType != TopAbs_VERTEX && + !GEOMUtils::CheckTriangulation(theShape)) { SetErrorCode("Cannot build triangulation on the shape"); return aSeqOfIDs; } @@ -3997,7 +4009,7 @@ Handle(TColStd_HSequenceOfInteger) Handle(TColStd_HSequenceOfInteger) aSeqOfIDs; // Check presence of triangulation, build if need - if (!GEOMUtils::CheckTriangulation(aShape)) { + if (theShapeType != TopAbs_VERTEX && !GEOMUtils::CheckTriangulation(aShape)) { SetErrorCode("Cannot build triangulation on the shape"); return aSeqOfIDs; } @@ -4223,16 +4235,28 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) const TopoDS_Shape &aShapeResult = aGIP.Result(); TopTools_MapOfShape aMFence; TopTools_IndexedMapOfShape aWhereIndices; + Standard_Integer aShapeType = -1; TopExp::MapShapes(aWhere, aWhereIndices); if (aShapeResult.IsNull() == Standard_False) { - TopoDS_Iterator anIt(aShapeResult); + TopoDS_Iterator anIt(aShapeResult); + Standard_Boolean isFirst = Standard_True; for (; anIt.More(); anIt.Next()) { const TopoDS_Shape &aPart = anIt.Value(); if(aWhereIndices.Contains(aPart) && aMFence.Add(aPart)) { + const TopAbs_ShapeEnum aType = aPart.ShapeType(); + + if (aShapeType == -1) { + // Initialization. + aShapeType = aType; + } else if (aShapeType != TopAbs_SHAPE && aShapeType != aType) { + // Different types. + aShapeType = TopAbs_SHAPE; + } + aLSA.Append(aPart); } } @@ -4246,13 +4270,7 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) Handle(TColStd_HArray1OfInteger) aModifiedArray = new TColStd_HArray1OfInteger (1, aLSA.Extent()); TopTools_ListIteratorOfListOfShape anIterModif (aLSA); for (Standard_Integer imod = 1; anIterModif.More(); anIterModif.Next(), imod++) { - if (aWhereIndices.Contains(anIterModif.Value())) { - aModifiedArray->SetValue(imod, aWhereIndices.FindIndex(anIterModif.Value())); - } - else { - SetErrorCode("Error: wrong sub-shape returned"); - return NULL; - } + aModifiedArray->SetValue(imod, aWhereIndices.FindIndex(anIterModif.Value())); } //Add a new object @@ -4262,7 +4280,10 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlace (Handle(GEOM_Object) return NULL; } - if (aModifiedArray->Length() > 1 || theShapeWhat->GetType() == GEOM_GROUP) { + const Standard_Boolean isSameType = (aShapeType != TopAbs_SHAPE); + + if ((aModifiedArray->Length() > 1 && isSameType) || + theShapeWhat->GetType() == GEOM_GROUP) { //Set a GROUP type aResult->SetType(GEOM_GROUP); @@ -4331,10 +4352,20 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceOld new TColStd_HArray1OfInteger (1, aModifiedList.Extent()); TopTools_ListIteratorOfListOfShape anIterModif (aModifiedList); Standard_Integer imod; + Standard_Integer aShapeType = -1; for (imod = 1; anIterModif.More(); anIterModif.Next(), imod++) { const Standard_Integer anIndex = aWhereIndices.FindIndex(anIterModif.Value()); + const TopAbs_ShapeEnum aType = anIterModif.Value().ShapeType(); + + if (aShapeType == -1) { + // Initialization. + aShapeType = aType; + } else if (aShapeType != TopAbs_SHAPE && aShapeType != aType) { + // Different types. + aShapeType = TopAbs_SHAPE; + } aModifiedArray->SetValue(imod, anIndex); } @@ -4348,7 +4379,10 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceOld return NULL; } - if (aModifiedArray->Length() > 1 || theShapeWhat->GetType() == GEOM_GROUP) { + const Standard_Boolean isSameType = (aShapeType != TopAbs_SHAPE); + + if ((aModifiedArray->Length() > 1 && isSameType) || + theShapeWhat->GetType() == GEOM_GROUP) { //Set a GROUP type aResult->SetType(GEOM_GROUP); @@ -4406,40 +4440,27 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceByHistory return NULL; } - Standard_Integer nbFound = aModifiedList.Extent(); + Handle(TColStd_HArray1OfInteger) aModifiedArray = + new TColStd_HArray1OfInteger (1, aModifiedList.Extent()); TopTools_ListIteratorOfListOfShape anIterModif (aModifiedList); - if ( nbFound > 1 ) - { - // remove sub-shapes inappropriate for group creation - TopAbs_ShapeEnum subType = TopAbs_SHAPE; - while ( anIterModif.More() ) { - TopAbs_ShapeEnum type = anIterModif.Value().ShapeType(); - bool okForGroup = ( type == TopAbs_VERTEX || type == TopAbs_EDGE || - type == TopAbs_FACE || type == TopAbs_SOLID ); - if ( okForGroup ) { - if ( subType == TopAbs_SHAPE ) - subType = type; - else - okForGroup = ( subType == type ); - } - if ( okForGroup ) - anIterModif.Next(); - else - aModifiedList.Remove( anIterModif ); - nbFound -= ( !okForGroup ); - } - if ( nbFound == 0 ) { - SetErrorCode("Error: result found but it's type is inappropriate for group creation."); - return NULL; - } - } + Standard_Integer imod; + Standard_Integer aShapeType = -1; - Handle(TColStd_HArray1OfInteger) aModifiedArray = - new TColStd_HArray1OfInteger( 1, nbFound ); - anIterModif.Initialize(aModifiedList); - for (Standard_Integer imod = 1; anIterModif.More(); anIterModif.Next(), imod++) - aModifiedArray->SetValue - (imod, aWhereIndices.FindIndex(anIterModif.Value())); + for (imod = 1; anIterModif.More(); anIterModif.Next(), imod++) { + const Standard_Integer anIndex = + aWhereIndices.FindIndex(anIterModif.Value()); + const TopAbs_ShapeEnum aType = anIterModif.Value().ShapeType(); + + if (aShapeType == -1) { + // Initialization. + aShapeType = aType; + } else if (aShapeType != TopAbs_SHAPE && aShapeType != aType) { + // Different types. + aShapeType = TopAbs_SHAPE; + } + + aModifiedArray->SetValue(imod, anIndex); + } //Add a new object Handle(GEOM_Object) aResult = GetEngine()->AddSubShape(theShapeWhere, aModifiedArray); @@ -4448,7 +4469,10 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::GetInPlaceByHistory return NULL; } - if (aModifiedArray->Length() > 1) { + const Standard_Boolean isSameType = (aShapeType != TopAbs_SHAPE); + + if ((aModifiedArray->Length() > 1 && isSameType) || + theShapeWhat->GetType() == GEOM_GROUP) { //Set a GROUP type aResult->SetType(GEOM_GROUP); diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx index 5d89b0c0a..6cc201000 100644 --- a/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.cxx @@ -218,7 +218,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved //Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add a translate function Handle(GEOM_Function) aFunction = @@ -271,7 +271,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved //Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add a translate function Handle(GEOM_Function) aFunction = @@ -376,7 +376,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved //Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add a translate function Handle(GEOM_Function) aFunction = @@ -807,7 +807,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored //Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add a mirror function Handle(GEOM_Function) aFunction = @@ -910,7 +910,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored //Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add a mirror function Handle(GEOM_Function) aFunction = @@ -1013,7 +1013,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored //Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add a mirror function Handle(GEOM_Function) aFunction = @@ -1114,7 +1114,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset //Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add a new Offset function Handle(GEOM_Function) aFunction = @@ -1364,7 +1364,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled //Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add a scale function Handle(GEOM_Function) aFunction = @@ -1555,7 +1555,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position //Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add a position function Standard_Integer aType = POSITION_SHAPE_COPY; @@ -1734,7 +1734,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Objec if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated //Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add a rotate function aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY); @@ -2088,7 +2088,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePointsCopy (Handle if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be rotated //Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); //Add a rotate function aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS_COPY); @@ -2145,7 +2145,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TransformLikeOtherCopy if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object // Add a new Copy object - Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType()); + Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY); // Add a transform function (depends on theSample function) Handle(GEOM_Function) aFunction = @@ -2278,7 +2278,8 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MakeProjectionOnCylinder (const Handle(GEOM_Object) &theObject, const Standard_Real theRadius, const Standard_Real theStartAngle, - const Standard_Real theAngleLength) + const Standard_Real theAngleLength, + const Standard_Real theAngleRotation) { SetErrorCode(KO); @@ -2312,6 +2313,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MakeProjectionOnCylinder aProj.SetRadius(theRadius); aProj.SetStartAngle(theStartAngle); aProj.SetAngleLength(theAngleLength); + aProj.SetAngleRotation(theAngleRotation); //Compute the Projection try { @@ -2328,16 +2330,10 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MakeProjectionOnCylinder } //Make a Python command - GEOM::TPythonDump pd(aFunction); - - pd << aResult << " = geompy.MakeProjectionOnCylinder(" - << theObject << ", " << theRadius << ", " << theStartAngle; - - if (theAngleLength >= 0.) { - pd << ", " << theAngleLength; - } - - pd << ")"; + GEOM::TPythonDump(aFunction) + << aResult << " = geompy.MakeProjectionOnCylinder(" + << theObject << ", " << theRadius << ", " << theStartAngle + << ", " << theAngleLength << ", " << theAngleRotation << ")"; SetErrorCode(OK); diff --git a/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx index 155dbfdd9..3742157bf 100644 --- a/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx +++ b/src/GEOMImpl/GEOMImpl_ITransformOperations.hxx @@ -195,7 +195,8 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations (const Handle(GEOM_Object) &theObject, const Standard_Real theRadius, const Standard_Real theStartAngle, - const Standard_Real theAngleLength); + const Standard_Real theAngleLength, + const Standard_Real theAngleRotation); }; diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx index 31f53f873..cf660675f 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.cxx @@ -43,8 +43,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -686,6 +688,42 @@ static void FindFirstPairFaces(const TopoDS_Shape& S1, const TopoDS_Shape& S2, FS2 = Fs(numface); } +//======================================================================= +//function : RemoveFaces +//purpose : This function returns theShapeFrom without faces of the shape +// theFacesToRm. It returns a shell if theShapeFrom is a solid or +// a compound otherwise. Auxilary for CreatePipeWithDifferentSections +// method. +//======================================================================= +static TopoDS_Shape RemoveFaces(const TopoDS_Shape &theShapeFrom, + const TopoDS_Shape &theFacesToRm) +{ + TopTools_IndexedMapOfShape aMapFaces; + TopExp_Explorer anExp(theShapeFrom, TopAbs_FACE); + BRep_Builder aBuilder; + TopoDS_Shape aResult; + + if (theShapeFrom.ShapeType() == TopAbs_SOLID) { + // Create shell + aBuilder.MakeShell(TopoDS::Shell(aResult)); + } else { + // Create compound + aBuilder.MakeCompound(TopoDS::Compound(aResult)); + } + + TopExp::MapShapes(theFacesToRm, TopAbs_FACE, aMapFaces); + + for (; anExp.More(); anExp.Next()) { + const TopoDS_Shape &aFace = anExp.Current(); + + if (!aMapFaces.Contains(aFace)) { + aBuilder.Add(aResult, aFace); + } + } + + return aResult; +} + //======================================================================= //function : CreatePipeWithDifferentSections //purpose : @@ -696,6 +734,7 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections const Handle(TopTools_HSequenceOfShape) theHSeqLocs, const Standard_Boolean theWithContact, const Standard_Boolean theWithCorrect, + const Standard_Boolean IsBySteps, Handle(TColStd_HArray1OfInteger) *theGroups) { TopoDS_Shape aShape; @@ -883,49 +922,82 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections } } - // check curvature of wire for condition that - // max summary angle between directions along - // wire path must be < 4*PI. If not - split wire - // and seguences of shapes, perform pipe for each - // and make sewing after that - double fp,lp; - gp_Pnt P1,P2; - gp_Vec Vec1,Vec2; - double SumAng = 0; - if ( Edges.Length() > 0 ) { - Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp); - C->D1(fp,P1,Vec1); - C->D1(lp,P2,Vec2); - SumAng = fabs(Vec1.Angle(Vec2)); - Vec1 = Vec2; - P1 = P2; - } TColStd_SequenceOfInteger SplitEdgeNums,SplitLocNums; - int LastLoc = 1; - //cout<<"Edges.Length()="<D1(lp,P2,Vec2); - double ang = fabs(Vec1.Angle(Vec2)); - SumAng += ang; - if (SumAng>4*M_PI) { - SumAng = ang; - SplitEdgeNums.Append(i-1); - int j; - for (j=LastLoc+1; j<=aSeqLocs.Length(); j++) { - TopoDS_Vertex aVert = TopoDS::Vertex(aSeqLocs.Value(j)); - gp_Pnt P = BRep_Tool::Pnt(aVert); - if (P1.Distance(P) < tol) { - SplitLocNums.Append(j); - LastLoc = j; - break; - } + + if (IsBySteps) { + // Fill SplitEdgeNums and SplitLocNums with intermediate location indices + // and corresponding edge indices. + Standard_Integer i = 1; + Standard_Integer j; + TopoDS_Vertex aVert; + gp_Pnt aP; + + for (j = 2; j < aSeqLocs.Length(); j++) { + SplitLocNums.Append(j); + aVert = TopoDS::Vertex(aSeqLocs.Value(j)); + aP = BRep_Tool::Pnt(aVert); + + while (i < Edges.Length()) { + Standard_Real aFp; + Standard_Real aLp; + TopoDS_Edge anEdge = TopoDS::Edge(Edges.Value(i)); + Standard_Real aTol = BRep_Tool::Tolerance(anEdge); + Handle(Geom_Curve) aC = BRep_Tool::Curve(anEdge, aFp, aLp); + gp_Pnt aPLast; + + aC->D0(aLp, aPLast); + i++; + + if (aP.Distance(aPLast) < aTol) { + SplitEdgeNums.Append(i - 1); + break; } } + } + } else { + // check curvature of wire for condition that + // max summary angle between directions along + // wire path must be < 4*PI. If not - split wire + // and seguences of shapes, perform pipe for each + // and make sewing after that + double fp,lp; + gp_Pnt P1,P2; + gp_Vec Vec1,Vec2; + double SumAng = 0; + if ( Edges.Length() > 0 ) { + Handle(Geom_Curve) C = BRep_Tool::Curve(TopoDS::Edge(Edges.Value(1)),fp,lp); + C->D1(fp,P1,Vec1); + C->D1(lp,P2,Vec2); + SumAng = fabs(Vec1.Angle(Vec2)); Vec1 = Vec2; P1 = P2; + } + int LastLoc = 1; + //cout<<"Edges.Length()="<D1(lp,P2,Vec2); + double ang = fabs(Vec1.Angle(Vec2)); + SumAng += ang; + if (SumAng>4*M_PI) { + SumAng = ang; + SplitEdgeNums.Append(i-1); + int j; + for (j=LastLoc+1; j<=aSeqLocs.Length(); j++) { + TopoDS_Vertex aVert = TopoDS::Vertex(aSeqLocs.Value(j)); + gp_Pnt P = BRep_Tool::Pnt(aVert); + if (P1.Distance(P) < tol) { + SplitLocNums.Append(j); + LastLoc = j; + break; + } + } + } + Vec1 = Vec2; + P1 = P2; + } } bool isCreateGroups = (theGroups != NULL); @@ -966,9 +1038,24 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); } - BuildPipeShell(aBuilder); + Standard_Boolean isDone = BuildPipeShell(aBuilder); + + if (isDone && NeedCreateSolid && nn == 1) { + // Make solid for the first step. + isDone = aBuilder.MakeSolid(); + } + + if (!isDone) { + Standard_ConstructionError::Raise("Pipe construction failure"); + } TopoDS_Shape resShape = aBuilder.Shape(); + + if (NeedCreateSolid && nn == 1) { + // Remove top lid from the result. + resShape = RemoveFaces(resShape, aBuilder.LastShape()); + } + aSeqRes.Append(resShape); // Create groups. @@ -1014,9 +1101,23 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections Standard_ConstructionError::Raise("Invalid input data for building PIPE: bases are invalid"); } - BuildPipeShell(aBuilder); + Standard_Boolean isDone = BuildPipeShell(aBuilder); + + if (isDone && NeedCreateSolid) { + isDone = aBuilder.MakeSolid(); + } + + if (!isDone) { + Standard_ConstructionError::Raise("Pipe construction failure"); + } TopoDS_Shape resShape = aBuilder.Shape(); + + if (NeedCreateSolid) { + // Remove bottom lid from the result. + resShape = RemoveFaces(resShape, aBuilder.FirstShape()); + } + aSeqRes.Append(resShape); // Create groups. @@ -1046,6 +1147,28 @@ TopoDS_Shape GEOMImpl_PipeDriver::CreatePipeWithDifferentSections aSewing->Perform(); aShape = aSewing->SewedShape(); + if (NeedCreateSolid && aShape.ShapeType() == TopAbs_SHELL) { + // Build a solid. + BRepBuilderAPI_MakeSolid aMkSolid; + + aMkSolid.Add(TopoDS::Shell(aShape)); + + if (!aMkSolid.IsDone()) { + Standard_ConstructionError::Raise("Can't create solid pipe"); + } + + TopoDS_Solid aSolid = aMkSolid.Solid(); + BRepClass3d_SolidClassifier aSC(aSolid); + + aSC.PerformInfinitePoint(Precision::Confusion()); + + if (aSC.State() == TopAbs_IN) { + aShape = aSolid.Reversed(); + } else { + aShape = aSolid; + } + } + if (isCreateGroups) { // Replase Group shapes by modified ones. TopTools_SequenceOfShape aSeqGroups[5]; @@ -3032,6 +3155,7 @@ Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const Handle(TColStd_HSequenceOfTransient) aLocObjs = aCIDS->GetLocations (); Standard_Boolean aWithContact = (aCIDS->GetWithContactMode()); Standard_Boolean aWithCorrect = (aCIDS->GetWithCorrectionMode()); + Standard_Boolean isBySteps = aCIDS->GetIsBySteps(); if (aCI) { delete aCI; @@ -3079,7 +3203,7 @@ Standard_Integer GEOMImpl_PipeDriver::Execute (TFunction_Logbook& log) const aShape = CreatePipeWithDifferentSections (aWirePath, aHSeqBases, aHSeqLocs, - aWithContact, aWithCorrect, pGroups); + aWithContact, aWithCorrect, isBySteps, pGroups); if (isGenerateGroups) { // Store created groups. @@ -3265,8 +3389,13 @@ GetCreationInformation(std::string& theOperationName, AddParam( theParams, "Bases", aCI.GetBases() ); AddParam( theParams, "Locations", aCI.GetLocations() ); AddParam( theParams, "Path", aCI.GetPath() ); - AddParam( theParams, "With contact", aCI.GetWithContactMode() ); - AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() ); + + if (!aCI.GetIsBySteps()) { + AddParam( theParams, "With contact", aCI.GetWithContactMode() ); + AddParam( theParams, "With correction", aCI.GetWithCorrectionMode() ); + } + + AddParam( theParams, "Step by step", aCI.GetIsBySteps() ); break; } case PIPE_SHELL_SECTIONS: diff --git a/src/GEOMImpl/GEOMImpl_PipeDriver.hxx b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx index 3a4deca6f..767536946 100644 --- a/src/GEOMImpl/GEOMImpl_PipeDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_PipeDriver.hxx @@ -88,6 +88,7 @@ public: const Handle(TopTools_HSequenceOfShape) theLocs, const Standard_Boolean theWithContact, const Standard_Boolean theWithCorrect, + const Standard_Boolean IsBySteps, Handle(TColStd_HArray1OfInteger) *theGroups = NULL); Standard_EXPORT virtual diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx index 03edfc4c1..f80ba42b9 100644 --- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx @@ -145,7 +145,14 @@ Standard_Integer GEOMImpl_PointDriver::Execute(TFunction_Logbook& log) const Standard_Real aFP, aLP, aP; Handle(Geom_Curve) aCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), aFP, aLP); if ( !aCurve.IsNull() ) { - aP = aFP + (aLP - aFP) * aPI.GetParameter(); + if (aPI.GetTakeOrientationIntoAccount() && + aRefShape.Orientation() == TopAbs_REVERSED) { + aP = 1. - aPI.GetParameter(); + } else { + aP = aPI.GetParameter(); + } + + aP = aFP + (aLP - aFP) * aP; aPnt = aCurve->Value(aP); } else { @@ -393,6 +400,7 @@ GetCreationInformation(std::string& theOperationName, case POINT_CURVE_PAR: AddParam( theParams, "Edge", aCI.GetCurve() ); AddParam( theParams, "Parameter", aCI.GetParameter() ); + AddParam( theParams, "Use Orientation", aCI.GetTakeOrientationIntoAccount() ); break; case POINT_CURVE_COORD: AddParam( theParams, "X", aCI.GetX() ); diff --git a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx index 52f6d2109..48e5353ea 100644 --- a/src/GEOMImpl/GEOMImpl_PrismDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PrismDriver.cxx @@ -351,7 +351,8 @@ TopoDS_Shape GEOMImpl_PrismDriver::MakeScaledPrism (const TopoDS_Shape& theShape aLocs->Append(aShapeCDG_1); aLocs->Append(aShapeCDG_2); - aShape = GEOMImpl_PipeDriver::CreatePipeWithDifferentSections(aWirePath, aBases, aLocs, false, false); + aShape = GEOMImpl_PipeDriver::CreatePipeWithDifferentSections + (aWirePath, aBases, aLocs, false, false, false); // 7. Make a solid, if possible if (theShapeBase.ShapeType() == TopAbs_FACE) { diff --git a/src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx b/src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx index 0c34bc8c2..db0fae349 100644 --- a/src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ProjectionDriver.cxx @@ -33,6 +33,8 @@ #include #include +#include +#include #include #include #include @@ -428,10 +430,11 @@ Standard_Integer GEOMImpl_ProjectionDriver::Execute(TFunction_Logbook& log) cons } // Get the face. - const TopAbs_ShapeEnum aType = aShape.ShapeType(); - const Standard_Real aRadius = aProj.GetRadius(); - const Standard_Real aStartAngle = aProj.GetStartAngle(); - const Standard_Real aLengthAngle = aProj.GetAngleLength(); + const TopAbs_ShapeEnum aType = aShape.ShapeType(); + const Standard_Real aRadius = aProj.GetRadius(); + const Standard_Real aStartAngle = aProj.GetStartAngle(); + const Standard_Real aLengthAngle = aProj.GetAngleLength(); + const Standard_Real aRotationAngle = aProj.GetAngleRotation(); if (aType != TopAbs_WIRE && aType != TopAbs_FACE) { return 0; @@ -441,8 +444,8 @@ Standard_Integer GEOMImpl_ProjectionDriver::Execute(TFunction_Logbook& log) cons return 0; } - TopoDS_Shape aProjShape = - projectOnCylinder(aShape, aRadius, aStartAngle, aLengthAngle); + TopoDS_Shape aProjShape = projectOnCylinder + (aShape, aRadius, aStartAngle, aLengthAngle, aRotationAngle); if (aProjShape.IsNull()) { return 0; @@ -504,6 +507,8 @@ GetCreationInformation(std::string& theOperationName, AddParam(theParams, "Length angle", aLengthAngle); } + AddParam(theParams, "Rotation angle", aProj.GetAngleRotation()); + break; } default: @@ -523,7 +528,8 @@ TopoDS_Shape GEOMImpl_ProjectionDriver::projectOnCylinder (const TopoDS_Shape &theShape, const Standard_Real theRadius, const Standard_Real theStartAngle, - const Standard_Real theAngleLength) const + const Standard_Real theAngleLength, + const Standard_Real theAngleRotation) const { TopoDS_Shape aResult; @@ -596,8 +602,6 @@ TopoDS_Shape GEOMImpl_ProjectionDriver::projectOnCylinder // Compute 2d translation transformation. TopoDS_Wire anOuterWire = BRepTools::OuterWire(aFace); - Standard_Real aU[2]; - Standard_Real aV[2]; BRepTools_WireExplorer aOWExp(anOuterWire, aFace); if (!aOWExp.More()) { @@ -605,21 +609,63 @@ TopoDS_Shape GEOMImpl_ProjectionDriver::projectOnCylinder return aResult; } - // Compute anisotropic transformation from a face's 2d space - // to cylinder's 2d space. - BRepTools::UVBounds(aFace, anOuterWire, aU[0], aU[1], aV[0], aV[1]); - + // Rotate 2D presentation of face. TopoDS_Vertex aFirstVertex = aOWExp.CurrentVertex(); TopoDS_Edge aFirstEdge = aOWExp.Current(); gp_Pnt aPnt = BRep_Tool::Pnt(aFirstVertex); BRepAdaptor_Curve2d anAdaptorCurve(aFirstEdge, aFace); Standard_Real aParam = BRep_Tool::Parameter(aFirstVertex, aFirstEdge, aFace); - gp_Pnt2d aPntUV = anAdaptorCurve.Value(aParam); + gp_Pnt2d aPntUV; + gp_Vec2d aVecUV; + gp_Vec2d aVecU0(1., 0); + anAdaptorCurve.D1(aParam, aPntUV, aVecUV); + + if (aVecUV.Magnitude() <= gp::Resolution()) { + return aResult; + } + + if (aFirstEdge.Orientation() == TopAbs_REVERSED) { + aVecUV.Reverse(); + } + + const Standard_Real anAngle = aVecUV.Angle(aVecU0) + theAngleRotation; + const Standard_Boolean isToRotate = Abs(anAngle) > Precision::Angular(); + gp_Trsf2d aRotTrsf; + Bnd_Box2d aUVBox; + Standard_Real aPar[2]; + + if (isToRotate) { + aRotTrsf.SetRotation(aPntUV, anAngle); + } + + for (; aOWExp.More(); aOWExp.Next()) { + TopoDS_Edge anEdge = aOWExp.Current(); + Handle(Geom2d_Curve) aCurve = + BRep_Tool::CurveOnSurface(anEdge, aFace, aPar[0], aPar[1]); + + if (aCurve.IsNull()) { + continue; + } + + if (isToRotate) { + aCurve = Handle(Geom2d_Curve)::DownCast(aCurve->Transformed(aRotTrsf)); + } + + BndLib_Add2dCurve::Add(aCurve, aPar[0], aPar[1], 0., aUVBox); + } + + Standard_Real aU[2]; + Standard_Real aV[2]; + + aUVBox.Get(aU[0], aV[0], aU[1], aV[1]); + + // Compute anisotropic transformation from a face's 2d space + // to cylinder's 2d space. GEOMUtils::Trsf2d aTrsf2d (1./theRadius, 0., theStartAngle - aU[0]/theRadius, - 0., 1., aPnt.Z() - 0.5*(aV[1] - aV[0]) - aPntUV.Y()); + 0., 1., aPnt.Z() - aPntUV.Y()); // Compute scaling trsf. const Standard_Boolean isToScale = theAngleLength >= Precision::Angular(); @@ -640,7 +686,6 @@ TopoDS_Shape GEOMImpl_ProjectionDriver::projectOnCylinder new Geom_CylindricalSurface(gp_Ax3(), theRadius); GeomAdaptor_Surface aGACyl(aCylinder); TopExp_Explorer anExp(aFace, TopAbs_WIRE); - Standard_Real aPar[2]; TopTools_ListOfShape aWires; Standard_Real aUResol = aGACyl.UResolution(Precision::Confusion()); Standard_Real aVResol = aGACyl.VResolution(Precision::Confusion()); @@ -659,6 +704,10 @@ TopoDS_Shape GEOMImpl_ProjectionDriver::projectOnCylinder continue; } + if (isToRotate) { + aCurve = Handle(Geom2d_Curve)::DownCast(aCurve->Transformed(aRotTrsf)); + } + // Transform the curve to cylinder's parametric space. GEOMUtils::Handle(HTrsfCurve2d) aTrsfCurve = new GEOMUtils::HTrsfCurve2d(aCurve, aPar[0], aPar[1], aTrsf2d); diff --git a/src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx b/src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx index ee703af55..47dfc4413 100644 --- a/src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx +++ b/src/GEOMImpl/GEOMImpl_ProjectionDriver.hxx @@ -87,7 +87,8 @@ private: TopoDS_Shape projectOnCylinder(const TopoDS_Shape &theShape, const Standard_Real theRadius, const Standard_Real theStartAngle, - const Standard_Real theAngleLength) const; + const Standard_Real theAngleLength, + const Standard_Real theAngleRotation) const; public: diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx index 933ad9eea..8b585f83e 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -107,6 +107,62 @@ #include +namespace +{ + // check that compound includes only shapes of expected type + bool checkCompound( TopoDS_Shape& c, TopAbs_ShapeEnum t ) + { + TopoDS_Iterator it( c, Standard_True, Standard_True ); + + // empty compound is OK only if we explicitly create a compound of shapes + bool result = true; + + // => if expected type is TopAbs_SHAPE, we allow compound consisting of any shapes, this above check is enough + // => otherwise we have to check compound's content + // => compound sometimes can contain enclosed compound(s), we process them recursively and rebuild initial compound + + if ( t != TopAbs_SHAPE ) { + result = it.More(); + std::list compounds, shapes; + compounds.push_back( c ); + while ( !compounds.empty() && result ) { + // check that compound contains only shapes of expected type + TopoDS_Shape cc = compounds.front(); + compounds.pop_front(); + it.Initialize( cc, Standard_True, Standard_True ); + for ( ; it.More() && result; it.Next() ) { + TopAbs_ShapeEnum tt = it.Value().ShapeType(); + if ( tt == TopAbs_COMPOUND || tt == TopAbs_COMPSOLID ) { + compounds.push_back( it.Value() ); + continue; + } + shapes.push_back( it.Value() ); + result = tt == t; + } + } + if ( result ) { + if ( shapes.empty() ) { + result = false; + } + else if ( shapes.size() == 1 ) { + c = shapes.front(); + } + else { + BRep_Builder b; + TopoDS_Compound newc; + b.MakeCompound( newc ); + std::list ::const_iterator sit; + for ( sit = shapes.begin(); sit != shapes.end(); ++sit ) + b.Add( newc, *sit ); + c = newc; + } + } + } + + return result; + } +} + //modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f //static // void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges, @@ -146,12 +202,17 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const TopoDS_Shape aShape; TCollection_AsciiString aWarning; - std::list anExpectedType; + + // this is an exact type of expected shape, or shape in a compound if compound is allowed as a result (see below) + TopAbs_ShapeEnum anExpectedType = TopAbs_SHAPE; + // this should be true if result can be a compound of shapes of strict type (see above) + bool allowCompound = false; BRep_Builder B; if (aType == WIRE_EDGES) { - anExpectedType.push_back(TopAbs_WIRE); + // result may be only a single wire + anExpectedType = TopAbs_WIRE; Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); @@ -162,7 +223,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const aShape = MakeWireFromEdges(aShapes, aTolerance); } else if (aType == FACE_WIRE) { - anExpectedType.push_back(TopAbs_FACE); + // result may be a face or a compound of faces + anExpectedType = TopAbs_FACE; + allowCompound = true; Handle(GEOM_Function) aRefBase = aCI.GetBase(); TopoDS_Shape aShapeBase = aRefBase->GetValue(); @@ -197,7 +260,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const } } else if (aType == FACE_WIRES) { - anExpectedType.push_back(TopAbs_FACE); + // result may be a face or a compound of faces + anExpectedType = TopAbs_FACE; + allowCompound = true; // Try to build a face from a set of wires and edges int ind; @@ -325,7 +390,8 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const } } else if (aType == FACE_FROM_SURFACE) { - anExpectedType.push_back(TopAbs_FACE); + // result may be only a face + anExpectedType = TopAbs_FACE; Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); @@ -361,7 +427,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const } } else if (aType == SHELL_FACES) { - anExpectedType.push_back(TopAbs_SHELL); + // result may be only a shell or a compound of shells + anExpectedType = TopAbs_SHELL; + allowCompound = true; Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); unsigned int ind, nbshapes = aShapes->Length(); @@ -420,7 +488,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const } else if (aType == SOLID_SHELLS) { - anExpectedType.push_back(TopAbs_SOLID); + // result may be only a solid or a compound of solids + anExpectedType = TopAbs_SOLID; + allowCompound = true; Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); unsigned int ind, nbshapes = aShapes->Length(); @@ -463,7 +533,8 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const aShape = Sol; } else if (aType == COMPOUND_SHAPES) { - anExpectedType.push_back(TopAbs_COMPOUND); + // result may be only a compound of any shapes + allowCompound = true; Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); unsigned int ind, nbshapes = aShapes->Length(); @@ -484,7 +555,8 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const } else if (aType == EDGE_WIRE) { - anExpectedType.push_back(TopAbs_EDGE); + // result may be only an edge + anExpectedType = TopAbs_EDGE; Handle(GEOM_Function) aRefBase = aCI.GetBase(); TopoDS_Shape aWire = aRefBase->GetValue(); @@ -495,9 +567,9 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const aShape = MakeEdgeFromWire(aWire, LinTol, AngTol); } else if (aType == SOLID_FACES) { - anExpectedType.push_back(TopAbs_SOLID); - anExpectedType.push_back(TopAbs_COMPOUND); - anExpectedType.push_back(TopAbs_COMPSOLID); + // result may be only a solid or a compound of solids + anExpectedType = TopAbs_SOLID; + allowCompound = true; Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); unsigned int ind, nbshapes = aShapes->Length(); @@ -534,7 +606,8 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const aShape = aMV.Shape(); } else if (aType == EDGE_CURVE_LENGTH) { - anExpectedType.push_back(TopAbs_EDGE); + // result may be only an edge + anExpectedType = TopAbs_EDGE; GEOMImpl_IVector aVI (aFunction); @@ -609,7 +682,12 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const BRepBuilderAPI_MakeEdge aME (ReOrientedCurve, UFirst, aParam); if (aME.IsDone()) aShape = aME.Shape(); - } else if (aType == SHAPE_ISOLINE) { + } + else if (aType == SHAPE_ISOLINE) { + // result may be only an edge or compound of edges + anExpectedType = TopAbs_EDGE; + allowCompound = true; + GEOMImpl_IIsoline aII (aFunction); Handle(GEOM_Function) aRefFace = aII.GetFace(); TopoDS_Shape aShapeFace = aRefFace->GetValue(); @@ -635,8 +713,11 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const Standard_NullObject::Raise ("Shape for isoline construction is not a face"); } - } else if (aType == EDGE_UV) { - anExpectedType.push_back(TopAbs_EDGE); + } + else if (aType == EDGE_UV) { + // result may be only an edge + anExpectedType = TopAbs_EDGE; + GEOMImpl_IShapeExtend aSE (aFunction); Handle(GEOM_Function) aRefEdge = aSE.GetShape(); TopoDS_Shape aShapeEdge = aRefEdge->GetValue(); @@ -646,8 +727,10 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const aShape = ExtendEdge(anEdge, aSE.GetUMin(), aSE.GetUMax()); } - } else if (aType == FACE_UV) { - anExpectedType.push_back(TopAbs_FACE); + } + else if (aType == FACE_UV) { + // result may be only a face + anExpectedType = TopAbs_FACE; GEOMImpl_IShapeExtend aSE (aFunction); Handle(GEOM_Function) aRefFace = aSE.GetShape(); @@ -660,8 +743,10 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const aShape = ExtendFace(aFace, aSE.GetUMin(), aSE.GetUMax(), aSE.GetVMin(), aSE.GetVMax()); } - } else if (aType == SURFACE_FROM_FACE) { - anExpectedType.push_back(TopAbs_FACE); + } + else if (aType == SURFACE_FROM_FACE) { + // result may be only a face + anExpectedType = TopAbs_FACE; GEOMImpl_IShapeExtend aSE (aFunction); Handle(GEOM_Function) aRefFace = aSE.GetShape(); @@ -706,7 +791,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const if (aShape.IsNull()) return 0; // Check shape validity - BRepCheck_Analyzer ana (aShape, false); + BRepCheck_Analyzer ana (aShape, true); if (!ana.IsValid()) { //Standard_ConstructionError::Raise("Algorithm have produced an invalid shape result"); // For Mantis issue 0021772: EDF 2336 GEOM: Non valid face created from two circles @@ -715,17 +800,18 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const aShape = aSfs->Shape(); } - // Check if the result shape type is compatible with the expected. + // Check if the result shape is of expected type. const TopAbs_ShapeEnum aShType = aShape.ShapeType(); - if (!anExpectedType.empty()) { - bool ok = false; - std::list::const_iterator it; - for (it = anExpectedType.begin(); it != anExpectedType.end() && !ok; ++it) - ok = (*it == TopAbs_SHAPE || *it == aShType); - if (!ok) - Standard_ConstructionError::Raise("Result type check failed"); + bool ok = false; + if ( aShType == TopAbs_COMPOUND || aShType == TopAbs_COMPSOLID ) { + ok = allowCompound && checkCompound( aShape, anExpectedType ); } + else { + ok = ( anExpectedType == TopAbs_SHAPE ) || ( aShType == anExpectedType ); + } + if (!ok) + Standard_ConstructionError::Raise("Result type check failed"); aFunction->SetValue(aShape); @@ -861,11 +947,13 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire, { Standard_Boolean Done = Standard_False; Standard_Real NewFpar, NewLpar; - GeomAdaptor_Curve GAprevcurve(CurveSeq.Last()); + Handle(Geom_Geometry) aTrsfGeom = CurveSeq.Last()->Transformed + (LocSeq.Last().Location().Transformation()); + GeomAdaptor_Curve GAprevcurve(Handle(Geom_Curve)::DownCast(aTrsfGeom)); TopoDS_Vertex CurVertex = wexp.CurrentVertex(); TopoDS_Vertex CurFirstVer = TopExp::FirstVertex(anEdge); TopAbs_Orientation ConnectByOrigin = (CurVertex.IsSame(CurFirstVer))? TopAbs_FORWARD : TopAbs_REVERSED; - if (aCurve == CurveSeq.Last()) + if (aCurve == CurveSeq.Last() && aLoc.IsEqual(LocSeq.Last().Location())) { NewFpar = fpar; NewLpar = lpar; diff --git a/src/GEOMToolsGUI/CMakeLists.txt b/src/GEOMToolsGUI/CMakeLists.txt index ea18e8b90..cb3e004cb 100755 --- a/src/GEOMToolsGUI/CMakeLists.txt +++ b/src/GEOMToolsGUI/CMakeLists.txt @@ -58,8 +58,13 @@ SET(_link_LIBRARIES GEOM GEOMBase Material - DependencyTree ) + +IF(SALOME_USE_GRAPHICSVIEW) + LIST(APPEND _link_LIBRARIES + DependencyTree + ) +ENDIF() # --- headers --- diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index 5fe45f595..7a437d272 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -206,9 +206,11 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) case GEOMOp::OpDelete: // EDIT - DELETE OnEditDelete(); break; +#ifndef DISABLE_PYCONSOLE case GEOMOp::OpCheckGeom: // TOOLS - CHECK GEOMETRY OnCheckGeometry(); break; +#endif case GEOMOp::OpSelectVertex: // POPUP - SELECT ONLY - VERTEX OnSelectOnly( GEOM_POINT ); break; @@ -306,9 +308,11 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent) case GEOMOp::OpSortChildren: OnSortChildren(); break; +#ifndef DISABLE_GRAPHICSVIEW case GEOMOp::OpShowDependencyTree: OnShowDependencyTree(); break; +#endif case GEOMOp::OpReduceStudy: OnReduceStudy(); break; diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h index 581d10f7b..6916bdfa8 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.h +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -87,7 +87,9 @@ private: void OnClsBringToFront(); void OnCreateFolder(); void OnSortChildren(); +#ifndef DISABLE_GRAPHICSVIEW void OnShowDependencyTree(); +#endif void OnReduceStudy(); // Shortcut commands diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx index d00c98d24..b83b3e77e 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_1.cxx @@ -24,7 +24,9 @@ // File : GEOMToolsGUI_1.cxx // Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com) +#ifndef DISABLE_PYCONSOLE #include +#endif #include "GEOMToolsGUI.h" #include "GEOMToolsGUI_TransparencyDlg.h" @@ -47,9 +49,11 @@ #include #include +#ifndef DISABLE_GRAPHICSVIEW #include #include #include +#endif #include @@ -126,6 +130,7 @@ // on Show Dependencies operation #define LAYOUT_DEPVIEW +#ifndef DISABLE_PYCONSOLE void GEOMToolsGUI::OnCheckGeometry() { SalomeApp_Application* app = @@ -135,6 +140,7 @@ void GEOMToolsGUI::OnCheckGeometry() if (pyConsole) pyConsole->exec("from GEOM_usinggeom import *"); } +#endif void GEOMToolsGUI::OnAutoColor() { @@ -882,6 +888,7 @@ void GEOMToolsGUI::OnSortChildren() app->updateObjectBrowser( true ); } +#ifndef DISABLE_GRAPHICSVIEW void GEOMToolsGUI::OnShowDependencyTree() { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); @@ -932,6 +939,7 @@ void GEOMToolsGUI::OnShowDependencyTree() #endif depVw->setFocus(); } +#endif void GEOMToolsGUI::OnReduceStudy() { diff --git a/src/GEOMUtils/CMakeLists.txt b/src/GEOMUtils/CMakeLists.txt index 039990ab7..a2bbfd9d0 100755 --- a/src/GEOMUtils/CMakeLists.txt +++ b/src/GEOMUtils/CMakeLists.txt @@ -53,6 +53,7 @@ SET(GEOMUtils_HEADERS GEOMUtils.hxx GEOMUtils_Hatcher.hxx GEOMUtils_HTrsfCurve2d.hxx + GEOMUtils_ShapeStatistics.hxx GEOMUtils_Trsf2d.hxx GEOMUtils_TrsfCurve2d.hxx GEOMUtils_XmlHandler.hxx @@ -63,6 +64,7 @@ SET(GEOMUtils_SOURCES GEOMUtils.cxx GEOMUtils_Hatcher.cxx GEOMUtils_HTrsfCurve2d.cxx + GEOMUtils_ShapeStatistics.cxx GEOMUtils_Trsf2d.cxx GEOMUtils_TrsfCurve2d.cxx GEOMUtils_XmlHandler.cxx diff --git a/src/GEOMUtils/GEOMUtils_ShapeStatistics.cxx b/src/GEOMUtils/GEOMUtils_ShapeStatistics.cxx new file mode 100644 index 000000000..4ef3b8658 --- /dev/null +++ b/src/GEOMUtils/GEOMUtils_ShapeStatistics.cxx @@ -0,0 +1,147 @@ +// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : GEOMUtils_ShapeStatisticsDlg.cxx +// Author : Alexander KOVALEV, OPEN CASCADE S.A.S. + +#include "GEOMUtils_ShapeStatistics.hxx" + +#include +#include +#include +#include +#include + +namespace GEOMUtils +{ +//================================================================================= +// function : ComputeMeasures() +// purpose : gets measures of the given type for list of shapes in the range +//================================================================================= + std::map ComputeMeasures( std::list shapes, + TopAbs_ShapeEnum entity, + Range &range) +{ + bool hasRange = (range.min != -1.0); // -1.0 means that range must not be used + if ( !hasRange ) + range.min = 1e+32, range.max = 0.0; + // list of measures of entities + std::map measures; + + std::list::const_iterator it; + int shift = 0; + for ( it = shapes.begin(); it != shapes.end(); ++it ) { + double aMeasure; + TopTools_IndexedMapOfShape aSubShapesMap; + TopExp::MapShapes(*it, aSubShapesMap); // map of all global indices + TopTools_IndexedMapOfShape aMx; + TopExp::MapShapes( *it, entity, aMx ); // map of current type sub-shape indices + int aNbS = aMx.Extent(); + int index = -1; + for ( int i = 1; i <= aNbS; ++i ) { + aMeasure = 0.0; + const TopoDS_Shape& aSubShape = aMx( i ); + //Get the measure: length, area or volume + GProp_GProps LProps, SProps, VProps; + if ( entity == TopAbs_EDGE ) { + BRepGProp::LinearProperties( aSubShape, LProps ); + aMeasure = LProps.Mass(); + } else if ( entity == TopAbs_FACE ) { + BRepGProp::SurfaceProperties( aSubShape, SProps ); + aMeasure = SProps.Mass(); + } else if ( entity == TopAbs_SOLID ) { + BRepGProp::VolumeProperties( aSubShape, VProps ); + aMeasure = VProps.Mass(); + } + // Don't pass sub-shapes with out of range measure, if range is used + if ( hasRange ) { + if ( aMeasure < range.min || aMeasure > range.max ) + continue; + } else { + // get range min and max + if ( aMeasure < range.min ) range.min = aMeasure; + if ( aMeasure > range.max ) range.max = aMeasure; + } + // get global index of sub-shape + index = aSubShapesMap.FindIndex( aSubShape ); + // keep measures to distribute it + measures[shift+index] = aMeasure; + } + shift += aSubShapesMap.Extent(); + } + return measures; +} + +//================================================================================= +// function : ComputeDistribution() +// purpose : gets distribution data for single shape +//================================================================================= +Distribution ComputeDistribution( TopoDS_Shape shape, + TopAbs_ShapeEnum entity, + int intervals, + Range range) +{ + std::list aShapes; + aShapes.push_back( shape ); + return ComputeDistribution( aShapes, entity, intervals, range ); +} + +//================================================================================= +// function : ComputeDistribution() +// purpose : gets distribution data for list of shapes +//================================================================================= +Distribution ComputeDistribution( std::list shapes, + TopAbs_ShapeEnum entity, + int nbIntervals, + Range range) +{ + // get list of measures and compute range (if it was not specified) + std::map measures = ComputeMeasures( shapes, entity, range ); + + // compute a step + double aStep = (range.max - range.min) / nbIntervals; + + // compute distribution in intervals + Distribution aDistr; + std::map::iterator dit; + for ( int i = 0; i < nbIntervals; i++ ) { + Range localRange; // range of current interval + localRange.min = range.min + ( i * aStep ); + localRange.max = range.min + ( (i+1) * aStep ); + localRange.count = 0; + + std::vector indicesToErase; + for ( dit = measures.begin(); dit != measures.end(); dit++ ) { + if ( ( dit->second >= localRange.min && dit->second < localRange.max ) || + ( i == nbIntervals-1 && dit->second == localRange.max ) ) { + localRange.count++; + localRange.indices.push_back( dit->first ); + // measure is in interval, so remove it from map of search + indicesToErase.push_back( dit->first ); + } + } + aDistr.push_back( localRange ); + for( int j=0; j < indicesToErase.size(); j++ ) + measures.erase( indicesToErase[j] ); + } + + return aDistr; +} + +} //namespace GEOMUtils diff --git a/src/GEOMUtils/GEOMUtils_ShapeStatistics.hxx b/src/GEOMUtils/GEOMUtils_ShapeStatistics.hxx new file mode 100644 index 000000000..703050e51 --- /dev/null +++ b/src/GEOMUtils/GEOMUtils_ShapeStatistics.hxx @@ -0,0 +1,61 @@ +// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : GEOMUtils_ShapeStatisticsDlg.hxx +// Author : Alexander KOVALEV, OPEN CASCADE S.A.S. + +#ifndef _GEOMUtils_ShapeStatistics_HXX_ +#define _GEOMUtils_ShapeStatistics_HXX_ + +#include +#include +#include + +#include + +namespace GEOMUtils +{ + // struct to store range data + typedef struct { double min; double max; long count; std::list indices; } Range; + // distribution is a set of ranges + typedef std::vector Distribution; + + // function to get measures of entities and compute range for list of shapes + Standard_EXPORT std::map ComputeMeasures( + std::list shapes, + TopAbs_ShapeEnum entity, + Range &range ); + + // function to get distribution data for single shape + Standard_EXPORT Distribution ComputeDistribution( + TopoDS_Shape shape, + TopAbs_ShapeEnum entity, + int intervals, + Range range ); + + // function to get distribution data for list of shapes + Standard_EXPORT Distribution ComputeDistribution( + std::list shapes, + TopAbs_ShapeEnum entity, + int intervals, + Range range ); + +} + +#endif // _GEOMUtils_ShapeStatistics_HXX_ diff --git a/src/GEOM_I/GEOM_Gen_i.cc b/src/GEOM_I/GEOM_Gen_i.cc index 7a824de35..7f60f803e 100755 --- a/src/GEOM_I/GEOM_Gen_i.cc +++ b/src/GEOM_I/GEOM_Gen_i.cc @@ -66,7 +66,6 @@ #include #include -#include #include #include @@ -326,8 +325,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, std::string plgId; for ( size_t j = 0; j < infoSeq->length(); ++j ) for ( size_t i = 0; i < infoSeq[j].params.length(); ++i ) { - std::string param_name = infoSeq[j].params[i].name.in(); - std::string param_value = infoSeq[j].params[i].value.in(); + std::string param_name = infoSeq[j].params[i].name.in(); + std::string param_value = infoSeq[j].params[i].value.in(); if( param_name == PLUGIN_NAME) { plgId = param_value; break; @@ -684,8 +683,8 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, useCaseBuilder->SetRootCurrent(); useCaseBuilder->Append( theComponent ); // component object is added as the top level item } - - SALOMEDS::ChildIterator_wrap it = study->NewChildIterator( theComponent ); + + SALOMEDS::ChildIterator_wrap it = study->NewChildIterator( theComponent ); for ( it->InitEx(true); it->More(); it->Next() ) { if ( !useCaseBuilder->IsUseCaseNode( it->Value() ) ) { useCaseBuilder->AppendTo( it->Value()->GetFather(), it->Value() ); @@ -2459,7 +2458,7 @@ GEOM::GEOM_IOperations_ptr GEOM_Gen_i::GetPluginOperations(CORBA::Long theStudyI aServant = myOpCreatorMap[aLibName]->Create(_poa, theStudyID, engine, _impl); // activate the CORBA servant if (aServant) - operations = aServant->_this(); + operations = aServant->_this(); } } catch (SALOME_Exception& S_ex) { @@ -2484,7 +2483,7 @@ void GEOM_Gen_i::LoadPlugin(const std::string& theLibName) aPlatformLibName += theLibName; aPlatformLibName += ".so"; #endif - + // check, if corresponding operations are already created if (myOpCreatorMap.find(theLibName) == myOpCreatorMap.end()) { // load plugin library @@ -2497,7 +2496,7 @@ void GEOM_Gen_i::LoadPlugin(const std::string& theLibName) throw(SALOME_Exception(LOCALIZED( "Can't load server geometry plugin library" ))); #endif } - + // get method, returning operations creator typedef GEOM_GenericOperationsCreator* (*GetOperationsCreator)(); GetOperationsCreator procHandle = @@ -2506,7 +2505,7 @@ void GEOM_Gen_i::LoadPlugin(const std::string& theLibName) UnLoadLib(libHandle); throw(SALOME_Exception(LOCALIZED("bad geometry plugin library"))); } - + // get operations creator GEOM_GenericOperationsCreator* aCreator = procHandle(); if (aCreator) { @@ -2808,8 +2807,8 @@ char* GEOM_Gen_i::getVersion() // function : CreateFolder() // purpose : Creates and returns a new folder object //================================================================================= -SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName, - SALOMEDS::SObject_ptr theFather) +SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName, + SALOMEDS::SObject_ptr theFather) { SALOMEDS::SObject_var aFolderSO; @@ -2861,8 +2860,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::CreateFolder(const char* theName, // function : MoveToFolder() // purpose : Moves GEOM object to the specified folder //================================================================================= -void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject, - SALOMEDS::SObject_ptr theFolder) { +void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject, + SALOMEDS::SObject_ptr theFolder) { GEOM::object_list_var objects = new GEOM::object_list(); objects->length( 1 ); SALOMEDS::SObject_var aSO = theFolder->GetStudy()->FindObjectID( theObject->GetStudyEntry() ); @@ -2874,8 +2873,8 @@ void GEOM_Gen_i::MoveToFolder(GEOM::GEOM_Object_ptr theObject, // function : MoveListToFolder() // purpose : Moves list of GEOM objects to the specified folder //================================================================================= -void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO, - SALOMEDS::SObject_ptr theFolder) { +void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO, + SALOMEDS::SObject_ptr theFolder) { int aLen = theListOfGO.length(); GEOM::object_list_var objects = new GEOM::object_list(); objects->length( aLen ); @@ -2892,12 +2891,12 @@ void GEOM_Gen_i::MoveListToFolder (const GEOM::ListOfGO& theListOfGO, //================================================================================= // function : Move() -// purpose : Moves objects to the specified position. +// purpose : Moves objects to the specified position. // Is used in the drag-n-drop functionality. //================================================================================= void GEOM_Gen_i::Move( const GEOM::object_list& what, - SALOMEDS::SObject_ptr where, - CORBA::Long row ) + SALOMEDS::SObject_ptr where, + CORBA::Long row ) { if ( CORBA::is_nil( where ) ) return; @@ -2907,7 +2906,7 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what, SALOMEDS::SComponent_var father = where->GetFatherComponent(); std::string dataType = father->ComponentDataType(); if ( dataType != "GEOM" ) return; // not a GEOM component - + SALOMEDS::SObject_var objAfter; if ( row >= 0 && useCaseBuilder->HasChildren( where ) ) { // insert at given row -> find insertion position @@ -2918,7 +2917,7 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what, objAfter = useCaseIt->Value(); } } - + for ( int i = 0; i < what.length(); i++ ) { SALOMEDS::SObject_var sobj = what[i]; if ( CORBA::is_nil( sobj ) ) continue; // skip bad object @@ -2930,155 +2929,12 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what, } } -//================================================================================= -// function : importData -// purpose : imports geometrical data file into the GEOM internal data structure -//================================================================================= -Engines::ListOfIdentifiers* GEOM_Gen_i::importData( - CORBA::Long studyId, Engines::DataContainer_ptr data, const Engines::ListOfOptions& options) -{ - CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" ); - SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject ); - SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId ); - - Engines::ListOfIdentifiers_var aResult = new Engines::ListOfIdentifiers; - GEOM::GEOM_IInsertOperations_var aInsOp = GetIInsertOperations(aStudy->StudyId()); - if (aInsOp->_is_nil()) { - MESSAGE("No insert operations!"); - return aResult._retn(); - } - - // Get a temporary directory to store a file - std::string aTmpDir = SALOMEDS_Tool::GetTmpDir(); - std::string aFileName("file"); - if (aFileName.rfind("/") != std::string::npos) { // remove folders from the name - aFileName = aFileName.substr(aFileName.rfind("/") + 1); - } - - std::string anExtension(data->extension()); - aFileName += "." + anExtension; - // convert extension to upper case - std::transform(anExtension.begin(), anExtension.end(), anExtension.begin(), ::toupper); - std::string aFullPath = aTmpDir + aFileName; - - Engines::TMPFile* aFileStream = data->get(); - const char *aBuffer = (const char*)aFileStream->NP_data(); -#ifdef WIN32 - std::ofstream aFile(aFullPath.c_str(), std::ios::binary); -#else - std::ofstream aFile(aFullPath.c_str()); -#endif - aFile.write(aBuffer, aFileStream->length()); - aFile.close(); - - GEOM::ListOfGBO_var aObjects = aInsOp->ImportFile(aFullPath.c_str(), "XAO"); - - if ( aObjects->length() > 0 && aInsOp->IsDone() ) { - aResult->length(aObjects->length()); - // publish main object (first in the list of returned geom objects) - CORBA::String_var aName = aObjects[0]->GetName(); - SALOMEDS::SObject_var aSO = PublishInStudy(aStudy.in(), SALOMEDS::SObject::_nil(), aObjects[0].in(), aName.in()); - aResult[0] = aSO->GetID(); - // publish groups && fields - for (int i = 1; i < aObjects->length(); i++ ) { - aName = aObjects[i]->GetName(); - aSO = AddInStudy(aStudy.in(), aObjects[0].in(), aName.in(), aObjects[0].in()); - aResult[i] = aSO->GetID(); - } - } - else { - if (aObjects->length() == 0) - MESSAGE("ImportXAO operation is failed for file "<IsDone()) - MESSAGE("Import operation is not done for file "<DocumentModified(studyId, false); - return aResult._retn(); -} - -//================================================================================= -// function : getModifiedData -// purpose : exports all geometry of this GEOM module into one BRep file -//================================================================================= -Engines::ListOfData* GEOM_Gen_i::getModifiedData(CORBA::Long studyId) -{ - Engines::ListOfData_var aResult = new Engines::ListOfData; - - if (!_impl->DocumentModified(studyId)) { - MESSAGE("Document is not modified") - return aResult._retn(); - } - - CORBA::Object_var aSMObject = name_service->Resolve("/myStudyManager"); - SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject ); - if (CORBA::is_nil(aStudyManager)) - return aResult._retn(); - SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId ); - if (CORBA::is_nil(aStudy)) - return aResult._retn(); - SALOMEDS::SComponent_var aComponent = aStudy->FindComponent("GEOM"); - if (CORBA::is_nil(aComponent)) - return aResult._retn(); - SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(aComponent); // check only published shapes - - GEOM::GEOM_IInsertOperations_var aInsOp = GetIInsertOperations(aStudy->StudyId()); - if (aInsOp->_is_nil()) { - MESSAGE("No insert operations!"); - return aResult._retn(); - } - - GEOM::GEOM_Object_var shapeObj; - - for(; anIter->More(); anIter->Next()) { - SALOMEDS::SObject_var aSO = anIter->Value(); - SALOMEDS::SObject_var aRefSO; - // export only not referenced objects, or referenced outside of GEOM - if (!aSO->ReferencedObject(aRefSO) || aRefSO->GetFatherComponent()->GetID() != aComponent->GetID()) { - CORBA::Object_var anObj = aSO->GetObject(); - if (!CORBA::is_nil(anObj)) { - GEOM::GEOM_Object_var aCORBAMainShape = GEOM::GEOM_Object::_narrow(anObj); - if(!aCORBAMainShape->_is_nil()) { - CORBA::String_var entry = aCORBAMainShape->GetEntry(); - Handle(GEOM_Object) aMainShape = Handle(GEOM_Object)::DownCast(_impl->GetObject(studyId, entry)); - - GEOM::shape_type aCORBAShapeType = aCORBAMainShape->GetShapeType(); - if (!aMainShape.IsNull() && !(aCORBAShapeType == GEOM::VERTEX) && !(aCORBAShapeType == GEOM::EDGE)) { - shapeObj = aCORBAMainShape; - break; - } - } - } - } - } - - if (!CORBA::is_nil(shapeObj)) { // Shape is correct, write it to the temporary file - std::string aPath = Kernel_Utils::GetTmpFileName() + ".xao"; - aInsOp->Export(shapeObj.in(), aPath.c_str(), "XAO"); - aResult->length(1); - Engines::DataContainer_var aData = (new Engines_DataContainer_i( - aPath.c_str(), "", "", true))->_this(); - aResult[0] = aData; - } else { - MESSAGE("No shapes to export"); - } - - return aResult._retn(); -} - //======================================================================= // function : GetDependencyTree // purpose : Collects dependencies of the given objects from other ones //======================================================================= SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy, - const GEOM::string_array& theObjectEntries ) { + const GEOM::string_array& theObjectEntries ) { // fill in the tree structure GEOMUtils::TreeModel tree; @@ -3102,7 +2958,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy, // translation the tree into string std::string treeStr; GEOMUtils::ConvertTreeToString( tree, treeStr ); - + // put string into stream char* aBuffer = (char*)CORBA::string_dup(treeStr.c_str()); int aBufferSize = strlen((char*)aBuffer); @@ -3118,10 +2974,10 @@ SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy, // function : getUpwardDependency // purpose : Collects the entries of objects on that the given one depends //======================================================================= -void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo, - GEOMUtils::LevelsList &upLevelList, - std::map< std::string, std::set > &passedEntries, - int level ) { +void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo, + GEOMUtils::LevelsList &upLevelList, + std::map< std::string, std::set > &passedEntries, + int level ) { std::string aGboEntry = gbo->GetEntry(); GEOMUtils::NodeLinks anEntries; GEOMUtils::LevelInfo aLevelMap; @@ -3133,7 +2989,7 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo, // get the existent map aLevelMap = upLevelList.at(level-1); if ( aLevelMap.count( aGboEntry ) > 0 ) { - anEntries = aLevelMap[ aGboEntry ]; + anEntries = aLevelMap[ aGboEntry ]; } } } @@ -3144,7 +3000,7 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo, if ( depList[j]->_is_nil() ) continue; aDepEntry = depList[j]->GetEntry(); - if ( passedEntries.count( aGboEntry ) > 0 && + if ( passedEntries.count( aGboEntry ) > 0 && passedEntries[aGboEntry].count( aDepEntry ) > 0 ) { //avoid checking the passed objects continue; @@ -3166,10 +3022,10 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo, // function : getDownwardDependency // purpose : Collects the entries of objects that depends on the given one //======================================================================= -void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo, - GEOMUtils::LevelsList &downLevelList, - std::map< std::string, std::set > &passedEntries, - int level ) { +void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo, + GEOMUtils::LevelsList &downLevelList, + std::map< std::string, std::set > &passedEntries, + int level ) { std::string aGboEntry = gbo->GetEntry(); Handle(TDocStd_Document) aDoc = GEOM_Engine::GetEngine()->GetDocument(gbo->GetStudyID()); Handle(TDataStd_TreeNode) aNode, aRoot; @@ -3201,7 +3057,7 @@ void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo, continue; if ( depList[i]->_is_equivalent( gbo ) ) { // yes, the current object depends on the given object - if ( passedEntries.count( aGoEntry ) > 0 && + if ( passedEntries.count( aGoEntry ) > 0 && passedEntries[aGoEntry].count( aGboEntry ) > 0 ) { //avoid checking the passed objects continue; @@ -3234,10 +3090,10 @@ void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo, // purpose : Fills 3 lists that is used to clean study of redundant objects //============================================================================== void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy, - GEOM::string_array& theSelectedEntries, - GEOM::string_array& theParentEntries, - GEOM::string_array& theSubEntries, - GEOM::string_array& theOtherEntries) + GEOM::string_array& theSelectedEntries, + GEOM::string_array& theParentEntries, + GEOM::string_array& theSubEntries, + GEOM::string_array& theOtherEntries) { std::set aSelected, aParents, aChildren, anOthers; for ( int i = 0; i < theSelectedEntries.length(); i++ ) { @@ -3271,7 +3127,7 @@ void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy, if ( aSelected.count( anEntry ) > 0 && aParents.count( anEntry ) == 0 ) { includeParentDependencies( geomObj, aSelected, aParents, aChildren, anOthers ); - } else if ( aParents.count( anEntry ) == 0 && + } else if ( aParents.count( anEntry ) == 0 && aChildren.count( anEntry ) == 0 ) { anOthers.insert( geomObj->GetEntry() ); } @@ -3288,7 +3144,7 @@ void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy, } // if some selected object is not a main shape, - // we move it's main shapes into 'selected' list, + // we move it's main shapes into 'selected' list, // because they could not be modified anyhow. std::set aToBeInSelected; for ( it = aSelected.begin(); it != aSelected.end(); ++it ) { @@ -3341,13 +3197,13 @@ void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy, //============================================================================== // function : includeParentDependencies -// purpose : +// purpose : //============================================================================== void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj, - std::set& aSelected, - std::set& aParents, - std::set& aChildren, - std::set& anOthers) + std::set& aSelected, + std::set& aParents, + std::set& aChildren, + std::set& anOthers) { std::string anEntry = geomObj->GetEntry(); if ( aSelected.count( anEntry ) == 0 ) { @@ -3369,10 +3225,10 @@ void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj, for( int i = 0; i < depList->length(); i++ ) { aDepEntry = depList[i]->GetEntry(); if ( depList[i]->_is_nil() || - aDepEntry == anEntry || // skip self-depending - aSelected.count( aDepEntry ) > 0 || // skip selected objects - aParents.count( aDepEntry ) > 0 // skip already processed objects - ) + aDepEntry == anEntry || // skip self-depending + aSelected.count( aDepEntry ) > 0 || // skip selected objects + aParents.count( aDepEntry ) > 0 // skip already processed objects + ) continue; includeParentDependencies( depList[i], aSelected, aParents, aChildren, anOthers ); } @@ -3380,14 +3236,14 @@ void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj, //============================================================================== // function : includeSubObjects -// purpose : +// purpose : //============================================================================== void GEOM_Gen_i::includeSubObjects(SALOMEDS::Study_ptr theStudy, - const std::string& aSelectedEntry, - std::set& aSelected, - std::set& aParents, - std::set& aChildren, - std::set& anOthers) + const std::string& aSelectedEntry, + std::set& aSelected, + std::set& aParents, + std::set& aChildren, + std::set& anOthers) { std::set::iterator foundIt; Handle(GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), aSelectedEntry.c_str(), false); @@ -3412,10 +3268,10 @@ void GEOM_Gen_i::includeSubObjects(SALOMEDS::Study_ptr theStudy, if ( foundIt == aParents.end() ) { // add to sub-objects if it is not in parents list foundIt = aSelected.find( aSubEntryStr ); if ( foundIt == aSelected.end() ) { // add to sub-objects if it is not in selected list - aChildren.insert( aSubEntryStr ); - foundIt = anOthers.find( aSubEntryStr ); - if ( foundIt != anOthers.end() ) - anOthers.erase( foundIt ); + aChildren.insert( aSubEntryStr ); + foundIt = anOthers.find( aSubEntryStr ); + if ( foundIt != anOthers.end() ) + anOthers.erase( foundIt ); } } includeSubObjects( theStudy, aSubEntryStr, aSelected, aParents, aChildren, anOthers ); diff --git a/src/GEOM_I/GEOM_Gen_i.hh b/src/GEOM_I/GEOM_Gen_i.hh index f56712fb0..25963bffd 100644 --- a/src/GEOM_I/GEOM_Gen_i.hh +++ b/src/GEOM_I/GEOM_Gen_i.hh @@ -201,7 +201,7 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi //Collects dependencies of the given objects from other ones SALOMEDS::TMPFile* GetDependencyTree(SALOMEDS::Study_ptr theStudy, - const GEOM::string_array& theObjectEntries); + const GEOM::string_array& theObjectEntries); //-----------------------------------------------------------------------// // Transaction methods // @@ -301,37 +301,30 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi virtual char* getVersion(); // Create a new folder object - SALOMEDS::SObject_ptr CreateFolder(const char* theName, - SALOMEDS::SObject_ptr theFather); + SALOMEDS::SObject_ptr CreateFolder(const char* theName, + SALOMEDS::SObject_ptr theFather); // Move GEOM object to the specified folder - void MoveToFolder(GEOM::GEOM_Object_ptr theObject, - SALOMEDS::SObject_ptr theFolder); + void MoveToFolder(GEOM::GEOM_Object_ptr theObject, + SALOMEDS::SObject_ptr theFolder); // Move list of GEOM objects to the specified folder - void MoveListToFolder (const GEOM::ListOfGO& theListOfGO, - SALOMEDS::SObject_ptr theFolder); + void MoveListToFolder (const GEOM::ListOfGO& theListOfGO, + SALOMEDS::SObject_ptr theFolder); // Move objects to the specified position void Move( const GEOM::object_list& what, - SALOMEDS::SObject_ptr where, - CORBA::Long row ); - - // SIMAN-related functions (check out/check in) : import data to study - virtual Engines::ListOfIdentifiers* importData(CORBA::Long studyId, - Engines::DataContainer_ptr data, - const Engines::ListOfOptions& options); - // SIMAN-related functions (check out/check in) : get modified data - virtual Engines::ListOfData* getModifiedData(CORBA::Long studyId); + SALOMEDS::SObject_ptr where, + CORBA::Long row ); /*! \brief Fills 3 lists that is used to clean study of redundant objects. * To be used from GUI. */ void GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy, - GEOM::string_array& theSelectedEntries, - GEOM::string_array& theParentEntries, - GEOM::string_array& theSubEntries, - GEOM::string_array& theOtherEntries); + GEOM::string_array& theSelectedEntries, + GEOM::string_array& theParentEntries, + GEOM::string_array& theSubEntries, + GEOM::string_array& theOtherEntries); //-----------------------------------------------------------------------// // Internal methods // @@ -381,28 +374,28 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi const Standard_CString& GrName, GEOM::ListOfGO_var aResList); - void getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo, - GEOMUtils::LevelsList &upLevelList, - std::map< std::string, std::set > &passedEntries, + void getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo, + GEOMUtils::LevelsList &upLevelList, + std::map< std::string, std::set > &passedEntries, int level = 0 ); - void getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo, - GEOMUtils::LevelsList &downLevelList, - std::map< std::string, std::set > &passedEntries, + void getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo, + GEOMUtils::LevelsList &downLevelList, + std::map< std::string, std::set > &passedEntries, int level = 0 ); void includeParentDependencies(GEOM::GEOM_BaseObject_ptr gbo, - std::set& aSelected, - std::set& aParents, - std::set& aChildren, - std::set& anOthers); + std::set& aSelected, + std::set& aParents, + std::set& aChildren, + std::set& anOthers); void includeSubObjects(SALOMEDS::Study_ptr theStudy, - const std::string& aSelectedEntry, - std::set& aSelected, - std::set& aParents, - std::set& aChildren, - std::set& anOthers); + const std::string& aSelectedEntry, + std::set& aSelected, + std::set& aParents, + std::set& aChildren, + std::set& anOthers); void LoadPlugin(const std::string& theLibName); diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc index 3d5969f71..41b415ded 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.cc +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.cc @@ -987,6 +987,7 @@ GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections GEOM::GEOM_Object_ptr thePath, CORBA::Boolean theWithContact, CORBA::Boolean theWithCorrections, + CORBA::Boolean IsBySteps, CORBA::Boolean IsGenerateGroups) { GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO; @@ -1029,7 +1030,7 @@ GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections GetOperations()->MakePipeWithDifferentSections (aSeqBases, aSeqLocations, aPath, theWithContact, - theWithCorrections, IsGenerateGroups); + theWithCorrections, IsBySteps, IsGenerateGroups); if (!GetOperations()->IsDone() || aHSeq.IsNull()) return aSeq._retn(); diff --git a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh index d5d8ea847..3fe2951eb 100644 --- a/src/GEOM_I/GEOM_I3DPrimOperations_i.hh +++ b/src/GEOM_I/GEOM_I3DPrimOperations_i.hh @@ -186,6 +186,7 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i : GEOM::GEOM_Object_ptr thePath, CORBA::Boolean theWithContact, CORBA::Boolean theWithCorrections, + CORBA::Boolean IsBySteps, CORBA::Boolean IsGenerateGroups); GEOM::ListOfGO* MakePipeWithShellSections diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.cc b/src/GEOM_I/GEOM_IBasicOperations_i.cc index 1dcf544f9..b48adfff4 100644 --- a/src/GEOM_I/GEOM_IBasicOperations_i.cc +++ b/src/GEOM_I/GEOM_IBasicOperations_i.cc @@ -135,7 +135,9 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnLinesIntersection */ //============================================================================= GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve - (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theParameter) + (GEOM::GEOM_Object_ptr theCurve, + CORBA::Double theParameter, + CORBA::Boolean takeOrientationIntoAccount) { GEOM::GEOM_Object_var aGEOMObject; @@ -147,8 +149,8 @@ GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurve if (aReference.IsNull()) return aGEOMObject._retn(); //Create the point - Handle(GEOM_Object) anObject = - GetOperations()->MakePointOnCurve(aReference, theParameter); + Handle(GEOM_Object) anObject = GetOperations()->MakePointOnCurve + (aReference, theParameter, takeOrientationIntoAccount); if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_IBasicOperations_i.hh b/src/GEOM_I/GEOM_IBasicOperations_i.hh index ec55aee27..c3e1fa3ff 100644 --- a/src/GEOM_I/GEOM_IBasicOperations_i.hh +++ b/src/GEOM_I/GEOM_IBasicOperations_i.hh @@ -52,8 +52,10 @@ class GEOM_I_EXPORT GEOM_IBasicOperations_i : CORBA::Double theY, CORBA::Double theZ); - GEOM::GEOM_Object_ptr MakePointOnCurve (GEOM::GEOM_Object_ptr theCurve, - CORBA::Double theParameter); + GEOM::GEOM_Object_ptr MakePointOnCurve + (GEOM::GEOM_Object_ptr theCurve, + CORBA::Double theParameter, + CORBA::Boolean takeOrientationIntoAccount); GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theCurve, CORBA::Double theLength, diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.cc b/src/GEOM_I/GEOM_IMeasureOperations_i.cc index f75787a3c..407d71f05 100644 --- a/src/GEOM_I/GEOM_IMeasureOperations_i.cc +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.cc @@ -765,6 +765,49 @@ CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersections (GEOM::GEOM_Obj return isGood; } +//============================================================================= +/*! + * CheckSelfIntersectionsFast + */ +//============================================================================= +CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersectionsFast + (GEOM::GEOM_Object_ptr theShape, + CORBA::Float theDeflection, + CORBA::Double theTolerance, + GEOM::ListOfLong_out theIntersections) +{ + // Set a not done flag + GetOperations()->SetNotDone(); + + bool isGood = false; + + // Allocate the CORBA arrays + GEOM::ListOfLong_var anIntegersArray = new GEOM::ListOfLong(); + + // Get the reference shape + Handle(GEOM_Object) aShape = GetObjectImpl(theShape); + + if (!aShape.IsNull()) { + Handle(TColStd_HSequenceOfInteger) anIntegers = new TColStd_HSequenceOfInteger; + + // Detect self-intersections + isGood = GetOperations()->CheckSelfIntersectionsFast + (aShape, theDeflection, theTolerance, anIntegers); + + int nbInts = anIntegers->Length(); + + anIntegersArray->length(nbInts); + + for (int ii = 0; ii < nbInts; ii++) { + anIntegersArray[ii] = anIntegers->Value(ii + 1); + } + } + + // Initialize out-parameters with local arrays + theIntersections = anIntegersArray._retn(); + return isGood; +} + //============================================================================= /*! * FastIntersect diff --git a/src/GEOM_I/GEOM_IMeasureOperations_i.hh b/src/GEOM_I/GEOM_IMeasureOperations_i.hh index 27e2e5d42..71e6194ba 100644 --- a/src/GEOM_I/GEOM_IMeasureOperations_i.hh +++ b/src/GEOM_I/GEOM_IMeasureOperations_i.hh @@ -100,6 +100,11 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i : CORBA::Long theCheckLevel, GEOM::ListOfLong_out theIntersections); + CORBA::Boolean CheckSelfIntersectionsFast (GEOM::GEOM_Object_ptr theShape, + CORBA::Float theDeflection, + CORBA::Double theTolerance, + GEOM::ListOfLong_out theIntersections); + CORBA::Boolean FastIntersect (GEOM::GEOM_Object_ptr theShape1, GEOM::GEOM_Object_ptr theShape2, CORBA::Double theTolerance, diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.cc b/src/GEOM_I/GEOM_ITransformOperations_i.cc index c18c87b6c..fbfe591f1 100644 --- a/src/GEOM_I/GEOM_ITransformOperations_i.cc +++ b/src/GEOM_I/GEOM_ITransformOperations_i.cc @@ -1402,7 +1402,8 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MakeProjectionOnCylinder (GEOM::GEOM_Object_ptr theObject, CORBA::Double theRadius, CORBA::Double theStartAngle, - CORBA::Double theAngleLength) + CORBA::Double theAngleLength, + CORBA::Double theAngleRotation) { GEOM::GEOM_Object_var aGEOMObject; @@ -1418,7 +1419,7 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MakeProjectionOnCylinder //Perform the transformation Handle(GEOM_Object) aResObject = GetOperations()->MakeProjectionOnCylinder - (anObject, theRadius, theStartAngle, theAngleLength); + (anObject, theRadius, theStartAngle, theAngleLength, theAngleRotation); if (!GetOperations()->IsDone() || aResObject.IsNull()) { return aGEOMObject._retn(); diff --git a/src/GEOM_I/GEOM_ITransformOperations_i.hh b/src/GEOM_I/GEOM_ITransformOperations_i.hh index e507c1f77..96aa0c23d 100644 --- a/src/GEOM_I/GEOM_ITransformOperations_i.hh +++ b/src/GEOM_I/GEOM_ITransformOperations_i.hh @@ -201,7 +201,8 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i : (GEOM::GEOM_Object_ptr theObject, CORBA::Double theRadius, CORBA::Double theStartAngle, - CORBA::Double theAngleLength); + CORBA::Double theAngleLength, + CORBA::Double theAngleRotation); ::GEOMImpl_ITransformOperations* GetOperations() { return (::GEOMImpl_ITransformOperations*)GetImpl(); } }; diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index 8501474d8..449a3c6b8 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -722,7 +722,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurve (GEOM::GEOM_Object_ptr the beginService( " GEOM_Superv_i::MakePointOnCurve" ); MESSAGE("GEOM_Superv_i::MakePointOnCurve"); getBasicOp(); - GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurve(theRefCurve, theParameter); + GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurve(theRefCurve, theParameter, false); endService( " GEOM_Superv_i::MakePointOnCurve" ); return anObj; } @@ -1512,7 +1512,7 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePipeWithDifferentSections beginService( " GEOM_Superv_i::MakePipeWithDifferentSections" ); MESSAGE("GEOM_Superv_i::MakePipeWithDifferentSections"); get3DPrimOp(); - GEOM::ListOfGO_var aList = my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections, false); + GEOM::ListOfGO_var aList = my3DPrimOp->MakePipeWithDifferentSections(theBases,theLocations, thePath,theWithContact,theWithCorrections, false, false); endService( " GEOM_Superv_i::MakePipeWithDifferentSections" ); return aList[0]; } diff --git a/src/GEOM_PY/structelem/__init__.py b/src/GEOM_PY/structelem/__init__.py index 47f2b6bcd..9fb941376 100644 --- a/src/GEOM_PY/structelem/__init__.py +++ b/src/GEOM_PY/structelem/__init__.py @@ -109,6 +109,8 @@ from salome.geom.geomtools import getGeompy from salome.geom.structelem import parts from salome.geom.structelem.parts import InvalidParameterError +import GEOM + ## This class manages the structural elements in the study. It is used to # create a new structural element from a list of commands. The parameter # \em studyId defines the ID of the study in which the manager will create diff --git a/src/GEOM_PY/structelem/parts.py b/src/GEOM_PY/structelem/parts.py index 5ab2f2474..ae1e59d0f 100644 --- a/src/GEOM_PY/structelem/parts.py +++ b/src/GEOM_PY/structelem/parts.py @@ -361,7 +361,8 @@ class Beam(StructuralElementPart): face2 = self.geom.MakeFace(wire2, True) shell = self.geom.MakePipeWithDifferentSections([wire1, wire2], [point1, point2], - path, False, False) + path, False, False, + False) closedShell = self.geom.MakeShell([face1, face2, shell]) solid = self.geom.MakeSolid([closedShell]) return solid diff --git a/src/GEOM_SWIG/GEOM_TestMeasures.py b/src/GEOM_SWIG/GEOM_TestMeasures.py index 87c9a0d11..7ad571552 100644 --- a/src/GEOM_SWIG/GEOM_TestMeasures.py +++ b/src/GEOM_SWIG/GEOM_TestMeasures.py @@ -33,8 +33,12 @@ def TestMeasureOperations (geompy, math): p678 = geompy.MakeVertex(60, 70, 80) p789 = geompy.MakeVertex(70, 80, 90) + vz = geompy.MakeVectorDXDYDZ(0, 0, 1) + cube = geompy.MakeBoxTwoPnt(p678, p789) + cylinder = geompy.MakeCylinder(p0, vz, 5, 70) + ####### PointCoordinates ####### Coords = geompy.PointCoordinates(p137) @@ -52,18 +56,20 @@ def TestMeasureOperations (geompy, math): ####### Detect Self-intersections ####### - [Face_1,Face_2] = geompy.SubShapes(box, [33, 23]) - Translation_1 = geompy.MakeTranslation(Face_1, 5, -15, -40) - Compound_1 = geompy.MakeCompound([Face_2, Translation_1]) - if geompy.CheckSelfIntersections(Compound_1) == True: + selfIntersected = geompy.MakeCompound([box, cylinder]) + if geompy.CheckSelfIntersections(selfIntersected): raise RuntimeError, "Existing self-intersection is not detected" - ####### Detect Fast intersection ####### + ####### Detect Self-intersections fast ####### - if salome_version.getXVersion() > "0x70501": - cylinder = geompy.MakeCylinderRH(100, 300) - if geompy.FastIntersect(box, cylinder)[0] == False: - raise RuntimeError, "Existing intersection is not detected" + if salome_version.getXVersion() > "0x70600": + if geompy.CheckSelfIntersectionsFast(selfIntersected): + raise RuntimeError, "Existing self-intersection is not detected" + + ####### Fast intersection ####### + + if not geompy.FastIntersect(box, cylinder)[0]: + raise RuntimeError, "Existing intersection is not detected" ####### WhatIs ####### diff --git a/src/GEOM_SWIG/geomBuilder.py b/src/GEOM_SWIG/geomBuilder.py index f932a632a..46573011e 100644 --- a/src/GEOM_SWIG/geomBuilder.py +++ b/src/GEOM_SWIG/geomBuilder.py @@ -600,6 +600,8 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # - EDGE: [nb_vertices] # # - VERTEX: [x y z] + # + # - LCS: [x y z xx xy xz yx yy yz zx zy zz] # @ingroup l1_geomBuilder_auxiliary kind = GEOM.GEOM_IKindOfShape @@ -1148,6 +1150,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): ## Create a point, corresponding to the given parameter on the given curve. # @param theRefCurve The referenced curve. # @param theParameter Value of parameter on the referenced curve. + # @param takeOrientationIntoAccount flag that tells if it is necessary + # to take the curve's orientation into account for the + # operation. I.e. if this flag is set, the results for the same + # parameters (except the value 0.5) is different for forward + # and reversed curves. If it is not set the result is the same. # @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. @@ -1156,13 +1163,20 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # # @ref tui_creation_point "Example" @ManageTransactions("BasicOp") - def MakeVertexOnCurve(self, theRefCurve, theParameter, theName=None): + def MakeVertexOnCurve(self, theRefCurve, theParameter, + takeOrientationIntoAccount=False, theName=None): """ Create a point, corresponding to the given parameter on the given curve. Parameters: theRefCurve The referenced curve. theParameter Value of parameter on the referenced curve. + takeOrientationIntoAccount flag that tells if it is necessary + to take the curve's orientation into account for the + operation. I.e. if this flag is set, the results for + the same parameters (except the value 0.5) is different + for forward and reversed curves. If it is not set + the result is the same. 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. @@ -1174,8 +1188,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) """ # Example: see GEOM_TestAll.py - theParameter, Parameters = ParseParameters(theParameter) - anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter) + theParameter, takeOrientationIntoAccount, Parameters = ParseParameters( + theParameter, takeOrientationIntoAccount) + anObj = self.BasicOp.MakePointOnCurve(theRefCurve, theParameter, + takeOrientationIntoAccount) RaiseIfFailed("MakePointOnCurve", self.BasicOp) anObj.SetParameters(Parameters) self._autoPublish(anObj, theName, "vertex") @@ -4023,7 +4039,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases, theLocations, thePath, theWithContact, theWithCorrection, - IsGenerateGroups) + False, IsGenerateGroups) RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp) if IsGenerateGroups: @@ -4033,6 +4049,43 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): self._autoPublish(aList[0], theName, "pipe") return aList[0] + ## Create a shape by extrusion of the profile shape along + # the path shape. This function is a version of + # MakePipeWithDifferentSections() with the same parameters, except + # eliminated theWithContact and theWithCorrection. So it is + # possible to find the description of all parameters is in this + # method. The difference is that this method performs the operation + # step by step, i.e. it creates pipes between each pair of neighbor + # sections and fuses them into a single shape. + # + # @ref tui_creation_pipe_with_diff_sec "Example" + @ManageTransactions("PrimOp") + def MakePipeWithDifferentSectionsBySteps(self, theSeqBases, + theLocations, thePath, + IsGenerateGroups=False, theName=None): + """ + Create a shape by extrusion of the profile shape along + the path shape. This function is a version of + MakePipeWithDifferentSections() with the same parameters, except + eliminated theWithContact and theWithCorrection. So it is + possible to find the description of all parameters is in this + method. The difference is that this method performs the operation + step by step, i.e. it creates pipes between each pair of neighbor + sections and fuses them into a single shape. + """ + aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases, + theLocations, thePath, + False, False, + True, IsGenerateGroups) + RaiseIfFailed("MakePipeWithDifferentSectionsBySteps", self.PrimOp) + + if IsGenerateGroups: + self._autoPublish(aList, theName, "pipe") + return aList + + self._autoPublish(aList[0], theName, "pipe") + return aList[0] + ## Create a shape by extrusion of the profile shape along # the path shape. The path shape can be a wire or an edge. # the several profiles can be specified in the several locations of path. @@ -4626,7 +4679,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # 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 face. + # @return New GEOM.GEOM_Object, containing the created face (compound of faces). # # @ref tui_creation_face "Example" @ManageTransactions("ShapesOp") @@ -4646,7 +4699,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - New GEOM.GEOM_Object, containing the created face. + New GEOM.GEOM_Object, containing the created face (compound of faces). """ # Example: see GEOM_TestAll.py anObj = self.ShapesOp.MakeFace(theWire, isPlanarWanted) @@ -4668,7 +4721,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # 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 face. + # @return New GEOM.GEOM_Object, containing the created face (compound of faces). # # @ref tui_creation_face "Example" @ManageTransactions("ShapesOp") @@ -4688,7 +4741,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - New GEOM.GEOM_Object, containing the created face. + New GEOM.GEOM_Object, containing the created face (compound of faces). """ # Example: see GEOM_TestAll.py anObj = self.ShapesOp.MakeFaceWires(ToList(theWires), isPlanarWanted) @@ -4787,7 +4840,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # 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 shell. + # @return New GEOM.GEOM_Object, containing the created shell (compound of shells). # # @ref tui_creation_shell "Example" @ManageTransactions("ShapesOp") @@ -4802,7 +4855,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): publication is switched on, default value is used for result name. Returns: - New GEOM.GEOM_Object, containing the created shell. + New GEOM.GEOM_Object, containing the created shell (compound of shells). """ # Example: see GEOM_TestAll.py anObj = self.ShapesOp.MakeShell( ToList( theFacesAndShells )) @@ -9581,6 +9634,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # The angle in which to project the total length of the wire. # If it is negative the projection is not scaled and natural # wire length is kept for the projection. + # @param theAngleRotation The desired angle in radians between + # the tangent vector to the first curve at the first point of + # the theObject's projection in 2D space and U-direction of + # cylinder's 2D space. # @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. @@ -9592,6 +9649,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): # @ref tui_projection "Example" def MakeProjectionOnCylinder (self, theObject, theRadius, theStartAngle=0.0, theAngleLength=-1.0, + theAngleRotation=0.0, theName=None): """ Compute a wire or a face that represents a projection of the source @@ -9608,6 +9666,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): to project the total length of the wire. If it is negative the projection is not scaled and natural wire length is kept for the projection. + theAngleRotation The desired angle in radians between + the tangent vector to the first curve at the first + point of the theObject's projection in 2D space and + U-direction of cylinder's 2D space. 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. @@ -9624,14 +9686,19 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): flagAngleLength = False if isinstance(theAngleLength,str): flagAngleLength = True - theRadius, theStartAngle, theAngleLength, Parameters = ParseParameters( - theRadius, theStartAngle, theAngleLength) + flagAngleRotation = False + if isinstance(theAngleRotation,str): + flagAngleRotation = True + theRadius, theStartAngle, theAngleLength, theAngleRotation, Parameters = ParseParameters( + theRadius, theStartAngle, theAngleLength, theAngleRotation) if flagStartAngle: theStartAngle = theStartAngle*math.pi/180. if flagAngleLength: theAngleLength = theAngleLength*math.pi/180. + if flagAngleRotation: + theAngleRotation = theAngleRotation*math.pi/180. anObj = self.TrsfOp.MakeProjectionOnCylinder(theObject, theRadius, - theStartAngle, theAngleLength) + theStartAngle, theAngleLength, theAngleRotation) RaiseIfFailed("MakeProjectionOnCylinder", self.TrsfOp) anObj.SetParameters(Parameters) self._autoPublish(anObj, theName, "projection") @@ -11257,6 +11324,37 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen): RaiseIfFailed("CheckSelfIntersections", self.MeasuOp) return IsValid + ## Detect self-intersections of the given shape with algorithm based on mesh intersections. + # @param theShape Shape to check. + # @param theDeflection Linear deflection coefficient that specifies quality of tesselation: + # - if \a theDeflection <= 0, default deflection 0.001 is used + # @param theTolerance Specifies a distance between sub-shapes used for detecting gaps: + # - if \a theTolerance <= 0, algorithm detects intersections (default behavior) + # - if \a theTolerance > 0, algorithm detects gaps + # @return TRUE, if the shape contains no self-intersections. + # + # @ref tui_check_self_intersections_fast_page "Example" + @ManageTransactions("MeasuOp") + def CheckSelfIntersectionsFast(self, theShape, theDeflection = 0.001, theTolerance = 0.0): + """ + Detect self-intersections of the given shape with algorithm based on mesh intersections. + + Parameters: + theShape Shape to check. + theDeflection Linear deflection coefficient that specifies quality of tesselation: + - if theDeflection <= 0, default deflection 0.001 is used + theTolerance Specifies a distance between shapes used for detecting gaps: + - if theTolerance <= 0, algorithm detects intersections (default behavior) + - if theTolerance > 0, algorithm detects gaps + + Returns: + TRUE, if the shape contains no self-intersections. + """ + # Example: see GEOM_TestMeasures.py + (IsValid, Pairs) = self.MeasuOp.CheckSelfIntersectionsFast(theShape, theDeflection, theTolerance) + RaiseIfFailed("CheckSelfIntersectionsFast", self.MeasuOp) + return IsValid + ## Detect intersections of the given shapes with algorithm based on mesh intersections. # @param theShape1 First source object # @param theShape2 Second source object diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index e6348707f..884b75d9d 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -209,7 +209,7 @@ void GenerationGUI_FillingDlg::initSelection() needTypes.push_back( TopAbs_COMPOUND ); globalSelection( aTypes ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + localSelection( needTypes ); } //================================================================================= diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index 33b43b09f..c00a0c275 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -50,13 +50,14 @@ //================================================================================= GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidget* parent, bool modal, Qt::WindowFlags fl) - : GEOMBase_Skeleton (theGeometryGUI, parent, modal, fl), - myGenGroupCheckGP (0), - myPrefixLblGP (0), - myPrefixEditGP (0), - myGenGroupCheckGMP (0), - myPrefixLblGMP (0), - myPrefixEditGMP (0) + : GEOMBase_Skeleton (theGeometryGUI, parent, modal, fl), + myGenGroupCheckGP (0), + myPrefixLblGP (0), + myPrefixEditGP (0), + myStepByStepCheckGMP (0), + myGenGroupCheckGMP (0), + myPrefixLblGMP (0), + myPrefixEditGMP (0) { QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_PIPE"))); QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); @@ -124,15 +125,18 @@ GenerationGUI_PipeDlg::GenerationGUI_PipeDlg (GeometryGUI* theGeometryGUI, QWidg // Add widgets for group generation QGridLayout *aLayoutGMP = (QGridLayout *)GroupMakePoints->GroupBox1->layout(); - myGenGroupCheckGMP = + myStepByStepCheckGMP = + new QCheckBox(tr("GEOM_STEP_BY_STEP"), GroupMakePoints->GroupBox1); + myGenGroupCheckGMP = new QCheckBox(tr("GEOM_GENERATE_GROUPS"), GroupMakePoints->GroupBox1); - myPrefixLblGMP = + myPrefixLblGMP = new QLabel (tr("GEOM_GROUP_NAME_PREFIX"), GroupMakePoints->GroupBox1); - myPrefixEditGMP = new QLineEdit(GroupMakePoints->GroupBox1); + myPrefixEditGMP = new QLineEdit(GroupMakePoints->GroupBox1); - aLayoutGMP->addWidget(myGenGroupCheckGMP, 8, 0, 1, 3); - aLayoutGMP->addWidget(myPrefixLblGMP, 9, 0, 1, 2); - aLayoutGMP->addWidget(myPrefixEditGMP, 9, 2); + aLayoutGMP->addWidget(myStepByStepCheckGMP, 8, 0, 1, 3); + aLayoutGMP->addWidget(myGenGroupCheckGMP, 9, 0, 1, 3); + aLayoutGMP->addWidget(myPrefixLblGMP, 10, 0, 1, 2); + aLayoutGMP->addWidget(myPrefixEditGMP, 10, 2); QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); @@ -201,8 +205,10 @@ void GenerationGUI_PipeDlg::Init() connect(GroupMakePoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(GroupMakePoints->CheckBox1, SIGNAL(clicked()), this, SLOT(processPreview())); connect(GroupMakePoints->CheckBox2, SIGNAL(clicked()), this, SLOT(processPreview())); - connect(myGenGroupCheckGP, SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool))); - connect(myGenGroupCheckGMP, SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool))); + connect(myStepByStepCheckGMP, SIGNAL(clicked()), this, SLOT(processPreview())); + connect(myGenGroupCheckGP, SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool))); + connect(myGenGroupCheckGMP, SIGNAL(toggled(bool)), this, SLOT(GenGroupClicked(bool))); + connect(myStepByStepCheckGMP, SIGNAL(toggled(bool)), this, SLOT(StepByStepClicked(bool))); initName(tr("GEOM_PIPE")); resize(100,100); @@ -250,6 +256,7 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId ) GroupPoints->hide(); GroupMakePoints->show(); GroupMakePoints->PushButton1->click(); + myStepByStepCheckGMP->setChecked(false); myGenGroupCheckGMP->setChecked(false); resetGenGroup(myGenGroupCheckGMP, false, true); break; @@ -273,7 +280,7 @@ void GenerationGUI_PipeDlg::SelectionTypeButtonClicked() { globalSelection(); if ( GroupPoints->CheckButton1->isChecked() ) { - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); } else { TColStd_MapOfInteger aMap; aMap.Add(GEOM_COMPOUND); @@ -375,7 +382,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() } } else if ( myEditCurrentArgument == GroupMakePoints->LineEdit2 ) { - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); QList objects = getSelected( TopAbs_VERTEX, -1 ); GEOMBase::Synchronize( myLocations, objects ); if ( !myLocations.isEmpty() ) { @@ -421,7 +428,7 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupPoints->LineEdit2; if ( GroupPoints->CheckButton1->isChecked() ) { - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); } else { TColStd_MapOfInteger aMap; aMap.Add(GEOM_COMPOUND); @@ -434,7 +441,7 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument() else if(send == GroupPoints->PushButton3) { myEditCurrentArgument = GroupPoints->LineEdit3; GroupPoints->CheckButton1->setEnabled(false); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } GroupMakePoints->PushButton1->setDown(false); @@ -583,10 +590,16 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects) myGenGroupCheckGMP->isChecked(); } + bool isWithContact = GroupMakePoints->CheckBox1->isEnabled() && + GroupMakePoints->CheckBox1->isChecked(); + bool isWithCorrection = GroupMakePoints->CheckBox2->isEnabled() && + GroupMakePoints->CheckBox2->isChecked(); + aList = anOper->MakePipeWithDifferentSections - (myBaseGO.in(), myLocationsGO.in(), myPath.get(), - GroupMakePoints->CheckBox1->isChecked(), - GroupMakePoints->CheckBox2->isChecked(), doGroups); + (myBaseGO.in(), myLocationsGO.in(), myPath.get(), + isWithContact, isWithCorrection, + myStepByStepCheckGMP->isChecked(), + doGroups); if (aList->length() > 0) { if (doGroups) { @@ -706,6 +719,16 @@ void GenerationGUI_PipeDlg::GenGroupClicked(bool isChecked) resetGenGroup((QCheckBox *)sender(), isChecked, false); } +//================================================================================= +// function : StepByStepClicked +// purpose : Slot to treat checking "Step-by-step generation" check box. +//================================================================================= +void GenerationGUI_PipeDlg::StepByStepClicked(bool isChecked) +{ + GroupMakePoints->CheckBox1->setEnabled(!isChecked); + GroupMakePoints->CheckBox2->setEnabled(!isChecked); +} + //================================================================================= // function : updateGenGroup // purpose : Update "Generate groups" widgets depending on the path. diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.h b/src/GenerationGUI/GenerationGUI_PipeDlg.h index 4b2d88efd..341fb18f4 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.h +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.h @@ -81,6 +81,7 @@ private: QCheckBox *myGenGroupCheckGP; QLabel *myPrefixLblGP; QLineEdit *myPrefixEditGP; + QCheckBox *myStepByStepCheckGMP; QCheckBox *myGenGroupCheckGMP; QLabel *myPrefixLblGMP; QLineEdit *myPrefixEditGMP; @@ -95,6 +96,7 @@ private slots: void ConstructorsClicked( int ); void SelectionTypeButtonClicked(); void GenGroupClicked(bool); + void StepByStepClicked(bool); }; #endif // GENERATIONGUI_PIPEDLG_H diff --git a/src/GenerationGUI/GenerationGUI_PipePathDlg.cxx b/src/GenerationGUI/GenerationGUI_PipePathDlg.cxx index a7889f101..5c465f3bb 100644 --- a/src/GenerationGUI/GenerationGUI_PipePathDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipePathDlg.cxx @@ -148,7 +148,7 @@ void GenerationGUI_PipePathDlg::SelectionTypeButtonClicked() { globalSelection(); if (GroupPoints->CheckButton1->isChecked()) { - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } else { TColStd_MapOfInteger aMap; @@ -269,7 +269,7 @@ void GenerationGUI_PipePathDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupPoints->LineEdit2; if (GroupPoints->CheckButton1->isChecked()) { - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } else { TColStd_MapOfInteger aMap; @@ -284,7 +284,7 @@ void GenerationGUI_PipePathDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupPoints->LineEdit3; if (GroupPoints->CheckButton1->isChecked()) { - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } else { TColStd_MapOfInteger aMap; diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index e2de72611..11cfd2c6e 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -446,7 +446,7 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupVecH->LineEdit2; GroupVecH->PushButton1->setDown(false); GroupVecH->LineEdit1->setEnabled(false); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } else if (send == Group2Points->PushButton1) { myEditCurrentArgument = Group2Points->LineEdit1; @@ -461,7 +461,7 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument() Group2Points->PushButton3->setDown(false); Group2Points->LineEdit1->setEnabled(false); Group2Points->LineEdit3->setEnabled(false); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } else if (send == Group2Points->PushButton3) { myEditCurrentArgument = Group2Points->LineEdit3; @@ -469,7 +469,7 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument() Group2Points->PushButton2->setDown(false); Group2Points->LineEdit1->setEnabled(false); Group2Points->LineEdit2->setEnabled(false); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } else if (send == GroupDXDYDZ->PushButton1) { myEditCurrentArgument = GroupDXDYDZ->LineEdit1; diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 61246cf11..2d798fcbf 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -234,7 +234,7 @@ void GenerationGUI_RevolDlg::SetEditCurrentArgument() myEditCurrentArgument = GroupPoints->LineEdit2; GroupPoints->PushButton1->setDown(false); GroupPoints->LineEdit1->setEnabled(false); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); diff --git a/src/GroupGUI/CMakeLists.txt b/src/GroupGUI/CMakeLists.txt index acf593702..73e18271b 100755 --- a/src/GroupGUI/CMakeLists.txt +++ b/src/GroupGUI/CMakeLists.txt @@ -39,6 +39,7 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/GEOMImpl ${PROJECT_SOURCE_DIR}/src/GEOMGUI ${PROJECT_SOURCE_DIR}/src/GEOMBase + ${PROJECT_SOURCE_DIR}/src/MeasureGUI ${PROJECT_SOURCE_DIR}/src/DlgRef ${PROJECT_BINARY_DIR}/src/DlgRef ${CMAKE_CURRENT_SOURCE_DIR} @@ -56,6 +57,7 @@ ADD_DEFINITIONS( SET(_link_LIBRARIES GEOMBase GEOMUtils + MeasureGUI ) # --- resources --- diff --git a/src/GroupGUI/GroupGUI_GroupDlg.cxx b/src/GroupGUI/GroupGUI_GroupDlg.cxx index 68b6314b1..40463f32a 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.cxx +++ b/src/GroupGUI/GroupGUI_GroupDlg.cxx @@ -31,6 +31,9 @@ #include #include #include +#ifndef DISABLE_PLOT2DVIEWER +#include +#endif #include #include @@ -200,6 +203,9 @@ GroupGUI_GroupDlg::GroupGUI_GroupDlg (Mode mode, GeometryGUI* theGeometryGUI, QW myLessFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp); myGreaterFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp); myApplyFilterButton = new QPushButton(tr("GEOM_BUT_APPLY"), myFilterGrp); +#ifndef DISABLE_PLOT2DVIEWER + myPlotDistributionButton = new QPushButton(tr("GEOM_PLOT_DISTRIBUTION"), myFilterGrp); +#endif QGridLayout* filterLayout = new QGridLayout(myFilterGrp); filterLayout->addWidget(myLessFilterCheck, 0, 0); @@ -209,6 +215,9 @@ GroupGUI_GroupDlg::GroupGUI_GroupDlg (Mode mode, GeometryGUI* theGeometryGUI, QW filterLayout->addWidget(myGreaterFilterCombo, 1, 1); filterLayout->addWidget(myGreaterFilterSpin, 1, 2); filterLayout->addWidget(myApplyFilterButton, 0, 3); +#ifndef DISABLE_PLOT2DVIEWER + filterLayout->addWidget(myPlotDistributionButton, 1, 3); +#endif QVBoxLayout* layout = new QVBoxLayout(centralWidget()); layout->setMargin(0); layout->setSpacing(6); @@ -326,6 +335,9 @@ void GroupGUI_GroupDlg::Init() connect(myIdList, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged())); connect(myApplyFilterButton, SIGNAL(clicked()), this, SLOT(ClickOnOkFilter())); +#ifndef DISABLE_PLOT2DVIEWER + connect(myPlotDistributionButton, SIGNAL(clicked()), this, SLOT(ClickOnPlot())); +#endif connect(myLessFilterCheck, SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled())); connect(myGreaterFilterCheck, SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled())); @@ -434,7 +446,7 @@ void GroupGUI_GroupDlg::ActivateThisDialog() //================================================================================= void GroupGUI_GroupDlg::SetEditCurrentArgument() { - QPushButton* send = (QPushButton*)sender(); + QPushButton* send = qobject_cast( sender() ); if (send == mySelBtn) { myEditCurrentArgument = myMainName; @@ -460,7 +472,8 @@ void GroupGUI_GroupDlg::SetEditCurrentArgument() // activateSelection(); if(myEditCurrentArgument) { myEditCurrentArgument->setFocus(); - send->setDown(true); + if ( send ) + send->setDown(true); } updateState(); @@ -1149,6 +1162,18 @@ void GroupGUI_GroupDlg::updateState (bool isAdd) subSelectionWay() == ALL_SUBSHAPES && myIsShapeType && getShapeType() != TopAbs_VERTEX); + // manage of 'Plot' button access + GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + GEOM::ListOfLong_var aSubShapes = aShOp->SubShapeAllIDs( myMainObj, getShapeType(), false ); + bool hasCurrentEntities = aSubShapes->length() > 0; +#ifndef DISABLE_PLOT2DVIEWER + myPlotDistributionButton->setEnabled( myFilterGrp->isEnabled() && + myIsShapeType && + ( getShapeType() == TopAbs_EDGE || + getShapeType() == TopAbs_FACE || + getShapeType() == TopAbs_SOLID ) && + hasCurrentEntities ); +#endif if (subSelectionWay() == ALL_SUBSHAPES) setInPlaceObj(GEOM::GEOM_Object::_nil()); } @@ -1437,6 +1462,21 @@ void GroupGUI_GroupDlg::ClickOnOkFilter() updateState(true); } +#ifndef DISABLE_PLOT2DVIEWER +//================================================================================= +// function : ClickOnPlot() +// purpose : opens "Shape Statistics" dialog box in order to plot sub-shapes distribution. +//================================================================================= +void GroupGUI_GroupDlg::ClickOnPlot() +{ + TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj); + QDialog* dlg = new MeasureGUI_ShapeStatisticsDlg( this, aMainShape, getShapeType() ); + if ( dlg ) { + dlg->show(); + } +} +#endif + void GroupGUI_GroupDlg::MeasureToggled() { myLessFilterSpin->setEnabled(myLessFilterCheck->isChecked()); diff --git a/src/GroupGUI/GroupGUI_GroupDlg.h b/src/GroupGUI/GroupGUI_GroupDlg.h index ad8f4e159..06ecae4cf 100644 --- a/src/GroupGUI/GroupGUI_GroupDlg.h +++ b/src/GroupGUI/GroupGUI_GroupDlg.h @@ -83,6 +83,9 @@ private slots: void showOnlySelected(); void selectionChanged(); void ClickOnOkFilter(); +#ifndef DISABLE_PLOT2DVIEWER + void ClickOnPlot(); +#endif void MeasureToggled(); private: @@ -133,6 +136,7 @@ private: SalomeApp_DoubleSpinBox* myLessFilterSpin; SalomeApp_DoubleSpinBox* myGreaterFilterSpin; QPushButton* myApplyFilterButton; + QPushButton* myPlotDistributionButton; QGroupBox* myFilterGrp; }; diff --git a/src/IGESPlugin/IGESPlugin_GUI.cxx b/src/IGESPlugin/IGESPlugin_GUI.cxx index da70682b7..f3dd0d0ac 100644 --- a/src/IGESPlugin/IGESPlugin_GUI.cxx +++ b/src/IGESPlugin/IGESPlugin_GUI.cxx @@ -37,10 +37,13 @@ #include "GEOM_Operation.h" #include "GEOMBase.h" #include "GEOM_Displayer.h" +#include "GEOM_GenericObjPtr.h" #include #include CORBA_SERVER_HEADER(IGESPlugin) +typedef GEOM::GenericObjPtr IGESOpPtr; + //======================================================================= // function : IGESPlugin_GUI() // purpose : Constructor @@ -109,8 +112,8 @@ bool IGESPlugin_GUI::importIGES( SUIT_Desktop* parent ) SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() ); GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "IGESPluginEngine" ); - GEOM::IIGESOperations_var igesOp = GEOM::IIGESOperations::_narrow( op ); - if ( CORBA::is_nil( igesOp ) ) return false; + IGESOpPtr igesOp = GEOM::IIGESOperations::_narrow( op ); + if ( igesOp.isNull() ) return false; QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""), tr( "IGES_FILES" ), @@ -126,7 +129,7 @@ bool IGESPlugin_GUI::importIGES( SUIT_Desktop* parent ) { QString fileName = fileNames.at( i ); SUIT_OverrideCursor wc; - GEOM_Operation transaction( app, igesOp.in() ); + GEOM_Operation transaction( app, igesOp.get() ); bool ignoreUnits = false; try @@ -182,6 +185,7 @@ bool IGESPlugin_GUI::importIGES( SUIT_Desktop* parent ) entryList.append( so->GetID() ); transaction.commit(); GEOM_Displayer( study ).Display( main.in() ); + main->UnRegister(); } else { @@ -221,8 +225,8 @@ bool IGESPlugin_GUI::exportIGES( SUIT_Desktop* parent ) SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() ); GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "IGESPluginEngine" ); - GEOM::IIGESOperations_var igesOp = GEOM::IIGESOperations::_narrow( op ); - if ( CORBA::is_nil( igesOp ) ) return false; + IGESOpPtr igesOp = GEOM::IIGESOperations::_narrow( op ); + if ( igesOp.isNull() ) return false; LightApp_SelectionMgr* sm = app->selectionMgr(); if ( !sm ) return false; @@ -251,7 +255,7 @@ bool IGESPlugin_GUI::exportIGES( SUIT_Desktop* parent ) SUIT_OverrideCursor wc; - GEOM_Operation transaction( app, igesOp.in() ); + GEOM_Operation transaction( app, igesOp.get() ); try { diff --git a/src/MeasureGUI/CMakeLists.txt b/src/MeasureGUI/CMakeLists.txt index c7ab327c1..eaae08f27 100755 --- a/src/MeasureGUI/CMakeLists.txt +++ b/src/MeasureGUI/CMakeLists.txt @@ -104,6 +104,7 @@ SET(MeasureGUI_HEADERS MeasureGUI_DimensionCreateTool.h MeasureGUI_DimensionInteractor.h MeasureGUI_DimensionFilter.h + MeasureGUI_definitions.h ) # header files / to be processed by moc @@ -130,6 +131,12 @@ SET(_moc_HEADERS MeasureGUI_CreateDimensionDlg.h MeasureGUI_DimensionInteractor.h ) + +IF(SALOME_USE_PLOT2DVIEWER) + LIST(APPEND _moc_HEADERS + MeasureGUI_ShapeStatisticsDlg.h + ) +ENDIF() # header files / uic wrappings QT4_WRAP_UI(_uic_HEADERS ${_uic_files}) @@ -167,6 +174,12 @@ SET(MeasureGUI_SOURCES ${_uic_files} ) +IF(SALOME_USE_PLOT2DVIEWER) + LIST(APPEND MeasureGUI_SOURCES + MeasureGUI_ShapeStatisticsDlg.cxx + ) +ENDIF() + # --- rules --- ADD_LIBRARY(MeasureGUI ${MeasureGUI_SOURCES}) diff --git a/src/MeasureGUI/MeasureGUI.cxx b/src/MeasureGUI/MeasureGUI.cxx index 37c8ed4b2..d76f132ff 100644 --- a/src/MeasureGUI/MeasureGUI.cxx +++ b/src/MeasureGUI/MeasureGUI.cxx @@ -53,6 +53,9 @@ #include "MeasureGUI_FastCheckIntersectionsDlg.h" // Method FAST CHECK INTERSCTIONS #include "MeasureGUI_PointDlg.h" // Method POINTCOORDINATES #include "MeasureGUI_ManageDimensionsDlg.h" // Method MANAGEDIMENSIONS +#ifndef DISABLE_PLOT2DVIEWER +#include "MeasureGUI_ShapeStatisticsDlg.h" // Method SHAPE STATISTICS +#endif #include @@ -129,6 +132,11 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent ) case GEOMOp::OpFastCheckInters: dlg = new MeasureGUI_FastCheckIntersectionsDlg( getGeometryGUI(), parent ); break; // FAST CHECK INTERSCTIONS +#ifndef DISABLE_PLOT2DVIEWER + case GEOMOp::OpShapeStatistics: + dlg = new MeasureGUI_ShapeStatisticsDlg( parent ); + break; // SHAPE STATISTICS +#endif case GEOMOp::OpPointCoordinates: dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent ); break; // POINT COORDINATES diff --git a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx index 64c51cc78..2d8de0fcc 100644 --- a/src/MeasureGUI/MeasureGUI_AngleDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_AngleDlg.cxx @@ -404,5 +404,5 @@ bool MeasureGUI_AngleDlg::isValid (QString& msg) void MeasureGUI_AngleDlg::activateSelection() { globalSelection(GEOM_LINE); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); } diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx index 56b10a092..ddb2e566a 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx @@ -307,11 +307,7 @@ bool MeasureGUI_BndBoxDlg::execute (ObjectList& objects) void MeasureGUI_BndBoxDlg::activateSelection() { globalSelection( GEOM_ALLSHAPES ); - std::list needTypes; - needTypes.push_back( TopAbs_SHAPE ), needTypes.push_back( TopAbs_VERTEX ), needTypes.push_back( TopAbs_EDGE ); - needTypes.push_back( TopAbs_WIRE ), needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ); - needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPSOLID ), needTypes.push_back( TopAbs_COMPOUND ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + localSelection( TopAbs_SHAPE ); } //================================================================================= diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx index c2f5f92c1..0fdecafde 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -131,11 +131,7 @@ void MeasureGUI_CenterMassDlg::Init() void MeasureGUI_CenterMassDlg::activateSelection() { globalSelection( GEOM_ALLSHAPES ); - std::list needTypes; - needTypes.push_back( TopAbs_SHAPE ), needTypes.push_back( TopAbs_VERTEX ), needTypes.push_back( TopAbs_EDGE ); - needTypes.push_back( TopAbs_WIRE ), needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ); - needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPSOLID ), needTypes.push_back( TopAbs_COMPOUND ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + localSelection( TopAbs_SHAPE ); } //================================================================================= diff --git a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx index a07e919e5..27bebf181 100644 --- a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.cxx @@ -26,6 +26,7 @@ #include "MeasureGUI_CheckSelfIntersectionsDlg.h" #include "MeasureGUI.h" +#include #include #include #include @@ -58,80 +59,144 @@ //================================================================================= MeasureGUI_CheckSelfIntersectionsDlg::MeasureGUI_CheckSelfIntersectionsDlg (GeometryGUI* GUI, QWidget* parent) : GEOMBase_Skeleton (GUI, parent, false), - myTextView (0), - mySelButton (0), - myEditObjName (0), + myTextView1 (0), + myTextView2 (0), + mySelButton1 (0), + mySelButton2 (0), + myEditObjName1 (0), + myEditObjName2 (0), myLevelBox (0), - myComputeButton (0), - myInteList (0), - myShapeList (0) + myComputeButton1 (0), + myComputeButton2 (0), + myInteList1 (0), + myShapeList1 (0), + myInteList2 (0), + myShapeList2 (0), + myCurrConstrId (-1) { SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_CHECK_SELF_INTERSECTIONS"))); QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT"))); + QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FAST_CHECK_INTERSECTIONS"))); setWindowTitle(tr("GEOM_CHECK_SELF_INTERSECTIONS")); /***************************************************************/ - mainFrame()->GroupConstructors->setTitle(tr("GEOM_CHECK_SELF_INTERSECTIONS")); + mainFrame()->GroupConstructors->setTitle(tr("GEOM_CHECK_INTERSECT_TYPE")); mainFrame()->RadioButton1->setIcon(image0); - mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); - mainFrame()->RadioButton2->close(); + mainFrame()->RadioButton2->setIcon(image2);; mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->close(); - QGroupBox *aGrp = new QGroupBox(tr("GEOM_CHECK_INFOS")); - QLabel *anObjLbl = new QLabel(tr("GEOM_OBJECT")); - QLabel *anInteLbl = new QLabel(tr("GEOM_CHECK_INTE_INTERSECTIONS")); - QLabel *aShapeLbl = new QLabel(tr("GEOM_CHECK_INTE_SUBSHAPES")); - QLabel *aLevelLbl = new QLabel(tr("GEOM_CHECK_INTE_CHECK_LEVEL")); - QLabel *aSummaryLbl = new QLabel(tr("GEOM_CHECK_INTE_SUMMARY")); + /***************************************************************/ + /* SIMPLE SELF-INTERSECTION constructor + /***************************************************************/ + mySimpleGrp = new QGroupBox(tr("GEOM_CHECK_INFOS")); + QLabel *anObjLbl = new QLabel(tr("GEOM_OBJECT")); + QLabel *anInteLbl = new QLabel(tr("GEOM_CHECK_INTE_INTERSECTIONS")); + QLabel *aShapeLbl = new QLabel(tr("GEOM_CHECK_INTE_SUBSHAPES")); + QLabel *aLevelLbl = new QLabel(tr("GEOM_CHECK_INTE_CHECK_LEVEL")); + QLabel *aSummaryLbl1 = new QLabel(tr("GEOM_CHECK_INTE_SUMMARY")); QFont aFont (TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE); aFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias); - myTextView = new QTextBrowser; - myTextView->setReadOnly(true); - myTextView->setFont(aFont); + myTextView1 = new QTextBrowser; + myTextView1->setReadOnly(true); + myTextView1->setFont(aFont); - mySelButton = new QPushButton; - mySelButton->setIcon(image1); - mySelButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + mySelButton1 = new QPushButton; + mySelButton1->setIcon(image1); + mySelButton1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - myEditObjName = new QLineEdit; - myEditObjName->setReadOnly(true); + myEditObjName1 = new QLineEdit; + myEditObjName1->setReadOnly(true); myLevelBox = new QComboBox; - myComputeButton = new QPushButton(tr("GEOM_CHECK_INTE_COMPUTE")); + myComputeButton1 = new QPushButton(tr("GEOM_CHECK_INTE_COMPUTE")); - myInteList = new QListWidget; - myInteList->setSelectionMode(QAbstractItemView::ExtendedSelection); - myShapeList = new QListWidget; - myShapeList->setSelectionMode(QAbstractItemView::ExtendedSelection); + myInteList1 = new QListWidget; + myInteList1->setSelectionMode(QAbstractItemView::ExtendedSelection); + myShapeList1 = new QListWidget; + myShapeList1->setSelectionMode(QAbstractItemView::ExtendedSelection); - QGridLayout *aGrpLayout = new QGridLayout(aGrp); + QGridLayout *aGrpLayout1 = new QGridLayout(mySimpleGrp); - aGrpLayout->setMargin(9); - aGrpLayout->setSpacing(6); - aGrpLayout->addWidget(anObjLbl, 0, 0); - aGrpLayout->addWidget(anInteLbl, 5, 0); - aGrpLayout->addWidget(aShapeLbl, 5, 2); - aGrpLayout->addWidget(aLevelLbl, 1, 0); - aGrpLayout->addWidget(myLevelBox, 1, 1, 1, 2); - aGrpLayout->addWidget(myComputeButton, 2, 0, 1, 3); - aGrpLayout->addWidget(aSummaryLbl, 3, 0); - aGrpLayout->addWidget(myTextView, 4, 0, 1, 3); - aGrpLayout->addWidget(mySelButton, 0, 1); - aGrpLayout->addWidget(myEditObjName, 0, 2); - aGrpLayout->addWidget(myInteList, 6, 0, 1, 2); - aGrpLayout->addWidget(myShapeList, 6, 2); - - QVBoxLayout* layout = new QVBoxLayout (centralWidget()); - layout->setMargin(0); layout->setSpacing(6); - layout->addWidget(aGrp); + aGrpLayout1->setMargin(9); + aGrpLayout1->setSpacing(6); + aGrpLayout1->addWidget(anObjLbl, 0, 0); + aGrpLayout1->addWidget(mySelButton1, 0, 1); + aGrpLayout1->addWidget(myEditObjName1, 0, 2); + aGrpLayout1->addWidget(aLevelLbl, 1, 0); + aGrpLayout1->addWidget(myLevelBox, 1, 1, 1, 2); + aGrpLayout1->addWidget(myComputeButton1, 2, 0, 1, 3); + aGrpLayout1->addWidget(aSummaryLbl1, 3, 0); + aGrpLayout1->addWidget(myTextView1, 4, 0, 1, 3); + aGrpLayout1->addWidget(anInteLbl, 5, 0); + aGrpLayout1->addWidget(aShapeLbl, 5, 2); + aGrpLayout1->addWidget(myInteList1, 6, 0, 1, 2); + aGrpLayout1->addWidget(myShapeList1, 6, 2); /***************************************************************/ + /* FAST SELF-INTERSECTION constructor + /***************************************************************/ + + myFastGrp = new QGroupBox(tr("GEOM_CHECK_INFOS"), centralWidget()); + QLabel *anObjLbl2 = new QLabel(tr("GEOM_OBJECT"), myFastGrp); + QLabel *aDeflectLbl = new QLabel(tr("GEOM_CHECK_INT_DEFLECT"), myFastGrp); + QLabel *aSummaryLbl2 = new QLabel(tr("GEOM_CHECK_INTE_SUMMARY")); + QLabel *anInteLbl2 = new QLabel(tr("GEOM_CHECK_INTE_INTERSECTIONS"), myFastGrp); + QLabel *aShapeLbl2 = new QLabel(tr("GEOM_CHECK_INTE_SUBSHAPES"), myFastGrp); + + mySelButton2 = new QPushButton(myFastGrp); + mySelButton2->setIcon(image1); + mySelButton2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + + myEditObjName2 = new QLineEdit(myFastGrp); + myEditObjName2->setReadOnly(true); + + myDeflection = new SalomeApp_DoubleSpinBox(myFastGrp); + myDetGaps = new QCheckBox(tr( "GEOM_CHECK_INT_DETECT_GAPS" )); + myTolerance = new SalomeApp_DoubleSpinBox(myFastGrp); + + myComputeButton2 = new QPushButton(tr("GEOM_CHECK_INTE_COMPUTE")); + + myTextView2 = new QTextBrowser; + myTextView2->setReadOnly(true); + myTextView2->setFont(aFont); + + myInteList2 = new QListWidget(myFastGrp); + myInteList2->setSelectionMode(QAbstractItemView::ExtendedSelection); + myShapeList2 = new QListWidget(myFastGrp); + myShapeList2->setSelectionMode(QAbstractItemView::ExtendedSelection); + + QGridLayout *aGrpLayout2 = new QGridLayout(myFastGrp); + aGrpLayout2->setMargin(9); + aGrpLayout2->setSpacing(6); + aGrpLayout2->addWidget(anObjLbl2, 0, 0); + aGrpLayout2->addWidget(mySelButton2, 0, 1); + aGrpLayout2->addWidget(myEditObjName2, 0, 2); + aGrpLayout2->addWidget(aDeflectLbl, 1, 0); + aGrpLayout2->addWidget(myDeflection, 1, 1, 1, 2); + aGrpLayout2->addWidget(myDetGaps, 2, 0); + aGrpLayout2->addWidget(myTolerance, 2, 1, 1, 2); + aGrpLayout2->addWidget(myComputeButton2, 3, 0, 1, 3); + aGrpLayout2->addWidget(aSummaryLbl2, 4, 0); + aGrpLayout2->addWidget(myTextView2, 5, 0, 1, 3); + aGrpLayout2->addWidget(anInteLbl2, 6, 0); + aGrpLayout2->addWidget(aShapeLbl2, 6, 1, 1, 2); + aGrpLayout2->addWidget(myInteList2, 7, 0); + aGrpLayout2->addWidget(myShapeList2, 7, 1, 1, 2); + + /***************************************************************/ + + QVBoxLayout* layout2 = new QVBoxLayout (centralWidget()); + layout2->setMargin(0); layout2->setSpacing(6); + layout2->addWidget(mySimpleGrp); + layout2->addWidget(myFastGrp); + + /***************************************************************/ myHelpFileName = "check_self_intersections_page.html"; @@ -161,32 +226,65 @@ void MeasureGUI_CheckSelfIntersectionsDlg::Init() myLevelBox->insertItem(GEOM::SI_E_F, tr("GEOM_CHECK_INTE_E_F")); myLevelBox->insertItem(GEOM::SI_ALL, tr("GEOM_CHECK_INTE_ALL")); myLevelBox->setCurrentIndex(GEOM::SI_ALL); + myComputeButton1->setEnabled(false); + connect(mySelButton1, SIGNAL(clicked()), + this, SLOT(SetEditCurrentArgument())); + connect(myInteList1, SIGNAL(itemSelectionChanged()), + SLOT(onInteListSelectionChanged())); + connect(myShapeList1, SIGNAL(itemSelectionChanged()), + SLOT(onSubShapesListSelectionChanged())); + connect(myLevelBox, SIGNAL(currentIndexChanged(int)), + this, SLOT(clear())); + connect(myComputeButton1, SIGNAL(clicked()), this, SLOT(onCompute())); + + /***************************************************************/ + myObj2.nullify(); + myEditObjName2->setText(""); + myEditObjName2->setEnabled(true); + + myDetGaps->setChecked(false); + initSpinBox(myTolerance, 0, MAX_NUMBER, 1); + myTolerance->setValue(0); + myTolerance->setEnabled(false); + myComputeButton2->setEnabled(false); + + // Obtain deflection from preferences + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + initSpinBox(myDeflection, 1e-3, 1.0, 1e-3); + myDeflection->setValue(qMax(1e-3, resMgr->doubleValue("Geometry", "deflection_coeff", 1e-3))); + + connect( mySelButton2, SIGNAL(clicked()), + this, SLOT(SetEditCurrentArgument())); + connect( myDetGaps, SIGNAL(toggled(bool)), this, SLOT(OnGaps(bool))); + connect( myTolerance, SIGNAL(valueChanged(double)), this, SLOT(clear())); + connect( myDeflection, SIGNAL(valueChanged(double)), this, SLOT(clear())); + connect( myInteList2, SIGNAL(itemSelectionChanged()), + SLOT(onInteListSelectionChanged())); + connect( myShapeList2, SIGNAL(itemSelectionChanged()), + SLOT(onSubShapesListSelectionChanged())); + connect( myComputeButton2, SIGNAL(clicked()), this, SLOT(onCompute())); + + /***************************************************************/ + + connect(this, SIGNAL(constructorsClicked(int)), + this, SLOT(ConstructorsClicked(int))); connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(mySelButton, SIGNAL(clicked()), - this, SLOT(SetEditCurrentArgument())); - connect(myInteList, SIGNAL(itemSelectionChanged()), - SLOT(onInteListSelectionChanged())); - connect(myShapeList, SIGNAL(itemSelectionChanged()), - SLOT(onSubShapesListSelectionChanged())); - connect(myLevelBox, SIGNAL(currentIndexChanged(int)), - this, SLOT(clear())); - connect(myComputeButton, SIGNAL(clicked()), this, SLOT(onCompute())); - LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr(); - connect(aSel, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); initName( tr( "GEOM_SELF_INTERSECTION_NAME") ); buttonOk()->setEnabled(false); buttonApply()->setEnabled(false); - myComputeButton->setEnabled(false); + + ConstructorsClicked(0); + activateSelection(); SelectionIntoArgument(); } @@ -197,20 +295,56 @@ void MeasureGUI_CheckSelfIntersectionsDlg::Init() //================================================================================= void MeasureGUI_CheckSelfIntersectionsDlg::clear() { - myTextView->setText(""); + getTextView()->setText(""); + getComputeButton()->setEnabled(true); - myInteList->blockSignals(true); - myShapeList->blockSignals(true); - myInteList->clear(); - myShapeList->clear(); - myInteList->blockSignals(false); - myShapeList->blockSignals(false); + getInteList()->blockSignals(true); + getShapeList()->blockSignals(true); + getInteList()->clear(); + getShapeList()->clear(); + getInteList()->blockSignals(false); + getShapeList()->blockSignals(false); erasePreview(); - buttonOk()->setEnabled(false); buttonApply()->setEnabled(false); - myComputeButton->setEnabled(true); +} + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void MeasureGUI_CheckSelfIntersectionsDlg::ConstructorsClicked(int constructorId) +{ + if (myCurrConstrId == constructorId) + return; + + disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); + + switch (constructorId) { + case 0: + mySimpleGrp->show(); + myFastGrp->hide(); + break; + case 1: + mySimpleGrp->hide(); + myFastGrp->show(); + break; + } + + myCurrConstrId = constructorId; + + connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), + this, SLOT(SelectionIntoArgument())); + + qApp->processEvents(); + updateGeometry(); + resize(minimumSizeHint()); + + processPreview(); + //updateButtonState(); + activateSelection(); + SelectionIntoArgument(); } //================================================================================= @@ -223,7 +357,7 @@ void MeasureGUI_CheckSelfIntersectionsDlg::onCompute() QString anErrMsg(""); if (!findSelfIntersections(hasSelfInte, anErrMsg)) { - myTextView->setText(anErrMsg); + getTextView()->setText(anErrMsg); return; } @@ -243,12 +377,12 @@ void MeasureGUI_CheckSelfIntersectionsDlg::onCompute() aMsg += anErrMsg; } - myTextView->setText(aMsg); + getTextView()->setText(aMsg); // Pairs QStringList anInteList; QString anInteStr (""); - int nbPairs = myInters->length()/2; + int nbPairs = getInters()->length()/2; for (int i = 1; i <= nbPairs; i++) { anInteStr = "Intersection # "; @@ -256,8 +390,8 @@ void MeasureGUI_CheckSelfIntersectionsDlg::onCompute() anInteList.append(anInteStr); } - myInteList->addItems(anInteList); - myComputeButton->setEnabled(false); + getInteList()->addItems(anInteList); + getComputeButton()->setEnabled(false); } //================================================================================= @@ -291,7 +425,23 @@ void MeasureGUI_CheckSelfIntersectionsDlg::DeactivateActiveDialog() //================================================================================= void MeasureGUI_CheckSelfIntersectionsDlg::activateSelection() { - globalSelection(GEOM_ALLSHAPES); + switch (getConstructorId()) { + case 0: + globalSelection(GEOM_ALLSHAPES); + break; + case 1: + TColStd_MapOfInteger aTypes; + aTypes.Add(GEOM_COMPOUND ); + aTypes.Add(GEOM_SOLID ); + aTypes.Add(GEOM_SHELL); + aTypes.Add(GEOM_FACE); + globalSelection(aTypes); + + std::list needTypes; + needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ), needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPOUND ); + localSelection( needTypes ); + break; + } } //================================================================================= @@ -313,7 +463,11 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::ClickOnApply() if ( !onAccept() ) return false; + clear(); initName(); + + ConstructorsClicked(getConstructorId()); + return true; } @@ -341,7 +495,7 @@ GEOM::GEOM_IOperations_ptr MeasureGUI_CheckSelfIntersectionsDlg::createOperation //================================================================================= bool MeasureGUI_CheckSelfIntersectionsDlg::isValid( QString& ) { - return !myObj->_is_nil(); + return !getObj().isNull(); } //================================================================================= @@ -350,37 +504,51 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::isValid( QString& ) //================================================================================= void MeasureGUI_CheckSelfIntersectionsDlg::SetEditCurrentArgument() { - myEditObjName->setFocus(); + getEditObjName()->setFocus(); SelectionIntoArgument(); } +//================================================================================= +// function : OnGaps() +// purpose : +//================================================================================= +void MeasureGUI_CheckSelfIntersectionsDlg::OnGaps(bool checked) +{ + clear(); + myTolerance->setEnabled(checked); +} //================================================================================= // function : SelectionIntoArgument // purpose : //================================================================================= void MeasureGUI_CheckSelfIntersectionsDlg::SelectionIntoArgument() { + QList typesLst; + + if ( getConstructorId() == 0 ) { + typesLst << TopAbs_COMPOUND + << TopAbs_COMPSOLID + << TopAbs_SOLID + << TopAbs_SHELL + << TopAbs_FACE + << TopAbs_WIRE + << TopAbs_EDGE + << TopAbs_VERTEX + << TopAbs_SHAPE; + } else { + typesLst << TopAbs_FACE + << TopAbs_SHELL + << TopAbs_SOLID + << TopAbs_COMPOUND; + } + // Clear the dialog. clear(); - myObj = GEOM::GEOM_Object::_nil(); - LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr(); - SALOME_ListIO aSelList; - aSelMgr->selectedObjects(aSelList); + GEOM::GeomObjPtr aSelectedObject = getSelected( typesLst ); - GEOM::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil(); - - if (aSelList.Extent() > 0) { - aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() ); - } - - if (aSelectedObject->_is_nil()) { - myEditObjName->setText(""); - return; - } - - myObj = aSelectedObject; - myEditObjName->setText(GEOMBase::GetName(myObj)); + (getConstructorId() == 0 ? myObj1 :myObj2) = aSelectedObject; + getEditObjName()->setText(getObj() ? GEOMBase::GetName(getObj().get()) : ""); } //================================================================================= @@ -400,7 +568,7 @@ void MeasureGUI_CheckSelfIntersectionsDlg::enterEvent(QEvent *) bool MeasureGUI_CheckSelfIntersectionsDlg::findSelfIntersections (bool &HasSelfInte, QString &theErrMsg) { - if (myObj->_is_nil()) { + if (getObj()->_is_nil()) { return false; } @@ -413,10 +581,14 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::findSelfIntersections SUIT_OverrideCursor wc; try { - HasSelfInte = !anOper->CheckSelfIntersections(myObj, aLevel, myInters); - nbPairs = myInters->length()/2; + if ( getConstructorId() == 0 ) { + HasSelfInte = !anOper->CheckSelfIntersections(myObj1.get(), aLevel, myInters1); + } else { + HasSelfInte = !anOper->CheckSelfIntersectionsFast(myObj2.get(), getDeflection(), getTolerance(), myInters2); + } + nbPairs = getInters()->length()/2; - if (nbPairs*2 != myInters->length()) { + if (nbPairs*2 != getInters()->length()) { isOK = false; } } @@ -426,7 +598,7 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::findSelfIntersections } if (!anOper->IsDone()) { - if (myInters->length() == 0) { + if (getInters()->length() == 0) { theErrMsg = tr(anOper->GetErrorCode()); isOK = false; } else { @@ -447,24 +619,24 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::findSelfIntersections void MeasureGUI_CheckSelfIntersectionsDlg::onInteListSelectionChanged() { erasePreview(); - myShapeList->clear(); + getShapeList()->clear(); TopoDS_Shape aSelShape; - if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) { + if (!getObj()->_is_nil() && GEOMBase::GetShape(getObj().get(), aSelShape)) { TopTools_IndexedMapOfShape anIndices; TopExp::MapShapes(aSelShape, anIndices); - int nbSelected = myInteList->selectedItems().size(); + int nbSelected = getInteList()->selectedItems().size(); - for (int i = 0; i < myInteList->count(); i++) { - if ( myInteList->item(i)->isSelected() ) { + for (int i = 0; i < getInteList()->count(); i++) { + if ( getInteList()->item(i)->isSelected() ) { if ( nbSelected > 1 ) - myShapeList->addItem(QString("--- #%1 ---").arg(i+1)); + getShapeList()->addItem(QString("--- #%1 ---").arg(i+1)); for (int j = 0; j < 2; j++) { - TopoDS_Shape aSubShape = anIndices.FindKey(myInters[i*2+j]); + TopoDS_Shape aSubShape = anIndices.FindKey(getInters()[i*2+j]); QString aType = GEOMBase::GetShapeTypeString(aSubShape); - myShapeList->addItem(QString("%1_%2").arg(aType).arg(myInters[i*2+j])); - myShapeList->item(myShapeList->count()-1)->setData(Qt::UserRole, myInters[i*2+j]); + getShapeList()->addItem(QString("%1_%2").arg(aType).arg(getInters()[i*2+j])); + getShapeList()->item(getShapeList()->count()-1)->setData(Qt::UserRole, getInters()[i*2+j]); } } } @@ -480,7 +652,7 @@ void MeasureGUI_CheckSelfIntersectionsDlg::onSubShapesListSelectionChanged() erasePreview(); // Selected IDs - QList selected = myShapeList->selectedItems(); + QList selected = getShapeList()->selectedItems(); QList aIds; foreach(QListWidgetItem* item, selected) { int idx = item->data(Qt::UserRole).toInt(); @@ -492,7 +664,7 @@ void MeasureGUI_CheckSelfIntersectionsDlg::onSubShapesListSelectionChanged() TopoDS_Shape aSelShape; TopoDS_Shape aSubShape; TopTools_IndexedMapOfShape anIndices; - if (!myObj->_is_nil() && GEOMBase::GetShape(myObj, aSelShape)) { + if (!getObj()->_is_nil() && GEOMBase::GetShape(getObj().get(), aSelShape)) { TopExp::MapShapes(aSelShape, anIndices); getDisplayer()->SetColor(Quantity_NOC_RED); getDisplayer()->SetWidth(3); @@ -500,11 +672,11 @@ void MeasureGUI_CheckSelfIntersectionsDlg::onSubShapesListSelectionChanged() foreach(int idx, aIds) { aSubShape = anIndices.FindKey(idx); try { - SALOME_Prs* aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs(aSubShape) : 0; - if (aPrs) displayPreview(aPrs, true); + SALOME_Prs* aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs(aSubShape) : 0; + if (aPrs) displayPreview(aPrs, true); } catch (const SALOME::SALOME_Exception& e) { - SalomeApp_Tools::QtCatchCorbaException(e); + SalomeApp_Tools::QtCatchCorbaException(e); } } } @@ -526,15 +698,15 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::execute(ObjectList& objects) TColStd_IndexedMapOfInteger aMapIndex; QList pairs; - int nbSelected = myInteList->selectedItems().size(); + int nbSelected = getInteList()->selectedItems().size(); // Collect the map of indices - for (int i = 0; i < myInteList->count(); i++) { - if ( nbSelected < 1 || myInteList->item(i)->isSelected() ) { - aMapIndex.Add(myInters[i*2]); - aMapIndex.Add(myInters[i*2 + 1]); - pairs << myInters[i*2]; - pairs << myInters[i*2 + 1]; + for (int i = 0; i < getInteList()->count(); i++) { + if ( nbSelected < 1 || getInteList()->item(i)->isSelected() ) { + aMapIndex.Add(getInters()[i*2]); + aMapIndex.Add(getInters()[i*2 + 1]); + pairs << getInters()[i*2]; + pairs << getInters()[i*2 + 1]; } } @@ -547,7 +719,7 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::execute(ObjectList& objects) for (int i = 1; i <= aMapIndex.Extent(); i++) anArray[i-1] = aMapIndex.FindKey(i); - GEOM::ListOfGO_var aList = shapesOper->MakeSubShapes(myObj, anArray); + GEOM::ListOfGO_var aList = shapesOper->MakeSubShapes(getObj().get(), anArray); // Make compounds for (int i = 0; i < pairs.count()/2; i++) { @@ -562,6 +734,27 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::execute(ObjectList& objects) return true; } +//================================================================================= +// function : getDeflection +// purpose : +//================================================================================= +float MeasureGUI_CheckSelfIntersectionsDlg::getDeflection() +{ + return (float)myDeflection->value(); +} + +//================================================================================= +// function : getTolerance +// purpose : +//================================================================================= +double MeasureGUI_CheckSelfIntersectionsDlg::getTolerance() +{ + double aVal = myTolerance->value(); + if (!myDetGaps->isChecked() || aVal < 0.0) + return 0.0; + return aVal; +} + //================================================================ // Function : getFather // Purpose : Get father object for object to be added in study @@ -570,5 +763,54 @@ bool MeasureGUI_CheckSelfIntersectionsDlg::execute(ObjectList& objects) GEOM::GEOM_Object_ptr MeasureGUI_CheckSelfIntersectionsDlg::getFather (GEOM::GEOM_Object_ptr) { - return myObj; + return getObj().get(); +} + +//================================================================================= +// function : getSourceObjects +// purpose : virtual method to get source objects +//================================================================================= +QList MeasureGUI_CheckSelfIntersectionsDlg::getSourceObjects() +{ + QList res; + res << getObj(); + return res; +} + +//================================================================================= +// GETTERS +//================================================================================= +QTextBrowser* MeasureGUI_CheckSelfIntersectionsDlg::getTextView() +{ + return ( getConstructorId() == 0 ? myTextView1 : myTextView2 ); +} + +QListWidget* MeasureGUI_CheckSelfIntersectionsDlg::getInteList() +{ + return ( getConstructorId() == 0 ? myInteList1 : myInteList2 ); +} + +QListWidget* MeasureGUI_CheckSelfIntersectionsDlg::getShapeList() +{ + return ( getConstructorId() == 0 ? myShapeList1 : myShapeList2 ); +} + +QPushButton* MeasureGUI_CheckSelfIntersectionsDlg::getComputeButton() +{ + return ( getConstructorId() == 0 ? myComputeButton1 : myComputeButton2 ); +} + +QLineEdit* MeasureGUI_CheckSelfIntersectionsDlg::getEditObjName() +{ + return ( getConstructorId() == 0 ? myEditObjName1 : myEditObjName2 ); +} + +GEOM::GeomObjPtr MeasureGUI_CheckSelfIntersectionsDlg::getObj() +{ + return ( getConstructorId() == 0 ? myObj1 : myObj2 ); +} + +GEOM::ListOfLong_var MeasureGUI_CheckSelfIntersectionsDlg::getInters() +{ + return ( getConstructorId() == 0 ? myInters1 : myInters2 ); } diff --git a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h index f05dd8109..ac0f2d935 100644 --- a/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h +++ b/src/MeasureGUI/MeasureGUI_CheckSelfIntersectionsDlg.h @@ -54,6 +54,7 @@ protected: virtual bool execute(ObjectList &); virtual bool extractPrefix() const; virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr); + virtual QList getSourceObjects(); private slots: @@ -67,6 +68,9 @@ private slots: void DeactivateActiveDialog(); void SelectionIntoArgument(); void SetEditCurrentArgument(); + void ConstructorsClicked (int); + void OnGaps(bool); + private: @@ -76,18 +80,46 @@ private: bool findSelfIntersections (bool &HasSelfInte, QString &theErrMsg); + float getDeflection(); + double getTolerance(); + +// Getters + QTextBrowser* getTextView(); + QListWidget* getInteList(); + QListWidget* getShapeList(); + QPushButton* getComputeButton(); + QLineEdit* getEditObjName(); + GEOM::GeomObjPtr getObj(); + GEOM::ListOfLong_var getInters(); + private: - - QTextBrowser *myTextView; - QPushButton *mySelButton; - QLineEdit *myEditObjName; + int myCurrConstrId; + // simple + QPushButton *myComputeButton1; + QGroupBox *mySimpleGrp; + QTextBrowser *myTextView1; + QPushButton *mySelButton1; + QLineEdit *myEditObjName1; QComboBox *myLevelBox; - QPushButton *myComputeButton; - QListWidget *myInteList; - QListWidget *myShapeList; - GEOM::GEOM_Object_var myObj; - GEOM::ListOfLong_var myInters; + QListWidget *myInteList1; + QListWidget *myShapeList1; + GEOM::GeomObjPtr myObj1; + GEOM::ListOfLong_var myInters1; + // fast + QPushButton *myComputeButton2; + QGroupBox *myFastGrp; + QTextBrowser *myTextView2; + QPushButton *mySelButton2; + QLineEdit *myEditObjName2; + QCheckBox *myDetGaps; + SalomeApp_DoubleSpinBox *myTolerance; + SalomeApp_DoubleSpinBox *myDeflection; + QListWidget *myInteList2; + QListWidget *myShapeList2; + GEOM::GeomObjPtr myObj2; + GEOM::ListOfLong_var myInters2; + GEOM::GEOM_IShapesOperations_var myShapesOper; }; #endif // MEASUREGUI_CHECKSELFINTERDLG_H diff --git a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx index 2576676b2..45ef0135f 100644 --- a/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx @@ -495,12 +495,13 @@ Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension() QColor aQColor = aResMgr->colorValue ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) ); int aLineWidth = aResMgr->integerValue( "Geometry", "dimensions_line_width", 1 ); - double aFontHeight = aResMgr->doubleValue ( "Geometry", "dimensions_font_height", 10 ); + QFont aFont = aResMgr->fontValue ( "Geometry", "dimensions_font", QFont("Y14.5M-2009", 14) ); double anArrowLength = aResMgr->doubleValue ( "Geometry", "dimensions_arrow_length", 5 ); double aDefFlyout = aResMgr->doubleValue ( "Geometry", "dimensions_default_flyout", 20 ); bool isUnitsShown = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false ); QString aUnitsLength = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" ); QString aUnitsAngle = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" ); + bool aUseText3d = aResMgr->booleanValue( "Geometry", "dimensions_use_text3d", false ); OCCViewer_ViewWindow* anActiveView = NULL; @@ -610,10 +611,12 @@ Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension() aStyle->SetCommonColor( aColor ); aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown ); - aStyle->MakeText3d( Standard_True ); + aStyle->MakeText3d( aUseText3d ); aStyle->MakeTextShaded( Standard_True ); - aStyle->SetExtensionSize( aFontHeight * 0.5 ); - aStyle->TextAspect()->SetHeight( aFontHeight ); + int fsize = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize(); + aStyle->SetExtensionSize( fsize * 0.5 ); + aStyle->TextAspect()->SetFont( aFont.family().toLatin1().data() ); + aStyle->TextAspect()->SetHeight( fsize ); aStyle->ArrowAspect()->SetLength( anArrowLength ); aStyle->LineAspect()->SetWidth( aLineWidth ); diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index a2b0dc16c..8c7207f9a 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -489,11 +489,7 @@ bool MeasureGUI_DistanceDlg::execute (ObjectList& objects) void MeasureGUI_DistanceDlg::activateSelection() { globalSelection( GEOM_ALLSHAPES ); - std::list needTypes; - needTypes.push_back( TopAbs_SHAPE ), needTypes.push_back( TopAbs_VERTEX ), needTypes.push_back( TopAbs_EDGE ); - needTypes.push_back( TopAbs_WIRE ), needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ); - needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPSOLID ), needTypes.push_back( TopAbs_COMPOUND ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + localSelection( TopAbs_SHAPE ); } //================================================================================= diff --git a/src/MeasureGUI/MeasureGUI_FastCheckIntersectionsDlg.cxx b/src/MeasureGUI/MeasureGUI_FastCheckIntersectionsDlg.cxx index 459501c3c..ff075bc17 100644 --- a/src/MeasureGUI/MeasureGUI_FastCheckIntersectionsDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_FastCheckIntersectionsDlg.cxx @@ -317,7 +317,7 @@ void MeasureGUI_FastCheckIntersectionsDlg::activateSelection() std::list needTypes; needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ), needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPOUND ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + localSelection( needTypes ); } diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx index ee14238b3..61dcafdc3 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx @@ -129,9 +129,7 @@ void MeasureGUI_InertiaDlg::Init() void MeasureGUI_InertiaDlg::activateSelection() { MeasureGUI_Skeleton::activateSelection(); - std::list needTypes; - needTypes.push_back( TopAbs_VERTEX ), needTypes.push_back( TopAbs_EDGE ), needTypes.push_back( TopAbs_WIRE ), needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ), needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPOUND ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + localSelection( TopAbs_SHAPE ); } diff --git a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx index b8954462a..4618f9c80 100644 --- a/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx @@ -29,6 +29,7 @@ #include "MeasureGUI_DimensionFilter.h" #include +#include #include #include #include @@ -771,6 +772,8 @@ bool MeasureGUI_ManageDimensionsDlg::ClickOnApply() mySavedPropertyState.SaveToAttribute( aStudy, myEditObject->GetStudyEntry() ); + myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) ); + return true; } @@ -805,9 +808,12 @@ void MeasureGUI_ManageDimensionsDlg::OnFinish() myEditObject->GetStudyEntry(), GEOM::propertyName( GEOM::Dimensions ), QVariant() ); + if ( myIsNeedRedisplay ) { - redisplay( myEditObject.get()); + redisplay( myEditObject.get() ); } + + myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) ); } //================================================================================= diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx index 2c1d1dec3..6fd821b71 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx @@ -184,10 +184,7 @@ bool MeasureGUI_MaxToleranceDlg::getParameters( double& theMinFaceToler, void MeasureGUI_MaxToleranceDlg::activateSelection() { globalSelection( GEOM_ALLSHAPES ); - std::list needTypes; - needTypes.push_back( TopAbs_SHAPE ), needTypes.push_back( TopAbs_EDGE ); - needTypes.push_back( TopAbs_WIRE ), needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ); - needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPSOLID ), needTypes.push_back( TopAbs_COMPOUND ); localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + localSelection( TopAbs_SHAPE ); } void MeasureGUI_MaxToleranceDlg::SelectionIntoArgument() diff --git a/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx b/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx index 03619dc03..f2df1b3d3 100644 --- a/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_NormaleDlg.cxx @@ -267,7 +267,7 @@ void MeasureGUI_NormaleDlg::SetEditCurrentArgument() GroupArgs->PushButton2->setDown(false); GroupArgs->LineEdit2->setEnabled(false); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); + localSelection(TopAbs_FACE); } else if (send == GroupArgs->PushButton2) { myEditCurrentArgument = GroupArgs->LineEdit2; @@ -275,7 +275,7 @@ void MeasureGUI_NormaleDlg::SetEditCurrentArgument() GroupArgs->PushButton1->setDown(false); GroupArgs->LineEdit1->setEnabled(false); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); diff --git a/src/MeasureGUI/MeasureGUI_PointDlg.cxx b/src/MeasureGUI/MeasureGUI_PointDlg.cxx index a0bd2762b..d2acb6e3e 100644 --- a/src/MeasureGUI/MeasureGUI_PointDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PointDlg.cxx @@ -112,7 +112,7 @@ void MeasureGUI_PointDlg::Init() //================================================================================= void MeasureGUI_PointDlg::activateSelection() { - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); } //================================================================================= diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx index 620103fdf..ecaa437ba 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx @@ -125,7 +125,7 @@ void MeasureGUI_PropertiesDlg::activateSelection() std::list needTypes; needTypes.push_back( TopAbs_EDGE ), needTypes.push_back( TopAbs_WIRE ), needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ), needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPOUND ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + localSelection( needTypes ); } void MeasureGUI_PropertiesDlg::SelectionIntoArgument() diff --git a/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.cxx b/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.cxx new file mode 100644 index 000000000..9387cf4a8 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.cxx @@ -0,0 +1,533 @@ +// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// File : MeasureGUI_ShapeStatisticsDlg.cxx +// Author : Alexander KOVALEV, OPEN CASCADE S.A.S. + +// internal includes +#include "MeasureGUI_ShapeStatisticsDlg.h" + +// GEOM includes +#include +#include +#include +#include + +// GUI includes +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +// Qt includes +#include +#include +#include +#include + +// Qtx includes +#include + +// OCC includes +#include + +#include + +//=========================================================================== +// class : MeasureGUI_ShapeStatisticsDlg() +//=========================================================================== +MeasureGUI_ShapeStatisticsDlg::MeasureGUI_ShapeStatisticsDlg( QWidget* parent, TopoDS_Shape aShape, TopAbs_ShapeEnum aSubShapeType ) + : GEOMBase_Helper( SUIT_Session::session()->activeApplication()->desktop() ), + QDialog( parent ), + myHistogram ( 0 ) +{ + myShapes.push_back( aShape ); + + QIcon iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); + + setWindowTitle( tr( "GEOM_SHAPE_STATISTICS" ) ); + setAttribute( Qt::WA_DeleteOnClose ); + + myApp = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); + + QVBoxLayout* topLayout = new QVBoxLayout( this ); + + QGridLayout* settingsLayout = new QGridLayout(); + + /********************** Selected Objects **********************/ + + QLabel* objsLabel = new QLabel( tr( "GEOM_SELECTED_OBJECTS" ), this ); + QPushButton* selBtn = new QPushButton( this ); + selBtn->setIcon( iconSelect ); + myEditMainShape = new QLineEdit( this ); + myEditMainShape->setReadOnly(true); + + settingsLayout->addWidget( objsLabel, 0, 0 ); + settingsLayout->addWidget( selBtn, 0, 1 ); + settingsLayout->addWidget( myEditMainShape, 0, 2 ); + + if ( !aShape.IsNull() ) { + objsLabel->hide(); + selBtn->hide(); + myEditMainShape->hide(); + } + + /********************** Type **********************/ + + QLabel* typeLabel = new QLabel( tr( "GEOM_SHAPE_STATISTICS_TYPE" ), this ); + myCBTypes = new QtxComboBox( this ); + myCBTypes->setCleared( true ); + if ( aSubShapeType != TopAbs_SHAPE ) { + fillTypes( aSubShapeType == TopAbs_EDGE, + aSubShapeType == TopAbs_FACE, + aSubShapeType == TopAbs_SOLID ); + myCBTypes->setEnabled( false ); + } + + settingsLayout->addWidget( typeLabel, 1, 0 ); + settingsLayout->addWidget( myCBTypes, 1, 2 ); + + /********************** Number of intervals **********************/ + + QLabel* nbIntervalsLabel = new QLabel( tr( "GEOM_SHAPE_STATISTICS_NB_INTERVALS" ), this ); + myNbIntervals = new QtxIntSpinBox( 1, 1000, 1, this ); + myNbIntervals->setValue( 10 ); + + settingsLayout->addWidget( nbIntervalsLabel, 2, 0 ); + settingsLayout->addWidget( myNbIntervals, 2, 2 ); + + /********************** Scalar Range **********************/ + + myScalarRangeBox = new QGroupBox( tr( "GEOM_SHAPE_STATISTICS_SCALAR_RANGE" ), this ); + myScalarRangeBox->setCheckable( true ); + myScalarRangeBox->setChecked( false ); + QLabel* minLabel = new QLabel( tr( "GEOM_SHAPE_STATISTICS_MIN" ), this ); + myMin = new QLineEdit( this ); + QtxDoubleValidator* aValid = new QtxDoubleValidator( this ); + aValid->setBottom( 0.0 ); + myMin->setValidator( aValid ); + QLabel* maxLabel = new QLabel( tr( "GEOM_SHAPE_STATISTICS_MAX" ), this ); + myMax = new QLineEdit( this ); + myMax->setValidator( aValid ); + + QPushButton* buttonCompute = new QPushButton( tr( "GEOM_SHAPE_STATISTICS_COMPUTE" ), this ); + connect( buttonCompute, SIGNAL( clicked() ), this, SLOT( clickOnCompute() ) ); + + QGridLayout* scalarRangeLayout = new QGridLayout(); + scalarRangeLayout->setMargin( 11 ); settingsLayout->setSpacing( 6 ); + + scalarRangeLayout->addWidget( minLabel, 0, 0 ); + scalarRangeLayout->addWidget( myMin, 0, 1 ); + scalarRangeLayout->addWidget( maxLabel, 1, 0 ); + scalarRangeLayout->addWidget( myMax, 1, 1 ); + scalarRangeLayout->addWidget( buttonCompute, 0, 2, 2, 1 ); + + myScalarRangeBox->setLayout( scalarRangeLayout ); + + /********************** Buttons **********************/ + + myButtonPlot = new QPushButton( tr( "GEOM_PLOT_DISTRIBUTION" ), this ); + myButtonPlot->setDefault( true ); + myButtonCreateGr = new QPushButton( tr( "GEOM_SHAPE_STATISTICS_CREATE_GROUPS" ), this ); + QPushButton* buttonClose = new QPushButton( tr( "GEOM_BUT_CLOSE" ), this ); + QPushButton* buttonHelp = new QPushButton( tr( "GEOM_BUT_HELP" ), this ); + + QHBoxLayout* buttonsLayout = new QHBoxLayout(); + buttonsLayout->addWidget( myButtonPlot ); + buttonsLayout->addWidget( myButtonCreateGr ); + buttonsLayout->addWidget( buttonClose ); + buttonsLayout->addWidget( buttonHelp ); + + if ( !aShape.IsNull() ) { + myButtonCreateGr->hide(); + } + /********************** Layouting **********************/ + + topLayout->addLayout( settingsLayout ); + topLayout->addWidget( myScalarRangeBox ); + topLayout->addLayout( buttonsLayout ); + + // Signals and slots connections + + connect( selBtn, SIGNAL( clicked() ), this, SLOT( onEditMainShape() ) ); + + connect( myButtonPlot, SIGNAL( clicked() ), this, SLOT( clickOnPlot() ) ); + connect( myButtonCreateGr, SIGNAL( clicked() ), this, SLOT( clickOnCreateGroups() ) ); + + connect( buttonClose, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( clickOnHelp() ) ); + + connect(myApp->selectionMgr(), + SIGNAL(currentSelectionChanged()), this, SLOT(onEditMainShape())); + + if ( aShape.IsNull() ) + onEditMainShape(); +} + +//=========================================================================== +// function : ~MeasureGUI_ShapeStatisticsDlg() +// purpose : Destroys the object and frees any allocated resources +//=========================================================================== +MeasureGUI_ShapeStatisticsDlg::~MeasureGUI_ShapeStatisticsDlg() +{ +} + +//================================================================================= +// function : createOperation +// purpose : +//================================================================================= +GEOM::GEOM_IOperations_ptr MeasureGUI_ShapeStatisticsDlg::createOperation() +{ + return getGeomEngine()->GetIGroupOperations(getStudyId()); +} + +#define RETURN_WITH_MSG(a, b) \ + if (!(a)) { \ + theMessage += (b); \ + return false; \ + } + +//================================================================ +// Function : getFather +// Purpose : Get father object for object to be added in study +// (called with addInStudy method) +//================================================================ +GEOM::GEOM_Object_ptr MeasureGUI_ShapeStatisticsDlg::getFather(GEOM::GEOM_Object_ptr theObj) +{ + GEOM::GEOM_Object_var aFatherObj; + if (theObj->GetType() == GEOM_GROUP) { + GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation()); + aFatherObj = anOper->GetMainShape(theObj); + } + return aFatherObj._retn(); +} + +//================================================================================= +// function : getSourceObjects +// purpose : virtual method to get source objects +//================================================================================= +QList MeasureGUI_ShapeStatisticsDlg::getSourceObjects() +{ + QList res; + res << myMainObj; + return res; +} + +//================================================================================= +// function : onEditMainShape() +// purpose : called when selection button was clicked +//================================================================================= +void MeasureGUI_ShapeStatisticsDlg::onEditMainShape() +{ + // restore initial parameters for dialog box + myEditMainShape->setText(""); + myEditMainShape->setFocus(); + + //get shapes from selection + QList selShapes = getSelected( TopAbs_SHAPE, -1 ); + + myButtonPlot->setEnabled( !selShapes.isEmpty() ); + myButtonCreateGr->setEnabled( selShapes.count() == 1 ); + + if ( !selShapes.isEmpty() ) { + if ( selShapes.count() == 1 ) + myMainObj = selShapes[0]; + QString aName = selShapes.count() > 1 ? QString( "%1_objects").arg( selShapes.count() ) : GEOMBase::GetName( myMainObj.get() ); + myEditMainShape->setText( aName ); + } + + updateTypes( selShapes ); +} + +//================================================================================= +// function : currentType() +// purpose : returns currently selected type of shapes in 'Type' combobox +//================================================================================= +void MeasureGUI_ShapeStatisticsDlg::fillTypes( bool hasEdges, bool hasFaces, bool hasSolids ) +{ + if ( hasEdges ) + myCBTypes->addItem( tr("GEOM_SHAPE_STATISTICS_LENGTH"), (int)TopAbs_EDGE ); + if ( hasFaces ) + myCBTypes->addItem( tr("GEOM_SHAPE_STATISTICS_AREA"), (int)TopAbs_FACE ); + if ( hasSolids ) + myCBTypes->addItem( tr("GEOM_SHAPE_STATISTICS_VOLUME"), (int)TopAbs_SOLID ); + + myCBTypes->setEnabled( myCBTypes->count() > 0 ); +} + +//================================================================================= +// function : updateTypes() +// purpose : update 'Type' combobox with available types +//================================================================================= +void MeasureGUI_ShapeStatisticsDlg::updateTypes( QList theShapes ) +{ + myCBTypes->clear(); + myCBTypes->setEnabled( false ); + + int hasEdges = -1, hasFaces = -1, hasSolids = -1; + + myShapes.clear(); + // get types of the shapes and its sub-shapes + foreach( GEOM::GeomObjPtr aShapePtr, theShapes ) { + if ( !aShapePtr ) + return; + + TopoDS_Shape aShape; + if ( !GEOMBase::GetShape( aShapePtr.get(), aShape ) || aShape.IsNull() ) + return; + + myShapes.push_back( aShape ); + + GEOM::ListOfLong_var aSubShapes; + GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() ); + if ( hasEdges != 0 ) + hasEdges = aShOp->NumberOfSubShapes( aShapePtr.get(), TopAbs_EDGE ) > 0; + if ( hasFaces != 0 ) + hasEdges = aShOp->NumberOfSubShapes( aShapePtr.get(), TopAbs_FACE ) > 0; + if ( hasSolids != 0 ) + hasEdges = aShOp->NumberOfSubShapes( aShapePtr.get(), TopAbs_SOLID ) > 0; + } + fillTypes( hasEdges, hasFaces, hasSolids ); +} + +//================================================================================= +// function : currentType() +// purpose : returns currently selected type of shapes in 'Type' combobox +//================================================================================= +TopAbs_ShapeEnum MeasureGUI_ShapeStatisticsDlg::currentType() +{ + return (TopAbs_ShapeEnum)( myCBTypes->itemData( myCBTypes->currentIndex() ).toInt() ); +} + +//================================================================================= +// function : clickOnPlot() +// purpose : called when Plot button was clicked +//================================================================================= +bool MeasureGUI_ShapeStatisticsDlg::isValid(QString& theMessage) +{ + if ( myScalarRangeBox->isChecked() ) { + RETURN_WITH_MSG( !myMin->text().isEmpty(), tr("GEOM_SHAPE_STATISTICS_MIN_ERROR") ) + RETURN_WITH_MSG( !myMax->text().isEmpty(), tr("GEOM_SHAPE_STATISTICS_MAX_ERROR") ) + RETURN_WITH_MSG( myMin->text().toDouble() <= myMax->text().toDouble(), tr("GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR") ) + } + return true; +} +//================================================================================= +// function : clickOnPlot() +// purpose : called when Plot button was clicked +//================================================================================= +void MeasureGUI_ShapeStatisticsDlg::clickOnPlot() +{ + GEOMUtils::Range aRange; + if ( myScalarRangeBox->isChecked() ) { + QString msg; + if ( !isValid( msg ) ) { + showError( msg ); + return; + } + aRange.min = myMin->text().toDouble(); + aRange.max = myMax->text().toDouble(); + } else { + aRange.min = -1.0; // flag that range is empty + aRange.max = -1.0; // flag that range is empty + } + + GEOMUtils::Distribution aShapesDistr = + GEOMUtils::ComputeDistribution( myShapes, currentType(), myNbIntervals->value(), aRange ); + + QList xVals, yVals; + double width = -1, min = -1; + double xmin = 1e+32, xmax = 0.0, ymax = 0.0; + int i=0; + GEOMUtils::Distribution::const_iterator it; + for (it = aShapesDistr.begin(); it != aShapesDistr.end(); it++) { + GEOMUtils::Range ran = *it; + if ( width < 0 ) width = ran.max - ran.min; // bar width + if ( min < 0 ) min = ran.min; // global min + xVals << width / 2. + i*width + min; // get a middle of bar + yVals << ran.count; + // get global boundary max values + if ( ran.min < xmin ) xmin = ran.min; + if ( ran.max > xmax ) xmax = ran.max; + if ( ran.count > ymax ) ymax = ran.count; + i++; + } + + // plot the computed distribution + SUIT_ViewManager* aViewManager = myApp->getViewManager( Plot2d_Viewer::Type(), true ); // create if necessary + if( !aViewManager ) + return; + Plot2d_ViewWindow* aViewWnd = dynamic_cast(aViewManager->getActiveView()); + if( !aViewWnd ) + return; + Plot2d_ViewFrame* aPlot = aViewWnd->getViewFrame(); + if ( !aPlot ) + return; + + aPlot->EraseAll(); + + // create or reuse histogram + if( !myHistogram ) + myHistogram = new Plot2d_Histogram(); + else + myHistogram->clearAllPoints(); + // set histogram parameters + myHistogram->setData( xVals, yVals ); + if ( width != 0.0 ) + myHistogram->setWidth( width ); + myHistogram->setAutoAssign(true); + myHistogram->setName( myEditMainShape->text() ); + myHistogram->setHorTitle( myCBTypes->currentText() ); + myHistogram->setVerTitle( tr("GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT") ); + myHistogram->setColor( QColor(0, 85, 0) ); + // display histogram + aPlot->displayObject( myHistogram, true ); + if ( width == 0.0 ) // only one X value + aPlot->fitAll(); + else + aPlot->fitData( 0, xmin, xmax, 0.0, ymax ); +} + +//================================================================================= +// function : clickOnCompute() +// purpose : called when Compute button was clicked +//================================================================================= +void MeasureGUI_ShapeStatisticsDlg::clickOnCompute() +{ + GEOMUtils::Range aRange; + aRange.min = -1.0; // flag that range is empty + aRange.max = -1.0; // flag that range is empty + std::map measures = GEOMUtils::ComputeMeasures( myShapes, currentType(), aRange ); + if ( measures.size() != 0 ) { + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); + myMin->setText( DlgRef::PrintDoubleValue( aRange.min, aPrecision ) ); + myMax->setText( DlgRef::PrintDoubleValue( aRange.max, aPrecision ) ); + } +} + +//================================================================================= +// function : clickOnCreateGroups() +// purpose : called when Create Groups button was clicked +//================================================================================= +void MeasureGUI_ShapeStatisticsDlg::clickOnCreateGroups() +{ + onAccept(false, false, false); +} + +//================================================================================= +// function : execute(ObjectList& objects) +// purpose : +//================================================================================= +bool MeasureGUI_ShapeStatisticsDlg::execute(ObjectList& objects) +{ + if ( myMainObj.isNull() ) + return false; + + GEOM::GroupOpPtr anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation()); + + GEOMUtils::Range aRange; + if ( myScalarRangeBox->isChecked() ) { + QString msg; + if ( !isValid( msg ) ) { + showError( msg ); + return false; + } + aRange.min = myMin->text().toDouble(); + aRange.max = myMax->text().toDouble(); + } else { + aRange.min = -1.0; // flag that range is empty + aRange.max = -1.0; // flag that range is empty + } + + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); + int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 ); + QString aTypePrefix = myCBTypes->currentText().replace(' ', '_'); + QString objIOR, aMin, aMax, aGroupName; + SalomeApp_Study* study = getStudy(); + + GEOMUtils::Distribution aShapesDistr = + GEOMUtils::ComputeDistribution( myShapes, currentType(), myNbIntervals->value(), aRange ); + + int nbGroups = 0; + + GEOMUtils::Distribution::const_iterator it; + for (it = aShapesDistr.begin(); it != aShapesDistr.end(); it++) { + std::list idList = (*it).indices; + int nn = idList.size(); + if ( nn > 0 ) { + GEOM::ListOfLong_var aNewList = new GEOM::ListOfLong; + aNewList->length(nn); + int ii = 0; + std::list::const_iterator id_it; + for ( id_it = idList.begin(); id_it != idList.end(); id_it++ ) { + aNewList[ii++] = *id_it; + } + + // Create an empty group + GEOM::GEOM_Object_var aGroup; + aGroup = anOper->CreateGroup( myMainObj.get(), currentType() ); + + if (CORBA::is_nil(aGroup) || !anOper->IsDone()) + return false; + + // Add sub-shapes into group + anOper->UnionIDs(aGroup, aNewList); + if (!anOper->IsDone()) + return false; + + // publish group + aMin = DlgRef::PrintDoubleValue( (*it).min, aPrecision ); + aMax = DlgRef::PrintDoubleValue( (*it).max, aPrecision ); + aGroupName = aTypePrefix + "_" + aMin + "_" + aMax; + GEOMBase::PublishSubObject( aGroup, aGroupName ); + + // this is needed just to avoid error message + objects.push_back(aGroup._retn()); + + nbGroups++; + } + } + + SUIT_MessageBox::information( this, tr( "INF_INFO" ), tr( "GEOM_MSG_GROUPS_CREATED" ).arg( nbGroups ) ); + + return true; +} + +//================================================================================= +// function : clickOnHelp() +// purpose : called when Help button was clicked +//================================================================================= +void MeasureGUI_ShapeStatisticsDlg::clickOnHelp() +{ + GeometryGUI* aGeomGUI = dynamic_cast( myApp->module( "Geometry" ) ); + myApp->onHelpContextModule( aGeomGUI ? myApp->moduleName( aGeomGUI->moduleName() ) : QString(""), "shape_statistics_operation_page.html" ); +} diff --git a/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.h b/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.h new file mode 100644 index 000000000..8b604a261 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.h @@ -0,0 +1,93 @@ +// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +// GEOM GEOMGUI : GUI for Geometry component +// File : MeasureGUI_ShapeStatisticsDlg.h +// Author : Alexander KOVALEV, Open CASCADE (alexander.kovalev@opencascade.com) +// +#ifndef MEASUREGUI_SHAPESTATISTICSDLG_H +#define MEASUREGUI_SHAPESTATISTICSDLG_H + +// GEOM includes +#include +#include "GEOM_GenericObjPtr.h" +#include "MeasureGUI_definitions.h" + +// Qt includes +#include +#include +#include +#include + +// Qtx includes +#include +#include + +class Plot2d_Histogram; + +//========================================================================== +// class : MeasureGUI_ShapeStatisticsDlg +// purpose : +//========================================================================== + +class MEASUREGUI_EXPORT MeasureGUI_ShapeStatisticsDlg : public QDialog, public GEOMBase_Helper +{ + Q_OBJECT + +public: + MeasureGUI_ShapeStatisticsDlg( QWidget*, TopoDS_Shape aShape = TopoDS_Shape(), TopAbs_ShapeEnum aSubShapeType = TopAbs_SHAPE ); + ~MeasureGUI_ShapeStatisticsDlg(); + +protected: + // redefined from GEOMBase_Helper + virtual GEOM::GEOM_IOperations_ptr createOperation(); + virtual bool isValid (QString&); + virtual bool execute (ObjectList&); + virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr); + virtual QList getSourceObjects(); + +private slots: + void onEditMainShape(); + void clickOnCompute(); + void clickOnPlot(); + void clickOnCreateGroups(); + void clickOnHelp(); + +private: + void fillTypes( bool, bool, bool ); + void updateTypes( QList theShapes ); + TopAbs_ShapeEnum currentType(); + +private: + SalomeApp_Application* myApp; + QLineEdit* myEditMainShape; + QtxComboBox* myCBTypes; + std::list myShapes; + GEOM::GeomObjPtr myMainObj; + QtxIntSpinBox* myNbIntervals; + QGroupBox* myScalarRangeBox; + QLineEdit* myMin; + QLineEdit* myMax; + QPushButton* myButtonPlot; + QPushButton* myButtonCreateGr; + Plot2d_Histogram* myHistogram; + +}; + +#endif // MEASUREGUI_SHAPESTATISTICSDLG_H diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx index 3bf5a2bf7..7b331751c 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx @@ -193,10 +193,8 @@ void MeasureGUI_WhatisDlg::processObject() //================================================================================= void MeasureGUI_WhatisDlg::activateSelection() { - MeasureGUI_Skeleton::activateSelection(); - std::list needTypes; - needTypes.push_back( TopAbs_VERTEX ), needTypes.push_back( TopAbs_EDGE ), needTypes.push_back( TopAbs_WIRE ), needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ), needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPOUND ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + globalSelection(); // all types of objects + localSelection(TopAbs_SHAPE); // all types of sub-shapes } //================================================================================= @@ -264,7 +262,9 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters ) if ( !anOper->IsDone() ) return aKindStr; -#define PRINT_DOUBLE(val, tol) DlgRef::PrintDoubleValue( val, tol ) +#define PRINT_DOUBLE(val, tol) QString(" %1").arg( DlgRef::PrintDoubleValue( val, tol ) ) +#define TITLE(val) QString("%1").arg(tr(val)) +#define TITLE_I(val, i) QString("%1").arg(tr(val).arg(i)) switch ( aKind ) { case GEOM::GEOM_IKindOfShape::COMPOUND: @@ -294,85 +294,85 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters ) // SOLIDs case GEOM::GEOM_IKindOfShape::SPHERE: aKindStr = tr( "GEOM_SPHERE" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::CYLINDER: aKindStr = tr( "GEOM_CYLINDER" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + - "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_AXIS" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::BOX: aKindStr = tr( "GEOM_BOX" ); - theParameters = tr( "GEOM_CENTER") + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + "Ax :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + "Ay :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + "Az :" + PRINT_DOUBLE( aDbls[5], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + "Ax :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + "Ay :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + "Az :" + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::ROTATED_BOX: aKindStr = tr( "GEOM_BOX" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\nZ Axis:" + - "\n" + "Zx :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + "Zy :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + "Zz :" + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\nX Axis:" + - "\n" + tr( "GEOM_X_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + - "\n" + tr( "GEOM_X_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + - "\n" + tr( "GEOM_X_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) + - "\nDimensions along local axes:" + - "\n" + "Ax :" + PRINT_DOUBLE( aDbls[9], aLenPrecision ) + - "\n" + "Ay :" + PRINT_DOUBLE( aDbls[10], aLenPrecision ) + - "\n" + "Az :" + PRINT_DOUBLE( aDbls[11], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_Z_AXIS") + + "
    " + tr( "GEOM_Z_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_X_AXIS") + + "
    " + tr( "GEOM_X_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + tr( "GEOM_X_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + + "
    " + tr( "GEOM_X_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIM_AXES") + + "
    " + tr( "GEOM_A_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) + + "
    " + tr( "GEOM_A_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) + + "
    " + tr( "GEOM_A_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::TORUS: aKindStr = tr( "GEOM_TORUS" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_AXIS" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::CONE: aKindStr = tr( "GEOM_CONE" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + - "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_AXIS" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + + "
    " + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::POLYHEDRON: aKindStr = tr( "GEOM_POLYHEDRON" ); @@ -383,115 +383,115 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters ) // FACEs case GEOM::GEOM_IKindOfShape::SPHERE2D: aKindStr = tr( "GEOM_SURFSPHERE" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::CYLINDER2D: aKindStr = tr( "GEOM_SURFCYLINDER" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + - "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_AXIS" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::TORUS2D: aKindStr = tr( "GEOM_SURFTORUS" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_AXIS" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::CONE2D: aKindStr = tr( "GEOM_SURFCONE" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_AXIS" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + - "\n" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + - "\n" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_AXIS" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + + "
    " + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::DISK_CIRCLE: aKindStr = tr( "GEOM_DISK_CIRCLE" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_NORMAL" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::DISK_ELLIPSE: aKindStr = tr( "GEOM_DISK_ELLIPSE" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + - "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_NORMAL" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::POLYGON: aKindStr = tr( "GEOM_POLYGON" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_NORMAL" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::PLANE: aKindStr = tr( "GEOM_PLANE" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_NORMAL" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::PLANAR: aKindStr = tr( "GEOM_PLANAR_FACE" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_NORMAL" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::FACE: aKindStr = tr( "GEOM_FACE" ); @@ -499,105 +499,124 @@ QString MeasureGUI_WhatisDlg::getKindOfShape( QString& theParameters ) // EDGEs case GEOM::GEOM_IKindOfShape::CIRCLE: aKindStr = tr( "GEOM_CIRCLE" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_NORMAL" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::ARC_CIRCLE: aKindStr = tr( "GEOM_ARC" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + - "\n" + tr( "GEOM_POINT_I" ).arg( 1 ) + - "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) + - "\n" + tr( "GEOM_POINT_I" ).arg( 2 ) + - "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_NORMAL" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + TITLE_I( "GEOM_POINT_I", 1 ) + + "
    " + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) + + "
    " + TITLE_I( "GEOM_POINT_I", 2 ) + + "
    " + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::ELLIPSE: aKindStr = tr( "GEOM_ELLIPSE" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + - "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_NORMAL" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::ARC_ELLIPSE: aKindStr = tr( "GEOM_ARC_ELLIPSE" ); - theParameters = tr( "GEOM_CENTER" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_NORMAL" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + - "\n" + tr( "GEOM_DIMENSIONS" ) + - "\n" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + - "\n" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + - "\n" + tr( "GEOM_POINT_I" ).arg( 1 ) + - "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) + - "\n" + tr( "GEOM_POINT_I" ).arg( 2 ) + - "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[13], aLenPrecision ); + theParameters = TITLE( "GEOM_CENTER" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_NORMAL" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIMENSIONS" ) + + "
    " + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + + "
    " + TITLE_I( "GEOM_POINT_I", 1 ) + + "
    " + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) + + "
    " + TITLE_I( "GEOM_POINT_I", 2 ) + + "
    " + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[13], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::LINE: aKindStr = tr( "GEOM_LINE" ); - theParameters = tr( "GEOM_POSITION" ) + - "\n" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_DIRECTION" ) + - "\n" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); + theParameters = TITLE( "GEOM_POSITION" ) + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_DIRECTION" ) + + "
    " + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::SEGMENT: aKindStr = tr( "GEOM_SEGMENT" ); - theParameters = tr( "GEOM_POINT_I" ).arg( 1 ) + - "\n" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + - "\n" + tr( "GEOM_POINT_I" ).arg( 2 ) + - "\n" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + - "\n" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + - "\n" + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); + theParameters = TITLE_I( "GEOM_POINT_I", 1 ) + + "
    " + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE_I( "GEOM_POINT_I", 2 ) + + "
    " + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::EDGE: aKindStr = tr( "GEOM_EDGE" ); break; case GEOM::GEOM_IKindOfShape::VERTEX: aKindStr = tr( "GEOM_VERTEX" ); - theParameters = tr( "GEOM_COORDINATES" ) + - "\n" + tr( "GEOM_X" ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + - "\n" + tr( "GEOM_Y" ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + - "\n" + tr( "GEOM_Z" ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ); + theParameters = TITLE( "GEOM_COORDINATES" ) + + "
    " + tr( "GEOM_X" ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y" ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z" ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ); + break; + case GEOM::GEOM_IKindOfShape::LCS: + aKindStr = tr( "GEOM_LCS" ); + theParameters = TITLE("GEOM_POSITION") + + "
    " + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) + + "
    " + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) + + "
    " + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) + + "
    " + TITLE( "GEOM_X_AXIS") + + "
    " + "Xx :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) + + "
    " + "Xy :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) + + "
    " + "Xz :" + PRINT_DOUBLE( aDbls[5], aLenPrecision ) + + "
    " + TITLE( "GEOM_Y_AXIS") + + "
    " + "Yx :" + PRINT_DOUBLE( aDbls[6], aLenPrecision ) + + "
    " + "Yy :" + PRINT_DOUBLE( aDbls[7], aLenPrecision ) + + "
    " + "Yz :" + PRINT_DOUBLE( aDbls[8], aLenPrecision ) + + "
    " + TITLE( "GEOM_Z_AXIS") + + "
    " + "Zx :" + PRINT_DOUBLE( aDbls[9], aLenPrecision ) + + "
    " + "Zy :" + PRINT_DOUBLE( aDbls[10], aLenPrecision ) + + "
    " + "Zz :" + PRINT_DOUBLE( aDbls[11], aLenPrecision ); break; case GEOM::GEOM_IKindOfShape::ADVANCED: { @@ -629,4 +648,4 @@ void MeasureGUI_WhatisDlg::SelectionIntoArgument() mySelEdit->setText(GEOMBase::GetName(myObj.get())); processObject(); redisplayPreview(); -} \ No newline at end of file +} diff --git a/src/MeasureGUI/MeasureGUI_definitions.h b/src/MeasureGUI/MeasureGUI_definitions.h new file mode 100644 index 000000000..f61720001 --- /dev/null +++ b/src/MeasureGUI/MeasureGUI_definitions.h @@ -0,0 +1,33 @@ +// Copyright (C) 2015 CEA/DEN, EDF R&D, OPEN CASCADE +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef MEASUREGUI_DEF_HXX +#define MEASUREGUI_DEF_HXX + +#ifdef WIN32 +# if defined MEASUREGUI_EXPORTS || defined MeasureGUI_EXPORTS +# define MEASUREGUI_EXPORT __declspec( dllexport ) +# else +# define MEASUREGUI_EXPORT __declspec( dllimport ) +# endif +#else +# define MEASUREGUI_EXPORT +#endif + +#endif \ No newline at end of file diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index 7ee734a7b..f18df7940 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -307,7 +307,7 @@ void PrimitiveGUI_BoxDlg::SetEditCurrentArgument() disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -323,7 +323,7 @@ void PrimitiveGUI_BoxDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); if (getConstructorId() == 0) { - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); } diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index a3c86ed62..a69ddf957 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -308,7 +308,7 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument() GroupPoints->LineEdit2->setEnabled(false); globalSelection(GEOM_POINT); // to break previous local selection - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } else if (send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; @@ -317,7 +317,7 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument() GroupPoints->LineEdit1->setEnabled(false); globalSelection(GEOM_LINE);// to break previous local selection - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index fd30c9b44..fce60b91c 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -317,7 +317,7 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument() GroupPoints->LineEdit2->setEnabled(false); globalSelection(GEOM_POINT); // to break previous local selection - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } else if (send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; @@ -326,7 +326,7 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument() GroupPoints->LineEdit1->setEnabled(false); globalSelection(GEOM_LINE); // to break previous local selection - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); diff --git a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx index 4101be272..d558048bf 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx @@ -397,11 +397,11 @@ void PrimitiveGUI_DiskDlg::SetEditCurrentArgument() disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0); if (myEditCurrentArgument == GroupPntVecR->LineEdit2) { globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } else { globalSelection(); // close local contexts, if any - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); diff --git a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx index 6f6d17912..e36fd5fc0 100755 --- a/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx @@ -127,7 +127,7 @@ void PrimitiveGUI_FaceDlg::Init() myEdge.nullify(); myFace.nullify(); globalSelection(); // close local contexts, if any - // localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + // localSelection( TopAbs_EDGE ); myOrientationType = 1; @@ -224,12 +224,12 @@ void PrimitiveGUI_FaceDlg::TypeButtonClicked() { if ( GroupType->RadioButton1->isChecked() ) { globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); GroupPlane->TextLabel1->setText( tr( "GEOM_EDGE" ) ); } else if ( GroupType->RadioButton2->isChecked() ) { globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + localSelection( TopAbs_FACE ); GroupPlane->TextLabel1->setText( tr( "GEOM_FACE" ) ); } myEditCurrentArgument = GroupPlane->LineEdit1; @@ -288,7 +288,7 @@ void PrimitiveGUI_FaceDlg::ConstructorsClicked( int constructorId ) case 1: { globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); myEditCurrentArgument = GroupPlane->LineEdit1; myEditCurrentArgument->setText(""); myEdge.nullify(); @@ -362,9 +362,9 @@ void PrimitiveGUI_FaceDlg::SetEditCurrentArgument() if ( send == GroupPlane->PushButton1 ) { myEditCurrentArgument = GroupPlane->LineEdit1; if (GroupType->RadioButton1->isChecked()) - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); else if (GroupType->RadioButton1->isChecked()) - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE ); + localSelection( TopAbs_FACE ); } myEditCurrentArgument->setFocus(); diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index ddd615ef9..73e2c592f 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -165,7 +165,7 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked( int constructorId ) case 0: { globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); GroupDimensions->hide(); GroupPoints->show(); @@ -268,7 +268,7 @@ void PrimitiveGUI_SphereDlg::SetEditCurrentArgument() GroupPoints->LineEdit1->setFocus(); myEditCurrentArgument = GroupPoints->LineEdit1; globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); + localSelection( TopAbs_VERTEX ); SelectionIntoArgument(); } } diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index 3cc46d8e5..979e52412 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -296,7 +296,7 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() GroupPoints->LineEdit2->setEnabled(false); globalSelection(GEOM_POINT); // to break previous local selection - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } else if (send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; @@ -305,7 +305,7 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument() GroupPoints->LineEdit1->setEnabled(false); globalSelection(GEOM_LINE); // to break previous local selection - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); diff --git a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx index 086874a90..673f29d6b 100644 --- a/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx +++ b/src/RepairGUI/RepairGUI_DivideEdgeDlg.cxx @@ -550,12 +550,10 @@ bool RepairGUI_DivideEdgeDlg::getIsByParameter() const //================================================================================= void RepairGUI_DivideEdgeDlg::initSelection() { - TopAbs_ShapeEnum type = TopAbs_EDGE; - if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) - type = TopAbs_VERTEX; - - globalSelection(); // close local contexts, if any - localSelection( GEOM::GEOM_Object::_nil(), type ); // load local selection on ALL objects + // close local contexts + globalSelection(); + // load local selection on ALL objects + localSelection( myEditCurrentArgument == GroupPoints->LineEdit2 ? TopAbs_VERTEX : TopAbs_EDGE ); } //================================================================================= diff --git a/src/RepairGUI/RepairGUI_GlueDlg.cxx b/src/RepairGUI/RepairGUI_GlueDlg.cxx index 3d9c5cc1d..2c288851b 100644 --- a/src/RepairGUI/RepairGUI_GlueDlg.cxx +++ b/src/RepairGUI/RepairGUI_GlueDlg.cxx @@ -615,8 +615,6 @@ bool RepairGUI_GlueDlg::onAcceptLocal() return false; } - erasePreview(false); - try { if (openCommand()) { SUIT_OverrideCursor wc; @@ -672,6 +670,8 @@ bool RepairGUI_GlueDlg::onAcceptLocal() abortCommand(); } + erasePreview(false); + updateViewer(); activateSelection(); updateButtonState(); diff --git a/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx b/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx index e3df32f8a..71d3ce0f2 100755 --- a/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx +++ b/src/RepairGUI/RepairGUI_ShapeProcessDlg.cxx @@ -361,7 +361,7 @@ void RepairGUI_ShapeProcessDlg::init() //myOpList->setCurrentRow( myOpList->findItem( 0 ); reset(); - myStack->setCurrentIndex( 0 ); + myOpList->setCurrentRow(0); initName( tr( "PROCESS_SHAPE_NEW_OBJ_NAME" )); selectionChanged(); diff --git a/src/STEPPlugin/STEPPlugin_GUI.cxx b/src/STEPPlugin/STEPPlugin_GUI.cxx index 88686838e..c8f0300e3 100644 --- a/src/STEPPlugin/STEPPlugin_GUI.cxx +++ b/src/STEPPlugin/STEPPlugin_GUI.cxx @@ -36,10 +36,13 @@ #include "GEOM_Operation.h" #include "GEOMBase.h" #include "GEOM_Displayer.h" +#include "GEOM_GenericObjPtr.h" #include #include CORBA_SERVER_HEADER(STEPPlugin) +typedef GEOM::GenericObjPtr STEPOpPtr; + //======================================================================= // function : STEPPlugin_GUI() // purpose : Constructor @@ -111,8 +114,8 @@ bool STEPPlugin_GUI::importSTEP( SUIT_Desktop* parent ) SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() ); GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STEPPluginEngine" ); - GEOM::ISTEPOperations_var stepOp = GEOM::ISTEPOperations::_narrow( op ); - if ( CORBA::is_nil( stepOp ) ) return false; + STEPOpPtr stepOp = GEOM::ISTEPOperations::_narrow( op ); + if ( stepOp.isNull() ) return false; QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""), tr( "STEP_FILES" ), @@ -128,7 +131,7 @@ bool STEPPlugin_GUI::importSTEP( SUIT_Desktop* parent ) { QString fileName = fileNames.at( i ); SUIT_OverrideCursor wc; - GEOM_Operation transaction( app, stepOp.in() ); + GEOM_Operation transaction( app, stepOp.get() ); bool ignoreUnits = false; try @@ -189,6 +192,7 @@ bool STEPPlugin_GUI::importSTEP( SUIT_Desktop* parent ) } transaction.commit(); GEOM_Displayer( study ).Display( main.in() ); + main->UnRegister(); } else { @@ -228,8 +232,8 @@ bool STEPPlugin_GUI::exportSTEP( SUIT_Desktop* parent ) SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() ); GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STEPPluginEngine" ); - GEOM::ISTEPOperations_var stepOp = GEOM::ISTEPOperations::_narrow( op ); - if ( CORBA::is_nil( stepOp ) ) return false; + STEPOpPtr stepOp = GEOM::ISTEPOperations::_narrow( op ); + if ( stepOp.isNull() ) return false; LightApp_SelectionMgr* sm = app->selectionMgr(); if ( !sm ) return false; @@ -257,7 +261,7 @@ bool STEPPlugin_GUI::exportSTEP( SUIT_Desktop* parent ) SUIT_OverrideCursor wc; - GEOM_Operation transaction( app, stepOp.in() ); + GEOM_Operation transaction( app, stepOp.get() ); try { diff --git a/src/STEPPlugin/STEPPlugin_ImportDriver.cxx b/src/STEPPlugin/STEPPlugin_ImportDriver.cxx index a00ccdcd8..961dd77be 100644 --- a/src/STEPPlugin/STEPPlugin_ImportDriver.cxx +++ b/src/STEPPlugin/STEPPlugin_ImportDriver.cxx @@ -66,239 +66,242 @@ #include #include // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC -//============================================================================= -/*! - * GetShape() - */ -//============================================================================= - -TopoDS_Shape GetShape(const Handle(Standard_Transient) &theEnti, - const Handle(Transfer_TransientProcess) &theTP) +namespace { - TopoDS_Shape aResult; - Handle(Transfer_Binder) aBinder = theTP->Find(theEnti); - - if (aBinder.IsNull()) { + //============================================================================= + /*! + * GetShape() + */ + //============================================================================= + + TopoDS_Shape GetShape(const Handle(Standard_Transient) &theEnti, + const Handle(Transfer_TransientProcess) &theTP) + { + TopoDS_Shape aResult; + Handle(Transfer_Binder) aBinder = theTP->Find(theEnti); + + if (aBinder.IsNull()) { + return aResult; + } + + aResult = TransferBRep::ShapeResult(aBinder); + + return aResult; + } + + //============================================================================= + /*! + * GetLabel() + */ + //============================================================================= + + TDF_Label GetLabel(const Handle(Standard_Transient) &theEnti, + const TDF_Label &theShapeLabel, + const TopoDS_Shape &aShape) + { + TDF_Label aResult; + + if (theEnti->IsKind + (STANDARD_TYPE(StepGeom_GeometricRepresentationItem))) { + // check all named shapes using iterator + TDF_ChildIDIterator anIt + (theShapeLabel, TDataStd_Name::GetID(), Standard_True); + + for (; anIt.More(); anIt.Next()) { + Handle(TDataStd_Name) nameAttr = + Handle(TDataStd_Name)::DownCast(anIt.Value()); + + if (nameAttr.IsNull()) { + continue; + } + + TDF_Label aLab = nameAttr->Label(); + Handle(TNaming_NamedShape) shAttr; + + if (aLab.FindAttribute(TNaming_NamedShape::GetID(), shAttr) && + shAttr->Get().IsEqual(aShape)) { + aResult = aLab; + } + } + } + + // create label and set shape + if (aResult.IsNull()) { + TDF_TagSource aTag; + + aResult = aTag.NewChild(theShapeLabel); + + TNaming_Builder tnBuild (aResult); + + tnBuild.Generated(aShape); + } + return aResult; } - aResult = TransferBRep::ShapeResult(aBinder); - - return aResult; -} - -//============================================================================= -/*! - * GetLabel() - */ -//============================================================================= - -TDF_Label GetLabel(const Handle(Standard_Transient) &theEnti, - const TDF_Label &theShapeLabel, - const TopoDS_Shape &aShape) -{ - TDF_Label aResult; - - if (theEnti->IsKind - (STANDARD_TYPE(StepGeom_GeometricRepresentationItem))) { - // check all named shapes using iterator - TDF_ChildIDIterator anIt - (theShapeLabel, TDataStd_Name::GetID(), Standard_True); - - for (; anIt.More(); anIt.Next()) { - Handle(TDataStd_Name) nameAttr = - Handle(TDataStd_Name)::DownCast(anIt.Value()); - - if (nameAttr.IsNull()) { - continue; - } - - TDF_Label aLab = nameAttr->Label(); - Handle(TNaming_NamedShape) shAttr; - - if (aLab.FindAttribute(TNaming_NamedShape::GetID(), shAttr) && - shAttr->Get().IsEqual(aShape)) { - aResult = aLab; - } - } - } - - // create label and set shape - if (aResult.IsNull()) { - TDF_TagSource aTag; - - aResult = aTag.NewChild(theShapeLabel); - - TNaming_Builder tnBuild (aResult); - - tnBuild.Generated(aShape); - } - - return aResult; -} - -//============================================================================= -/*! - * StoreName() - */ -//============================================================================= - -void StoreName( const Handle(Standard_Transient) &theEnti, - const TopTools_IndexedMapOfShape &theIndices, - const Handle(Transfer_TransientProcess) &theTP, - const TDF_Label &theShapeLabel) -{ - Handle(TCollection_HAsciiString) aName; - - if (theEnti->IsKind(STANDARD_TYPE(StepShape_TopologicalRepresentationItem)) || - theEnti->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationItem))) { - aName = Handle(StepRepr_RepresentationItem)::DownCast(theEnti)->Name(); - } else { - Handle(StepBasic_ProductDefinition) PD = - Handle(StepBasic_ProductDefinition)::DownCast(theEnti); - - if (PD.IsNull() == Standard_False) { - Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct(); - aName = Prod->Name(); - } - } - - bool isValidName = false; - - if (aName.IsNull() == Standard_False) { - isValidName = true; - - if (aName->UsefullLength() < 1) { - isValidName = false; - } else if (aName->UsefullLength() == 4 && - toupper (aName->Value(1)) == 'N' && - toupper (aName->Value(2)) == 'O' && - toupper (aName->Value(3)) == 'N' && - toupper (aName->Value(4)) == 'E') { - // skip 'N0NE' name - isValidName = false; + //============================================================================= + /*! + * StoreName() + */ + //============================================================================= + + void StoreName( const Handle(Standard_Transient) &theEnti, + const TopTools_IndexedMapOfShape &theIndices, + const Handle(Transfer_TransientProcess) &theTP, + const TDF_Label &theShapeLabel) + { + Handle(TCollection_HAsciiString) aName; + + if (theEnti->IsKind(STANDARD_TYPE(StepShape_TopologicalRepresentationItem)) || + theEnti->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationItem))) { + aName = Handle(StepRepr_RepresentationItem)::DownCast(theEnti)->Name(); } else { - // special check to pass names like "Open CASCADE STEP translator 6.3 1" - TCollection_AsciiString aSkipName ("Open CASCADE STEP translator"); + Handle(StepBasic_ProductDefinition) PD = + Handle(StepBasic_ProductDefinition)::DownCast(theEnti); + + if (PD.IsNull() == Standard_False) { + Handle(StepBasic_Product) Prod = PD->Formation()->OfProduct(); + aName = Prod->Name(); + } + } + + bool isValidName = false; - if (aName->Length() >= aSkipName.Length()) { - if (aName->String().SubString - (1, aSkipName.Length()).IsEqual(aSkipName)) { - isValidName = false; + if (aName.IsNull() == Standard_False) { + isValidName = true; + + if (aName->UsefullLength() < 1) { + isValidName = false; + } else if (aName->UsefullLength() == 4 && + toupper (aName->Value(1)) == 'N' && + toupper (aName->Value(2)) == 'O' && + toupper (aName->Value(3)) == 'N' && + toupper (aName->Value(4)) == 'E') { + // skip 'N0NE' name + isValidName = false; + } else { + // special check to pass names like "Open CASCADE STEP translator 6.3 1" + TCollection_AsciiString aSkipName ("Open CASCADE STEP translator"); + + if (aName->Length() >= aSkipName.Length()) { + if (aName->String().SubString + (1, aSkipName.Length()).IsEqual(aSkipName)) { + isValidName = false; + } + } + } + } + + if (isValidName) { + TCollection_ExtendedString aNameExt (aName->ToCString()); + + // find target shape + TopoDS_Shape S = GetShape(theEnti, theTP); + + if (S.IsNull()) { + return; + } + + // as PRODUCT can be included in the main shape + // several times, we look here for all iclusions. + Standard_Integer isub, nbSubs = theIndices.Extent(); + + for (isub = 1; isub <= nbSubs; isub++) { + TopoDS_Shape aSub = theIndices.FindKey(isub); + + if (aSub.IsPartner(S)) { + TDF_Label L = GetLabel(theEnti, theShapeLabel, aSub); + + // set a name + TDataStd_Name::Set(L, aNameExt); } } } } - if (isValidName) { - TCollection_ExtendedString aNameExt (aName->ToCString()); + //============================================================================= + /*! + * StoreMaterial() + */ + //============================================================================= - // find target shape - TopoDS_Shape S = GetShape(theEnti, theTP); - - if (S.IsNull()) { - return; - } - - // as PRODUCT can be included in the main shape - // several times, we look here for all iclusions. - Standard_Integer isub, nbSubs = theIndices.Extent(); - - for (isub = 1; isub <= nbSubs; isub++) { - TopoDS_Shape aSub = theIndices.FindKey(isub); - - if (aSub.IsPartner(S)) { - TDF_Label L = GetLabel(theEnti, theShapeLabel, aSub); - - // set a name - TDataStd_Name::Set(L, aNameExt); - } - } - } -} - -//============================================================================= -/*! - * StoreMaterial() - */ -//============================================================================= - -void StoreMaterial( const Handle(Standard_Transient) &theEnti, - const TopTools_IndexedMapOfShape &theIndices, - const Handle(Transfer_TransientProcess) &theTP, - const TDF_Label &theShapeLabel ) -{ - // Treat Product Definition Shape only. - Handle(StepRepr_ProductDefinitionShape) aPDS = + void StoreMaterial( const Handle(Standard_Transient) &theEnti, + const TopTools_IndexedMapOfShape &theIndices, + const Handle(Transfer_TransientProcess) &theTP, + const TDF_Label &theShapeLabel ) + { + // Treat Product Definition Shape only. + Handle(StepRepr_ProductDefinitionShape) aPDS = Handle(StepRepr_ProductDefinitionShape)::DownCast(theEnti); - Handle(StepBasic_ProductDefinition) aProdDef; + Handle(StepBasic_ProductDefinition) aProdDef; - if(aPDS.IsNull() == Standard_False) { - // Product Definition Shape ==> Product Definition - aProdDef = aPDS->Definition().ProductDefinition(); - } + if(aPDS.IsNull() == Standard_False) { + // Product Definition Shape ==> Product Definition + aProdDef = aPDS->Definition().ProductDefinition(); + } - if (aProdDef.IsNull() == Standard_False) { - // Product Definition ==> Property Definition - const Interface_Graph &aGraph = theTP->Graph(); - Interface_EntityIterator aSubs = aGraph.Sharings(aProdDef); - TopoDS_Shape aShape; + if (aProdDef.IsNull() == Standard_False) { + // Product Definition ==> Property Definition + const Interface_Graph &aGraph = theTP->Graph(); + Interface_EntityIterator aSubs = aGraph.Sharings(aProdDef); + TopoDS_Shape aShape; - for(aSubs.Start(); aSubs.More(); aSubs.Next()) { - Handle(StepRepr_PropertyDefinition) aPropD = - Handle(StepRepr_PropertyDefinition)::DownCast(aSubs.Value()); + for(aSubs.Start(); aSubs.More(); aSubs.Next()) { + Handle(StepRepr_PropertyDefinition) aPropD = + Handle(StepRepr_PropertyDefinition)::DownCast(aSubs.Value()); - if(aPropD.IsNull() == Standard_False) { - // Property Definition ==> Representation. - Interface_EntityIterator aSubs1 = aGraph.Sharings(aPropD); + if(aPropD.IsNull() == Standard_False) { + // Property Definition ==> Representation. + Interface_EntityIterator aSubs1 = aGraph.Sharings(aPropD); - for(aSubs1.Start(); aSubs1.More(); aSubs1.Next()) { - Handle(StepRepr_PropertyDefinitionRepresentation) aPDR = - Handle(StepRepr_PropertyDefinitionRepresentation):: + for(aSubs1.Start(); aSubs1.More(); aSubs1.Next()) { + Handle(StepRepr_PropertyDefinitionRepresentation) aPDR = + Handle(StepRepr_PropertyDefinitionRepresentation):: DownCast(aSubs1.Value()); - if(aPDR.IsNull() == Standard_False) { - // Property Definition ==> Material Name. - Handle(StepRepr_Representation) aRepr = aPDR->UsedRepresentation(); + if(aPDR.IsNull() == Standard_False) { + // Property Definition ==> Material Name. + Handle(StepRepr_Representation) aRepr = aPDR->UsedRepresentation(); - if(aRepr.IsNull() == Standard_False) { - Standard_Integer ir; + if(aRepr.IsNull() == Standard_False) { + Standard_Integer ir; - for(ir = 1; ir <= aRepr->NbItems(); ir++) { - Handle(StepRepr_RepresentationItem) aRI = aRepr->ItemsValue(ir); - Handle(StepRepr_DescriptiveRepresentationItem) aDRI = - Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(aRI); + for(ir = 1; ir <= aRepr->NbItems(); ir++) { + Handle(StepRepr_RepresentationItem) aRI = aRepr->ItemsValue(ir); + Handle(StepRepr_DescriptiveRepresentationItem) aDRI = + Handle(StepRepr_DescriptiveRepresentationItem)::DownCast(aRI); - if(aDRI.IsNull() == Standard_False) { - // Get shape from Product Definition - Handle(TCollection_HAsciiString) aMatName = aDRI->Name(); + if(aDRI.IsNull() == Standard_False) { + // Get shape from Product Definition + Handle(TCollection_HAsciiString) aMatName = aDRI->Name(); - if(aMatName.IsNull() == Standard_False) { - TCollection_ExtendedString - aMatNameExt (aMatName->ToCString()); - - if (aShape.IsNull()) { - // Get the shape. - aShape = GetShape(aProdDef, theTP); + if(aMatName.IsNull() == Standard_False) { + TCollection_ExtendedString + aMatNameExt (aMatName->ToCString()); if (aShape.IsNull()) { - return; + // Get the shape. + aShape = GetShape(aProdDef, theTP); + + if (aShape.IsNull()) { + return; + } } - } - // as PRODUCT can be included in the main shape - // several times, we look here for all iclusions. - Standard_Integer isub, nbSubs = theIndices.Extent(); + // as PRODUCT can be included in the main shape + // several times, we look here for all iclusions. + Standard_Integer isub, nbSubs = theIndices.Extent(); - for (isub = 1; isub <= nbSubs; isub++) { - TopoDS_Shape aSub = theIndices.FindKey(isub); + for (isub = 1; isub <= nbSubs; isub++) { + TopoDS_Shape aSub = theIndices.FindKey(isub); - if (aSub.IsPartner(aShape)) { - TDF_Label aLabel = - GetLabel(aProdDef, theShapeLabel, aSub); + if (aSub.IsPartner(aShape)) { + TDF_Label aLabel = + GetLabel(aProdDef, theShapeLabel, aSub); - // set a name - TDataStd_Comment::Set(aLabel, aMatNameExt); + // set a name + TDataStd_Comment::Set(aLabel, aMatNameExt); + } } } } @@ -310,7 +313,53 @@ void StoreMaterial( const Handle(Standard_Transient) &theEnti, } } } -} + + TCollection_AsciiString ToNamedUnit( const TCollection_AsciiString& unit ) + { + TCollection_AsciiString result = unit; + result.LowerCase(); + if ( result == "mil" ) result = "milliinch"; + return result; + } + + TCollection_AsciiString ToOcctUnit( const TCollection_AsciiString& unit, TCollection_AsciiString& error ) + { + TCollection_AsciiString result = "M", u = ToNamedUnit(unit); + u.LowerCase(); + + if (u == "inch") + result = "INCH"; + else if (u == "milliinch") + result = "MIL"; + else if (u == "microinch") + result = "UIN"; + else if (u == "foot") + result = "FT"; + else if (u == "mile") + result = "MI"; + else if (u == "metre") + result = "M"; + else if (u == "kilometre") + result = "KM"; + else if (u == "millimetre") + result = "MM"; + else if (u == "centimetre") + result = "CM"; + else if (u == "micrometre") + result = "UM"; + else if (u.IsEmpty()) + result = "M"; + else + error = "The file contains not supported units"; + + // TODO (for other units) + // else + // result = "??" + + return result; + } + +} // end of namespace //======================================================================= //function : GetID @@ -377,21 +426,8 @@ Standard_Integer STEPPlugin_ImportDriver::Execute( TFunction_Logbook& log ) cons TColStd_SequenceOfAsciiString anUnitSolidAngleNames; aReader.FileUnits(anUnitLengthNames, anUnitAngleNames, anUnitSolidAngleNames); if (anUnitLengthNames.Length() > 0) { - TCollection_AsciiString aLenUnits = anUnitLengthNames.First(); - if (aLenUnits == "millimetre") - Interface_Static::SetCVal("xstep.cascade.unit", "MM"); - else if (aLenUnits == "centimetre") - Interface_Static::SetCVal("xstep.cascade.unit", "CM"); - else if (aLenUnits == "metre" || aLenUnits.IsEmpty()) - Interface_Static::SetCVal("xstep.cascade.unit", "M"); - else if (aLenUnits == "INCH") - Interface_Static::SetCVal("xstep.cascade.unit", "INCH"); - else { - anError = "The file contains not supported units."; - } - // TODO (for other units than mm, cm, m or inch) - // else if (aLenUnits == "") - // Interface_Static::SetCVal("xstep.cascade.unit", "???"); + TCollection_AsciiString aLenUnits = ToOcctUnit(anUnitLengthNames.First(), anError); + Interface_Static::SetCVal("xstep.cascade.unit", aLenUnits.ToCString()); } } else { @@ -548,10 +584,10 @@ GetCreationInformation( std::string& theOperationName, TCollection_AsciiString STEPPlugin_ImportDriver::GetValue( const TCollection_AsciiString& theFileName, - const TCollection_AsciiString& theParameterName, - TCollection_AsciiString& theError ) + const TCollection_AsciiString& theParameterName, + TCollection_AsciiString& theError ) { - Handle(TCollection_HAsciiString) aValue; + TCollection_AsciiString aValue; if (theParameterName != "LEN_UNITS") { theError = theParameterName + " parameter reading is not supported by STEP plugin"; @@ -575,23 +611,8 @@ STEPPlugin_ImportDriver::GetValue( const TCollection_AsciiString& theFileName, TColStd_SequenceOfAsciiString anUnitAngleNames; TColStd_SequenceOfAsciiString anUnitSolidAngleNames; aReader.FileUnits(anUnitLengthNames, anUnitAngleNames, anUnitSolidAngleNames); - if (anUnitLengthNames.Length() > 0) { - aValue = new TCollection_HAsciiString( anUnitLengthNames.First() ); - /* - TCollection_AsciiString aLenUnits = anUnitLengthNames.First(); - if (aLenUnits == "millimetre") - aValue = new TCollection_HAsciiString ("MM"); - else if (aLenUnits == "centimetre") - aValue = new TCollection_HAsciiString ("CM"); - else if (aLenUnits == "metre") - aValue = new TCollection_HAsciiString ("M"); - else if (aLenUnits == "INCH") - aValue = new TCollection_HAsciiString ("INCH"); - // TODO (for other units than mm, cm, m or inch) - //else if (aLenUnits == "") - // aValue = new TCollection_HAsciiString (""); - */ - } + if (anUnitLengthNames.Length() > 0) + aValue = ToNamedUnit( anUnitLengthNames.First() ); } else { theError = theFileName + " reading failed"; @@ -601,10 +622,7 @@ STEPPlugin_ImportDriver::GetValue( const TCollection_AsciiString& theFileName, Handle(Standard_Failure) aFail = Standard_Failure::Caught(); theError = aFail->GetMessageString(); } - if (!aValue.IsNull()) - return aValue->String(); - else - return TCollection_AsciiString(); + return aValue; } diff --git a/src/STLPlugin/STLPlugin_GUI.cxx b/src/STLPlugin/STLPlugin_GUI.cxx index 27311769a..d868adb97 100644 --- a/src/STLPlugin/STLPlugin_GUI.cxx +++ b/src/STLPlugin/STLPlugin_GUI.cxx @@ -37,10 +37,13 @@ #include "GEOM_Operation.h" #include "GEOMBase.h" #include "GEOM_Displayer.h" +#include "GEOM_GenericObjPtr.h" #include #include CORBA_SERVER_HEADER(STLPlugin) +typedef GEOM::GenericObjPtr STLOpPtr; + //======================================================================= // function : STLPlugin_GUI() // purpose : Constructor @@ -109,8 +112,8 @@ bool STLPlugin_GUI::importSTL( SUIT_Desktop* parent ) SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() ); GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STLPluginEngine" ); - GEOM::ISTLOperations_var stlOp = GEOM::ISTLOperations::_narrow( op ); - if ( CORBA::is_nil( stlOp ) ) return false; + STLOpPtr stlOp = GEOM::ISTLOperations::_narrow( op ); + if ( stlOp.isNull() ) return false; QStringList fileNames = app->getOpenFileNames( SUIT_FileDlg::getLastVisitedPath().isEmpty() ? QDir::currentPath() : QString(""), tr( "STL_FILES" ), @@ -124,7 +127,7 @@ bool STLPlugin_GUI::importSTL( SUIT_Desktop* parent ) foreach( QString fileName, fileNames ) { SUIT_OverrideCursor wc; - GEOM_Operation transaction( app, stlOp.in() ); + GEOM_Operation transaction( app, stlOp.get() ); try { @@ -143,6 +146,7 @@ bool STLPlugin_GUI::importSTL( SUIT_Desktop* parent ) entryList.append( so->GetID() ); transaction.commit(); GEOM_Displayer( study ).Display( main.in() ); + main->UnRegister(); } else { @@ -181,8 +185,8 @@ bool STLPlugin_GUI::exportSTL( SUIT_Desktop* parent ) SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() ); GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "STLPluginEngine" ); - GEOM::ISTLOperations_var stlOp = GEOM::ISTLOperations::_narrow( op ); - if ( CORBA::is_nil( stlOp ) ) return false; + STLOpPtr stlOp = GEOM::ISTLOperations::_narrow( op ); + if ( stlOp.isNull() ) return false; LightApp_SelectionMgr* sm = app->selectionMgr(); if ( !sm ) return false; @@ -215,7 +219,7 @@ bool STLPlugin_GUI::exportSTL( SUIT_Desktop* parent ) SUIT_OverrideCursor wc; - GEOM_Operation transaction( app, stlOp.in() ); + GEOM_Operation transaction( app, stlOp.get() ); try { diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index 133d181d6..ebc844cc1 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -266,14 +266,14 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument() switch (getConstructorId()) { case 0: - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); break; case 1: - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); break; case 2: globalSelection(GEOM_PLANE); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); + localSelection(TopAbs_FACE); break; } diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index b3f04d0a0..f54ee69a3 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -330,7 +330,7 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument() else if (send == GroupArgs->PushButton2) { myEditCurrentArgument = GroupArgs->LineEdit2; - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); GroupArgs->PushButton1->setDown(false); GroupArgs->LineEdit1->setEnabled(false); diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index da234f210..1051b8abf 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -429,7 +429,7 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() else if (send == GroupPoints->PushButton2) { myEditCurrentArgument = GroupPoints->LineEdit2; - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); GroupPoints->PushButton1->setDown(false); GroupPoints->LineEdit1->setEnabled(false); @@ -445,7 +445,7 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() else if (send == GroupDimensions->PushButton2) { myEditCurrentArgument = GroupDimensions->LineEdit2; - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); GroupDimensions->PushButton1->setDown(false); GroupDimensions->PushButton3->setDown(false); @@ -455,7 +455,7 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument() else if (send == GroupDimensions->PushButton3) { myEditCurrentArgument = GroupDimensions->LineEdit3; - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); GroupDimensions->PushButton1->setDown(false); GroupDimensions->PushButton2->setDown(false); diff --git a/src/TransformationGUI/TransformationGUI_PositionDlg.cxx b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx index 87d155511..fd0283e14 100644 --- a/src/TransformationGUI/TransformationGUI_PositionDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_PositionDlg.cxx @@ -259,7 +259,7 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId) void TransformationGUI_PositionDlg::SelectionTypeButtonClicked() { if ( Group1->CheckButton2->isChecked() ) { - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); } else { TColStd_MapOfInteger aMap; aMap.Add(GEOM_WIRE); @@ -433,7 +433,7 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument() Group1->CheckButton2->setEnabled(true); if ( Group1->CheckButton2->isChecked() ) { - localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE ); + localSelection( TopAbs_EDGE ); } else { TColStd_MapOfInteger aMap; aMap.Add(GEOM_WIRE); diff --git a/src/TransformationGUI/TransformationGUI_ProjectionDlg.cxx b/src/TransformationGUI/TransformationGUI_ProjectionDlg.cxx index 2e91fc3da..186e9e0c8 100644 --- a/src/TransformationGUI/TransformationGUI_ProjectionDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ProjectionDlg.cxx @@ -239,12 +239,12 @@ void TransformationGUI_ProjectionDlg::SetEditCurrentArgument() globalSelection( aMap ); std::list needTypes; needTypes.push_back( TopAbs_VERTEX ), needTypes.push_back( TopAbs_EDGE ), needTypes.push_back( TopAbs_WIRE ); - localSelection(GEOM::GEOM_Object::_nil(), needTypes ); + localSelection(needTypes); break; } case PROJ_ON_WIRE: case PROJ_ON_EDGE: { - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); break; } default:; @@ -258,9 +258,9 @@ void TransformationGUI_ProjectionDlg::SetEditCurrentArgument() myGroup->LineEdit1->setEnabled(false); switch ( getConstructorId() ) { - case PROJ_ON_FACE: localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE); break; - case PROJ_ON_WIRE: localSelection(GEOM::GEOM_Object::_nil(), TopAbs_WIRE); break; - case PROJ_ON_EDGE: localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); break; + case PROJ_ON_FACE: localSelection(TopAbs_FACE); break; + case PROJ_ON_WIRE: localSelection(TopAbs_WIRE); break; + case PROJ_ON_EDGE: localSelection(TopAbs_EDGE); break; default:; } } diff --git a/src/TransformationGUI/TransformationGUI_ProjectionOnCylDlg.cxx b/src/TransformationGUI/TransformationGUI_ProjectionOnCylDlg.cxx index 7c5dd6176..21125e57e 100644 --- a/src/TransformationGUI/TransformationGUI_ProjectionOnCylDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ProjectionOnCylDlg.cxx @@ -60,7 +60,8 @@ TransformationGUI_ProjectionOnCylDlg::TransformationGUI_ProjectionOnCylDlg myRadiusSpin (0), myStartAngleSpin (0), myUseAngleLen (0), - myAngleLenSpin (0) + myAngleLenSpin (0), + myAngleRotSpin (0) { SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr(); QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICO_DLG_PROJ_ON_CYL"))); @@ -85,6 +86,8 @@ TransformationGUI_ProjectionOnCylDlg::TransformationGUI_ProjectionOnCylDlg new QLabel(tr("GEOM_PROJ_ON_CYL_START_ANGLE"), aGrpParams); QLabel *anAngleLenLbl = new QLabel(tr("GEOM_PROJ_ON_CYL_LENGTH_ANGLE"), aGrpParams); + QLabel *anAngleRotLbl = + new QLabel(tr("GEOM_PROJ_ON_CYL_ROTATION_ANGLE"), aGrpParams); myObjectName = new QLineEdit(aGrpParams); mySelButton = new QPushButton(aGrpParams); @@ -92,6 +95,7 @@ TransformationGUI_ProjectionOnCylDlg::TransformationGUI_ProjectionOnCylDlg myStartAngleSpin = new SalomeApp_DoubleSpinBox(aGrpParams); myUseAngleLen = new QCheckBox(aGrpParams); myAngleLenSpin = new SalomeApp_DoubleSpinBox(aGrpParams); + myAngleRotSpin = new SalomeApp_DoubleSpinBox(aGrpParams); myObjectName->setReadOnly(true); mySelButton->setIcon(image1); @@ -110,6 +114,8 @@ TransformationGUI_ProjectionOnCylDlg::TransformationGUI_ProjectionOnCylDlg aParamsLayout->addWidget(myUseAngleLen, 3, 0); aParamsLayout->addWidget(anAngleLenLbl, 3, 1); aParamsLayout->addWidget(myAngleLenSpin, 3, 2, 1, 2); + aParamsLayout->addWidget(anAngleRotLbl, 4, 1); + aParamsLayout->addWidget(myAngleRotSpin, 4, 2, 1, 2); QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); layout->setMargin( 0 ); layout->setSpacing( 6 ); @@ -145,14 +151,17 @@ void TransformationGUI_ProjectionOnCylDlg::Init() double aRadius = 100.0; double aStartAngle = 0.; double anAngleLen = 360.; + double aRotAngle = 0.; initSpinBox(myRadiusSpin, 0.00001, COORD_MAX, aStep, "length_precision"); initSpinBox(myStartAngleSpin, -180., 180., aSpecificStep, "angle_precision"); initSpinBox(myAngleLenSpin, 0.00001, COORD_MAX, aSpecificStep, "angle_precision"); + initSpinBox(myAngleRotSpin, -180., 180., aSpecificStep, "angle_precision"); myRadiusSpin->setValue(aRadius); myStartAngleSpin->setValue(aStartAngle); myAngleLenSpin->setValue(anAngleLen); + myAngleRotSpin->setValue(aRotAngle); myObjectName->setText(""); myUseAngleLen->setChecked(true); @@ -165,6 +174,7 @@ void TransformationGUI_ProjectionOnCylDlg::Init() connect(myRadiusSpin, SIGNAL(valueChanged(double)), this, SLOT(processPreview())); connect(myStartAngleSpin, SIGNAL(valueChanged(double)), this, SLOT(processPreview())); connect(myAngleLenSpin, SIGNAL(valueChanged(double)), this, SLOT(processPreview())); + connect(myAngleRotSpin, SIGNAL(valueChanged(double)), this, SLOT(processPreview())); connect(myUseAngleLen, SIGNAL(clicked()), this, SLOT(SetUseLengthAngle())); connect(myGeomGUI->getApp()->selectionMgr(),SIGNAL(currentSelectionChanged()), @@ -319,7 +329,8 @@ bool TransformationGUI_ProjectionOnCylDlg::isValid (QString &msg) if (!myObj->_is_nil() && myRadiusSpin->isValid(msg, !IsPreview()) && - myStartAngleSpin->isValid(msg, !IsPreview())) { + myStartAngleSpin->isValid(msg, !IsPreview()) && + myAngleRotSpin->isValid(msg, !IsPreview())) { if (myUseAngleLen->isChecked()) { // Check length angle spin. isOk = myAngleLenSpin->isValid(msg, !IsPreview()); @@ -343,6 +354,7 @@ bool TransformationGUI_ProjectionOnCylDlg::execute (ObjectList& objects) double aRadius = myRadiusSpin->value(); double aStartAngle = myStartAngleSpin->value()*M_PI/180.; + double aRotAngle = myAngleRotSpin->value()*M_PI/180.; double aLengthAngle = -1.; if (myUseAngleLen->isChecked()) { @@ -350,7 +362,7 @@ bool TransformationGUI_ProjectionOnCylDlg::execute (ObjectList& objects) } GEOM::GEOM_Object_var anObj = anOper->MakeProjectionOnCylinder - (myObj, aRadius, aStartAngle, aLengthAngle); + (myObj, aRadius, aStartAngle, aLengthAngle, aRotAngle); if (!anObj->_is_nil()) { if (!IsPreview()) { @@ -359,6 +371,7 @@ bool TransformationGUI_ProjectionOnCylDlg::execute (ObjectList& objects) aParameters << myStartAngleSpin->text(); if (myUseAngleLen->isChecked()) aParameters << myAngleLenSpin->text(); + aParameters << myAngleRotSpin->text(); anObj->SetParameters(aParameters.join(":").toUtf8().constData()); } objects.push_back(anObj._retn()); diff --git a/src/TransformationGUI/TransformationGUI_ProjectionOnCylDlg.h b/src/TransformationGUI/TransformationGUI_ProjectionOnCylDlg.h index beb16d976..eab7ee34a 100644 --- a/src/TransformationGUI/TransformationGUI_ProjectionOnCylDlg.h +++ b/src/TransformationGUI/TransformationGUI_ProjectionOnCylDlg.h @@ -72,6 +72,7 @@ private: SalomeApp_DoubleSpinBox *myStartAngleSpin; QCheckBox *myUseAngleLen; SalomeApp_DoubleSpinBox *myAngleLenSpin; + SalomeApp_DoubleSpinBox *myAngleRotSpin; }; diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index 03ce4cecb..7e9617f3d 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -361,9 +361,9 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() GroupPoints->LineEdit5->setEnabled(false); if (getConstructorId() == 0) - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); else - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } else if (send == GroupPoints->PushButton4) { myEditCurrentArgument = GroupPoints->LineEdit4; @@ -375,7 +375,7 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() GroupPoints->LineEdit2->setEnabled(false); GroupPoints->LineEdit5->setEnabled(false); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } else if (send == GroupPoints->PushButton5) { myEditCurrentArgument = GroupPoints->LineEdit5; @@ -387,7 +387,7 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument() GroupPoints->LineEdit2->setEnabled(false); GroupPoints->LineEdit4->setEnabled(false); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index e43169ba3..50e338f11 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -325,7 +325,7 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument() else if (send == PushButton2) { myEditCurrentArgument = LineEdit2; - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); PushButton1->setDown(false); LineEdit1->setEnabled(false); diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index f5622c716..23bafef69 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -385,9 +385,9 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument() GroupPoints->LineEdit3->setEnabled(false); if (getConstructorId() == 1) - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); else - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE); + localSelection(TopAbs_EDGE); } else if (send == GroupPoints->PushButton3) { myEditCurrentArgument = GroupPoints->LineEdit3; @@ -397,7 +397,7 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument() GroupPoints->LineEdit1->setEnabled(false); GroupPoints->LineEdit2->setEnabled(false); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); } connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); diff --git a/src/VTKPlugin/VTKPlugin_GUI.cxx b/src/VTKPlugin/VTKPlugin_GUI.cxx index ada1e297c..fbf7dfdc6 100644 --- a/src/VTKPlugin/VTKPlugin_GUI.cxx +++ b/src/VTKPlugin/VTKPlugin_GUI.cxx @@ -35,10 +35,13 @@ #include "GEOM_Operation.h" #include "GEOMBase.h" #include "GEOM_Displayer.h" +#include "GEOM_GenericObjPtr.h" #include #include CORBA_SERVER_HEADER(VTKPlugin) +typedef GEOM::GenericObjPtr VTKOpPtr; + //======================================================================= // function : VTKPlugin_GUI() // purpose : Constructor @@ -102,8 +105,8 @@ bool VTKPlugin_GUI::exportVTK( SUIT_Desktop* parent ) SALOMEDS::Study_var dsStudy = GeometryGUI::ClientStudyToStudy( study->studyDS() ); GEOM::GEOM_IOperations_var op = GeometryGUI::GetGeomGen()->GetPluginOperations( dsStudy->StudyId(), "VTKPluginEngine" ); - GEOM::IVTKOperations_var stlOp = GEOM::IVTKOperations::_narrow( op ); - if ( CORBA::is_nil( stlOp ) ) return false; + VTKOpPtr vtkOp = GEOM::IVTKOperations::_narrow( op ); + if ( vtkOp.isNull() ) return false; LightApp_SelectionMgr* sm = app->selectionMgr(); if ( !sm ) return false; @@ -132,16 +135,16 @@ bool VTKPlugin_GUI::exportVTK( SUIT_Desktop* parent ) SUIT_OverrideCursor wc; - GEOM_Operation transaction( app, stlOp.in() ); + GEOM_Operation transaction( app, vtkOp.get() ); try { app->putInfo( tr( "GEOM_PRP_EXPORT" ).arg( fileName ) ); transaction.start(); - stlOp->ExportVTK( obj, fileName.toUtf8().constData(), deflection ); + vtkOp->ExportVTK( obj, fileName.toUtf8().constData(), deflection ); - if ( stlOp->IsDone() ) + if ( vtkOp->IsDone() ) { transaction.commit(); } @@ -150,7 +153,7 @@ bool VTKPlugin_GUI::exportVTK( SUIT_Desktop* parent ) transaction.abort(); SUIT_MessageBox::critical( parent, tr( "GEOM_ERROR" ), - tr( "GEOM_PRP_ABORT" ) + "\n" + tr( stlOp->GetErrorCode() ) ); + tr( "GEOM_PRP_ABORT" ) + "\n" + tr( vtkOp->GetErrorCode() ) ); return false; } } diff --git a/src/XAOPlugin/XAOPlugin_Driver.cxx b/src/XAOPlugin/XAOPlugin_Driver.cxx index 01803c136..607c7b3df 100644 --- a/src/XAOPlugin/XAOPlugin_Driver.cxx +++ b/src/XAOPlugin/XAOPlugin_Driver.cxx @@ -100,6 +100,23 @@ Standard_Integer XAOPlugin_Driver::Execute(TFunction_Logbook& log) const return 1; } -IMPLEMENT_STANDARD_HANDLE (XAOPlugin_Driver, TFunction_Driver); -IMPLEMENT_STANDARD_RTTIEXT(XAOPlugin_Driver, TFunction_Driver); +//======================================================================= +//function : GetCreationInformation +//purpose : Returns a name of creation operation and names and values of +// creation parameters +//======================================================================= + +bool XAOPlugin_Driver::GetCreationInformation(std::string& theOperationName, + std::vector& theParams) +{ + if (Label().IsNull()) return false; + Handle(GEOM_Function) function = GEOM_Function::GetFunction(Label()); + + theOperationName = "ImportXAO"; + AddParam( theParams, "File name", function->GetString( GetFileNameTag() )); + return true; +} + +IMPLEMENT_STANDARD_HANDLE (XAOPlugin_Driver, GEOM_BaseDriver); +IMPLEMENT_STANDARD_RTTIEXT(XAOPlugin_Driver, GEOM_BaseDriver); diff --git a/src/XAOPlugin/XAOPlugin_Driver.hxx b/src/XAOPlugin/XAOPlugin_Driver.hxx index 1d36b839b..9a8885e96 100644 --- a/src/XAOPlugin/XAOPlugin_Driver.hxx +++ b/src/XAOPlugin/XAOPlugin_Driver.hxx @@ -23,12 +23,11 @@ #ifndef _XAOPlugin_Driver_HXX #define _XAOPlugin_Driver_HXX -// OCCT includes -#include +#include "GEOM_BaseDriver.hxx" -DEFINE_STANDARD_HANDLE(XAOPlugin_Driver, TFunction_Driver); +DEFINE_STANDARD_HANDLE(XAOPlugin_Driver, GEOM_BaseDriver); -class XAOPlugin_Driver: public TFunction_Driver +class XAOPlugin_Driver: public GEOM_BaseDriver { public: XAOPlugin_Driver(); @@ -39,7 +38,12 @@ public: Standard_Boolean MustExecute(const TFunction_Logbook&) const; virtual void Validate(TFunction_Logbook&) const {} -DEFINE_STANDARD_RTTI(XAOPlugin_Driver) + virtual bool GetCreationInformation(std::string& theOperationName, + std::vector& theParams); + + static int GetFileNameTag() { return 1; } // where to store file name in GEOM_Function + + DEFINE_STANDARD_RTTI(XAOPlugin_Driver) }; #endif // _XAOPlugin_Driver_HXX diff --git a/src/XAOPlugin/XAOPlugin_IOperations.cxx b/src/XAOPlugin/XAOPlugin_IOperations.cxx index d491cad2b..d8c886274 100644 --- a/src/XAOPlugin/XAOPlugin_IOperations.cxx +++ b/src/XAOPlugin/XAOPlugin_IOperations.cxx @@ -470,6 +470,8 @@ bool XAOPlugin_IOperations::ImportXAO( const char* fileName, if (function.IsNull()) return false; if (function->GetDriverGUID() != XAOPlugin_Driver::GetID()) return false; + function->SetString( XAOPlugin_Driver::GetFileNameTag(), fileName ); + // set the geometry if (xaoGeometry->getFormat() == XAO::BREP) { diff --git a/src/XAOPlugin/XAOPlugin_ImportDlg.cxx b/src/XAOPlugin/XAOPlugin_ImportDlg.cxx index 990386361..2d061210f 100644 --- a/src/XAOPlugin/XAOPlugin_ImportDlg.cxx +++ b/src/XAOPlugin/XAOPlugin_ImportDlg.cxx @@ -280,13 +280,16 @@ bool XAOPlugin_ImportDlg::execute() { QStringList anEntryList; anEntryList << addInStudy(m_mainShape, m_mainShape->GetName()); + m_mainShape->UnRegister(); for (int i = 0; i < subShapes->length(); i++) { addInStudy(subShapes[i].in(), subShapes[i]->GetName()); + subShapes[i]->UnRegister(); } for (int i = 0; i < groups->length(); i++) { addInStudy(groups[i].in(), groups[i]->GetName()); + groups[i]->UnRegister(); } for (int i = 0; i < fields->length(); i++) { @@ -316,6 +319,7 @@ QString XAOPlugin_ImportDlg::addFieldInStudy( GEOM::GEOM_Field_ptr theField, GEO SALOMEDS::SObject_var aSO = getGeomEngine()->AddInStudy(aStudyDS, theField, theField->GetName(), theFather); + theField->UnRegister(); QString anEntry; if ( !aSO->_is_nil() ) { @@ -331,6 +335,7 @@ QString XAOPlugin_ImportDlg::addFieldInStudy( GEOM::GEOM_Field_ptr theField, GEO QString stepName = (tr("XAOPLUGIN_STEP") + " %1 %2").arg( step->GetID() ).arg( step->GetStamp() ); SALOMEDS::SObject_wrap aSOField = getGeomEngine()->AddInStudy( aStudyDS, step, stepName.toLatin1().constData(), theField ); + step->UnRegister(); } aSO->UnRegister();