]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
debug split polylines, improvement on SPLINE, but it would be preferable to keep...
authorPaul RASCLE <paul.rascle@edf.fr>
Sat, 18 Jun 2016 14:32:43 +0000 (16:32 +0200)
committerPaul RASCLE <paul.rascle@edf.fr>
Sat, 18 Jun 2016 14:32:43 +0000 (16:32 +0200)
src/HYDROData/HYDROData_PolylineOperator.cxx
src/HYDROData/HYDROData_PolylineOperator.h
src/HYDROData/HYDROData_PolylineXY.cxx
src/HYDROData/HYDROData_PolylineXY.h
src/HYDROData/HYDROData_TopoCurve.cxx
src/HYDROData/HYDROData_TopoCurve.h
src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx
src/HYDROGUI/HYDROGUI_RecognizeContoursOp.cxx

index 5dfa0411ecd7ba3344e02c71b44315da6656bf9f..947de75126b262b8c489d02e56ca53c365e30980 100644 (file)
@@ -225,12 +225,12 @@ bool HYDROData_PolylineOperator::split( const Handle( HYDROData_Document )& theD
       aSplitCurves.end();
     for (int iw=0; aCIt != aLastCIt; ++aCIt, iw++)
     {
-        std::stringstream brepName;
-        brepName << "theSplitWire_";
-        brepName << iw;
-        brepName << ".brep";
-        BRepTools::Write(aCIt->Wire() , brepName.str().c_str() );
-     aResult.push_back(aCIt->Wire());
+      std::stringstream brepName;
+      brepName << "theSplitWire_";
+      brepName << iw;
+      brepName << ".brep";
+      BRepTools::Write(aCIt->Wire() , brepName.str().c_str() );
+      aResult.push_back(aCIt->Wire());
     }
   }
 
