Salome HOME
Merge branch V7_6_BR
authorvsr <vsr@opencascade.com>
Wed, 3 Jun 2015 08:06:53 +0000 (11:06 +0300)
committervsr <vsr@opencascade.com>
Wed, 3 Jun 2015 08:06:53 +0000 (11:06 +0300)
62 files changed:
CMakeLists.txt
doc/salome/gui/GEOM/images/editgroup.png
doc/salome/gui/GEOM/images/geomcreategroup.png
doc/salome/gui/GEOM/images/shape_statistics.png [new file with mode: 0644]
doc/salome/gui/GEOM/images/shape_statistics_simple.png [new file with mode: 0644]
doc/salome/gui/GEOM/input/shape_statistics_operation.doc [new file with mode: 0644]
doc/salome/gui/GEOM/input/using_measurement_tools.doc
doc/salome/gui/GEOM/input/working_with_groups.doc
resources/CMakeLists.txt
resources/SalomeApp.xml.in
resources/Y14.5M-2009.ttf [new file with mode: 0644]
src/CMakeLists.txt
src/EntityGUI/CMakeLists.txt
src/EntityGUI/EntityGUI_SubShapeDlg.cxx
src/EntityGUI/EntityGUI_SubShapeDlg.h
src/GEOMAlgo/CMakeLists.txt
src/GEOMAlgo/FILES
src/GEOMAlgo/GEOMAlgo.cdl [changed mode: 0755->0644]
src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx
src/GEOMAlgo/GEOMAlgo_FinderShapeOn.cxx
src/GEOMAlgo/GEOMAlgo_FinderShapeOn1.cxx
src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx
src/GEOMAlgo/GEOMAlgo_GetInPlace_1.cxx
src/GEOMAlgo/GEOMAlgo_GlueDetector.cxx
src/GEOMAlgo/GEOMAlgo_Gluer.cxx [changed mode: 0755->0644]
src/GEOMAlgo/GEOMAlgo_Gluer2.cxx
src/GEOMAlgo/GEOMAlgo_KindOfDef.hxx [new file with mode: 0644]
src/GEOMAlgo/GEOMAlgo_KindOfName.hxx
src/GEOMAlgo/GEOMAlgo_KindOfShape.hxx
src/GEOMAlgo/GEOMAlgo_ShapeInfo.cxx
src/GEOMAlgo/GEOMAlgo_ShapeInfo.hxx
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller.cxx
src/GEOMAlgo/GEOMAlgo_ShapeInfoFiller_1.cxx
src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx
src/GEOMAlgo/GEOMAlgo_Splitter.cxx [changed mode: 0755->0644]
src/GEOMAlgo/GEOMAlgo_SurfaceTools.cxx
src/GEOMBase/GEOMBase.cxx
src/GEOMBase/GEOMBase.h
src/GEOMGUI/CMakeLists.txt
src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx [new file with mode: 0644]
src/GEOMGUI/GEOMGUI_TextTreeWdg.h [new file with mode: 0644]
src/GEOMGUI/GEOM_Displayer.cxx
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.h
src/GEOMGUI/GeometryGUI_Operations.h
src/GEOMImpl/GEOMImpl_IHealingOperations.cxx
src/GEOMImpl/GEOMImpl_ITransformOperations.cxx
src/GEOMUtils/CMakeLists.txt
src/GEOMUtils/GEOMUtils_ShapeStatistics.cxx [new file with mode: 0644]
src/GEOMUtils/GEOMUtils_ShapeStatistics.hxx [new file with mode: 0644]
src/GroupGUI/CMakeLists.txt
src/GroupGUI/GroupGUI_GroupDlg.cxx
src/GroupGUI/GroupGUI_GroupDlg.h
src/MeasureGUI/CMakeLists.txt
src/MeasureGUI/MeasureGUI.cxx
src/MeasureGUI/MeasureGUI_CreateDimensionDlg.cxx
src/MeasureGUI/MeasureGUI_ManageDimensionsDlg.cxx
src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.cxx [new file with mode: 0644]
src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.h [new file with mode: 0644]

index 6431c21614ac85def8da0e33de890b146667c58a..dbf940714bd43519142597159a5ea51971a29982 100755 (executable)
@@ -34,7 +34,7 @@ SET(${PROJECT_NAME_UC}_MINOR_VERSION 6)
 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
 # ===========
index c7f55074e27ea482a3fe678945ae82c6b0ea61e4..4501fa61ff4701073ab349387730f3f9ec365f1d 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/editgroup.png and b/doc/salome/gui/GEOM/images/editgroup.png differ
index 0f67a625c1f772ed7a469793c067a109ff01e0e1..c982f0bc93886bc8de8acdf5d47824c77bc3c99b 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/geomcreategroup.png and b/doc/salome/gui/GEOM/images/geomcreategroup.png differ
diff --git a/doc/salome/gui/GEOM/images/shape_statistics.png b/doc/salome/gui/GEOM/images/shape_statistics.png
new file mode 100644 (file)
index 0000000..2aaaa9a
Binary files /dev/null and b/doc/salome/gui/GEOM/images/shape_statistics.png differ
diff --git a/doc/salome/gui/GEOM/images/shape_statistics_simple.png b/doc/salome/gui/GEOM/images/shape_statistics_simple.png
new file mode 100644 (file)
index 0000000..bc2c076
Binary files /dev/null and b/doc/salome/gui/GEOM/images/shape_statistics_simple.png differ
diff --git a/doc/salome/gui/GEOM/input/shape_statistics_operation.doc b/doc/salome/gui/GEOM/input/shape_statistics_operation.doc
new file mode 100644 (file)
index 0000000..207db3b
--- /dev/null
@@ -0,0 +1,28 @@
+/*!
+
+\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 face or shell being selected); multiple selection is processed correspondingly (i.e. only types applicable for all selected shapes will be available).
+
+- "Number of intervals" spin box is used to specify number of distribution histogram ranges.
+
+- "Scalar range" checkable group box that, when switched ON, allows specifying custom values range used for plotting and creating groups.
+\note By default, "Scalar range" controls is empty; pressing "Compute" button allows automatic computing initial range of the chosen parameter. This is needed as computation of the parameters range can be time-consuming for large or complex models. In case of multiple selection, scalar range is computed as common from all selected shapes.
+
+- "Plot" button opens or uses an opened Plot2d viewer and plots the distribution histogram for the selected shape(s).
+
+- "Create groups" button allows creating a groups according to the currently specified parameters. The groups names will include numerical values of the range, e.g. "Edges_length_0-20", "Edges_length_20-40", etc. Empty groups are not created.
+
+- Close dialog box, by pressing <b>Close</b> button.
+
+*/
index 77a5ee4b3aecbb40dde9c228ddda5b5e167e485d..515a94ce4a7808c7942730e944c6d6ec2b716803 100644 (file)
@@ -19,6 +19,7 @@
 <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:
index 2ca5154dca81318cf7e1a33ab3e6ad5a67179e10..852047dfb04216c9bde75c4842cb30c26a38dc53 100644 (file)
@@ -24,7 +24,7 @@ This functionality is available in OCC viewer only.
 
 To create a group of sub-shapes of a geometrical object in the main
 menu select <b>New entity > Group > Create</b>
-\n The following menu will appear:
+\n The following dialog box will appear:
 
 \image html geomcreategroup.png
 
@@ -101,6 +101,11 @@ In order to filter out some entities:
 The entities, which satisfy the entered filtering parameters, will be automatically highlighted
 in the 3D viewer.
 
+\b Plot button into "Filter" group box provides an access 
+to the \ref shape_statistics_operation_page "Shape Statistics" functionality with simplified look-n-feel:
+
+\image html shape_statistics_simple.png
+
 \n <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.
index cef2c42f2976d4ba54acafd65e34099d2858125e..44d86e7bc11cb47a801ed72da73ecbbfcc3e465d 100755 (executable)
@@ -35,6 +35,7 @@ SET( _res_files
   GEOM.config
   GEOMDS_Resources
   ShHealing
+  Y14.5M-2009.ttf
   3dsketch.png
   isoline.png
   isoline_v.png
index 84f53783c7e224fbc70819938ccc5890a03848b2..8e83fdbc2fe8e69c3afd42f3091eb9b90b70b317 100644 (file)
     <!-- 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" />
diff --git a/resources/Y14.5M-2009.ttf b/resources/Y14.5M-2009.ttf
new file mode 100644 (file)
index 0000000..1f1ca19
Binary files /dev/null and b/resources/Y14.5M-2009.ttf differ
index d271e268eaef9f2b1eaabd65f07b1f6834b51a1a..6f830743b957ffe5951b5607bc6a753fbbd872aa 100755 (executable)
@@ -43,8 +43,8 @@ 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
+    CurveCreator MeasureGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI
+    RepairGUI GroupGUI BlocksGUI AdvancedGUI
     GEOM_SWIG_WITHIHM
     )
 ENDIF()
index ecfc09a2d4f7fbd29dba91dae9789e5c93ab9d50..0bb93f921c92435cfd152cf93f47709b534d103f 100755 (executable)
@@ -39,6 +39,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/GEOMImpl
   ${PROJECT_SOURCE_DIR}/src/GEOMGUI
   ${PROJECT_SOURCE_DIR}/src/GEOMBase
+  ${PROJECT_SOURCE_DIR}/src/MeasureGUI
   ${PROJECT_SOURCE_DIR}/src/SKETCHER
   ${PROJECT_SOURCE_DIR}/src/CurveCreator
   ${PROJECT_SOURCE_DIR}/src/ShapeRecognition
@@ -67,6 +68,7 @@ SET(_link_LIBRARIES
   DlgRef
   GEOMSketcher
   CurveCreator
+  MeasureGUI
   )
 
 # optional sources
index 9db5fbab0723d932e37a3e99b5a037fddaf78724..598d05de696a15242499b921f372e42b8046f7ea 100644 (file)
@@ -30,6 +30,7 @@
 #include <GeometryGUI.h>
 #include <GEOMBase.h>
 #include <GEOMUtils.hxx>
+#include <MeasureGUI_ShapeStatisticsDlg.h>
 
 #include <OCCViewer_ViewModel.h>
 #include <SVTK_ViewModel.h>
@@ -165,6 +166,7 @@ EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(GeometryGUI* theGeometryGUI, QWidge
   myLessFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
   myGreaterFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
   myApplyFilterButton = new QPushButton(tr("GEOM_BUT_APPLY"), myFilterGrp);
+  myPlotDistributionButton = new QPushButton(tr("GEOM_PLOT_DISTRIBUTION"), myFilterGrp);
 
   QGridLayout* filterLayout = new QGridLayout(myFilterGrp);
   filterLayout->addWidget(myLessFilterCheck,    0, 0);
@@ -174,6 +176,7 @@ EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(GeometryGUI* theGeometryGUI, QWidge
   filterLayout->addWidget(myGreaterFilterCombo, 1, 1);
   filterLayout->addWidget(myGreaterFilterSpin,  1, 2);
   filterLayout->addWidget(myApplyFilterButton,  0, 3);
+  filterLayout->addWidget(myPlotDistributionButton,  1, 3);
 
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
   layout->setMargin(0); layout->setSpacing(6);
@@ -250,6 +253,7 @@ void EntityGUI_SubShapeDlg::Init()
   connect(GroupPoints->PushButton4, SIGNAL(clicked()), this, SLOT(showOnlySelected()));
 
   connect(myApplyFilterButton, SIGNAL(clicked()),         this, SLOT(ClickOnOkFilter()));
+  connect(myPlotDistributionButton, SIGNAL(clicked()),    this, SLOT(ClickOnPlot()));
   connect(myLessFilterCheck,   SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
   connect(myGreaterFilterCheck,   SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
 
@@ -491,6 +495,11 @@ void EntityGUI_SubShapeDlg::SubShapeToggled()
                           GroupPoints->CheckButton1->isChecked() &&
                           shapeType() < GEOM::VERTEX);
 
+  myPlotDistributionButton->setEnabled( myFilterGrp->isEnabled() &&
+                                       ( shapeType() == TopAbs_EDGE || 
+                                         shapeType() == TopAbs_FACE ||
+                                         shapeType() == TopAbs_SOLID ) );
+
   activateSelection();
 }
 
@@ -936,6 +945,18 @@ void EntityGUI_SubShapeDlg::ClickOnOkFilter()
   updateButtonState();
 }
 
+//=================================================================================
+// 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();
+  }
+}
+
 //=================================================================================
 // function : MeasureToggled()
 // purpose  :
index e3618ac41e97b5d5d6b210384930b1cea21c9c06..c2f14e66e0a8d1326c3caa20321d3cbfc803188d 100644 (file)
@@ -73,6 +73,7 @@ private slots:
 
   void                                showOnlySelected();
   void                                ClickOnOkFilter();
+  void                                ClickOnPlot();
   void                                MeasureToggled();
 
 private:
@@ -102,6 +103,7 @@ private:
   SalomeApp_DoubleSpinBox*            myLessFilterSpin;
   SalomeApp_DoubleSpinBox*            myGreaterFilterSpin;
   QPushButton*                        myApplyFilterButton;
+  QPushButton*                        myPlotDistributionButton;
   QGroupBox*                          myFilterGrp;
 };
 
index f44663a1026972c59249dc8a7089f5039d395b8b..d2b6024abadb4910378579dc3f69c441598a1cf8 100755 (executable)
@@ -59,7 +59,10 @@ SET(GEOMAlgo_HEADERS
   GEOMAlgo_DataMapOfPassKeyInteger.hxx
   GEOMAlgo_DataMapOfShapeMapOfShape.hxx
   GEOMAlgo_DataMapOfShapePnt.hxx
+  GEOMAlgo_FinderShapeOn.hxx
+  GEOMAlgo_FinderShapeOn1.hxx
   GEOMAlgo_FinderShapeOn2.hxx
+  GEOMAlgo_FinderShapeOnQuad.hxx
   GEOMAlgo_GetInPlace.hxx
   GEOMAlgo_GetInPlaceAPI.hxx
   GEOMAlgo_GlueAnalyser.hxx
@@ -77,6 +80,7 @@ SET(GEOMAlgo_HEADERS
   GEOMAlgo_IndexedDataMapOfShapeState.hxx
   GEOMAlgo_KindOfBounds.hxx
   GEOMAlgo_KindOfClosed.hxx
+  GEOMAlgo_KindOfDef.hxx
   GEOMAlgo_KindOfName.hxx
   GEOMAlgo_KindOfShape.hxx
   GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx
index 85d55bcfcd6f53a8c0d52c49b100f59b07964c90..91e59813fbd294e77a480fa7597e540b8f0a61f6 100644 (file)
@@ -11,25 +11,28 @@ GEOMAlgo_ShellSolid.cxx
 GEOMAlgo_AlgoTools.hxx
 GEOMAlgo_AlgoTools.cxx
 GEOMAlgo_AlgoTools_1.cxx
-GEOMAlgo_AlgoTools_2.cxx
 GEOMAlgo_SolidSolid.hxx
 GEOMAlgo_SolidSolid.cxx
 GEOMAlgo_ShapeAlgo.hxx
 GEOMAlgo_ShapeAlgo.cxx
+GEOMAlgo_FinderShapeOn.hxx
+GEOMAlgo_FinderShapeOn.cxx
+GEOMAlgo_FinderShapeOn1.hxx
+GEOMAlgo_FinderShapeOn1.cxx
 GEOMAlgo_HAlgo.hxx
 GEOMAlgo_HAlgo.cxx
 GEOMAlgo_Clsf.hxx
 GEOMAlgo_Clsf.cxx
 GEOMAlgo_ClsfBox.hxx
 GEOMAlgo_ClsfBox.cxx
-GEOMAlgo_ClsfQuad.hxx
-GEOMAlgo_ClsfQuad.cxx
 GEOMAlgo_ClsfSolid.hxx
 GEOMAlgo_ClsfSolid.cxx
 GEOMAlgo_ClsfSurf.hxx
 GEOMAlgo_ClsfSurf.cxx
 GEOMAlgo_FinderShapeOn2.hxx
 GEOMAlgo_FinderShapeOn2.cxx
+GEOMAlgo_FinderShapeOnQuad.hxx
+GEOMAlgo_FinderShapeOnQuad.cxx
 GEOMAlgo_Gluer.hxx
 GEOMAlgo_Gluer.cxx
 GEOMAlgo_GlueAnalyser.hxx
@@ -50,8 +53,6 @@ GEOMAlgo_GetInPlace.cxx
 GEOMAlgo_GetInPlace_1.cxx
 GEOMAlgo_GetInPlace_2.cxx
 GEOMAlgo_GetInPlace_3.cxx
-GEOMAlgo_GetInPlaceAPI.hxx
-GEOMAlgo_GetInPlaceAPI.cxx
 GEOMAlgo_Splitter.hxx
 GEOMAlgo_Splitter.cxx
 GEOMAlgo_ShapeInfoFiller.hxx
@@ -106,3 +107,5 @@ GEOMAlgo_ShapeInfo.cxx
 GEOMAlgo_IndexedDataMapOfShapeShapeInfo.hxx
 
 Basics_OCCTVersion.hxx
+
+GEOMAlgo_KindOfDef.hxx
old mode 100755 (executable)
new mode 100644 (file)
index ae08f548096f10753bdd680a15640f4584faa20e..57184bff18b7f0a5ff51ec4bac0ee955f939409a 100644 (file)
@@ -93,15 +93,15 @@ static
                 Standard_Integer& iCnt);
 static
   void CopySource(const TopoDS_Shape& aS,
-                 TopTools_IndexedDataMapOfShapeShape& aMapSS,
-                 TopoDS_Shape& aSC);
+    TopTools_IndexedDataMapOfShapeShape& aMapSS,
+    TopoDS_Shape& aSC);
 
 //=======================================================================
 //function : CopyShape
 //purpose  :
 //=======================================================================
 void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS,
