diff --git a/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.cxx b/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.cxx index 82805de9f4..18c90f749d 100644 --- a/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.cxx +++ b/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.cxx @@ -142,6 +142,15 @@ int TDocStd_Application::NbDocuments() const //================================================================================================= +occ::handle TDocStd_Application::GetDocument(const int index) const +{ + occ::handle aDoc; + GetDocument(index, aDoc); + return aDoc; +} + +//================================================================================================= + void TDocStd_Application::GetDocument(const int index, occ::handle& theDoc) const { CDF_DirectoryIterator it(myDirectory); @@ -218,7 +227,7 @@ int TDocStd_Application::IsInSession(const TCollection_ExtendedString& path) con occ::handle D; for (int i = 1; i <= nbdoc; i++) { - GetDocument(i, D); + D = GetDocument(i); if (D->IsSaved()) { TCollection_ExtendedString unifiedDocPath(D->GetPath()); diff --git a/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.hxx b/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.hxx index 5309e74be7..ab272d410f 100644 --- a/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.hxx +++ b/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.hxx @@ -154,18 +154,14 @@ public: //! returns the number of documents handled by the current applicative session. Standard_EXPORT int NbDocuments() const; - //! Constructs the new document aDoc. - //! aDoc is identified by the index index which is - //! any integer between 1 and n where n is the - //! number of documents returned by NbDocument. - //! Example - //! occ::handle - //! anApp; - //! if (!CafTest::Find(A)) return 1; - //! occ::handle aDoc; - //! int nbdoc = anApp->NbDocuments(); - //! for (int i = 1; i <= nbdoc; i++) { - //! aApp->GetDocument(i,aDoc); + //! Returns the document at the given 1-based index. + //! The index is any integer between 1 and NbDocuments(). + //! @param[in] index 1-based document index + //! @return handle to the document + [[nodiscard]] Standard_EXPORT occ::handle GetDocument(const int index) const; + + //! @deprecated Use GetDocument() returning handle by value instead. + Standard_DEPRECATED("Use GetDocument() returning handle by value instead") Standard_EXPORT void GetDocument(const int index, occ::handle& aDoc) const; //! Constructs the empty new document aDoc. diff --git a/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Driver.cxx b/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Driver.cxx index 87e18c6cc2..cedacc0e50 100644 --- a/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Driver.cxx +++ b/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Driver.cxx @@ -32,7 +32,7 @@ void TFunction_Driver::Init(const TDF_Label& L) //================================================================================================= -void TFunction_Driver::Validate(occ::handle& log) const +void TFunction_Driver::Validate(const occ::handle& log) const { NCollection_List res; Results(res); diff --git a/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Driver.hxx b/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Driver.hxx index aefafac645..f787e2feb1 100644 --- a/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Driver.hxx +++ b/src/ApplicationFramework/TKLCAF/TFunction/TFunction_Driver.hxx @@ -54,7 +54,7 @@ public: //! method even if the function is not executed. //! execution of function //! ===================== - Standard_EXPORT virtual void Validate(occ::handle& log) const; + Standard_EXPORT virtual void Validate(const occ::handle& log) const; //! Analyzes the labels in the logbook log. //! Returns true if attributes have been modified. diff --git a/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintDriver.cxx b/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintDriver.cxx index fa6f85f53d..c317aff7f0 100644 --- a/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintDriver.cxx +++ b/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintDriver.cxx @@ -62,67 +62,67 @@ bool TPrsStd_ConstraintDriver::Update(const TDF_Label& aLabel switch (thetype) { case TDataXtd_DISTANCE: { - TPrsStd_ConstraintTools::ComputeDistance(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeDistance(apConstraint); break; } case TDataXtd_PARALLEL: { - TPrsStd_ConstraintTools::ComputeParallel(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeParallel(apConstraint); break; } case TDataXtd_PERPENDICULAR: { - TPrsStd_ConstraintTools::ComputePerpendicular(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputePerpendicular(apConstraint); break; } case TDataXtd_CONCENTRIC: { - TPrsStd_ConstraintTools::ComputeConcentric(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeConcentric(apConstraint); break; } case TDataXtd_SYMMETRY: { - TPrsStd_ConstraintTools::ComputeSymmetry(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeSymmetry(apConstraint); break; } case TDataXtd_MIDPOINT: { - TPrsStd_ConstraintTools::ComputeMidPoint(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeMidPoint(apConstraint); break; } case TDataXtd_TANGENT: { - TPrsStd_ConstraintTools::ComputeTangent(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeTangent(apConstraint); break; } case TDataXtd_ANGLE: { - TPrsStd_ConstraintTools::ComputeAngle(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeAngle(apConstraint); break; } case TDataXtd_RADIUS: { - TPrsStd_ConstraintTools::ComputeRadius(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeRadius(apConstraint); break; } case TDataXtd_MINOR_RADIUS: { - TPrsStd_ConstraintTools::ComputeMinRadius(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeMinRadius(apConstraint); break; } case TDataXtd_MAJOR_RADIUS: { - TPrsStd_ConstraintTools::ComputeMaxRadius(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeMaxRadius(apConstraint); break; } case TDataXtd_DIAMETER: { - TPrsStd_ConstraintTools::ComputeDiameter(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeDiameter(apConstraint); break; } case TDataXtd_FIX: { - TPrsStd_ConstraintTools::ComputeFix(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeFix(apConstraint); break; } case TDataXtd_OFFSET: { - TPrsStd_ConstraintTools::ComputeOffset(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeOffset(apConstraint); break; } case TDataXtd_COINCIDENT: { - TPrsStd_ConstraintTools::ComputeCoincident(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeCoincident(apConstraint); break; } case TDataXtd_ROUND: { - TPrsStd_ConstraintTools::ComputeRound(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeRound(apConstraint); break; } @@ -130,19 +130,19 @@ bool TPrsStd_ConstraintDriver::Update(const TDF_Label& aLabel case TDataXtd_ALIGN_FACES: case TDataXtd_ALIGN_AXES: case TDataXtd_AXES_ANGLE: { - TPrsStd_ConstraintTools::ComputePlacement(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputePlacement(apConstraint); break; } case TDataXtd_EQUAL_DISTANCE: { - TPrsStd_ConstraintTools::ComputeEqualDistance(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeEqualDistance(apConstraint); break; } case TDataXtd_EQUAL_RADIUS: { - TPrsStd_ConstraintTools::ComputeEqualRadius(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeEqualRadius(apConstraint); break; } default: { - TPrsStd_ConstraintTools::ComputeOthers(apConstraint, anAIS); + anAIS = TPrsStd_ConstraintTools::ComputeOthers(apConstraint); break; } } diff --git a/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintTools.cxx b/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintTools.cxx index 188e2c2eac..c6de4706bc 100644 --- a/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintTools.cxx +++ b/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintTools.cxx @@ -229,6 +229,16 @@ void TPrsStd_ConstraintTools::UpdateOnlyValue(const occ::handle TPrsStd_ConstraintTools::ComputeDistance( + const occ::handle& theConst) +{ + occ::handle aResult; + ComputeDistance(theConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeDistance(const occ::handle& theConst, occ::handle& theAIS) { @@ -458,6 +468,16 @@ void TPrsStd_ConstraintTools::ComputeDistance(const occ::handle TPrsStd_ConstraintTools::ComputePerpendicular( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputePerpendicular(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputePerpendicular(const occ::handle& aConst, occ::handle& anAIS) { @@ -527,6 +547,16 @@ void TPrsStd_ConstraintTools::ComputePerpendicular(const occ::handle TPrsStd_ConstraintTools::ComputeParallel( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeParallel(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeParallel(const occ::handle& aConst, occ::handle& anAIS) { @@ -597,6 +627,16 @@ void TPrsStd_ConstraintTools::ComputeParallel(const occ::handle TPrsStd_ConstraintTools::ComputeSymmetry( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeSymmetry(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeSymmetry(const occ::handle& aConst, occ::handle& anAIS) { @@ -670,6 +710,16 @@ void TPrsStd_ConstraintTools::ComputeSymmetry(const occ::handle TPrsStd_ConstraintTools::ComputeMidPoint( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeMidPoint(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeMidPoint(const occ::handle& aConst, occ::handle& anAIS) { @@ -745,6 +795,16 @@ void TPrsStd_ConstraintTools::ComputeMidPoint(const occ::handle TPrsStd_ConstraintTools::ComputeTangent( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeTangent(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeTangent(const occ::handle& aConst, occ::handle& anAIS) { @@ -818,6 +878,16 @@ void TPrsStd_ConstraintTools::ComputeTangent(const occ::handle TPrsStd_ConstraintTools::ComputeAngleForOneFace( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeAngleForOneFace(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeAngleForOneFace(const occ::handle& aConst, occ::handle& anAIS) { @@ -889,6 +959,16 @@ static bool CheckIsShapeCompound(TopoDS_Shape& shape, TopoDS_Face& aFace) //================================================================================================= +occ::handle TPrsStd_ConstraintTools::ComputeAngle( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeAngle(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeAngle(const occ::handle& aConst, occ::handle& anAIS) { @@ -1157,6 +1237,16 @@ void TPrsStd_ConstraintTools::ComputeAngle(const occ::handle TPrsStd_ConstraintTools::ComputeConcentric( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeConcentric(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeConcentric(const occ::handle& aConst, occ::handle& anAIS) { @@ -1238,6 +1328,16 @@ void TPrsStd_ConstraintTools::ComputeConcentric(const occ::handle TPrsStd_ConstraintTools::ComputeRadius( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeRadius(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeRadius(const occ::handle& aConst, occ::handle& anAIS) { @@ -1323,6 +1423,16 @@ void TPrsStd_ConstraintTools::ComputeRadius(const occ::handle TPrsStd_ConstraintTools::ComputeMinRadius( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeMinRadius(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeMinRadius(const occ::handle& aConst, occ::handle& anAIS) { @@ -1409,6 +1519,16 @@ void TPrsStd_ConstraintTools::ComputeMinRadius(const occ::handle TPrsStd_ConstraintTools::ComputeMaxRadius( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeMaxRadius(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeMaxRadius(const occ::handle& aConst, occ::handle& anAIS) { @@ -1495,6 +1615,16 @@ void TPrsStd_ConstraintTools::ComputeMaxRadius(const occ::handle TPrsStd_ConstraintTools::ComputeEqualDistance( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeEqualDistance(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeEqualDistance(const occ::handle& aConst, occ::handle& anAIS) { @@ -1652,6 +1782,16 @@ static bool CheckShapesPair(const TopoDS_Shape& aShape1, const TopoDS_Shape& aSh //================================================================================================= +occ::handle TPrsStd_ConstraintTools::ComputeEqualRadius( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeEqualRadius(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeEqualRadius(const occ::handle& aConst, occ::handle& anAIS) { @@ -1753,6 +1893,16 @@ void TPrsStd_ConstraintTools::ComputeEqualRadius(const occ::handle TPrsStd_ConstraintTools::ComputeDiameter( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeDiameter(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeDiameter(const occ::handle& aConst, occ::handle& anAIS) { @@ -1821,6 +1971,16 @@ void TPrsStd_ConstraintTools::ComputeDiameter(const occ::handle TPrsStd_ConstraintTools::ComputeFix( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeFix(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeFix(const occ::handle& aConst, occ::handle& anAIS) { @@ -1889,6 +2049,16 @@ void TPrsStd_ConstraintTools::ComputeFix(const occ::handle& //================================================================================================= +occ::handle TPrsStd_ConstraintTools::ComputeOffset( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeOffset(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeOffset(const occ::handle& aConst, occ::handle& anAIS) { @@ -2080,6 +2250,16 @@ void TPrsStd_ConstraintTools::ComputeOffset(const occ::handle TPrsStd_ConstraintTools::ComputePlacement( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputePlacement(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputePlacement(const occ::handle& aConst, occ::handle& anAIS) { @@ -2136,6 +2316,16 @@ void TPrsStd_ConstraintTools::ComputePlacement(const occ::handle TPrsStd_ConstraintTools::ComputeOthers( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeOthers(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeOthers(const occ::handle& /*aConst*/, occ::handle& /*anAIS*/) { @@ -2212,6 +2402,16 @@ void TPrsStd_ConstraintTools::GetShapesAndGeom(const occ::handle TPrsStd_ConstraintTools::ComputeCoincident( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeCoincident(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeCoincident(const occ::handle& aConst, occ::handle& anAIS) { @@ -2283,6 +2483,16 @@ void TPrsStd_ConstraintTools::ComputeCoincident(const occ::handle TPrsStd_ConstraintTools::ComputeRound( + const occ::handle& aConst) +{ + occ::handle aResult; + ComputeRound(aConst, aResult); + return aResult; +} + +//================================================================================================= + void TPrsStd_ConstraintTools::ComputeRound(const occ::handle& aConst, occ::handle& anAIS) { diff --git a/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintTools.hxx b/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintTools.hxx index 89d2ddb2c2..430408d75b 100644 --- a/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintTools.hxx +++ b/src/ApplicationFramework/TKVCAF/TPrsStd/TPrsStd_ConstraintTools.hxx @@ -37,63 +37,223 @@ public: Standard_EXPORT static void UpdateOnlyValue(const occ::handle& aConst, const occ::handle& anAIS); + //! Computes a distance dimension presentation for the given constraint. + //! @param[in] aConst the distance constraint + //! @return interactive object representing the distance, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeDistance( + const occ::handle& aConst); + + //! @deprecated Use ComputeDistance() returning handle by value instead. + Standard_DEPRECATED("Use ComputeDistance() returning handle by value instead") Standard_EXPORT static void ComputeDistance(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a parallel relation presentation for the given constraint. + //! @param[in] aConst the parallel constraint + //! @return interactive object representing the relation, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeParallel( + const occ::handle& aConst); + + //! @deprecated Use ComputeParallel() returning handle by value instead. + Standard_DEPRECATED("Use ComputeParallel() returning handle by value instead") Standard_EXPORT static void ComputeParallel(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a tangent relation presentation for the given constraint. + //! @param[in] aConst the tangent constraint + //! @return interactive object representing the relation, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeTangent( + const occ::handle& aConst); + + //! @deprecated Use ComputeTangent() returning handle by value instead. + Standard_DEPRECATED("Use ComputeTangent() returning handle by value instead") Standard_EXPORT static void ComputeTangent(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a perpendicular relation presentation for the given constraint. + //! @param[in] aConst the perpendicular constraint + //! @return interactive object representing the relation, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputePerpendicular( + const occ::handle& aConst); + + //! @deprecated Use ComputePerpendicular() returning handle by value instead. + Standard_DEPRECATED("Use ComputePerpendicular() returning handle by value instead") Standard_EXPORT static void ComputePerpendicular(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a concentric relation presentation for the given constraint. + //! @param[in] aConst the concentric constraint + //! @return interactive object representing the relation, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeConcentric( + const occ::handle& aConst); + + //! @deprecated Use ComputeConcentric() returning handle by value instead. + Standard_DEPRECATED("Use ComputeConcentric() returning handle by value instead") Standard_EXPORT static void ComputeConcentric(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a symmetry relation presentation for the given constraint. + //! @param[in] aConst the symmetry constraint + //! @return interactive object representing the relation, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeSymmetry( + const occ::handle& aConst); + + //! @deprecated Use ComputeSymmetry() returning handle by value instead. + Standard_DEPRECATED("Use ComputeSymmetry() returning handle by value instead") Standard_EXPORT static void ComputeSymmetry(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a midpoint relation presentation for the given constraint. + //! @param[in] aConst the midpoint constraint + //! @return interactive object representing the relation, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeMidPoint( + const occ::handle& aConst); + + //! @deprecated Use ComputeMidPoint() returning handle by value instead. + Standard_DEPRECATED("Use ComputeMidPoint() returning handle by value instead") Standard_EXPORT static void ComputeMidPoint(const occ::handle& aConst, occ::handle& anAIS); + //! Computes an angle dimension presentation for the given constraint. + //! @param[in] aConst the angle constraint + //! @return interactive object representing the angle, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeAngle( + const occ::handle& aConst); + + //! @deprecated Use ComputeAngle() returning handle by value instead. + Standard_DEPRECATED("Use ComputeAngle() returning handle by value instead") Standard_EXPORT static void ComputeAngle(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a radius dimension presentation for the given constraint. + //! @param[in] aConst the radius constraint + //! @return interactive object representing the radius, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeRadius( + const occ::handle& aConst); + + //! @deprecated Use ComputeRadius() returning handle by value instead. + Standard_DEPRECATED("Use ComputeRadius() returning handle by value instead") Standard_EXPORT static void ComputeRadius(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a minor radius dimension presentation for the given constraint. + //! @param[in] aConst the minor radius constraint + //! @return interactive object representing the minor radius, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeMinRadius( + const occ::handle& aConst); + + //! @deprecated Use ComputeMinRadius() returning handle by value instead. + Standard_DEPRECATED("Use ComputeMinRadius() returning handle by value instead") Standard_EXPORT static void ComputeMinRadius(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a major radius dimension presentation for the given constraint. + //! @param[in] aConst the major radius constraint + //! @return interactive object representing the major radius, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeMaxRadius( + const occ::handle& aConst); + + //! @deprecated Use ComputeMaxRadius() returning handle by value instead. + Standard_DEPRECATED("Use ComputeMaxRadius() returning handle by value instead") Standard_EXPORT static void ComputeMaxRadius(const occ::handle& aConst, occ::handle& anAIS); + //! Computes an equal distance relation presentation for the given constraint. + //! @param[in] aConst the equal distance constraint + //! @return interactive object representing the relation, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeEqualDistance( + const occ::handle& aConst); + + //! @deprecated Use ComputeEqualDistance() returning handle by value instead. + Standard_DEPRECATED("Use ComputeEqualDistance() returning handle by value instead") Standard_EXPORT static void ComputeEqualDistance(const occ::handle& aConst, occ::handle& anAIS); + //! Computes an equal radius relation presentation for the given constraint. + //! @param[in] aConst the equal radius constraint + //! @return interactive object representing the relation, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeEqualRadius( + const occ::handle& aConst); + + //! @deprecated Use ComputeEqualRadius() returning handle by value instead. + Standard_DEPRECATED("Use ComputeEqualRadius() returning handle by value instead") Standard_EXPORT static void ComputeEqualRadius(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a fix constraint presentation for the given constraint. + //! @param[in] aConst the fix constraint + //! @return interactive object representing the constraint, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeFix( + const occ::handle& aConst); + + //! @deprecated Use ComputeFix() returning handle by value instead. + Standard_DEPRECATED("Use ComputeFix() returning handle by value instead") Standard_EXPORT static void ComputeFix(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a diameter dimension presentation for the given constraint. + //! @param[in] aConst the diameter constraint + //! @return interactive object representing the diameter, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeDiameter( + const occ::handle& aConst); + + //! @deprecated Use ComputeDiameter() returning handle by value instead. + Standard_DEPRECATED("Use ComputeDiameter() returning handle by value instead") Standard_EXPORT static void ComputeDiameter(const occ::handle& aConst, occ::handle& anAIS); + //! Computes an offset relation presentation for the given constraint. + //! @param[in] aConst the offset constraint + //! @return interactive object representing the offset, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeOffset( + const occ::handle& aConst); + + //! @deprecated Use ComputeOffset() returning handle by value instead. + Standard_DEPRECATED("Use ComputeOffset() returning handle by value instead") Standard_EXPORT static void ComputeOffset(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a placement relation presentation for the given constraint. + //! @param[in] aConst the placement constraint + //! @return interactive object representing the placement, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputePlacement( + const occ::handle& aConst); + + //! @deprecated Use ComputePlacement() returning handle by value instead. + Standard_DEPRECATED("Use ComputePlacement() returning handle by value instead") Standard_EXPORT static void ComputePlacement(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a coincident relation presentation for the given constraint. + //! @param[in] aConst the coincident constraint + //! @return interactive object representing the relation, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeCoincident( + const occ::handle& aConst); + + //! @deprecated Use ComputeCoincident() returning handle by value instead. + Standard_DEPRECATED("Use ComputeCoincident() returning handle by value instead") Standard_EXPORT static void ComputeCoincident(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a round (fillet) relation presentation for the given constraint. + //! @param[in] aConst the round constraint + //! @return interactive object representing the relation, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeRound( + const occ::handle& aConst); + + //! @deprecated Use ComputeRound() returning handle by value instead. + Standard_DEPRECATED("Use ComputeRound() returning handle by value instead") Standard_EXPORT static void ComputeRound(const occ::handle& aConst, occ::handle& anAIS); + //! Computes a presentation for constraint types not handled by specific methods. + //! @param[in] aConst the constraint + //! @return interactive object representing the constraint, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeOthers( + const occ::handle& aConst); + + //! @deprecated Use ComputeOthers() returning handle by value instead. + Standard_DEPRECATED("Use ComputeOthers() returning handle by value instead") Standard_EXPORT static void ComputeOthers(const occ::handle& aConst, occ::handle& anAIS); @@ -102,6 +262,14 @@ public: TCollection_ExtendedString& aText, const bool anIsAngle); + //! Computes an angle dimension presentation for a single-face constraint. + //! @param[in] aConst the angle constraint on one face + //! @return interactive object representing the angle, or null handle on failure + [[nodiscard]] Standard_EXPORT static occ::handle ComputeAngleForOneFace( + const occ::handle& aConst); + + //! @deprecated Use ComputeAngleForOneFace() returning handle by value instead. + Standard_DEPRECATED("Use ComputeAngleForOneFace() returning handle by value instead") Standard_EXPORT static void ComputeAngleForOneFace(const occ::handle& aConst, occ::handle& anAIS); diff --git a/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_Part.cxx b/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_Part.cxx index e098c6fdf0..21d7c15f65 100644 --- a/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_Part.cxx +++ b/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_Part.cxx @@ -52,7 +52,7 @@ STEPConstruct_Part::STEPConstruct_Part() void STEPConstruct_Part::MakeSDR(const occ::handle& SR, const occ::handle& aName, const occ::handle& AC, - occ::handle& theStepModel) + const occ::handle& theStepModel) { // get current schema const int schema = theStepModel->InternalParameters.WriteSchema; diff --git a/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_Part.hxx b/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_Part.hxx index 256c8a5efe..2f62cd3273 100644 --- a/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_Part.hxx +++ b/src/DataExchange/TKDESTEP/STEPConstruct/STEPConstruct_Part.hxx @@ -48,7 +48,7 @@ public: Standard_EXPORT void MakeSDR(const occ::handle& aShape, const occ::handle& aName, const occ::handle& AC, - occ::handle& theStepModel); + const occ::handle& theStepModel); Standard_EXPORT void ReadSDR(const occ::handle& aShape); diff --git a/src/DataExchange/TKDESTEP/STEPControl/STEPControl_ActorRead.cxx b/src/DataExchange/TKDESTEP/STEPControl/STEPControl_ActorRead.cxx index 8cd90a2487..4c4224e442 100644 --- a/src/DataExchange/TKDESTEP/STEPControl/STEPControl_ActorRead.cxx +++ b/src/DataExchange/TKDESTEP/STEPControl/STEPControl_ActorRead.cxx @@ -2127,8 +2127,8 @@ void STEPControl_ActorRead::PrepareUnits(const occ::handle& theModel, - StepData_Factors& theLocalFactors) +void STEPControl_ActorRead::ResetUnits(const occ::handle& theModel, + StepData_Factors& theLocalFactors) { theLocalFactors.InitializeFactors(1, 1, 1); myPrecision = theModel->InternalParameters.ReadPrecisionVal; diff --git a/src/DataExchange/TKDESTEP/STEPControl/STEPControl_ActorRead.hxx b/src/DataExchange/TKDESTEP/STEPControl/STEPControl_ActorRead.hxx index 40cf79e6f7..d579d50f67 100644 --- a/src/DataExchange/TKDESTEP/STEPControl/STEPControl_ActorRead.hxx +++ b/src/DataExchange/TKDESTEP/STEPControl/STEPControl_ActorRead.hxx @@ -88,8 +88,8 @@ public: //! reset units and tolerances context to default //! (mm, radians, read.precision.val, etc.) - Standard_EXPORT void ResetUnits(occ::handle& theModel, - StepData_Factors& theLocalFactors); + Standard_EXPORT void ResetUnits(const occ::handle& theModel, + StepData_Factors& theLocalFactors); //! Set model Standard_EXPORT void SetModel(const occ::handle& theModel); diff --git a/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_GeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol.hxx b/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_GeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol.hxx index 44d092e00f..5dc2d4a3e1 100644 --- a/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_GeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol.hxx +++ b/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_GeoTolAndGeoTolWthDatRefAndGeoTolWthMaxTol.hxx @@ -55,7 +55,7 @@ public: const occ::handle& theMaxTol, const StepDimTol_GeometricToleranceType theType); - inline void SetMaxTolerance(occ::handle& theMaxTol) + inline void SetMaxTolerance(const occ::handle& theMaxTol) { myMaxTol = theMaxTol; } diff --git a/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_GeoTolAndGeoTolWthMaxTol.hxx b/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_GeoTolAndGeoTolWthMaxTol.hxx index b75f877583..8c2d54ad3c 100644 --- a/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_GeoTolAndGeoTolWthMaxTol.hxx +++ b/src/DataExchange/TKDESTEP/StepDimTol/StepDimTol_GeoTolAndGeoTolWthMaxTol.hxx @@ -49,7 +49,7 @@ public: const occ::handle& theMaxTol, const StepDimTol_GeometricToleranceType theType); - inline void SetMaxTolerance(occ::handle& theMaxTol) + inline void SetMaxTolerance(const occ::handle& theMaxTol) { myMaxTol = theMaxTol; } diff --git a/src/DataExchange/TKDEVRML/VrmlAPI/VrmlAPI_Writer.cxx b/src/DataExchange/TKDEVRML/VrmlAPI/VrmlAPI_Writer.cxx index bfa4a8fd11..8466092475 100644 --- a/src/DataExchange/TKDEVRML/VrmlAPI/VrmlAPI_Writer.cxx +++ b/src/DataExchange/TKDEVRML/VrmlAPI/VrmlAPI_Writer.cxx @@ -167,6 +167,13 @@ void VrmlAPI_Writer::SetRepresentation(const VrmlAPI_RepresentationOfShape aRep) myRepresentation = aRep; } +VrmlAPI_RepresentationOfShape VrmlAPI_Writer::GetRepresentation() const +{ + return myRepresentation; +} + +//================================================================================================= + void VrmlAPI_Writer::SetTransparencyToMaterial(occ::handle& aMaterial, const double aTransparency) { @@ -174,6 +181,8 @@ void VrmlAPI_Writer::SetTransparencyToMaterial(occ::handle& aMate aMaterial->SetTransparency(t); } +//================================================================================================= + void VrmlAPI_Writer::SetShininessToMaterial(occ::handle& aMaterial, const double aShininess) { @@ -181,6 +190,8 @@ void VrmlAPI_Writer::SetShininessToMaterial(occ::handle& aMateria aMaterial->SetShininess(s); } +//================================================================================================= + void VrmlAPI_Writer::SetAmbientColorToMaterial( occ::handle& aMaterial, const occ::handle>& Color) @@ -188,6 +199,8 @@ void VrmlAPI_Writer::SetAmbientColorToMaterial( aMaterial->SetAmbientColor(Color); } +//================================================================================================= + void VrmlAPI_Writer::SetDiffuseColorToMaterial( occ::handle& aMaterial, const occ::handle>& Color) @@ -195,6 +208,8 @@ void VrmlAPI_Writer::SetDiffuseColorToMaterial( aMaterial->SetDiffuseColor(Color); } +//================================================================================================= + void VrmlAPI_Writer::SetSpecularColorToMaterial( occ::handle& aMaterial, const occ::handle>& Color) @@ -202,6 +217,8 @@ void VrmlAPI_Writer::SetSpecularColorToMaterial( aMaterial->SetSpecularColor(Color); } +//================================================================================================= + void VrmlAPI_Writer::SetEmissiveColorToMaterial( occ::handle& aMaterial, const occ::handle>& Color) @@ -209,11 +226,6 @@ void VrmlAPI_Writer::SetEmissiveColorToMaterial( aMaterial->SetEmissiveColor(Color); } -VrmlAPI_RepresentationOfShape VrmlAPI_Writer::GetRepresentation() const -{ - return myRepresentation; -} - occ::handle VrmlAPI_Writer::GetFrontMaterial() const { return myFrontMaterial; diff --git a/src/DataExchange/TKDEVRML/VrmlAPI/VrmlAPI_Writer.hxx b/src/DataExchange/TKDEVRML/VrmlAPI/VrmlAPI_Writer.hxx index 8bcfc885b8..dd7402083e 100644 --- a/src/DataExchange/TKDEVRML/VrmlAPI/VrmlAPI_Writer.hxx +++ b/src/DataExchange/TKDEVRML/VrmlAPI/VrmlAPI_Writer.hxx @@ -25,10 +25,10 @@ #include #include #include +#include class VrmlConverter_Drawer; class VrmlConverter_Projector; -class Vrml_Material; class TopoDS_Shape; class TDocStd_Document; @@ -66,34 +66,45 @@ public: //! defined through the VrmlAPI_RepresentationOfShape enumeration. Standard_EXPORT void SetRepresentation(const VrmlAPI_RepresentationOfShape aRep); - //! Set transparency to given material - Standard_EXPORT void SetTransparencyToMaterial(occ::handle& aMaterial, - const double aTransparency); - - Standard_EXPORT void SetShininessToMaterial(occ::handle& aMaterial, - const double aShininess); - - Standard_EXPORT void SetAmbientColorToMaterial( - occ::handle& aMaterial, - const occ::handle>& Color); - - Standard_EXPORT void SetDiffuseColorToMaterial( - occ::handle& aMaterial, - const occ::handle>& Color); - - Standard_EXPORT void SetSpecularColorToMaterial( - occ::handle& aMaterial, - const occ::handle>& Color); - - Standard_EXPORT void SetEmissiveColorToMaterial( - occ::handle& aMaterial, - const occ::handle>& Color); - //! Returns the representation of the shape which is //! written to the VRML file. Types of representation are set through the //! VrmlAPI_RepresentationOfShape enumeration. Standard_EXPORT VrmlAPI_RepresentationOfShape GetRepresentation() const; + //! @deprecated Call Vrml_Material::SetTransparency() directly instead. + Standard_DEPRECATED("Call Vrml_Material::SetTransparency() directly instead") + Standard_EXPORT void SetTransparencyToMaterial(occ::handle& aMaterial, + const double aTransparency); + + //! @deprecated Call Vrml_Material::SetShininess() directly instead. + Standard_DEPRECATED("Call Vrml_Material::SetShininess() directly instead") + Standard_EXPORT void SetShininessToMaterial(occ::handle& aMaterial, + const double aShininess); + + //! @deprecated Call Vrml_Material::SetAmbientColor() directly instead. + Standard_DEPRECATED("Call Vrml_Material::SetAmbientColor() directly instead") + Standard_EXPORT void SetAmbientColorToMaterial( + occ::handle& aMaterial, + const occ::handle>& Color); + + //! @deprecated Call Vrml_Material::SetDiffuseColor() directly instead. + Standard_DEPRECATED("Call Vrml_Material::SetDiffuseColor() directly instead") + Standard_EXPORT void SetDiffuseColorToMaterial( + occ::handle& aMaterial, + const occ::handle>& Color); + + //! @deprecated Call Vrml_Material::SetSpecularColor() directly instead. + Standard_DEPRECATED("Call Vrml_Material::SetSpecularColor() directly instead") + Standard_EXPORT void SetSpecularColorToMaterial( + occ::handle& aMaterial, + const occ::handle>& Color); + + //! @deprecated Call Vrml_Material::SetEmissiveColor() directly instead. + Standard_DEPRECATED("Call Vrml_Material::SetEmissiveColor() directly instead") + Standard_EXPORT void SetEmissiveColorToMaterial( + occ::handle& aMaterial, + const occ::handle>& Color); + Standard_EXPORT occ::handle GetFrontMaterial() const; Standard_EXPORT occ::handle GetPointsMaterial() const; diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModelCopier.cxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModelCopier.cxx index 498ef1720f..7137508b1a 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModelCopier.cxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModelCopier.cxx @@ -513,14 +513,14 @@ void IFSelect_ModelCopier::CopiedModel(const Interface_Graph& } } -void IFSelect_ModelCopier::CopiedRemaining(const Interface_Graph& G, - const occ::handle& WL, - Interface_CopyTool& TC, - occ::handle& newmod) +occ::handle IFSelect_ModelCopier::CopiedRemaining( + const Interface_Graph& G, + const occ::handle& WL, + Interface_CopyTool& TC) { const occ::handle& original = G.Model(); // Interface_CopyTool TC(original,protocol); - newmod = original->NewEmptyModel(); + occ::handle newmod = original->NewEmptyModel(); TC.Clear(); Interface_EntityIterator tocopy; int nb = G.Size(); @@ -567,6 +567,16 @@ void IFSelect_ModelCopier::CopiedRemaining(const Interface_Graph& std::cout << " -- Remaining data complete" << std::endl; #endif } + + return newmod; +} + +void IFSelect_ModelCopier::CopiedRemaining(const Interface_Graph& G, + const occ::handle& WL, + Interface_CopyTool& TC, + occ::handle& newmod) +{ + newmod = CopiedRemaining(G, WL, TC); } bool IFSelect_ModelCopier::SetRemaining(Interface_Graph& CG) const diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModelCopier.hxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModelCopier.hxx index 6cd8ad760f..2d611aacdd 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModelCopier.hxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_ModelCopier.hxx @@ -167,6 +167,18 @@ public: //! performs the copy by using //! is assumed to have been defined with the starting model //! same as defined by . + //! Produces a model copied from the remaining list. + //! @param[in] G the interface graph + //! @param[in] WL the work library performing the copy + //! @param[in,out] TC the copy tool + //! @return the new model with remaining data, or null handle if empty + [[nodiscard]] Standard_EXPORT occ::handle CopiedRemaining( + const Interface_Graph& G, + const occ::handle& WL, + Interface_CopyTool& TC); + + //! @deprecated Use CopiedRemaining() returning handle by value instead. + Standard_DEPRECATED("Use CopiedRemaining() returning handle by value instead") Standard_EXPORT void CopiedRemaining(const Interface_Graph& G, const occ::handle& WL, Interface_CopyTool& TC, diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_TransformStandard.cxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_TransformStandard.cxx index 5f4831c1b7..f1eb510d97 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_TransformStandard.cxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_TransformStandard.cxx @@ -114,7 +114,7 @@ bool IFSelect_TransformStandard::Perform(const Interface_Graph& { Interface_CopyTool TC(G.Model(), protocol); themap = TC.Control(); - Copy(G, TC, newmod); + newmod = Copy(G, TC); return ApplyModifiers(G, protocol, TC, checks, newmod); } @@ -122,18 +122,15 @@ void IFSelect_TransformStandard::Copy(const Interface_Graph& G, Interface_CopyTool& TC, occ::handle& newmod) const { - if (CopyOption()) - StandardCopy(G, TC, newmod); - else - OnTheSpot(G, TC, newmod); + newmod = Copy(G, TC); } -void IFSelect_TransformStandard::StandardCopy(const Interface_Graph& G, - Interface_CopyTool& TC, - occ::handle& newmod) const +occ::handle IFSelect_TransformStandard::StandardCopy( + const Interface_Graph& G, + Interface_CopyTool& TC) const { const occ::handle& original = G.Model(); - newmod = original->NewEmptyModel(); + occ::handle newmod = original->NewEmptyModel(); TC.Clear(); int nb = G.Size(); occ::handle> remain = new NCollection_HArray1(0, nb + 1); @@ -144,16 +141,37 @@ void IFSelect_TransformStandard::StandardCopy(const Interface_Graph& TC.TransferEntity(original->Value(i)); } TC.FillModel(newmod); + return newmod; +} + +occ::handle IFSelect_TransformStandard::Copy(const Interface_Graph& G, + Interface_CopyTool& TC) const +{ + return CopyOption() ? StandardCopy(G, TC) : OnTheSpot(G, TC); +} + +void IFSelect_TransformStandard::StandardCopy(const Interface_Graph& G, + Interface_CopyTool& TC, + occ::handle& newmod) const +{ + newmod = StandardCopy(G, TC); +} + +occ::handle IFSelect_TransformStandard::OnTheSpot( + const Interface_Graph& G, + Interface_CopyTool& TC) const +{ + int nb = G.Size(); + for (int i = 1; i <= nb; i++) + TC.Bind(G.Entity(i), G.Entity(i)); + return G.Model(); } void IFSelect_TransformStandard::OnTheSpot(const Interface_Graph& G, Interface_CopyTool& TC, occ::handle& newmod) const { - int nb = G.Size(); - for (int i = 1; i <= nb; i++) - TC.Bind(G.Entity(i), G.Entity(i)); - newmod = G.Model(); + newmod = OnTheSpot(G, TC); } bool IFSelect_TransformStandard::ApplyModifiers(const Interface_Graph& G, diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_TransformStandard.hxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_TransformStandard.hxx index d4ab5fd574..ada25af7ba 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_TransformStandard.hxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_TransformStandard.hxx @@ -118,6 +118,17 @@ public: //! This the first operation. It calls StandardCopy or OnTheSpot //! according the option + //! Performs the copy operation. Calls StandardCopy or OnTheSpot + //! according to the copy option. + //! @param[in] G the interface graph + //! @param[in,out] TC the copy tool + //! @return the new model produced by the copy + [[nodiscard]] Standard_EXPORT occ::handle Copy( + const Interface_Graph& G, + Interface_CopyTool& TC) const; + + //! @deprecated Use Copy() returning handle by value instead. + Standard_DEPRECATED("Use Copy() returning handle by value instead") Standard_EXPORT void Copy(const Interface_Graph& G, Interface_CopyTool& TC, occ::handle& newmod) const; @@ -125,12 +136,33 @@ public: //! This is the standard action of Copy : its takes into account //! only the remaining entities (noted by Graph Status positive) //! and their proper dependences of course. Produces a new model. + //! Performs a standard copy of remaining entities and their dependencies. + //! @param[in] G the interface graph + //! @param[in,out] TC the copy tool + //! @return the new model with copied entities + [[nodiscard]] Standard_EXPORT occ::handle StandardCopy( + const Interface_Graph& G, + Interface_CopyTool& TC) const; + + //! @deprecated Use StandardCopy() returning handle by value instead. + Standard_DEPRECATED("Use StandardCopy() returning handle by value instead") Standard_EXPORT void StandardCopy(const Interface_Graph& G, Interface_CopyTool& TC, occ::handle& newmod) const; //! This is the OnTheSpot action : each entity is bound with ... //! itself. The produced model is the same as the starting one. + //! Performs the on-the-spot action: each entity is bound with itself. + //! The produced model is the same as the starting one. + //! @param[in] G the interface graph + //! @param[in,out] TC the copy tool + //! @return the starting model (same instance) + [[nodiscard]] Standard_EXPORT occ::handle OnTheSpot( + const Interface_Graph& G, + Interface_CopyTool& TC) const; + + //! @deprecated Use OnTheSpot() returning handle by value instead. + Standard_DEPRECATED("Use OnTheSpot() returning handle by value instead") Standard_EXPORT void OnTheSpot(const Interface_Graph& G, Interface_CopyTool& TC, occ::handle& newmod) const; diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx index d7d13da4dc..0363f95676 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx @@ -2115,9 +2115,9 @@ bool IFSelect_WorkSession::SetRemaining(const IFSelect_RemainMode mode) } else if (mode == IFSelect_RemainCompute) { - occ::handle newmod; Interface_CopyTool TC(myModel, theprotocol); - thecopier->CopiedRemaining(thegraph->Graph(), thelibrary, TC, newmod); + occ::handle newmod = + thecopier->CopiedRemaining(thegraph->Graph(), thelibrary, TC); if (newmod.IsNull()) { sout << " No Remaining Data recorded" << std::endl; diff --git a/src/DataExchange/TKXSBase/Interface/Interface_IntList.cxx b/src/DataExchange/TKXSBase/Interface/Interface_IntList.cxx index d234549a1c..31e6ad1c66 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_IntList.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_IntList.cxx @@ -43,7 +43,9 @@ Interface_IntList::Interface_IntList(const Interface_IntList& other, const bool { thenbe = other.NbEntities(); thenum = thecount = therank = 0; // szv#4:S4163:12Mar99 initialization needed - other.Internals(thenbr, theents, therefs); + thenbr = other.NbReferences(); + theents = other.Entities(); + therefs = other.References(); if (copied) { int i; @@ -69,6 +71,21 @@ void Interface_IntList::Initialize(const int nbe) theents->Init(0); } +int Interface_IntList::NbReferences() const +{ + return thenbr; +} + +const occ::handle>& Interface_IntList::Entities() const +{ + return theents; +} + +const occ::handle>& Interface_IntList::References() const +{ + return therefs; +} + void Interface_IntList::Internals(int& nbrefs, occ::handle>& ents, occ::handle>& refs) const diff --git a/src/DataExchange/TKXSBase/Interface/Interface_IntList.hxx b/src/DataExchange/TKXSBase/Interface/Interface_IntList.hxx index 3d1d580e9d..430fd12f39 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_IntList.hxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_IntList.hxx @@ -70,7 +70,21 @@ public: //! Initialize IntList by number of entities. Standard_EXPORT void Initialize(const int nbe); + //! Returns count of stored references. + //! @return number of references + Standard_EXPORT int NbReferences() const; + + //! Returns entity headers used to describe the lists. + //! @return handle to the array of entity headers + Standard_EXPORT const occ::handle>& Entities() const; + + //! Returns the packed references storage. + //! @return handle to the array of packed references + Standard_EXPORT const occ::handle>& References() const; + //! Returns internal values, used for copying + //! @deprecated Use NbReferences(), Entities(), and References() instead. + Standard_DEPRECATED("Use NbReferences(), Entities(), and References() instead") Standard_EXPORT void Internals(int& nbrefs, occ::handle>& ents, occ::handle>& refs) const; diff --git a/src/Draw/TKDCAF/DNaming/DNaming_BooleanOperationDriver.cxx b/src/Draw/TKDCAF/DNaming/DNaming_BooleanOperationDriver.cxx index b837b78a78..6142ac6663 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_BooleanOperationDriver.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_BooleanOperationDriver.cxx @@ -70,7 +70,7 @@ DNaming_BooleanOperationDriver::DNaming_BooleanOperationDriver() = default; // function : Validate // purpose : Validates labels of a function in . //======================================================================= -void DNaming_BooleanOperationDriver::Validate(occ::handle&) const {} +void DNaming_BooleanOperationDriver::Validate(const occ::handle&) const {} //======================================================================= // function : MustExecute diff --git a/src/Draw/TKDCAF/DNaming/DNaming_BooleanOperationDriver.hxx b/src/Draw/TKDCAF/DNaming/DNaming_BooleanOperationDriver.hxx index bd3ad710bc..ed10143faf 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_BooleanOperationDriver.hxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_BooleanOperationDriver.hxx @@ -42,7 +42,7 @@ public: //! the valid label scope. //! execution of function //! ====================== - Standard_EXPORT void Validate(occ::handle& theLog) const override; + Standard_EXPORT void Validate(const occ::handle& theLog) const override; //! Analyse in if the loaded function must be executed //! (i.e.arguments are modified) or not. diff --git a/src/Draw/TKDCAF/DNaming/DNaming_BoxDriver.cxx b/src/Draw/TKDCAF/DNaming/DNaming_BoxDriver.cxx index 84a8302d69..62a68a70c2 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_BoxDriver.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_BoxDriver.cxx @@ -41,7 +41,7 @@ DNaming_BoxDriver::DNaming_BoxDriver() = default; // function : Validate // purpose : Validates labels of a function in . //======================================================================= -void DNaming_BoxDriver::Validate(occ::handle&) const {} +void DNaming_BoxDriver::Validate(const occ::handle&) const {} //======================================================================= // function : MustExecute diff --git a/src/Draw/TKDCAF/DNaming/DNaming_BoxDriver.hxx b/src/Draw/TKDCAF/DNaming/DNaming_BoxDriver.hxx index 6d552f1ce7..3f4d3dea1b 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_BoxDriver.hxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_BoxDriver.hxx @@ -40,7 +40,7 @@ public: //! the valid label scope. //! execution of function //! ====================== - Standard_EXPORT void Validate(occ::handle& theLog) const override; + Standard_EXPORT void Validate(const occ::handle& theLog) const override; //! Analyse in if the loaded function must be executed //! (i.e.arguments are modified) or not. diff --git a/src/Draw/TKDCAF/DNaming/DNaming_CylinderDriver.cxx b/src/Draw/TKDCAF/DNaming/DNaming_CylinderDriver.cxx index 3481e5586a..09e06cc2da 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_CylinderDriver.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_CylinderDriver.cxx @@ -46,7 +46,7 @@ DNaming_CylinderDriver::DNaming_CylinderDriver() = default; // function : Validate // purpose : Validates labels of a function in . //======================================================================= -void DNaming_CylinderDriver::Validate(occ::handle&) const {} +void DNaming_CylinderDriver::Validate(const occ::handle&) const {} //======================================================================= // function : MustExecute diff --git a/src/Draw/TKDCAF/DNaming/DNaming_CylinderDriver.hxx b/src/Draw/TKDCAF/DNaming/DNaming_CylinderDriver.hxx index e7c65b2657..baeb9cb2f4 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_CylinderDriver.hxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_CylinderDriver.hxx @@ -41,7 +41,7 @@ public: //! the valid label scope. //! execution of function //! ====================== - Standard_EXPORT void Validate(occ::handle& theLog) const override; + Standard_EXPORT void Validate(const occ::handle& theLog) const override; //! Analyse in if the loaded function must be executed //! (i.e.arguments are modified) or not. diff --git a/src/Draw/TKDCAF/DNaming/DNaming_FilletDriver.cxx b/src/Draw/TKDCAF/DNaming/DNaming_FilletDriver.cxx index efd478c3e2..ebd7eac399 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_FilletDriver.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_FilletDriver.cxx @@ -47,7 +47,7 @@ DNaming_FilletDriver::DNaming_FilletDriver() = default; // function : Validate // purpose : Validates labels of a function in . //======================================================================= -void DNaming_FilletDriver::Validate(occ::handle&) const {} +void DNaming_FilletDriver::Validate(const occ::handle&) const {} //======================================================================= // function : MustExecute diff --git a/src/Draw/TKDCAF/DNaming/DNaming_FilletDriver.hxx b/src/Draw/TKDCAF/DNaming/DNaming_FilletDriver.hxx index b3da9a643d..d1badc3434 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_FilletDriver.hxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_FilletDriver.hxx @@ -41,7 +41,7 @@ public: //! the valid label scope. //! execution of function //! ====================== - Standard_EXPORT void Validate(occ::handle& theLog) const override; + Standard_EXPORT void Validate(const occ::handle& theLog) const override; //! Analyse in if the loaded function must be executed //! (i.e.arguments are modified) or not. diff --git a/src/Draw/TKDCAF/DNaming/DNaming_Line3DDriver.cxx b/src/Draw/TKDCAF/DNaming/DNaming_Line3DDriver.cxx index e868bd1467..3660e9fc7b 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_Line3DDriver.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_Line3DDriver.cxx @@ -51,7 +51,7 @@ DNaming_Line3DDriver::DNaming_Line3DDriver() = default; // function : Validate // purpose : Validates labels of a function in . //======================================================================= -void DNaming_Line3DDriver::Validate(occ::handle&) const {} +void DNaming_Line3DDriver::Validate(const occ::handle&) const {} //======================================================================= // function : MustExecute diff --git a/src/Draw/TKDCAF/DNaming/DNaming_Line3DDriver.hxx b/src/Draw/TKDCAF/DNaming/DNaming_Line3DDriver.hxx index 3372f65aba..52e816043c 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_Line3DDriver.hxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_Line3DDriver.hxx @@ -43,7 +43,7 @@ public: //! the valid label scope. //! execution of function //! ====================== - Standard_EXPORT void Validate(occ::handle& theLog) const override; + Standard_EXPORT void Validate(const occ::handle& theLog) const override; //! Analyse in if the loaded function must be executed //! (i.e.arguments are modified) or not. diff --git a/src/Draw/TKDCAF/DNaming/DNaming_PointDriver.cxx b/src/Draw/TKDCAF/DNaming/DNaming_PointDriver.cxx index 3d934a5335..9f4c3b1a8d 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_PointDriver.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_PointDriver.cxx @@ -44,7 +44,7 @@ DNaming_PointDriver::DNaming_PointDriver() = default; // function : Validate // purpose : Validates labels of a function in . //======================================================================= -void DNaming_PointDriver::Validate(occ::handle&) const {} +void DNaming_PointDriver::Validate(const occ::handle&) const {} //======================================================================= // function : MustExecute diff --git a/src/Draw/TKDCAF/DNaming/DNaming_PointDriver.hxx b/src/Draw/TKDCAF/DNaming/DNaming_PointDriver.hxx index 0a2db93d8e..f2b35dae80 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_PointDriver.hxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_PointDriver.hxx @@ -39,7 +39,7 @@ public: //! the valid label scope. //! execution of function //! ====================== - Standard_EXPORT void Validate(occ::handle& theLog) const override; + Standard_EXPORT void Validate(const occ::handle& theLog) const override; //! Analyse in if the loaded function must be executed //! (i.e.arguments are modified) or not. diff --git a/src/Draw/TKDCAF/DNaming/DNaming_PrismDriver.cxx b/src/Draw/TKDCAF/DNaming/DNaming_PrismDriver.cxx index 34c60f3fa3..696b77acd0 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_PrismDriver.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_PrismDriver.cxx @@ -58,7 +58,7 @@ DNaming_PrismDriver::DNaming_PrismDriver() = default; // function : Validate // purpose : Validates labels of a function in . //======================================================================= -void DNaming_PrismDriver::Validate(occ::handle&) const {} +void DNaming_PrismDriver::Validate(const occ::handle&) const {} //======================================================================= // function : MustExecute diff --git a/src/Draw/TKDCAF/DNaming/DNaming_PrismDriver.hxx b/src/Draw/TKDCAF/DNaming/DNaming_PrismDriver.hxx index 761deb5b4f..2f11753697 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_PrismDriver.hxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_PrismDriver.hxx @@ -41,7 +41,7 @@ public: //! the valid label scope. //! execution of function //! ====================== - Standard_EXPORT void Validate(occ::handle& theLog) const override; + Standard_EXPORT void Validate(const occ::handle& theLog) const override; //! Analyse in if the loaded function must be executed //! (i.e.arguments are modified) or not. diff --git a/src/Draw/TKDCAF/DNaming/DNaming_RevolutionDriver.cxx b/src/Draw/TKDCAF/DNaming/DNaming_RevolutionDriver.cxx index 826ba151d4..942bb016e5 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_RevolutionDriver.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_RevolutionDriver.cxx @@ -59,7 +59,7 @@ DNaming_RevolutionDriver::DNaming_RevolutionDriver() = default; // function : Validate // purpose : Validates labels of a function in . //======================================================================= -void DNaming_RevolutionDriver::Validate(occ::handle&) const {} +void DNaming_RevolutionDriver::Validate(const occ::handle&) const {} //======================================================================= // function : MustExecute diff --git a/src/Draw/TKDCAF/DNaming/DNaming_RevolutionDriver.hxx b/src/Draw/TKDCAF/DNaming/DNaming_RevolutionDriver.hxx index fa80232244..dec2faf410 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_RevolutionDriver.hxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_RevolutionDriver.hxx @@ -41,7 +41,7 @@ public: //! the valid label scope. //! execution of function //! ====================== - Standard_EXPORT void Validate(occ::handle& theLog) const override; + Standard_EXPORT void Validate(const occ::handle& theLog) const override; //! Analyse in if the loaded function must be executed //! (i.e.arguments are modified) or not. diff --git a/src/Draw/TKDCAF/DNaming/DNaming_SelectionDriver.cxx b/src/Draw/TKDCAF/DNaming/DNaming_SelectionDriver.cxx index 75766ac5e8..bb6a97bbf8 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_SelectionDriver.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_SelectionDriver.cxx @@ -40,7 +40,7 @@ DNaming_SelectionDriver::DNaming_SelectionDriver() = default; // function : Validate // purpose : Validates labels of a function in . //======================================================================= -void DNaming_SelectionDriver::Validate(occ::handle&) const {} +void DNaming_SelectionDriver::Validate(const occ::handle&) const {} //======================================================================= // function : MustExecute diff --git a/src/Draw/TKDCAF/DNaming/DNaming_SelectionDriver.hxx b/src/Draw/TKDCAF/DNaming/DNaming_SelectionDriver.hxx index 992dd4ba1f..a4c706e534 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_SelectionDriver.hxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_SelectionDriver.hxx @@ -37,7 +37,7 @@ public: //! the valid label scope. //! execution of function //! ====================== - Standard_EXPORT void Validate(occ::handle& theLog) const override; + Standard_EXPORT void Validate(const occ::handle& theLog) const override; //! Analyse in if the loaded function must be executed //! (i.e.arguments are modified) or not. diff --git a/src/Draw/TKDCAF/DNaming/DNaming_SphereDriver.cxx b/src/Draw/TKDCAF/DNaming/DNaming_SphereDriver.cxx index e3ac8b11a4..c8c98995eb 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_SphereDriver.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_SphereDriver.cxx @@ -52,7 +52,7 @@ DNaming_SphereDriver::DNaming_SphereDriver() = default; // function : Validate // purpose : Validates labels of a function in //======================================================================= -void DNaming_SphereDriver::Validate(occ::handle&) const {} +void DNaming_SphereDriver::Validate(const occ::handle&) const {} //======================================================================= // function : MustExecute diff --git a/src/Draw/TKDCAF/DNaming/DNaming_SphereDriver.hxx b/src/Draw/TKDCAF/DNaming/DNaming_SphereDriver.hxx index 6d88df9fea..12529a097f 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_SphereDriver.hxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_SphereDriver.hxx @@ -40,7 +40,7 @@ public: //! the valid label scope. //! execution of function //! ====================== - Standard_EXPORT void Validate(occ::handle& theLog) const override; + Standard_EXPORT void Validate(const occ::handle& theLog) const override; //! Analyse in if the loaded function must be executed //! (i.e.arguments are modified) or not. diff --git a/src/Draw/TKDCAF/DNaming/DNaming_TransformationDriver.cxx b/src/Draw/TKDCAF/DNaming/DNaming_TransformationDriver.cxx index f8feb74363..e1c80ba59f 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_TransformationDriver.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_TransformationDriver.cxx @@ -76,7 +76,7 @@ DNaming_TransformationDriver::DNaming_TransformationDriver() = default; // function : Validate // purpose : Validates labels of a function in . //======================================================================= -void DNaming_TransformationDriver::Validate(occ::handle&) const {} +void DNaming_TransformationDriver::Validate(const occ::handle&) const {} //======================================================================= // function : MustExecute diff --git a/src/Draw/TKDCAF/DNaming/DNaming_TransformationDriver.hxx b/src/Draw/TKDCAF/DNaming/DNaming_TransformationDriver.hxx index c806591272..ca28ce3d20 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_TransformationDriver.hxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_TransformationDriver.hxx @@ -41,7 +41,7 @@ public: //! the valid label scope. //! execution of function //! ====================== - Standard_EXPORT void Validate(occ::handle& theLog) const override; + Standard_EXPORT void Validate(const occ::handle& theLog) const override; //! Analyse in if the loaded function must be executed //! (i.e.arguments are modified) or not. diff --git a/src/Draw/TKTopTest/BRepTest/BRepTest_FilletCommands.cxx b/src/Draw/TKTopTest/BRepTest/BRepTest_FilletCommands.cxx index 0d8ebaa8c6..54881b327c 100644 --- a/src/Draw/TKTopTest/BRepTest/BRepTest_FilletCommands.cxx +++ b/src/Draw/TKTopTest/BRepTest/BRepTest_FilletCommands.cxx @@ -642,8 +642,7 @@ static int blend1(Draw_Interpretor& di, int narg, const char** a) int s = aRakk.NbSection(i); for (j = 1; j <= s; j++) { - occ::handle Sec; - aRakk.Section(i, j, Sec); + const occ::handle Sec = aRakk.Section(i, j); Sprintf(localname, "%s%d%d", "sec", i, j); temp = localname; DrawTrSurf::Set(temp, Sec); diff --git a/src/Draw/TKTopTest/SWDRAW/SWDRAW_ShapeFix.cxx b/src/Draw/TKTopTest/SWDRAW/SWDRAW_ShapeFix.cxx index f03acf5a1b..c7fb82ed8f 100644 --- a/src/Draw/TKTopTest/SWDRAW/SWDRAW_ShapeFix.cxx +++ b/src/Draw/TKTopTest/SWDRAW/SWDRAW_ShapeFix.cxx @@ -975,8 +975,7 @@ static int connectedges(Draw_Interpretor& di, int n, const char** a) TopExp_Explorer aExpE(aSh1, TopAbs_EDGE); occ::handle> aSeqEdges = new NCollection_HSequence; - occ::handle> aSeqWires = - new NCollection_HSequence; + occ::handle> aSeqWires; NCollection_IndexedMap aMapEdges; for (; aExpE.More(); aExpE.Next()) { @@ -984,7 +983,7 @@ static int connectedges(Draw_Interpretor& di, int n, const char** a) aMapEdges.Add(aExpE.Current()); } - ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdges, aTol, shared, aSeqWires); + aSeqWires = ShapeAnalysis_FreeBounds::ConnectEdgesToWires(aSeqEdges, aTol, shared); TopoDS_Compound aComp; BRep_Builder aB; aB.MakeCompound(aComp); diff --git a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_PaveFiller_3.cxx b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_PaveFiller_3.cxx index 2d6e84a668..98a42a410e 100644 --- a/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_PaveFiller_3.cxx +++ b/src/ModelingAlgorithms/TKBO/BOPAlgo/BOPAlgo_PaveFiller_3.cxx @@ -569,9 +569,9 @@ void BOPAlgo_PaveFiller::PerformEE(const Message_ProgressRange& theRange) int aNbV = aMVCPB.Extent(); for (i = 1; i <= aNbV; ++i) { - occ::handle aPB1, aPB2; - const BOPDS_CoupleOfPaveBlocks& aCPB = aMVCPB.FindFromIndex(i); - aCPB.PaveBlocks(aPB1, aPB2); + const BOPDS_CoupleOfPaveBlocks& aCPB = aMVCPB.FindFromIndex(i); + const occ::handle& aPB1 = aCPB.PaveBlock1(); + const occ::handle& aPB2 = aCPB.PaveBlock2(); // aMEdges.Remove(aPB1->OriginalEdge()); aMEdges.Remove(aPB2->OriginalEdge()); @@ -661,8 +661,9 @@ void BOPAlgo_PaveFiller::PerformNewVertices( const BOPDS_CoupleOfPaveBlocks& aCPB = theMVCPB.FindFromIndex(i); int iV = aCPB.Index(); // - occ::handle aPB[2]; - aCPB.PaveBlocks(aPB[0], aPB[1]); + const occ::handle& aPB1 = aCPB.PaveBlock1(); + const occ::handle& aPB2 = aCPB.PaveBlock2(); + const occ::handle aPB[] = {aPB1, aPB2}; for (int j = 0; j < 2; ++j) { NCollection_List* pLI = aMPBLI.ChangeSeek(aPB[j]); diff --git a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_CoupleOfPaveBlocks.hxx b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_CoupleOfPaveBlocks.hxx index f9346713b3..ef2f717bc3 100644 --- a/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_CoupleOfPaveBlocks.hxx +++ b/src/ModelingAlgorithms/TKBO/BOPDS/BOPDS_CoupleOfPaveBlocks.hxx @@ -17,21 +17,11 @@ #include -/** - * The Class BOPDS_CoupleOfPaveBlocks is to store - * the information about two pave blocks - * and some satellite information - * - */ - -//================================================================================================= - +//! Stores information about two pave blocks and satellite data. class BOPDS_CoupleOfPaveBlocks { public: - /** - * Constructor - */ + //! Default constructor. BOPDS_CoupleOfPaveBlocks() : myIndexInterf(-1), myIndex(-1), @@ -39,14 +29,9 @@ public: { } - // - /** - * Constructor - * @param thePB1 - * first pave block - * @param thePB2 - * secondt pave block - */ + //! Constructor with two pave blocks. + //! @param[in] thePB1 first pave block + //! @param[in] thePB2 second pave block BOPDS_CoupleOfPaveBlocks(const occ::handle& thePB1, const occ::handle& thePB2) : myIndexInterf(-1), @@ -56,52 +41,27 @@ public: SetPaveBlocks(thePB1, thePB2); } - // - /** - * Destructor - */ ~BOPDS_CoupleOfPaveBlocks() = default; - // - /** - * Sets an index - * @param theIndex - * index - */ + //! Sets the index. + //! @param[in] theIndex the index void SetIndex(const int theIndex) { myIndex = theIndex; } - // - /** - * Returns the index - * @return - * index - */ + //! Returns the index. + //! @return the index int Index() const { return myIndex; } - // - /** - * Sets an index of an interference - * @param theIndex - * index of an interference - */ + //! Sets the index of an interference. + //! @param[in] theIndex index of an interference void SetIndexInterf(const int theIndex) { myIndexInterf = theIndex; } - // - /** - * Returns the index of an interference - * @return - * index of an interference - */ + //! Returns the index of an interference. + //! @return index of an interference int IndexInterf() const { return myIndexInterf; } - // - /** - * Sets pave blocks - * @param thePB1 - * first pave block - * @param thePB2 - * secondt pave block - */ + //! Sets both pave blocks. + //! @param[in] thePB1 first pave block + //! @param[in] thePB2 second pave block void SetPaveBlocks(const occ::handle& thePB1, const occ::handle& thePB2) { @@ -109,60 +69,36 @@ public: myPB[1] = thePB2; } - // - /** - * Returns pave blocks - * @param thePB1 - * the first pave block - * @param thePB2 - * the second pave block - */ + //! @deprecated Use PaveBlock1() and PaveBlock2() instead. + Standard_DEPRECATED("Use PaveBlock1() and PaveBlock2() instead") void PaveBlocks(occ::handle& thePB1, occ::handle& thePB2) const { - thePB1 = myPB[0]; - thePB2 = myPB[1]; + thePB1 = PaveBlock1(); + thePB2 = PaveBlock2(); } - // - /** - * Sets the first pave block - * @param thePB - * the first pave block - */ + //! Sets the first pave block. + //! @param[in] thePB the first pave block void SetPaveBlock1(const occ::handle& thePB) { myPB[0] = thePB; } - /** - * Returns the first pave block - * @return - * the first pave block - */ + //! Returns the first pave block. + //! @return handle to the first pave block const occ::handle& PaveBlock1() const { return myPB[0]; } - // - /** - * Sets the second pave block - * @param thePB - * the second pave block - */ + //! Sets the second pave block. + //! @param[in] thePB the second pave block void SetPaveBlock2(const occ::handle& thePB) { myPB[1] = thePB; } - // - /** - * Returns the second pave block - * @return - * the second pave block - */ + //! Returns the second pave block. + //! @return handle to the second pave block const occ::handle& PaveBlock2() const { return myPB[1]; } - /** - * Sets the tolerance associated with this couple - */ + //! Sets the tolerance associated with this couple. + //! @param[in] theTol the tolerance value void SetTolerance(const double theTol) { myTolerance = theTol; } - // - /** - * Returns the tolerance associated with this couple - */ + //! Returns the tolerance associated with this couple. + //! @return the tolerance value double Tolerance() const { return myTolerance; } protected: @@ -172,5 +108,4 @@ protected: double myTolerance; }; -// #endif diff --git a/src/ModelingAlgorithms/TKBool/BRepProj/BRepProj_Projection.cxx b/src/ModelingAlgorithms/TKBool/BRepProj/BRepProj_Projection.cxx index 393ea595e0..047ccb3e91 100644 --- a/src/ModelingAlgorithms/TKBool/BRepProj/BRepProj_Projection.cxx +++ b/src/ModelingAlgorithms/TKBool/BRepProj/BRepProj_Projection.cxx @@ -132,8 +132,8 @@ void BRepProj_Projection::BuildSection(const TopoDS_Shape& theShape, const TopoD return; // connect edges to wires using ShapeAnalysis functionality - ShapeAnalysis_FreeBounds::ConnectEdgesToWires(anEdges, Precision::Confusion(), true, mySection); - myIsDone = (!mySection.IsNull() && mySection->Length() > 0); + mySection = ShapeAnalysis_FreeBounds::ConnectEdgesToWires(anEdges, Precision::Confusion(), true); + myIsDone = (!mySection.IsNull() && mySection->Length() > 0); // collect all resulting wires to compound if (myIsDone) diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Curve.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Curve.cxx index e0138b560f..f1f446ab47 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Curve.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Curve.cxx @@ -80,11 +80,11 @@ void TopOpeBRepDS_Curve::SetSCI(const occ::handle& SC //================================================================================================= -void TopOpeBRepDS_Curve::GetSCI(occ::handle& SCI1, - occ::handle& SCI2) const +void TopOpeBRepDS_Curve::GetSCI(occ::handle& theI1, + occ::handle& theI2) const { - SCI1 = mySCI1; - SCI2 = mySCI2; + theI1 = GetSCI1(); + theI2 = GetSCI2(); } //================================================================================================= diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Curve.hxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Curve.hxx index 8726887f08..dea24995c5 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Curve.hxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_Curve.hxx @@ -50,12 +50,18 @@ public: Standard_EXPORT void SetSCI(const occ::handle& I1, const occ::handle& I2); + //! Returns the first surface-curve interference. + //! @return handle to the first interference Standard_EXPORT const occ::handle& GetSCI1() const; + //! Returns the second surface-curve interference. + //! @return handle to the second interference Standard_EXPORT const occ::handle& GetSCI2() const; - Standard_EXPORT void GetSCI(occ::handle& I1, - occ::handle& I2) const; + //! @deprecated Use GetSCI1() and GetSCI2() instead. + Standard_DEPRECATED("Use GetSCI1() and GetSCI2() instead") + Standard_EXPORT void GetSCI(occ::handle& theI1, + occ::handle& theI2) const; Standard_EXPORT void SetShapes(const TopoDS_Shape& S1, const TopoDS_Shape& S2); diff --git a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_DataStructure.cxx b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_DataStructure.cxx index f72a5c1d20..5f4b2e7bbb 100644 --- a/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_DataStructure.cxx +++ b/src/ModelingAlgorithms/TKBool/TopOpeBRepDS/TopOpeBRepDS_DataStructure.cxx @@ -135,8 +135,8 @@ void TopOpeBRepDS_DataStructure::RemoveCurve(const int I) TopoDS_Shape S1, S2; C.GetShapes(S1, S2); - occ::handle I1, I2; - C.GetSCI(I1, I2); + const occ::handle& I1 = C.GetSCI1(); + const occ::handle& I2 = C.GetSCI2(); if (!I1.IsNull()) RemoveShapeInterference(S1, I1); if (!I2.IsNull()) diff --git a/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_Builder.cxx b/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_Builder.cxx index 0d2939feb3..b5de4c5294 100644 --- a/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_Builder.cxx +++ b/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_Builder.cxx @@ -316,9 +316,8 @@ int FilletSurf_Builder::NbSection(const int IndexSurf) const // IndexSec of SurfaceFillet(IndexSurf) (The basis curve of the // trimmed curve is a Geom_Circle) //======================================================================= -void FilletSurf_Builder::Section(const int IndexSurf, - const int IndexSec, - occ::handle& Circ) const +occ::handle FilletSurf_Builder::Section(const int IndexSurf, + const int IndexSec) const { if ((IndexSurf < 1) || (IndexSurf > NbSurface())) throw Standard_OutOfRange("FilletSurf_Builder::Section NbSurface"); @@ -326,6 +325,12 @@ void FilletSurf_Builder::Section(const int IndexSurf, else if ((IndexSec < 1) || (IndexSec > NbSection(IndexSurf))) throw Standard_OutOfRange("FilletSurf_Builder::Section NbSection"); - else - myIntBuild.Section(IndexSurf, IndexSec, Circ); + return myIntBuild.Section(IndexSurf, IndexSec); +} + +void FilletSurf_Builder::Section(const int IndexSurf, + const int IndexSec, + occ::handle& Circ) const +{ + Circ = Section(IndexSurf, IndexSec); } diff --git a/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_Builder.hxx b/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_Builder.hxx index a70a23dddd..dbd5ec8248 100644 --- a/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_Builder.hxx +++ b/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_Builder.hxx @@ -89,6 +89,20 @@ public: //! gives the number of NUBS surfaces of the Fillet. Standard_EXPORT int NbSurface() const; + //! Returns the arc of the section of index IndexSec of surface + //! of index IndexSurf. The basis curve of the trimmed curve is a Geom_Circle. + //! @param[in] IndexSurf 1-based surface index + //! @param[in] IndexSec 1-based section index + //! @return the section as a trimmed circular arc + [[nodiscard]] Standard_EXPORT occ::handle Section(const int IndexSurf, + const int IndexSec) const; + + //! @deprecated Use Section() returning handle by value instead. + Standard_DEPRECATED("Use Section() returning handle by value instead") + Standard_EXPORT void Section(const int IndexSurf, + const int IndexSec, + occ::handle& Circ) const; + //! gives the NUBS surface of index Index. Standard_EXPORT const occ::handle& SurfaceFillet(const int Index) const; @@ -132,10 +146,6 @@ public: Standard_EXPORT int NbSection(const int IndexSurf) const; - Standard_EXPORT void Section(const int IndexSurf, - const int IndexSec, - occ::handle& Circ) const; - private: FilletSurf_InternalBuilder myIntBuild; FilletSurf_StatusDone myisdone; diff --git a/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_InternalBuilder.cxx b/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_InternalBuilder.cxx index 3cca3f41ae..830de6ab3e 100644 --- a/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_InternalBuilder.cxx +++ b/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_InternalBuilder.cxx @@ -821,13 +821,19 @@ int FilletSurf_InternalBuilder::NbSection(const int IndexSurf) const // IndexSec of SurfaceFillet(IndexSurf) (The basis curve of the // trimmed curve is a Geom_Circle) //======================================================================= -void FilletSurf_InternalBuilder::Section(const int IndexSurf, - const int IndexSec, - occ::handle& Circ) const +occ::handle FilletSurf_InternalBuilder::Section(const int IndexSurf, + const int IndexSec) const { gp_Circ c; double deb, fin; Sect(1, IndexSurf)->Value(IndexSec).Get(c, deb, fin); occ::handle Gc = new Geom_Circle(c); - Circ = new Geom_TrimmedCurve(Gc, deb, fin); + return new Geom_TrimmedCurve(Gc, deb, fin); +} + +void FilletSurf_InternalBuilder::Section(const int IndexSurf, + const int IndexSec, + occ::handle& Circ) const +{ + Circ = Section(IndexSurf, IndexSec); } diff --git a/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_InternalBuilder.hxx b/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_InternalBuilder.hxx index 2dfc844430..690a2b4283 100644 --- a/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_InternalBuilder.hxx +++ b/src/ModelingAlgorithms/TKFillet/FilletSurf/FilletSurf_InternalBuilder.hxx @@ -111,6 +111,16 @@ public: Standard_EXPORT int NbSection(const int IndexSurf) const; + //! Returns the arc of the section of index IndexSec of surface + //! of index IndexSurf. The basis curve of the trimmed curve is a Geom_Circle. + //! @param[in] IndexSurf 1-based surface index + //! @param[in] IndexSec 1-based section index + //! @return the section as a trimmed circular arc + [[nodiscard]] Standard_EXPORT occ::handle Section(const int IndexSurf, + const int IndexSec) const; + + //! @deprecated Use Section() returning handle by value instead. + Standard_DEPRECATED("Use Section() returning handle by value instead") Standard_EXPORT void Section(const int IndexSurf, const int IndexSec, occ::handle& Circ) const; diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntCurveSurface/IntCurveSurface_TheHCurveTool.cxx b/src/ModelingAlgorithms/TKGeomAlgo/IntCurveSurface/IntCurveSurface_TheHCurveTool.cxx index fccc97c065..b50371e346 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntCurveSurface/IntCurveSurface_TheHCurveTool.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntCurveSurface/IntCurveSurface_TheHCurveTool.cxx @@ -59,16 +59,17 @@ int IntCurveSurface_TheHCurveTool::NbSamples(const occ::handle& return ((int)nbs); } -void IntCurveSurface_TheHCurveTool::SamplePars(const occ::handle& C, - const double U0, - const double U1, - const double Defl, - const int NbMin, - occ::handle>& Pars) +occ::handle> IntCurveSurface_TheHCurveTool::SamplePars( + const occ::handle& C, + const double U0, + const double U1, + const double Defl, + const int NbMin) { - GeomAbs_CurveType typC = C->GetType(); - const double nbsOther = 10.0; - double nbs = nbsOther; + occ::handle> Pars; + GeomAbs_CurveType typC = C->GetType(); + const double nbsOther = 10.0; + double nbs = nbsOther; if (typC == GeomAbs_Line) nbs = 2; @@ -94,7 +95,7 @@ void IntCurveSurface_TheHCurveTool::SamplePars(const occ::handleSetValue(i, u); } - return; + return Pars; } const occ::handle& aBC = C->BSpline(); @@ -257,7 +258,7 @@ void IntCurveSurface_TheHCurveTool::SamplePars(const occ::handleSetValue(i, t1); } - return; + return Pars; } Pars = new NCollection_HArray1(1, NbSamples); @@ -270,4 +271,17 @@ void IntCurveSurface_TheHCurveTool::SamplePars(const occ::handleSetValue(j, aPars(i)); } } + return Pars; +} + +//================================================================================================= + +void IntCurveSurface_TheHCurveTool::SamplePars(const occ::handle& C, + const double U0, + const double U1, + const double Defl, + const int NbMin, + occ::handle>& Pars) +{ + Pars = SamplePars(C, U0, U1, Defl, NbMin); } diff --git a/src/ModelingAlgorithms/TKGeomAlgo/IntCurveSurface/IntCurveSurface_TheHCurveTool.hxx b/src/ModelingAlgorithms/TKGeomAlgo/IntCurveSurface/IntCurveSurface_TheHCurveTool.hxx index 4a357aaed6..65ce93850b 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/IntCurveSurface/IntCurveSurface_TheHCurveTool.hxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/IntCurveSurface/IntCurveSurface_TheHCurveTool.hxx @@ -165,6 +165,23 @@ public: const double U0, const double U1); + //! Returns sample parameters for the curve within [U0, U1] range, + //! computed based on deflection and minimum number of points. + //! @param[in] C the curve adaptor + //! @param[in] U0 start parameter + //! @param[in] U1 end parameter + //! @param[in] Defl deflection tolerance + //! @param[in] NbMin minimum number of sample points + //! @return array of sample parameter values + [[nodiscard]] Standard_EXPORT static occ::handle> SamplePars( + const occ::handle& C, + const double U0, + const double U1, + const double Defl, + const int NbMin); + + //! @deprecated Use SamplePars() returning handle by value instead. + Standard_DEPRECATED("Use SamplePars() returning handle by value instead") Standard_EXPORT static void SamplePars(const occ::handle& C, const double U0, const double U1, diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.cxx b/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.cxx index cfb23b8b5b..7f40c97662 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.cxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.cxx @@ -1180,18 +1180,25 @@ gp_XYZ Plate_Plate::EvaluateDerivative(const gp_XY& point2d, const int iu, const // the polynomial part of the Plate function //======================================================================= -void Plate_Plate::CoefPol(occ::handle>& Coefs) const +occ::handle> Plate_Plate::CoefPol() const { - Coefs = new NCollection_HArray2(0, order - 1, 0, order - 1, gp_XYZ(0., 0., 0.)); + occ::handle> aCoefs = + new NCollection_HArray2(0, order - 1, 0, order - 1, gp_XYZ(0., 0., 0.)); int i = n_el; for (int iu = 0; iu < order; iu++) for (int iv = 0; iu + iv < order; iv++) { - Coefs->ChangeValue(iu, iv) = Solution(i) * ddu[iu] * ddv[iv]; + aCoefs->ChangeValue(iu, iv) = Solution(i) * ddu[iu] * ddv[iv]; // Coefs->ChangeValue(idu,idv) = Solution(i); // it is necessary to reset this line if one remove factors in method Polm. i++; } + return aCoefs; +} + +void Plate_Plate::CoefPol(occ::handle>& Coefs) const +{ + Coefs = CoefPol(); } //======================================================================= diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.hxx b/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.hxx index 41fe645673..5fcb4e90f2 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.hxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Plate/Plate_Plate.hxx @@ -98,6 +98,12 @@ public: Standard_EXPORT gp_XYZ EvaluateDerivative(const gp_XY& point2d, const int iu, const int iv) const; + //! Returns the coefficients of the polynomial part of the Plate function. + //! @return 2D array of polynomial coefficients as XYZ values + [[nodiscard]] Standard_EXPORT occ::handle> CoefPol() const; + + //! @deprecated Use CoefPol() returning handle by value instead. + Standard_DEPRECATED("Use CoefPol() returning handle by value instead") Standard_EXPORT void CoefPol(occ::handle>& Coefs) const; Standard_EXPORT void SetPolynomialPartOnly(const bool PPOnly = true); diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_LineTool.hxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_LineTool.hxx index a7c7e5eff7..ae97b4d632 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_LineTool.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_LineTool.hxx @@ -153,6 +153,21 @@ public: static int NbSamples(const gp_Lin& C, const double U0, const double U1); + //! Returns sample parameters for the line within [U0, U1] range. + //! @param[in] C the line + //! @param[in] U0 start parameter + //! @param[in] U1 end parameter + //! @param[in] Defl deflection tolerance (unused for lines) + //! @param[in] NbMin minimum number of sample points (unused for lines) + //! @return array of 3 sample parameter values + [[nodiscard]] static occ::handle> SamplePars(const gp_Lin& C, + const double U0, + const double U1, + const double Defl, + const int NbMin); + + //! @deprecated Use SamplePars() returning handle by value instead. + Standard_DEPRECATED("Use SamplePars() returning handle by value instead") static void SamplePars(const gp_Lin& C, const double U0, const double U1, diff --git a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_LineTool.lxx b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_LineTool.lxx index f73f620630..9e46f7d5d1 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_LineTool.lxx +++ b/src/ModelingAlgorithms/TKHLR/HLRBRep/HLRBRep_LineTool.lxx @@ -205,17 +205,25 @@ inline int HLRBRep_LineTool::NbSamples(const gp_Lin&, const double, const double return 3; } -// modified by NIZHNY-MKK Tue Nov 1 18:49:28 2005 -inline void HLRBRep_LineTool::SamplePars(const gp_Lin&, - const double U0, - const double U1, - const double, - const int, +inline occ::handle> HLRBRep_LineTool::SamplePars(const gp_Lin&, + const double U0, + const double U1, + const double, + const int) +{ + occ::handle> aPars = new NCollection_HArray1(1, 3); + aPars->SetValue(1, U0); + aPars->SetValue(2, (U0 + U1) * 0.5); + aPars->SetValue(3, U1); + return aPars; +} + +inline void HLRBRep_LineTool::SamplePars(const gp_Lin& C, + const double U0, + const double U1, + const double Defl, + const int NbMin, occ::handle>& Pars) { - - Pars = new NCollection_HArray1(1, 3); - Pars->SetValue(1, U0); - Pars->SetValue(2, (U0 + U1) * 0.5); - Pars->SetValue(3, U1); + Pars = SamplePars(C, U0, U1, Defl, NbMin); } diff --git a/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.cxx b/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.cxx index 889bd64fa9..2f1d0e2139 100644 --- a/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.cxx +++ b/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.cxx @@ -4066,7 +4066,7 @@ static bool IsInOut(BRepTopAdaptor_FClass2d& FC, void BRepOffset_Tool::CorrectOrientation( const TopoDS_Shape& SI, const NCollection_IndexedMap& NewEdges, - occ::handle& AsDes, + const occ::handle& AsDes, BRepAlgo_Image& InitOffset, const double Offset) { diff --git a/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.hxx b/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.hxx index 74d0524922..d1e4c1f743 100644 --- a/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.hxx +++ b/src/ModelingAlgorithms/TKOffset/BRepOffset/BRepOffset_Tool.hxx @@ -195,7 +195,7 @@ public: Standard_EXPORT static void CorrectOrientation( const TopoDS_Shape& SI, const NCollection_IndexedMap& NewEdges, - occ::handle& AsDes, + const occ::handle& AsDes, BRepAlgo_Image& InitOffset, const double Offset); diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_FreeBounds.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_FreeBounds.cxx index 0695219a70..02c078b981 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_FreeBounds.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_FreeBounds.cxx @@ -76,7 +76,6 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape, // int nbedge = Sew.NbFreeEdges(); occ::handle> edges = new NCollection_HSequence; - occ::handle> wires; TopoDS_Edge anEdge; for (int iedge = 1; iedge <= nbedge; iedge++) { @@ -87,7 +86,7 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape, // // Chainage. // - ConnectEdgesToWires(edges, toler, false, wires); + occ::handle> wires = ConnectEdgesToWires(edges, toler, false); DispatchWires(wires, myWires, myEdges); SplitWires(); @@ -120,8 +119,8 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape, occ::handle> edges = see.SeqFromCompound(sas.FreeEdges(), false); - occ::handle> wires; - ConnectEdgesToWires(edges, Precision::Confusion(), true, wires); + occ::handle> wires = + ConnectEdgesToWires(edges, Precision::Confusion(), true); DispatchWires(wires, myWires, myEdges); SplitWires(); } @@ -129,11 +128,10 @@ ShapeAnalysis_FreeBounds::ShapeAnalysis_FreeBounds(const TopoDS_Shape& shape, //================================================================================================= -void ShapeAnalysis_FreeBounds::ConnectEdgesToWires( - occ::handle>& edges, - const double toler, - const bool shared, - occ::handle>& wires) +occ::handle> ShapeAnalysis_FreeBounds::ConnectEdgesToWires( + const occ::handle>& edges, + const double toler, + const bool shared) { occ::handle> iwires = new NCollection_HSequence; BRep_Builder B; @@ -147,29 +145,66 @@ void ShapeAnalysis_FreeBounds::ConnectEdgesToWires( iwires->Append(wire); } - ConnectWiresToWires(iwires, toler, shared, wires); + occ::handle> wires = + ConnectWiresToWires(iwires, toler, shared); for (i = 1; i <= edges->Length(); i++) if (iwires->Value(i).Orientation() == TopAbs_REVERSED) edges->ChangeValue(i).Reverse(); + + return wires; } //================================================================================================= -void ShapeAnalysis_FreeBounds::ConnectWiresToWires( - occ::handle>& iwires, - const double toler, - const bool shared, - occ::handle>& owires) +void ShapeAnalysis_FreeBounds::ConnectEdgesToWires( + const occ::handle>& edges, + const double toler, + const bool shared, + occ::handle>& wires) +{ + wires = ConnectEdgesToWires(edges, toler, shared); +} + +//================================================================================================= + +occ::handle> ShapeAnalysis_FreeBounds::ConnectWiresToWires( + const occ::handle>& iwires, + const double toler, + const bool shared) { NCollection_DataMap map; - ConnectWiresToWires(iwires, toler, shared, owires, map); + return ConnectWiresToWires(iwires, toler, shared, map); } //================================================================================================= void ShapeAnalysis_FreeBounds::ConnectWiresToWires( - occ::handle>& iwires, + const occ::handle>& iwires, + const double toler, + const bool shared, + occ::handle>& owires) +{ + owires = ConnectWiresToWires(iwires, toler, shared); +} + +//================================================================================================= + +occ::handle> ShapeAnalysis_FreeBounds::ConnectWiresToWires( + const occ::handle>& iwires, + const double toler, + const bool shared, + NCollection_DataMap& vertices) +{ + occ::handle> owires; + ConnectWiresToWires(iwires, toler, shared, owires, vertices); + return owires; +} + +//================================================================================================= + +void ShapeAnalysis_FreeBounds::ConnectWiresToWires( + const occ::handle>& iwires, const double toler, const bool shared, occ::handle>& owires, @@ -281,7 +316,6 @@ void ShapeAnalysis_FreeBounds::ConnectWiresToWires( { // making wire // 1.providing connection (see ShapeFix_Wire::FixConnected()) - // int i; // svv #1 for (/*int*/ i = 1; i <= saw->NbEdges(); i++) { if (saw->CheckConnected(i)) @@ -291,11 +325,11 @@ void ShapeAnalysis_FreeBounds::ConnectWiresToWires( TopoDS_Edge E1 = sewd->Edge(n1); TopoDS_Edge E2 = sewd->Edge(n2); - TopoDS_Vertex Vprev, Vfol, V; // connection vertex + TopoDS_Vertex Vprev, Vfol, V; Vprev = sae.LastVertex(E1); Vfol = sae.FirstVertex(E2); - if (saw->LastCheckStatus(ShapeExtend_DONE1)) // absolutely confused + if (saw->LastCheckStatus(ShapeExtend_DONE1)) V = Vprev; else { @@ -305,7 +339,6 @@ void ShapeAnalysis_FreeBounds::ConnectWiresToWires( vertices.Bind(Vprev, V); vertices.Bind(Vfol, V); - // replace vertices to a new one ShapeBuild_Edge sbe; if (saw->NbEdges() < 2) sewd->Set(sbe.CopyReplaceVertices(E2, V, V), n2); @@ -318,7 +351,6 @@ void ShapeAnalysis_FreeBounds::ConnectWiresToWires( } } - // 2.making wire TopoDS_Wire wire = sewd->Wire(); if (isUsedManifoldMode) { @@ -327,7 +359,6 @@ void ShapeAnalysis_FreeBounds::ConnectWiresToWires( } else { - // Try to check connection by number of free vertices NCollection_Map vmap; TopoDS_Iterator it(wire); @@ -340,7 +371,6 @@ void ShapeAnalysis_FreeBounds::ConnectWiresToWires( const TopoDS_Shape& V = ite.Value(); if (V.Orientation() == TopAbs_FORWARD || V.Orientation() == TopAbs_REVERSED) { - // add or remove in the vertex map if (!vmap.Add(V)) vmap.Remove(V); } @@ -356,14 +386,12 @@ void ShapeAnalysis_FreeBounds::ConnectWiresToWires( sewd->Clear(); sewd->ManifoldMode() = isUsedManifoldMode; - // Recherche de la premier edge non traitee pour un autre wire. - // Searching for first edge for next wire lwire = -1; for (/*int*/ i = 1; i <= arrwires->Length(); i++) { if (!aSel.ContWire(i)) { - lwire = i; // szv#4:S4163:12Mar99 optimized + lwire = i; sewd->Add(TopoDS::Wire(arrwires->Value(lwire))); aSel.LoadList(lwire); @@ -498,7 +526,7 @@ static void SplitWire(const TopoDS_Wire& wire, if (statuses.Value(i) != 2) edges->Append(sewd->Edge(i)); - ShapeAnalysis_FreeBounds::ConnectEdgesToWires(edges, toler, shared, open); + open = ShapeAnalysis_FreeBounds::ConnectEdgesToWires(edges, toler, shared); } void ShapeAnalysis_FreeBounds::SplitWires( diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_FreeBounds.hxx b/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_FreeBounds.hxx index f184526dce..cddc8582ee 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_FreeBounds.hxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeAnalysis/ShapeAnalysis_FreeBounds.hxx @@ -114,17 +114,41 @@ public: //! adjacent edges share the same vertex. //! If is False connection is performed only when //! ends of adjacent edges are at distance less than . - Standard_EXPORT static void ConnectEdgesToWires( - occ::handle>& edges, - const double toler, - const bool shared, - occ::handle>& wires); + //! Connects edges from the given sequence into wires. + //! @param[in] edges the sequence of edges to connect + //! @param[in] toler distance tolerance for connection + //! @param[in] shared if true, connection uses shared vertices only + //! @return sequence of resulting wires + [[nodiscard]] Standard_EXPORT static occ::handle> + ConnectEdgesToWires(const occ::handle>& edges, + const double toler, + const bool shared); + //! @deprecated Use ConnectEdgesToWires() returning handle by value instead. + Standard_DEPRECATED("Use ConnectEdgesToWires() returning handle by value instead") + Standard_EXPORT static void ConnectEdgesToWires( + const occ::handle>& edges, + const double toler, + const bool shared, + occ::handle>& wires); + + //! Connects wires from the given sequence into longer wires. + //! @param[in] iwires the sequence of input wires + //! @param[in] toler distance tolerance for connection + //! @param[in] shared if true, connection uses shared vertices only + //! @return sequence of resulting wires + [[nodiscard]] Standard_EXPORT static occ::handle> + ConnectWiresToWires(const occ::handle>& iwires, + const double toler, + const bool shared); + + //! @deprecated Use ConnectWiresToWires() returning handle by value instead. + Standard_DEPRECATED("Use ConnectWiresToWires() returning handle by value instead") Standard_EXPORT static void ConnectWiresToWires( - occ::handle>& iwires, - const double toler, - const bool shared, - occ::handle>& owires); + const occ::handle>& iwires, + const double toler, + const bool shared, + occ::handle>& owires); //! Builds sequence of out of sequence of not sorted //! . @@ -139,8 +163,24 @@ public: //! ends of adjacent wires are at distance less than . //! Map stores the correspondence between original //! end vertices of the wires and new connecting vertices. + //! Connects wires from the given sequence into longer wires. + //! Also fills the map of original to new connecting vertices. + //! @param[in] iwires the sequence of input wires + //! @param[in] toler distance tolerance for connection + //! @param[in] shared if true, connection uses shared vertices only + //! @param[out] vertices map of original vertices to new connecting vertices + //! @return sequence of resulting wires + [[nodiscard]] Standard_EXPORT static occ::handle> + ConnectWiresToWires( + const occ::handle>& iwires, + const double toler, + const bool shared, + NCollection_DataMap& vertices); + + //! @deprecated Use ConnectWiresToWires() returning handle by value instead. + Standard_DEPRECATED("Use ConnectWiresToWires() returning handle by value instead") Standard_EXPORT static void ConnectWiresToWires( - occ::handle>& iwires, + const occ::handle>& iwires, const double toler, const bool shared, occ::handle>& owires, diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_FreeBounds.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_FreeBounds.cxx index 0d04d707b1..66dee96bf9 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_FreeBounds.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeFix/ShapeFix_FreeBounds.cxx @@ -91,10 +91,10 @@ bool ShapeFix_FreeBounds::Perform() if (myCloseToler > mySewToler) { ShapeExtend_Explorer see; - occ::handle> newwires, - open = see.SeqFromCompound(myEdges, false); + occ::handle> open = see.SeqFromCompound(myEdges, false); NCollection_DataMap vertices; - ShapeAnalysis_FreeBounds::ConnectWiresToWires(open, myCloseToler, myShared, newwires, vertices); + occ::handle> newwires = + ShapeAnalysis_FreeBounds::ConnectWiresToWires(open, myCloseToler, myShared, vertices); myEdges.Nullify(); ShapeAnalysis_FreeBounds::DispatchWires(newwires, myWires, myEdges); diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp.cxx index 1284491251..87e26ca64a 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp.cxx @@ -141,7 +141,7 @@ void BRepGProp::LinearProperties(const TopoDS_Shape& S, bool IsGeom = BRep_Tool::IsGeometric(aE); if (UseTriangulation || !IsGeom) { - BRepGProp_MeshCinert::PreparePolygon(aE, theNodes); + theNodes = BRepGProp_MeshCinert::PreparePolygon(aE); } if (!theNodes.IsNull()) { diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_Face.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_Face.cxx index ca7f6e595a..410c3b16a8 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_Face.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_Face.cxx @@ -644,6 +644,16 @@ static void GetCurveKnots(const double theMin, //================================================================================================= +occ::handle> BRepGProp_Face::GetUKnots(const double theUMin, + const double theUMax) const +{ + occ::handle> theUKnots; + GetUKnots(theUMin, theUMax, theUKnots); + return theUKnots; +} + +//================================================================================================= + void BRepGProp_Face::GetUKnots(const double theUMin, const double theUMax, occ::handle>& theUKnots) const @@ -705,6 +715,16 @@ void BRepGProp_Face::GetUKnots(const double theUMin //================================================================================================= +occ::handle> BRepGProp_Face::GetTKnots(const double theTMin, + const double theTMax) const +{ + occ::handle> theTKnots; + GetTKnots(theTMin, theTMax, theTKnots); + return theTKnots; +} + +//================================================================================================= + void BRepGProp_Face::GetTKnots(const double theTMin, const double theTMax, occ::handle>& theTKnots) const diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_Face.hxx b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_Face.hxx index 63df4bd921..4d955251f0 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_Face.hxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_Face.hxx @@ -134,6 +134,15 @@ public: //! then theUMin and lower then theUMax in increasing order. //! If the face is not a BSpline, the array initialized with //! theUMin and theUMax only. + //! @param[in] theUMin lower U bound + //! @param[in] theUMax upper U bound + //! @return array of U knot values + [[nodiscard]] Standard_EXPORT occ::handle> GetUKnots( + const double theUMin, + const double theUMax) const; + + //! @deprecated Use GetUKnots() returning handle by value instead. + Standard_DEPRECATED("Use GetUKnots() returning handle by value instead") Standard_EXPORT void GetUKnots(const double theUMin, const double theUMax, occ::handle>& theUKnots) const; @@ -147,6 +156,15 @@ public: //! theTMin and lower then theTMax in increasing order. //! If the face is not a BSpline, the array initialized with //! theTMin and theTMax only. + //! @param[in] theTMin lower T bound + //! @param[in] theTMax upper T bound + //! @return array of T knot values + [[nodiscard]] Standard_EXPORT occ::handle> GetTKnots( + const double theTMin, + const double theTMax) const; + + //! @deprecated Use GetTKnots() returning handle by value instead. + Standard_DEPRECATED("Use GetTKnots() returning handle by value instead") Standard_EXPORT void GetTKnots(const double theTMin, const double theTMax, occ::handle>& theTKnots) const; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_MeshCinert.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_MeshCinert.cxx index 8ec35beb12..241f54e37a 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_MeshCinert.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_MeshCinert.cxx @@ -131,6 +131,16 @@ void BRepGProp_MeshCinert::Perform(const NCollection_Array1& theNodes) //================================================================================================= +occ::handle> BRepGProp_MeshCinert::PreparePolygon( + const TopoDS_Edge& theE) +{ + occ::handle> thePolyg; + PreparePolygon(theE, thePolyg); + return thePolyg; +} + +//================================================================================================= + void BRepGProp_MeshCinert::PreparePolygon(const TopoDS_Edge& theE, occ::handle>& thePolyg) { diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_MeshCinert.hxx b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_MeshCinert.hxx index 196950bcc3..553bfc58d7 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_MeshCinert.hxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_MeshCinert.hxx @@ -43,9 +43,15 @@ public: //! of polylines represented by set of points. Standard_EXPORT void Perform(const NCollection_Array1& theNodes); - //! Prepare set of 3d points on base of any available edge polygons: - //! 3D polygon, polygon on triangulation, 2d polygon on surface - //! If edge has no polygons, array thePolyg is left unchanged + //! Prepares set of 3d points on base of any available edge polygons: + //! 3D polygon, polygon on triangulation, 2d polygon on surface. + //! @param[in] theE the edge to extract polygon from + //! @return array of 3D points, or null handle if edge has no polygons + [[nodiscard]] Standard_EXPORT static occ::handle> PreparePolygon( + const TopoDS_Edge& theE); + + //! @deprecated Use PreparePolygon() returning handle by value instead. + Standard_DEPRECATED("Use PreparePolygon() returning handle by value instead") Standard_EXPORT static void PreparePolygon(const TopoDS_Edge& theE, occ::handle>& thePolyg); }; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_TFunction.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_TFunction.cxx index 1a3e11eefe..26f26ebd3f 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_TFunction.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_TFunction.cxx @@ -56,10 +56,9 @@ bool BRepGProp_TFunction::Value(const double X, double& F) { const double tolU = 1.e-9; - gp_Pnt2d aP2d; - gp_Vec2d aV2d; - double aUMax; - occ::handle> anUKnots; + gp_Pnt2d aP2d; + gp_Vec2d aV2d; + double aUMax; mySurface.D12d(X, aP2d, aV2d); aUMax = aP2d.X(); @@ -70,13 +69,13 @@ bool BRepGProp_TFunction::Value(const double X, double& F) return true; } - mySurface.GetUKnots(myUMin, aUMax, anUKnots); + occ::handle> aUKnots = mySurface.GetUKnots(myUMin, aUMax); myUFunction.SetVParam(aP2d.Y()); // Compute the integral from myUMin to aUMax of myUFunction. int i; double aCoeff = aV2d.Y(); - // int aNbUIntervals = anUKnots->Length() - 1; + // int aNbUIntervals = aUKnots->Length() - 1; // double aTol = myTolerance/aNbUIntervals; double aTol = myTolerance; @@ -116,23 +115,23 @@ bool BRepGProp_TFunction::Value(const double X, double& F) // else // aTol = 0.1; - int iU = anUKnots->Upper(); + int iU = aUKnots->Upper(); int aNbPntsStart; int aNbMaxIter = 1000; math_KronrodSingleIntegration anIntegral; double aLocalErr = 0.; - i = anUKnots->Lower(); + i = aUKnots->Lower(); F = 0.; // Epmirical criterion - aNbPntsStart = std::min(15, mySurface.UIntegrationOrder() / (anUKnots->Length() - 1) + 1); + aNbPntsStart = std::min(15, mySurface.UIntegrationOrder() / (aUKnots->Length() - 1) + 1); aNbPntsStart = std::max(5, aNbPntsStart); while (i < iU) { - double aU1 = anUKnots->Value(i++); - double aU2 = anUKnots->Value(i); + double aU1 = aUKnots->Value(i++); + double aU2 = aUKnots->Value(i); if (aU2 - aU1 < tolU) continue; diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_VinertGK.cxx b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_VinertGK.cxx index ae146c92fa..c21dffba59 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_VinertGK.cxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepGProp/BRepGProp_VinertGK.cxx @@ -354,10 +354,9 @@ double BRepGProp_VinertGK::PrivatePerform(BRepGProp_Face& theSurface, aTMax = theSurface.LastParameter(); // Get the spans on the curve. - occ::handle> aTKnots; BRepGProp_TFunction aTFunc(theSurface, loc, IsByPoint, theCoeffs, aUMin, aCrvTol); - theSurface.GetTKnots(aTMin, aTMax, aTKnots); + occ::handle> aTKnots = theSurface.GetTKnots(aTMin, aTMax); int iU = aTKnots->Upper(); int aNbTIntervals = aTKnots->Length() - 1; diff --git a/src/ModelingData/TKGeomBase/AppDef/AppDef_SmoothCriterion.hxx b/src/ModelingData/TKGeomBase/AppDef/AppDef_SmoothCriterion.hxx index 159854a2cf..3bc3f7a90e 100644 --- a/src/ModelingData/TKGeomBase/AppDef/AppDef_SmoothCriterion.hxx +++ b/src/ModelingData/TKGeomBase/AppDef/AppDef_SmoothCriterion.hxx @@ -40,6 +40,15 @@ public: Standard_EXPORT virtual void SetCurve(const occ::handle& C) = 0; + //! Returns the curve associated with this criterion. + //! @return handle to the FEmTool curve + [[nodiscard]] occ::handle Curve() const + { + occ::handle aCurve; + GetCurve(aCurve); + return aCurve; + } + Standard_EXPORT virtual void GetCurve(occ::handle& C) const = 0; Standard_EXPORT virtual void SetEstimation(const double E1, const double E2, const double E3) = 0; diff --git a/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx b/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx index 8e069da071..a23435df44 100644 --- a/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx +++ b/src/ModelingData/TKGeomBase/AppDef/AppDef_Variational.cxx @@ -1471,7 +1471,7 @@ void AppDef_Variational::Optimization(occ::handle& J, int el, dim; - A.GetAssemblyTable(AssTable); + AssTable = A.AssemblyTable(); int NbConstr = myNbPassPoints + myNbTangPoints + myNbCurvPoints; double CBLONG = J->EstLength(); diff --git a/src/ModelingData/TKGeomBase/FEmTool/FEmTool_Assembly.cxx b/src/ModelingData/TKGeomBase/FEmTool/FEmTool_Assembly.cxx index a82684ff30..b00965b557 100644 --- a/src/ModelingData/TKGeomBase/FEmTool/FEmTool_Assembly.cxx +++ b/src/ModelingData/TKGeomBase/FEmTool/FEmTool_Assembly.cxx @@ -440,7 +440,7 @@ int FEmTool_Assembly::NbGlobVar() const void FEmTool_Assembly::GetAssemblyTable( occ::handle>>>& AssTable) const { - AssTable = myRefTable; + AssTable = AssemblyTable(); } void FEmTool_Assembly::ResetConstraint() diff --git a/src/ModelingData/TKGeomBase/FEmTool/FEmTool_Assembly.hxx b/src/ModelingData/TKGeomBase/FEmTool/FEmTool_Assembly.hxx index 4a7a0907da..db9a28336c 100644 --- a/src/ModelingData/TKGeomBase/FEmTool/FEmTool_Assembly.hxx +++ b/src/ModelingData/TKGeomBase/FEmTool/FEmTool_Assembly.hxx @@ -79,6 +79,17 @@ public: Standard_EXPORT int NbGlobVar() const; + //! Returns the assembly table mapping element-local indices to global indices. + //! @return const reference to the assembly table + [[nodiscard]] const occ::handle>>>& + AssemblyTable() const + { + return myRefTable; + } + + //! Returns the assembly table via output parameter. + //! @deprecated Use AssemblyTable() returning const reference instead. + Standard_DEPRECATED("Use AssemblyTable() returning const reference instead") Standard_EXPORT void GetAssemblyTable( occ::handle>>>& AssTable) const; diff --git a/src/Visualization/TKV3d/AIS/AIS_Line.hxx b/src/Visualization/TKV3d/AIS/AIS_Line.hxx index 649d6e13a6..6be6097c54 100644 --- a/src/Visualization/TKV3d/AIS/AIS_Line.hxx +++ b/src/Visualization/TKV3d/AIS/AIS_Line.hxx @@ -46,22 +46,35 @@ public: //! Constructs an infinite line. const occ::handle& Line() const { return myComponent; } + //! Returns the starting point of the line set by SetPoints. + //! @return handle to the start point + const occ::handle& StartPoint() const { return myStartPoint; } + + //! Returns the end point of the line set by SetPoints. + //! @return handle to the end point + const occ::handle& EndPoint() const { return myEndPoint; } + //! Returns the starting point thePStart and the end point thePEnd of the line set by SetPoints. + //! @deprecated Use StartPoint() and EndPoint() instead. + Standard_DEPRECATED("Use StartPoint() and EndPoint() instead") void Points(occ::handle& thePStart, occ::handle& thePEnd) const { - thePStart = myStartPoint; - thePEnd = myEndPoint; + thePStart = StartPoint(); + thePEnd = EndPoint(); } - //! instantiates an infinite line. + //! Sets the infinite line. + //! @param[in] theLine the geometric line void SetLine(const occ::handle& theLine) { myComponent = theLine; myLineIsSegment = false; } - //! Sets the starting point thePStart and ending point thePEnd of the + //! Sets the starting point and ending point of the //! infinite line to create a finite line segment. + //! @param[in] thePStart the starting point + //! @param[in] thePEnd the ending point void SetPoints(const occ::handle& thePStart, const occ::handle& thePEnd) { myStartPoint = thePStart; diff --git a/src/Visualization/TKV3d/Select3D/Select3D_InteriorSensitivePointSet.cxx b/src/Visualization/TKV3d/Select3D/Select3D_InteriorSensitivePointSet.cxx index fea5ad5f82..245f39d5c3 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_InteriorSensitivePointSet.cxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_InteriorSensitivePointSet.cxx @@ -164,11 +164,10 @@ Select3D_InteriorSensitivePointSet::Select3D_InteriorSensitivePointSet( // ======================================================================= // function : GetPoints -// purpose : Initializes the given array theHArrayOfPnt by 3d +// purpose : Initializes the given array aHArrayOfPnt by 3d // coordinates of vertices of the whole point set // ======================================================================= -void Select3D_InteriorSensitivePointSet::GetPoints( - occ::handle>& theHArrayOfPnt) +occ::handle> Select3D_InteriorSensitivePointSet::GetPoints() const { int aSize = 0; for (int anIdx = 0; anIdx < myPlanarPolygons.Length(); ++anIdx) @@ -177,23 +176,28 @@ void Select3D_InteriorSensitivePointSet::GetPoints( aSize += aPolygon->NbSubElements(); } - theHArrayOfPnt = new NCollection_HArray1(1, aSize); - int anOutputPntArrayIdx = 1; + occ::handle> aHArrayOfPnt = new NCollection_HArray1(1, aSize); + int anOutputPntArrayIdx = 1; for (int aPolygIdx = 0; aPolygIdx < myPlanarPolygons.Length(); ++aPolygIdx) { - const occ::handle& aPolygon = myPlanarPolygons.Value(aPolygIdx); - occ::handle> aPoints; - aPolygon->Points3D(aPoints); - int anUpper = + const occ::handle& aPolygon = myPlanarPolygons.Value(aPolygIdx); + const occ::handle> aPoints = aPolygon->Points3D(); + int anUpper = aPolygIdx < myPlanarPolygons.Length() - 1 ? aPoints->Upper() : aPoints->Upper() + 1; for (int aPntIter = 1; aPntIter < anUpper; ++aPntIter) { - theHArrayOfPnt->SetValue(anOutputPntArrayIdx, aPoints->Value(aPntIter)); + aHArrayOfPnt->SetValue(anOutputPntArrayIdx, aPoints->Value(aPntIter)); anOutputPntArrayIdx++; } - aPoints.Nullify(); } + return aHArrayOfPnt; +} + +void Select3D_InteriorSensitivePointSet::GetPoints( + occ::handle>& aHArrayOfPnt) +{ + aHArrayOfPnt = GetPoints(); } //======================================================================= @@ -249,10 +253,9 @@ bool Select3D_InteriorSensitivePointSet::overlapsElement( int theElemIdx, bool) { - int aPolygIdx = myPolygonsIdxs->Value(theElemIdx); - const occ::handle& aPolygon = myPlanarPolygons.Value(aPolygIdx); - occ::handle> aPoints; - aPolygon->Points3D(aPoints); + int aPolygIdx = myPolygonsIdxs->Value(theElemIdx); + const occ::handle& aPolygon = myPlanarPolygons.Value(aPolygIdx); + const occ::handle> aPoints = aPolygon->Points3D(); return theMgr.OverlapsPolygon(aPoints->Array1(), Select3D_TOS_INTERIOR, thePickResult); } diff --git a/src/Visualization/TKV3d/Select3D/Select3D_InteriorSensitivePointSet.hxx b/src/Visualization/TKV3d/Select3D/Select3D_InteriorSensitivePointSet.hxx index f1419ed9d4..05b063dae7 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_InteriorSensitivePointSet.hxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_InteriorSensitivePointSet.hxx @@ -32,8 +32,14 @@ public: const occ::handle& theOwnerId, const NCollection_Array1& thePoints); + //! Returns 3d coordinates of vertices of the whole point set. + //! @return handle to array of 3D vertex coordinates + [[nodiscard]] Standard_EXPORT occ::handle> GetPoints() const; + //! Initializes the given array theHArrayOfPnt by 3d coordinates of vertices of the //! whole point set + //! @deprecated Use GetPoints() returning handle by value instead. + Standard_DEPRECATED("Use GetPoints() returning handle by value instead") Standard_EXPORT virtual void GetPoints(occ::handle>& theHArrayOfPnt); //! Returns the length of vector of planar convex polygons diff --git a/src/Visualization/TKV3d/Select3D/Select3D_SensitiveFace.cxx b/src/Visualization/TKV3d/Select3D/Select3D_SensitiveFace.cxx index 030fab2331..b6b63ae3ed 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_SensitiveFace.cxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_SensitiveFace.cxx @@ -64,16 +64,19 @@ Select3D_SensitiveFace::Select3D_SensitiveFace( // purpose : Initializes the given array theHArrayOfPnt by 3d // coordinates of vertices of the face //======================================================================= -void Select3D_SensitiveFace::GetPoints(occ::handle>& theHArrayOfPnt) +occ::handle> Select3D_SensitiveFace::GetPoints() const { if (myFacePoints->IsKind(STANDARD_TYPE(Select3D_SensitivePoly))) { - occ::down_cast(myFacePoints)->Points3D(theHArrayOfPnt); - } - else - { - occ::down_cast(myFacePoints)->GetPoints(theHArrayOfPnt); + return occ::down_cast(myFacePoints)->Points3D(); } + + return occ::down_cast(myFacePoints)->GetPoints(); +} + +void Select3D_SensitiveFace::GetPoints(occ::handle>& theHArrayOfPnt) +{ + theHArrayOfPnt = GetPoints(); } //================================================================================================= @@ -98,8 +101,7 @@ bool Select3D_SensitiveFace::Matches(SelectBasics_SelectingVolumeManager& theMgr occ::handle Select3D_SensitiveFace::GetConnected() { // Create a copy of this - occ::handle> aPoints; - GetPoints(aPoints); + const occ::handle> aPoints = GetPoints(); occ::handle aNewEntity = new Select3D_SensitiveFace(myOwnerId, aPoints, mySensType); diff --git a/src/Visualization/TKV3d/Select3D/Select3D_SensitiveFace.hxx b/src/Visualization/TKV3d/Select3D/Select3D_SensitiveFace.hxx index 84ff828f80..3e5b20bfeb 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_SensitiveFace.hxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_SensitiveFace.hxx @@ -47,8 +47,14 @@ public: const occ::handle>& thePoints, const Select3D_TypeOfSensitivity theType); + //! Returns 3d coordinates of vertices of the face. + //! @return handle to array of 3D vertex coordinates + [[nodiscard]] Standard_EXPORT occ::handle> GetPoints() const; + //! Initializes the given array theHArrayOfPnt by 3d //! coordinates of vertices of the face + //! @deprecated Use GetPoints() returning handle by value instead. + Standard_DEPRECATED("Use GetPoints() returning handle by value instead") Standard_EXPORT void GetPoints(occ::handle>& theHArrayOfPnt); //! Checks whether the face overlaps current selecting volume diff --git a/src/Visualization/TKV3d/Select3D/Select3D_SensitivePoly.cxx b/src/Visualization/TKV3d/Select3D/Select3D_SensitivePoly.cxx index dfa6708a30..c0581c97e9 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_SensitivePoly.cxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_SensitivePoly.cxx @@ -235,8 +235,7 @@ bool Select3D_SensitivePoly::Matches(SelectBasics_SelectingVolumeManager& theMgr } else if (mySensType == Select3D_TOS_INTERIOR) { - occ::handle> anArrayOfPnt; - Points3D(anArrayOfPnt); + const occ::handle> anArrayOfPnt = Points3D(); if (!theMgr.IsOverlapAllowed()) { if (theMgr.GetActiveSelectionType() == SelectMgr_SelectionType_Polyline) diff --git a/src/Visualization/TKV3d/Select3D/Select3D_SensitivePoly.hxx b/src/Visualization/TKV3d/Select3D/Select3D_SensitivePoly.hxx index 4a6e2f52c9..47531f82f7 100644 --- a/src/Visualization/TKV3d/Select3D/Select3D_SensitivePoly.hxx +++ b/src/Visualization/TKV3d/Select3D/Select3D_SensitivePoly.hxx @@ -73,14 +73,25 @@ public: Standard_EXPORT int NbSubElements() const override; //! Returns the 3D points of the array used at construction time. - void Points3D(occ::handle>& theHArrayOfPnt) + //! @return handle to array of 3D points + [[nodiscard]] occ::handle> Points3D() const { - int aSize = myPolyg.Size(); - theHArrayOfPnt = new NCollection_HArray1(1, aSize); + int aSize = myPolyg.Size(); + occ::handle> aHArrayOfPnt = + new NCollection_HArray1(1, aSize); for (int anIndex = 1; anIndex <= aSize; anIndex++) { - theHArrayOfPnt->SetValue(anIndex, myPolyg.Pnt(anIndex - 1)); + aHArrayOfPnt->SetValue(anIndex, myPolyg.Pnt(anIndex - 1)); } + return aHArrayOfPnt; + } + + //! Returns the 3D points of the array used at construction time via output parameter. + //! @deprecated Use Points3D() returning handle by value instead. + Standard_DEPRECATED("Use Points3D() returning handle by value instead") + void Points3D(occ::handle>& aHArrayOfPnt) + { + aHArrayOfPnt = Points3D(); } //! Return array bounds. diff --git a/src/Visualization/TKV3d/SelectMgr/SelectMgr.cxx b/src/Visualization/TKV3d/SelectMgr/SelectMgr.cxx index dbd9851d5d..518525e5d6 100644 --- a/src/Visualization/TKV3d/SelectMgr/SelectMgr.cxx +++ b/src/Visualization/TKV3d/SelectMgr/SelectMgr.cxx @@ -220,9 +220,8 @@ void SelectMgr::ComputeSensitivePrs(const occ::handle& else if (occ::handle aFace = occ::down_cast(anEnt)) { - occ::handle> aSensPnts; - aFace->GetPoints(aSensPnts); - occ::handle> aPoints = new NCollection_HSequence(); + const occ::handle> aSensPnts = aFace->GetPoints(); + occ::handle> aPoints = new NCollection_HSequence(); for (NCollection_HArray1::Iterator aPntIter(*aSensPnts); aPntIter.More(); aPntIter.Next()) {