@@ -353,7 +353,7 @@ bool HYDROData_PolylineOperator::CreatePolylines( const Handle( HYDROData_Docume
     if( aPolyline.IsNull() )
       return false;
 
-    aPolyline->ImportShape(theShapes[i], false);
+    aPolyline->ImportShape(theShapes[i], false, false);
     //aPolyline->SetShape( theShapes[i] );
 
 
index a710e72ad9628c866ee2254cbfeaf4d1754cd1cf..ed1716c00bd342195a819fe13a08d3b9e3550a2c 100644 (file)
@@ -59,7 +59,7 @@ public:
   //! the middle deflection is more than the required deflection and
   //! more than the half of the maximal middle deflection.
   //! Returns the initial maximal middle deflection.
-  //! Returns a negative value in the case of any erorr.
+  //! Returns a negative value in the case of any error.
   static double ReduceDeflection(
     const double theDeflection,
     HYDROData_TopoCurve& theCurve,
index 0acdacdf811e897b7714fcc372055939a6687142..20629aa0d3505300b9d2ea50f274bb3e98b7982d 100644 (file)
@@ -237,7 +237,7 @@ bool HYDROData_PolylineXY::ImportFromGeomIOR( const TCollection_AsciiString& the
   if ( aShape.IsNull() )
     return false;
 
-  return ImportShape( aShape );
+  return ImportShape( aShape, false );
 #endif
 }
 
@@ -363,6 +363,7 @@ bool convertEdgesToSections( const TopoDS_Edge&
     }
 
   bool anIsEdgeClosed = anEdgeGeomCurve->IsClosed();
+  anIsEdgeClosed &= IsCanBeClosed; // on split, resulting edges are normally not closed...
   HYDROData_PolylineXY::SectionType aSectionType ;
   if( anEdgeGeomCurve->IsKind( STANDARD_TYPE(Geom_Line) ) )
     {
@@ -482,6 +483,7 @@ bool convertEdgesToSections( const TopoDS_Edge&
 
 bool HYDROData_PolylineXY::ImportShape( const TopoDS_Shape& theShape,
                                         bool IsInterpolationAllowed,
+                                        bool IsClosureAllowed,
                                         double theDeviation )
 {
   DEBTRACE("ImportShape");
@@ -501,8 +503,10 @@ bool HYDROData_PolylineXY::ImportShape( const TopoDS_Shape& theShape,
   {
       DEBTRACE("TopAbs_EDGE");
     TopoDS_Edge anEdge = TopoDS::Edge( theShape );
-    anIsCanBeImported = convertEdgeToSection( anEdge, aSectNames, aSectTypes,
-      aSectClosures, aSectPoints, true, IsInterpolationAllowed, theDeviation );
+//    anIsCanBeImported = convertEdgeToSection( anEdge, aSectNames, aSectTypes,
+//      aSectClosures, aSectPoints, true, IsInterpolationAllowed, theDeviation );
+    anIsCanBeImported = convertEdgesToSections( anEdge, aSectNames, aSectTypes,
+      aSectClosures, aSectPoints, IsClosureAllowed, IsInterpolationAllowed, theDeviation );
   }
   else if ( theShape.ShapeType() == TopAbs_WIRE )
   {
@@ -515,7 +519,7 @@ bool HYDROData_PolylineXY::ImportShape( const TopoDS_Shape& theShape,
     {
       TopoDS_Edge aWireEdge = TopoDS::Edge( anEdges.Value( i ) );
       anIsCanBeImported = convertEdgesToSections( aWireEdge, aSectNames, aSectTypes,
-        aSectClosures, aSectPoints, false, IsInterpolationAllowed, theDeviation );
+        aSectClosures, aSectPoints, IsClosureAllowed, IsInterpolationAllowed, theDeviation );
     }
   }
 
index aa6ab4a27e251c9b3cc421b0a44b9b8a84747748..39d01e72e75fe29b78fa6b4f2cfe9bd7e7e3bc7d 100644 (file)
@@ -30,7 +30,7 @@ class gp_XYZ;
 class gp_Pnt;
 
 /**\class HYDROData_PolylineXY
- * \brief Class that stores/retreives information about the 
+ * \brief Class that stores/retrieves information about the
  *        parametric profile points.
  */
 class HYDROData_PolylineXY : public HYDROData_IPolyline
@@ -69,13 +69,13 @@ public:
   HYDRODATA_EXPORT virtual void UpdateLocalCS( double theDx, double theDy );
 
   /**
-   * Checks that object has 2D presentation. Reimlemented to retun true.
+   * Checks that object has 2D presentation. Re-implemented to return true.
    */
   HYDRODATA_EXPORT virtual bool IsHas2dPrs() const;
 
   /**
    * Returns data of object wrapped to QVariant.
-   * Reimplemented to wrap and return saved path.
+   * Re-implemented to wrap and return saved path.
    */
   HYDRODATA_EXPORT virtual QVariant GetDataVariant();
 
@@ -91,14 +91,14 @@ public:
 public:
 
   /**
-   * Returns the presentation of polyline section in CAS maner.
+   * Returns the presentation of polyline section in CAS manner.
    */
   HYDRODATA_EXPORT static TopoDS_Wire BuildWire( const SectionType&                  theType,
                                                  const bool&                         theIsClosed,
                                                  const NCollection_Sequence<gp_XYZ>& thePoints );
 
   /**
-   * Returns the presentation of polyline section in Qt maner.
+   * Returns the presentation of polyline section in Qt manner.
    */
   HYDRODATA_EXPORT static void BuildPainterPath( QPainterPath&                       thePath,
                                                  const SectionType&                  theType,
@@ -131,8 +131,9 @@ public:
    * Returns the 3D presentation of all points.
    */
   HYDRODATA_EXPORT virtual bool ImportShape( const TopoDS_Shape& theShape,
-                                             bool IsInterpolationAllowed = false,
-                                             double theDeviation = 1E-3 );
+                                             bool IsInterpolationAllowed,
+                                             bool IsClosureAllowed = true,
+                                             double theDeviation = 1.);
 
   /**
    * Returns flag indicating that polyline can be edited or not.
index fce5201ade18cb254d39d20b916ff6314e49da0f..540dd8b08489e2a9f8d35f4c41d0270bcf9e30be 100644 (file)
@@ -367,7 +367,7 @@ static bool Interpolate(
 
 bool HYDROData_TopoCurve::Initialize(const TopoDS_Wire& theWire)
 {
-  // Check for nonemptiness.
+  // Check for non-emptiness.
   myEdges.clear();
   TopTools_IndexedDataMapOfShapeListOfShape aVertexToEdges;
   TopExp::MapShapesAndAncestors(theWire,
index a1db81e7e7178443fef11af8cee9d014cd6704de..bb187c0ebdfb95f92612128c6d16e859266ce763 100644 (file)
@@ -35,7 +35,7 @@ class TopoDS_Wire;
 //                           const Adaptor3d_Curve& theCurve,
 //                           double& theParameter);
 
-//! The type represents a 1 monifold connected topo curve
+//! The type represents a 1 manifold connected topo curve
 //! with forward orientation.
 class HYDROData_TopoCurve
 {
@@ -47,7 +47,7 @@ public:
   HYDROData_TopoCurve(const TopoDS_Edge& theEdge) {myEdges.push_back(theEdge);}
 
   //! Initializes the curve by the wire.
-  //! Returns 'false' if the wire is not 1 monifold or
+  //! Returns 'false' if the wire is not 1 manifold or
   //! is disconnected or is empty.
   HYDRODATA_EXPORT bool Initialize(const TopoDS_Wire& theWire);
 
index 02df17e1b99d7e5f7480746f0672c13c8c2e0642..f0757cf98aa53d93666c10d38ebe5be71947aa8f 100644 (file)
@@ -243,7 +243,7 @@ bool HYDROGUI_ImportGeomObjectOp::processApply( int& theUpdateFlags,
         anIsOk = true;
       } else if ( myOpType == ImportSelectedAsPolyline ) {
         Handle(HYDROData_PolylineXY) aPolyline = Handle(HYDROData_PolylineXY)::DownCast( anObject );
-        anIsOk = aPolyline->ImportShape( aShape );
+        anIsOk = aPolyline->ImportShape( aShape, false );
 
         /* TODO: check it before start operation
         if ( anIsOk && !aPolyline->IsEditable() )
@@ -370,4 +370,4 @@ QList<GEOM::shape_type> HYDROGUI_ImportGeomObjectOp::getPolylineTypes()
   aTypes << GEOM::WIRE << GEOM::EDGE;
 
   return aTypes;
-}
\ No newline at end of file
+}
index 834d344b86e45d3eedf97d7644e4cd38b3af24e7..1ed528f676eb70ba5fc65791fe93986d7ab46588 100644 (file)
@@ -228,7 +228,7 @@ bool HYDROGUI_RecognizeContoursOp::processApply( int& theUpdateFlags,
 
     if( !aPolylineObj.IsNull() ) {
       aPolylineObj->SetName( aName );
-      aPolylineObj->ImportShape( aShape );
+      aPolylineObj->ImportShape( aShape, false );
       aPolylineObj->SetWireColor( HYDROData_PolylineXY::DefaultWireColor() );
 
       aPolylineObj->Update();
@@ -379,7 +379,7 @@ void HYDROGUI_RecognizeContoursOp::updateRecognizedPolylines()
       TopoDS_Shape aSubShape = aSubShapes.Value( i );
 
       // Transform the sub-shape
-      aPolylineObj->ImportShape( aSubShape );
+      aPolylineObj->ImportShape( aSubShape, false );
       aPolylineObj->Transform( aTrsf );
 
       /*
@@ -514,4 +514,4 @@ void HYDROGUI_RecognizeContoursOp::cleanup()
     // update the object browser
     module()->getApp()->updateObjectBrowser( true );
   }
-}
\ No newline at end of file
+}