-                                  TopoDS_Shape& aSC)
+       TopoDS_Shape& aSC)
 {
   TopTools_IndexedDataMapOfShapeShape aMapSS;
   //
@@ -112,8 +112,8 @@ void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS,
 //purpose  :
 //=======================================================================
 void GEOMAlgo_AlgoTools::CopyShape(const TopoDS_Shape& aS,
-                                  TopoDS_Shape& aSC,
-                                  TopTools_IndexedDataMapOfShapeShape& aMapSS)
+       TopoDS_Shape& aSC,
+       TopTools_IndexedDataMapOfShapeShape& aMapSS)
 {
   CopySource(aS, aMapSS, aSC);
 }
@@ -172,9 +172,9 @@ void CopySource(const TopoDS_Shape& aS,
 //purpose  : 
 //=======================================================================
 void GEOMAlgo_AlgoTools::FaceNormal (const TopoDS_Face& aF,
-                                    const Standard_Real U,
-                                    const Standard_Real V,
-                                    gp_Vec& aN)
+         const Standard_Real U,
+         const Standard_Real V,
+         gp_Vec& aN)
 {
   gp_Pnt aPnt ;
   gp_Vec aD1U, aD1V;
@@ -343,7 +343,7 @@ Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace
 // purpose:
 //=======================================================================
 void GEOMAlgo_AlgoTools::MakeContainer(const TopAbs_ShapeEnum theType,
-                                      TopoDS_Shape& theC)
+           TopoDS_Shape& theC)
 {
   BRep_Builder aBB;
   //
@@ -412,9 +412,9 @@ Standard_Boolean GEOMAlgo_AlgoTools::IsUPeriodic(const  Handle(Geom_Surface) &aS
 //purpose  :
 //=======================================================================
 void GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
-                                                  const TopoDS_Face& aF,
-                                                  const Standard_Real aUMin,
-                                                  const Standard_Real aUMax)
+         const TopoDS_Face& aF,
+         const Standard_Real aUMin,
+         const Standard_Real aUMax)
 {
   Standard_Real aT1, aT2, aTx, aUx, aTol;
   gp_Pnt2d aP2D;
@@ -559,7 +559,7 @@ Standard_Boolean GEOMAlgo_AlgoTools::ProjectPointOnShape
 //purpose  :
 //=======================================================================
 void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
-                                    gp_Pnt& aP3D)
+         gp_Pnt& aP3D)
 {
   Standard_Real aTx, aT1, aT2;
   //
@@ -572,8 +572,8 @@ void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
 //purpose  :
 //=======================================================================
 void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
-                                    const Standard_Real aT,
-                                    gp_Pnt& aP3D)
+         const Standard_Real aT,
+         gp_Pnt& aP3D)
 {
   Standard_Real aT1, aT2;
   Handle(Geom_Curve) aC3D;
@@ -586,9 +586,9 @@ void GEOMAlgo_AlgoTools::PointOnEdge(const TopoDS_Edge& aE,
 //purpose  :
 //=======================================================================
 void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
-                                    const Standard_Real aU,
-                                    const Standard_Real aV,
-                                    gp_Pnt& aP3D)
+         const Standard_Real aU,
+         const Standard_Real aV,
+         gp_Pnt& aP3D)
 {
   Handle(Geom_Surface) aS;
   //
@@ -600,7 +600,7 @@ void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
 //purpose  :
 //=======================================================================
 void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
-                                    gp_Pnt& aP3D)
+         gp_Pnt& aP3D)
 {
   Standard_Real aU, aV, aUMin, aUMax, aVMin, aVMax;
   //
@@ -616,7 +616,7 @@ void GEOMAlgo_AlgoTools::PointOnFace(const TopoDS_Face& aF,
 //purpose  :
 //=======================================================================
 void GEOMAlgo_AlgoTools::PointOnShape(const TopoDS_Shape& aS,
-                                     gp_Pnt& aP3D)
+          gp_Pnt& aP3D)
 {
   TopAbs_ShapeEnum aType;
   //
@@ -713,7 +713,7 @@ Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
     return 0; // Nothing to do
   }
   //
-  while(1) {
+  for(;;) {
     aNbEProcessed=aMProcessed.Extent();
     if (aNbEProcessed==aNbE) {
       break;
@@ -922,8 +922,8 @@ void GetCount(const TopoDS_Shape& aS,
 //purpose  :
 //=======================================================================
 Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF,
-                                              gp_Pnt& theP,
-                                              gp_Pnt2d& theP2D)
+                                               gp_Pnt& theP,
+                                               gp_Pnt2d& theP2D)
 {
   Standard_Boolean bIsDone, bHasFirstPoint, bHasSecondPoint;
   Standard_Integer iErr, aIx, aNbDomains, i;
@@ -948,8 +948,8 @@ Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF,
   //
   Geom2dHatch_Intersector aIntr(aTotArcIntr, aTolTangfIntr);
   Geom2dHatch_Hatcher aHatcher(aIntr,
-                              aTolHatch2D, aTolHatch3D,
-                              Standard_True, Standard_False);
+          aTolHatch2D, aTolHatch3D,
+          Standard_True, Standard_False);
   //
   iErr=0;
   aEpsT=1.e-12;
@@ -1004,30 +1004,33 @@ Standard_Integer GEOMAlgo_AlgoTools::PntInFace(const TopoDS_Face& aF,
   }
   //
   // 4.
+  aVx=aVMin;
   aNbDomains=aHatcher.NbDomains(aIx);
-  for (i=1; i<=aNbDomains; ++i) {
-    const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
-    bHasFirstPoint=aDomain.HasFirstPoint();
-    if (!bHasFirstPoint) {
-      iErr=5;
-      return iErr;
-    }
-    //
-    aV1=aDomain.FirstPoint().Parameter();
-    //
-    bHasSecondPoint=aDomain.HasSecondPoint();
-    if (!bHasSecondPoint) {
-      iErr=6;
-      return iErr;
-    }
-    //
-    aV2=aDomain.SecondPoint().Parameter();
-    //
-    aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
-    //
-    break;
+  if (!aNbDomains) {
+    iErr=5;
+    return iErr;
   }
   //
+  i=1;
+  const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
+  bHasFirstPoint=aDomain.HasFirstPoint();
+  if (!bHasFirstPoint) {
+    iErr=5;
+    return iErr;
+  }
+  //
+  aV1=aDomain.FirstPoint().Parameter();
+  //
+  bHasSecondPoint=aDomain.HasSecondPoint();
+  if (!bHasSecondPoint) {
+    iErr=6;
+    return iErr;
+  }
+  //
+  aV2=aDomain.SecondPoint().Parameter();
+  //
+  aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
+  //
   aS->D0(aUx, aVx, aPx);
   //
   theP2D.SetCoord(aUx, aVx);
index e721aca85e0ed905bb832c0944fc6aa50a783cc8..4db6801de96fc7045d33e6a82a11d8ecd443a273 100644 (file)
@@ -62,7 +62,6 @@
 #include <BRepLib_MakeFace.hxx>
 #include <BRepLib_FaceError.hxx>
 
-//#include <BOPTools_DSFiller.hxx>
 
 #include <GEOMAlgo_WireSolid.hxx>
 #include <GEOMAlgo_ShellSolid.hxx>
@@ -300,7 +299,6 @@ void GEOMAlgo_FinderShapeOn::Find(const TopoDS_Shape& aS)
 {
   myErrorStatus=0;
   //
-  Standard_Boolean bIsDone;
   Standard_Integer i, iErr;
   TopAbs_State aSts[]={TopAbs_IN, TopAbs_OUT, TopAbs_ON};
   TopTools_ListIteratorOfListOfShape aIt;
index 6487a04ac8e77ec418f47669c530a503f9766dff..f2f7fe0d51c6c03685a71cd369d116e51f554db3 100644 (file)
@@ -309,6 +309,9 @@ void GEOMAlgo_FinderShapeOn1::ProcessEdges()
   aType1=myGAS.GetType();
   //
   TopExp::MapShapes(myShape, TopAbs_EDGE, aM);
+  //
+  bIsConformState=Standard_False;
+  //
   aNb=aM.Extent();
   for (i=1; i<=aNb; ++i) {
     GEOMAlgo_ListOfPnt aLP;
@@ -427,6 +430,8 @@ void GEOMAlgo_FinderShapeOn1::ProcessFaces()
       }
     }
     //
+    bIsConformState=Standard_False;
+    //
     aExp.Init(aF, TopAbs_EDGE);
     for (; aExp.More(); aExp.Next()) {
       const TopoDS_Shape& aE=aExp.Current();
@@ -500,6 +505,9 @@ void GEOMAlgo_FinderShapeOn1::ProcessSolids()
     const TopoDS_Shape& aSd=aM(i);
     aMF.Clear();
     TopExp::MapShapes(aSd, TopAbs_FACE, aMF);
+    //
+    bIsConformState=Standard_False;
+    //
     aNbF=aMF.Extent();
     for (j=1; j<=aNbF; ++j) {
       const TopoDS_Shape& aF=aMF(j);
@@ -660,7 +668,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Face& aF,
     }// if (aType==GeomAbs_Plane || aType==GeomAbs_Cylinder)
   }// if (!aNb && myNbPntsMin) {
 }
-//modified by NIZNHY-PKV Thu Jan 26 09:56:20 2012f
 //=======================================================================
 //function : InnerPoints
 //purpose  :
@@ -676,7 +683,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
   aLP.Clear();
   InnerPoints(aE, aNbPntsMin, aLP);
 }
-//modified by NIZNHY-PKV Thu Jan 26 09:56:32 2012t
 //=======================================================================
 //function : InnerPoints
 //purpose  :
@@ -702,16 +708,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
     return;
   }
   //
-  //modified by NIZNHY-PKV Thu Jan 26 09:51:20 2012f
-  /*
-  aNbT=myNbPntsMin+1;
-  dT=(aT2-aT1)/aNbT;
-  for (j=1; j<=aNbPntsMin; ++j) {
-    aT=aT1+j*dT;
-    aC3D->D0(aT, aP);
-    aLP.Append(aP);
-  }
-  */
   aNbT=aNbPntsMin+1;
   dT=(aT2-aT1)/aNbT;
   for (j=1; j<aNbT; ++j) {
@@ -719,7 +715,6 @@ void GEOMAlgo_FinderShapeOn1::InnerPoints(const TopoDS_Edge& aE,
     aC3D->D0(aT, aP);
     aLP.Append(aP);
   }
-  //modified by NIZNHY-PKV Thu Jan 26 09:51:24 2012t
 }
 
 //=======================================================================
index 439caec37553401368f4e839bc3a845ebc70603b..e2e34de0fefe009075e38d742c2ee8e4c4bd879e 100644 (file)
@@ -362,6 +362,8 @@ void GEOMAlgo_FinderShapeOn2::ProcessEdges()
     //
     const TopoDS_Edge& aE=TopoDS::Edge(aM(i));
     //
+    bIsConformState=Standard_False;
+    //
     aExp.Init(aE, TopAbs_VERTEX);
     for (; aExp.More(); aExp.Next()) {
       const TopoDS_Shape& aV=aExp.Current();
@@ -475,6 +477,9 @@ void GEOMAlgo_FinderShapeOn2::ProcessFaces()
       }
     }
     //
