]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0022762: [EDF] Fast detection of face/face face/solid solid/solid interference
authorana <ana@opencascade.com>
Tue, 16 Dec 2014 16:27:28 +0000 (19:27 +0300)
committervsr <vsr@opencascade.com>
Wed, 17 Dec 2014 17:07:41 +0000 (20:07 +0300)
29 files changed:
doc/salome/examples/CMakeLists.txt
doc/salome/examples/check_shape.py
doc/salome/examples/fast_intersection.py [new file with mode: 0644]
doc/salome/gui/GEOM/images/measures12.png [new file with mode: 0644]
doc/salome/gui/GEOM/input/fast_intersection.doc [new file with mode: 0644]
doc/salome/gui/GEOM/input/tui_fast_intersection.doc [new file with mode: 0644]
doc/salome/gui/GEOM/input/tui_measurement_tools.doc
doc/salome/gui/GEOM/input/tui_test_measures.doc
doc/salome/gui/GEOM/input/using_measurement_tools.doc
idl/GEOM_Gen.idl
resources/CMakeLists.txt
resources/fast_intersect.png [new file with mode: 0644]
src/GEOMGUI/GEOM_images.ts
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GEOM_msg_fr.ts
src/GEOMGUI/GEOM_msg_ja.ts
src/GEOMGUI/GeometryGUI.cxx
src/GEOMGUI/GeometryGUI_Operations.h
src/GEOMImpl/CMakeLists.txt
src/GEOMImpl/GEOMImpl_IMeasureOperations.cxx
src/GEOMImpl/GEOMImpl_IMeasureOperations.hxx
src/GEOM_I/GEOM_IMeasureOperations_i.cc
src/GEOM_I/GEOM_IMeasureOperations_i.hh
src/GEOM_SWIG/GEOM_TestMeasures.py
src/GEOM_SWIG/geomBuilder.py
src/MeasureGUI/CMakeLists.txt
src/MeasureGUI/MeasureGUI.cxx
src/MeasureGUI/MeasureGUI_FastCheckIntersectionsDlg.cxx [new file with mode: 0644]
src/MeasureGUI/MeasureGUI_FastCheckIntersectionsDlg.h [new file with mode: 0644]

index 76c3883e125f51b8ae0f6de40a7b5d632d362bf1..0817e5fb47304c3e8cbb1ff67f19249e97019e2f 100644 (file)
@@ -65,7 +65,8 @@ SET(GOOD_TESTS
   complex_objs_ex07.py  
   complex_objs_ex08.py  
   complex_objs_ex09.py  
-  complex_objs_ex10.py  
+  complex_objs_ex10.py
+  fast_intersection.py
   free_boundaries.py  
   free_faces.py  
   GEOM_box.py  
index a0e72896798f7dcf8fff52a9a0111d5808ce69e0..f10f31c8a44f91e9e6e4bfcf958c364202174a79 100644 (file)
@@ -10,7 +10,7 @@ geompy = geomBuilder.New(salome.myStudy)
 box = geompy.MakeBoxDXDYDZ(100,30,100)
 (IsValid, err) = geompy.CheckShape(box, 0, 2)
 if IsValid == 0:
-    geompy.PrintShapeError(box, err)
+    geompy.PrintShapeErrors(box, err)
     raise RuntimeError, "Invalid box created"
 else:
     print "\nBox is valid"
diff --git a/doc/salome/examples/fast_intersection.py b/doc/salome/examples/fast_intersection.py
new file mode 100644 (file)
index 0000000..4854a57
--- /dev/null
@@ -0,0 +1,34 @@
+# Fast intersection
+
+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)
+
+isOk, res1, res2 = geompy.FastIntersect(box, cylinder)
+if isOk == 0:
+    raise RuntimeError, "No intersection!"
+else:
+    print "\nTwo lists of indexes of sub-shapes localize the intersection:"
+    print res1, res2
+
+# create two boxes with gap
+Ver1 = geompy.MakeVertex(0, 0, 0)
+Ver2 = geompy.MakeVertex(100, 100, 100)
+Ver3 = geompy.MakeVertex(100.1, 0, 0)
+Ver4 = geompy.MakeVertex(200, 200, 200)
+box1 = geompy.MakeBoxTwoPnt(Ver1, Ver2)
+box2 = geompy.MakeBoxTwoPnt(Ver3, Ver4)
+
+isOk1, aRes1, aRes2 = geompy.FastIntersect(box1, box2, 1.)
+if isOk1 == 0:
+    raise RuntimeError, "No gaps!"
+else:
+    print "\nTwo lists of indexes of sub-shapes localize the gap:"
+    print aRes1, aRes2
diff --git a/doc/salome/gui/GEOM/images/measures12.png b/doc/salome/gui/GEOM/images/measures12.png
new file mode 100644 (file)
index 0000000..0dba542
Binary files /dev/null and b/doc/salome/gui/GEOM/images/measures12.png differ
diff --git a/doc/salome/gui/GEOM/input/fast_intersection.doc b/doc/salome/gui/GEOM/input/fast_intersection.doc
new file mode 100644 (file)
index 0000000..4de27fc
--- /dev/null
@@ -0,0 +1,61 @@
+/*!
+\page fast_intersection_page Fast intersection
+
+This operation checks whether or not 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 
+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.
+Due to this fact, the tool is not suitable for computing exact intersection
+of shapes; however, it can be used to quickly find zones where
+intersections can present, and then use these results in further analysis.
+
+\note For more information about Partition and Boolean Operations Algorithms
+and their limitations refer to <a href="SALOME_BOA_PA.pdf">this document</a>.
+
+\image html measures12.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
+in the viewer to navigate between selectable objects.
+- Press left mouse button to select an appropriate object to the dialog box.
+.
+For more details, please refer to the \em "Functionality common for OCC and VTK viewers" chapter
+of the GUI module's documentation.
+
+In this dialog:
+
+- \b Object 1 - first checked object. \b Selection button allows picking it in the viewer or in the object browser.
+- \b Object 2 - second checked object. \b Selection button allows picking it in the viewer or in the object browser.
+- <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>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
+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.
+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
+where:
+- \em theShape1 First shape.
+- \em theShape2 Second shape.
+- \em theTolerance When it is negative or equal to zero, the function detects intersections;
+                   when it is positive, the function detects gaps.
+- \em theDeflection Linear deflection for shapes; if deflection <= 0, default deflection 0.001 is used
+
+<b>Result:</b> Boolean + two lists of IDs of sub-shapes (from input shapes) that localize the intersection.
+
+See also a \ref tui_fast_intersection_page "TUI example".
+
+*/
\ No newline at end of file
diff --git a/doc/salome/gui/GEOM/input/tui_fast_intersection.doc b/doc/salome/gui/GEOM/input/tui_fast_intersection.doc
new file mode 100644 (file)
index 0000000..05708da
--- /dev/null
@@ -0,0 +1,6 @@
+/*!
+
+\page tui_fast_intersection_page Fast intersection
+\tui_script{fast_intersection.py}
+
+*/
index 583f3de0f56e4071941db96b1ad0f97ac10cc280..6e83325c3dc8b10a24a6f9ff04128d60a592ba39 100644 (file)
@@ -19,6 +19,7 @@
 <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_fast_intersection_page</li>
 </ul>
 
 */
index 90dafb538c81a6be0de7171e984990cbbf5add92..b954b7f605bec8b10f4efb6cd54d1f98bc4eb760 100644 (file)
 \until CheckShape
 
 \anchor swig_CheckShape
-\until MakeCompound
+\until Detect Self-intersections
 
 \anchor swig_CheckSelfIntersections
+\until Detect Fast intersection
+
+\anchor swig_FastIntersection
 \until WhatIs
 
 \anchor swig_WhatIs
index 40e38c6640d4b1552c46c6f5fd9fccaed4e01930..2672156cd09b08f8b1fe0285b47f531ee17396c3 100644 (file)
@@ -29,6 +29,7 @@
 <li>\subpage check_compound_of_blocks_page "Check compound of blocks"</li>
 <li>\subpage get_non_blocks_page "Get non blocks"</li>
 <li>\subpage check_self_intersections_page "Detect Self-intersections"</li>
+<li>\subpage fast_intersection_page "Fast intersection"</li>
 </ul>
 
 \n Our <b>TUI Scripts</b> show how to use
index 78e9bfca24e552af7724c92253f7cca05f6bae3f..6a38a71db8f08ca29beb285806d2647326d919d7 100644 (file)
@@ -4330,6 +4330,26 @@ module GEOM
                                     in long        theCheckLevel,
                                     out ListOfLong theIntersections);
 
