From: Paul RASCLE Date: Sat, 18 Jun 2016 14:32:43 +0000 (+0200) Subject: debug split polylines, improvement on SPLINE, but it would be preferable to keep... X-Git-Tag: v1.6~105 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7de2b9cfd8501129720f9338fcdf1766007511b9;p=modules%2Fhydro.git debug split polylines, improvement on SPLINE, but it would be preferable to keep original polyline points --- diff --git a/src/HYDROData/HYDROData_PolylineOperator.cxx b/src/HYDROData/HYDROData_PolylineOperator.cxx index 5dfa0411..947de751 100644 --- a/src/HYDROData/HYDROData_PolylineOperator.cxx +++ b/src/HYDROData/HYDROData_PolylineOperator.cxx @@ -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] ); diff --git a/src/HYDROData/HYDROData_PolylineOperator.h b/src/HYDROData/HYDROData_PolylineOperator.h index a710e72a..ed1716c0 100644 --- a/src/HYDROData/HYDROData_PolylineOperator.h +++ b/src/HYDROData/HYDROData_PolylineOperator.h @@ -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, diff --git a/src/HYDROData/HYDROData_PolylineXY.cxx b/src/HYDROData/HYDROData_PolylineXY.cxx index 0acdacdf..20629aa0 100644 --- a/src/HYDROData/HYDROData_PolylineXY.cxx +++ b/src/HYDROData/HYDROData_PolylineXY.cxx @@ -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 ); } } diff --git a/src/HYDROData/HYDROData_PolylineXY.h b/src/HYDROData/HYDROData_PolylineXY.h index aa6ab4a2..39d01e72 100644 --- a/src/HYDROData/HYDROData_PolylineXY.h +++ b/src/HYDROData/HYDROData_PolylineXY.h @@ -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& 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. diff --git a/src/HYDROData/HYDROData_TopoCurve.cxx b/src/HYDROData/HYDROData_TopoCurve.cxx index fce5201a..540dd8b0 100644 --- a/src/HYDROData/HYDROData_TopoCurve.cxx +++ b/src/HYDROData/HYDROData_TopoCurve.cxx @@ -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, diff --git a/src/HYDROData/HYDROData_TopoCurve.h b/src/HYDROData/HYDROData_TopoCurve.h index a1db81e7..bb187c0e 100644 --- a/src/HYDROData/HYDROData_TopoCurve.h +++ b/src/HYDROData/HYDROData_TopoCurve.h @@ -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); diff --git a/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx b/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx index 02df17e1..f0757cf9 100644 --- a/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportGeomObjectOp.cxx @@ -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 HYDROGUI_ImportGeomObjectOp::getPolylineTypes() aTypes << GEOM::WIRE << GEOM::EDGE; return aTypes; -} \ No newline at end of file +} diff --git a/src/HYDROGUI/HYDROGUI_RecognizeContoursOp.cxx b/src/HYDROGUI/HYDROGUI_RecognizeContoursOp.cxx index 834d344b..1ed528f6 100644 --- a/src/HYDROGUI/HYDROGUI_RecognizeContoursOp.cxx +++ b/src/HYDROGUI/HYDROGUI_RecognizeContoursOp.cxx @@ -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 +}