+    //
+    bIsConformState=Standard_False;
+    //
     aExp.Init(aF, TopAbs_EDGE);
     for (; aExp.More(); aExp.Next()) {
       const TopoDS_Shape& aE=aExp.Current();
@@ -558,6 +563,9 @@ void GEOMAlgo_FinderShapeOn2::ProcessSolids()
     const TopoDS_Shape& aSd=aM(i);
     aMF.Clear();
     TopExp::MapShapes(aSd, TopAbs_FACE, aMF);
+    //
+    bIsConformState=Standard_False;
+    //
     aNbF=aMF.Extent();
     for (j=1; j<=aNbF; ++j) {
       const TopoDS_Shape& aF=aMF(j);
index c717997e3826289a4353a548154853ffccbcd9a1..03416d293fa26c0b8cfc1ca0f229a4e6a1196d0c 100644 (file)
@@ -239,7 +239,6 @@ Standard_Integer PntInSolid(const TopoDS_Solid& aZ,
   gp_Pnt aPx;
   gp_Pnt2d aP2Dx;
   gp_Vec aDNx;
-
   TopoDS_Face aF;
   TopExp_Explorer aExp;
   //
@@ -247,9 +246,8 @@ Standard_Integer PntInSolid(const TopoDS_Solid& aZ,
   aCoef=10.;
   //
   aExp.Init (aZ, TopAbs_FACE);
-  for (; aExp.More() ; aExp.Next()) {
+  if (aExp.More()) {
     aF=*((TopoDS_Face*)&aExp.Current());
-    break;
   }
   //
   iErr=PntInFace(aF, aPx, aP2Dx);
@@ -368,29 +366,31 @@ Standard_Integer PntInFace(const TopoDS_Face& aF,
   //
   // 4.
   aNbDomains=aHatcher.NbDomains(aIx);
-  for (i=1; i<=aNbDomains; ++i) {
-    const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
-    bHasFirstPoint=aDomain.HasFirstPoint();
-    if (!bHasFirstPoint) {
-      iErr=5;
-      return iErr;
-    }
-    //
-    aV1=aDomain.FirstPoint().Parameter();
-    //
-    bHasSecondPoint=aDomain.HasSecondPoint();
-    if (!bHasSecondPoint) {
-      iErr=6;
-      return iErr;
-    }
-    //
-    aV2=aDomain.SecondPoint().Parameter();
-    //
-    aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
-    //
-    break;
+  if (!aNbDomains) {
+    iErr=5;
+    return iErr;
+  }
+  //
+  i=1;
+  const HatchGen_Domain& aDomain=aHatcher.Domain (aIx, i) ;
+  bHasFirstPoint=aDomain.HasFirstPoint();
+  if (!bHasFirstPoint) {
+    iErr=5;
+    return iErr;
+  }
+  //
+  aV1=aDomain.FirstPoint().Parameter();
+  //
+  bHasSecondPoint=aDomain.HasSecondPoint();
+  if (!bHasSecondPoint) {
+    iErr=6;
+    return iErr;
   }
   //
+  aV2=aDomain.SecondPoint().Parameter();
+  //
+  aVx=IntTools_Tools::IntermediatePoint(aV1, aV2);
+  //
   aS->D0(aUx, aVx, aPx);
   //
   theP2D.SetCoord(aUx, aVx);
index e5ca7dfbdad98cf0db273041c476a2c5d0b0aaa1..bad1fe01f67b65b720463b5deea102cc61b7220c 100644 (file)
@@ -90,7 +90,6 @@ GEOMAlgo_GlueDetector::GEOMAlgo_GlueDetector()
 //=======================================================================
 GEOMAlgo_GlueDetector::~GEOMAlgo_GlueDetector()
 {}
-//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f
 //=======================================================================
 //function : StickedShapes
 //purpose  :
@@ -100,7 +99,6 @@ const TopTools_IndexedDataMapOfShapeListOfShape&
 {
   return myStickedShapes;
 }
-//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t
 //=======================================================================
 //function : Perform
 //purpose  :
@@ -124,12 +122,10 @@ void GEOMAlgo_GlueDetector::Perform()
     return;
   }
   //
-  //modified by NIZNHY-PKV Wed Mar 14 08:00:09 2012f
   CheckDetected();
   if (myErrorStatus) {
     return;
   }
-  //modified by NIZNHY-PKV Wed Mar 14 08:00:12 2012t
   //
   DetectEdges();
   if (myErrorStatus) {
@@ -206,7 +202,7 @@ void GEOMAlgo_GlueDetector::DetectVertices()
     TColStd_MapIteratorOfMapOfInteger aIt1;
     //
     aMIP.Add(i);
-    while(1) {
+    for(;;) {
       aNbIP=aMIP.Extent();
       aIt1.Initialize(aMIP);
       for(; aIt1.More(); aIt1.Next()) {
@@ -460,7 +456,6 @@ void GEOMAlgo_GlueDetector::EdgePassKey(const TopoDS_Edge& aE,
   //
   aPK.SetShapes(aLV);
 }
-//modified by NIZNHY-PKV Tue Mar 13 09:54:18 2012f
 //=======================================================================
 //function : CheckDetected
 //purpose  :
@@ -607,4 +602,3 @@ Standard_Integer CheckAncesstors
   //
   return iRet;
 }
-//modified by NIZNHY-PKV Tue Mar 13 09:54:59 2012t
old mode 100755 (executable)
new mode 100644 (file)
index 3c1d629..d9f8079
 // 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
@@ -228,10 +228,7 @@ void GEOMAlgo_Gluer::MakeVertices()
   TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
   TopTools_DataMapOfShapeListOfShape aMVV;
   GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
-  //modified by NIZNHY-PKV Thu Jan 21 10:03:07 2010f
-  //GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
   GEOMAlgo_IndexedDataMapOfShapeBndSphere aMSB;
-  //modified by NIZNHY-PKV Thu Jan 21 10:03:10 2010t
   //
   GEOMAlgo_BndSphereTreeSelector aSelector;
   GEOMAlgo_BndSphereTree aBBTree;
@@ -278,57 +275,54 @@ void GEOMAlgo_Gluer::MakeVertices()
     TColStd_MapIteratorOfMapOfInteger aIt1;
     //
     aMIP.Add(i);
-    while(1) {
+    for(;;) {
       aNbIP=aMIP.Extent();
       aIt1.Initialize(aMIP);
       for(; aIt1.More(); aIt1.Next()) {
-       aIP=aIt1.Key();
-       if (aMIPC.Contains(aIP)) {
-         continue;
-       }
-       //
-       const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
-       //modified by NIZNHY-PKV Thu Jan 21 10:04:09 2010f
-       const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
-       //const Bnd_Box& aBoxVP=aMSB.FindFromKey(aVP);
-       //modified by NIZNHY-PKV Thu Jan 21 10:04:11 2010t
-       //
-       aSelector.Clear();
-       aSelector.SetBox(aBoxVP);
-       //
-       aNbVSD=aBBTree.Select(aSelector);
-       if (!aNbVSD) {
-         continue;  // it must not be
-       }
-       //
-       const TColStd_ListOfInteger& aLI=aSelector.Indices();
-       //
-       aIt.Initialize(aLI);
-       for (; aIt.More(); aIt.Next()) {
-         aIP1=aIt.Value();
-         if (aMIP.Contains(aIP1)) {
-           continue;
-         }
-         aMIP1.Add(aIP1);
-       } //for (; aIt.More(); aIt.Next()) {
+        aIP=aIt1.Key();
+        if (aMIPC.Contains(aIP)) {
+          continue;
+        }
+        //
+        const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+        const GEOMAlgo_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
+        //
+        aSelector.Clear();
+        aSelector.SetBox(aBoxVP);
+        //
+        aNbVSD=aBBTree.Select(aSelector);
+        if (!aNbVSD) {
+          continue;  // it must not be
+ }
+        //
+        const TColStd_ListOfInteger& aLI=aSelector.Indices();
+        //
+        aIt.Initialize(aLI);
+        for (; aIt.More(); aIt.Next()) {
+          aIP1=aIt.Value();
+          if (aMIP.Contains(aIP1)) {
+            continue;
+          }
+          aMIP1.Add(aIP1);
+        } //for (; aIt.More(); aIt.Next()) {
       }//for(; aIt1.More(); aIt1.Next()) {
       //
       aNbIP1=aMIP1.Extent();
       if (!aNbIP1) {
-       break;
+        break;
       }
       //
       aIt1.Initialize(aMIP);
       for(; aIt1.More(); aIt1.Next()) {
-       aIP=aIt1.Key();
-       aMIPC.Add(aIP);
+        aIP=aIt1.Key();
+        aMIPC.Add(aIP);
       }
       //
       aMIP.Clear();
       aIt1.Initialize(aMIP1);
       for(; aIt1.More(); aIt1.Next()) {
-       aIP=aIt1.Key();
-       aMIP.Add(aIP);
+        aIP=aIt1.Key();
+        aMIP.Add(aIP);
       }
       aMIP1.Clear();
     }// while(1)
@@ -344,13 +338,13 @@ void GEOMAlgo_Gluer::MakeVertices()
     else { // SD vertices founded [ aMIPC ]
       aIt1.Initialize(aMIPC);
       for(j=0; aIt1.More(); aIt1.Next(), ++j) {
-       aIP=aIt1.Key();
-       const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
-       if (!j) {
-         aVF=aVP;
-       }
-       aLVSD.Append(aVP);
-       aMVProcessed.Add(aVP);
+        aIP=aIt1.Key();
+        const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
+        if (!j) {
+          aVF=aVP;
+        }
+        aLVSD.Append(aVP);
+        aMVProcessed.Add(aVP);
       }
     }
     myImages.Bind(aVF, aLVSD);
@@ -395,7 +389,7 @@ void GEOMAlgo_Gluer::MakeVertices()
     for (; aItS.More(); aItS.Next()) {
       const TopoDS_Shape& aVSD=aItS.Value();
       if (!myOrigins.IsBound(aVSD)) {
-       myOrigins.Bind(aVSD, aV);
+        myOrigins.Bind(aVSD, aV);
       }
     }
   }
@@ -468,7 +462,8 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape&  theShape,
           aER.Orientation(TopAbs_FORWARD);
           if (!BRep_Tool::Degenerated(aER)) {
             // orient image
-            Standard_Boolean bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
+            Standard_Boolean bIsToReverse=
+              GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
             if (bIsToReverse) {
               aER.Reverse();
             }
@@ -490,8 +485,7 @@ void GEOMAlgo_Gluer::MakeSubShapes (const TopoDS_Shape&  theShape,
       aBB.Add(theResult, aShapeR);
     }
   }
-  else
-  {
+  else  {
     if (myKeepNonSolids)    {
       // just add image
       const TopoDS_Shape& aShapeR = myOrigins.Find(theShape);
@@ -554,12 +548,12 @@ void GEOMAlgo_Gluer::MakeShells()
       const TopoDS_Face& aF=TopoDS::Face(aExp.Current());
       aFR=TopoDS::Face(myOrigins.Find(aF));
       if (aFR.IsSame(aF)) {
-       aBB.Add(aNewShell, aF);
-       continue;
+        aBB.Add(aNewShell, aF);
+        continue;
       }
       bIsToReverse=IsToReverse(aFR, aF);
       if (bIsToReverse) {
-       aFR.Reverse();
+        aFR.Reverse();
       }
       aBB.Add(aNewShell, aFR);
     }
@@ -660,25 +654,25 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
     if (aNbSDF==1) {
       bHasNewSubShape=HasNewSubShape(aS1);
       if (!bHasNewSubShape) {
-       aNewShape=aS1;
-       aNewShape.Orientation(TopAbs_FORWARD);
+        aNewShape=aS1;
+        aNewShape.Orientation(TopAbs_FORWARD);
       }
     }
     //
     if (bHasNewSubShape) {
       if (aType==TopAbs_FACE) {
-       TopoDS_Face aNewFace;
-       //
-       const TopoDS_Face& aF1=TopoDS::Face(aS1);
-       MakeFace(aF1, aNewFace);
-       aNewShape=aNewFace;
+        TopoDS_Face aNewFace;
+        //
+        const TopoDS_Face& aF1=TopoDS::Face(aS1);
+        MakeFace(aF1, aNewFace);
+        aNewShape=aNewFace;
       }
       else if (aType==TopAbs_EDGE) {
-       TopoDS_Edge aNewEdge;
-       //
-       const TopoDS_Edge& aE1=TopoDS::Edge(aS1);
-       MakeEdge(aE1, aNewEdge);
-       aNewShape=aNewEdge;
+        TopoDS_Edge aNewEdge;
+        //
+        const TopoDS_Edge& aE1=TopoDS::Edge(aS1);
+        MakeEdge(aE1, aNewEdge);
+        aNewShape=aNewEdge;
       }
     }
     //
@@ -688,7 +682,7 @@ void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
     for (; aItS.More(); aItS.Next()) {
       const TopoDS_Shape& aFSD=aItS.Value();
       if (!myOrigins.IsBound(aFSD)) {
-       myOrigins.Bind(aFSD, aNewShape);
+        myOrigins.Bind(aFSD, aNewShape);
       }
     }
   }
@@ -728,12 +722,12 @@ void GEOMAlgo_Gluer::CheckResult()
     for (j=1; j<=aNbFS; ++j) {
       const TopoDS_Shape& aFS=aMFS(j);
       if (aMFR.Contains(aFS)) {
-       const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS);
-       aNbSx=aLSx.Extent();
-       if (aNbSx==2) {
-         bFound=!bFound;
-         break;
-       }
+        const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS);
+        aNbSx=aLSx.Extent();
+        if (aNbSx==2) {
+          bFound=!bFound;
+          break;
+        }
       }
     }
     //
@@ -795,7 +789,7 @@ void GEOMAlgo_Gluer::InnerTolerance()
 //purpose  :
 //=======================================================================
 void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF,
-                                GEOMAlgo_PassKeyShape& aPK)
+     GEOMAlgo_PassKeyShape& aPK)
 {
   Standard_Integer i, aNbE;
   TopTools_ListOfShape aLE;
@@ -820,7 +814,7 @@ void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF,
 //purpose  :
 //=======================================================================
 void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE,
-                                GEOMAlgo_PassKeyShape& aPK)
+     GEOMAlgo_PassKeyShape& aPK)
 {
   TopoDS_Vertex aV1, aV2;
   //
@@ -839,7 +833,7 @@ void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE,
 //purpose  :
 //=======================================================================
 void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV,
-                               TopoDS_Vertex& aNewVertex)
+    TopoDS_Vertex& aNewVertex)
 {
   Standard_Integer aNbV;
   Standard_Real aTolV, aD, aDmax;
@@ -885,7 +879,7 @@ void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV,
 //purpose  :
 //=======================================================================
 void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
-                             TopoDS_Edge& aNewEdge)
+         TopoDS_Edge& aNewEdge)
 {
   myErrorStatus=0;
   //
@@ -939,7 +933,7 @@ void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
 //purpose  :
 //=======================================================================
 void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
-                             TopoDS_Face& aNewFace)
+         TopoDS_Face& aNewFace)
 {
   myErrorStatus=0;
   //
@@ -975,20 +969,20 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
       //
       aER.Orientation(TopAbs_FORWARD);
       if (!BRep_Tool::Degenerated(aER)) {
-       // build p-curve
-       if (bIsUPeriodic) {
-         GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
-       }
-       BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
-
-       // orient image
-       bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
-       if (bIsToReverse) {
-         aER.Reverse();
-       }
+        // build p-curve
+        if (bIsUPeriodic) {
+          GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
+          }
+        BOPTools_AlgoTools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
+        
+        // orient image
+        bIsToReverse=GEOMAlgo_AlgoTools::IsSplitToReverse(aER, aE, myContext);
+        if (bIsToReverse) {
+          aER.Reverse();
+        }
       }
       else {
-       aER.Orientation(aE.Orientation());
+        aER.Orientation(aE.Orientation());
       }
       //
       aBB.Add(newWire, aER);
@@ -1009,7 +1003,7 @@ void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
 //purpose  :
 //=======================================================================
 Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
-                                            const TopoDS_Face& aF)
+                                             const TopoDS_Face& aF)
 {
   Standard_Boolean bRet;
   Standard_Real aT, aT1, aT2, aTR, aScPr;
@@ -1088,7 +1082,7 @@ Standard_Boolean GEOMAlgo_Gluer::HasNewSubShape(const TopoDS_Shape& aS)const
 //purpose  :
 //=======================================================================
 void GetSubShapes(const TopoDS_Shape& aS,
-                 TopTools_IndexedMapOfShape& aMSS)
+    TopTools_IndexedMapOfShape& aMSS)
 {
   Standard_Integer aR;
   TopAbs_ShapeEnum aType;
@@ -1111,7 +1105,8 @@ void GetSubShapes(const TopoDS_Shape& aS,
 //function : Modified
 //purpose  :
 //=======================================================================
-const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS)
+const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified
+  (const TopoDS_Shape& aS)
 {
   TopAbs_ShapeEnum aType;
   //
@@ -1127,7 +1122,7 @@ const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS)
     if(myOrigins.IsBound(aS)) {
       const TopoDS_Shape& aSnew=myOrigins.Find(aS);
       if (!aSnew.IsSame(aS)) {
-       myGenerated.Append(aSnew);
+        myGenerated.Append(aSnew);
       }
     }
   }
index 80e71f4fae4c52c0e5b9c30c7f2ec5e3a1d57d3b..7ecbd807bb3ee10d9a8efdcc46e997987df52b76 100644 (file)
@@ -84,11 +84,8 @@ void GEOMAlgo_Gluer2::Clear()
   myImagesToWork.Clear();
   myOriginsToWork.Clear();
   myKeepNonSolids=Standard_False;
-  //modified by NIZNHY-PKV Tue Mar 13 13:38:28 2012f
   myDetector.Clear();
-  //modified by NIZNHY-PKV Tue Mar 13 13:38:30 2012t
 }
-//modified by NIZNHY-PKV Tue Mar 13 12:26:50 2012f
 //=======================================================================
 //function : StickedShapes
 //purpose  :
@@ -98,12 +95,12 @@ const TopTools_IndexedDataMapOfShapeListOfShape&
 {
   return myDetector.StickedShapes();
 }
-//modified by NIZNHY-PKV Tue Mar 13 12:26:54 2012t
 //=======================================================================
 //function : SetShapesToGlue
 //purpose  :
 //=======================================================================
-void GEOMAlgo_Gluer2::SetShapesToGlue(const TopTools_DataMapOfShapeListOfShape& aM)
+void GEOMAlgo_Gluer2::SetShapesToGlue
+  (const TopTools_DataMapOfShapeListOfShape& aM)
 {
   myShapesToGlue=aM;
 }
@@ -241,6 +238,7 @@ void GEOMAlgo_Gluer2::CheckData()
   myWarningStatus=0;
   //
   aNbSG=myShapesToGlue.Extent();
+  aType=TopAbs_SHAPE;
   if (aNbSG) {
     // Check myShapesToGlue
     aItDMSLS.Initialize(myShapesToGlue);
@@ -587,6 +585,7 @@ void GEOMAlgo_Gluer2::BuildResult()
   myErrorStatus=0;
   myWarningStatus=0;
   //
+  bHasImage=Standard_False;
   aItC.Initialize(myArgument);
   for (; aItC.More(); aItC.Next()) {
     const TopoDS_Shape& aCx=aItC.Value();
diff --git a/src/GEOMAlgo/GEOMAlgo_KindOfDef.hxx b/src/GEOMAlgo/GEOMAlgo_KindOfDef.hxx
new file mode 100644 (file)
index 0000000..fab5929
--- /dev/null
@@ -0,0 +1,37 @@
+// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//GEOMAlgo_KindOfDef
+#ifndef _GEOMAlgo_KindOfDef_HeaderFile
+#define _GEOMAlgo_KindOfDef_HeaderFile
+
+
+enum GEOMAlgo_KindOfDef {
+GEOMAlgo_KD_UNKNOWN,
+GEOMAlgo_KD_SPECIFIED,
+GEOMAlgo_KD_ARBITRARY
+};
+
+#ifndef _Standard_PrimitiveTypes_HeaderFile
+#include <Standard_PrimitiveTypes.hxx>
+#endif
+
+#endif
index eda5fba088fe71d9b5b9d8f875768e06a56a7cd6..cf012663ecda63232ad00c343cbf6dee2c2545ad 100644 (file)
@@ -44,7 +44,8 @@ GEOMAlgo_KN_DISKELLIPSE,
 GEOMAlgo_KN_RECTANGLE,
 GEOMAlgo_KN_TRIANGLE,
 GEOMAlgo_KN_QUADRANGLE,
-GEOMAlgo_KN_ARCELLIPSE
+GEOMAlgo_KN_ARCELLIPSE,
+GEOMAlgo_KN_SOLID
 };
 
 #ifndef _Standard_PrimitiveTypes_HeaderFile
index 32efa59c96b97c16834364d9d3c53b51a8968179..382fdef6a0f0068c28f1c30b1d0ebbaca2d3897e 100644 (file)
@@ -35,9 +35,7 @@ GEOMAlgo_KS_PLANE,
 GEOMAlgo_KS_CIRCLE,
 GEOMAlgo_KS_LINE,
 GEOMAlgo_KS_DEGENERATED,
-//modified by NIZNHY-PKV Tue Jul 03 10:28:09 2012f
 GEOMAlgo_KS_BSPLINE
-//modified by NIZNHY-PKV Tue Jul 03 10:28:11 2012t
 };
 
 #ifndef _Standard_PrimitiveTypes_HeaderFile