+    /*!
+     *  \brief Detect intersections of the given shapes with algorithm based on mesh intersections.
+     *  \param theShape1 First source object
+     *  \param theShape2 Second source object
+     *  \param theTolerance Specifies a distance between shapes used for detecting gaps:
+     *                       - if \a theTolerance <= 0, algorithm detects intersections
+     *                       - if \a theTolerance > 0, algorithm detects gaps
+     *  \param theDeflection Linear deflection coefficient that specifies quality of tesselation:
+     *                       - if \a theDeflection <= 0, default deflection 0.001 is used
+     *  \param theIntersections1 Output: contains list of sub-shapes IDs from 1st shape that localize intersection
+     *  \param theIntersections2 Output: contains list of sub-shapes IDs from 2nd shape that localize intersection
+     *  \return TRUE, if the are intersections (gaps) between source shapes
+     */
+    boolean FastIntersect (in GEOM_Object theShape1,
+                          in GEOM_Object theShape2,
+                          in double      theTolerance,
+                          in float       theDeflection,
+                          out ListOfLong theIntersections1,
+                          out ListOfLong theIntersections2);
+
     /*!
      *  \brief Check if the given shape can be an argument for MakeSolid operation
      *  \param theShape Shape to be described.
index 60ea6bd8abbd754858b96502fa519a8d0e458a23..c555dbd485c2fe4aa66fd5cdb46fb3ff3becaf82 100755 (executable)
@@ -259,6 +259,7 @@ SET( _res_files
   check_blocks_compound.png
   get_non_blocks.png
   check_self_intersections.png
+  fast_intersect.png
   free_faces.png
   propagate.png
   redo.png
diff --git a/resources/fast_intersect.png b/resources/fast_intersect.png
new file mode 100644 (file)
index 0000000..736adde
Binary files /dev/null and b/resources/fast_intersect.png differ
index 43fa10a0630e81c3db6625986a4afd9b8e249f67..6877d9c7cac196ff4532f7339ff1eb7c0253c9f0 100644 (file)
             <source>ICON_DLG_CHECK_SELF_INTERSECTIONS</source>
             <translation>check_self_intersections.png</translation>
         </message>
+        <message>
+            <source>ICON_DLG_FAST_CHECK_INTERSECTIONS</source>
+            <translation>fast_intersect.png</translation>
+        </message>
         <message>
             <source>ICON_DLG_CIRCLE_PNTS</source>
             <translation>circle3points.png</translation>
             <source>ICO_CHECK_SELF_INTERSECTIONS</source>
             <translation>check_self_intersections.png</translation>
         </message>
+        <message>
+            <source>ICO_FAST_CHECK_INTERSECTIONS</source>
+            <translation>fast_intersect.png</translation>
+        </message>
         <message>
             <source>ICO_CHECK_FREE_BNDS</source>
             <translation>free_bound.png</translation>
index 45b178e5ef4e867b0e4c37a4f7b6f5484732451e..86e1622a7f67fdb836a9e3023061ad193afd842f 100644 (file)
@@ -423,6 +423,10 @@ Please, select face, shell or solid and try again</translation>
         <source>GEOM_CHECK_SELF_INTERSECTIONS</source>
         <translation>Detect Self-intersections</translation>
     </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INTERSECTIONS</source>
+        <translation>Fast intersection</translation>
+    </message>
     <message>
         <source>GEOM_CIRCLE</source>
         <translation>Circle</translation>
@@ -2500,6 +2504,10 @@ Please, select face, shell or solid and try again</translation>
         <source>MEN_CHECK_SELF_INTERSECTIONS</source>
         <translation>Detect Self-intersections</translation>
     </message>
+    <message>
+        <source>MEN_FAST_CHECK_INTERSECTIONS</source>
+        <translation>Fast intersection</translation>
+    </message>
     <message>
         <source>MEN_CHECK_FREE_BNDS</source>
         <translation>Check Free Boundaries</translation>
@@ -3505,6 +3513,10 @@ Please, select face, shell or solid and try again</translation>
         <translation>Detect Self-intersections</translation>
     </message>
     <message>
+        <source>STB_FAST_CHECK_INTERSECTIONS</source>
+        <translation>Fast intersection</translation>
+   </message>
+   <message>
         <source>STB_CHECK_FREE_BNDS</source>
         <translation>Check free boundaries</translation>
     </message>
@@ -4116,6 +4128,10 @@ Please, select face, shell or solid and try again</translation>
         <source>TOP_CHECK_SELF_INTERSECTIONS</source>
         <translation>Detect Self-intersections</translation>
     </message>
+    <message>
+        <source>TOP_FAST_CHECK_INTERSECTIONS</source>
+        <translation>Fast intersection</translation>
+    </message>
     <message>
         <source>TOP_CHECK_FREE_BNDS</source>
         <translation>Check free boundaries</translation>
@@ -7138,6 +7154,37 @@ Do you want to create new material?</translation>
     <translation>All interferences</translation>
   </message>
 </context>
+<context>
+    <name>MeasureGUI_FastCheckIntersectionsDlg</name>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_DEFLECT</source>
+        <translation>Deflection coefficient</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_DETECT_GAPS</source>
+        <translation>Detect gaps with tolerance</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_SUBSHAPES</source>
+        <translation>Sub-shapes of Object %1:</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_COMPUTE</source>
+        <translation>Compute intersections</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_INTERSECTION_NAME</source>
+        <translation>Fast_intersection</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_INTERSECTION_FAILS</source>
+        <translation>No intersections</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_OBJ</source>
+        <translation>Objects And Results</translation>
+    </message>
+</context>
 <context>
     <name>TransformationGUI_ExtensionDlg</name>
     <message>
index 0d42a5b679fac24d54b6feb0e13d63620cc97876..62edf16288199fcd1d544e3e302541f6a22b7c7d 100644 (file)
@@ -431,6 +431,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_CHECK_SELF_INTERSECTIONS</source>
         <translation>Détecter les auto-intersections</translation>
     </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INTERSECTIONS</source>
+        <translation type="unfinished">Fast intersection</translation>
+    </message>
     <message>
         <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
         <translation>La détection d&apos;auto-intersections a échoué</translation>
@@ -2464,6 +2468,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>MEN_CHECK_SELF_INTERSECTIONS</source>
         <translation>Détections des auto-intersections</translation>
     </message>
+    <message>
+        <source>MEN_FAST_CHECK_INTERSECTIONS</source>
+        <translation type="unfinished">Fast intersection</translation>
+    </message>
     <message>
         <source>MEN_CHECK_FREE_BNDS</source>
         <translation>Contrôler les contours libres</translation>
@@ -3452,6 +3460,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>STB_CHECK_SELF_INTERSECTIONS</source>
         <translation>Détecte les auto-intersections</translation>
     </message>
+    <message>
+        <source>STB_FAST_CHECK_INTERSECTIONS</source>
+        <translation type="unfinished">Fast intersection</translation>
+   </message>
     <message>
         <source>STB_CHECK_FREE_BNDS</source>
         <translation>Vérifier les contours libres</translation>
@@ -4060,6 +4072,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>TOP_CHECK_SELF_INTERSECTIONS</source>
         <translation>Détection des auto-intersections</translation>
     </message>
+    <message>
+        <source>TOP_FAST_CHECK_INTERSECTIONS</source>
+        <translation type="unfinished">Fast intersection</translation>
+    </message>
     <message>
         <source>TOP_CHECK_FREE_BNDS</source>
         <translation>Valider les contours libres</translation>
@@ -6999,4 +7015,160 @@ Voulez-vous en créer un nouveau ?</translation>
         <translation>V-Isoligne</translation>
     </message>
 </context>
+<context>
+    <name>MeasureGUI_CheckSelfIntersectionsDlg</name>
+    <message>
+        <source>GEOM_CHECK_INTE_INTERSECTIONS</source>
+        <translation type="unfinished">Self-intersections</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_SUBSHAPES</source>
+        <translation type="unfinished">Sub-shapes</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_CHECK_LEVEL</source>
+        <translation type="unfinished">Level of check</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_SUMMARY</source>
+        <translation type="unfinished">Summary</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_COMPUTE</source>
+        <translation type="unfinished">Compute self-intersections</translation>
+    </message>
+    <message>
+        <source>GEOM_SELF_INTERSECTION_NAME</source>
+        <translation type="unfinished">Self_intersection</translation>
+    </message>
+    <message>
+        <source>GEOM_NO_SELF_INTERSECTIONS</source>
+        <translation type="unfinished">There are no self-intersections in the shape</translation>
+    </message>
+    <message>
+        <source>GEOM_SELF_INTERSECTIONS_FOUND</source>
+        <translation type="unfinished">Some self-intersections detected</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
+        <translation type="unfinished">Detection of self-intersections failed</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_SELF_INTERSECTIONS_ERRORS</source>
+        <translation type="unfinished">Warning: there were errors during the operation, so the list may be incomplete.</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_V_V</source>
+        <translation type="unfinished">Vertex to Vertex</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_V_E</source>
+        <translation type="unfinished">Vertex to Edge + all above</translation>
+    </message>
+  <message>
+    <source>GEOM_CHECK_INTE_E_E</source>
+    <translation type="unfinished">Edge to Edge + all above</translation>
+  </message>
+  <message>
+    <source>GEOM_CHECK_INTE_V_F</source>
+    <translation type="unfinished">Vertex to Face + all above</translation>
+  </message>
+  <message>
+    <source>GEOM_CHECK_INTE_E_F</source>
+    <translation type="unfinished">Edge to Face + all above</translation>
+  </message>
+  <message>
+    <source>GEOM_CHECK_INTE_ALL</source>
+    <translation type="unfinished">All interferences</translation>
+  </message>
+</context>
+<context>
+    <name>MeasureGUI_FastCheckIntersectionsDlg</name>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_DEFLECT</source>
+        <translation type="unfinished">Deflection coefficient</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_DETECT_GAPS</source>
+        <translation type="unfinished">Detect gaps with tolerance</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_SUBSHAPES</source>
+        <translation type="unfinished">Sub-shapes of Object %1:</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_COMPUTE</source>
+        <translation type="unfinished">Compute intersections</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_INTERSECTION_NAME</source>
+        <translation type="unfinished">Fast_intersection</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_INTERSECTION_FAILS</source>
+        <translation type="unfinished">No intersections</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_OBJ</source>
+        <translation type="unfinished">Objects And Results</translation>
+    </message>
+</context>
+<context>
+    <name>TransformationGUI_ExtensionDlg</name>
+    <message>
+        <source>GEOM_EXTENSION_TITLE</source>
+        <translation type="unfinished">Extension of Edge or Face</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION</source>
+        <translation type="unfinished">Extension</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MIN</source>
+        <translation type="unfinished">First Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MAX</source>
+        <translation type="unfinished">Last Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MIN_U</source>
+        <translation type="unfinished">First U-Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MAX_U</source>
+        <translation type="unfinished">Last U-Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MIN_V</source>
+        <translation type="unfinished">First V-Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MAX_V</source>
+        <translation type="unfinished">Last V-Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_EDGE_NAME</source>
+        <translation type="unfinished">ExtendedEdge</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_FACE_NAME</source>
+        <translation type="unfinished">ExtendedFace</translation>
+    </message>
+</context>
+<context>
+    <name>EntityGUI_SurfFromFaceDlg</name>
+    <message>
+        <source>GEOM_SURF_FROM_FACE_TITLE</source>
+        <translation type="unfinished">Surface From Face Construction</translation>
+    </message>
+    <message>
+        <source>GEOM_SURF_FROM_FACE</source>
+        <translation type="unfinished">Surface From Face</translation>
+    </message>
+    <message>
+        <source>GEOM_SURF_FROM_FACE_NAME</source>
+        <translation type="unfinished">SurfaceFromFace</translation>
+    </message>
+</context>
 </TS>
index d7d25aab46a9fdf17c971700a398511c46114df0..8ef05204b56ddd8c49febe2afedaaf7a53699098 100644 (file)
       <source>GEOM_CHECK_SELF_INTERSECTIONS</source>
       <translation>自己交差の検出</translation>
     </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INTERSECTIONS</source>
+        <translation type="unfinished">Fast intersection</translation>
+    </message>
     <message>
       <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
       <translation>自己交差の検出に失敗しました</translation>
       <source>MEN_CHECK_SELF_INTERSECTIONS</source>
       <translation>自己交差の確認</translation>
     </message>
+    <message>
+        <source>MEN_FAST_CHECK_INTERSECTIONS</source>
+        <translation type="unfinished">Fast intersection</translation>
+    </message>
     <message>
       <source>MEN_CHECK_FREE_BNDS</source>
       <translation>自由境界の確認</translation>
       <source>STB_CHECK_SELF_INTERSECTIONS</source>
       <translation>自己交差の確認</translation>
     </message>
+    <message>
+        <source>STB_FAST_CHECK_INTERSECTIONS</source>
+        <translation type="unfinished">Fast intersection</translation>
+   </message>
     <message>
       <source>STB_CHECK_FREE_BNDS</source>
       <translation>自由境界をチェック</translation>
       <source>TOP_CHECK_SELF_INTERSECTIONS</source>
       <translation>自己交差の確認</translation>
     </message>
+    <message>
+        <source>TOP_FAST_CHECK_INTERSECTIONS</source>
+        <translation type="unfinished">Fast intersection</translation>
+    </message>
     <message>
       <source>TOP_CHECK_FREE_BNDS</source>
       <translation>自由境界を確認</translation>
       <translation>V-Isoline</translation>
     </message>
   </context>
+<context>
+    <name>MeasureGUI_CheckSelfIntersectionsDlg</name>
+    <message>
+        <source>GEOM_CHECK_INTE_INTERSECTIONS</source>
+        <translation type="unfinished">Self-intersections</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_SUBSHAPES</source>
+        <translation type="unfinished">Sub-shapes</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_CHECK_LEVEL</source>
+        <translation type="unfinished">Level of check</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_SUMMARY</source>
+        <translation type="unfinished">Summary</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_COMPUTE</source>
+        <translation type="unfinished">Compute self-intersections</translation>
+    </message>
+    <message>
+        <source>GEOM_SELF_INTERSECTION_NAME</source>
+        <translation type="unfinished">Self_intersection</translation>
+    </message>
+    <message>
+        <source>GEOM_NO_SELF_INTERSECTIONS</source>
+        <translation type="unfinished">There are no self-intersections in the shape</translation>
+    </message>
+    <message>
+        <source>GEOM_SELF_INTERSECTIONS_FOUND</source>
+        <translation type="unfinished">Some self-intersections detected</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
+        <translation type="unfinished">Detection of self-intersections failed</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_SELF_INTERSECTIONS_ERRORS</source>
+        <translation type="unfinished">Warning: there were errors during the operation, so the list may be incomplete.</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_V_V</source>
+        <translation type="unfinished">Vertex to Vertex</translation>
+    </message>
+    <message>
+        <source>GEOM_CHECK_INTE_V_E</source>
+        <translation type="unfinished">Vertex to Edge + all above</translation>
+    </message>
+  <message>
+    <source>GEOM_CHECK_INTE_E_E</source>
+    <translation type="unfinished">Edge to Edge + all above</translation>
+  </message>
+  <message>
+    <source>GEOM_CHECK_INTE_V_F</source>
+    <translation type="unfinished">Vertex to Face + all above</translation>
+  </message>
+  <message>
+    <source>GEOM_CHECK_INTE_E_F</source>
+    <translation type="unfinished">Edge to Face + all above</translation>
+  </message>
+  <message>
+    <source>GEOM_CHECK_INTE_ALL</source>
+    <translation type="unfinished">All interferences</translation>
+  </message>
+</context>
+<context>
+    <name>MeasureGUI_FastCheckIntersectionsDlg</name>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_DEFLECT</source>
+        <translation type="unfinished">Deflection coefficient</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_DETECT_GAPS</source>
+        <translation type="unfinished">Detect gaps with tolerance</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_SUBSHAPES</source>
+        <translation type="unfinished">Sub-shapes of Object %1:</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_INT_COMPUTE</source>
+        <translation type="unfinished">Compute intersections</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_INTERSECTION_NAME</source>
+        <translation type="unfinished">Fast_intersection</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_INTERSECTION_FAILS</source>
+        <translation type="unfinished">No intersections</translation>
+    </message>
+    <message>
+        <source>GEOM_FAST_CHECK_OBJ</source>
+        <translation type="unfinished">Objects And Results</translation>
+    </message>
+</context>
+<context>
+    <name>TransformationGUI_ExtensionDlg</name>
+    <message>
+        <source>GEOM_EXTENSION_TITLE</source>
+        <translation type="unfinished">Extension of Edge or Face</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION</source>
+        <translation type="unfinished">Extension</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MIN</source>
+        <translation type="unfinished">First Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MAX</source>
+        <translation type="unfinished">Last Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MIN_U</source>
+        <translation type="unfinished">First U-Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MAX_U</source>
+        <translation type="unfinished">Last U-Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MIN_V</source>
+        <translation type="unfinished">First V-Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_MAX_V</source>
+        <translation type="unfinished">Last V-Parameter</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_EDGE_NAME</source>
+        <translation type="unfinished">ExtendedEdge</translation>
+    </message>
+    <message>
+        <source>GEOM_EXTENSION_FACE_NAME</source>
+        <translation type="unfinished">ExtendedFace</translation>
+    </message>
+</context>
+<context>
+    <name>EntityGUI_SurfFromFaceDlg</name>
+    <message>
+        <source>GEOM_SURF_FROM_FACE_TITLE</source>
+        <translation type="unfinished">Surface From Face Construction</translation>
+    </message>
+    <message>
+        <source>GEOM_SURF_FROM_FACE</source>
+        <translation type="unfinished">Surface From Face</translation>
+    </message>
+    <message>
+        <source>GEOM_SURF_FROM_FACE_NAME</source>
+        <translation type="unfinished">SurfaceFromFace</translation>
+    </message>
+</context>
 </TS>
index a8e6f6bca41f48f46d50fab768d6140dd9ad1209..883347659648ea94496d8a16869f9bbda81e00c7 100644 (file)
@@ -638,6 +638,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
   case GEOMOp::OpGetNonBlocks:       // MENU MEASURE - Get NON BLOCKS
   case GEOMOp::OpPointCoordinates:   // MENU MEASURE - POINT COORDINATES
   case GEOMOp::OpCheckSelfInters:    // MENU MEASURE - CHECK SELF INTERSECTIONS
+  case GEOMOp::OpFastCheckInters:    // MENU MEASURE - FAST CHECK INTERSECTIONS
   case GEOMOp::OpManageDimensions:   // MENU MEASURE - MANAGE DIMENSIONS
   case GEOMOp::OpShowAllDimensions:  // POPUP MENU - SHOW ALL DIMENSIONS
   case GEOMOp::OpHideAllDimensions:  // POPUP MENU - HIDE ALL DIMENSIONS
@@ -1016,6 +1017,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpCheckCompound,    "CHECK_COMPOUND" );
   createGeomAction( GEOMOp::OpGetNonBlocks,     "GET_NON_BLOCKS" );
   createGeomAction( GEOMOp::OpCheckSelfInters,  "CHECK_SELF_INTERSECTIONS" );
+  createGeomAction( GEOMOp::OpFastCheckInters,  "FAST_CHECK_INTERSECTIONS" );
 
 #ifdef _DEBUG_ // PAL16821
   createGeomAction( GEOMOp::OpCheckGeom,        "CHECK_GEOMETRY" );
@@ -1273,6 +1275,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpCheckCompound,   measurId, -1 );
   createMenu( GEOMOp::OpGetNonBlocks,    measurId, -1 );
   createMenu( GEOMOp::OpCheckSelfInters, measurId, -1 );
+  createMenu( GEOMOp::OpFastCheckInters, measurId, -1 );
 
   int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
 #if defined(_DEBUG_) || defined(_DEBUG) // PAL16821
@@ -1420,6 +1423,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createTool( GEOMOp::OpCheckCompound,    measureTbId );
   createTool( GEOMOp::OpGetNonBlocks,     measureTbId );
   createTool( GEOMOp::OpCheckSelfInters,  measureTbId );
+  createTool( GEOMOp::OpFastCheckInters,  measureTbId );
 
   int picturesTbId = createTool( tr( "TOOL_PICTURES" ), QString( "GEOMPictures" ) );
   createTool( GEOMOp::OpPictureImport,    picturesTbId );
index 7243340f4c850011e4c65e57f230b71bcfe02fff..8b01f7a0feef1a15bdc8be615f6da173ec265f8a 100644 (file)
@@ -194,6 +194,7 @@ namespace GEOMOp {
     OpManageDimensions    = 5014,   // MENU MEASURES - MANAGE DIMENSIONS
     OpShowAllDimensions   = 5015,   // POPUP MENU - SHOW ALL DIMENSIONS
     OpHideAllDimensions   = 5016,   // POPUP MENU - HIDE ALL DIMENSIONS
+    OpFastCheckInters     = 5017,   // MENU MEASURES - FAST CHECK INTERSECTIONS
     // GroupGUI --------------------//--------------------------------
     OpGroupCreate         = 6000,   // MENU GROUP - CREATE
     OpGroupEdit           = 6001,   // MENU GROUP - EDIT
index 29436dabcf97fd78eb327968bd958e96322913bc..2a889628131c17b0caae6c060b00d9845b02794e 100755 (executable)
@@ -30,6 +30,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/BlockFix
   ${PROJECT_SOURCE_DIR}/src/GEOMAlgo 
   ${PROJECT_SOURCE_DIR}/src/GEOMUtils
+  ${PROJECT_SOURCE_DIR}/src/OCC2VTK
   ${PROJECT_SOURCE_DIR}/src/SKETCHER
   ${PROJECT_SOURCE_DIR}/src/ARCHIMEDE
   ${PROJECT_SOURCE_DIR}/src/XAO
@@ -48,7 +49,7 @@ SET(_link_LIBRARIES
   ${CAS_TKFeat}
   ${CAS_TKFillet}
   ${PYTHON_LIBRARIES}
-  ShHealOper GEOMbasic BlockFix GEOMAlgo GEOMUtils GEOMSketcher GEOMArchimede XAO
+  ShHealOper GEOMbasic BlockFix GEOMAlgo GEOMUtils GEOMSketcher GEOMArchimede XAO OCC2VTK
   ${KERNEL_SALOMELocalTrace}
   )
 
index fb2320ea5cef74e4d237a89c1b6be2ba9d7a1005..3d7601a7677560a757c5e473b92184bf4008e499 100644 (file)
@@ -30,6 +30,7 @@
 #include <GEOMAlgo_AlgoTools.hxx>
 #include <GEOMAlgo_KindOfName.hxx>
 #include <GEOMAlgo_ShapeInfoFiller.hxx>
+#include <OCC2VTK_Tools.h>
 
 #include <GEOM_PythonDump.hxx>
 
@@ -48,6 +49,7 @@
 #include <BRepClass3d_SolidClassifier.hxx>
 #include <BRepClass_FaceClassifier.hxx>
 #include <BRepExtrema_DistShapeShape.hxx>
+#include <BRepExtrema_ShapeProximity.hxx>
 #include <BRepGProp.hxx>
 #include <BRepTools.hxx>
 #include <BRep_Tool.hxx>
@@ -1575,6 +1577,88 @@ bool GEOMImpl_IMeasureOperations::CheckSelfIntersections
   return isGood;
 }
 
+//=============================================================================
+/*!
+ *  FastIntersect
+ */
+//=============================================================================
+bool GEOMImpl_IMeasureOperations::FastIntersect (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) theShape2,
+                                                 double theTolerance, float theDeflection,
+                                                 Handle(TColStd_HSequenceOfInteger)& theIntersections1,
+                                                 Handle(TColStd_HSequenceOfInteger)& theIntersections2)
+{
+  SetErrorCode(KO);
+  bool isGood = false;
+
+  if (theIntersections1.IsNull())
+    theIntersections1 = new TColStd_HSequenceOfInteger;
+  else
+    theIntersections1->Clear();
+
+  if (theIntersections2.IsNull())
+    theIntersections2 = new TColStd_HSequenceOfInteger;
+  else
+    theIntersections2->Clear();
+
+  if (theShape1.IsNull() || theShape2.IsNull()) {
+    SetErrorCode("Objects have NULL Shape");
+    return isGood;
+  }
+
+  if (theShape1 == theShape2) {
+    SetErrorCode("Objects are equal");
+    return isGood;
+  }
+  Handle(GEOM_Function) aRefShape1 = theShape1->GetLastFunction();
+  Handle(GEOM_Function) aRefShape2 = theShape2->GetLastFunction();
+  if (aRefShape1.IsNull() || aRefShape2.IsNull()) return isGood;
+
+  TopoDS_Shape aShape1 = aRefShape1->GetValue();
+  TopoDS_Shape aShape2 = aRefShape2->GetValue();
+  if (aShape1.IsNull() || aShape2.IsNull()) return isGood;
+
+  // 0. Prepare data
+  TopoDS_Shape aScopy1, aScopy2;
+  GEOMAlgo_AlgoTools::CopyShape(aShape1, aScopy1);
+  GEOMAlgo_AlgoTools::CopyShape(aShape2, aScopy2);
+
+  float aDeflection = (theDeflection <= 0.) ? 0.001 : theDeflection;
+  GEOM::MeshShape(aScopy1, aDeflection);
+  GEOM::MeshShape(aScopy2, aDeflection);
+  //
+  // Map sub-shapes and their indices
+  TopTools_IndexedMapOfShape anIndices1, anIndices2;
+  TopExp::MapShapes(aScopy1, anIndices1);
+  TopExp::MapShapes(aScopy2, anIndices2);
+
+  BOPCol_ListOfShape aLCS1, aLCS2;
+  aLCS1.Append(aScopy1); aLCS2.Append(aScopy2);
+  //
+  BRepExtrema_ShapeProximity aBSP; // checker of fast interferences
+  aBSP.LoadShape1(aScopy1); aBSP.LoadShape2(aScopy2);
+  aBSP.SetTolerance((theTolerance <= 0.) ? 0.0 : theTolerance);
+
+  // 1. Launch the checker
+  aBSP.Perform();
+  // 2. Get sets of IDs of overlapped faces
+  for (BRepExtrema_OverlappedSubShapes::Iterator anIt1 (aBSP.OverlapSubShapes1()); anIt1.More(); anIt1.Next()) {
+    const TopoDS_Shape& aS1 = aBSP.GetSubShape1(anIt1.Key());
+    theIntersections1->Append(anIndices1.FindIndex(aS1));
+  }
+  
+  for (BRepExtrema_OverlappedSubShapes::Iterator anIt2 (aBSP.OverlapSubShapes2()); anIt2.More(); anIt2.Next()) {
+    const TopoDS_Shape& aS2 = aBSP.GetSubShape2(anIt2.Key());
+    theIntersections2->Append(anIndices2.FindIndex(aS2));
+  }
+
+  isGood = !theIntersections1->IsEmpty() && !theIntersections1->IsEmpty();
+
+  if (aBSP.IsDone())
+    SetErrorCode(OK);
+
+  return isGood;
+}
 //=============================================================================
 /*!
  *  IsGoodForSolid
index 3b8ae3d42279502ae9214b52053417027a80253b..9712e33c277f24a7e73c23e20092279642ac9adb 100644 (file)
@@ -157,6 +157,11 @@ class GEOMImpl_IMeasureOperations : public GEOM_IOperations {
   Standard_EXPORT bool CheckSelfIntersections (Handle(GEOM_Object) theShape,
                                                const SICheckLevel  theCheckLevel,
                                                Handle(TColStd_HSequenceOfInteger)& theIntersections);
+  
+  Standard_EXPORT bool FastIntersect (Handle(GEOM_Object) theShape1, Handle(GEOM_Object) theShape2,
+                                      double tolerance, float deflection,
+                                      Handle(TColStd_HSequenceOfInteger)& theIntersections1,
+                                      Handle(TColStd_HSequenceOfInteger)& theIntersections2);
 
   Standard_EXPORT TCollection_AsciiString IsGoodForSolid (Handle(GEOM_Object) theShape);
 
index 0d4a89effb2514e7e598e33197b4dbf2eb43b4dd..e8a8272a8e97fa697633f11d52e7db6b5e91625f 100644 (file)
@@ -765,6 +765,59 @@ CORBA::Boolean GEOM_IMeasureOperations_i::CheckSelfIntersections (GEOM::GEOM_Obj
   return isGood;
 }
 
+//=============================================================================
+/*!
+ *  FastIntersect
+ */
+//=============================================================================
+CORBA::Boolean GEOM_IMeasureOperations_i::FastIntersect (GEOM::GEOM_Object_ptr theShape1,
+                                                         GEOM::GEOM_Object_ptr theShape2,
+                                                         CORBA::Double         theTolerance,
+                                                         CORBA::Float          theDeflection,
+                                                         GEOM::ListOfLong_out  theIntersections1,
+                                                         GEOM::ListOfLong_out  theIntersections2)
+{
+  // Set a not done flag
+  GetOperations()->SetNotDone();
+
+  bool isGood = false;
+
+  // Allocate the CORBA arrays
+  GEOM::ListOfLong_var anIntegersArray1 = new GEOM::ListOfLong();
+  GEOM::ListOfLong_var anIntegersArray2 = new GEOM::ListOfLong();
+
+  // Get the reference shape
+  Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
+  Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
+  
+  if (!aShape1.IsNull() && !aShape2.IsNull()) {
+    Handle(TColStd_HSequenceOfInteger) anIntegers1 = new TColStd_HSequenceOfInteger;
+    Handle(TColStd_HSequenceOfInteger) anIntegers2 = new TColStd_HSequenceOfInteger;
+
+    // Detect intersections
+    isGood = GetOperations()->FastIntersect
+      (aShape1, aShape2, theTolerance, theDeflection, anIntegers1, anIntegers2);
+
+    int nbInts1 = anIntegers1->Length();
+    int nbInts2 = anIntegers2->Length();
+
+    anIntegersArray1->length(nbInts1);
+    anIntegersArray2->length(nbInts2);
+
+    for (int ii = 0; ii < nbInts1; ii++) {
+      anIntegersArray1[ii] = anIntegers1->Value(ii + 1);
+    }
+    for (int ii = 0; ii < nbInts2; ii++) {
+      anIntegersArray2[ii] = anIntegers2->Value(ii + 1);
+    }
+  }
+
+  // Initialize out-parameters with local arrays
+  theIntersections1 = anIntegersArray1._retn();
+  theIntersections2 = anIntegersArray2._retn();
+  return isGood;
+}
+
 //=============================================================================
 /*!
  *  IsGoodForSolid
index 391de3f48e60807d4b2689c1a1daf4b094cb4812..6f595d52120a07897849b88f6b23306d479a8eb7 100644 (file)
@@ -100,6 +100,13 @@ class GEOM_I_EXPORT GEOM_IMeasureOperations_i :
                                          CORBA::Long           theCheckLevel,
                                          GEOM::ListOfLong_out  theIntersections);
 
+  CORBA::Boolean FastIntersect (GEOM::GEOM_Object_ptr theShape1,
+                                GEOM::GEOM_Object_ptr theShape2,
+                                CORBA::Double         theTolerance,
+                                CORBA::Float         theDeflection,
+                                GEOM::ListOfLong_out  theIntersections1,
+                                GEOM::ListOfLong_out  theIntersections2);
+
   char* IsGoodForSolid (GEOM::GEOM_Object_ptr theShape);
 
   char* WhatIs (GEOM::GEOM_Object_ptr theShape);
index 2aed6d6a5a2c3c4bb7c1454883956a1998f7c126..22657306d5e95e9e4764fd7c81714d18ee3d8621 100644 (file)
@@ -56,6 +56,12 @@ def TestMeasureOperations (geompy, math):
   if geompy.CheckSelfIntersections(Compound_1) == True:
     raise RuntimeError, "Existing self-intersection is not detected"
 
+  ####### Detect Fast intersection #######
+
+  cylinder = geompy.MakeCylinderRH(100, 300)
+  if geompy.FastIntersect(box, cylinder) == False:
+    raise RuntimeError, "Existing intersection is not detected"
+
   ####### WhatIs #######
 
   Descr = geompy.WhatIs(box)
index b5e1ca8082cca7b585d9198051ee821d6d547f7f..fd3cecc0eaf6bb8260082f16b434b5b914f846fa 100755 (executable)
@@ -4869,7 +4869,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @param theShape Shape to find free faces in.
         #  @return List of IDs of all free faces, contained in theShape.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_free_faces_page "Example"
         @ManageTransactions("ShapesOp")
         def GetFreeFacesIDs(self,theShape):
             """
@@ -7000,7 +7000,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  \n \a theClosedWires: Closed wires on the free boundary of the given shape.
         #  \n \a theOpenWires: Open wires on the free boundary of the given shape.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_free_boundaries_page "Example"
         @ManageTransactions("HealOp")
         def GetFreeBoundary(self, theObject, theName=None):
             """
@@ -10008,7 +10008,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         ## Get point coordinates
         #  @return [x, y, z]
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_point_coordinates_page "Example"
         @ManageTransactions("MeasuOp")
         def PointCoordinates(self,Point):
             """
@@ -10084,7 +10084,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  theSurfArea: Area of surface of the given shape.\n
         #  theVolume:   Volume of the given shape.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_basic_properties_page "Example"
         @ManageTransactions("MeasuOp")
         def BasicProperties(self,theShape):
             """
@@ -10113,7 +10113,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  Ymin,Ymax: Limits of shape along OY axis.
         #  Zmin,Zmax: Limits of shape along OZ axis.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_bounding_box_page "Example"
         @ManageTransactions("MeasuOp")
         def BoundingBox (self, theShape, precise=False):
             """
@@ -10143,7 +10143,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @return New GEOM.GEOM_Object, containing the created box.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_bounding_box_page "Example"
         @ManageTransactions("MeasuOp")
         def MakeBoundingBox (self, theShape, precise=False, theName=None):
             """
@@ -10171,7 +10171,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  I(1-3)(1-3): Components of the inertia matrix of the given shape.
         #  Ix,Iy,Iz:    Moments of inertia of the given shape.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_inertia_page "Example"
         @ManageTransactions("MeasuOp")
         def Inertia(self,theShape):
             """
@@ -10214,7 +10214,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @param theShape1,theShape2 Shapes to find minimal distance between.
         #  @return Value of the minimal distance between the given shapes.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_min_distance_page "Example"
         @ManageTransactions("MeasuOp")
         def MinDistance(self, theShape1, theShape2):
             """
@@ -10236,7 +10236,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @return Value of the minimal distance between the given shapes, in form of list
         #          [Distance, DX, DY, DZ].
         #
-        #  @ref swig_all_measure "Example"
+        #  @ref tui_min_distance_page "Example"
         @ManageTransactions("MeasuOp")
         def MinDistanceComponents(self, theShape1, theShape2):
             """
@@ -10260,7 +10260,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @return The number of found solutions (-1 in case of infinite number of
         #          solutions) and a list of (X, Y, Z) coordinates for all couples of points.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_min_distance_page "Example"
         @ManageTransactions("MeasuOp")
         def ClosestPoints (self, theShape1, theShape2):
             """
@@ -10284,7 +10284,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #        with their orientations, otherwise the minimum angle is computed.
         #  @return Value of the angle between the given shapes in degrees.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_angle_page "Example"
         @ManageTransactions("MeasuOp")
         def GetAngle(self, theShape1, theShape2):
             """
@@ -10311,7 +10311,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #        with their orientations, otherwise the minimum angle is computed.
         #  @return Value of the angle between the given shapes in radians.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_angle_page "Example"
         @ManageTransactions("MeasuOp")
         def GetAngleRadians(self, theShape1, theShape2):
             """
@@ -10339,7 +10339,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #                 if False, the opposite vector to the normal vector is used.
         #  @return Value of the angle between the given vectors in degrees.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_angle_page "Example"
         @ManageTransactions("MeasuOp")
         def GetAngleVectors(self, theShape1, theShape2, theFlag = True):
             """
@@ -10532,7 +10532,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  EdgeMin,EdgeMax: Min and max tolerances of the edges.\n
         #  VertMin,VertMax: Min and max tolerances of the vertices.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_tolerance_page "Example"
         @ManageTransactions("MeasuOp")
         def Tolerance(self,theShape):
             """
@@ -10556,7 +10556,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @param theShape Shape to be described.
         #  @return Description of the given shape.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_whatis_page "Example"
         @ManageTransactions("MeasuOp")
         def WhatIs(self,theShape):
             """
@@ -10643,7 +10643,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #
         #  @return New GEOM.GEOM_Object, containing the created point.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_center_of_mass_page "Example"
         @ManageTransactions("MeasuOp")
         def MakeCDG(self, theShape, theName=None):
             """
@@ -10789,7 +10789,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @return If theReturnStatus is equal to 1 the description is returned.
         #          Otherwise doesn't return anything.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_check_shape_page "Example"
         @ManageTransactions("MeasuOp")
         def PrintShapeErrors(self, theShape, theShapeErrors, theReturnStatus = 0):
             """
@@ -10829,7 +10829,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #          If theReturnStatus is equal to 2 the list of error data is
         #          returned along with IsValid flag.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_check_shape_page "Example"
         @ManageTransactions("MeasuOp")
         def CheckShape(self,theShape, theIsCheckGeom = 0, theReturnStatus = 0):
             """
@@ -10884,7 +10884,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #         - GEOM.SI_ALL(5) - all interferences.
         #  @return TRUE, if the shape contains no self-intersections.
         #
-        #  @ref tui_measurement_tools_page "Example"
+        #  @ref tui_check_self_intersections_page "Example"
         @ManageTransactions("MeasuOp")
         def CheckSelfIntersections(self, theShape, theCheckLevel = GEOM.SI_ALL):
             """
@@ -10909,6 +10909,43 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
             RaiseIfFailed("CheckSelfIntersections", 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
+        #  @param theTolerance Specifies a distance between shapes used for detecting gaps:
+        #         - if \a theTolerance <= 0, algorithm detects intersections (default behavior)
+        #         - if \a theTolerance > 0, algorithm detects gaps
+        #  @param theDeflection Linear deflection coefficient that specifies quality of tesselation:
+        #         - if \a theDeflection <= 0, default deflection 0.001 is used
+        #  @return TRUE, if there are intersections (gaps) between source shapes
+        #  @return List of sub-shapes IDs from 1st shape that localize intersection.
+        #  @return List of sub-shapes IDs from 2nd shape that localize intersection.
+        #
+        #  @ref tui_fast_intersection_page "Example"
+        @ManageTransactions("MeasuOp")
+        def FastIntersect(self, theShape1, theShape2, theTolerance = 0.0, theDeflection = 0.001):
+            """
+            Detect intersections of the given shapes with algorithm based on mesh intersections.
+
+            Parameters:
+                theShape1 First source object
+                theShape2 Second source object
+                theTolerance Specifies a distance between shapes used for detecting gaps:
+                    - if theTolerance <= 0, algorithm detects intersections (default behavior)
+                    - if theTolerance > 0, algorithm detects gaps
+                theDeflection Linear deflection coefficient that specifies quality of tesselation:
+                    - if theDeflection <= 0, default deflection 0.001 is used
+            Returns:
+                TRUE, if there are intersections (gaps) between source shapes
+                List of sub-shapes IDs from 1st shape that localize intersection.
+                List of sub-shapes IDs from 2nd shape that localize intersection.
+            """
+            # Example: see GEOM_TestMeasures.py
+            IsOk, Res1, Res2 = self.MeasuOp.FastIntersect(theShape1, theShape2, theTolerance, theDeflection)
+            RaiseIfFailed("FastIntersect", self.MeasuOp)
+            return IsOk, Res1, Res2
+
         ## Get position (LCS) of theShape.
         #
         #  Origin of the LCS is situated at the shape's center of mass.
@@ -11710,7 +11747,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #  @return TRUE, if the given shape is a compound of blocks.
         #  If theCompound is not valid, prints all discovered errors.
         #
-        #  @ref tui_measurement_tools_page "Example 1"
+        #  @ref tui_check_compound_of_blocks_page "Example 1"
         #  \n @ref swig_CheckCompoundOfBlocks "Example 2"
         @ManageTransactions("BlocksOp")
         def CheckCompoundOfBlocks(self,theCompound):
@@ -11749,7 +11786,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
         #          presence of non-quadrangular faces). The second object is a
         #          group of all non quadrangular faces.
         #
-        #  @ref tui_measurement_tools_page "Example 1"
+        #  @ref tui_get_non_blocks_page "Example 1"
         #  \n @ref swig_GetNonBlocks "Example 2"
         @ManageTransactions("BlocksOp")
         def GetNonBlocks (self, theShape, theName=None):
index 8f57e40ad500c0f97f5b50fdf178d37611007604..fe15eedc06cbc727fe6f2c76d426e405f1d921d5 100755 (executable)
@@ -97,6 +97,7 @@ SET(MeasureGUI_HEADERS
   MeasureGUI_CheckCompoundOfBlocksDlg.h
   MeasureGUI_GetNonBlocksDlg.h
   MeasureGUI_CheckSelfIntersectionsDlg.h
+  MeasureGUI_FastCheckIntersectionsDlg.h
   MeasureGUI_PointDlg.h
   MeasureGUI_ManageDimensionsDlg.h
   MeasureGUI_CreateDimensionDlg.h
@@ -123,6 +124,7 @@ SET(_moc_HEADERS
   MeasureGUI_CheckCompoundOfBlocksDlg.h
   MeasureGUI_GetNonBlocksDlg.h
   MeasureGUI_CheckSelfIntersectionsDlg.h
+  MeasureGUI_FastCheckIntersectionsDlg.h
   MeasureGUI_PointDlg.h
   MeasureGUI_ManageDimensionsDlg.h
   MeasureGUI_CreateDimensionDlg.h
@@ -154,6 +156,7 @@ SET(MeasureGUI_SOURCES
   MeasureGUI_CheckCompoundOfBlocksDlg.cxx
   MeasureGUI_GetNonBlocksDlg.cxx
   MeasureGUI_CheckSelfIntersectionsDlg.cxx
+  MeasureGUI_FastCheckIntersectionsDlg.cxx
   MeasureGUI_PointDlg.cxx
   MeasureGUI_ManageDimensionsDlg.cxx
   MeasureGUI_CreateDimensionDlg.cxx
index 3f5358745c0d2fbd527457563652778fc1951f5e..1c5d61b95734512a7b3c5654f1c2b9209a5f3fe6 100644 (file)
@@ -50,6 +50,7 @@
 #include "MeasureGUI_CheckCompoundOfBlocksDlg.h"  // Method CHECKCOMPOUND
 #include "MeasureGUI_GetNonBlocksDlg.h"           // Method GET NON BLOCKS
 #include "MeasureGUI_CheckSelfIntersectionsDlg.h" // Method CHECK SELF INTERSCTIONS
+#include "MeasureGUI_FastCheckIntersectionsDlg.h" // Method FAST CHECK INTERSCTIONS
 #include "MeasureGUI_PointDlg.h"                  // Method POINTCOORDINATES
 #include "MeasureGUI_ManageDimensionsDlg.h"       // Method MANAGEDIMENSIONS
 
@@ -125,6 +126,9 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
   case GEOMOp::OpCheckSelfInters:
     dlg = new MeasureGUI_CheckSelfIntersectionsDlg( getGeometryGUI(), parent );
     break; // CHECK SELF INTERSCTIONS
+  case GEOMOp::OpFastCheckInters:
+    dlg = new MeasureGUI_FastCheckIntersectionsDlg( getGeometryGUI(), parent );
+    break; // FAST CHECK INTERSCTIONS
   case GEOMOp::OpPointCoordinates:
     dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
     break; // POINT COORDINATES
diff --git a/src/MeasureGUI/MeasureGUI_FastCheckIntersectionsDlg.cxx b/src/MeasureGUI/MeasureGUI_FastCheckIntersectionsDlg.cxx
new file mode 100644 (file)
index 0000000..a9ba962
--- /dev/null
@@ -0,0 +1,696 @@
+// Copyright (C) 2007-2014  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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : MeasureGUI_FastCheckIntersectionsDlg.cxx
+
+#include "MeasureGUI_FastCheckIntersectionsDlg.h"
+#include "MeasureGUI.h"
+
+#include <SUIT_OverrideCursor.h>
+#include <SUIT_Session.h>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_MessageBox.h>
+#include <LightApp_SelectionMgr.h>
+#include <SalomeApp_Tools.h>
+#include <SalomeApp_Application.h>
+
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TColStd_MapOfInteger.hxx>
+
+#include <DlgRef.h>
+#include <GeometryGUI.h>
+#include <GEOMBase.h>
+#include <GEOMImpl_Types.hxx>
+
+#include <QListWidget>
+
+#define TEXTEDIT_FONT_FAMILY "Courier"
+#define TEXTEDIT_FONT_SIZE 11
+//=================================================================================
+// class    : MeasureGUI_FastCheckIntersectionsDlg()
+// purpose  : Constructs a MeasureGUI_FastCheckIntersectionsDlg which is a child of 'parent', with the
+//            name 'name' and widget flags set to 'f'.
+//            The dialog will by default be modeless, unless you set 'modal' to
+//            true to construct a modal dialog.
+//=================================================================================
+MeasureGUI_FastCheckIntersectionsDlg::MeasureGUI_FastCheckIntersectionsDlg (GeometryGUI* GUI, QWidget* parent)
+  : GEOMBase_Skeleton (GUI, parent, false),
+    mySelButton1       (0),
+    mySelButton2       (0),
+    myEditObjName1     (0),
+    myEditObjName2     (0),
+    myDetGaps          (0),
+    myTolerance        (0),
+    myDeflection       (0),
+    myComputeButton    (0),
+    myShapeList1       (0),
+    myShapeList2       (0)
+{
+  SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+  QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FAST_CHECK_INTERSECTIONS")));
+  QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+
+  setWindowTitle(tr("GEOM_FAST_CHECK_INTERSECTIONS"));
+
+  /***************************************************************/
+  mainFrame()->GroupConstructors->setTitle(tr("GEOM_FAST_CHECK_INTERSECTIONS"));
+  mainFrame()->RadioButton1->setIcon(image0);
+  mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose );
+  mainFrame()->RadioButton2->close();
+  mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
+  mainFrame()->RadioButton3->close();
+
+  QGroupBox *aGrp      = new QGroupBox(tr("GEOM_FAST_CHECK_OBJ"));
+  QLabel    *anObjLbl1  = new QLabel(tr("GEOM_OBJECT_I").arg("1"));
+  QLabel    *anObjLbl2  = new QLabel(tr("GEOM_OBJECT_I").arg("2"));
+  QLabel    *aShapeLbl1 = new QLabel(tr("GEOM_FAST_CHECK_INT_SUBSHAPES").arg("1"));
+  QLabel    *aShapeLbl2 = new QLabel(tr("GEOM_FAST_CHECK_INT_SUBSHAPES").arg("2"));
+  QLabel    *aDeflectLbl = new QLabel(tr("GEOM_FAST_CHECK_INT_DEFLECT"));
+  QFont      aFont (TEXTEDIT_FONT_FAMILY, TEXTEDIT_FONT_SIZE);
+
+  aFont.setStyleHint(QFont::TypeWriter, QFont::PreferAntialias);
+
+  mySelButton1 = new QPushButton;
+  mySelButton1->setIcon(image1);
+  mySelButton1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+  mySelButton2 = new QPushButton;
+  mySelButton2->setIcon(image1);
+  mySelButton2->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+
+  myEditObjName1 = new QLineEdit;
+  myEditObjName1->setReadOnly(true);
+  myEditObjName2 = new QLineEdit;
+  myEditObjName2->setReadOnly(true);
+
+  myDetGaps = new QCheckBox( tr( "GEOM_FAST_CHECK_INT_DETECT_GAPS" ));
+  myTolerance = new SalomeApp_DoubleSpinBox;
+  myDeflection = new SalomeApp_DoubleSpinBox;
+  myShapeList1  = new QListWidget;
+  myShapeList2 = new QListWidget;
+  myShapeList1->setSelectionMode(QAbstractItemView::ExtendedSelection);
+  myShapeList2->setSelectionMode(QAbstractItemView::ExtendedSelection);
+
+  myComputeButton = new QPushButton(tr("GEOM_FAST_CHECK_INT_COMPUTE"));
+
+  QGridLayout *aGrpLayout = new QGridLayout(aGrp);
+  aGrpLayout->setMargin(9);
+  aGrpLayout->setSpacing(6);
+  aGrpLayout->addWidget(anObjLbl1,       0, 0);
+  aGrpLayout->addWidget(mySelButton1,    0, 1);
+  aGrpLayout->addWidget(myEditObjName1,  0, 2);
+  aGrpLayout->addWidget(anObjLbl2,       1, 0);
+  aGrpLayout->addWidget(mySelButton2,    1, 1);
+  aGrpLayout->addWidget(myEditObjName2,  1, 2);
+  aGrpLayout->addWidget(aDeflectLbl,     2, 0);
+  aGrpLayout->addWidget(myDeflection,    2, 1, 1, 2);
+  aGrpLayout->addWidget(myDetGaps,       3, 0);
+  aGrpLayout->addWidget(myTolerance,     3, 1, 1, 2);
+  aGrpLayout->addWidget(myComputeButton, 4, 0, 1, 3);
+  
+  QGridLayout *aGrpLayout2 = new QGridLayout();
+  aGrpLayout->addLayout(aGrpLayout2,     5, 0, 1, 3);
+  aGrpLayout2->addWidget(aShapeLbl1,     0, 0);
+  aGrpLayout2->addWidget(aShapeLbl2,     0, 1);
+  aGrpLayout2->addWidget(myShapeList1,   1, 0);
+  aGrpLayout2->addWidget(myShapeList2,   1, 1);
+
+  QVBoxLayout* layout = new QVBoxLayout (centralWidget());
+  layout->setMargin(0); layout->setSpacing(6);
+  layout->addWidget(aGrp);
+
+  /***************************************************************/
+
+  myHelpFileName = "fast_intersection_page.html";
+
+  // Initialisation 
+  Init();
+}
+
+//=================================================================================
+// function : ~MeasureGUI_FastCheckIntersectionsDlg()
+// purpose  : Destroys the object and frees any allocated resources
+//=================================================================================
+MeasureGUI_FastCheckIntersectionsDlg::~MeasureGUI_FastCheckIntersectionsDlg()
+{
+}
+
+//=================================================================================
+// function : Init()
+// purpose  :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::Init()
+{
+  myObj1.nullify();
+  myObj2.nullify();
+  myEditObjName1->setText("");
+  myEditObjName2->setText("");
+  myEditObjName1->setEnabled(true);
+  myEditObjName2->setEnabled(false);
+
+  myDetGaps->setChecked(false);
+  double SpecificStep = 0.001;
+  double prec = Precision::Confusion();
+  initSpinBox(myTolerance, prec, MAX_NUMBER, SpecificStep);
+  myTolerance->setValue(SpecificStep);
+  myTolerance->setEnabled(false);
+
+  // Obtain deflection from preferences
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+  const char* quantity = "deflection_coeff";
+  double aDeflection = resMgr->doubleValue("Geometry", quantity, 0.00001); 
+  initSpinBox(myDeflection, prec, 1.0, aDeflection);
+  myDeflection->setValue(aDeflection);
+
+  myEditCurrentArgument = myEditObjName1;
+
+  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(mySelButton1,       SIGNAL(clicked()),
+          this,               SLOT(SetEditCurrentArgument()));
+  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(myShapeList1,       SIGNAL(itemSelectionChanged()),
+          SLOT(onSubShapesListSelectionChanged()));
+  connect(myShapeList2,       SIGNAL(itemSelectionChanged()),
+          SLOT(onSubShapesListSelectionChanged()));
+  connect(myComputeButton,    SIGNAL(clicked()), this, SLOT(onCompute()));
+
+  LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
+
+  connect(aSel,               SIGNAL(currentSelectionChanged()),
+          this,               SLOT(SelectionIntoArgument()));
+
+  initName(tr("GEOM_FAST_INTERSECTION_NAME"));
+  buttonOk()->setEnabled(false);
+  buttonApply()->setEnabled(false);
+  myComputeButton->setEnabled(false);
+  activateSelection();
+
+  mySelButton1->click();
+  SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : clear
+// purpose  :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::clear()
+{
+  disconnect(myShapeList1, SIGNAL(itemSelectionChanged()), this, 0);
+  disconnect(myShapeList2, SIGNAL(itemSelectionChanged()), this, 0);
+  myShapeList1->clear();
+  myShapeList2->clear();
+  connect(myShapeList1,    SIGNAL(itemSelectionChanged()),
+          SLOT(onSubShapesListSelectionChanged()));
+  connect(myShapeList2,    SIGNAL(itemSelectionChanged()),
+          SLOT(onSubShapesListSelectionChanged()));
+  erasePreview();
+  buttonOk()->setEnabled(false);
+  buttonApply()->setEnabled(false);
+  myComputeButton->setEnabled(true);
+}
+
+//=================================================================================
+// function : onCompute
+// purpose  :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::onCompute()
+{
+  myShapeList1->clear();
+  myShapeList2->clear();
+
+  if (!findIntersections()) {
+    myShapeList1->addItem(tr("GEOM_FAST_INTERSECTION_FAILS"));
+    myShapeList1->setEnabled(false);
+    myShapeList2->addItem(tr("GEOM_FAST_INTERSECTION_FAILS"));
+    myShapeList2->setEnabled(false);
+    return;
+  }
+  
+  myShapeList1->setEnabled(true);
+  myShapeList2->setEnabled(true);
+  QStringList aSubShapeList1, aSubShapeList2;
+  TopoDS_Shape aSelShape1, aSelShape2;
+  if (myObj1 && GEOMBase::GetShape(myObj1.get(), aSelShape1) && myObj2
+                     && GEOMBase::GetShape(myObj2.get(), aSelShape2)) {
+    TopTools_IndexedMapOfShape anIndices1, anIndices2;
+    TopExp::MapShapes(aSelShape1, anIndices1);
+    TopExp::MapShapes(aSelShape2, anIndices2);
+
+    //Sub-shapes of 1st Object
+    for (int i = 0; i < myInters1->length(); i++) {
+      TopoDS_Shape aSubShape = anIndices1.FindKey(myInters1[i]);
+      QString aType = GEOMBase::GetShapeTypeString(aSubShape);
+      if (!aType.isEmpty())
+        aSubShapeList1.append(QString("%1_%2").arg(aType).arg(myInters1[i]));
+    }
+    myShapeList1->addItems(aSubShapeList1);
+    myShapeList1->selectAll();
+
+    //Sub-shapes of second Object
+    for (int i = 0; i < myInters2->length(); i++) {
+      TopoDS_Shape aSubShape = anIndices2.FindKey(myInters2[i]);
+      QString aType = GEOMBase::GetShapeTypeString(aSubShape);
+      if (!aType.isEmpty())
+        aSubShapeList2.append(QString("%1_%2").arg(aType).arg(myInters2[i]));
+    }
+    myShapeList2->addItems(aSubShapeList2);
+    myShapeList2->selectAll();
+  }
+
+  buttonOk()->setEnabled(true);
+  buttonApply()->setEnabled(true);
+  myComputeButton->setEnabled(false);
+}
+
+//=================================================================================
+// function : ActivateThisDialog
+// purpose  :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::ActivateThisDialog()
+{
+  GEOMBase_Skeleton::ActivateThisDialog();
+
+  LightApp_SelectionMgr* aSel = myGeomGUI->getApp()->selectionMgr();
+  if ( aSel )
+    connect( aSel, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+
+  activateSelection();
+  DISPLAY_PREVIEW_MACRO
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose  : public slot to deactivate if active
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::DeactivateActiveDialog()
+{
+  GEOMBase_Skeleton::DeactivateActiveDialog();
+}
+
+//=================================================================================
+// function : activateSelection
+// purpose  : 
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::activateSelection()
+{
+  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(GEOM::GEOM_Object::_nil(), needTypes );
+
+}
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose  :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::ClickOnOk()
+{
+  if ( ClickOnApply() )
+    ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose  :
+//=================================================================================
+bool MeasureGUI_FastCheckIntersectionsDlg::ClickOnApply()
+{
+  if ( !onAccept() )
+    return false;
+
+  clear();
+  initName();
+  return true;
+}
+
+//=================================================================================
+// function : extractPrefix
+// purpose  :
+//=================================================================================
+bool MeasureGUI_FastCheckIntersectionsDlg::extractPrefix() const
+{
+  return true;
+}
+
+//=================================================================================
+// function : createOperation
+// purpose  :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr MeasureGUI_FastCheckIntersectionsDlg::createOperation()
+{
+  return getGeomEngine()->GetIMeasureOperations( getStudyId() );
+}
+
+//=================================================================================
+// function : isValid
+// purpose  :
+//=================================================================================
+bool MeasureGUI_FastCheckIntersectionsDlg::isValid( QString& )
+{
+  return myObj1 && myObj2;
+}
+
+//=================================================================================
+// function : SetEditCurrentArgument
+// purpose  :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::SetEditCurrentArgument()
+{
+    QPushButton* send = (QPushButton*)sender();
+
+  if (send == mySelButton1) {
+    myEditCurrentArgument = myEditObjName1;
+
+    mySelButton2->setDown(false);
+    myEditObjName2->setEnabled(false);
+    myObj1.nullify();
+  }
+  else {
+    myEditCurrentArgument = myEditObjName2;
+
+    mySelButton1->setDown(false);
+    myEditObjName1->setEnabled(false);
+    myObj2.nullify();
+  }
+
+  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+  activateSelection();
+  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+          this, SLOT(SelectionIntoArgument()));
+
+  // enable line edit
+  myEditCurrentArgument->setEnabled(true);
+  myEditCurrentArgument->setFocus();
+  // after setFocus(), because it will be setDown(false) when loses focus
+  send->setDown(true);
+
+  SelectionIntoArgument();
+}
+
+//=================================================================================
+// function : OnGaps()
+// purpose  :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::OnGaps(bool cheked)
+{
+  clear();
+  myTolerance->setEnabled(cheked);
+}
+//=================================================================================
+// function : SelectionIntoArgument
+// purpose  :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::SelectionIntoArgument()
+{
+  myEditCurrentArgument->setText("");
+  // Clear the dialog.
+  clear();
+
+  QList<TopAbs_ShapeEnum> typesLst;
+  typesLst << TopAbs_FACE << TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPOUND;
+  GEOM::GeomObjPtr aSelectedObject = getSelected( typesLst );
+
+  // clear selection
+  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+  myGeomGUI->getApp()->selectionMgr()->clearSelected();
+  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+          this, SLOT(SelectionIntoArgument()));
+
+  if (myEditCurrentArgument == myEditObjName1) {
+    myObj1 = aSelectedObject;
+    if (myObj1 && !myObj2)
+      mySelButton2->click();
+  }
+  else {
+    myObj2 = aSelectedObject;
+    if (myObj2 && !myObj1)
+      mySelButton1->click();
+  }
+  myEditObjName1->setText(myObj1 ? GEOMBase::GetName(myObj1.get()) : "");
+  myEditObjName2->setText(myObj2 ? GEOMBase::GetName(myObj2.get()) : "");
+}
+
+//=================================================================================
+// function : enterEvent
+// purpose  :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::enterEvent(QEvent *)
+{
+  if (!mainFrame()->GroupConstructors->isEnabled())
+    ActivateThisDialog();
+}
+
+//=================================================================================
+// function : findIntersections
+// purpose  :
+//=================================================================================
+bool MeasureGUI_FastCheckIntersectionsDlg::findIntersections()
+{
+  if (!myObj1 || !myObj2)
+    return false;
+
+  GEOM::GEOM_IMeasureOperations_var anOper =
+    GEOM::GEOM_IMeasureOperations::_narrow(getOperation());
+  bool isOK = true;
+
+  bool HasInte;
+  try {
+    HasInte = anOper->FastIntersect(myObj1.get(), myObj2.get(), getTolerance(), getDeflection(), myInters1, myInters2);
+  }
+  catch (const SALOME::SALOME_Exception& e) {
+    SalomeApp_Tools::QtCatchCorbaException(e);
+    isOK = false;
+  }
+
+  bool isDone = anOper->IsDone();
+  if (!isDone) {
+    CORBA::String_var aMsg = anOper->GetErrorCode();
+    SUIT_MessageBox::warning(this,
+                             QObject::tr("WRN_WARNING"),
+                             QObject::tr(aMsg.in()));
+  }
+
+  if ( !HasInte || myInters1->length() == 0 || myInters2->length() == 0)
+    isOK = false;
+
+  return isOK;
+}
+
+//=================================================================================
+// function : onSubShapesListSelectionChanged
+// purpose  :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::onSubShapesListSelectionChanged()
+{
+  erasePreview();
+  previewSubShapesListSelection(myShapeList1);
+  previewSubShapesListSelection(myShapeList2);
+}
+
+//=================================================================================
+// function : previewSubShapesListSelection
+// purpose  :
+//=================================================================================
+void MeasureGUI_FastCheckIntersectionsDlg::previewSubShapesListSelection(QListWidget* theWidget)
+{
+  GEOM::ListOfLong_var anInters;
+  GEOM::GeomObjPtr anObj;
+
+  if (theWidget == myShapeList1) { // Sub-Shapes of Object 1
+    anObj = myObj1;
+    anInters = myInters1;
+  }
+  else {
+    if (theWidget == myShapeList2) { // Sub-Shapes of Object 2
+      anObj = myObj2;
+      anInters = myInters2;
+    }
+    else return;
+  }
+  // Selected IDs
+  QList<int> aIds;
+  for (int i = 0, n = theWidget->count(); i < n; i++) {
+    if (theWidget->item(i)->isSelected())
+      aIds.append(i);
+  }
+  if (aIds.count() < 1)
+    return;
+
+  TopoDS_Shape aSelShape;
+  TopoDS_Shape aSubShape;
+  TopTools_IndexedMapOfShape anIndices;
+  if (anObj && GEOMBase::GetShape(anObj.get(), aSelShape)) {
+    SALOME_Prs* aPrs = 0;
+    TopExp::MapShapes(aSelShape, anIndices);
+    QList<int>::iterator it;
+    for (it = aIds.begin(); it != aIds.end(); ++it) {
+      aSubShape = anIndices.FindKey(anInters[(*it)]);
+      try {
+        getDisplayer()->SetColor(Quantity_NOC_RED);
+        getDisplayer()->SetWidth(3);
+        getDisplayer()->SetToActivate(false);
+        aPrs = !aSubShape.IsNull() ? getDisplayer()->BuildPrs(aSubShape) : 0;
+        if (aPrs)
+          displayPreview(aPrs, true);
+      }
+      catch (const SALOME::SALOME_Exception& e) {
+        SalomeApp_Tools::QtCatchCorbaException(e);
+      }
+    }
+  }
+}
+
+//=================================================================================
+// function : getLstObjFromListSelection
+// purpose  :
+//=================================================================================
+GEOM::ListOfGO_var MeasureGUI_FastCheckIntersectionsDlg::getLstObjFromListSelection(QListWidget* theWidget)
+{
+  GEOM::ListOfLong_var anInters;
+  GEOM::GeomObjPtr anObj;
+  GEOM::ListOfGO_var anObjLst = new GEOM::ListOfGO();
+
+  if (theWidget == myShapeList1) { // Sub-Shapes of Object 1
+    anObj = myObj1;
+    anInters = myInters1;
+  }
+  else {
+    if (theWidget == myShapeList2) { // Sub-Shapes of Object 2
+      anObj = myObj2;
+      anInters = myInters2;
+    }
+    else
+      return anObjLst;
+  }
+  //Add in study myObj if local selection
+  GEOMBase::PublishSubObject( anObj.get() );
+  // Collect the map of indices and already publised objects
+  TColStd_IndexedMapOfInteger aMapIndex;
+  ObjectList aObjLstExist;
+  for (int i = 0, n = theWidget->count(); i < n; i++) {
+    if (theWidget->item(i)->isSelected()) {
+      GEOM::GEOM_Object_var aTmpObj = GEOMBase_Helper::findObjectInFather(anObj.get(), anInters[i]);
+      if (aTmpObj->_is_nil())
+        aMapIndex.Add(anInters[i]);
+      else
+        aObjLstExist.push_back( GEOM::GEOM_Object::_duplicate(aTmpObj));
+    }
+  }
+
+  if (aMapIndex.IsEmpty() && aObjLstExist.empty())
+    return anObjLst;
+  // Create objects.
+  GEOM::ListOfLong_var anArray   = new GEOM::ListOfLong;
+  const int            aNbShapes = aMapIndex.Extent();
+  anArray->length(aNbShapes);
+  for (int i = 1; i <= aNbShapes; i++) {
+    anArray[i - 1] = aMapIndex.FindKey(i);
+  }
+
+  if (myShapesOper->_is_nil())
+    myShapesOper = getGeomEngine()->GetIShapesOperations(getStudyId());
+
+  GEOM::ListOfGO_var aObjLstCreate = myShapesOper->MakeSubShapes(anObj.get(), anArray);
+
+  //Collect all objects in list
+  anObjLst->length(aObjLstCreate->length() + aObjLstExist.size());
+  
+  ObjectList::iterator anIter;
+  int i;
+  for (i=0, anIter = aObjLstExist.begin(); anIter != aObjLstExist.end(); i++, ++anIter) {
+    anObjLst[i] = *anIter;
+  }
+  for (int j = 0; j < aObjLstCreate->length(); j++) {
+    anObjLst[aObjLstExist.size()+j]=aObjLstCreate[j];
+  }
+  return  anObjLst._retn();
+}
+
+//=================================================================================
+// function : execute
+// purpose  :
+//=================================================================================
+bool MeasureGUI_FastCheckIntersectionsDlg::execute(ObjectList& objects)
+{
+  GEOM::ListOfGO_var aList1 = getLstObjFromListSelection(myShapeList1);
+  GEOM::ListOfGO_var aList2 = getLstObjFromListSelection(myShapeList2);
+  GEOM::ListOfGO_var aCompList = new GEOM::ListOfGO();
+  const int nbObj = aList1->length() + aList2->length();
+  if (nbObj <= 0)
+    return true;
+
+  //Collect general intersection list
+  aCompList->length(nbObj);
+  int i;
+  for (i = 0; i < aList1->length(); i++) {
+    GEOMBase::PublishSubObject( aList1[i] );
+    aCompList[i]=aList1[i];
+  }
+  for (int j = 0; j < aList2->length(); j++) {
+    GEOMBase::PublishSubObject( aList2[j] );
+    aCompList[i+j]=aList2[j];
+  }
+
+  // make compound
+  objects.push_back(myShapesOper->MakeCompound(aCompList));
+  return true; 
+}
+
+//=================================================================================
+// function : getDeflection
+// purpose  :
+//=================================================================================
+float MeasureGUI_FastCheckIntersectionsDlg::getDeflection()
+{
+  return (float)myDeflection->value();
+}
+
+//=================================================================================
+// function : getTolerance
+// purpose  :
+//=================================================================================
+double MeasureGUI_FastCheckIntersectionsDlg::getTolerance()
+{
+  double aVal = myTolerance->value();
+  if (!myDetGaps->isChecked() || aVal < 0.0)
+    return 0.0;
+  return aVal;
+}
diff --git a/src/MeasureGUI/MeasureGUI_FastCheckIntersectionsDlg.h b/src/MeasureGUI/MeasureGUI_FastCheckIntersectionsDlg.h
new file mode 100644 (file)
index 0000000..745911a
--- /dev/null
@@ -0,0 +1,98 @@
+// Copyright (C) 2007-2014  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
+//
+
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : MeasureGUI_FastCheckIntersectionsDlg.h
+
+#ifndef MEASUREGUI_FASTCHECKINTERDLG_H
+#define MEASUREGUI_FASTCHECKINTERDLG_H
+
+#include <GEOMBase_Skeleton.h>
+
+class QListWidget;
+
+//=================================================================================
+// class    : MeasureGUI_FastCheckIntersectionsDlg
+// purpose  :
+//=================================================================================
+
+class MeasureGUI_FastCheckIntersectionsDlg : public GEOMBase_Skeleton
+{
+  Q_OBJECT
+
+public:
+
+  MeasureGUI_FastCheckIntersectionsDlg(GeometryGUI*, QWidget*);
+  ~MeasureGUI_FastCheckIntersectionsDlg();
+
+protected:
+  // redefined from GEOMBase_Helper
+  virtual GEOM::GEOM_IOperations_ptr  createOperation();
+  virtual bool                        isValid(QString &);
+  virtual bool                        execute(ObjectList &);
+  virtual bool                        extractPrefix() const;
+
+private slots:
+
+  void                                onSubShapesListSelectionChanged();
+  void                                clear();
+  void                                onCompute();
+  void                                ClickOnOk();
+  bool                                ClickOnApply();
+  void                                ActivateThisDialog();
+  void                                DeactivateActiveDialog();  
+  void                                SelectionIntoArgument(); 
+  void                                SetEditCurrentArgument();
+  void                                OnGaps(bool);
+
+private:
+
+  void                                Init();
+  void                                activateSelection();
+  void                                enterEvent(QEvent *);
+  bool                                findIntersections();
+  float                               getDeflection();
+  double                              getTolerance();
+  void                                previewSubShapesListSelection(QListWidget*);
+  GEOM::ListOfGO_var                  getLstObjFromListSelection(QListWidget*);
+
+private:
+
+  QPushButton                        *mySelButton1;
+  QPushButton                        *mySelButton2;
+  QLineEdit                          *myEditObjName1;
+  QLineEdit                          *myEditObjName2;
+  QLineEdit                          *myEditCurrentArgument;
+  QCheckBox                          *myDetGaps;
+  SalomeApp_DoubleSpinBox            *myTolerance;
+  SalomeApp_DoubleSpinBox            *myDeflection;
+  QPushButton                        *myComputeButton;
+  QListWidget                        *myShapeList1;
+  QListWidget                        *myShapeList2;
+  GEOM::GeomObjPtr                    myObj1;
+  GEOM::GeomObjPtr                    myObj2;
+  GEOM::ListOfLong_var                myInters1;
+  GEOM::ListOfLong_var                myInters2;
+  GEOM::GEOM_IShapesOperations_var    myShapesOper;
+};
+
+#endif // MEASUREGUI_FASTCHECKINTERDLG_H