From 5c253ac1c71e68e997a01850de3beecdd4939fe5 Mon Sep 17 00:00:00 2001 From: Pasukhin Dmitry Date: Sat, 17 Jan 2026 15:21:04 +0000 Subject: [PATCH] Documentation - Refactor documentation with new coding rules (#1013) - Replaces `Handle(ClassName)` with `occ::handle` throughout documentation - Updates `Standard_Integer`, `Standard_Real`, `Standard_Boolean`, `Standard_CString` to native C++ types (`int`, `double`, `bool`, `const char*`) - Modernizes collection class references (e.g., `TDF_LabelSequence` to `NCollection_Sequence`) --- dox/contribution/coding_rules.md | 157 ++++---- dox/debug/debug.md | 30 +- dox/samples/ais_object.md | 222 +++++------ dox/samples/ocaf.md | 42 +-- dox/samples/ocaf_func.md | 20 +- .../boolean_operations/boolean_operations.md | 76 ++-- dox/tutorial/tutorial.md | 92 ++--- dox/upgrade/upgrade.md | 238 ++++++------ dox/user_guides/de_wrapper/de_wrapper.md | 64 ++-- .../draw_test_harness/draw_test_harness.md | 48 +-- .../foundation_classes/foundation_classes.md | 124 +++---- dox/user_guides/iges/iges.md | 84 ++--- dox/user_guides/mesh/mesh.md | 32 +- .../modeling_algos/modeling_algos.md | 347 +++++++++--------- .../modeling_data/modeling_data.md | 50 +-- dox/user_guides/ocaf/ocaf.md | 226 ++++++------ .../shape_healing/shape_healing.md | 180 ++++----- dox/user_guides/step/step.md | 117 +++--- dox/user_guides/vis/vis.md | 10 +- .../visualization/visualization.md | 228 ++++++------ dox/user_guides/xde/xde.md | 130 +++---- 21 files changed, 1259 insertions(+), 1258 deletions(-) diff --git a/dox/contribution/coding_rules.md b/dox/contribution/coding_rules.md index 404711ad55..301768d377 100644 --- a/dox/contribution/coding_rules.md +++ b/dox/contribution/coding_rules.md @@ -49,9 +49,9 @@ Camel Case style is preferred for names. For example: ~~~~{.cpp} -Standard_Integer awidthofbox; // this is bad -Standard_Integer width_of_box; // this is bad -Standard_Integer aWidthOfBox; // this is OK +int awidthofbox; // this is bad +int width_of_box; // this is bad +int aWidthOfBox; // this is OK ~~~~ @subsection occt_coding_rules_2_2 Names of development units @@ -96,7 +96,7 @@ Such types should be given own names using *typedef* statement, located in same- For example, see definition in the file *TColStd_IndexedDataMapOfStringString.hxx*: ~~~~{.cpp} -typedef NCollection_IndexedDataMap TColStd_IndexedDataMapOfStringString; +typedef NCollection_IndexedDataMap NCollection_IndexedDataMap; ~~~~ ### Names of functions @@ -115,12 +115,12 @@ class MyPackage_MyClass public: - Standard_Integer Value() const; - void SetValue (const Standard_Integer theValue); + int Value() const; + void SetValue (const int theValue); private: - void setIntegerValue (const Standard_Integer theValue); + void setIntegerValue (const int theValue); }; ~~~~ @@ -138,11 +138,11 @@ The name of a variable should not start with an underscore. See the following examples: ~~~~{.cpp} -Standard_Integer Elapsed_Time = 0; // this is bad - possible class name -Standard_Integer gp = 0; // this is bad - existing package name -Standard_Integer aGp = 0; // this is OK -Standard_Integer _KERNEL = 0; // this is bad -Standard_Integer THE_KERNEL = 0; // this is OK +int Elapsed_Time = 0; // this is bad - possible class name +int gp = 0; // this is bad - existing package name +int aGp = 0; // this is OK +int _KERNEL = 0; // this is bad +int THE_KERNEL = 0; // this is OK ~~~~ ### Names of function parameters @@ -164,9 +164,9 @@ The name of a class member variable should start with prefix *my* followed by th See the following examples: ~~~~{.cpp} -Standard_Integer counter; // This is bad -Standard_Integer myC; // This is OK -Standard_Integer myCounter; // This is preferred +int counter; // This is bad +int myC; // This is OK +int myCounter; // This is preferred ~~~~ ### Names of global variables @@ -177,15 +177,15 @@ However, as soon as a global variable is necessary, its name should be prefixed See the following examples: ~~~~{.cpp} -Standard_Integer MyPackage_myGlobalVariable = 0; -Standard_Integer MyPackage_MyClass_myGlobalVariable = 0; +int MyPackage_myGlobalVariable = 0; +int MyPackage_MyClass_myGlobalVariable = 0; ~~~~ Static constants within the file should be written in upper-case and begin with prefix *THE_*: ~~~~{.cpp} namespace { - static const Standard_Real THE_CONSTANT_COEF = 3.14; + static const double THE_CONSTANT_COEF = 3.14; }; ~~~~ @@ -198,10 +198,10 @@ It is preferred to prefix local variable names with *a* and *an* (or *is*, *to* See the following example: ~~~~{.cpp} -Standard_Integer theI; // this is bad -Standard_Integer i; // this is bad -Standard_Integer index; // this is bad -Standard_Integer anIndex; // this is OK +int theI; // this is bad +int i; // this is bad +int index; // this is bad +int anIndex; // this is OK ~~~~ ### Avoid dummy names @@ -212,19 +212,19 @@ The code becomes more and more complicated when such dummy names are used there See the following examples for preferred style: ~~~~{.cpp} -void Average (const Standard_Real** theArray, - Standard_Integer theRowsNb, - Standard_Integer theRowLen, - Standard_Real& theResult) +void Average (const double** theArray, + int theRowsNb, + int theRowLen, + double& theResult) { theResult = 0.0; - for (Standard_Integer aRow = 0; aRow < aRowsNb; ++aRow) + for (int aRow = 0; aRow < aRowsNb; ++aRow) { - for (Standard_Integer aCol = 0; aCol < aRowLen; ++aCol) + for (int aCol = 0; aCol < aRowLen; ++aCol) { theResult += theArray[aRow][aCol]; } - theResult /= Standard_Real(aRowsNb * aRowLen); + theResult /= double(aRowsNb * aRowLen); } } ~~~~ @@ -267,7 +267,7 @@ See the following example: ~~~~{.cpp} // check arguments -Standard_Integer anArgsNb = argCount(); +int anArgsNb = argCount(); if (anArgsNb < 3 || isSmthInvalid) { return THE_ARG_INVALID; @@ -327,10 +327,10 @@ Entering a block increases and leaving a block decreases the indentation by one Single-line conditional operators (if, while, for, etc.) can be written without brackets on the following line. ~~~~{.cpp} -if (!myIsInit) return Standard_False; // bad +if (!myIsInit) return false; // bad -if (thePtr == NULL) // OK - return Standard_False; +if (thePtr == nullptr) // OK + return false; if (!theAlgo.IsNull()) // preferred { @@ -346,8 +346,8 @@ In comparisons, put the variable (in the current context) on the left side and c That is, the so called "Yoda style" is to be avoided. ~~~~{.cpp} -if (NULL != thePointer) // Yoda style, not recommended -if (thePointer != NULL) // OK +if (nullptr != thePointer) // Yoda style, not recommended +if (thePointer != nullptr) // OK if (34 < anIter) // Yoda style, not recommended if (anIter > 34) // OK @@ -384,11 +384,11 @@ Use an early return condition rather than collect indentations. Write like this: ~~~~{.cpp} -Standard_Integer ComputeSumm (const Standard_Integer* theArray, - const Standard_Size theSize) +int ComputeSumm (const int* theArray, + const size_t theSize) { - Standard_Integer aSumm = 0; - if (theArray == NULL || theSize == 0) + int aSumm = 0; + if (theArray == nullptr || theSize == 0) { return 0; } @@ -401,11 +401,11 @@ Standard_Integer ComputeSumm (const Standard_Integer* theArray, Rather than: ~~~~{.cpp} -Standard_Integer ComputeSumm (const Standard_Integer* theArray, - const Standard_Size theSize) +int ComputeSumm (const int* theArray, + const size_t theSize) { - Standard_Integer aSumm = 0; - if (theArray != NULL && theSize != 0) + int aSumm = 0; + if (theArray != nullptr && theSize != 0) { ... computing summ ... } @@ -479,7 +479,7 @@ Accepted style is: //! Method computes the square value. //! @param theValue the input value //! @return squared value -Standard_Export Standard_Real Square (Standard_Real theValue); +Standard_Export double Square (double theValue); @endverbatim ### Documenting C/C++ sources @@ -562,8 +562,7 @@ A class with virtual function(s) ought to have a virtual destructor. ### Overriding virtual methods -Declaration of overriding method should contains specifiers "virtual" and "override" -(using Standard_OVERRIDE alias for compatibility with old compilers). +Declaration of overriding method should contain specifiers "virtual" and "override". ~~~~{.cpp} class MyPackage_BaseClass @@ -571,7 +570,7 @@ class MyPackage_BaseClass public: - Standard_EXPORT virtual Standard_Boolean Perform(); + Standard_EXPORT virtual bool Perform(); }; @@ -580,7 +579,7 @@ class MyPackage_MyClass : public MyPackage_BaseClass public: - Standard_EXPORT virtual Standard_Boolean Perform() Standard_OVERRIDE; + Standard_EXPORT virtual bool Perform() override; }; ~~~~ @@ -610,11 +609,11 @@ Avoid *goto* statement unless it is really needed. Declare a cycle variable in the header of the *for()* statement if not used out of cycle. ~~~~{.cpp} -Standard_Real aMinDist = Precision::Infinite(); +double aMinDist = Precision::Infinite(); for (NCollection_Sequence::Iterator aPntIter (theSequence); aPntIter.More(); aPntIter.Next()) { - aMinDist = Min (aMinDist, theOrigin.Distance (aPntIter.Value())); + aMinDist = std::min (aMinDist, theOrigin.Distance (aPntIter.Value())); } ~~~~ @@ -623,8 +622,8 @@ for (NCollection_Sequence::Iterator aPntIter (theSequence); Avoid usage of C-style comparison for non-boolean variables: ~~~~{.cpp} -void Function (Standard_Integer theValue, - Standard_Real* thePointer) +void Function (int theValue, + double* thePointer) { if (!theValue) // bad style - ambiguous logic { @@ -636,8 +635,8 @@ void Function (Standard_Integer theValue, DoSome(); } - if (thePointer != NULL) // OK, predefined NULL makes pointer comparison cleaner to reader - { // (nullptr should be used instead as soon as C++11 will be available) + if (thePointer != nullptr) // OK, nullptr is preferred for pointer comparisons + { DoSome2(); } } @@ -652,8 +651,8 @@ This chapter contains rules that are critical for cross-platform portability. The source code must be portable to all platforms listed in the official 'Technical Requirements'. The term 'portable' here means 'able to be built from source'. -The C++ source code should meet C++03 standard. -Any usage of compiler-specific features or further language versions (for example, C++11, until all major compilers on all supported platforms implement all its features) should be optional (used only with appropriate preprocessor checks) and non-exclusive (an alternative implementation compatible with other compilers should be provided). +The C++ source code should meet the C++17 standard or later. +Compiler-specific features should be avoided where possible, or used only with appropriate preprocessor checks to ensure portability across all supported platforms. ### Avoid usage of global variables [MANDATORY] @@ -663,9 +662,9 @@ Use global (package or class) functions that return reference to static variable Another possible problem is the order of initialization of global variables defined in various libraries that may differ depending on platform, compiler and environment. -### Avoid explicit basic types +### Use standard C++ primitive types -Avoid explicit usage of basic types (*int*, *float*, *double*, etc.), use Open CASCADE Technology types from package *Standard: Standard_Integer, Standard_Real, Standard_ShortReal, Standard_Boolean, Standard_CString* and others or a specific *typedef* instead. +In new code, use standard C++ primitive types (*int*, *double*, *bool*, *float*) directly instead of legacy Open CASCADE Technology typedef aliases (*Standard_Integer*, *Standard_Real*, *Standard_Boolean*, etc.). The legacy types are typedef aliases to native types and remain in the codebase for historical reasons. New code should prefer native types for clarity and consistency with modern C++. ### Use sizeof() to calculate sizes [MANDATORY] @@ -701,20 +700,20 @@ See the following example: class Master : public Standard_Transient { ... - void SetSlave (const Handle(Slave)& theSlave) + void SetSlave (const occ::handle& theSlave) { mySlave = theSlave; } ... private: - Handle(Slave) theSlave; // smart pointer + occ::handle theSlave; // smart pointer ... } class Slave : public Standard_Transient { ... - void SetMaster (const Handle(Master)& theMaster) + void SetMaster (const occ::handle& theMaster) { myMaster = theMaster.get(); } @@ -748,8 +747,8 @@ Define a destructor, a copy constructor and an assignment operator for classes w Every variable should be initialized. ~~~~{.cpp} -Standard_Integer aTmpVar1; // bad -Standard_Integer aTmpVar2 = 0; // OK +int aTmpVar1; // bad +int aTmpVar2 = 0; // OK ~~~~ Uninitialized variables might be kept only within performance-sensitive code blocks and only when their initialization is guaranteed by subsequent code. @@ -767,7 +766,7 @@ In *operator=()* assign to all data members and check for assignment to self. Don't check floats for equality or non-equality; check for GT, GE, LT or LE. ~~~~{.cpp} -if (Abs (theFloat1 - theFloat2) < theTolerance) +if (std::abs (theFloat1 - theFloat2) < theTolerance) { DoSome(); } @@ -830,8 +829,8 @@ public: private: - Standard_Integer myPropertyA; - Standard_Integer myPropertyB; + int myPropertyA; + int myPropertyB; }; ~~~~ @@ -855,8 +854,8 @@ When programming procedures with extensive memory access, try to optimize them i On x86 this code ~~~~{.cpp} -Standard_Real anArray[4096][2]; -for (Standard_Integer anIter = 0; anIter < 4096; ++anIter) +double anArray[4096][2]; +for (int anIter = 0; anIter < 4096; ++anIter) { anArray[anIter][0] = anArray[anIter][1]; } @@ -865,8 +864,8 @@ for (Standard_Integer anIter = 0; anIter < 4096; ++anIter) is more efficient then ~~~~{.cpp} -Standard_Real anArray[2][4096]; -for (Standard_Integer anIter = 0; anIter < 4096; ++anIter) +double anArray[2][4096]; +for (int anIter = 0; anIter < 4096; ++anIter) { anArray[0][anIter] = anArray[1][anIter]; } @@ -901,9 +900,9 @@ Command should warn the user about unknown arguments, including cases when extra return 1; } - Standard_Integer anArgIter = 1; - Standard_CString aResName = theArgVec[anArgIter++]; - Standard_CString aFaceName = theArgVec[anArgIter++]; + int anArgIter = 1; + const char* aResName = theArgVec[anArgIter++]; + const char* aFaceName = theArgVec[anArgIter++]; TopoDS_Shape aFaceShape = DBRep::Get (aFaceName); if (aFaceShape.IsNull() || aFaceShape.ShapeType() != TopAbs_FACE) @@ -939,10 +938,10 @@ myCommand -flag1 value1 value2 -flag2 value3 Functions *Draw::Atof()* and *Draw::Atoi()* support expressions and read values in C-locale. ~~~~{.cpp} - Standard_Real aPosition[3] = {0.0, 0.0, 0.0}; - for (Standard_Integer anArgIter = 1; anArgIter < theArgsNb; ++anArgIter) + double aPosition[3] = {0.0, 0.0, 0.0}; + for (int anArgIter = 1; anArgIter < theArgsNb; ++anArgIter) { - Standard_CString anArg = theArgVec[anArgIter]; + const char* anArg = theArgVec[anArgIter]; TCollection_AsciiString aFlag (anArg); aFlag.LowerCase(); //!< for case insensitive comparison if (aFlag == "position") @@ -977,7 +976,7 @@ public: //! @name public methods //! Method computes the square value. //! @param theValue the input value //! @return squared value - Standard_Export Standard_Real Square (const Standard_Real theValue); + Standard_Export double Square (const double theValue); private: //! \@name private methods @@ -986,7 +985,7 @@ private: //! \@name private methods private: //! \@name private fields - Standard_Integer myCounter; //!< usage counter + int myCounter; //!< usage counter }; @@ -999,7 +998,7 @@ private: //! \@name private fields // function : Square // purpose : Method computes the square value // ========================================================== -Standard_Real Package_Class::Square (const Standard_Real theValue) +double Package_Class::Square (const double theValue) { increment(); return theValue * theValue; diff --git a/dox/debug/debug.md b/dox/debug/debug.md index b21551abb0..df8887fe42 100644 --- a/dox/debug/debug.md +++ b/dox/debug/debug.md @@ -113,7 +113,7 @@ const char* BRepMesh_Dump (void* theMeshHandlePtr, const char* theFileNameStr) ~~~~ Stores mesh produced in parametric space to BREP file. -- *theMeshHandlePtr* -- a pointer to *Handle(BRepMesh_DataStructureOfDelaun)* variable. +- *theMeshHandlePtr* -- a pointer to *occ::handle\* variable. - *theFileNameStr* -- the name of the file where the mesh is stored. The following functions are provided by *TKTopTest* toolkit: @@ -123,9 +123,9 @@ const char* MeshTest_DrawLinks(const char* theNameStr, void* theFaceAttr) const char* MeshTest_DrawTriangles(const char* theNameStr, void* theFaceAttr) ~~~~ -Sets the edges or triangles from mesh data structure of type *Handle(BRepMesh_FaceAttribute)* as DRAW interpreter variables, assigning a unique name in the form "_" to each object. +Sets the edges or triangles from mesh data structure of type *occ::handle\* as DRAW interpreter variables, assigning a unique name in the form "_" to each object. - *theNameStr* -- the prefix to use in names of objects. -- *theFaceAttr* -- a pointer to *Handle(BRepMesh_FaceAttribute)* variable. +- *theFaceAttr* -- a pointer to *occ::handle\* variable. The following additional function is provided by *TKGeomBase* toolkit: @@ -134,7 +134,7 @@ const char* GeomTools_Dump (void* theHandlePtr) ~~~~ Dump geometric object to cout. -- *theHandlePtr* -- a pointer to the geometric variable (Handle to *Geom_Geometry* or *Geom2d_Curve* or descendant) to be set. +- *theHandlePtr* -- a pointer to the geometric variable (*occ::handle\<\>* to *Geom_Geometry* or *Geom2d_Curve* or descendant) to be set. @section occt_debug_dump_json Dump OCCT objects into Json @@ -301,32 +301,32 @@ math_Vector { children ( #array ( expr: ((double*)($c.Array.Addr))[$i], size: 1+$c.UpperIndex ) ) } -TColStd_Array1OfReal { +NCollection_Array1 { preview ( #( "Array1OfReal [", $e.myLowerBound, "..", $e.myUpperBound, "]" ) ) children ( #array ( expr: ((double*)($c.myStart))[$i], size: 1+$c.myUpperBound ) ) } Handle_TColStd_HArray1OfReal { preview ( #( "HArray1OfReal [", - ((TColStd_HArray1OfReal*)$e.entity)->myArray.myLowerBound, "..", - ((TColStd_HArray1OfReal*)$e.entity)->myArray.myUpperBound, "] ", + ((NCollection_HArray1*)$e.entity)->myArray.myLowerBound, "..", + ((NCollection_HArray1*)$e.entity)->myArray.myUpperBound, "] ", [$e.entity,x], " count=", $e.entity->count ) ) - children ( #array ( expr: ((double*)(((TColStd_HArray1OfReal*)$e.entity)->myArray.myStart))[$i], - size: 1+((TColStd_HArray1OfReal*)$e.entity)->myArray.myUpperBound ) ) + children ( #array ( expr: ((double*)(((NCollection_HArray1*)$e.entity)->myArray.myStart))[$i], + size: 1+((NCollection_HArray1*)$e.entity)->myArray.myUpperBound ) ) } -TColStd_Array1OfInteger { - preview ( #( "Array1OfInteger [", $e.myLowerBound, "..", $e.myUpperBound, "]" ) ) +NCollection_Array1 { + preview ( #( "NCollection_Shared> [", $e.myLowerBound, "..", $e.myUpperBound, "]" ) ) children ( #array ( expr: ((int*)($c.myStart))[$i], size: 1+$c.myUpperBound ) ) } Handle_TColStd_HArray1OfInteger { preview ( #( "HArray1OfInteger [", - ((TColStd_HArray1OfInteger*)$e.entity)->myArray.myLowerBound, "..", - ((TColStd_HArray1OfInteger*)$e.entity)->myArray.myUpperBound, "] ", + ((NCollection_HArray1*)$e.entity)->myArray.myLowerBound, "..", + ((NCollection_HArray1*)$e.entity)->myArray.myUpperBound, "] ", [$e.entity,x], " count=", $e.entity->count ) ) - children ( #array ( expr: ((int*)(((TColStd_HArray1OfInteger*)$e.entity)->myArray.myStart))[$i], - size: 1+((TColStd_HArray1OfInteger*)$e.entity)->myArray.myUpperBound ) ) + children ( #array ( expr: ((int*)(((NCollection_HArray1*)$e.entity)->myArray.myStart))[$i], + size: 1+((NCollection_HArray1*)$e.entity)->myArray.myUpperBound ) ) } Handle_TCollection_HExtendedString { diff --git a/dox/samples/ais_object.md b/dox/samples/ais_object.md index cf5a17e7c5..bd1c31a347 100644 --- a/dox/samples/ais_object.md +++ b/dox/samples/ais_object.md @@ -18,14 +18,14 @@ class MyAisObject : public AIS_InteractiveObject public: MyAisObject() {} public: - virtual void Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) override {} + virtual void Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) override {} - virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) override {} + virtual void ComputeSelection (const occ::handle& theSel, + const int theMode) override {} - virtual bool AcceptDisplayMode (const Standard_Integer theMode) const override + virtual bool AcceptDisplayMode (const int theMode) const override { return true; } }; ~~~~ @@ -56,16 +56,16 @@ Presentation builders are reusable bricks for constructing @c AIS objects. Standard OCCT interactive objects highly rely on them, so that you may easily replicate @c AIS_Shape presentation for displaying a shape with just a couple of lines calling @c StdPrs_ShadedShape: ~~~~{.cpp} -void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) +void MyAisObject::Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) { TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0); StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer); } ... -Handle(AIS_InteractiveContext) theCtx; -Handle(MyAisObject) aPrs = new MyAisObject(); +occ::handle theCtx; +occ::handle aPrs = new MyAisObject(); theCtx->Display (aPrs, true); ~~~~ @@ -84,9 +84,9 @@ For each supported display mode, the **Presentation Manager** creates a dedicate It is a good practice to reject unsupported display modes within @c @::Compute() method: ~~~~{.cpp} -void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) +void MyAisObject::Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) { if (theMode != 0) { return; } // reject non-zero display modes @@ -98,8 +98,8 @@ void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, This wouldn't, however, prevent application from displaying the object with another display mode like this: ~~~~{.cpp} -Handle(AIS_InteractiveContext) theCtx; -Handle(MyAisObject) aPrs = new MyAisObject(); +occ::handle theCtx; +occ::handle aPrs = new MyAisObject(); theCtx->Display (aPrs, 100, -1, true); ~~~~ @@ -107,7 +107,7 @@ The code above will display @c MyAisObject with display mode equal to 100, and a @c AIS will still create a presentation with specified display mode, but it will be empty - method @c @::AcceptDisplayMode() could be overridden to disallow even creation of an empty presentation: ~~~~{.cpp} -bool MyAisObject::AcceptDisplayMode (const Standard_Integer theMode) const +bool MyAisObject::AcceptDisplayMode (const int theMode) const { return theMode == 0; // reject non-zero display modes } @@ -117,9 +117,9 @@ bool MyAisObject::AcceptDisplayMode (const Standard_Integer theMode) const @c StdPrs_ShadedShape prepares a shaded (triangulated) presentation of a shape, while @c StdPrs_WFShape creates a wireframe presentation with B-Rep wire boundaries: ~~~~{.cpp} -void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) +void MyAisObject::Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) { if (!AcceptDisplayMode (theMode)) { return; } @@ -138,13 +138,13 @@ With the help of @c Prs3d tools we may display elements like arrows, boxes or te Let's extend our presentation with a second **display mode 1** showing a bounding box using @c Prs3d_BndBox builder: ~~~~{.cpp} -bool MyAisObject::AcceptDisplayMode (const Standard_Integer theMode) const +bool MyAisObject::AcceptDisplayMode (const int theMode) const { return theMode == 0 || theMode == 1; } -void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) +void MyAisObject::Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) { TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (100.0, 100.0); if (theMode == 0) @@ -164,8 +164,8 @@ void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, Now, displaying an object with **display mode 1** will show a box: ~~~~{.cpp} -Handle(AIS_InteractiveContext) theCtx; -Handle(MyAisObject) aPrs = new MyAisObject(); +occ::handle theCtx; +occ::handle aPrs = new MyAisObject(); theCtx->Display (aPrs, 1, 0, true); ~~~~ @@ -192,8 +192,8 @@ MyAisObject::MyAisObject() ... -Handle(AIS_InteractiveContext) theCtx; -Handle(MyAisObject) aPrs = new MyAisObject(); +occ::handle theCtx; +occ::handle aPrs = new MyAisObject(); theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false); theCtx->HilightWithColor (aPrs, aPrs->HilightAttributes(), false); theCtx->CurrentViewer()->Redraw(); @@ -231,9 +231,9 @@ The latter one avoids duplicating vertices shared between connected elements (tr Let's extend our sample and display a cylinder section contour defined by array of indexed segments (e.g. a polyline of four vertices): ~~~~{.cpp} -void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) +void MyAisObject::Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) { const double aRadius = 100.0, aHeight = 100.0; TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight); @@ -241,7 +241,7 @@ void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, { StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer); //StdPrs_WFShape::Add (thePrs, aShape, myDrawer); - Handle(Graphic3d_ArrayOfSegments) aSegs = new Graphic3d_ArrayOfSegments (4, 4 * 2, Graphic3d_ArrayFlags_None); + occ::handle aSegs = new Graphic3d_ArrayOfSegments (4, 4 * 2, Graphic3d_ArrayFlags_None); aSegs->AddVertex (gp_Pnt (0.0, -aRadius, 0.0)); aSegs->AddVertex (gp_Pnt (0.0, -aRadius, aHeight)); aSegs->AddVertex (gp_Pnt (0.0, aRadius, aHeight)); @@ -250,7 +250,7 @@ void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, aSegs->AddEdges (2, 3); aSegs->AddEdges (3, 4); aSegs->AddEdges (4, 1); - Handle(Graphic3d_Group) aGroupSegs = thePrs->NewGroup(); + occ::handle aGroupSegs = thePrs->NewGroup(); aGroupSegs->SetGroupPrimitivesAspect (myDrawer->WireAspect()->Aspect()); aGroupSegs->AddPrimitiveArray (aSegs); } @@ -286,14 +286,14 @@ These subclasses exist for historical reasons and are treated by renderers in ex It is technically possible to create transient aspects directly within @c @::Compute() method like this: ~~~~{.cpp} -void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) +void MyAisObject::Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) { - Handle(Graphic3d_Aspects) anAspects = new Graphic3d_Aspects(); + occ::handle anAspects = new Graphic3d_Aspects(); anAspects->SetShadingModel (Graphic3d_TypeOfShadingModel_Unlit); anAspects->SetColor (Quantity_NOC_RED); - Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); + occ::handle aGroup = thePrs->NewGroup(); aGroup->SetGroupPrimitivesAspect (anAspects); ... } @@ -333,9 +333,9 @@ This interface allows bypassing creation of a complex B-Rep (@c TopoDS_Shape) de Let's try using @c Prs3d_ToolCylinder in our sample: ~~~~{.cpp} -void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) +void MyAisObject::Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) { const double aRadius = 100.0, aHeight = 100.0; TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight); @@ -343,9 +343,9 @@ void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, { //StdPrs_ShadedShape::Add (thePrs, aShape, myDrawer); // add shading //StdPrs_WFShape::Add (thePrs, aShape, myDrawer); // add wireframe - Handle(Graphic3d_ArrayOfTriangles) aTris = + occ::handle aTris = Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 10, 10, gp_Trsf()); - Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup(); + occ::handle aGroupTris = thePrs->NewGroup(); aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect()); aGroupTris->AddPrimitiveArray (aTris); ... @@ -367,7 +367,7 @@ Quadric builder creates a triangulation taking the following parameters: Let's increase number of subdivisions from _10_ to _25_: ~~~~{.cpp} -Handle(Graphic3d_ArrayOfTriangles) aTris = +occ::handle aTris = Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 25, 25, gp_Trsf()); ~~~~ @@ -379,9 +379,9 @@ There is one issue though - our cylinder doesn't have top and bottom anymore! To fix this problem we will use one more quadric builder @c Prs3d_ToolDisk: ~~~~{.cpp} -void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) +void MyAisObject::Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) { const double aRadius = 100.0, aHeight = 100.0; if (theMode == MyDispMode_Main) @@ -389,7 +389,7 @@ void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, Prs3d_ToolCylinder aCyl (aRadius, aRadius, aHeight, 25, 25); Prs3d_ToolDisk aDisk (0.0, aRadius, 25, 1); - Handle(Graphic3d_ArrayOfTriangles) aTris = + occ::handle aTris = new Graphic3d_ArrayOfTriangles (aCyl.VerticesNb() + 2 * aDisk.VerticesNb(), 3 * (aCyl.TrianglesNb() + 2 * aDisk.TrianglesNb()), Graphic3d_ArrayFlags_VertexNormal); @@ -400,7 +400,7 @@ void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, aDisk2Trsf.SetTransformation (gp_Ax3 (gp_Pnt (0.0, 0.0, aHeight), -gp::DZ(), gp::DX()), gp::XOY()); aDisk.FillArray (aTris, aDisk2Trsf); - Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup(); + occ::handle aGroupTris = thePrs->NewGroup(); aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect()); aGroupTris->AddPrimitiveArray (aTris); aGroupTris->SetClosed (true); @@ -419,35 +419,35 @@ as each `Graphic3d_ArrayOfPrimitives` is mapped into a dedicated draw call at gr As an exercise, let's try computing a triangulation for cylinder disk without help of @c Prs3d_ToolDisk builder: ~~~~{.cpp} -void MyAisObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) +void MyAisObject::Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) { const double aRadius = 100.0, aHeight = 100.0; if (theMode == MyDispMode_Main) { const int aNbSlices = 25; Prs3d_ToolCylinder aCyl (aRadius, aRadius, aHeight, aNbSlices, aNbSlices); - Handle(Graphic3d_ArrayOfTriangles) aTris = + occ::handle aTris = new Graphic3d_ArrayOfTriangles (aCyl.VerticesNb(), 3 * (aCyl.TrianglesNb()), Graphic3d_ArrayFlags_VertexNormal); aCyl.FillArray (aTris, gp_Trsf()); - Handle(Graphic3d_ArrayOfTriangles) aTris2 = + occ::handle aTris2 = new Graphic3d_ArrayOfTriangles (aNbSlices + 1, aNbSlices * 3, Graphic3d_ArrayFlags_VertexNormal); aTris2->AddVertex (gp_Pnt (0.0, 0.0, aHeight), -gp::DZ()); for (int aSliceIter = 0; aSliceIter < aNbSlices; ++aSliceIter) { double anAngle = M_PI * 2.0 * double(aSliceIter) / double(aNbSlices); - aTris2->AddVertex (gp_Pnt (Cos (anAngle) * aRadius, Sin (anAngle) * aRadius, aHeight), -gp::DZ()); + aTris2->AddVertex (gp_Pnt (std::cos (anAngle) * aRadius, std::sin (anAngle) * aRadius, aHeight), -gp::DZ()); } for (int aSliceIter = 0; aSliceIter < aNbSlices; ++aSliceIter) { aTris2->AddEdges (1, aSliceIter + 2, aSliceIter + 1 < aNbSlices ? (aSliceIter + 3) : 2); } - Handle(Graphic3d_Group) aGroupTris = thePrs->NewGroup(); + occ::handle aGroupTris = thePrs->NewGroup(); aGroupTris->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect()); aGroupTris->AddPrimitiveArray (aTris); aGroupTris->AddPrimitiveArray (aTris2); @@ -476,15 +476,15 @@ This method should fill in the @c SelectMgr_Selection argument with @c SelectMgr @c Select3D_SensitiveBox is probably the simplest way to define selectable volume - by it's bounding box: ~~~~{.cpp} -void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) +void MyAisObject::ComputeSelection (const occ::handle& theSel, + const int theMode) { const double aRadius = 100.0, aHeight = 100.0; TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight); Bnd_Box aBox; BRepBndLib::Add (aShape, aBox); - Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this); - Handle(Select3D_SensitiveBox) aSensBox = new Select3D_SensitiveBox (anOwner, aBox); + occ::handle anOwner = new SelectMgr_EntityOwner (this); + occ::handle aSensBox = new Select3D_SensitiveBox (anOwner, aBox); theSel->Add (aSensBox); } ~~~~ @@ -505,12 +505,12 @@ Owner may store an additional identifier as a class field, like @c StdSelect_BRe In a similar way as @c StdPrs_ShadedShape is a **presentation builder** for @c TopoDS_Shape, the @c StdSelect_BRepSelectionTool can be seen as a standard **selection builder** for shapes: ~~~~{.cpp} -void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) +void MyAisObject::ComputeSelection (const occ::handle& theSel, + const int theMode) { const double aRadius = 100.0, aHeight = 100.0; TopoDS_Shape aShape = BRepPrimAPI_MakeCylinder (aRadius, aHeight); - Standard_Real aDefl = StdPrs_ToolTriangulatedShape::GetDeflection (aShape, myDrawer); + double aDefl = StdPrs_ToolTriangulatedShape::GetDeflection (aShape, myDrawer); StdSelect_BRepSelectionTool::Load (theSel, this, aShape, TopAbs_SHAPE, aDefl, myDrawer->DeviationAngle(), myDrawer->IsAutoTriangulation()); @@ -522,14 +522,14 @@ Internally, @c StdSelect_BRepSelectionTool iterates over sub-shapes and appends Previously, we have used @c Prs3d_ToolCylinder to triangulate a cylinder, so let's try to construct @c Select3D_SensitivePrimitiveArray from the same triangulation: ~~~~{.cpp} -void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) +void MyAisObject::ComputeSelection (const occ::handle& theSel, + const int theMode) { const double aRadius = 100.0, aHeight = 100.0; - Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this); - Handle(Graphic3d_ArrayOfTriangles) aTris = + occ::handle anOwner = new SelectMgr_EntityOwner (this); + occ::handle aTris = Prs3d_ToolCylinder::Create (aRadius, aRadius, aHeight, 25, 25, gp_Trsf()); - Handle(Select3D_SensitivePrimitiveArray) aSensTri = + occ::handle aSensTri = new Select3D_SensitivePrimitiveArray (anOwner); aSensTri->InitTriangulation (aTris->Attributes(), aTris->Indices(), TopLoc_Location()); @@ -544,8 +544,8 @@ These issues might happen, for example, when selection uses tessellated represen As in case of @c @::Compute(), it makes sense defining some enumeration of **selection modes** supported by specific object and reject unsupported ones to avoid unexpected behavior: ~~~~{.cpp} -void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) +void MyAisObject::ComputeSelection (const occ::handle& theSel, + const int theMode) { if (theMode != 0) { return; } ... @@ -558,8 +558,8 @@ A user should be careful to activate only the modes that actually make sense and Selection mode to activate could be specified while displaying the object (passing _**-1**_ instead of _**0**_ would display an object with deactivated selection): ~~~~{.cpp} -Handle(AIS_InteractiveContext) theCtx; -Handle(MyAisObject) aPrs = new MyAisObject(); +occ::handle theCtx; +occ::handle aPrs = new MyAisObject(); theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false); ~~~~ @@ -579,19 +579,19 @@ class MyAisOwner : public SelectMgr_EntityOwner { DEFINE_STANDARD_RTTI_INLINE(MyAisOwner, SelectMgr_EntityOwner) public: - MyAisOwner (const Handle(MyAisObject)& theObj, int thePriority = 0) + MyAisOwner (const occ::handle& theObj, int thePriority = 0) : SelectMgr_EntityOwner (theObj, thePriority) {} - virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Integer theMode) override + virtual void HilightWithColor (const occ::handle& thePrsMgr, + const occ::handle& theStyle, + const int theMode) override { base_type::HilightWithColor (thePrsMgr, theStyle, theMode); } - virtual void Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Standard_Integer theMode) override + virtual void Unhilight (const occ::handle& thePrsMgr, + const int theMode) override { base_type::Unhilight (thePrsMgr, theMode); } protected: - Handle(Prs3d_Presentation) myPrs; + occ::handle myPrs; }; ~~~~ @@ -606,11 +606,11 @@ MyAisObject::MyAisObject() ... } -void MyAisObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) +void MyAisObject::ComputeSelection (const occ::handle& theSel, + const int theMode) { const double aRadius = 100.0, aHeight = 100.0; - Handle(MyAisOwner) anOwner = new MyAisOwner (this); + occ::handle anOwner = new MyAisOwner (this); ... } ~~~~ @@ -621,15 +621,15 @@ This is because default implementation of @c SelectMgr_EntityOwner for highlight ~~~~{.cpp} void SelectMgr_EntityOwner::HilightWithColor ( - const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Integer theMode) + const occ::handle& thePrsMgr, + const occ::handle& theStyle, + const int theMode) { const Graphic3d_ZLayerId aHiLayer = theStyle->ZLayer() != Graphic3d_ZLayerId_UNKNOWN ? theStyle->ZLayer() : mySelectable->ZLayer(); - thePrsMgr->Color (mySelectable, theStyle, theMode, NULL, aHiLayer); + thePrsMgr->Color (mySelectable, theStyle, theMode, nullptr, aHiLayer); } ~~~~ @@ -638,9 +638,9 @@ void SelectMgr_EntityOwner::HilightWithColor ( Now, let's override the @c SelectMgr_EntityOwner::HilightWithColor() method and display a bounding box presentation: ~~~~{.cpp} -void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Integer theMode) +void MyAisOwner::HilightWithColor (const occ::handle& thePrsMgr, + const occ::handle& theStyle, + const int theMode) { if (myPrs.IsNull()) { @@ -665,8 +665,8 @@ One thing became broken, though - highlighting remains displayed even after clea To fix this issue, we need implementing @c SelectMgr_EntityOwner::Unhilight() and hide our custom presentation explicitly: ~~~~{.cpp} -void MyAisOwner::Unhilight (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Standard_Integer theMode) +void MyAisOwner::Unhilight (const occ::handle& thePrsMgr, + const int theMode) { if (!myPrs.IsNull()) { myPrs->Erase(); } } @@ -678,9 +678,9 @@ Within this mode turned ON, presentation should be displayed on the screen with (it will be cleared from the screen automatically on the next mouse movement): ~~~~{.cpp} -void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Integer theMode) +void MyAisOwner::HilightWithColor (const occ::handle& thePrsMgr, + const occ::handle& theStyle, + const int theMode) { if (myPrs.IsNull()) { @@ -690,7 +690,7 @@ void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& the } if (thePrsMgr->IsImmediateModeOn()) { - Handle(Prs3d_PresentationShadow) aShadow = + occ::handle aShadow = new Prs3d_PresentationShadow (thePrsMgr->StructureManager(), myPrs); aShadow->SetZLayer (Graphic3d_ZLayerId_Top); aShadow->Highlight (theStyle); @@ -708,14 +708,14 @@ We may create two dedicated presentations for dynamic highlighting or reuse exis Let's go further and make dynamic highlighting a little bit more interesting - by drawing a surface normal at the point where mouse picked the object: ~~~~{.cpp} -void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Drawer)& theStyle, - const Standard_Integer theMode) +void MyAisOwner::HilightWithColor (const occ::handle& thePrsMgr, + const occ::handle& theStyle, + const int theMode) { MyAisObject* anObj = dynamic_cast (mySelectable); if (thePrsMgr->IsImmediateModeOn()) { - Handle(StdSelect_ViewerSelector) aSelector = + occ::handle aSelector = anObj->InteractiveContext()->MainSelector(); SelectMgr_SortCriterion aPickPnt; for (int aPickIter = 1; aPickIter <= aSelector->NbPicked(); ++aPickIter) @@ -727,14 +727,14 @@ void MyAisOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager)& the } } - Handle(Prs3d_Presentation) aPrs = mySelectable->GetHilightPresentation (thePrsMgr); + occ::handle aPrs = mySelectable->GetHilightPresentation (thePrsMgr); aPrs->SetZLayer (Graphic3d_ZLayerId_Top); aPrs->Clear(); - Handle(Graphic3d_Group) aGroup = aPrs->NewGroup(); + occ::handle aGroup = aPrs->NewGroup(); aGroupPnt->SetGroupPrimitivesAspect (theStyle->ArrowAspect()->Aspect()); gp_Trsf aTrsfInv = mySelectable->LocalTransformation().Inverted(); gp_Dir aNorm (aPickPnt.Normal.x(), aPickPnt.Normal.y(), aPickPnt.Normal.z()); - Handle(Graphic3d_ArrayOfTriangles) aTris = + occ::handle aTris = Prs3d_Arrow::DrawShaded (gp_Ax1(aPickPnt.Point, aNorm).Transformed (aTrsfInv), 1.0, 15.0, 3.0, 4.0, 10); @@ -825,13 +825,13 @@ But let's have some fun and make our object to change a color on each mouse clic class MyAisOwner : public SelectMgr_EntityOwner { ... - virtual bool HandleMouseClick (const Graphic3d_Vec2i& thePoint, + virtual bool HandleMouseClick (const NCollection_Vec2& thePoint, Aspect_VKeyMouse theButton, Aspect_VKeyFlags theModifiers, bool theIsDoubleClick) override; }; -bool MyAisOwner::HandleMouseClick (const Graphic3d_Vec2i& thePoint, +bool MyAisOwner::HandleMouseClick (const NCollection_Vec2& thePoint, Aspect_VKeyMouse theButton, Aspect_VKeyFlags theModifiers, bool theIsDoubleClick) @@ -854,13 +854,13 @@ We use a couple of global (@c static) variables in our sample for simplicity - d class MyAisOwner : public SelectMgr_EntityOwner { ... - void SetAnimation (const Handle(AIS_Animation)& theAnim) + void SetAnimation (const occ::handle& theAnim) { myAnim = theAnim; } ... - Handle(AIS_Animation) myAnim; + occ::handle myAnim; }; -bool MyAisOwner::HandleMouseClick (const Graphic3d_Vec2i& thePoint, +bool MyAisOwner::HandleMouseClick (const NCollection_Vec2& thePoint, Aspect_VKeyMouse theButton, Aspect_VKeyFlags theModifiers, bool theIsDoubleClick) @@ -872,7 +872,7 @@ bool MyAisOwner::HandleMouseClick (const Graphic3d_Vec2i& thePoint, aTrsfTo.SetRotation (gp_Ax1 (gp::Origin(), gp::DX()), isFirst ? M_PI * 0.5 : -M_PI * 0.5); gp_Trsf aTrsfFrom = anObj->LocalTransformation(); - Handle(AIS_AnimationObject) anAnim = + occ::handle anAnim = new AIS_AnimationObject ("MyAnim", anObj->InteractiveContext(), anObj, aTrsfFrom, aTrsfTo); anAnim->SetOwnDuration (2.0); @@ -890,9 +890,9 @@ To utilize it, you need adding a custom object animation to @c AIS_ViewControlle Somewhere in application this might look like this: ~~~~{.cpp} -Handle(AIS_InteractiveContext) theCtx; -Handle(AIS_ViewController) theViewCtrl; -Handle(MyAisObject) aPrs = new MyAisObject(); +occ::handle theCtx; +occ::handle theViewCtrl; +occ::handle aPrs = new MyAisObject(); aPrs->SetAnimation (theViewCtrl->ObjectsAnimation()); theCtx->Display (aPrs, MyAisObject::MyDispMode_Main, 0, false); ~~~~ diff --git a/dox/samples/ocaf.md b/dox/samples/ocaf.md index 4d7bb70950..b1209d6538 100644 --- a/dox/samples/ocaf.md +++ b/dox/samples/ocaf.md @@ -38,7 +38,7 @@ In the Formats method, add the format of the documents, which need to be For example: ~~~~{.cpp} - void myApplication::Formats(TColStd_SequenceOfExtendedString& Formats) + void myApplication::Formats(NCollection_Sequence& Formats) { Formats.Append(TCollection_ExtendedString ("OCAF-myApplication")); } @@ -48,9 +48,9 @@ In the ResourcesName method, you only define the name of the resource fil This file contains several definitions for the saving and opening mechanisms associated with each format and calling of the plug-in file. ~~~~{.cpp} - Standard_CString myApplication::ResourcesName() + const char* myApplication::ResourcesName() { - return Standard_CString ("Resources"); + return const char* ("Resources"); } ~~~~ @@ -140,7 +140,7 @@ public: //!@ name Static methods //! Finds or creates the attribute attached to . //! The found or created attribute is returned. - Standard_EXPORT static Handle(MyPackage_Transformation) Set (const TDF_Label theLabel); + Standard_EXPORT static occ::handle Set (const TDF_Label theLabel); public: //!@ name Methods for access to the attribute data @@ -150,7 +150,7 @@ public: //!@ name Methods for access to the attribute data public: //!@ name Methods for setting the data of transformation //! The method defines a rotation type of transformation. - Standard_EXPORT void SetRotation (const gp_Ax1& theAxis, Standard_Real theAngle); + Standard_EXPORT void SetRotation (const gp_Ax1& theAxis, double theAngle); //! The method defines a translation type of transformation. Standard_EXPORT void SetTranslation (const gp_Vec& theVector); @@ -165,7 +165,7 @@ public: //!@ name Methods for setting the data of transformation Standard_EXPORT void SetMirror (const gp_Ax2& thePlane); //! The method defines a scale type of transformation. - Standard_EXPORT void SetScale (const gp_Pnt& thePoint, Standard_Real theScale); + Standard_EXPORT void SetScale (const gp_Pnt& thePoint, double theScale); //! The method defines a complex type of transformation from one coordinate system to another. Standard_EXPORT void SetTransformation (const gp_Ax3& theCoordinateSystem1, const gp_Ax3& theCoordinateSystem2); @@ -178,15 +178,15 @@ public: //!@ name Overridden methods from TDF_Attribute //! The method is called on Undo / Redo. //! It copies the content of theAttribute into this attribute (copies the fields). - Standard_EXPORT void Restore (const Handle(TDF_Attribute)& theAttribute); + Standard_EXPORT void Restore (const occ::handle& theAttribute); //! It creates a new instance of this attribute. //! It is called on Copy / Paste, Undo / Redo. - Standard_EXPORT Handle(TDF_Attribute) NewEmpty () const; + Standard_EXPORT occ::handle NewEmpty () const; //! The method is called on Copy / Paste. //! It copies the content of this attribute into theAttribute (copies the fields). - Standard_EXPORT void Paste (const Handle(TDF_Attribute)& theAttribute, const Handle(TDF_RelocationTable)& theRelocationTable); + Standard_EXPORT void Paste (const occ::handle& theAttribute, const occ::handle& theRelocationTable); //! Prints the content of this attribute into the stream. Standard_EXPORT Standard_OStream& Dump(Standard_OStream& theOS); @@ -207,8 +207,8 @@ private: gp_Ax3 mySecondAx3; // Scalar values - Standard_Real myAngle; - Standard_Real myScale; + double myAngle; + double myScale; // Points gp_Pnt myFirstPoint; @@ -238,9 +238,9 @@ const Standard_GUID& MyPackage_Transformation::GetID() //purpose : Finds or creates the attribute attached to . // The found or created attribute is returned. //======================================================================= -Handle(MyPackage_Transformation) MyPackage_Transformation::Set(const TDF_Label& theLabel) +occ::handle MyPackage_Transformation::Set(const TDF_Label& theLabel) { - Handle(MyPackage_Transformation) T; + occ::handle T; if (!theLabel.FindAttribute(MyPackage_Transformation::GetID(), T)) { T = new MyPackage_Transformation(); @@ -309,7 +309,7 @@ gp_Trsf MyPackage_Transformation::Get() const //function : SetRotation //purpose : The method defines a rotation type of transformation. //======================================================================= -void MyPackage_Transformation::SetRotation(const gp_Ax1& theAxis, const Standard_Real theAngle) +void MyPackage_Transformation::SetRotation(const gp_Ax1& theAxis, const double theAngle) { Backup(); myType = gp_Rotation; @@ -369,7 +369,7 @@ void MyPackage_Transformation::SetMirror(const gp_Ax2& thePlane) //function : SetScale //purpose : The method defines a scale type of transformation. //======================================================================= -void MyPackage_Transformation::SetScale(const gp_Pnt& thePoint, const Standard_Real theScale) +void MyPackage_Transformation::SetScale(const gp_Pnt& thePoint, const double theScale) { Backup(); myType = gp_Scale; @@ -407,9 +407,9 @@ const Standard_GUID& MyPackage_Transformation::ID() const // It copies the content of // into this attribute (copies the fields). //======================================================================= -void MyPackage_Transformation::Restore(const Handle(TDF_Attribute)& theAttribute) +void MyPackage_Transformation::Restore(const occ::handle& theAttribute) { - Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute); + occ::handle theTransformation = occ::down_cast(theAttribute); myType = theTransformation->myType; myAx1 = theTransformation->myAx1; myAx2 = theTransformation->myAx2; @@ -426,7 +426,7 @@ void MyPackage_Transformation::Restore(const Handle(TDF_Attribute)& theAttribute //purpose : It creates a new instance of this attribute. // It is called on Copy / Paste, Undo / Redo. //======================================================================= -Handle(TDF_Attribute) MyPackage_Transformation::NewEmpty() const +occ::handle MyPackage_Transformation::NewEmpty() const { return new MyPackage_Transformation(); } @@ -437,10 +437,10 @@ Handle(TDF_Attribute) MyPackage_Transformation::NewEmpty() const // It copies the content of this attribute into // (copies the fields). //======================================================================= -void MyPackage_Transformation::Paste (const Handle(TDF_Attribute)& theAttribute, - const Handle(TDF_RelocationTable)& ) const +void MyPackage_Transformation::Paste (const occ::handle& theAttribute, + const occ::handle& ) const { - Handle(MyPackage_Transformation) theTransformation = Handle(MyPackage_Transformation)::DownCast(theAttribute); + occ::handle theTransformation = occ::down_cast(theAttribute); theTransformation->myType = myType; theTransformation->myAx1 = myAx1; theTransformation->myAx2 = myAx2; diff --git a/dox/samples/ocaf_func.md b/dox/samples/ocaf_func.md index 7f782a2e56..95ae6c765d 100644 --- a/dox/samples/ocaf_func.md +++ b/dox/samples/ocaf_func.md @@ -163,7 +163,7 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl ~~~~{.cpp} // The scope of functions is defined. - Handle(TFunction_Scope) scope = TFunction_Scope::Set( anyLabel ); + occ::handle scope = TFunction_Scope::Set( anyLabel ); // The information on modifications in the model is received. TFunction_Logbook& log = scope-GetLogbook(); @@ -177,17 +177,17 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl { // The function iterator may return a list of current functions for execution. // It might be useful for multi-threaded execution of functions. - const TDF_LabelList& currentFunctions = iterator.Current(); + const NCollection_List& currentFunctions = iterator.Current(); //The list of current functions is iterated. - TDF_ListIteratorOfLabelList currentterator( currentFunctions ); + NCollection_List::Iterator currentterator( currentFunctions ); for (; currentIterator.More(); currentIterator.Next()) { // An interface for the function is created. TFunction_IFunction interface( currentIterator.Value() ); // The function driver is retrieved. - Handle(TFunction_Driver) driver = interface.GetDriver(); + occ::handle driver = interface.GetDriver(); // The dependency of the function on the  modified data is checked. If (driver-MustExecute( log )) @@ -210,7 +210,7 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl ~~~~{.cpp} // A virtual method ::Arguments() returns a list of arguments of the function. - CylinderDriver::Arguments( TDF_LabelList& args ) + CylinderDriver::Arguments( NCollection_List& args ) { // The direct arguments, located at sub-leaves of the function, are collected (see picture 2). TDF_ChildIterator cIterator( Label(), false ); @@ -221,7 +221,7 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl Args.Append( sublabel ); // The references to the external data are checked. - Handle(TDF_Reference) ref; + occ::handle ref; If ( sublabel.FindAttribute( TDF_Reference::GetID(), ref ) ) { args.Append( ref-Get() ); @@ -229,7 +229,7 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl } // A virtual method ::Results() returns a list of result leaves. - CylinderDriver::Results( TDF_LabelList& res ) + CylinderDriver::Results( NCollection_List& res ) { // The result is kept at the function label.   Res.Append( Label() ); @@ -246,11 +246,11 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl TDF_Label radiusLabel = Label().FindChild( 2 ); // The multiplicator of the radius ()is retrieved. - Handle(TDataStd_Real) radiusValue; + occ::handle radiusValue; radiusLabel.FindAttribute( TDataStd_Real::GetID(), radiusValue); // The reference to the radius is retrieved. - Handle(TDF_Reference) refRadius; + occ::handle refRadius; RadiusLabel.FindAttribute( TDF_Reference::GetID(), refRadius ); // The radius value is calculated. @@ -263,7 +263,7 @@ drivers for a function driver table with the help of *TFunction_DriverTable* cl else { // The referenced radius value is retrieved. - Handle(TDataStd_Real) referencedRadiusValue; + occ::handle referencedRadiusValue; RefRadius-Get().FindAttribute(TDataStd_Real::GetID() ,referencedRadiusValue ); radius = referencedRadiusValue-Get() * radiusValue-Get(); } diff --git a/dox/specification/boolean_operations/boolean_operations.md b/dox/specification/boolean_operations/boolean_operations.md index f57c183e92..1c7b992b74 100644 --- a/dox/specification/boolean_operations/boolean_operations.md +++ b/dox/specification/boolean_operations/boolean_operations.md @@ -814,21 +814,21 @@ The following example illustrates how to use the GF algorithm: ~~~~{.cpp} BOPAlgo_Builder aBuilder; // Setting arguments -TopTools_ListOfShape aLSObjects = …; // Objects +NCollection_List aLSObjects = …; // Objects aBuilder.SetArguments(aLSObjects); // Setting options for GF // Set parallel processing mode (default is false) -Standard_Boolean bRunParallel = Standard_True; +bool bRunParallel = true; aBuilder.SetRunParallel(bRunParallel); // Set Fuzzy value (default is Precision::Confusion()) -Standard_Real aFuzzyValue = 1.e-5; +double aFuzzyValue = 1.e-5; aBuilder.SetFuzzyValue(aFuzzyValue); // Set safe processing mode (default is false) -Standard_Boolean bSafeMode = Standard_True; +bool bSafeMode = true; aBuilder.SetNonDestructive(bSafeMode); // Set Gluing mode for coinciding arguments (default is off) @@ -836,11 +836,11 @@ BOPAlgo_GlueEnum aGlue = BOPAlgo_GlueShift; aBuilder.SetGlue(aGlue); // Disabling/Enabling the check for inverted solids (default is true) -Standard Boolean bCheckInverted = Standard_False; +Standard Boolean bCheckInverted = false; aBuilder.SetCheckInverted(bCheckInverted); // Set OBB usage (default is false) -Standard_Boolean bUseOBB = Standard_True; +bool bUseOBB = true; aBuilder.SetUseOBB(buseobb); // Perform the operation @@ -1202,8 +1202,8 @@ On the low level the Splitter algorithm is implemented in class *BOPAlgo_Splitte ~~~~{.cpp} BOPAlgo_Splitter aSplitter; // Setting arguments and tools -TopTools_ListOfShape aLSObjects = …; // Objects -TopTools_ListOfShape aLSTools = …; // Tools +NCollection_List aLSObjects = …; // Objects +NCollection_List aLSTools = …; // Tools aSplitter.SetArguments(aLSObjects); aSplitter.SetTools(aLSTools); @@ -2185,14 +2185,14 @@ The usage of the algorithm on the API level: ~~~~{.cpp} BOPAlgo_MakerVolume aMV; // Set the arguments -TopTools_ListOfShape aLS = …; // arguments +NCollection_List aLS = …; // arguments aMV.SetArguments(aLS); // Set options for the algorithm // setting options for this algorithm is similar to setting options for GF algorithm (see "GF Usage" chapter) ... // Additional option of the algorithm -Standard_Boolean bAvoidInternalShapes = Standard_False; // Set to True to exclude from the result any shapes internal to the solids +bool bAvoidInternalShapes = false; // Set to True to exclude from the result any shapes internal to the solids aMV.SetAvoidInternalShapes(bAvoidInternalShapes); // Perform the operation @@ -2294,8 +2294,8 @@ const TopoDS_Shape& anAllCells = aCBuilder.GetAllParts(); //all split parts TopTools_ListOfShape aLSToTake = ...; // parts of these arguments will be taken into result TopTools_ListOfShape aLSToAvoid = ...; // parts of these arguments will not be taken into result // -Standard_Integer iMaterial = 1; // defines the material for the cells -Standard_Boolean bUpdate = Standard_False; // defines whether to update the result right now or not +int iMaterial = 1; // defines the material for the cells +bool bUpdate = false; // defines whether to update the result right now or not // adding to result aCBuilder.AddToResult(aLSToTake, aLSToAvoid, iMaterial, bUpdate); aCBuilder.RemoveInternalBoundaries(); // removing of the boundaries @@ -2826,7 +2826,7 @@ BOPAlgo_Builder aGF; // .... // enabling the safe processing mode to prevent modification of the input shapes -aGF.SetNonDestructive(Standard_True); +aGF.SetNonDestructive(true); // .... ~~~~ @@ -2857,7 +2857,7 @@ BOPAlgo_Builder aGF; // .... // disabling the classification of the input solid -aGF.SetCheckInverted(Standard_False); +aGF.SetCheckInverted(false); // .... ~~~~ @@ -2884,7 +2884,7 @@ BOPAlgo_Builder aGF; // .... // Enabling the usage of OBB in the operation -aGF.SetUseOBB(Standard_True); +aGF.SetUseOBB(true); // .... ~~~~ @@ -3181,7 +3181,7 @@ The following example illustrates how to use General Fuse operator: BRepAlgoAPI_BuilderAlgo aBuilder; // // prepare the arguments - TopTools_ListOfShape& aLS=…; + NCollection_List& aLS=…; // // set the arguments aBuilder.SetArguments(aLS); @@ -3240,9 +3240,9 @@ BRepAlgoAPI_BuilderAlgo aSplitter; // // prepare the arguments // objects -TopTools_ListOfShape& aLSObjects = … ; +NCollection_List& aLSObjects = … ; // tools -TopTools_ListOfShape& aLSTools = … ; +NCollection_List& aLSTools = … ; // // set the arguments aSplitter.SetArguments(aLSObjects); @@ -3302,15 +3302,15 @@ The following example illustrates how to use Common operation: #include #include < BRepAlgoAPI_Common.hxx> {… - Standard_Boolean bRunParallel; - Standard_Real aFuzzyValue; + bool bRunParallel; + double aFuzzyValue; BRepAlgoAPI_Common aBuilder; // prepare the arguments - TopTools_ListOfShape& aLS=…; - TopTools_ListOfShape& aLT=…; + NCollection_List& aLS=…; + NCollection_List& aLT=…; // - bRunParallel=Standard_True; + bRunParallel=true; aFuzzyValue=2.1e-5; // // set the arguments @@ -3369,15 +3369,15 @@ The following example illustrates how to use Fuse operation: #include #include < BRepAlgoAPI_Fuse.hxx> {… - Standard_Boolean bRunParallel; - Standard_Real aFuzzyValue; + bool bRunParallel; + double aFuzzyValue; BRepAlgoAPI_Fuse aBuilder; // prepare the arguments - TopTools_ListOfShape& aLS=…; - TopTools_ListOfShape& aLT=…; + NCollection_List& aLS=…; + NCollection_List& aLT=…; // - bRunParallel=Standard_True; + bRunParallel=true; aFuzzyValue=2.1e-5; // // set the arguments @@ -3436,15 +3436,15 @@ The following example illustrates how to use Cut operation: #include #include < BRepAlgoAPI_Cut.hxx> {… - Standard_Boolean bRunParallel; - Standard_Real aFuzzyValue; + bool bRunParallel; + double aFuzzyValue; BRepAlgoAPI_Cut aBuilder; // prepare the arguments - TopTools_ListOfShape& aLS=…; - TopTools_ListOfShape& aLT=…; + NCollection_List& aLS=…; + NCollection_List& aLT=…; // - bRunParallel=Standard_True; + bRunParallel=true; aFuzzyValue=2.1e-5; // // set the arguments @@ -3504,15 +3504,15 @@ The following example illustrates how to use Section operation: #include #include < BRepAlgoAPI_Section.hxx> {… - Standard_Boolean bRunParallel; - Standard_Real aFuzzyValue; + bool bRunParallel; + double aFuzzyValue; BRepAlgoAPI_Section aBuilder; // prepare the arguments - TopTools_ListOfShape& aLS=…; - TopTools_ListOfShape& aLT=…; + NCollection_List& aLS=…; + NCollection_List& aLT=…; // - bRunParallel=Standard_True; + bRunParallel=true; aFuzzyValue=2.1e-5; // // set the arguments diff --git a/dox/tutorial/tutorial.md b/dox/tutorial/tutorial.md index 0825c9b464..e1d3d52bb8 100644 --- a/dox/tutorial/tutorial.md +++ b/dox/tutorial/tutorial.md @@ -77,7 +77,7 @@ To instantiate a *gp_Pnt* object, just specify the X, Y, and Z coordinates of th Once your objects are instantiated, you can use methods provided by the class to access and modify its data. For example, to get the X coordinate of a point: ~~~~{.cpp} -Standard_Real xValue1 = aPnt1.X(); +double xValue1 = aPnt1.X(); ~~~~ @subsection OCCT_TUTORIAL_SUB2_2 Profile: Defining the Geometry @@ -96,16 +96,16 @@ This is because the *GC* provides two algorithm classes which are exactly what i Both of these classes return a *Geom_TrimmedCurve* manipulated by handle. This entity represents a base curve (line or circle, in our case), limited between two of its parameter values. For example, circle C is parameterized between 0 and 2PI. If you need to create a quarter of a circle, you create a *Geom_TrimmedCurve* on C limited between 0 and M_PI/2. ~~~~{.cpp} - Handle(Geom_TrimmedCurve) aArcOfCircle = GC_MakeArcOfCircle(aPnt2,aPnt3,aPnt4); - Handle(Geom_TrimmedCurve) aSegment1 = GC_MakeSegment(aPnt1, aPnt2); - Handle(Geom_TrimmedCurve) aSegment2 = GC_MakeSegment(aPnt4, aPnt5); + occ::handle aArcOfCircle = GC_MakeArcOfCircle(aPnt2,aPnt3,aPnt4); + occ::handle aSegment1 = GC_MakeSegment(aPnt1, aPnt2); + occ::handle aSegment2 = GC_MakeSegment(aPnt4, aPnt5); ~~~~ All *GC* classes provide a casting method to obtain a result automatically with a function-like call. Note that this method will raise an exception if construction has failed. To handle possible errors more explicitly, you may use the *IsDone* and *Value* methods. For example: ~~~~{.cpp} GC_MakeSegment mkSeg (aPnt1, aPnt2); - Handle(Geom_TrimmedCurve) aSegment1; + occ::handle aSegment1; if(mkSegment.IsDone()){ aSegment1 = mkSeg.Value(); } @@ -370,8 +370,8 @@ To create a cylinder, use another class from the primitives construction package * the radius and height. ~~~~{.cpp} - Standard_Real myNeckRadius = myThickness / 4.; - Standard_Real myNeckHeight = myHeight / 10; + double myNeckRadius = myThickness / 4.; + double myNeckHeight = myHeight / 10; BRepPrimAPI_MakeCylinder MKCylinder(neckAx2, myNeckRadius, myNeckHeight); TopoDS_Shape myNeck = MKCylinder.Shape(); ~~~~ @@ -424,7 +424,7 @@ For each detected face, you need to access the geometric properties of the shape * *Point* to access the 3D point of a vertex. ~~~~{.cpp} -Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace); +occ::handle aSurface = BRep_Tool::Surface(aFace); ~~~~ As you can see, the *BRep_Tool::Surface* method returns an instance of the *Geom_Surface* class manipulated by handle. However, the *Geom_Surface* class does not provide information about the real type of the object *aSurface*, which could be an instance of *Geom_Plane*, *Geom_CylindricalSurface*, etc. @@ -444,21 +444,21 @@ To compare a given type with the type you seek, use the *STANDARD_TYPE* macro, w If this comparison is true, you know that the *aSurface* real type is *Geom_Plane*. You can then convert it from *Geom_Surface* to *Geom_Plane* by using the *DownCast()* method provided by each class inheriting *Standard_Transient*. As its name implies, this static method is used to downcast objects to a given type with the following syntax: ~~~~{.cpp} - Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurface); + occ::handle aPlane = occ::down_cast(aSurface); ~~~~ Remember that the goal of all these conversions is to find the highest face of the bottle lying on a plane. Suppose that you have these two global variables: ~~~~{.cpp} TopoDS_Face faceToRemove; - Standard_Real zMax = -1; + double zMax = -1; ~~~~ You can easily find the plane whose origin is the biggest in Z knowing that the location of the plane is given with the *Geom_Plane::Location* method. For example: ~~~~{.cpp} gp_Pnt aPnt = aPlane->Location(); - Standard_Real aZ = aPnt.Z(); + double aZ = aPnt.Z(); if(aZ > zMax){ zMax = aZ; faceToRemove = aFace; @@ -470,7 +470,7 @@ Open CASCADE Technology provides many collections for different kinds of objects The collection for shapes can be found in the *TopTools* package. As *BRepOffsetAPI_MakeThickSolid* requires a list, use the *TopTools_ListOfShape* class. ~~~~{.cpp} - TopTools_ListOfShape facesToRemove; + NCollection_List facesToRemove; facesToRemove.Append(faceToRemove); ~~~~ @@ -504,9 +504,9 @@ Using the same coordinate system *neckAx2* used to position the neck, you create Notice that one of the cylindrical surfaces is smaller than the neck. There is a good reason for this: after the thread creation, you will fuse it with the neck. So, we must make sure that the two shapes remain in contact. ~~~~{.cpp} - Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99); + occ::handle aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99); - Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05); + occ::handle aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05); ~~~~ @@ -588,18 +588,18 @@ Supposing that: Your ellipses are defined as follows: ~~~~{.cpp} - Standard_Real aMajor = 2. * M_PI; - Standard_Real aMinor = myNeckHeight / 10; - Handle(Geom2d_Ellipse) anEllipse1 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor); - Handle(Geom2d_Ellipse) anEllipse2 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor / 4); + double aMajor = 2. * M_PI; + double aMinor = myNeckHeight / 10; + occ::handle anEllipse1 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor); + occ::handle anEllipse2 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor / 4); ~~~~ To describe portions of curves for the arcs drawn above, you define *Geom2d_TrimmedCurve* trimmed curves out of the created ellipses and two parameters to limit them. As the parametric equation of an ellipse is P(U) = O + (MajorRadius * cos(U) * XDirection) + (MinorRadius * sin(U) * YDirection), the ellipses need to be limited between 0 and M_PI. ~~~~{.cpp} - Handle(Geom2d_TrimmedCurve) anArc1 = new Geom2d_TrimmedCurve(anEllipse1, 0, M_PI); - Handle(Geom2d_TrimmedCurve) anArc2 = new Geom2d_TrimmedCurve(anEllipse2, 0, M_PI); + occ::handle anArc1 = new Geom2d_TrimmedCurve(anEllipse1, 0, M_PI); + occ::handle anArc2 = new Geom2d_TrimmedCurve(anEllipse2, 0, M_PI); ~~~~ The last step consists in defining the segment, which is the same for the two profiles: a line limited by the first and the last point of one of the arcs. @@ -615,7 +615,7 @@ When creating the bottle's profile, you used classes from the *GC* package, prov In 2D geometry, this kind of algorithms is found in the *GCE2d* package. Class names and behaviors are similar to those in *GC*. For example, to create a 2D segment out of two points: ~~~~{.cpp} - Handle(Geom2d_TrimmedCurve) aSegment = GCE2d_MakeSegment(anEllipsePnt1, anEllipsePnt2); + occ::handle aSegment = GCE2d_MakeSegment(anEllipsePnt1, anEllipsePnt2); ~~~~ @@ -675,9 +675,9 @@ The loft function is implemented in the *BRepOffsetAPI_ThruSections* class, whic * Ask for the resulting loft shape with the Shape method. ~~~~{.cpp} - BRepOffsetAPI_ThruSections aTool(Standard_True); + BRepOffsetAPI_ThruSections aTool(true); aTool.AddWire(threadingWire1); aTool.AddWire(threadingWire2); - aTool.CheckCompatibility(Standard_False); + aTool.CheckCompatibility(false); TopoDS_Shape myThreading = aTool.Shape(); ~~~~ @@ -709,8 +709,8 @@ If you want to know more and develop major projects using Open CASCADE Technolog Complete definition of MakeBottle function (defined in the file src/MakeBottle.cxx of the Tutorial): ~~~~{.cpp} - TopoDS_Shape MakeBottle(const Standard_Real myWidth, const Standard_Real myHeight, - const Standard_Real myThickness) + TopoDS_Shape MakeBottle(const double myWidth, const double myHeight, + const double myThickness) { // Profile : Define Support Points gp_Pnt aPnt1(-myWidth / 2., 0, 0); @@ -720,9 +720,9 @@ Complete definition of MakeBottle function (defined in the file src/MakeBottle.c gp_Pnt aPnt5(myWidth / 2., 0, 0); // Profile : Define the Geometry - Handle(Geom_TrimmedCurve) anArcOfCircle = GC_MakeArcOfCircle(aPnt2,aPnt3,aPnt4); - Handle(Geom_TrimmedCurve) aSegment1 = GC_MakeSegment(aPnt1, aPnt2); - Handle(Geom_TrimmedCurve) aSegment2 = GC_MakeSegment(aPnt4, aPnt5); + occ::handle anArcOfCircle = GC_MakeArcOfCircle(aPnt2,aPnt3,aPnt4); + occ::handle aSegment1 = GC_MakeSegment(aPnt1, aPnt2); + occ::handle aSegment2 = GC_MakeSegment(aPnt4, aPnt5); // Profile : Define the Topology TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(aSegment1); @@ -766,8 +766,8 @@ Complete definition of MakeBottle function (defined in the file src/MakeBottle.c gp_Dir neckAxis = gp::DZ(); gp_Ax2 neckAx2(neckLocation, neckAxis); - Standard_Real myNeckRadius = myThickness / 4.; - Standard_Real myNeckHeight = myHeight / 10.; + double myNeckRadius = myThickness / 4.; + double myNeckHeight = myHeight / 10.; BRepPrimAPI_MakeCylinder MKCylinder(neckAx2, myNeckRadius, myNeckHeight); TopoDS_Shape myNeck = MKCylinder.Shape(); @@ -776,16 +776,16 @@ Complete definition of MakeBottle function (defined in the file src/MakeBottle.c // Body : Create a Hollowed Solid TopoDS_Face faceToRemove; - Standard_Real zMax = -1; + double zMax = -1; for(TopExp_Explorer aFaceExplorer(myBody, TopAbs_FACE); aFaceExplorer.More(); aFaceExplorer.Next()){ TopoDS_Face aFace = TopoDS::Face(aFaceExplorer.Current()); // Check if is the top face of the bottle's neck - Handle(Geom_Surface) aSurface = BRep_Tool::Surface(aFace); + occ::handle aSurface = BRep_Tool::Surface(aFace); if(aSurface->DynamicType() == STANDARD_TYPE(Geom_Plane)){ - Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(aSurface); + occ::handle aPlane = occ::down_cast(aSurface); gp_Pnt aPnt = aPlane->Location(); - Standard_Real aZ = aPnt.Z(); + double aZ = aPnt.Z(); if(aZ > zMax){ zMax = aZ; faceToRemove = aFace; @@ -793,31 +793,31 @@ Complete definition of MakeBottle function (defined in the file src/MakeBottle.c } } - TopTools_ListOfShape facesToRemove; + NCollection_List facesToRemove; facesToRemove.Append(faceToRemove); BRepOffsetAPI_MakeThickSolid aSolidMaker; aSolidMaker.MakeThickSolidByJoin(myBody, facesToRemove, -myThickness / 50, 1.e-3); myBody = aSolidMaker.Shape(); // Threading : Create Surfaces - Handle(Geom_CylindricalSurface) aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99); - Handle(Geom_CylindricalSurface) aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05); + occ::handle aCyl1 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 0.99); + occ::handle aCyl2 = new Geom_CylindricalSurface(neckAx2, myNeckRadius * 1.05); // Threading : Define 2D Curves gp_Pnt2d aPnt(2. * M_PI, myNeckHeight / 2.); gp_Dir2d aDir(2. * M_PI, myNeckHeight / 4.); gp_Ax2d anAx2d(aPnt, aDir); - Standard_Real aMajor = 2. * M_PI; - Standard_Real aMinor = myNeckHeight / 10; + double aMajor = 2. * M_PI; + double aMinor = myNeckHeight / 10; - Handle(Geom2d_Ellipse) anEllipse1 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor); - Handle(Geom2d_Ellipse) anEllipse2 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor / 4); - Handle(Geom2d_TrimmedCurve) anArc1 = new Geom2d_TrimmedCurve(anEllipse1, 0, M_PI); - Handle(Geom2d_TrimmedCurve) anArc2 = new Geom2d_TrimmedCurve(anEllipse2, 0, M_PI); + occ::handle anEllipse1 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor); + occ::handle anEllipse2 = new Geom2d_Ellipse(anAx2d, aMajor, aMinor / 4); + occ::handle anArc1 = new Geom2d_TrimmedCurve(anEllipse1, 0, M_PI); + occ::handle anArc2 = new Geom2d_TrimmedCurve(anEllipse2, 0, M_PI); gp_Pnt2d anEllipsePnt1 = anEllipse1->Value(0); gp_Pnt2d anEllipsePnt2 = anEllipse1->Value(M_PI); - Handle(Geom2d_TrimmedCurve) aSegment = GCE2d_MakeSegment(anEllipsePnt1, anEllipsePnt2); + occ::handle aSegment = GCE2d_MakeSegment(anEllipsePnt1, anEllipsePnt2); // Threading : Build Edges and Wires TopoDS_Edge anEdge1OnSurf1 = BRepBuilderAPI_MakeEdge(anArc1, aCyl1); TopoDS_Edge anEdge2OnSurf1 = BRepBuilderAPI_MakeEdge(aSegment, aCyl1); @@ -829,10 +829,10 @@ Complete definition of MakeBottle function (defined in the file src/MakeBottle.c BRepLib::BuildCurves3d(threadingWire2); // Create Threading - BRepOffsetAPI_ThruSections aTool(Standard_True); + BRepOffsetAPI_ThruSections aTool(true); aTool.AddWire(threadingWire1); aTool.AddWire(threadingWire2); - aTool.CheckCompatibility(Standard_False); + aTool.CheckCompatibility(false); TopoDS_Shape myThreading = aTool.Shape(); diff --git a/dox/upgrade/upgrade.md b/dox/upgrade/upgrade.md index aac37d3f40..6b978ffa39 100644 --- a/dox/upgrade/upgrade.md +++ b/dox/upgrade/upgrade.md @@ -41,10 +41,10 @@ Porting of user applications from an earlier OCCT version to version 6.5.1 requi * Method *Graphic3d_Structure::Groups()* now returns *Graphic3d_SequenceOfGroup*. If this method has been used, the application code should be updated to iterate another collection type or, if *Graphic3d_HSetOfGroup* is required, to fill its own collection: ~~~~{.cpp} -const Graphic3d_SequenceOfGroup& aGroupsSeq = theStructure.Groups(); -Handle(Graphic3d_HSetOfGroup) aGroupSet = new Graphic3d_HSetOfGroup(); -Standard_Integer aLen = aGroupsSeq.Length(); -for (Standard_Integer aGr = 1; aGr <= aLen; ++aGr) +const NCollection_Sequence>& aGroupsSeq = theStructure.Groups(); +occ::handle aGroupSet = new Graphic3d_HSetOfGroup(); +int aLen = aGroupsSeq.Length(); +for (int aGr = 1; aGr <= aLen; ++aGr) { aGroupSet->Add (aGroupsSeq.Value (aGr)); } @@ -64,7 +64,7 @@ Porting of user applications from an earlier OCCT version to version 6.5.2 requi * The print method used in the application code might need to be revised to take into account the ability to choose between print algorithms: tile and stretch. The stretch algorithm will be selected by default during porting. * It is recommended to *BRepMesh_DiscretFactory* users, to check *BRepMesh_DiscretFactory::SetDefault()* return value to determine plugin availability / validity. *BRepMesh_DiscretFactory::Discret()* method now returns handle instead of pointer. The code should be updated in the following manner: ~~~~{.cpp} -Handle(BRepMesh_DiscretRoot) aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape, theDeflection, theAngularToler); +occ::handle aMeshAlgo = BRepMesh_DiscretFactory::Get().Discret (theShape, theDeflection, theAngularToler); if (!aMeshAlgo.IsNull()) {} ~~~~ @@ -91,10 +91,10 @@ Porting of user applications from an earlier OCCT version to version 6.5.4 requi * The code using obsolete classes *Aspect_PixMap, Xw_PixMap* and *WNT_PixMap* should be rewritten implementing class *Image_PixMap*, which is now retrieved by *ToPixMap* methods as argument. A sample code using *ToPixMap* is given below: ~~~~{.cpp} #include -void dump (Handle(V3d_View)& theView3D) +void dump (occ::handle& theView3D) { - Standard_Integer aWndSizeX = 0; - Standard_Integer aWndSizeY = 0; + int aWndSizeX = 0; + int aWndSizeY = 0; theView3D->Window()->Size (aWndSizeX, aWndSizeY); Image_AlienPixMap aPixMap; theView3D->ToPixMap (aPixMap, aWndSizeX, aWndSizeY); @@ -124,11 +124,11 @@ Refer to the Visualization User's Guide for further details concerning OCCT 3D v * Run-time graphic driver library loading mechanism based on *CSF_GraphicShr* environment variable usage has been replaced by explicit linking against *TKOpenGl* library. The code sample below shows how the graphic driver should be created and initialized in the application code: ~~~~{.cpp} // initialize a new viewer with OpenGl graphic driver -Handle(Graphic3d_GraphicDriver) aGraphicDriver = +occ::handle aGraphicDriver = new OpenGl_GraphicDriver ("TKOpenGl"); aGraphicDriver->Begin (new Aspect_DisplayConnection()); TCollection_ExtendedString aNameOfViewer ("Visu3D"); - Handle(V3d_Viewer) aViewer + occ::handle aViewer = new V3d_Viewer (aGraphicDriver, aNameOfViewer.ToExtString()); aViewer->Init(); @@ -136,18 +136,18 @@ new OpenGl_GraphicDriver ("TKOpenGl"); // provided by a 3rd-party framework (Qt, MFC, C# or Cocoa) #if defined(_WIN32) || defined(__WIN32__) Aspect_Handle aWindowHandle = (Aspect_Handle )winId(); - Handle(WNT_Window) aWindow = new WNT_Window (winId()); + occ::handle aWindow = new WNT_Window (winId()); #elif defined(__APPLE__) && !defined(MACOSX_USE_GLX) NSView* aViewHandle = (NSView* )winId(); - Handle(Cocoa_Window) aWindow = new Cocoa_Window (aViewHandle); + occ::handle aWindow = new Cocoa_Window (aViewHandle); #else Aspect_Handle aWindowHandle = (Aspect_Handle )winId(); - Handle(Xw_Window) aWindow = + occ::handle aWindow = new Xw_Window (aGraphicDriver->GetDisplayConnection(), aWindowHandle); #endif // WNT // setup the window for a new view - Handle(V3d_View) aView = aViewer->CreateView(); + occ::handle aView = aViewer->CreateView(); aView->SetWindow (aWindow); ~~~~ @@ -266,10 +266,10 @@ Custom Interactive Objects should implement new virtual method *SelectMgr_Select Now the method *SelectMgr_Selection::Sensitive()* does not return *SelectBasics_SensitiveEntity*. It returns an instance of *SelectMgr_SensitiveEntity*, which belongs to a different class hierarchy (thus *DownCast()* will fail). To access base sensitive it is necessary to use method *SelectMgr_SensitiveEntity::BaseSensitive()*. For example: ~~~~{.cpp} -Handle(SelectMgr_Selection) aSelection = anInteractiveObject->Selection (aMode); +occ::handle aSelection = anInteractiveObject->Selection (aMode); for (aSelection->Init(); aSelection->More(); aSelection->Next()) { - Handle(SelectBasics_SensitiveEntity) anEntity = aSelection->Sensitive()->BaseSensitive(); + occ::handle anEntity = aSelection->Sensitive()->BaseSensitive(); } ~~~~ @@ -290,14 +290,14 @@ Here is an example of overlap/inclusion test for a box: ~~~~{.cpp} if (!theMgr.IsOverlapAllowed()) // check for inclusion { - Standard_Boolean isInside = Standard_True; + bool isInside = true; return theMgr.Overlaps (myBox.CornerMin(), myBox.CornerMax(), &isInside) && isInside; } -Standard_Real aDepth; +double aDepth; if (!theMgr.Overlaps (myBox, aDepth)) // check for overlap { - return Standard_False; + return false; } thePickResult = @@ -433,19 +433,19 @@ DEFINE_STANDARD_RTTI(Class) -> DEFINE_STANDARD_RTTIEXT(Class, Base) 2. Replaces forward declarations of collection classes previously generated from CDL generics (defined in *TCollection* package) by inclusion of the corresponding header: ~~~~{.cpp} -class TColStd_Array1OfReal; -> #include +class NCollection_Array1; -> #include .hxx> ~~~~ 3. Replaces underscored names of *Handle* classes by usage of a macro: ~~~~{.cpp} -Handle_Class -> Handle(Class) +Handle_Class -> occ::handle ~~~~ This change is not applied if the source or header file is recognized as containing the definition of Qt class with signals or slots, to avoid possible compilation errors of MOC files caused by inability of MOC to recognize macros (see https://doc.qt.io/qt-4.8/signalsandslots.html). The file is considered as defining a Qt object if it contains strings *Q_OBJECT* and either *slots:* or *signals:*. 4. Removes forward declarations of classes with names Handle(C) or *Handle_C*, replacing them either by forward declaration of its argument class, or (for files defining Qt objects) \#include statement for a header with the name of the argument class and extension .hxx: ~~~~{.cpp} -class Handle(TColStd_HArray1OfReal); -> #include +class occ::handle>; -> #include .hxx> ~~~~ 5. Removes \#includes of files Handle_...hxx that have disappeared in OCCT 7.0: @@ -455,26 +455,26 @@ class Handle(TColStd_HArray1OfReal); -> #include 6. Removes *typedef* statements that use *Handle* macro to generate the name: ~~~~{.cpp} -typedef NCollection_Handle Handle(Message_Msg); -> +typedef NCollection_Handle occ::handle; -> ~~~~ 7. Converts C-style casts applied to Handles into calls to DownCast() method: ~~~~{.cpp} - ((Handle(A)&)b) -> Handle(A)::DownCast(b) - (Handle(A)&)b -> Handle(A)::DownCast(b) - (*((Handle(A)*)&b)) -> Handle(A)::DownCast(b) - *((Handle(A)*)&b) -> Handle(A)::DownCast(b) - (*(Handle(A)*)&b) -> Handle(A)::DownCast(b) + ((occ::handle&)b) -> occ::down_cast(b) + (occ::handle&)b -> occ::down_cast(b) + (*((occ::handle*)&b)) -> occ::down_cast(b) + *((occ::handle*)&b) -> occ::down_cast(b) + (*(occ::handle*)&b) -> occ::down_cast(b) ~~~~ 8. Moves Handle() macro out of namespace scope: ~~~~{.cpp} -Namespace::Handle(Class) -> Handle(Namespace::Class) +Namespace::occ::handle -> Handle(Namespace::Class) ~~~~ 9. Converts local variables of reference type, which are initialized by a temporary object returned by call to DownCast(), to the variables of non-reference type (to avoid using references to destroyed memory): ~~~~{.cpp} - const Handle(A)& a = Handle(B)::DownCast (b); -> Handle(A) a (Handle(B)::DownCast (b)); + const occ::handle& a = Handle(B)::DownCast (b); -> occ::handle a (Handle(B)::DownCast (b)); ~~~~ 10. Adds \#include for all classes used as argument to macro STANDARD_TYPE(), except for already included ones; @@ -508,7 +508,7 @@ The use of handle objects (construction, comparison using operators == or !=, us For example, the following lines will fail to compile if *Geom_Line.hxx* is not included: ~~~~{.cpp} -Handle(Geom_Line) aLine = 0; +occ::handle aLine = 0; if (aLine != aCurve) {...} if (aCurve->IsKind(STANDARD_TYPE(Geom_Line)) {...} aLine = Handle(Geom_Line)::DownCast (aCurve); @@ -525,10 +525,10 @@ The problem is that operator const handle& is defined for any type Example: ~~~~{.cpp} -void func (const Handle(Geom_Curve)&); -void func (const Handle(Geom_Surface)&); +void func (const occ::handle&); +void func (const occ::handle&); -Handle(Geom_TrimmedCurve) aCurve = new Geom_TrimmedCurve (...); +occ::handle aCurve = new Geom_TrimmedCurve (...); func (aCurve); // ambiguity error in VC++ 10 ~~~~ @@ -538,16 +538,16 @@ To resolve this ambiguity, change your code so that argument type should corresp In some cases this can be done by using the relevant type for the corresponding variable, like in the example above: ~~~~{.cpp} -Handle(Geom_Curve) aCurve = new Geom_TrimmedCurve (...); +occ::handle aCurve = new Geom_TrimmedCurve (...); ~~~~ Other variants consist in assigning the argument to a local variable of the correct type and using the direct cast or constructor: ~~~~{.cpp} -const Handle(Geom_Curve)& aGCurve (aTrimmedCurve); +const occ::handle& aGCurve (aTrimmedCurve); func (aGCurve); // OK - argument has exact type func (static_cast(aCurve)); // OK - direct cast -func (Handle(Geom_Curve)(aCurve)); // OK - temporary handle is constructed +func (occ::handle(aCurve)); // OK - temporary handle is constructed ~~~~ Another possibility consists in defining additional template variant of the overloaded function causing ambiguity, and using *SFINAE* to resolve the ambiguity. @@ -560,7 +560,7 @@ As the cast of a handle to the reference to another handle to the base type has For example: ~~~~{.cpp} -Handle(Geom_Geometry) aC = GC_MakeLine (p, v); // compiler error +occ::handle aC = GC_MakeLine (p, v); // compiler error ~~~~ The problem is that the class *GC_MakeLine* has a user-defined conversion to const Handle(Geom_TrimmedCurve)&, which is not the same as the type of the local variable *aC*. @@ -568,21 +568,21 @@ The problem is that the class *GC_MakeLine* has a user-defined conversion to To resolve this, use method Value(): ~~~~{.cpp} -Handle(Geom_Geometry) aC = GC_MakeLine (p, v).Value(); // ok +occ::handle aC = GC_MakeLine (p, v).Value(); // ok ~~~~ or use variable of the appropriate type: ~~~~{.cpp} -Handle(Geom_TrimmedCurve) aC = GC_MakeLine (p, v); // ok +occ::handle aC = GC_MakeLine (p, v); // ok ~~~~ A similar problem appears with GCC compiler, when *const* handle to derived type is used to construct handle to base type via assignment (and in some cases in return statement), for instance: ~~~~{.cpp} - const Handle(Geom_Line) aLine; - Handle(Geom_Curve) c1 = aLine; // GCC error - Handle(Geom_Curve) c2 (aLine); // ok + const occ::handle aLine; + occ::handle c1 = aLine; // GCC error + occ::handle c2 (aLine); // ok ~~~~ This problem is specific to GCC and it does not appear if macro *OCCT_HANDLE_NOCAST* is used, see @ref upgrade_occt700_cdl_nocast "below". @@ -595,9 +595,9 @@ You might need to clean your code from incorrect use of macros *STANDARD_TYPE*() Example: ~~~~{.cpp} -const Handle(Standard_Type)& STANDARD_TYPE(math_GlobOptMin) +const occ::handle& STANDARD_TYPE(math_GlobOptMin) { - static Handle(Standard_Type) _atype = new Standard_Type ("math_GlobOptMin", sizeof (math_GlobOptMin)); + static occ::handle _atype = new Standard_Type ("math_GlobOptMin", sizeof (math_GlobOptMin)); return _atype; } ~~~~ @@ -619,8 +619,8 @@ Handles in OCCT 7.0 do not have the operator of conversion to Standard_Transi This is done to prevent possible unintended errors like this: ~~~~{.cpp} -Handle(Geom_Line) aLine = ...; -Handle(Geom_Surface) aSurf = ...; +occ::handle aLine = ...; +occ::handle aSurf = ...; ... if (aLine == aSurf) {...} // will cause a compiler error in OCCT 7.0, but not OCCT 6.x ~~~~ @@ -629,7 +629,7 @@ The places where this implicit cast has been used should be corrected manually. The typical situation is when Handle is passed to stream: ~~~~{.cpp} -Handle(Geom_Line) aLine = ...; +occ::handle aLine = ...; os << aLine; // in OCCT 6.9.0, resolves to operator << (void*) ~~~~ @@ -641,8 +641,8 @@ Method *DownCast()* in OCCT 7.0 is made templated; if its argument is not a base This is done to prevent possible unintended errors like this: ~~~~{.cpp} -Handle(Geom_Surface) aSurf = ; -Handle(Geom_Line) aLine = +occ::handle aSurf = ; +occ::handle aLine = Handle(Geom_Line)::DownCast (aSurf); // will cause a compiler warning in OCCT 7.0, but not OCCT 6.x ~~~~ @@ -652,9 +652,9 @@ If down casting is used in a template context where the argument can have the sa ~~~~{.cpp} template -bool CheckLine (const Handle(T) theArg) +bool CheckLine (const occ::handle theArg) { - Handle(Geom_Line) aLine = dynamic_cast (theArg.get()); + occ::handle aLine = dynamic_cast (theArg.get()); ... } ~~~~ @@ -674,8 +674,8 @@ Example: ~~~~{.cpp} // note that DownCast() returns new temporary object! -const Handle(Geom_BoundedCurve)& aBC = -Handle(Geom_TrimmedCurve)::DownCast(aCurve); +const occ::handle& aBC = +occ::down_cast(aCurve); aBC->Transform (T); // access violation in OCCT 7.0 ~~~~ @@ -685,9 +685,9 @@ In OCCT 6.x and earlier versions the handle classes formed a hierarchy echoing t This automatically enabled the possibility to use the handle to a derived class in all contexts where the handle to a base class was needed, e.g. to pass it in a function by reference without copying: ~~~~{.cpp} -Standard_Boolean GetCurve (Handle(Geom_Curve)& theCurve); +bool GetCurve (occ::handle& theCurve); .... -Handle(Geom_Line) aLine; +occ::handle aLine; if (GetCurve (aLine)) { // use aLine, unsafe } @@ -707,8 +707,8 @@ The code that relies on the possibility of casting to base should be amended to For instance, the code from the example below can be changed as follows: ~~~~{.cpp} -Handle(Geom_Line) aLine; -Handle(Geom_Curve) aCurve; +occ::handle aLine; +occ::handle aCurve; if (GetCurve (aCure) && !(aLine = Handle(Geom_Line)::DownCast (aCurve)).IsNull()) { // use aLine safely } @@ -804,9 +804,9 @@ The property of *V3d_View* storing the global *ColorScale* object has been remov Here is an example of creating *ColorScale* using the updated API: ~~~~{.cpp} -Handle(AIS_ColorScale) aCS = new AIS_ColorScale(); +occ::handle aCS = new AIS_ColorScale(); // configuring -Standard_Integer aWidth, aHeight; +int aWidth, aHeight; aView->Window()->Size (aWidth, aHeight); aCS->SetSize (aWidth, aHeight); aCS->SetRange (0.0, 10.0); @@ -837,8 +837,8 @@ vdrawtext t "2D-TEXT" -2d -pos 0 150 0 -color red Here is a small example in C++ illustrating how to display a custom AIS object in 2d: ~~~~{.cpp} -Handle(AIS_InteractiveContext) aContext = ...; -Handle(AIS_InteractiveObject) anObj =...; // create an AIS object +occ::handle aContext = ...; +occ::handle anObj =...; // create an AIS object anObj->SetZLayer(Graphic3d_ZLayerId_TopOSD); // display object in overlay anObj->SetTransformPersistence (Graphic3d_TMF_2d, gp_Pnt (-1,-1,0)); // set 2d flag, coordinate origin is set to down-left corner aContext->Display (anObj); // display the object @@ -885,15 +885,15 @@ Old APIs based on global callback functions for creating *UserDraw* objects and class UserDrawElement : public OpenGl_Element {}; //! Implementation of virtual method AIS_InteractiveObject::Compute(). -void UserDrawObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) +void UserDrawObject::Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) { - Graphic3d_Vec4 aBndMin (myCoords[0], myCoords[1], myCoords[2], 1.0f); - Graphic3d_Vec4 aBndMax (myCoords[3], myCoords[4], myCoords[5], 1.0f); + NCollection_Vec4 aBndMin (myCoords[0], myCoords[1], myCoords[2], 1.0f); + NCollection_Vec4 aBndMax (myCoords[3], myCoords[4], myCoords[5], 1.0f); // casting to OpenGl_Group should be always true as far as application uses OpenGl_GraphicDriver for rendering - Handle(OpenGl_Group) aGroup = Handle(OpenGl_Group)::DownCast (thePrs->NewGroup()); + occ::handle aGroup = Handle(OpenGl_Group)::DownCast (thePrs->NewGroup()); aGroup->SetMinMaxValues (aBndMin.x(), aBndMin.y(), aBndMin.z(), aBndMax.x(), aBndMax.y(), aBndMax.z()); UserDrawElement* anElem = new UserDrawElement (this); @@ -915,7 +915,7 @@ public: //! Override rendering into the view. virtual void render (Graphic3d_Camera::Projection theProjection, OpenGl_FrameBuffer* theReadDrawFbo, - const Standard_Boolean theToDrawImmediate) + const bool theToDrawImmediate) { OpenGl_View::render (theProjection, theReadDrawFbo, theToDrawImmediate); if (theToDrawImmediate) @@ -924,7 +924,7 @@ public: } // perform custom drawing - const Handle(OpenGl_Context)& aCtx = myWorkspace->GetGlContext(); + const occ::handle& aCtx = myWorkspace->GetGlContext(); GLfloat aVerts[3] = { 0.0f, 0,0f, 0,0f }; aCtx->core20->glEnableClientState(GL_VERTEX_ARRAY); aCtx->core20->glVertexPointer(3, GL_FLOAT, 0, aVerts); @@ -939,11 +939,11 @@ class UserDriver : public OpenGl_GraphicDriver { public: //! Create instance of own view. - virtual Handle(Graphic3d_CView) CreateView (const Handle(Graphic3d_StructureManager)& theMgr) Standard_OVERRIDE + virtual occ::handle CreateView (const occ::handle& theMgr) override { - Handle(UserView) aView = new UserView (theMgr, this, myCaps, myDeviceLostFlag, &myStateCounter); + occ::handle aView = new UserView (theMgr, this, myCaps, myDeviceLostFlag, &myStateCounter); myMapOfView.Add (aView); - for (TColStd_SequenceOfInteger::Iterator aLayerIt (myLayerSeq); aLayerIt.More(); aLayerIt.Next()) + for (NCollection_Sequence::Iterator aLayerIt (myLayerSeq); aLayerIt.More(); aLayerIt.Next()) { const Graphic3d_ZLayerId aLayerID = aLayerIt.Value(); const Graphic3d_ZLayerSettings& aSettings = myMapOfZLayerSettings.Find (aLayerID); @@ -1261,7 +1261,7 @@ The following Grid management methods within class V3d_Viewer do not implicitly The duplicating interface methods accepting *Quantity_NameOfColor* (in addition to methods accepting *Quantity_Color*) of TKV3d toolkit have been removed. In most cases this change should be transparent, however applications implementing such interface methods should also remove them -(compiler will automatically highlight this issue for methods marked with Standard_OVERRIDE keyword). +(compiler will automatically highlight this issue for methods marked with `override` keyword). @subsection upgrade_720_Result_Of_BOP_On_Containers Result of Boolean operations on containers @@ -1320,7 +1320,7 @@ The code example below demonstrates how to read shapes from a storage driver usi ~~~~{.cpp} // aDriver should be created and opened for reading -Handle(StdStorage_Data) aData; +occ::handle aData; // Read data from the driver // StdStorage::Read creates aData instance automatically if it is null @@ -1331,16 +1331,16 @@ if (anError != Storage_VSOk) } // Get root objects -Handle(StdStorage_RootData) aRootData = aData->RootData(); -Handle(StdStorage_HSequenceOfRoots) aRoots = aRootData->Roots(); +occ::handle aRootData = aData->RootData(); +occ::handle>> aRoots = aRootData->Roots(); if (!aRoots.IsNull()) { // Iterator over the sequence of root objects - for (StdStorage_HSequenceOfRoots::Iterator anIt(*aRoots); anIt.More(); anIt.Next()) + for (NCollection_HSequence>::Iterator anIt(*aRoots); anIt.More(); anIt.Next()) { - Handle(StdStorage_Root)& aRoot = anIt.ChangeValue(); + occ::handle& aRoot = anIt.ChangeValue(); // Get a persistent root's object - Handle(StdObjMgt_Persistent) aPObject = aRoot->Object(); + occ::handle aPObject = aRoot->Object(); if (!aPObject.IsNull()) { Handle(ShapePersistent_TopoDS::HShape) aHShape = Handle(ShapePersistent_TopoDS::HShape)::DownCast(aPObject); @@ -1372,14 +1372,14 @@ catch (Standard_Failure& e) } // Create a storage data instance -Handle(StdStorage_Data) aData = new StdStorage_Data(); +occ::handle aData = new StdStorage_Data(); // Set an axiliary application name (optional) aData->HeaderData()->SetApplicationName(TCollection_ExtendedString("Application")); // Provide a map to track sharing -StdObjMgt_TransientPersistentMap aMap; +NCollection_DataMap, occ::handle> aMap; // Iterator over a collection of shapes -for (Standard_Integer i = 1; i <= shapes.Length(); ++i) +for (int i = 1; i <= shapes.Length(); ++i) { TopoDS_Shape aShape = shapes.Value(i); // Translate a shape to a persistent object @@ -1394,7 +1394,7 @@ for (Standard_Integer i = 1; i <= shapes.Length(); ++i) TCollection_AsciiString aName = TCollection_AsciiString("Shape_") + i; // Add a root to storage data - Handle(StdStorage_Root) aRoot = new StdStorage_Root(aName, aPShape); + occ::handle aRoot = new StdStorage_Root(aName, aPShape); aData->RootData()->AddRoot(aRoot); } @@ -1646,26 +1646,26 @@ Case 1 (explicit parameters): #include #include -Standard_Boolean meshing_explicit_parameters() +bool meshing_explicit_parameters() { - BRepMesh_IncrementalMesh aMesher (aShape, 0.1, Standard_False, 0.5, Standard_True); - const Standard_Integer aStatus = aMesher.GetStatusFlags(); + BRepMesh_IncrementalMesh aMesher (aShape, 0.1, false, 0.5, true); + const int aStatus = aMesher.GetStatusFlags(); return !aStatus; } -Standard_Boolean meshing_new() +bool meshing_new() { IMeshTools_Parameters aMeshParams; aMeshParams.Deflection = 0.1; aMeshParams.Angle = 0.5; - aMeshParams.Relative = Standard_False; - aMeshParams.InParallel = Standard_True; + aMeshParams.Relative = false; + aMeshParams.InParallel = true; aMeshParams.MinSize = Precision::Confusion(); - aMeshParams.InternalVerticesMode = Standard_True; - aMeshParams.ControlSurfaceDeflection = Standard_True; + aMeshParams.InternalVerticesMode = true; + aMeshParams.ControlSurfaceDeflection = true; BRepMesh_IncrementalMesh aMesher (aShape, aMeshParams); - const Standard_Integer aStatus = aMesher.GetStatusFlags(); + const int aStatus = aMesher.GetStatusFlags(); return !aStatus; } ~~~~ @@ -1690,25 +1690,25 @@ As aspects for different primitive types have been merged, Graphic3d_Group does Existing code relying on old behavior and putting interleaved per-type aspects into single Graphic3d_Group should be updated. For example, the following pseudo-code will not work anymore, because all *SetGroupPrimitivesAspect* calls will setup the same property: ~~~~{.cpp} -Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); +occ::handle aGroup = thePrs->NewGroup(); aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect()); aGroup->SetGroupPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< overrides previous aspect -Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2); -Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3); +occ::handle aLines = new Graphic3d_ArrayOfSegments (2); +occ::handle aTris = new Graphic3d_ArrayOfTriangles (3); aGroup->AddPrimitiveArray (aLines); //!< both arrays will use the same aspect aGroup->AddPrimitiveArray (aTris); ~~~~ To solve the problem, the code should be modified to either put primitives into dedicated groups (preferred approach), or using *SetPrimitivesAspect* in proper order: ~~~~{.cpp} -Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); +occ::handle aGroup = thePrs->NewGroup(); aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect()); -Handle(Graphic3d_ArrayOfTriangles) aTris = new Graphic3d_ArrayOfTriangles (3); +occ::handle aTris = new Graphic3d_ArrayOfTriangles (3); aGroup->AddPrimitiveArray (aTris); -Handle(Graphic3d_ArrayOfSegments) aLines = new Graphic3d_ArrayOfSegments (2); +occ::handle aLines = new Graphic3d_ArrayOfSegments (2); aGroup->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect()); //!< next array will use the new aspect aGroup->AddPrimitiveArray (aLines); ~~~~ @@ -1721,20 +1721,20 @@ As result, the following methods of *Graphic3d_MaterialAspect* class have been r Previously, computation of final value required the following code: ~~~~{.cpp} Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor; -Graphic3d_Vec3 anAmbient (0.0f); +NCollection_Vec3 anAmbient (0.0f); if (theMaterial.ReflectionMode (Graphic3d_TOR_AMBIENT)) { anAmbient = theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT) - ? (Graphic3d_Vec3 )theInteriorColor * theMaterial.Ambient() - : (Graphic3d_Vec3 )theMaterial.AmbientColor() * theMaterial.Ambient(); + ? (NCollection_Vec3 )theInteriorColor * theMaterial.Ambient() + : (NCollection_Vec3 )theMaterial.AmbientColor() * theMaterial.Ambient(); } ~~~~ New code looks like this: ~~~~{.cpp} Graphic3d_MaterialAspect theMaterial; Quantity_Color theInteriorColor; -Graphic3d_Vec3 anAmbient = theMaterial.AmbientColor(); -if (theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)) { anAmbient *= (Graphic3d_Vec3 )theInteriorColor; } +NCollection_Vec3 anAmbient = theMaterial.AmbientColor(); +if (theMaterial.MaterialType (Graphic3d_MATERIAL_ASPECT)) { anAmbient *= (NCollection_Vec3 )theInteriorColor; } ~~~~ Existing code should be updated to: @@ -1753,7 +1753,7 @@ Parameters of *Text* in *Graphic3d_Group* are moved into a new *Graphic3d_Text* The previous code: ~~~~{.cpp} -Standard_Real x, y, z; +double x, y, z; theAttachmentPoint.Coord(x,y,z); theGroup->Text (theText, Graphic3d_Vertex(x,y,z), @@ -1765,7 +1765,7 @@ theGroup->Text (theText, ~~~~ should be replaced by the new code: ~~~~{.cpp} -Handle(Graphic3d_Text) aText = new Graphic3d_Text (theAspect->Height()); +occ::handle aText = new Graphic3d_Text (theAspect->Height()); aText->SetText (theText.ToExtString()); aText->SetPosition (theAttachmentPoint); aText->SetHorizontalAlignment (theAspect->HorizontalJustification()); @@ -1930,8 +1930,8 @@ The method Select3D_SensitiveEntity::NbSubElements() has been changed to be cons * TreatCompound method has been moved from *BOPAlgo_Tools* to *BOPTools_AlgoTools*. Additionally, the map parameter became optional: ~~~~{.cpp} void BOPTools_AlgoTools::TreatCompound (const TopoDS_Shape& theS, - TopTools_ListOfShape& theLS, - TopTools_MapOfShape* theMap = NULL); + NCollection_List& theLS, + NCollection_Map* theMap = NULL); ~~~~ @subsection upgrade_750_Adaptor2d_OffsetCurve Offset direction change @@ -2096,19 +2096,19 @@ The code that used operator << for messenger, should be ported as follows. Before the change: ~~~~{.cpp} - Handle(Message_Messenger) theMessenger = ...; + occ::handle theMessenger = ...; theMessenger << "Value = " << anInteger << Message_EndLine; ~~~~ After the change, single-line variant: ~~~~{.cpp} - Handle(Message_Messenger) theMessenger = ...; + occ::handle theMessenger = ...; theMessenger->SendInfo() << "Value = " << anInteger << std::endl; ~~~~ After the change, extended variant: ~~~~{.cpp} - Handle(Message_Messenger) theMessenger = ...; + occ::handle theMessenger = ...; Message_Messenger::StreamBuffer aSender = theMessenger->SendInfo(); aSender << "Array: [ "; for (int i = 0; i < aNb; ++i) { aSender << anArray[i] << " "; } @@ -2181,8 +2181,8 @@ Existing code relying on old behavior, if any, shall be rewritten. Geom_RectangularTrimmedSurface sequentially trimming in U and V directions already no longer loses the first trim. For example: ~~~~{.cpp} - Handle(Geom_RectangularTrimmedSurface) ST = new Geom_RectangularTrimmedSurface (Sbase, u1, u2, Standard_True); // trim along U - Handle(Geom_RectangularTrimmedSurface) ST1 = new Geom_RectangularTrimmedSurface (ST, v1, v2, Standard_False); // trim along V + occ::handle ST = new Geom_RectangularTrimmedSurface (Sbase, u1, u2, true); // trim along U + occ::handle ST1 = new Geom_RectangularTrimmedSurface (ST, v1, v2, false); // trim along V ~~~~ gives different result. In current version ST1 - surface trimmed only along V, U trim is removed; @@ -2275,13 +2275,13 @@ Now the classes accept adaptors instead objects as input parameters. The following functions in *GeomLib_CheckCurveOnSurface* have been modified: ~~~~{.cpp} -GeomLib_CheckCurveOnSurface(const Handle(Adaptor3d_Curve)& theCurve, - const Standard_Real theTolRange); +GeomLib_CheckCurveOnSurface(const occ::handle& theCurve, + const double theTolRange); -void Init (const Handle(Adaptor3d_Curve)& theCurve, const Standard_Real theTolRange); +void Init (const occ::handle& theCurve, const double theTolRange); -void Perform(const Handle(Adaptor3d_CurveOnSurface)& theCurveOnSurface, - const Standard_Boolean isMultiThread); +void Perform(const occ::handle& theCurveOnSurface, + const bool isMultiThread); ~~~~ @subsection upgrade_occt760_old_bop_removed Removal of old Boolean operations algorithm (BRepAlgo_BooleanOperation) @@ -2475,7 +2475,7 @@ The `Handle_*` type names are still available, but it is recommended to use the Example: ~~~~{.cpp} - Handle(TDataStd_Application) anApp = new TDataStd_Application(); // recommended + occ::handle anApp = new TDataStd_Application(); // recommended Handle_TDataStd_Application anApp = new TDataStd_Application(); // deprecated ~~~~ diff --git a/dox/user_guides/de_wrapper/de_wrapper.md b/dox/user_guides/de_wrapper/de_wrapper.md index 09e0b70901..336d7e1de9 100644 --- a/dox/user_guides/de_wrapper/de_wrapper.md +++ b/dox/user_guides/de_wrapper/de_wrapper.md @@ -49,15 +49,15 @@ Working with a DE session requires a DE_Wrapper object to be loaded or created f Getting the global DE_Wrapping object: ~~~~{.cpp} -Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); +occ::handle aSession = DE_Wrapper::GlobalWrapper(); ~~~~ Creating a local DE_Wrapper: ~~~~{.cpp} -Handle(DE_Wrapper) aSession = new DE_Wrapper(); +occ::handle aSession = new DE_Wrapper(); ~~~~ It is recommended to create a local one-time copy to work with the session, if no global changes are intended. ~~~~{.cpp} -Handle(DE_Wrapper) aOneTimeSession = aSession->Copy(); +occ::handle aOneTimeSession = aSession->Copy(); ~~~~ @subsection occt_de_wrapper_3_2 Configuration resource @@ -96,12 +96,12 @@ There are two options for loading a resource: recursive and global parameters on Configuring using a resource string: ~~~~{.cpp} - Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); + occ::handle aSession = DE_Wrapper::GlobalWrapper(); TCollection_AsciiString aString = "global.priority.STEP : OCC DTK\n" "global.general.length.unit : 1\n" "provider.STEP.OCC.read.precision.val : 0.\n"; - Standard_Boolean aIsRecursive = Standard_True; + bool aIsRecursive = true; if (!aSession->Load(aString, aIsRecursive)) { Message::SendFail() << "Error: configuration is incorrect"; @@ -109,9 +109,9 @@ Configuring using a resource string: ~~~~ Configuring using a resource file: ~~~~{.cpp} - Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); + occ::handle aSession = DE_Wrapper::GlobalWrapper(); TCollection_AsciiString aPathToFile = ""; - Standard_Boolean aIsRecursive = Standard_True; + bool aIsRecursive = true; if (!aSession->Load(aPathToFile, aIsRecursive)) { Message::SendFail() << "Error: configuration is incorrect"; @@ -150,23 +150,23 @@ It is possible to filter what vendors or providers to save by providing the corr Dump to resource string. If the vendors list is empty, saves all vendors. If the providers list is empty, saves all providers of valid vendors. ~~~~{.cpp} - Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); - TColStd_ListOfAsciiString aFormats; - TColStd_ListOfAsciiString aVendors; + occ::handle aSession = DE_Wrapper::GlobalWrapper(); + NCollection_List aFormats; + NCollection_List aVendors; aFormats.Appends("STEP"); aVendors.Appends("OCC"); - Standard_Boolean aIsRecursive = Standard_True; + bool aIsRecursive = true; TCollection_AsciiString aConf = aSession->aConf->Save(aIsRecursive, aFormats, aVendors); ~~~~ Configure using a resource file. If the vendors list is empty, saves all vendors. If the providers list is empty, saves all providers of valid vendors. ~~~~{.cpp} - Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); + occ::handle aSession = DE_Wrapper::GlobalWrapper(); TCollection_AsciiString aPathToFile = ""; - TColStd_ListOfAsciiString aFormats; - TColStd_ListOfAsciiString aVendors; + NCollection_List aFormats; + NCollection_List aVendors; aFormats.Appends("STEP"); aVendors.Appends("OCC"); - Standard_Boolean aIsRecursive = Standard_True; + bool aIsRecursive = true; if (!aSession->Save(aPathToFile, aIsRecursive, aFormats,aVendors)) { Message::SendFail() << "Error: configuration is not saved"; @@ -199,8 +199,8 @@ All registered providers are set to the map with information about its vendor an It is necessary to register only one ConfigurationNode for all needed formats. ~~~~{.cpp} -Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); -Handle(DE_ConfigurationNode) aNode = new DESTEP_ConfigurationNode(); +occ::handle aSession = DE_Wrapper::GlobalWrapper(); +occ::handle aNode = new DESTEP_ConfigurationNode(); aSession->Bind(aNode); ~~~~ @subsubsection occt_de_wrapper_3_3_2 Registering providers. DRAW Sample @@ -216,11 +216,11 @@ It is possible to change a parameter from code using a smart pointer. ~~~~{.cpp} // global variable -static Handle(DESTEP_ConfigurationNode) THE_STEP_NODE; +static occ::handle THE_STEP_NODE; -static Handle(DE_ConfigurationNode) RegisterStepNode() +static occ::handle RegisterStepNode() { - Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); + occ::handle aSession = DE_Wrapper::GlobalWrapper(); if (!THE_STEP_NODE.IsNull()) { return THE_STEP_NODE; @@ -246,14 +246,14 @@ If the high priority vendor's provider is not supported, a transfer operation is @subsubsection occt_de_wrapper_3_4_1 Priority of Vendors. Code sample ~~~~{.cpp} - Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); + occ::handle aSession = DE_Wrapper::GlobalWrapper(); TCollection_AsciiString aFormat = "STEP"; - TColStd_ListOfAsciiString aVendors; + NCollection_List aVendors; aVendors.Appends("OCC"); // high priority aVendors.Appends("DTK"); // Flag to disable not chosen vendors, in this case configuration is possible // otherwise, lower their priority and continue to check ability to transfer - Standard_Boolean aToDisable = Standard_True; + bool aToDisable = true; aSession->ChangePriority(aFormat, aVendors, aToDisable); ~~~~ @@ -277,7 +277,7 @@ The format of input/output file is automatically determined by its extension or Reading STEP file to Shape. ~~~~{.cpp} - Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); + occ::handle aSession = DE_Wrapper::GlobalWrapper(); TCollection_AsciiString aPathToFile = "example.stp"; TopoDS_Shape aShRes; if (!aSession->Read(aPathToFile, aShRes)) @@ -288,7 +288,7 @@ Reading STEP file to Shape. Writing Shape to STEP file. ~~~~{.cpp} - Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); + occ::handle aSession = DE_Wrapper::GlobalWrapper(); TCollection_AsciiString aPathToFile = "example.stp"; TopoDS_Shape aShFrom = ...; if (!aSession->Write(aPathToFile, aShRes)) @@ -299,9 +299,9 @@ Writing Shape to STEP file. Reading STEP file into XCAF document. ~~~~{.cpp} - Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); + occ::handle aSession = DE_Wrapper::GlobalWrapper(); TCollection_AsciiString aPathToFile = "example.stp"; - Handle(TDocStd_Document) aDoc = ...; + occ::handle aDoc = ...; if (!aSession->Read(aPathToFile, aDoc)) { Message::SendFail() << "Error: Can't read file"; @@ -310,9 +310,9 @@ Reading STEP file into XCAF document. Writing XCAF document into STEP. ~~~~{.cpp} - Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper(); + occ::handle aSession = DE_Wrapper::GlobalWrapper(); TCollection_AsciiString aPathToFile = "example.stp"; - Handle(TDocStd_Document) aDoc = ...; + occ::handle aDoc = ...; if (!aSession->Write(aPathToFile, aDoc)) { Message::SendFail() << "Error: Can't write file"; @@ -351,9 +351,9 @@ It is possible to read and write CAD files directly from a special provider. ~~~~{.cpp} // Creating or getting node -Handle(DESTEP_ConfigurationNode) aNode = new DESTEP_ConfigurationNode(); +occ::handle aNode = new DESTEP_ConfigurationNode(); // Creating an one-time provider -Handle(DE_Provider) aProvider = aNode->BuildProvider(); +occ::handle aProvider = aNode->BuildProvider(); // Setting configuration with all parameters aProvider->SetNode(aNode); if (!aProvider->Read(...)) @@ -374,7 +374,7 @@ It is possible to change the configuration of only one transfer operation. To av Code sample to configure via transfer. ~~~~{.cpp} - Handle(DE_Wrapper) aSession = DE_Wrapper::GlobalWrapper()->Copy(); + occ::handle aSession = DE_Wrapper::GlobalWrapper()->Copy(); TCollection_AsciiString aString = "global.priority.STEP : OCC DTK\n" "global.general.length.unit : 1\n" diff --git a/dox/user_guides/draw_test_harness/draw_test_harness.md b/dox/user_guides/draw_test_harness/draw_test_harness.md index 10cc3e30fb..b2d2ba726a 100644 --- a/dox/user_guides/draw_test_harness/draw_test_harness.md +++ b/dox/user_guides/draw_test_harness/draw_test_harness.md @@ -783,31 +783,31 @@ restore theBox #### In DrawTrSurf package: ~~~~{.php} -void Set(Standard_CString& Name,const gp_Pnt& G) ; -void Set(Standard_CString& Name,const gp_Pnt2d& G) ; -void Set(Standard_CString& Name, -const Handle(Geom_Geometry)& G) ; -void Set(Standard_CString& Name, -const Handle(Geom2d_Curve)& C) ; -void Set(Standard_CString& Name, -const Handle(Poly_Triangulation)& T) ; -void Set(Standard_CString& Name, -const Handle(Poly_Polygon3D)& P) ; -void Set(Standard_CString& Name, -const Handle(Poly_Polygon2D)& P) ; +void Set(const char*& Name,const gp_Pnt& G) ; +void Set(const char*& Name,const gp_Pnt2d& G) ; +void Set(const char*& Name, +const occ::handle& G) ; +void Set(const char*& Name, +const occ::handle& C) ; +void Set(const char*& Name, +const occ::handle& T) ; +void Set(const char*& Name, +const occ::handle& P) ; +void Set(const char*& Name, +const occ::handle& P) ; ~~~~ #### In DBRep package: ~~~~{.php} -void Set(const Standard_CString Name, +void Set(const char* Name, const TopoDS_Shape& S) ; ~~~~ Example of *DrawTrSurf* ~~~~{.php} -Handle(Geom2d_Circle) C1 = new Geom2d_Circle +occ::handle C1 = new Geom2d_Circle (gce_MakeCirc2d (gp_Pnt2d(50,0,) 25)); DrawTrSurf::Set(char*, C1); ~~~~ @@ -825,24 +825,24 @@ DBRep::Set(char*,B); #### In DrawTrSurf package: ~~~~{.php} -Handle(Geom_Geometry) Get(Standard_CString& Name) ; +occ::handle Get(const char*& Name) ; ~~~~ #### In DBRep package: ~~~~{.php} -TopoDS_Shape Get(Standard_CString& Name, +TopoDS_Shape Get(const char*& Name, const TopAbs_ShapeEnum Typ = TopAbs_SHAPE, -const Standard_Boolean Complain -= Standard_True) ; +const bool Complain += true) ; ~~~~ Example of *DrawTrSurf* ~~~~{.php} -Standard_Integer MyCommand +int MyCommand (Draw_Interpretor& theCommands, -Standard_Integer argc, char** argv) +int argc, char** argv) {...... // Creation of a Geom_Geometry from a Draw geometric // name @@ -853,9 +853,9 @@ Handle (Geom_Geometry) aGeom= DrawTrSurf::Get(argv[1]); Example of *DBRep* ~~~~{.php} -Standard_Integer MyCommand +int MyCommand (Draw_Interpretor& theCommands, -Standard_Integer argc, char** argv) +int argc, char** argv) {...... // Creation of a TopoDS_Shape from a Draw topological // name @@ -9982,7 +9982,7 @@ Syntax: fixsmalledges [ ] ~~~~ -Searches at least one small edge at a given shape. If such edges have been found, then small edges are merged with a given tolerance. If parameter \ is equal to *Standard_True* (can be given any values, except 2), then small edges, which can not be merged, are removed, otherwise they are to be kept (*Standard_False* is used by default). Parameter \ sets a maximum possible angle for merging two adjacent edges, by default no limit angle is applied (-1). Results are put into the shape, which is given as parameter result. +Searches at least one small edge at a given shape. If such edges have been found, then small edges are merged with a given tolerance. If parameter \ is equal to *true* (can be given any values, except 2), then small edges, which can not be merged, are removed, otherwise they are to be kept (*false* is used by default). Parameter \ sets a maximum possible angle for merging two adjacent edges, by default no limit angle is applied (-1). Results are put into the shape, which is given as parameter result. **Example:** ~~~~{.php} @@ -10975,7 +10975,7 @@ Custom command implementation has not undergone any changes since the introducti **Example:** ~~~~{.cpp} -static Standard_Integer myadvcurve(Draw_Interpretor& di, Standard_Integer n, char** a) +static int myadvcurve(Draw_Interpretor& di, int n, char** a) { ... } diff --git a/dox/user_guides/foundation_classes/foundation_classes.md b/dox/user_guides/foundation_classes/foundation_classes.md index 143cb91dd8..3c6b9aa107 100644 --- a/dox/user_guides/foundation_classes/foundation_classes.md +++ b/dox/user_guides/foundation_classes/foundation_classes.md @@ -184,7 +184,7 @@ To reference an object, we instantiate the class with one of its constructors. For example, in C++: ~~~~{.cpp} -Handle(MyClass) anObject = new MyClass(); +occ::handle anObject = new MyClass(); ~~~~ In Open CASCADE Technology, the Handles are specific classes that are used to safely manipulate objects allocated in the dynamic memory by reference, @@ -303,7 +303,7 @@ Objects of classes derived (directly or indirectly) from *Transient*, are normal Handle is defined as template class *opencascade::handle<>*. Open CASCADE Technology provides preprocessor macro *Handle()* that is historically used throughout OCCT code to name a handle: ~~~~{.cpp} -Handle(Geom_Line) aLine; // "Handle(Geom_Line)" is expanded to "opencascade::handle" +occ::handle aLine; // "occ::handle" is expanded to "opencascade::handle" ~~~~ In addition, for most OCCT classes additional *typedef* is defined for a handle, as the name of a class prefixed by *Handle_*. @@ -319,7 +319,7 @@ A handle is characterized by the object it references. Before performing any operation on a transient object, you must declare the handle. For example, if Point and Line are two transient classes from the Geom package, you would write: ~~~~{.cpp} -Handle(Geom_Point) p1, p2; +occ::handle p1, p2; ~~~~ Declaring a handle creates a null handle that does not refer to any object. The handle may be checked to be null by its method *IsNull()*. @@ -391,8 +391,8 @@ Thus, the dynamic type of an object (also called the actual type of an object) c Consider the class *Geom_CartesianPoint*, a sub-class of *Geom_Point*; the rule of type conformity can be illustrated as follows: ~~~~{.cpp} -Handle(Geom_Point) aPnt1; -Handle(Geom_CartesianPoint) aPnt2; +occ::handle aPnt1; +occ::handle aPnt2; aPnt2 = new Geom_CartesianPoint(); aPnt1 = aPnt2; // OK, the types are compatible ~~~~ @@ -410,11 +410,11 @@ If this is not the case, the handle is nullified (explicit type conversion is so Consider the example below. ~~~~{.cpp} -Handle(Geom_Point) aPnt1; -Handle(Geom_CartesianPoint) aPnt2, aPnt3; +occ::handle aPnt1; +occ::handle aPnt2, aPnt3; aPnt2 = new Geom_CartesianPoint(); aPnt1 = aPnt2; // OK, standard assignment -aPnt3 = Handle(Geom_CartesianPoint)::DownCast (aPnt1); +aPnt3 = occ::down_cast(aPnt1); // OK, the actual type of aPnt1 is Geom_CartesianPoint, although the static type of the handle is Geom_Point ~~~~ @@ -422,9 +422,9 @@ If conversion is not compatible with the actual type of the referenced object, t So, if you require reliable services defined in a sub-class of the type seen by the handle (static type), write as follows: ~~~~{.cpp} -void MyFunction (const Handle(A) & a) +void MyFunction (const occ::handle & a) { - Handle(B) b = Handle(B)::DownCast(a); + occ::handle b = occ::down_cast(a); if (! b.IsNull()) { // we can use “b” if class B inherits from A } @@ -438,10 +438,10 @@ Downcasting is used particularly with collections of objects of different types; For example, with a sequence of transient objects *TColStd_SequenceOfTransient* and two classes A and B that both inherit from *Standard_Transient*, you get the following syntax: ~~~~{.cpp} -Handle(A) a; -Handle(B) b; -Handle(Standard_Transient) t; -TColStd_SequenceOfTransient aSeq; +occ::handle a; +occ::handle b; +occ::handle t; +NCollection_Sequence> aSeq; a = new A(); aSeq.Append (a); b = new B(); @@ -450,7 +450,7 @@ t = aSeq.Value (1); // here, you cannot write: // a = t; // ERROR ! // so you downcast: -a = Handle (A)::Downcast (t) +a = occ::down_cast(t) if (!a.IsNull()) { // types are compatible, you can use a @@ -467,7 +467,7 @@ To create an object which is manipulated by handle, declare the handle and initi The constructor can be any of those specified in the source of the class from which the object is instanced. ~~~~{.cpp} -Handle(Geom_CartesianPoint) aPnt; +occ::handle aPnt; aPnt = new Geom_CartesianPoint (0, 0, 0); ~~~~ @@ -481,8 +481,8 @@ To test or to modify the state of the handle, the method is translated by the *d The example below illustrates how to access the coordinates of an (optionally initialized) point object: ~~~~{.cpp} -Handle(Geom_CartesianPoint) aCentre; -Standard_Real x, y, z; +occ::handle aCentre; +double x, y, z; if (aCentre.IsNull()) { aCentre = new PGeom_CartesianPoint (0, 0, 0); @@ -493,7 +493,7 @@ aCentre->Coord (x, y, z); The example below illustrates how to access the type object of a Cartesian point: ~~~~{.cpp} -Handle(Standard_Transient) aPnt = new Geom_CartesianPoint (0., 0., 0.); +occ::handle aPnt = new Geom_CartesianPoint (0., 0., 0.); if (aPnt->DynamicType() == STANDARD_TYPE(Geom_CartesianPoint)) { std::cout << "Type check OK\n"; @@ -513,7 +513,7 @@ A class method is called like a static C++ function, i.e. it is called by the na For example, we can find the maximum degree of a Bezier curve: ~~~~{.cpp} -Standard_Integer aDegree = Geom_BezierCurve::MaxDegree(); +int aDegree = Geom_BezierCurve::MaxDegree(); ~~~~ @subsubsection occt_fcug_2_2_5 Handle deallocation @@ -532,14 +532,14 @@ The principle of allocation can be seen in the example below. ~~~~{.cpp} ... { - Handle(TColStd_HSequenceOfInteger) H1 = new TColStd_HSequenceOfInteger(); + occ::handle> H1 = new NCollection_HSequence(); // H1 has one reference and corresponds to 48 bytes of memory { - Handle(TColStd_HSequenceOfInteger) H2; + occ::handle> H2; H2 = H1; // H1 has two references if (argc == 3) { - Handle(TColStd_HSequenceOfInteger) H3; + occ::handle> H3; H3 = H1; // Here, H1 has three references ... @@ -548,18 +548,18 @@ The principle of allocation can be seen in the example below. } // Here, H1 has 1 reference } -// Here, H1 has no reference and the referred TColStd_HSequenceOfInteger object is deleted. +// Here, H1 has no reference and the referred NCollection_HSequence object is deleted. ~~~~ You can easily cast a reference to the handle object to void* by defining the following: ~~~~{.cpp} void* aPointer; - Handle(Some_Class) aHandle; + occ::handle aHandle; // Here only a pointer will be copied aPointer = &aHandle; // Here the Handle object will be copied - aHandle = *(Handle(Some_Class)*)aPointer; + aHandle = *(occ::handle*)aPointer; ~~~~ @subsubsection occt_fcug_2_2_6 Cycles @@ -735,7 +735,7 @@ For example, if you consider the *TCollection_Array1* class used with: then, the *Value* function may be implemented as follows: ~~~~{.cpp} -Item TCollection_Array1::Value (Standard_Integer theIndex) const +Item TCollection_Array1::Value (int theIndex) const { // where myR1 and myR2 are the lower and upper bounds of the array if (theIndex < myR1 || theIndex > myR2) @@ -766,7 +766,7 @@ The entire call may be removed by defining one of the preprocessor symbols *No_E Using this syntax, the *Value* function becomes: ~~~~{.cpp} -Item TCollection_Array1::Value (Standard_Integer theIndex) const +Item TCollection_Array1::Value (int theIndex) const { Standard_OutOfRange_Raise_if(theIndex < myR1 || theIndex > myR2, "index out of range in TCollection_Array1::Value"); return myContents[theIndex]; @@ -942,7 +942,7 @@ The client may then call the functions supported by this object. To invoke one of the services provided by the plug-in, you may call the *Plugin::Load()* global function with the *Standard_GUID* of the requested service as follows: ~~~~{.cpp} -Handle(FADriver_PartStorer)::DownCast(PlugIn::Load (yourStandardGUID)); +occ::down_cast(PlugIn::Load (yourStandardGUID)); ~~~~ Let us take *FAFactory.hxx* and *FAFactory.cxx* as an example: @@ -955,7 +955,7 @@ Let us take *FAFactory.hxx* and *FAFactory.cxx* as an example: class FAFactory { public: - Standard_EXPORT static Handle(Standard_Transient) Factory (const Standard_GUID& theGUID); + Standard_EXPORT static occ::handle Factory (const Standard_GUID& theGUID); }; ~~~~ @@ -977,29 +977,29 @@ static Standard_GUID Schema ("45b3c6a2-22f3-11d2-b09e-0000f8791463"); // function : Factory // purpose : //====================================================== -Handle(Standard_Transient) FAFactory::Factory (const Standard_GUID& theGUID) +occ::handle FAFactory::Factory (const Standard_GUID& theGUID) { if (theGUID == StorageDriver) { std::cout << "FAFactory : Create store driver\n"; - static Handle(FADriver_PartStorer) sd = new FADriver_PartStorer(); + static occ::handle sd = new FADriver_PartStorer(); return sd; } if (theGUID == RetrievalDriver) { std::cout << "FAFactory : Create retrieve driver\n"; - static Handle(FADriver_PartRetriever) rd = new FADriver_PartRetriever(); + static occ::handle rd = new FADriver_PartRetriever(); return rd; } if (theGUID == Schema) { std::cout << "FAFactory : Create schema\n"; - static Handle(FirstAppSchema) s = new FirstAppSchema(); + static occ::handle s = new FirstAppSchema(); return s; } throw Standard_Failure ("FAFactory: unknown GUID"); - return Handle(Standard_Transient)(); + return occ::handle(); } // export plugin function "PLUGINFACTORY" @@ -1056,7 +1056,7 @@ For the case, when sequence itself should be managed by handle, auxiliary macros typedef NCollection_Sequence MyPackage_SequenceOfPnt; DEFINE_HSEQUENCE(MyPackage_HSequenceOfPnt, MyPackage_SequenceOfPnt) ... -Handle(MyPackage_HSequenceOfPnt) aSeq = new MyPackage_HSequenceOfPnt(); +occ::handle aSeq = new MyPackage_HSequenceOfPnt(); ~~~~ See more details about available collections in following sections. @@ -1368,10 +1368,10 @@ public: void Add (const MyBndType& theOther); //! Classifies other bounding type instance relatively me - Standard_Boolean IsOut (const MyBndType& theOther) const; + bool IsOut (const MyBndType& theOther) const; //! Computes the squared maximal linear extent of me (for a box it is the squared diagonal of the box). - Standard_Real SquareExtent() const; + double SquareExtent() const; }; ~~~~ @@ -1399,12 +1399,12 @@ public: //! Bounding box rejection - definition of virtual method. //! @return True if theBox is outside the selection criterion. - virtual Standard_Boolean Reject (const Bnd_B2f& theBox) const override { return theBox.IsOut (myPnt); } + virtual bool Reject (const Bnd_B2f& theBox) const override { return theBox.IsOut (myPnt); } //! Redefined from the base class. //! Called when the bounding of theData conforms to the selection criterion. //! This method updates myList. - virtual Standard_Boolean Accept (const MyData& theData) override { myList.Append (theData); } + virtual bool Accept (const MyData& theData) override { myList.Append (theData); } private: gp_XY myPnt; @@ -1439,8 +1439,8 @@ while search with NCollection_UBTree provides logarithmic law access time. Packages *TShort*, *TColGeom*, *TColGeom2d*, *TColStd*, *TColgp* provide template instantiations (typedefs) of *NCollection* templates to standard OCCT types. Classes with *H* prefix in name are handle-based variants and inherit Standard_Transient. ~~~~{.cpp} -typedef NCollection_Array1 TColgp_Array1OfVec; -typedef NCollection_Array1 TColStd_Array1OfAsciiString; +typedef NCollection_Array1 NCollection_Array1; +typedef NCollection_Array1 NCollection_Array1; ~~~~ Packages like *TopTools* also include definitions of collections and hash functions for complex types like shapes -- *TopTools_ShapeMapHasher*, *TopTools_MapOfShape*. @@ -1548,7 +1548,7 @@ Vector and Matrix values may be initialized and obtained using indexes which mus ~~~~{.cpp} math_Vector aVec (1, 3); math_Matrix aMat (1, 3, 1, 3); -Standard_Real aValue; +double aValue; aVec (2) = 1.0; aValue = aVec(1); @@ -1654,7 +1654,7 @@ class math_Gauss { public: math_Gauss (const math_Matrix& A); - Standard_Boolean IsDone() const; + bool IsDone() const; void Solve (const math_Vector& B, math_Vector& X) const; }; ~~~~ @@ -1696,11 +1696,11 @@ class math_BissecNewton { public: math_BissecNewton (math_FunctionWithDerivative& f, - const Standard_Real bound1, - const Standard_Real bound2, - const Standard_Real tolx); - Standard_Boolean IsDone() const; - Standard_Real Root(); + const double bound1, + const double bound2, + const double tolx); + bool IsDone() const; + double Root(); }; ~~~~ @@ -1711,9 +1711,9 @@ The following definition corresponds to the header file of the abstract class *m class math_FunctionWithDerivative { public: - virtual Standard_Boolean Value (const Standard_Real x, Standard_Real& f) = 0; - virtual Standard_Boolean Derivative (const Standard_Real x, Standard_Real& d) = 0; - virtual Standard_Boolean Values (const Standard_Real x, Standard_Real& f, Standard_Real& d) = 0; + virtual bool Value (const double x, double& f) = 0; + virtual bool Derivative (const double x, double& d) = 0; + virtual bool Values (const double x, double& f, double& d) = 0; }; ~~~~ @@ -1725,23 +1725,23 @@ The function to solve is implemented in the class *myFunction* which inherits fr #include class myFunction : public math_FunctionWithDerivative { - Standard_Real myCoefA, myCoefB, myCoefC; + double myCoefA, myCoefB, myCoefC; public: - myFunction (const Standard_Real theA, const Standard_Real theB, const Standard_Real theC) + myFunction (const double theA, const double theB, const double theC) : myCoefA(a), myCoefB(b), myCoefC(c) {} - virtual Standard_Boolean Value (const Standard_Real x, Standard_Real& f) override + virtual bool Value (const double x, double& f) override { f = myCoefA * x * x + myCoefB * x + myCoefC; } - virtual Standard_Boolean Derivative (const Standard_Real x, Standard_Real& d) override + virtual bool Derivative (const double x, double& d) override { d = myCoefA * x * 2.0 + myCoefB; } - virtual Standard_Boolean Values (const Standard_Real x, Standard_Real& f, Standard_Real& d) override + virtual bool Values (const double x, double& f, double& d) override { f = myCoefA * x * x + myCoefB * x + myCoefC; d = myCoefA * x * 2.0 + myCoefB; @@ -1754,7 +1754,7 @@ main() math_BissecNewton aSol (aFunc, 1.5, 2.5, 0.000001); if (aSol.IsDone()) // is it OK ? { - Standard_Real x = aSol.Root(); // yes + double x = aSol.Root(); // yes } else // no { @@ -1770,7 +1770,7 @@ The *Precision* package addresses the daily problem of the geometric algorithm d Real number equivalence is clearly a poor choice. The difference between the numbers should be compared to a given precision setting. -Do not write _if (X1 == X2)_, instead write _if (Abs(X1-X2) < Precision)_. +Do not write _if (X1 == X2)_, instead write _if (std::abs(X1-X2) < Precision)_. Also, to order real numbers, keep in mind that _if (X1 < X2 - Precision)_ is incorrect. _if (X2 - X1 > Precision)_ is far better when *X1* and *X2* are high numbers. @@ -1797,7 +1797,7 @@ This is because it is desirable to link parametric precision and real precision. If you are on a curve defined by the equation *P(t)*, you would want to have equivalence between the following: ~~~~{.cpp} - Abs (t1 - t2) < ParametricPrecision + std::abs (t1 - t2) < ParametricPrecision Distance (P(t1), P(t2)) < RealPrecision ~~~~ @@ -1835,7 +1835,7 @@ It can be used to check confusion of two angles as follows: ~~~~{.cpp} bool areEqualAngles (double theAngle1, double theAngle2) { - return Abs(theAngle1 - theAngle2) < Precision::Angular(); + return std::abs(theAngle1 - theAngle2) < Precision::Angular(); } ~~~~ @@ -1852,7 +1852,7 @@ So to test if two directions of type *gp_Dir* are perpendicular, it is legal to ~~~~{.cpp} bool arePerpendicular (const gp_Dir& theDir1, const gp_Dir& theDir2) { - return Abs(theDir1 * theDir2) < Precision::Angular(); + return std::abs(theDir1 * theDir2) < Precision::Angular(); } ~~~~ diff --git a/dox/user_guides/iges/iges.md b/dox/user_guides/iges/iges.md index 0f8028117e..4025d96023 100644 --- a/dox/user_guides/iges/iges.md +++ b/dox/user_guides/iges/iges.md @@ -69,7 +69,7 @@ The loading operation only loads the IGES file into computer memory; it does no @subsubsection occt_iges_2_3_2 Checking the IGES file This step is not obligatory. Check the loaded file with: ~~~~{.cpp} -Standard_Boolean ok = reader.Check(Standard_True); +bool ok = reader.Check(true); ~~~~ The variable “ok is True” is returned if no fail message was found; “ok is False” is returned if there was at least one fail message. ~~~~{.cpp} @@ -77,7 +77,7 @@ reader.PrintCheckLoad (failsonly, mode); ~~~~ Error messages are displayed if there are invalid or incomplete IGES entities, giving you information on the cause of the error. ~~~~{.cpp} -Standard_Boolean failsonly = Standard_True or Standard_False; +bool failsonly = true or false; ~~~~ If you give True, you will see fail messages only. If you give False, you will see both fail and warning messages. @@ -99,7 +99,7 @@ manages the continuity of BSpline curves (IGES entities 106, 112 and 126) after Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("read.iges.bspline.continuity"); +int ic = Interface_Static::IVal("read.iges.bspline.continuity"); ~~~~ Modify this value with: ~~~~{.cpp} @@ -118,7 +118,7 @@ reads the precision value. Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("read.precision.mode"); +int ic = Interface_Static::IVal("read.precision.mode"); ~~~~ Modify this value with: ~~~~{.cpp} @@ -134,7 +134,7 @@ This value is in the measurement unit defined in the IGES file header. Read this parameter with: ~~~~{.cpp} -Standard_Real rp = Interface_Static::RVal("read.precision.val"); +double rp = Interface_Static::RVal("read.precision.val"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -155,7 +155,7 @@ defines the mode of applying the maximum allowed tolerance. Its possible values Read this parameter with: ~~~~{.cpp} -Standard_Integer mv = Interface_Static::IVal("read.maxprecision.mode"); +int mv = Interface_Static::IVal("read.maxprecision.mode"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -170,7 +170,7 @@ It should be not less than the basis value of tolerance set in processor (eithe Actually, the maximum between *read.maxprecision.val* and basis tolerance is used to define maximum allowed tolerance. Read this parameter with: ~~~~{.cpp} -Standard_Real rp = Interface_Static::RVal("read.maxprecision.val"); +double rp = Interface_Static::RVal("read.maxprecision.val"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -186,7 +186,7 @@ defines the using of *BRepLib\::SameParameter*. Its possible values are: *BRepLib\::SameParameter* is used through *ShapeFix_Edge\::SameParameter*. It ensures that the resulting edge will have the lowest tolerance taking pcurves either unmodified from the IGES file or modified by *BRepLib\::SameParameter*. Read this parameter with: ~~~~{.cpp} -Standard_Integer mv = Interface_Static::IVal("read.stdsameparameter.mode"); +int mv = Interface_Static::IVal("read.stdsameparameter.mode"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -227,7 +227,7 @@ If either a 3D or a 2D contour is absent in the file or cannot be translated, t Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("read.surfacecurve.mode"); +int ic = Interface_Static::IVal("read.surfacecurve.mode"); ~~~~ Modify this value with: ~~~~{.cpp} @@ -241,7 +241,7 @@ This parameter is used within the *BRepLib::EncodeRegularity()* function which Read this parameter with: ~~~~{.cpp} -Standard_Real era = Interface_Static::RVal("read.encoderegularity.angle"); +double era = Interface_Static::RVal("read.encoderegularity.angle"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -255,7 +255,7 @@ This parameter is obsolete (it is rarely used in real practice). If set to True Read this parameter with: ~~~~{.cpp} -Standard_Real bam = Interface_Static::CVal("read.iges.bspline.approxd1.mode"); +double bam = Interface_Static::CVal("read.iges.bspline.approxd1.mode"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -285,7 +285,7 @@ Default value is MM. A list of entities can be formed by invoking the method *IGESControl_Reader::GiveList*. ~~~~{.cpp} -Handle(TColStd_HSequenceOfTransient) list = reader.GiveList(); +occ::handle>> list = reader.GiveList(); ~~~~ Several predefined operators can be used to select a list of entities of a specific type. To make a selection, use the method *IGESControl_Reader::GiveList* with the selection type in quotation marks as an argument. You can also make cumulative selections. For example, you would use the following Syntax: @@ -345,29 +345,29 @@ faces = Reader.GiveList(“xst-type(!=SurfaceOfRevolution)”); Perform translation according to what you want to translate: 1. Translate an entity identified by its rank with: ~~~~{.cpp} -Standard_Boolean ok = reader.Transfer (rank); +bool ok = reader.Transfer (rank); ~~~~ 2. Translate an entity identified by its handle with: ~~~~{.cpp} -Standard_Boolean ok = reader.TransferEntity (ent); +bool ok = reader.TransferEntity (ent); ~~~~ 3. Translate a list of entities in one operation with: ~~~~{.cpp} -Standard_Integer nbtrans = reader.TransferList (list); +int nbtrans = reader.TransferList (list); reader.IsDone(); ~~~~ where *nbtrans* returns the number of items in the list that produced a shape and *reader.IsDone()* indicates whether at least one entity was translated. 4. Translate a list of entities, entity by entity: ~~~~{.cpp} -Standard_Integer i,nb = list-Length(); +int i,nb = list-Length(); for (i = 1; i <= nb; i ++) { - Handle(Standard_Transient) ent = list-Value(i); - Standard_Boolean OK = reader.TransferEntity (ent); + occ::handle ent = list-Value(i); + bool OK = reader.TransferEntity (ent); } ~~~~ 5. Translate the whole file (all entities or only visible entities) with: ~~~~{.cpp} -Standard_Boolean onlyvisible = Standard_True or Standard_False; +bool onlyvisible = true or false; reader.TransferRoots(onlyvisible) ~~~~ @@ -375,7 +375,7 @@ reader.TransferRoots(onlyvisible) Each successful translation operation outputs one shape. A series of translations gives a series of shapes. Each time you invoke *TransferEntity, Transfer* or *Transferlist*, their results are accumulated and NbShapes increases. You can clear the results (Clear function) between two translation operations, if you do not do this, the results from the next translation will be added to the accumulation. *TransferRoots* operations automatically clear all existing results before they start. ~~~~{.cpp} -Standard_Integer nbs = reader.NbShapes(); +int nbs = reader.NbShapes(); ~~~~ returns the number of shapes recorded in the result. ~~~~{.cpp} @@ -609,16 +609,16 @@ The highlighted classes produce OCCT geometry. ~~~~{.cpp} #include “IGESControl_Reader.hxx” -#include “TColStd_HSequenceOfTransient.hxx” +#include “NCollection_HSequence>.hxx” #include “TopoDS_Shape.hxx” { IGESControl_Reader myIgesReader; -Standard_Integer nIgesFaces,nTransFaces; +int nIgesFaces,nTransFaces; myIgesReader.ReadFile (“MyFile.igs”); //loads file MyFile.igs -Handle(TColStd_HSequenceOfTransient) myList = myIgesReader.GiveList(“iges-faces”); +occ::handle>> myList = myIgesReader.GiveList(“iges-faces”); //selects all IGES faces in the file and puts them into a list called //MyList, nIgesFaces = myList-Length(); @@ -668,7 +668,7 @@ The following parameters are used for the OCCT-to-IGES translation. * "BRep" (1): OCCT *TopoDS_Faces* will be translated into IGES 510 (Face) entities, the IGES file will contain BRep entities. Read this parameter with: ~~~~{.cpp} -Standard_Integer byvalue = Interface_Static::IVal("write.iges.brep.mode"); +int byvalue = Interface_Static::IVal("write.iges.brep.mode"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -697,13 +697,13 @@ Default value is "Faces" (0). * "Greatest" (1): resolution value is set to the maximum tolerance of all edges and all vertices in an OCCT shape. * "Session" (2): resolution value is that of the write.precision.val parameter. - * Read this parameter with Standard_Integer ic = Interface_Static::IVal("write.precision.mode"); + * Read this parameter with int ic = Interface_Static::IVal("write.precision.mode"); * Modify this parameter with if (!Interface_Static\::SetIVal("write.precision.mode",1)) .. error .. * *write.precision.val:* is the user precision value. This parameter gives the resolution value for an IGES file when the *write.precision.mode* parameter value is 1. It is equal to 0.0001 by default, but can take any real positive (non null) value. Read this parameter with: ~~~~{.cpp} -Standard_Real rp = Interface_Static::RVal(;write.precision.val;); +double rp = Interface_Static::RVal(;write.precision.val;); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -724,23 +724,23 @@ write.iges.sequence - ToIGES. You can perform the translation in one or several operations. Here is how you translate topological and geometrical objects: ~~~~{.cpp} -Standard_Boolean ok = writer.AddShape (TopoDS_Shape); +bool ok = writer.AddShape (TopoDS_Shape); ~~~~ *ok* is True if translation was correctly performed and False if there was at least one entity that was not translated. ~~~~{.cpp} -Standard_Boolean ok = writer.AddGeom (geom); +bool ok = writer.AddGeom (geom); ~~~~ -where *geom* is *Handle(Geom_Curve)* or *Handle(Geom_Surface)*; +where *geom* is *occ::handle\* or *occ::handle\*; *ok* is True if the translation was correctly performed and False if there was at least one entity whose geometry was not among the allowed types. @subsubsection occt_iges_3_3_4 Writing the IGES file Write the IGES file with: ~~~~{.cpp} -Standard_Boolean ok = writer.Write ("filename.igs"); +bool ok = writer.Write ("filename.igs"); ~~~~ to give the file name. ~~~~{.cpp} -Standard_Boolean ok = writer.Write (S); +bool ok = writer.Write (S); ~~~~ where *S* is *Standard_OStream* *ok* is True if the operation was correctly performed and False if an error occurred (for instance, if the processor could not create the file). @@ -829,7 +829,7 @@ The highlighted classes are intended to translate geometry. #include #include #include -Standard_Integer main() +int main() { IGESControl_Controller::Init(); IGESControl_Writer ICW (;MM;, 0); @@ -838,7 +838,7 @@ Standard_Integer main() ICW.AddShape (sh); //adds shape sh to IGES model ICW.ComputeModel(); - Standard_Boolean OK = ICW.Write (;MyFile.igs;); + bool OK = ICW.Write (;MyFile.igs;); //writes a model to the file MyFile.igs } ~~~~ @@ -1124,7 +1124,7 @@ Allows writing the prepared model to a file with name *filename.igs*. Before performing any other operation, you must load an IGES file with: ~~~~{.cpp} -IGESCAFControl_Reader reader(XSDRAW::Session(), Standard_False); +IGESCAFControl_Reader reader(XSDRAW::Session(), false); IFSelect_ReturnStatus stat = reader.ReadFile(“filename.igs”); ~~~~ Loading the file only memorizes, but does not translate the data. @@ -1141,28 +1141,28 @@ In addition, the following parameters can be set for XDE translation of attrib * For transferring colors: ~~~~{.cpp} reader.SetColorMode(mode); -// mode can be Standard_True or Standard_False +// mode can be true or false ~~~~ * For transferring names: ~~~~{.cpp} reader.SetNameMode(mode); -// mode can be Standard_True or Standard_False +// mode can be true or false ~~~~ ### Translate an IGES file to XDE The following function performs a translation of the whole document: ~~~~{.cpp} -Standard_Boolean ok = reader.Transfer(doc); +bool ok = reader.Transfer(doc); ~~~~ -where *doc* is a variable which contains a handle to the output document and should have a type *Handle(TDocStd_Document)*. +where *doc* is a variable which contains a handle to the output document and should have a type *occ::handle\*. @subsection occt_iges_5_2 Writing to IGES The translation from XDE to IGES can be initialized as follows: ~~~~{.cpp} -IGESCAFControl_Writer aWriter(XSDRAW::Session(),Standard_False); +IGESCAFControl_Writer aWriter(XSDRAW::Session(),false); ~~~~ ### Set parameters for translation from XDE to IGES @@ -1171,12 +1171,12 @@ The following parameters can be set for translation of attributes to IGES: * For transferring colors: ~~~~{.cpp} aWriter.SetColorMode(mode); -// mode can be Standard_True or Standard_False +// mode can be true or false ~~~~ * For transferring names: ~~~~{.cpp} aWriter.SetNameMode(mode); -// mode can be Standard_True or Standard_False +// mode can be true or false ~~~~ ### Translate an XDE document to IGES @@ -1185,7 +1185,7 @@ You can perform the translation of a document by calling the function: ~~~~{.cpp} IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc); ~~~~ -where "doc" is a variable which contains a handle to the input document for transferring and should have a type *Handle(TDocStd_Document)*. +where "doc" is a variable which contains a handle to the input document for transferring and should have a type *occ::handle\*. ### Write an IGES file diff --git a/dox/user_guides/mesh/mesh.md b/dox/user_guides/mesh/mesh.md index d8df688076..a20b4dab5c 100644 --- a/dox/user_guides/mesh/mesh.md +++ b/dox/user_guides/mesh/mesh.md @@ -35,38 +35,38 @@ The algorithm of shape triangulation is provided by the functionality of *BRepMe #include #include -Standard_Boolean meshing_explicit_parameters() +bool meshing_explicit_parameters() { - const Standard_Real aRadius = 10.0; - const Standard_Real aHeight = 25.0; + const double aRadius = 10.0; + const double aHeight = 25.0; BRepPrimAPI_MakeCylinder aCylinder(aRadius, aHeight); TopoDS_Shape aShape = aCylinder.Shape(); - const Standard_Real aLinearDeflection = 0.01; - const Standard_Real anAngularDeflection = 0.5; - BRepMesh_IncrementalMesh aMesher (aShape, aLinearDeflection, Standard_False, anAngularDeflection, Standard_True); - const Standard_Integer aStatus = aMesher.GetStatusFlags(); + const double aLinearDeflection = 0.01; + const double anAngularDeflection = 0.5; + BRepMesh_IncrementalMesh aMesher (aShape, aLinearDeflection, false, anAngularDeflection, true); + const int aStatus = aMesher.GetStatusFlags(); return !aStatus; } -Standard_Boolean meshing_imeshtools_parameters() +bool meshing_imeshtools_parameters() { - const Standard_Real aRadius = 10.0; - const Standard_Real aHeight = 25.0; + const double aRadius = 10.0; + const double aHeight = 25.0; BRepPrimAPI_MakeCylinder aCylinder(aRadius, aHeight); TopoDS_Shape aShape = aCylinder.Shape(); IMeshTools_Parameters aMeshParams; aMeshParams.Deflection = 0.01; aMeshParams.Angle = 0.5; - aMeshParams.Relative = Standard_False; - aMeshParams.InParallel = Standard_True; + aMeshParams.Relative = false; + aMeshParams.InParallel = true; aMeshParams.MinSize = Precision::Confusion(); - aMeshParams.InternalVerticesMode = Standard_True; - aMeshParams.ControlSurfaceDeflection = Standard_True; + aMeshParams.InternalVerticesMode = true; + aMeshParams.ControlSurfaceDeflection = true; BRepMesh_IncrementalMesh aMesher (aShape, aMeshParams); - const Standard_Integer aStatus = aMesher.GetStatusFlags(); + const int aStatus = aMesher.GetStatusFlags(); return !aStatus; } ~~~~ @@ -208,7 +208,7 @@ The code snippet below shows passing a custom mesh factory to BRepMesh_Increment ~~~~{.cpp} IMeshTools_Parameters aMeshParams; -Handle(IMeshTools_Context) aContext = new BRepMesh_Context(); +occ::handle aContext = new BRepMesh_Context(); aContext->SetFaceDiscret (new BRepMesh_FaceDiscret (new BRepMesh_DelabellaMeshAlgoFactory())); BRepMesh_IncrementalMesh aMesher; diff --git a/dox/user_guides/modeling_algos/modeling_algos.md b/dox/user_guides/modeling_algos/modeling_algos.md index d50f51543b..a04546fa86 100644 --- a/dox/user_guides/modeling_algos/modeling_algos.md +++ b/dox/user_guides/modeling_algos/modeling_algos.md @@ -30,7 +30,7 @@ The *Geom2dAPI_InterCurveCurve* class allows the evaluation of the intersection @figure{/user_guides/modeling_algos/images/modeling_algos_image003.png,"Intersection and self-intersection of curves",300} -In both cases, the algorithm requires a value for the tolerance (Standard_Real) for the confusion between two points. The default tolerance value used in all constructors is *1.0e-6.* +In both cases, the algorithm requires a value for the tolerance (double) for the confusion between two points. The default tolerance value used in all constructors is *1.0e-6.* @figure{/user_guides/modeling_algos/images/modeling_algos_image004.png,"Intersection and tangent intersection",420} @@ -49,7 +49,7 @@ Geom2dAPI_InterCurveCurve Intersector(C3,tolerance); ~~~~ ~~~~{.cpp} -Standard_Integer N = Intersector.NbPoints(); +int N = Intersector.NbPoints(); ~~~~ Calls the number of intersection points @@ -60,12 +60,12 @@ gp_Pnt2d P = Intersector.Point(Index); To call the number of intersection segments, use ~~~~{.cpp} -Standard_Integer M = Intersector.NbSegments(); +int M = Intersector.NbSegments(); ~~~~ To select the desired intersection segment pass integer index values in argument. ~~~~{.cpp} -Handle(Geom2d_Curve) Seg1, Seg2; +occ::handle Seg1, Seg2; Intersector.Segment(Index,Seg1,Seg2); // if intersection of 2 curves Intersector.Segment(Index,Seg1); @@ -89,7 +89,7 @@ GeomAPI_IntCS Intersector(C, S); To call the number of intersection points, use: ~~~~{.cpp} -Standard_Integer nb = Intersector.NbPoints(); +int nb = Intersector.NbPoints(); ~~~~ @@ -109,12 +109,12 @@ GeomAPI_IntSS Intersector(S1, S2, Tolerance); Once the *GeomAPI_IntSS* object has been created, it can be interpreted. ~~~~{.cpp} -Standard_Integer nb = Intersector. NbLines(); +int nb = Intersector. NbLines(); ~~~~ Calls the number of intersection curves. ~~~~{.cpp} -Handle(Geom_Curve) C = Intersector.Line(Index) +occ::handle C = Intersector.Line(Index) ~~~~ Where *Index* is an integer between 1 and *nb*, calls the intersection curves. @@ -137,26 +137,26 @@ This class is used to interpolate a BSplineCurve passing through an array of po This class may be instantiated as follows: ~~~~{.cpp} Geom2dAPI_Interpolate -(const Handle(TColgp_HArray1OfPnt2d)& Points, -const Standard_Boolean PeriodicFlag, -const Standard_Real Tolerance); +(const occ::handle>& Points, +const bool PeriodicFlag, +const double Tolerance); -Geom2dAPI_Interpolate Interp(Points, Standard_False, +Geom2dAPI_Interpolate Interp(Points, false, Precision::Confusion()); ~~~~ It is possible to call the BSpline curve from the object defined above it. ~~~~{.cpp} -Handle(Geom2d_BSplineCurve) C = Interp.Curve(); +occ::handle C = Interp.Curve(); ~~~~ -Note that the *Handle(Geom2d_BSplineCurve)* operator has been redefined by the method *Curve()*. Consequently, it is unnecessary to pass via the construction of an intermediate object of the *Geom2dAPI_Interpolate* type and the following syntax is correct. +Note that the *occ::handle\* operator has been redefined by the method *Curve()*. Consequently, it is unnecessary to pass via the construction of an intermediate object of the *Geom2dAPI_Interpolate* type and the following syntax is correct. ~~~~{.cpp} -Handle(Geom2d_BSplineCurve) C = +occ::handle C = Geom2dAPI_Interpolate(Points, - Standard_False, + false, Precision::Confusion()); ~~~~ @@ -165,29 +165,31 @@ Geom2dAPI_Interpolate(Points, This class may be instantiated as follows: ~~~~{.cpp} GeomAPI_Interpolate -(const Handle(TColgp_HArray1OfPnt)& Points, -const Standard_Boolean PeriodicFlag, -const Standard_Real Tolerance); +(const occ::handle>& Points, +const bool PeriodicFlag, +const double Tolerance); -GeomAPI_Interpolate Interp(Points, Standard_False, +GeomAPI_Interpolate Interp(Points, false, Precision::Confusion()); ~~~~ It is possible to call the BSpline curve from the object defined above it. ~~~~{.cpp} -Handle(Geom_BSplineCurve) C = Interp.Curve(); +occ::handle C = Interp.Curve(); ~~~~ -Note that the *Handle(Geom_BSplineCurve)* operator has been redefined by the method *Curve()*. Thus, it is unnecessary to pass via the construction of an intermediate object of the *GeomAPI_Interpolate* type and the following syntax is correct. +Note that the *occ::handle\* operator has been redefined by the method *Curve()*. Thus, it is unnecessary to pass via the construction of an intermediate object of the *GeomAPI_Interpolate* type and the following syntax is correct. -Handle(Geom_BSplineCurve) C = - GeomAPI_Interpolate(Points, - Standard_False, - 1.0e-7); +~~~~{.cpp} +occ::handle C = + GeomAPI_Interpolate(Points, + false, + 1.0e-7); +~~~~ Boundary conditions may be imposed with the method Load. ~~~~{.cpp} GeomAPI_Interpolate AnInterpolator -(Points, Standard_False, 1.0e-5); +(Points, false, 1.0e-5); AnInterpolator.Load (StartingTangent, EndingTangent); ~~~~ @@ -621,7 +623,7 @@ The class *MakeApprox* allows converting a *GeomPlate* surface into a *Geom_BSpl Let us create a Plate surface and approximate it from a polyline as a curve constraint and a point constraint ~~~~{.cpp} -Standard_Integer NbCurFront=4, +int NbCurFront=4, NbPointConstraint=1; gp_Pnt P1(0.,0.,0.); gp_Pnt P2(0.,10.,0.); @@ -636,38 +638,37 @@ W.Add(P4); W.Add(P1); // Initialize a BuildPlateSurface GeomPlate_BuildPlateSurface BPSurf(3,15,2); -// Create the curve constraints -BRepTools_WireExplorer anExp; -for(anExp.Init(W); anExp.More(); anExp.Next()) +// Create the curve constraints +for (BRepTools_WireExplorer anExp(W); anExp.More(); anExp.Next()) { TopoDS_Edge E = anExp.Current(); -Handle(BRepAdaptor_HCurve) C = new +occ::handle C = new BRepAdaptor_HCurve(); C-ChangeCurve().Initialize(E); -Handle(BRepFill_CurveConstraint) Cont= new +occ::handle Cont= new BRepFill_CurveConstraint(C,0); BPSurf.Add(Cont); } // Point constraint -Handle(GeomPlate_PointConstraint) PCont= new +occ::handle PCont= new GeomPlate_PointConstraint(P5,0); BPSurf.Add(PCont); // Compute the Plate surface BPSurf.Perform(); // Approximation of the Plate surface -Standard_Integer MaxSeg=9; -Standard_Integer MaxDegree=8; -Standard_Integer CritOrder=0; -Standard_Real dmax,Tol; -Handle(GeomPlate_Surface) PSurf = BPSurf.Surface(); -dmax = Max(0.0001,10*BPSurf.G0Error()); +int MaxSeg=9; +int MaxDegree=8; +int CritOrder=0; +double dmax,Tol; +occ::handle PSurf = BPSurf.Surface(); +dmax = std::max(0.0001,10*BPSurf.G0Error()); Tol=0.0001; GeomPlate_MakeApprox Mapp(PSurf,Tol,MaxSeg,MaxDegree,dmax,CritOrder); Handle (Geom_Surface) Surf (Mapp.Surface()); // create a face corresponding to the approximated Plate Surface -Standard_Real Umin, Umax, Vmin, Vmax; +double Umin, Umax, Vmin, Vmax; PSurf->Bounds( Umin, Umax, Vmin, Vmax); BRepBuilderAPI_MakeFace MF(Surf,Umin, Umax, Vmin, Vmax); ~~~~ @@ -693,7 +694,7 @@ The class *Geom2dAPI_ProjectPointOnCurve* may be instantiated as in the followin ~~~~{.cpp} gp_Pnt2d P; -Handle(Geom2d_BezierCurve) C = +occ::handle C = new Geom2d_BezierCurve(args); Geom2dAPI_ProjectPointOnCurve Projector (P, C); ~~~~ @@ -707,7 +708,7 @@ Having thus created the *Geom2dAPI_ProjectPointOnCurve* object, we can now inter #### Calling the number of solution points ~~~~{.cpp} -Standard_Integer NumSolutions = Projector.NbPoints(); +int NumSolutions = Projector.NbPoints(); ~~~~ #### Calling the location of a solution point @@ -722,13 +723,13 @@ gp_Pnt2d Pn = Projector.Point(Index); For a given point corresponding to a given *Index*: ~~~~{.cpp} -Standard_Real U = Projector.Parameter(Index); +double U = Projector.Parameter(Index); ~~~~ This can also be programmed as: ~~~~{.cpp} -Standard_Real U; +double U; Projector.Parameter(Index,U); ~~~~ @@ -737,7 +738,7 @@ Projector.Parameter(Index,U); We can find the distance between the initial point and a point, which corresponds to the given *Index*: ~~~~{.cpp} -Standard_Real D = Projector.Distance(Index); +double D = Projector.Distance(Index); ~~~~ #### Calling the nearest solution point @@ -751,29 +752,29 @@ gp_Pnt2d P1 = Projector.NearestPoint(); #### Calling the parameter of the nearest solution point ~~~~{.cpp} -Standard_Real U = Projector.LowerDistanceParameter(); +double U = Projector.LowerDistanceParameter(); ~~~~ #### Calling the minimum distance from the point to the curve ~~~~{.cpp} -Standard_Real D = Projector.LowerDistance(); +double D = Projector.LowerDistance(); ~~~~ #### Redefined operators Some operators have been redefined to find the closest solution. -*Standard_Real()* returns the minimum distance from the point to the curve. +*double()* returns the minimum distance from the point to the curve. ~~~~{.cpp} -Standard_Real D = Geom2dAPI_ProjectPointOnCurve (P,C); +double D = Geom2dAPI_ProjectPointOnCurve (P,C); ~~~~ -*Standard_Integer()* returns the number of solutions. +*int()* returns the number of solutions. ~~~~{.cpp} -Standard_Integer N = +int N = Geom2dAPI_ProjectPointOnCurve (P,C); ~~~~ @@ -809,7 +810,7 @@ The class *GeomAPI_ProjectPointOnCurve* is instantiated as in the following exa ~~~~{.cpp} gp_Pnt P; -Handle(Geom_BezierCurve) C = +occ::handle C = new Geom_BezierCurve(args); GeomAPI_ProjectPointOnCurve Projector (P, C); ~~~~ @@ -824,7 +825,7 @@ Having thus created the *GeomAPI_ProjectPointOnCurve* object, you can now inter #### Calling the number of solution points ~~~~{.cpp} -Standard_Integer NumSolutions = Projector.NbPoints(); +int NumSolutions = Projector.NbPoints(); ~~~~ #### Calling the location of a solution point @@ -839,12 +840,12 @@ gp_Pnt Pn = Projector.Point(Index); For a given point corresponding to a given index: ~~~~{.cpp} -Standard_Real U = Projector.Parameter(Index); +double U = Projector.Parameter(Index); ~~~~ This can also be programmed as: ~~~~{.cpp} -Standard_Real U; +double U; Projector.Parameter(Index,U); ~~~~ @@ -852,7 +853,7 @@ Projector.Parameter(Index,U); The distance between the initial point and a point, which corresponds to a given index, may be found: ~~~~{.cpp} -Standard_Real D = Projector.Distance(Index); +double D = Projector.Distance(Index); ~~~~ #### Calling the nearest solution point @@ -865,28 +866,28 @@ gp_Pnt P1 = Projector.NearestPoint(); #### Calling the parameter of the nearest solution point ~~~~{.cpp} -Standard_Real U = Projector.LowerDistanceParameter(); +double U = Projector.LowerDistanceParameter(); ~~~~ #### Calling the minimum distance from the point to the curve ~~~~{.cpp} -Standard_Real D = Projector.LowerDistance(); +double D = Projector.LowerDistance(); ~~~~ #### Redefined operators Some operators have been redefined to find the nearest solution. -*Standard_Real()* returns the minimum distance from the point to the curve. +*double()* returns the minimum distance from the point to the curve. ~~~~{.cpp} -Standard_Real D = GeomAPI_ProjectPointOnCurve (P,C); +double D = GeomAPI_ProjectPointOnCurve (P,C); ~~~~ -*Standard_Integer()* returns the number of solutions. +*int()* returns the number of solutions. ~~~~{.cpp} -Standard_Integer N = GeomAPI_ProjectPointOnCurve (P,C); +int N = GeomAPI_ProjectPointOnCurve (P,C); ~~~~ *gp_Pnt2d()* returns the nearest solution point. @@ -943,7 +944,7 @@ Having thus created the *GeomAPI_ProjectPointOnSurf* object, you can interrogat #### Calling the number of solution points ~~~~{.cpp} -Standard_Integer NumSolutions = Proj.NbPoints(); +int NumSolutions = Proj.NbPoints(); ~~~~ #### Calling the location of a solution point @@ -959,7 +960,7 @@ gp_Pnt Pn = Proj.Point(Index); For a given point corresponding to the given index: ~~~~{.cpp} -Standard_Real U,V; +double U,V; Proj.Parameters(Index, U, V); ~~~~ @@ -968,7 +969,7 @@ Proj.Parameters(Index, U, V); The distance between the initial point and a point corresponding to the given index may be found: ~~~~{.cpp} -Standard_Real D = Projector.Distance(Index); +double D = Projector.Distance(Index); ~~~~ #### Calling the nearest solution point @@ -981,30 +982,30 @@ gp_Pnt P1 = Proj.NearestPoint(); #### Calling the parameters of the nearest solution point ~~~~{.cpp} -Standard_Real U,V; +double U,V; Proj.LowerDistanceParameters (U, V); ~~~~ #### Calling the minimum distance from a point to the surface ~~~~{.cpp} -Standard_Real D = Proj.LowerDistance(); +double D = Proj.LowerDistance(); ~~~~ #### Redefined operators Some operators have been redefined to help you find the nearest solution. -*Standard_Real()* returns the minimum distance from the point to the surface. +*double()* returns the minimum distance from the point to the surface. ~~~~{.cpp} -Standard_Real D = GeomAPI_ProjectPointOnSurf (P,S); +double D = GeomAPI_ProjectPointOnSurf (P,S); ~~~~ -*Standard_Integer()* returns the number of solutions. +*int()* returns the number of solutions. ~~~~{.cpp} -Standard_Integer N = GeomAPI_ProjectPointOnSurf (P,S); +int N = GeomAPI_ProjectPointOnSurf (P,S); ~~~~ *gp_Pnt2d()* returns the nearest solution point. @@ -1045,8 +1046,8 @@ The *To2d* and *To3d* methods are used to; These methods are called as follows: ~~~~{.cpp} -Handle(Geom2d_Curve) C2d = GeomAPI::To2d(C3d, Pln); -Handle(Geom_Curve) C3d = GeomAPI::To3d(C2d, Pln); +occ::handle C2d = GeomAPI::To2d(C3d, Pln); +occ::handle C3d = GeomAPI::To3d(C2d, Pln); ~~~~ @@ -1082,9 +1083,9 @@ This class always creates a new vertex and has no other methods. Use *BRepBuilderAPI_MakeEdge* to create from a curve and vertices. The basic method constructs an edge from a curve, two vertices, and two parameters. ~~~~{.cpp} -Handle(Geom_Curve) C = ...; // a curve +occ::handle C = ...; // a curve TopoDS_Vertex V1 = ...,V2 = ...;// two Vertices -Standard_Real p1 = ..., p2 = ..;// two parameters +double p1 = ..., p2 = ..;// two parameters TopoDS_Edge E = BRepBuilderAPI_MakeEdge(C,V1,V2,p1,p2); ~~~~ @@ -1132,9 +1133,9 @@ There exist supplementary edge construction methods derived from the basic one. The five following methods are thus derived from the basic construction: ~~~~{.cpp} -Handle(Geom_Curve) C = ...; // a curve +occ::handle C = ...; // a curve TopoDS_Vertex V1 = ...,V2 = ...;// two Vertices -Standard_Real p1 = ..., p2 = ..;// two parameters +double p1 = ..., p2 = ..;// two parameters gp_Pnt P1 = ..., P2 = ...;// two points TopoDS_Edge E; // project the vertices on the curve @@ -1203,9 +1204,9 @@ The following example creates a rectangle centered on the origin of dimensions #include // Use MakeArc method to make an edge and two vertices -void MakeArc(Standard_Real x,Standard_Real y, -Standard_Real R, -Standard_Real ang, +void MakeArc(double x,double y, +double R, +double ang, TopoDS_Shape& E, TopoDS_Shape& V1, TopoDS_Shape& V2) @@ -1220,20 +1221,20 @@ V1 = ME.Vertex1(); V2 = ME.Vertex2(); } -TopoDS_Wire MakeFilletedRectangle(const Standard_Real H, -const Standard_Real L, -const Standard_Real R) +TopoDS_Wire MakeFilletedRectangle(const double H, +const double L, +const double R) { -TopTools_Array1OfShape theEdges(1,8); -TopTools_Array1OfShape theVertices(1,8); +NCollection_Array1 theEdges(1,8); +NCollection_Array1 theVertices(1,8); // First create the circular edges and the vertices // using the MakeArc function described above. -void MakeArc(Standard_Real, Standard_Real, -Standard_Real, Standard_Real, +void MakeArc(double, double, +double, double, TopoDS_Shape&, TopoDS_Shape&, TopoDS_Shape&); -Standard_Real x = L/2 - R, y = H/2 - R; +double x = L/2 - R, y = H/2 - R; MakeArc(x,-y,R,3.*PI/2.,theEdges(2),theVertices(2), theVertices(3)); MakeArc(x,y,R,0.,theEdges(4),theVertices(4), @@ -1243,7 +1244,7 @@ theVertices(7)); MakeArc(-x,-y,R,PI,theEdges(8),theVertices(8), theVertices(1)); // Create the linear edges -for (Standard_Integer i = 1; i <= 7; i += 2) +for (int i = 1; i <= 7; i += 2) { theEdges(i) = BRepBuilderAPI_MakeEdge (TopoDS::Vertex(theVertices(i)),TopoDS::Vertex @@ -1276,10 +1277,10 @@ The basic usage of *BRepBuilderAPI_MakePolygon* is to create a wire by adding v #include #include -TopoDS_Wire ClosedPolygon(const TColgp_Array1OfPnt& Points) +TopoDS_Wire ClosedPolygon(const NCollection_Array1& Points) { BRepBuilderAPI_MakePolygon MP; -for(Standard_Integer i=Points.Lower();i=Points.Upper();i++) +for (int i = Points.Lower(); i <= Points.Upper(); i++) { MP.Add(Points(i)); } @@ -1294,7 +1295,7 @@ Two examples: Example of a closed triangle from three vertices: ~~~~{.cpp} -TopoDS_Wire W = BRepBuilderAPI_MakePolygon(V1,V2,V3,Standard_True); +TopoDS_Wire W = BRepBuilderAPI_MakePolygon(V1,V2,V3,true); ~~~~ Example of an open polygon from four points: @@ -1315,8 +1316,8 @@ Use *BRepBuilderAPI_MakeFace* class to create a face from a surface and wires. A A face can be constructed from a surface and four parameters to determine a limitation of the UV space. The parameters are optional, if they are omitted the natural bounds of the surface are used. Up to four edges and vertices are created with a wire. No edge is created when the parameter is infinite. ~~~~{.cpp} -Handle(Geom_Surface) S = ...; // a surface -Standard_Real umin,umax,vmin,vmax; // parameters +occ::handle S = ...; // a surface +double umin,umax,vmin,vmax; // parameters TopoDS_Face F = BRepBuilderAPI_MakeFace(S,umin,umax,vmin,vmax); ~~~~ @@ -1325,7 +1326,7 @@ TopoDS_Face F = BRepBuilderAPI_MakeFace(S,umin,umax,vmin,vmax); To make a face from the natural boundary of a surface, the parameters are not required: ~~~~{.cpp} -Handle(Geom_Surface) S = ...; // a surface +occ::handle S = ...; // a surface TopoDS_Face F = BRepBuilderAPI_MakeFace(S); ~~~~ @@ -1374,10 +1375,10 @@ A planar face can be created from only a wire, provided this wire defines a pla #include #include -TopoDS_Face PolygonalFace(const TColgp_Array1OfPnt& thePnts) +TopoDS_Face PolygonalFace(const NCollection_Array1& thePnts) { BRepBuilderAPI_MakePolygon MP; -for(Standard_Integer i=thePnts.Lower(); +for(int i=thePnts.Lower(); i<=thePnts.Upper(); i++) { MP.Add(thePnts(i)); @@ -1422,7 +1423,7 @@ For a higher or unknown number of edges the Add method must be used; for exampl ~~~~{.cpp} TopTools_Array1OfShapes theEdges; BRepBuilderAPI_MakeWire MW; -for (Standard_Integer i = theEdge.Lower(); +for (int i = theEdge.Lower(); i <= theEdges.Upper(); i++) MW.Add(TopoDS::Edge(theEdges(i)); TopoDS_Wire W = MW; @@ -1536,7 +1537,7 @@ The following code builds the cylindrical face of the figure, which is a quarte ~~~~{.cpp} -Standard_Real X = 20, Y = 10, Z = 15, R = 10, DY = 30; +double X = 20, Y = 10, Z = 15, R = 10, DY = 30; // Make the system of coordinates gp_Ax2 axes = gp::ZOX(); axes.Translate(gp_Vec(X,Y,Z)); @@ -1554,7 +1555,7 @@ BRepPrimAPI_MakeCylinder(axes,R,DY,PI/2.); The following code builds the solid cone of the figure, which is located in the default system with radii *R1* and *R2* and height *H*. ~~~~{.cpp} -Standard_Real R1 = 30, R2 = 10, H = 15; +double R1 = 30, R2 = 10, H = 15; TopoDS_Solid S = BRepPrimAPI_MakeCone(R1,R2,H); ~~~~ @@ -1571,7 +1572,7 @@ TopoDS_Solid S = BRepPrimAPI_MakeCone(R1,R2,H); The following code builds four spheres from a radius and three angles. ~~~~{.cpp} -Standard_Real R = 30, ang = +double R = 30, ang = PI/2, a1 = -PI/2.3, a2 = PI/4; TopoDS_Solid S1 = BRepPrimAPI_MakeSphere(R); TopoDS_Solid S2 = BRepPrimAPI_MakeSphere(R,ang); @@ -1597,7 +1598,7 @@ Note that we could equally well choose to create Shells instead of Solids. The following code builds four toroidal shells from two radii and three angles. ~~~~{.cpp} -Standard_Real R1 = 30, R2 = 10, ang = PI, a1 = 0, +double R1 = 30, R2 = 10, ang = PI, a1 = 0, a2 = PI/2; TopoDS_Shell S1 = BRepPrimAPI_MakeTorus(R1,R2); TopoDS_Shell S2 = BRepPrimAPI_MakeTorus(R1,R2,ang); @@ -1650,7 +1651,7 @@ The following code creates a finite, an infinite and a semi-infinite solid using ~~~~{.cpp} TopoDS_Face F = ..; // The swept face gp_Dir direc(0,0,1); -Standard_Real l = 10; +double l = 10; // create a vector from the direction and the length gp_Vec v = direc; v *= l; @@ -1658,7 +1659,7 @@ TopoDS_Solid P1 = BRepPrimAPI_MakePrism(F,v); // finite TopoDS_Solid P2 = BRepPrimAPI_MakePrism(F,direc); // infinite -TopoDS_Solid P3 = BRepPrimAPI_MakePrism(F,direc,Standard_False); +TopoDS_Solid P3 = BRepPrimAPI_MakePrism(F,direc,false); // semi-infinite ~~~~ @@ -1673,7 +1674,7 @@ The following code creates a full and a partial rotation using a face, an axis a ~~~~{.cpp} TopoDS_Face F = ...; // the profile gp_Ax1 axis(gp_Pnt(0,0,0),gp_Dir(0,0,1)); -Standard_Real ang = PI/3; +double ang = PI/3; TopoDS_Solid R1 = BRepPrimAPI_MakeRevol(F,axis); // Full revol TopoDS_Solid R2 = BRepPrimAPI_MakeRevol(F,axis,ang); @@ -1782,18 +1783,18 @@ To make the faces from edges it is, firstly, necessary to create planar wires fr The static methods *BOPAlgo_Tools::EdgesToWires* and *BOPAlgo_Tools::WiresToFaces* can be used for that: ~~~~{.cpp} TopoDS_Shape anEdges = ...; /* The input edges */ -Standard_Real anAngTol = 1.e-8; /* The angular tolerance for distinguishing the planes in which the wires are located */ -Standard_Boolean bShared = Standard_False; /* Defines whether the edges are shared or not */ +double anAngTol = 1.e-8; /* The angular tolerance for distinguishing the planes in which the wires are located */ +bool bShared = false; /* Defines whether the edges are shared or not */ // TopoDS_Shape aWires; /* resulting wires */ -Standard_Integer iErr = BOPAlgo_Tools::EdgesToWires(anEdges, aWires, bShared, anAngTol); +int iErr = BOPAlgo_Tools::EdgesToWires(anEdges, aWires, bShared, anAngTol); if (iErr) { cout << "Error: Unable to build wires from given edges\n"; return; } // TopoDS_Shape aFaces; /* resulting faces */ -Standard_Boolean bDone = BOPAlgo_Tools::WiresToFaces(aWires, aFaces, anAngTol); +bool bDone = BOPAlgo_Tools::WiresToFaces(aWires, aFaces, anAngTol); if (!bDone) { cout << "Error: Unable to build faces from wires\n"; return; @@ -1961,7 +1962,7 @@ The History is filled basing on the result of the operation. History cannot retu If the result of the operation is an empty shape, all input shapes will be considered as Deleted and none will have Modified and Generated shapes. The history information can be accessed by the API methods: -* *Standard_Boolean IsDeleted(const TopoDS_Shape& theS)* - to check if the shape has been Deleted during the operation; +* *bool IsDeleted(const TopoDS_Shape& theS)* - to check if the shape has been Deleted during the operation; * *const TopTools_ListOfShape& Modified(const TopoDS_Shape& theS)* - to get the shapes Modified from the given shape; * *const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS)* - to get the shapes Generated from the given shape. @@ -2008,7 +2009,7 @@ BRepBuilderAPI_Transform aTransformer(aS, aTrsf); // Transformation API algorith const TopoDS_Shape& aRes = aTransformer.Shape(); // Create the translation history object -TopTools_ListOfShape anArguments; +NCollection_List anArguments; anArguments.Append(aS); BRepTools_History aHistory(anArguments, aTransformer); ~~~~ @@ -2016,8 +2017,8 @@ BRepTools_History aHistory(anArguments, aTransformer); *BRepTools_History* also allows merging histories. Thus, if you have two or more subsequent operations you can get one final history combined from histories of these operations: ~~~~{.cpp} -Handle(BRepTools_History) aHist1 = ...; // History of first operation -Handle(BRepTools_History) aHist2 = ...; // History of second operation +occ::handle aHist1 = ...; // History of first operation +occ::handle aHist2 = ...; // History of second operation ~~~~ It is possible to merge the second history into the first one: @@ -2027,7 +2028,7 @@ aHist1->Merge(aHist2); Or create the new history keeping the two histories unmodified: ~~~~{.cpp} -Handle(BRepTools_History) aResHistory = new BRepTools_History; +occ::handle aResHistory = new BRepTools_History; aResHistory->Merge(aHist1); aResHistory->Merge(aHist2); ~~~~ @@ -2079,10 +2080,10 @@ In the following example a filleted box with dimensions a,b,c and radius r is c #include #include -TopoDS_Shape FilletedBox(const Standard_Real a, - const Standard_Real b, - const Standard_Real c, - const Standard_Real r) +TopoDS_Shape FilletedBox(const double a, + const double b, + const double c, + const double r) { TopoDS_Solid Box = BRepPrimAPI_MakeBox(a,b,c); BRepFilletAPI_MakeFillet MF(Box); @@ -2112,7 +2113,7 @@ void CSampleTopologicalOperationsDoc::OnEvolvedblend1() ChFi3d_FilletShape FSh = ChFi3d_Rational; Rake.SetFilletShape(FSh); - TColgp_Array1OfPnt2d ParAndRad(1, 6); + NCollection_Array1 ParAndRad(1, 6); ParAndRad(1).SetCoord(0., 10.); ParAndRad(1).SetCoord(50., 20.); ParAndRad(1).SetCoord(70., 20.); @@ -2170,10 +2171,10 @@ Planar Fillet #include “TopoDS.hxx” #include “TopoDS_Solid.hxx” -TopoDS_Shape FilletFace(const Standard_Real a, - const Standard_Real b, - const Standard_Real c, - const Standard_Real r) +TopoDS_Shape FilletFace(const double a, + const double b, + const double c, + const double r) { TopoDS_Solid Box = BRepPrimAPI_MakeBox (a,b,c); @@ -2245,12 +2246,12 @@ The MakeThickSolidByJoin method of the *BRepOffsetAPI_MakeThickSolid* takes the ~~~~{.cpp} TopoDS_Solid SolidInitial = ...; -Standard_Real Of = ...; -TopTools_ListOfShape LCF; +double Of = ...; +NCollection_List LCF; TopoDS_Shape Result; -Standard_Real Tol = Precision::Confusion(); +double Tol = Precision::Confusion(); -for (Standard_Integer i = 1 ;i <= n; i++) { +for (int i = 1 ;i <= n; i++) { TopoDS_Face SF = ...; // a face from SolidInitial LCF.Append(SF); } @@ -2290,18 +2291,18 @@ The following code places a draft angle on several faces of a shape; the same d ~~~~{.cpp} TopoDS_Shape myShape = ... // The original shape -TopTools_ListOfShape ListOfFace; +NCollection_List ListOfFace; // Creation of the list of faces to be modified ... gp_Dir Direc(0.,0.,1.); // Z direction -Standard_Real Angle = 5.*PI/180.; +double Angle = 5.*PI/180.; // 5 degree angle gp_Pln Neutral(gp_Pnt(0.,0.,5.), Direc); // Neutral plane Z=5 BRepOffsetAPI_DraftAngle theDraft(myShape); -TopTools_ListIteratorOfListOfShape itl; +NCollection_List::Iterator itl; for (itl.Initialize(ListOfFace); itl.More(); itl.Next()) { theDraft.Add(TopoDS::Face(itl.Value()),Direc,Angle,Neutral); if (!theDraft.AddDone()) { @@ -2383,7 +2384,7 @@ T.SetRotation(gp_Ax1(gp_Pnt(0.,0.,0.),gp_Vec(0.,0.,1.)), BRepBuilderAPI_Transformation theTrsf(T); theTrsf.Perform(myShape1); TopoDS_Shape myNewShape1 = theTrsf.Shape() -theTrsf.Perform(myShape2,Standard_True); +theTrsf.Perform(myShape2,true); // Here duplication is forced TopoDS_Shape myNewShape2 = theTrsf.Shape() ~~~~ @@ -2625,7 +2626,7 @@ gp_Dir Extrusion (.,.,.); // An empty face is given as the sketch face -BRepFeat_MakePrism thePrism(Sbase, Fbase, TopoDS_Face(), Extrusion, Standard_True, Standard_True); +BRepFeat_MakePrism thePrism(Sbase, Fbase, TopoDS_Face(), Extrusion, true, true); thePrism, Perform(100.); if (thePrism.IsDone()) { @@ -2671,20 +2672,20 @@ Ex.Next(); Ex.Next(); Ex.Next(); TopoDS_Face F = TopoDS::Face(Ex.Current()); -Handle(Geom_Surface) surf = BRep_Tool::Surface(F); +occ::handle surf = BRep_Tool::Surface(F); gp_Circ2d c(gp_Ax2d(gp_Pnt2d(200.,130.),gp_Dir2d(1.,0.)),50.); BRepBuilderAPI_MakeWire MW; -Handle(Geom2d_Curve) aline = new Geom2d_Circle(c); +occ::handle aline = new Geom2d_Circle(c); MW.Add(BRepBuilderAPI_MakeEdge(aline,surf,0.,PI)); MW.Add(BRepBuilderAPI_MakeEdge(aline,surf,PI,2.*PI)); BRepBuilderAPI_MakeFace MKF; -MKF.Init(surf,Standard_False); +MKF.Init(surf,false); MKF.Add(MW.Wire()); TopoDS_Face FP = MKF.Face(); BRepLib::BuildCurves3d(FP); -BRepFeat_MakeDPrism MKDP (S,FP,F,10*PI180,Standard_True, - Standard_True); +BRepFeat_MakeDPrism MKDP (S,FP,F,10*PI180,true, + true); MKDP.Perform(200); TopoDS_Shape res1 = MKDP.Shape(); ~~~~ @@ -2724,7 +2725,7 @@ gp_Ax1 RevolAx(gp_Pnt(.,.,.), RevolDir); // An empty face is given as the sketch face -BRepFeat_MakeRevol theRevol(Sbase, Frevol, TopoDS_Face(), RevolAx, Standard_True, Standard_True); +BRepFeat_MakeRevol theRevol(Sbase, Frevol, TopoDS_Face(), RevolAx, true, true); theRevol.Perform(FUntil); if (theRevol.IsDone()) { @@ -2759,12 +2760,12 @@ Ex.Init(S,TopAbs_FACE); Ex.Next(); Ex.Next(); TopoDS_Face F1 = TopoDS::Face(Ex.Current()); -Handle(Geom_Surface) surf = BRep_Tool::Surface(F1); +occ::handle surf = BRep_Tool::Surface(F1); BRepBuilderAPI_MakeWire MW1; gp_Pnt2d p1,p2; p1 = gp_Pnt2d(100.,100.); p2 = gp_Pnt2d(200.,100.); -Handle(Geom2d_Line) aline = GCE2d_MakeLine(p1,p2).Value(); +occ::handle aline = GCE2d_MakeLine(p1,p2).Value(); MW1.Add(BRepBuilderAPI_MakeEdge(aline,surf,0.,p1.Distance(p2))); p1 = p2; @@ -2778,23 +2779,23 @@ aline = GCE2d_MakeLine(p1,p2).Value(); MW1.Add(BRepBuilderAPI_MakeEdge(aline,surf,0.,p1.Distance(p2))); BRepBuilderAPI_MakeFace MKF1; -MKF1.Init(surf,Standard_False); +MKF1.Init(surf,false); MKF1.Add(MW1.Wire()); TopoDS_Face FP = MKF1.Face(); BRepLib::BuildCurves3d(FP); -TColgp_Array1OfPnt CurvePoles(1,3); +NCollection_Array1 CurvePoles(1,3); gp_Pnt pt = gp_Pnt(150.,0.,150.); CurvePoles(1) = pt; pt = gp_Pnt(200.,100.,150.); CurvePoles(2) = pt; pt = gp_Pnt(150.,200.,150.); CurvePoles(3) = pt; -Handle(Geom_BezierCurve) curve = new Geom_BezierCurve +occ::handle curve = new Geom_BezierCurve (CurvePoles); TopoDS_Edge E = BRepBuilderAPI_MakeEdge(curve); TopoDS_Wire W = BRepBuilderAPI_MakeWire(E); -BRepFeat_MakePipe MKPipe (S,FP,F1,W,Standard_False, -Standard_True); +BRepFeat_MakePipe MKPipe (S,FP,F1,W,false, +true); MKPipe.Perform(); TopoDS_Shape res1 = MKPipe.Shape(); ~~~~ @@ -2851,10 +2852,10 @@ TopoDS_Shape S = BRepBuilderAPI_MakePrism(BRepBuilderAPI_MakeFace TopoDS_Wire W = BRepBuilderAPI_MakeWire(BRepBuilderAPI_MakeEdge(gp_Pnt (50.,45.,100.), gp_Pnt(100.,45.,50.))); -Handle(Geom_Plane) aplane = +occ::handle aplane = new Geom_Plane(gp_Pnt(0.,45.,0.), gp_Vec(0.,1.,0.)); BRepFeat_MakeLinearForm aform(S, W, aplane, gp_Dir - (0.,5.,0.), gp_Dir(0.,-3.,0.), 1, Standard_True); + (0.,5.,0.), gp_Dir(0.,-3.,0.), 1, true); aform.Perform(); TopoDS_Shape res = aform.Shape(); ~~~~ @@ -2874,14 +2875,14 @@ Two *Bind* methods are used to bind a face of the glued shape to a face of the TopoDS_Shape Sbase = ...; // the basic shape TopoDS_Shape Sglued = ...; // the glued shape -TopTools_ListOfShape Lfbase; -TopTools_ListOfShape Lfglued; +NCollection_List Lfbase; +NCollection_List Lfglued; // Determination of the glued faces ... BRepFeat_Gluer theGlue(Sglue, Sbase); -TopTools_ListIteratorOfListOfShape itlb(Lfbase); -TopTools_ListIteratorOfListOfShape itlg(Lfglued); +NCollection_List::Iterator itlb(Lfbase); +NCollection_List::Iterator itlg(Lfglued); for (; itlb.More(); itlb.Next(), itlg(Next()) { const TopoDS_Face& f1 = TopoDS::Face(itlg.Value()); const TopoDS_Face& f2 = TopoDS::Face(itlb.Value()); @@ -2988,9 +2989,9 @@ Although, removal of only two faces, keeping one of the transverse faces, will f Here is the example of usage of the *BRepAlgoAPI_Defeaturing* algorithm on the C++ level: ~~~~{.cpp} TopoDS_Shape aSolid = ...; // Input shape to remove the features from -TopTools_ListOfShape aFeatures = ...; // Features to remove from the shape -Standard_Boolean bRunParallel = ...; // Parallel processing mode -Standard_Boolean isHistoryNeeded = ...; // History support +NCollection_List aFeatures = ...; // Features to remove from the shape +bool bRunParallel = ...; // Parallel processing mode +bool isHistoryNeeded = ...; // History support BRepAlgoAPI_Defeaturing aDF; // Defeaturing algorithm aDF.SetShape(aSolid); // Set the shape @@ -3017,13 +3018,13 @@ const TopoDS_Shape& aResult = aDF.Shape(); // Result shape Use the API history methods to track the history of a shape: ~~~~{.cpp} // Obtain modification of the shape -const TopTools_ListOfShape& BRepAlgoAPI_Defeaturing::Modified(const TopoDS_Shape& theS); +const NCollection_List& BRepAlgoAPI_Defeaturing::Modified(const TopoDS_Shape& theS); // Obtain shapes generated from the shape -const TopTools_ListOfShape& BRepAlgoAPI_Defeaturing::Generated(const TopoDS_Shape& theS); +const NCollection_List& BRepAlgoAPI_Defeaturing::Generated(const TopoDS_Shape& theS); // Check if the shape is removed or not -Standard_Boolean BRepAlgoAPI_Defeaturing::IsDeleted(const TopoDS_Shape& theS); +bool BRepAlgoAPI_Defeaturing::IsDeleted(const TopoDS_Shape& theS); ~~~~ The command removefeatures allows using the Defeaturing algorithm on the Draw level. @@ -3166,13 +3167,13 @@ The algorithm is implemented in the class *BOPAlgo_MakePeriodic*. Here is the example of its usage on the API level: ~~~~{.cpp} TopoDS_Shape aShape = ...; // The shape to make periodic -Standard_Boolean bMakeXPeriodic = ...; // Flag for making or not the shape periodic in X direction -Standard_Real aXPeriod = ...; // X period for the shape -Standard_Boolean isXTrimmed = ...; // Flag defining whether it is necessary to trimming +bool bMakeXPeriodic = ...; // Flag for making or not the shape periodic in X direction +double aXPeriod = ...; // X period for the shape +bool isXTrimmed = ...; // Flag defining whether it is necessary to trimming // the shape to fit to X period -Standard_Real aXFirst = ...; // Start of the X period +double aXFirst = ...; // Start of the X period // (really necessary only if the trimming is requested) -Standard_Boolean bRunParallel = ...; // Parallel processing mode or single +bool bRunParallel = ...; // Parallel processing mode or single BOPAlgo_MakePeriodic aPeriodicityMaker; // Periodicity maker aPeriodicityMaker.SetShape(aShape); // Set the shape @@ -3209,7 +3210,7 @@ The other options of the base class are not supported here and will have no effe All the history information obtained during the operation is stored into *BRepTools_History* object and available through *History()* method: ~~~~{.cpp} // Get the history object -const Handle(BRepTools_History)& BOPAlgo_MakePeriodic::History(); +const occ::handle& BOPAlgo_MakePeriodic::History(); ~~~~ For the usage of the MakePeriodic algorithm on the Draw level the following commands have been implemented: @@ -3313,7 +3314,7 @@ For an *HLRBRep_HLRToShape* object built from an *HLRBRepAlgo* object you can al myAlgo = new HLRBRep_Algo(); // Add Shapes into the algorithm -TopTools_ListIteratorOfListOfShape anIterator(myListOfShape); +NCollection_List::Iterator anIterator(myListOfShape); for (;anIterator.More();anIterator.Next()) myAlgo-Add(anIterator.Value(),myNbIsos); @@ -3360,7 +3361,7 @@ aHLRToShape.IsoLineHCompound(); myPolyAlgo = new HLRBRep_PolyAlgo(); // Add Shapes into the algorithm -TopTools_ListIteratorOfListOfShape +NCollection_List::Iterator anIterator(myListOfShape); for (;anIterator.More();anIterator.Next()) myPolyAlgo-Load(anIterator.Value()); @@ -3423,10 +3424,10 @@ For obtaining the material information the following methods should be used ~~~~{.cpp} // Returns the original shapes which images contain the given shape with FORWARD orientation. -const TopTools_ListOfShape& BOPAlgo_MakeConnected::MaterialsOnPositiveSide(const TopoDS_Shape& theS) +const NCollection_List& BOPAlgo_MakeConnected::MaterialsOnPositiveSide(const TopoDS_Shape& theS) // Returns the original shapes which images contain the given shape with REVERSED orientation. -const TopTools_ListOfShape& BOPAlgo_MakeConnected::MaterialsOnNegativeSide(const TopoDS_Shape& theS) +const NCollection_List& BOPAlgo_MakeConnected::MaterialsOnNegativeSide(const TopoDS_Shape& theS) ~~~~ @subsection occt_modalg_makeconnected_makeperiodic Making connected shape periodic @@ -3442,7 +3443,7 @@ The algorithm supports history of shapes modifications during the operation. Add The method is called *GetOrigins()*: ~~~~{.cpp} // Returns the list of original shapes from which the current shape has been created. -const TopTools_ListOfShape& BOPAlgo_MakeConnected::GetOrigins(const TopoDS_Shape& theS); +const NCollection_List& BOPAlgo_MakeConnected::GetOrigins(const TopoDS_Shape& theS); ~~~~ Both Gluing history and history of making the shape periodic and periodic shape repetition are available here. Note, that all repeated shapes are stored as generated into the history. @@ -3464,8 +3465,8 @@ For more information on the error/warning reporting system please see the chapte Here is the example of usage of the *BOPAlgo_MakePeriodic* algorithm on the API level: ~~~~{.cpp} -TopTools_ListOfShape anArguments = ...; // Shapes to make connected -Standard_Boolean bRunParallel = ...; // Parallel processing mode +NCollection_List anArguments = ...; // Shapes to make connected +bool bRunParallel = ...; // Parallel processing mode BOPAlgo_MakeConnected aMC; // Tool for making the shapes connected aMC.SetArguments(anArguments); // Set the shapes @@ -3494,8 +3495,8 @@ TopExp_Explorer anExp(anArguments.First(), anElemType); for (; anExp.More(); anExp.Next()) { const TopoDS_Shape& anElement = anExp.Current(); - const TopTools_ListOfShape& aNegativeM = aMC.MaterialsOnNegativeSide(anElement); - const TopTools_ListOfShape& aPositiveM = aMC.MaterialsOnPositiveSide(anElement); + const NCollection_List& aNegativeM = aMC.MaterialsOnNegativeSide(anElement); + const NCollection_List& aPositiveM = aMC.MaterialsOnPositiveSide(anElement); } // Making the connected shape periodic @@ -3523,7 +3524,7 @@ The other options of the base class are not supported here and will have no effe All the history information obtained during the operation is stored into *BRepTools_History* object and available through *History()* method: ~~~~{.cpp} // Get the history object -const Handle(BRepTools_History)& BOPAlgo_MakeConnected::History(); +const occ::handle& BOPAlgo_MakeConnected::History(); ~~~~ For the usage of the MakeConnected algorithm on the Draw level the following commands have been implemented: diff --git a/dox/user_guides/modeling_data/modeling_data.md b/dox/user_guides/modeling_data/modeling_data.md index 4099d24c56..043e77b50f 100644 --- a/dox/user_guides/modeling_data/modeling_data.md +++ b/dox/user_guides/modeling_data/modeling_data.md @@ -58,7 +58,7 @@ GeomAPI_Interpolate Interp(Points); From this object, the BSpline curve may be requested as follows: ~~~~{.cpp} -Handle(Geom_BSplineCurve) C = Interp.Curve(); +occ::handle C = Interp.Curve(); ~~~~ #### 2D Approximation @@ -79,7 +79,7 @@ Approx(Points,DegMin,DegMax,Continuity, Tol); From this object, the BSpline curve may be requested as follows: ~~~~{.cpp} -Handle(Geom_BSplineCurve) K = Approx.Curve(); +occ::handle K = Approx.Curve(); ~~~~ #### Surface Approximation @@ -364,13 +364,13 @@ The adapted curve is created in the following way: **2D case:** ~~~~{.cpp} - Handle(Geom2d_Curve) mycurve = ... ; + occ::handle mycurve = ... ; Geom2dAdaptor_Curve C (mycurve); ~~~~ **3D case:** ~~~~{.cpp} - Handle(Geom_Curve) mycurve = ... ; + occ::handle mycurve = ... ; GeomAdaptor_Curve C (mycurve); ~~~~ @@ -378,13 +378,13 @@ The algorithm is then constructed with this object: ~~~~{.cpp} GCPnts_UniformDeflection myAlgo (); - Standard_Real Deflection = ... ; + double Deflection = ... ; myAlgo.Initialize (C, Deflection); if (myAlgo.IsDone()) { - Standard_Integer nbr = myAlgo.NbPoints(); - Standard_Real param; - for (Standard_Integer i = 1; i <= nbr; i++) + int nbr = myAlgo.NbPoints(); + double param; + for (int i = 1; i <= nbr; i++) { param = myAlgo.Parameter (i); ... @@ -961,7 +961,7 @@ To process objects only once, they have to be placed in a Map. ~~~~{.cpp} void TopExp::MapShapes (const TopoDS_Shape& S, const TopAbs_ShapeEnum T, - TopTools_IndexedMapOfShape& M) + NCollection_IndexedMap& M) { TopExp_Explorer Ex (S, T); while (Ex.More()) @@ -989,18 +989,18 @@ The following steps are performed: ~~~~{.cpp} void DrawShape (const TopoDS_Shape& aShape, - const Standard_Integer nbIsos, + const int nbIsos, const Quantity_Color FaceIsocolor, const Quantity_Color FreeEdgeColor, const Quantity_Color BorderEdgeColor, const Quantity_Color SharedEdgeColor) { // Store the edges in a Map - TopTools_IndexedMapOfShape edgemap; + NCollection_IndexedMap edgemap; TopExp::MapShapes (aShape, TopAbs_EDGE, edgeMap); // Create an array set to zero - TColStd_Array1OfInteger faceCount (1, edgeMap.Extent()); + NCollection_Array1 faceCount (1, edgeMap.Extent()); faceCount.Init (0); // Explore the faces. @@ -1022,7 +1022,7 @@ The following steps are performed: } // Draw the edges of theMap - for (Standard_Integer i = 1; i <= edgemap.Extent(); i++) + for (int i = 1; i <= edgemap.Extent(); i++) { switch (faceCount[i]) { @@ -1055,11 +1055,11 @@ The following example counts the size of a data structure as a number of *TShape ~~~~{.cpp} #include - Standard_Integer Size (const TopoDS_Shape& aShape) + int Size (const TopoDS_Shape& aShape) { // This is a recursive method. // The size of a shape is1 + the sizes of the subshapes. - Standard_Integer size = 1; + int size = 1; for (TopoDS_Iterator It (aShape); It.More(); It.Next()) { size += Size (It.Value()); @@ -1078,7 +1078,7 @@ One solution is to put all the Shapes in a Map so as to avoid counting them twic #include void MapShapes (const TopoDS_Shape& aShape, - TopTools_MapOfShape& aMap) + NCollection_Map& aMap) { // This is a recursive auxiliary method. It stores all subShapes of aShape in a Map. if (aMap.Add (aShape)) @@ -1091,10 +1091,10 @@ One solution is to put all the Shapes in a Map so as to avoid counting them twic } } - Standard_Integer Size (const TopoDS_Shape& aShape) + int Size (const TopoDS_Shape& aShape) { // Store Shapes in a Mapand return the size. - TopTools_MapOfShape M; + NCollection_Map M; MapShapes (aShape, M); return M.Extent(); } @@ -1121,14 +1121,14 @@ The principal algorithm is as follows: { // Copies the wholestructure of aShape using aBuilder. // Stores all thesub-Shapes in an IndexedMap. - TopTools_IndexedMapOfShape theMap; + NCollection_IndexedMap theMap; TopoDS_Iterator It; TopLoc_Location Identity; TopoDS_Shape S = aShape; S.Location (Identity); S.Orientation(TopAbs_FORWARD); theMap.Add(S); - for (Standard_Integer i = 1; i <= theMap.Extent(); i++) + for (int i = 1; i <= theMap.Extent(); i++) { for (It.Initialize(theMap(i)); It.More(); It.Next()) { @@ -1153,9 +1153,9 @@ Only the underlying TShape is of great interest. TopTools_Array1OfShapetheCopies (1, theMap.Extent()); // Use a recursivefunction to copy the first element. - void AuxiliaryCopy (Standard_Integer , - const TopTools_IndexedMapOfShape& , - TopTools_Array1OfShape& , + void AuxiliaryCopy (int , + const NCollection_IndexedMap& , + NCollection_Array1& , const TopoDS_Builder& ); AuxiliaryCopy (1, theMap, theCopies, aBuilder); @@ -1171,9 +1171,9 @@ Below is the auxiliary function, which copies the element of rank *i* from the m This method checks if the object has been copied; if not copied, then an empty copy is performed into the table and the copies of all the sub-elements are inserted by finding their rank in the map. ~~~~{.cpp} - void AuxiliaryCopy (Standard_Integer index, + void AuxiliaryCopy (int index, const TopTools_IndexedMapOfShapes& sources, - TopTools_Array1OfShape& copies, + NCollection_Array1& copies, const TopoDS_Builder& aBuilder) { // If the copy is a null Shape the copy is not done. diff --git a/dox/user_guides/ocaf/ocaf.md b/dox/user_guides/ocaf/ocaf.md index 03a1a85b1a..930d859798 100644 --- a/dox/user_guides/ocaf/ocaf.md +++ b/dox/user_guides/ocaf/ocaf.md @@ -311,9 +311,9 @@ To retrieve a child label from a tag which you have specified yourself, you need ~~~~{.cpp} -TDF_Label achild = root.FindChild(3,Standard_False); +TDF_Label achild = root.FindChild(3,false); if (!achild.IsNull()) { -Standard_Integer tag = achild.Tag(); +int tag = achild.Tag(); } ~~~~ @@ -345,8 +345,8 @@ You could also use the same syntax but add the Boolean *true* as a value of the ~~~~{.cpp} -TDF_Label level1 = root.FindChild(3,Standard_True); -TDF_Label level2 = level1.FindChild(1,Standard_True); +TDF_Label level1 = root.FindChild(3,true); +TDF_Label level2 = level1.FindChild(1,true); ~~~~ @subsubsection occt_ocaf_3_4_3 Retrieving child labels @@ -356,7 +356,7 @@ You can retrieve child labels of your current label by iteration on the first le ~~~~{.cpp} TDF_Label current; // -for (TDF_ChildIterator it1 (current,Standard_False); it1.More(); it1.Next()) { +for (TDF_ChildIterator it1 (current,false); it1.More(); it1.Next()) { achild = it1.Value(); // // do something on a child (level 1) @@ -365,7 +365,7 @@ achild = it1.Value(); ~~~~ You can also retrieve all child labels in every descendant generation of your current label by iteration on all levels in the scope of this label. ~~~~{.cpp} -for (TDF_ChildIterator itall (current,Standard_True); itall.More(); itall.Next()) { +for (TDF_ChildIterator itall (current,true); itall.More(); itall.Next()) { achild = itall.Value(); // // do something on a child (all levels) @@ -380,7 +380,7 @@ void DumpChildren(const TDF_Label& aLabel) { TDF_ChildIterator it; TCollection_AsciiString es; - for (it.Initialize(aLabel,Standard_True); it.More(); it.Next()){ + for (it.Initialize(aLabel,true); it.More(); it.Next()){ TDF_Tool::Entry(it.Value(),es); cout << as.ToCString() << endl; } @@ -423,7 +423,7 @@ You can create a new instance of an attribute and retrieve its GUID. In the exam ~~~~{.cpp} -Handle(TDataStd_Integer) INT = new TDataStd_Integer(); +occ::handle INT = new TDataStd_Integer(); Standard_GUID guid = INT->ID(); ~~~~ @@ -457,7 +457,7 @@ if (current.IsA(TDataStd_Integer::GetID())) { } if (current.HasAttribute()) { // the label has at least one attribute attached -Standard_Integer nbatt = current.NbAttributes(); +int nbatt = current.NbAttributes(); // the label has nbatt attributes attached } ~~~~ @@ -604,7 +604,7 @@ As a container for your data framework, you need a document, and your document m To create an application, use the following syntax. ~~~~{.cpp} -Handle(TDocStd_Application) app = new TDocStd_Application (); +occ::handle app = new TDocStd_Application (); ~~~~ @subsubsection occt_ocaf_4_2_2 Creating a new document @@ -612,7 +612,7 @@ Handle(TDocStd_Application) app = new TDocStd_Application (); To the application which you declared in the previous example (4.2.1), you must add the document *doc* as an argument of *TDocStd_Application::NewDocument*. ~~~~{.cpp} -Handle(TDocStd_Document) doc; +occ::handle doc; app->NewDocument("NewDocumentFormat", doc); ~~~~ @@ -625,7 +625,7 @@ If your application defines specific OCAF attributes, you need to define your ow To retrieve the application containing your document, you use the syntax below. ~~~~{.cpp} -app = Handle(TDocStd_Application)::DownCast (doc->Application()); +app = occ::down_cast(doc->Application()); ~~~~ @subsection occt_ocaf_4_3 The Document @@ -749,7 +749,7 @@ For binary formats only the part of the stored document can be loaded. For that or to define one or several entries for sub-tree that must be loaded only. The following example opens document *doc*, but reads only "0:1:2" label and its sub-labels and only *TDataStd_Name* attributes on them. ~~~~{.cpp} -Handle(PCDM_ReaderFilter) filter = new PCDM_ReaderFilter("0:1:2"); +occ::handle filter = new PCDM_ReaderFilter("0:1:2"); filter->AddRead("TDataStd_Name"); app->Open("example.cbf", doc, filter); ~~~~ @@ -757,7 +757,7 @@ app->Open("example.cbf", doc, filter); Also, using filters, part of the document can be appended into the already loaded document from the same file. For an example, to read into the previously opened *doc* all attributes, except *TDataStd_Name* and *TDataStd_Integer*: ~~~~{.cpp} -Handle(PCDM_ReaderFilter) filter2 = new PCDM_ReaderFilter(PCDM_ReaderFilter::AppendMode_Protect); +occ::handle filter2 = new PCDM_ReaderFilter(PCDM_ReaderFilter::AppendMode_Protect); filter2->AddSkipped("TDataStd_Name"); filter2->AddSkipped("TDataStd_Integer"); app->Open("example.cbf", doc, filter2); @@ -792,7 +792,7 @@ to another place defined by a label. ~~~~{.cpp} TDF_CopyLabel aCopy; - TDF_IDFilter aFilter (Standard_False); + TDF_IDFilter aFilter (false); //Don't copy TDataStd_TreeNode attribute @@ -823,8 +823,8 @@ Note that documents can be copied with or without a possibility of updating an e To copy a document with a possibility of updating it later, you use *TDocStd_XLinkTool::CopyWithLink*. ~~~~{.cpp} -Handle(TDocStd_Document) doc1; -Handle(TDocStd_Document) doc2; +occ::handle doc1; +occ::handle doc2; TDF_Label source = doc1->GetData()->Root(); TDF_Label target = doc2->GetData()->Root(); @@ -920,7 +920,7 @@ builder.Generated(oldshape1,newshape1); // set another pair of shapes with the same evolution builder.Generated(oldshape2,newshape2); // get the result - TNaming_NamedShape attribute -Handle(TNaming_NamedShape) ns = builder.NamedShape(); +occ::handle ns = builder.NamedShape(); ~~~~ @subsection occt_ocaf_5_5 Reading the contents of a named shape attribute @@ -929,8 +929,8 @@ You can use the method TNaming_NamedShape::Evolution() to get the evoluti More detailed information about the contents of the named shape or about the modification history of a topology can be obtained with the following: * *TNaming_Tool* provides a common high-level functionality for access to the named shapes contents: - * The method GetShape(Handle(TNaming_NamedShape)) returns a compound of new shapes of the given named shape; - * The method CurrentShape(Handle(TNaming_NamedShape)) returns a compound of the shapes, which are latest versions of the shapes from the given named shape; + * The method GetShape(occ::handle\) returns a compound of new shapes of the given named shape; + * The method CurrentShape(occ::handle\) returns a compound of the shapes, which are latest versions of the shapes from the given named shape; * The method NamedShape(TopoDS_Shape,TDF_Label) returns a named shape, which contains a given shape as a new shape. A given label is any label from the data framework -- it just gives access to it. * *TNaming_Iterator* gives access to the named shape and hooks pairs. @@ -1008,13 +1008,13 @@ If you need to create a topological attribute for existing data, use the method ~~~~{.cpp} class MyPkg_MyClass { -public: Standard_Boolean SameEdge (const Handle(CafTest_Line)& L1, const Handle(CafTest_Line)& L2); +public: bool SameEdge (const occ::handle& L1, const occ::handle& L2); }; -Standard_Boolean CafTest_MyClass::SameEdge (const Handle(CafTest_Line)& L1, const Handle(CafTest_Line)& L2) +bool CafTest_MyClass::SameEdge (const occ::handle& L1, const occ::handle& L2) { - Handle(TNaming_NamedShape) NS1 = L1->NamedShape(); - Handle(TNaming_NamedShape) NS2 = L2->NamedShape(); + occ::handle NS1 = L1->NamedShape(); + occ::handle NS2 = L2->NamedShape(); return BRepTools::Compare(NS1,NS2); } ~~~~ @@ -1167,7 +1167,7 @@ To find an attribute attached to a specific label, you use the GUID of the attri ~~~~{.cpp} Standard_GUID anID = MyAttributeClass::GetID(); - Standard_Boolean HasAttribute = aLabel.Find(anID,anAttribute); + bool HasAttribute = aLabel.Find(anID,anAttribute); ~~~~ @subsubsection occt_ocaf_6_2_2 Conventional Interface of Standard Attributes @@ -1291,12 +1291,12 @@ It is possible to describe any model by means of standard OCAF attributes. static method Set in next way: ~~~~{.cpp} -static Handle(TDataStd_Real) Set (const TDF_Label& label, const Standard_Real value); +static occ::handle Set (const TDF_Label& label, const double value); ~~~~ This is a default form which is kept by the attribute. It uses the default GUID for the attribute identification - TDataStd_Real::GetID(). In case if you want to use the new feature (user defined Real attribute), for example to define several attributes which should keep a value - of the same type - Standard_Real, but to be associated with different user's notions (or objects) the new static method Set should be used. + of the same type - double, but to be associated with different user's notions (or objects) the new static method Set should be used. In our example we will define two Real attributes which presents two customer's objects - Density and Volume and will be put on the same Label. ~~~~{.cpp} @@ -1323,7 +1323,7 @@ aLabel.FindAttribute (DENSITY, anAtt); ~~~~{.cpp} TDF_Label aLabel = ...; - Standard_Integer aValue = ...; + int aValue = ...; Standard_GUID aGuid = TDataStd_Integer::GetID(); TDataStd_Integer::Set(aLabel, aGuid, aValue); ~~~~ @@ -1331,7 +1331,7 @@ aLabel.FindAttribute (DENSITY, anAtt); 2. Using the default constructor ~~~~{.cpp} - Handle(TDataStd_Integer) anInt = new TDataStd_Integer(); + occ::handle anInt = new TDataStd_Integer(); anInt->SetID(aGuid); aLabel.Add(anInt); anInt->Set(aValue); @@ -1354,7 +1354,7 @@ To initialize the AIS viewer as in the example below, use method *Find*. ~~~~{.cpp} // "access" is any label of the data framework -Handle(TPrsStd_AISViewer) viewer = TPrsStd_AISViewer::Find(access) +occ::handle viewer = TPrsStd_AISViewer::Find(access) ~~~~ @subsection occt_ocaf_7_2_2 Defining a presentation attribute @@ -1589,7 +1589,7 @@ To automatically erase the nail from the viewer and the data tree it is enough ~~~~{.cpp} // The scope of functions is defined. -Handle(TFunction_Scope) aScope = TFunction_Scope::Set (anyLabel); +occ::handle aScope = TFunction_Scope::Set (anyLabel); // The information on modifications in the model is received. TFunction_Logbook& aLog = aScope->GetLogbook(); @@ -1603,17 +1603,17 @@ for (; anIterator.more(); anIterator.Next()) { // The function iterator may return a list of current functions for execution. // It might be useful for multi-threaded execution of functions. - const TDF_LabelList& aCurrentFunctions = anIterator.Current(); + const NCollection_List& aCurrentFunctions = anIterator.Current(); // The list of current functions is iterated. - for (TDF_ListIteratorOfLabelList aCurrentIterator (aCurrentFunctions); + for (NCollection_List::Iterator aCurrentIterator (aCurrentFunctions); aCurrentIterator.More(); aCurrentIterator.Next()) { // An interface for the function is created. TFunction_IFunction anInterface (aCurrentIterator.Value()); // The function driver is retrieved. - Handle(TFunction_Driver) aDriver = anInterface.GetDriver(); + occ::handle aDriver = anInterface.GetDriver(); // The dependency of the function on the  modified data is checked. if (aDriver->MustExecute (aLog)) @@ -1637,7 +1637,7 @@ for (; anIterator.more(); anIterator.Next()) ~~~~{.cpp} // A virtual method ::Arguments() returns a list of arguments of the function. - CylinderDriver::Arguments( TDF_LabelList& args ) + CylinderDriver::Arguments( NCollection_List& args ) { // The direct arguments, located at sub-leaves of the function, are collected (see picture 2) TDF_ChildIterator cIterator( Label(), false ); @@ -1648,7 +1648,7 @@ for (; anIterator.more(); anIterator.Next()) Args.Append( sublabel ); // The references to the external data are checked. - Handle(TDF_Reference) ref; + occ::handle ref; If ( sublabel.FindAttribute( TDF_Reference::GetID(), ref ) ) { args.Append( ref-Get() ); @@ -1656,7 +1656,7 @@ for (; anIterator.more(); anIterator.Next()) } // A virtual method ::Results() returns a list of result leaves. - CylinderDriver::Results( TDF_LabelList& res ) + CylinderDriver::Results( NCollection_List& res ) { // The result is kept at the function label.   Res.Append( Label() ); @@ -1673,11 +1673,11 @@ for (; anIterator.more(); anIterator.Next()) TDF_Label radiusLabel = Label().FindChild( 2 ); // The multiplicator of the radius ()is retrieved. - Handle(TDataStd_Real) radiusValue; + occ::handle radiusValue; radiusLabel.FindAttribute( TDataStd_Real::GetID(), radiusValue); // The reference to the radius is retrieved. - Handle(TDF_Reference) refRadius; + occ::handle refRadius; RadiusLabel.FindAttribute( TDF_Reference::GetID(), refRadius ); // The radius value is calculated. @@ -1690,7 +1690,7 @@ for (; anIterator.more(); anIterator.Next()) else { // The referenced radius value is retrieved. - Handle(TDataStd_Real) referencedRadiusValue; + occ::handle referencedRadiusValue; RefRadius-Get().FindAttribute(TDataStd_Real::GetID() ,referencedRadiusValue ); radius = referencedRadiusValue-Get() * radiusValue-Get(); } @@ -1776,9 +1776,9 @@ There is one attribute driver for XML persistence for each transient attribute f At the beginning of storage/retrieval process, one instance of each attribute driver is created and appended to driver table implemented as *XmlMDF_ADriverTable*. During OCAF Data storage, attribute drivers are retrieved from the driver table by the type of attribute. In the retrieval step, a data map is created linking names of *DOM_Elements* and attribute drivers, and then attribute drivers are sought in this map by *DOM_Element* qualified tag names. -Every transient attribute is saved as a *DOM_Element* (root element of OCAF attribute) with attributes and possibly sub-nodes. The name of the root element can be defined in the attribute driver as a string passed to the base class constructor. The default is the attribute type name. Similarly, namespace prefixes for each attribute can be set. There is no default value, but it is possible to pass NULL or an empty string to store attributes without namespace prefixes. +Every transient attribute is saved as a *DOM_Element* (root element of OCAF attribute) with attributes and possibly sub-nodes. The name of the root element can be defined in the attribute driver as a string passed to the base class constructor. The default is the attribute type name. Similarly, namespace prefixes for each attribute can be set. There is no default value, but it is possible to pass nullptr or an empty string to store attributes without namespace prefixes. -The basic class *XmlMDF_ADriver* supports errors reporting via the method *WriteMessage(const TCollection_ExtendedString&)*. It sends a message string to its message driver which is initialized in the constructor with a *Handle(CDM_MessageDriver)* passed from the application by Document Storage/Retrieval Driver. +The basic class *XmlMDF_ADriver* supports errors reporting via the method *WriteMessage(const TCollection_ExtendedString&)*. It sends a message string to its message driver which is initialized in the constructor with a *occ::handle\* passed from the application by Document Storage/Retrieval Driver. @subsection occt_ocaf_9_3 XML Document Structure @@ -1950,8 +1950,8 @@ The other available format is *XmlOcaf*. The class **TObj_Model** declares and p implementation of two virtual methods: ~~~~{.cpp} - virtual Standard_Boolean Load (const char* theFile); - virtual Standard_Boolean SaveAs (const char* theFile); + virtual bool Load (const char* theFile); + virtual bool SaveAs (const char* theFile); ~~~~ which retrieve and store the model from or @@ -1959,7 +1959,7 @@ in the OCAF file. The descendants should define the following protected method to support Load and Save operations: ~~~~{.cpp} - virtual Standard_Boolean initNewModel (const Standard_Boolean IsNew); + virtual bool initNewModel (const bool IsNew); ~~~~ This method is called by *Load* after creation of a new model @@ -1999,20 +1999,20 @@ All objects in the model are stored in the main partition and accessed by iterat To access all model objects use: ~~~~{.cpp} - virtual Handle(TObj_ObjectIterator) GetObjects () const; + virtual occ::handle GetObjects () const; ~~~~ This method returns a recursive iterator on all objects stored in the model. ~~~~{.cpp} - virtual Handle(TObj_ObjectIterator) GetChildren () const; + virtual occ::handle GetChildren () const; ~~~~ This method returns an iterator on child objects of the main partition. Use the following method to get the main partition: ~~~~{.cpp} - Handle(TObj_Partition) GetMainPartition() const; + occ::handle GetMainPartition() const; ~~~~ To receive the iterator on objects of a specific type *AType* use the following call: @@ -2024,7 +2024,7 @@ To receive the iterator on objects of a specific type *AType* use the following The set of protected methods is provided for descendant classes to deal with partitions: ~~~~{.cpp} - virtual Handle(TObj_Partition) getPartition (const TDF_Label, const Standard_Boolean theHidden) const; + virtual occ::handle getPartition (const TDF_Label, const bool theHidden) const; ~~~~ This method returns (creating if necessary) a partition in the specified label of the document. @@ -2037,15 +2037,15 @@ in the sub-label of the specified label in the document (the label of the main partition for the second method) and with the given name: ~~~~{.cpp} - virtual Handle(TObj_Partition) getPartition (const TDF_Label, const Standard_Integer theIndex, const TCollection_ExtendedString& theName, const Standard_Boolean theHidden) const; - virtual Handle(TObj_Partition) getPartition (const Standard_Integer theIndex, const TCollection_ExtendedString& theName, const Standard_Boolean theHidden) const; + virtual occ::handle getPartition (const TDF_Label, const int theIndex, const TCollection_ExtendedString& theName, const bool theHidden) const; + virtual occ::handle getPartition (const int theIndex, const TCollection_ExtendedString& theName, const bool theHidden) const; ~~~~ If the default object naming and the name register mechanism is turned on, the object can be found in the model by its unique name: ~~~~{.cpp} - Handle(TObj_Object) FindObject (const Handle(TCollection_HExtendedString)& theName, const Handle(TObj_TNameContainer)& theDictionary) const; + occ::handle FindObject (const occ::handle& theName, const occ::handle& theDictionary) const; ~~~~ @subsubsection occt_tobj_2_5 Own model data @@ -2072,13 +2072,13 @@ To ignore name registering it is necessary to redefine the methods *SetName*, Use the following methods for the naming mechanism: ~~~~{.cpp} - Standard_Boolean IsRegisteredName (const Handle(TCollection_HExtendedString)& theName, const Handle(TObj_TNameContainer)& theDictionary ) const; + bool IsRegisteredName (const occ::handle& theName, const occ::handle& theDictionary ) const; ~~~~ Returns **True** if the object name is already registered in the indicated (or model) dictionary. ~~~~{.cpp} - void RegisterName (const Handle(TCollection_HExtendedString)& theName, const TDF_Label& theLabel, const Handle(TObj_TNameContainer)& theDictionary ) const; + void RegisterName (const occ::handle& theName, const TDF_Label& theLabel, const occ::handle& theDictionary ) const; ~~~~ Registers the object name with the indicated label where the object @@ -2087,14 +2087,14 @@ of the method *SetName* of the object registers the new name automatically (if the name is not yet registered for any other object) ~~~~{.cpp} - void UnRegisterName (const Handle(TCollection_HExtendedString)& theName, const Handle(TObj_TNameContainer)& theDictionary ) const; + void UnRegisterName (const occ::handle& theName, const occ::handle& theDictionary ) const; ~~~~ Unregisters the name from the dictionary. The names of *TObj* model objects are removed from the dictionary when the objects are deleted from the model. ~~~~{.cpp} - Handle(TObj_TNameContainer) GetDictionary() const; + occ::handle GetDictionary() const; ~~~~ Returns a default instance of the model dictionary (located at the model root label). @@ -2108,7 +2108,7 @@ that returns the dictionary where names of objects should be registered. Class *TObj_Model* provides the API for transaction mechanism (supported by OCAF): ~~~~{.cpp} - Standard_Boolean HasOpenCommand() const; + bool HasOpenCommand() const; ~~~~ Returns True if a Command transaction is open @@ -2132,13 +2132,13 @@ Commits the Command transaction. Does nothing If there is no open Command transa Aborts the Command transaction. Does nothing if there is no open Command transaction. ~~~~{.cpp} - Standard_Boolean IsModified() const; + bool IsModified() const; ~~~~ Returns True if the model document has a modified status (has changes after the last save) ~~~~{.cpp} - void SetModified( const Standard_Boolean ); + void SetModified( const bool ); ~~~~ Changes the modified status by force. For synchronization of transactions @@ -2166,13 +2166,13 @@ of the model format. The current version of the model format is stored in the model file and can be checked upon retrieval. ~~~~{.cpp} - Standard_Integer GetFormatVersion() const; + int GetFormatVersion() const; ~~~~ Returns the format version stored in the model file ~~~~{.cpp} - void SetFormatVersion(const Standard_Integer theVersion); + void SetFormatVersion(const int theVersion); ~~~~ Defines the format version used for save. @@ -2206,20 +2206,20 @@ The following methods are used for model update to ensure its consistency with respect to the other models in case of cross-model dependencies: ~~~~{.cpp} - virtual Standard_Boolean Update(); + virtual bool Update(); ~~~~ This method is usually called after loading of the model. The default implementation does nothing and returns **True**. ~~~~{.cpp} - virtual Standard_Boolean initNewModel( const Standard_Boolean IsNew); + virtual bool initNewModel( const bool IsNew); ~~~~ This method performs model initialization, check and updates (as described above). ~~~~{.cpp} - virtual void updateBackReferences( const Handle(TObj_Object)& theObj); + virtual void updateBackReferences( const occ::handle& theObj); ~~~~ This method is called from the previous method to update back references @@ -2231,7 +2231,7 @@ of the indicated object after the retrieval of the model from file To copy the model between OCAF documents use the following methods: ~~~~{.cpp} - virtual Standard_Boolean Paste (Handle(TObj_Model) theModel, Handle(TDF_RelocationTable) theRelocTable = 0 ); + virtual bool Paste (occ::handle theModel, occ::handle theRelocTable = 0 ); ~~~~ Pastes the current model to the new model. The relocation table @@ -2239,13 +2239,13 @@ ensures correct copying of the sub-data shared by several parts of the model. It stores a map of processed original objects of relevant types in their copies. ~~~~{.cpp} - virtual Handle(TObj_Model) NewEmpty() = 0; + virtual occ::handle NewEmpty() = 0; ~~~~ Redefines a pure virtual method to create a new empty instance of the model. ~~~~{.cpp} - void CopyReferences ( const Handle(TObj_Model)& theTarget, const Handle(TDF_RelocationTable)& theRelocTable); + void CopyReferences ( const occ::handle& theTarget, const occ::handle& theRelocTable); ~~~~ Copies the references from the current model to the target model. @@ -2257,8 +2257,8 @@ The messenger is stored as the field of the model instance and can be set and retrieved by the following methods: ~~~~{.cpp} - void SetMessenger( const Handle(Message_Messenger)& ); - Handle(Message_Messenger) Messenger() const; + void SetMessenger( const occ::handle& ); + occ::handle Messenger() const; ~~~~ A developer should create his own instance of the Messenger @@ -2325,17 +2325,17 @@ The *TObj_Object* class provides some basic features that can be inherited (or, An object can be received from the model by the following methods: ~~~~{.cpp} - static Standard_Boolean GetObj ( const TDF_Label& theLabel, Handle(TObj_Object)& theResObject, const Standard_Boolean isSuper = Standard_False ); + static bool GetObj ( const TDF_Label& theLabel, occ::handle& theResObject, const bool isSuper = false ); ~~~~ Returns *True* if the object has been found in the indicated label (or in the upper level label if *isSuper* is *True*). ~~~~{.cpp} - Handle(TObj_Object) GetFatherObject ( const Handle(Standard_Type)& theType = NULL ) const; + occ::handle GetFatherObject ( const occ::handle& theType = nullptr ) const; ~~~~ Returns the father object of the indicated type -for the current object (the direct father object if the type is NULL). +for the current object (the direct father object if the type is nullptr). @subsubsection occt_tobj_3_3 Data layout and inheritance @@ -2359,8 +2359,8 @@ See the declaration of the TObj_Partition class for the example. to access the data stored in sub-labels by their tag numbers: ~~~~{.cpp} - TDF_Label getDataLabel (const Standard_Integer theRank1, const Standard_Integer theRank2 = 0) const; - TDF_Label getReferenceLabel (const Standard_Integer theRank1, const Standard_Integer theRank2 = 0) const; + TDF_Label getDataLabel (const int theRank1, const int theRank2 = 0) const; + TDF_Label getReferenceLabel (const int theRank1, const int theRank2 = 0) const; ~~~~ Returns the label in *Data* or *References* sub-labels at a given tag number (theRank1). @@ -2370,26 +2370,26 @@ This is useful when the data to be stored are represented by multiple OCAF attri of the same type (e.g. sequences of homogeneous data or references). The get/set methods allow easily accessing the data located in the specified data label -for the most widely used data types (*Standard_Real*, *Standard_Integer*, *TCollection_HExtendedString*, +for the most widely used data types (*double*, *int*, *TCollection_HExtendedString*, *TColStd_HArray1OfReal*, *TColStd_HArray1OfInteger*, *TColStd_HArray1OfExtendedString*). For instance, methods provided for real numbers are: ~~~~{.cpp} - Standard_Real getReal (const Standard_Integer theRank1, const Standard_Integer theRank2 = 0) const; - Standard_Boolean setReal (const Standard_Real theValue, const Standard_Integer theRank1, const Standard_Integer theRank2 = 0, const Standard_Real theTolerance = 0.) const; + double getReal (const int theRank1, const int theRank2 = 0) const; + bool setReal (const double theValue, const int theRank1, const int theRank2 = 0, const double theTolerance = 0.) const; ~~~~ Similar methods are provided to access references to other objects: ~~~~{.cpp} - Handle(TObj_Object) getReference (const Standard_Integer theRank1, const Standard_Integer theRank2 = 0) const; - Standard_Boolean setReference (const Handle(TObj_Object) &theObject, const Standard_Integer theRank1, const Standard_Integer theRank2 = 0); + occ::handle getReference (const int theRank1, const int theRank2 = 0) const; + bool setReference (const occ::handle &theObject, const int theRank1, const int theRank2 = 0); ~~~~ The method *addReference* gives an easy way to store a sequence of homogeneous references in one label. ~~~~{.cpp} - TDF_Label addReference (const Standard_Integer theRank1, const Handle(TObj_Object) &theObject); + TDF_Label addReference (const int theRank1, const occ::handle &theObject); ~~~~ Note that while references to other objects should be defined by descendant classes @@ -2453,24 +2453,24 @@ If necessary, it is easy to redefine a couple of object methods This functionality is provided by the following methods: ~~~~{.cpp} - virtual Handle(TObj_TNameContainer) GetDictionary() const; + virtual occ::handle GetDictionary() const; ~~~~ Returns the name container where the name of object should be registered. The default implementation returns the model name container. ~~~~{.cpp} - Handle(TCollection_HExtendedString) GetName() const; - Standard_Boolean GetName( TCollection_ExtendedString& theName ) const; - Standard_Boolean GetName( TCollection_AsciiString& theName ) const; + occ::handle GetName() const; + bool GetName( TCollection_ExtendedString& theName ) const; + bool GetName( TCollection_AsciiString& theName ) const; ~~~~ Returns the object name. The methods with in / out argument return False if the object name is not defined. ~~~~{.cpp} - virtual Standard_Boolean SetName ( const Handle(TCollection_HExtendedString)& theName ) const; - Standard_Boolean SetName ( const Handle(TCollection_HAsciiString)& theName ) const; - Standard_Boolean SetName ( const Standard_CString theName ) const; + virtual bool SetName ( const occ::handle& theName ) const; + bool SetName ( const occ::handle& theName ) const; + bool SetName ( const char* theName ) const; ~~~~ Attributes a new name to the object and returns **True** if the name has been attributed successfully. @@ -2501,17 +2501,17 @@ from different *TObj* models, facilitating the construction of complex relations The most used methods for work with references are: ~~~~{.cpp} - virtual Standard_Boolean HasReference( const Handle(TObj_Object)& theObject) const; + virtual bool HasReference( const occ::handle& theObject) const; ~~~~ Returns True if the current object refers to the indicated object. ~~~~{.cpp} - virtual Handle(TObj_ObjectIterator) GetReferences ( const Handle(Standard_Type)& theType = NULL ) const; + virtual occ::handle GetReferences ( const occ::handle& theType = nullptr ) const; ~~~~ Returns an iterator on the object references. The optional argument *theType* -restricts the types of referred objects, or does not if it is NULL. +restricts the types of referred objects, or does not if it is nullptr. ~~~~{.cpp} virtual void RemoveAllReferences(); @@ -2520,27 +2520,27 @@ restricts the types of referred objects, or does not if it is NULL. Removes all references from the current object. ~~~~{.cpp} - virtual void RemoveReference( const Handle(TObj_Object)& theObject ); + virtual void RemoveReference( const occ::handle& theObject ); ~~~~ Removes the reference to the indicated object. ~~~~{.cpp} - virtual Handle(TObj_ObjectIterator) GetBackReferences ( const Handle(Standard_Type)& theType = NULL ) const; + virtual occ::handle GetBackReferences ( const occ::handle& theType = nullptr ) const; ~~~~ Returns an iterator on the object back references. -The argument theType restricts the types of master objects, or does not if it is NULL. +The argument theType restricts the types of master objects, or does not if it is nullptr. ~~~~{.cpp} - virtual void ReplaceReference ( const Handle(TObj_Object)& theOldObject, const Handle(TObj_Object)& theNewObject ); + virtual void ReplaceReference ( const occ::handle& theOldObject, const occ::handle& theNewObject ); ~~~~ Replaces the reference to theOldObject by the reference to *theNewObject*. -The handle theNewObject may be NULL to remove the reference. +The handle theNewObject may be nullptr to remove the reference. ~~~~{.cpp} - virtual Standard_Boolean RelocateReferences ( const TDF_Label& theFromRoot, const TDF_Label& theToRoot, const Standard_Boolean theUpdateackRefs = Standard_True ); + virtual bool RelocateReferences ( const TDF_Label& theFromRoot, const TDF_Label& theToRoot, const bool theUpdateackRefs = true ); ~~~~ Replaces all references to a descendant label of *theFromRoot* @@ -2549,7 +2549,7 @@ Returns **False** if the resulting reference does not point at a *TObj_Object*. Updates back references if theUpdateackRefs is **True**. ~~~~{.cpp} - virtual Standard_Boolean CanRemoveReference ( const Handle(TObj_Object)& theObj) const; + virtual bool CanRemoveReference ( const occ::handle& theObj) const; ~~~~ Returns **True** if the reference can be removed and the master object @@ -2594,13 +2594,13 @@ but the behavior depends on the deletion mode *TObj_DeletingMode*: The most used methods for object removing are: ~~~~{.cpp} - virtual Standard_Boolean CanDetachObject (const TObj_DeletingMode theMode = TObj_FreeOnly ); + virtual bool CanDetachObject (const TObj_DeletingMode theMode = TObj_FreeOnly ); ~~~~ Returns **True** if the object can be deleted with the indicated deletion mode. ~~~~{.cpp} - virtual Standard_Boolean Detach ( const TObj_DeletingMode theMode = TObj_FreeOnly ); + virtual bool Detach ( const TObj_DeletingMode theMode = TObj_FreeOnly ); ~~~~ Removes the object from the document if possible @@ -2613,7 +2613,7 @@ Returns **True** if the objects have been successfully deleted. *TObj_Object* provides a number of special virtual methods to support replications of objects. These methods should be redefined by descendants when necessary. ~~~~{.cpp} - virtual Handle(TObj_Object) Clone (const TDF_Label& theTargetLabel, Handle(TDF_RelocationTable) theRelocTable = 0); + virtual occ::handle Clone (const TDF_Label& theTargetLabel, occ::handle theRelocTable = 0); ~~~~ Copies the object to theTargetLabel. The new object will have all references of its original. @@ -2622,7 +2622,7 @@ but the name is changed by adding the postfix *_copy*. To assign different names to the copies redefine the method: ~~~~{.cpp} - virtual Handle(TCollection_HExtendedString) GetNameForClone ( const Handle(TObj_Object)& ) const; + virtual occ::handle GetNameForClone ( const occ::handle& ) const; ~~~~ Returns the name for a new object copy. It could be useful to return the same object name @@ -2630,13 +2630,13 @@ if the copy will be in the other model or in the other partition with its own di The method *Clone* uses the following public methods for object data replications: ~~~~{.cpp} - virtual void CopyReferences (const const Handle(TObj_Object)& theTargetObject, const Handle(TDF_RelocationTable) theRelocTable); + virtual void CopyReferences (const occ::handle& theTargetObject, const occ::handle theRelocTable); ~~~~ Adds to the copy of the original object its references. ~~~~{.cpp} - virtual void CopyChildren (TDF_Label& theTargetLabel, const Handle(TDF_RelocationTable) theRelocTable); + virtual void CopyChildren (TDF_Label& theTargetLabel, const occ::handle theRelocTable); ~~~~ Copies the children of an object to the target child label. @@ -2657,10 +2657,10 @@ The user (developer) can define any new flags in descendant classes. To set/get an object, the flags use the following methods: ~~~~{.cpp} - Standard_Integer GetFlags() const; - void SetFlags( const Standard_Integer theMask ); - Stadnard_Boolean TestFlags( const Standard_Integer theMask ) const; - void ClearFlags( const Standard_Integer theMask = 0 ); + int GetFlags() const; + void SetFlags( const int theMask ); + Stadnard_Boolean TestFlags( const int theMask ) const; + void ClearFlags( const int theMask = 0 ); ~~~~ In addition, the generic virtual interface stores the logical properties @@ -2668,7 +2668,7 @@ of the object class in the form of a set of bit flags. Type flags can be received by the method: ~~~~{.cpp} - virtual Standard_Integer GetTypeFlags() const; + virtual int GetTypeFlags() const; ~~~~ The default implementation returns the flag **Visible** @@ -2694,31 +2694,31 @@ The main partition object methods: Allocates and returns a new label for creation of a new child object. ~~~~{.cpp} - void SetNamePrefix ( const Handle(TCollection_HExtendedString)& thePrefix); + void SetNamePrefix ( const occ::handle& thePrefix); ~~~~ Defines the prefix for automatic generation of names of the newly created objects. ~~~~{.cpp} - Handle(TCollection_HExtendedString) GetNamePrefix() const; + occ::handle GetNamePrefix() const; ~~~~ Returns the current name prefix. ~~~~{.cpp} - Handle(TCollection_HExtendedString) GetNewName ( const Standard_Boolean theIsToChangeCount) const; + occ::handle GetNewName ( const bool theIsToChangeCount) const; ~~~~ Generates the new name and increases the internal counter of child objects if theIsToChangeCount is **True**. ~~~~{.cpp} - Standard_Integer GetLastIndex() const; + int GetLastIndex() const; ~~~~ Returns the last reserved child index. ~~~~{.cpp} - void SetLastIndex( const Standard_Integer theIndex ); + void SetLastIndex( const int theIndex ); ~~~~ Sets the last reserved index. diff --git a/dox/user_guides/shape_healing/shape_healing.md b/dox/user_guides/shape_healing/shape_healing.md index 81b2f0832e..2c57ae536d 100644 --- a/dox/user_guides/shape_healing/shape_healing.md +++ b/dox/user_guides/shape_healing/shape_healing.md @@ -125,7 +125,7 @@ The sequence of actions is as follows: 1. Create tool *ShapeFix_Shape* and initialize it by shape: ~~~~{.cpp} - Handle(ShapeFix_Shape) aFixShape = new ShapeFix_Shape(); + occ::handle aFixShape = new ShapeFix_Shape(); aFixShape->Init (theShape); ~~~~ @@ -161,11 +161,11 @@ The sequence of actions is as follows: 5. Create *ShapeFix_Wireframe* tool and initialize it by shape: ~~~~{.cpp} - Handle(ShapeFix_Wireframe) aFixWire = new ShapeFix_Wireframe (theShape); + occ::handle aFixWire = new ShapeFix_Wireframe (theShape); ~~~~ or: ~~~~{.cpp} - Handle(ShapeFix_Wireframe) aFixWire = new ShapeFix_Wireframe(); + occ::handle aFixWire = new ShapeFix_Wireframe(); aFixWire->Load (theShape); ~~~~ 6. Set the basic precision and the maximum allowed tolerance: @@ -208,10 +208,10 @@ For example, in the following way it is possible to fix face *theFace1* of shape ~~~~{.cpp} // create tools for fixing a face -Handle(ShapeFix_Face) aFixFace = new ShapeFix_Face(); +occ::handle aFixFace = new ShapeFix_Face(); // create tool for rebuilding a shape and initialize it by shape -Handle(ShapeBuild_ReShape) aReshapeContext = new ShapeBuild_ReShape(); +occ::handle aReshapeContext = new ShapeBuild_ReShape(); aReshapeContext->Apply (theShape1); // set a tool for rebuilding a shape in the tool for fixing @@ -272,7 +272,7 @@ To set a flag to the desired value, get a tool containing this flag and set the For example, it is possible to forbid performing fixes to remove small edges - *FixSmall*: ~~~~{.cpp} -Handle(ShapeFix_Shape) aFixShape = new ShapeFix_Shape (theShape); +occ::handle aFixShape = new ShapeFix_Shape (theShape); aFixShape->FixWireTool()->FixSmallMode() = 0; if (aFixShape->Perform()) { @@ -289,7 +289,7 @@ For example, it is possible to force the removal of invalid 2D curves from a fac ~~~~{.cpp} TopoDS_Face theFace = ...; // face with invalid 2D curves. // creation of tool and its initialization by shape -Handle(ShapeFix_Shape) aFixShape = new ShapeFix_Shape (theFace); +occ::handle aFixShape = new ShapeFix_Shape (theFace); // set work precision and max allowed tolerance aFixShape->SetPrecision (thePrec); aFixShape->SetMaxTolerance (theMaxTol); @@ -492,7 +492,7 @@ Let us create a custom set of fixes as an example: ~~~~{.cpp} TopoDS_Face theFace = ...; TopoDS_Wire theWire = ...; -Standard_Real aPrecision = 1e-04; +double aPrecision = 1e-04; ShapeFix_Wire aFixWire (theWire, theFace, aPrecision); // create a tool and loads objects into it aFixWire.FixReorder(); @@ -532,7 +532,7 @@ and then immediately apply fixing tools. ~~~~{.cpp} TopoDS_Face theFace = ...; TopoDS_Wire theWire = ...; -Standard_Real aPrecision = 1e-04; +double aPrecision = 1e-04; ShapeAnalysis_Wire aCheckWire (theWire, theFace, aPrecision); ShapeFix_Wire aFixWire (theWire, theFace, aPrecision); if (aCheckWire.CheckOrder()) @@ -547,7 +547,7 @@ if (aCheckWire.CheckSmall (aPrecision)) { std::cout << "Wire contains edge(s) shorter than " << aPrecision << std::endl; // an edge that is shorter than the given tolerance is found - Standard_Boolean LockVertex = Standard_True; + bool LockVertex = true; if (aFixWire.FixSmall (LockVertex, aPrecision)) { std::cout << "Edges shorter than " << aPrecision << " have been removed\n"; @@ -592,7 +592,7 @@ Then we can use the repairing tool to increase the tolerance and make the deviat ~~~~{.cpp} TopoDS_Edge theEdge = ...; ShapeAnalysis_Edge aCheckEdge; -Standard_Real aMaxDev = 0.0; +double aMaxDev = 0.0; if (aCheckEdge.CheckSameParameter (theEdge, aMaxDev)) { std::cout << "Incorrect SameParameter flag\n" @@ -615,7 +615,7 @@ This class performs the following operations: * merges and removes small edges. Fixing of small edges can be managed with the help of two flags: - * *ModeDropSmallEdges()* -- mode for removing small edges that can not be merged, by default it is equal to Standard_False. + * *ModeDropSmallEdges()* -- mode for removing small edges that can not be merged, by default it is equal to false. * *LimitAngle* -- maximum possible angle for merging two adjacent edges, by default no limit angle is applied (-1). To perform fixes it is necessary to: @@ -625,7 +625,7 @@ To perform fixes it is necessary to: ~~~~{.cpp} // creation of a tool -Handle(ShapeFix_Wireframe) aFixWireframe = new ShapeFix_Wireframe (theShape); +occ::handle aFixWireframe = new ShapeFix_Wireframe (theShape); // set the working precision problems will be detected with and the maximum allowed tolerance aFixWireframe->SetPrecision (thePrec); aFixWireframe->SetMaxTolerance (theMaxTol); @@ -652,7 +652,7 @@ Class ShapeFix_FixSmallFaceThis tool is intended for dropping small faces from t The sequence of actions for performing the fix is the same as for the fixes described above: ~~~~{.cpp} // creation of a tool -Handle(ShapeFix_FixSmallFace) aFixSmallFace = new ShapeFix_FixSmallFace (theShape); +occ::handle aFixSmallFace = new ShapeFix_FixSmallFace (theShape); // setting of tolerances aFixSmallFace->SetPrecision (thePrec); aFixSmallFace->SetMaxTolerance (theMaxTol); @@ -761,7 +761,7 @@ In addition, each API method returns a Boolean value, which is True when a case ~~~~{.cpp} TopoDS_Face theFace = ...; TopoDS_Wire theWire = ...; -Standard_Real aPrecision = 1e-04; +double aPrecision = 1e-04; ShapeAnalysis_Wire aCheckWire (theWire, theFace, aPrecision); // create a tool and load objects into it if (aCheckWire.CheckOrder()) @@ -807,14 +807,14 @@ for (TopExp_Explorer anExp (theFace, TopAbs_EDGE); anExp.More(); anExp.Next()) { std::cout << "Edge has no 3D curve\n"; } - Handle(Geom2d_Curve) aPCurve; - Standard_Real aPFirst = 0.0, aPLast = 0.0; - if (aCheckEdge.PCurve (anEdge, theFace, aPCurve, aPFirst, aPLast, Standard_False)) + occ::handle aPCurve; + double aPFirst = 0.0, aPLast = 0.0; + if (aCheckEdge.PCurve (anEdge, theFace, aPCurve, aPFirst, aPLast, false)) { // print the pcurve and its range on the given face std::cout << "Pcurve range [" << aPFirst << ", " << aPLast << "]\n"; } - Standard_Real aMaxDev = 0.0; + double aMaxDev = 0.0; if (aCheckEdge.CheckSameParameter (anEdge, aMaxDev)) { // check the consistency of all the curves in the edge @@ -829,10 +829,10 @@ for (TopExp_Explorer anExp (theFace, TopAbs_EDGE); anExp.More(); anExp.Next()) // check the overlapping of two edges TopoDS_Edge theEdge1 = ...; TopoDS_Edge theEdge2 = ...; -Standard_Real theDomainDist = 0.0; +double theDomainDist = 0.0; ShapeAnalysis_Edge aCheckEdge; -Standard_Real aTolOverlap = 0.0; +double aTolOverlap = 0.0; if (aCheckEdge.CheckOverlapping (theEdge1, theEdge2, aTolOverlap, theDomainDist)) { std::cout << "Edges are overlapped with tolerance = " << aTolOverlap << std::endl; @@ -851,7 +851,7 @@ TopoDS_Shape theShape = ...; // checked shape // creation of a tool ShapeAnalysis_CheckSmallFace aCheckSmallFace; // exploring the shape on faces and checking each face -Standard_Integer aNbSmallfaces = 0; +int aNbSmallfaces = 0; for (TopExp_Explorer anExp (theShape, TopAbs_FACE); anExp.More(); anExp.Next()) { TopoDS_Face aFace = TopoDS::Face (anExp.Current()); @@ -907,13 +907,13 @@ The analysis of tolerance functionality is the following: ~~~~{.cpp} TopoDS_Shape theShape = ...; ShapeAnalysis_ShapeTolerance aCheckToler; -Standard_Real anAverageOnShape = aCheckToler.Tolerance (theShape, 0); +double anAverageOnShape = aCheckToler.Tolerance (theShape, 0); std::cout << "Average tolerance of the shape is " << anAverageOnShape << std::endl; -Standard_Real aMinOnEdge = aCheckToler.Tolerance (theShape, -1, TopAbs_EDGE); +double aMinOnEdge = aCheckToler.Tolerance (theShape, -1, TopAbs_EDGE); std::cout << "Minimum tolerance of the edges is " << aMinOnEdge << std::endl; -Standard_Real aMaxOnVertex = aCheckToler.Tolerance (theShape, 1, TopAbs_VERTEX); +double aMaxOnVertex = aCheckToler.Tolerance (theShape, 1, TopAbs_VERTEX); std::cout << "Maximum tolerance of the vertices is " << aMaxOnVertex << std::endl; -Standard_Real theMaxAllowed = 0.1; +double theMaxAllowed = 0.1; if (aMaxOnVertex > theMaxAllowed) { std::cout << "Maximum tolerance of the vertices exceeds maximum allowed\n"; @@ -952,7 +952,7 @@ This class also provides some static methods for advanced use: connecting edges/ ~~~~{.cpp} TopoDS_Shape theShape = ...; // tolerance for sewing -Standard_Real theSewTolerance = 1.e-03; +double theSewTolerance = 1.e-03; bool theToSplitClosed = false; bool theToSplitOpen = true; // in case of analysis of possible free boundaries @@ -987,12 +987,12 @@ Methods for calculating the number of geometric objects or sub-shapes with a spe and selecting sub-shapes by various criteria. -The corresponding flags should be set to True for storing a shape by a specified criteria: - * faces based on indirect surfaces -- *aCheckContents.MofifyIndirectMode() = Standard_True*; - * faces based on offset surfaces -- *aCheckContents.ModifyOffsetSurfaceMode() = Standard_True*; - * edges if their 3D curves are trimmed -- *aCheckContents.ModifyTrimmed3dMode() = Standard_True*; - * edges if their 3D curves and 2D curves are offset curves -- *aCheckContents.ModifyOffsetCurveMode() = Standard_True*; - * edges if their 2D curves are trimmed -- *aCheckContents.ModifyTrimmed2dMode() = Standard_True*; +The corresponding flags should be set to true for storing a shape by a specified criteria: + * faces based on indirect surfaces -- *aCheckContents.MofifyIndirectMode() = true*; + * faces based on offset surfaces -- *aCheckContents.ModifyOffsetSurfaceMode() = true*; + * edges if their 3D curves are trimmed -- *aCheckContents.ModifyTrimmed3dMode() = true*; + * edges if their 3D curves and 2D curves are offset curves -- *aCheckContents.ModifyOffsetCurveMode() = true*; + * edges if their 2D curves are trimmed -- *aCheckContents.ModifyTrimmed2dMode() = true*; Let us, for example, select faces based on offset surfaces. @@ -1002,9 +1002,9 @@ ShapeAnalysis_ShapeContents aCheckContents; aCheckContents.ModifyOffsetSurfaceMode() = true; aCheckContents.Perform (theShape); // getting the number of offset surfaces in the shape -Standard_Integer aNbOffsetSurfaces = aCheckContents.NbOffsetSurf(); +int aNbOffsetSurfaces = aCheckContents.NbOffsetSurf(); // getting the sequence of faces based on offset surfaces -Handle(TopTools_HSequenceOfShape) aSeqFaces = aCheckContents.OffsetSurfaceSec(); +occ::handle> aSeqFaces = aCheckContents.OffsetSurfaceSec(); ~~~~ @subsubsection occt_shg_3_2_4 Analysis of shape underlined geometry @@ -1115,9 +1115,9 @@ Let us split a shape according to a specified criterion. ~~~~{.cpp} // creation of new tools for geometry splitting by a specified criterion -Handle(MyTools_SplitSurfaceTool) MySplitSurfaceTool = new MyTools_SplitSurfaceTool(); -Handle(MyTools_SplitCurve3DTool) MySplitCurve3Dtool = new MyTools_SplitCurve3DTool(); -Handle(MyTools_SplitCurve2DTool) MySplitCurve2Dtool = new MyTools_SplitCurve2DTool(); +occ::handle MySplitSurfaceTool = new MyTools_SplitSurfaceTool(); +occ::handle MySplitCurve3Dtool = new MyTools_SplitCurve3DTool(); +occ::handle MySplitCurve2Dtool = new MyTools_SplitCurve2DTool(); // creation of a tool for splitting the shape and initialization of that tool by shape TopoDS_Shape theInitShape = ...; @@ -1128,8 +1128,8 @@ aShapeDivide.SetPrecision (prec); aShapeDivide.SetMaxTolerance (MaxTol); // setting of new splitting geometry tools in the shape splitting tools -Handle(ShapeUpgrade_FaceDivide) aFaceDivide = aShapeDivide->GetSplitFaceTool(); -Handle(ShapeUpgrade_WireDivide) aWireDivide = aFaceDivide->GetWireDivideTool(); +occ::handle aFaceDivide = aShapeDivide->GetSplitFaceTool(); +occ::handle aWireDivide = aFaceDivide->GetWireDivideTool(); aFaceDivide->SetSplitSurfaceTool (MySplitSurfaceTool); aWireDivide->SetSplitCurve3dTool (MySplitCurve3DTool); aWireDivide->SetSplitCurve2dTool (MySplitCurve2DTool); @@ -1236,15 +1236,15 @@ class ShapeUpgrade_SplitSurfaceContinuity : public ShapeUpgrade_SplitSurface // methods to set the criterion and the tolerance into the splitting tool void SetCriterion (GeomAbs_Shape theCriterion); - void SetTolerance (Standard_Real theTol); + void SetTolerance (double theTol); // redefinition of method Compute virtual void Compute (const bool theSegment) override; private: GeomAbs_Shape myCriterion; - Standard_Real myTolerance; - Standard_Integer myCont; + double myTolerance; + int myCont; }; ~~~~ @@ -1266,7 +1266,7 @@ aShapeDivide.SetSurfaceCriterion (GeomAbs_C2); // for Surfaces aShapeDivide.Perform(); TopoDS_Shape aResShape = aShapeDivide.Result(); //.. to also get the correspondences before/after -Handle(ShapeBuild_ReShape) aCtx = aShapeDivide.Context(); +occ::handle aCtx = aShapeDivide.Context(); //.. on a given shape if (aCtx.IsRecorded (theSh)) { @@ -1334,11 +1334,11 @@ It topologically and (partially) geometrically processes closed faces and perfor ~~~~{.cpp} TopoDS_Shape theShape = ...; ShapeUpgrade_ShapeDivideClosed aTool (theShape); -Standard_Real theCloseTol = ...; +double theCloseTol = ...; aTool.SetPrecision (theCloseTol); -Standard_Real theMaxTol = ...; +double theMaxTol = ...; aTool.SetMaxTolerance (theMaxTol); -Standard_Integer theNbSplitPoints = ...; +int theNbSplitPoints = ...; aTool.SetNbSplitPoints (theNbSplitPoints); if (!aTool.Perform() && aTool.Status (ShapeExtend_FAIL)) { @@ -1423,7 +1423,7 @@ New 2d curves (recomputed for converted surfaces) are added to the same edges be ~~~~{.cpp} ShapeCustom::ScaleShape() - TopoDS_Shape ShapeCustom::ScaleShape (const TopoDS_Shape& theShape, const Standard_Real theScale); + TopoDS_Shape ShapeCustom::ScaleShape (const TopoDS_Shape& theShape, const double theScale); ~~~~ This method returns a new shape, which is a scaled original shape with a coefficient equal to the specified value of scale. @@ -1438,14 +1438,14 @@ The method with all parameters looks as follows: ~~~~{.cpp} ShapeCustom::BsplineRestriction() TopoDS_Shape ShapeCustom::BSplineRestriction (const TopoDS_Shape& theShape, - const Standard_Real theTol3d, const Standard_Real theTol2d, - const Standard_Integer theMaxDegree, - const Standard_Integer theMaxNbSegment, + const double theTol3d, const double theTol2d, + const int theMaxDegree, + const int theMaxNbSegment, const GeomAbs_Shape theContinuity3d, const GeomAbs_Shape theContinuity2d, - const Standard_Boolean theDegree, - const Standard_Boolean theRational, - const Handle(ShapeCustom_RestrictionParameters)& theParameters); + const bool theDegree, + const bool theRational, + const occ::handle& theParameters); ~~~~ It returns a new shape with all surfaces, curves and 2D curves of BSpline/Bezier type or based on them, @@ -1488,9 +1488,9 @@ This method returns a new shape with all elementary periodic surfaces converted ~~~~{.cpp} ShapeCustom::ConvertToBSpline() TopoDS_Shape ShapeCustom::ConvertToBSpline (const TopoDS_Shape& theShape, - const Standard_Boolean theExtrMode, - const Standard_Boolean theRevolMode, - const Standard_Boolean theOffsetMode); + const bool theExtrMode, + const bool theRevolMode, + const bool theOffsetMode); ~~~~ This method returns a new shape with all surfaces of linear extrusion, revolution and offset surfaces converted according to flags to *Geom_BSplineSurface* (with the same parameterization). @@ -1512,11 +1512,11 @@ You can refine your mapping process by using additional calls to follow shape ma The following code along with pertinent includes can be used: ~~~~{.cpp} -Standard_Real theScale = 100; // for example! +double theScale = 100; // for example! gp_Trsf aTrsf; aTrsf.SetScale (gp_Pnt (0, 0, 0), theScale); -Handle(ShapeCustom_TrsfModification) aTrsfModif = new ShapeCustom_TrsfModification (aTrsf); -TopTools_DataMapOfShapeShape aContext; +occ::handle aTrsfModif = new ShapeCustom_TrsfModification (aTrsf); +NCollection_DataMap aContext; BRepTools_Modifier aBRepModif; TopoDS_Shape aRes = ShapeCustom::ApplyModifier (theShape, aTrsfModif, aContext, aBRepModif); ~~~~ @@ -1533,7 +1533,7 @@ if (aContext.IsBound (theOneShape)) aOneRes = aContext.Find (theOneShape); } // you can also sweep the entire data map: -for (TopTools_DataMapOfShapeShape::Iterator anIter (aContext); anIter.More(); anIter.Next()) +for (NCollection_DataMap::Iterator anIter (aContext); anIter.More(); anIter.Next()) { TopoDS_Shape aOneShape = anIter.Key(); TopoDS_Shape aOneRes = anIter.Value(); @@ -1583,7 +1583,7 @@ The example of method application is also given below: ~~~~{.cpp} // initialization of the class by shape -Handle(ShapeUpgrade_RemoveInternalWires) aTool = new ShapeUpgrade_RemoveInternalWires (theInputShape); +occ::handle aTool = new ShapeUpgrade_RemoveInternalWires (theInputShape); // setting parameters aTool->MinArea() = theMinArea; aTool->RemoveFaceMode() = theModeRemoveFaces; @@ -1602,12 +1602,12 @@ if (aTool->Status (ShapeExtend_FAIL) if (aTool->Status (ShapeExtend_DONE1)) { - const TopTools_SequenceOfShape& aRemovedWires = aTool->RemovedWires(); + const NCollection_Sequence& aRemovedWires = aTool->RemovedWires(); std::cout << aRemovedWires.Length() << " internal wires were removed\n"; } if (aTool->Status (ShapeExtend_DONE2)) { - const TopTools_SequenceOfShape& aRemovedFaces =aTool->RemovedFaces(); + const NCollection_Sequence& aRemovedFaces =aTool->RemovedFaces(); std::cout << aRemovedFaces.Length() << " small faces were removed\n"; } // getting result shape @@ -1630,14 +1630,14 @@ To convert surfaces to analytical form this class analyzes the form and the clos The conversion is done only if the new (analytical) surface does not deviate from the source one more than by the given precision. ~~~~{.cpp} -Handle(Geom_Surface) theInitSurf; +occ::handle theInitSurf; ShapeCustom_Surface aConvSurf (theInitSurf); // conversion to analytical form -Handle(Geom_Surface) aNewSurf = aConvSurf.ConvertToAnalytical (theAllowedTol, false); +occ::handle aNewSurf = aConvSurf.ConvertToAnalytical (theAllowedTol, false); // or conversion to a periodic surface -Handle(Geom_Surface) aNewSurf = aConvSurf.ConvertToPeriodic (false); +occ::handle aNewSurf = aConvSurf.ConvertToPeriodic (false); // getting the maximum deviation of the new surface from the initial surface -Standard_Real aMaxDist = aConvSurf.Gap(); +double aMaxDist = aConvSurf.Gap(); ~~~~ @subsubsection occt_shg_4_4_9 Unify Same Domain @@ -1686,9 +1686,9 @@ Requests may be applied as *Oriented* (i.e. only to an item with the same orient Then these requests may be applied to any shape, which may contain one or more of these individual shapes. This tool has a flag for taking the location of shapes into account (for keeping the structure of assemblies) (*ModeConsiderLocation*). -If this mode is equal to Standard_True, the shared shapes with locations will be kept. -If this mode is equal to Standard_False, some different shapes will be produced from one shape with different locations after rebuilding. -By default, this mode is equal to Standard_False. +If this mode is equal to true, the shared shapes with locations will be kept. +If this mode is equal to false, some different shapes will be produced from one shape with different locations after rebuilding. +By default, this mode is equal to false. To use this tool for the reconstruction of shapes it is necessary to take the following steps: 1. Create this tool and use method *Apply()* for its initialization by the initial shape. @@ -1713,7 +1713,7 @@ Let us use the tool to get the result shape after modification of sub-shapes of ~~~~{.cpp} TopoDS_Shape theInitialShape = ...; // creation of a rebuilding tool -Handle(ShapeBuild_ReShape) aContext = new ShapeBuild_ReShape(); +occ::handle aContext = new ShapeBuild_ReShape(); // next step is optional; it can be used for keeping the assembly structure aContext->ModeConsiderLocation = true; @@ -1771,13 +1771,13 @@ This class also provides a method to check if the edge in the wire is a seam (if Let us remove edges from the wire and define whether it is seam edge: ~~~~{.cpp} TopoDS_Wire theInitWire = ...; -Handle(ShapeExtend_Wire) anExtendWire = new ShapeExtend_Wire (theInitWire); +occ::handle anExtendWire = new ShapeExtend_Wire (theInitWire); // Removing edge theEdge1 from the wire -Standard_Integer anEdge1Index = anExtendWire->Index (theEdge1); +int anEdge1Index = anExtendWire->Index (theEdge1); anExtendWire.Remove (anEdge1Index); // Definition of whether theEdge2 is a seam edge -Standard_Integer anEdge2Index = anExtendWire->Index (theEdge2); +int anEdge2Index = anExtendWire->Index (theEdge2); anExtendWire->IsSeam (anEdge2Index); ~~~~ @@ -1798,20 +1798,20 @@ Messages are added to the Maps (stored as a field) that can be used, for instanc Let us send and get a message attached to object: ~~~~{.cpp} -Handle(ShapeExtend_MsgRegistrator) aMsgReg = new ShapeExtend_MsgRegistrator(); +occ::handle aMsgReg = new ShapeExtend_MsgRegistrator(); // attaches messages to an object (shape or entity) Message_Msg theMsg = ...; TopoDS_Shape theShape1 = ...; aMsgReg->Send (theShape1, theMsg, Message_WARNING); -Handle(Standard_Transient) theEnt = ...; +occ::handle theEnt = ...; aMsgReg->Send (theEnt, theMsg, Message_WARNING); // get messages attached to shape -const ShapeExtend_DataMapOfShapeListOfMsg& aMsgMap = aMsgReg->MapShape(); +const NCollection_DataMap& aMsgMap = aMsgReg->MapShape(); if (aMsgMap.IsBound (theShape1)) { - const Message_ListOfMsg& aMsgList = aMsgMap.Find (theShape1); - for (Message_ListIteratorOfListOfMsg aMsgIter (aMsgList); aMsgIter.More(); aMsgIter.Next()) + const NCollection_List& aMsgList = aMsgMap.Find (theShape1); + for (NCollection_List::Iterator aMsgIter (aMsgList); aMsgIter.More(); aMsgIter.Next()) { Message_Msg aMsg = aMsgIter.Value(); } @@ -1834,7 +1834,7 @@ XSDRAWIGES.cxx MoniTool_Timer::ClearTimers(); ... MoniTool_TimerSentry aTimeSentry ("IGES_LoadFile"); - Standard_Integer aStatus = aReader.LoadFile (theFilePath.ToCString()); + int aStatus = aReader.LoadFile (theFilePath.ToCString()); aTimeSentry.Stop(); ... MoniTool_Timer::DumpTimers (std::cout); @@ -1844,9 +1844,9 @@ IGESBRep_Reader.cxx ... #include ... - Standard_Integer aNbEntries = theModel->NbEntities(); + int aNbEntries = theModel->NbEntities(); ... - for (Standard_Integer i = 1; i<= aNbEntries; ++i) + for (int i = 1; i<= aNbEntries; ++i) { MoniTool_TimerSentry aTimeSentry ("IGESToBRep_Transfer"); ... @@ -1880,10 +1880,10 @@ This function is used in the following way: ~~~~{.cpp} TopoDS_Shape theShape = ...; -Standard_Real thePrec = ...; -Standard_Real theMaxTol = ...; +double thePrec = ...; +double theMaxTol = ...; -Handle(Standard_Transient) anInfo; +occ::handle anInfo; TopoDS_Shape aResult = XSAlgo::AlgoContainer()->ProcessShape (theShape, thePrec, theMaxTol, "Name of ResourceFile", "NameSequence", anInfo); ~~~~ @@ -1907,13 +1907,13 @@ Let us create a custom sequence of operations: where *myFunction* is a function which implements the operation. 4. Create this function in *ShapeProcess_OperLibrary* as follows: ~~~~{.cpp} -static bool myFunction (const Handle(ShapeProcess_Context)& theContext) +static bool myFunction (const occ::handle& theContext) { - Handle(ShapeProcess_ShapeContext) aCtx = Handle(ShapeProcess_ShapeContext)::DownCast (theContext); + occ::handle aCtx = occ::down_cast(theContext); if (aCtx.IsNull()) { return false; } TopoDS_Shape aShape = aCtx->Result(); // receive our parameter: - Standard_Real aToler = 0.0; + double aToler = 0.0; aCtx->GetReal (Tolerance, aToler); ~~~~ 5. Make the necessary operations with *aShape* using the received value of parameter *Tolerance* from the resource file. @@ -2208,7 +2208,7 @@ Your message string goes here A custom file can be loaded into memory using the method *Message_MsgFile::LoadFile*, taking as an argument the path to your file as in the example below: ~~~~{.cpp} -Standard_CString aMsgFilePath = "(path)/sample.file"; +const char* aMsgFilePath = "(path)/sample.file"; Message_MsgFile::LoadFile (aMsgFilePath); ~~~~ diff --git a/dox/user_guides/step/step.md b/dox/user_guides/step/step.md index 691689a0d7..aaa0194b1a 100644 --- a/dox/user_guides/step/step.md +++ b/dox/user_guides/step/step.md @@ -156,7 +156,7 @@ Defines which precision value will be used during translation (see section 2.5 b Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("read.precision.mode"); +int ic = Interface_Static::IVal("read.precision.mode"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -172,7 +172,7 @@ This value is a basic value of tolerance in the processor. The value is in milli Read this parameter with: ~~~~{.cpp} -Standard_Real rp = Interface_Static::RVal("read.precision.val"); +double rp = Interface_Static::RVal("read.precision.val"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -190,7 +190,7 @@ Actually, the maximum between *read.maxprecision.val* and the basis tolerance is Read this parameter with: ~~~~{.cpp} -Standard_Real rp = Interface_Static::RVal("read.maxprecision.val"); +double rp = Interface_Static::RVal("read.maxprecision.val"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -208,7 +208,7 @@ Defines the mode of applying the maximum allowed tolerance. Its possible values Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("read.maxprecision.mode"); +int ic = Interface_Static::IVal("read.maxprecision.mode"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -226,7 +226,7 @@ The functionality of *BRepLib::SameParameter* is used through *ShapeFix_Edge::Sa Read this parameter with: ~~~~{.cpp} -Standard_Integer mv = Interface_Static::IVal("read.stdsameparameter.mode"); +int mv = Interface_Static::IVal("read.stdsameparameter.mode"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -245,7 +245,7 @@ If both 2D and 3D representation of the entity are present, the computation of t Read this parameter with: ~~~~{.cpp} -Standard_Integer rp = Interface_Static::IVal("read.surfacecurve.mode"); +int rp = Interface_Static::IVal("read.surfacecurve.mode"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -259,7 +259,7 @@ Default value is (0). This parameter is used for call to *BRepLib::EncodeRegularity()* function which is called for the shape read from an IGES or a STEP file at the end of translation process. This function sets the regularity flag of the edge in the shell when this edge is shared by two faces. This flag shows the continuity these two faces are connected with at that edge. Read this parameter with: ~~~~{.cpp} -Standard_Real era = Interface_Static::RVal("read.encoderegularity.angle"); +double era = Interface_Static::RVal("read.encoderegularity.angle"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -297,7 +297,7 @@ Defines the approach used for selection of top-level STEP entities for translati Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("read.step.product.mode"); +int ic = Interface_Static::IVal("read.step.product.mode"); ~~~~ Modify this parameter with: @@ -320,7 +320,7 @@ Note that in AP 203 and AP214 files all products should be marked as `design', s Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("read.step.product.context"); +int ic = Interface_Static::IVal("read.step.product.context"); ~~~~ Modify this parameter with: @@ -345,7 +345,7 @@ When this option is not equal to 1, for products with multiple representations t Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("read.step.shape.repr"); +int ic = Interface_Static::IVal("read.step.shape.repr"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -364,7 +364,7 @@ Specifies which data should be read for the products found in the STEP file: Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("read.step.assembly.level"); +int ic = Interface_Static::IVal("read.step.assembly.level"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -381,7 +381,7 @@ Defines whether shapes associated with the main *SHAPE_DEFINITION_REPRESENTATION Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("read.step.shape.relationship"); +int ic = Interface_Static::IVal("read.step.shape.relationship"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -398,7 +398,7 @@ Defines whether shapes associated with the *PRODUCT_DEFINITION_SHAPE* entity of Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("read.step.shape.aspect"); +int ic = Interface_Static::IVal("read.step.shape.aspect"); ~~~~ Modify this parameter with: @@ -431,15 +431,15 @@ of for each of the two "AXIS2_PLACEMENT_3D" entities referenced by it. as follow ~~~~{.cpp} STEPControl_Reader aReader; ... // translate file and parse STEP model to find relevant axis entity - Handle(StepGeom_Axis2Placement3d) aSTEPAxis = ...; - Handle(Transfer_Binder) aBinder = aReader->WS()->TransferReader()->TransientProcess()->Find(aSTEPAxis); - Handle(TransferBRep_ShapeBinder) aShBinder = Handle(TransferBRep_ShapeBinder)::DownCast(aBinder); + occ::handle aSTEPAxis = ...; + occ::handle aBinder = aReader->WS()->TransferReader()->TransientProcess()->Find(aSTEPAxis); + occ::handle aShBinder = occ::down_cast(aBinder); if (! aShBinder.IsNull()) { TopoDS_Face aFace = TopoDS::Face (aShBinder->Result()); if (! aFace.IsNull()) { - Handle(Geom_Plane) aSurf = Handle(Geom_Plane)::DownCast (BRep_Tool::Surface (aFace)); + occ::handle aSurf = occ::down_cast(BRep_Tool::Surface (aFace)); if (! aSurf.IsNull()) { gp_Ax3 anAxis = aSurf->Placement(); @@ -467,7 +467,7 @@ Tessellated geometry is attached to shapes as objects of Poly_TriangulationList of entities @@ -559,23 +559,23 @@ A list of entities can be formed by invoking *STEP214Control_Reader::GiveList* ( Here is a simple example of how a list is translated: ~~~~{.cpp} -Handle(TColStd_HSequenceOfTransient) list = reader.GiveList(); +occ::handle>> list = reader.GiveList(); ~~~~ -The result is a *TColStd_HSequenceOfTransient*. +The result is a *NCollection_HSequence\\>*. You can either translate a list entity by entity or all at once. An entity-by-entity operation lets you check each individual entity translated.
Translating a whole list in one operation
~~~~{.cpp} -Standard_Integer nbtrans = reader.TransferList (list); +int nbtrans = reader.TransferList (list); ~~~~ *nbtrans* gives the number of items in the list that produced a shape.
Translating a list entity by entity:
~~~~{.cpp} -Standard_Integer i,nb = list->Length(); +int i,nb = list->Length(); for (i = 1; i <= nb; i ++) { - Handle(Standard_Transient) ent = list->Value(i); - Standard_Boolean OK = reader.TransferEntity (ent); + occ::handle ent = list->Value(i); + bool OK = reader.TransferEntity (ent); } ~~~~ @@ -603,19 +603,19 @@ You can select an entity either by its rank or by its handle (an entity's handle
Selection by rank
Use method *StepData_StepModel::NextNumberForLabel* to find its rank with the following: ~~~~{.cpp} -Standard_CString label = `#...'; +const char* label = `#...'; StepData_StepModel model = reader.StepModel(); -rank = model->NextNumberForLabe(label, 0, Standard_False); +rank = model->NextNumberForLabe(label, 0, false); ~~~~ Translate an entity specified by its rank: ~~~~{.cpp} -Standard_Boolean ok = reader.Transfer (rank); +bool ok = reader.Transfer (rank); ~~~~
Direct selection of an entity
-*ent* is the entity. The argument is a *Handle(Standard_Transient)*. +*ent* is the entity. The argument is a *occ::handle\*. ~~~~{.cpp} -Standard_Boolean ok = reader.TransferEntity (ent); +bool ok = reader.TransferEntity (ent); ~~~~ @subsection occt_step_2_4 Mapping STEP entities to Open CASCADE Technology shapes @@ -824,18 +824,18 @@ The following diagram illustrates the structure of calls in reading STEP. The hi #include #include -Standard_Integer main() +int main() { STEPControl_Reader reader; reader.ReadFile("MyFile.stp"); // Loads file MyFile.stp - Standard_Integer NbRoots = reader.NbRootsForTransfer(); + int NbRoots = reader.NbRootsForTransfer(); // gets the number of transferable roots cout;Number of roots in STEP file: ; NbRootsendl; - Standard_Integer NbTrans = reader.TransferRoots(); + int NbTrans = reader.TransferRoots(); // translates all transferable roots, and returns the number of //successful translations cout;STEP roots transferred: ; NbTransendl; cout;Number of resulting shapes is: ;reader.NbShapes()endl; @@ -893,9 +893,10 @@ writes the precision value. * Greatest (1) : the uncertainty value is set to the maximum tolerance of an OCCT shape * Session (2) : the uncertainty value is that of the write.precision.val parameter. -Read this parameter with: - -Standard_Integer ic = Interface_Static::IVal("write.precision.mode"); +Read this parameter with: +~~~~{.cpp} +int ic = Interface_Static::IVal("write.precision.mode"); +~~~~ Modify this parameter with: ~~~~{.cpp} if(!Interface_Static::SetIVal("write.precision.mode",1)) @@ -912,7 +913,7 @@ This value is stored in shape_representation in a STEP file as an uncertainty. Read this parameter with: ~~~~{.cpp} -Standard_Real rp = Interface_Static::RVal("write.precision.val"); +double rp = Interface_Static::RVal("write.precision.val"); ~~~~ Modify this parameter with: @@ -930,7 +931,7 @@ writing assembly mode. Read this parameter with: ~~~~{.cpp} -Standard_Integer rp = Interface_Static::IVal("write.step.assembly"); +int rp = Interface_Static::IVal("write.step.assembly"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -957,7 +958,7 @@ if(!Interface_Static::SetCVal("write.step.schema","DIS")) .. error .. ~~~~ Default value is 1 (;CD;). -For the parameter *write.step.schema* to take effect, method *STEPControl_Writer::Model(Standard_True)* should be called after changing this parameter (corresponding command in DRAW is *newmodel*). +For the parameter *write.step.schema* to take effect, method *STEPControl_Writer::Model(true)* should be called after changing this parameter (corresponding command in DRAW is *newmodel*).

write.step.product.name

Defines the text string that will be used for field `name' of PRODUCT entities written to the STEP file. @@ -972,7 +973,7 @@ This parameter indicates whether parametric curves (curves in parametric space o Read this parameter with: ~~~~{.cpp} -Standard_Integer wp = Interface_Static::IVal("write.surfacecurve.mode"); +int wp = Interface_Static::IVal("write.surfacecurve.mode"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -1002,7 +1003,7 @@ This parameter indicates which of free vertices writing mode is switch on. Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("write.step.vertex.mode"); +int ic = Interface_Static::IVal("write.step.vertex.mode"); ~~~~ Modify this parameter with: ~~~~{.cpp} @@ -1028,7 +1029,7 @@ Tessellated geometry is taken as objects of Poly_Triangulation type from Read this parameter with: ~~~~{.cpp} -Standard_Integer ic = Interface_Static::IVal("write.step.tessellated"); +int ic = Interface_Static::IVal("write.step.tessellated"); ~~~~ Modify this parameter with: @@ -1194,7 +1195,7 @@ The highlighted classes are intended to translate geometry. #include #include -Standard_Integer main() +int main() { TopoDS_Solid source; . . . @@ -1513,7 +1514,7 @@ In addition to the translation of shapes implemented in basic translator, it pro ### Load a STEP file Before performing any other operation, you must load a STEP file with: ~~~~{.cpp} -STEPCAFControl_Reader reader(XSDRAW::Session(), Standard_False); +STEPCAFControl_Reader reader(XSDRAW::Session(), false); IFSelect_ReturnStatus stat = reader.ReadFile("filename.stp"); ~~~~ Loading the file only memorizes the data, it does not translate it. @@ -1529,21 +1530,21 @@ In addition, the following parameters can be set for XDE translation of attribut * Parameter for transferring colors: ~~~~{.cpp} reader.SetColorMode(mode); -// mode can be Standard_True or Standard_False +// mode can be true or false ~~~~ * Parameter for transferring names: ~~~~{.cpp} reader.SetNameMode(mode); -// mode can be Standard_True or Standard_False +// mode can be true or false ~~~~ ### Translate a STEP file to XDE The following function performs a translation of the whole document: ~~~~{.cpp} -Standard_Boolean ok = reader.Transfer(doc); +bool ok = reader.Transfer(doc); ~~~~ -where *doc* is a variable which contains a handle to the output document and should have a type *Handle(TDocStd_Document)*. +where *doc* is a variable which contains a handle to the output document and should have a type *occ::handle\*. @subsection occt_step_7_2 Attributes read from STEP @@ -1664,7 +1665,7 @@ Attributes can be read for shapes at levels: The translation from XDE to STEP can be initialized as follows: ~~~~{.cpp} -STEPCAFControl_Writer aWriter(XSDRAW::Session(),Standard_False); +STEPCAFControl_Writer aWriter(XSDRAW::Session(),false); ~~~~ ### Set parameters for translation from XDE to STEP @@ -1673,12 +1674,12 @@ The following parameters can be set for a translation of attributes to STEP: * For transferring colors: ~~~~{.cpp} aWriter.SetColorMode(mode); -// mode can be Standard_True or Standard_False +// mode can be true or false ~~~~ * For transferring names: ~~~~{.cpp} aWriter.SetNameMode(mode); -// mode can be Standard_True or Standard_False +// mode can be true or false ~~~~ ### Translate an XDE document to STEP @@ -1687,7 +1688,7 @@ You can perform the translation of document by calling the function: ~~~~{.cpp} IFSelect_ReturnStatus aRetSt = aWriter.Transfer(doc); ~~~~ -where *doc* is a variable, which contains a handle to the input document for transferring and should have a type *Handle(TDocStd_Document)*. +where *doc* is a variable, which contains a handle to the input document for transferring and should have a type *occ::handle\*. ### Write a STEP file diff --git a/dox/user_guides/vis/vis.md b/dox/user_guides/vis/vis.md index f60161f435..88264861f5 100644 --- a/dox/user_guides/vis/vis.md +++ b/dox/user_guides/vis/vis.md @@ -219,7 +219,7 @@ vtkActorCollection* anActorCollection = aPicker->GetPickedActors(); ~~~~ or as a collection of picked shape IDs: ~~~~{.cpp} -IVtk_ShapeIdList ids = aPicker->GetPickedShapesIds(); +NCollection_List ids = aPicker->GetPickedShapesIds(); ~~~~ These methods return a single top picked actor or a shape by default. To get all the picked actors or shapes it is necessary to send “true” value in the optional Boolean parameter: ~~~~{.cpp} @@ -228,7 +228,7 @@ ids = aPicker->GetPickedShapesIds(true); ~~~~ 5. Obtain the picked sub-shape IDs: ~~~~{.cpp} -IVtk_ShapeIdList subShapeIds = aPicker->GetPickedSubShapesIds(shapeId); +NCollection_List subShapeIds = aPicker->GetPickedSubShapesIds(shapeId); ~~~~ This method also returns a single ID of a top-level picked sub-shape and has the same optional Boolean parameter to get all the picked sub-shapes of a shape: ~~~~{.cpp} @@ -264,7 +264,7 @@ vtkSmartPointer subShapesFilter = IVtkTools_SubPoly subShapesFilter->SetInputConnection(DS->GetOutputPort()); // Get all picked sub-shapes ids of the shape from a picker (see 3.4) -IVtk_ShapeIdList subShapeIds = aPicker->GetPickedSubShapesIds(ds->GetId(), true); +NCollection_List subShapeIds = aPicker->GetPickedSubShapesIds(ds->GetId(), true); // Set ids to the filter to pass only picked sub-shapes subShapesFilter->SetData(subShapeIds); @@ -352,11 +352,11 @@ myOccPickerAlgo->Pick(x, y); ~~~~ 5. Obtain top-level picking results as IDs of the picked top-level shapes: ~~~~{.cpp} -IVtk_ShapeIdList ids = myOccPickerAlgo->ShapesPicked(); +NCollection_List ids = myOccPickerAlgo->ShapesPicked(); ~~~~ 6. Obtain IDs of the picked sub-shapes: ~~~~{.cpp} -IVtk_ShapeIdList subShapeIds +NCollection_List subShapeIds = myOccPickerAlgo->SubShapesPicked(shapeId); ~~~~ diff --git a/dox/user_guides/visualization/visualization.md b/dox/user_guides/visualization/visualization.md index a4bf2cd0a9..3f05d5bc00 100644 --- a/dox/user_guides/visualization/visualization.md +++ b/dox/user_guides/visualization/visualization.md @@ -108,12 +108,12 @@ Additional packages, such as *Prs3d* and *Graphic3d* may be used if you need to @subsubsection occt_visu_2_1_3 A Basic Example: How to display a 3D object ~~~~{.cpp} -Handle(V3d_Viewer) theViewer; -Handle(AIS_InteractiveContext) aContext = new AIS_InteractiveContext (theViewer); +occ::handle theViewer; +occ::handle aContext = new AIS_InteractiveContext (theViewer); BRepPrimAPI_MakeWedge aWedgeMaker (theWedgeDX, theWedgeDY, theWedgeDZ, theWedgeLtx); TopoDS_Solid aShape = aWedgeMaker.Solid(); -Handle(AIS_Shape) aShapePrs = new AIS_Shape (aShape); // creation of the presentable object +occ::handle aShapePrs = new AIS_Shape (aShape); // creation of the presentable object aContext->Display (aShapePrs, AIS_Shaded, 0, true); // display the presentable object and redraw 3d viewer ~~~~ @@ -365,15 +365,15 @@ To select box's edge, the application must create one sensitive primitive per ed Here all sensitive entities cannot share the owner since different geometric primitives must be highlighted as the result of selection procedure. ~~~~{.cpp} -void InteractiveBox::ComputeSelection (const Handle(SelectMgr_Selection)& theSel, - const Standard_Integer theMode) +void InteractiveBox::ComputeSelection (const occ::handle& theSel, + const int theMode) { switch (theMode) { case 0: // creation of face sensitives for selection of the whole box { - Handle(SelectMgr_EntityOwner) anOwner = new SelectMgr_EntityOwner (this, 5); - for (Standard_Integer aFaceIter = 1; aFaceIter <= myNbFaces; ++aFaceIter) + occ::handle anOwner = new SelectMgr_EntityOwner (this, 5); + for (int aFaceIter = 1; aFaceIter <= myNbFaces; ++aFaceIter) { Select3D_TypeOfSensitivity aSensType = myIsInterior; theSel->Add (new Select3D_SensitiveFace (anOwner, myFaces[aFaceIter]->PointArray(), aSensType)); @@ -382,10 +382,10 @@ void InteractiveBox::ComputeSelection (const Handle(SelectMgr_Selection)& theSel } case 1: // creation of edge sensitives for selection of box edges only { - for (Standard_Integer anEdgeIter = 1; anEdgeIter <= 12; ++anEdgeIter) + for (int anEdgeIter = 1; anEdgeIter <= 12; ++anEdgeIter) { // 1 owner per edge, where 6 is a priority of the sensitive - Handle(MySelection_EdgeOwner) anOwner = new MySelection_EdgeOwner (this, anEdgeIter, 6); + occ::handle anOwner = new MySelection_EdgeOwner (this, anEdgeIter, 6); theSel->Add (new Select3D_SensitiveSegment (anOwner, myFirstPnt[anEdgeIter]), myLastPnt[anEdgeIter])); } break; @@ -405,8 +405,8 @@ Selection structures for any interactive object are created in *SelectMgr_Select The example below shows how computation of different selection modes of the topological shape can be done using standard OCCT mechanisms, implemented in *StdSelect_BRepSelectionTool*. ~~~~{.cpp} - void MyInteractiveObject::ComputeSelection (const Handle(SelectMgr_Selection)& theSelection, - const Standard_Integer theMode) + void MyInteractiveObject::ComputeSelection (const occ::handle& theSelection, + const int theMode) { switch (theMode) { @@ -454,8 +454,8 @@ It also contains the code to start the detection procedure and parse the results // Suppose there is an instance of class InteractiveBox from the previous sample. // It contains an implementation of method InteractiveBox::ComputeSelection() for selection // modes 0 (whole box must be selected) and 1 (edge of the box must be selectable) -Handle(InteractiveBox) theBox; -Handle(AIS_InteractiveContext) theContext; +occ::handle theBox; +occ::handle theContext; // To prevent automatic activation of the default selection mode theContext->SetAutoActivateSelection (false); theContext->Display (theBox, false); @@ -473,7 +473,7 @@ theContext->Select(); // Iterate through the selected owners for (theContext->InitSelected(); theContext->MoreSelected() && !aHasSelected; theContext->NextSelected()) { - Handle(AIS_InteractiveObject) anIO = theContext->SelectedInteractive(); + occ::handle anIO = theContext->SelectedInteractive(); } // deactivate all selection modes for aBox1 @@ -491,9 +491,9 @@ To change this, use the following code: ~~~~{.cpp} // Assume there is a created interactive context -const Handle(AIS_InteractiveContext) theContext; +const occ::handle theContext; // Retrieve the current viewer selector -const Handle(StdSelect_ViewerSelector3d)& aMainSelector = theContext->MainSelector(); +const occ::handle& aMainSelector = theContext->MainSelector(); // Set the flag to allow overlap detection aMainSelector->AllowOverlapDetection (true); ~~~~ @@ -551,16 +551,16 @@ If you are creating your own type of interactive object, you must implement the #### For 3D: ~~~~{.cpp} -void PackageName_ClassName::Compute (const Handle(PrsMgr_PresentationManager)& thePresentationManager, - const Handle(Prs3d_Presentation)& thePresentation, - const Standard_Integer theMode); +void PackageName_ClassName::Compute (const occ::handle& thePresentationManager, + const occ::handle& thePresentation, + const int theMode); ~~~~ #### For hidden line removal (HLR) mode in 3D: ~~~~{.cpp} -void PackageName_ClassName::Compute (const Handle(Prs3d_Projector)& theProjector, - const Handle(Prs3d_Presentation)& thePresentation); +void PackageName_ClassName::Compute (const occ::handle& theProjector, + const occ::handle& thePresentation); ~~~~ @subsubsection occt_visu_3_2_2 Hidden Line Removal @@ -645,14 +645,14 @@ Let us take for example the class called *IShape* representing an interactive ob myPk_IShape::myPk_IShape (const TopoDS_Shape& theShape, PrsMgr_TypeOfPresentation theType) : AIS_InteractiveObject (theType), myShape (theShape) { SetHilightMode (0); } -Standard_Boolean myPk_IShape::AcceptDisplayMode (const Standard_Integer theMode) const +bool myPk_IShape::AcceptDisplayMode (const int theMode) const { return theMode == 0 || theMode == 1; } -void myPk_IShape::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, - const Handle(Prs3d_Presentation)& thePrs, - const Standard_Integer theMode) +void myPk_IShape::Compute (const occ::handle& thePrsMgr, + const occ::handle& thePrs, + const int theMode) { switch (theMode) { @@ -663,8 +663,8 @@ void myPk_IShape::Compute (const Handle(PrsMgr_PresentationManager)& thePrsMgr, } } -void myPk_IShape::Compute (const Handle(Prs3d_Projector)& theProjector, - const Handle(Prs3d_Presentation)& thePrs) +void myPk_IShape::Compute (const occ::handle& theProjector, + const occ::handle& thePrs) { // Hidden line mode calculation algorithm StdPrs_HLRPolyShape::Add (thePrs, myShape, myDrawer, theProjector); @@ -864,7 +864,7 @@ There is one essential rule to follow: the modification of an interactive object You can only directly call the functions available for an interactive object if it has not been loaded into an Interactive Context. ~~~~{.cpp} -Handle(AIS_Shape) aShapePrs = new AIS_Shape (theShape); +occ::handle aShapePrs = new AIS_Shape (theShape); myIntContext->Display (aShapePrs, AIS_Shaded, 0, false, aShapePrs->AcceptShapeDecomposition()); myIntContext->SetColor(aShapePrs, Quantity_NOC_RED); ~~~~ @@ -872,7 +872,7 @@ myIntContext->SetColor(aShapePrs, Quantity_NOC_RED); You can also write ~~~~{.cpp} -Handle(AIS_Shape) aShapePrs = new AIS_Shape (theShape); +occ::handle aShapePrs = new AIS_Shape (theShape); aShapePrs->SetColor (Quantity_NOC_RED); aShapePrs->SetDisplayMode (AIS_Shaded); myIntContext->Display (aShapePrs); @@ -968,15 +968,15 @@ There are several functions to manipulate filters: ~~~~{.cpp} // shading visualization mode, no specific mode, authorization for decomposition into sub-shapes const TopoDS_Shape theShape; -Handle(AIS_Shape) aShapePrs = new AIS_Shape (theShape); +occ::handle aShapePrs = new AIS_Shape (theShape); myContext->Display (aShapePrs, AIS_Shaded, -1, true, true); // activates decomposition of shapes into faces const int aSubShapeSelMode = AIS_Shape::SelectionMode (TopAbs_Face); myContext->Activate (aShapePrs, aSubShapeSelMode); -Handle(StdSelect_FaceFilter) aFil1 = new StdSelect_FaceFilter (StdSelect_Revol); -Handle(StdSelect_FaceFilter) aFil2 = new StdSelect_FaceFilter (StdSelect_Plane); +occ::handle aFil1 = new StdSelect_FaceFilter (StdSelect_Revol); +occ::handle aFil2 = new StdSelect_FaceFilter (StdSelect_Plane); myContext->AddFilter (aFil1); myContext->AddFilter (aFil2); @@ -1022,9 +1022,9 @@ In case of *AIS_Shape*, the (sub)shape is returned by method *StdSelect_BRepOwne ~~~~{.cpp} for (myAISCtx->InitSelected(); myAISCtx->MoreSelected(); myAISCtx->NextSelected()) { - Handle(SelectMgr_EntityOwner) anOwner = myAISCtx->SelectedOwner(); - Handle(AIS_InteractiveObject) anObj = Handle(AIS_InteractiveObject)::DownCast (anOwner->Selectable()); - if (Handle(StdSelect_BRepOwner) aBRepOwner = Handle(StdSelect_BRepOwner)::DownCast (anOwner)) + occ::handle anOwner = myAISCtx->SelectedOwner(); + occ::handle anObj = occ::down_cast(anOwner->Selectable()); + if (occ::handle aBRepOwner = occ::down_cast(anOwner)) { // to be able to use the picked shape TopoDS_Shape aShape = aBRepOwner->Shape(); @@ -1131,11 +1131,11 @@ The point data is packed into vertex buffer object for performance. Example: ~~~~{.cpp} -Handle(Graphic3d_ArrayOfPoints) aPoints = new Graphic3d_ArrayOfPoints (2000, Standard_True); +occ::handle aPoints = new Graphic3d_ArrayOfPoints (2000, true); aPoints->AddVertex (gp_Pnt(-40.0, -40.0, -40.0), Quantity_Color (Quantity_NOC_BLUE1)); aPoints->AddVertex (gp_Pnt (40.0, 40.0, 40.0), Quantity_Color (Quantity_NOC_BLUE2)); -Handle(AIS_PointCloud) aPntCloud = new AIS_PointCloud(); +occ::handle aPntCloud = new AIS_PointCloud(); aPntCloud->SetPoints (aPoints); ~~~~ @@ -1184,9 +1184,9 @@ Moreover, you can redefine the base builder class and provide your own presentat You can add/remove builders using the following methods: ~~~~{.cpp} - MeshVS_Mesh::AddBuilder (const Handle(MeshVS_PrsBuilder)& theBuilder, Standard_Boolean theToTreatAsHilighter); - MeshVS_Mesh::RemoveBuilder (const Standard_Integer theIndex); - MeshVS_Mesh::RemoveBuilderById (const Standard_Integer theId); + MeshVS_Mesh::AddBuilder (const occ::handle& theBuilder, bool theToTreatAsHilighter); + MeshVS_Mesh::RemoveBuilder (const int theIndex); + MeshVS_Mesh::RemoveBuilderById (const int theId); ~~~~ There is a set of reserved display and highlighting mode flags for *MeshVS_Mesh*. @@ -1238,15 +1238,15 @@ Such an object, for example, can be used for displaying the object and stored in ~~~~{.cpp} // read the data and create a data source -Handle(Poly_Triangulation) aSTLMesh = RWStl::ReadFile (aFileName); -Handle(XSDRAWSTLVRML_DataSource) aDataSource = new XSDRAWSTLVRML_DataSource (aSTLMesh); +occ::handle aSTLMesh = RWStl::ReadFile (aFileName); +occ::handle aDataSource = new XSDRAWSTLVRML_DataSource (aSTLMesh); // create mesh -Handle(MeshVS_Mesh) aMeshPrs = new MeshVS(); +occ::handle aMeshPrs = new MeshVS(); aMeshPrs->SetDataSource (aDataSource); // use default presentation builder -Handle(MeshVS_MeshPrsBuilder) aBuilder = new MeshVS_MeshPrsBuilder (aMeshPrs); +occ::handle aBuilder = new MeshVS_MeshPrsBuilder (aMeshPrs); aMeshPrs->AddBuilder (aBuilder, true); ~~~~ @@ -1256,16 +1256,16 @@ The following example demonstrates how you can do this (check if the view has be ~~~~{.cpp} // assign nodal builder to the mesh -Handle(MeshVS_NodalColorPrsBuilder) aBuilder = new MeshVS_NodalColorPrsBuilder (theMeshPrs, MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask); +occ::handle aBuilder = new MeshVS_NodalColorPrsBuilder (theMeshPrs, MeshVS_DMF_NodalColorDataPrs | MeshVS_DMF_OCCMask); aBuilder->UseTexture (true); // prepare color map -Aspect_SequenceOfColor aColorMap; +NCollection_Sequence aColorMap; aColorMap.Append (Quantity_NOC_RED); aColorMap.Append (Quantity_NOC_BLUE1); // assign color scale map values (0..1) to nodes -TColStd_DataMapOfIntegerReal aScaleMap; +NCollection_DataMap aScaleMap; ... // iterate through the nodes and add an node id and an appropriate value to the map aScaleMap.Bind (anId, aValue); @@ -1379,14 +1379,14 @@ The following example shows how to define an array of points: ~~~~{.cpp} // create an array -Handle(Graphic3d_ArrayOfPoints) anArray = new Graphic3d_ArrayOfPoints (theVerticiesMaxCount); +occ::handle anArray = new Graphic3d_ArrayOfPoints (theVerticiesMaxCount); // add vertices to the array anArray->AddVertex (10.0, 10.0, 10.0); anArray->AddVertex (0.0, 10.0, 10.0); // add the array to the structure -Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); +occ::handle aGroup = thePrs->NewGroup(); aGroup->AddPrimitiveArray (anArray); aGroup->SetGroupPrimitivesAspect (myDrawer->PointAspect()->Aspect()); ~~~~ @@ -1400,7 +1400,7 @@ The following example shows how to define an array of triangles: ~~~~{.cpp} // create an array -Handle(Graphic3d_ArrayOfTriangles) anArray = new Graphic3d_ArrayOfTriangles (theVerticesMaxCount, theEdgesMaxCount, Graphic3d_ArrayFlags_None); +occ::handle anArray = new Graphic3d_ArrayOfTriangles (theVerticesMaxCount, theEdgesMaxCount, Graphic3d_ArrayFlags_None); // add vertices to the array anArray->AddVertex (-1.0, 0.0, 0.0); // vertex 1 anArray->AddVertex ( 1.0, 0.0, 0.0); // vertex 2 @@ -1412,7 +1412,7 @@ anArray->AddEdges (1, 2, 3); // first triangle anArray->AddEdges (1, 2, 4); // second triangle // add the array to the structure -Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); +occ::handle aGroup = thePrs->NewGroup(); aGroup->AddPrimitiveArray (anArray); aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect()); ~~~~ @@ -1428,8 +1428,8 @@ aGroup->SetGroupPrimitivesAspect (myDrawer->ShadingAspect()->Aspect()); The text attributes for the group could be defined with the *Graphic3d_AspectText3d* attributes group. To add any text to the graphic structure you can use the following methods: ~~~~{.cpp} -void Graphic3d_Group::AddText (const Handle(Graphic3d_Text)& theTextParams, - const Standard_Boolean theToEvalMinMax); +void Graphic3d_Group::AddText (const occ::handle& theTextParams, + const bool theToEvalMinMax); ~~~~ You can pass FALSE as *theToEvalMinMax* if you do not want the Graphic3d structure boundaries to be affected by the text position. @@ -1439,16 +1439,16 @@ You can pass FALSE as *theToEvalMinMax* if you do not want the Graphic3d structu See the example: ~~~~{.cpp} // get the group -Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); +occ::handle aGroup = thePrs->NewGroup(); // change the text aspect -Handle(Graphic3d_AspectText3d) aTextAspect = new Graphic3d_AspectText3d(); +occ::handle aTextAspect = new Graphic3d_AspectText3d(); aTextAspect->SetTextZoomable (true); aTextAspect->SetTextAngle (45.0); aGroup->SetPrimitivesAspect (aTextAspect); // add a text primitive to the structure -Handle(Graphic3d_Text) aText = new Graphic3d_Text (16.0f); +occ::handle aText = new Graphic3d_Text (16.0f); aText->SetText ("Text"); aText->SetPosition (gp_Pnt (1, 1, 1)); aGroup->AddText (aText); @@ -1492,7 +1492,7 @@ To enable custom shader for a specific AIS_Shape in your application, the follow ~~~~{.cpp} // Create shader program -Handle(Graphic3d_ShaderProgram) aProgram = new Graphic3d_ShaderProgram(); +occ::handle aProgram = new Graphic3d_ShaderProgram(); // Attach vertex shader aProgram->AttachShader (Graphic3d_ShaderObject::CreateFromFile (Graphic3d_TOS_VERTEX, "")); @@ -1501,7 +1501,7 @@ aProgram->AttachShader (Graphic3d_ShaderObject::CreateFromFile (Graphic3d_TOS_VE aProgram->AttachShader (Graphic3d_ShaderObject::CreateFromFile (Graphic3d_TOS_FRAGMENT, "")); // Set values for custom uniform variables (if they are) -aProgram->PushVariable ("MyColor", Graphic3d_Vec3 (0.0f, 1.0f, 0.0f)); +aProgram->PushVariable ("MyColor", NCollection_Vec3 (0.0f, 1.0f, 0.0f)); // Set aspect property for specific AIS_Shape theAISShape->Attributes()->ShadingAspect()->Aspect()->SetShaderProgram (aProgram); @@ -1542,45 +1542,45 @@ This sample TEST program for the *V3d* Package uses primary packages *Xw* and *G ~~~~{.cpp} // create a default display connection -Handle(Aspect_DisplayConnection) aDispConnection = new Aspect_DisplayConnection(); +occ::handle aDispConnection = new Aspect_DisplayConnection(); // create a Graphic Driver -Handle(OpenGl_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver (aDispConnection); +occ::handle aGraphicDriver = new OpenGl_GraphicDriver (aDispConnection); // create a Viewer to this Driver -Handle(V3d_Viewer) aViewer = new V3d_Viewer (aGraphicDriver); +occ::handle aViewer = new V3d_Viewer (aGraphicDriver); aViewer->SetDefaultBackgroundColor (Quantity_NOC_DARKVIOLET); // Create a structure in this Viewer -Handle(Graphic3d_Structure) aStruct = new Graphic3d_Structure (aViewer->StructureManager()); +occ::handle aStruct = new Graphic3d_Structure (aViewer->StructureManager()); aStruct->SetVisual (Graphic3d_TOS_SHADING); // Type of structure // Create a group of primitives in this structure -Handle(Graphic3d_Group) aPrsGroup = aStruct->NewGroup(); +occ::handle aPrsGroup = aStruct->NewGroup(); // Fill this group with one quad of size 100 -Handle(Graphic3d_ArrayOfTriangleStrips) aTriangles = new Graphic3d_ArrayOfTriangleStrips (4); +occ::handle aTriangles = new Graphic3d_ArrayOfTriangleStrips (4); aTriangles->AddVertex (-100./2., -100./2., 0.0); aTriangles->AddVertex (-100./2., 100./2., 0.0); aTriangles->AddVertex ( 100./2., -100./2., 0.0); aTriangles->AddVertex ( 100./2., 100./2., 0.0); -Handle(Graphic3d_AspectFillArea3d) anAspects = new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID, Quantity_NOC_RED, +occ::handle anAspects = new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID, Quantity_NOC_RED, Quantity_NOC_RED, Aspect_TOL_SOLID, 1.0f, Graphic3d_NameOfMaterial_Gold, Graphic3d_NameOfMaterial_Gold); aPrsGroup->SetGroupPrimitivesAspect (anAspects); aPrsGroup->AddPrimitiveArray (aTriangles); // Create Ambient and Infinite Lights in this Viewer -Handle(V3d_AmbientLight) aLight1 = new V3d_AmbientLight (Quantity_NOC_GRAY50); -Handle(V3d_DirectionalLight) aLight2 = new V3d_DirectionalLight (V3d_Zneg, Quantity_NOC_WHITE, true); +occ::handle aLight1 = new V3d_AmbientLight (Quantity_NOC_GRAY50); +occ::handle aLight2 = new V3d_DirectionalLight (V3d_Zneg, Quantity_NOC_WHITE, true); aViewer->AddLight (aLight1); aViewer->AddLight (aLight2); aViewer->SetLightOn(); // Create a 3D quality Window with the same DisplayConnection -Handle(Xw_Window) aWindow = new Xw_Window (aDispConnection, "Test V3d", 100, 100, 500, 500); +occ::handle aWindow = new Xw_Window (aDispConnection, "Test V3d", 100, 100, 500, 500); aWindow->Map(); // Map this Window to this screen // Create a Perspective View in this Viewer -Handle(V3d_View) aView = new V3d_View (aViewer); +occ::handle aView = new V3d_View (aViewer); aView->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Perspective); // Associate this View with the Window aView->SetWindow (aWindow); @@ -1627,7 +1627,7 @@ The following code configures the camera for orthographic rendering: ~~~~{.cpp} // Create an orthographic View in this Viewer -Handle(V3d_View) aView = new V3d_View (theViewer); +occ::handle aView = new V3d_View (theViewer); aView->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Orthographic); aView->Update(); // update the Visualization in this View ~~~~ @@ -1642,7 +1642,7 @@ The following code configures the camera for perspective rendering: ~~~~{.cpp} // Create a perspective View in this Viewer -Handle(V3d_View) aView = new V3d_View (theViewer); +occ::handle aView = new V3d_View (theViewer); aView->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Perspective); aView->Update(); ~~~~ @@ -1674,16 +1674,16 @@ In a non-stereo camera this effect is not visible because only the same projecti To enable quad buffering support you should provide the following settings to the graphic driver *OpenGl_Caps*: ~~~~{.cpp} -Handle(OpenGl_GraphicDriver) aDriver = new OpenGl_GraphicDriver(); +occ::handle aDriver = new OpenGl_GraphicDriver(); OpenGl_Caps& aCaps = aDriver->ChangeOptions(); -aCaps.contextStereo = Standard_True; +aCaps.contextStereo = true; ~~~~ The following code configures the camera for stereographic rendering: ~~~~{.cpp} // Create a Stereographic View in this Viewer -Handle(V3d_View) aView = new V3d_View (theViewer); +occ::handle aView = new V3d_View (theViewer); aView->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Stereo); // Change stereo parameters aView->Camera()->SetIOD (IODType_Absolute, 5.0); @@ -1694,7 +1694,7 @@ aView->Update(); Other 3D displays are also supported, including row-interlaced with passive glasses and anaglyph glasses - see *Graphic3d_StereoMode* enumeration. Example to activate another stereoscopic display: ~~~~{.cpp} -Handle(V3d_View) theView; +occ::handle theView; theView->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Stereo); theView->ChangeRenderingParams().StereoParams = Graphic3d_StereoMode_RowInterlaced; ~~~~ @@ -1725,16 +1725,16 @@ The gradient background style could be set up with the following method: void V3d_View::SetBgGradientColors (const Quantity_Color& theColor1, const Quantity_Color& theColor2, const Aspect_GradientFillMethod theFillStyle, - const Standard_Boolean theToUpdate = false); + const bool theToUpdate = false); ~~~~ The *theColor1* and *theColor2* parameters define the boundary colors of interpolation, the *theFillStyle* parameter defines the direction of interpolation. To set the image as a background and change the background image style you can use the following method: ~~~~{.cpp} -void V3d_View::SetBackgroundImage (const Standard_CString theFileName, +void V3d_View::SetBackgroundImage (const char* theFileName, const Aspect_FillMethod theFillStyle, - const Standard_Boolean theToUpdate = false); + const bool theToUpdate = false); ~~~~ The *theFileName* parameter defines the image file name and the path to it, the *theFillStyle* parameter defines the method of filling the background with the image. @@ -1749,7 +1749,7 @@ The methods are: The 3D scene displayed in the view can be dumped into image file with resolution independent from window size (using offscreen buffer). The *V3d_View* has the following methods for dumping the 3D scene: ~~~~{.cpp} -Standard_Boolean V3d_View::Dump (const Standard_CString theFile, +bool V3d_View::Dump (const char* theFile, const Image_TypeOfImage theBufferType); ~~~~ Dumps the scene into an image file with the view dimensions. @@ -1759,7 +1759,7 @@ The value passed as *theBufferType* argument defines the type of the buffer for Method returns TRUE if the scene has been successfully dumped. ~~~~{.cpp} -Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage, +bool V3d_View::ToPixMap (Image_PixMap& theImage, const V3d_ImageDumpOptions& theParams); ~~~~ Dumps the displayed 3d scene into a pixmap with a width and height passed through parameters structure *theParams*. @@ -1830,9 +1830,9 @@ Example: ~~~~{.cpp} // set z-layer to an interactive object -Handle(AIS_InteractiveContext) theContext; -Handle(AIS_InteractiveObject) theInterObj; -Standard_Integer anId = -1; +occ::handle theContext; +occ::handle theInterObj; +int anId = -1; aViewer->AddZLayer (anId); theContext->SetZLayer (theInterObj, anId); ~~~~ @@ -1916,7 +1916,7 @@ gp_Pln Graphic3d_ClipPlane::ToPlane() const The clipping planes can be activated with the following method: ~~~~{.cpp} -void Graphic3d_ClipPlane::SetOn (const Standard_Boolean theIsOn) +void Graphic3d_ClipPlane::SetOn (const bool theIsOn) ~~~~ The number of clipping planes is limited. @@ -1924,15 +1924,15 @@ You can check the limit value via method *Graphic3d_GraphicDriver::InquireLimit( ~~~~{.cpp} // get the limit of clipping planes for the current view -Standard_Integer aMaxClipPlanes = aView->Viewer()->Driver()->InquireLimit (Graphic3d_TypeOfLimit_MaxNbClipPlanes); +int aMaxClipPlanes = aView->Viewer()->Driver()->InquireLimit (Graphic3d_TypeOfLimit_MaxNbClipPlanes); ~~~~ Let us see for example how to create a new clipping plane with custom parameters and add it to a view or to an object: ~~~~{.cpp} // create a new clipping plane -Handle(Graphic3d_ClipPlane) aClipPlane = new Graphic3d_ClipPlane(); +occ::handle aClipPlane = new Graphic3d_ClipPlane(); // change equation of the clipping plane -Standard_Real aCoeffA, aCoeffB, aCoeffC, aCoeffD = ... +double aCoeffA, aCoeffB, aCoeffC, aCoeffD = ... aClipPlane->SetEquation (gp_Pln (aCoeffA, aCoeffB, aCoeffC, aCoeffD)); // set capping aClipPlane->SetCapping (aCappingArg == "on"); @@ -1943,17 +1943,17 @@ aMat.SetAmbientColor (aColor); aMat.SetDiffuseColor (aColor); aClipPlane->SetCappingMaterial (aMat); // set the texture of clipping plane -Handle(Graphic3d_Texture2Dmanual) aTexture = ... +occ::handle aTexture = ... aTexture->EnableModulate(); aTexture->EnableRepeat(); aClipPlane->SetCappingTexture (aTexture); // add the clipping plane to an interactive object -Handle(AIS_InteractiveObject) aIObj = ... +occ::handle aIObj = ... aIObj->AddClipPlane (aClipPlane); // or to the whole view aView->AddClipPlane (aClipPlane); // activate the clipping plane -aClipPlane->SetOn (Standard_True); +aClipPlane->SetOn (true); // update the view aView->Update(); ~~~~ @@ -2004,9 +2004,9 @@ Quantity_Color aWhite (Quantity_NOC_WHITE); Create line attributes. ~~~~{.cpp} -Handle(Graphic3d_AspectLine3d) anAspectBrown = new Graphic3d_AspectLine3d(); -Handle(Graphic3d_AspectLine3d) anAspectBlue = new Graphic3d_AspectLine3d(); -Handle(Graphic3d_AspectLine3d) anAspectWhite = new Graphic3d_AspectLine3d(); +occ::handle anAspectBrown = new Graphic3d_AspectLine3d(); +occ::handle anAspectBlue = new Graphic3d_AspectLine3d(); +occ::handle anAspectWhite = new Graphic3d_AspectLine3d(); anAspectBrown->SetColor (aBrown); anAspectBlue ->SetColor (aBlue); anAspectWhite->SetColor (aWhite); @@ -2014,7 +2014,7 @@ anAspectWhite->SetColor (aWhite); Create marker attributes. ~~~~{.cpp} -Handle(Graphic3d_AspectMarker3d aFirebrickMarker = new Graphic3d_AspectMarker3d(); +occ::handle aFirebrickMarker = new Graphic3d_AspectMarker3d(); // marker attributes aFirebrickMarker->SetColor (Firebrick); aFirebrickMarker->SetScale (1.0f); @@ -2025,7 +2025,7 @@ aFirebrickMarker->SetMarkerImage (theImage) Create facet attributes. ~~~~{.cpp} -Handle(Graphic3d_AspectFillArea3d) aFaceAspect = new Graphic3d_AspectFillArea3d(); +occ::handle aFaceAspect = new Graphic3d_AspectFillArea3d(); Graphic3d_MaterialAspect aBrassMaterial (Graphic3d_NameOfMaterial_Brass); Graphic3d_MaterialAspect aGoldMaterial (Graphic3d_NameOfMaterial_Gold); aFaceAspect->SetInteriorStyle (Aspect_IS_SOLID_WIREFRAME); @@ -2037,14 +2037,14 @@ aFaceAspect->SetBackMaterial (aBrassMaterial); Create text attributes. ~~~~{.cpp} -Handle(Graphic3d_AspectText3d) aTextAspect = new Graphic3d_AspectText3d (aForest, Font_NOF_MONOSPACE, 1.0, 0.0); +occ::handle aTextAspect = new Graphic3d_AspectText3d (aForest, Font_NOF_MONOSPACE, 1.0, 0.0); ~~~~ @subsubsection occt_visu_4_5_2 Create a 3D Viewer (a Windows example) ~~~~{.cpp} // create a graphic driver -Handle(OpenGl_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver (Handle(Aspect_DisplayConnection)()); +occ::handle aGraphicDriver = new OpenGl_GraphicDriver (occ::handle()); // create a viewer myViewer = new V3d_Viewer (aGraphicDriver); // set parameters for V3d_Viewer @@ -2064,7 +2064,7 @@ a3DViewer->SetDefaultBackgroundColor (Quantity_NOC_BLACK); It is assumed that a valid Windows window may already be accessed via the method *GetSafeHwnd()* (as in case of MFC sample). ~~~~{.cpp} -Handle(WNT_Window) aWNTWindow = new WNT_Window (GetSafeHwnd()); +occ::handle aWNTWindow = new WNT_Window (GetSafeHwnd()); myView = myViewer->CreateView(); myView->SetWindow (aWNTWindow); ~~~~ @@ -2079,7 +2079,7 @@ You are now able to display interactive objects such as an *AIS_Shape*. ~~~~{.cpp} TopoDS_Shape aShape = BRepAPI_MakeBox (10, 20, 30).Solid(); -Handle(AIS_Shape) anAISShape = new AIS_Shape (aShape); +occ::handle anAISShape = new AIS_Shape (aShape); myAISContext->Display (anAISShape, true); ~~~~ @@ -2096,15 +2096,15 @@ i.e. in hidden line removal and wireframe modes. Let us look at the example of compute methods ~~~~{.cpp} -void MyPresentableObject::Compute (const Handle(PrsMgr_PresentationManager)& thePrsManager, - const Handle(Graphic3d_Structure)& thePrs, - const Standard_Integer theMode) +void MyPresentableObject::Compute (const occ::handle& thePrsManager, + const occ::handle& thePrs, + const int theMode) ( //... ) -void MyPresentableObject::Compute (const Handle(Prs3d_Projector)& theProjector, - const Handle(Graphic3d_Structure)& thePrs) +void MyPresentableObject::Compute (const occ::handle& theProjector, + const occ::handle& thePrs) ( //... ) @@ -2115,7 +2115,7 @@ void MyPresentableObject::Compute (const Handle(Prs3d_Projector)& theProjector, Get the group used in *Graphic3d_Structure*. ~~~~{.cpp} -Handle(Graphic3d_Group) aGroup = thePrs->NewGroup(); +occ::handle aGroup = thePrs->NewGroup(); ~~~~ Update the group attributes. @@ -2127,9 +2127,9 @@ aGroup->SetGroupPrimitivesAspect (anAspectBlue); Create two triangles in *aGroup*. ~~~~{.cpp} -Standard_Integer aNbTria = 2; -Handle(Graphic3d_ArrayOfTriangles) aTriangles = new Graphic3d_ArrayOfTriangles (3 * aNbTria, 0, Graphic3d_ArrayFlags_VertexNormal); -for (Standard_Integer aTriIter = 1; aTriIter <= aNbTria; ++aTriIter) +int aNbTria = 2; +occ::handle aTriangles = new Graphic3d_ArrayOfTriangles (3 * aNbTria, 0, Graphic3d_ArrayFlags_VertexNormal); +for (int aTriIter = 1; aTriIter <= aNbTria; ++aTriIter) { aTriangles->AddVertex (aTriIter * 5., 0., 0., 1., 1., 1.); aTriangles->AddVertex (aTriIter * 5 + 5, 0., 0., 1., 1., 1.); @@ -2142,10 +2142,10 @@ aGroup->SetGroupPrimitivesAspect (new Graphic3d_AspectFillArea3d()); Use the polyline function to create a boundary box for the *thePrs* structure in group *aGroup*. ~~~~{.cpp} -Standard_Real Xm, Ym, Zm, XM, YM, ZM; +double Xm, Ym, Zm, XM, YM, ZM; thePrs->MinMaxValues (Xm, Ym, Zm, XM, YM, ZM); -Handle(Graphic3d_ArrayOfPolylines) aPolylines = new Graphic3d_ArrayOfPolylines (16, 4); +occ::handle aPolylines = new Graphic3d_ArrayOfPolylines (16, 4); aPolylines->AddBound (4); aPolylines->AddVertex (Xm, Ym, Zm); aPolylines->AddVertex (Xm, Ym, ZM); @@ -2180,7 +2180,7 @@ static char* THE_TEXT[3] = "My company", "My company address." }; -Handle(Graphic3d_ArrayOfPoints) aPtsArr = new Graphic3d_ArrayOfPoints (2, 1); +occ::handle aPtsArr = new Graphic3d_ArrayOfPoints (2, 1); aPtsArr->AddVertex (-40.0, -40.0, -40.0); aPtsArr->AddVertex (40.0, 40.0, 40.0); aGroup->AddPrimitiveArray (aPtsArr); @@ -2189,9 +2189,9 @@ aGroup->SetGroupPrimitivesAspect (new Graphic3d_AspectText3d()); Graphic3d_Vertex aMarker (0.0, 0.0, 0.0); for (int i = 0; i <= 2; i++) { - aMarker.SetCoord (-(Standard_Real )i * 4 + 30, - (Standard_Real )i * 4, - -(Standard_Real )i * 4); + aMarker.SetCoord (-(double )i * 4 + 30, + (double )i * 4, + -(double )i * 4); aGroup->Text (THE_TEXT[i], Marker, 20.); } ~~~~ diff --git a/dox/user_guides/xde/xde.md b/dox/user_guides/xde/xde.md index 72056a2e63..aa4bf324c3 100644 --- a/dox/user_guides/xde/xde.md +++ b/dox/user_guides/xde/xde.md @@ -192,7 +192,7 @@ Before working with shapes, properties, and other types of information, the glob To find out if an existing `TDocStd_Document` is suitable for XDE, use: ~~~~{.cpp} -Handle(TDocStd_Document) theDoc; +occ::handle theDoc; if (XCAFDoc_DocumentTool::IsXCAFDocument (theDoc)) { .. yes .. } ~~~~ If the Document is suitable for XDE, you can perform operations and queries explained in this guide. @@ -202,8 +202,8 @@ However, if a Document is not fully structured for XDE, it must be initialized. If you want to retrieve an existing application or an existing document (known to be correctly structured for XDE), use: ~~~~{.cpp} -Handle(TDocStd_Document) aDoc; -Handle(XCAFApp_Application) anApp = XCAFApp_Application::GetApplication(); +occ::handle aDoc; +occ::handle anApp = XCAFApp_Application::GetApplication(); BinXCAFDrivers::DefineFormat (anApp); XmlXCAFDrivers::DefineFormat (anApp); anApp->NewDocument ("BinXCAF", aDoc); @@ -216,8 +216,8 @@ anApp->NewDocument ("BinXCAF", aDoc); An XDE Document begins with a `TDocStd_Document`. Assuming you have a `TDocStd_Document` already created, you can ensure that it is correctly structured for XDE by initializing the XDE structure as follows: ~~~~{.cpp} -Handle(TDocStd_Document) theDoc = ...; -Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool (theDoc->Main()); +occ::handle theDoc = ...; +occ::handle myAssembly = XCAFDoc_DocumentTool::ShapeTool (theDoc->Main()); TDF_Label aLabel = myAssembly->NewShape(); ~~~~ **Note** that the method `XCAFDoc_DocumentTool::ShapeTool` returns the `XCAFDoc_ShapeTool`. @@ -229,8 +229,8 @@ In our example, a handle is used for the `TDocStd_Document`. To get a node considered as an Assembly from an XDE structure, you can use the Label of the node. Assuming that you have a properly initialized `TDocStd_Document`, use: ~~~~{.cpp} -Handle(TDocStd_Document) theDoc = ...; -Handle(XCAFDoc_ShapeTool) myAssembly = XCAFDoc_DocumentTool::ShapeTool (aLabel); +occ::handle theDoc = ...; +occ::handle myAssembly = XCAFDoc_DocumentTool::ShapeTool (aLabel); ~~~~ In the previous example, you can also get the Main Item of an XDE document, which records the root shape representation (as a Compound if it is an Assembly) by using `XCAFDoc_DocumentTool::ShapeTool(theDoc->Main())` instead of `XCAFDoc_DocumentTool::ShapeTool(aLabel)`. @@ -340,7 +340,7 @@ if (myAssembly->IsTopLevel (aLabel)) { .. yes .. } To get a list of top-level shapes added by the `XCAFDoc_ShapeTool::AddShape` method, use: ~~~~{.cpp} -TDF_LabelSequence aFreeShapes; +NCollection_Sequence aFreeShapes; myAssembly->GetShapes (aFreeShapes); ~~~~ @@ -355,7 +355,7 @@ If there is more than one item, you must create and fill a compound, use: TopoDS_Compound aComp; BRep_Builder aBuilder; aBuilder.MakeCompound (aComp); -for (TDF_LabelSequence::Iterator aLabIter (aFreeShapes); aLabIter.More(); aLabIter.Next()) +for (NCollection_Sequence::Iterator aLabIter (aFreeShapes); aLabIter.More(); aLabIter.Next()) { TopoDS_Shape aShape = myAssembly->GetShape (aLabIter.Value()); aBuilder.Add (aComp, aShape); @@ -372,14 +372,14 @@ if (myAssembly->IsFree (aLabel)) { .. yes .. } To get a list of Free Shapes (roots), use: ~~~~{.cpp} -TDF_LabelSequence aFreeShapes; +NCollection_Sequence aFreeShapes; myAssembly->GetFreeShapes (aFreeShapes); ~~~~ To get the shapes, which use a given shape as a component, use: ~~~~{.cpp} -TDF_LabelSequence aUsers; -Standard_Integer aNbUsers = myAssembly->GetUsers (aLabel, aUsers); +NCollection_Sequence aUsers; +int aNbUsers = myAssembly->GetUsers (aLabel, aUsers); ~~~~ The count of `aUsers` is contained with `aNbUsers`. It contains `0` if there are no users. @@ -398,7 +398,7 @@ if (myAssembly->IsAssembly (aLabel)) { .. yes .. } If the label is a node of a (sub-) assembly, you can get the count of components, use: ~~~~{.cpp} bool subchilds = false; // default -Standard_Integer nbc = myAssembly->NbComponents (aLabel [,subchilds]); +int nbc = myAssembly->NbComponents (aLabel [,subchilds]); ~~~~ If `subchilds` is `True`, commands also consider sub-levels. By default, only level one is checked. @@ -406,7 +406,7 @@ If `subchilds` is `True`, commands also consider sub-levels. By default, only le To get component Labels themselves, use: ~~~~{.cpp} bool subchilds = false; // default -TDF_LabelSequence aComps; +NCollection_Sequence aComps; bool isassembly = myAssembly->GetComponents (aLabel, aComps [,subchilds]); ~~~~ @@ -491,7 +491,7 @@ In any case, the search stops on the first one found. To get the sub-shapes of a shape, which are recorded under a label, use: ~~~~{.cpp} -TDF_LabelSequence aSubshapes; +NCollection_Sequence aSubshapes; bool hasSubshapes = myAssembly->GetSubShapes (aLabel, aSubShapes); ~~~~ @@ -535,7 +535,7 @@ What is specific to data exchange is the way names are attached to entities. To get the name attached to a label (as a reminder using OCAF), use: ~~~~{.cpp} -Handle(TDataStd_Name) aNameAttr; +occ::handle aNameAttr; if (!aLabel.FindAttribute (TDataStd_Name::GetID(), aNameAttr)) { // no name is attached @@ -568,7 +568,7 @@ A centroid can be determined at any level of an assembly, thereby allowing a che To get a Centroid attached to a Shape, use: ~~~~{.cpp} gp_Pnt aPos; -Handle(XCAFDoc_Centroid) aCentAttr; +occ::handle aCentAttr; aLabel.FindAttribute (XCAFDoc_Centroid::GetID(), aCentAttr); if (!aCentAttr.IsNull()) aPos = aCentAttr->Get(); ~~~~ @@ -589,8 +589,8 @@ In addition, it is attached to simple shapes, not to assemblies. To get an area attached to a Shape, use: ~~~~{.cpp} -Standard_Real anArea = 0.0; -Handle(XCAFDoc_Area) anAreaAttr; +double anArea = 0.0; +occ::handle anAreaAttr; aLabel.FindAttribute (XCAFDoc_Area::GetID(), anAreaAttr); if (!anAreaAttr.IsNull()) anArea = anAreaAttr->Get(); ~~~~ @@ -598,7 +598,7 @@ if (!anAreaAttr.IsNull()) anArea = anAreaAttr->Get(); To set an area value to a Shape, use: ~~~~{.cpp} // value previously computed for the area -Standard_Real anArea = ...; +double anArea = ...; XCAFDoc_Area::Set (aLabel, anArea); ~~~~ @@ -611,8 +611,8 @@ It may be attached to simple shapes or their assemblies for computing cumulated To get a Volume attached to a Shape, use: ~~~~{.cpp} -Standard_Real aVolume = 0.0; -Handle(XCAFDoc_Volume) aVolAttr; +double aVolume = 0.0; +occ::handle aVolAttr; aLabel.FindAttribute (XCAFDoc_Volume::GetID(), aVolAttr); if (!aVolAttr.IsNull()) aVolume = aVolAttr->Get(); ~~~~ @@ -620,7 +620,7 @@ if (!aVolAttr.IsNull()) aVolume = aVolAttr->Get(); To set a volume value to a Shape, use: ~~~~{.cpp} // value previously computed for the volume -Standard_Real aVolume = ...; +double aVolume = ...; XCAFDoc_Volume::Set (aLabel, aVolume); ~~~~ @@ -659,7 +659,7 @@ These definitions are common to various exchange formats, at least for STEP and To query, edit, or initialize a Document to handle Colors of XCAF, use: ~~~~{.cpp} -Handle(XCAFDoc_ColorTool) myColors = XCAFDoc_DocumentTool::ColorTool (theDoc->Main()); +occ::handle myColors = XCAFDoc_DocumentTool::ColorTool (theDoc->Main()); ~~~~ This call can be used at any time. The first time it is used, a relevant structure is added to the document. @@ -741,9 +741,9 @@ if (!myColors->GetColor (aLabel, aColType, aCol)) To get all the Colors recorded in the Document, use: ~~~~{.cpp} -TDF_LabelSequence aColLabels; +NCollection_Sequence aColLabels; myColors->GetColors (aColLabels); -for (TDF_LabelSequence::Iterator aColIter (aColLabels); aColIter.More(); aColIter.Next()) +for (NCollection_Sequence::Iterator aColIter (aColLabels); aColIter.More(); aColIter.Next()) { Quantity_Color aCol; // to receive the values TDF_Label aColLabel = aColIter.Value(); @@ -804,7 +804,7 @@ These definitions are common to various exchange formats, at least for STEP. To query, edit, or initialize a Document to handle GD\&Ts of XCAF, use: ~~~~{.cpp} -Handle(XCAFDoc_DimTolTool) myDimTolTool = XCAFDoc_DocumentTool::DimTolTool (theDoc->Main()); +occ::handle myDimTolTool = XCAFDoc_DocumentTool::DimTolTool (theDoc->Main()); ~~~~ This call can be used at any time. @@ -836,11 +836,11 @@ A similar approach can be used for other GD\&T types. A newly added GD\&T entity is empty. To set its data a corresponding access object should be used as it is demonstrated below, where the dimension becomes a linear distance between two points. ~~~~{.cpp} -Handle(XCAFDoc_Dimension) aDimAttr; +occ::handle aDimAttr; aDimLabel.FindAttribute (XCAFDoc_Dimension::GetID(), aDimAttr); if (!aDimAttr.IsNull()) { - Handle(XCAFDimTolObjects_DimensionObject) aDimObject = aDimAttr->GetObject(); + occ::handle aDimObject = aDimAttr->GetObject(); // set dimension data aDimObject->SetType(XCAFDimTolObjects_DimensionType_Location_LinearDistance); aDimObject->SetPoint(thePnt1); // the first reference point @@ -865,7 +865,7 @@ All previous links will be removed. The example below demonstrates linking of a dimension to sequences of shape labels: ~~~~{.cpp} -TDF_LabelSequence aShapes1, aShapes2; +NCollection_Sequence aShapes1, aShapes2; aShapes1.Append (aShape11); //... aShapes2.Append (aShape21); @@ -907,7 +907,7 @@ Clipping planes are stored in a child of the starting document label `0.1.8`, wh To query, edit, or initialize a Document to handle clipping planes of XCAF, use: ~~~~{.cpp} -Handle(XCAFDoc_ClippingPlaneTool) myClipPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool (theDoc->Main()); +occ::handle myClipPlaneTool = XCAFDoc_DocumentTool::ClippingPlaneTool (theDoc->Main()); ~~~~ This call can be used at any time. @@ -916,7 +916,7 @@ When it is used for the first time, a relevant structure is added to the documen To add a clipping plane use one of overloaded methods `XCAFDoc_ClippingPlaneTool::AddClippingPlane`, e.g.: ~~~~{.cpp} gp_Pln aPln = ...; -Standard_Boolean aCapping = ...; +bool aCapping = ...; TDF_Label aClipPlnLbl = myClipPlaneTool->AddClippingPlane (aPln, "Name of plane", aCapping); if (aClipPlnLbl.IsNull()) { @@ -942,23 +942,23 @@ myClipPlaneTool->UpdateClippingPlane (aClipPlnLbl, aPln, "New name of plane"); Capping property can be changed using `XCAFDoc_ClippingPlaneTool::SetCapping` method, e.g.: ~~~~{.cpp} -Standard_Boolean aCapping = ...; +bool aCapping = ...; myClipPlaneTool->SetCapping (aClipPlnLbl, aCapping); ~~~~ `XCAFDoc_ClippingPlaneTool` can be used to get all clipping plane labels and to check if a label belongs to the *ClippingPlane table*, e.g.: ~~~~{.cpp} -TDF_LabelSequence aClipPlaneLbls; +NCollection_Sequence aClipPlaneLbls; myClipPlaneTool->GetClippingPlanes(aClipPlaneLbls); ... -for (TDF_LabelSequence::Iterator anIt(aClipPlaneLbls); anIt.More(); anIt.Next()) +for (NCollection_Sequence::Iterator anIt(aClipPlaneLbls); anIt.More(); anIt.Next()) { if (myClipPlaneTool->IsClippingPlane(anIt.Value())) { // the label is a clipping plane gp_Pln aPln; TCollection_ExtendedString aName; - Standard_Boolean aCapping; + bool aCapping; if (!myClipPlaneTool->GetClippingPlane(anIt.Value(), aPln, aName, aCapping)) { // error processing @@ -978,7 +978,7 @@ Views and selected shapes, clipping planes, GD\&Ts and notes are related by Grap To query, edit, or initialize a Document to handle views of XCAF, use: ~~~~{.cpp} -Handle(XCAFDoc_ViewTool) myViewTool = XCAFDoc_DocumentTool::ViewTool (theDoc->Main()); +occ::handle myViewTool = XCAFDoc_DocumentTool::ViewTool (theDoc->Main()); ~~~~ This call can be used at any time. @@ -991,11 +991,11 @@ if (aViewLbl.IsNull()) { // error processing } -Handle(XCAFDoc_View) aViewAttr; +occ::handle aViewAttr; aViewLbl.FindAttribute(XCAFDoc_View::GetID(), aViewAttr); if (!aViewAttr.IsNull()) { - Handle(XCAFView_Object) aViewObject = aViewAttr->GetObject(); + occ::handle aViewObject = aViewAttr->GetObject(); // set view data aViewObject->SetType(XCAFView_ProjectionType_Parallel); aViewObject->SetViewDirection(theViewDir); @@ -1008,10 +1008,10 @@ if (!aViewAttr.IsNull()) To set shapes, clipping planes, GD\&Ts and notes selected for the view use one of overloaded `SetView` methods of `XCAFDoc_ViewTool`. To set only clipping planes one should use `XCAFDoc_ViewTool::SetClippingPlanes` method. ~~~~{.cpp} -TDF_LabelSequence aShapes; ... -TDF_LabelSequence aGDTs; ... +NCollection_Sequence aShapes; ... +NCollection_Sequence aGDTs; ... myViewTool->SetView(aShapes, aGDTs, aViewLbl); -TDF_LabelSequence aClippingPlanes; ... +NCollection_Sequence aClippingPlanes; ... myViewTool->SetClippingPlanes(aClippingPlanes, aViewLbl); ~~~~ @@ -1019,10 +1019,10 @@ To remove a view use `XCAFDoc_ViewTool::RemoveView` method. To get all view labels and check if a label belongs to the View table use: ~~~~{.cpp} -TDF_LabelSequence aViewLbls; +NCollection_Sequence aViewLbls; myViewTool->GetViewLabels(aViewLbls); ... -for (TDF_LabelSequence::Iterator anIt(aViewLbls); anIt.More(); anIt.Next()) +for (NCollection_Sequence::Iterator anIt(aViewLbls); anIt.More(); anIt.Next()) { if (myViewTool->IsView(anIt.Value())) { @@ -1065,7 +1065,7 @@ Notes binding is done through `XCAFDoc_GraphNode` attribute. To query, edit, or initialize a Document to handle custom notes of XCAF, use: ~~~~{.cpp} -Handle(XCAFDoc_NotesTool) myNotes = XCAFDoc_DocumentTool::NotesTool (theDoc->Main()); +occ::handle myNotes = XCAFDoc_DocumentTool::NotesTool (theDoc->Main()); ~~~~ This call can be used at any time. @@ -1080,8 +1080,8 @@ Before annotating a Document item a note must be created using one of the follow Both methods return an instance of `XCAFDoc_Note` class. ~~~~{.cpp} -Handle(XCAFDoc_NotesTool) myNotes = ...; -Handle(XCAFDoc_Note) myNote = myNotes->CreateComment ("User", "Timestamp", "Hello, World!"); +occ::handle myNotes = ...; +occ::handle myNote = myNotes->CreateComment ("User", "Timestamp", "Hello, World!"); ~~~~ This code adds a child label to label `0.1.9.1` with `XCAFDoc_NoteComment` attribute. @@ -1096,7 +1096,7 @@ myNote->Set("New User", "New Timestamp"); To change specific data one needs to down cast `myNote` handle to the appropriate sub-class: ~~~~{.cpp} -Handle(XCAFDoc_NoteComment) myCommentNote = Handle(XCAFDoc_NoteComment)::DownCast(myNote); +occ::handle myCommentNote = occ::down_cast(myNote); if (!myCommentNote.IsNull()) { myCommentNote->Set("New comment"); @@ -1113,7 +1113,7 @@ one should use a transfer object `XCAFNoteObjects_NoteObject` by GetObject and S After getting, the transfer object can be edited and set back to the note: ~~~~{.cpp} -Handle(XCAFNoteObjects_NoteObject) aNoteObj = myNote->GetObject(); +occ::handle aNoteObj = myNote->GetObject(); if (!aNoteObj.IsNull()) { gp_Pnt aPntTxt (...); @@ -1133,14 +1133,14 @@ Once a note has been created it can be bound to a Document item using the follow All methods return a pointer to `XCAFDoc_AssemblyItemRef` attribute identifying the annotated item. ~~~~{.cpp} -Handle(XCAFDoc_NotesTool) myNotes = ...; -Handle(XCAFDoc_Note) myNote = ...; +occ::handle myNotes = ...; +occ::handle myNote = ...; TDF_Label theLabel = ...; -Handle(XCAFDoc_AssemblyItemRef) myRef = myNotes->AddNote(myNote->Label(), theLabel); +occ::handle myRef = myNotes->AddNote(myNote->Label(), theLabel); Standard_GUID theAttrGUID = ...; -Handle(XCAFDoc_AssemblyItemRef) myRefAttr = myNotes->AddNoteToAttr(myNote->Label(), theAttrGUID); -Standard_Integer theSubshape = 1; -Handle(XCAFDoc_AssemblyItemRef) myRefSubshape = myNotes->AddNoteToSubshape(myNote->Label(), theSubshape); +occ::handle myRefAttr = myNotes->AddNoteToAttr(myNote->Label(), theAttrGUID); +int theSubshape = 1; +occ::handle myRefSubshape = myNotes->AddNoteToSubshape(myNote->Label(), theSubshape); ~~~~ This code adds three child labels with `XCAFDoc_AssemblyItemRef` attribute to label `0.1.9.2`. @@ -1154,12 +1154,12 @@ To find annotation labels under label `0.1.9.2` use the following `XCAFDoc_Notes - `XCAFDoc_NotesTool::FindAnnotatedItemSubshape`: returns an annotation label for a sub-shape. ~~~~{.cpp} -Handle(XCAFDoc_NotesTool) myNotes = ...; +occ::handle myNotes = ...; TDF_Label theLabel = ...; TDF_Label myLabel = myNotes->FindAnnotatedItem(theLabel); Standard_GUID theAttrGUID = ...; TDF_Label myLabelAttr = myNotes->FindAnnotatedItemAttr(theLabel, theAttrGUID); -Standard_Integer theSubshape = 1; +int theSubshape = 1; TDF_Label myLabelSubshape = myNotes->FindAnnotatedItemSubshape(theLabel, theSubshape); ~~~~ @@ -1172,15 +1172,15 @@ To get all notes of the Document item use the following `XCAFDoc_NotesTool` meth All these methods return the number of notes. ~~~~{.cpp} -Handle(XCAFDoc_NotesTool) myNotes = ...; +occ::handle myNotes = ...; TDF_Label theLabel = ...; -TDF_LabelSequence theNotes; +NCollection_Sequence theNotes; myNotes->GetNotes(theLabel, theNotes); Standard_GUID theAttrGUID = ...; -TDF_LabelSequence theNotesAttr; +NCollection_Sequence theNotesAttr; myNotes->GetAttrNotes(theLabel, theAttrGUID, theNotesAttr); -Standard_Integer theSubshape = 1; -TDF_LabelSequence theNotesSubshape; +int theSubshape = 1; +NCollection_Sequence theNotesSubshape; myNotes->GetAttrSubshape(theLabel, theSubshape, theNotesSubshape); ~~~~ @@ -1192,12 +1192,12 @@ To remove a note use one of the following `XCAFDoc_NotesTool` methods: - `XCAFDoc_NotesTool::RemoveSubshapeNote`: unbinds a note from a sub-shape. ~~~~{.cpp} -Handle(XCAFDoc_Note) myNote = ...; +occ::handle myNote = ...; TDF_Label theLabel = ...; myNotes->RemoveNote(myNote->Label(), theLabel); Standard_GUID theAttrGUID = ...; myRefAttr = myNotes->RemoveAttrNote(myNote->Label(), theAttrGUID); -Standard_Integer theSubshape = 1; +int theSubshape = 1; myNotes->RemoveSubshapeNote(myNote->Label(), theSubshape); ~~~~ A note will not be deleted automatically. @@ -1244,7 +1244,7 @@ IFSelect_ReturnStatus aReadStat = aReader.ReadFile (theFilename); if (aReadStat != IFSelect_RetDone) { .. reader/parser error .. } // the various ways of reading a file are available here too: // to read it by the reader, to take it from a WorkSession ... -Handle(TDocStd_Document) aDoc = ...; +occ::handle aDoc = ...; // the document referred to is already defined and properly initialized; now, the transfer itself if (!aReader.Transfer (aDoc)) {