index b91eb9728cb91128e374c31adc848ca108838d8e..fe4b7f69b0fb5d4726d5a1a02be4287c01526c10 100644 (file)
@@ -29,6 +29,8 @@ static
   void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB);
 static
   void DumpKindOfName(const GEOMAlgo_KindOfName aKS);
+static
+  void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD);
 static
   void DumpPosition(const gp_Ax3& aAx3);
 static
@@ -39,7 +41,7 @@ static
 //function :
 //purpose  :
 //=======================================================================
-  GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo()
+GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo()
 {
   Reset();
 }
@@ -47,14 +49,14 @@ static
 //function : ~
 //purpose  :
 //=======================================================================
-  GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo()
+GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo()
 {
 }
 //=======================================================================
 //function : Reset
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::Reset()
+void GEOMAlgo_ShapeInfo::Reset()
 {
   Standard_Integer i;
   //
@@ -69,6 +71,7 @@ static
   myKindOfBounds=GEOMAlgo_KB_UNKNOWN;
   myKindOfClosed=GEOMAlgo_KC_UNKNOWN;
   myKindOfName=GEOMAlgo_KN_UNKNOWN;
+  myKindOfDef=GEOMAlgo_KD_UNKNOWN;
   //
   myLocation.SetCoord(99., 99., 99.);
   myDirection.SetCoord(1.,0.,0.);
@@ -83,7 +86,7 @@ static
 //function : SetType
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType)
+void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType)
 {
   myType=aType;
 }
@@ -91,7 +94,7 @@ static
 //function : Type
 //purpose  :
 //=======================================================================
-  TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const
+TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const
 {
   return myType;
 }
@@ -99,8 +102,8 @@ static
 //function : SetNbSubShapes
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetNbSubShapes(const TopAbs_ShapeEnum aType,
-                                          const Standard_Integer aNb)
+void GEOMAlgo_ShapeInfo::SetNbSubShapes(const TopAbs_ShapeEnum aType,
+                                        const Standard_Integer aNb)
 {
   Standard_Integer iN;
 
@@ -113,7 +116,8 @@ static
 //function : NbSubShapes
 //purpose  :
 //=======================================================================
-  Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes(const TopAbs_ShapeEnum aType) const
+Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes
+  (const TopAbs_ShapeEnum aType) const
 {
   Standard_Integer iN;
 
@@ -127,7 +131,7 @@ static
 //function : SetKindOfShape
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetKindOfShape(const GEOMAlgo_KindOfShape aT)
+void GEOMAlgo_ShapeInfo::SetKindOfShape(const GEOMAlgo_KindOfShape aT)
 {
   myKindOfShape=aT;
 }
@@ -135,7 +139,7 @@ static
 //function : KindOfShape
 //purpose  :
 //=======================================================================
-  GEOMAlgo_KindOfShape GEOMAlgo_ShapeInfo::KindOfShape() const
+GEOMAlgo_KindOfShape GEOMAlgo_ShapeInfo::KindOfShape() const
 {
   return myKindOfShape;
 }
@@ -143,7 +147,7 @@ static
 //function : SetKindOfName
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetKindOfName(const GEOMAlgo_KindOfName aT)
+void GEOMAlgo_ShapeInfo::SetKindOfName(const GEOMAlgo_KindOfName aT)
 {
   myKindOfName=aT;
 }
@@ -151,7 +155,7 @@ static
 //function : KindOfName
 //purpose  :
 //=======================================================================
-  GEOMAlgo_KindOfName GEOMAlgo_ShapeInfo::KindOfName() const
+GEOMAlgo_KindOfName GEOMAlgo_ShapeInfo::KindOfName() const
 {
   return myKindOfName;
 }
@@ -159,7 +163,7 @@ static
 //function : SetKindOfBounds
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetKindOfBounds(const GEOMAlgo_KindOfBounds aT)
+void GEOMAlgo_ShapeInfo::SetKindOfBounds(const GEOMAlgo_KindOfBounds aT)
 {
   myKindOfBounds=aT;
 }
@@ -167,7 +171,7 @@ static
 //function : KindOfBounds
 //purpose  :
 //=======================================================================
-  GEOMAlgo_KindOfBounds GEOMAlgo_ShapeInfo::KindOfBounds() const
+GEOMAlgo_KindOfBounds GEOMAlgo_ShapeInfo::KindOfBounds() const
 {
   return myKindOfBounds;
 }
@@ -175,7 +179,7 @@ static
 //function : SetKindOfClosed
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetKindOfClosed(const GEOMAlgo_KindOfClosed aT)
+void GEOMAlgo_ShapeInfo::SetKindOfClosed(const GEOMAlgo_KindOfClosed aT)
 {
   myKindOfClosed=aT;
 }
@@ -183,15 +187,31 @@ static
 //function : KindOfClosed
 //purpose  :
 //=======================================================================
-  GEOMAlgo_KindOfClosed GEOMAlgo_ShapeInfo::KindOfClosed() const
+GEOMAlgo_KindOfClosed GEOMAlgo_ShapeInfo::KindOfClosed() const
 {
   return myKindOfClosed;
 }
 //=======================================================================
+//function : SetKindOfDef
+//purpose  :
+//=======================================================================
+void GEOMAlgo_ShapeInfo::SetKindOfDef(const GEOMAlgo_KindOfDef aT)
+{
+  myKindOfDef=aT;
+}
+//=======================================================================
+//function : KindOfDef
+//purpose  :
+//=======================================================================
+GEOMAlgo_KindOfDef GEOMAlgo_ShapeInfo::KindOfDef() const
+{
+  return myKindOfDef;
+}
+//=======================================================================
 //function : SetLocation
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetLocation(const gp_Pnt& aP)
+void GEOMAlgo_ShapeInfo::SetLocation(const gp_Pnt& aP)
 {
   myLocation=aP;
 }
@@ -199,7 +219,7 @@ static
 //function : Location
 //purpose  :
 //=======================================================================
-  const gp_Pnt& GEOMAlgo_ShapeInfo::Location() const
+const gp_Pnt& GEOMAlgo_ShapeInfo::Location() const
 {
   return myLocation;
 }
@@ -207,7 +227,7 @@ static
 //function : SetDirection
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetDirection(const gp_Dir& aD)
+void GEOMAlgo_ShapeInfo::SetDirection(const gp_Dir& aD)
 {
   myDirection=aD;
 }
@@ -215,7 +235,7 @@ static
 //function : Direction
 //purpose  :
 //=======================================================================
-  const gp_Dir& GEOMAlgo_ShapeInfo::Direction() const
+const gp_Dir& GEOMAlgo_ShapeInfo::Direction() const
 {
   return myDirection;
 }
@@ -223,7 +243,7 @@ static
 //function : SetPosition
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax2& aAx2)
+void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax2& aAx2)
 {
   gp_Ax3 aAx3(aAx2);
   SetPosition(aAx3);
@@ -232,7 +252,7 @@ static
 //function : SetPosition
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax3& aAx3)
+void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax3& aAx3)
 {
   myPosition=aAx3;
 }
@@ -240,7 +260,7 @@ static
 //function : Position
 //purpose  :
 //=======================================================================
-  const gp_Ax3& GEOMAlgo_ShapeInfo::Position() const
+const gp_Ax3& GEOMAlgo_ShapeInfo::Position() const
 {
   return myPosition;
 }
@@ -249,7 +269,7 @@ static
 //function : SetPnt1
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetPnt1(const gp_Pnt& aP)
+void GEOMAlgo_ShapeInfo::SetPnt1(const gp_Pnt& aP)
 {
   myPnt1=aP;
 }
@@ -257,7 +277,7 @@ static
 //function : Pnt1
 //purpose  :
 //=======================================================================
-  const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt1() const
+const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt1() const
 {
   return myPnt1;
 }
@@ -265,7 +285,7 @@ static
 //function : SetPnt2
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetPnt2(const gp_Pnt& aP)
+void GEOMAlgo_ShapeInfo::SetPnt2(const gp_Pnt& aP)
 {
   myPnt2=aP;
 }
@@ -273,7 +293,7 @@ static
 //function : Pnt2
 //purpose  :
 //=======================================================================
-  const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt2() const
+const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt2() const
 {
   return myPnt2;
 }
@@ -281,7 +301,7 @@ static
 //function : SetRadius1
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetRadius1(const Standard_Real aR)
+void GEOMAlgo_ShapeInfo::SetRadius1(const Standard_Real aR)
 {
   myRadius1=aR;
 }
@@ -289,7 +309,7 @@ static
 //function : Radius1
 //purpose  :
 //=======================================================================
-  Standard_Real GEOMAlgo_ShapeInfo::Radius1() const
+Standard_Real GEOMAlgo_ShapeInfo::Radius1() const
 {
   return myRadius1;
 }
@@ -297,7 +317,7 @@ static
 //function : SetRadius2
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetRadius2(const Standard_Real aR)
+void GEOMAlgo_ShapeInfo::SetRadius2(const Standard_Real aR)
 {
   myRadius2=aR;
 }
@@ -305,7 +325,7 @@ static
 //function : Radius2
 //purpose  :
 //=======================================================================
-  Standard_Real GEOMAlgo_ShapeInfo::Radius2() const
+Standard_Real GEOMAlgo_ShapeInfo::Radius2() const
 {
   return myRadius2;
 }
@@ -313,7 +333,7 @@ static
 //function : SetLength
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetLength(const Standard_Real aL)
+void GEOMAlgo_ShapeInfo::SetLength(const Standard_Real aL)
 {
   myLength=aL;
 }
@@ -321,7 +341,7 @@ static
 //function : Length
 //purpose  :
 //=======================================================================
-  Standard_Real GEOMAlgo_ShapeInfo::Length() const
+Standard_Real GEOMAlgo_ShapeInfo::Length() const
 {
   return myLength;
 }
@@ -329,7 +349,7 @@ static
 //function : SetWidth
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetWidth(const Standard_Real aW)
+void GEOMAlgo_ShapeInfo::SetWidth(const Standard_Real aW)
 {
   myWidth=aW;
 }
@@ -337,7 +357,7 @@ static
 //function : Width
 //purpose  :
 //=======================================================================
-  Standard_Real GEOMAlgo_ShapeInfo::Width() const
+Standard_Real GEOMAlgo_ShapeInfo::Width() const
 {
   return myWidth;
 }
@@ -345,7 +365,7 @@ static
 //function : SetHeight
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::SetHeight(const Standard_Real aH)
+void GEOMAlgo_ShapeInfo::SetHeight(const Standard_Real aH)
 {
   myHeight=aH;
 }
@@ -353,7 +373,7 @@ static
 //function : Height
 //purpose  :
 //=======================================================================
-  Standard_Real GEOMAlgo_ShapeInfo::Height() const
+Standard_Real GEOMAlgo_ShapeInfo::Height() const
 {
   return myHeight;
 }
