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}_MINOR_VERSION 7)
SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
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)
+SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
# Find KERNEL
# ===========
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})
##
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()
+ IF(NOT SALOME_GUI_BUILD_WITH_QT5)
+ # Qt
+ FIND_PACKAGE(SalomeQt4 REQUIRED COMPONENTS QtCore QtGui QtXml QtWebKit QtOpenGL QtNetwork)
+ # PyQt
+ FIND_PACKAGE(SalomePyQt4 REQUIRED)
+ ELSE()
+ # Qt
+ FIND_PACKAGE(SalomeQt5 REQUIRED)
+ # PyQt
+ FIND_PACKAGE(SalomePyQt5 REQUIRED)
+ ENDIF()
ENDIF(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)
LIST(APPEND GEOM_DEFINITIONS "-DWITH_OPENCV")
ENDIF()
-# For all prerequisites, load the corresponding targets if the package was used
+# For all prerequisites, load the corresponding targets if the package was used
# in CONFIG mode. This ensures dependent projects link correctly
# without having to set LD_LIBRARY_PATH:
-SET(_PREREQ @_PREREQ_LIST@)
-SET(_PREREQ_CONFIG_DIR @_PREREQ_DIR_LIST@)
-SET(_PREREQ_COMPONENTS "@_PREREQ_COMPO_LIST@")
-LIST(LENGTH _PREREQ_CONFIG_DIR _list_len)
-IF(NOT _list_len EQUAL 0)
+SET(_PREREQ_@PROJECT_NAME@ @_PREREQ_LIST@)
+SET(_PREREQ_@PROJECT_NAME@_CONFIG_DIR @_PREREQ_DIR_LIST@)
+SET(_PREREQ_@PROJECT_NAME@_COMPONENTS "@_PREREQ_COMPO_LIST@")
+LIST(LENGTH _PREREQ_@PROJECT_NAME@_CONFIG_DIR _list_len_@PROJECT_NAME@)
+IF(NOT _list_len_@PROJECT_NAME@ EQUAL 0)
# Another CMake stupidity - FOREACH(... RANGE r) generates r+1 numbers ...
- MATH(EXPR _range "${_list_len}-1")
- FOREACH(_p RANGE ${_range})
- LIST(GET _PREREQ ${_p} _pkg )
- LIST(GET _PREREQ_CONFIG_DIR ${_p} _pkg_dir)
- LIST(GET _PREREQ_COMPONENTS ${_p} _pkg_compo)
- MESSAGE(STATUS "===> Reloading targets from ${_pkg} ...")
- IF(NOT _pkg_compo)
- FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE
- PATHS "${_pkg_dir}"
- NO_DEFAULT_PATH)
- ELSE()
- STRING(REPLACE "," ";" _compo_lst "${_pkg_compo}")
- MESSAGE(STATUS "===> (components: ${_pkg_compo})")
- FIND_PACKAGE(${_pkg} REQUIRED NO_MODULE
- COMPONENTS ${_compo_lst}
- PATHS "${_pkg_dir}"
- NO_DEFAULT_PATH)
+ MATH(EXPR _range_@PROJECT_NAME@ "${_list_len_@PROJECT_NAME@}-1")
+ FOREACH(_p_@PROJECT_NAME@ RANGE ${_range_@PROJECT_NAME@})
+ LIST(GET _PREREQ_@PROJECT_NAME@ ${_p_@PROJECT_NAME@} _pkg_@PROJECT_NAME@ )
+ LIST(GET _PREREQ_@PROJECT_NAME@_CONFIG_DIR ${_p_@PROJECT_NAME@} _pkg_dir_@PROJECT_NAME@)
+ LIST(GET _PREREQ_@PROJECT_NAME@_COMPONENTS ${_p_@PROJECT_NAME@} _pkg_compo_@PROJECT_NAME@)
+ IF(NOT OMIT_DETECT_PACKAGE_${_pkg_@PROJECT_NAME@})
+ MESSAGE(STATUS "===> Reloading targets from ${_pkg_@PROJECT_NAME@} ...")
+ IF(NOT _pkg_compo_@PROJECT_NAME@)
+ FIND_PACKAGE(${_pkg_@PROJECT_NAME@} REQUIRED NO_MODULE
+ PATHS "${_pkg_dir_@PROJECT_NAME@}"
+ NO_DEFAULT_PATH)
+ ELSE()
+ STRING(REPLACE "," ";" _compo_lst_@PROJECT_NAME@ "${_pkg_compo_@PROJECT_NAME@}")
+ MESSAGE(STATUS "===> (components: ${_pkg_compo_@PROJECT_NAME@})")
+ FIND_PACKAGE(${_pkg_@PROJECT_NAME@} REQUIRED NO_MODULE
+ COMPONENTS ${_compo_lst_@PROJECT_NAME@}
+ PATHS "${_pkg_dir_@PROJECT_NAME@}"
+ NO_DEFAULT_PATH)
+ ENDIF()
ENDIF()
ENDFOREACH()
ENDIF()
complex_objs_ex09.py
complex_objs_ex10.py
complex_objs_ex11.py
+ fast_intersection.py
free_boundaries.py
free_faces.py
GEOM_box.py
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()
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"
--- /dev/null
+# 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"
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)
class SalomeSession(object):
def __init__(self, script):
import runSalome
- sys.argv = ["runSalome.py"]
+ run_script = "runSalome.py"
+ if sys.platform == 'win32':
+ module_dir = os.getenv("KERNEL_ROOT_DIR")
+ if module_dir: run_script = os.path.join(module_dir, "bin", "salome", run_script)
+ pass
+ sys.argv = [run_script]
sys.argv += ["--terminal"]
sys.argv += ["--modules=GEOM"]
sys.argv += ["%s" % script]
+ if sys.platform == 'win32':
+ main_module_path = sys.modules['__main__'].__file__
+ sys.modules['__main__'].__file__ = ''
clt, d = runSalome.main()
+ if sys.platform == 'win32':
+ sys.modules['__main__'].__file__ = main_module_path
return
def __del__(self):
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
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:
<ol>
- <li> 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.
+ <li> By specifying the position (ranging from 0.0 to 1.0) by length or by parameter.
<p>
<b>TUI Command:</b> <em>geompy.DivideEdge(Shape, EdgeID, Value,
IsByParameter)</em>
<ul>
- <li> \em Shape is a shape which contains an edge to be divided</li>
+ <li> \em Shape is a shape, which contains an edge to be divided;</li>
<li>\em EdgeID is the ID of the edge to be divided, if it is = -1,
- then \em Shape should be an edge itself.</li>
+ then \em Shape should be an edge itself;</li>
<li> \em Value is a value of parameter on edge or length parameter,
- depending on \em IsByParameter. </li>
- <li> \em IsByParameter is a boolean flag, specifying operation mode:
- - \c True: \em Value is treated as a curve parameter [0..1]
- - \c False: \em Value is treated as a length parameter [0..1] </li>
+ depending on \em IsByParameter;</li>
+ <li> \em IsByParameter is a boolean flag, specifying the operation mode:
+ - \c True: \em Value is treated as a curve parameter; [0..1]
+ - \c False: \em Value is treated as a length parameter. [0..1] </li>
</ul>
\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,
\image html repair8.png
\n\n
</li>
- <li>We can select several points that will be projected to the selected
+ <li> By selecting several points that will be projected to the selected
edge to find the location of new vertices.
<p>
- <b>TUI Command:</b> <em>geompy.DivideEdgeByPoint(Shape, Edge, Points)</em>
+ <b>TUI Command:</b> <em>geompy.DivideEdgeByPoint(Shape, Edge, Points):</em>
<ul>
- <li> \em Shape is a shape which contains an edge to be divided</li>
- <li>\em Edge is an edge to be divided (or it's ID, if it is = -1,
- then \em Shape should be an edge itself).</li>
- <li> \em Points is a list of points to project to \a Edge. </li>
+ <li> \em Shape is a shape, which contains an edge to be divided;</li>
+ <li>\em Edge is an edge to be divided (or its ID, if it is = -1,
+ then \em Shape should be an edge itself);</li>
+ <li> \em Points is a list of points to be projected to the \a Edge.</li>
</ul>
\b Arguments: Name + 1 Edge + 1 or more Points.
\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 improves the shape to 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.
In this dialog:
- \b Object - the checked object. \b Selection button allows picking it in the viewer or in the object browser.
-- <b>Use C1 criterion</b> - option that shitches on/off the C1 continuity mode.
+- <b>Use C1 criterion</b> - option switches on/off the C1 continuity mode.
- <b>Angular Tolerance</b> - 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.
-- <b>Incriminated Sub-shapes</b> 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 <b>Apply and Close</b> button.
+- <b>Incriminated Sub-shapes</b> field outputs the list of sub-shapes that cause problem.
+- \b Apply and <b>Apply and Close</b> buttons launch the improvement process
+and publish the result shape, which includes valid blocks only. The
+algorithm tries to:
+ - remove seam and degenerated edges from surfaces of revolution;
+ - re-approximate surfaces to exclude singularities on boundaries;
+ - unite edges and faces;
+ - glue faces.
\n <b>TUI Command:</b>
See also a \ref tui_check_compound_of_blocks_page "TUI example".
-*/
\ No newline at end of file
+*/
\page check_self_intersections_page Detect Self-intersections
+\n To <b>Detect Self-intersections,</b> select in the <b>Main Menu</b>
+<b>Inspection - > Detect Self-intersections</b>.
+
+There are two ways to check self-intersections.
+
+\anchor check_self_intersections_topological
+<br><h3>Check topological intersections</h3>
+
This operation checks the topology of the selected shape to detect self-intersections.
\image html measures11.png
In this dialog:
- \b Object - the checked object. \b Selection button allows picking it in the viewer or in the object browser.
-- <b>Level of check</b> - 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".
-- <b>Compute self-intersections</b> 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 <b>Sub-shapes</b> in the field to the right.
-- \b Apply and <b>Apply and Close</b> 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.
-
-\note This tool is useful for detection of shapes, not suitable for
+- <b>Level of check</b> - combo box allows setting the level of self-interference checking. It defines, which interferences will be checked. The default value is "All interferences".
+- <b>Compute self-intersections</b> 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 <b>Sub-shapes</b> in the field to the right.
+- \b Apply and <b>Apply and Close</b> buttons store the interferences selected in the <b>Self-intersections</b> 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 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 <a href="SALOME_BOA_PA.pdf">this document</a>.
See also a \ref tui_check_self_intersections_page "TUI example".
+\anchor check_self_intersections_fast
+<br><h3>Fast intersection</h3>
+
+This operation allows quickly detecting self-interferences of the given shape using the algorithm based on mesh intersections.
+
+The algorithm works on the face level, i.e. it computes only face-to-face intersections. No additional intersection types are computed.
+
+This can be useful to detect all intersections between subshapes of type "surface" in an assembly.
+The result quality will depend on the tesselation quality. However, small deflection values can significantly decrease the performance of the algorithm.
+Nevertheless, the performance of Fast Intersect algorithm is much higher than that of the topological intersection.
+
+\image html measures13.png
+
+In this dialog:
+
+- \b Object - the checked object. \b Selection button allows picking it in the viewer or in the object browser.
+- <b>Deflection coefficient</b> - a linear deflection coefficient that defines the tesselation quality. If theDeflection <= 0, default deflection 0.001 is used.
+- <b>Detect gaps with tolerance</b> specifies the distance between shapes used for detecting gaps:
+ - if theTolerance <= 0, the algorithm detects intersections;
+ - if theTolerance > 0, the algorithm detects gapss.
+- <b>Compute self-intersections</b> 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 <b>Sub-shapes</b> in the field to the right.
+- \b Apply and <b>Apply and Close</b> buttons store the interferences selected in the <b>Self-intersections</b> 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.
+
+\n <b>Result:</b> Boolean.
+\n <b>TUI Command:</b> <em>geompy.CheckSelfIntersectionsFast(theShape, theDeflection, theTolerance),</em> \n
+where: \n
+\em theShape is the shape checked for validity. \n
+\em theDeflection that specifies the quality of tesselation.
+\em theTolerance Specifies the distance between shapes used for detecting gaps.
+
+See also a \ref tui_check_self_intersections_fast_page "TUI example".
-*/
\ No newline at end of file
+*/
<li>\subpage create_extrusion_alongpath_page "Extrude an object along a path",
creating a more complex trajectory object.</li>
<li>\subpage create_pipe_path_page "Restore Path" of a pipe-like shape.</li>
-<li>\subpage create_thickness_page "Thickness" operation that allows to add a thickness to objects.</li>
-
-<li>\subpage create_groups_page "Generate Groups".
-This cross-operation functionality allows creation of groups for certain generation operations.</li>
+<li>\subpage create_thickness_page "Add thickness" to objects.</li>
+<li>\subpage create_groups_page "Generate Groups" for certain generation operations.</li>
</ul>
<b> New entity -> Advanced </b> sub-menu allows creating new geometric
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 <b>Sub Shapes Type</b> combo box depend on the type
+The choices available in the <b>Sub Shapes Type</b> combo box depend on the type
of selected <b>Main Object</b>:
- \b Compound: to extract compounds;
- \b Compsolid: to extract compsolids;
- \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 <b>Select Sub-shapes</b> 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 <b>Select Sub-shapes</b> 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:
- <b>Less Than</b> or <b>Equal or Less Than</b> for the first comparator;
- <b>Greater Than</b> or <b>Equal or Greater Than</b> 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 <b>TUI Commands</b> you can perform this operation in a
variety of ways:
- <em>geompy.ExtractShapes(Shape, Type, isSorted)</em> 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.
-- <em>geompy.SubShapeAll(Shape, Type)</em> explodes a Shape on
+ This method does not return the Shape itself if it matches the Type.
+- <em>geompy.SubShapeAll(Shape, Type)</em> explodes a Shape into
sub-shapes of a given Type and returns a List of sub-shapes.
-- <em>geompy.SubShapeAllIDs(Shape, Type)</em> explodes a Shape on
- sub-shapes of a given Type and returns a List of IDs of
- sub-shapes.
+- <em>geompy.SubShapeAllIDs(Shape, Type)</em> explodes a Shape into sub-shapes of a given Type and returns a List of IDs of sub-shapes.
- <em>geompy.SubShapeAllSortedCentres(Shape, Type)</em> 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.
- <em>geompy.SubShapeAllSortedCentresIDs(Shape, Type)</em> 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.
- <em>geompy.SubShape(Shape, Type, ListOfInd)</em> 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].
- <em>geompy.SubShapeSortedCentres(Shape, Type, ListOfInd)</em>
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]
<b>Arguments: </b>1 SHAPE + 1 type of SubShape.
<b>Example:</b>
-\image html explode.png "A box, exploded into faces"
+\image html explode.png "A box exploded into faces"
*/
- If <b>With contact</b> is checked, the section is translated in contact with the spine.
- If <b>With correction</b> is checked, the section is rotated to be orthogonal to the spine
tangent in the corresponding point.
+- If <b>Step-by-step generation</b> 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 <b>Step-by-step generation</b> is checked, <b>With contact</b> and
+<b>With correction</b> controls are disabled as corrections of bases are
+not allowed in step-by-step mode.
<b>Generate groups</b> 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 <b>TUI Command:</b> <em>geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection,
+\n <b>TUI Commands:</b>
+- <em>geompy.MakePipeWithDifferentSections(baseShape, locations, pathShape, withContact, withCorrection,
IsGenerateGroups=False)</em>
\n <b>Arguments:</b> 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).
+- <em>geompy.MakePipeWithDifferentSectionsBySteps(baseShape, locations, pathShape,
+ IsGenerateGroups=False)</em>
+\n <b>Arguments:</b> 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 <b>Advanced options</b> \ref preview_anchor "Preview"
\image html pipe3.png
\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
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 <b>TUI Command:</b> <em>geompy.MakeFaceWires([list of Shapes], isPlanarWanted)</em>
\n <b>Arguments:</b> Name + 1 wire.
\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 <b>TUI Command:</b> <em>geompy.MakeFaceFromSurface(theFace, theWire)</em>
\n <b>Arguments:</b> Name + 1 face + 1 wire.
\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 <b>TUI Command:</b> <em>geompy.MakeFaceWithConstraints([List of constraints])</em>
\n <b>Arguments:</b> Name + List of input edges and constraint faces. If a constraint
\page create_isoline_page Isoline
\b Isoline is a 3D curve built on a bounded face limited by <em> [Umin, Umax] </em> and <em> [Vmin, Vmax] </em>
-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 <b>Main Menu</b> select <b>New Entity - > Basic - > Isoline</b>.
\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 <b>TUI Command:</b> <em>geompy.MakeVertexOnCurve(Edge,Parameter).</em>
+\n <b>TUI Command:</b> <em>geompy.MakeVertexOnCurve(Edge,Parameter,takeOrientationIntoAccount).</em>
\n <b>Arguments:</b> 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.
Build - > Shell</b>
\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 <b>TUI Command:</b> <em>geompy.MakeShell(ListOfShape)</em>
\n <b>Arguments:</b> Name + Compound of faces or List of faces having connected edges.
To create a <b>Surface From Face</B> in the <b>Main Menu</b> select <b>New Entity - > Basic - > Surface From Face</b>
-\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
+<b>GEOM_Object</b>, i.e. topological shape by extracting the underlying surface
+of the source face and limiting it by the <b>Umin, Umax, Vmin</b> and <b>Vmax</b>
+parameters of the source face (in the parametric space).
\n
\ref restore_presentation_parameters_page "Advanced options".
\page create_thickness_page Thickness Construction
-To add a \b Thickness to a shape in the <b>Main Menu</b> select <b>New Entity - > Generation - > Thickness</b>
-\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
-<b>Thicken towards the inside</b> check box.
+To add \b Thickness to a shape in the <b>Main Menu</b> select <b>New Entity - > Generation - > Thickness</b>.
+
+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.
+<b>Thicken towards the inside</b> check box allows changing the thickness direction.
+
<b>Example:</b>
\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 <b>Thicken towards the inside</b> 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.
+<b>Thicken towards the inside</b> check box allows changing the thickness direction.
+
<b>Example:</b>
\image html thicksolid_result.png "Thickness of Solid"
<b>Arguments:</b> 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 <b>Advanced options</b> \ref preview_anchor "Preview"
Our <b>TUI Scripts</b> provide you with useful examples of creation of
All necessary parameters of Dependency Tree Viewer can be edited in the \ref pref_dependency_tree "Preferences".
+\note This functionality is available only if the GUI module is built with Graphics view (option SALOME_USE_GRAPHICSVIEW is ON when building GUI module).
+
<hr>
\anchor dependency_tree_nodes_anchor <h2>Nodes</h2>
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:
Dependency Tree Viewer shows oriented links between nodes to
represent the dependency direction. The viewer supports the following states of links:
-<ul><li><b>Unidirectional link</b> - shows that object B depends on object A;</li></ul>
+<ul><li><b>Unidirectional link</b> - shows that object \b B depends on object \b A;</li></ul>
\image html tree_unidir_link.png
-<ul><li><b>Bidirectional link</b> - shows that object B depends on
-object A and, at the same time, object A depends on object B;</li></ul>
+<ul><li><b>Bidirectional link</b> - shows that object \b B depends on
+object \b A and, at the same time, object \b A depends on object \b B;</li></ul>
\image html tree_bidir_link.png
<ul><li><b>Self-dependency link</b> - shows that an object depends on itself;</li></ul>
\n <b>TUI Command:</b> <em>gg.setVectorsMode(ID, Bool)</em>
-\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
<b>Display mode -> Show Vertices</b>, or apply this
functionality for all objects in the current view via the main menu
\n <b>TUI Command:</b> <em>gg.setVerticesMode(ID, Bool)</em>
-\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
<b>Display mode -> Show Name</b>, 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
<b> View -> Display Mode -> Show/Hide Name.</b>
\image html name_mode.png
/*!
-\page extension_operation_page Extension of an Edge or a Face
+\page extension_operation_page Extension
-\n To produce an \b Extension in the <b>Main Menu</b> select
-<b>Operations - > Transformation - > Extension</b>
+\n To produce an \b Extension of an Edge or a Face select in the <b>Main Menu</b>
+<b>Operations - > Transformation - > Extension</b>. 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 <b>TUI Command:</b> <em>geompy.ExtendEdge(theEdge, theMin, theMax)</em>,
where \em theEdge the input edge to be resized, \em theMin the minimal
parameter value, \em theMax the maximal parameter value.
\n <b>Arguments:</b> Name + Object (Edge) + 2 values (Min and Max Parameters).
-\image html extension1.png "Extension of an Edge"
-
\n <b>Example:</b>
\image html extend_edge_example.png "Original edge (white) and extended edge"
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 <b>TUI Command:</b> <em>geompy.ExtendFace(theFace, theUMin, theUMax,
theVMin, theVMax)</em>, where \em theFace the input face to be resized,
\em theUMin the minimal U-Parameter value, \em theUMax the maximal U-Parameter
\n <b>Arguments:</b> Name + Object (Face) + 4 values (Min and Max U- and
V-Parameters).
-\image html extension2.png "Extension of a Face"
\n <b>Example:</b>
-\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 <b>TUI Scripts</b> provide you with useful examples of the use of
/*!
\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.
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.
+- <b> Object 1 </b> and <b> Object 2 </b> the checked objects. \b Selection button allows picking them in the viewer or in the object browser.
- <b>Deflection coefficient</b> specifies the quality of shapes tessellation.
- <b>Detect gaps</b> - when switched on, allows detecting gaps between shapes.
-- <b>Tolerance</b> - specifies a distance between shapes used for detecting gaps.
+- <b>Tolerance</b> - specifies the distance between shapes used for detecting gaps.
- <b>Compute intersections</b> - press this button to compute interferences.
- <b>Sub-shapes of Object 1</b> - list of sub-shapes from the first source shape that localize the intersection.
- <b>Sub-shapes of Object 2</b> - list of sub-shapes from the second source shape that localize the intersection.
- \b Apply and <b>Apply and Close</b> 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 <b>Apply and Close</b> 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.
<b>TUI Command:</b> <em>geompy.FastIntersect(theShape1, theShape2, theTolerance = 0.0, theDeflection = 0.001),</em> \n
\n <b>TUI Command:</b>
<p><em>geompy.MakeGlueEdges( theShapes, theTolerance )</em>,
-\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.
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.
<em>geompy.MakeGlueEdgesByList( theShapes, theTolerance, theEdges )</em>,
-\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.
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 <b>Glue all coincident edges</b>
-checkbox.
+check-box.
\n <b>TUI Commands:</b>
<em>geompy.GetGlueFaces( theShapes, theTolerance )</em>,
-\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
To <b>Inspect Object</b>, in the <b>Main Menu</b> select <b>Measures - > Inspect Object</b>.
-\image html inspect_object.png
+The dialog can be used in two modes. The first one is a tree view mode:
+\image html inspect_object.png "Dialog in the tree view mode"
-In this dialog:
+This is a default mode that allows to inspect an object in the form of tree
+starting from the shape itself. Its children are its direct sub-shapes that
+have they own children as sub-shapes etc. till most very base sub-shapes,
+i.e. vertices.
+
+The second mode is a filtering one. It is activated when the user selects
+<b>Tolerance filter</b> check box:
+\image html inspect_object2.png "Dialog in the filtering mode"
+
+In this mode the user can check the type of sub-shapes to work with using
+the radio-buttons. The type can be either \b Vertex, \b Edge or \b Face.
+Then the user choses a tolerance criterion to be applied to filter out
+sub-shapes. It is possible to chose one of the following values:
+- \b > - greater than (default value)
+- \b >= - greater than or equal to
+- \b < - lower than
+- \b <= - lower than or equal to
+
+The last parameter to be chosen is the tolerance value. The result is the shapes
+of a certain type that satisfy the defined tolerance criterion. E.g. if the user
+chooses \b Face, criterion \b > and tolerance value equal to \b 1.e-6 the faces
+with the tolerance greater than \b 1.e-6 are displayed.
+
+It is possible to set maximal and minimal value of the tolerance using the
+buttons <b>Max value</b> and <b>Min value</b>. These values are displayed in
+the labels <b>Max :</b> and <b>Min :</b>
+
+In this dialog never mind of its mode it is possible to:
- 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 <F2> key.
-- Show selected sub-shape(s) in the 3D viewer by pressing <b>Show Selected</b> button.
-- Show selected sub-shape(s) in the 3D viewer and erase all currently shown objects by pressing <b>Show Only Selected</b> button.
-- Hide selected sub-shape(s) from the 3D viewer by pressing <b>Hide Selected</b> button.
-- Publish selected sub-shapes in the study, by pressing <b>Publish Selected</b> button.
+- 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 tree, by pressing "eye" icon in the first column of the tree view header or
+ by pressing <b>Show all</b>/<b>Hide all</b> buttons.
+- Rename the selected sub-shape by double-clicking on the item or pressing <F2> key.
+- Show the selected sub-shape(s) in the 3D viewer by pressing <b>Show Selected</b> button.
+- Show the selected sub-shape(s) in the 3D viewer and erase all currently shown objects by pressing <b>Show Only Selected</b> button.
+- Hide the selected sub-shape(s) from the 3D viewer by pressing <b>Hide Selected</b> button.
+- Publish the selected sub-shapes in the study, by pressing <b>Publish Selected</b> button.
- Close dialog box, by pressing <b>Close</b> button.
+\n <b>TUI Command:</b>
+
+A command to filter sub-shapes is defined:
+
+<em>geompy.GetSubShapesWithTolerance(theShape, theShapeType, theCondition, theTolerance),</em> \n
+where \n
+\em theShape is the shape to be exploded. \n
+\em theShapeType is the type of sub-shapes to be returned. Can have
+ the values \b GEOM.FACE, \b GEOM.EDGE and \b GEOM.VERTEX only.\n
+\em theCondition is the condition type (the value of GEOM.comparison_condition emuneration).\n
+\em theTolerance is the tolerance filter.
+
+See also a \ref swig_GetSubShapesWithTolerance "TUI example".
+
*/
- \b Object to be projected. It can be either a planar wire or a face;
- \b Radius of the cylinder;
- <b>Starting angle</b> from the cylinder's X axis around Z axis. This is
-the angle of the projection starting.
-- <b>Length angle</b> 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.
+- <b>Length angle</b> 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".
+- <b>Rotation angle</b> the angle between the tangent vector to
+the first curve at the first point of the object projection in 2D space
+and U-direction of the cylinder in 2D space.
+- \ref restore_presentation_parameters_page "Advanced options".
\image html proj_on_cyl_dlg.png
+\n The following figure explains the meaning of each input angle:
+
+\image html proj_on_cyl_angles.png "Input angles of projection on the cylinder"
+
\n <b>Example:</b>
\image html proj_on_cyl_preview.png "The curve (in red) and its projection on the cylinder"
\n <b>TUI Command:</b> <em>geompy.MakeProjectionOnCylinder(theObject, theRadius,
-theStartAngle=0.0, theAngleLength=-1.0),</em>
-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),</em>
+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 <b>TUI Scripts</b> provide you with useful examples of the use of
\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.<p>
This operation is similar to <b>New Entity - > Build - > Shell</b>
operation, the difference is that with \b Sewing you can specify the
-tolerance and can get a non-manifold result. <p>
-Possibility to create a non-manifold shell can be used e.g. to create a
+tolerance and get a non-manifold result. <p>
+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 <b>Main Menu</b> select <b>Repair - > Sewing</b>.
<li><b>3D Tolerance</b> (DropSmallEdges.Tolerance3d) - defines minimum
possible distance between two parallel edges.</li>
</ul>
-<li><b>Drop Small Solids</b> (DropSmallSolids) - either removes small
+<li><b>Drop Small Solids</b> (DropSmallSolids) - removes small
solids or merges them with neighboring ones.</li>
<ul>
<li><b>Width factor tol.</b> (DropSmallSolids.WidthFactorThreshold) -
- defines maximum value of <em>2V/S</em> of a solid which is
- considered small, where \a V is volume and \a S is surface area of
+ defines the maximum value of <em>2V/S</em> of a solid, which is
+ considered small, where \a V is the volume and \a S is the surface area of
the solid.</li>
<li><b>Volume tol.</b> (DropSmallSolids.VolumeThreshold) - defines
- maximum volume of a solid which is considered small.</li>
+ the maximum volume of a solid, which is considered small.</li>
<li><b>To merge solids</b> (DropSmallSolids.MergeSolids) - if
activated, small solids are removed, else small solids are merged to
- adjacent non-small solids or left untouched if cannot be merged.
+ adjacent non-small solids or left untouched if they cannot be merged.
</li>
</ul>
If the both tolerances are activated a solid is considered small if
-it meets the both criteria.
+it meets both criteria.
<li><b>Split Angle</b> (SplitAngle) - splits faces based on conical
surfaces, surfaces of revolution and cylindrical surfaces in segments
using a certain angle.</li>
--- /dev/null
+/*!
+
+\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 <b>Shape Statistics</b> dialog box, in the <b>Main Menu</b> select <b>Inspection - > Shape Statistics</b>.
+
+\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 a selected face or shell); 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, when switched ON, allows specifying custom values range used for plotting and creating groups.
+\note By default, "Scalar range" controls are empty; pressing "Compute" button allows automatically computing the initial range of the chosen parameter. This is necessary as the computation of the parameters range can be time-consuming for large or complex models. In case of multiple selection, the scalar range is computed for 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 groups according to the currently specified parameters. The group 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 <b>Close</b> button.
+
+\note This functionality is available only if GUI module is built with Plot 2D Viewer (option SALOME_USE_PLOT2DVIEWER is ON when building GUI module).
+
+*/
In this dialog:
- <b>Name</b> is the base name of the resulting shapes.
-- <b>Shapes</b> are the shapes to fing shared sub-shapes of.
+- <b>Shapes</b> are the shapes whose shared sub-shapes should be found.
- <b>Sub-shapes Type</b> is the type of required sub-shapes.
- <b>Shared by all</b> 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.
<b>Advanced options:</b> \ref preview_anchor "Preview"
<b>TUI Command:</b> <em> geompy.GetSharedShapesMulti( Shapes, Type ),</em>
-<br> 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.
+<br> 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 <b>TUI Scripts</b> provide you with useful examples of the use of
Get Shared Shapes functionality:
\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
refer to <a href="SALOME_BOA_PA.pdf">Chapter 9.2.2 of the same document</a>.
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:
<CENTER><B><PRE>Smax = TolC / TolA (1)</PRE></B></CENTER>
\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:
\section sec3 Full Range of Sizes
The values <B>Smax (2)</B>, <B>Smin (4)</B> 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:
<ul>
<li> <b>Source Shape</b> is an object that is a source of non-topological data.</li>
<li> <b>Destination Shape</b> is a data destination object. </li>
-<li> <b>Type of detection operation</b> is the method to search sub-shapes of
- <b>Source Shape</b> in <b>Destination Shape</b>. Data are transferred
- from these corresponding sub-shapes. This is a combo-box with the following
- possible values:
+<li> <b>Type of detection operation</b> allows choosing how to search sub-shapes of the
+ <b>Source Shape</b> in the <b>Destination Shape</b>. The data are transferred
+ from these corresponding sub-shapes. The following methods are possible:
<ul>
- <li><b>Get In Place</b> - current implementation of Get In Place algorithm
+ <li><b>Get In Place</b> - the current implementation of Get In Place algorithm
(default value).</li>
- <li><b>Get In Place (old)</b> - old implementation of Get In Place
+ <li><b>Get In Place (old)</b> - the old implementation of Get In Place
algorithm.</li>
<li><b>Get In Place By History</b> - Get In Place By History algorithm.</li>
</ul>
</li>
</ul>
-To copy data click on \b Apply or <b>Apply and Close</b> 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 <b>Apply and Close</b> 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"
--- /dev/null
+/*!
+
+\page tui_check_self_intersections_fast_page Detect Self-intersections fast
+\tui_script{check_self_intersections_fast.py}
+
+*/
<li>\subpage tui_check_compound_of_blocks_page</li>
<li>\subpage tui_get_non_blocks_page</li>
<li>\subpage tui_check_self_intersections_page</li>
+<li>\subpage tui_check_self_intersections_fast_page</li>
<li>\subpage tui_fast_intersection_page</li>
</ul>
\until geompy.RestoreSubShapes(Partition1)
\anchor swig_GetSubShapeEdgeSorted
+\until geompy.GetSubShapeEdgeSorted(Sketcher3d_2, p3, "OrderedEdges")
+
+\anchor swig_GetSubShapesWithTolerance
\until print "DONE"
*/
\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
<li>\subpage managing_dimensions_page "Dimensions"</li>
<li>\subpage whatis_page "WhatIs"</li>
<li>\subpage inspect_object_operation_page "Inspect Object"</li>
+<li>\subpage shape_statistics_operation_page "Shape Statistics"</li>
</ul>
\n To check their integrity:
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.
.
To create a group of sub-shapes of a geometrical object in the main
menu select <b>New entity > Group > Create</b>
-\n The following menu will appear:
+\n The following dialog box will appear:
\image html geomcreategroup.png
\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:
- <b>Less Than</b> or <b>Equal or Less Than</b> for the first comparator;
- <b>Greater Than</b> or <b>Equal or Greater Than</b> 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 gives access
+to the \ref shape_statistics_operation_page "Shape Statistics" functionality with a simplified look-and-feel:
+
+\image html shape_statistics_simple.png
+
\n <b>TUI Command:</b> <em>geompy.CreateGroup(MainShape,
ShapeType),</em> where MainShape is a shape for which the group is
created, ShapeType is a type of shapes in the created group.
SI_ALL // all interferences
};
+ /**
+ * This enumeration represents comparison conditions.
+ */
+ enum comparison_condition
+ {
+ CC_GT, ///< Greater then
+ CC_GE, ///< Greater then or equal to
+ CC_LT, ///< Less then
+ CC_LE ///< Less then or equal to
+ };
+
/*!
* \brief Object creation parameters
*
* 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.
* 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);
};
/*!
* 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,
in GEOM_Object thePath,
in boolean theWithContact ,
in boolean theWithCorrection,
+ in boolean IsBySteps,
in boolean IsGenerateGroups);
/*!
ListOfGO GetSubShapeEdgeSorted (in GEOM_Object theShape,
in GEOM_Object theStartPoint);
+ /*!
+ * \brief Return the list of subshapes that satisfies a certain tolerance
+ * criterion. The user defines the type of shapes to be returned, the
+ * condition and the tolerance value. The operation is defined for
+ * faces, edges and vertices only. E.g. for theShapeType FACE, theCondition
+ * CC_GT and theTolerance 1.e-7 this method returns all faces of theShape
+ * that have tolerances greater then 1.e7.
+ *
+ * \param theShape the shape to be exploded
+ * \param theShapeType the type of shapes to be returned. Can have the
+ * values FACE, EDGE and VERTEX only.
+ * \param theCondition the condition type.
+ * \param theTolerance the tolerance filter.
+ * \return the list of shapes that satisfy the conditions.
+ */
+ ListOfGO GetSubShapesWithTolerance(in GEOM_Object theShape,
+ in short theShapeType,
+ in comparison_condition theCondition,
+ in double theTolerance);
+
};
// # GEOM_IBlocksOperations:
// VERTEX
VERTEX,
// ADVANCED shapes
+ LCS,
/*! all advanced shapes (temporary implementation) */
ADVANCED
};
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
module GEOM
{
+ /*!
+ * \brief Units of length
+ */
+ enum length_unit
+ {
+ LU_INCH,
+ LU_MILLIMETER,
+ LU_FOOT,
+ LU_MILE,
+ LU_METER,
+ LU_KILOMETER,
+ LU_MILLIINCH,
+ LU_MICROMETER,
+ LU_CENTIMETER,
+ LU_MICROINCH
+ };
+
/*!
* \brief Interface for STEPPlugin modeling functions.
*/
*
* \param theObject Shape to be stored in the file.
* \param theFileName Name of the file to store the given shape in.
+ * \param theUnit the length unit.
*/
void ExportSTEP( in GEOM::GEOM_Object theObject,
- in string theFileName );
+ in string theFileName,
+ in GEOM::length_unit theUnit);
/*!
* \brief Import a shape from the STEP file.
GEOM.config
GEOMDS_Resources
ShHealing
+ Y14.5M-2009.ttf
3dsketch.png
isoline.png
isoline_v.png
fuse_collinear_edges.png
geometry.png
import_picture.png
+ import.png
limit_tolerance.png
line.png
line2points.png
<!-- Dimension presentation properties -->
<parameter name="dimensions_color" value="#ffffff" />
<parameter name="dimensions_line_width" value="1" />
- <parameter name="dimensions_font_height" value="10" />
+ <parameter name="dimensions_font" value="Y14.5M-2009,14" />
<parameter name="dimensions_arrow_length" value="5" />
<parameter name="dimensions_show_units" value="0" />
<parameter name="dimensions_length_units" value="m" />
<parameter name="dimensions_angle_units" value="deg" />
- <parameter name="dimensions_default_flyout" value="20" />
+ <parameter name="dimensions_default_flyout" value="20" />
+ <parameter name="dimensions_use_text3d" value="0" />
<!-- Scalar bar for field step presentation -->
<parameter name="scalar_bar_x_position" value="0.05" />
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()));
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()));
}
showOnlyPreviewControl();
globalSelection();
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
//@@ initialize dialog box widgets here @@//
// Signal/slot connections
initName();
globalSelection();
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
return true;
}
{
GEOMBase_Skeleton::ActivateThisDialog();
globalSelection();
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
//displayPreview();
}
myEditCurrentArgument = GroupPoints->LineEdit1;
myEditCurrentArgument->setFocus();
globalSelection();
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
SelectionIntoArgument();
}
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
)
# header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(AdvancedGUI_SOURCES
AdvancedGUI.cxx
TARGET_LINK_LIBRARIES(AdvancedGUI ${_link_LIBRARIES})
INSTALL(TARGETS AdvancedGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
-QT4_INSTALL_TS_RESOURCES("${AdvancedGUI_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${AdvancedGUI_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
#include "GEOM_Operation.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
+#include "GEOM_GenericObjPtr.h"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(BREPPlugin)
+typedef GEOM::GenericObjPtr<GEOM::IBREPOperations> BREPOpPtr;
+
//=======================================================================
// function : BREPPlugin_GUI()
// purpose : Constructor
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" ),
foreach( QString fileName, fileNames )
{
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, brepOp.in() );
+ GEOM_Operation transaction( app, brepOp.get() );
try
{
entryList.append( so->GetID() );
transaction.commit();
GEOM_Displayer( study ).Display( main.in() );
+ main->UnRegister();
}
else
{
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;
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, brepOp.in() );
+ GEOM_Operation transaction( app, brepOp.get() );
try
{
#
IF(SALOME_BUILD_GUI)
- INCLUDE(UseQt4Ext)
- INCLUDE(${QT_USE_FILE})
+ INCLUDE(UseQtExt)
ENDIF()
# --- options ---
IF(SALOME_BUILD_GUI)
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/OBJECT
${PROJECT_SOURCE_DIR}/src/GEOMGUI
IF(SALOME_BUILD_GUI)
# sources / moc wrappings
- QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+ QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(BREPPluginGUI_SOURCES
BREPPlugin_GUI.cxx
TARGET_LINK_LIBRARIES(BREPPluginGUI ${_link_gui_LIBRARIES})
INSTALL(TARGETS BREPPluginGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
- QT4_INSTALL_TS_RESOURCES("${BREPPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
+ QT_INSTALL_TS_RESOURCES("${BREPPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
ENDIF()
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() ) {
}
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();
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() ) );
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();
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();
initName( tr( "GEOM_ELLIPSE" ) );
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
resize( minimumSizeHint() );
SelectionIntoArgument();
myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
displayPreview(true);
return true;
myEditCurrentArgument == GroupPoints->LineEdit3 ) ?
TopAbs_EDGE : TopAbs_VERTEX;
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
+ localSelection( aNeedType );
myEditCurrentArgument->setFocus();
//SelectionIntoArgument();
myDir.nullify();
//globalSelection( GEOM_POINT );
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
}
//=================================================================================
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();
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();
{
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;
}
Group2->hide();
aMainGrp->show();
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
activate( GEOM_MARKER );
break;
}
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( "" );
}
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 );
}
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 );
}
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 );
/* 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 */
/* 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 */
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 */
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 */
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 );
globalSelection( GEOM_MARKER );
}
else { // 3 Pnts
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
}
// SelectionIntoArgument();
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"));
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);
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()));
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_VERTEX;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
GroupRefPoint->hide();
GroupOnCurve->hide();
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_VERTEX;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
myEditCurrentArgument = GroupRefPoint->LineEdit1;
myEditCurrentArgument->setText("");
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_EDGE;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
myEditCurrentArgument = GroupOnCurve->LineEdit1;
myEditCurrentArgument->setText("");
globalSelection(); // close local contexts, if any
std::list<int> 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("");
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_FACE;
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection(myNeedType);
myEditCurrentArgument = GroupOnSurface->LineEdit1;
myEditCurrentArgument->setText("");
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);
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);
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();
// function : CheckBoxClicked()
// purpose : Check Boxes Management
//=================================================================================
-void BasicGUI_PointDlg::CheckBoxClicked(int State)
+void BasicGUI_PointDlg::CheckBoxClicked()
{
displayPreview(true);
}
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<<GroupOnCurve->SpinBox_DX->text();
}
else if (myParamCoord->checkedId() == LENGTH_VALUE) {
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);
}
}
else if (id == GEOM_POINT_SURF) {
- GroupOnSurface->TextLabel2->setShown(isParam);
- GroupOnSurface->TextLabel3->setShown(isParam);
- GroupOnSurface->SpinBox_DX->setShown(isParam);
- GroupOnSurface->SpinBox_DY->setShown(isParam);
+ GroupOnSurface->TextLabel2->setVisible(isParam);
+ GroupOnSurface->TextLabel3->setVisible(isParam);
+ GroupOnSurface->SpinBox_DX->setVisible(isParam);
+ GroupOnSurface->SpinBox_DY->setVisible(isParam);
}
- GroupXYZ->setShown(!isParam && !isLength);
+ GroupXYZ->setVisible(!isParam && !isLength);
if (theIsUpdate)
QTimer::singleShot(50, this, SLOT(updateSize()));
#include "GEOM_GenericObjPtr.h"
#include <QMap>
-class DlgRef_2Sel1Spin;
+class DlgRef_2Sel1Spin2Check;
class DlgRef_3Spin;
class DlgRef_2Sel;
class DlgRef_1Sel3Spin;
DlgRef_3Spin* GroupXYZ;
DlgRef_1Sel3Spin* GroupRefPoint;
- DlgRef_2Sel1Spin* GroupOnCurve;
+ DlgRef_2Sel1Spin2Check* GroupOnCurve;
DlgRef_2Sel* GroupLineIntersection;
DlgRef_1Sel2Spin* GroupOnSurface;
void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double );
void ClickParamCoord( int );
- void CheckBoxClicked( int );
+ void CheckBoxClicked();
void updateSize();
};
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;
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);
}
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(BasicGUI_SOURCES
BasicGUI.cxx
#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
isSame = Standard_True;
- for (; anIter1.More(); anIter1.Next()) {
+ for (; anIter1.More() && isSame; anIter1.Next()) {
TopoDS_Face aFace1 = TopoDS::Face(anIter1.Value());
TopTools_ListIteratorOfListOfShape anIter2(aLst2);
// 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
if (i > 1)
{
- TopExp::CommonVertex(PrevEdge, anEdge, CV);
+ GetCommonVertex(PrevEdge, anEdge, CV);
Standard_Real Tol = BRep_Tool::Tolerance(CV);
tabtolvertex(i-2) = Tol;
}
if (C.IsNull()) {
// jfa for Mantis issue 0020228
if (PV1.Distance(PV2) > Precision::Confusion()) continue;
- // closed chain
- if (edge1.Orientation() == TopAbs_FORWARD) {
- C = C1;
- } else {
- C = Handle(Geom_Circle)::DownCast(C1->Reversed());
+ // closed chain. Make a closed circular edge starting from V1.
+ gp_Ax1 anAxis = C1->Axis();
+
+ if (edge1.Orientation() == TopAbs_REVERSED) {
+ anAxis.Reverse();
}
+ const gp_Pnt &aP0 = anAxis.Location();
+ gp_Dir aDX(PV1.XYZ().Subtracted(aP0.XYZ()));
+ gp_Ax2 aNewAxis(aP0, anAxis.Direction(), aDX);
+
+ C = new Geom_Circle(aNewAxis, C1->Radius());
+
B.MakeEdge (E,C,Precision::Confusion());
B.Add(E,V1);
B.Add(E,V2);
+ B.UpdateVertex(V1, 0., E, 0.);
+ B.UpdateVertex(V2, 2.*M_PI, E, 0.);
}
else {
gp_Pnt P0 = C->Location();
{
//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);
}
}
- //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;
}
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()));
}
{
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);
// 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" ) ) );
}
}
- if ( !onAccept() )
+ if ( !onAccept( true, true, false ) )
return false;
activateSelection();
//=================================================================================
bool BlocksGUI_ExplodeDlg::isAllSubShapes() const
{
- return !myGrp1->CheckBox1->isChecked() || !myGrp1->CheckBox1->isEnabled();
+ return !(myGrp1->CheckBox1->isEnabled() && myGrp1->CheckBox1->isChecked());
}
//=================================================================================
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()));
//=================================================================================
void BlocksGUI_TrsfDlg::SelectionIntoArgument()
{
- erasePreview();
myEditCurrentArgument->setText("");
// Get index of current selection focus
}
myEditCurrentArgument->setText(aName);
myFaces[aCurrFocus] = anIndex;
- processPreview();
}
switch (aCurrFocus) {
default:
break;
}
+
+ processPreview();
}
//=================================================================================
aSender->setDown(true);
activateSelection();
+
+ processPreview();
}
//=================================================================================
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
)
# header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(BlocksGUI_SOURCES
BlocksGUI.cxx
mainFrame()->RadioButton1->setFocus();
globalSelection(GEOM_ALLSHAPES);
-
- std::list<int> 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);
}
globalSelection(GEOM_ALLSHAPES);
-
- std::list<int> 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);
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
)
# header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(BooleanGUI_SOURCES
BooleanGUI.cxx
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()));
case 0:
{
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->LineEdit1->setText("");
case 1:
{
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_WIRE);
+ localSelection(TopAbs_WIRE);
myEditCurrentArgument = GroupWire->LineEdit1;
GroupWire->LineEdit1->setText("");
case 2:
{
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
myEditCurrentArgument = GroupOnCurve->LineEdit1;
GroupOnCurve->LineEdit1->setText("");
myEditCurrentArgument->setText(aName);
globalSelection();
- localSelection(GEOM::GEOM_Object::_nil(), aNeedType);
+ localSelection(aNeedType);
if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myPoint1 = aSelectedObject;
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;
GroupOnCurve->LineEdit1->setEnabled(false);
globalSelection(); // close local contexts, if any
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
}
// enable line edit
columnNames.append( tr( "GEOM_EDGE" ));
columnNames.append( tr( "GEOM_FACE_CONSTRAINT" ) );
myTreeConstraints->setHeaderLabels( columnNames );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
myTreeConstraints->header()->setMovable( false );
myTreeConstraints->header()->setResizeMode( QHeaderView::ResizeToContents );
+#else
+ myTreeConstraints->header()->setSectionsMovable( false );
+ myTreeConstraints->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
+#endif
myTreeConstraints->setMinimumHeight( 140 );
QHBoxLayout* l = new QHBoxLayout( myGroupWireConstraints->Box );
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("");
case 2:
{
globalSelection();
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_WIRE );
+ localSelection( TopAbs_WIRE );
myTreeConstraints->clear();
myCurrentItem = 0;
myEditCurrentArgument->setEnabled(false);
globalSelection();
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+ localSelection( TopAbs_FACE );
myTreeConstraints->resizeColumnToContents(0);
QTreeWidgetItem* firstItem = myTreeConstraints->topLevelItem(0);
}
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;
}
}
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;
}
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;
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"));
myEdgesAndWires.clear();
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
/* signals and slots connections */
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
{
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();
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
)
# header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(BuildGUI_SOURCES
BuildGUI.cxx
ARCHIMEDE BlockFix GEOMAlgo SKETCHER GEOM ShHealOper GEOMUtils XAO XAO_Swig
GEOMImpl GEOM_I GEOMClient GEOM_I_Superv GEOM_SWIG GEOM_PY
AdvancedEngine OCC2VTK
- STLPlugin BREPPlugin STEPPlugin IGESPlugin XAOPlugin VTKPlugin
+ STLPlugin BREPPlugin STEPPlugin IGESPlugin XAOPlugin VTKPlugin Tools
)
##
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
#
IF(SALOME_BUILD_GUI)
- INCLUDE(${QT_USE_FILE})
+ INCLUDE(UseQtExt)
ENDIF(SALOME_BUILD_GUI)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${CAS_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
IF(SALOME_BUILD_GUI)
# sources / moc wrappings
- QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+ QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
ENDIF(SALOME_BUILD_GUI)
# sources / static
INSTALL(TARGETS CurveCreator EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
INSTALL(FILES ${CurveCreator_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-
void CurveCreator_TreeViewModel::setCurve( CurveCreator_ICurve* theCurve )
{
myCurve = theCurve;
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
reset();
+#endif
}
/*****************************************************************************************/
QTreeView(parent)
{
header()->hide();
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
header()->setResizeMode(QHeaderView::ResizeToContents);
+#else
+ header()->setSectionResizeMode(QHeaderView::ResizeToContents);
+#endif
setUniformRowHeights(true);
setContextMenuPolicy( Qt::CustomContextMenu );
CurveCreator_TreeViewModel* aModel = new CurveCreator_TreeViewModel(theCurve, this);
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(DependencyTree_SOURCES
DependencyTree_Arrow.cxx
INSTALL(FILES ${DependencyTree_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_res_files}" "${SALOME_GEOM_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_res_files}" "${SALOME_GEOM_INSTALL_RES_DATA}")
DependencyTree_Arrow::DependencyTree_Arrow( DependencyTree_Object* theStartItem,
DependencyTree_Object* theEndItem,
QGraphicsItem* parent, QGraphicsScene* scene )
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
:QGraphicsLineItem( parent, scene ),
+#else
+:QGraphicsLineItem( parent ),
+#endif
myIsBiLink( false ),
myStartItem( theStartItem ),
myEndItem( theEndItem )
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
-
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
+INCLUDE(UseQtExt)
# --- options ---
SET(_moc_HEADERS DlgRef.h)
# header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / to compile
SET(DlgRef_SOURCES DlgRef.cxx ${_moc_SOURCES} ${_uic_HEADERS})
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${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
DlgRef
GEOMSketcher
CurveCreator
+ MeasureGUI
)
# optional sources
)
# header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(EntityGUI_SOURCES
EntityGUI.cxx
myLengthPrs = dynamic_cast<SOCC_Prs*>(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0));
myTextPrs = dynamic_cast<SOCC_Prs*>(((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);
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);
}
TopoDS_Shape aSubShape = myShapeMap( index );
QString anEntry = QString( "TEMP_" ) + aMainEntry.in() + QString("_%1").arg(index);
Handle(SALOME_InteractiveObject) io =
- new SALOME_InteractiveObject(anEntry.toAscii(), "GEOM", "TEMP_IO");
+ new SALOME_InteractiveObject(anEntry.toLatin1(), "GEOM", "TEMP_IO");
aDisplayer->SetColor( aCol );
SALOME_Prs* aPrs = aDisplayer->buildSubshapePresentation(aSubShape, anEntry, aView);
if (aPrs) {
Group4Spin->hide();
GroupRect->hide();
globalSelection(); // close local selection to clear it
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
}
}
QString Command = myCommand.join( "" );
- Sketcher_Profile aProfile = Sketcher_Profile( Command.toAscii() );
+ Sketcher_Profile aProfile = Sketcher_Profile( Command.toLatin1() );
bool isDone = false;
TopoDS_Shape myShape = aProfile.GetShape( &isDone );
if ( isDone ) {
selButton->setDown(true);
}
globalSelection(); // close local selection to clear it
- localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ localSelection( myNeedType );
}
//Last Shape
QString Command1 = myCommand.join( "" );
- Sketcher_Profile aProfile1( Command1.toAscii() );
+ Sketcher_Profile aProfile1( Command1.toLatin1() );
myShape1 = aProfile1.GetShape();
//Current Shape
QString Command2 = Command1 + GetNewCommand( aParameters );
- Sketcher_Profile aProfile2( Command2.toAscii() );
+ Sketcher_Profile aProfile2( Command2.toLatin1() );
myShape2 = aProfile2.GetShape( &isDone, &error );
//Error Message
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <GEOMUtils.hxx>
+#ifndef DISABLE_PLOT2DVIEWER
+ #include <MeasureGUI_ShapeStatisticsDlg.h>
+#endif
#include <OCCViewer_ViewModel.h>
#include <SVTK_ViewModel.h>
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);
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);
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()));
}
if (isOk)
- isOk = onAccept();
+ isOk = onAccept( true, true, false );
if (isOk)
ClickOnCancel();
GroupPoints->CheckButton1->isChecked() &&
shapeType() < GEOM::VERTEX);
+#ifndef DISABLE_PLOT2DVIEWER
+ myPlotDistributionButton->setEnabled( myFilterGrp->isEnabled() &&
+ ( shapeType() == TopAbs_EDGE ||
+ shapeType() == TopAbs_FACE ||
+ shapeType() == TopAbs_SOLID ) );
+#endif
+
activateSelection();
}
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 :
void showOnlySelected();
void ClickOnOkFilter();
+#ifndef DISABLE_PLOT2DVIEWER
+ void ClickOnPlot();
+#endif
void MeasureToggled();
private:
SalomeApp_DoubleSpinBox* myLessFilterSpin;
SalomeApp_DoubleSpinBox* myGreaterFilterSpin;
QPushButton* myApplyFilterButton;
+ QPushButton* myPlotDistributionButton;
QGroupBox* myFilterGrp;
};
typedef std::map< TCollection_AsciiString, TCollection_AsciiString > TSting2StringMap;
typedef std::map< TCollection_AsciiString, TObjectData > TSting2ObjDataMap;
typedef std::map< TCollection_AsciiString, TObjectData* > TSting2ObjDataPtrMap;
+typedef std::map< int, std::list < int > > TIntToListIntMap;
static GEOM_Engine* TheEngine = NULL;
std::set<TCollection_AsciiString>& theIgnoreObjs,
bool& theIsDumpCollected);
+static int GetTag(const TCollection_AsciiString &theEntry);
+
+static void FillMapOfRef(const Handle(GEOM_Function) &theFunction,
+ TIntToListIntMap &theRefMap);
+
void ReplaceVariables(TCollection_AsciiString& theCommand,
const TVariablesList& theVariables);
std::map< int, TCollection_AsciiString >& theEntryToCmdMap,
std::set<TCollection_AsciiString>& theMapOfPublished);
+static TCollection_AsciiString GetPublishCommands
+ (const int theTag,
+ const std::map< int, TCollection_AsciiString > &theEntryToCmdMap,
+ const TIntToListIntMap &theMapRefs,
+ std::set< int > &thePublished);
+
//================================================================================
/*!
* \brief Fix up the name of python variable
// Mantis issue 0020768
Standard_Integer objectCounter = 0;
Resource_DataMapOfAsciiStringAsciiString aNameToEntry;
+ TIntToListIntMap aRefMap;
if (aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
TDataStd_ChildNodeIterator Itr(aRoot);
continue; // aCurScript is already at the end of aFuncScript
aFuncScript += aCurScript;
}
+
+ // Fill the map of references.
+ FillMapOfRef(aFunction, aRefMap);
+
if (isDumpCollected ) {
// Replace entries by the names
ReplaceEntriesByNames( aFuncScript, aEntry2ObjData, isPublished,
aNameToEntry, anEntryToCmdMap, anIgnoreObjMap );
}
// add publishing commands to the script
+ std::set< int > aPublished;
std::map< int, TCollection_AsciiString >::iterator anEntryToCmd = anEntryToCmdMap.begin();
- for ( ; anEntryToCmd != anEntryToCmdMap.end(); ++anEntryToCmd )
- aFuncScript += anEntryToCmd->second;
+
+ for ( ; anEntryToCmd != anEntryToCmdMap.end(); ++anEntryToCmd ) {
+ const TCollection_AsciiString aPublishCmds =
+ GetPublishCommands(anEntryToCmd->first, anEntryToCmdMap,
+ aRefMap, aPublished);
+
+ aFuncScript += aPublishCmds;
+ }
// PTv, 0020001 add result objects from RestoreGivenSubShapes into ignore list,
// because they will be published during command execution
aNameToEntry, anEntryToCmdMap, anIgnoreObjMap );
}
// add publishing commands to the script
+ std::set< int > aPublished;
std::map< int, TCollection_AsciiString >::iterator anEntryToCmd = anEntryToCmdMap.begin();
- for ( ; anEntryToCmd != anEntryToCmdMap.end(); ++anEntryToCmd )
- aScript += anEntryToCmd->second;
+
+ for ( ; anEntryToCmd != anEntryToCmdMap.end(); ++anEntryToCmd ) {
+ const TCollection_AsciiString aPublishCmds =
+ GetPublishCommands(anEntryToCmd->first, anEntryToCmdMap,
+ aRefMap, aPublished);
+
+ aScript += aPublishCmds;
+ }
}
//RNV: issue 16219: EDF PAL 469: "RemoveFromStudy" Function
return true;
}
+//=============================================================================
+/*!
+ * GetTag: Returns the tag from entry
+ */
+//=============================================================================
+int GetTag(const TCollection_AsciiString &theEntry)
+{
+ const int aGeomObjDepth = 3;
+ const int aTag = theEntry.Token(":", aGeomObjDepth).IntegerValue();
+
+ return aTag;
+}
+
+//=============================================================================
+/*!
+ * FillMapOfRef: Fill the map of references
+ */
+//=============================================================================
+void FillMapOfRef(const Handle(GEOM_Function) &theFunction,
+ TIntToListIntMap &theRefMap)
+{
+ TDF_LabelSequence aSeq;
+ TCollection_AsciiString anObjEntry;
+ int anObjTag;
+
+ TDF_Tool::Entry(theFunction->GetOwnerEntry(), anObjEntry);
+ anObjTag = GetTag(anObjEntry);
+ theFunction->GetDependency(aSeq);
+
+ const Standard_Integer aLen = aSeq.Length();
+ Standard_Integer i;
+
+ for (i = 1; i <= aLen; i++) {
+ TDF_Label aRefLabel = aSeq.Value(i);
+ Handle(TDF_Reference) aRef;
+
+ if (aRefLabel.FindAttribute(TDF_Reference::GetID(), aRef)) {
+ if (!aRef.IsNull() && !aRef->Get().IsNull()) {
+ Handle(TDataStd_TreeNode) aT;
+
+ if (TDataStd_TreeNode::Find(aRef->Get(), aT)) {
+ TDF_Label aDepLabel = aT->Label();
+ Handle(GEOM_Function) aRefFunct = GEOM_Function::GetFunction(aDepLabel);
+
+ if (!aRefFunct.IsNull()) {
+ // Get entry of the referenced object.
+ TDF_Tool::Entry(aRefFunct->GetOwnerEntry(), anObjEntry);
+
+ const int aRefTag = GetTag(anObjEntry);
+
+ theRefMap[anObjTag].push_back(aRefTag);
+ }
+ }
+ }
+ }
+ }
+}
+
//=============================================================================
/*!
* FindEntries: Returns a sequence of start/end positions of entries in the string
if ( stEntry2DataPtr != theStEntry2ObjDataPtr.end() )
aFatherData = stEntry2DataPtr->second;
- const int geomObjDepth = 3;
-
// treat multiply published object
if ( theObjectData._pyName.IsEmpty() )
{
aCreationCommand += theObjectData._pyName + " = " + data0._pyName;
// store aCreationCommand before publishing commands
- int tag = theObjectData._entry.Token( ":", geomObjDepth ).IntegerValue();
+ int tag = GetTag(theObjectData._entry);
theEntryToCmdMap.insert( std::make_pair( tag + 2*theEntry2ObjData.size(), aCreationCommand ));
}
aCommand += theObjectData._pyName + ", '" + theObjectData._name + "' )";
// bind a command to the study entry
- int tag = theObjectData._entry.Token( ":", geomObjDepth ).IntegerValue();
+ int tag = GetTag(theObjectData._entry);
theEntryToCmdMap.insert( std::make_pair( tag, aCommand ));
theObjectData._studyEntry.Clear(); // not to publish any more
}
+//================================================================================
+/*!
+ * \brief Returns the string of publishing commands. Take into account that
+ * references should be published prior to the objects refer to them.
+ */
+//================================================================================
+TCollection_AsciiString GetPublishCommands
+ (const int theTag,
+ const std::map< int, TCollection_AsciiString > &theEntryToCmdMap,
+ const TIntToListIntMap &theMapRefs,
+ std::set< int > &thePublished)
+{
+ TCollection_AsciiString aResult;
+
+ if (!thePublished.count(theTag)) {
+ // This object is not published yet.
+ std::map< int, TCollection_AsciiString >::const_iterator anIt =
+ theEntryToCmdMap.find(theTag);
+
+ if (anIt != theEntryToCmdMap.end()) {
+ // There is a pubish cmd.
+ TIntToListIntMap::const_iterator aRefIt = theMapRefs.find(theTag);
+
+ if (aRefIt != theMapRefs.end()) {
+ // Recursively publish all references.
+ std::list< int >::const_iterator aRefTagIt = aRefIt->second.begin();
+
+ for(; aRefTagIt != aRefIt->second.end(); ++aRefTagIt) {
+ const TCollection_AsciiString aRefCmd = GetPublishCommands
+ (*aRefTagIt, theEntryToCmdMap, theMapRefs, thePublished);
+
+ aResult += aRefCmd;
+ }
+ }
+
+ // Add the object command.
+ aResult += anIt->second;
+ }
+
+ thePublished.insert(theTag);
+ }
+
+ return aResult;
+}
+
//================================================================================
/*!
* \brief Constructor
TPythonDump::operator<< (const std::list<Handle(GEOM_Object)>& theObjects)
{
Standard_Integer aLength = theObjects.size();
- if ( aLength > 1 ) {
+ if ( aLength != 1 ) {
myStream << "[";
}
std::list<Handle(GEOM_Object)>::const_iterator obj = theObjects.begin();
*this << *obj;
if ( i < aLength ) myStream << ", ";
}
- if ( aLength > 1 ) {
+ if ( aLength != 1 ) {
myStream << "]";
}
return *this;
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
GEOMAlgo_IndexedDataMapOfShapeState.hxx
GEOMAlgo_KindOfBounds.hxx
GEOMAlgo_KindOfClosed.hxx
+ GEOMAlgo_KindOfDef.hxx
GEOMAlgo_KindOfName.hxx
GEOMAlgo_KindOfShape.hxx
GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx
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
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
GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
Basics_OCCTVersion.hxx
+
+GEOMAlgo_KindOfDef.hxx
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;
//
//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);
}
//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;
// purpose:
//=======================================================================
void GEOMAlgo_AlgoTools::MakeContainer(const TopAbs_ShapeEnum theType,
- TopoDS_Shape& theC)
+ TopoDS_Shape& theC)
{
BRep_Builder aBB;
//
//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;
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
- gp_Pnt& aP3D)
+ gp_Pnt& aP3D)
{
Standard_Real aTx, aT1, aT2;
//
//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;
//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;
//
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
- gp_Pnt& aP3D)
+ gp_Pnt& aP3D)
{
Standard_Real aU, aV, aUMin, aUMax, aVMin, aVMax;
//
//purpose :
//=======================================================================
void GEOMAlgo_AlgoTools::PointOnShape(const TopoDS_Shape& aS,
- gp_Pnt& aP3D)
+ gp_Pnt& aP3D)
{
TopAbs_ShapeEnum aType;
//
return 0; // Nothing to do
}
//
- while(1) {
+ for(;;) {
aNbEProcessed=aMProcessed.Extent();
if (aNbEProcessed==aNbE) {
break;
//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;
//
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;
}
//
// 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);
#include <BRepLib_MakeFace.hxx>
#include <BRepLib_FaceError.hxx>
-//#include <BOPTools_DSFiller.hxx>
#include <GEOMAlgo_WireSolid.hxx>
#include <GEOMAlgo_ShellSolid.hxx>
{
myErrorStatus=0;
//
- Standard_Boolean bIsDone;
Standard_Integer i, iErr;
TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON};
TopTools_ListIteratorOfListOfShape aIt;
aType1=myGAS.GetType();
//
TopExp::MapShapes(myShape, TopAbs_EDGE, aM);
+ //
+ bIsConformState=Standard_False;
+ //
aNb=aM.Extent();
for (i=1; i<=aNb; ++i) {
GEOMAlgo_ListOfPnt aLP;
}
}
//
+ bIsConformState=Standard_False;
+ //
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aE=aExp.Current();
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);
}// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder)
}// if (!aNb && myNbPntsMin) {
}
-//modified by NIZNHY-PKV Thu Jan 26 09:56:20 2012f
//=======================================================================
//function : InnerPoints
//purpose :
aLP.Clear();
InnerPoints(aE, aNbPntsMin, aLP);
}
-//modified by NIZNHY-PKV Thu Jan 26 09:56:32 2012t
//=======================================================================
//function : InnerPoints
//purpose :
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; j<aNbT; ++j) {
aC3D->D0(aT, aP);
aLP.Append(aP);
}
- //modified by NIZNHY-PKV Thu Jan 26 09:51:24 2012t
}
//=======================================================================
//
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();
}
}
//
+ //
+ bIsConformState=Standard_False;
+ //
aExp.Init(aF, TopAbs_EDGE);
for (; aExp.More(); aExp.Next()) {
const TopoDS_Shape& aE=aExp.Current();
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);
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;
-
- iType = GEOMUtils::GetTypeOfSimplePart(theWhat);
+ // Check shape type.
+ TopAbs_ShapeEnum 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 );
-
- // 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();
+ // Compute confusion tolerance.
+ Standard_Real aTolConf = Precision::Confusion();
+ Standard_Integer i;
+
+ 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) );
-
- 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();
+ // Compute mass tolerance.
+ Bnd_Box aBoundingBox;
+ Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
+ Standard_Real aMassTol;
- 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;
+ 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;
- // 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
gp_Pnt aPx;
gp_Pnt2d aP2Dx;
gp_Vec aDNx;
-
TopoDS_Face aF;
TopExp_Explorer aExp;
//
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);
//
// 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);
//=======================================================================
GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector()
{}
-//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f
//=======================================================================
//function : StickedShapes
//purpose :
{
return myStickedShapes;
}
-//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t
//=======================================================================
//function : Perform
//purpose :
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) {
TColStd_MapIteratorOfMapOfInteger aIt1;
//
aMIP.Add(i);
- while(1) {
+ for(;;) {
aNbIP=aMIP.Extent();
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {
//
aPK.SetShapes(aLV);
}
-//modified by NIZNHY-PKV Tue Mar 13 09:54:18 2012f
//=======================================================================
//function : CheckDetected
//purpose :
//
return iRet;
}
-//modified by NIZNHY-PKV Tue Mar 13 09:54:59 2012t
// 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
-// <peter@PREFEX>
+// File: GEOMAlgo_Gluer.cxx
+// Created: Sat Dec 04 12:45:53 2004
+// Author: Peter KURNEV
+// <peter@PREFEX>
//
#include <GEOMAlgo_Gluer.hxx>
//
static
void GetSubShapes(const TopoDS_Shape& aS,
- TopTools_IndexedMapOfShape& aMSS);
+ TopTools_IndexedMapOfShape& aMSS);
//=======================================================================
//function : GEOMAlgo_Gluer
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;
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)
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);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aVSD=aItS.Value();
if (!myOrigins.IsBound(aVSD)) {
- myOrigins.Bind(aVSD, aV);
+ myOrigins.Bind(aVSD, aV);
}
}
}
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();
}
aBB.Add(theResult, aShapeR);
}
}
- else
- {
+ else {
if (myKeepNonSolids) {
// just add image
const TopoDS_Shape& aShapeR = myOrigins.Find(theShape);
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);
}
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;
}
}
//
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aFSD=aItS.Value();
if (!myOrigins.IsBound(aFSD)) {
- myOrigins.Bind(aFSD, aNewShape);
+ myOrigins.Bind(aFSD, aNewShape);
}
}
}
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;
+ }
}
}
//
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF,
- GEOMAlgo_PassKeyShape& aPK)
+ GEOMAlgo_PassKeyShape& aPK)
{
Standard_Integer i, aNbE;
TopTools_ListOfShape aLE;
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE,
- GEOMAlgo_PassKeyShape& aPK)
+ GEOMAlgo_PassKeyShape& aPK)
{
TopoDS_Vertex aV1, aV2;
//
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV,
- TopoDS_Vertex& aNewVertex)
+ TopoDS_Vertex& aNewVertex)
{
Standard_Integer aNbV;
Standard_Real aTolV, aD, aDmax;
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
- TopoDS_Edge& aNewEdge)
+ TopoDS_Edge& aNewEdge)
{
myErrorStatus=0;
//
//purpose :
//=======================================================================
void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
- TopoDS_Face& aNewFace)
+ TopoDS_Face& aNewFace)
{
myErrorStatus=0;
//
//
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);
//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;
//purpose :
//=======================================================================
void GetSubShapes(const TopoDS_Shape& aS,
- TopTools_IndexedMapOfShape& aMSS)
+ TopTools_IndexedMapOfShape& aMSS)
{
Standard_Integer aR;
TopAbs_ShapeEnum aType;
//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;
//
if(myOrigins.IsBound(aS)) {
const TopoDS_Shape& aSnew=myOrigins.Find(aS);
if (!aSnew.IsSame(aS)) {
- myGenerated.Append(aSnew);
+ myGenerated.Append(aSnew);
}
}
}
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 :
{
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;
}
myWarningStatus=0;
//
aNbSG=myShapesToGlue.Extent();
+ aType=TopAbs_SHAPE;
if (aNbSG) {
// Check myShapesToGlue
aItDMSLS.Initialize(myShapesToGlue);
myErrorStatus=0;
myWarningStatus=0;
//
+ bHasImage=Standard_False;
aItC.Initialize(myArgument);
for (; aItC.More(); aItC.Next()) {
const TopoDS_Shape& aCx=aItC.Value();
--- /dev/null
+// 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 <Standard_PrimitiveTypes.hxx>
+#endif
+
+#endif
GEOMAlgo_KN_RECTANGLE,
GEOMAlgo_KN_TRIANGLE,
GEOMAlgo_KN_QUADRANGLE,
-GEOMAlgo_KN_ARCELLIPSE
+GEOMAlgo_KN_ARCELLIPSE,
+GEOMAlgo_KN_SOLID
};
#ifndef _Standard_PrimitiveTypes_HeaderFile
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
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
//function :
//purpose :
//=======================================================================
- GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo()
+GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo()
{
Reset();
}
//function : ~
//purpose :
//=======================================================================
- GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo()
+GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo()
{
}
//=======================================================================
//function : Reset
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::Reset()
+void GEOMAlgo_ShapeInfo::Reset()
{
Standard_Integer i;
//
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.);
//function : SetType
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType)
+void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType)
{
myType=aType;
}
//function : Type
//purpose :
//=======================================================================
- TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const
+TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const
{
return myType;
}
//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;
//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;
//function : SetKindOfShape
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetKindOfShape(const GEOMAlgo_KindOfShape aT)
+void GEOMAlgo_ShapeInfo::SetKindOfShape(const GEOMAlgo_KindOfShape aT)
{
myKindOfShape=aT;
}
//function : KindOfShape
//purpose :
//=======================================================================
- GEOMAlgo_KindOfShape GEOMAlgo_ShapeInfo::KindOfShape() const
+GEOMAlgo_KindOfShape GEOMAlgo_ShapeInfo::KindOfShape() const
{
return myKindOfShape;
}
//function : SetKindOfName
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetKindOfName(const GEOMAlgo_KindOfName aT)
+void GEOMAlgo_ShapeInfo::SetKindOfName(const GEOMAlgo_KindOfName aT)
{
myKindOfName=aT;
}
//function : KindOfName
//purpose :
//=======================================================================
- GEOMAlgo_KindOfName GEOMAlgo_ShapeInfo::KindOfName() const
+GEOMAlgo_KindOfName GEOMAlgo_ShapeInfo::KindOfName() const
{
return myKindOfName;
}
//function : SetKindOfBounds
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetKindOfBounds(const GEOMAlgo_KindOfBounds aT)
+void GEOMAlgo_ShapeInfo::SetKindOfBounds(const GEOMAlgo_KindOfBounds aT)
{
myKindOfBounds=aT;
}
//function : KindOfBounds
//purpose :
//=======================================================================
- GEOMAlgo_KindOfBounds GEOMAlgo_ShapeInfo::KindOfBounds() const
+GEOMAlgo_KindOfBounds GEOMAlgo_ShapeInfo::KindOfBounds() const
{
return myKindOfBounds;
}
//function : SetKindOfClosed
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetKindOfClosed(const GEOMAlgo_KindOfClosed aT)
+void GEOMAlgo_ShapeInfo::SetKindOfClosed(const GEOMAlgo_KindOfClosed aT)
{
myKindOfClosed=aT;
}
//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;
}
//function : Location
//purpose :
//=======================================================================
- const gp_Pnt& GEOMAlgo_ShapeInfo::Location() const
+const gp_Pnt& GEOMAlgo_ShapeInfo::Location() const
{
return myLocation;
}
//function : SetDirection
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetDirection(const gp_Dir& aD)
+void GEOMAlgo_ShapeInfo::SetDirection(const gp_Dir& aD)
{
myDirection=aD;
}
//function : Direction
//purpose :
//=======================================================================
- const gp_Dir& GEOMAlgo_ShapeInfo::Direction() const
+const gp_Dir& GEOMAlgo_ShapeInfo::Direction() const
{
return myDirection;
}
//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);
//function : SetPosition
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax3& aAx3)
+void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax3& aAx3)
{
myPosition=aAx3;
}
//function : Position
//purpose :
//=======================================================================
- const gp_Ax3& GEOMAlgo_ShapeInfo::Position() const
+const gp_Ax3& GEOMAlgo_ShapeInfo::Position() const
{
return myPosition;
}
//function : SetPnt1
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetPnt1(const gp_Pnt& aP)
+void GEOMAlgo_ShapeInfo::SetPnt1(const gp_Pnt& aP)
{
myPnt1=aP;
}
//function : Pnt1
//purpose :
//=======================================================================
- const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt1() const
+const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt1() const
{
return myPnt1;
}
//function : SetPnt2
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetPnt2(const gp_Pnt& aP)
+void GEOMAlgo_ShapeInfo::SetPnt2(const gp_Pnt& aP)
{
myPnt2=aP;
}
//function : Pnt2
//purpose :
//=======================================================================
- const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt2() const
+const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt2() const
{
return myPnt2;
}
//function : SetRadius1
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetRadius1(const Standard_Real aR)
+void GEOMAlgo_ShapeInfo::SetRadius1(const Standard_Real aR)
{
myRadius1=aR;
}
//function : Radius1
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfo::Radius1() const
+Standard_Real GEOMAlgo_ShapeInfo::Radius1() const
{
return myRadius1;
}
//function : SetRadius2
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetRadius2(const Standard_Real aR)
+void GEOMAlgo_ShapeInfo::SetRadius2(const Standard_Real aR)
{
myRadius2=aR;
}
//function : Radius2
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfo::Radius2() const
+Standard_Real GEOMAlgo_ShapeInfo::Radius2() const
{
return myRadius2;
}
//function : SetLength
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetLength(const Standard_Real aL)
+void GEOMAlgo_ShapeInfo::SetLength(const Standard_Real aL)
{
myLength=aL;
}
//function : Length
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfo::Length() const
+Standard_Real GEOMAlgo_ShapeInfo::Length() const
{
return myLength;
}
//function : SetWidth
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetWidth(const Standard_Real aW)
+void GEOMAlgo_ShapeInfo::SetWidth(const Standard_Real aW)
{
myWidth=aW;
}
//function : Width
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfo::Width() const
+Standard_Real GEOMAlgo_ShapeInfo::Width() const
{
return myWidth;
}
//function : SetHeight
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::SetHeight(const Standard_Real aH)
+void GEOMAlgo_ShapeInfo::SetHeight(const Standard_Real aH)
{
myHeight=aH;
}
//function : Height
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfo::Height() const
+Standard_Real GEOMAlgo_ShapeInfo::Height() const
{
return myHeight;
}
//function : Dump
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::Dump()const
+void GEOMAlgo_ShapeInfo::Dump()const
{
switch (myType) {
//
//function : DumpCompound
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpCompound()const
+void GEOMAlgo_ShapeInfo::DumpCompound()const
{
Standard_Integer aNbV, aNbE, aNbF, aNbS, aNbC, aNbP;
GEOMAlgo_KindOfShape aKS;
//function : DumpCompSolid
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpCompSolid()const
+void GEOMAlgo_ShapeInfo::DumpCompSolid()const
{
Standard_Integer aNbV, aNbE, aNbF, aNbS;
GEOMAlgo_KindOfShape aKS;
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;
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);
aKN=KindOfName();
aKB=KindOfBounds();
aKC=KindOfClosed();
+ aKD=KindOfDef();
//
printf(" *FACE\n");
printf(" number of vertices: %d\n", aNbV);
DumpKindOfName (aKN);
DumpKindOfBounds(aKB);
DumpKindOfClosed(aKC);
+ DumpKindOfDef(aKD);
//
// PLANE
if (aKN==GEOMAlgo_KN_PLANE) {
//function : DumpShell
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpShell()const
+void GEOMAlgo_ShapeInfo::DumpShell()const
{
Standard_Integer aNbV, aNbE, aNbF;
GEOMAlgo_KindOfClosed aKC;
//function : DumpWire
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpWire()const
+void GEOMAlgo_ShapeInfo::DumpWire()const
{
Standard_Integer aNbV, aNbE;
GEOMAlgo_KindOfClosed aKC;
//function : DumpEdge
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpEdge()const
+void GEOMAlgo_ShapeInfo::DumpEdge()const
{
Standard_Integer aNbV;
Standard_Real aX, aY, aZ;
//function : DumpVertex
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfo::DumpVertex()const
+void GEOMAlgo_ShapeInfo::DumpVertex()const
{
printf(" *VERTEX\n");
DumpLocation(myLocation);
//function : DumpLocation
//purpose :
//=======================================================================
- void DumpLocation(const gp_Pnt& aP)
+void DumpLocation(const gp_Pnt& aP)
{
Standard_Real aX, aY, aZ;
//
//function : DumpDirection
//purpose :
//=======================================================================
- void DumpDirection(const gp_Dir& aD)
+void DumpDirection(const gp_Dir& aD)
{
Standard_Real aX, aY, aZ;
//
"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]);
+}
#include <GEOMAlgo_KindOfName.hxx>
#include <GEOMAlgo_KindOfBounds.hxx>
#include <GEOMAlgo_KindOfClosed.hxx>
+#include <GEOMAlgo_KindOfDef.hxx>
//=======================================================================
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;
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) ;
GEOMAlgo_KindOfName myKindOfName;
GEOMAlgo_KindOfBounds myKindOfBounds;
GEOMAlgo_KindOfClosed myKindOfClosed;
+ GEOMAlgo_KindOfDef myKindOfDef;
gp_Pnt myLocation;
gp_Dir myDirection;
gp_Ax3 myPosition;
//function :
//purpose :
//=======================================================================
- GEOMAlgo_ShapeInfoFiller::GEOMAlgo_ShapeInfoFiller()
+GEOMAlgo_ShapeInfoFiller::GEOMAlgo_ShapeInfoFiller()
:
GEOMAlgo_Algo()
{
//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;
}
//function : Tolerance
//purpose :
//=======================================================================
- Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const
+Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const
{
return myTolerance;
}
//function : SetShape
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS)
{
myShape=aS;
}
//function : Shape
//purpose :
//=======================================================================
- const TopoDS_Shape& GEOMAlgo_ShapeInfoFiller::Shape() const
+const TopoDS_Shape& GEOMAlgo_ShapeInfoFiller::Shape() const
{
return myShape;
}
//function : Info
//purpose :
//=======================================================================
- const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info() const
+const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info() const
{
return Info(myShape);
}
//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)) {
//function : CheckData
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::CheckData()
+void GEOMAlgo_ShapeInfoFiller::CheckData()
{
myErrorStatus=0;
//
//function : Perform
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::Perform()
+void GEOMAlgo_ShapeInfoFiller::Perform()
{
myErrorStatus=0;
//
//function :FillShape
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::FillShape(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::FillShape(const TopoDS_Shape& aS)
{
TopAbs_ShapeEnum aType;
//
//function :FillSubShapes
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::FillSubShapes(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::FillSubShapes(const TopoDS_Shape& aS)
{
TopoDS_Iterator aIt;
//
//function : FillContainer
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::FillContainer(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::FillContainer(const TopoDS_Shape& aS)
{
myErrorStatus=0;
//
//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;
//
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);
//
aF=TopoDS::Face(aS);
//
- aNbWires=GEOMAlgo_ShapeInfoFiller::NbWires(aF);
- //
aSurf=BRep_Tool::Surface(aF);
GeomAdaptor_Surface aGAS(aSurf);
aST=aGAS.GetType();
return;
}
//
+ //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// 1. Plane
if (aST==GeomAbs_Plane) {
gp_Pln aPln;
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);
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;
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;
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);
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);
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;
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);
FillSubShapes(aS);
return;
}
- //modified by NIZNHY-PKV Tue Jul 03 10:19:03 2012f
// BSplineCurve
if (aCT==GeomAbs_BSplineCurve) {
Standard_Integer aNbKnots, aNbPoles, aDegree;
aInfo.SetDirection(aDir);
}
}
- //modified by NIZNHY-PKV Tue Jul 03 10:19:06 2012t
// Line
else if (aCT==GeomAbs_Line) {
Standard_Boolean bInf1, bInf2;
//function :FillVertex
//purpose :
//=======================================================================
- void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS)
{
myErrorStatus=0;
//
//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;
//
//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;
//
aIt.Initialize(aSd);
for (; aIt.More(); aIt.Next()) {
- //const TopoDS_Shape& aSh=aIt.Value();
++iCnt;
}
return iCnt;
//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;
//
aIt.Initialize(aF);
for (; aIt.More(); aIt.Next()) {
- //const TopoDS_Shape& aW=aIt.Value();
++iCnt;
}
return iCnt;
//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;
GeomAbs_Line,
GeomAbs_Circle,
GeomAbs_Ellipse,
- GeomAbs_BSplineCurve //modified by NIZNHY-PKV Tue Jul 03 10:18:01 2012ft
+ GeomAbs_BSplineCurve
};
//
bRet=Standard_False;
//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;
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);
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
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);
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;
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);
return;
}
//
+ iMin=-1;
+ iMax=-1;
aDistMin=1.e15;
aDistMax=-aDistMin;
for (i=0; i<aNbFi; ++i) {
TopTools_IndexedMapOfShape aMV;
BRepTools_WireExplorer aWExp;
GEOMAlgo_KindOfName aKN, aKNE;
- GEOMAlgo_KindOfShape aKS;
//
GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
- aKN=GEOMAlgo_KN_UNKNOWN;
- aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
//
- aKS=aInfo.KindOfShape();
- if (aKS!=GEOMAlgo_KS_PLANE) {
- return;
- }
- //
- if (aInfo.KindOfBounds()==GEOMAlgo_KB_INFINITE) {
- aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
- return;
- }
+ aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
//
aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
// 1. may be it is circle/ellipse
if (aNbV==1 && aNbE==1) {
aExp.Init(aF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
+ if (aExp.More()) {
aE=aExp.Current();
- break;
}
//
const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
aInfo.SetRadius1(aInfoE.Radius1());
aInfo.SetLocation(aInfoE.Location());
aInfo.SetPosition(aInfoE.Position());
+ aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
}
if (aKNE==GEOMAlgo_KN_ELLIPSE) {
aKN=GEOMAlgo_KN_DISKELLIPSE;
aInfo.SetRadius2(aInfoE.Radius2());
aInfo.SetLocation(aInfoE.Location());
aInfo.SetPosition(aInfoE.Position());
+ aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
}
- }
+ return;
+ }// if (aNbV==1 && aNbE==1) {
//
- // 2. may be it is rectangle
- else {
- aExp.Init(aF, TopAbs_EDGE);
- for (; aExp.More(); aExp.Next()) {
- aE=aExp.Current();
- const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
- aKNE=aInfoE.KindOfName();
- if (aKNE!=GEOMAlgo_KN_SEGMENT) {
- return;
- }
+ //
+ Standard_Boolean bSegment;
+ //
+ bSegment=Standard_True;
+ aExp.Init(aF, TopAbs_EDGE);
+ for (; aExp.More() && bSegment; aExp.Next()) {
+ aE=aExp.Current();
+ const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
+ aKNE=aInfoE.KindOfName();
+ if (aKNE!=GEOMAlgo_KN_SEGMENT) {
+ bSegment=!bSegment;
}
- //
- aInfo.SetKindOfName(GEOMAlgo_KN_POLYGON);
+ }
+ //
+ if (bSegment) {
+ // 2. may be it is TRIANGLE, POLYGON, QUADRANGLE, RECTANGLE
+ aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
+ aInfo.SetKindOfName(GEOMAlgo_KN_POLYGON);
//
if (aNbV==3 && aNbE==3) {
aInfo.SetKindOfName(GEOMAlgo_KN_TRIANGLE);
//
aInfo.SetLocation(aPc);
aInfo.SetPosition(aAx3);
- //
- return;
- }
- //
- if (!(aNbV==4 && aNbE==4)) {
- return;
- }
+ } // if (aNbV==3 && aNbE==3) {
//
- // aNbV==4 && aNbE==4 and all edges are segments
- aIt.Initialize(aF);
- for (; aIt.More(); aIt.Next()){
- aW=TopoDS::Wire(aIt.Value());
- break;
- }
- //
- 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;
+ 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);
-
- 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);
+ 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();
+ }
//
- aLength=aD1;
- aWidth =aD0;
-
- if (aD0>aD1) {
- aLength=aD0;
- aWidth =aD1;
- aDX=aDx[1];
+ 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;
}
//
- aLength=2.*aLength;
- aWidth =2.*aWidth;
+ // Location : aPc in center of rectangle
+ // Position : 0z is plane normal
+ // 0x is along the first edge (quadrangle) or
+ // along length (rectangle)
//
- 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);
- }
+ aXYZc.Divide(4.);
+ aPc.SetXYZ(aXYZc);
+ aDX=aDx[0];
+ aInfo.SetLocation(aPc);
- return;
+ 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];
+ }
+ //
+ aLength=2.*aLength;
+ aWidth =2.*aWidth;
+ //
+ 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);
+ //
+ }// 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 (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();
+ //
+ if (BRep_Tool::IsClosed(aE, aF)) {
+ ++aNbSE;
+ }
+ else if (aKSE==GEOMAlgo_KS_DEGENERATED) {
+ ++aNbDE;
+ }
}
}
+ //
+ if (aNbSE==1 && aNbDE==2) {
+ aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
+ }
}
- //
- 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)
+ const gp_Cylinder& aCyl)
+
{
- Standard_Integer aNbV, aNbE, aNbCE, aNbSE, aNbDE, i;
- Standard_Real aR[3], aHeight;
- gp_Pnt aPC[3], aPD, aPc, aPX[3];
- TopoDS_Vertex aVD;
+ Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE;
+ Standard_Real aT0, aT1, aHeight;
+ gp_Pnt aPC[3], aPc;
TopoDS_Edge aE;
- TopoDS_Iterator aIt;
TopExp_Explorer aExp;
TopTools_MapOfShape aM;
- GEOMAlgo_KindOfShape aKS, aKSE;
- 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_CONE) {
- 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;
- 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);
- for (; aIt.More(); aIt.Next()) {
- aVD=TopoDS::Vertex(aIt.Value());
- break;
+ 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;
}
- aPX[i]=BRep_Tool::Pnt(aVD);
- //
- ++i;
- ++aNbCE;
- }
- else if (aKNE==GEOMAlgo_KN_SEGMENT) {
- if (BRep_Tool::IsClosed(aE, aF)) {
- ++aNbSE;
+ 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;
- }
- //
- aPD=BRep_Tool::Pnt(aVD);
- //
- ++aNbDE;
- }
}
- }
- //
- 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);
+ //
+ 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_Cylinder& aCyl)
+ const gp_Cone& aCone)
{
- Standard_Integer i, aNbV, aNbE, aNbCE, aNbSE;
- Standard_Real aT0, aT1, aHeight;
- gp_Pnt aPC[3], aPc;
+ 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 aKS;
- GEOMAlgo_KindOfName aKN, aKNE;
+ GEOMAlgo_KindOfShape aKSE;
+ 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) {
+ 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 && 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]);
+ //
+ 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) {
//
- gp_Ax3 aAx3=aCyl.Position();
- aAx3.SetLocation(aPc);
+ aInfo.SetRadius1 (aCone.RefRadius());
//
- aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER);
- aInfo.SetPosition(aAx3);
- aInfo.SetLocation(aPc);
- aInfo.SetHeight(aHeight);
+ aRmin=0.; // ZZ
+ aInfo.SetRadius2(aRmin);
}
-
//=======================================================================
//function : FillDetails
//purpose :
void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
const gp_Torus& )
{
+
Standard_Integer aNbV, aNbE, aNbSE;
TopoDS_Edge aE;
TopExp_Explorer aExp;
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;
TopExp_Explorer aExp;
//
bRet=Standard_False;
- aTolLin=Precision::Confusion();
+ aTol=Precision::Confusion();
aTolAng=Precision::Angular();
//
aExp.Init(aSd, TopAbs_FACE);
aSphere[j]=aGAS.Sphere();
}
//
- bIsEqual=IsEqual(aSphere[0], aSphere[1], aTolLin);
+ bIsEqual=IsEqual(aSphere[0], aSphere[1], aTol);
if (!bIsEqual) {
return bRet;
}
//
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;
}
//
//
return bRet;
}
-//modified by NIZNHY-PKV Tue Jul 03 13:29:43 2012t
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;
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) {
TopoDS_Iterator aItC;
//
aLC.Append (aC1);
- while(1) {
+ for(;;) {
aLC1.Clear();
aIt.Initialize(aLC);
for (; aIt.More(); aIt.Next()) {
//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();
//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;
//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;
//
//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();
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));
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;
//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;
//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;
//
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(${QT_USE_FILE})
-
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(GEOMBase_SOURCES
GEOMBase.cxx
// 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<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
if ( study && !CORBA::is_nil( 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() );
}
}
}
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<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right );
};
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<int> 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<int> modes;
+ modes.push_back( mode );
+ localSelection( modes );
+}
+
//================================================================
// Function : globalSelection
// Purpose : Activate selection of sub-shapes. Set selection filters
void localSelection( const ObjectList&, const int );
void localSelection( GEOM::GEOM_Object_ptr, const std::list<int> );
void localSelection( GEOM::GEOM_Object_ptr, const int );
+ void localSelection( const std::list<int> );
+ 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 );
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(${QT_USE_FILE})
-
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${PTHREAD_INCLUDE_DIR}
${CAS_INCLUDE_DIRS}
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
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
)
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
# sources / rcc wrappings
-QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
+QT_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES})
SET(GEOMGUI_SOURCES
GeometryGUI.cxx
GEOMGUI_OCCSelector.cxx
GEOMGUI_Selection.cxx
GEOMGUI_CreationInfoWdg.cxx
+ GEOMGUI_TextTreeWdg.cxx
GEOMGUI_DimensionProperty.cxx
${_moc_SOURCES}
${_rcc_SOURCES}
INSTALL(TARGETS GEOM EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
INSTALL(FILES ${GEOMGUI_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-QT4_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
+QT_INSTALL_TS_RESOURCES("${_ts_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
//=================================================================================
bool GEOMGUI::OnGUIEvent( int /*theCommandID*/, SUIT_Desktop* /*parent*/, const QVariant& /*theParam*/ )
{
- return TRUE;
+ return true;
}
//=================================================================================
//=================================================================================
bool GEOMGUI::OnGUIEvent( int /*theCommandID*/, SUIT_Desktop* /*parent*/ )
{
- return TRUE;
+ return true;
}
//=================================================================================
//=================================================================================
bool GEOMGUI::OnMousePress( QMouseEvent* /*pe*/, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* /*studyFrame*/ )
{
- return FALSE;
+ return false;
}
//=================================================================================
//=================================================================================
bool GEOMGUI::OnMouseMove( QMouseEvent* /*pe*/, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* /*studyFrame*/ )
{
- return TRUE;
+ return true;
}
//=================================================================================
//=================================================================================
bool GEOMGUI::OnMouseRelease( QMouseEvent* /*pe*/, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* /*studyFrame*/ )
{
- return TRUE;
+ return true;
}
//=================================================================================
//=================================================================================
bool GEOMGUI::OnKeyPress( QKeyEvent* /*pe*/, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* /*studyFrame*/ )
{
- return TRUE;
+ return true;
}
//=================================================================================
myParamsTreeWd->setColumnCount( 2 );
myParamsTreeWd->setHeaderLabels( QStringList() << tr( "PARAMETER" ) << tr( "VALUE" ) );
myParamsTreeWd->header()->setStretchLastSection( true );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
myParamsTreeWd->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
+#else
+ myParamsTreeWd->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
+#endif
QVBoxLayout* aLayout = new QVBoxLayout( this );
aLayout->addWidget( myParamsTreeWd );
}
// 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() );
--- /dev/null
+// 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 <GEOM_Constants.h>
+#include <GEOMUtils.hxx>
+
+// GUI includes
+#include <LightApp_Module.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_DataBrowser.h>
+
+// Qt includes
+#include <QAction>
+#include <QMenu>
+#include <QString>
+#include <QLabel>
+#include <QLineEdit>
+#include <QTreeWidget>
+#include <QHeaderView>
+#include <QGroupBox>
+#include <QVBoxLayout>
+#include <QHBoxLayout>
+#include <QHash>
+
+GEOMGUI_TextTreeWdg::GEOMGUI_TextTreeWdg( SalomeApp_Application* app )
+ : myDisplayer(NULL)
+{
+ myStudy = dynamic_cast<SalomeApp_Study*>( 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 );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ header()->setResizeMode( 1, QHeaderView::ResizeToContents );
+#else
+ header()->setSectionResizeMode( 1, QHeaderView::ResizeToContents );
+#endif
+ 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<GeometryGUI*>( 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"<<std::endl;
+}
+
+//=================================================================================
+// function : createActions
+// purpose : Create context popup menu actions.
+//=================================================================================
+void GEOMGUI_TextTreeWdg::createActions()
+{
+ QAction* a = new QAction( tr( "MEN_DISPLAY" ), this );
+ a->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<SalomeApp_Study*>( 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<QString> 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<SalomeApp_Study*>( 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 );
+}
--- /dev/null
+// 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 <QTreeWidget>
+#include <QHash>
+
+#include <SALOMEDSClient.hxx>
+
+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<QString, QTreeWidgetItem*> myObjects;
+ SalomeApp_Study* myStudy;
+ QTreeWidgetItem* myDimensionsItem;
+ GEOM_Displayer myDisplayer;
+
+ QMap<int, QAction*> myActions; //!< menu actions list
+
+};
+#endif
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;
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() );
<source>ICO_TRANSFER_DATA</source>
<translation>transfer_data.png</translation>
</message>
+ <message>
+ <source>ICO_IMPORT_SHAPE</source>
+ <translation>import.png</translation>
+ </message>
<message>
<source>ICON_DLG_POINT_FACE</source>
<translation>pointonface.png</translation>
<source>GEOM_FAST_CHECK_INTERSECTIONS</source>
<translation>Fast intersection</translation>
</message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS</source>
+ <translation>Shape Statistics</translation>
+ </message>
<message>
<source>GEOM_CIRCLE</source>
<translation>Circle</translation>
<source>GEOM_LENGTH_VALUE</source>
<translation>By length</translation>
</message>
+ <message>
+ <source>GEOM_TAKE_ORIENTATION_INTO_ACCOUNT</source>
+ <translation>Take edge orientation into account</translation>
+ </message>
<message>
<source>GEOM_PARTITION</source>
<translation>Partition</translation>
<source>GEOM_GROUP_NAME_PREFIX</source>
<translation>Group Names Prefix</translation>
</message>
+ <message>
+ <source>GEOM_STEP_BY_STEP</source>
+ <translation>Step-by-step generation</translation>
+ </message>
<message>
<source>GEOM_PLANE</source>
<translation>Plane</translation>
</message>
<message>
<source>GEOM_WRN_FACES_NOT_SHELL</source>
- <translation>Unable to create a shell. Result is a compound of faces.</translation>
+ <translation>Unable to create single shell. Result is a compound of shells.</translation>
+ </message>
+ <message>
+ <source>GEOM_WRN_FACES_NOT_FACE</source>
+ <translation>Unable to create single face. Result is a compound of faces.</translation>
</message>
<message>
<source>WRN_SHAPE_UNCLOSED</source>
<source>MEN_FAST_CHECK_INTERSECTIONS</source>
<translation>Fast intersection</translation>
</message>
+ <message>
+ <source>MEN_SHAPE_STATISTICS</source>
+ <translation>Shape Statistics</translation>
+ </message>
<message>
<source>MEN_CHECK_FREE_BNDS</source>
<translation>Check Free Boundaries</translation>
</message>
<message>
<source>MEN_MEASURES</source>
- <translation>Measures</translation>
+ <translation>Inspection</translation>
</message>
<message>
<source>MEN_MIN_DIST</source>
<translation>Line width</translation>
</message>
<message>
- <source>PREF_DIMENSIONS_FONT_HEIGHT</source>
- <translation>Font height</translation>
+ <source>PREF_DIMENSIONS_FONT</source>
+ <translation>Font</translation>
</message>
<message>
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
<source>PREF_DIMENSIONS_SHOW_UNITS</source>
<translation>Show units of measurement</translation>
</message>
+ <message>
+ <source>PREF_DIMENSIONS_USE_TEXT3D</source>
+ <translation>Use 3D text</translation>
+ </message>
<message>
<source>PREF_HIDE_INPUT_OBJECT</source>
<translation>Hide input objects from the viewer</translation>
<message>
<source>STB_FAST_CHECK_INTERSECTIONS</source>
<translation>Fast intersection</translation>
- </message>
+ </message>
<message>
+ <source>STB_SHAPE_STATISTICS</source>
+ <translation>Shape Statistics</translation>
+ </message>
+ <message>
<source>STB_CHECK_FREE_BNDS</source>
<translation>Check free boundaries</translation>
</message>
<source>TOP_FAST_CHECK_INTERSECTIONS</source>
<translation>Fast intersection</translation>
</message>
+ <message>
+ <source>TOP_SHAPE_STATISTICS</source>
+ <translation>Shape Statistics</translation>
+ </message>
<message>
<source>TOP_CHECK_FREE_BNDS</source>
<translation>Check free boundaries</translation>
<source>GEOM_Z_I</source>
<translation>Z%1 :</translation>
</message>
+ <message>
+ <source>GEOM_A_I</source>
+ <translation>A%1 :</translation>
+ </message>
<message>
<source>GEOM_SHAPES_ON_SHAPE_TITLE</source>
<translation>Get shapes on shape</translation>
</message>
<message>
<source>GEOM_PLUGINS_OTHER</source>
- <translation>Other</translation>
+ <translation>Python Plugins</translation>
</message>
<message>
<source>SHOW_ONLY_SELECTED</source>
<source>GEOM_HEALING_STATS_COL_2</source>
<translation>Modification</translation>
</message>
+ <message>
+ <source>GEOM_PLOT_DISTRIBUTION</source>
+ <translation>Plot</translation>
+ </message>
+ <message>
+ <source>GEOM_X_AXIS</source>
+ <translation>X Axis</translation>
+ </message>
+ <message>
+ <source>GEOM_Y_AXIS</source>
+ <translation>Y Axis</translation>
+ </message>
+ <message>
+ <source>GEOM_Z_AXIS</source>
+ <translation>Z Axis</translation>
+ </message>
+ <message>
+ <source>GEOM_DIM_AXES</source>
+ <translation>Dimensions along local axes</translation>
+ </message>
+ <message>
+ <source>SHOW_ALL_BTN</source>
+ <translation>Show all</translation>
+ </message>
+ <message>
+ <source>HIDE_ALL_BTN</source>
+ <translation>Hide all</translation>
+ </message>
</context>
<context>
<name>GeometryGUI</name>
</message>
<message>
<source>TOOL_MEASURES</source>
- <translation>Measures</translation>
+ <translation>Inspection</translation>
</message>
<message>
<source>TOOL_IMPORTEXPORT</source>
<source>REMOVE_BTN</source>
<translation>Remove</translation>
</message>
- <message>
- <source>SHOW_ALL_BTN</source>
- <translation>Show all</translation>
- </message>
- <message>
- <source>HIDE_ALL_BTN</source>
- <translation>Hide all</translation>
- </message>
<message>
<source>DISTANCE_ITEM</source>
<translation>Distance</translation>
<translation>Main shape</translation>
</message>
<message>
- <source>GEOM_INSPECT_OBJECT_SHOW</source>
+ <source>GEOM_INSPECT_TOLERANCE_FILTER</source>
+ <translation>Tolerance filter</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_RESET_MIN</source>
+ <translation>Min value</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_RESET_MAX</source>
+ <translation>Max value</translation>
+ </message>
+ <message>
+ <source>GEOM_INSPECT_OBJECT_SHOW</source>
<translation>Show Selected</translation>
</message>
<message>
<translation>(No info available)</translation>
</message>
</context>
+<context>
+ <name>GEOMGUI_TextTreeWdg</name>
+ <message>
+ <source>TEXT_TREE_VIEW_TITLE</source>
+ <translation>Text</translation>
+ </message>
+ <message>
+ <source>TEXT_TREE_VIEW_NAME</source>
+ <translation>Name</translation>
+ </message>
+</context>
<context>
<name>EntityGUI_IsolineDlg</name>
<message>
</context>
<context>
<name>MeasureGUI_CheckSelfIntersectionsDlg</name>
+ <message>
+ <source>GEOM_CHECK_INTERSECT_TYPE</source>
+ <translation>Self-intersection Detection Type</translation>
+ </message>
<message>
<source>GEOM_CHECK_INTE_INTERSECTIONS</source>
<translation>Self-intersections</translation>
<source>GEOM_CHECK_INTE_ALL</source>
<translation>Face to Face + all above</translation>
</message>
+ <message>
+ <source>GEOM_CHECK_INT_DEFLECT</source>
+ <translation>Deflection coefficient</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INT_DETECT_GAPS</source>
+ <translation>Detect gaps with tolerance</translation>
+ </message>
</context>
<context>
<name>MeasureGUI_FastCheckIntersectionsDlg</name>
<translation>Objects And Results</translation>
</message>
</context>
+<context>
+ <name>MeasureGUI_ShapeStatisticsDlg</name>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_TYPE</source>
+ <translation>Type</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_LENGTH</source>
+ <translation>Edges length</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_AREA</source>
+ <translation>Faces area</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_VOLUME</source>
+ <translation>Solids volume</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_NB_INTERVALS</source>
+ <translation>Number of intervals</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_SCALAR_RANGE</source>
+ <translation>Scalar range</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_COMPUTE</source>
+ <translation>Compute</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN</source>
+ <translation>Min</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX</source>
+ <translation>Max</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_CREATE_GROUPS</source>
+ <translation>Create Groups</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT</source>
+ <translation>Number of entities</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_ERROR</source>
+ <translation>Set minimal range value or switch-off Scalar range</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX_ERROR</source>
+ <translation>Set maximal range value or switch-off Scalar range</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR</source>
+ <translation>Minimal range value can not be more than maximal</translation>
+ </message>
+ <message>
+ <source>GEOM_MSG_GROUPS_CREATED</source>
+ <translation>%1 groups created</translation>
+ </message>
+</context>
<context>
<name>TransformationGUI_ExtensionDlg</name>
<message>
<source>GEOM_PROJ_ON_CYL_LENGTH_ANGLE</source>
<translation>Length angle</translation>
</message>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_ROTATION_ANGLE</source>
+ <translation>Rotation angle</translation>
+ </message>
</context>
</TS>
<source>GEOM_FAST_CHECK_INTERSECTIONS</source>
<translation>Intersection rapide</translation>
</message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS</source>
+ <translation>Statistiques sur l'objet</translation>
+ </message>
<message>
<source>GEOM_CIRCLE</source>
<translation>Cercle</translation>
</message>
<message>
<source>GEOM_TOWARDS_INSIDE</source>
- <translation>Epaissit vers l'intérieur</translation>
+ <translation>Epaissit vers l'intérieur</translation>
</message>
<message>
<source>GEOM_SCALE_PRISM</source>
</message>
<message>
<source>GEOM_WRN_FACES_NOT_SHELL</source>
- <translation>Impossible de créer une coque. Le résultat est un assemblage de faces.</translation>
+ <translation>Impossible de créer une coque. Le résultat est un assemblage de coques.</translation>
+ </message>
+ <message>
+ <source>GEOM_WRN_FACES_NOT_FACE</source>
+ <translation>Impossible de créer une face. Le résultat est un assemblage de faces.</translation>
</message>
<message>
<source>WRN_SHAPE_UNCLOSED</source>
<source>MEN_FAST_CHECK_INTERSECTIONS</source>
<translation>Intersection rapide</translation>
</message>
+ <message>
+ <source>MEN_SHAPE_STATISTICS</source>
+ <translation>Statistiques sur l'objet</translation>
+ </message>
<message>
<source>MEN_CHECK_FREE_BNDS</source>
<translation>Contrôler les contours libres</translation>
</message>
<message>
<source>MEN_MEASURES</source>
- <translation>Mesures</translation>
+ <translation>Inspection</translation>
</message>
<message>
<source>MEN_MIN_DIST</source>
<translation>Epaisseur de la ligne</translation>
</message>
<message>
- <source>PREF_DIMENSIONS_FONT_HEIGHT</source>
- <translation>Taille de police</translation>
+ <source>PREF_DIMENSIONS_FONT</source>
+ <translation>Police</translation>
</message>
<message>
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
<source>PREF_DIMENSIONS_SHOW_UNITS</source>
<translation>Afficher les unités</translation>
</message>
+ <message>
+ <source>PREF_DIMENSIONS_USE_TEXT3D</source>
+ <translation>Utiliser du texte 3D</translation>
+ </message>
<message>
<source>PREF_HIDE_INPUT_OBJECT</source>
<translation>Cacher dans la vue les objets en entrée</translation>
<source>STB_FAST_CHECK_INTERSECTIONS</source>
<translation>Intersection rapide</translation>
</message>
+ <message>
+ <source>STB_SHAPE_STATISTICS</source>
+ <translation>Statistique de l'objet</translation>
+ </message>
<message>
<source>STB_CHECK_FREE_BNDS</source>
<translation>Vérifier les contours libres</translation>
</message>
<message>
<source>STB_THICKNESS</source>
- <translation>Crée un solide par ajout d'épaisseur</translation>
+ <translation>Crée un solide par ajout d'épaisseur</translation>
</message>
<message>
<source>STB_PLANE</source>
<source>TOP_FAST_CHECK_INTERSECTIONS</source>
<translation>Intersection rapide</translation>
</message>
+ <message>
+ <source>TOP_SHAPE_STATISTICS</source>
+ <translation>Statistique de l'objet</translation>
+ </message>
<message>
<source>TOP_CHECK_FREE_BNDS</source>
<translation>Valider les contours libres</translation>
<source>GEOM_Z_I</source>
<translation>Z%1 :</translation>
</message>
+ <message>
+ <source>GEOM_A_I</source>
+ <translation>A%1 :</translation>
+ </message>
<message>
<source>GEOM_SHAPES_ON_SHAPE_TITLE</source>
<translation>Trouver les éléments d'un objet</translation>
</message>
<message>
<source>GEOM_PLUGINS_OTHER</source>
- <translation>Autre</translation>
+ <translation>Plugins Python</translation>
</message>
<message>
<source>SHOW_ONLY_SELECTED</source>
<source>GEOM_HEALING_STATS_COL_2</source>
<translation>Modification</translation>
</message>
+ <message>
+ <source>GEOM_PLOT_DISTRIBUTION</source>
+ <translation>Graphe</translation>
+ </message>
+ <message>
+ <source>GEOM_X_AXIS</source>
+ <translation>Axe X</translation>
+ </message>
+ <message>
+ <source>GEOM_Y_AXIS</source>
+ <translation>Axe Y</translation>
+ </message>
+ <message>
+ <source>GEOM_Z_AXIS</source>
+ <translation>Axe Z</translation>
+ </message>
+ <message>
+ <source>GEOM_DIM_AXES</source>
+ <translation>Dimensions sur les axes locaux</translation>
+ </message>
</context>
<context>
<name>GeometryGUI</name>
</message>
<message>
<source>TOOL_MEASURES</source>
- <translation>Informations</translation>
+ <translation>Inspection</translation>
</message>
<message>
<source>TOOL_IMPORTEXPORT</source>
<translation>(aucune information disponible)</translation>
</message>
</context>
+<context>
+ <name>GEOMGUI_TextTreeWdg</name>
+ <message>
+ <source>TEXT_TREE_VIEW_TITLE</source>
+ <translation>Texte</translation>
+ </message>
+ <message>
+ <source>TEXT_TREE_VIEW_NAME</source>
+ <translation>Nom</translation>
+ </message>
+</context>
<context>
<name>EntityGUI_IsolineDlg</name>
<message>
</context>
<context>
<name>MeasureGUI_CheckSelfIntersectionsDlg</name>
+ <message>
+ <source>GEOM_CHECK_INTERSECT_TYPE</source>
+ <translation>Détection du type d'auto-intersection</translation>
+ </message>
<message>
<source>GEOM_CHECK_INTE_INTERSECTIONS</source>
<translation>Auto-intersections</translation>
<source>GEOM_CHECK_INTE_ALL</source>
<translation>Face à Face + tout au-delà</translation>
</message>
+ <message>
+ <source>GEOM_CHECK_INT_DEFLECT</source>
+ <translation>Coefficient de déflexion</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INT_DETECT_GAPS</source>
+ <translation>Détection des écarts avec tolérance</translation>
+ </message>
</context>
<context>
<name>MeasureGUI_FastCheckIntersectionsDlg</name>
<translation>Objets et résultats</translation>
</message>
</context>
+<context>
+ <name>MeasureGUI_ShapeStatisticsDlg</name>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_TYPE</source>
+ <translation>Type</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_LENGTH</source>
+ <translation>Longueur des arêtes</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_AREA</source>
+ <translation>Aire des faces</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_VOLUME</source>
+ <translation>Volume des solides</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_NB_INTERVALS</source>
+ <translation>Nombre d'intervalles</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_SCALAR_RANGE</source>
+ <translation>Echelle de dimension</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_COMPUTE</source>
+ <translation>Calculer</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN</source>
+ <translation>Min</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX</source>
+ <translation>Max</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_CREATE_GROUPS</source>
+ <translation>Créer des groupes</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT</source>
+ <translation>Nombre d'entités</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_ERROR</source>
+ <translation>Spécifier une valeur minimale ou ignorer l'échelle de dimension</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX_ERROR</source>
+ <translation>Spécifier une valeur maximale ou ignorer l'échelle de dimension</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR</source>
+ <translation>La valeur minimal ne peut pas être plus grande que la maximale</translation>
+ </message>
+ <message>
+ <source>GEOM_MSG_GROUPS_CREATED</source>
+ <translation>%1 groupes créés</translation>
+ </message>
+</context>
<context>
<name>TransformationGUI_ExtensionDlg</name>
<message>
</message>
<message>
<source>GEOM_PROJ_ON_CYL_LENGTH_ANGLE</source>
- <translation>Longueur de l'angle</translation>
+ <translation>Longueur de l'angle</translation>
</message>
</context>
</TS>
<source>GEOM_FAST_CHECK_INTERSECTIONS</source>
<translation>クイック交点</translation>
</message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS</source>
+ <translation>形状の統計</translation>
+ </message>
<message>
<source>GEOM_CIRCLE</source>
<translation>Circle</translation>
<source>GEOM_LENGTH_VALUE</source>
<translation>長さで</translation>
</message>
+ <message>
+ <source>GEOM_TAKE_ORIENTATION_INTO_ACCOUNT</source>
+ <translation>エッジの方向に注意</translation>
+ </message>
<message>
<source>GEOM_PARTITION</source>
<translation>Partition</translation>
<source>GEOM_GROUP_NAME_PREFIX</source>
<translation>グループ名Prefix</translation>
</message>
+ <message>
+ <source>GEOM_STEP_BY_STEP</source>
+ <translation>ステップ生成</translation>
+ </message>
<message>
<source>GEOM_PLANE</source>
<translation>Plane</translation>
<source>GEOM_WRN_FACES_NOT_SHELL</source>
<translation>シェルを作成できません。面の結合です。</translation>
</message>
+ <message>
+ <source>GEOM_WRN_FACES_NOT_FACE</source>
+ <translation>たった1つの面を作成することはできません。結果は複合面になります。</translation>
+ </message>
<message>
<source>WRN_SHAPE_UNCLOSED</source>
<translation>閉じていないオブジェクト %1 からソリッドを作成できません</translation>
<source>MEN_FAST_CHECK_INTERSECTIONS</source>
<translation>クイック交点</translation>
</message>
+ <message>
+ <source>MEN_SHAPE_STATISTICS</source>
+ <translation>形状の統計</translation>
+ </message>
<message>
<source>MEN_CHECK_FREE_BNDS</source>
<translation>自由境界の確認</translation>
<translation>線幅</translation>
</message>
<message>
- <source>PREF_DIMENSIONS_FONT_HEIGHT</source>
- <translation>フォント高さ</translation>
+ <source>PREF_DIMENSIONS_FONT</source>
+ <translation>フォント</translation>
</message>
<message>
<source>PREF_DIMENSIONS_ARROW_LENGTH</source>
<source>PREF_DIMENSIONS_SHOW_UNITS</source>
<translation>測定単位の表示</translation>
</message>
+ <message>
+ <source>PREF_DIMENSIONS_USE_TEXT3D</source>
+ <translation>3Dテキストの使用</translation>
+ </message>
<message>
<source>PREF_HIDE_INPUT_OBJECT</source>
<translation>ビューワから入力したオブジェクトの非表示</translation>
<source>STB_FAST_CHECK_INTERSECTIONS</source>
<translation>クイック交点</translation>
</message>
+ <message>
+ <source>STB_SHAPE_STATISTICS</source>
+ <translation>形状の統計</translation>
+ </message>
<message>
<source>STB_CHECK_FREE_BNDS</source>
<translation>自由境界をチェック</translation>
<source>TOP_FAST_CHECK_INTERSECTIONS</source>
<translation>クイック交点</translation>
</message>
+ <message>
+ <source>TOP_SHAPE_STATISTICS</source>
+ <translation>形状の統計</translation>
+ </message>
<message>
<source>TOP_CHECK_FREE_BNDS</source>
<translation>自由境界を確認</translation>
<source>GEOM_Z_I</source>
<translation>Z%1 :</translation>
</message>
+ <message>
+ <source>GEOM_A_I</source>
+ <translation>A%1 :</translation>
+ </message>
<message>
<source>GEOM_SHAPES_ON_SHAPE_TITLE</source>
<translation>オブジェクトの要素を見つける</translation>
</message>
<message>
<source>CC_PNT_ITEM_X_Y</source>
- <translation type="unfinished">X=%1, Y=%2</translation>
+ <translation>X=%1, Y=%2</translation>
</message>
<message>
<source>CC_PNT_ITEM_X_Y_Z</source>
- <translation type="unfinished">X=%1, Y=%2, Z=%3</translation>
+ <translation>X=%1, Y=%2, Z=%3</translation>
</message>
<message>
<source>GEOM_FILTER</source>
<source>GEOM_HEALING_STATS_COL_2</source>
<translation>修正</translation>
</message>
+ <message>
+ <source>GEOM_PLOT_DISTRIBUTION</source>
+ <translation>Plot</translation>
+ </message>
+ <message>
+ <source>GEOM_X_AXIS</source>
+ <translation>X軸</translation>
+ </message>
+ <message>
+ <source>GEOM_Y_AXIS</source>
+ <translation>Y軸</translation>
+ </message>
+ <message>
+ <source>GEOM_Z_AXIS</source>
+ <translation>Z軸</translation>
+ </message>
+ <message>
+ <source>GEOM_DIM_AXES</source>
+ <translation>局所座標軸に沿った次元</translation>
+ </message>
</context>
<context>
<name>GeometryGUI</name>
</message>
<message>
<source>TABLE_X</source>
- <translation type="unfinished">X</translation>
+ <translation>X</translation>
</message>
<message>
<source>TABLE_Y</source>
- <translation type="unfinished">Y</translation>
+ <translation>Y</translation>
</message>
</context>
<context>
</message>
<message>
<source>Z</source>
- <translation type="unfinished">Z</translation>
+ <translation>Z</translation>
</message>
</context>
<context>
<name>OperationGUI_ChamferDlg</name>
<message>
<source>D</source>
- <translation type="unfinished">D</translation>
+ <translation>D</translation>
</message>
<message>
<source>FACE_1</source>
<translation>(有効情報なし)</translation>
</message>
</context>
+ <context>
+ <name>GEOMGUI_TextTreeWdg</name>
+ <message>
+ <source>TEXT_TREE_VIEW_TITLE</source>
+ <translation>テキスト</translation>
+ </message>
+ <message>
+ <source>TEXT_TREE_VIEW_NAME</source>
+ <translation>名前</translation>
+ </message>
+ </context>
<context>
<name>EntityGUI_IsolineDlg</name>
<message>
</context>
<context>
<name>MeasureGUI_CheckSelfIntersectionsDlg</name>
+ <message>
+ <source>GEOM_CHECK_INTERSECT_TYPE</source>
+ <translation>自己交差検出型</translation>
+ </message>
<message>
<source>GEOM_CHECK_INTE_INTERSECTIONS</source>
<translation>自己交差</translation>
<source>GEOM_CHECK_INTE_ALL</source>
<translation>面から面と上記すべて</translation>
</message>
+ <message>
+ <source>GEOM_CHECK_INT_DEFLECT</source>
+ <translation>偏向係数</translation>
+ </message>
+ <message>
+ <source>GEOM_CHECK_INT_DETECT_GAPS</source>
+ <translation>トレランスとのギャップ検出</translation>
+ </message>
</context>
<context>
<name>MeasureGUI_FastCheckIntersectionsDlg</name>
<translation>オブジェクトと結果</translation>
</message>
</context>
+ <context>
+ <name>MeasureGUI_ShapeStatisticsDlg</name>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_TYPE</source>
+ <translation>タイプ</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_LENGTH</source>
+ <translation>エッジ長さ</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_AREA</source>
+ <translation>面の面積</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_VOLUME</source>
+ <translation>ソリッドの体積</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_NB_INTERVALS</source>
+ <translation>間隔数</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_SCALAR_RANGE</source>
+ <translation>スカラ範囲</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_COMPUTE</source>
+ <translation>計算</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN</source>
+ <translation>Min</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX</source>
+ <translation>Max</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_CREATE_GROUPS</source>
+ <translation>グループの作成</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT</source>
+ <translation>エンティティ数</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_ERROR</source>
+ <translation>範囲内最小の値をセットするかスカラ範囲のスイッチをOFFにしてください。</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MAX_ERROR</source>
+ <translation>範囲内最大の値をセットするかスカラ範囲のスイッチをOFFにしてください。</translation>
+ </message>
+ <message>
+ <source>GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR</source>
+ <translation>範囲内最小値が最大値より大きくすることはできません</translation>
+ </message>
+ <message>
+ <source>GEOM_MSG_GROUPS_CREATED</source>
+ <translation>%1 グループを作成しました。</translation>
+ </message>
+ </context>
<context>
<name>TransformationGUI_ExtensionDlg</name>
<message>
<source>GEOM_PROJ_ON_CYL_LENGTH_ANGLE</source>
<translation>Length angle</translation>
</message>
+ <message>
+ <source>GEOM_PROJ_ON_CYL_ROTATION_ANGLE</source>
+ <translation>回転角度</translation>
+ </message>
</context>
</TS>
#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"
#include <SUIT_Session.h>
#include <SUIT_ViewManager.h>
-#include <PyInterp_Interp.h>
-
#include <OCCViewer_ViewWindow.h>
#include <OCCViewer_ViewPort3d.h>
#include <OCCViewer_ViewModel.h>
#include <SVTK_InteractorStyle.h>
#include <SVTK_ViewModel.h>
+#ifndef DISABLE_GRAPHICSVIEW
#include <GraphicsView_Viewer.h>
+#endif
#include <SalomeApp_Application.h>
#include <SalomeApp_DataObject.h>
#include <SALOMEDS_SObject.hxx>
#include <Basics_OCCTVersion.hxx>
+#include <QtxFontEdit.h>
// External includes
#include <QDir>
#include <QString>
#include <QPainter>
#include <QSignalMapper>
+#include <QFontDatabase>
#include <AIS_ListOfInteractive.hxx>
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <NCollection_DataMap.hxx>
#include <TColStd_HArray1OfByte.hxx>
+#include <TColStd_SequenceOfHAsciiString.hxx>
#include <utilities.h>
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx>
+#include <Font_SystemFont.hxx>
+#include <Font_FontMgr.hxx>
+#include <TCollection_HAsciiString.hxx>
+
#include "GEOM_version.h"
#include "GEOMImpl_Types.hxx" // dangerous hxx (defines short-name macros) - include after all
myLocalSelectionMode = GEOM_ALLOBJECTS;
myCreationInfoWdg = 0;
+ myTextTreeWdg = 0;
connect( Material_ResourceMgr::resourceMgr(), SIGNAL( changed() ), this, SLOT( updateMaterials() ) );
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<int> NotViewerDependentCommands;
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
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;
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";
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 );
}
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" );
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" );
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 );
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
// 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
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 );
}
}
+ Py_XDECREF(pluginsmanager);
return true;
}
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();
{
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
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 );
setPreferenceProperty( aDimLineWidthId, "min", 1 );
setPreferenceProperty( aDimLineWidthId, "max", 5 );
- int aDimFontHeightId = addPreference( tr( "PREF_DIMENSIONS_FONT_HEIGHT" ), aDimGroupId,
- LightApp_Preferences::DblSpin, "Geometry", "dimensions_font_height" );
-
- setPreferenceProperty( aDimFontHeightId, "min", 1e-9 );
- setPreferenceProperty( aDimFontHeightId, "max", 1e+9 );
- setPreferenceProperty( aDimFontHeightId, "precision", 9 );
+ int aDimFontId = addPreference( tr( "PREF_DIMENSIONS_FONT" ), aDimGroupId, LightApp_Preferences::Font, "Geometry", "dimensions_font" );
+
+ 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" );
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";
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" );
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,
QList<QVariant> aMarkerTypeIndicesList;
QList<QVariant> 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 ) ) );
}
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();
// update Object browser
getApp()->updateObjectBrowser( false );
}
+
+void GeometryGUI::emitDimensionsUpdated( QString entry )
+{
+ emit DimensionsUpdated( entry );
+}
class SUIT_ViewManager;
class SalomeApp_Study;
class GEOMGUI_CreationInfoWdg;
+class GEOMGUI_TextTreeWdg;
//=================================================================================
// class : GeometryGUI
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* );
void SignalDefaultStepValueChanged( double newVal );
void SignalDependencyTreeParamChanged( const QString&, const QString& );
void SignalDependencyTreeRenameObject( const QString& );
+ void DimensionsUpdated( const QString& );
protected:
virtual LightApp_Selection* createSelection() const;
GEOMGUI_CreationInfoWdg* myCreationInfoWdg;
+ GEOMGUI_TextTreeWdg* myTextTreeWdg;
+
SALOME_ListIO myTopLevelIOList;
friend class DisplayGUI;
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
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
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
else {
TopoDS_Shape aFixed;
ShHealOper_ShapeProcess aHealer;
- aHealer.Perform(aResult, aFixed);
+ aHealer.Perform(aShape, aFixed);
if (aHealer.isDone() && GEOMUtils::CheckShape(aFixed))
aResult = aFixed;
}
theWire = TopoDS::Wire(Fixer->Shape());
*/
- TopoDS_Edge prevEdge;
- TopTools_ListOfShape finalList, currChain;
-
- BRepTools_WireExplorer wexp (theWire);
- if (wexp.More()) {
- prevEdge = wexp.Current();
- currChain.Append(prevEdge);
- wexp.Next();
+ // Get the ordered list of edges.
+ TopTools_ListOfShape anEdges;
+ TopTools_ListOfShape aCurVertices;
+ BRepTools_WireExplorer aWExp (theWire);
+
+ 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;
const Handle(GEOM_Object) &thePath,
const bool theWithContact,
const bool theWithCorrections,
+ const bool IsBySteps,
const bool IsGenerateGroups)
{
SetErrorCode(KO);
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
pyDump << aPipeDS;
}
- pyDump << " = geompy.MakePipeWithDifferentSections([";
+ if (IsBySteps) {
+ pyDump << " = geompy.MakePipeWithDifferentSectionsBySteps([";
+ } else {
+ pyDump << " = geompy.MakePipeWithDifferentSections([";
+ }
for(i =1 ; i <= nbBases; i++) {
}
}
- pyDump<< "], "<<thePath<<","<<theWithContact << "," << theWithCorrections;
+ pyDump<< "], "<<thePath;
+
+ if (!IsBySteps) {
+ pyDump<<","<<theWithContact << "," << theWithCorrections;
+ }
if (IsGenerateGroups) {
pyDump << ", True";
const Handle(GEOM_Object) &thePath,
const bool theWithContact,
const bool theWithCorrections,
+ const bool IsBySteps,
const bool IsGenerateGroups);
Standard_EXPORT Handle(TColStd_HSequenceOfTransient) MakePipeWithShellSections
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBasicOperations::makePointOnGeom
(Handle(GEOM_Object) theGeomObj,
- double theParam1,
- double theParam2,
- double theParam3,
+ double theParam1,
+ double theParam2,
+ double theParam3,
const PointLocation theLocation,
+ const bool takeOrientationIntoAccount,
Handle(GEOM_Object) theRefPoint)
{
SetErrorCode(KO);
case PointOn_CurveByParam:
aPI.SetCurve(aRefFunction);
aPI.SetParameter(theParam1);
+ aPI.SetTakeOrientationIntoAccount(takeOrientationIntoAccount);
break;
case PointOn_CurveByLength:
aPI.SetCurve(aRefFunction);
{
case PointOn_CurveByParam:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurve("
- << theGeomObj << ", " << theParam1 << ")";
+ << theGeomObj << ", " << theParam1 << ", "
+ << takeOrientationIntoAccount << ")";
break;
case PointOn_CurveByLength:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength("
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurve
- (Handle(GEOM_Object) theCurve, double theParameter)
+ (Handle(GEOM_Object) theCurve,
+ double theParameter,
+ bool takeOrientationIntoAccount)
{
- return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam);
+ return makePointOnGeom(theCurve, theParameter, 0.0, 0.0, PointOn_CurveByParam,
+ takeOrientationIntoAccount);
}
//=============================================================================
double theLength,
Handle(GEOM_Object) theStartPoint)
{
- return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, theStartPoint);
+ return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength,
+ false, theStartPoint);
}
//=============================================================================
Standard_EXPORT Handle(GEOM_Object) MakePointWithReference (Handle(GEOM_Object) theReference,
double theX, double theY, double theZ);
- Standard_EXPORT Handle(GEOM_Object) MakePointOnCurve (Handle(GEOM_Object) theCurve,
- double theParameter);
+ Standard_EXPORT Handle(GEOM_Object) MakePointOnCurve
+ (Handle(GEOM_Object) theCurve,
+ double theParameter,
+ bool takeOrientationIntoAccount);
Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByLength (Handle(GEOM_Object) theCurve,
double theLength,
PointOn_Face
};
- Handle(GEOM_Object) makePointOnGeom (Handle(GEOM_Object) theGeomObj,
- double theParam1,
- double theParam2,
- double theParam3,
- const PointLocation theLocation,
- Handle(GEOM_Object) theRefPoint = 0);
+ Handle(GEOM_Object) makePointOnGeom
+ (Handle(GEOM_Object) theGeomObj,
+ double theParam1,
+ double theParam2,
+ double theParam3,
+ const PointLocation theLocation,
+ const bool takeOrientationIntoAccount = false,
+ Handle(GEOM_Object) theRefPoint = 0);
};
#endif
* =========== PYTHON ==============
* ==================================*/
-typedef struct {
- PyObject_HEAD
- int softspace;
- std::string *out;
- } PyStdOut;
-
-static void
-PyStdOut_dealloc(PyStdOut *self)
-{
- PyObject_Del(self);
-}
-
-static PyObject *
-PyStdOut_write(PyStdOut *self, PyObject *args)
+namespace
{
- char *c;
- int l;
- if (!PyArg_ParseTuple(args, "t#:write",&c, &l))
- return NULL;
-
- //std::cerr << c ;
- *(self->out)=*(self->out)+c;
-
- Py_INCREF(Py_None);
- return Py_None;
-}
+ typedef struct {
+ PyObject_HEAD
+ int softspace;
+ std::string *out;
+ } PyStdOut;
+
+ static void
+ PyStdOut_dealloc(PyStdOut *self)
+ {
+ PyObject_Del(self);
+ }
-static PyMethodDef PyStdOut_methods[] = {
- {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
- PyDoc_STR("write(string) -> None")},
- {NULL, NULL} /* sentinel */
-};
-
-static PyMemberDef PyStdOut_memberlist[] = {
- {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
- (char*)"flag indicating that a space needs to be printed; used by print"},
- {NULL} /* Sentinel */
-};
-
-static PyTypeObject PyStdOut_Type = {
- /* The ob_type field must be initialized in the module init function
- * to be portable to Windows without using C++. */
- PyObject_HEAD_INIT(NULL)
- 0, /*ob_size*/
- "PyOut", /*tp_name*/
- sizeof(PyStdOut), /*tp_basicsize*/
- 0, /*tp_itemsize*/
- /* methods */
- (destructor)PyStdOut_dealloc, /*tp_dealloc*/
- 0, /*tp_print*/
- 0, /*tp_getattr*/
- 0, /*tp_setattr*/
- 0, /*tp_compare*/
- 0, /*tp_repr*/
- 0, /*tp_as_number*/
- 0, /*tp_as_sequence*/
- 0, /*tp_as_mapping*/
- 0, /*tp_hash*/
- 0, /*tp_call*/
- 0, /*tp_str*/
- PyObject_GenericGetAttr, /*tp_getattro*/
- /* softspace is writable: we must supply tp_setattro */
- PyObject_GenericSetAttr, /* tp_setattro */
- 0, /*tp_as_buffer*/
- Py_TPFLAGS_DEFAULT, /*tp_flags*/
- 0, /*tp_doc*/
- 0, /*tp_traverse*/
- 0, /*tp_clear*/
- 0, /*tp_richcompare*/
- 0, /*tp_weaklistoffset*/
- 0, /*tp_iter*/
- 0, /*tp_iternext*/
- PyStdOut_methods, /*tp_methods*/
- PyStdOut_memberlist, /*tp_members*/
- 0, /*tp_getset*/
- 0, /*tp_base*/
- 0, /*tp_dict*/
- 0, /*tp_descr_get*/
- 0, /*tp_descr_set*/
- 0, /*tp_dictoffset*/
- 0, /*tp_init*/
- 0, /*tp_alloc*/
- 0, /*tp_new*/
- 0, /*tp_free*/
- 0, /*tp_is_gc*/
-};
-
-PyObject * newPyStdOut( std::string& out )
-{
- PyStdOut *self;
- self = PyObject_New(PyStdOut, &PyStdOut_Type);
- if (self == NULL)
- return NULL;
- self->softspace = 0;
- self->out=&out;
- return (PyObject*)self;
+ static PyObject*
+ PyStdOut_write(PyStdOut* self, PyObject* args)
+ {
+ char *c;
+ int l;
+ if (!PyArg_ParseTuple(args, "t#:write", &c, &l))
+ return NULL;
+
+ *(self->out) = *(self->out) + c;
+
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+
+ static PyMethodDef PyStdOut_methods[] = {
+ {"write", (PyCFunction)PyStdOut_write, METH_VARARGS,
+ PyDoc_STR("write(string) -> None")},
+ {NULL, NULL} /* sentinel */
+ };
+
+ static PyMemberDef PyStdOut_memberlist[] = {
+ {(char*)"softspace", T_INT, offsetof(PyStdOut, softspace), 0,
+ (char*)"flag indicating that a space needs to be printed; used by print"},
+ {NULL} /* Sentinel */
+ };
+
+ static PyTypeObject PyStdOut_Type = {
+ /* The ob_type field must be initialized in the module init function
+ * to be portable to Windows without using C++. */
+ PyObject_HEAD_INIT(NULL)
+ 0, /*ob_size*/
+ "PyOut", /*tp_name*/
+ sizeof(PyStdOut), /*tp_basicsize*/
+ 0, /*tp_itemsize*/
+ /* methods */
+ (destructor)PyStdOut_dealloc, /*tp_dealloc*/
+ 0, /*tp_print*/
+ 0, /*tp_getattr*/
+ 0, /*tp_setattr*/
+ 0, /*tp_compare*/
+ 0, /*tp_repr*/
+ 0, /*tp_as_number*/
+ 0, /*tp_as_sequence*/
+ 0, /*tp_as_mapping*/
+ 0, /*tp_hash*/
+ 0, /*tp_call*/
+ 0, /*tp_str*/
+ PyObject_GenericGetAttr, /*tp_getattro*/
+ /* softspace is writable: we must supply tp_setattro */
+ PyObject_GenericSetAttr, /* tp_setattro */
+ 0, /*tp_as_buffer*/
+ Py_TPFLAGS_DEFAULT, /*tp_flags*/
+ 0, /*tp_doc*/
+ 0, /*tp_traverse*/
+ 0, /*tp_clear*/
+ 0, /*tp_richcompare*/
+ 0, /*tp_weaklistoffset*/
+ 0, /*tp_iter*/
+ 0, /*tp_iternext*/
+ PyStdOut_methods, /*tp_methods*/
+ PyStdOut_memberlist, /*tp_members*/
+ 0, /*tp_getset*/
+ 0, /*tp_base*/
+ 0, /*tp_dict*/
+ 0, /*tp_descr_get*/
+ 0, /*tp_descr_set*/
+ 0, /*tp_dictoffset*/
+ 0, /*tp_init*/
+ 0, /*tp_alloc*/
+ 0, /*tp_new*/
+ 0, /*tp_free*/
+ 0, /*tp_is_gc*/
+ };
+
+ PyObject* newPyStdOut( std::string& out )
+ {
+ PyStdOut* self = PyObject_New(PyStdOut, &PyStdOut_Type);
+ if (self) {
+ self->softspace = 0;
+ self->out=&out;
+ }
+ return (PyObject*)self;
+ }
}
-
////////////////////////END PYTHON///////////////////////////
//=============================================================================
/*!
PyObject * func = NULL;
func = PyObject_GetAttrString(main_mod, "coordCalculator");
-
+
if (func == NULL){
SetErrorCode("Can't get function from python module !!!");
PyGILState_Release(gstate);
else
coords = PyObject_CallFunction(func,(char*)"(d, d, d)", theParamMin, theParamMax, theParamStep );
- PyObject* new_stderr = NULL;
-
if (coords == NULL){
fflush(stderr);
std::string err_description="";
- new_stderr = newPyStdOut(err_description);
+ PyObject* new_stderr = newPyStdOut(err_description);
+ PyObject* old_stderr = PySys_GetObject((char*)"stderr");
+ Py_INCREF(old_stderr);
PySys_SetObject((char*)"stderr", new_stderr);
PyErr_Print();
- PySys_SetObject((char*)"stderr", PySys_GetObject((char*)"__stderr__"));
+ PySys_SetObject((char*)"stderr", old_stderr);
Py_DECREF(new_stderr);
MESSAGE("Can't evaluate coordCalculator()" << " error is " << err_description);
SetErrorCode("Can't evaluate the expressions, please check them !!!");
return NULL; //There is no function which creates an object to be processed
// Add a new object
- Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
if (theObject->GetType() == GEOM_VECTOR) { // Mantis issue 21066
//Add the function
#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepClass_FaceClassifier.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
-#if OCC_VERSION_LARGE > 0x06080000
#include <BRepExtrema_ShapeProximity.hxx>
+#if OCC_VERSION_LARGE > 0x06090000
+#include <BRepExtrema_SelfIntersection.hxx>
+#include <BRepExtrema_MapOfIntegerPackedMapOfInteger.hxx>
#endif
#include <BRepGProp.hxx>
#include <BRepTools.hxx>
#include <GeomAPI_ProjectPointOnSurf.hxx>
#include <GeomLProp_CLProps.hxx>
#include <GeomLProp_SLProps.hxx>
+#include <Geom_Plane.hxx>
#include <GProp_GProps.hxx>
#include <GProp_PrincipalProps.hxx>
#include <ShapeAnalysis.hxx>
#include <TopoDS_Edge.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_DataMapIteratorOfDataMapOfIntegerListOfShape.hxx>
+#include <TColStd_MapIteratorOfPackedMapOfInteger.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopTools_ListOfShape.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+#include <set>
+
//=============================================================================
/*!
* Constructor
}
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)
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;
Handle(TColStd_HSequenceOfInteger)& theIntersections)
{
SetErrorCode(KO);
- bool isGood = false;
if (theIntersections.IsNull())
theIntersections = new TColStd_HSequenceOfInteger;
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;
aCSI.Perform();
Standard_Integer iErr = aCSI.ErrorStatus();
- isGood = true;
//
Standard_Integer aNbS, n1, n2;
BOPDS_MapIteratorMapOfPassKey aItMPK;
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<Standard_Integer> 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();
}
//=============================================================================
SetErrorCode(KO);
bool isGood = false;
-#if OCC_VERSION_LARGE > 0x06080000
-
if (theIntersections1.IsNull())
theIntersections1 = new TColStd_HSequenceOfInteger;
else
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));
}
if (aBSP.IsDone())
SetErrorCode(OK);
-#endif // OCC_VERSION_LARGE > 0x06080000
-
return isGood;
}
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)
};
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,
#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
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
#define ARG_LENGTH 11
-//#define ARG_FLAG 12
+#define ARG_USE_ORIENTATION 12
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:
#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
{
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); }
{ 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:
#include <Geom_Plane.hxx>
#include <Geom_SphericalSurface.hxx>
#include <Geom_Surface.hxx>
+#include <Geom_TrimmedCurve.hxx>
#include <Precision.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TDF_Tool.hxx>
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++;
Handle(GEOM_Object) theObject,
const Standard_Integer theObjectIndex)
{
+ SetErrorCode(KO);
+
if ( theObject.IsNull() || theSubObject.IsNull() )
return false;
}
TopExp::MapShapes( shape, anIndices );
- return anIndices.Contains( subShape );
+
+ const Standard_Boolean isBelongTo = anIndices.Contains(subShape);
+
+ SetErrorCode(OK);
+
+ return isBelongTo;
}
//=============================================================================
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;
}
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;
}
return aSeq;
}
+//=============================================================================
+/*!
+ * GetSubShapesWithTolerance
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfTransient)
+ GEOMImpl_IShapesOperations::GetSubShapesWithTolerance
+ (const Handle(GEOM_Object) &theShape,
+ const Standard_Integer theShapeType,
+ const GEOMUtils::ComparisonCondition theCondition,
+ const Standard_Real theTolerance)
+{
+ if (theShape.IsNull()) {
+ SetErrorCode("NULL GEOM object");
+ return NULL;
+ }
+
+ TopoDS_Shape aShape = theShape->GetValue();
+
+ if (aShape.IsNull()) {
+ SetErrorCode("NULL Shape");
+ return NULL;
+ }
+
+ if (theShapeType != TopAbs_FACE && theShapeType != TopAbs_EDGE &&
+ theShapeType != TopAbs_VERTEX && aShape.ShapeType() >= theShapeType) {
+ SetErrorCode("Invalid shape type");
+ return NULL;
+ }
+
+ TopTools_IndexedMapOfShape anIndices;
+ TopTools_MapOfShape aMapFence;
+ TopExp_Explorer anExp(aShape,
+ (TopAbs_ShapeEnum) theShapeType);
+ Handle(TColStd_HSequenceOfInteger) anIDs = new TColStd_HSequenceOfInteger;
+
+ TopExp::MapShapes(aShape, anIndices);
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &aSubShape = anExp.Current();
+
+ if (aMapFence.Add(aSubShape)) {
+ // Compute tolerance
+ Standard_Real aTolerance = -1.;
+
+ switch (aSubShape.ShapeType()) {
+ case TopAbs_FACE:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Face(aSubShape));
+ break;
+ case TopAbs_EDGE:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Edge(aSubShape));
+ break;
+ case TopAbs_VERTEX:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Vertex(aSubShape));
+ break;
+ default:
+ break;
+ }
+
+ if (aTolerance < 0.) {
+ continue;
+ }
+
+ // Compare the tolerance with reference value.
+ if (GEOMUtils::IsFitCondition (theCondition, aTolerance, theTolerance)) {
+ anIDs->Append(anIndices.FindIndex(aSubShape));
+ }
+ }
+ }
+
+ if (anIDs->IsEmpty()) {
+ SetErrorCode("Empty sequence of sub-shapes");
+ return NULL;
+ }
+
+ // Get objects by indices.
+ TCollection_AsciiString anAsciiList;
+ Handle(TColStd_HSequenceOfTransient) aSeq =
+ getObjectsShapesOn(theShape, anIDs, anAsciiList);
+
+ if (aSeq.IsNull() || aSeq->IsEmpty()) {
+ SetErrorCode("Empty sequence of edges");
+ return NULL;
+ }
+
+ // Make a Python command
+ Handle(GEOM_Object) anObj =
+ Handle(GEOM_Object)::DownCast(aSeq->Value(1));
+ Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
+
+ GEOM::TPythonDump(aFunction)
+ << "[" << anAsciiList.ToCString() << "] = geompy.GetSubShapesWithTolerance("
+ << theShape << ", " << theShapeType << ", " << theCondition << ", "
+ << theTolerance << ")";
+
+ SetErrorCode(OK);
+
+ return aSeq;
+}
+
//=======================================================================
//function : getShapesOnSurfaceIDs
/*!
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;
}
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;
}
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);
}
}
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
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);
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);
}
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);
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;
+
+ 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;
}
- }
- 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()));
+ aModifiedArray->SetValue(imod, anIndex);
+ }
//Add a new object
Handle(GEOM_Object) aResult = GetEngine()->AddSubShape(theShapeWhere, aModifiedArray);
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);
U = U11+range*2.0/3.0;
gp_Pnt P2 = C1->Value(U); //Compute a point on two thirds of the edge's length
+ C2 = new Geom_TrimmedCurve(C2, U21, U22);
+
if(!GeomLib_Tool::Parameter(C2, P1, MAX_TOLERANCE, U) || U < U21 || U > U22)
return false;
#include "GEOM_IOperations.hxx"
#include "GEOMAlgo_State.hxx"
+#include "GEOMUtils.hxx"
#include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_HSequenceOfInteger.hxx>
GetSubShapeEdgeSorted (const Handle(GEOM_Object) &theShape,
const Handle(GEOM_Object) &theStartPoint);
+ /*!
+ * \brief Return the list of subshapes that satisfies a certain tolerance
+ * criterion. The user defines the type of shapes to be returned, the
+ * condition and the tolerance value. The operation is defined for
+ * faces, edges and vertices only. E.g. for theShapeType FACE, theCondition
+ * CC_GT and theTolerance 1.e-7 this method returns all faces of theShape
+ * that have tolerances greater then 1.e7.
+ *
+ * \param theShape the shape to be exploded
+ * \param theShapeType the type of shapes to be returned. Can have the
+ * values FACE, EDGE and VERTEX only.
+ * \param theCondition the condition type.
+ * \param theTolerance the tolerance filter.
+ * \return the list of shapes that satisfy the conditions.
+ */
+ Standard_EXPORT Handle(TColStd_HSequenceOfTransient) GetSubShapesWithTolerance
+ (const Handle(GEOM_Object) &theShape,
+ const Standard_Integer theShapeType,
+ const GEOMUtils::ComparisonCondition theCondition,
+ const Standard_Real theTolerance);
+
private:
Handle(GEOM_Object) MakeShape (std::list<Handle(GEOM_Object)> theShapes,
const Standard_Integer theObjectType,
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 =
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 =
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 =
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 =
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 =
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 =
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 =
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 =
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;
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);
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);
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 =
(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);
aProj.SetRadius(theRadius);
aProj.SetStartAngle(theStartAngle);
aProj.SetAngleLength(theAngleLength);
+ aProj.SetAngleRotation(theAngleRotation);
//Compute the Projection
try {
}
//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);
(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);
};
#include <BRep_Builder.hxx>
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
+#include <BRepBuilderAPI_MakeSolid.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_Sewing.hxx>
+#include <BRepClass3d_SolidClassifier.hxx>
#include <BRepGProp.hxx>
#include <GeomFill_Trihedron.hxx>
#include <GeomFill_CorrectedFrenet.hxx>
#define GROUP_SIDE2 3
#define GROUP_OTHER 4
+static const Standard_Real TolPipeSurf = 5.e-4;
+
static bool FillGroups(const TopTools_SequenceOfShape *theGroups,
const TopTools_IndexedMapOfShape &theIndices,
Handle(TColStd_HArray1OfInteger) *theGroupIds);
Standard_Boolean isDone = theBuilder.IsDone();
- if (!isDone) {
+ if (!isDone ||
+ theBuilder.ErrorOnSurface() > TolPipeSurf) {
// Try to use Descrete Trihedron mode.
theBuilder.SetDiscreteMode();
theBuilder.Build();
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 :
const Handle(TopTools_HSequenceOfShape) theHSeqLocs,
const Standard_Boolean theWithContact,
const Standard_Boolean theWithCorrect,
+ const Standard_Boolean IsBySteps,
Handle(TColStd_HArray1OfInteger) *theGroups)
{
TopoDS_Shape aShape;
}
}
- // 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()="<<Edges.Length()<<endl;
- for (i=2; i<=Edges.Length(); i++) {
- TopoDS_Edge edge = TopoDS::Edge(Edges.Value(i));
- double tol = BRep_Tool::Tolerance(edge);
- Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp);
- C->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()="<<Edges.Length()<<endl;
+ for (i=2; i<=Edges.Length(); i++) {
+ TopoDS_Edge edge = TopoDS::Edge(Edges.Value(i));
+ double tol = BRep_Tool::Tolerance(edge);
+ Handle(Geom_Curve) C = BRep_Tool::Curve(edge,fp,lp);
+ C->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);
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.
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.
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];
GeomFill_Trihedron theBestMode = EvaluateBestSweepMode(aWirePath);
BRepOffsetAPI_MakePipe aMkPipe(aWirePath, aShapeBase, theBestMode);
- if (aMkPipe.IsDone()) {
+ if (aMkPipe.IsDone() && aMkPipe.ErrorOnSurface() <= TolPipeSurf) {
aShape = aMkPipe.Shape();
if (!CreateGroups(aShapeBase, aWirePath, aMkPipe, aCI)) {
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;
aShape = CreatePipeWithDifferentSections
(aWirePath, aHSeqBases, aHSeqLocs,
- aWithContact, aWithCorrect, pGroups);
+ aWithContact, aWithCorrect, isBySteps, pGroups);
if (isGenerateGroups) {
// Store created groups.
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:
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
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 {
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() );
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) {
#include <GEOMUtils_HTrsfCurve2d.hxx>
#include <Approx_Curve2d.hxx>
+#include <Bnd_Box2d.hxx>
+#include <BndLib_Add2dCurve.hxx>
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve2d.hxx>
#include <BRepBuilderAPI_Transform.hxx>
}
// 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;
return 0;
}
- TopoDS_Shape aProjShape =
- projectOnCylinder(aShape, aRadius, aStartAngle, aLengthAngle);
+ TopoDS_Shape aProjShape = projectOnCylinder
+ (aShape, aRadius, aStartAngle, aLengthAngle, aRotationAngle);
if (aProjShape.IsNull()) {
return 0;
AddParam(theParams, "Length angle", aLengthAngle);
}
+ AddParam(theParams, "Rotation angle", aProj.GetAngleRotation());
+
break;
}
default:
(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;
// 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()) {
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();
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());
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);
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:
#include <list>
+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<TopoDS_Shape> 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<TopoDS_Shape> ::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,
TopoDS_Shape aShape;
TCollection_AsciiString aWarning;
- std::list<TopAbs_ShapeEnum> 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();
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();
}
}
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;
}
}
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();
}
}
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();
}
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();
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();
}
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();
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();
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);
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();
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();
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();
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();
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
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<TopAbs_ShapeEnum>::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);
{
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;
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(${QT_USE_FILE})
-
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
GEOM
GEOMBase
Material
- DependencyTree
)
+
+IF(SALOME_USE_GRAPHICSVIEW)
+ LIST(APPEND _link_LIBRARIES
+ DependencyTree
+ )
+ENDIF()
# --- headers ---
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(GEOMToolsGUI_SOURCES
GEOMToolsGUI.cxx
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;
case GEOMOp::OpSortChildren:
OnSortChildren();
break;
+#ifndef DISABLE_GRAPHICSVIEW
case GEOMOp::OpShowDependencyTree:
OnShowDependencyTree();
break;
+#endif
case GEOMOp::OpReduceStudy:
OnReduceStudy();
break;
void OnClsBringToFront();
void OnCreateFolder();
void OnSortChildren();
+#ifndef DISABLE_GRAPHICSVIEW
void OnShowDependencyTree();
+#endif
void OnReduceStudy();
// Shortcut commands
// File : GEOMToolsGUI_1.cxx
// Author : Sergey ANIKIN, Open CASCADE S.A.S. (sergey.anikin@opencascade.com)
+#ifndef DISABLE_PYCONSOLE
#include <PyConsole_Console.h>
+#endif
#include "GEOMToolsGUI.h"
#include "GEOMToolsGUI_TransparencyDlg.h"
#include <GEOMBase.h>
#include <GEOM_Actor.h>
+#ifndef DISABLE_GRAPHICSVIEW
#include <DependencyTree_ViewModel.h>
#include <DependencyTree_View.h>
#include <DependencyTree_Selector.h>
+#endif
#include <Basics_OCCTVersion.hxx>
// on Show Dependencies operation
#define LAYOUT_DEPVIEW
+#ifndef DISABLE_PYCONSOLE
void GEOMToolsGUI::OnCheckGeometry()
{
SalomeApp_Application* app =
if (pyConsole)
pyConsole->exec("from GEOM_usinggeom import *");
}
+#endif
void GEOMToolsGUI::OnAutoColor()
{
app->updateObjectBrowser( true );
}
+#ifndef DISABLE_GRAPHICSVIEW
void GEOMToolsGUI::OnShowDependencyTree()
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
#endif
depVw->setFocus();
}
+#endif
void GEOMToolsGUI::OnReduceStudy()
{
setModal(true);
setWindowTitle(tr("GEOM_DEFLECTION_TLT"));
- setSizeGripEnabled(TRUE);
+ setSizeGripEnabled(true);
QGridLayout* MyDialogLayout = new QGridLayout(this);
MyDialogLayout->setSpacing(6);
MyDialogLayout->setMargin(11);
QPushButton* buttonOk = new QPushButton (GroupButtons);
buttonOk->setObjectName("buttonOk");
buttonOk->setText(tr("GEOM_BUT_OK"));
- buttonOk->setAutoDefault(TRUE);
- buttonOk->setDefault(TRUE);
+ buttonOk->setAutoDefault(true);
+ buttonOk->setDefault(true);
GroupButtonsLayout->addWidget(buttonOk, 0, 0);
GroupButtonsLayout->addItem(new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
QPushButton* buttonCancel = new QPushButton (GroupButtons);
buttonCancel->setObjectName("buttonCancel");
buttonCancel->setText(tr("GEOM_BUT_CANCEL"));
- buttonCancel->setAutoDefault(TRUE);
+ buttonCancel->setAutoDefault(true);
GroupButtonsLayout->addWidget(buttonCancel, 0, 1);
QPushButton* buttonHelp = new QPushButton (GroupButtons);
buttonHelp->setObjectName("buttonHelp");
buttonHelp->setText(tr("GEOM_BUT_HELP"));
- buttonHelp->setAutoDefault(TRUE);
+ buttonHelp->setAutoDefault(true);
GroupButtonsLayout->addWidget(buttonHelp, 0, 2);
/***************************************************************/
setModal(true);
setWindowTitle(tr(title.toLatin1().constData()));
- setSizeGripEnabled(TRUE);
+ setSizeGripEnabled(true);
QGridLayout* MyDialogLayout = new QGridLayout(this);
MyDialogLayout->setSpacing(6);
MyDialogLayout->setMargin(11);
QPushButton* buttonOk = new QPushButton (GroupButtons);
buttonOk->setObjectName("buttonOk");
buttonOk->setText(tr("GEOM_BUT_OK"));
- buttonOk->setAutoDefault(TRUE);
- buttonOk->setDefault(TRUE);
+ buttonOk->setAutoDefault(true);
+ buttonOk->setDefault(true);
GroupButtonsLayout->addWidget(buttonOk, 0, 0);
GroupButtonsLayout->addItem(new QSpacerItem (20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
QPushButton* buttonCancel = new QPushButton (GroupButtons);
buttonCancel->setObjectName("buttonCancel");
buttonCancel->setText(tr("GEOM_BUT_CANCEL"));
- buttonCancel->setAutoDefault(TRUE);
+ buttonCancel->setAutoDefault(true);
GroupButtonsLayout->addWidget(buttonCancel, 0, 1);
QPushButton* buttonHelp = new QPushButton (GroupButtons);
buttonHelp->setObjectName("buttonHelp");
buttonHelp->setText(tr("GEOM_BUT_HELP"));
- buttonHelp->setAutoDefault(TRUE);
+ buttonHelp->setAutoDefault(true);
GroupButtonsLayout->addWidget(buttonHelp, 0, 2);
/***************************************************************/
setModal( true );
setWindowTitle( tr( "GEOM_MEN_ISOS" ) );
- setSizeGripEnabled(TRUE);
+ setSizeGripEnabled(true);
QGridLayout* MyDialogLayout = new QGridLayout(this);
MyDialogLayout->setSpacing(6);
MyDialogLayout->setMargin(11);
QPushButton* buttonOk = new QPushButton( GroupButtons );
buttonOk->setObjectName( "buttonOk" );
buttonOk->setText( tr( "GEOM_BUT_OK" ) ) ;
- buttonOk->setAutoDefault( TRUE );
- buttonOk->setDefault( TRUE );
+ buttonOk->setAutoDefault( true );
+ buttonOk->setDefault( true );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
QPushButton* buttonCancel = new QPushButton( GroupButtons );
buttonCancel->setObjectName( "buttonCancel" );
buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ) ;
- buttonCancel->setAutoDefault( TRUE );
+ buttonCancel->setAutoDefault( true );
GroupButtonsLayout->addWidget( buttonCancel, 0, 1 );
QPushButton* buttonHelp = new QPushButton( GroupButtons );
buttonHelp->setObjectName( "buttonHelp" );
buttonHelp->setText( tr( "GEOM_BUT_HELP" ) ) ;
- buttonHelp->setAutoDefault( TRUE );
+ buttonHelp->setAutoDefault( true );
GroupButtonsLayout->addWidget( buttonHelp, 0, 2 );
/***************************************************************/
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
headerItem->setIcon( 2, QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_VISIBLE" ) ) ) );
myTreeWidget->setHeaderItem ( headerItem );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
myTreeWidget->header()->setClickable( true );
+#else
+ myTreeWidget->header()->setSectionsClickable( true );
+#endif
myTreeWidget->header()->setSortIndicatorShown( true );
myTreeWidget->header()->moveSection( 2, 0 );
myTreeWidget->setSortingEnabled( true );
QTreeWidgetItem * headerItem = new QTreeWidgetItem( columnNames );
theTreeWidget->setHeaderItem ( headerItem );
theTreeWidget->header()->moveSection( 1, 0 );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
theTreeWidget->header()->setClickable( true );
theTreeWidget->header()->setMovable( false );
theTreeWidget->header()->setResizeMode( 1, QHeaderView::ResizeToContents );
+#else
+ theTreeWidget->header()->setSectionsClickable( true );
+ theTreeWidget->header()->setSectionsMovable( false );
+ theTreeWidget->header()->setSectionResizeMode( 1, QHeaderView::ResizeToContents );
+#endif
theTreeWidget->setSelectionMode( QAbstractItemView::ExtendedSelection );
}
GEOMUtils.hxx
GEOMUtils_Hatcher.hxx
GEOMUtils_HTrsfCurve2d.hxx
+ GEOMUtils_ShapeStatistics.hxx
GEOMUtils_Trsf2d.hxx
GEOMUtils_TrsfCurve2d.hxx
GEOMUtils_XmlHandler.hxx
GEOMUtils.cxx
GEOMUtils_Hatcher.cxx
GEOMUtils_HTrsfCurve2d.cxx
+ GEOMUtils_ShapeStatistics.cxx
GEOMUtils_Trsf2d.cxx
GEOMUtils_TrsfCurve2d.cxx
GEOMUtils_XmlHandler.cxx
#define STD_SORT_ALGO 1
+#define DEFAULT_TOLERANCE_TOLERANCE 1.e-02
+#define DEFAULT_MAX_TOLERANCE_TOLERANCE 1.e-06
+
// When the following macro is defined, ShapeFix_ShapeTolerance function is used to set max tolerance of curve
// in GEOMUtils::FixShapeCurves function; otherwise less restrictive BRep_Builder::UpdateEdge/UpdateVertex
// approach is used
return isOpen;
}
+
+//=======================================================================
+//function : CompareToleranceValues
+//purpose :
+//=======================================================================
+int GEOMUtils::CompareToleranceValues(const double theTolShape,
+ const double theTolRef)
+{
+ const double aTolTol = Min(DEFAULT_MAX_TOLERANCE_TOLERANCE,
+ theTolRef*DEFAULT_TOLERANCE_TOLERANCE);
+
+ int aResult = 0;
+
+ if (theTolShape < theTolRef - aTolTol) {
+ aResult = -1;
+ } else if (theTolShape > theTolRef + aTolTol) {
+ aResult = 1;
+ }
+
+ return aResult;
+}
+
+//=======================================================================
+//function : IsFitCondition
+//purpose :
+//=======================================================================
+bool GEOMUtils::IsFitCondition(const ComparisonCondition theCondition,
+ const double theTolShape,
+ const double theTolRef)
+{
+ const int aCompValue = CompareToleranceValues(theTolShape, theTolRef);
+ bool isFit = false;
+
+ switch (theCondition) {
+ case CC_GT:
+ isFit = aCompValue == 1;
+ break;
+ case GEOMUtils::CC_GE:
+ isFit = aCompValue != -1;
+ break;
+ case GEOMUtils::CC_LT:
+ isFit = aCompValue == -1;
+ break;
+ case GEOMUtils::CC_LE:
+ isFit = aCompValue != 1;
+ break;
+ default:
+ break;
+ }
+
+ return isFit;
+}
namespace GEOMUtils
{
+ /**
+ * This enumeration represents comparison conditions.
+ */
+ enum ComparisonCondition {
+ CC_GT, ///< Greater then
+ CC_GE, ///< Greater then or equal to
+ CC_LT, ///< Less then
+ CC_LE ///< Less then or equal to
+ };
+
typedef std::vector<std::string> NodeLinks;
typedef std::map<std::string, NodeLinks> LevelInfo;
typedef std::vector<LevelInfo> LevelsList;
*/
Standard_EXPORT bool IsOpenPath(const TopoDS_Shape &theShape);
+ /**
+ * This function compares two tolerances. The shape tolerance (the first
+ * argument) is considered less than the reference tolerance (the second
+ * argument) if theTolShape < theTolRef - Tolerance(theTolRef). theTolShape is
+ * considered greater than theTolRef if theTolShape > theTolRef +
+ * Tolerance(theTolRef). Otherwise these tolerances are equal.
+ * Tolerance(theTolRef) = theTolRef*DEFAULT_TOLERANCE_TOLERANCE. But this value
+ * should not be greated than DEFAULT_MAX_TOLERANCE_TOLERANCE.
+ *
+ * \param theTolShape the shape tolerance
+ * \param theTolRef the reference tolerance
+ * \return -1 if theTolShape is less than theTolRef; 1 if theTolShape is greater
+ * than theTolRef; 0 if they are equal
+ */
+ Standard_EXPORT int CompareToleranceValues(const double theTolShape,
+ const double theTolRef);
+
+ /**
+ * Check if the comarison of tolerances fit the condition. The comparison of
+ * tolerances is performed using the function CompareToleranceValues.
+ *
+ * \param theCondition the condition
+ * \param theTolShape the shape tolerance
+ * \param theTolRef the reference tolerance
+ * \return true if the shape tolerance fits the condition; false otherwise.
+ */
+ Standard_EXPORT bool IsFitCondition(const ComparisonCondition theCondition,
+ const double theTolShape,
+ const double theTolRef);
+
};
#endif
--- /dev/null
+// 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 <BRepGProp.hxx>
+#include <GProp_GProps.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
+namespace GEOMUtils
+{
+//=================================================================================
+// function : ComputeMeasures()
+// purpose : gets measures of the given type for list of shapes in the range
+//=================================================================================
+ std::map<int,double> ComputeMeasures( std::list<TopoDS_Shape> 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<int, double> measures;
+
+ std::list<TopoDS_Shape>::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<TopoDS_Shape> 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<TopoDS_Shape> shapes,
+ TopAbs_ShapeEnum entity,
+ int nbIntervals,
+ Range range)
+{
+ // get list of measures and compute range (if it was not specified)
+ std::map<int,double> measures = ComputeMeasures( shapes, entity, range );
+
+ // compute a step
+ double aStep = (range.max - range.min) / nbIntervals;
+
+ // compute distribution in intervals
+ Distribution aDistr;
+ std::map<int,double>::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<int> 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
--- /dev/null
+// 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 <list>
+#include <map>
+#include <vector>
+
+#include <TopoDS_Shape.hxx>
+
+namespace GEOMUtils
+{
+ // struct to store range data
+ typedef struct { double min; double max; long count; std::list<long> indices; } Range;
+ // distribution is a set of ranges
+ typedef std::vector<Range> Distribution;
+
+ // function to get measures of entities and compute range for list of shapes
+ Standard_EXPORT std::map<int,double> ComputeMeasures(
+ std::list<TopoDS_Shape> 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<TopoDS_Shape> shapes,
+ TopAbs_ShapeEnum entity,
+ int intervals,
+ Range range );
+
+}
+
+#endif // _GEOMUtils_ShapeStatistics_HXX_
#include <SALOMEDS_Tool.hxx>
#include <SALOMEDS_wrap.hxx>
-#include <SALOME_DataContainer_i.hxx>
#include <Basics_DirUtils.hxx>
#include <set>
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;
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() );
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) {
aPlatformLibName += theLibName;
aPlatformLibName += ".so";
#endif
-
+
// check, if corresponding operations are already created
if (myOpCreatorMap.find(theLibName) == myOpCreatorMap.end()) {
// load plugin library
throw(SALOME_Exception(LOCALIZED( "Can't load server geometry plugin library" )));
#endif
}
-
+
// get method, returning operations creator
typedef GEOM_GenericOperationsCreator* (*GetOperationsCreator)();
GetOperationsCreator procHandle =
UnLoadLib(libHandle);
throw(SALOME_Exception(LOCALIZED("bad geometry plugin library")));
}
-
+
// get operations creator
GEOM_GenericOperationsCreator* aCreator = procHandle();
if (aCreator) {
// 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;
// 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() );
// 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 );
//=================================================================================
// 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;
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
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
}
}
-//=================================================================================
-// 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 "<<aFullPath.c_str());
- if (!aInsOp->IsDone())
- MESSAGE("Import operation is not done for file "<<aFullPath.c_str());
- return aResult._retn();
- }
-
- // remove temporary file and directory
- SALOMEDS::ListOfFileNames aTmpFiles;
- aTmpFiles.length(1);
- aTmpFiles[0] = aFileName.c_str();
- SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir, aTmpFiles, true);
-
- _impl->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;
// 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);
// 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<std::string> > &passedEntries,
- int level ) {
+void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+ GEOMUtils::LevelsList &upLevelList,
+ std::map< std::string, std::set<std::string> > &passedEntries,
+ int level ) {
std::string aGboEntry = gbo->GetEntry();
GEOMUtils::NodeLinks anEntries;
GEOMUtils::LevelInfo aLevelMap;
// get the existent map
aLevelMap = upLevelList.at(level-1);
if ( aLevelMap.count( aGboEntry ) > 0 ) {
- anEntries = aLevelMap[ aGboEntry ];
+ anEntries = aLevelMap[ aGboEntry ];
}
}
}
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;
// 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<std::string> > &passedEntries,
- int level ) {
+void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+ GEOMUtils::LevelsList &downLevelList,
+ std::map< std::string, std::set<std::string> > &passedEntries,
+ int level ) {
std::string aGboEntry = gbo->GetEntry();
Handle(TDocStd_Document) aDoc = GEOM_Engine::GetEngine()->GetDocument(gbo->GetStudyID());
Handle(TDataStd_TreeNode) aNode, aRoot;
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;
// 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<std::string> aSelected, aParents, aChildren, anOthers;
for ( int i = 0; i < theSelectedEntries.length(); i++ ) {
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() );
}
}
// 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<std::string> aToBeInSelected;
for ( it = aSelected.begin(); it != aSelected.end(); ++it ) {
//==============================================================================
// function : includeParentDependencies
-// purpose :
+// purpose :
//==============================================================================
void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj,
- std::set<std::string>& aSelected,
- std::set<std::string>& aParents,
- std::set<std::string>& aChildren,
- std::set<std::string>& anOthers)
+ std::set<std::string>& aSelected,
+ std::set<std::string>& aParents,
+ std::set<std::string>& aChildren,
+ std::set<std::string>& anOthers)
{
std::string anEntry = geomObj->GetEntry();
if ( aSelected.count( anEntry ) == 0 ) {
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 );
}
//==============================================================================
// function : includeSubObjects
-// purpose :
+// purpose :
//==============================================================================
void GEOM_Gen_i::includeSubObjects(SALOMEDS::Study_ptr theStudy,
- const std::string& aSelectedEntry,
- std::set<std::string>& aSelected,
- std::set<std::string>& aParents,
- std::set<std::string>& aChildren,
- std::set<std::string>& anOthers)
+ const std::string& aSelectedEntry,
+ std::set<std::string>& aSelected,
+ std::set<std::string>& aParents,
+ std::set<std::string>& aChildren,
+ std::set<std::string>& anOthers)
{
std::set<std::string>::iterator foundIt;
Handle(GEOM_BaseObject) handle_object = _impl->GetObject( theStudy->StudyId(), aSelectedEntry.c_str(), false);
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 );
//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 //
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 //
const Standard_CString& GrName,
GEOM::ListOfGO_var aResList);
- void getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
- GEOMUtils::LevelsList &upLevelList,
- std::map< std::string, std::set<std::string> > &passedEntries,
+ void getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+ GEOMUtils::LevelsList &upLevelList,
+ std::map< std::string, std::set<std::string> > &passedEntries,
int level = 0 );
- void getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
- GEOMUtils::LevelsList &downLevelList,
- std::map< std::string, std::set<std::string> > &passedEntries,
+ void getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
+ GEOMUtils::LevelsList &downLevelList,
+ std::map< std::string, std::set<std::string> > &passedEntries,
int level = 0 );
void includeParentDependencies(GEOM::GEOM_BaseObject_ptr gbo,
- std::set<std::string>& aSelected,
- std::set<std::string>& aParents,
- std::set<std::string>& aChildren,
- std::set<std::string>& anOthers);
+ std::set<std::string>& aSelected,
+ std::set<std::string>& aParents,
+ std::set<std::string>& aChildren,
+ std::set<std::string>& anOthers);
void includeSubObjects(SALOMEDS::Study_ptr theStudy,
- const std::string& aSelectedEntry,
- std::set<std::string>& aSelected,
- std::set<std::string>& aParents,
- std::set<std::string>& aChildren,
- std::set<std::string>& anOthers);
+ const std::string& aSelectedEntry,
+ std::set<std::string>& aSelected,
+ std::set<std::string>& aParents,
+ std::set<std::string>& aChildren,
+ std::set<std::string>& anOthers);
void LoadPlugin(const std::string& theLibName);
GEOM::GEOM_Object_ptr thePath,
CORBA::Boolean theWithContact,
CORBA::Boolean theWithCorrections,
+ CORBA::Boolean IsBySteps,
CORBA::Boolean IsGenerateGroups)
{
GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
GetOperations()->MakePipeWithDifferentSections
(aSeqBases, aSeqLocations,
aPath, theWithContact,
- theWithCorrections, IsGenerateGroups);
+ theWithCorrections, IsBySteps, IsGenerateGroups);
if (!GetOperations()->IsDone() || aHSeq.IsNull())
return aSeq._retn();
GEOM::GEOM_Object_ptr thePath,
CORBA::Boolean theWithContact,
CORBA::Boolean theWithCorrections,
+ CORBA::Boolean IsBySteps,
CORBA::Boolean IsGenerateGroups);
GEOM::ListOfGO* MakePipeWithShellSections
*/
//=============================================================================
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;
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();
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,
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
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,
#include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_HArray1OfInteger.hxx>
+/**
+ * This function converts GEOM::comparison_condition type into
+ * GEOMUtils::ComparisonCondition type.
+ *
+ * \param theCondition the condition of GEOM::comparison_condition type
+ * \return the condition of GEOMUtils::ComparisonCondition type.
+ */
+static GEOMUtils::ComparisonCondition ComparisonCondition
+ (const GEOM::comparison_condition theCondition)
+{
+ GEOMUtils::ComparisonCondition aResult = GEOMUtils::CC_GT;
+
+ switch (theCondition) {
+ case GEOM::CC_GE:
+ aResult = GEOMUtils::CC_GE;
+ break;
+ case GEOM::CC_LT:
+ aResult = GEOMUtils::CC_LT;
+ break;
+ case GEOM::CC_LE:
+ aResult = GEOMUtils::CC_LE;
+ break;
+ default:
+ break;
+ }
+
+ return aResult;
+}
+
//=============================================================================
/*!
* constructor:
return aSeq._retn();
}
+
+//=============================================================================
+/*!
+ * GetSubShapesWithTolerance
+ */
+//=============================================================================
+GEOM::ListOfGO* GEOM_IShapesOperations_i::GetSubShapesWithTolerance
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Short theShapeType,
+ GEOM::comparison_condition theCondition,
+ CORBA::Double theTolerance)
+{
+ GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference objects
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+
+ if (aShape.IsNull()) {
+ return aSeq._retn();
+ }
+
+ //Get Shapes On Shape
+ const GEOMUtils::ComparisonCondition aCondition =
+ ComparisonCondition(theCondition);
+ Handle(TColStd_HSequenceOfTransient) aHSeq =
+ GetOperations()->GetSubShapesWithTolerance
+ (aShape, theShapeType, aCondition, theTolerance);
+
+ if (!GetOperations()->IsDone() || aHSeq.IsNull())
+ return aSeq._retn();
+
+ const Standard_Integer aLength = aHSeq->Length();
+ Standard_Integer i;
+
+ aSeq->length(aLength);
+
+ for (i = 1; i <= aLength; i++) {
+ aSeq[i-1] = GetObject(Handle(GEOM_Object)::DownCast(aHSeq->Value(i)));
+ }
+
+ return aSeq._retn();
+}
GEOM::ListOfGO* GetSubShapeEdgeSorted (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr theStartPoint);
+ GEOM::ListOfGO* GetSubShapesWithTolerance
+ (GEOM::GEOM_Object_ptr theShape,
+ CORBA::Short theShapeType,
+ GEOM::comparison_condition theCondition,
+ CORBA::Double theTolerance);
+
::GEOMImpl_IShapesOperations* GetOperations()
{ return (::GEOMImpl_IShapesOperations*)GetImpl(); }
};
(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;
//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();
(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(); }
};
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;
}
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];
}
beginService( " GEOM_Superv_i::ExportSTEP" );
MESSAGE("GEOM_Superv_i::ExportSTEP");
getSTEPPluginOp();
- mySTEPOp->ExportSTEP( theObject, theFileName );
+
+ const GEOM::length_unit aUnit = GEOM::LU_METER;
+
+ mySTEPOp->ExportSTEP( theObject, theFileName, aUnit );
endService( " GEOM_Superv_i::ExportSTEP" );
}
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
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
geompy.GetSubShapeEdgeSorted(Sketcher3d_1, p2, "OrderedEdges")
geompy.GetSubShapeEdgeSorted(Sketcher3d_2, p3, "OrderedEdges")
+ # GetSubShapesWithTolerance
+ geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_GT, 1.e-8, "gt")
+ geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_GE, 1.e-7, "ge")
+ geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_LT, 2.e-7, "lt")
+ geompy.GetSubShapesWithTolerance(Box, GEOM.FACE, GEOM.CC_LE, 1.e-7, "le")
+
print "DONE"
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)
####### 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() > "0x70600":
+ if geompy.CheckSelfIntersectionsFast(selfIntersected):
+ raise RuntimeError, "Existing self-intersection is not detected"
+
+ ####### Fast intersection #######
- 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 not geompy.FastIntersect(box, cylinder)[0]:
+ raise RuntimeError, "Existing intersection is not detected"
####### WhatIs #######
#
from GEOM import ISTEPOperations
+import GEOM
# Engine Library Name
__libraryName__ = "STEPPluginEngine"
## Export the given shape into a file with given name in STEP format.
# @param theObject Shape to be stored in the file.
# @param theFileName Name of the file to store the given shape in.
+# @param theUnit the length unit (see GEOM::length_unit). In meters by default.
# @ingroup l2_import_export
-def ExportSTEP(self, theObject, theFileName):
+def ExportSTEP(self, theObject, theFileName, theUnit=GEOM.LU_METER):
"""
Export the given shape into a file with given name in STEP format.
Parameters:
theObject Shape to be stored in the file.
theFileName Name of the file to store the given shape in.
+ theUnit the length unit (see GEOM::length_unit). In meters by default.
"""
anOp = GetSTEPPluginOperations(self)
- anOp.ExportSTEP(theObject, theFileName)
+ anOp.ExportSTEP(theObject, theFileName, theUnit)
if anOp.IsDone() == 0:
raise RuntimeError, "Export : " + anOp.GetErrorCode()
pass
## Raise an Error, containing the Method_name, if Operation is Failed
## @ingroup l1_geomBuilder_auxiliary
def RaiseIfFailed (Method_name, Operation):
- if Operation.IsDone() == 0 and Operation.GetErrorCode() != "NOT_FOUND_ANY":
+ if not Operation.IsDone() and Operation.GetErrorCode() != "NOT_FOUND_ANY":
raise RuntimeError, Method_name + " : " + Operation.GetErrorCode()
## Return list of variables value from salome notebook
# - 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
## 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.
#
# @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.
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")
anObj = self.CurvesOp.MakeCurveParametricNew(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
else:
anObj = self.CurvesOp.MakeCurveParametric(thexExpr,theyExpr,thezExpr,theParamMin,theParamMax,theParamStep,theCurveType)
- RaiseIfFailed("MakeSplineInterpolation", self.CurvesOp)
+ RaiseIfFailed("MakeCurveParametric", self.CurvesOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "curve")
return anObj
aList = self.PrimOp.MakePipeWithDifferentSections(theSeqBases,
theLocations, thePath,
theWithContact, theWithCorrection,
- IsGenerateGroups)
+ False, IsGenerateGroups)
RaiseIfFailed("MakePipeWithDifferentSections", self.PrimOp)
if IsGenerateGroups:
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.
# 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")
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)
# 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")
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)
# 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")
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 ))
self._autoPublish(ListObj, theName, "SortedEdges")
return ListObj
+ ##
+ # Return the list of subshapes that satisfies a certain tolerance
+ # criterion. The user defines the type of shapes to be returned, the
+ # condition and the tolerance value. The operation is defined for
+ # faces, edges and vertices only. E.g. for theShapeType FACE,
+ # theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
+ # all faces of theShape that have tolerances greater then 1.e7.
+ #
+ # @param theShape the shape to be exploded
+ # @param theShapeType the type of sub-shapes to be returned (see
+ # ShapeType()). Can have the values FACE, EDGE and VERTEX only.
+ # @param theCondition the condition type (see GEOM::comparison_condition).
+ # @param theTolerance the tolerance filter.
+ # @param theName Object name; when specified, this parameter is used
+ # for result publication in the study. Otherwise, if automatic
+ # publication is switched on, default value is used for result name.
+ # @return the list of shapes that satisfy the conditions.
+ #
+ # @ref swig_GetSubShapesWithTolerance "Example"
+ @ManageTransactions("ShapesOp")
+ def GetSubShapesWithTolerance(self, theShape, theShapeType,
+ theCondition, theTolerance, theName=None):
+ """
+ Return the list of subshapes that satisfies a certain tolerance
+ criterion. The user defines the type of shapes to be returned, the
+ condition and the tolerance value. The operation is defined for
+ faces, edges and vertices only. E.g. for theShapeType FACE,
+ theCondition GEOM::CC_GT and theTolerance 1.e-7 this method returns
+ all faces of theShape that have tolerances greater then 1.e7.
+
+ Parameters:
+ theShape the shape to be exploded
+ theShapeType the type of sub-shapes to be returned (see
+ ShapeType()). Can have the values FACE,
+ EDGE and VERTEX only.
+ theCondition the condition type (see GEOM::comparison_condition).
+ theTolerance the tolerance filter.
+ theName Object name; when specified, this parameter is used
+ for result publication in the study. Otherwise, if automatic
+ publication is switched on, default value is used for result name.
+
+ Returns:
+ The list of shapes that satisfy the conditions.
+ """
+ # Example: see GEOM_TestAll.py
+ ListObj = self.ShapesOp.GetSubShapesWithTolerance(theShape, EnumToLong(theShapeType),
+ theCondition, theTolerance)
+ RaiseIfFailed("GetSubShapesWithTolerance", self.ShapesOp)
+ self._autoPublish(ListObj, theName, "SubShapeWithTolerance")
+ return ListObj
+
## Check if the object is a sub-object of another GEOM object.
# @param aSubObject Checked sub-object (or its parent object, in case if
# \a theSubObjectIndex is non-zero).
# 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.
# @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
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.
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")
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
#
INCLUDE(${SWIG_USE_FILE})
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(GenerationGUI_SOURCES
GenerationGUI.cxx
needTypes.push_back( TopAbs_COMPOUND );
globalSelection( aTypes );
- localSelection(GEOM::GEOM_Object::_nil(), needTypes );
+ localSelection( needTypes );
}
//=================================================================================
//=================================================================================
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")));
// 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);
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);
GroupPoints->hide();
GroupMakePoints->show();
GroupMakePoints->PushButton1->click();
+ myStepByStepCheckGMP->setChecked(false);
myGenGroupCheckGMP->setChecked(false);
resetGenGroup(myGenGroupCheckGMP, false, true);
break;
{
globalSelection();
if ( GroupPoints->CheckButton1->isChecked() ) {
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
} else {
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_COMPOUND);
}
}
else if ( myEditCurrentArgument == GroupMakePoints->LineEdit2 ) {
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_VERTEX, -1 );
GEOMBase::Synchronize( myLocations, objects );
if ( !myLocations.isEmpty() ) {
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);
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);
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) {
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.
QCheckBox *myGenGroupCheckGP;
QLabel *myPrefixLblGP;
QLineEdit *myPrefixEditGP;
+ QCheckBox *myStepByStepCheckGMP;
QCheckBox *myGenGroupCheckGMP;
QLabel *myPrefixLblGMP;
QLineEdit *myPrefixEditGMP;
void ConstructorsClicked( int );
void SelectionTypeButtonClicked();
void GenGroupClicked(bool);
+ void StepByStepClicked(bool);
};
#endif // GENERATIONGUI_PIPEDLG_H
{
globalSelection();
if (GroupPoints->CheckButton1->isChecked()) {
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else {
TColStd_MapOfInteger aMap;
myEditCurrentArgument = GroupPoints->LineEdit2;
if (GroupPoints->CheckButton1->isChecked()) {
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else {
TColStd_MapOfInteger aMap;
myEditCurrentArgument = GroupPoints->LineEdit3;
if (GroupPoints->CheckButton1->isChecked()) {
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ localSelection(TopAbs_EDGE);
}
else {
TColStd_MapOfInteger aMap;
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;
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;
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;
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()));
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${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}
SET(_link_LIBRARIES
GEOMBase
GEOMUtils
+ MeasureGUI
)
# --- resources ---
)
# header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(GroupGUI_SOURCES
GroupGUI.cxx
#include <GeometryGUI.h>
#include <GEOM_Displayer.h>
#include <GEOMUtils.hxx>
+#ifndef DISABLE_PLOT2DVIEWER
+#include <MeasureGUI_ShapeStatisticsDlg.h>
+#endif
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
myBusy(false),
myIsShapeType(false),
myIsHiddenMain(false),
- myWasHiddenMain(true)
+ myWasHiddenMain(true),
+ myIsAccept(false)
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
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);
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);
GEOM_Displayer* aDisplayer = getDisplayer();
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
bool isHideObjects = resMgr->booleanValue( "Geometry", "hide_input_object", true);
- if (myWasHiddenMain) {
+ if (myWasHiddenMain || ( isHideObjects && myIsAccept ) ) {
myIsHiddenMain = true;
}
- else if (!isHideObjects) {
+ else {
aDisplayer->Display(myMainObj);
myIsHiddenMain = false;
}
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()));
setIsDisplayResult( false );
}
- if (!onAccept(myMode == CreateGroup, true, isApplyAndClose()))
+ myIsAccept = onAccept(myMode == CreateGroup, true, isApplyAndClose());
+ if (!myIsAccept)
return false;
if(!isApplyAndClose()) {
//=================================================================================
void GroupGUI_GroupDlg::SetEditCurrentArgument()
{
- QPushButton* send = (QPushButton*)sender();
+ QPushButton* send = qobject_cast<QPushButton*>( sender() );
if (send == mySelBtn) {
myEditCurrentArgument = myMainName;
// activateSelection();
if(myEditCurrentArgument) {
myEditCurrentArgument->setFocus();
- send->setDown(true);
+ if ( send )
+ send->setDown(true);
}
updateState();
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aGeomObj, aShape)) {
if (aGeomObj->GetType() == GEOM_GROUP || aShape.ShapeType() == getShapeType()) {
+ if (subSelectionWay() != ALL_SUBSHAPES &&
+ GEOMBase::GetName(aGeomObj) == myShape2Name->text()) {
+ // Skip selected in place object.
+ continue;
+ }
+
TopTools_IndexedMapOfShape aMainMap;
TopoDS_Shape aMainShape = GEOM_Client::get_client().GetShape(GeometryGUI::GetGeomGen(), myMainObj);
TopExp::MapShapes(aMainShape, aMainMap);
int index = aSubShapesMap.FindIndex(aSubShape);
QString anEntry = QString( "TEMP_" ) + anEntryBase + QString("_%1").arg(index);
Handle(SALOME_InteractiveObject) io =
- new SALOME_InteractiveObject(anEntry.toAscii(), "GEOM", "TEMP_IO");
+ new SALOME_InteractiveObject(anEntry.toLatin1(), "GEOM", "TEMP_IO");
if ( myGroupIdList.contains( index ) ) {
aDisplayer->SetColor( aCol );
}
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());
}
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());
void showOnlySelected();
void selectionChanged();
void ClickOnOkFilter();
+#ifndef DISABLE_PLOT2DVIEWER
+ void ClickOnPlot();
+#endif
void MeasureToggled();
private:
TColStd_DataMapOfIntegerInteger myMain2InPlaceIndices;
QList<int> myGroupIdList;
int myDmMode;
+ bool myIsAccept;
QPushButton* mySelBtn;
QLineEdit* myMainName;
SalomeApp_DoubleSpinBox* myLessFilterSpin;
SalomeApp_DoubleSpinBox* myGreaterFilterSpin;
QPushButton* myApplyFilterButton;
+ QPushButton* myPlotDistributionButton;
QGroupBox* myFilterGrp;
};
#
IF(SALOME_BUILD_GUI)
- INCLUDE(UseQt4Ext)
- INCLUDE(${QT_USE_FILE})
+ INCLUDE(UseQtExt)
ENDIF()
# --- options ---
IF(SALOME_BUILD_GUI)
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/OBJECT
${PROJECT_SOURCE_DIR}/src/GEOMGUI
IF(SALOME_BUILD_GUI)
# sources / moc wrappings
- QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+ QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(IGESPluginGUI_SOURCES
IGESPlugin_GUI.cxx
TARGET_LINK_LIBRARIES(IGESPluginGUI ${_link_gui_LIBRARIES})
INSTALL(TARGETS IGESPluginGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
- QT4_INSTALL_TS_RESOURCES("${IGESPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
+ QT_INSTALL_TS_RESOURCES("${IGESPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
ENDIF()
IGESPlugin_ExportDlg fd( parent );
fd.setFileMode( AnyFile );
- fd.setFilters( fls );
+ fd.setNameFilters( fls );
fd.setWindowTitle( caption );
if ( !tmpfilename.isEmpty() )
fd.processPath( tmpfilename );
#include "GEOM_Operation.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
+#include "GEOM_GenericObjPtr.h"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(IGESPlugin)
+typedef GEOM::GenericObjPtr<GEOM::IIGESOperations> IGESOpPtr;
+
//=======================================================================
// function : IGESPlugin_GUI()
// purpose : Constructor
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" ),
{
QString fileName = fileNames.at( i );
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, igesOp.in() );
+ GEOM_Operation transaction( app, igesOp.get() );
bool ignoreUnits = false;
try
entryList.append( so->GetID() );
transaction.commit();
GEOM_Displayer( study ).Display( main.in() );
+ main->UnRegister();
}
else
{
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;
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, igesOp.in() );
+ GEOM_Operation transaction( app, igesOp.get() );
try
{
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(${QT_USE_FILE})
-
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${CAS_INCLUDE_DIRS}
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(Material_SOURCES
Material_Model.cxx
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
MeasureGUI_DimensionCreateTool.h
MeasureGUI_DimensionInteractor.h
MeasureGUI_DimensionFilter.h
+ MeasureGUI_definitions.h
)
# header files / to be processed by moc
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})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(MeasureGUI_SOURCES
MeasureGUI.cxx
${_uic_files}
)
+IF(SALOME_USE_PLOT2DVIEWER)
+ LIST(APPEND MeasureGUI_SOURCES
+ MeasureGUI_ShapeStatisticsDlg.cxx
+ )
+ENDIF()
+
# --- rules ---
ADD_LIBRARY(MeasureGUI ${MeasureGUI_SOURCES})
TARGET_LINK_LIBRARIES(MeasureGUI ${_link_LIBRARIES})
INSTALL(TARGETS MeasureGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
-
-
#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 <QApplication>
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
void MeasureGUI_AngleDlg::activateSelection()
{
globalSelection(GEOM_LINE);
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ localSelection( TopAbs_EDGE );
}
void MeasureGUI_BndBoxDlg::activateSelection()
{
globalSelection( GEOM_ALLSHAPES );
- std::list<int> 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 );
}
//=================================================================================
void MeasureGUI_CenterMassDlg::activateSelection()
{
globalSelection( GEOM_ALLSHAPES );
- std::list<int> 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 );
}
//=================================================================================
#include "MeasureGUI_CheckSelfIntersectionsDlg.h"
#include "MeasureGUI.h"
+#include <SUIT_MessageBox.h>
#include <SUIT_OverrideCursor.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
//=================================================================================
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";
/* Initialisation */
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(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()),
+ connect(mySelButton1, SIGNAL(clicked()),
this, SLOT(SetEditCurrentArgument()));
- connect(myInteList, SIGNAL(itemSelectionChanged()),
+ connect(myInteList1, SIGNAL(itemSelectionChanged()),
SLOT(onInteListSelectionChanged()));
- connect(myShapeList, SIGNAL(itemSelectionChanged()),
+ connect(myShapeList1, SIGNAL(itemSelectionChanged()),
SLOT(onSubShapesListSelectionChanged()));
connect(myLevelBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(clear()));
- connect(myComputeButton, SIGNAL(clicked()), this, SLOT(onCompute()));
+ connect(myComputeButton1, SIGNAL(clicked()), this, SLOT(onCompute()));
- LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
+ /***************************************************************/
+ 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()));
+ 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();
}
//=================================================================================
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();
}
//=================================================================================
QString anErrMsg("");
if (!findSelfIntersections(hasSelfInte, anErrMsg)) {
- myTextView->setText(anErrMsg);
+ getTextView()->setText(anErrMsg);
return;
}
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 # ";
anInteList.append(anInteStr);
}
- myInteList->addItems(anInteList);
- myComputeButton->setEnabled(false);
+ getInteList()->addItems(anInteList);
+ getComputeButton()->setEnabled(false);
}
//=================================================================================
//=================================================================================
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<int> needTypes;
+ needTypes.push_back( TopAbs_FACE ), needTypes.push_back( TopAbs_SHELL ), needTypes.push_back( TopAbs_SOLID ), needTypes.push_back( TopAbs_COMPOUND );
+ localSelection( needTypes );
+ break;
+ }
}
//=================================================================================
if ( !onAccept() )
return false;
+ clear();
initName();
+
+ ConstructorsClicked(getConstructorId());
+
return true;
}
//=================================================================================
bool MeasureGUI_CheckSelfIntersectionsDlg::isValid( QString& )
{
- return !myObj->_is_nil();
+ return !getObj().isNull();
}
//=================================================================================
//=================================================================================
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<TopAbs_ShapeEnum> 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::GEOM_Object_var aSelectedObject = GEOM::GEOM_Object::_nil();
- if (aSelList.Extent() > 0) {
- aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
- }
-
- if (aSelectedObject->_is_nil()) {
- myEditObjName->setText("");
- return;
- }
+ GEOM::GeomObjPtr aSelectedObject = getSelected( typesLst );
- myObj = aSelectedObject;
- myEditObjName->setText(GEOMBase::GetName(myObj));
+ (getConstructorId() == 0 ? myObj1 :myObj2) = aSelectedObject;
+ getEditObjName()->setText(getObj() ? GEOMBase::GetName(getObj().get()) : "");
}
//=================================================================================
bool MeasureGUI_CheckSelfIntersectionsDlg::findSelfIntersections
(bool &HasSelfInte, QString &theErrMsg)
{
- if (myObj->_is_nil()) {
+ if (getObj()->_is_nil()) {
return false;
}
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;
}
}
}
if (!anOper->IsDone()) {
- if (myInters->length() == 0) {
+ if (getInters()->length() == 0) {
theErrMsg = tr(anOper->GetErrorCode());
isOK = false;
} else {
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]);
}
}
}
erasePreview();
// Selected IDs
- QList<QListWidgetItem*> selected = myShapeList->selectedItems();
+ QList<QListWidgetItem*> selected = getShapeList()->selectedItems();
QList<int> aIds;
foreach(QListWidgetItem* item, selected) {
int idx = item->data(Qt::UserRole).toInt();
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);
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);
}
}
}
TColStd_IndexedMapOfInteger aMapIndex;
QList<int> 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];
}
}
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++) {
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
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<GEOM::GeomObjPtr> MeasureGUI_CheckSelfIntersectionsDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> 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 );
}
virtual bool execute(ObjectList &);
virtual bool extractPrefix() const;
virtual GEOM::GEOM_Object_ptr getFather (GEOM::GEOM_Object_ptr);
+ virtual QList<GEOM::GeomObjPtr> getSourceObjects();
private slots:
void DeactivateActiveDialog();
void SelectionIntoArgument();
void SetEditCurrentArgument();
+ void ConstructorsClicked (int);
+ void OnGaps(bool);
+
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;
+private:
+ 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
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;
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 );
void MeasureGUI_DistanceDlg::activateSelection()
{
globalSelection( GEOM_ALLSHAPES );
- std::list<int> 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 );
}
//=================================================================================
std::list<int> 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 );
}
void MeasureGUI_InertiaDlg::activateSelection()
{
MeasureGUI_Skeleton::activateSelection();
- std::list<int> 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 );
}
#include "MeasureGUI_DimensionFilter.h"
#include <GEOMGUI_DimensionProperty.h>
+#include <GEOMGUI_TextTreeWdg.h>
#include <GEOMUtils.hxx>
#include <GEOMGUI_OCCSelector.h>
#include <GEOM_AISDimension.hxx>
mySavedPropertyState.SaveToAttribute( aStudy, myEditObject->GetStudyEntry() );
+ myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
+
return true;
}
myEditObject->GetStudyEntry(),
GEOM::propertyName( GEOM::Dimensions ),
QVariant() );
+
if ( myIsNeedRedisplay ) {
- redisplay( myEditObject.get());
+ redisplay( myEditObject.get() );
}
+
+ myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
}
//=================================================================================
void MeasureGUI_MaxToleranceDlg::activateSelection()
{
globalSelection( GEOM_ALLSHAPES );
- std::list<int> 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()
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;
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()));
//=================================================================================
void MeasureGUI_PointDlg::activateSelection()
{
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
}
//=================================================================================
std::list<int> 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()
--- /dev/null
+// 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 <GEOMBase.h>
+#include <GEOMUtils_ShapeStatistics.hxx>
+#include <GeometryGUI.h>
+#include <DlgRef.h>
+
+// GUI includes
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_ViewManager.h>
+#include <SUIT_ViewWindow.h>
+
+#include <LightApp_SelectionMgr.h>
+
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
+
+#include <Plot2d_Histogram.h>
+#include <Plot2d_ViewFrame.h>
+#include <Plot2d_ViewModel.h>
+#include <Plot2d_ViewWindow.h>
+
+// Qt includes
+#include <QIcon>
+#include <QGridLayout>
+#include <QPushButton>
+#include <QLabel>
+
+// Qtx includes
+#include <QtxValidator.h>
+
+// OCC includes
+#include <TopoDS_Shape.hxx>
+
+#include <GEOMImpl_Types.hxx>
+
+//===========================================================================
+// 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<GEOM::GeomObjPtr> MeasureGUI_ShapeStatisticsDlg::getSourceObjects()
+{
+ QList<GEOM::GeomObjPtr> 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<GEOM::GeomObjPtr> 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<GEOM::GeomObjPtr> 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 )
+ hasFaces = aShOp->NumberOfSubShapes( aShapePtr.get(), TopAbs_FACE ) > 0;
+ if ( hasSolids != 0 )
+ hasSolids = 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<double> 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<Plot2d_ViewWindow*>(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<int,double> 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<long> 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<long>::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<GeometryGUI*>( myApp->module( "Geometry" ) );
+ myApp->onHelpContextModule( aGeomGUI ? myApp->moduleName( aGeomGUI->moduleName() ) : QString(""), "shape_statistics_operation_page.html" );
+}
--- /dev/null
+// 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 <GEOMBase_Helper.h>
+#include "GEOM_GenericObjPtr.h"
+#include "MeasureGUI_definitions.h"
+
+// Qt includes
+#include <QDialog>
+#include <QLineEdit>
+#include <QPointer>
+#include <QGroupBox>
+
+// Qtx includes
+#include <QtxIntSpinBox.h>
+#include <QtxComboBox.h>
+
+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<GEOM::GeomObjPtr> getSourceObjects();
+
+private slots:
+ void onEditMainShape();
+ void clickOnCompute();
+ void clickOnPlot();
+ void clickOnCreateGroups();
+ void clickOnHelp();
+
+private:
+ void fillTypes( bool, bool, bool );
+ void updateTypes( QList<GEOM::GeomObjPtr> theShapes );
+ TopAbs_ShapeEnum currentType();
+
+private:
+ SalomeApp_Application* myApp;
+ QLineEdit* myEditMainShape;
+ QtxComboBox* myCBTypes;
+ std::list<TopoDS_Shape> myShapes;
+ GEOM::GeomObjPtr myMainObj;
+ QtxIntSpinBox* myNbIntervals;
+ QGroupBox* myScalarRangeBox;
+ QLineEdit* myMin;
+ QLineEdit* myMax;
+ QPushButton* myButtonPlot;
+ QPushButton* myButtonCreateGr;
+ Plot2d_Histogram* myHistogram;
+
+};
+
+#endif // MEASUREGUI_SHAPESTATISTICSDLG_H
//=================================================================================
void MeasureGUI_WhatisDlg::activateSelection()
{
- MeasureGUI_Skeleton::activateSelection();
- std::list<int> 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
}
//=================================================================================
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("<b>%1</b>").arg(tr(val))
+#define TITLE_I(val, i) QString("<b>%1</b>").arg(tr(val).arg(i))
switch ( aKind )
{
case GEOM::GEOM_IKindOfShape::COMPOUND:
// 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + "Ax :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + "Ay :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + "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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_Z_AXIS") +
+ "<br>" + tr( "GEOM_Z_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_X_AXIS") +
+ "<br>" + tr( "GEOM_X_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( "z" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIM_AXES") +
+ "<br>" + tr( "GEOM_A_I" ).arg( "x" ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
+ "<br>" + tr( "GEOM_A_I" ).arg( "y" ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + tr( "GEOM_HEIGHT" ) + PRINT_DOUBLE( aDbls[8], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::POLYHEDRON:
aKindStr = tr( "GEOM_POLYHEDRON" );
// 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_AXIS" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_RADIUS_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::FACE:
aKindStr = tr( "GEOM_FACE" );
// 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + TITLE_I( "GEOM_POINT_I", 1 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
+ "<br>" + TITLE_I( "GEOM_POINT_I", 2 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_NORMAL" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DZ" ) + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIMENSIONS" ) +
+ "<br>" + tr( "GEOM_RADIUS_MAJOR" ) + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + tr( "GEOM_RADIUS_MINOR" ) + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + TITLE_I( "GEOM_POINT_I", 1 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
+ "<br>" + TITLE_I( "GEOM_POINT_I", 2 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[11], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[12], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_DIRECTION" ) +
+ "<br>" + tr( "GEOM_DX" ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_DY" ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + 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 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 1 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE_I( "GEOM_POINT_I", 2 ) +
+ "<br>" + tr( "GEOM_X_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 2 ) + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + 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" ) +
+ "<br>" + tr( "GEOM_X" ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y" ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z" ) + PRINT_DOUBLE( aDbls[2], aLenPrecision );
+ break;
+ case GEOM::GEOM_IKindOfShape::LCS:
+ aKindStr = tr( "GEOM_LCS" );
+ theParameters = TITLE("GEOM_POSITION") +
+ "<br>" + tr( "GEOM_X_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[0], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Y_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[1], aLenPrecision ) +
+ "<br>" + tr( "GEOM_Z_I" ).arg( 0 ) + PRINT_DOUBLE( aDbls[2], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_X_AXIS") +
+ "<br>" + "Xx :" + PRINT_DOUBLE( aDbls[3], aLenPrecision ) +
+ "<br>" + "Xy :" + PRINT_DOUBLE( aDbls[4], aLenPrecision ) +
+ "<br>" + "Xz :" + PRINT_DOUBLE( aDbls[5], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_Y_AXIS") +
+ "<br>" + "Yx :" + PRINT_DOUBLE( aDbls[6], aLenPrecision ) +
+ "<br>" + "Yy :" + PRINT_DOUBLE( aDbls[7], aLenPrecision ) +
+ "<br>" + "Yz :" + PRINT_DOUBLE( aDbls[8], aLenPrecision ) +
+ "<br>" + TITLE( "GEOM_Z_AXIS") +
+ "<br>" + "Zx :" + PRINT_DOUBLE( aDbls[9], aLenPrecision ) +
+ "<br>" + "Zy :" + PRINT_DOUBLE( aDbls[10], aLenPrecision ) +
+ "<br>" + "Zz :" + PRINT_DOUBLE( aDbls[11], aLenPrecision );
break;
case GEOM::GEOM_IKindOfShape::ADVANCED:
{
mySelEdit->setText(GEOMBase::GetName(myObj.get()));
processObject();
redisplayPreview();
-}
\ No newline at end of file
+}
--- /dev/null
+// 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
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(${QT_USE_FILE})
INCLUDE(${VTK_USE_FILE})
# --- options ---
INCLUDE_DIRECTORIES(
${VTK_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
- ${QT_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${CAS_INCLUDE_DIRS}
${KERNEL_INCLUDE_DIRS}
pt2.Transform(edgeTransf);
}
- float aCoord1[3] = {pt1.X(), pt1.Y(), pt1.Z()};
+ float aCoord1[3] = {(float)pt1.X(), (float)pt1.Y(), (float)pt1.Z()};
vtkIdType anIds[2];
anIds[0] = thePts->InsertNextPoint(aCoord1);
- float aCoord2[3] = {pt2.X(), pt2.Y(), pt2.Z()};
+ float aCoord2[3] = {(float)pt2.X(), (float)pt2.Y(), (float)pt2.Z()};
anIds[1] = thePts->InsertNextPoint(aCoord2);
thePolyData->InsertNextCell(VTK_LINE,2,anIds);
pt2.Transform(edgeTransf);
}
- float aCoord1[3] = {pt1.X(), pt1.Y(), pt1.Z()};
+ float aCoord1[3] = {(float)pt1.X(), (float)pt1.Y(), (float)pt1.Z()};
vtkIdType anIds[2];
anIds[0] = thePts->InsertNextPoint(aCoord1);
- float aCoord2[3] = {pt2.X(), pt2.Y(), pt2.Z()};
+ float aCoord2[3] = {(float)pt2.X(), (float)pt2.Y(), (float)pt2.Z()};
anIds[1] = thePts->InsertNextPoint(aCoord2);
thePolyData->InsertNextCell(VTK_LINE,2,anIds);
// Add points and segments, composing the arrow
Standard_Real cosinus, sinus, Tg = tan(anAngle);
- float coord[3] = {xo, yo, zo};
+ float coord[3] = {(float)xo, (float)yo, (float)zo};
vtkIdType ptLoc = thePts->InsertNextPoint(coord);
vtkIdType ptFirst = 0;
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
)
# header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(OperationGUI_SOURCES
OperationGUI.cxx
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE(${QT_USE_FILE})
-
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(PrimitiveGUI_SOURCES
PrimitiveGUI.cxx
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()));
{
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()));
}
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;
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()));
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;
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()));
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()));
myEdge.nullify();
myFace.nullify();
globalSelection(); // close local contexts, if any
- // localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ // localSelection( TopAbs_EDGE );
myOrientationType = 1;
{
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;
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();
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();
case 0:
{
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
GroupDimensions->hide();
GroupPoints->show();
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection( TopAbs_VERTEX );
SelectionIntoArgument();
}
}
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;
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()));
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src/DlgRef
${PROJECT_BINARY_DIR}/src/DlgRef
${PROJECT_SOURCE_DIR}/src/GEOMAlgo
+ ${PROJECT_SOURCE_DIR}/src/GEOMUtils
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
# libraries to link to
SET(_link_LIBRARIES
GEOMBase
+ GEOMUtils
)
# --- resources ---
)
# header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(RepairGUI_SOURCES
RepairGUI.cxx
case GEOMOp::OpRemoveExtraEdges: aDlg = new RepairGUI_RemoveExtraEdgesDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpFuseEdges: aDlg = new RepairGUI_FuseEdgesDlg (getGeometryGUI(), parent); break;
case GEOMOp::OpUnionFaces: aDlg = new RepairGUI_UnionFacesDlg (getGeometryGUI(), parent); break;
- case GEOMOp::OpInspectObj: aDlg = new RepairGUI_InspectObjectDlg (parent); break;
+ case GEOMOp::OpInspectObj: aDlg = new RepairGUI_InspectObjectDlg (getGeometryGUI(), parent); break;
default:
app->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
break;
const int nbCols = 2;
QTableWidget* table = new QTableWidget( nbRows, nbCols, this );
table->setEditTriggers( QAbstractItemView::NoEditTriggers );
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
table->horizontalHeader()->setResizeMode( 1, QHeaderView::Interactive );
+#else
+ table->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Interactive );
+#endif
table->horizontalHeader()->setStretchLastSection( true );
QStringList headers;
//=======================================================================
void RepairGUI_DivideEdgeDlg::ConstructorsClicked( int constructorId )
{
- myIsParameterGr->button( 0 )->setShown( constructorId == BY_PARAM );
- myIsParameterGr->button( 1 )->setShown( constructorId == BY_PARAM );
- myValEdt ->setShown( constructorId == BY_PARAM );
- myValLbl ->setShown( constructorId == BY_PARAM );
- GroupPoints->TextLabel2 ->setShown( constructorId == BY_POINT_PROJ );
- GroupPoints->PushButton2 ->setShown( constructorId == BY_POINT_PROJ );
- GroupPoints->LineEdit2 ->setShown( constructorId == BY_POINT_PROJ );
+ myIsParameterGr->button( 0 )->setVisible( constructorId == BY_PARAM );
+ myIsParameterGr->button( 1 )->setVisible( constructorId == BY_PARAM );
+ myValEdt ->setVisible( constructorId == BY_PARAM );
+ myValLbl ->setVisible( constructorId == BY_PARAM );
+ GroupPoints->TextLabel2 ->setVisible( constructorId == BY_POINT_PROJ );
+ GroupPoints->PushButton2 ->setVisible( constructorId == BY_POINT_PROJ );
+ GroupPoints->LineEdit2 ->setVisible( constructorId == BY_POINT_PROJ );
initSelection();
//=================================================================================
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 );
}
//=================================================================================
GroupVertexes->LineEdit1->setReadOnly(true);
GroupVertexes->LineEdit2->setReadOnly(true);
- GroupVertexes->TextLabel3->setShown(false);
- GroupVertexes->SpinBox_DX->setShown(false);
+ GroupVertexes->TextLabel3->setVisible(false);
+ GroupVertexes->SpinBox_DX->setVisible(false);
QVBoxLayout* layout = new QVBoxLayout (centralWidget());
layout->setMargin(0);
return false;
}
- erasePreview(false);
-
try {
if (openCommand()) {
SUIT_OverrideCursor wc;
abortCommand();
}
+ erasePreview(false);
+
updateViewer();
activateSelection();
updateButtonState();
#include <GEOMBase.h>
#include <GEOM_Constants.h>
#include <GeometryGUI.h>
+#include <GEOMUtils.hxx>
// GUI includes
#include <SUIT_Session.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Application.h>
+#include <SalomeApp_DoubleSpinBox.h>
#include <SalomeApp_Study.h>
#include <OCCViewer_ViewModel.h>
#include <SVTK_ViewModel.h>
// OCCT includes
+#include <BRep_Tool.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
#include <TopoDS_Iterator.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
// Qt includes
+#include <QButtonGroup>
+#include <QComboBox>
#include <QGridLayout>
+#include <QGroupBox>
#include <QPushButton>
#include <QHeaderView>
#include <QItemDelegate>
+#include <QLineEdit>
+#include <QRadioButton>
+#include <QStackedLayout>
+#include <QTreeWidgetItem>
+
+// Shape type definitions (values are equal to corresponding types of TopAbs_ShapeEnum).
+#define TYPE_FACE 4
+#define TYPE_EDGE 6
+#define TYPE_VERTEX 7
+
+// Comparison type definitions
+#define COMPARE_GT 0
+#define COMPARE_GE 1
+#define COMPARE_LT 2
+#define COMPARE_LE 3
+
+// Default tolerance values
+#define DEFAULT_TOLERANCE_VALUE 1.e-07
//=================================================================================
// class : RepairGUI_InspectObjectDlg::TreeWidgetItem
class RepairGUI_InspectObjectDlg::TreeWidgetItem : public QTreeWidgetItem
{
public:
- TreeWidgetItem( QTreeWidget*, const QStringList&, const TopoDS_Shape&, const Handle(SALOME_InteractiveObject)&, int = Type );
- TreeWidgetItem( QTreeWidgetItem*, const QStringList&, const TopoDS_Shape&, const QString&, int = Type );
+ TreeWidgetItem(QTreeWidget*,
+ const QStringList&,
+ const TopoDS_Shape&,
+ const Handle(SALOME_InteractiveObject)&,
+ double = DEFAULT_TOLERANCE_VALUE,
+ int = Type);
+
+ TreeWidgetItem(QTreeWidgetItem*,
+ const QStringList&,
+ const TopoDS_Shape&,
+ const QString&,
+ double = DEFAULT_TOLERANCE_VALUE,
+ int = Type);
+
~TreeWidgetItem();
bool isVisible();
TopoDS_Shape getShape() const;
Handle(SALOME_InteractiveObject) getIO() const;
+ double getTolerance() const;
+ void setTolerance(double theTolerance);
+
private:
bool myIsVisible;
TopoDS_Shape myShape;
Handle(SALOME_InteractiveObject) myIO;
+ double myTolerance;
};
-RepairGUI_InspectObjectDlg::TreeWidgetItem::TreeWidgetItem( QTreeWidget* view, const QStringList &strings, const TopoDS_Shape& shape,
- const Handle(SALOME_InteractiveObject)& io, int type )
+RepairGUI_InspectObjectDlg::TreeWidgetItem::TreeWidgetItem
+ (QTreeWidget *view,
+ const QStringList &strings,
+ const TopoDS_Shape &shape,
+ const Handle(SALOME_InteractiveObject) &io,
+ double theTolerance,
+ int type)
: QTreeWidgetItem( view, strings, type ),
myIsVisible( false ),
myShape( shape ),
- myIO( io )
+ myIO( io ),
+ myTolerance (theTolerance)
{
}
-RepairGUI_InspectObjectDlg::TreeWidgetItem::TreeWidgetItem( QTreeWidgetItem* parent, const QStringList &strings,
- const TopoDS_Shape& shape, const QString& entry, int type )
+RepairGUI_InspectObjectDlg::TreeWidgetItem::TreeWidgetItem
+ (QTreeWidgetItem *parent,
+ const QStringList &strings,
+ const TopoDS_Shape &shape,
+ const QString &entry,
+ double theTolerance,
+ int type)
: QTreeWidgetItem( parent, strings, type ),
myIsVisible( false ),
- myShape( shape )
+ myShape( shape ),
+ myTolerance (theTolerance)
{
- myIO = new SALOME_InteractiveObject( entry.toAscii(), "GEOM", "TEMP_IO" );
+ myIO = new SALOME_InteractiveObject( entry.toLatin1(), "GEOM", "TEMP_IO" );
setFlags( flags() | Qt::ItemIsEditable );
}
return myIO;
}
+double RepairGUI_InspectObjectDlg::TreeWidgetItem::getTolerance() const
+{
+ return myTolerance;
+}
+
+void RepairGUI_InspectObjectDlg::TreeWidgetItem::setTolerance(double theTolerance)
+{
+ myTolerance = theTolerance;
+}
+
//=================================================================================
// class : RepairGUI_InspectObjectDlg::Delegate
// purpose : class for "Inspect Object" tree item editing
// class : RepairGUI_InspectObjectDlg()
// purpose : Constructs a RepairGUI_InspectObjectDlg which is a child of 'parent'.
//=================================================================================
-RepairGUI_InspectObjectDlg::RepairGUI_InspectObjectDlg( SUIT_Desktop* parent )
-: GEOMBase_Helper( parent ),
- QDialog( parent ),
- myTransparency( 0.0 ),
- myIsSelectAll( false )
+RepairGUI_InspectObjectDlg::RepairGUI_InspectObjectDlg(GeometryGUI *theGeomGUI, SUIT_Desktop* parent )
+: GEOMBase_Helper (parent),
+ QDialog (parent),
+ myGeomGUI (theGeomGUI),
+ myTreeObjects (0),
+ myFilteredTreeObjects (0),
+ myCurrentTreeObjects (0),
+ myEditMainShape (0),
+ myTolFilterGrp (0),
+ myShapeTypeBtnGrp (0),
+ myComparisonCompo (0),
+ myMinTolValLabel (0),
+ myMaxTolValLabel (0),
+ myTolEdit (0),
+ myTreesLayout (0),
+ myTransparency (0.0),
+ myIsSelectAll (false),
+ myMaxTol (-1.),
+ myMinTol (-1.)
{
- QIcon iconSelect( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
- myVisible = QIcon( SUIT_Session::session()->resourceMgr()->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_VISIBLE" ) ) );
- myInvisible = QIcon( SUIT_Session::session()->resourceMgr()->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_INVISIBLE" ) ) );
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ QIcon iconSelect( resMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ myVisible = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_VISIBLE" ) ) );
+ myInvisible = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_INVISIBLE" ) ) );
+
+ QPixmap anImageVtx(resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_VERTEX")));
+ QPixmap anImageEdge(resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_EDGE")));
+ QPixmap anImageFace(resMgr->loadPixmap("GEOM", tr("ICON_OBJBROWSER_FACE")));
setWindowTitle( tr( "GEOM_INSPECT_OBJECT_TITLE" ) );
setAttribute( Qt::WA_DeleteOnClose );
- myApp = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
- myViewWindow = myApp->desktop()->activeWindow();
+ myViewWindow = myGeomGUI->getApp()->desktop()->activeWindow();
QGridLayout* topLayout = new QGridLayout( this );
topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
/********************** Inspected Object **********************/
- QHBoxLayout* mainShapeLayout = new QHBoxLayout();
+ QHBoxLayout* mainShapeLayout = new QHBoxLayout(this);
- QLabel* label = new QLabel( tr( "GEOM_INSPECT_OBJECT_MAIN_SHAPE" ) );
- QPushButton* selBtn = new QPushButton();
+ QLabel* label = new QLabel( tr( "GEOM_INSPECT_OBJECT_MAIN_SHAPE" ), this );
+ QPushButton* selBtn = new QPushButton(this);
selBtn->setIcon( iconSelect );
- myEditMainShape = new QLineEdit();
+ myEditMainShape = new QLineEdit(this);
myEditMainShape->setReadOnly(true);
mainShapeLayout->addWidget( label );
mainShapeLayout->addWidget( selBtn );
mainShapeLayout->addWidget( myEditMainShape );
- /********************** Sub-objects tree **********************/
-
- myTreeObjects = new QTreeWidget();
- myTreeObjects->setColumnCount( 2 );
- QStringList columnNames;
- columnNames.append( tr( "GEOM_INSPECT_OBJECT_NAME" ) );
- columnNames.append("");
- myTreeObjects->setHeaderLabels( columnNames );
- QTreeWidgetItem* headerItem = new QTreeWidgetItem( columnNames );
- myTreeObjects->setHeaderItem( headerItem );
- myTreeObjects->header()->moveSection( 1, 0 );
- myTreeObjects->header()->setClickable( true );
- myTreeObjects->header()->setMovable( false );
- myTreeObjects->header()->setResizeMode( 1, QHeaderView::ResizeToContents );
- myTreeObjects->setSelectionMode( QAbstractItemView::ExtendedSelection );
- myTreeObjects->setEditTriggers( QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed );
- // set custom item delegate
- myTreeObjects->setItemDelegate( new Delegate( myTreeObjects ) );
+ /********************** Tolerance filter **********************/
+
+ myTolFilterGrp = new QGroupBox (tr("GEOM_INSPECT_TOLERANCE_FILTER"), this);
+ myShapeTypeBtnGrp = new QButtonGroup(myTolFilterGrp);
+
+ // Filter on shape type
+ QRadioButton *aVtx = new QRadioButton(tr("GEOM_VERTEX"), myTolFilterGrp);
+ QRadioButton *anEdge = new QRadioButton(tr("GEOM_EDGE"), myTolFilterGrp);
+ QRadioButton *aFace = new QRadioButton(tr("GEOM_FACE"), myTolFilterGrp);
+
+ aVtx->setIcon(anImageVtx);
+ anEdge->setIcon(anImageEdge);
+ aFace->setIcon(anImageFace);
+ myShapeTypeBtnGrp->addButton(aVtx, TYPE_VERTEX);
+ myShapeTypeBtnGrp->addButton(anEdge, TYPE_EDGE);
+ myShapeTypeBtnGrp->addButton(aFace, TYPE_FACE);
+
+ // Filter on sub-shape tolerance
+ QLabel *aTolLabel = new QLabel(tr("GEOM_TOLERANCE"), myTolFilterGrp);
+ QLabel *aMinTolLabel = new QLabel(tr("GEOM_MIN"), myTolFilterGrp);
+ QLabel *aMaxTolLabel = new QLabel(tr("GEOM_MAX"), myTolFilterGrp);
+ QGridLayout *aFilterLayout = new QGridLayout(myTolFilterGrp);
+
+ myMinTolValLabel = new QLabel(myTolFilterGrp);
+ myMaxTolValLabel = new QLabel(myTolFilterGrp);
+ myMinTolResetBtn = new QPushButton(tr("GEOM_INSPECT_RESET_MIN"), myTolFilterGrp);
+ myMaxTolResetBtn = new QPushButton(tr("GEOM_INSPECT_RESET_MAX"), myTolFilterGrp);
+ myComparisonCompo = new QComboBox(myTolFilterGrp);
+ myTolEdit = new SalomeApp_DoubleSpinBox(myTolFilterGrp);
+ myTolEdit->setMinimumWidth(120);
+ aFilterLayout->addWidget(aVtx, 0, 0);
+ aFilterLayout->addWidget(anEdge, 0, 1);
+ aFilterLayout->addWidget(aFace, 0, 2);
+ aFilterLayout->addWidget(aMaxTolLabel, 1, 0, Qt::AlignRight);
+ aFilterLayout->addWidget(aTolLabel, 2, 0);
+ aFilterLayout->addWidget(aMinTolLabel, 3, 0, Qt::AlignRight);
+ aFilterLayout->addWidget(myMaxTolValLabel, 1, 1);
+ aFilterLayout->addWidget(myComparisonCompo, 2, 1);
+ aFilterLayout->addWidget(myMinTolValLabel, 3, 1);
+ aFilterLayout->addWidget(myMaxTolResetBtn, 1, 2);
+ aFilterLayout->addWidget(myTolEdit, 2, 2);
+ aFilterLayout->addWidget(myMinTolResetBtn, 3, 2);
+ aFilterLayout->setRowMinimumHeight(0, 30);
+
+ myTolFilterGrp->setCheckable(true);
+
+ /********************** Sub-objects trees **********************/
+ createTreeWidget(myTreeObjects);
+ createTreeWidget(myFilteredTreeObjects);
+
+ myTreesLayout = new QStackedLayout(this);
+ myTreesLayout->addWidget(myTreeObjects);
+ myTreesLayout->addWidget(myFilteredTreeObjects);
/********************** Buttons **********************/
- QVBoxLayout* buttonsLayout1 = new QVBoxLayout();
+ QVBoxLayout* buttonsLayout1 = new QVBoxLayout(this);
+
+ QPushButton* buttonShow = new QPushButton( tr( "GEOM_INSPECT_OBJECT_SHOW" ), this );
+ QPushButton* buttonShowOnly = new QPushButton( tr( "GEOM_INSPECT_OBJECT_SHOW_ONLY" ), this );
+ QPushButton* buttonHide = new QPushButton( tr( "GEOM_INSPECT_OBJECT_HIDE" ), this );
+ QPushButton* buttonPublish = new QPushButton( tr( "GEOM_INSPECT_OBJECT_PUBLISH" ), this );
+ QPushButton* aShowAllBtn = new QPushButton(tr("SHOW_ALL_BTN"), this);
+ QPushButton* aHideAllBtn = new QPushButton(tr("HIDE_ALL_BTN"), this);
- QPushButton* buttonShow = new QPushButton( tr( "GEOM_INSPECT_OBJECT_SHOW" ) );
- QPushButton* buttonShowOnly = new QPushButton( tr( "GEOM_INSPECT_OBJECT_SHOW_ONLY" ) );
- QPushButton* buttonHide = new QPushButton( tr( "GEOM_INSPECT_OBJECT_HIDE" ) );
- QPushButton* buttonPublish = new QPushButton( tr( "GEOM_INSPECT_OBJECT_PUBLISH" ) );
buttonsLayout1->addWidget( buttonShow );
buttonsLayout1->addWidget( buttonShowOnly );
buttonsLayout1->addWidget( buttonHide );
- buttonsLayout1->addStretch();
+ buttonsLayout1->addWidget( aShowAllBtn );
+ buttonsLayout1->addWidget( aHideAllBtn );
buttonsLayout1->addWidget( buttonPublish );
buttonsLayout1->addStretch();
- QHBoxLayout* buttonsLayout2 = new QHBoxLayout();
+ QHBoxLayout* buttonsLayout2 = new QHBoxLayout(this);
- QPushButton* buttonClose = new QPushButton( tr( "GEOM_BUT_CLOSE" ) );
- QPushButton* buttonHelp = new QPushButton( tr( "GEOM_BUT_HELP" ) );
+ QPushButton* buttonClose = new QPushButton( tr( "GEOM_BUT_CLOSE" ), this );
+ QPushButton* buttonHelp = new QPushButton( tr( "GEOM_BUT_HELP" ), this );
buttonsLayout2->addWidget( buttonClose );
buttonsLayout2->addStretch();
buttonsLayout2->addWidget( buttonHelp );
topLayout->addLayout( mainShapeLayout, 0, 0 );
- topLayout->addWidget( myTreeObjects, 1, 0 );
- topLayout->addLayout( buttonsLayout1, 0, 1, 2, 1 );
- topLayout->addLayout( buttonsLayout2, 2, 0, 1, 2 );
-
- // Signals and slots connections
+ topLayout->addWidget( myTolFilterGrp, 1, 0);
+ topLayout->addLayout( myTreesLayout, 2, 0 );
+ topLayout->addLayout( buttonsLayout1, 0, 1, 3, 1 );
+ topLayout->addLayout( buttonsLayout2, 3, 0, 1, 2 );
connect( selBtn, SIGNAL( clicked() ), this, SLOT( onEditMainShape() ) );
- connect( myTreeObjects, SIGNAL( itemClicked( QTreeWidgetItem*, int ) ),
- this, SLOT( onItemClicked( QTreeWidgetItem*, int ) ) );
- connect( myTreeObjects, SIGNAL( itemChanged( QTreeWidgetItem*, int ) ),
- this, SLOT( onItemChanged( QTreeWidgetItem*, int ) ) );
- connect( myTreeObjects, SIGNAL( itemExpanded ( QTreeWidgetItem* ) ),
- this, SLOT( onItemExpanded( QTreeWidgetItem* ) ) );
- connect( myTreeObjects, SIGNAL( itemSelectionChanged() ),
- this, SLOT( onItemSelectionChanged() ) );
-
- connect( myTreeObjects->header(), SIGNAL( sectionClicked( int ) ), this, SLOT( onHeaderClicked( int ) ) );
-
connect( buttonShow, SIGNAL( clicked() ), this, SLOT( clickOnShow() ) );
connect( buttonShowOnly, SIGNAL( clicked() ), this, SLOT( clickOnShowOnly() ) );
connect( buttonHide, SIGNAL( clicked() ), this, SLOT( clickOnHide() ) );
connect( buttonPublish, SIGNAL( clicked() ), this, SLOT( clickOnPublish() ) );
-
connect( buttonClose, SIGNAL( clicked() ), this, SLOT( reject() ) );
connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( clickOnHelp() ) );
-
- connect( myApp->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( onViewSelectionChanged() ) );
-
- connect( myApp->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
- this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
-
- if ( myViewWindow )
- connect( myViewWindow->getViewManager(), SIGNAL( deleteView( SUIT_ViewWindow* ) ),
- this, SLOT( onCloseView( SUIT_ViewWindow* ) ), Qt::UniqueConnection );
+ connect( aShowAllBtn, SIGNAL( clicked() ), this, SLOT( clickOnShowAll() ) );
+ connect( aHideAllBtn, SIGNAL( clicked() ), this, SLOT( clickOnHideAll() ) );
init();
}
// no need to delete child widgets, Qt does it all for us
}
+//=================================================================================
+// function : createTreeWidget()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::createTreeWidget(QTreeWidget *&theTreeObjects)
+{
+ theTreeObjects = new QTreeWidget(this);
+ theTreeObjects->setColumnCount(2);
+ QStringList columnNames;
+ columnNames.append(tr("GEOM_INSPECT_OBJECT_NAME"));
+ columnNames.append("");
+ theTreeObjects->setHeaderLabels(columnNames);
+ QTreeWidgetItem* headerItem = new QTreeWidgetItem(columnNames);
+
+ headerItem->setIcon(1, myInvisible);
+ theTreeObjects->setHeaderItem(headerItem);
+ theTreeObjects->header()->moveSection(1, 0);
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
+ theTreeObjects->header()->setClickable(true);
+ theTreeObjects->header()->setMovable(false);
+ theTreeObjects->header()->setResizeMode( 1, QHeaderView::ResizeToContents);
+#else
+ theTreeObjects->header()->setSectionsClickable(true);
+ theTreeObjects->header()->setSectionsMovable(false);
+ theTreeObjects->header()->setSectionResizeMode( 1, QHeaderView::ResizeToContents);
+#endif
+ theTreeObjects->setSelectionMode(QAbstractItemView::ExtendedSelection);
+ theTreeObjects->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::EditKeyPressed);
+ // set custom item delegate
+ theTreeObjects->setItemDelegate(new Delegate(theTreeObjects));
+}
+
//=================================================================================
// function : init()
// purpose : initialize dialog data
//=================================================================================
void RepairGUI_InspectObjectDlg::init()
{
- //get shape from selection
- SALOME_ListIO selected;
- myApp->selectionMgr()->selectedObjects(selected);
+ myTolFilterGrp->setChecked(false);
+ myComparisonCompo->addItem(">", GEOMUtils::CC_GT);
+ myComparisonCompo->addItem(">=", GEOMUtils::CC_GE);
+ myComparisonCompo->addItem("<", GEOMUtils::CC_LT);
+ myComparisonCompo->addItem("<=", GEOMUtils::CC_LE);
- if ( selected.Extent() != 1 )
- return;
-
- if ( !myViewWindow ) {
- SUIT_ViewManager* occVm = myApp->getViewManager( OCCViewer_Viewer::Type(), true );
- myViewWindow = occVm->getActiveView();
- connect( occVm, SIGNAL( deleteView( SUIT_ViewWindow* ) ),
- this, SLOT( onCloseView( SUIT_ViewWindow* ) ), Qt::UniqueConnection );
- }
+ initSpinBox(myTolEdit, 0., 100., DEFAULT_TOLERANCE_VALUE, "len_tol_precision");
+ myTolEdit->setValue(DEFAULT_TOLERANCE_VALUE);
- TopoDS_Shape aShape = GEOMBase::GetTopoFromSelection( selected );
- if ( aShape.IsNull() )
- return;
+ // Signals and slots connections
+ initTreeWidget(myTreeObjects);
+ initTreeWidget(myFilteredTreeObjects);
+ myCurrentTreeObjects = myTreeObjects;
+ myMaxTolResetBtn->setEnabled(false);
+ myMinTolResetBtn->setEnabled(false);
+
+ connect(myMinTolResetBtn, SIGNAL(clicked()), this, SLOT(clickOnResetToMin()));
+ connect(myMaxTolResetBtn, SIGNAL(clicked()), this, SLOT(clickOnResetToMax()));
+ connect(myShapeTypeBtnGrp, SIGNAL(buttonClicked(int)), this, SLOT(onInitFilteredData()));
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(reject()));
+
+ connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
+ this, SLOT( onViewSelectionChanged() ) );
- Handle(SALOME_InteractiveObject) anIO = selected.First();
- GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( anIO );
- QString aName = anObject->GetName();
- CORBA::String_var anEntry = anObject->GetStudyEntry();
+ connect( myGeomGUI->getApp()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
+ this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
- myEditMainShape->setText( aName );
- myEditMainShape->setEnabled( false );
+ // Connect signals and slots for filter group box elements.
+ connect(myTolFilterGrp, SIGNAL(toggled(bool)),
+ this, SLOT(onFilterToggled(bool)));
+ connect(myComparisonCompo, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(onFilterData()));
+ connect(myTolEdit, SIGNAL(valueChanged(double)),
+ this, SLOT(onFilterData()));
- // remember initial transparency value
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
- QVariant v = aStudy->getObjectProperty( myViewWindow->getViewManager()->getGlobalId(),
- QString( anEntry.in() ),
- GEOM::propertyName( GEOM::Transparency ), myTransparency );
- if ( v.canConvert( QVariant::Double ) )
- myTransparency = v.toDouble();
+ if ( myViewWindow )
+ connect( myViewWindow->getViewManager(), SIGNAL( deleteView( SUIT_ViewWindow* ) ),
+ this, SLOT( onCloseView( SUIT_ViewWindow* ) ), Qt::UniqueConnection );
- TreeWidgetItem* anItem = new TreeWidgetItem( myTreeObjects, QStringList() << aName, aShape, anIO );
- if ( getDisplayer()->IsDisplayed( anEntry.in() ) )
- anItem->setVisible( true, myVisible );
- else
- anItem->setVisible( false, myInvisible );
+ // Initialize the dialog with current selection.
+ onViewSelectionChanged();
+}
- setMainObjectTransparency( 0.5 );
+//=================================================================================
+// function : initSpinBox()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::initSpinBox(SalomeApp_DoubleSpinBox* spinBox,
+ double min, double max,
+ double step, const char* quantity)
+{
+ // Obtain precision from preferences
+ SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+ int aPrecision = resMgr->integerValue( "Geometry", quantity, 6 );
+
+ spinBox->setPrecision( aPrecision );
+ spinBox->setDecimals( qAbs( aPrecision ) ); // it's necessary to set decimals before the range setting,
+ // by default Qt rounds boundaries to 2 decimals at setRange
+ spinBox->setRange( min, max );
+ spinBox->setSingleStep( step );
+
+ // Add a hint for the user saying how to tune precision
+ QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() );
+ spinBox->setProperty( "validity_tune_hint",
+ QVariant( QObject::tr( "GEOM_PRECISION_HINT" ).arg( userPropName ) ) );
+}
- // add sub-objects in the tree
- addSubObjects( anItem );
+//=================================================================================
+// function : initTreeWidget()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::initTreeWidget(QTreeWidget *theTreeObjects)
+{
+ connect(theTreeObjects, SIGNAL(itemClicked (QTreeWidgetItem *, int)),
+ this, SLOT(onItemClicked(QTreeWidgetItem *, int)));
+ connect(theTreeObjects, SIGNAL(itemChanged (QTreeWidgetItem *, int)),
+ this, SLOT(onItemChanged(QTreeWidgetItem *, int)));
+ connect(theTreeObjects, SIGNAL(itemExpanded (QTreeWidgetItem *)),
+ this, SLOT(onItemExpanded(QTreeWidgetItem *)));
+ connect(theTreeObjects, SIGNAL(itemSelectionChanged()),
+ this, SLOT(onItemSelectionChanged()));
+
+ connect(theTreeObjects->header(), SIGNAL(sectionClicked(int)),
+ this, SLOT(onHeaderClicked(int)));
+}
- // check icon for tree header
- checkVisibleIcon();
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::enterEvent (QEvent*)
+{
+ if (!myTolFilterGrp->isEnabled())
+ ActivateThisDialog();
}
//=================================================================================
void RepairGUI_InspectObjectDlg::checkVisibleIcon()
{
bool isInvisible = false;
- QTreeWidgetItemIterator it( myTreeObjects );
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
while ( *it ) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
- if ( !anItem->isVisible() )
+ if ( !anItem->isHidden() && !anItem->isVisible() ) {
isInvisible = true;
+ break;
+ }
++it;
}
if ( isInvisible ) {
- myTreeObjects->headerItem()->setIcon( 1, myInvisible );
+ myCurrentTreeObjects->headerItem()->setIcon( 1, myInvisible );
myIsSelectAll = false;
}
else {
- myTreeObjects->headerItem()->setIcon( 1, myVisible );
+ myCurrentTreeObjects->headerItem()->setIcon( 1, myVisible );
myIsSelectAll = true;
}
}
// function : addSubObjects()
// purpose : add sub-objects to parent object in the tree
//=================================================================================
-void RepairGUI_InspectObjectDlg::addSubObjects( TreeWidgetItem* theParentItem )
+void RepairGUI_InspectObjectDlg::addSubObjects
+ (TreeWidgetItem *theParentItem,
+ const TopTools_IndexedMapOfShape &theIndices)
{
TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myTreeObjects->topLevelItem(0) );
TopoDS_Iterator it( theParentItem->getShape() );
for ( ; it.More(); it.Next() ) {
TopoDS_Shape aSubShape = it.Value();
- int anIndex = GEOMBase::GetIndex( aSubShape, aMainItem->getShape() );
+ int anIndex = theIndices.FindIndex(aSubShape);
QString anEntry = QString( "TEMP_" ) + aMainItem->getIO()->getEntry() + QString("_%1").arg( anIndex );
TreeWidgetItem* anItem = new TreeWidgetItem( theParentItem, QStringList(), aSubShape, anEntry);
anItem->setVisible( false, myInvisible );
- addSubObjects( anItem );
+ addSubObjects(anItem, theIndices);
+ }
+}
+
+//=================================================================================
+// function : onInitFilteredData()
+// purpose : add sub-objects to parent object in the filtered tree
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onInitFilteredData()
+{
+ TreeWidgetItem *aMainItem =
+ dynamic_cast<TreeWidgetItem*>(myFilteredTreeObjects->topLevelItem(0));
+
+ if (!aMainItem) {
+ return;
+ }
+
+ // Remove the children.
+ SALOME_ListIO aListOfIO;
+ QTreeWidgetItemIterator it(aMainItem);
+
+ while (*it) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
+ if (aMainItem != anItem && (anItem->flags() & Qt::ItemIsSelectable) &&
+ anItem->isVisible() && !anItem->isHidden()) {
+ aListOfIO.Append(anItem->getIO());
+ }
+
+ ++it;
+ }
+
+ myFilteredTreeObjects->clearSelection();
+ myFilteredTreeObjects->headerItem()->setIcon(1, myInvisible);
+ getDisplayer()->Erase(aListOfIO);
+ getDisplayer()->UpdateViewer();
+
+ // Delete child items.
+ QList<QTreeWidgetItem *> aListItems = aMainItem->takeChildren();
+
+ foreach (QTreeWidgetItem *anItem, aListItems) {
+ delete anItem;
+ }
+
+ // Initialize the tree with a new list.
+ TopoDS_Shape aShape = aMainItem->getShape();
+ TopAbs_ShapeEnum aShapeType = aShape.ShapeType();
+
+ myShapeTypeBtnGrp->button(TYPE_FACE)->setVisible(aShapeType < TYPE_FACE);
+ myShapeTypeBtnGrp->button(TYPE_EDGE)->setVisible(aShapeType < TYPE_EDGE);
+ myShapeTypeBtnGrp->button(TYPE_VERTEX)->setVisible(aShapeType < TYPE_VERTEX);
+
+ int anId = myShapeTypeBtnGrp->checkedId();
+
+ myMaxTol = -RealLast();
+ myMinTol = RealLast();
+
+ if (anId != -1 && myShapeTypeBtnGrp->checkedButton()->isVisible()) {
+ // Get sub-shapes
+ TopTools_MapOfShape aMapFence;
+ TopExp_Explorer anExp(aShape, (TopAbs_ShapeEnum)anId);
+ TopTools_IndexedMapOfShape anIndices;
+
+ TopExp::MapShapes(aShape, anIndices);
+
+ for (; anExp.More(); anExp.Next()) {
+ const TopoDS_Shape &aSubShape = anExp.Current();
+
+ if (aMapFence.Add(aSubShape)) {
+ // Compute tolerance
+ Standard_Real aTolerance = -1.;
+
+ switch (aSubShape.ShapeType()) {
+ case TYPE_FACE:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Face(aSubShape));
+ break;
+ case TYPE_EDGE:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Edge(aSubShape));
+ break;
+ case TYPE_VERTEX:
+ aTolerance = BRep_Tool::Tolerance(TopoDS::Vertex(aSubShape));
+ break;
+ default:
+ break;
+ }
+
+ if (aTolerance < 0.) {
+ continue;
+ }
+
+ if (aTolerance > myMaxTol) {
+ myMaxTol = aTolerance;
+ }
+
+ if (aTolerance < myMinTol) {
+ myMinTol = aTolerance;
+ }
+
+ int anIndex = anIndices.FindIndex(aSubShape);
+ QString anEntry = QString( "TEMP_" ) +
+ aMainItem->getIO()->getEntry() +
+ QString::number(anIndex);
+ TreeWidgetItem* anItem =
+ new TreeWidgetItem(aMainItem, QStringList(),
+ aSubShape, anEntry, aTolerance);
+ anItem->setVisible( false, myInvisible );
+ }
+ }
+ }
+
+ // Compose names of sub-items if the main item is expanded.
+ if (aMainItem->isExpanded()) {
+ onItemExpanded(aMainItem);
+ }
+
+ myMaxTolResetBtn->setEnabled(myMaxTol >= myMinTol);
+ myMinTolResetBtn->setEnabled(myMaxTol >= myMinTol);
+
+ if (myMaxTol < myMinTol) {
+ myMinTol = DEFAULT_TOLERANCE_VALUE;
+ myMaxTol = DEFAULT_TOLERANCE_VALUE;
+ myMinTolValLabel->setText(QString::number(DEFAULT_TOLERANCE_VALUE));
+ myMaxTolValLabel->setText(QString::number(DEFAULT_TOLERANCE_VALUE));
+ myTolEdit->setValue(DEFAULT_TOLERANCE_VALUE);
+ } else {
+ myMinTolValLabel->setText(QString::number(myMinTol));
+ myMaxTolValLabel->setText(QString::number(myMaxTol));
+
+ if (GEOMUtils::CompareToleranceValues(myMinTol, myTolEdit->value()) == 1) {
+ clickOnResetToMin();
+ } else if (GEOMUtils::CompareToleranceValues
+ (myMaxTol, myTolEdit->value()) == -1) {
+ clickOnResetToMax();
+ } else {
+ onFilterData();
+ }
}
}
+//=================================================================================
+// function : onFilterData()
+// purpose : filter objects in the filtered tree
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onFilterData()
+{
+ TreeWidgetItem *aMainItem =
+ dynamic_cast<TreeWidgetItem*>(myFilteredTreeObjects->topLevelItem(0));
+
+ if (!aMainItem) {
+ return;
+ }
+
+ SALOME_ListIO aListOfIOToHide;
+ QTreeWidgetItemIterator anIt(aMainItem);
+ const int aCompValue =
+ myComparisonCompo->itemData(myComparisonCompo->currentIndex()).toInt();
+ const double aTolValue = myTolEdit->value();
+
+ while (*anIt) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*anIt);
+
+ if (aMainItem != anItem) {
+ const bool isToFilter = !GEOMUtils::IsFitCondition
+ ((GEOMUtils::ComparisonCondition) aCompValue,
+ anItem->getTolerance(), aTolValue);
+
+ if (isToFilter && !anItem->isHidden()) {
+ if (anItem->isVisible()) {
+ aListOfIOToHide.Append(anItem->getIO());
+ }
+
+ anItem->setVisible(false, myInvisible);
+ }
+
+ anItem->setHidden(isToFilter);
+ }
+
+ ++anIt;
+ }
+
+ if (!aListOfIOToHide.IsEmpty()) {
+ getDisplayer()->Erase(aListOfIOToHide);
+ getDisplayer()->UpdateViewer();
+ }
+
+ checkVisibleIcon();
+}
+
//=================================================================================
// function : displayItem()
// purpose : display sub-object of inspected object according its tree item
void RepairGUI_InspectObjectDlg::displayItem( TreeWidgetItem* theItem )
{
GEOM_Displayer* aDisplayer = getDisplayer();
- if ( theItem == myTreeObjects->topLevelItem(0) ) {
+ if ( theItem == myCurrentTreeObjects->topLevelItem(0) ) {
aDisplayer->UnsetColor();
aDisplayer->UnsetWidth();
}
//=================================================================================
void RepairGUI_InspectObjectDlg::setItemDisplayStatus( TreeWidgetItem* theItem, bool theIsVisible )
{
- QTreeWidgetItemIterator it( myTreeObjects );
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
while (*it) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
if ( anItem->getShape().IsSame( theItem->getShape() ) )
{
SUIT_ViewManager* aViewMan = myViewWindow->getViewManager();
SALOME_View* aView = dynamic_cast<SALOME_View*>( aViewMan->getViewModel() );
- SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( myGeomGUI->getApp()->activeStudy() );
+
+ TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myCurrentTreeObjects->topLevelItem(0) );
+
+ if (!aMainItem) {
+ return;
+ }
- TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myTreeObjects->topLevelItem(0) );
aStudy->setObjectProperty( myViewWindow->getViewManager()->getGlobalId(),
QString( aMainItem->getIO()->getEntry() ),
GEOM::propertyName( GEOM::Transparency ), theTransparency );
setMainObjectTransparency( myTransparency );
// erase sub-shapes
- TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myTreeObjects->topLevelItem(0) );
- QTreeWidgetItemIterator it( myTreeObjects );
+ TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myCurrentTreeObjects->topLevelItem(0) );
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
while (*it) {
if ( *it != aMainItem ) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
myEditMainShape->setText("");
myEditMainShape->setFocus();
myTreeObjects->clear();
+ myFilteredTreeObjects->clear();
}
//=================================================================================
return;
// rename the same items in the tree
- QTreeWidgetItemIterator it( myTreeObjects );
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
while ( *it ) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
if ( anItem->getShape().IsSame( dynamic_cast<TreeWidgetItem*>( theItem )->getShape() ) )
//=================================================================================
void RepairGUI_InspectObjectDlg::onItemExpanded( QTreeWidgetItem* theItem )
{
- TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myTreeObjects->topLevelItem(0) );
+ TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myCurrentTreeObjects->topLevelItem(0) );
GEOM::GEOM_Object_var aMainObject = GEOMBase::ConvertIOinGEOMObject( aMainItem->getIO() );
for ( int i = 0; i < theItem->childCount(); i++ ) {
if ( !myViewWindow )
return;
- QList<QTreeWidgetItem*> listItem = myTreeObjects->selectedItems();
+ QList<QTreeWidgetItem*> listItem = myCurrentTreeObjects->selectedItems();
SALOME_ListIO aSelected;
for ( int i = 0; i < listItem.size(); i++ ) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>( listItem.at(i) );
aSelected.Append( anItem->getIO() );
}
- myApp->selectionMgr()->setSelectedObjects( aSelected );
+ myGeomGUI->getApp()->selectionMgr()->setSelectedObjects( aSelected );
}
//=================================================================================
if ( myIsSelectAll ) {
myIsSelectAll = false;
- myTreeObjects->headerItem()->setIcon( 1, myInvisible );
+ myCurrentTreeObjects->headerItem()->setIcon( 1, myInvisible );
SALOME_ListIO aListOfIO;
- QTreeWidgetItemIterator it( myTreeObjects );
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
while ( *it ) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
- if ( ( anItem->flags() & Qt::ItemIsSelectable ) && anItem->isVisible() ) {
+ if ( !anItem->isHidden() && ( anItem->flags() & Qt::ItemIsSelectable ) &&
+ anItem->isVisible() ) {
aListOfIO.Append( anItem->getIO() );
anItem->setVisible( false, myInvisible );
}
}
else {
myIsSelectAll = true;
- myTreeObjects->headerItem()->setIcon( 1, myVisible );
- QTreeWidgetItemIterator it( myTreeObjects );
+ myCurrentTreeObjects->headerItem()->setIcon( 1, myVisible );
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
while ( *it ) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
- if ( ( anItem->flags() & Qt::ItemIsSelectable ) && !anItem->isVisible() ) {
+ if ( !anItem->isHidden() && ( anItem->flags() & Qt::ItemIsSelectable ) &&
+ !anItem->isVisible() ) {
displayItem( anItem );
anItem->setVisible( true, myVisible );
}
//=================================================================================
void RepairGUI_InspectObjectDlg::onViewSelectionChanged()
{
- if ( myEditMainShape->isEnabled() )
- init();
+ if (!myEditMainShape->isEnabled())
+ return;
+
+ //get shape from selection
+ SALOME_ListIO selected;
+ myGeomGUI->getApp()->selectionMgr()->selectedObjects(selected);
+
+ if ( selected.Extent() != 1 )
+ return;
+
+ if ( !myViewWindow ) {
+ SUIT_ViewManager* occVm = myGeomGUI->getApp()->getViewManager( OCCViewer_Viewer::Type(), true );
+ myViewWindow = occVm->getActiveView();
+ connect( occVm, SIGNAL( deleteView( SUIT_ViewWindow* ) ),
+ this, SLOT( onCloseView( SUIT_ViewWindow* ) ), Qt::UniqueConnection );
+ }
+
+ TopoDS_Shape aShape = GEOMBase::GetTopoFromSelection( selected );
+ if ( aShape.IsNull() )
+ return;
+
+ Handle(SALOME_InteractiveObject) anIO = selected.First();
+ GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( anIO );
+ QString aName = anObject->GetName();
+ CORBA::String_var anEntry = anObject->GetStudyEntry();
+
+ myEditMainShape->setText( aName );
+ myEditMainShape->setEnabled( false );
+
+ // remember initial transparency value
+ SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( myGeomGUI->getApp()->activeStudy() );
+ QVariant v = aStudy->getObjectProperty( myViewWindow->getViewManager()->getGlobalId(),
+ QString( anEntry.in() ),
+ GEOM::propertyName( GEOM::Transparency ), myTransparency );
+ if ( v.canConvert( QVariant::Double ) )
+ myTransparency = v.toDouble();
+
+ TreeWidgetItem* anItem = new TreeWidgetItem
+ (myTreeObjects, QStringList() << aName, aShape, anIO);
+ TreeWidgetItem* anItemFiltered = new TreeWidgetItem
+ (myFilteredTreeObjects, QStringList() << aName, aShape, anIO);
+
+ if ( getDisplayer()->IsDisplayed( anEntry.in() ) ) {
+ anItem->setVisible( true, myVisible );
+ anItemFiltered->setVisible( true, myVisible );
+ } else {
+ anItem->setVisible( false, myInvisible );
+ anItemFiltered->setVisible( false, myInvisible );
+ }
+
+ setMainObjectTransparency( 0.5 );
+
+ // add sub-objects in the tree
+ TopTools_IndexedMapOfShape anIndices;
+
+ TopExp::MapShapes(aShape, anIndices);
+ addSubObjects(anItem, anIndices);
+ onInitFilteredData();
+ updateViewer(false);
+
+ // check icon for tree header
+ checkVisibleIcon();
}
//=================================================================================
}
myViewWindow = theViewWindow;
- if ( myTreeObjects->topLevelItemCount() > 0 ) {
+ if ( myCurrentTreeObjects->topLevelItemCount() > 0 ) {
setMainObjectTransparency( 0.5 );
- TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myTreeObjects->topLevelItem(0) );
+ TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myCurrentTreeObjects->topLevelItem(0) );
if ( getDisplayer()->IsDisplayed( aMainItem->getIO()->getEntry() ) )
aMainItem->setVisible( true, myVisible );
else
//=================================================================================
void RepairGUI_InspectObjectDlg::onCloseView( SUIT_ViewWindow* )
{
- if ( myApp->desktop()->windows().size() == 0 ) {
+ if ( myGeomGUI->getApp()->desktop()->windows().size() == 0 ) {
restoreParam();
myViewWindow = 0;
}
if ( !myViewWindow )
return;
- QList<QTreeWidgetItem*> listItem = myTreeObjects->selectedItems();
+ QList<QTreeWidgetItem*> listItem = myCurrentTreeObjects->selectedItems();
for ( int i = 0; i < listItem.size(); i++ ) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>( listItem.at(i) );
if ( !anItem->isVisible() ) {
return;
SALOME_ListIO aListOfIO;
- QTreeWidgetItemIterator it( myTreeObjects );
+ QTreeWidgetItemIterator it( myCurrentTreeObjects );
while ( *it ) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
- if ( ( anItem->flags() & Qt::ItemIsSelectable ) && anItem->isVisible() ) {
+ if ( !anItem->isHidden() && ( anItem->flags() & Qt::ItemIsSelectable ) &&
+ anItem->isVisible() ) {
aListOfIO.Append( anItem->getIO() );
anItem->setVisible( false, myInvisible );
}
if ( !myViewWindow )
return;
- QList<QTreeWidgetItem*> listItem = myTreeObjects->selectedItems();
+ QList<QTreeWidgetItem*> listItem = myCurrentTreeObjects->selectedItems();
for ( int i = 0; i < listItem.size(); i++ ) {
TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>( listItem.at(i) );
if ( anItem->isVisible() ) {
//=================================================================================
void RepairGUI_InspectObjectDlg::clickOnPublish()
{
- _PTR(Study) studyDS = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() )->studyDS();
+ _PTR(Study) studyDS = dynamic_cast<SalomeApp_Study*>( myGeomGUI->getApp()->activeStudy() )->studyDS();
// find main object
- TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myTreeObjects->topLevelItem(0) );
+ TreeWidgetItem* aMainItem = dynamic_cast<TreeWidgetItem*>( myCurrentTreeObjects->topLevelItem(0) );
+
+ if (!aMainItem) {
+ return;
+ }
+
GEOM::GEOM_Object_var aMainObject = GEOMBase::ConvertIOinGEOMObject( aMainItem->getIO() );
// find unique indices of selected objects
- QList<QTreeWidgetItem*> selectedItems = myTreeObjects->selectedItems();
+ QList<QTreeWidgetItem*> selectedItems = myCurrentTreeObjects->selectedItems();
QMap< int, QString > anIndices;
GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
anArray->length( selectedItems.size() );
//=================================================================================
void RepairGUI_InspectObjectDlg::clickOnHelp()
{
- myApp->onHelpContextModule( "GEOM", "inspect_object_operation_page.html" );
+ myGeomGUI->getApp()->onHelpContextModule( "GEOM", "inspect_object_operation_page.html" );
+}
+
+//=================================================================================
+// function : clickOnResetToMin()
+// purpose : called when Reset button was clicked to reset tolerance filter to minimal value.
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnResetToMin()
+{
+ if (myMinTol >= myTolEdit->minimum() && myMinTol <= myTolEdit->maximum()) {
+ myTolEdit->setValue(myMinTol);
+ }
+}
+
+//=================================================================================
+// function : clickOnResetToMax()
+// purpose : called when Reset button was clicked to reset tolerance filter to maximal value.
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnResetToMax()
+{
+ if (myMaxTol >= myTolEdit->minimum() && myMaxTol <= myTolEdit->maximum()) {
+ myTolEdit->setValue(myMaxTol);
+ }
+}
+
+//=================================================================================
+// function : clickOnShowAll()
+// purpose : called when Help button was clicked to show all shapes
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnShowAll()
+{
+ myIsSelectAll = false;
+ onHeaderClicked(1);
+}
+
+//=================================================================================
+// function : clickOnHideAll()
+// purpose : called when Help button was clicked to hide all shapes
+//=================================================================================
+void RepairGUI_InspectObjectDlg::clickOnHideAll()
+{
+ myIsSelectAll = true;
+ onHeaderClicked(1);
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::DeactivateActiveDialog()
+{
+ setEnabled(false);
+ disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+ myGeomGUI->SetActiveDialogBox(0);
+ globalSelection();
+ erasePreview();
+}
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::ActivateThisDialog()
+{
+ /* Emit a signal to deactivate the active dialog */
+ myGeomGUI->EmitSignalDeactivateDialog();
+ setEnabled(true);
+ myGeomGUI->SetActiveDialogBox( (QDialog*)this );
+
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(onViewSelectionChanged()));
+
+ updateViewer(false);
+}
+
+//=================================================================================
+// function : onFilterToggled()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::onFilterToggled(bool isOn)
+{
+ if (isOn) {
+ myCurrentTreeObjects = myFilteredTreeObjects;
+ myTreesLayout->setCurrentIndex(1);
+ } else {
+ myCurrentTreeObjects = myTreeObjects;
+ myTreesLayout->setCurrentIndex(0);
+ }
+
+ updateViewer(true);
+}
+
+//=================================================================================
+// function : updateViewer()
+// purpose :
+//=================================================================================
+void RepairGUI_InspectObjectDlg::updateViewer(const bool theIsHideOtherTree)
+{
+ GEOM_Displayer *aDisplayer = getDisplayer();
+
+ if (theIsHideOtherTree) {
+ QTreeWidget *aTreeToHide = myCurrentTreeObjects == myTreeObjects ?
+ myFilteredTreeObjects: myTreeObjects;
+
+ // Hide the objects of disappeared tree, do not switch off flags.
+ SALOME_ListIO aListOfIO;
+ QTreeWidgetItemIterator it(aTreeToHide);
+
+ while (*it) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it);
+ if ((anItem->flags() & Qt::ItemIsSelectable) &&
+ anItem->isVisible() && !anItem->isHidden()) {
+ aListOfIO.Append(anItem->getIO());
+ }
+
+ ++it;
+ }
+
+ aDisplayer->Erase(aListOfIO);
+ }
+
+ // Show the objects that are marked as shown in the appeared tree.
+ QTreeWidgetItemIterator it2(myCurrentTreeObjects);
+
+ while (*it2) {
+ TreeWidgetItem* anItem = dynamic_cast<TreeWidgetItem*>(*it2);
+ if ((anItem->flags() & Qt::ItemIsSelectable) &&
+ anItem->isVisible() && !anItem->isHidden()) {
+ displayItem(anItem);
+ }
+
+ ++it2;
+ }
+
+ aDisplayer->UpdateViewer();
}
// Qt includes
#include <QDialog>
-#include <QTreeWidget>
-#include <QLabel>
-#include <QLineEdit>
#include <QPointer>
+#include <QIcon>
+
+class GeometryGUI;
+class SalomeApp_DoubleSpinBox;
+
+class QButtonGroup;
+class QComboBox;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QPushButton;
+class QStackedLayout;
+class QTreeWidget;
+class QTreeWidgetItem;
+
+class TopTools_IndexedMapOfShape;
class RepairGUI_InspectObjectDlg : public QDialog, public GEOMBase_Helper
{
class Delegate;
public:
- RepairGUI_InspectObjectDlg( SUIT_Desktop* );
+ RepairGUI_InspectObjectDlg(GeometryGUI*, SUIT_Desktop* );
~RepairGUI_InspectObjectDlg();
private slots:
void clickOnHide();
void clickOnPublish();
void clickOnHelp();
+ void clickOnResetToMin();
+ void clickOnResetToMax();
+ void clickOnShowAll();
+ void clickOnHideAll();
+ void DeactivateActiveDialog();
+ void ActivateThisDialog();
+ void onFilterToggled(bool);
+ void onInitFilteredData();
+ void onFilterData();
private:
+ void createTreeWidget(QTreeWidget *&theTreeObjects);
void init();
+ void initSpinBox(SalomeApp_DoubleSpinBox* spinBox,
+ double min, double max,
+ double step, const char* quantity);
+ void initTreeWidget(QTreeWidget *theTopLevelItem);
+ void enterEvent( QEvent* );
void checkVisibleIcon();
- void addSubObjects( TreeWidgetItem* );
+ void addSubObjects( TreeWidgetItem*, const TopTools_IndexedMapOfShape &);
+
void displayItem( TreeWidgetItem* );
void setItemDisplayStatus( TreeWidgetItem* theItem, bool theIsVisible );
void setMainObjectTransparency( double );
void restoreParam();
+ void updateViewer(const bool theIsHideOtherTree);
- SalomeApp_Application* myApp;
QPointer<SUIT_ViewWindow> myViewWindow;
+ GeometryGUI* myGeomGUI;
QIcon myVisible;
QIcon myInvisible;
- QTreeWidget* myTreeObjects;
- QLineEdit* myEditMainShape;
-
+ QTreeWidget *myTreeObjects;
+ QTreeWidget *myFilteredTreeObjects;
+ QTreeWidget *myCurrentTreeObjects;
+ QLineEdit *myEditMainShape;
+ QGroupBox *myTolFilterGrp;
+ QButtonGroup *myShapeTypeBtnGrp;
+ QComboBox *myComparisonCompo;
+ SalomeApp_DoubleSpinBox *myTolEdit;
+ QLabel *myMinTolValLabel;
+ QLabel *myMaxTolValLabel;
+ QStackedLayout *myTreesLayout;
+ QPushButton *myMinTolResetBtn;
+ QPushButton *myMaxTolResetBtn;
+ double myMaxTol;
+ double myMinTol;
bool myIsSelectAll;
double myTransparency;
//myOpList->setCurrentRow( myOpList->findItem( 0 );
reset();
- myStack->setCurrentIndex( 0 );
+ myOpList->setCurrentRow(0);
initName( tr( "PROCESS_SHAPE_NEW_OBJ_NAME" ));
selectionChanged();
#
IF(SALOME_BUILD_GUI)
- INCLUDE(UseQt4Ext)
- INCLUDE(${QT_USE_FILE})
+ INCLUDE(UseQtExt)
ENDIF()
# --- options ---
IF(SALOME_BUILD_GUI)
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/OBJECT
${PROJECT_SOURCE_DIR}/src/GEOMGUI
STEPPlugin_IExport.hxx
STEPPlugin_IImport.hxx
STEPPlugin_ImportDriver.hxx
+ STEPPlugin_ExportDlg.h
STEPPlugin_ExportDriver.hxx
STEPPlugin_IECallBack.hxx
)
# header files / to be processed by moc
SET(_moc_HEADERS
STEPPlugin_GUI.h
+ STEPPlugin_ExportDlg.h
)
ENDIF()
IF(SALOME_BUILD_GUI)
# sources / moc wrappings
- QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+ QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(STEPPluginGUI_SOURCES
STEPPlugin_GUI.cxx
+ STEPPlugin_ExportDlg.cxx
${_moc_SOURCES}
)
ENDIF()
TARGET_LINK_LIBRARIES(STEPPluginGUI ${_link_gui_LIBRARIES})
INSTALL(TARGETS STEPPluginGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
- QT4_INSTALL_TS_RESOURCES("${STEPPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
+ QT_INSTALL_TS_RESOURCES("${STEPPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
ENDIF()
--- /dev/null
+// Copyright (C) 2014-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
+//
+
+#include "STEPPlugin_ExportDlg.h"
+
+#include <QApplication>
+#include <QLabel>
+#include <QLayout>
+#include <QComboBox>
+
+//=============================================================================
+// Constructor
+//=============================================================================
+STEPPlugin_ExportDlg::STEPPlugin_ExportDlg(QWidget *parent)
+ : SUIT_FileDlg (parent, false, true, true),
+ myUnitCB (0)
+{
+ QLabel* aUnitLabel = new QLabel(tr("STEP_LENGTH_UNITS"), this);
+
+ myUnitCB = new QComboBox(this);
+ myUnitCB->addItem(tr("STEP_UNITS_KILOMETER"), GEOM::LU_KILOMETER);
+ myUnitCB->addItem(tr("STEP_UNITS_METER"), GEOM::LU_METER);
+ myUnitCB->addItem(tr("STEP_UNITS_CENTIMETER"), GEOM::LU_CENTIMETER);
+ myUnitCB->addItem(tr("STEP_UNITS_MILLIMETER"), GEOM::LU_MILLIMETER);
+ myUnitCB->addItem(tr("STEP_UNITS_MICROMETER"), GEOM::LU_MICROMETER);
+ myUnitCB->addItem(tr("STEP_UNITS_MILE"), GEOM::LU_MILE);
+ myUnitCB->addItem(tr("STEP_UNITS_FOOT"), GEOM::LU_FOOT);
+ myUnitCB->addItem(tr("STEP_UNITS_INCH"), GEOM::LU_INCH);
+ myUnitCB->addItem(tr("STEP_UNITS_MILLIINCH"), GEOM::LU_MILLIINCH);
+ myUnitCB->addItem(tr("STEP_UNITS_MICROINCH"), GEOM::LU_MICROINCH);
+
+ // Meters by default.
+ myUnitCB->setCurrentIndex(1);
+
+ layout()->addWidget(aUnitLabel);
+ layout()->addWidget(myUnitCB);
+}
+
+//=============================================================================
+// Destructor
+//=============================================================================
+STEPPlugin_ExportDlg::~STEPPlugin_ExportDlg()
+{
+}
+
+//=============================================================================
+// getUnits
+//=============================================================================
+GEOM::length_unit STEPPlugin_ExportDlg::getUnits() const
+{
+ const GEOM::length_unit anUnit =
+ (GEOM::length_unit) myUnitCB->itemData(myUnitCB->currentIndex()).toInt();
+
+ return anUnit;
+}
+
+//=============================================================================
+// getFileName
+//=============================================================================
+QString STEPPlugin_ExportDlg::getFileName(const QString &theInitial,
+ const QString &theFilters,
+ const QString &theCaption,
+ QWidget *theParent,
+ GEOM::length_unit &theUnits)
+{
+ QStringList aFls = theFilters.split(";;", QString::SkipEmptyParts);
+ QString aTmpFileName = theInitial;
+
+ aTmpFileName = aTmpFileName.simplified();
+ aTmpFileName =
+ aTmpFileName.replace(QRegExp("\\*"), "").replace(QRegExp("\\?"), "");
+
+ STEPPlugin_ExportDlg aDlg(theParent);
+
+ aDlg.setFileMode(AnyFile);
+ aDlg.setNameFilters(aFls);
+ aDlg.setWindowTitle(theCaption);
+
+ if (!aTmpFileName.isEmpty()) {
+ aDlg.processPath(aTmpFileName);
+ }
+
+ QString aFileName;
+
+ if (aDlg.exec() == QDialog::Accepted) {
+ aFileName = aDlg.selectedFile();
+ theUnits = aDlg.getUnits();
+ }
+
+ QApplication::processEvents();
+
+ return aFileName;
+}
--- /dev/null
+// Copyright (C) 2014-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 STEPPlugin_ExportDlg_H
+#define STEPPlugin_ExportDlg_H
+
+#include <SUIT_FileDlg.h>
+#include <SALOMEconfig.h>
+#include CORBA_CLIENT_HEADER(STEPPlugin)
+
+class QComboBox;
+
+class STEPPlugin_ExportDlg: public SUIT_FileDlg
+{
+ Q_OBJECT
+
+public:
+
+ STEPPlugin_ExportDlg(QWidget *parent);
+ ~STEPPlugin_ExportDlg();
+
+ GEOM::length_unit getUnits() const;
+
+ static QString getFileName(const QString &theInitial,
+ const QString &theFilters,
+ const QString &theCaption,
+ QWidget *theParent,
+ GEOM::length_unit &theUnits);
+
+private:
+
+ QComboBox *myUnitCB;
+
+};
+
+#endif // STEPPlugin_ExportDlg_H
// internal includes
#include "STEPPlugin_ExportDriver.hxx"
#include "STEPPlugin_IExport.hxx"
+#include "STEPPlugin_IOperations.hxx"
// KERNEL includes
#include <utilities.h>
aFunction->SetValue( aShape );
TCollection_AsciiString aFileName = aData.GetFileName();
+ Standard_Integer anUnit = aData.GetUnit();
+ TCollection_AsciiString aWriteUnit;
+
+ switch (anUnit) {
+ case STEPPlugin_IOperations::LengthUnit_Inch:
+ aWriteUnit = "INCH";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Millimeter:
+ aWriteUnit = "MM";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Foot:
+ aWriteUnit = "FT";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Mile:
+ aWriteUnit = "MI";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Meter:
+ aWriteUnit = "M";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Kilometer:
+ aWriteUnit = "KM";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Milliinch:
+ aWriteUnit = "MIL";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Micrometer:
+ aWriteUnit = "UM";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Centimeter:
+ aWriteUnit = "CM";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Microinch:
+ aWriteUnit = "UIN";
+ break;
+ default:
+ return 0;
+ }
MESSAGE("Export STEP into file " << aFileName.ToCString());
//VRV: OCC 4.0 migration
STEPControl_Writer aWriter;
Interface_Static::SetCVal("xstep.cascade.unit","M");
- Interface_Static::SetCVal("write.step.unit", "M");
+ Interface_Static::SetCVal("write.step.unit", aWriteUnit.ToCString());
Interface_Static::SetIVal("write.step.nonmanifold", 1);
status = aWriter.Transfer( aShape, STEPControl_AsIs );
//VRV: OCC 4.0 migration
#include "GEOM_Operation.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
+#include "GEOM_GenericObjPtr.h"
+#include "STEPPlugin_ExportDlg.h"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(STEPPlugin)
+typedef GEOM::GenericObjPtr<GEOM::ISTEPOperations> STEPOpPtr;
+
//=======================================================================
// function : STEPPlugin_GUI()
// purpose : Constructor
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" ),
{
QString fileName = fileNames.at( i );
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, stepOp.in() );
+ GEOM_Operation transaction( app, stepOp.get() );
bool ignoreUnits = false;
try
}
transaction.commit();
GEOM_Displayer( study ).Display( main.in() );
+ main->UnRegister();
}
else
{
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;
if ( CORBA::is_nil( obj ) ) continue;
- QString fileName = app->getFileName( false,
- QString( io->getName() ),
+ GEOM::length_unit anUnit;
+ QString fileName = STEPPlugin_ExportDlg::getFileName
+ (QString( io->getName() ),
tr( "STEP_FILES" ),
tr( "EXPORT_TITLE" ),
- parent );
+ parent, anUnit);
if ( fileName.isEmpty() )
return false;
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, stepOp.in() );
+ GEOM_Operation transaction( app, stepOp.get() );
try
{
app->putInfo( tr( "GEOM_PRP_EXPORT" ).arg( fileName ) );
transaction.start();
- stepOp->ExportSTEP( obj, fileName.toUtf8().constData() );
+ stepOp->ExportSTEP( obj, fileName.toUtf8().constData(), anUnit);
if ( stepOp->IsDone() )
{
const TCollection_AsciiString& theFormatName )
{
STEPPlugin_IOperations* aPluginOperations = STEPPlugin_OperationsCreator::get( GetEngine(), theDocId );
- aPluginOperations->ExportSTEP( theOriginal, theFileName );
+ const STEPPlugin_IOperations::LengthUnit aUnit = STEPPlugin_IOperations::LengthUnit_Meter;
+
+ aPluginOperations->ExportSTEP( theOriginal, theFileName, aUnit );
return true;
}
#define EXPORTSTEP_ARG_ORIGINAL 1
#define EXPORTSTEP_ARG_FILENAME 2
+#define EXPORTSTEP_ARG_UNIT 3
class STEPPlugin_IExport
{
{ _func->SetString( EXPORTSTEP_ARG_FILENAME, theFileName ); }
TCollection_AsciiString GetFileName()
{ return _func->GetString( EXPORTSTEP_ARG_FILENAME ); }
+
+ void SetUnit(const Standard_Integer theUnit)
+ { _func->SetInteger(EXPORTSTEP_ARG_UNIT, theUnit); }
+ Standard_Integer GetUnit()
+ { return _func->GetInteger(EXPORTSTEP_ARG_UNIT); }
private:
Handle(GEOM_Function) _func;
MESSAGE( "STEPPlugin_IOperations::~STEPPlugin_IOperations" );
}
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
+static GEOM::TPythonDump& operator<<
+ (GEOM::TPythonDump &theDump,
+ const STEPPlugin_IOperations::LengthUnit theState)
+{
+ switch (theState) {
+ case STEPPlugin_IOperations::LengthUnit_Inch:
+ theDump << "GEOM.LU_INCH";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Millimeter:
+ theDump << "GEOM.LU_MILLIMETER";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Foot:
+ theDump << "GEOM.LU_FOOT";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Mile:
+ theDump << "GEOM.LU_MILE";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Meter:
+ theDump << "GEOM.LU_METER";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Kilometer:
+ theDump << "GEOM.LU_KILOMETER";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Milliinch:
+ theDump << "GEOM.LU_MILLIINCH";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Micrometer:
+ theDump << "GEOM.LU_MICROMETER";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Centimeter:
+ theDump << "GEOM.LU_CENTIMETER";
+ break;
+ case STEPPlugin_IOperations::LengthUnit_Microinch:
+ theDump << "GEOM.LU_MICROINCH";
+ break;
+ default:
+ break;
+ }
+
+ return theDump;
+}
+
//=============================================================================
/*!
* ExportSTEP
* Export a shape to STEP format
* \param theOriginal The shape to export
* \param theFileName The name of the file to exported
- * \param theIsASCII The format of the exported file (ASCII or Binary)
- * \param theDeflection The deflection of the shape to exported
+ * \param theUnit the length unit
*/
//=============================================================================
-void STEPPlugin_IOperations::ExportSTEP( const Handle(GEOM_Object) theOriginal,
- const TCollection_AsciiString& theFileName )
+void STEPPlugin_IOperations::ExportSTEP
+ (const Handle(GEOM_Object) theOriginal,
+ const TCollection_AsciiString &theFileName,
+ const LengthUnit theUnit)
{
SetErrorCode(KO);
if( theOriginal.IsNull() ) return;
STEPPlugin_IExport aCI( aFunction );
aCI.SetOriginal( aRefFunction );
aCI.SetFileName( theFileName );
+ aCI.SetUnit( theUnit );
//Perform the Export
try {
//Make a Python command
GEOM::TPythonDump(aFunction) << "geompy.ExportSTEP(" << theOriginal << ", \""
- << theFileName.ToCString() << "\" )";
+ << theFileName.ToCString() << "\", " << theUnit << " )";
SetErrorCode(OK);
}
class STEPPLUGINENGINE_EXPORT STEPPlugin_IOperations: public GEOMImpl_IBaseIEOperations
{
+
+public:
+
+ /*!
+ * \brief Units of length
+ */
+ enum LengthUnit
+ {
+ LengthUnit_Inch,
+ LengthUnit_Millimeter,
+ LengthUnit_Foot,
+ LengthUnit_Mile,
+ LengthUnit_Meter,
+ LengthUnit_Kilometer,
+ LengthUnit_Milliinch,
+ LengthUnit_Micrometer,
+ LengthUnit_Centimeter,
+ LengthUnit_Microinch
+ };
+
+
public:
STEPPlugin_IOperations( GEOM_Engine*, int );
~STEPPlugin_IOperations();
void ExportSTEP( const Handle(GEOM_Object),
- const TCollection_AsciiString& );
+ const TCollection_AsciiString&, const LengthUnit );
Handle(TColStd_HSequenceOfTransient) ImportSTEP( const TCollection_AsciiString&,
const bool );
* Export a shape to STEP format
* \param theOriginal The shape to export
* \param theFileName The name of the exported file
+ * \param theUnit the length unit.
*/
//=============================================================================
-void STEPPlugin_IOperations_i::ExportSTEP( GEOM::GEOM_Object_ptr theOriginal,
- const char* theFileName )
+void STEPPlugin_IOperations_i::ExportSTEP(GEOM::GEOM_Object_ptr theOriginal,
+ const char* theFileName,
+ GEOM::length_unit theUnit)
{
// duplicate the original shape
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate( theOriginal );
Handle(GEOM_Object) anOriginal = GetObjectImpl( theOriginal );
if (anOriginal.IsNull()) return;
+ STEPPlugin_IOperations::LengthUnit aUnit;
+
+ switch (theUnit) {
+ case GEOM::LU_INCH:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Inch;
+ break;
+ case GEOM::LU_MILLIMETER:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Millimeter;
+ break;
+ case GEOM::LU_FOOT:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Foot;
+ break;
+ case GEOM::LU_MILE:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Mile;
+ break;
+ case GEOM::LU_METER:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Meter;
+ break;
+ case GEOM::LU_KILOMETER:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Kilometer;
+ break;
+ case GEOM::LU_MILLIINCH:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Milliinch;
+ break;
+ case GEOM::LU_MICROMETER:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Micrometer;
+ break;
+ case GEOM::LU_CENTIMETER:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Centimeter;
+ break;
+ case GEOM::LU_MICROINCH:
+ aUnit = STEPPlugin_IOperations::LengthUnit_Microinch;
+ break;
+ default:
+ return;
+ }
+
//Export the shape to the file
- GetOperations()->ExportSTEP( anOriginal, theFileName );
+ GetOperations()->ExportSTEP( anOriginal, theFileName, aUnit );
}
//=============================================================================
STEPPlugin_IOperations* theImpl );
~STEPPlugin_IOperations_i();
- void ExportSTEP( GEOM::GEOM_Object_ptr, const char* );
+ void ExportSTEP( GEOM::GEOM_Object_ptr, const char*,
+ GEOM::length_unit );
GEOM::ListOfGO* ImportSTEP( const char*, const bool );
char* ReadValue( const char*, const char* );
#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // 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;
}
-
- 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;
+
+ //=============================================================================
+ /*!
+ * 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();
+
+ // create label and set shape
+ if (aResult.IsNull()) {
+ TDF_TagSource aTag;
+
+ aResult = aTag.NewChild(theShapeLabel);
+
+ TNaming_Builder tnBuild (aResult);
+
+ tnBuild.Generated(aShape);
}
+
+ return aResult;
}
- 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");
-
- if (aName->Length() >= aSkipName.Length()) {
- if (aName->String().SubString
- (1, aSkipName.Length()).IsEqual(aSkipName)) {
- isValidName = false;
+ 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;
+ } 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());
+ if (isValidName) {
+ TCollection_ExtendedString aNameExt (aName->ToCString());
- // find target shape
- TopoDS_Shape S = GetShape(theEnti, theTP);
+ // find target shape
+ TopoDS_Shape S = GetShape(theEnti, theTP);
- if (S.IsNull()) {
- return;
- }
+ 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();
+ // 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(S)) {
- TDF_Label L = GetLabel(theEnti, theShapeLabel, aSub);
+ if (aSub.IsPartner(S)) {
+ TDF_Label L = GetLabel(theEnti, theShapeLabel, aSub);
- // set a name
- TDataStd_Name::Set(L, aNameExt);
+ // set a name
+ TDataStd_Name::Set(L, aNameExt);
+ }
}
}
}
-}
-//=============================================================================
-/*!
- * StoreMaterial()
- */
-//=============================================================================
+ //=============================================================================
+ /*!
+ * 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);
+ }
}
}
}
}
}
}
-}
+
+ 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
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 {
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";
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";
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
theError = aFail->GetMessageString();
}
- if (!aValue.IsNull())
- return aValue->String();
- else
- return TCollection_AsciiString();
+ return aValue;
}
Ignoring units will cause model scaling (as dimensions are supposed to be specified in meters).</translation>
</message>
</context>
+<context>
+ <name>STEPPlugin_ExportDlg</name>
+ <message>
+ <source>STEP_LENGTH_UNITS</source>
+ <translation>Length units</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_INCH</source>
+ <translation>inch</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_MILLIMETER</source>
+ <translation>millimeter</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_FOOT</source>
+ <translation>foot</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_MILE</source>
+ <translation>mile</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_METER</source>
+ <translation>meter</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_KILOMETER</source>
+ <translation>kilometer</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_MILLIINCH</source>
+ <translation>milliinch</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_MICROMETER</source>
+ <translation>micrometer</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_CENTIMETER</source>
+ <translation>centimeter</translation>
+ </message>
+ <message>
+ <source>STEP_UNITS_MICROINCH</source>
+ <translation>microinch</translation>
+ </message>
+</context>
</TS>
#
IF(SALOME_BUILD_GUI)
- INCLUDE(UseQt4Ext)
- INCLUDE(${QT_USE_FILE})
+ INCLUDE(UseQtExt)
ENDIF()
# --- options ---
IF(SALOME_BUILD_GUI)
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/OBJECT
${PROJECT_SOURCE_DIR}/src/GEOMGUI
IF(SALOME_BUILD_GUI)
# sources / moc wrappings
- QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+ QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(STLPluginGUI_SOURCES
STLPlugin_GUI.cxx
TARGET_LINK_LIBRARIES(STLPluginGUI ${_link_gui_LIBRARIES})
INSTALL(TARGETS STLPluginGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
- QT4_INSTALL_TS_RESOURCES("${STLPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
+ QT_INSTALL_TS_RESOURCES("${STLPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
ENDIF()
STLPlugin_ExportDlg fd( io, parent );
fd.setFileMode( AnyFile );
- fd.setFilters( fls );
+ fd.setNameFilters( fls );
fd.setWindowTitle( caption );
if ( !tmpfilename.isEmpty() )
fd.processPath( tmpfilename );
#include "GEOM_Operation.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
+#include "GEOM_GenericObjPtr.h"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(STLPlugin)
+typedef GEOM::GenericObjPtr<GEOM::ISTLOperations> STLOpPtr;
+
//=======================================================================
// function : STLPlugin_GUI()
// purpose : Constructor
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" ),
foreach( QString fileName, fileNames )
{
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, stlOp.in() );
+ GEOM_Operation transaction( app, stlOp.get() );
try
{
entryList.append( so->GetID() );
transaction.commit();
GEOM_Displayer( study ).Display( main.in() );
+ main->UnRegister();
}
else
{
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;
SUIT_OverrideCursor wc;
- GEOM_Operation transaction( app, stlOp.in() );
+ GEOM_Operation transaction( app, stlOp.get() );
try
{
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-INCLUDE( ${QT_USE_FILE} )
# --- options ---
INSTALL(TARGETS GEOMShapeRec EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
#INSTALL(FILES ${ShapeRecognition_HEADERS} DESTINATION ${SALOME_INSTALL_HEADERS})
-
-
--- /dev/null
+# Copyright (C) 2012-2014 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, 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
+#
+
+ADD_SUBDIRECTORY(t_shape)
+
+
+IF(SALOME_BUILD_GUI)
+ # scripts / static
+ SET(plugin_SCRIPTS
+ geom_plugins.py
+ )
+
+ # --- rules ---
+ SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${SALOME_GEOM_INSTALL_PLUGINS})
+ENDIF()
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2010-2014 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
+#
+# Author : Renaud Nédélec (OpenCascade S.A.S)
+
+import salome_pluginsmanager
+
+def t_shape_fluid(context):
+ #from salome.geom.t_shape import t_shape_builder
+ from salome.geom.t_shape import t_shape_dialog
+ from salome.geom.t_shape import t_shape_progress
+ import xalome
+ from PyQt4.QtGui import QMessageBox
+ activeStudy = context.study
+
+ dialog = t_shape_dialog.TShapeDialog()
+
+ # Get the parameter values from a gui dialog box. If the dialog is
+ # closed using the Ok button, then the data are requested from the
+ # gui and used to create the shape of the tube.
+ dialog.exec_()
+ if dialog.wasOk():
+ r1, r2, h1, h2, thickness = dialog.getData()
+ #QMessageBox.about(None, "Building in progress", "building shape, please be patient")
+ #shape = t_shape_builder.build_shape(activeStudy, r1, r2, h1, h2, thickness)
+ shapeBuilder = t_shape_progress.t_shape_progress()
+ shape = shapeBuilder.run(activeStudy, r1, r2, h1, h2, thickness)
+ entry = xalome.addToStudy(activeStudy, shape, "T_shape_fluid" )
+ xalome.displayShape(entry)
+ #if dialog.wasOk():
+ #radius, length, width = dialog.getData()
+ #shape = tubebuilder.createGeometry(activeStudy, radius, length, width)
+ #entry = xalome.addToStudy(activeStudy, shape, "Tube" )
+ #xalome.displayShape(entry)
+
+
+salome_pluginsmanager.AddFunction('T shape fluid',
+ 'Creates the fluid part of a pipe T-shape',
+ t_shape_fluid)
\ No newline at end of file
--- /dev/null
+# Copyright (C) 2012-2014 EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, 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
+#
+IF(SALOME_BUILD_GUI)
+ INCLUDE(UsePyQt)
+ENDIF()
+
+# --- scripts ---
+
+# base scripts
+SET(base_SCRIPTS
+ __init__.py
+ t_shape_builder.py
+ )
+
+IF(SALOME_BUILD_GUI)
+ # gui scripts
+ SET(gui_SCRIPTS
+ t_shape_dialog.py
+ t_shape_dialog.ui
+ t_shape_progress.py
+ )
+
+ # uic files / to be processed by pyuic
+ SET(_pyuic_files
+ t_shape_dialog.ui
+ )
+
+ # scripts / pyuic wrappings
+ PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files})
+ENDIF()
+
+# --- rules ---
+
+SALOME_INSTALL_SCRIPTS("${base_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/geom/t_shape)
+
+IF(SALOME_BUILD_GUI)
+ SALOME_INSTALL_SCRIPTS("${gui_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/geom/t_shape)
+ SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/geom/t_shape)
+ENDIF()
\ No newline at end of file
--- /dev/null
+# -*- coding: utf-8 -*-
--- /dev/null
+# -*- coding: utf-8 -*-
+
+import sys
+import salome
+
+import GEOM
+from salome.geom import geomBuilder
+import math
+import SALOMEDS
+import time
+
+geompy = None
+
+def demidisk(study, r1, a1, roty=0, solid_thickness=0):
+ if solid_thickness < 1e-7:
+ with_solid = False
+ else:
+ with_solid = True
+
+ #geompy = geomBuilder.New(study)
+
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+ v=range(8)
+ l=range(8)
+ v0 = geompy.MakeVertex(0, 0, 0)
+ v[0] = geompy.MakeVertex(0, r1/2.0, 0)
+ v[1] = geompy.MakeVertex(0, r1, 0)
+ l[1] = geompy.MakeLineTwoPnt(v[0], v[1])
+ l[2] = geompy.MakeRotation(l[1], OX, a1*math.pi/180.0)
+ v[4] = geompy.MakeRotation(v[0], OX, a1*math.pi/180.0)
+ v[6] = geompy.MakeRotation(v[1], OX, a1*math.pi/180.0)
+
+ v[2] = geompy.MakeVertex(0, -r1/2.0, 0)
+ v[3] = geompy.MakeVertex(0, -r1, 0)
+ l[3] = geompy.MakeLineTwoPnt(v[2], v[3])
+ l[4] = geompy.MakeRotation(l[3], OX, -a1*math.pi/180.0)
+ v[5] = geompy.MakeRotation(v[2], OX, -a1*math.pi/180.0)
+ v[7] = geompy.MakeRotation(v[3], OX, -a1*math.pi/180.0)
+
+ l[5] = geompy.MakeLineTwoPnt(v[4], v[5])
+ l[6] = geompy.MakeLineTwoPnt(v[0], v[4])
+ l[7] = geompy.MakeLineTwoPnt(v[2], v[5])
+
+ v7 = geompy.MakeVertex(0, 0, r1)
+ arc1 = geompy.MakeArc(v[1], v7, v[3])
+ l[0] = geompy.MakeLineTwoPnt(v[1], v[3])
+ face1 = geompy.MakeFaceWires([arc1, l[0]], 1)
+ part1 = geompy.MakePartition([face1], [l[2], l[4], l[5], l[6], l[7]], [], [], geompy.ShapeType["FACE"], 0, [], 0, True)
+
+ if with_solid:
+ # Add some faces corresponding to the solid layer outside
+ # the fluid part
+
+ # --- Vertices
+ v0 = geompy.MakeVertex(0, r1 + solid_thickness, 0)
+ v1 = geompy.MakeRotation(v0, OX, a1*math.pi/180.0)
+ v2 = geompy.MakeRotation(v0, OX, math.pi - (a1*math.pi/180.0))
+ v3 = geompy.MakeRotation(v0, OX, math.pi)
+ v.extend([v0,v1,v3,v2]) # The order is important for use in pointsProjetes
+ # --- Lines
+ l0 = geompy.MakeLineTwoPnt(v[1], v0)
+ l2 = geompy.MakeRotation(l0, OX, a1*math.pi/180.0)
+ l3 = geompy.MakeRotation(l0, OX, math.pi - (a1*math.pi/180.0))
+ # --- Faces
+ face2 = geompy.MakeRevolution(l0, OX, a1*math.pi/180.0)
+ face3 = geompy.MakeRevolution(l2, OX, math.pi - 2*a1*math.pi/180.0)
+ face4 = geompy.MakeRevolution(l3, OX, a1*math.pi/180.0)
+ # --- Compound of the "fluid part" of the divided disk and the additional faces
+ compound1 = geompy.MakeCompound([part1, face2, face3, face4])
+ # --- Glue edges
+ part1 = geompy.MakeGlueEdges(compound1,1e-7)
+
+ if roty != 0:
+ vrot = [ geompy.MakeRotation(vert, OY, roty*math.pi/180.0) for vert in v ]
+ lrot = [ geompy.MakeRotation(lin, OY, roty*math.pi/180.0) for lin in l ]
+ arc = geompy.MakeRotation(arc1, OY, roty*math.pi/180.0)
+ part = geompy.MakeRotation(part1, OY, roty*math.pi/180.0)
+ return vrot, lrot, arc, part
+ else:
+ return v, l, arc1, part1
+
+def pointsProjetes(study, vref, face):
+ #geompy = geomBuilder.New(study)
+ vface = geompy.ExtractShapes(face, geompy.ShapeType["VERTEX"], True)
+ vord = range(len(vref))
+ plan = geompy.MakePlaneThreePnt(vref[0], vref[1], vref[-1], 10000)
+ vproj = [ geompy.MakeProjection(vert, plan) for vert in vface ]
+ for i,v in enumerate(vproj):
+ dist = [ (geompy.MinDistance(v, vr), j) for j,vr in enumerate(vref) ]
+ dist.sort()
+ if dist[0][0] < 1.e-3:
+ vord[dist[0][1]] = vface[i]
+ return vord
+
+def arcsProjetes(study, vf, face):
+ #geompy = geomBuilder.New(study)
+ lface = geompy.ExtractShapes(face, geompy.ShapeType["EDGE"], True)
+ lord = range(3)
+ ends = [vf[1], vf[6], vf[7], vf[3]]
+ for i in range(3):
+ for lf in lface:
+ pts = geompy.ExtractShapes(lf, geompy.ShapeType["VERTEX"], True)
+ if (((geompy.MinDistance(pts[0], ends[i]) < 0.001) and (geompy.MinDistance(pts[1], ends[i+1]) < 0.001)) or
+ ((geompy.MinDistance(pts[1], ends[i]) < 0.001) and (geompy.MinDistance(pts[0], ends[i+1]) < 0.001))):
+ lord[i] = lf
+ #print "arc_%d OK"%i
+ break
+ pass
+ return lord
+
+def build_shape(study, r1, r2, h1, h2, solid_thickness=0, progressBar=None ):
+ """ Builds the final shape """
+
+ if progressBar is not None:
+ time0 = time.time()
+ print time.time() -time0
+
+ if solid_thickness < 1e-7:
+ with_solid = False
+ else:
+ with_solid = True
+
+ global geompy
+ geompy = geomBuilder.New(study)
+
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+ a1 = 45.0
+ seuilmax = 0.1
+ ratio = float(r2)/float(r1)
+ if ratio > (1.0 -seuilmax):
+ a1 = 45.0*(1.0 -ratio)/seuilmax
+
+ # --- Creation of the jonction faces
+ [faci, sect45, arc1, l1, lord90, lord45, edges, arcextru] = jonction(study, r1, r2,\
+ h1, h2, a1)
+ if progressBar is not None:
+ progressBar.addSteps(2)
+ print time.time() -time0
+
+ if with_solid:
+ # The same code is executed again with different external radiuses in order
+ # to get the needed faces and edges to build the solid layer of the pipe
+ [faci_ext, sect45_ext, arc1_ext, l1_ext, \
+ lord90_ext, lord45_ext, edges_ext, arcextru_ext] = jonction(study, r1 + solid_thickness, r2 + solid_thickness,\
+ h1, h2, a1)
+ faces_jonction_ext = []
+ for i,l in enumerate(lord90):
+ faces_jonction_ext.append(geompy.MakeQuad2Edges(lord90[i],lord90_ext[i]))
+ for i in [1, 3, 6, 7]:
+ faces_jonction_ext.append(geompy.MakeQuad2Edges(edges[i],edges_ext[i]))
+ for i,l in enumerate(lord45):
+ faces_jonction_ext.append(geompy.MakeQuad2Edges(lord45[i],lord45_ext[i]))
+
+ if progressBar is not None:
+ progressBar.addSteps(4)
+ print time.time() -time0
+
+ # --- extrusion droite des faces de jonction, pour reconstituer les demi cylindres
+ if with_solid:
+ sect45 = geompy.MakeCompound([sect45]+faces_jonction_ext[-3:])
+ sect45 = geompy.MakeGlueEdges(sect45, 1e-7)
+
+ if progressBar is not None:
+ progressBar.addSteps(1)
+ print time.time() -time0
+
+ extru1 = geompy.MakePrismVecH(sect45, OX, h1+10)
+
+ faces_coupe = faci[5:]
+ if with_solid:
+ faces_coupe = faci[5:]+faces_jonction_ext[:3]
+ base2 = geompy.MakePartition(faces_coupe, [], [], [], geompy.ShapeType["FACE"], 0, [], 0, True)
+ extru2 = geompy.MakePrismVecH(base2, OZ, h2)
+
+ if progressBar is not None:
+ progressBar.addSteps(1)
+ print time.time() -time0
+
+ # --- partition et coupe
+
+ if with_solid:
+ demiDisque = geompy.MakeFaceWires([arc1_ext, l1_ext[0]], 1)
+ else:
+ demiDisque = geompy.MakeFaceWires([arc1, l1[0]], 1)
+ demiCylindre = geompy.MakePrismVecH(demiDisque, OX, h1)
+
+ if progressBar is not None:
+ progressBar.addSteps(1)
+ print time.time() -time0
+
+ box = geompy.MakeBox(0, -2*(r1+h1), -2*(r1+h1), 2*(r1+h1), 2*(r1+h1), 2*(r1+h1))
+ rot = geompy.MakeRotation(box, OY, 45*math.pi/180.0)
+
+ # NOTE: The following Cut takes almost half of the total execution time
+ garder = geompy.MakeCutList(demiCylindre, [extru2, rot], True)
+
+ if progressBar is not None:
+ progressBar.addSteps(9)
+ print time.time() -time0
+
+ faces_coupe = faci[:5]
+ if with_solid:
+ faces_coupe.extend(faces_jonction_ext[-7:])
+ raccord = geompy.MakePartition([garder], faces_coupe + [arcextru], [], [], geompy.ShapeType["SOLID"], 0, [], 0, True)
+ assemblage = geompy.MakeCompound([raccord, extru1, extru2])
+ assemblage = geompy.MakeGlueFaces(assemblage, 1e-7)
+
+ if progressBar is not None:
+ progressBar.addSteps(3)
+ print time.time() -time0
+
+ box = geompy.MakeBox(-1, -(r1+r2+2*solid_thickness), -1, h1, r1+r2+2*solid_thickness, h2)
+
+ # NOTE: This operation takes about 1/4 of the total execution time
+ final = geompy.MakeCommonList([box, assemblage], True)
+
+ if progressBar is not None:
+ progressBar.addSteps(5)
+ print time.time() -time0
+
+ # --- Partie inférieure
+
+ v3, l3, arc3, part3 = demidisk(study, r1, a1, 180.0, solid_thickness)
+ extru3 = geompy.MakePrismVecH(part3, OX, h1)
+
+ # --- Symétrie
+
+ compound = geompy.MakeCompound([final, extru3])
+ plane = geompy.MakePlane(O,OX,2000)
+ compound_mirrored = geompy.MakeMirrorByPlane(compound, plane)
+ compound_total = geompy.MakeCompound([compound, compound_mirrored])
+ final = geompy.MakeGlueFaces(compound_total, 1e-07)
+
+ if progressBar is not None:
+ progressBar.addSteps(1)
+ print time.time() -time0
+
+ return final
+
+
+def jonction(study, r1, r2, h1, h2, a1):
+ """ Builds the jonction faces and
+ returns what is needed to build the whole pipe
+ """
+ #geompy = geomBuilder.New(study)
+
+ O = geompy.MakeVertex(0, 0, 0)
+ OX = geompy.MakeVectorDXDYDZ(1, 0, 0)
+ OY = geompy.MakeVectorDXDYDZ(0, 1, 0)
+ OZ = geompy.MakeVectorDXDYDZ(0, 0, 1)
+
+ # --- sections droites des deux demi cylindres avec le partionnement
+ v1, l1, arc1, part1 = demidisk(study, r1, a1, 0.)
+ v2, l2, arc2, part2 = demidisk(study, r2, a1, 90.0)
+
+ # --- extrusion des sections --> demi cylindres de travail, pour en extraire les sections utilisées au niveau du Té
+ # et enveloppe cylindrique du cylindre principal
+
+ demicyl1 = geompy.MakePrismVecH(part1, OX, h1)
+ demicyl2 = geompy.MakePrismVecH(part2, OZ, h2)
+ arcextru = geompy.MakePrismVecH(arc1, OX, h1)
+
+ # --- plan de coupe à 45° sur le cylindre principal,
+ # section à 45° du cylndre principal,
+ # section du cylindre secondaire par l'enveloppe cylindrique du cylindre principal
+
+ plan1 = geompy.MakePlane(O, OX, 4*r1)
+ planr = geompy.MakeRotation(plan1, OY, 45*math.pi/180.0)
+
+ sect45 = geompy.MakeCommonList([demicyl1, planr], True)
+ sect90 = geompy.MakeCommonList([demicyl2, arcextru], True)
+ #geompy.addToStudy(sect90, "sect90")
+
+ # --- liste ordonnée des points projetés sur les deux sections
+
+ vord45 = pointsProjetes(study, v1, sect45)
+ vord90 = pointsProjetes(study, v2, sect90)
+
+ # --- identification des projections des trois arcs de cercle, sur les deux sections.
+
+ lord45 = arcsProjetes(study, vord45, sect45)
+ lord90 = arcsProjetes(study, vord90, sect90)
+
+ # --- abaissement des quatre points centraux de la section du cylindre secondaire
+
+ dz = -r2/2.0
+ for i in (0, 2, 4, 5):
+ vord90[i] = geompy.TranslateDXDYDZ(vord90[i], 0, 0, dz, True)
+ #geompy.addToStudyInFather(sect90, vord90[i], 'vm%d'%i)
+
+ # --- création des deux arêtes curvilignes sur l'enveloppe cylindrique du cylindre principal, à la jonction
+
+ curv = [None for i in range(4)] # liaisons entre les points 1, 3, 6 et 7 des 2 sections
+
+ curv[0] = geompy.MakeArcCenter(O, vord90[1] , vord45[1], False)
+ curv[1] = geompy.MakeArcCenter(O, vord90[3] , vord45[3], False)
+
+ lipts = ((6, 6, 4), (7, 7, 5))
+ for i, ipts in enumerate(lipts):
+ #print i, ipts
+ p0 = vord90[ipts[0]]
+ p1 = vord45[ipts[1]]
+ p2 = vord45[ipts[2]]
+ plan = geompy.MakePlaneThreePnt(p0, p1, p2, 10000)
+ #geompy.addToStudy(plan, "plan%d"%i)
+ section = geompy.MakeSection(plan, arcextru, True)
+ secpart = geompy.MakePartition([section], [sect45, sect90], [], [], geompy.ShapeType["EDGE"], 0, [], 0, True)
+ #geompy.addToStudy(secpart, "secpart%d"%i)
+ lsec = geompy.ExtractShapes(secpart, geompy.ShapeType["EDGE"], True)
+
+ for l in lsec:
+ pts = geompy.ExtractShapes(l, geompy.ShapeType["VERTEX"], True)
+ if (((geompy.MinDistance(pts[0], p0) < 0.001) and (geompy.MinDistance(pts[1], p1) < 0.001)) or
+ ((geompy.MinDistance(pts[1], p0) < 0.001) and (geompy.MinDistance(pts[0], p1) < 0.001))):
+ curv[i+2] =l
+ #print "curv_%d OK"%i
+ break
+
+ # --- creation des arêtes droites manquantes, des faces et volumes pour les quatre volumes de la jonction
+
+ edges = [None for i in range(8)]
+ edges[0] = geompy.MakeLineTwoPnt(vord45[0], vord90[0])
+ edges[1] = curv[0]
+ edges[2] = geompy.MakeLineTwoPnt(vord45[2], vord90[2])
+ edges[3] = curv[1]
+ edges[4] = geompy.MakeLineTwoPnt(vord45[4], vord90[4])
+ edges[5] = geompy.MakeLineTwoPnt(vord45[5], vord90[5])
+ edges[6] = curv[2]
+ edges[7] = curv[3]
+
+ ed45 = [None for i in range(8)]
+ ed45[0] = geompy.MakeLineTwoPnt(vord45[0], vord45[2])
+ ed45[1] = geompy.MakeLineTwoPnt(vord45[0], vord45[1])
+ ed45[2] = geompy.MakeLineTwoPnt(vord45[4], vord45[6])
+ ed45[3] = geompy.MakeLineTwoPnt(vord45[2], vord45[3])
+ ed45[4] = geompy.MakeLineTwoPnt(vord45[5], vord45[7])
+ ed45[5] = geompy.MakeLineTwoPnt(vord45[4], vord45[5])
+ ed45[6] = geompy.MakeLineTwoPnt(vord45[0], vord45[4])
+ ed45[7] = geompy.MakeLineTwoPnt(vord45[2], vord45[5])
+
+ ed90 = [None for i in range(8)]
+ ed90[0] = geompy.MakeLineTwoPnt(vord90[0], vord90[2])
+ ed90[1] = geompy.MakeLineTwoPnt(vord90[0], vord90[1])
+ ed90[2] = geompy.MakeLineTwoPnt(vord90[4], vord90[6])
+ ed90[3] = geompy.MakeLineTwoPnt(vord90[2], vord90[3])
+ ed90[4] = geompy.MakeLineTwoPnt(vord90[5], vord90[7])
+ ed90[5] = geompy.MakeLineTwoPnt(vord90[4], vord90[5])
+ ed90[6] = geompy.MakeLineTwoPnt(vord90[0], vord90[4])
+ ed90[7] = geompy.MakeLineTwoPnt(vord90[2], vord90[5])
+
+ faci = []
+ faci.append(geompy.MakeFaceWires([ed45[6], edges[0], ed90[6], edges[4]], 0))
+ faci.append(geompy.MakeFaceWires([ed45[7], edges[2], ed90[7], edges[5]], 0))
+ faci.append(geompy.MakeFaceWires([ed45[2], edges[4], ed90[2], edges[6]], 0))
+ faci.append(geompy.MakeFaceWires([ed45[5], edges[4], ed90[5], edges[5]], 0))
+ faci.append(geompy.MakeFaceWires([ed45[4], edges[5], ed90[4], edges[7]], 0))
+ faci.append(geompy.MakeFaceWires([ed90[0], ed90[6], ed90[5], ed90[7]], 0))
+ faci.append(geompy.MakeFaceWires([ed90[1], ed90[6], ed90[2], lord90[0]], 0))
+ faci.append(geompy.MakeFaceWires([ed90[2], ed90[5], ed90[4], lord90[1]], 0))
+ faci.append(geompy.MakeFaceWires([ed90[3], ed90[7], ed90[4], lord90[2]], 0))
+
+ return faci, sect45, arc1, l1, lord90, lord45, edges, arcextru
+
+def test_t_shape_builder():
+ """For testing purpose"""
+ salome.salome_init()
+ theStudy = salome.myStudy
+ geompy = geomBuilder.New(theStudy)
+ for r1 in [1., 100.]:
+ for r2 in [0.9*r1, 0.5*r1, 0.1*r1, 0.05*r1]:
+ for thickness in [r1/100., r1/10., r1/2.]:
+ print r1, r2, thickness
+ h1 = r1 * 2.0
+ h2 = h1
+ try:
+ res = build_shape(theStudy, r1, r2, h1, h2, thickness)
+ geompy.addToStudy(res, "res_%f_%f_%f"%(r1,r2, thickness))
+ except:
+ print "problem with res_%f_%f_%f"%(r1,r2, thickness)
+
+if __name__=="__main__":
+ """For testing purpose"""
+ test_t_shape_builder()
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2010-2014 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
+#
+# Author : Renaud Nédélec (OpenCascade S.A.S)
+
+import sys
+from PyQt4 import QtGui
+from PyQt4 import QtCore
+
+from t_shape_dialog_ui import Ui_Dialog
+
+
+class TShapeDialog(QtGui.QDialog):
+ def __init__(self):
+ QtGui.QDialog.__init__(self, None, QtCore.Qt.Tool)
+ # Set up the user interface from Designer.
+ self.ui = Ui_Dialog()
+ self.ui.setupUi(self)
+ self.show()
+ self._wasOk = False
+ self.ui.dsb_solidThickness.setEnabled(False)
+ self.ui.label_5.setEnabled(False)
+ self.ui.dsb_bigRadius.setValue(50.0)
+ self.ui.dsb_smallRadius.setValue(40.0)
+ self.ui.dsb_bigHeight.setValue(80.0)
+ self.ui.dsb_smallHeight.setValue(80.0)
+
+ def accept(self):
+ self._wasOk = True
+ QtGui.QDialog.accept(self)
+
+ def getData(self):
+ r1 = self.ui.dsb_bigRadius.value()
+ r2 = self.ui.dsb_smallRadius.value()
+ h1 = self.ui.dsb_bigHeight.value()
+ h2 = self.ui.dsb_smallHeight.value()
+ thickness = 0.0
+ if self.ui.cb_buildSolid.isChecked():
+ thickness = self.ui.dsb_solidThickness.value()
+
+ return r1, r2, h1, h2, thickness
+
+ def reject(self):
+ self._wasOk = False
+ QtGui.QDialog.reject(self)
+
+ def wasOk(self):
+ return self._wasOk
+
+
+# ================
+# Tests
+# ================
+
+def main( args ):
+ import sys
+ app = QtGui.QApplication(sys.argv)
+ Dialog = TShapeDialog()
+ ui = Ui_Dialog()
+ ui.setupUi(Dialog)
+ Dialog.show()
+ sys.exit(app.exec_())
+
+if __name__=="__main__":
+ main(sys.argv)
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Dialog</class>
+ <widget class="QDialog" name="Dialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>349</width>
+ <height>283</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="2" column="1">
+ <widget class="QDoubleSpinBox" name="dsb_smallRadius">
+ <property name="decimals">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <double>100000.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>40.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Big pipe radius</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QDoubleSpinBox" name="dsb_bigHeight">
+ <property name="decimals">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <double>1000000.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>80.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QDoubleSpinBox" name="dsb_smallHeight">
+ <property name="decimals">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <double>1000000.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>80.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QDoubleSpinBox" name="dsb_bigRadius">
+ <property name="decimals">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <double>100000.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>50.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Big pipe height</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Small pipe radius</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Small pipe height</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="cb_buildSolid">
+ <property name="text">
+ <string>Build solid part</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Solid thickness</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="dsb_solidThickness">
+ <property name="decimals">
+ <number>5</number>
+ </property>
+ <property name="maximum">
+ <double>1000000.000000000000000</double>
+ </property>
+ <property name="value">
+ <double>5.000000000000000</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>Dialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>205</x>
+ <y>241</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>250</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>Dialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>205</x>
+ <y>241</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>214</x>
+ <y>250</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cb_buildSolid</sender>
+ <signal>clicked(bool)</signal>
+ <receiver>label_5</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>99</x>
+ <y>170</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>107</x>
+ <y>205</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>cb_buildSolid</sender>
+ <signal>clicked(bool)</signal>
+ <receiver>dsb_solidThickness</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>150</x>
+ <y>170</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>277</x>
+ <y>212</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
--- /dev/null
+# -*- coding: utf-8 -*-
+# Copyright (C) 2010-2014 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
+#
+# Author : Renaud Nédélec (OpenCascade S.A.S)
+
+from salome.geom.t_shape import t_shape_builder
+from PyQt4.QtGui import QProgressDialog
+from PyQt4 import QtCore
+
+class t_shape_progress(QProgressDialog):
+ _totSteps = 0
+ _nmaxSteps = 27
+
+ def __init__(self, parent=None):
+ QProgressDialog.__init__(self, "t_shape fluid build", "stop", 0, self._nmaxSteps, parent, QtCore.Qt.Tool)
+ self.show()
+
+ def run(self, activeStudy, r1, r2, h1, h2, thickness):
+ shape = t_shape_builder.build_shape(activeStudy, r1, r2, h1, h2, thickness, self)
+ self.setValue(self._nmaxSteps)
+ return shape
+
+ def addSteps(self, nbSteps):
+ self._totSteps += nbSteps
+ self.setValue(self._totSteps)
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-#INCLUDE(UseQt4Ext)
-INCLUDE(${QT_USE_FILE})
+INCLUDE(UseQtExt)
# --- options ---
# additional include directories
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${PTHREAD_INCLUDE_DIR}
${VTK_INCLUDE_DIRS}
${OMNIORB_INCLUDE_DIR}
)
# header files / uic wrappings
-QT4_WRAP_UI(_uic_HEADERS ${_uic_files})
+QT_WRAP_UIC(_uic_HEADERS ${_uic_files})
# --- sources ---
# sources / moc wrappings
-QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(TransformationGUI_SOURCES
TransformationGUI.cxx
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;
}
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);
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);
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);
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);
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);
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);
globalSelection( aMap );
std::list<int> 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:;
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:;
}
}
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")));
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);
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);
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 );
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);
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()),
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());
double aRadius = myRadiusSpin->value();
double aStartAngle = myStartAngleSpin->value()*M_PI/180.;
+ double aRotAngle = myAngleRotSpin->value()*M_PI/180.;
double aLengthAngle = -1.;
if (myUseAngleLen->isChecked()) {
}
GEOM::GEOM_Object_var anObj = anOper->MakeProjectionOnCylinder
- (myObj, aRadius, aStartAngle, aLengthAngle);
+ (myObj, aRadius, aStartAngle, aLengthAngle, aRotAngle);
if (!anObj->_is_nil()) {
if (!IsPreview()) {
aParameters << myStartAngleSpin->text();
if (myUseAngleLen->isChecked())
aParameters << myAngleLenSpin->text();
+ aParameters << myAngleRotSpin->text();
anObj->SetParameters(aParameters.join(":").toUtf8().constData());
}
objects.push_back(anObj._retn());
SalomeApp_DoubleSpinBox *myStartAngleSpin;
QCheckBox *myUseAngleLen;
SalomeApp_DoubleSpinBox *myAngleLenSpin;
+ SalomeApp_DoubleSpinBox *myAngleRotSpin;
};
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;
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;
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()));
else if (send == PushButton2) {
myEditCurrentArgument = LineEdit2;
- localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ localSelection(TopAbs_VERTEX);
PushButton1->setDown(false);
LineEdit1->setEnabled(false);
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;
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()));
#
IF(SALOME_BUILD_GUI)
- INCLUDE(UseQt4Ext)
- INCLUDE(${QT_USE_FILE})
+ INCLUDE(UseQtExt)
ENDIF()
# --- options ---
IF(SALOME_BUILD_GUI)
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/OBJECT
${PROJECT_SOURCE_DIR}/src/GEOMGUI
IF(SALOME_BUILD_GUI)
# sources / moc wrappings
- QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+ QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(VTKPluginGUI_SOURCES
VTKPlugin_GUI.cxx
TARGET_LINK_LIBRARIES(VTKPluginGUI ${_link_gui_LIBRARIES})
INSTALL(TARGETS VTKPluginGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
- QT4_INSTALL_TS_RESOURCES("${VTKPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
+ QT_INSTALL_TS_RESOURCES("${VTKPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
ENDIF()
VTKPlugin_ExportDlg fd( io, parent );
fd.setFileMode( AnyFile );
- fd.setFilters( fls );
+ fd.setNameFilters( fls );
fd.setWindowTitle( caption );
if ( !tmpfilename.isEmpty() )
fd.processPath( tmpfilename );
#include "GEOM_Operation.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
+#include "GEOM_GenericObjPtr.h"
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(VTKPlugin)
+typedef GEOM::GenericObjPtr<GEOM::IVTKOperations> VTKOpPtr;
+
//=======================================================================
// function : VTKPlugin_GUI()
// purpose : Constructor
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;
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();
}
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;
}
}
{
std::ifstream rstr;
int length;
- rstr.open(filePath.c_str());
+ rstr.open(filePath.c_str(), std::ios_base::binary);
rstr.seekg(0, rstr.end); // go to the end
length = rstr.tellg(); // report location (this is the length)
rstr.seekg(0, rstr.beg); // go back to the beginning
#
IF(SALOME_BUILD_GUI)
- INCLUDE(UseQt4Ext)
- INCLUDE(${QT_USE_FILE})
+ INCLUDE(UseQtExt)
ENDIF()
# --- options ---
IF(SALOME_BUILD_GUI)
INCLUDE_DIRECTORIES(
- ${QT_INCLUDE_DIRS}
${GUI_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/OBJECT
${PROJECT_SOURCE_DIR}/src/GEOMGUI
IF(SALOME_BUILD_GUI)
# sources / moc wrappings
- QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS})
+ QT_WRAP_MOC(_moc_SOURCES ${_moc_HEADERS})
SET(XAOPluginGUI_SOURCES
XAOPlugin_GUI.cxx
TARGET_LINK_LIBRARIES(XAOPluginGUI ${_link_gui_LIBRARIES})
INSTALL(TARGETS XAOPluginGUI EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
- QT4_INSTALL_TS_RESOURCES("${XAOPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
+ QT_INSTALL_TS_RESOURCES("${XAOPlugin_RESOURCES}" "${SALOME_GEOM_INSTALL_RES_DATA}")
ENDIF()
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<GEOM_Param>& 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);
#ifndef _XAOPlugin_Driver_HXX
#define _XAOPlugin_Driver_HXX
-// OCCT includes
-#include <TFunction_Driver.hxx>
+#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();
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<GEOM_Param>& theParams);
+
+ static int GetFileNameTag() { return 1; } // where to store file name in GEOM_Function
+
+ DEFINE_STANDARD_RTTI(XAOPlugin_Driver)
};
#endif // _XAOPlugin_Driver_HXX
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)
{
{
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++)
{
SALOMEDS::SObject_var aSO =
getGeomEngine()->AddInStudy(aStudyDS, theField, theField->GetName(), theFather);
+ theField->UnRegister();
QString anEntry;
if ( !aSO->_is_nil() ) {
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();