@@ -372,7 +392,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
 //function : Dump
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::Dump()const
+void GEOMAlgo_ShapeInfo::Dump()const
 {
   switch (myType) {
     //
@@ -417,7 +437,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
 //function : DumpCompound
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::DumpCompound()const
+void GEOMAlgo_ShapeInfo::DumpCompound()const
 {
   Standard_Integer aNbV, aNbE, aNbF, aNbS, aNbC, aNbP;
   GEOMAlgo_KindOfShape aKS;
@@ -452,7 +472,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
 //function : DumpCompSolid
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::DumpCompSolid()const
+void GEOMAlgo_ShapeInfo::DumpCompSolid()const
 {
   Standard_Integer aNbV, aNbE, aNbF, aNbS;
   GEOMAlgo_KindOfShape aKS;
@@ -479,12 +499,11 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
   DumpKindOfBounds(aKB);
   DumpKindOfClosed(aKC);
 }
-
 //=======================================================================
 //function : DumpSolid
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::DumpSolid()const
+void GEOMAlgo_ShapeInfo::DumpSolid()const
 {
   Standard_Integer aNbV, aNbE, aNbF;
   GEOMAlgo_KindOfShape aKS;
@@ -545,18 +564,18 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
     printf("  Height    : %.3lf\n", myHeight);
   }
 }
-
 //=======================================================================
 //function : DumpFace
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::DumpFace()const
+void GEOMAlgo_ShapeInfo::DumpFace()const
 {
   Standard_Integer aNbV, aNbE;
   GEOMAlgo_KindOfShape aKS;
   GEOMAlgo_KindOfName aKN;
   GEOMAlgo_KindOfBounds aKB;
   GEOMAlgo_KindOfClosed aKC;
+  GEOMAlgo_KindOfDef aKD;
   //
   aNbV=NbSubShapes(TopAbs_VERTEX);
   aNbE=NbSubShapes(TopAbs_EDGE);
@@ -564,6 +583,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
   aKN=KindOfName();
   aKB=KindOfBounds();
   aKC=KindOfClosed();
+  aKD=KindOfDef();
   //
   printf(" *FACE\n");
   printf("  number of vertices: %d\n", aNbV);
@@ -572,6 +592,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
   DumpKindOfName (aKN);
   DumpKindOfBounds(aKB);
   DumpKindOfClosed(aKC);
+  DumpKindOfDef(aKD);
   //
   // PLANE
   if (aKN==GEOMAlgo_KN_PLANE) {
@@ -641,7 +662,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
 //function : DumpShell
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::DumpShell()const
+void GEOMAlgo_ShapeInfo::DumpShell()const
 {
   Standard_Integer aNbV, aNbE, aNbF;
   GEOMAlgo_KindOfClosed aKC;
@@ -662,7 +683,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
 //function : DumpWire
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::DumpWire()const
+void GEOMAlgo_ShapeInfo::DumpWire()const
 {
   Standard_Integer aNbV, aNbE;
   GEOMAlgo_KindOfClosed aKC;
@@ -682,7 +703,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
 //function : DumpEdge
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::DumpEdge()const
+void GEOMAlgo_ShapeInfo::DumpEdge()const
 {
   Standard_Integer aNbV;
   Standard_Real aX, aY, aZ;
@@ -755,7 +776,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
 //function : DumpVertex
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfo::DumpVertex()const
+void GEOMAlgo_ShapeInfo::DumpVertex()const
 {
   printf(" *VERTEX\n");
   DumpLocation(myLocation);
@@ -764,7 +785,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
 //function : DumpLocation
 //purpose  :
 //=======================================================================
-  void DumpLocation(const gp_Pnt& aP)
+void DumpLocation(const gp_Pnt& aP)
 {
   Standard_Real aX, aY, aZ;
   //
@@ -775,7 +796,7 @@ Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
 //function : DumpDirection
 //purpose  :
 //=======================================================================
-  void DumpDirection(const gp_Dir& aD)
+void DumpDirection(const gp_Dir& aD)
 {
   Standard_Real aX, aY, aZ;
   //
@@ -881,10 +902,27 @@ void DumpKindOfName(const GEOMAlgo_KindOfName aKS)
     "KN_RECTANGLE",
     "KN_TRIANGLE",
     "KN_QUADRANGLE",
-    "KN_ARCELLIPSE"
+    "KN_ARCELLIPSE",
+    "KN_SOLID"
     };
   int i;
   //
   i=(Standard_Integer)aKS;
   printf(" KindOfName  : %s\n", pStr[i]);
 }
+//=======================================================================
+//function : DumpKindOfDef
+//purpose  :
+//=======================================================================
+void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD)
+{
+  const char *pStr[]={
+    "KD_UNKNOWN",
+    "KD_SPECIFIED",
+    "KB_ARBITRARY"
+  };
+  int i;
+  //
+  i=(Standard_Integer)aKD;
+  printf(" KindOfDef: %s\n", pStr[i]);
+}
index 827370343f5ac21918334ee025f2f097fe2d5795..0556e68d47ffa559d644516d19adbb0bf235a486 100644 (file)
@@ -37,6 +37,7 @@
 #include <GEOMAlgo_KindOfName.hxx>
 #include <GEOMAlgo_KindOfBounds.hxx>
 #include <GEOMAlgo_KindOfClosed.hxx>
+#include <GEOMAlgo_KindOfDef.hxx>
 
 
 //=======================================================================
@@ -62,7 +63,8 @@ class GEOMAlgo_ShapeInfo
     TopAbs_ShapeEnum Type() const;
 
   Standard_EXPORT
-    void SetNbSubShapes(const TopAbs_ShapeEnum aType,const Standard_Integer aNb) ;
+    void SetNbSubShapes(const TopAbs_ShapeEnum aType,
+                        const Standard_Integer aNb) ;
 
   Standard_EXPORT
     Standard_Integer NbSubShapes(const TopAbs_ShapeEnum aType) const;
@@ -91,6 +93,12 @@ class GEOMAlgo_ShapeInfo
   Standard_EXPORT
     GEOMAlgo_KindOfClosed KindOfClosed() const;
 
+  Standard_EXPORT
+    void SetKindOfDef(const GEOMAlgo_KindOfDef aT) ;
+
+  Standard_EXPORT
+    GEOMAlgo_KindOfDef KindOfDef() const;
+
   Standard_EXPORT
     void SetLocation(const gp_Pnt& aP) ;
 
@@ -189,6 +197,7 @@ class GEOMAlgo_ShapeInfo
   GEOMAlgo_KindOfName myKindOfName;
   GEOMAlgo_KindOfBounds myKindOfBounds;
   GEOMAlgo_KindOfClosed myKindOfClosed;
+  GEOMAlgo_KindOfDef myKindOfDef;
   gp_Pnt myLocation;
   gp_Dir myDirection;
   gp_Ax3 myPosition;
index 84a4f4322a1944ce9f9605348ca92a4b7fec14e3..e440912b61d6156929762a308c3458e4ca7e8c26 100644 (file)
@@ -59,7 +59,7 @@
 //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;
 }
@@ -84,7 +84,7 @@
 //function : Tolerance
 //purpose  :
 //=======================================================================
-  Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const
+Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const
 {
   return myTolerance;
 }
@@ -92,7 +92,7 @@
 //function : SetShape
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS)
 {
   myShape=aS;
 }
 //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);
@@ -535,7 +523,6 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
     FillSubShapes(aS);
     return;
   }
-  //modified by NIZNHY-PKV Tue Jul 03 10:19:03 2012f
   // BSplineCurve
   if (aCT==GeomAbs_BSplineCurve) {
     Standard_Integer aNbKnots, aNbPoles, aDegree;
@@ -577,7 +564,6 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
       aInfo.SetDirection(aDir);
     }
   }
-  //modified by NIZNHY-PKV Tue Jul 03 10:19:06 2012t
   // Line
   else if (aCT==GeomAbs_Line) {
     Standard_Boolean bInf1, bInf2;
@@ -712,7 +698,7 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
 //function :FillVertex
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS)
+void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS)
 {
   myErrorStatus=0;
   //
@@ -739,8 +725,8 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
 //function : FillNbSubshapes
 //purpose  :
 //=======================================================================
-  void GEOMAlgo_ShapeInfoFiller::FillNbSubShapes(const TopoDS_Shape& aS,
-                                                 GEOMAlgo_ShapeInfo& aInfo)
+void GEOMAlgo_ShapeInfoFiller::FillNbSubShapes(const TopoDS_Shape& aS,
+                                               GEOMAlgo_ShapeInfo& aInfo)
 {
   myErrorStatus=0;
   //
@@ -776,7 +762,8 @@ void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
 //function :NbShells
 //purpose  :
 //=======================================================================
-Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd)
+Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells
+  (const TopoDS_Solid& aSd)
 {
   Standard_Integer iCnt;
   TopoDS_Iterator aIt;
@@ -785,7 +772,6 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd)
   //
   aIt.Initialize(aSd);
   for (; aIt.More(); aIt.Next()) {
-    //const TopoDS_Shape& aSh=aIt.Value();
     ++iCnt;
   }
   return iCnt;
@@ -794,7 +780,8 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells(const TopoDS_Solid& aSd)
 //function : NbWires
 //purpose  :
 //=======================================================================
-Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF)
+Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires
+  (const TopoDS_Face& aF)
 {
   Standard_Integer iCnt;
   TopoDS_Iterator aIt;
@@ -803,7 +790,6 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF)
   //
   aIt.Initialize(aF);
   for (; aIt.More(); aIt.Next()) {
-    //const TopoDS_Shape& aW=aIt.Value();
     ++iCnt;
   }
   return iCnt;
@@ -812,7 +798,8 @@ Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires(const TopoDS_Face& aF)
 //function : IsAllowedType
 //purpose  :
 //=======================================================================
-Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType aCT)
+Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType
+  (const GeomAbs_CurveType aCT)
 {
   Standard_Boolean bRet;
   Standard_Integer i, aNb;
@@ -820,7 +807,7 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType
     GeomAbs_Line,
     GeomAbs_Circle,
     GeomAbs_Ellipse,
-    GeomAbs_BSplineCurve //modified by NIZNHY-PKV Tue Jul 03 10:18:01 2012ft
+    GeomAbs_BSplineCurve 
   };
   //
   bRet=Standard_False;
@@ -834,7 +821,8 @@ Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_CurveType
 //function : IsAllowedType
 //purpose  :
 //=======================================================================
-Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType(const GeomAbs_SurfaceType aST)
+Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType
+  (const GeomAbs_SurfaceType aST)
 {
   Standard_Boolean bRet;
   Standard_Integer i, aNb;
index 77fb5e0c660e4c7df4be922ce05bb090e24f7fde..f5f50949689eb996fc3466134bc506f238a50cf4 100644 (file)
@@ -68,10 +68,12 @@ static
 void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
 {
   Standard_Boolean bIsStepSphere;
-  Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct, aNbCrc, aNbX;
+  Standard_Integer i, aNbF, aNbCyl, aNbCon, aNbPgn, aNbRct;
+  Standard_Integer aNbShells, aNbCrc, aNbX;
   TopoDS_Shape aFCyl, aFCon;
   TopTools_IndexedMapOfShape aMF;
   GEOMAlgo_KindOfName aKNF;
+  GEOMAlgo_KindOfDef aKD;
   //
   GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aSd);
   aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
@@ -83,7 +85,26 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
     return;
   }
   //
+  aKD=GEOMAlgo_KD_SPECIFIED;
+  for (i=1; i<=aNbF && aKD==GEOMAlgo_KD_SPECIFIED; ++i) {
+    const TopoDS_Shape& aF=aMF(i);
+    GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF);
+    aKD=aInfoF.KindOfDef();
+  }
+  if (aKD!=GEOMAlgo_KD_SPECIFIED) {
+    aInfo.SetKindOfName(GEOMAlgo_KN_SOLID); 
+    return;
+  }
+  //
+  aNbShells=GEOMAlgo_ShapeInfoFiller::NbShells(aSd);
+  if (aNbShells>1) {
+    aInfo.SetKindOfName(GEOMAlgo_KN_SOLID); 
+    return;
+  }
+  //
+  //
   if (aNbF==1) {
+    // mb: sphere, torus
     const TopoDS_Shape& aF=aMF(1);
     GEOMAlgo_ShapeInfo& aInfoF=myMapInfo.ChangeFromKey(aF);
     aKNF=aInfoF.KindOfName(); // mb: sphere, torus
@@ -99,7 +120,6 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
       return;
     }
   }
-  //modified by NIZNHY-PKV Tue Jul 03 13:23:55 2012f
   else if (aNbF==2) {
     // specific solid that should be treated as a sphere
     bIsStepSphere=TreatStepSphere(aSd);
@@ -107,7 +127,6 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
       return;
     }
   }
-  //modified by NIZNHY-PKV Tue Jul 03 13:23:57 2012t
   //
   aNbCyl=0;
   aNbCon=0;
@@ -229,11 +248,9 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
       const gp_Dir& aDNj=aIFj.Position().Direction();
       //
       aDot=aDNi*aDNj;
-      //modified by NIZNHY-PKV Tue Jul 03 10:01:56 2012f
       if (aDot<0.) {
         aDot=-aDot;
       }
-      //modified by NIZNHY-PKV Tue Jul 03 10:01:52 2012t
       if (fabs(1.-aDot)<0.0001) {
         aMp.Add(i);
         aMp.Add(j);
@@ -248,6 +265,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Solid& aSd)
     return;
   }
   //
+  iMin=-1;
+  iMax=-1;
   aDistMin=1.e15;
   aDistMax=-aDistMin;
   for (i=0; i<aNbFi; ++i) {
@@ -308,21 +327,10 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
   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);
@@ -330,9 +338,8 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
   // 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);
@@ -343,6 +350,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
       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;
@@ -351,22 +359,29 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
       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);
@@ -393,359 +408,327 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
       //
       aInfo.SetLocation(aPc);
       aInfo.SetPosition(aAx3);
-      //
-      return;
-    }
+    } // if (aNbV==3 && aNbE==3) {
     //
-    if (!(aNbV==4 && aNbE==4)) {
-      return;
-    }
-    //
-    // 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());
+      }
+      //
+      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();
       }
-    }
-    //
-    // 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);
+      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;
+        }
+      }
       //
-      aLength=aD1;
-      aWidth =aD0;
-
-      if (aD0>aD1) {
-        aLength=aD0;
-        aWidth =aD1;
-        aDX=aDx[1];
+      // 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;
-        }
-        aPX[i]=BRep_Tool::Pnt(aVD);
-        //
-        ++i;
-        ++aNbCE;
-      }
-      else if (aKNE==GEOMAlgo_KN_SEGMENT) {
-        if (BRep_Tool::IsClosed(aE, aF)) {
-          ++aNbSE;
+  if (aNbV==2 && aNbE==3) {
+    const gp_Ax1& aAx1=aCyl.Axis();
+    const gp_Dir& aDir=aAx1.Direction();
+    const gp_Pnt& aPLoc=aAx1.Location();
+    //
+    i=0;
+    aNbCE=0;
+    aNbSE=0;
+    aExp.Init(aF, TopAbs_EDGE);
+    for (; aExp.More(); aExp.Next()) {
+      aE=TopoDS::Edge(aExp.Current());
+      if(aM.Add(aE)) {
+        const GEOMAlgo_ShapeInfo& aInfoE=myMapInfo.FindFromKey(aE);
+        aKNE=aInfoE.KindOfName();
+        aKCE=aInfoE.KindOfClosed();
+        if (aKNE==GEOMAlgo_KN_CIRCLE && aKCE==GEOMAlgo_KC_CLOSED) {
+          aPC[aNbCE]=aInfoE.Location();
+          ++aNbCE;
         }
-      }
-      else if (aKSE==GEOMAlgo_KS_DEGENERATED) {
-        aIt.Initialize(aE);
-        for (; aIt.More(); aIt.Next()) {
-          aVD=TopoDS::Vertex(aIt.Value());
-          break;
+        else if (aKNE==GEOMAlgo_KN_SEGMENT) {
+          if (BRep_Tool::IsClosed(aE, aF)) {
+            ++aNbSE;
+          }
         }
-        //
-        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  :
@@ -753,6 +736,7 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
 void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
                                            const gp_Torus& )
 {
+  
   Standard_Integer aNbV, aNbE, aNbSE;
   TopoDS_Edge aE;
   TopExp_Explorer aExp;
@@ -760,42 +744,39 @@ void GEOMAlgo_ShapeInfoFiller::FillDetails(const TopoDS_Face& aF,
   GEOMAlgo_KindOfShape aKS;
   //
   GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aF);
-  aInfo.SetKindOfName(GEOMAlgo_KN_UNKNOWN);
+  aInfo.SetKindOfDef(GEOMAlgo_KD_ARBITRARY);
   //
   aKS=aInfo.KindOfShape();
   if (aKS!=GEOMAlgo_KS_TORUS) {
     return;
   }
-  //
+  
   aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
-  aNbE=aInfo.NbSubShapes(TopAbs_EDGE);
-  if (!(aNbV==1 && aNbE==2)) {
-    return;
-  }
-  //
-  aNbSE=0;
-  aExp.Init(aF, TopAbs_EDGE);
-  for (; aExp.More(); aExp.Next()) {
-    aE=TopoDS::Edge(aExp.Current());
-    if (aM.Add(aE)) {
-      if (BRep_Tool::IsClosed(aE, aF)) {
-        ++aNbSE;
+  aNbE=aInfo.NbSubShapes(TopAbs_EDGE); 
+  
+  if (aNbV==1 && aNbE==2) {
+    aNbSE=0;
+    aExp.Init(aF, TopAbs_EDGE);
+    for (; aExp.More(); aExp.Next()) {
+      aE=TopoDS::Edge(aExp.Current());
+      if (aM.Add(aE)) {
+        if (BRep_Tool::IsClosed(aE, aF)) {
+          ++aNbSE;
+        }
       }
     }
+    //
+    if (aNbSE==2) {
+      aInfo.SetKindOfDef(GEOMAlgo_KD_SPECIFIED);
+    }
   }
-  //
-  if (aNbSE!=2) {
-    return;
-  }
-  aInfo.SetKindOfName(GEOMAlgo_KN_TORUS);
 }
-//modified by NIZNHY-PKV Tue Jul 03 13:29:41 2012f
 //=======================================================================
 //function : TreatStepSphere
 //purpose  :
 //=======================================================================
-Standard_Boolean
-  GEOMAlgo_ShapeInfoFiller::TreatStepSphere(const TopoDS_Solid& aSd)
+Standard_Boolean  GEOMAlgo_ShapeInfoFiller::TreatStepSphere
+  (const TopoDS_Solid& aSd)
 {
   Standard_Boolean bRet, bIsAllowedType, bOnlyClosed, bIsEqual;
   Standard_Integer j;
@@ -906,4 +887,3 @@ Standard_Boolean IsEqual(const gp_Sphere& aSp1,
   //
   return bRet;
 }
-//modified by NIZNHY-PKV Tue Jul 03 13:29:43 2012t
index 3749b7cd718613f872926fa55a5358516eba28c4..964ea96cd98646b71abb1059fac11d921f51d63e 100644 (file)
@@ -245,7 +245,7 @@ void GEOMAlgo_ShellSolid::Perform()
     const BOPDS_IndexRange& aRange=pDS->Range(iRank);
     aRange.Indices(iBeg, iEnd);
     const TopoDS_Solid& aSolid=(!iRank) ? *((TopoDS_Solid*)&aTool) : *((TopoDS_Solid*)&aObj);
-    BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
+    //BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
     //
     //------------------------------ShellSolidBuilder
     GEOMAlgo_ShellSolidBuilder aSSB;
@@ -264,50 +264,50 @@ void GEOMAlgo_ShellSolid::Perform()
       const TopoDS_Shape& aS=pDS->Shape(i);
       aType=aS.ShapeType();
       if (aType!=TopAbs_FACE) {
-       continue;
+        continue;
       }
       //
       aState=TopAbs_UNKNOWN;
       aF=*((TopoDS_Face*)&aS);
       //
       if (!aImages.IsBound(aS)) {
-       iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
-       if (iErr) {
-         myErrorStatus=16;
-         return;
-       }
-       //
-       aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
+        iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
+        if (iErr) {
+          myErrorStatus=16;
+          return;
+        }
+        //
+        aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
       }
       else {
-       const BOPCol_ListOfShape& aLSp=aImages.Find(aS);
-       aNbSp=aLSp.Extent();
-       if (aNbSp>0) {
-         continue;
-       }
-       //
-       if (aNbSp==1) {
-         aF=*((TopoDS_Face*)&aLSp.First());
-       }
-       //
-       iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
-       if (iErr) {
-         myErrorStatus=16;
-         return;
-       }
-       //
-       aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
+        const BOPCol_ListOfShape& aLSp=aImages.Find(aS);
+        aNbSp=aLSp.Extent();
+        if (aNbSp>0) {
+          continue;
+        }
+        //
+        if (aNbSp==1) {
+          aF=*((TopoDS_Face*)&aLSp.First());
+        }
+        //
+        iErr=GEOMAlgo_AlgoTools::PntInFace(aF, aP, aP2D);
+        if (iErr) {
+          myErrorStatus=16;
+          return;
+        }
+        //
+        aState=BOPTools_AlgoTools::ComputeState(aP, aSolid, aTol, aCtx);
       }
       //----------
       if (aState==TopAbs_ON) {
-       myLSON.Append(aF);
+        myLSON.Append(aF);
       }
       else if (aState==TopAbs_OUT) {
-       myLSOUT.Append(aF);
+        myLSOUT.Append(aF);
       }
       else if (aState==TopAbs_IN) {
-       myLSIN.Append(aF);
-      }        
+        myLSIN.Append(aF);
+      } 
       //----------
     }//for (i=iBeg; i<=iEnd; ++i) {
     
old mode 100755 (executable)
new mode 100644 (file)
index 4bbcf5c..f48c5e1
@@ -301,7 +301,7 @@ void TreatCompound(const TopoDS_Shape& aC1,
   TopoDS_Iterator aItC;
   //
   aLC.Append (aC1);
-  while(1) {
+  for(;;) {
     aLC1.Clear();
     aIt.Initialize(aLC);
     for (; aIt.More(); aIt.Next()) {
index 59cfe94ad137f63e7b508a65c8176d00f1d00757..4a02ac4bef4ba6627213b463e7eadc322923edcf 100644 (file)
 //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();
@@ -147,7 +151,7 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1,
   gp_XYZ        aDP2   = aP2.XYZ().Subtracted(aLoc);
   Standard_Real aDot1  = aDP1.Dot(aDAxis);
   Standard_Real aDot2  = aDP1.Dot(aDAxis);
-  Standard_Real aTol2  = aTol*aTol;
+  //Standard_Real aTol2  = aTol*aTol;
 
   // Project P1 and P2 onto a plane with location aLoc and Norm aDAxis.
   aDP1.Subtract(aDAxis.Multiplied(aDot1));
@@ -160,7 +164,7 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1,
   if (fabs(aRadius1 - aRadius2) <= aTol) {
     // Check the deflection of the middle point.
     gp_XYZ        aMidP       = 0.5*(aDP1 + aDP2);
-    Standard_Real aMidRadius1 = aMidP.Modulus();
+    //Standard_Real aMidRadius1 = aMidP.Modulus();
 
     if (fabs(aRadius1 - aRadius2) <= aTol) {
       isOn = Standard_True;
@@ -173,7 +177,8 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsCoaxial(const gp_Pnt& aP1,
 //function : IsAnalytic
 //purpose  :
 //=======================================================================
-Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& aSurf)
+Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic
+  (const Handle(Geom_Surface)& aSurf)
 {
   Standard_Boolean bRet;
   GeomAbs_SurfaceType aType;
@@ -190,8 +195,9 @@ Standard_Boolean GEOMAlgo_SurfaceTools::IsAnalytic(const Handle(Geom_Surface)& a
 //function : IsConformState
 //purpose  :
 //=======================================================================
-Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState(const TopAbs_State aST1,
-                                                       const GEOMAlgo_State aST2)
+Standard_Boolean GEOMAlgo_SurfaceTools::IsConformState
+  (const TopAbs_State aST1,
+   const GEOMAlgo_State aST2)
 {
   Standard_Boolean bRet=Standard_False;
   //
index e10909ddca19a73d142a7305a86791d3eeadbd55..0cfe8f6aed6d58ba05089445c9f6225452d4e0a2 100644 (file)
@@ -859,7 +859,7 @@ QString GEOMBase::GetEntry( GEOM::GEOM_Object_ptr object )
 // Function : PublishSubObject
 // Purpose  : Publish sub-shape under the main object
 //================================================================
-void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object )
+void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object, const QString& name )
 {
   SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
   if ( study && !CORBA::is_nil( object ) ) {
@@ -868,9 +868,9 @@ void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object )
     GEOM::GEOM_Object_var father = object->GetMainShape();
     QString fatherEntry = GetEntry( father );
     if ( entry.isEmpty() && !CORBA::is_nil( father ) && !fatherEntry.isEmpty() ) {
-      QString name = GetName( object );
+      QString aName = !name.isEmpty() ? name : GetName( object );
       GeometryGUI::GetGeomGen()->AddInStudy( GeometryGUI::ClientStudyToStudy( studyDS ),
-                                             object, name.toLatin1().data(), father.in() );
+                                             object, aName.toLatin1().data(), father.in() );
     }
   }
 }
index 242e5fdcdfb664331744e3bd6c867436173d16f5..69e21e778a533a3639928a0cd24c86cfcc7255d3 100644 (file)
@@ -133,7 +133,7 @@ public :
   static QString      GetEntry( GEOM::GEOM_Object_ptr object );
 
   /* Publish sub-shape under the main object */
-  static void         PublishSubObject( GEOM::GEOM_Object_ptr object );
+  static void         PublishSubObject( GEOM::GEOM_Object_ptr object, const QString& name = QString() );
 
   static void         Synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right );
 };
index 211156716d5258f3f50994f9c608b09834c22584..c5e9e928f19b0d34ec243cdea90f3e10542158c0 100755 (executable)
@@ -76,12 +76,14 @@ SET(GEOMGUI_HEADERS
   GEOMGUI_Selection.h
   GEOM_GEOMGUI.hxx
   GEOMGUI_CreationInfoWdg.h
+  GEOMGUI_TextTreeWdg.h
   GEOMGUI_DimensionProperty.h
   )
 
 # header files / to be processed by moc
 SET(_moc_HEADERS 
   GEOMGUI_CreationInfoWdg.h
+  GEOMGUI_TextTreeWdg.h
   GeometryGUI.h
   )
 
@@ -114,6 +116,7 @@ SET(GEOMGUI_SOURCES
   GEOMGUI_OCCSelector.cxx
   GEOMGUI_Selection.cxx
   GEOMGUI_CreationInfoWdg.cxx
+  GEOMGUI_TextTreeWdg.cxx
   GEOMGUI_DimensionProperty.cxx
   ${_moc_SOURCES}
   ${_rcc_SOURCES}
diff --git a/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx b/src/GEOMGUI/GEOMGUI_TextTreeWdg.cxx
new file mode 100644 (file)
index 0000000..2c00a3b
--- /dev/null
@@ -0,0 +1,421 @@
+// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File      : GEOMGUI_TextTreeWdg.cxx
+// Author    : Alexander KOVALEV (akl)
+
+#include "GEOMGUI_TextTreeWdg.h"
+
+#include "GEOMGUI_DimensionProperty.h"
+#include "GeometryGUI.h"
+#include "GeometryGUI_Operations.h"
+#include <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 );
+  header()->setResizeMode( 1, QHeaderView::ResizeToContents );
+
+  QStringList rootNames;
+  rootNames << tr("GEOM_DIMENSIONS") << "";
+  myDimensionsItem = new QTreeWidgetItem( this, rootNames );
+  myDimensionsItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
+  addTopLevelItem( myDimensionsItem );
+
+  // get a free dockable window id
+  myWindowID = 11;
+  while( app->dockWindow( myWindowID ))
+    ++myWindowID;
+  ++myWindowID;
+
+  createActions();
+  setContextMenuPolicy( Qt::CustomContextMenu );
+  connect( this, SIGNAL( customContextMenuRequested(const QPoint&) ),
+          this, SLOT( showContextMenu(const QPoint&) ) );
+
+  connect( myStudy, SIGNAL( objVisibilityChanged( QString, Qtx::VisibilityState ) ), 
+          this, SLOT( updateVisibilityColumn( QString, Qtx::VisibilityState ) ) );
+  connect( app->objectBrowser(), SIGNAL( updated() ), this, SLOT( updateTree() ) );
+  GeometryGUI* aGeomGUI = dynamic_cast<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 );
+}
diff --git a/src/GEOMGUI/GEOMGUI_TextTreeWdg.h b/src/GEOMGUI/GEOMGUI_TextTreeWdg.h
new file mode 100644 (file)
index 0000000..689a21a
--- /dev/null
@@ -0,0 +1,89 @@
+// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef GEOMGUI_TEXTTREEWDG_H
+#define GEOMGUI_TEXTTREEWDG_H
+
+#include "GEOM_GEOMGUI.hxx"
+#include "GEOM_Displayer.h"
+
+#include <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
index 205e9db757d3655cfc148e5a2548d17fdeea4068..3166ac20a98e47b4ab47eb70e11be71fb4de214c 100644 (file)
@@ -1234,11 +1234,12 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
 
   QColor  aQColor       = aResMgr->colorValue  ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) );
   int     aLineWidth    = aResMgr->integerValue( "Geometry", "dimensions_line_width", 1 );
-  double  aFontHeight   = aResMgr->doubleValue ( "Geometry", "dimensions_font_height", 10 );
+  QFont   aFont         = aResMgr->fontValue   ( "Geometry", "dimensions_font", QFont("Y14.5M-2009", 14) );
   double  anArrowLength = aResMgr->doubleValue ( "Geometry", "dimensions_arrow_length", 5 );
   bool    isUnitsShown  = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false );
   QString aUnitsLength  = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" );
   QString aUnitsAngle   = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" );
+  bool    aUseText3d    = aResMgr->booleanValue( "Geometry", "dimensions_use_text3d", false );
 
   // restore dimension presentation from saved attribute or property data
   AIS_ListOfInteractive aRestoredDimensions;
@@ -1304,10 +1305,12 @@ void GEOM_Displayer::updateDimensions( const Handle(SALOME_InteractiveObject)& t
 
     aStyle->SetCommonColor( aColor );
     aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
-    aStyle->MakeText3d( Standard_True );
+    aStyle->MakeText3d( aUseText3d );
     aStyle->MakeTextShaded( Standard_True );
-    aStyle->SetExtensionSize( aFontHeight * 0.5 );
-    aStyle->TextAspect()->SetHeight( aFontHeight );
+    int fsize = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize();
+    aStyle->SetExtensionSize( fsize * 0.5 );
+    aStyle->TextAspect()->SetFont( aFont.family().toLatin1().data() );
+    aStyle->TextAspect()->SetHeight( fsize );
     aStyle->ArrowAspect()->SetLength( anArrowLength );
     aStyle->LineAspect()->SetWidth( aLineWidth );
     aStyle->SetTextHorizontalPosition( aPrs->DimensionAspect()->TextHorizontalPosition() );
index 72fb131e156fdd511135e59ee76e34c1522f6911..8c43d9c848b5c1a1e61e51499ecd733d4e44fdac 100644 (file)
@@ -431,6 +431,10 @@ Please, select face, shell or solid and try again</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>
@@ -2556,6 +2560,10 @@ Please, select face, shell or solid and try again</translation>
         <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>
@@ -2838,7 +2846,7 @@ Please, select face, shell or solid and try again</translation>
     </message>
     <message>
         <source>MEN_MEASURES</source>
-        <translation>Measures</translation>
+        <translation>Inspection</translation>
     </message>
     <message>
         <source>MEN_MIN_DIST</source>
@@ -3445,8 +3453,8 @@ Please, select face, shell or solid and try again</translation>
         <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>
@@ -3468,6 +3476,10 @@ Please, select face, shell or solid and try again</translation>
         <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>
@@ -3591,8 +3603,12 @@ Please, select face, shell or solid and try again</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>
@@ -4224,6 +4240,10 @@ Please, select face, shell or solid and try again</translation>
         <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>
@@ -5384,6 +5404,10 @@ shells and solids on the other hand.</translation>
         <source>GEOM_HEALING_STATS_COL_2</source>
         <translation>Modification</translation>
     </message>
+    <message>
+        <source>GEOM_PLOT_DISTRIBUTION</source>
+        <translation>Plot</translation>
+    </message>
 </context>
 <context>
     <name>GeometryGUI</name>
@@ -5433,7 +5457,7 @@ shells and solids on the other hand.</translation>
     </message>
     <message>
         <source>TOOL_MEASURES</source>
-        <translation>Measures</translation>
+        <translation>Inspection</translation>
     </message>
     <message>
         <source>TOOL_IMPORTEXPORT</source>
@@ -7218,6 +7242,17 @@ Do you want to create new material?</translation>
         <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>
@@ -7335,6 +7370,69 @@ Do you want to create new material?</translation>
         <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>
index 203e4d6aae3dd10b29293fbbc64dbe7be2e9ef4e..0d8d4623c3bbb62f7dd84caf99fa79a2861d1980 100644 (file)
@@ -431,6 +431,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>GEOM_FAST_CHECK_INTERSECTIONS</source>
         <translation>Intersection rapide</translation>
     </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS</source>
+        <translation type="unfinished">Shape Statistics</translation>
+    </message>
     <message>
         <source>GEOM_CIRCLE</source>
         <translation>Cercle</translation>
@@ -2556,6 +2560,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>MEN_FAST_CHECK_INTERSECTIONS</source>
         <translation>Intersection rapide</translation>
     </message>
+    <message>
+        <source>MEN_SHAPE_STATISTICS</source>
+        <translation type="unfinished">Shape Statistics</translation>
+    </message>
     <message>
         <source>MEN_CHECK_FREE_BNDS</source>
         <translation>Contrôler les contours libres</translation>
@@ -2838,7 +2846,7 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
     </message>
     <message>
         <source>MEN_MEASURES</source>
-        <translation>Mesures</translation>
+        <translation type="unfinished">Inspection</translation>
     </message>
     <message>
         <source>MEN_MIN_DIST</source>
@@ -3445,8 +3453,8 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <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 type="unfinished">Font</translation>
     </message>
     <message>
         <source>PREF_DIMENSIONS_ARROW_LENGTH</source>
@@ -3468,6 +3476,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>PREF_DIMENSIONS_SHOW_UNITS</source>
         <translation>Afficher les unités</translation>
     </message>
+    <message>
+        <source>PREF_DIMENSIONS_USE_TEXT3D</source>
+        <translation type="unfinished">Use 3D text</translation>
+    </message>
     <message>
         <source>PREF_HIDE_INPUT_OBJECT</source>
         <translation>Cacher dans la vue les objets en entrée</translation>
@@ -3592,6 +3604,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>STB_FAST_CHECK_INTERSECTIONS</source>
         <translation>Intersection rapide</translation>
     </message>
+    <message>
+        <source>STB_SHAPE_STATISTICS</source>
+        <translation type="unfinished">Shape Statistics</translation>
+    </message>
     <message>
         <source>STB_CHECK_FREE_BNDS</source>
         <translation>Vérifier les contours libres</translation>
@@ -4224,6 +4240,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
         <source>TOP_FAST_CHECK_INTERSECTIONS</source>
         <translation>Intersection rapide</translation>
     </message>
+    <message>
+        <source>TOP_SHAPE_STATISTICS</source>
+        <translation type="unfinished">Shape Statistics</translation>
+    </message>
     <message>
         <source>TOP_CHECK_FREE_BNDS</source>
         <translation>Valider les contours libres</translation>
@@ -5384,6 +5404,10 @@ le paramètre &apos;%1&apos; aux préférences du module Géométrie.</translati
         <source>GEOM_HEALING_STATS_COL_2</source>
         <translation>Modification</translation>
     </message>
+    <message>
+        <source>GEOM_PLOT_DISTRIBUTION</source>
+        <translation type="unfinished">Plot</translation>
+    </message>
 </context>
 <context>
     <name>GeometryGUI</name>
@@ -5433,7 +5457,7 @@ le paramètre &apos;%1&apos; aux préférences du module Géométrie.</translati
     </message>
     <message>
         <source>TOOL_MEASURES</source>
-        <translation>Informations</translation>
+        <translation type="unfinished">Inspection</translation>
     </message>
     <message>
         <source>TOOL_IMPORTEXPORT</source>
@@ -7218,6 +7242,17 @@ Voulez-vous en créer un nouveau ?</translation>
         <translation>(aucune information disponible)</translation>
     </message>
 </context>
+<context>
+    <name>GEOMGUI_TextTreeWdg</name>
+    <message>
+        <source>TEXT_TREE_VIEW_TITLE</source>
+        <translation type="unfinished">Text</translation>
+    </message>
+    <message>
+        <source>TEXT_TREE_VIEW_NAME</source>
+        <translation type="unfinished">Name</translation>
+    </message>
+</context>
 <context>
     <name>EntityGUI_IsolineDlg</name>
     <message>
@@ -7335,6 +7370,69 @@ Voulez-vous en créer un nouveau ?</translation>
         <translation>Objets et résultats</translation>
     </message>
 </context>
+<context>
+    <name>MeasureGUI_ShapeStatisticsDlg</name>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_TYPE</source>
+        <translation type="unfinished">Type</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_LENGTH</source>
+        <translation type="unfinished">Edges length</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_AREA</source>
+        <translation type="unfinished">Faces area</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_VOLUME</source>
+        <translation type="unfinished">Solids volume</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_NB_INTERVALS</source>
+        <translation type="unfinished">Number of intervals</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_SCALAR_RANGE</source>
+        <translation type="unfinished">Scalar range</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_COMPUTE</source>
+        <translation type="unfinished">Compute</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_MIN</source>
+        <translation type="unfinished">Min</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_MAX</source>
+        <translation type="unfinished">Max</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_CREATE_GROUPS</source>
+        <translation type="unfinished">Create Groups</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT</source>
+        <translation type="unfinished">Number of entities</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_MIN_ERROR</source>
+        <translation type="unfinished">Set minimal range value or switch-off Scalar range</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_MAX_ERROR</source>
+        <translation type="unfinished">Set maximal range value or switch-off Scalar range</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR</source>
+        <translation type="unfinished">Minimal range value can not be more than maximal</translation>
+    </message>
+    <message>
+        <source>GEOM_MSG_GROUPS_CREATED</source>
+        <translation type="unfinished">%1 groups created</translation>
+    </message>
+</context>
 <context>
     <name>TransformationGUI_ExtensionDlg</name>
     <message>
index fc01a2b0a21fe2901087aec1cf5f965f8a0f0da8..6efba76e0b9f9bb483c940df350fca65d89633bb 100644 (file)
       <source>GEOM_FAST_CHECK_INTERSECTIONS</source>
       <translation>クイック交点</translation>
     </message>
+    <message>
+      <source>GEOM_SHAPE_STATISTICS</source>
+      <translation type="unfinished">Shape Statistics</translation>
+    </message>
+    <message>
+      <source>GEOM_CHECK_SELF_INTERSECTIONS_FAILED</source>
+      <translation>自己交差の検出に失敗しました</translation>
+    </message>
+    <message>
+      <source>GEOM_NO_SELF_INTERSECTIONS</source>
+      <translation>自己交差は検出されませんでした。</translation>
+    </message>
+    <message>
+      <source>GEOM_SELF_INTERSECTIONS_FOUND</source>
+      <translation>自己交差が検出されました。</translation>
+    </message>
+    <message>
+      <source>GEOM_CHECK_SELF_INTERSECTIONS_ERRORS</source>
+      <translation>警告: 操作中にエラーがあったので、リストが不完全かもしれない</translation>
+    </message>
     <message>
       <source>GEOM_CIRCLE</source>
       <translation>Circle</translation>
       <source>MEN_FAST_CHECK_INTERSECTIONS</source>
       <translation>クイック交点</translation>
     </message>
+    <message>
+        <source>MEN_SHAPE_STATISTICS</source>
+        <translation type="unfinished">Shape Statistics</translation>
+    </message>
     <message>
       <source>MEN_CHECK_FREE_BNDS</source>
       <translation>自由境界の確認</translation>
     </message>
     <message>
       <source>MEN_MEASURES</source>
-      <translation>計測</translation>
+      <translation type="unfinished">Inspection</translation>
     </message>
     <message>
       <source>MEN_MIN_DIST</source>
       <translation>線幅</translation>
     </message>
     <message>
-      <source>PREF_DIMENSIONS_FONT_HEIGHT</source>
-      <translation>フォント高さ</translation>
+        <source>PREF_DIMENSIONS_FONT</source>
+        <translation type="unfinished">Font</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 type="unfinished">Use 3D text</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 type="unfinished">Shape Statistics</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 type="unfinished">Shape Statistics</translation>
+    </message>
     <message>
       <source>TOP_CHECK_FREE_BNDS</source>
       <translation>自由境界を確認</translation>
       <source>GEOM_HEALING_STATS_COL_2</source>
       <translation>修正</translation>
     </message>
+    <message>
+        <source>GEOM_PLOT_DISTRIBUTION</source>
+        <translation type="unfinished">Plot</translation>
+    </message>
   </context>
   <context>
     <name>GeometryGUI</name>
       <translation>(有効情報なし)</translation>
     </message>
   </context>
+  <context>
+    <name>GEOMGUI_TextTreeWdg</name>
+    <message>
+        <source>TEXT_TREE_VIEW_TITLE</source>
+        <translation type="unfinished">Text</translation>
+    </message>
+    <message>
+        <source>TEXT_TREE_VIEW_NAME</source>
+        <translation type="unfinished">Name</translation>
+    </message>
+  </context>
   <context>
     <name>EntityGUI_IsolineDlg</name>
     <message>
       <translation>オブジェクトと結果</translation>
     </message>
   </context>
+  <context>
+    <name>MeasureGUI_ShapeStatisticsDlg</name>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_TYPE</source>
+        <translation type="unfinished">Type</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_LENGTH</source>
+        <translation type="unfinished">Edges length</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_AREA</source>
+        <translation type="unfinished">Faces area</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_VOLUME</source>
+        <translation type="unfinished">Solids volume</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_NB_INTERVALS</source>
+        <translation type="unfinished">Number of intervals</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_SCALAR_RANGE</source>
+        <translation type="unfinished">Scalar range</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_COMPUTE</source>
+        <translation type="unfinished">Compute</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_MIN</source>
+        <translation type="unfinished">Min</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_MAX</source>
+        <translation type="unfinished">Max</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_CREATE_GROUPS</source>
+        <translation type="unfinished">Create Groups</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_DISTRIBUTION_NB_ENT</source>
+        <translation type="unfinished">Number of entities</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_MIN_ERROR</source>
+        <translation type="unfinished">Set minimal range value or switch-off Scalar range</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_MAX_ERROR</source>
+        <translation type="unfinished">Set maximal range value or switch-off Scalar range</translation>
+    </message>
+    <message>
+        <source>GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR</source>
+        <translation type="unfinished">Minimal range value can not be more than maximal</translation>
+    </message>
+    <message>
+        <source>GEOM_MSG_GROUPS_CREATED</source>
+        <translation type="unfinished">%1 groups created</translation>
+    </message>
+  </context>
   <context>
     <name>TransformationGUI_ExtensionDlg</name>
     <message>
index 3e61afba714451fa2154482e385347e79ba0712d..8b4f0968a95e0a8ee22d656cbb423f13a1509139 100644 (file)
@@ -33,6 +33,7 @@
 #include "GEOMGUI_OCCSelector.h"
 #include "GEOMGUI_Selection.h"
 #include "GEOMGUI_CreationInfoWdg.h"
+#include "GEOMGUI_TextTreeWdg.h"
 #include "GEOMGUI_DimensionProperty.h"
 #include "GEOM_Constants.h"
 #include "GEOM_Displayer.h"
@@ -86,6 +87,7 @@
 #include <SALOMEDS_SObject.hxx>
 
 #include <Basics_OCCTVersion.hxx>
+#include <QtxFontEdit.h>
 
 // External includes
 #include <QDir>
@@ -97,6 +99,7 @@
 #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
 
@@ -218,6 +226,7 @@ GeometryGUI::GeometryGUI() :
   myLocalSelectionMode = GEOM_ALLOBJECTS;
 
   myCreationInfoWdg = 0;
+  myTextTreeWdg = 0;
 
   connect( Material_ResourceMgr::resourceMgr(), SIGNAL( changed() ), this, SLOT( updateMaterials() ) );
 
@@ -644,6 +653,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
   case GEOMOp::OpCheckSelfInters:    // MENU MEASURE - CHECK SELF INTERSECTIONS
   case GEOMOp::OpFastCheckInters:    // MENU MEASURE - FAST CHECK INTERSECTIONS
   case GEOMOp::OpManageDimensions:   // MENU MEASURE - MANAGE DIMENSIONS
+  case GEOMOp::OpShapeStatistics:    // MENU MEASURE - SHAPE STATISTICS
   case GEOMOp::OpShowAllDimensions:  // POPUP MENU - SHOW ALL DIMENSIONS
   case GEOMOp::OpHideAllDimensions:  // POPUP MENU - HIDE ALL DIMENSIONS
     libName = "MeasureGUI";
@@ -1025,6 +1035,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpGetNonBlocks,     "GET_NON_BLOCKS" );
   createGeomAction( GEOMOp::OpCheckSelfInters,  "CHECK_SELF_INTERSECTIONS" );
   createGeomAction( GEOMOp::OpFastCheckInters,  "FAST_CHECK_INTERSECTIONS" );
+  createGeomAction( GEOMOp::OpShapeStatistics,  "SHAPE_STATISTICS" );
 
 #ifdef _DEBUG_ // PAL16821
   createGeomAction( GEOMOp::OpCheckGeom,        "CHECK_GEOMETRY" );
@@ -1288,6 +1299,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpCheckSelfInters, measurId, -1 );
   createMenu( GEOMOp::OpFastCheckInters, measurId, -1 );
   createMenu( GEOMOp::OpInspectObj,      measurId, -1 );
+  createMenu( GEOMOp::OpShapeStatistics, measurId, -1 );
 
   int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
 #if defined(_DEBUG_) || defined(_DEBUG) // PAL16821
@@ -1780,6 +1792,11 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
   getApp()->insertDockWindow( myCreationInfoWdg->getWinID(), myCreationInfoWdg );
   getApp()->placeDockWindow( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
 
+  if ( !myTextTreeWdg )
+    myTextTreeWdg = new GEOMGUI_TextTreeWdg( getApp() );
+  getApp()->insertDockWindow( myTextTreeWdg->getWinID(), myTextTreeWdg );
+  getApp()->placeDockWindow( myTextTreeWdg->getWinID(), Qt::LeftDockWidgetArea );
+
   //NPAL 19674
   SALOME_ListIO selected;
   sm->selectedObjects( selected );
@@ -1841,8 +1858,15 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study )
 
   disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateCreationInfo() ));
   disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateFieldColorScale() ));
-  getApp()->removeDockWindow( myCreationInfoWdg->getWinID() );
-  myCreationInfoWdg = 0;
+  if ( myCreationInfoWdg ) {
+    getApp()->removeDockWindow( myCreationInfoWdg->getWinID() );
+    myCreationInfoWdg = 0;
+  }
+  if ( myTextTreeWdg ) {
+    getApp()->removeDockWindow( myTextTreeWdg->getWinID() );
+    disconnect( application(), 0, myTextTreeWdg, 0 );
+    myTextTreeWdg = 0;
+  }
 
   EmitSignalCloseAllDialogs();
 
@@ -1900,6 +1924,8 @@ void GeometryGUI::windows( QMap<int, int>& mappa ) const
   mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
   if ( myCreationInfoWdg )
     mappa.insert( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
+  if ( myTextTreeWdg )
+    mappa.insert( myTextTreeWdg->getWinID(), Qt::LeftDockWidgetArea );
 }
 
 void GeometryGUI::viewManagers( QStringList& lst ) const
@@ -2211,6 +2237,8 @@ void GeometryGUI::OnSetMaterial(const QString& theName)
 
 void GeometryGUI::createPreferences()
 {
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+
   int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
 
   int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
@@ -2307,12 +2335,36 @@ void GeometryGUI::createPreferences()
   setPreferenceProperty( aDimLineWidthId, "min", 1 );
   setPreferenceProperty( aDimLineWidthId, "max", 5 );
 
-  int aDimFontHeightId = addPreference( tr( "PREF_DIMENSIONS_FONT_HEIGHT" ), aDimGroupId,
-                                        LightApp_Preferences::DblSpin, "Geometry", "dimensions_font_height" );
-
-  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" );
@@ -2327,9 +2379,6 @@ void GeometryGUI::createPreferences()
   int anAngUnitsId = addPreference( tr( "PREF_DIMENSIONS_ANGLE_UNITS" ), aDimGroupId,
                                    LightApp_Preferences::Selector, "Geometry", "dimensions_angle_units" );
 
-  addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId,
-                 LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" );
-
   QStringList aListOfLengthUnits;
   aListOfLengthUnits << "m";
   aListOfLengthUnits << "cm";
@@ -2344,6 +2393,9 @@ void GeometryGUI::createPreferences()
   setPreferenceProperty( aLengthUnitsId, "strings", aListOfLengthUnits );
   setPreferenceProperty( anAngUnitsId,   "strings", aListOfAngUnits );
 
+  addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId,
+                 LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" );
+
   int aDimDefFlyout = addPreference( tr( "PREF_DIMENSIONS_DEFAULT_FLYOUT" ), aDimGroupId,
                                      LightApp_Preferences::DblSpin, "Geometry", "dimensions_default_flyout" );
 
@@ -2351,6 +2403,9 @@ void GeometryGUI::createPreferences()
   setPreferenceProperty( aDimDefFlyout, "max", 1e+9 );
   setPreferenceProperty( aDimDefFlyout, "precision", 9 );
 
+  addPreference( tr( "PREF_DIMENSIONS_USE_TEXT3D" ), aDimGroupId,
+                 LightApp_Preferences::Bool, "Geometry", "dimensions_use_text3d" );
+
   int isoGroup = addPreference( tr( "PREF_ISOS" ), tabId );
   setPreferenceProperty( isoGroup, "columns", 2 );
   int isoU = addPreference( tr( "PREF_ISOS_U" ), isoGroup,
@@ -2457,7 +2512,6 @@ void GeometryGUI::createPreferences()
   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 ) ) );
@@ -2619,11 +2673,12 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par
     }
     else if ( param == QString("dimensions_color")        ||
               param == QString("dimensions_line_width")   ||
-              param == QString("dimensions_font_height")  ||
+              param == QString("dimensions_font")         ||
               param == QString("dimensions_arrow_length") ||
               param == QString("dimensions_show_units")   ||
               param == QString("dimensions_length_units") ||
               param == QString("dimensions_angle_units")  ||
+              param == QString("dimensions_use_text3d")  ||
               param == QString("label_color") )
     {
       SalomeApp_Application* anApp = getApp();
@@ -3442,3 +3497,8 @@ void GeometryGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* wher
   // update Object browser
   getApp()->updateObjectBrowser( false );
 }
+
+void GeometryGUI::emitDimensionsUpdated( QString entry )
+{
+  emit DimensionsUpdated( entry );
+}
index 53d314ed127faf41f8ec5e36d1bfedf9fb8b0ef1..f0abf2da2244d5ba81cfdd3985a19d45769d5dbb 100644 (file)
@@ -64,6 +64,7 @@ class LightApp_Selection;
 class SUIT_ViewManager;
 class SalomeApp_Study;
 class GEOMGUI_CreationInfoWdg;
+class GEOMGUI_TextTreeWdg;
 
 //=================================================================================
 // class    : GeometryGUI
@@ -148,6 +149,8 @@ public:
                                            SUIT_DataObject* where,
                                            const int row, Qt::DropAction action );
 
+  void                        emitDimensionsUpdated( QString entry );
+
 public slots:
   virtual bool                deactivateModule( SUIT_Study* );
   virtual bool                activateModule( SUIT_Study* );
@@ -176,6 +179,7 @@ signals :
   void                        SignalDefaultStepValueChanged( double newVal );
   void                        SignalDependencyTreeParamChanged( const QString&, const QString& );
   void                        SignalDependencyTreeRenameObject( const QString& );
+  void                        DimensionsUpdated( const QString& );
 
 protected:
   virtual LightApp_Selection* createSelection() const;
@@ -224,6 +228,8 @@ private:
 
   GEOMGUI_CreationInfoWdg*    myCreationInfoWdg;
   
+  GEOMGUI_TextTreeWdg*       myTextTreeWdg;
+  
   SALOME_ListIO               myTopLevelIOList;               
 
   friend class DisplayGUI;
index 915f5d1f18bc026eb1e0d0bf7bda802b641ed792..865ac91d9a171aa5a93fb7cc0e08ecdc30db11b1 100644 (file)
@@ -200,6 +200,7 @@ namespace GEOMOp {
     OpHideAllDimensions   = 5016,   // POPUP MENU - HIDE ALL DIMENSIONS
     OpFastCheckInters     = 5017,   // MENU MEASURES - FAST CHECK INTERSECTIONS
     OpInspectObj         = 5018,   // MENU MEASURES - INSPECT OBJECT
+    OpShapeStatistics    = 5019,   // MENU MEASURES - SHAPE STATISTICS
     // GroupGUI --------------------//--------------------------------
     OpGroupCreate         = 6000,   // MENU GROUP - CREATE
     OpGroupEdit           = 6001,   // MENU GROUP - EDIT
index 4bc9a6700fc6e6c6d5cb84cae55e809b9e14acef..82654f21ffac3deb4c03f9f51498cf7a23eb7a67 100644 (file)
@@ -1116,7 +1116,7 @@ Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientationCopy (Handle(G
     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
index 5d89b0c0ac6630c535678e5ad0a9ea6f2902de25..0373f9b0553ad4209ef62ccd87e2a348d783efa0 100644 (file)
@@ -218,7 +218,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateTwoPointsCopy
   if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
 
   //Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   //Add a translate function
   Handle(GEOM_Function) aFunction =
@@ -271,7 +271,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateDXDYDZCopy
   if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
 
   //Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   //Add a translate function
   Handle(GEOM_Function) aFunction =
@@ -376,7 +376,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TranslateVectorCopy
   if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be moved
 
   //Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   //Add a translate function
   Handle(GEOM_Function) aFunction =
@@ -807,7 +807,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPlaneCopy
   if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
 
   //Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   //Add a mirror function
   Handle(GEOM_Function) aFunction =
@@ -910,7 +910,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorPointCopy
   if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
 
   //Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   //Add a mirror function
   Handle(GEOM_Function) aFunction =
@@ -1013,7 +1013,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy
   if (aLastFunction.IsNull()) return NULL; //There is no function which creates an object to be mirrored
 
   //Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   //Add a mirror function
   Handle(GEOM_Function) aFunction =
@@ -1114,7 +1114,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
   if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be offset
 
   //Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   //Add a new Offset function
   Handle(GEOM_Function) aFunction =
@@ -1364,7 +1364,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::ScaleShapeCopy
   if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be scaled
 
   //Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   //Add a scale function
   Handle(GEOM_Function) aFunction =
@@ -1555,7 +1555,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
   if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
 
   //Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   //Add a position function
   Standard_Integer aType = POSITION_SHAPE_COPY;
@@ -1734,7 +1734,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateCopy (Handle(GEOM_Objec
   if (aLastFunction.IsNull()) return NULL;  //There is no function which creates an object to be rotated
 
   //Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   //Add a rotate function
   aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_COPY);
@@ -2088,7 +2088,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::RotateThreePointsCopy (Handle
   if (aLastFunction.IsNull()) return NULL;  //There is no function which creates an object to be rotated
 
   //Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   //Add a rotate function
   aFunction = aCopy->AddFunction(GEOMImpl_RotateDriver::GetID(), ROTATE_THREE_POINTS_COPY);
@@ -2145,7 +2145,7 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::TransformLikeOtherCopy
   if (aSampleFunc.IsNull()) return NULL; // There is no function which creates a sample object
 
   // Add a new Copy object
-  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
+  Handle(GEOM_Object) aCopy = GetEngine()->AddObject(GetDocID(), GEOM_COPY);
 
   // Add a transform function (depends on theSample function)
   Handle(GEOM_Function) aFunction =
index 039990ab77c4edf7b699ebf53f3a1ee0c148acee..a2bbfd9d00d295b8c7514cf029876560656a52f5 100755 (executable)
@@ -53,6 +53,7 @@ SET(GEOMUtils_HEADERS
   GEOMUtils.hxx
   GEOMUtils_Hatcher.hxx
   GEOMUtils_HTrsfCurve2d.hxx
+  GEOMUtils_ShapeStatistics.hxx
   GEOMUtils_Trsf2d.hxx
   GEOMUtils_TrsfCurve2d.hxx
   GEOMUtils_XmlHandler.hxx
@@ -63,6 +64,7 @@ SET(GEOMUtils_SOURCES
   GEOMUtils.cxx
   GEOMUtils_Hatcher.cxx
   GEOMUtils_HTrsfCurve2d.cxx
+  GEOMUtils_ShapeStatistics.cxx
   GEOMUtils_Trsf2d.cxx
   GEOMUtils_TrsfCurve2d.cxx
   GEOMUtils_XmlHandler.cxx
diff --git a/src/GEOMUtils/GEOMUtils_ShapeStatistics.cxx b/src/GEOMUtils/GEOMUtils_ShapeStatistics.cxx
new file mode 100644 (file)
index 0000000..4ef3b86
--- /dev/null
@@ -0,0 +1,147 @@
+// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File   : GEOMUtils_ShapeStatisticsDlg.cxx
+// Author : Alexander KOVALEV, OPEN CASCADE S.A.S.
+
+#include "GEOMUtils_ShapeStatistics.hxx"
+
+#include <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
diff --git a/src/GEOMUtils/GEOMUtils_ShapeStatistics.hxx b/src/GEOMUtils/GEOMUtils_ShapeStatistics.hxx
new file mode 100644 (file)
index 0000000..703050e
--- /dev/null
@@ -0,0 +1,61 @@
+// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File   : GEOMUtils_ShapeStatisticsDlg.hxx
+// Author : Alexander KOVALEV, OPEN CASCADE S.A.S.
+
+#ifndef _GEOMUtils_ShapeStatistics_HXX_
+#define _GEOMUtils_ShapeStatistics_HXX_
+
+#include <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_
index acf593702c81fbebe5b6adecd7cfee965a6d5ab8..73e18271bbad8586b320fa1d3d9df1ec762b64f8 100755 (executable)
@@ -39,6 +39,7 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/GEOMImpl
   ${PROJECT_SOURCE_DIR}/src/GEOMGUI
   ${PROJECT_SOURCE_DIR}/src/GEOMBase
+  ${PROJECT_SOURCE_DIR}/src/MeasureGUI
   ${PROJECT_SOURCE_DIR}/src/DlgRef
   ${PROJECT_BINARY_DIR}/src/DlgRef
   ${CMAKE_CURRENT_SOURCE_DIR}
@@ -56,6 +57,7 @@ ADD_DEFINITIONS(
 SET(_link_LIBRARIES
   GEOMBase
   GEOMUtils
+  MeasureGUI
   )
 
 # --- resources ---
index 68b6314b1ce93b2cb29ad882df7fa9e2e9a6415d..a13236cd2930b0302f53b54b43efcc2dedb175c9 100644 (file)
@@ -31,6 +31,7 @@
 #include <GeometryGUI.h>
 #include <GEOM_Displayer.h>
 #include <GEOMUtils.hxx>
+#include <MeasureGUI_ShapeStatisticsDlg.h>
 
 #include <SalomeApp_Application.h>
 #include <SalomeApp_Study.h>
@@ -200,6 +201,7 @@ GroupGUI_GroupDlg::GroupGUI_GroupDlg (Mode mode, GeometryGUI* theGeometryGUI, QW
   myLessFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
   myGreaterFilterSpin = new SalomeApp_DoubleSpinBox(myFilterGrp);
   myApplyFilterButton = new QPushButton(tr("GEOM_BUT_APPLY"), myFilterGrp);
+  myPlotDistributionButton = new QPushButton(tr("GEOM_PLOT_DISTRIBUTION"), myFilterGrp);
 
   QGridLayout* filterLayout = new QGridLayout(myFilterGrp);
   filterLayout->addWidget(myLessFilterCheck,    0, 0);
@@ -209,6 +211,7 @@ GroupGUI_GroupDlg::GroupGUI_GroupDlg (Mode mode, GeometryGUI* theGeometryGUI, QW
   filterLayout->addWidget(myGreaterFilterCombo, 1, 1);
   filterLayout->addWidget(myGreaterFilterSpin,  1, 2);
   filterLayout->addWidget(myApplyFilterButton,  0, 3);
+  filterLayout->addWidget(myPlotDistributionButton,  1, 3);
 
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
   layout->setMargin(0); layout->setSpacing(6);
@@ -326,6 +329,7 @@ void GroupGUI_GroupDlg::Init()
   connect(myIdList,        SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged()));
 
   connect(myApplyFilterButton, SIGNAL(clicked()),         this, SLOT(ClickOnOkFilter()));
+  connect(myPlotDistributionButton, SIGNAL(clicked()),    this, SLOT(ClickOnPlot()));
   connect(myLessFilterCheck,   SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
   connect(myGreaterFilterCheck,   SIGNAL(stateChanged(int)), this, SLOT(MeasureToggled()));
 
@@ -1149,6 +1153,16 @@ void GroupGUI_GroupDlg::updateState (bool isAdd)
                           subSelectionWay() == ALL_SUBSHAPES &&
                           myIsShapeType &&
                           getShapeType() != TopAbs_VERTEX);
+  // manage of 'Plot' button access
+  GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
+  GEOM::ListOfLong_var aSubShapes = aShOp->SubShapeAllIDs( myMainObj, getShapeType(), false );
+  bool hasCurrentEntities = aSubShapes->length() > 0;
+  myPlotDistributionButton->setEnabled( myFilterGrp->isEnabled() &&
+                                       myIsShapeType &&
+                                       ( getShapeType() == TopAbs_EDGE || 
+                                         getShapeType() == TopAbs_FACE ||
+                                         getShapeType() == TopAbs_SOLID ) &&
+                                       hasCurrentEntities );
   if (subSelectionWay() == ALL_SUBSHAPES)
     setInPlaceObj(GEOM::GEOM_Object::_nil());
 }
@@ -1437,6 +1451,19 @@ void GroupGUI_GroupDlg::ClickOnOkFilter()
   updateState(true);
 }
 
+//=================================================================================
+// 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();
+  }
+}
+
 void GroupGUI_GroupDlg::MeasureToggled()
 {
   myLessFilterSpin->setEnabled(myLessFilterCheck->isChecked());
index ad8f4e1598b804debb903745d9184ebf7f1cdf5d..231ea033a1264c08b301a4026562a37be0dcf431 100644 (file)
@@ -83,6 +83,7 @@ private slots:
   void                                showOnlySelected();
   void                                selectionChanged();
   void                                ClickOnOkFilter();
+  void                                ClickOnPlot();
   void                                MeasureToggled();
 
 private:
@@ -133,6 +134,7 @@ private:
   SalomeApp_DoubleSpinBox*            myLessFilterSpin;
   SalomeApp_DoubleSpinBox*            myGreaterFilterSpin;
   QPushButton*                        myApplyFilterButton;
+  QPushButton*                        myPlotDistributionButton;
   QGroupBox*                          myFilterGrp;
 };
 
index c7ab327c1b6a1106bb32adfa9ae8b73f46cc047c..31e2375ac37d2966fd994cc29f866057d0fb322b 100755 (executable)
@@ -129,6 +129,7 @@ SET(_moc_HEADERS
   MeasureGUI_ManageDimensionsDlg.h
   MeasureGUI_CreateDimensionDlg.h
   MeasureGUI_DimensionInteractor.h
+  MeasureGUI_ShapeStatisticsDlg.h
   )
 
 # header files / uic wrappings
@@ -163,6 +164,7 @@ SET(MeasureGUI_SOURCES
   MeasureGUI_DimensionCreateTool.cxx
   MeasureGUI_DimensionInteractor.cxx
   MeasureGUI_DimensionFilter.cxx
+  MeasureGUI_ShapeStatisticsDlg.cxx
   ${_moc_SOURCES}
   ${_uic_files}
   )
index 37c8ed4b22d5b03ed74dec05fd373ec70be0c2af..1ab692d327486ec5eecd1a5e77f45a46714649b4 100644 (file)
@@ -53,6 +53,7 @@
 #include "MeasureGUI_FastCheckIntersectionsDlg.h" // Method FAST CHECK INTERSCTIONS
 #include "MeasureGUI_PointDlg.h"                  // Method POINTCOORDINATES
 #include "MeasureGUI_ManageDimensionsDlg.h"       // Method MANAGEDIMENSIONS
+#include "MeasureGUI_ShapeStatisticsDlg.h"        // Method SHAPE STATISTICS
 
 #include <QApplication>
 
@@ -129,6 +130,9 @@ bool MeasureGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
   case GEOMOp::OpFastCheckInters:
     dlg = new MeasureGUI_FastCheckIntersectionsDlg( getGeometryGUI(), parent );
     break; // FAST CHECK INTERSCTIONS
+  case GEOMOp::OpShapeStatistics:
+    dlg = new MeasureGUI_ShapeStatisticsDlg( parent );
+    break; // FAST CHECK INTERSCTIONS
   case GEOMOp::OpPointCoordinates:
     dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
     break; // POINT COORDINATES
index 2576676b22cbebdb342cbe54df4fb91ea203afbc..45ef0135f56583e60dd216e26ed812e43a135322 100644 (file)
@@ -495,12 +495,13 @@ Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension()
 
   QColor  aQColor       = aResMgr->colorValue  ( "Geometry", "dimensions_color", QColor( 0, 255, 0 ) );
   int     aLineWidth    = aResMgr->integerValue( "Geometry", "dimensions_line_width", 1 );
-  double  aFontHeight   = aResMgr->doubleValue ( "Geometry", "dimensions_font_height", 10 );
+  QFont   aFont         = aResMgr->fontValue   ( "Geometry", "dimensions_font", QFont("Y14.5M-2009", 14) );
   double  anArrowLength = aResMgr->doubleValue ( "Geometry", "dimensions_arrow_length", 5 );
   double  aDefFlyout    = aResMgr->doubleValue ( "Geometry", "dimensions_default_flyout", 20 );
   bool    isUnitsShown  = aResMgr->booleanValue( "Geometry", "dimensions_show_units", false );
   QString aUnitsLength  = aResMgr->stringValue ( "Geometry", "dimensions_length_units", "m" );
   QString aUnitsAngle   = aResMgr->stringValue ( "Geometry", "dimensions_angle_units", "deg" );
+  bool    aUseText3d    = aResMgr->booleanValue( "Geometry", "dimensions_use_text3d", false );
 
   OCCViewer_ViewWindow* anActiveView = NULL;
 
@@ -610,10 +611,12 @@ Handle(AIS_Dimension) MeasureGUI_CreateDimensionDlg::CreateDimension()
 
   aStyle->SetCommonColor( aColor );
   aStyle->MakeUnitsDisplayed( (Standard_Boolean) isUnitsShown );
-  aStyle->MakeText3d( Standard_True );
+  aStyle->MakeText3d( aUseText3d );
   aStyle->MakeTextShaded( Standard_True );
-  aStyle->SetExtensionSize( aFontHeight * 0.5 );
-  aStyle->TextAspect()->SetHeight( aFontHeight );
+  int fsize = aFont.pixelSize() != -1 ? aFont.pixelSize() : aFont.pointSize();
+  aStyle->SetExtensionSize( fsize * 0.5 );
+  aStyle->TextAspect()->SetFont( aFont.family().toLatin1().data() );
+  aStyle->TextAspect()->SetHeight( fsize );
   aStyle->ArrowAspect()->SetLength( anArrowLength );
   aStyle->LineAspect()->SetWidth( aLineWidth );
 
index b8954462a47086e2b200fc517793492fd24865f1..4618f9c808b1dce56a0985731f035d63b5020862 100644 (file)
@@ -29,6 +29,7 @@
 #include "MeasureGUI_DimensionFilter.h"
 
 #include <GEOMGUI_DimensionProperty.h>
+#include <GEOMGUI_TextTreeWdg.h>
 #include <GEOMUtils.hxx>
 #include <GEOMGUI_OCCSelector.h>
 #include <GEOM_AISDimension.hxx>
@@ -771,6 +772,8 @@ bool MeasureGUI_ManageDimensionsDlg::ClickOnApply()
 
   mySavedPropertyState.SaveToAttribute( aStudy, myEditObject->GetStudyEntry() );
 
+  myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
+
   return true;
 }
 
@@ -805,9 +808,12 @@ void MeasureGUI_ManageDimensionsDlg::OnFinish()
                              myEditObject->GetStudyEntry(),
                              GEOM::propertyName( GEOM::Dimensions ),
                              QVariant() );
+
   if ( myIsNeedRedisplay ) {
-    redisplay( myEditObject.get());
+    redisplay( myEditObject.get() );
   }
+  
+  myGeomGUI->emitDimensionsUpdated( QString( myEditObject->GetStudyEntry() ) );
 }
 
 //=================================================================================
diff --git a/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.cxx b/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.cxx
new file mode 100644 (file)
index 0000000..9387cf4
--- /dev/null
@@ -0,0 +1,533 @@
+// Copyright (C) 2015  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+// File   : MeasureGUI_ShapeStatisticsDlg.cxx
+// Author : Alexander KOVALEV, OPEN CASCADE S.A.S.
+
+// internal includes
+#include "MeasureGUI_ShapeStatisticsDlg.h"
+
+// GEOM includes
+#include <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 )
+      hasEdges = aShOp->NumberOfSubShapes( aShapePtr.get(), TopAbs_FACE ) > 0;
+    if ( hasSolids != 0 )
+      hasEdges = aShOp->NumberOfSubShapes( aShapePtr.get(), TopAbs_SOLID ) > 0;
+  }
+  fillTypes( hasEdges, hasFaces, hasSolids );
+}
+
+//=================================================================================
+// function : currentType()
+// purpose  : returns currently selected type of shapes in 'Type' combobox
+//=================================================================================
+TopAbs_ShapeEnum MeasureGUI_ShapeStatisticsDlg::currentType()
+{
+  return (TopAbs_ShapeEnum)( myCBTypes->itemData( myCBTypes->currentIndex() ).toInt() );
+}
+
+//=================================================================================
+// function : clickOnPlot()
+// purpose  : called when Plot button was clicked
+//=================================================================================
+bool MeasureGUI_ShapeStatisticsDlg::isValid(QString& theMessage)
+{
+  if ( myScalarRangeBox->isChecked() ) {
+    RETURN_WITH_MSG( !myMin->text().isEmpty(), tr("GEOM_SHAPE_STATISTICS_MIN_ERROR") )
+    RETURN_WITH_MSG( !myMax->text().isEmpty(), tr("GEOM_SHAPE_STATISTICS_MAX_ERROR") )
+    RETURN_WITH_MSG( myMin->text().toDouble() <= myMax->text().toDouble(), tr("GEOM_SHAPE_STATISTICS_MIN_MAX_ERROR") )
+  }
+  return true;
+}
+//=================================================================================
+// function : clickOnPlot()
+// purpose  : called when Plot button was clicked
+//=================================================================================
+void MeasureGUI_ShapeStatisticsDlg::clickOnPlot()
+{
+  GEOMUtils::Range aRange;
+  if ( myScalarRangeBox->isChecked() ) {
+    QString msg;
+    if ( !isValid( msg ) ) {
+      showError( msg );
+      return;
+    }
+    aRange.min = myMin->text().toDouble();
+    aRange.max = myMax->text().toDouble();
+  } else {
+    aRange.min = -1.0; // flag that range is empty
+    aRange.max = -1.0; // flag that range is empty
+  }
+
+  GEOMUtils::Distribution aShapesDistr = 
+    GEOMUtils::ComputeDistribution( myShapes, currentType(), myNbIntervals->value(), aRange );
+
+  QList<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" );
+}
diff --git a/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.h b/src/MeasureGUI/MeasureGUI_ShapeStatisticsDlg.h
new file mode 100644 (file)
index 0000000..8013132
--- /dev/null
@@ -0,0 +1,92 @@
+// 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"
+
+// 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_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